mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-06-13 05:21:29 +00:00
Remove all trailing whitespaces.
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
c93c7b1a0b
commit
f79d43bbe7
2
COPYING
2
COPYING
@ -146,7 +146,7 @@ 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
|
||||
|
2
TODO
2
TODO
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
* create an interactive configuration with the lxc-create command
|
||||
line, like the 'make menuconfig' of the kernel.
|
||||
line, like the 'make menuconfig' of the kernel.
|
||||
|
||||
= lxc-create [-n foo] -m|--menuconfig
|
||||
|
@ -2,21 +2,21 @@ dnl as-ac-expand.m4 0.2.0
|
||||
dnl autostars m4 macro for expanding directories using configure's prefix
|
||||
dnl thomas@apestaart.org
|
||||
dnl
|
||||
|
||||
|
||||
dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
|
||||
dnl example
|
||||
dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
|
||||
dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
|
||||
|
||||
|
||||
AC_DEFUN([AS_AC_EXPAND],
|
||||
[
|
||||
EXP_VAR=[$1]
|
||||
FROM_VAR=[$2]
|
||||
|
||||
|
||||
dnl first expand prefix and exec_prefix if necessary
|
||||
prefix_save=$prefix
|
||||
exec_prefix_save=$exec_prefix
|
||||
|
||||
|
||||
dnl if no prefix given, then use /usr/local, the default prefix
|
||||
if test "x$prefix" = "xNONE"; then
|
||||
prefix="$ac_default_prefix"
|
||||
@ -25,7 +25,7 @@ AC_DEFUN([AS_AC_EXPAND],
|
||||
if test "x$exec_prefix" = "xNONE"; then
|
||||
exec_prefix=$prefix
|
||||
fi
|
||||
|
||||
|
||||
full_var="$FROM_VAR"
|
||||
dnl loop until it doesn't change anymore
|
||||
while true; do
|
||||
@ -33,11 +33,11 @@ AC_DEFUN([AS_AC_EXPAND],
|
||||
if test "x$new_full_var" = "x$full_var"; then break; fi
|
||||
full_var=$new_full_var
|
||||
done
|
||||
|
||||
|
||||
dnl clean up
|
||||
full_var=$new_full_var
|
||||
AC_SUBST([$1], "$full_var")
|
||||
|
||||
|
||||
dnl restore prefix and exec_prefix
|
||||
prefix=$prefix_save
|
||||
exec_prefix=$exec_prefix_save
|
||||
@ -94,7 +94,7 @@ x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
|
||||
# Determine the number of characters in A and B.
|
||||
ax_compare_version_len_A=`echo "$A" | awk '{print(length)}'`
|
||||
ax_compare_version_len_B=`echo "$B" | awk '{print(length)}'`
|
||||
|
||||
|
||||
# Set A to no more than B's length and B to no more than A's length.
|
||||
A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
|
||||
B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
|
||||
|
@ -32,8 +32,8 @@ error when starting a container.
|
||||
"[syserr] lxc_start:96: Invalid argument - failed to fork into a new
|
||||
namespace"
|
||||
|
||||
Answer:
|
||||
-------
|
||||
Answer:
|
||||
-------
|
||||
|
||||
read the lxc man page about kernel version prereq :) most probably
|
||||
your kernel is not configured to support the container options you
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -143,7 +143,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
The container is not running.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -67,7 +67,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
The available tty are free slots taken by this command. That
|
||||
means if the container has four ttys available and the command
|
||||
has been launched four times taking the different tty, the fifth
|
||||
command will fail because no console will be available.
|
||||
command will fail because no console will be available.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@ -114,7 +114,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
user "foo" and "bar" is trying to open a console to it.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -100,7 +100,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
command to list the available containers on the system.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -162,7 +162,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
container or create a new one.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -81,7 +81,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
the <command>lxc-create</command> command.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -120,7 +120,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<simpara>
|
||||
<simpara>
|
||||
<citerefentry>
|
||||
<refentrytitle>ls</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -135,7 +135,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
the <command>lxc-create</command> command.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
@ -145,7 +145,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<simpara>
|
||||
<simpara>
|
||||
<citerefentry>
|
||||
<refentrytitle>regex</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -86,8 +86,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
<listitem>
|
||||
<para>
|
||||
specify the container <replaceable>name</replaceable>
|
||||
to limit the output to the processes belonging
|
||||
to this container name.
|
||||
to limit the output to the processes belonging
|
||||
to this container name.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -98,7 +98,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
limit the output to the processes belonging
|
||||
limit the output to the processes belonging
|
||||
to all lxc containers.
|
||||
</para>
|
||||
</listitem>
|
||||
@ -139,7 +139,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<simpara>
|
||||
<simpara>
|
||||
<citerefentry>
|
||||
<refentrytitle>ps</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -198,7 +198,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
container or create a new one.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -80,7 +80,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
container or create a new one.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>The container was not found</term>
|
||||
@ -90,7 +90,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
the <command>lxc-create</command> command.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -78,7 +78,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
the <command>lxc-create</command> command.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -133,7 +133,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
the <command>lxc-create</command> command.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
@ -16,7 +16,7 @@ lxc.network.type = macvlan
|
||||
|
||||
# specify the flags to be used for the network, actually only <up> is allowed
|
||||
# which mean the network should be set up when created. If the network is set
|
||||
# up, the loopback is automatically set up too.
|
||||
# up, the loopback is automatically set up too.
|
||||
lxc.network.flags = up
|
||||
|
||||
# specify the physical network device which will communicate with the
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -235,7 +235,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
specify an action to do for the
|
||||
network.
|
||||
</para>
|
||||
|
||||
|
||||
<para><option>up:</option> activates the interface.
|
||||
</para>
|
||||
</listitem>
|
||||
@ -849,7 +849,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
<simpara>
|
||||
<simpara>
|
||||
<citerefentry>
|
||||
<refentrytitle><command>chroot</command></refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
@ -867,14 +867,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
</simpara>
|
||||
</refsect1>
|
||||
|
||||
|
||||
&seealso;
|
||||
|
||||
<refsect1>
|
||||
<title>Author</title>
|
||||
<para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
|
||||
lxc: linux Container library
|
||||
|
||||
@ -239,7 +239,7 @@ rootfs
|
||||
/sbin /home/root/sshd/rootfs/sbin none ro,bind 0 0
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
|
||||
<para>How to run a system in a container ?</para>
|
||||
|
||||
<para>Running a system inside a container is paradoxically easier
|
||||
@ -249,7 +249,7 @@ rootfs
|
||||
without configuration because the container will set them
|
||||
up. eg. the ipv4 address will be setup by the system container
|
||||
init scripts. Here is an example of the mount points file:
|
||||
|
||||
|
||||
<programlisting>
|
||||
[root@lxc debian]$ cat fstab
|
||||
|
||||
@ -312,7 +312,7 @@ rootfs
|
||||
<refsect2>
|
||||
<title>Configuration</title>
|
||||
<para>The container is configured through a configuration
|
||||
file, the format of the configuration file is described in
|
||||
file, the format of the configuration file is described in
|
||||
<citerefentry>
|
||||
<refentrytitle><filename>lxc.conf</filename></refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
@ -363,7 +363,7 @@ rootfs
|
||||
but if needed the <command>lxc-stop</command> command can
|
||||
be used to kill the still running application.
|
||||
</para>
|
||||
|
||||
|
||||
<para>
|
||||
Running an application inside a container is not exactly the
|
||||
same thing as running a system. For this reason, there are two
|
||||
@ -434,7 +434,7 @@ rootfs
|
||||
lxc-freeze -n foo
|
||||
</programlisting>
|
||||
|
||||
will put all the processes in an uninteruptible state and
|
||||
will put all the processes in an uninteruptible state and
|
||||
|
||||
<programlisting>
|
||||
lxc-unfreeze -n foo
|
||||
|
@ -52,7 +52,7 @@ int lxc_af_unix_open(const char *path, int type, int flags)
|
||||
|
||||
addr.sun_family = AF_UNIX;
|
||||
/* copy entire buffer in case of abstract socket */
|
||||
memcpy(addr.sun_path, path,
|
||||
memcpy(addr.sun_path, path,
|
||||
path[0]?strlen(path):sizeof(addr.sun_path));
|
||||
|
||||
if (bind(fd, (struct sockaddr *)&addr, sizeof(addr))) {
|
||||
@ -73,7 +73,7 @@ int lxc_af_unix_close(int fd)
|
||||
struct sockaddr_un addr;
|
||||
socklen_t addrlen;
|
||||
|
||||
if (!getsockname(fd, (struct sockaddr *)&addr, &addrlen) &&
|
||||
if (!getsockname(fd, (struct sockaddr *)&addr, &addrlen) &&
|
||||
addr.sun_path[0])
|
||||
unlink(addr.sun_path);
|
||||
|
||||
@ -95,7 +95,7 @@ int lxc_af_unix_connect(const char *path)
|
||||
|
||||
addr.sun_family = AF_UNIX;
|
||||
/* copy entire buffer in case of abstract socket */
|
||||
memcpy(addr.sun_path, path,
|
||||
memcpy(addr.sun_path, path,
|
||||
path[0]?strlen(path):sizeof(addr.sun_path));
|
||||
|
||||
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr))) {
|
||||
@ -161,7 +161,7 @@ int lxc_af_unix_recv_fd(int fd, int *recvfd, void *data, size_t size)
|
||||
|
||||
cmsg = CMSG_FIRSTHDR(&msg);
|
||||
|
||||
/* if the message is wrong the variable will not be
|
||||
/* if the message is wrong the variable will not be
|
||||
* filled and the peer will notified about a problem */
|
||||
*recvfd = -1;
|
||||
|
||||
|
@ -62,7 +62,7 @@ static int genetlink_resolve_family(const char *family)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = nla_put_string((struct nlmsg *)&request->nlmsghdr,
|
||||
ret = nla_put_string((struct nlmsg *)&request->nlmsghdr,
|
||||
CTRL_ATTR_FAMILY_NAME, family);
|
||||
if (ret)
|
||||
goto out;
|
||||
@ -130,7 +130,7 @@ extern int genetlink_send(struct genl_handler *handler, struct genlmsg *genlmsg)
|
||||
return netlink_send(&handler->nlh, (struct nlmsg *)&genlmsg->nlmsghdr);
|
||||
}
|
||||
|
||||
extern int genetlink_transaction(struct genl_handler *handler,
|
||||
extern int genetlink_transaction(struct genl_handler *handler,
|
||||
struct genlmsg *request, struct genlmsg *answer)
|
||||
{
|
||||
return netlink_transaction(&handler->nlh, (struct nlmsg *)&request->nlmsghdr,
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define GENLMSG_DATA(glh) ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
|
||||
|
||||
/*
|
||||
* struct genl_handler : the structure which store the netlink handler
|
||||
* struct genl_handler : the structure which store the netlink handler
|
||||
* and the family number resulting of the auto-generating id family
|
||||
* for the generic netlink protocol
|
||||
*
|
||||
@ -116,6 +116,6 @@ void genlmsg_free(struct genlmsg *genlmsg);
|
||||
*
|
||||
* Returns 0 on success, < 0 otherwise
|
||||
*/
|
||||
int genetlink_transaction(struct genl_handler *handler,
|
||||
int genetlink_transaction(struct genl_handler *handler,
|
||||
struct genlmsg *request, struct genlmsg *answer);
|
||||
#endif
|
||||
|
@ -89,7 +89,7 @@ fi
|
||||
echo -n "Cgroup device: " && is_enabled CONFIG_CGROUP_DEVICE
|
||||
echo -n "Cgroup sched: " && is_enabled CONFIG_CGROUP_SCHED
|
||||
echo -n "Cgroup cpu account: " && is_enabled CONFIG_CGROUP_CPUACCT
|
||||
echo -n "Cgroup memory controller: "
|
||||
echo -n "Cgroup memory controller: "
|
||||
if [ $KVER_MAJOR -ge 3 -a $KVER_MINOR -ge 6 ]; then
|
||||
is_enabled CONFIG_MEMCG
|
||||
else
|
||||
|
@ -102,7 +102,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
switch (msg.type) {
|
||||
case lxc_msg_state:
|
||||
printf("'%s' changed state to [%s]\n",
|
||||
printf("'%s' changed state to [%s]\n",
|
||||
msg.name, lxc_state2str(msg.value));
|
||||
break;
|
||||
default:
|
||||
|
@ -122,7 +122,7 @@ int main(int argc, char *argv[])
|
||||
return err;
|
||||
|
||||
if (!my_args.argc)
|
||||
args = default_args;
|
||||
args = default_args;
|
||||
else
|
||||
args = my_args.argv;
|
||||
|
||||
|
@ -59,7 +59,7 @@ int lxc_mainloop(struct lxc_epoll_descr *descr)
|
||||
|
||||
/* If the handler returns a positive value, exit
|
||||
the mainloop */
|
||||
if (handler->callback(handler->fd, handler->data,
|
||||
if (handler->callback(handler->fd, handler->data,
|
||||
descr) > 0)
|
||||
return 0;
|
||||
}
|
||||
@ -69,7 +69,7 @@ int lxc_mainloop(struct lxc_epoll_descr *descr)
|
||||
}
|
||||
}
|
||||
|
||||
int lxc_mainloop_add_handler(struct lxc_epoll_descr *descr, int fd,
|
||||
int lxc_mainloop_add_handler(struct lxc_epoll_descr *descr, int fd,
|
||||
lxc_mainloop_callback_t callback, void *data)
|
||||
{
|
||||
struct epoll_event ev;
|
||||
|
@ -28,13 +28,13 @@ struct lxc_epoll_descr {
|
||||
struct lxc_list handlers;
|
||||
};
|
||||
|
||||
typedef int (*lxc_mainloop_callback_t)(int fd, void *data,
|
||||
typedef int (*lxc_mainloop_callback_t)(int fd, void *data,
|
||||
struct lxc_epoll_descr *descr);
|
||||
|
||||
extern int lxc_mainloop(struct lxc_epoll_descr *descr);
|
||||
|
||||
extern int lxc_mainloop_add_handler(struct lxc_epoll_descr *descr, int fd,
|
||||
lxc_mainloop_callback_t callback,
|
||||
lxc_mainloop_callback_t callback,
|
||||
void *data);
|
||||
|
||||
extern int lxc_mainloop_del_handler(struct lxc_epoll_descr *descr, int fd);
|
||||
|
@ -100,7 +100,7 @@ extern int lxc_ipv6_gateway_add(int ifindex, struct in6_addr *gw);
|
||||
*/
|
||||
extern int lxc_bridge_attach(const char *bridge, const char *ifname);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Create default gateway
|
||||
*/
|
||||
extern int lxc_route_create_default(const char *addr, const char *ifname,
|
||||
|
14
src/lxc/nl.c
14
src/lxc/nl.c
@ -48,7 +48,7 @@ extern void *nlmsg_data(struct nlmsg *nlmsg)
|
||||
return data;
|
||||
}
|
||||
|
||||
static int nla_put(struct nlmsg *nlmsg, int attr,
|
||||
static int nla_put(struct nlmsg *nlmsg, int attr,
|
||||
const void *data, size_t len)
|
||||
{
|
||||
struct rtattr *rta;
|
||||
@ -63,7 +63,7 @@ static int nla_put(struct nlmsg *nlmsg, int attr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int nla_put_buffer(struct nlmsg *nlmsg, int attr,
|
||||
extern int nla_put_buffer(struct nlmsg *nlmsg, int attr,
|
||||
const void *data, size_t size)
|
||||
{
|
||||
return nla_put(nlmsg, attr, data, size);
|
||||
@ -193,7 +193,7 @@ extern int netlink_send(struct nl_handler *handler, struct nlmsg *nlmsg)
|
||||
#ifndef NLMSG_ERROR
|
||||
#define NLMSG_ERROR 0x2
|
||||
#endif
|
||||
extern int netlink_transaction(struct nl_handler *handler,
|
||||
extern int netlink_transaction(struct nl_handler *handler,
|
||||
struct nlmsg *request, struct nlmsg *answer)
|
||||
{
|
||||
int ret;
|
||||
@ -226,11 +226,11 @@ extern int netlink_open(struct nl_handler *handler, int protocol)
|
||||
if (handler->fd < 0)
|
||||
return -errno;
|
||||
|
||||
if (setsockopt(handler->fd, SOL_SOCKET, SO_SNDBUF,
|
||||
if (setsockopt(handler->fd, SOL_SOCKET, SO_SNDBUF,
|
||||
&sndbuf, sizeof(sndbuf)) < 0)
|
||||
return -errno;
|
||||
|
||||
if (setsockopt(handler->fd, SOL_SOCKET, SO_RCVBUF,
|
||||
if (setsockopt(handler->fd, SOL_SOCKET, SO_RCVBUF,
|
||||
&rcvbuf,sizeof(rcvbuf)) < 0)
|
||||
return -errno;
|
||||
|
||||
@ -238,12 +238,12 @@ extern int netlink_open(struct nl_handler *handler, int protocol)
|
||||
handler->local.nl_family = AF_NETLINK;
|
||||
handler->local.nl_groups = 0;
|
||||
|
||||
if (bind(handler->fd, (struct sockaddr*)&handler->local,
|
||||
if (bind(handler->fd, (struct sockaddr*)&handler->local,
|
||||
sizeof(handler->local)) < 0)
|
||||
return -errno;
|
||||
|
||||
socklen = sizeof(handler->local);
|
||||
if (getsockname(handler->fd, (struct sockaddr*)&handler->local,
|
||||
if (getsockname(handler->fd, (struct sockaddr*)&handler->local,
|
||||
&socklen) < 0)
|
||||
return -errno;
|
||||
|
||||
|
32
src/lxc/nl.h
32
src/lxc/nl.h
@ -39,7 +39,7 @@
|
||||
* struct nl_handler : the handler for netlink sockets, this structure
|
||||
* is used all along the netlink socket life cycle to specify the
|
||||
* netlink socket to be used.
|
||||
*
|
||||
*
|
||||
* @fd: the file descriptor of the netlink socket
|
||||
* @seq: the sequence number of the netlink messages
|
||||
* @local: the bind address
|
||||
@ -77,7 +77,7 @@ struct nlmsg {
|
||||
int netlink_open(struct nl_handler *handler, int protocol);
|
||||
|
||||
/*
|
||||
* netlink_close : close a netlink socket, after this call,
|
||||
* netlink_close : close a netlink socket, after this call,
|
||||
* the handler is no longer valid
|
||||
*
|
||||
* @handler: a handler to the netlink socket
|
||||
@ -87,8 +87,8 @@ int netlink_open(struct nl_handler *handler, int protocol);
|
||||
int netlink_close(struct nl_handler *handler);
|
||||
|
||||
/*
|
||||
* netlink_rcv : receive a netlink message from the kernel.
|
||||
* It is up to the caller to manage the allocation of the
|
||||
* netlink_rcv : receive a netlink message from the kernel.
|
||||
* It is up to the caller to manage the allocation of the
|
||||
* netlink message
|
||||
*
|
||||
* @handler: a handler to the netlink socket
|
||||
@ -110,8 +110,8 @@ int netlink_rcv(struct nl_handler *handler, struct nlmsg *nlmsg);
|
||||
int netlink_send(struct nl_handler *handler, struct nlmsg *nlmsg);
|
||||
|
||||
/*
|
||||
* netlink_transaction: send a request to the kernel and read the response.
|
||||
* This is useful for transactional protocol. It is up to the caller
|
||||
* netlink_transaction: send a request to the kernel and read the response.
|
||||
* This is useful for transactional protocol. It is up to the caller
|
||||
* to manage the allocation of the netlink message.
|
||||
*
|
||||
* @handler: a handler to a opened netlink socket
|
||||
@ -120,11 +120,11 @@ int netlink_send(struct nl_handler *handler, struct nlmsg *nlmsg);
|
||||
*
|
||||
* Returns 0 on success, < 0 otherwise
|
||||
*/
|
||||
int netlink_transaction(struct nl_handler *handler,
|
||||
int netlink_transaction(struct nl_handler *handler,
|
||||
struct nlmsg *request, struct nlmsg *anwser);
|
||||
|
||||
/*
|
||||
* nla_put_string: copy a null terminated string to a netlink message
|
||||
* nla_put_string: copy a null terminated string to a netlink message
|
||||
* attribute
|
||||
*
|
||||
* @nlmsg: the netlink message to be filled
|
||||
@ -146,7 +146,7 @@ int nla_put_string(struct nlmsg *nlmsg, int attr, const char *string);
|
||||
*
|
||||
* Returns 0 on success, < 0 otherwise
|
||||
*/
|
||||
int nla_put_buffer(struct nlmsg *nlmsg, int attr,
|
||||
int nla_put_buffer(struct nlmsg *nlmsg, int attr,
|
||||
const void *data, size_t size);
|
||||
|
||||
/*
|
||||
@ -172,7 +172,7 @@ int nla_put_u32(struct nlmsg *nlmsg, int attr, int value);
|
||||
int nla_put_u16(struct nlmsg *nlmsg, int attr, ushort value);
|
||||
|
||||
/*
|
||||
* nla_put_attr: add an attribute name to a netlink
|
||||
* nla_put_attr: add an attribute name to a netlink
|
||||
*
|
||||
* @nlmsg: the netlink message to be filled
|
||||
* @attr: the attribute name of the integer
|
||||
@ -185,7 +185,7 @@ int nla_put_attr(struct nlmsg *nlmsg, int attr);
|
||||
* nla_begin_nested: begin the nesting attribute
|
||||
*
|
||||
* @nlmsg: the netlink message to be filled
|
||||
* @attr: the netsted attribute name
|
||||
* @attr: the netsted attribute name
|
||||
*
|
||||
* Returns current nested pointer to be reused
|
||||
* to nla_end_nested.
|
||||
@ -198,17 +198,17 @@ struct rtattr *nla_begin_nested(struct nlmsg *nlmsg, int attr);
|
||||
* @nlmsg: the netlink message
|
||||
* @nested: the nested pointer
|
||||
*
|
||||
* Returns the current
|
||||
* Returns the current
|
||||
*/
|
||||
void nla_end_nested(struct nlmsg *nlmsg, struct rtattr *attr);
|
||||
|
||||
/*
|
||||
* nlmsg_allocate : allocate a netlink message. The netlink format message
|
||||
* nlmsg_allocate : allocate a netlink message. The netlink format message
|
||||
* is a header, a padding, a payload and a padding again.
|
||||
* When a netlink message is allocated, the size specify the
|
||||
* When a netlink message is allocated, the size specify the
|
||||
* payload we want. So the real size of the allocated message
|
||||
* is sizeof(header) + sizeof(padding) + payloadsize + sizeof(padding),
|
||||
* in other words, the function will allocate more than specified. When
|
||||
* in other words, the function will allocate more than specified. When
|
||||
* the buffer is allocated, the content is zeroed.
|
||||
* The function will also fill the field nlmsg_len with computed size.
|
||||
* If the allocation must be for the specified size, just use malloc.
|
||||
@ -228,7 +228,7 @@ void nlmsg_free(struct nlmsg *nlmsg);
|
||||
|
||||
/*
|
||||
* nlmsg_data : returns a pointer to the data contained in the netlink message
|
||||
*
|
||||
*
|
||||
* @nlmsg : the netlink message to get the data
|
||||
*
|
||||
* Returns a pointer to the netlink data or NULL if there is no data
|
||||
|
@ -53,7 +53,7 @@ extern int rtnetlink_send(struct rtnl_handler *handler, struct rtnlmsg *rtnlmsg)
|
||||
return netlink_send(&handler->nlh, (struct nlmsg *)&rtnlmsg->nlmsghdr);
|
||||
}
|
||||
|
||||
extern int rtnetlink_transaction(struct rtnl_handler *handler,
|
||||
extern int rtnetlink_transaction(struct rtnl_handler *handler,
|
||||
struct rtnlmsg *request, struct rtnlmsg *answer)
|
||||
{
|
||||
return netlink_transaction(&handler->nlh, (struct nlmsg *)&request->nlmsghdr,
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define RTNLMSG_DATA(glh) ((void *)(NLMSG_DATA(glh) + RTNL_HDRLEN))
|
||||
|
||||
/*
|
||||
* struct genl_handler : the structure which store the netlink handler
|
||||
* struct genl_handler : the structure which store the netlink handler
|
||||
* and the family number
|
||||
*
|
||||
* @nlh: the netlink socket handler
|
||||
@ -105,6 +105,6 @@ void rtnlmsg_free(struct rtnlmsg *rtnlmsg);
|
||||
*
|
||||
* Returns 0 on success, < 0 otherwise
|
||||
*/
|
||||
int rtnetlink_transaction(struct rtnl_handler *handler,
|
||||
int rtnetlink_transaction(struct rtnl_handler *handler,
|
||||
struct rtnlmsg *request, struct rtnlmsg *answer);
|
||||
#endif
|
||||
|
@ -54,7 +54,7 @@ c1:12345:respawn:/sbin/getty 38400 tty1 linux
|
||||
c2:12345:respawn:/sbin/getty 38400 tty2 linux
|
||||
c3:12345:respawn:/sbin/getty 38400 tty3 linux
|
||||
c4:12345:respawn:/sbin/getty 38400 tty4 linux
|
||||
p6::ctrlaltdel:/sbin/init 6
|
||||
p6::ctrlaltdel:/sbin/init 6
|
||||
p0::powerfail:/sbin/init 0
|
||||
EOF
|
||||
|
||||
|
@ -105,7 +105,7 @@ EOF
|
||||
# remove module stuff for iptables it just shows errors that are not
|
||||
# relevant in a container
|
||||
if [ -f "$container_rootfs/etc/sysconfig/iptables-config" ]; then
|
||||
sed -i 's|IPTABLES_MODULES=".*|IPTABLES_MODULES=""|' $container_rootfs/etc/sysconfig/iptables-config
|
||||
sed -i 's|IPTABLES_MODULES=".*|IPTABLES_MODULES=""|' $container_rootfs/etc/sysconfig/iptables-config
|
||||
sed -i 's|IPTABLES_MODULES_UNLOAD=".*|IPTABLES_MODULES_UNLOAD="no"|' $container_rootfs/etc/sysconfig/iptables-config
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user