remove unused go-lxc vendored library
This commit is contained in:
parent
62a7f951c0
commit
04f787d3fa
16
vendor/gopkg.in/lxc/go-lxc.v2/AUTHORS
generated
vendored
16
vendor/gopkg.in/lxc/go-lxc.v2/AUTHORS
generated
vendored
|
@ -1,16 +0,0 @@
|
|||
# This is the official list of Go-LXC authors for copyright purposes.
|
||||
|
||||
# Names should be added to this file as
|
||||
#Name or Organization <email address>
|
||||
# The email address is not required for organizations.
|
||||
|
||||
# Please keep the list sorted.
|
||||
|
||||
David Cramer <cramer@dropbox.com>
|
||||
Fatih Arslan <fatih@koding.com>
|
||||
Kelsey Hightower <kelsey.hightower@gmail.com>
|
||||
S.Çağlar Onur <caglar@10ur.org>
|
||||
Serge Hallyn <serge.hallyn@ubuntu.com>
|
||||
Stéphane Graber <stgraber@ubuntu.com>
|
||||
Syed <syed1.mushtaq@gmail.com>
|
||||
Tycho Andersen <tycho.andersen@canonical.com>
|
522
vendor/gopkg.in/lxc/go-lxc.v2/LICENSE
generated
vendored
522
vendor/gopkg.in/lxc/go-lxc.v2/LICENSE
generated
vendored
|
@ -1,522 +0,0 @@
|
|||
This software is licensed under the LGPLv2.1, included below.
|
||||
|
||||
As a special exception to the GNU Lesser General Public License version 2.1
|
||||
("LGPL2.1"), the copyright holders of this Library give you permission to
|
||||
convey to a third party a Combined Work that links statically or dynamically
|
||||
to this Library without providing any Minimal Corresponding Source or
|
||||
Minimal Application Code or providing the installation information,
|
||||
provided that you comply with the other provisions of LGPL2.1
|
||||
and provided that you meet, for the Application the terms and conditions
|
||||
of the license(s) which apply to the Application.
|
||||
|
||||
Except as stated in this special exception, the provisions of LGPL2.1 will
|
||||
continue to comply in full to this Library. If you modify this Library, you
|
||||
may apply this exception to your version of this Library, but you are not
|
||||
obliged to do so. If you do not wish to do so, delete this exception
|
||||
statement from your version. This exception does not (and cannot) modify any
|
||||
license terms which apply to the Application, with which you must still
|
||||
comply.
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
60
vendor/gopkg.in/lxc/go-lxc.v2/Makefile
generated
vendored
60
vendor/gopkg.in/lxc/go-lxc.v2/Makefile
generated
vendored
|
@ -1,60 +0,0 @@
|
|||
NO_COLOR=\033[0m
|
||||
OK_COLOR=\033[0;32m
|
||||
|
||||
all: format vet lint
|
||||
|
||||
format:
|
||||
@echo "$(OK_COLOR)==> Formatting the code $(NO_COLOR)"
|
||||
@gofmt -s -w *.go
|
||||
@goimports -w *.go || true
|
||||
|
||||
test:
|
||||
@echo "$(OK_COLOR)==> Running go test $(NO_COLOR)"
|
||||
@sudo `which go` test -v
|
||||
|
||||
test-race:
|
||||
@echo "$(OK_COLOR)==> Running go test $(NO_COLOR)"
|
||||
@sudo `which go` test -race -v
|
||||
|
||||
test-unprivileged:
|
||||
@echo "$(OK_COLOR)==> Running go test for unprivileged user$(NO_COLOR)"
|
||||
@`which go` test -v
|
||||
|
||||
test-unprivileged-race:
|
||||
@echo "$(OK_COLOR)==> Running go test for unprivileged user$(NO_COLOR)"
|
||||
@`which go` test -race -v
|
||||
|
||||
cover:
|
||||
@sudo `which go` test -v -coverprofile=coverage.out
|
||||
@`which go` tool cover -func=coverage.out
|
||||
|
||||
doc:
|
||||
@`which godoc` gopkg.in/lxc/go-lxc.v2 | less
|
||||
|
||||
vet:
|
||||
@echo "$(OK_COLOR)==> Running go vet $(NO_COLOR)"
|
||||
@`which go` vet .
|
||||
|
||||
lint:
|
||||
@echo "$(OK_COLOR)==> Running golint $(NO_COLOR)"
|
||||
@`which golint` . || true
|
||||
|
||||
escape-analysis:
|
||||
@go build -gcflags -m
|
||||
|
||||
ctags:
|
||||
@ctags -R --languages=c,go
|
||||
|
||||
scope:
|
||||
@echo "$(OK_COLOR)==> Exported container calls in container.go $(NO_COLOR)"
|
||||
@/bin/grep -E "\bc+\.([A-Z])\w+" container.go || true
|
||||
|
||||
setup-test-cgroup:
|
||||
for d in /sys/fs/cgroup/*; do \
|
||||
[ -f $$d/cgroup.clone_children ] && echo 1 | sudo tee $$d/cgroup.clone_children; \
|
||||
[ -f $$d/cgroup.use_hierarchy ] && echo 1 | sudo tee $$d/cgroup.use_hierarchy; \
|
||||
sudo mkdir -p $$d/lxc; \
|
||||
sudo chown -R $$USER: $$d/lxc; \
|
||||
done
|
||||
|
||||
.PHONY: all format test doc vet lint ctags
|
40
vendor/gopkg.in/lxc/go-lxc.v2/README.md
generated
vendored
40
vendor/gopkg.in/lxc/go-lxc.v2/README.md
generated
vendored
|
@ -1,40 +0,0 @@
|
|||
# Go Bindings for LXC (Linux Containers)
|
||||
|
||||
This package implements [Go](http://golang.org) bindings for the [LXC](http://linuxcontainers.org/) C API (liblxc).
|
||||
|
||||
## Requirements
|
||||
|
||||
This package requires [LXC 1.x](https://github.com/lxc/lxc/releases) and its development package to be installed. Works with [Go 1.x](http://golang.org/dl). Following command should install required dependencies on Ubuntu:
|
||||
|
||||
apt-get install -y pkg-config lxc-dev
|
||||
|
||||
## Installing
|
||||
|
||||
To install it, run:
|
||||
|
||||
go get gopkg.in/lxc/go-lxc.v2
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation can be found at [GoDoc](http://godoc.org/gopkg.in/lxc/go-lxc.v2).
|
||||
|
||||
## Stability
|
||||
|
||||
The package API will remain stable as described in [gopkg.in](https://gopkg.in).
|
||||
|
||||
## Examples
|
||||
|
||||
See the [examples](https://github.com/lxc/go-lxc/tree/v2/examples) directory for some.
|
||||
|
||||
## Contributing
|
||||
|
||||
We'd love to see go-lxc improve. To contribute to go-lxc;
|
||||
|
||||
* **Fork** the repository
|
||||
* **Modify** your fork
|
||||
* Ensure your fork **passes all tests**
|
||||
* **Send** a pull request
|
||||
* Bonus points if the pull request includes *what* you changed, *why* you changed it, and *tests* attached.
|
||||
* For the love of all that is holy, please use `go fmt` *before* you send the pull request.
|
||||
|
||||
We'll review it and merge it in if it's appropriate.
|
1909
vendor/gopkg.in/lxc/go-lxc.v2/container.go
generated
vendored
1909
vendor/gopkg.in/lxc/go-lxc.v2/container.go
generated
vendored
File diff suppressed because it is too large
Load diff
8
vendor/gopkg.in/lxc/go-lxc.v2/doc.go
generated
vendored
8
vendor/gopkg.in/lxc/go-lxc.v2/doc.go
generated
vendored
|
@ -1,8 +0,0 @@
|
|||
/*
|
||||
Package lxc provides Go Bindings for LXC (Linux Containers) C API.
|
||||
|
||||
LXC (LinuX Containers) is an operating system–level virtualization method for running multiple isolated Linux systems (containers) on a single control host.
|
||||
|
||||
LXC combines cgroups and namespace support to provide an isolated environment for applications.
|
||||
*/
|
||||
package lxc
|
86
vendor/gopkg.in/lxc/go-lxc.v2/error.go
generated
vendored
86
vendor/gopkg.in/lxc/go-lxc.v2/error.go
generated
vendored
|
@ -1,86 +0,0 @@
|
|||
// Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved.
|
||||
// Use of this source code is governed by a LGPLv2.1
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux,cgo
|
||||
|
||||
package lxc
|
||||
|
||||
var (
|
||||
ErrAddDeviceNodeFailed = NewError("adding device to container failed")
|
||||
ErrAllocationFailed = NewError("allocating memory failed")
|
||||
ErrAlreadyDefined = NewError("container already defined")
|
||||
ErrAlreadyFrozen = NewError("container is already frozen")
|
||||
ErrAlreadyRunning = NewError("container is already running")
|
||||
ErrAttachFailed = NewError("attaching to the container failed")
|
||||
ErrAttachInterfaceFailed = NewError("attaching specified netdev to the container failed")
|
||||
ErrBlkioUsage = NewError("BlkioUsage for the container failed")
|
||||
ErrCheckpointFailed = NewError("checkpoint failed")
|
||||
ErrClearingConfigItemFailed = NewError("clearing config item for the container failed")
|
||||
ErrClearingCgroupItemFailed = NewError("clearing cgroup item for the container failed")
|
||||
ErrCloneFailed = NewError("cloning the container failed")
|
||||
ErrCloseAllFdsFailed = NewError("setting close_all_fds flag for container failed")
|
||||
ErrCreateFailed = NewError("creating the container failed")
|
||||
ErrCreateSnapshotFailed = NewError("snapshotting the container failed")
|
||||
ErrDaemonizeFailed = NewError("setting daemonize flag for container failed")
|
||||
ErrDestroyAllSnapshotsFailed = NewError("destroying all snapshots failed")
|
||||
ErrDestroyFailed = NewError("destroying the container failed")
|
||||
ErrDestroySnapshotFailed = NewError("destroying the snapshot failed")
|
||||
ErrDestroyWithAllSnapshotsFailed = NewError("destroying the container with all snapshots failed")
|
||||
ErrDetachInterfaceFailed = NewError("detaching specified netdev to the container failed")
|
||||
ErrExecuteFailed = NewError("executing the command in a temporary container failed")
|
||||
ErrFreezeFailed = NewError("freezing the container failed")
|
||||
ErrInsufficientNumberOfArguments = NewError("insufficient number of arguments were supplied")
|
||||
ErrInterfaces = NewError("getting interface names for the container failed")
|
||||
ErrIPAddresses = NewError("getting IP addresses of the container failed")
|
||||
ErrIPAddress = NewError("getting IP address on the interface of the container failed")
|
||||
ErrIPv4Addresses = NewError("getting IPv4 addresses of the container failed")
|
||||
ErrIPv6Addresses = NewError("getting IPv6 addresses of the container failed")
|
||||
ErrKMemLimit = NewError("your kernel does not support cgroup kernel memory controller")
|
||||
ErrLoadConfigFailed = NewError("loading config file for the container failed")
|
||||
ErrMemLimit = NewError("your kernel does not support cgroup memory controller")
|
||||
ErrMemorySwapLimit = NewError("your kernel does not support cgroup swap controller")
|
||||
ErrMethodNotAllowed = NewError("the requested method is not currently supported with unprivileged containers")
|
||||
ErrNewFailed = NewError("allocating the container failed")
|
||||
ErrNoSnapshot = NewError("container has no snapshot")
|
||||
ErrNotDefined = NewError("container is not defined")
|
||||
ErrNotFrozen = NewError("container is not frozen")
|
||||
ErrNotRunning = NewError("container is not running")
|
||||
ErrNotSupported = NewError("method is not supported by this LXC version")
|
||||
ErrRebootFailed = NewError("rebooting the container failed")
|
||||
ErrRemoveDeviceNodeFailed = NewError("removing device from container failed")
|
||||
ErrRenameFailed = NewError("renaming the container failed")
|
||||
ErrRestoreFailed = NewError("restore failed")
|
||||
ErrRestoreSnapshotFailed = NewError("restoring the container failed")
|
||||
ErrSaveConfigFailed = NewError("saving config file for the container failed")
|
||||
ErrSettingCgroupItemFailed = NewError("setting cgroup item for the container failed")
|
||||
ErrSettingConfigItemFailed = NewError("setting config item for the container failed")
|
||||
ErrSettingConfigPathFailed = NewError("setting config file for the container failed")
|
||||
ErrSettingKMemoryLimitFailed = NewError("setting kernel memory limit for the container failed")
|
||||
ErrSettingMemoryLimitFailed = NewError("setting memory limit for the container failed")
|
||||
ErrSettingMemorySwapLimitFailed = NewError("setting memory+swap limit for the container failed")
|
||||
ErrSettingSoftMemoryLimitFailed = NewError("setting soft memory limit for the container failed")
|
||||
ErrShutdownFailed = NewError("shutting down the container failed")
|
||||
ErrSoftMemLimit = NewError("your kernel does not support cgroup memory controller")
|
||||
ErrStartFailed = NewError("starting the container failed")
|
||||
ErrStopFailed = NewError("stopping the container failed")
|
||||
ErrTemplateNotAllowed = NewError("unprivileged users only allowed to use \"download\" template")
|
||||
ErrUnfreezeFailed = NewError("unfreezing the container failed")
|
||||
ErrUnknownBackendStore = NewError("unknown backend type")
|
||||
)
|
||||
|
||||
// Error represents a basic error that implies the error interface.
|
||||
type Error struct {
|
||||
Message string
|
||||
}
|
||||
|
||||
// NewError creates a new error with the given msg argument.
|
||||
func NewError(msg string) error {
|
||||
return &Error{
|
||||
Message: msg,
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Error) Error() string {
|
||||
return e.Message
|
||||
}
|
503
vendor/gopkg.in/lxc/go-lxc.v2/lxc-binding.c
generated
vendored
503
vendor/gopkg.in/lxc/go-lxc.v2/lxc-binding.c
generated
vendored
|
@ -1,503 +0,0 @@
|
|||
// Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved.
|
||||
// Use of this source code is governed by a LGPLv2.1
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux,cgo
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <lxc/lxccontainer.h>
|
||||
#include <lxc/attach_options.h>
|
||||
#include <lxc/version.h>
|
||||
|
||||
#include "lxc-binding.h"
|
||||
|
||||
#ifndef LXC_DEVEL
|
||||
#define LXC_DEVEL 0
|
||||
#endif
|
||||
|
||||
bool go_lxc_defined(struct lxc_container *c) {
|
||||
return c->is_defined(c);
|
||||
}
|
||||
|
||||
const char* go_lxc_state(struct lxc_container *c) {
|
||||
return c->state(c);
|
||||
}
|
||||
|
||||
bool go_lxc_running(struct lxc_container *c) {
|
||||
return c->is_running(c);
|
||||
}
|
||||
|
||||
bool go_lxc_freeze(struct lxc_container *c) {
|
||||
return c->freeze(c);
|
||||
}
|
||||
|
||||
bool go_lxc_unfreeze(struct lxc_container *c) {
|
||||
return c->unfreeze(c);
|
||||
}
|
||||
|
||||
pid_t go_lxc_init_pid(struct lxc_container *c) {
|
||||
return c->init_pid(c);
|
||||
}
|
||||
|
||||
bool go_lxc_want_daemonize(struct lxc_container *c, bool state) {
|
||||
return c->want_daemonize(c, state);
|
||||
}
|
||||
|
||||
bool go_lxc_want_close_all_fds(struct lxc_container *c, bool state) {
|
||||
return c->want_close_all_fds(c, state);
|
||||
}
|
||||
|
||||
bool go_lxc_create(struct lxc_container *c, const char *t, const char *bdevtype, int flags, char * const argv[]) {
|
||||
return c->create(c, t, bdevtype, NULL, !!(flags & LXC_CREATE_QUIET), argv);
|
||||
}
|
||||
|
||||
bool go_lxc_start(struct lxc_container *c, int useinit, char * const argv[]) {
|
||||
return c->start(c, useinit, argv);
|
||||
}
|
||||
|
||||
bool go_lxc_stop(struct lxc_container *c) {
|
||||
return c->stop(c);
|
||||
}
|
||||
|
||||
bool go_lxc_reboot(struct lxc_container *c) {
|
||||
return c->reboot(c);
|
||||
}
|
||||
|
||||
bool go_lxc_shutdown(struct lxc_container *c, int timeout) {
|
||||
return c->shutdown(c, timeout);
|
||||
}
|
||||
|
||||
char* go_lxc_config_file_name(struct lxc_container *c) {
|
||||
return c->config_file_name(c);
|
||||
}
|
||||
|
||||
bool go_lxc_destroy(struct lxc_container *c) {
|
||||
return c->destroy(c);
|
||||
}
|
||||
|
||||
bool go_lxc_destroy_with_snapshots(struct lxc_container *c) {
|
||||
#if VERSION_AT_LEAST(1, 1, 0)
|
||||
return c->destroy_with_snapshots(c);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool go_lxc_wait(struct lxc_container *c, const char *state, int timeout) {
|
||||
return c->wait(c, state, timeout);
|
||||
}
|
||||
|
||||
char *go_lxc_get_config_item(struct lxc_container *c, const char *key)
|
||||
{
|
||||
char *value = NULL;
|
||||
|
||||
int len = c->get_config_item(c, key, NULL, 0);
|
||||
if (len <= 0)
|
||||
return NULL;
|
||||
|
||||
again:
|
||||
value = (char *)malloc(sizeof(char) * len + 1);
|
||||
if (value == NULL)
|
||||
goto again;
|
||||
|
||||
if (c->get_config_item(c, key, value, len + 1) != len) {
|
||||
free(value);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
bool go_lxc_set_config_item(struct lxc_container *c, const char *key, const char *value) {
|
||||
return c->set_config_item(c, key, value);
|
||||
}
|
||||
|
||||
void go_lxc_clear_config(struct lxc_container *c) {
|
||||
c->clear_config(c);
|
||||
}
|
||||
|
||||
bool go_lxc_clear_config_item(struct lxc_container *c, const char *key) {
|
||||
return c->clear_config_item(c, key);
|
||||
}
|
||||
|
||||
char* go_lxc_get_running_config_item(struct lxc_container *c, const char *key) {
|
||||
return c->get_running_config_item(c, key);
|
||||
}
|
||||
|
||||
char *go_lxc_get_keys(struct lxc_container *c, const char *key)
|
||||
{
|
||||
char *value = NULL;
|
||||
|
||||
int len = c->get_keys(c, key, NULL, 0);
|
||||
if (len <= 0)
|
||||
return NULL;
|
||||
|
||||
again:
|
||||
value = (char *)malloc(sizeof(char) * len + 1);
|
||||
if (value == NULL)
|
||||
goto again;
|
||||
|
||||
if (c->get_keys(c, key, value, len + 1) != len) {
|
||||
free(value);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
char *go_lxc_get_cgroup_item(struct lxc_container *c, const char *key)
|
||||
{
|
||||
char *value = NULL;
|
||||
|
||||
int len = c->get_cgroup_item(c, key, NULL, 0);
|
||||
if (len <= 0)
|
||||
return NULL;
|
||||
|
||||
again:
|
||||
value = (char *)malloc(sizeof(char) * len + 1);
|
||||
if (value == NULL)
|
||||
goto again;
|
||||
|
||||
if (c->get_cgroup_item(c, key, value, len + 1) != len) {
|
||||
free(value);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
bool go_lxc_set_cgroup_item(struct lxc_container *c, const char *key, const char *value) {
|
||||
return c->set_cgroup_item(c, key, value);
|
||||
}
|
||||
|
||||
const char* go_lxc_get_config_path(struct lxc_container *c) {
|
||||
return c->get_config_path(c);
|
||||
}
|
||||
|
||||
bool go_lxc_set_config_path(struct lxc_container *c, const char *path) {
|
||||
return c->set_config_path(c, path);
|
||||
}
|
||||
|
||||
bool go_lxc_load_config(struct lxc_container *c, const char *alt_file) {
|
||||
return c->load_config(c, alt_file);
|
||||
}
|
||||
|
||||
bool go_lxc_save_config(struct lxc_container *c, const char *alt_file) {
|
||||
return c->save_config(c, alt_file);
|
||||
}
|
||||
|
||||
bool go_lxc_clone(struct lxc_container *c, const char *newname, const char *lxcpath, int flags, const char *bdevtype) {
|
||||
return c->clone(c, newname, lxcpath, flags, bdevtype, NULL, 0, NULL) != NULL;
|
||||
}
|
||||
|
||||
int go_lxc_console_getfd(struct lxc_container *c, int ttynum) {
|
||||
int masterfd;
|
||||
int ret = 0;
|
||||
|
||||
ret = c->console_getfd(c, &ttynum, &masterfd);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return masterfd;
|
||||
}
|
||||
|
||||
bool go_lxc_console(struct lxc_container *c, int ttynum, int stdinfd, int stdoutfd, int stderrfd, int escape) {
|
||||
|
||||
if (c->console(c, ttynum, stdinfd, stdoutfd, stderrfd, escape) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
char** go_lxc_get_interfaces(struct lxc_container *c) {
|
||||
return c->get_interfaces(c);
|
||||
}
|
||||
|
||||
char** go_lxc_get_ips(struct lxc_container *c, const char *interface, const char *family, int scope) {
|
||||
return c->get_ips(c, interface, family, scope);
|
||||
}
|
||||
|
||||
int wait_for_pid_status(pid_t pid)
|
||||
{
|
||||
int status, ret;
|
||||
|
||||
again:
|
||||
ret = waitpid(pid, &status, 0);
|
||||
if (ret == -1) {
|
||||
if (errno == EINTR)
|
||||
goto again;
|
||||
return -1;
|
||||
}
|
||||
if (ret != pid)
|
||||
goto again;
|
||||
return status;
|
||||
}
|
||||
|
||||
int go_lxc_attach_no_wait(struct lxc_container *c,
|
||||
bool clear_env,
|
||||
int namespaces,
|
||||
long personality,
|
||||
uid_t uid, gid_t gid,
|
||||
int stdinfd, int stdoutfd, int stderrfd,
|
||||
char *initial_cwd,
|
||||
char **extra_env_vars,
|
||||
char **extra_keep_env,
|
||||
const char * const argv[],
|
||||
pid_t *attached_pid) {
|
||||
int ret;
|
||||
|
||||
lxc_attach_options_t attach_options = LXC_ATTACH_OPTIONS_DEFAULT;
|
||||
lxc_attach_command_t command = (lxc_attach_command_t){.program = NULL};
|
||||
|
||||
attach_options.env_policy = LXC_ATTACH_KEEP_ENV;
|
||||
if (clear_env) {
|
||||
attach_options.env_policy = LXC_ATTACH_CLEAR_ENV;
|
||||
}
|
||||
|
||||
attach_options.namespaces = namespaces;
|
||||
attach_options.personality = personality;
|
||||
|
||||
attach_options.uid = uid;
|
||||
attach_options.gid = gid;
|
||||
|
||||
attach_options.stdin_fd = stdinfd;
|
||||
attach_options.stdout_fd = stdoutfd;
|
||||
attach_options.stderr_fd = stderrfd;
|
||||
|
||||
attach_options.initial_cwd = initial_cwd;
|
||||
attach_options.extra_env_vars = extra_env_vars;
|
||||
attach_options.extra_keep_env = extra_keep_env;
|
||||
|
||||
command.program = (char *)argv[0];
|
||||
command.argv = (char **)argv;
|
||||
|
||||
ret = c->attach(c, lxc_attach_run_command, &command, &attach_options, attached_pid);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int go_lxc_attach(struct lxc_container *c,
|
||||
bool clear_env,
|
||||
int namespaces,
|
||||
long personality,
|
||||
uid_t uid, gid_t gid,
|
||||
int stdinfd, int stdoutfd, int stderrfd,
|
||||
char *initial_cwd,
|
||||
char **extra_env_vars,
|
||||
char **extra_keep_env) {
|
||||
int ret;
|
||||
pid_t pid;
|
||||
|
||||
lxc_attach_options_t attach_options = LXC_ATTACH_OPTIONS_DEFAULT;
|
||||
|
||||
attach_options.env_policy = LXC_ATTACH_KEEP_ENV;
|
||||
if (clear_env) {
|
||||
attach_options.env_policy = LXC_ATTACH_CLEAR_ENV;
|
||||
}
|
||||
|
||||
attach_options.namespaces = namespaces;
|
||||
attach_options.personality = personality;
|
||||
|
||||
attach_options.uid = uid;
|
||||
attach_options.gid = gid;
|
||||
|
||||
attach_options.stdin_fd = stdinfd;
|
||||
attach_options.stdout_fd = stdoutfd;
|
||||
attach_options.stderr_fd = stderrfd;
|
||||
|
||||
attach_options.initial_cwd = initial_cwd;
|
||||
attach_options.extra_env_vars = extra_env_vars;
|
||||
attach_options.extra_keep_env = extra_keep_env;
|
||||
|
||||
/*
|
||||
remount_sys_proc
|
||||
When using -s and the mount namespace is not included, this flag will cause lxc-attach to remount /proc and /sys to reflect the current other namespace contexts.
|
||||
default_options.attach_flags |= LXC_ATTACH_REMOUNT_PROC_SYS;
|
||||
|
||||
elevated_privileges
|
||||
Do not drop privileges when running command inside the container. If this option is specified, the new process will not be added to the container's cgroup(s) and it will not drop its capabilities before executing.
|
||||
default_options.attach_flags &= ~(LXC_ATTACH_MOVE_TO_CGROUP | LXC_ATTACH_DROP_CAPABILITIES | LXC_ATTACH_APPARMOR);
|
||||
*/
|
||||
|
||||
ret = c->attach(c, lxc_attach_run_shell, NULL, &attach_options, &pid);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = wait_for_pid_status(pid);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (WIFEXITED(ret))
|
||||
return WEXITSTATUS(ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int go_lxc_attach_run_wait(struct lxc_container *c,
|
||||
bool clear_env,
|
||||
int namespaces,
|
||||
long personality,
|
||||
uid_t uid, gid_t gid,
|
||||
int stdinfd, int stdoutfd, int stderrfd,
|
||||
char *initial_cwd,
|
||||
char **extra_env_vars,
|
||||
char **extra_keep_env,
|
||||
const char * const argv[]) {
|
||||
int ret;
|
||||
|
||||
lxc_attach_options_t attach_options = LXC_ATTACH_OPTIONS_DEFAULT;
|
||||
|
||||
attach_options.env_policy = LXC_ATTACH_KEEP_ENV;
|
||||
if (clear_env) {
|
||||
attach_options.env_policy = LXC_ATTACH_CLEAR_ENV;
|
||||
}
|
||||
|
||||
attach_options.namespaces = namespaces;
|
||||
attach_options.personality = personality;
|
||||
|
||||
attach_options.uid = uid;
|
||||
attach_options.gid = gid;
|
||||
|
||||
attach_options.stdin_fd = stdinfd;
|
||||
attach_options.stdout_fd = stdoutfd;
|
||||
attach_options.stderr_fd = stderrfd;
|
||||
|
||||
attach_options.initial_cwd = initial_cwd;
|
||||
attach_options.extra_env_vars = extra_env_vars;
|
||||
attach_options.extra_keep_env = extra_keep_env;
|
||||
|
||||
ret = c->attach_run_wait(c, &attach_options, argv[0], argv);
|
||||
if (WIFEXITED(ret) && WEXITSTATUS(ret) == 255)
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool go_lxc_may_control(struct lxc_container *c) {
|
||||
return c->may_control(c);
|
||||
}
|
||||
|
||||
int go_lxc_snapshot(struct lxc_container *c) {
|
||||
return c->snapshot(c, NULL);
|
||||
}
|
||||
|
||||
int go_lxc_snapshot_list(struct lxc_container *c, struct lxc_snapshot **ret) {
|
||||
return c->snapshot_list(c, ret);
|
||||
}
|
||||
|
||||
bool go_lxc_snapshot_restore(struct lxc_container *c, const char *snapname, const char *newname) {
|
||||
return c->snapshot_restore(c, snapname, newname);
|
||||
}
|
||||
|
||||
bool go_lxc_snapshot_destroy(struct lxc_container *c, const char *snapname) {
|
||||
return c->snapshot_destroy(c, snapname);
|
||||
}
|
||||
|
||||
bool go_lxc_snapshot_destroy_all(struct lxc_container *c) {
|
||||
#if VERSION_AT_LEAST(1, 1, 0)
|
||||
return c->snapshot_destroy_all(c);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
bool go_lxc_add_device_node(struct lxc_container *c, const char *src_path, const char *dest_path) {
|
||||
return c->add_device_node(c, src_path, dest_path);
|
||||
}
|
||||
|
||||
bool go_lxc_remove_device_node(struct lxc_container *c, const char *src_path, const char *dest_path) {
|
||||
return c->remove_device_node(c, src_path, dest_path);
|
||||
}
|
||||
|
||||
bool go_lxc_rename(struct lxc_container *c, const char *newname) {
|
||||
return c->rename(c, newname);
|
||||
}
|
||||
|
||||
bool go_lxc_checkpoint(struct lxc_container *c, char *directory, bool stop, bool verbose) {
|
||||
#if VERSION_AT_LEAST(1, 1, 0)
|
||||
return c->checkpoint(c, directory, stop, verbose);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool go_lxc_restore(struct lxc_container *c, char *directory, bool verbose) {
|
||||
#if VERSION_AT_LEAST(1, 1, 0)
|
||||
return c->restore(c, directory, verbose);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
int go_lxc_migrate(struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, struct extra_migrate_opts *extras) {
|
||||
#if VERSION_AT_LEAST(3, 0, 0)
|
||||
opts->features_to_check = extras->features_to_check;
|
||||
#endif
|
||||
#if VERSION_AT_LEAST(2, 0, 4)
|
||||
opts->action_script = extras->action_script;
|
||||
opts->ghost_limit = extras->ghost_limit;
|
||||
#endif
|
||||
|
||||
#if VERSION_AT_LEAST(2, 0, 1)
|
||||
opts->preserves_inodes = extras->preserves_inodes;
|
||||
#endif
|
||||
|
||||
#if VERSION_AT_LEAST(2, 0, 0)
|
||||
return c->migrate(c, cmd, opts, sizeof(*opts));
|
||||
#else
|
||||
return -EINVAL;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool go_lxc_attach_interface(struct lxc_container *c, const char *dev, const char *dst_dev) {
|
||||
#if VERSION_AT_LEAST(1, 1, 0)
|
||||
return c->attach_interface(c, dev, dst_dev);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool go_lxc_detach_interface(struct lxc_container *c, const char *dev, const char *dst_dev) {
|
||||
#if VERSION_AT_LEAST(1, 1, 0)
|
||||
return c->detach_interface(c, dev, dst_dev);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool go_lxc_config_item_is_supported(const char *key)
|
||||
{
|
||||
#if VERSION_AT_LEAST(2, 1, 0)
|
||||
return lxc_config_item_is_supported(key);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
int go_lxc_error_num(struct lxc_container *c)
|
||||
{
|
||||
return c->error_num;
|
||||
}
|
||||
|
||||
int go_lxc_console_log(struct lxc_container *c, struct lxc_console_log *log) {
|
||||
#if VERSION_AT_LEAST(3, 0, 0)
|
||||
return c->console_log(c, log);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool go_lxc_has_api_extension(const char *extension)
|
||||
{
|
||||
#if VERSION_AT_LEAST(3, 1, 0)
|
||||
return lxc_has_api_extension(extension);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
326
vendor/gopkg.in/lxc/go-lxc.v2/lxc-binding.go
generated
vendored
326
vendor/gopkg.in/lxc/go-lxc.v2/lxc-binding.go
generated
vendored
|
@ -1,326 +0,0 @@
|
|||
// Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved.
|
||||
// Use of this source code is governed by a LGPLv2.1
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux,cgo
|
||||
|
||||
package lxc
|
||||
|
||||
// #cgo pkg-config: lxc
|
||||
// #cgo LDFLAGS: -llxc -lutil
|
||||
// #include <lxc/lxccontainer.h>
|
||||
// #include <lxc/version.h>
|
||||
// #include "lxc-binding.h"
|
||||
// #ifndef LXC_DEVEL
|
||||
// #define LXC_DEVEL 0
|
||||
// #endif
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// NewContainer returns a new container struct.
|
||||
func NewContainer(name string, lxcpath ...string) (*Container, error) {
|
||||
var container *C.struct_lxc_container
|
||||
|
||||
cname := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cname))
|
||||
|
||||
if lxcpath != nil && len(lxcpath) == 1 {
|
||||
clxcpath := C.CString(lxcpath[0])
|
||||
defer C.free(unsafe.Pointer(clxcpath))
|
||||
|
||||
container = C.lxc_container_new(cname, clxcpath)
|
||||
} else {
|
||||
container = C.lxc_container_new(cname, nil)
|
||||
}
|
||||
|
||||
if container == nil {
|
||||
return nil, ErrNewFailed
|
||||
}
|
||||
c := &Container{container: container, verbosity: Quiet}
|
||||
|
||||
// http://golang.org/pkg/runtime/#SetFinalizer
|
||||
runtime.SetFinalizer(c, Release)
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Acquire increments the reference counter of the container object.
|
||||
func Acquire(c *Container) bool {
|
||||
return C.lxc_container_get(c.container) == 1
|
||||
}
|
||||
|
||||
// Release decrements the reference counter of the container object.
|
||||
func Release(c *Container) bool {
|
||||
// http://golang.org/pkg/runtime/#SetFinalizer
|
||||
runtime.SetFinalizer(c, nil)
|
||||
|
||||
// Go is bad at refcounting sometimes
|
||||
c.mu.Lock()
|
||||
|
||||
return C.lxc_container_put(c.container) == 1
|
||||
}
|
||||
|
||||
// Version returns the LXC version.
|
||||
func Version() string {
|
||||
version := C.GoString(C.lxc_get_version())
|
||||
|
||||
// New liblxc versions append "-devel" when LXC_DEVEL is set.
|
||||
if strings.HasSuffix(version, "-devel") {
|
||||
return fmt.Sprintf("%s (devel)", version[:(len(version)-len("-devel"))])
|
||||
}
|
||||
|
||||
return version
|
||||
}
|
||||
|
||||
// GlobalConfigItem returns the value of the given global config key.
|
||||
func GlobalConfigItem(name string) string {
|
||||
cname := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cname))
|
||||
|
||||
return C.GoString(C.lxc_get_global_config_item(cname))
|
||||
}
|
||||
|
||||
// DefaultConfigPath returns default config path.
|
||||
func DefaultConfigPath() string {
|
||||
return GlobalConfigItem("lxc.lxcpath")
|
||||
}
|
||||
|
||||
// DefaultLvmVg returns the name of the default LVM volume group.
|
||||
func DefaultLvmVg() string {
|
||||
return GlobalConfigItem("lxc.bdev.lvm.vg")
|
||||
}
|
||||
|
||||
// DefaultZfsRoot returns the name of the default ZFS root.
|
||||
func DefaultZfsRoot() string {
|
||||
return GlobalConfigItem("lxc.bdev.zfs.root")
|
||||
}
|
||||
|
||||
// ContainerNames returns the names of defined and active containers on the system.
|
||||
func ContainerNames(lxcpath ...string) []string {
|
||||
var size int
|
||||
var cnames **C.char
|
||||
|
||||
if lxcpath != nil && len(lxcpath) == 1 {
|
||||
clxcpath := C.CString(lxcpath[0])
|
||||
defer C.free(unsafe.Pointer(clxcpath))
|
||||
|
||||
size = int(C.list_all_containers(clxcpath, &cnames, nil))
|
||||
} else {
|
||||
|
||||
size = int(C.list_all_containers(nil, &cnames, nil))
|
||||
}
|
||||
|
||||
if size < 1 {
|
||||
return nil
|
||||
}
|
||||
return convertNArgs(cnames, size)
|
||||
}
|
||||
|
||||
// Containers returns the defined and active containers on the system. Only
|
||||
// containers that could retrieved successfully are returned.
|
||||
func Containers(lxcpath ...string) []*Container {
|
||||
var containers []*Container
|
||||
|
||||
for _, v := range ContainerNames(lxcpath...) {
|
||||
if container, err := NewContainer(v, lxcpath...); err == nil {
|
||||
containers = append(containers, container)
|
||||
}
|
||||
}
|
||||
|
||||
return containers
|
||||
}
|
||||
|
||||
// DefinedContainerNames returns the names of the defined containers on the system.
|
||||
func DefinedContainerNames(lxcpath ...string) []string {
|
||||
var size int
|
||||
var cnames **C.char
|
||||
|
||||
if lxcpath != nil && len(lxcpath) == 1 {
|
||||
clxcpath := C.CString(lxcpath[0])
|
||||
defer C.free(unsafe.Pointer(clxcpath))
|
||||
|
||||
size = int(C.list_defined_containers(clxcpath, &cnames, nil))
|
||||
} else {
|
||||
|
||||
size = int(C.list_defined_containers(nil, &cnames, nil))
|
||||
}
|
||||
|
||||
if size < 1 {
|
||||
return nil
|
||||
}
|
||||
return convertNArgs(cnames, size)
|
||||
}
|
||||
|
||||
// DefinedContainers returns the defined containers on the system. Only
|
||||
// containers that could retrieved successfully are returned.
|
||||
func DefinedContainers(lxcpath ...string) []*Container {
|
||||
var containers []*Container
|
||||
|
||||
for _, v := range DefinedContainerNames(lxcpath...) {
|
||||
if container, err := NewContainer(v, lxcpath...); err == nil {
|
||||
containers = append(containers, container)
|
||||
}
|
||||
}
|
||||
|
||||
return containers
|
||||
}
|
||||
|
||||
// ActiveContainerNames returns the names of the active containers on the system.
|
||||
func ActiveContainerNames(lxcpath ...string) []string {
|
||||
var size int
|
||||
var cnames **C.char
|
||||
|
||||
if lxcpath != nil && len(lxcpath) == 1 {
|
||||
clxcpath := C.CString(lxcpath[0])
|
||||
defer C.free(unsafe.Pointer(clxcpath))
|
||||
|
||||
size = int(C.list_active_containers(clxcpath, &cnames, nil))
|
||||
} else {
|
||||
|
||||
size = int(C.list_active_containers(nil, &cnames, nil))
|
||||
}
|
||||
|
||||
if size < 1 {
|
||||
return nil
|
||||
}
|
||||
return convertNArgs(cnames, size)
|
||||
}
|
||||
|
||||
// ActiveContainers returns the active containers on the system. Only
|
||||
// containers that could retrieved successfully are returned.
|
||||
func ActiveContainers(lxcpath ...string) []*Container {
|
||||
var containers []*Container
|
||||
|
||||
for _, v := range ActiveContainerNames(lxcpath...) {
|
||||
if container, err := NewContainer(v, lxcpath...); err == nil {
|
||||
containers = append(containers, container)
|
||||
}
|
||||
}
|
||||
|
||||
return containers
|
||||
}
|
||||
|
||||
// VersionNumber returns the LXC version.
|
||||
func VersionNumber() (major int, minor int) {
|
||||
major = C.LXC_VERSION_MAJOR
|
||||
minor = C.LXC_VERSION_MINOR
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// VersionAtLeast returns true when the tested version >= current version.
|
||||
func VersionAtLeast(major int, minor int, micro int) bool {
|
||||
if C.LXC_DEVEL == 1 {
|
||||
return true
|
||||
}
|
||||
|
||||
if major > C.LXC_VERSION_MAJOR {
|
||||
return false
|
||||
}
|
||||
|
||||
if major == C.LXC_VERSION_MAJOR &&
|
||||
minor > C.LXC_VERSION_MINOR {
|
||||
return false
|
||||
}
|
||||
|
||||
if major == C.LXC_VERSION_MAJOR &&
|
||||
minor == C.LXC_VERSION_MINOR &&
|
||||
micro > C.LXC_VERSION_MICRO {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// IsSupportedConfigItem returns true if the key belongs to a supported config item.
|
||||
func IsSupportedConfigItem(key string) bool {
|
||||
configItem := C.CString(key)
|
||||
defer C.free(unsafe.Pointer(configItem))
|
||||
return bool(C.go_lxc_config_item_is_supported(configItem))
|
||||
}
|
||||
|
||||
// runtimeLiblxcVersionAtLeast checks if the system's liblxc matches the
|
||||
// provided version requirement
|
||||
func runtimeLiblxcVersionAtLeast(major int, minor int, micro int) bool {
|
||||
version := Version()
|
||||
version = strings.Replace(version, " (devel)", "-devel", 1)
|
||||
parts := strings.Split(version, ".")
|
||||
partsLen := len(parts)
|
||||
if partsLen == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
develParts := strings.Split(parts[partsLen-1], "-")
|
||||
if len(develParts) == 2 && develParts[1] == "devel" {
|
||||
return true
|
||||
}
|
||||
|
||||
maj := -1
|
||||
min := -1
|
||||
mic := -1
|
||||
|
||||
for i, v := range parts {
|
||||
if i > 2 {
|
||||
break
|
||||
}
|
||||
|
||||
num, err := strconv.Atoi(v)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
switch i {
|
||||
case 0:
|
||||
maj = num
|
||||
case 1:
|
||||
min = num
|
||||
case 2:
|
||||
mic = num
|
||||
}
|
||||
}
|
||||
|
||||
/* Major version is greater. */
|
||||
if maj > major {
|
||||
return true
|
||||
}
|
||||
|
||||
if maj < major {
|
||||
return false
|
||||
}
|
||||
|
||||
/* Minor number is greater.*/
|
||||
if min > minor {
|
||||
return true
|
||||
}
|
||||
|
||||
if min < minor {
|
||||
return false
|
||||
}
|
||||
|
||||
/* Patch number is greater. */
|
||||
if mic > micro {
|
||||
return true
|
||||
}
|
||||
|
||||
if mic < micro {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// HasApiExtension returns true if the extension is supported.
|
||||
func HasApiExtension(extension string) bool {
|
||||
if runtimeLiblxcVersionAtLeast(3, 1, 0) {
|
||||
apiExtension := C.CString(extension)
|
||||
defer C.free(unsafe.Pointer(apiExtension))
|
||||
return bool(C.go_lxc_has_api_extension(apiExtension))
|
||||
}
|
||||
return false
|
||||
}
|
127
vendor/gopkg.in/lxc/go-lxc.v2/lxc-binding.h
generated
vendored
127
vendor/gopkg.in/lxc/go-lxc.v2/lxc-binding.h
generated
vendored
|
@ -1,127 +0,0 @@
|
|||
// Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved.
|
||||
// Use of this source code is governed by a LGPLv2.1
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#define VERSION_AT_LEAST(major, minor, micro) \
|
||||
((LXC_DEVEL == 1) || (!(major > LXC_VERSION_MAJOR || \
|
||||
major == LXC_VERSION_MAJOR && minor > LXC_VERSION_MINOR || \
|
||||
major == LXC_VERSION_MAJOR && minor == LXC_VERSION_MINOR && micro > LXC_VERSION_MICRO)))
|
||||
|
||||
extern bool go_lxc_add_device_node(struct lxc_container *c, const char *src_path, const char *dest_path);
|
||||
extern void go_lxc_clear_config(struct lxc_container *c);
|
||||
extern bool go_lxc_clear_config_item(struct lxc_container *c, const char *key);
|
||||
extern bool go_lxc_clone(struct lxc_container *c, const char *newname, const char *lxcpath, int flags, const char *bdevtype);
|
||||
extern bool go_lxc_console(struct lxc_container *c, int ttynum, int stdinfd, int stdoutfd, int stderrfd, int escape);
|
||||
extern bool go_lxc_create(struct lxc_container *c, const char *t, const char *bdevtype, int flags, char * const argv[]);
|
||||
extern bool go_lxc_defined(struct lxc_container *c);
|
||||
extern bool go_lxc_destroy(struct lxc_container *c);
|
||||
extern bool go_lxc_destroy_with_snapshots(struct lxc_container *c);
|
||||
extern bool go_lxc_freeze(struct lxc_container *c);
|
||||
extern bool go_lxc_load_config(struct lxc_container *c, const char *alt_file);
|
||||
extern bool go_lxc_may_control(struct lxc_container *c);
|
||||
extern bool go_lxc_reboot(struct lxc_container *c);
|
||||
extern bool go_lxc_remove_device_node(struct lxc_container *c, const char *src_path, const char *dest_path);
|
||||
extern bool go_lxc_rename(struct lxc_container *c, const char *newname);
|
||||
extern bool go_lxc_running(struct lxc_container *c);
|
||||
extern bool go_lxc_save_config(struct lxc_container *c, const char *alt_file);
|
||||
extern bool go_lxc_set_cgroup_item(struct lxc_container *c, const char *key, const char *value);
|
||||
extern bool go_lxc_set_config_item(struct lxc_container *c, const char *key, const char *value);
|
||||
extern bool go_lxc_set_config_path(struct lxc_container *c, const char *path);
|
||||
extern bool go_lxc_shutdown(struct lxc_container *c, int timeout);
|
||||
extern bool go_lxc_snapshot_destroy(struct lxc_container *c, const char *snapname);
|
||||
extern bool go_lxc_snapshot_destroy_all(struct lxc_container *c);
|
||||
extern bool go_lxc_snapshot_restore(struct lxc_container *c, const char *snapname, const char *newname);
|
||||
extern bool go_lxc_start(struct lxc_container *c, int useinit, char * const argv[]);
|
||||
extern bool go_lxc_stop(struct lxc_container *c);
|
||||
extern bool go_lxc_unfreeze(struct lxc_container *c);
|
||||
extern bool go_lxc_wait(struct lxc_container *c, const char *state, int timeout);
|
||||
extern bool go_lxc_want_close_all_fds(struct lxc_container *c, bool state);
|
||||
extern bool go_lxc_want_daemonize(struct lxc_container *c, bool state);
|
||||
extern char* go_lxc_config_file_name(struct lxc_container *c);
|
||||
extern char* go_lxc_get_cgroup_item(struct lxc_container *c, const char *key);
|
||||
extern char* go_lxc_get_config_item(struct lxc_container *c, const char *key);
|
||||
extern char** go_lxc_get_interfaces(struct lxc_container *c);
|
||||
extern char** go_lxc_get_ips(struct lxc_container *c, const char *interface, const char *family, int scope);
|
||||
extern char* go_lxc_get_keys(struct lxc_container *c, const char *key);
|
||||
extern char* go_lxc_get_running_config_item(struct lxc_container *c, const char *key);
|
||||
extern const char* go_lxc_get_config_path(struct lxc_container *c);
|
||||
extern const char* go_lxc_state(struct lxc_container *c);
|
||||
extern int go_lxc_attach_run_wait(struct lxc_container *c,
|
||||
bool clear_env,
|
||||
int namespaces,
|
||||
long personality,
|
||||
uid_t uid, gid_t gid,
|
||||
int stdinfd, int stdoutfd, int stderrfd,
|
||||
char *initial_cwd,
|
||||
char **extra_env_vars,
|
||||
char **extra_keep_env,
|
||||
const char * const argv[]);
|
||||
extern int go_lxc_attach(struct lxc_container *c,
|
||||
bool clear_env,
|
||||
int namespaces,
|
||||
long personality,
|
||||
uid_t uid, gid_t gid,
|
||||
int stdinfd, int stdoutfd, int stderrfd,
|
||||
char *initial_cwd,
|
||||
char **extra_env_vars,
|
||||
char **extra_keep_env);
|
||||
extern int go_lxc_attach_no_wait(struct lxc_container *c,
|
||||
bool clear_env,
|
||||
int namespaces,
|
||||
long personality,
|
||||
uid_t uid, gid_t gid,
|
||||
int stdinfd, int stdoutfd, int stderrfd,
|
||||
char *initial_cwd,
|
||||
char **extra_env_vars,
|
||||
char **extra_keep_env,
|
||||
const char * const argv[],
|
||||
pid_t *attached_pid);
|
||||
extern int go_lxc_console_getfd(struct lxc_container *c, int ttynum);
|
||||
extern int go_lxc_snapshot_list(struct lxc_container *c, struct lxc_snapshot **ret);
|
||||
extern int go_lxc_snapshot(struct lxc_container *c);
|
||||
extern pid_t go_lxc_init_pid(struct lxc_container *c);
|
||||
extern bool go_lxc_checkpoint(struct lxc_container *c, char *directory, bool stop, bool verbose);
|
||||
extern bool go_lxc_restore(struct lxc_container *c, char *directory, bool verbose);
|
||||
extern bool go_lxc_config_item_is_supported(const char *key);
|
||||
extern bool go_lxc_has_api_extension(const char *extension);
|
||||
|
||||
/* n.b. that we're just adding the fields here to shorten the definition
|
||||
* of go_lxc_migrate; in the case where we don't have the ->migrate API call,
|
||||
* we don't want to have to pass all the arguments in to let conditional
|
||||
* compilation handle things, but the call will still fail
|
||||
*/
|
||||
#if !VERSION_AT_LEAST(2, 0, 0)
|
||||
struct migrate_opts {
|
||||
char *directory;
|
||||
bool verbose;
|
||||
bool stop;
|
||||
char *predump_dir;
|
||||
};
|
||||
#endif
|
||||
|
||||
/* This is a struct that we can add "extra" (i.e. options added after 2.0.0)
|
||||
* migrate options to, so that we don't have to have a massive function
|
||||
* signature when the list of options grows.
|
||||
*/
|
||||
struct extra_migrate_opts {
|
||||
bool preserves_inodes;
|
||||
char *action_script;
|
||||
uint64_t ghost_limit;
|
||||
uint64_t features_to_check;
|
||||
};
|
||||
int go_lxc_migrate(struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, struct extra_migrate_opts *extras);
|
||||
|
||||
extern bool go_lxc_attach_interface(struct lxc_container *c, const char *dev, const char *dst_dev);
|
||||
extern bool go_lxc_detach_interface(struct lxc_container *c, const char *dev, const char *dst_dev);
|
||||
|
||||
#if !VERSION_AT_LEAST(3, 0, 0)
|
||||
struct lxc_console_log {
|
||||
bool clear;
|
||||
bool read;
|
||||
uint64_t *read_max;
|
||||
char *data;
|
||||
};
|
||||
#endif
|
||||
|
||||
extern int go_lxc_console_log(struct lxc_container *c, struct lxc_console_log *log);
|
||||
extern int go_lxc_error_num(struct lxc_container *c);
|
209
vendor/gopkg.in/lxc/go-lxc.v2/options.go
generated
vendored
209
vendor/gopkg.in/lxc/go-lxc.v2/options.go
generated
vendored
|
@ -1,209 +0,0 @@
|
|||
// Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved.
|
||||
// Use of this source code is governed by a LGPLv2.1
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux,cgo
|
||||
|
||||
package lxc
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// AttachOptions type is used for defining various attach options.
|
||||
type AttachOptions struct {
|
||||
|
||||
// Specify the namespaces to attach to, as OR'ed list of clone flags (syscall.CLONE_NEWNS | syscall.CLONE_NEWUTS ...).
|
||||
Namespaces int
|
||||
|
||||
// Specify the architecture which the kernel should appear to be running as to the command executed.
|
||||
Arch Personality
|
||||
|
||||
// Cwd specifies the working directory of the command.
|
||||
Cwd string
|
||||
|
||||
// UID specifies the user id to run as.
|
||||
UID int
|
||||
|
||||
// GID specifies the group id to run as.
|
||||
GID int
|
||||
|
||||
// If ClearEnv is true the environment is cleared before running the command.
|
||||
ClearEnv bool
|
||||
|
||||
// Env specifies the environment of the process.
|
||||
Env []string
|
||||
|
||||
// EnvToKeep specifies the environment of the process when ClearEnv is true.
|
||||
EnvToKeep []string
|
||||
|
||||
// StdinFd specifies the fd to read input from.
|
||||
StdinFd uintptr
|
||||
|
||||
// StdoutFd specifies the fd to write output to.
|
||||
StdoutFd uintptr
|
||||
|
||||
// StderrFd specifies the fd to write error output to.
|
||||
StderrFd uintptr
|
||||
}
|
||||
|
||||
// DefaultAttachOptions is a convenient set of options to be used.
|
||||
var DefaultAttachOptions = AttachOptions{
|
||||
Namespaces: -1,
|
||||
Arch: -1,
|
||||
Cwd: "/",
|
||||
UID: -1,
|
||||
GID: -1,
|
||||
ClearEnv: false,
|
||||
Env: nil,
|
||||
EnvToKeep: nil,
|
||||
StdinFd: os.Stdin.Fd(),
|
||||
StdoutFd: os.Stdout.Fd(),
|
||||
StderrFd: os.Stderr.Fd(),
|
||||
}
|
||||
|
||||
// TemplateOptions type is used for defining various template options.
|
||||
type TemplateOptions struct {
|
||||
|
||||
// Template specifies the name of the template.
|
||||
Template string
|
||||
|
||||
// Backend specifies the type of the backend.
|
||||
Backend BackendStore
|
||||
|
||||
// Distro specifies the name of the distribution.
|
||||
Distro string
|
||||
|
||||
// Release specifies the name/version of the distribution.
|
||||
Release string
|
||||
|
||||
// Arch specified the architecture of the container.
|
||||
Arch string
|
||||
|
||||
// Variant specifies the variant of the image (default: "default").
|
||||
Variant string
|
||||
|
||||
// Image server (default: "images.linuxcontainers.org").
|
||||
Server string
|
||||
|
||||
// GPG keyid (default: 0x...).
|
||||
KeyID string
|
||||
|
||||
// GPG keyserver to use.
|
||||
KeyServer string
|
||||
|
||||
// Disable GPG validation (not recommended).
|
||||
DisableGPGValidation bool
|
||||
|
||||
// Flush the local copy (if present).
|
||||
FlushCache bool
|
||||
|
||||
// Force the use of the local copy even if expired.
|
||||
ForceCache bool
|
||||
|
||||
// ExtraArgs provides a way to specify template specific args.
|
||||
ExtraArgs []string
|
||||
}
|
||||
|
||||
// DownloadTemplateOptions is a convenient set of options for "download" template.
|
||||
var DownloadTemplateOptions = TemplateOptions{
|
||||
Template: "download",
|
||||
Distro: "ubuntu",
|
||||
Release: "trusty",
|
||||
Arch: "amd64",
|
||||
}
|
||||
|
||||
// BusyboxTemplateOptions is a convenient set of options for "busybox" template.
|
||||
var BusyboxTemplateOptions = TemplateOptions{
|
||||
Template: "busybox",
|
||||
}
|
||||
|
||||
// UbuntuTemplateOptions is a convenient set of options for "ubuntu" template.
|
||||
var UbuntuTemplateOptions = TemplateOptions{
|
||||
Template: "ubuntu",
|
||||
}
|
||||
|
||||
// ConsoleOptions type is used for defining various console options.
|
||||
type ConsoleOptions struct {
|
||||
|
||||
// Tty number to attempt to allocate, -1 to allocate the first available tty, or 0 to allocate the console.
|
||||
Tty int
|
||||
|
||||
// StdinFd specifies the fd to read input from.
|
||||
StdinFd uintptr
|
||||
|
||||
// StdoutFd specifies the fd to write output to.
|
||||
StdoutFd uintptr
|
||||
|
||||
// StderrFd specifies the fd to write error output to.
|
||||
StderrFd uintptr
|
||||
|
||||
// EscapeCharacter (a means <Ctrl a>, b maens <Ctrl b>).
|
||||
EscapeCharacter rune
|
||||
}
|
||||
|
||||
// DefaultConsoleOptions is a convenient set of options to be used.
|
||||
var DefaultConsoleOptions = ConsoleOptions{
|
||||
Tty: -1,
|
||||
StdinFd: os.Stdin.Fd(),
|
||||
StdoutFd: os.Stdout.Fd(),
|
||||
StderrFd: os.Stderr.Fd(),
|
||||
EscapeCharacter: 'a',
|
||||
}
|
||||
|
||||
// CloneOptions type is used for defining various clone options.
|
||||
type CloneOptions struct {
|
||||
|
||||
// Backend specifies the type of the backend.
|
||||
Backend BackendStore
|
||||
|
||||
// lxcpath in which to create the new container. If not set the original container's lxcpath will be used.
|
||||
ConfigPath string
|
||||
|
||||
// Do not change the hostname of the container (in the root filesystem).
|
||||
KeepName bool
|
||||
|
||||
// Use the same MAC address as the original container, rather than generating a new random one.
|
||||
KeepMAC bool
|
||||
|
||||
// Create a snapshot rather than copy.
|
||||
Snapshot bool
|
||||
}
|
||||
|
||||
// DefaultCloneOptions is a convenient set of options to be used.
|
||||
var DefaultCloneOptions = CloneOptions{
|
||||
Backend: Directory,
|
||||
}
|
||||
|
||||
// CheckpointOptions type is used for defining checkpoint options for CRIU.
|
||||
type CheckpointOptions struct {
|
||||
Directory string
|
||||
Stop bool
|
||||
Verbose bool
|
||||
}
|
||||
|
||||
// RestoreOptions type is used for defining restore options for CRIU.
|
||||
type RestoreOptions struct {
|
||||
Directory string
|
||||
Verbose bool
|
||||
}
|
||||
|
||||
// MigrateOptions type is used for defining migrate options.
|
||||
type MigrateOptions struct {
|
||||
Directory string
|
||||
PredumpDir string
|
||||
ActionScript string
|
||||
Verbose bool
|
||||
Stop bool
|
||||
PreservesInodes bool
|
||||
GhostLimit uint64
|
||||
FeaturesToCheck CriuFeatures
|
||||
}
|
||||
|
||||
// ConsoleLogOptioins type is used for defining console log options.
|
||||
type ConsoleLogOptions struct {
|
||||
ClearLog bool
|
||||
ReadLog bool
|
||||
ReadMax uint64
|
||||
WriteToLogFile bool
|
||||
}
|
274
vendor/gopkg.in/lxc/go-lxc.v2/type.go
generated
vendored
274
vendor/gopkg.in/lxc/go-lxc.v2/type.go
generated
vendored
|
@ -1,274 +0,0 @@
|
|||
// Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved.
|
||||
// Use of this source code is governed by a LGPLv2.1
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux,cgo
|
||||
|
||||
package lxc
|
||||
|
||||
// #include <lxc/lxccontainer.h>
|
||||
import "C"
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Verbosity type
|
||||
type Verbosity int
|
||||
|
||||
const (
|
||||
// Quiet makes some API calls not to write anything to stdout
|
||||
Quiet Verbosity = 1 << iota
|
||||
// Verbose makes some API calls write to stdout
|
||||
Verbose
|
||||
)
|
||||
|
||||
// BackendStore type specifies possible backend types.
|
||||
type BackendStore int
|
||||
|
||||
const (
|
||||
// Btrfs backendstore type
|
||||
Btrfs BackendStore = iota + 1
|
||||
// Directory backendstore type
|
||||
Directory
|
||||
// LVM backendstore type
|
||||
LVM
|
||||
// ZFS backendstore type
|
||||
ZFS
|
||||
// Aufs backendstore type
|
||||
Aufs
|
||||
// Overlayfs backendstore type
|
||||
Overlayfs
|
||||
// Loopback backendstore type
|
||||
Loopback
|
||||
// Best backendstore type
|
||||
Best
|
||||
)
|
||||
|
||||
// BackendStore as string
|
||||
func (t BackendStore) String() string {
|
||||
switch t {
|
||||
case Directory:
|
||||
return "dir"
|
||||
case ZFS:
|
||||
return "zfs"
|
||||
case Btrfs:
|
||||
return "btrfs"
|
||||
case LVM:
|
||||
return "lvm"
|
||||
case Aufs:
|
||||
return "aufs"
|
||||
case Overlayfs:
|
||||
return "overlayfs"
|
||||
case Loopback:
|
||||
return "loopback"
|
||||
case Best:
|
||||
return "best"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var backendStoreMap = map[string]BackendStore{
|
||||
"dir": Directory,
|
||||
"zfs": ZFS,
|
||||
"btrfs": Btrfs,
|
||||
"lvm": LVM,
|
||||
"aufs": Aufs,
|
||||
"overlayfs": Overlayfs,
|
||||
"loopback": Loopback,
|
||||
"best": Best,
|
||||
}
|
||||
|
||||
// Set is the method to set the flag value, part of the flag.Value interface.
|
||||
func (t *BackendStore) Set(value string) error {
|
||||
backend, ok := backendStoreMap[value]
|
||||
if ok {
|
||||
*t = backend
|
||||
return nil
|
||||
}
|
||||
return ErrUnknownBackendStore
|
||||
}
|
||||
|
||||
// State type specifies possible container states.
|
||||
type State int
|
||||
|
||||
const (
|
||||
// STOPPED means container is not running
|
||||
STOPPED State = iota + 1
|
||||
// STARTING means container is starting
|
||||
STARTING
|
||||
// RUNNING means container is running
|
||||
RUNNING
|
||||
// STOPPING means container is stopping
|
||||
STOPPING
|
||||
// ABORTING means container is aborting
|
||||
ABORTING
|
||||
// FREEZING means container is freezing
|
||||
FREEZING
|
||||
// FROZEN means containe is frozen
|
||||
FROZEN
|
||||
// THAWED means container is thawed
|
||||
THAWED
|
||||
)
|
||||
|
||||
// StateMap provides the mapping betweens the state names and states
|
||||
var StateMap = map[string]State{
|
||||
"STOPPED": STOPPED,
|
||||
"STARTING": STARTING,
|
||||
"RUNNING": RUNNING,
|
||||
"STOPPING": STOPPING,
|
||||
"ABORTING": ABORTING,
|
||||
"FREEZING": FREEZING,
|
||||
"FROZEN": FROZEN,
|
||||
"THAWED": THAWED,
|
||||
}
|
||||
|
||||
// State as string
|
||||
func (t State) String() string {
|
||||
switch t {
|
||||
case STOPPED:
|
||||
return "STOPPED"
|
||||
case STARTING:
|
||||
return "STARTING"
|
||||
case RUNNING:
|
||||
return "RUNNING"
|
||||
case STOPPING:
|
||||
return "STOPPING"
|
||||
case ABORTING:
|
||||
return "ABORTING"
|
||||
case FREEZING:
|
||||
return "FREEZING"
|
||||
case FROZEN:
|
||||
return "FROZEN"
|
||||
case THAWED:
|
||||
return "THAWED"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Taken from http://golang.org/doc/effective_go.html#constants
|
||||
|
||||
// ByteSize type
|
||||
type ByteSize float64
|
||||
|
||||
const (
|
||||
_ = iota
|
||||
// KB - kilobyte
|
||||
KB ByteSize = 1 << (10 * iota)
|
||||
// MB - megabyte
|
||||
MB
|
||||
// GB - gigabyte
|
||||
GB
|
||||
// TB - terabyte
|
||||
TB
|
||||
// PB - petabyte
|
||||
PB
|
||||
// EB - exabyte
|
||||
EB
|
||||
// ZB - zettabyte
|
||||
ZB
|
||||
// YB - yottabyte
|
||||
YB
|
||||
)
|
||||
|
||||
func (b ByteSize) String() string {
|
||||
switch {
|
||||
case b >= YB:
|
||||
return fmt.Sprintf("%.2fYB", b/YB)
|
||||
case b >= ZB:
|
||||
return fmt.Sprintf("%.2fZB", b/ZB)
|
||||
case b >= EB:
|
||||
return fmt.Sprintf("%.2fEB", b/EB)
|
||||
case b >= PB:
|
||||
return fmt.Sprintf("%.2fPB", b/PB)
|
||||
case b >= TB:
|
||||
return fmt.Sprintf("%.2fTB", b/TB)
|
||||
case b >= GB:
|
||||
return fmt.Sprintf("%.2fGB", b/GB)
|
||||
case b >= MB:
|
||||
return fmt.Sprintf("%.2fMB", b/MB)
|
||||
case b >= KB:
|
||||
return fmt.Sprintf("%.2fKB", b/KB)
|
||||
}
|
||||
return fmt.Sprintf("%.2fB", b)
|
||||
}
|
||||
|
||||
// LogLevel type specifies possible log levels.
|
||||
type LogLevel int
|
||||
|
||||
const (
|
||||
// TRACE priority
|
||||
TRACE LogLevel = iota
|
||||
// DEBUG priority
|
||||
DEBUG
|
||||
// INFO priority
|
||||
INFO
|
||||
// NOTICE priority
|
||||
NOTICE
|
||||
// WARN priority
|
||||
WARN
|
||||
// ERROR priority
|
||||
ERROR
|
||||
// CRIT priority
|
||||
CRIT
|
||||
// ALERT priority
|
||||
ALERT
|
||||
// FATAL priority
|
||||
FATAL
|
||||
)
|
||||
|
||||
var logLevelMap = map[string]LogLevel{
|
||||
"TRACE": TRACE,
|
||||
"DEBUG": DEBUG,
|
||||
"INFO": INFO,
|
||||
"NOTICE": NOTICE,
|
||||
"WARN": WARN,
|
||||
"ERROR": ERROR,
|
||||
"CRIT": CRIT,
|
||||
"ALERT": ALERT,
|
||||
"FATAL": FATAL,
|
||||
}
|
||||
|
||||
func (l LogLevel) String() string {
|
||||
switch l {
|
||||
case TRACE:
|
||||
return "TRACE"
|
||||
case DEBUG:
|
||||
return "DEBUG"
|
||||
case INFO:
|
||||
return "INFO"
|
||||
case NOTICE:
|
||||
return "NOTICE"
|
||||
case WARN:
|
||||
return "WARN"
|
||||
case ERROR:
|
||||
return "ERROR"
|
||||
case CRIT:
|
||||
return "CRIT"
|
||||
case ALERT:
|
||||
return "ALERT"
|
||||
case FATAL:
|
||||
return "FATAL"
|
||||
}
|
||||
return "NOTSET"
|
||||
}
|
||||
|
||||
// Personality allows to set the architecture for the container.
|
||||
type Personality int64
|
||||
|
||||
const (
|
||||
X86 Personality = 0x0008
|
||||
X86_64 = 0x0000
|
||||
)
|
||||
|
||||
const (
|
||||
MIGRATE_PRE_DUMP = 0
|
||||
MIGRATE_DUMP = 1
|
||||
MIGRATE_RESTORE = 2
|
||||
MIGRATE_FEATURE_CHECK = 3
|
||||
)
|
||||
|
||||
type CriuFeatures uint64
|
||||
|
||||
const (
|
||||
FEATURE_MEM_TRACK CriuFeatures = 1 << iota
|
||||
FEATURE_LAZY_PAGES
|
||||
)
|
105
vendor/gopkg.in/lxc/go-lxc.v2/util.go
generated
vendored
105
vendor/gopkg.in/lxc/go-lxc.v2/util.go
generated
vendored
|
@ -1,105 +0,0 @@
|
|||
// Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved.
|
||||
// Use of this source code is governed by a LGPLv2.1
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux,cgo
|
||||
|
||||
package lxc
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#include <lxc/lxccontainer.h>
|
||||
|
||||
static char** makeCharArray(size_t size) {
|
||||
// caller checks return value
|
||||
return calloc(size, sizeof(char*));
|
||||
}
|
||||
|
||||
static void setArrayString(char **array, char *string, size_t n) {
|
||||
array[n] = string;
|
||||
}
|
||||
|
||||
static void freeCharArray(char **array, size_t size) {
|
||||
size_t i;
|
||||
for (i = 0; i < size; i++) {
|
||||
free(array[i]);
|
||||
}
|
||||
free(array);
|
||||
}
|
||||
|
||||
static void freeSnapshotArray(struct lxc_snapshot *s, size_t size) {
|
||||
size_t i;
|
||||
for (i = 0; i < size; i++) {
|
||||
s[i].free(&s[i]);
|
||||
}
|
||||
free(s);
|
||||
}
|
||||
|
||||
static size_t getArrayLength(char **array) {
|
||||
char **p;
|
||||
size_t size = 0;
|
||||
for (p = (char **)array; *p; p++) {
|
||||
size++;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func makeNullTerminatedArgs(args []string) **C.char {
|
||||
cparams := C.makeCharArray(C.size_t(len(args) + 1))
|
||||
if cparams == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(args); i++ {
|
||||
C.setArrayString(cparams, C.CString(args[i]), C.size_t(i))
|
||||
}
|
||||
C.setArrayString(cparams, nil, C.size_t(len(args)))
|
||||
|
||||
return cparams
|
||||
}
|
||||
|
||||
func freeNullTerminatedArgs(cArgs **C.char, length int) {
|
||||
C.freeCharArray(cArgs, C.size_t(length+1))
|
||||
}
|
||||
|
||||
func convertArgs(cArgs **C.char) []string {
|
||||
if cArgs == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return convertNArgs(cArgs, int(C.getArrayLength(cArgs)))
|
||||
}
|
||||
|
||||
func convertNArgs(cArgs **C.char, size int) []string {
|
||||
if cArgs == nil || size <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var A []*C.char
|
||||
|
||||
hdr := reflect.SliceHeader{
|
||||
Data: uintptr(unsafe.Pointer(cArgs)),
|
||||
Len: size,
|
||||
Cap: size,
|
||||
}
|
||||
cArgsInterface := reflect.NewAt(reflect.TypeOf(A), unsafe.Pointer(&hdr)).Elem().Interface()
|
||||
|
||||
result := make([]string, size)
|
||||
for i := 0; i < size; i++ {
|
||||
result[i] = C.GoString(cArgsInterface.([]*C.char)[i])
|
||||
}
|
||||
C.freeCharArray(cArgs, C.size_t(size))
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func freeSnapshots(snapshots *C.struct_lxc_snapshot, size int) {
|
||||
C.freeSnapshotArray(snapshots, C.size_t(size))
|
||||
}
|
1
vendor/vendor.json
vendored
1
vendor/vendor.json
vendored
|
@ -437,7 +437,6 @@
|
|||
{"path":"google.golang.org/grpc/transport","checksumSHA1":"oFGr0JoquaPGVnV86fVL8MVTc3A=","revision":"0c41876308d45bc82e587965971e28be659a1aca","revisionTime":"2017-07-21T17:58:12Z"},
|
||||
{"path":"gopkg.in/fsnotify.v1","checksumSHA1":"eIhF+hmL/XZhzTiAwhLD0M65vlY=","revision":"629574ca2a5df945712d3079857300b5e4da0236","revisionTime":"2016-10-11T02:33:12Z"},
|
||||
{"path":"gopkg.in/inf.v0","checksumSHA1":"6f8MEU31llHM1sLM/GGH4/Qxu0A=","revision":"3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4","revisionTime":"2015-09-11T12:57:57Z"},
|
||||
{"path":"gopkg.in/lxc/go-lxc.v2","checksumSHA1":"oAflbBrzWC7OMmZQixkp9bnPQW8=","revision":"0aadfc37157c2e3f0e63bedd10f8615e66e91cad","revisionTime":"2018-11-01T16:03:35Z"},
|
||||
{"path":"gopkg.in/tomb.v1","checksumSHA1":"TO8baX+t1Qs7EmOYth80MkbKzFo=","revision":"dd632973f1e7218eb1089048e0798ec9ae7dceb8","revisionTime":"2014-10-24T13:56:13Z"},
|
||||
{"path":"gopkg.in/tomb.v2","checksumSHA1":"WiyCOMvfzRdymImAJ3ME6aoYUdM=","revision":"14b3d72120e8d10ea6e6b7f87f7175734b1faab8","revisionTime":"2014-06-26T14:46:23Z"},
|
||||
{"path":"gopkg.in/yaml.v2","checksumSHA1":"12GqsW8PiRPnezDDy0v4brZrndM=","revision":"a5b47d31c556af34a302ce5d659e6fea44d90de0","revisionTime":"2016-09-28T15:37:09Z"}
|
||||
|
|
Loading…
Reference in a new issue