| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
| |
No actual code changes, just some splitting out.
|
| |
|
|
|
|
| |
This reverts commit 9c46228b7deb53d6384545535b37b2844a102b2b.
|
|
|
|
|
| |
That way we can use it in other code from basic/. It fits into both
headers equally well or badly, hence let's just move this one function.
|
| |
|
| |
|
|
|
|
| |
This reverts commit 6bf3c6c9007ca87376d5dff1e029186a38736cdc.
|
|
|
|
|
|
|
|
| |
Library code should not call freeze(), this is something that should
only be done by "application code", so moving it into shared/ is appropriate.
The fallback to call _exit() is dropped: let's trust that the infinite loop
is infinite.
|
|
|
|
|
|
|
| |
Currently it's only used in two places in src/shared/, so the function was
already included just once in compiled code. But it seems appropriate to
move it there anyway, because library code should have no need to fork
agents, so it doesn't belong in basic/.
|
|
|
|
| |
It has only one user and we don't need to put it in basic/.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We need a sorted list of fds to skip over when closing. We would allocate a
copy of the passed array to do the sort. But all callers construct a temporary
array to pass to us, so it is pointless to copy it again.
close_all_fds/safe_fork_full/namespace_fork/fork_agent are changed to pass
a non-const int array. I checked all users, and all callers are fine with
the array being sorted.
The function was returning some number (sometimes 1, sometimes the extent
of the range passed over to close_range(), ???). Anyway, all callers only
check for error, so let's return 0 on success.
|
|
|
|
|
| |
This is useful for allocating a userns fd later on for use in idmapped
mounts.
|
|
|
|
|
|
|
|
| |
The new flag is not used, except in tests, so no functional change yet.
This way, the command as shown can be copied-and-pasted into the shell
in more cases. For simple cases, shell quoting with "" is enough. But
$'' is needed when there are control characters in the command.
|
|
|
|
|
|
|
|
|
|
|
| |
Since the new functionality is controlled by an option, this causes no change
in output yet, except tests.
The login in the old branch of !(flags & PROCESS_CMDLINE_QUOTE) is essentially
unmodified. But there is an important difference in behaviour: instead of
unconditionally reading the whole virtual file, we now read only 'max_columns'
bytes. This makes out code to write process lists quite a bit more efficient
when there are processes with long command lines.
|
|
|
|
| |
Fixes: #18936
|
|
|
|
|
|
|
|
|
|
|
|
| |
argv[0] might be prefixed by a path, and we shouldn't get confused by
that. Hence provide a simple helper call that abstracts the checking
away, which we can use everywhere, and expose the same behaviour, even
if argv[0] is not set.
(While we are at it, port all other multi-call binaries over to the new
helper, too)
Follow-up for: d41a9e4fc1e1bcdefc8d358da2744a97aac5820a
|
| |
|
|
|
|
| |
names too
|
|
|
|
|
|
|
|
|
|
|
|
| |
"less" doesn't properly reset its terminal on SIGTERM, it does so only
on SIGINT. Let's thus configure SIGINT instead of SIGTERM.
I think this is something less should fix too, and clean up things
correctly on SIGTERM, too. However, given that we explicitly enable
SIGINT behaviour by passing "K" to $LESS I figure it makes sense if we
also send SIGINT instead of SIGTERM to match it.
Fixes: #16084
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch changes the way user managers set the default umask for the units it
manages.
Indeed one can expect that if user manager's umask is redefined through PAM
(via /etc/login.defs or pam_umask), all its children including the units it
spawns have their umask set to the new value.
Hence make user units inherit their umask value from their parent instead of
the hard coded value 0022 but allow them to override this value via their unit
file.
Note that reexecuting managers with 'systemctl daemon-reexec' after changing
UMask= has no effect. To take effect managers need to be restarted with
'systemct restart' instead. This behavior was already present before this
patch.
Fixes #6077.
|
|
|
|
|
| |
We already have assert_cc(sizeof(uid_t) == sizeof(uint32_t)) or friends
at various places.
|
|
|
|
|
|
| |
Instead, push to the closest possible Nice priority setting.
Replaces: #11397
|
|\
| |
| | |
Assorted smaller stuff split out from homed PR
|
| |
| |
| |
| |
| |
| |
| | |
This adds a new safe_fork() flag. If set the child process' fd 1 becomes
fd 2 of the caller. This is useful for invoking tools (such as various
mkfs/fsck implementations) that output status messages to stdout, but
which we invoke and don't want to pollute stdout with their output.
|
|/
|
|
| |
It returns the pid_t a pidfd refers to.
|
| |
|
|
|
|
|
|
| |
We use assert_cc(...); almost everywhere. Let's always require that.
https://github.com/systemd/systemd/issues/12997#issuecomment-510103988
|
|\
| |
| | |
Rework cpu affinity parsing
|
| |
| |
| |
| |
| | |
It just seems to fit better there and it's always better to have things
in shared/ rather than basic/.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This restores show_pid_array() output in legacy locales on the console.
Only one call to get_process_cmdline() is changed, all others retain
utf8-only mode. This affects systemd-cgls, systemctl status, etc, when
working locally.
Calls to get_process_cmdline() that cross a process boundary always use
utf8. It's the callers responsibility to convert this to some encoding that
they use. This means that we always pass utf8 over the bus.
|
| |
| |
| |
| | |
In preparation for the next commit…
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The functions to retrieve and print process cmdlines were based on the
assumption that they contain printable ASCII, and everything else
should be filtered out. That assumption doesn't hold in today's world,
where people are free to use unicode everywhere.
This replaces the custom cmdline reading code with a more generic approach
using utf8_escape_non_printable_full().
For kernel threads, truncation is done on the parenthesized name, so we'll
get "[worker]", "[worker…]", …, "[w…]", "[…", "…" as we reduce the number of
available columns.
This implementation is most likely slower for very long cmdlines, but I don't
think this is very important. The common case is to have short commandlines,
and should print those properly. Absurdly long cmdlines are the exception,
which needs to be handled correctly and safely, but speed is not too important.
Fixes #12532.
v2:
- use size_t for the number of columns. This change propagates into various
other functions that call get_process_cmdline(), increasing the size of the
patch, but the changes are rather trivial.
|
|/ |
|
|\
| |
| | |
add ConditionCPUs= + ConditionMemory=
|
| |
| |
| |
| |
| | |
Let's add a new helper for determining how many CPUs are configured for
us
|
|/
|
|
| |
No functional changes.
|
|
|
|
| |
Just some minor reorganiztion.
|
|
|
|
|
| |
Typesafety is nice. And this way we can take benefit of the new size
assert() the previous commit added.
|
|
|
|
|
| |
The new flag simply means rlimit_nofile_safe() is called in the child
after all fds are rearranged.
|
|
|
|
|
|
|
|
|
| |
forks again
This helper is useful to ensure pidns/userns joining is properly
executed (as that requires a fork after the setns()). This is
particularly important when it comes to /proc/self/ access or
SCM_CREDENTIALS, but is generally the safer mode of operation.
|
| |
|
|
|
|
| |
Fixes #10290.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
These lines are generally out-of-date, incomplete and unnecessary. With
SPDX and git repository much more accurate and fine grained information
about licensing and authorship is available, hence let's drop the
per-file copyright notice. Of course, removing copyright lines of others
is problematic, hence this commit only removes my own lines and leaves
all others untouched. It might be nicer if sooner or later those could
go away too, making git the only and accurate source of authorship
information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This part of the copyright blurb stems from the GPL use recommendations:
https://www.gnu.org/licenses/gpl-howto.en.html
The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.
hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
|
|
|
|
|
|
| |
Let's always write "1 << 0", "1 << 1" and so on, except where we need
more than 31 flag bits, where we write "UINT64(1) << 0", and so on to force
64bit values.
|
|
|
|
|
|
|
|
| |
We already have a flag for creating a new mount namespace for the child.
Let's add an extension to that: a new FORK_MOUNTNFS_SLAVE flag. When
used in combination will mark all mounts in the child namespace as
MS_SLAVE so that the child can freely mount or unmount stuff but it
won't leak into the parent.
|
|
|
|
| |
And let's make use of it in execute.c
|