Karel Zak [Mon, 9 Jan 2023 11:35:03 +0000 (12:35 +0100)]
Merge branch 'schedutils' of https://github.com/chaiken/util-linux
* 'schedutils' of https://github.com/chaiken/util-linux:
schedutils: better illustrate the usage of cpu-lists with taskset
schedutils: clarify meaning of taskset return code
schedutils: clarify confusing mask example in taskset man page
This is required by string_to_bitmask().
The previous cast failed on s390x with the following warning:
In function 'string_to_bitmask',
inlined from 'string_to_bitmask' at lib/strutils.c:802:5,
inlined from 'main' at sys-utils/wdctl.c:770:8:
lib/strutils.c:829:23: error: write of 64-bit data outside the bound of destination object, data truncated into 32-bit [-Werror=extra]
829 | *mask |= flag;
|
libmount: ensure child hangs around until we persisted namespace
When we create a new namespace in a child process to persist it we need
to ensure that the child hangs around. During exit the child will drop
all references to its namespaces and so by the time we call open we
might already fail to open the namespace. Fix this.
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
In file included from /usr/include/stdio.h:894,
from lib/strutils.c:8:
In function ‘printf’,
inlined from ‘test_strutils_cstrcasecmp’ at lib/strutils.c:1324:2,
inlined from ‘main’ at lib/strutils.c:1348:10:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:112:10: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
112 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
In file included from /usr/include/stdio.h:894,
from lib/strutils.c:8:
In function ‘printf’,
inlined from ‘test_strutils_cstrcasecmp’ at lib/strutils.c:1324:2,
inlined from ‘main’ at lib/strutils.c:1348:10:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:112:10: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
112 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Karel Zak [Wed, 4 Jan 2023 17:45:10 +0000 (18:45 +0100)]
Merge branch 'waitpid' of https://github.com/t-8ch/util-linux
* 'waitpid' of https://github.com/t-8ch/util-linux:
waitpid: add new command
tests: add ts_skip_exitcode_not_supported
exitcodes: add EXIT_NOTSUPP
pidfd-utils: include wait.h for siginfo_t
Thomas Weißschuh [Sat, 24 Dec 2022 04:27:04 +0000 (04:27 +0000)]
waitpid: add new command
This command implements waiting for the exit of multiple processes.
Especially it allows to wait for process that are not children of the
current process.
In contrast to wait(1P) it does not allow to retrieve the processes exit
codes.
Karel Zak [Tue, 3 Jan 2023 14:07:06 +0000 (15:07 +0100)]
Merge branch 'libblkid-debug' of https://github.com/t-8ch/util-linux
* 'libblkid-debug' of https://github.com/t-8ch/util-linux:
libblkid: remove strewn around calls to blkid_init_debug()
libblkid: always initialize debugging
Karel Zak [Tue, 3 Jan 2023 13:52:58 +0000 (14:52 +0100)]
Merge branch 'make-nice-posix-compliant' of https://github.com/kraptor/util-linux
* 'make-nice-posix-compliant' of https://github.com/kraptor/util-linux:
Changes for review
renice: support posix-compliant -n (via POSIXLY_CORRECT) and add --relative flag
Karel Zak [Thu, 6 Oct 2022 10:02:41 +0000 (12:02 +0200)]
libmount: fix mount -a to work with optlist
The original code uses libmnt_fs instance to store mount options. The
new uses libmnt_fs only for library API backward compatibility, but
internally it uses libmnt_optlist. Let's use optlist also to save
context template.
Karel Zak [Tue, 4 Oct 2022 11:05:27 +0000 (13:05 +0200)]
libmount: (legacy) init regualer mount before propagation
We have two ways how mount(2) is used, for propagation-only calls and
regular FS mount. The propagation-only code removes MS_PROPAGATION
flags from main mount options (=optlist), so any later decision about
propagation is impossible. We need to call propagation-only code as
the last thing. (Yes, new FD based mount(8) handles it better.)
Karel Zak [Wed, 21 Sep 2022 15:28:36 +0000 (17:28 +0200)]
libmount: (mount) use independent hooks
It seems better to reuse functions (hooks) to implement various
ways the mount is done. For example, attach to the tree is used
for move, bind, and new mount; set VFS flags is usable for all
operations, etc.
Complete mount(8) is a set (chain) of hooks that is possible to mix to
get the wanted result.
The new API allow for example things like
mount --move /A /B -oro,noexec
because it's
- open_tree()
- mount_setattr()
- move_tree()
Note that the hooks allow extend it to new functionality without core
code modification (for example, X-mount.idmap= append a new hook to
call another mount_setattr()).
Karel Zak [Wed, 21 Sep 2022 09:39:13 +0000 (11:39 +0200)]
libmount: (mount) improve syscalls status handling
The new kernel API is composed from more syscalls, but libmount
originally assumes one syscall and one place where we need to remember
return value of the syscall. It seems the best will be to set the
status after each mount related syscall call (fsopen(), move_mount(),
...) until we reach error or end of mount process.
For better error messages the last failed mount related syscall name
will be recorded in cxt->syscall_name.
Karel Zak [Wed, 21 Sep 2022 09:03:54 +0000 (11:03 +0200)]
libmount: add MS_MOVE to options map
libmount originally had in the options map only options that are
possible to use in fstab. Now we use the map to verify and
classify all mount options, so MS_MOVE is necessary there too.
The patch also add a new MNT_NOFSTAB option flag, not used for now.