Add a thread-safe and uniform way to retrieve errno values in programs that are
shipped as part of LXC but are not expected to have access to the logging
system.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
checkpatch.pl emits error
ERROR: do not use assignment in if condition
Move assignment out of if statement.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
checkpatch.pl emits a bunch of warnings about various whitespace
issues. Fix all these as a single patch since they are all whitespace
only changes.
Fix whitespace issues found by checkpatch.pl
Signed-off-by: Tobin C. Harding <me@tobin.cc>
checkpatch.pl emits error
ERROR: do not use assignment in if condition
Correctly indent switch statement.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Currently if lxc-usernsexec is run on a kernel without user namespaces
enabled the error message is
unshare: Invalid argument
read pipe: Success
This error message 'Invalid argument' does not point at the root cause
of the error. We can help the user out by giving a more detailed error
message and also not using perror() if errno==0.
Improve error message by
- Printing unshare flags
- Printing suggested cause of failure (user namespace not enabled)
- Print error message with fprintf() if errno==0 (EOF)
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Current we have a few minor grammatical errors in the documentation for
lxc container configuration.
Fix minor grammatical errors.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
sleep() is not thread-safe but nanosleep() is. Since no resources are allocated
in lxc_wait() it is safe to call nanosleep() without cancellation handlers.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
When we check whether an open file description lock has been taken on a file we
need to set the l_pid field to 0 otherwise the kernel will send back EINVAL.
Additionally, the kernel will not do pid translation and simply set the l_pid
value to -1.
Fixes https://discuss.linuxcontainers.org/t/container-deleted-or-stopped-when-lxc-ls-executed-concurrently/2439
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
These allow to pass a struct nlmsghdr directly and are used in the higher level
netlink_{send,rcv,transaction}.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Start to allocate a new network namespace id for each container.
Relates to https://github.com/lxc/lxd/issues/4831.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>