]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
6 years agoFix spacing error in namespace.c 2719/head
Jungsub [Tue, 6 Nov 2018 14:25:11 +0000 (14:25 +0000)] 
Fix spacing error in namespace.c

Signed-off-by: Jungsub Shin supsup5642@tmax.co.kr
6 years agooci-template: Add logic for no /etc/passwd, group 2657/head
Jungsub Shin [Fri, 28 Sep 2018 10:21:08 +0000 (19:21 +0900)] 
oci-template: Add logic for no /etc/passwd, group

OCI image spec dosen't specify action when there is
no /etc/passwd or /etc/group. So if there is no
/etc/passwd with string user info, set uid to 0. If there
is no /etc/group with string group info, set gid to 0.

Signed-off-by: Jungsub Shin jungsub_shin@tmax.co.kr
6 years agotemplate: oci template supports for char user info 2629/head
Jungsub Shin [Fri, 21 Sep 2018 06:29:37 +0000 (15:29 +0900)] 
template: oci template supports for char user info

oci template changes character user info to uid, gid
according to OCI image spec.

Signed-off-by: Jungsub Shin jungsub_shin@tmax.co.kr
6 years agostart: Fix net iface remaining issue 2559/head 2628/head
Jungsub Shin [Tue, 21 Aug 2018 10:21:59 +0000 (19:21 +0900)] 
start: Fix net iface remaining issue

When creating container that has multiple net ifaces fails
because of wrong net config, lxc doesn't remove previously created
net ifaces.

Solve this issue with changing return path in lxc_spawn().

Signed-off-by: Jungsub Shin jungsub_shin@tmax.co.kr
6 years agoMerge pull request #2555 from tcharding/clang-format-cmd
Christian Brauner [Tue, 21 Aug 2018 09:25:34 +0000 (11:25 +0200)] 
Merge pull request #2555 from tcharding/clang-format-cmd

cmd: Fix format issues found by clang-format

6 years agoMerge pull request #2557 from 2xsec/bugfix
Christian Brauner [Tue, 21 Aug 2018 09:24:52 +0000 (11:24 +0200)] 
Merge pull request #2557 from 2xsec/bugfix

list: fix indent

6 years agolist: fix indent 2557/head
2xsec [Tue, 21 Aug 2018 06:02:06 +0000 (15:02 +0900)] 
list: fix indent

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agocmd: Fix format issues found by clang-format 2555/head
Tobin C. Harding [Mon, 20 Aug 2018 23:44:36 +0000 (09:44 +1000)] 
cmd: Fix format issues found by clang-format

clang-format finds a few format issues, lets fix these up.

Fix format issues found by clang-format.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoMerge pull request #2552 from tcharding/cpp-check
Christian Brauner [Mon, 20 Aug 2018 23:37:31 +0000 (01:37 +0200)] 
Merge pull request #2552 from tcharding/cpp-check

cmd: Lint with cppcheck

6 years agocmd: Reduce scope of 'count' variable 2552/head
Tobin C. Harding [Mon, 20 Aug 2018 06:31:33 +0000 (16:31 +1000)] 
cmd: Reduce scope of 'count' variable

Variable is used in one plaice only within a nested statement block.
The code is cleaner if the variable is declared near where it is used.
Found using cppcheck.

Reduce the scope of 'count' variable.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Do not reassign variable before it is used
Tobin C. Harding [Mon, 20 Aug 2018 06:28:39 +0000 (16:28 +1000)] 
cmd: Do not reassign variable before it is used

cppcheck emits warning

  Variable 'ofd' is reassigned a value before the old one has been used.

We do not need to initialise a variable if it is assigned to on first use.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoMerge pull request #2549 from brauner/2018-08-19/cmd_usernsexec_fixes
Wolfgang Bumiller [Mon, 20 Aug 2018 13:35:10 +0000 (15:35 +0200)] 
Merge pull request #2549 from brauner/2018-08-19/cmd_usernsexec_fixes

cmd: lxc-usernsexec fixes + macro: move declarations + config_utils: macvlan fixes

6 years agocmd: use goto for cleanup in lxc-usernsexec 2549/head
Christian Brauner [Mon, 20 Aug 2018 12:24:55 +0000 (14:24 +0200)] 
cmd: use goto for cleanup in lxc-usernsexec

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2550 from 2xsec/bugfix
Christian Brauner [Mon, 20 Aug 2018 10:34:15 +0000 (12:34 +0200)] 
Merge pull request #2550 from 2xsec/bugfix

storage: exit() => _exit()

6 years agoMerge pull request #2542 from tcharding/signal-fail-2523
Christian Brauner [Mon, 20 Aug 2018 10:33:45 +0000 (12:33 +0200)] 
Merge pull request #2542 from tcharding/signal-fail-2523

tools: Indicate container startup failure

6 years agoMerge pull request #2553 from Blub/ttydir-path-fixup
Christian Brauner [Mon, 20 Aug 2018 08:37:50 +0000 (10:37 +0200)] 
Merge pull request #2553 from Blub/ttydir-path-fixup

conf: fix path/lxcpath mixups in tty setup

6 years agoconf: fix path/lxcpath mixups in tty setup 2553/head
Wolfgang Bumiller [Mon, 20 Aug 2018 08:02:35 +0000 (10:02 +0200)] 
conf: fix path/lxcpath mixups in tty setup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes: 6947153da ("conf: use mknod() to create dummy mount target")
6 years agotools: lxc-wait: add default log priority & cleanups 2550/head
2xsec [Mon, 20 Aug 2018 01:43:22 +0000 (10:43 +0900)] 
tools: lxc-wait: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agostorage: exit() => _exit(). when exec is failed, child process needs to use _exit()
2xsec [Mon, 20 Aug 2018 01:41:50 +0000 (10:41 +0900)] 
storage: exit() => _exit(). when exec is failed, child process needs to use _exit()

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: Indicate container startup failure 2542/head
Tobin C. Harding [Fri, 17 Aug 2018 06:49:46 +0000 (16:49 +1000)] 
tools: Indicate container startup failure

When running lxc-autostart we do not currently indicate failure to start
containers, either partial failure i.e. some of the containers failed to
start or total failure i.e. all of the containers failed to start.

Indicate container startup failure.  For total failure exit(1), for
partial failure exit(2).

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agomacro: add macvlan properties
Christian Brauner [Sun, 19 Aug 2018 18:14:25 +0000 (20:14 +0200)] 
macro: add macvlan properties

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agomacro: add missing headers
Christian Brauner [Sun, 19 Aug 2018 18:01:45 +0000 (20:01 +0200)] 
macro: add missing headers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocmd: use safe number parsers in lxc-usernsexec
Christian Brauner [Sun, 19 Aug 2018 17:41:00 +0000 (19:41 +0200)] 
cmd: use safe number parsers in lxc-usernsexec

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocmd: simplify lxc-usernsexec
Christian Brauner [Sun, 19 Aug 2018 17:37:49 +0000 (19:37 +0200)] 
cmd: simplify lxc-usernsexec

Calculate length only once.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocmd: use utils.{c,h} helpers in lxc-usernsexec
Christian Brauner [Sun, 19 Aug 2018 17:33:25 +0000 (19:33 +0200)] 
cmd: use utils.{c,h} helpers in lxc-usernsexec

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocmd: move declarations to macro.h
Christian Brauner [Sun, 19 Aug 2018 17:32:38 +0000 (19:32 +0200)] 
cmd: move declarations to macro.h

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocmd: lxc-usernsexec reorder includes
Christian Brauner [Sun, 19 Aug 2018 17:30:59 +0000 (19:30 +0200)] 
cmd: lxc-usernsexec reorder includes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2548 from 2xsec/bugfix
Christian Brauner [Sun, 19 Aug 2018 10:03:27 +0000 (12:03 +0200)] 
Merge pull request #2548 from 2xsec/bugfix

cmd: lxc-user-nic: change log macro & cleanups

6 years agocmd: lxc-user-nic: change log macro & cleanups 2548/head
2xsec [Sun, 19 Aug 2018 03:45:54 +0000 (12:45 +0900)] 
cmd: lxc-user-nic: change log macro & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2547 from brauner/2018-08-18/fix_execute_parsing
Serge Hallyn [Sat, 18 Aug 2018 16:35:11 +0000 (11:35 -0500)] 
Merge pull request #2547 from brauner/2018-08-18/fix_execute_parsing

tools: fix lxc-execute command parsing

6 years agoMerge pull request #2545 from ljagiello/integer-overflow
Christian Brauner [Sat, 18 Aug 2018 16:05:19 +0000 (18:05 +0200)] 
Merge pull request #2545 from ljagiello/integer-overflow

storage/loop.c: integer overflow

6 years agolseek - integer overflow 2545/head
Lukasz Jagiello [Sat, 18 Aug 2018 15:32:21 +0000 (08:32 -0700)] 
lseek - integer overflow

The issue was introduced in PR (https://github.com/lxc/lxc/pull/1705):

Previous code:
```
  if (lseek(fd, size, SEEK_SET) < 0) {
    SYSERROR("Error seeking to set new loop file size");
    close(fd);
    return -1;
  }
```
New code:
```
  int fd, ret;

  [...]

  ret = lseek(fd, size, SEEK_SET);
  if (ret < 0) {
    SYSERROR("Failed to seek to set new loop file size for loop "
       "file \"%s\"", path);
    close(fd);
    return -1;
  }
```

Based on http://man7.org/linux/man-pages/man2/lseek.2.html:
> Upon successful completion, lseek() returns the resulting offset
> location as measured in bytes from the beginning of the file.

So in this case value of `size` and `size` is `uint64_t`.

This fix change declaration of `ret`, but it can be fixed in other ways.
Let me know what works for you.

This PR fix issues (https://github.com/lxc/lxc/issues/1872).

Signed-off-by: Lukasz Jagiello <lukasz@wikia-inc.com>
6 years agotools: fix lxc-execute command parsing 2547/head
Christian Brauner [Sat, 18 Aug 2018 09:56:05 +0000 (11:56 +0200)] 
tools: fix lxc-execute command parsing

Initialize buf to avoid parsing random data later on.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2546 from 2xsec/bugfix
Christian Brauner [Sat, 18 Aug 2018 09:46:10 +0000 (11:46 +0200)] 
Merge pull request #2546 from 2xsec/bugfix

storage_utils: move duplicated function from tools

6 years agostorage_utils: move duplicated function from tools 2546/head
2xsec [Sat, 18 Aug 2018 09:05:32 +0000 (18:05 +0900)] 
storage_utils: move duplicated function from tools

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2544 from 2xsec/bugfix
Christian Brauner [Sat, 18 Aug 2018 07:58:53 +0000 (09:58 +0200)] 
Merge pull request #2544 from 2xsec/bugfix

tools: add default log priority & cleanups

6 years agotools: lxc-unfreeze: add default log priority & cleanups 2544/head
2xsec [Fri, 17 Aug 2018 16:42:15 +0000 (01:42 +0900)] 
tools: lxc-unfreeze: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-freeze: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:41:51 +0000 (01:41 +0900)] 
tools: lxc-freeze: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-stop: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:41:06 +0000 (01:41 +0900)] 
tools: lxc-stop: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-start: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:40:29 +0000 (01:40 +0900)] 
tools: lxc-start: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-execute: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:39:20 +0000 (01:39 +0900)] 
tools: lxc-execute: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-device: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:38:13 +0000 (01:38 +0900)] 
tools: lxc-device: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-destroy: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:36:58 +0000 (01:36 +0900)] 
tools: lxc-destroy: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-create: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:35:57 +0000 (01:35 +0900)] 
tools: lxc-create: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-console: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:34:28 +0000 (01:34 +0900)] 
tools: lxc-console: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-checkpoint: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:33:37 +0000 (01:33 +0900)] 
tools: lxc-checkpoint: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-cgroup: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:31:54 +0000 (01:31 +0900)] 
tools: lxc-cgroup: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-attach: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:30:52 +0000 (01:30 +0900)] 
tools: lxc-attach: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2543 from brauner/2018-08-17/silence_init_umount_failures
Stéphane Graber [Fri, 17 Aug 2018 14:48:33 +0000 (10:48 -0400)] 
Merge pull request #2543 from brauner/2018-08-17/silence_init_umount_failures

lxc_init: s/SYSDEBUG()/SYSERROR()/g in remove_self

6 years agolxc_init: s/SYSDEBUG()/SYSERROR()/g in remove_self 2543/head
Christian Brauner [Fri, 17 Aug 2018 09:47:25 +0000 (11:47 +0200)] 
lxc_init: s/SYSDEBUG()/SYSERROR()/g in remove_self

Since we switched to execveat() whenever possible in
commit 4b5b3a2a299b ("execute: use execveat() syscall if supported")
it is unlikely that remove_self() has any job to do at all. So dumb down the
error levels.

Closes #2536.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2540 from tcharding/checkatch-cmd
Christian Brauner [Fri, 17 Aug 2018 09:41:27 +0000 (11:41 +0200)] 
Merge pull request #2540 from tcharding/checkatch-cmd

cmd: Fix up checkpatch warnings

6 years agoMerge pull request #2539 from tcharding/contributing
Christian Brauner [Fri, 17 Aug 2018 09:27:22 +0000 (11:27 +0200)] 
Merge pull request #2539 from tcharding/contributing

Clean up contributing and coding stlye docs

6 years agocmd: Do not use comparison to NULL 2540/head
Tobin C. Harding [Fri, 17 Aug 2018 06:18:27 +0000 (16:18 +1000)] 
cmd: Do not use comparison to NULL

checkpatch emits two warnings of type:

    CHECK: Comparison to NULL could be written "!foo"

Prefer `(!foo)` instead of `(foo == NULL)`.

Do not use comparison to NULL, use !foo

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Remove typo'd semicolon
Tobin C. Harding [Fri, 17 Aug 2018 06:14:30 +0000 (16:14 +1000)] 
cmd: Remove typo'd semicolon

checkpatch emits warning:

    WARNING: Statements terminations use 1 semicolon

Remove typo'd semicolon.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Put trailing */ on a separate line
Tobin C. Harding [Fri, 17 Aug 2018 06:13:29 +0000 (16:13 +1000)] 
cmd: Put trailing */ on a separate line

checkpatch emits warning:

    WARNING: Block comments use a trailing */ on a separate line

Put trailing */ on a separate line.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Remove unnecessary whitespace in string
Tobin C. Harding [Fri, 17 Aug 2018 06:08:01 +0000 (16:08 +1000)] 
cmd: Remove unnecessary whitespace in string

checkpatch emits warning:

    WARNING: unnecessary whitespace before a quoted newline

Remove unnecessary whitespace before a quoted newline

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Use 'const' for static string constant.
Tobin C. Harding [Fri, 17 Aug 2018 06:05:14 +0000 (16:05 +1000)] 
cmd: Use 'const' for static string constant.

checkpatch emits warning:

WARNING: static char array declaration should probably be static const char

Use 'const' for static string constant (array of chars).

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Fix whitespace issues
Tobin C. Harding [Fri, 17 Aug 2018 06:02:28 +0000 (16:02 +1000)] 
cmd: Fix whitespace issues

checkpatch warns about a bunch of whitespace issues.  Fix the
non-controversial ones.

Fix whitespace issues found by checkpatch.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Do not use braces for single statement block
Tobin C. Harding [Fri, 17 Aug 2018 05:52:09 +0000 (15:52 +1000)] 
cmd: Do not use braces for single statement block

checkpatch emites warning:

    WARNING: braces {} are not necessary for single statement blocks

Do not use braces for single statement block.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Use 'void' instead of empty parameter list
Tobin C. Harding [Fri, 17 Aug 2018 05:44:25 +0000 (15:44 +1000)] 
cmd: Use 'void' instead of empty parameter list

checkpatch warns because of function definitions using empty parameter
list.  We should define these functions with 'void' as the parameter.

Use 'void' instead of empty parameter list for function definitions.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Use parenthesis around complex macro
Tobin C. Harding [Fri, 17 Aug 2018 05:42:32 +0000 (15:42 +1000)] 
cmd: Use parenthesis around complex macro

checkpatch emits error:

    ERROR: Macros with complex values should be enclosed in parentheses

Safeguard macro by use of parenthesis.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCODING_STYLE: Update section header format 2539/head
Tobin C. Harding [Fri, 17 Aug 2018 04:40:45 +0000 (14:40 +1000)] 
CODING_STYLE: Update section header format

Currently for section headings we use fourth level markdown heading
level (####).  We do not have levels two or three.

We can use standard incremental levels for heading adornments i.e

1) =========
2) ##
3) ###
ect.

Since this document is likely referenced by maintainers when guiding new
contributors it can save maintainer time to be able to quickly reference
a section in the coding stlye guide.  If we add numbers to each heading
(like the kernel stlye guide) then maintainers can say:

   Nice patch, please see section 3 of the coding style guide and ...

So, this patch makes two changes

- Use incremental level heading adornments
- Add a number to each section heading

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCODING_STYLE: Fix non-uniform heading level
Tobin C. Harding [Fri, 17 Aug 2018 04:07:48 +0000 (14:07 +1000)] 
CODING_STYLE: Fix non-uniform heading level

Heading uses only 3 level header (###) but the rest of the file uses
four (####).  We should be uniform.

Use uniform heading level in line with the rest of the file.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCODING_STLYE: Remove sections implied by 'kernel style'
Tobin C. Harding [Fri, 17 Aug 2018 03:55:47 +0000 (13:55 +1000)] 
CODING_STLYE: Remove sections implied by 'kernel style'

We explicitly state that LXC uses coding style based on Linux kernel
style.  It is redundant to then document obvious, and well known, kernel
style rules.  Identifier names certainly fall into this category as does
usage of braces.

Remove sections implied by 'kernel style'.  Naming conventions and brace
placement conventions.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCODING_STLYE: Simplify explanation for use of 'extern'
Tobin C. Harding [Thu, 16 Aug 2018 23:38:48 +0000 (09:38 +1000)] 
CODING_STLYE: Simplify explanation for use of 'extern'

Current explanation of rules around usage of 'extern' are overly
verbose.  It is not necessary to state that functions should be declared
in header files, the compiler already enforces this.  These rules are
simple, they are better described with simple statements.  An example is
not necessary for such simple rules and serves only to make the document
longer.

Use two simple statements describing the rules that govern function
declaration and the usage of the 'extern' keyword.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCONTRIBUTING: Add 'be' to fix grammar
Tobin C. Harding [Thu, 16 Aug 2018 23:22:40 +0000 (09:22 +1000)] 
CONTRIBUTING: Add 'be' to fix grammar

Fix minor grammatical issue.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCODING_STYLE: Mention kernel style in introduction
Tobin C. Harding [Fri, 17 Aug 2018 03:46:16 +0000 (13:46 +1000)] 
CODING_STYLE: Mention kernel style in introduction

Currently the coding style guide does not mention that we use kernel
coding style as a base style for LXC.  We have just linked to
CODING_STLYE.md from CONTRIBUTING (which mentions use of kernel coding
style).  We can increase documentation congruence and completeness by
mentioning kernel coding style guide in the introduction to our style
guide.

Add heading and introduction to coding style guide informing readers
that we follow kernel coding style as a base before explaining our style
additions.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCONTRIBUTING: Direct readers to CODING_STYLE.md
Tobin C. Harding [Thu, 16 Aug 2018 23:19:32 +0000 (09:19 +1000)] 
CONTRIBUTING: Direct readers to CODING_STYLE.md

Currently the 'Coding Style' section mentions only the kernel coding
style.  We have additions on top on this outlined in CODING_STYLE.md.
We should direct readers to this document as well as the kernel docs.

Direct readers to CODING_STLYE.md in the 'Coding Style' section.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCONTRIBUTING: Link to latest online kernel docs
Tobin C. Harding [Fri, 17 Aug 2018 04:29:15 +0000 (14:29 +1000)] 
CONTRIBUTING: Link to latest online kernel docs

Currently we link to a URL for v4.10 of the kernel docs.  Since we
already mention the kernel tree we should link to the _latest_ kernel
docs online instead of a fixed past version.

Link to latest online kernel docs tracking the mainline instead of past
fixed version.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCONTRIBUTING: Update reference to kernel coding style
Tobin C. Harding [Fri, 17 Aug 2018 04:16:47 +0000 (14:16 +1000)] 
CONTRIBUTING: Update reference to kernel coding style

Kernel coding style guide filename is stale, this file has been renamed
in the kernel tree.  While this file still exists we should use the new
filename.

Update reference to kernel coding style guide to use the new file name.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoMerge pull request #2535 from brauner/2018-08-16/cmd_fixes
Stéphane Graber [Thu, 16 Aug 2018 15:44:27 +0000 (11:44 -0400)] 
Merge pull request #2535 from brauner/2018-08-16/cmd_fixes

log: add logging tools for commands; lxc-usernsexec: cleanup and bugfixes

6 years agolxc-usernsexec: cleanup and bugfixes 2535/head
Christian Brauner [Thu, 16 Aug 2018 11:03:36 +0000 (13:03 +0200)] 
lxc-usernsexec: cleanup and bugfixes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolog: add CMD_SYSINFO()
Christian Brauner [Thu, 16 Aug 2018 11:03:21 +0000 (13:03 +0200)] 
log: add  CMD_SYSINFO()

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>
6 years agolog: add CMD_SYSERROR()
Christian Brauner [Thu, 16 Aug 2018 11:01:54 +0000 (13:01 +0200)] 
log: add  CMD_SYSERROR()

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>
6 years agoMerge pull request #2534 from tcharding/checkpatch
Christian Brauner [Thu, 16 Aug 2018 08:40:10 +0000 (10:40 +0200)] 
Merge pull request #2534 from tcharding/checkpatch

Checkpatch

6 years agoMerge pull request #2532 from tcharding/unshare-err
Christian Brauner [Thu, 16 Aug 2018 07:16:10 +0000 (09:16 +0200)] 
Merge pull request #2532 from tcharding/unshare-err

usernsexec: Make err out vebose for unshare error

6 years agocmd: Move assignment out of if statement 2534/head
Tobin C. Harding [Thu, 16 Aug 2018 07:04:58 +0000 (17:04 +1000)] 
cmd: Move assignment out of if statement

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>
6 years agocmd: Fix whitespace ERRORS
Tobin C. Harding [Thu, 16 Aug 2018 07:01:30 +0000 (17:01 +1000)] 
cmd: Fix whitespace ERRORS

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>
6 years agocmd: Do not initialise statics to 0
Tobin C. Harding [Thu, 16 Aug 2018 06:57:36 +0000 (16:57 +1000)] 
cmd: Do not initialise statics to 0

checkpatch.pl emits error

    ERROR: do not initialise statics to 0

Do not initialise statics to 0.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Correctly indent switch statement
Tobin C. Harding [Thu, 16 Aug 2018 06:55:09 +0000 (16:55 +1000)] 
cmd: Correctly indent switch statement

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>
6 years agousernsexec: Make err out vebose for unshare error 2532/head
Tobin C. Harding [Wed, 15 Aug 2018 23:43:02 +0000 (09:43 +1000)] 
usernsexec: Make err out vebose for unshare error

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>
6 years agoMerge pull request #2533 from tcharding/docs
Christian Brauner [Thu, 16 Aug 2018 05:37:07 +0000 (07:37 +0200)] 
Merge pull request #2533 from tcharding/docs

doc: Fix minor grammatical errors

6 years agodoc: Fix minor grammatical errors 2533/head
Tobin C. Harding [Thu, 16 Aug 2018 05:28:31 +0000 (15:28 +1000)] 
doc: Fix minor grammatical errors

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>
6 years agoMerge pull request #2531 from brauner/2018-08-16/minor_fixes
Stéphane Graber [Thu, 16 Aug 2018 00:26:08 +0000 (20:26 -0400)] 
Merge pull request #2531 from brauner/2018-08-16/minor_fixes

state: s/sleep()/nanosleep()/

6 years agostate: s/sleep()/nanosleep()/ 2531/head
Christian Brauner [Wed, 15 Aug 2018 22:39:50 +0000 (00:39 +0200)] 
state: s/sleep()/nanosleep()/

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>
6 years agoMerge pull request #2530 from brauner/2018-08-16/minor_fixes
Stéphane Graber [Wed, 15 Aug 2018 22:35:17 +0000 (18:35 -0400)] 
Merge pull request #2530 from brauner/2018-08-16/minor_fixes

lxccontainer: minor fixes

6 years agolxccontainer: minor fixes 2530/head
Christian Brauner [Wed, 15 Aug 2018 22:20:46 +0000 (00:20 +0200)] 
lxccontainer: minor fixes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2527 from brauner/2018-08-15/file_lock_fixes
Stéphane Graber [Wed, 15 Aug 2018 03:23:24 +0000 (23:23 -0400)] 
Merge pull request #2527 from brauner/2018-08-15/file_lock_fixes

lxccontainer: improve file locking

6 years agolxclock: improve file locking 2527/head
Christian Brauner [Tue, 14 Aug 2018 22:58:59 +0000 (00:58 +0200)] 
lxclock: improve file locking

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxccontainer: improve file locking
Christian Brauner [Tue, 14 Aug 2018 22:37:05 +0000 (00:37 +0200)] 
lxccontainer: improve file locking

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2526 from brauner/2018-08-14/fix_ongoing_create_check
Stéphane Graber [Tue, 14 Aug 2018 13:49:23 +0000 (09:49 -0400)] 
Merge pull request #2526 from brauner/2018-08-14/fix_ongoing_create_check

lxccontainer: fix F_OFD_GETLK checks

6 years agolxccontainer: fix F_OFD_GETLK checks 2526/head
Christian Brauner [Tue, 14 Aug 2018 11:00:29 +0000 (13:00 +0200)] 
lxccontainer: fix F_OFD_GETLK checks

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>
6 years agoMerge pull request #2525 from 2xsec/bugfix
Christian Brauner [Tue, 14 Aug 2018 07:33:14 +0000 (09:33 +0200)] 
Merge pull request #2525 from 2xsec/bugfix

coverity: #1438392

6 years agocoverity: #1438392 2525/head
2xsec [Tue, 14 Aug 2018 04:29:50 +0000 (13:29 +0900)] 
coverity: #1438392

Dereference before null check

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2524 from 2xsec/bugfix
Christian Brauner [Mon, 13 Aug 2018 11:07:37 +0000 (13:07 +0200)] 
Merge pull request #2524 from 2xsec/bugfix

fix thread-safe issue (localtime => localtime_r)

6 years agofix thread safe issue(localtime => localtime_r) 2524/head
2xsec [Mon, 13 Aug 2018 07:53:30 +0000 (16:53 +0900)] 
fix thread safe issue(localtime => localtime_r)

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agomacro: remove duplicated define
2xsec [Mon, 13 Aug 2018 07:52:24 +0000 (16:52 +0900)] 
macro: remove duplicated define

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2521 from brauner/2018-08-11/fix_netnsid_allocation
Stéphane Graber [Sun, 12 Aug 2018 00:17:29 +0000 (20:17 -0400)] 
Merge pull request #2521 from brauner/2018-08-11/fix_netnsid_allocation

netlink: add __netlink_{send,recv,transaction}

6 years agonetlink: add __netlink_{send,recv,transaction} 2521/head
Christian Brauner [Sat, 11 Aug 2018 14:25:14 +0000 (16:25 +0200)] 
netlink: add __netlink_{send,recv,transaction}

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>
6 years agoMerge pull request #2520 from brauner/2018-08-11/fix_netnsid_allocation
Stéphane Graber [Sat, 11 Aug 2018 00:40:51 +0000 (20:40 -0400)] 
Merge pull request #2520 from brauner/2018-08-11/fix_netnsid_allocation

netns: improve netnsid allocation