chiark / gitweb /
elogind.git
6 years agomeson: reuse libsystemd_static for libsystemd
Zbigniew Jędrzejewski-Szmek [Tue, 19 Dec 2017 10:53:53 +0000 (11:53 +0100)]
meson: reuse libsystemd_static for libsystemd

This gets rid of recompilation, making things faster and avoids duplicated warnings.
The result seems to be the same:
$ ls -l build/libsystemd.so.0.20.0 build2/libsystemd.so.0.20.0
-rwxrwxr-x. 1 zbyszek zbyszek 3071312 Dec 19 11:45 build2/libsystemd.so.0.20.0
-rwxrwxr-x. 1 zbyszek zbyszek 3071760 Dec 19 11:11 build/libsystemd.so.0.20.0
$ diff -U1 <(objdump -T build/libsystemd.so.0.20.0|sed -r 's/[0-9a-f]{16}/________________/g') <(objdump -T build2/libsystemd.so.0.20.0|sed -r 's/[0-9a-f]{16}/________________/g')
-build/libsystemd.so.0.20.0:     file format elf64-x86-64
+build2/libsystemd.so.0.20.0:     file format elf64-x86-64

6 years agomeson: rename libsystemd_internal to libsystem_static
Zbigniew Jędrzejewski-Szmek [Tue, 19 Dec 2017 10:35:01 +0000 (11:35 +0100)]
meson: rename libsystemd_internal to libsystem_static

We already use the "_static" suffix for libshared_static ("shared" is the name
of the library, "static" is the format) and other libs, so let's rename for
consistency.

Also change libsystemd_static_sources to libsystemd_sources, since the same
list is used for both and shorter is better.

6 years agobasic: detect_vm_cpuid: fix hypervisor detection
Mike Gilbert [Sat, 30 Dec 2017 17:48:20 +0000 (12:48 -0500)]
basic: detect_vm_cpuid: fix hypervisor detection

The __get_cpuid() function only calls __cpuid() if __get_cpuid_max()
returns a value that is less than or equal to the leaf value.

In QEMU/KVM, I found that the special hypervisor leaf value (0x40000000U)
is always larger than the value retured by __get_cpuid_max().

Avoid this problem by calling the __cpuid() macro directly once we have
checked the hypervisor bit from leaf 1.

Fixes: d31b0033b7743393562a2e9d3c1e74afea981c13
6 years agofileio: write_string_stream_ts: check for file errors immediately
Mike Gilbert [Thu, 28 Dec 2017 15:03:47 +0000 (10:03 -0500)]
fileio: write_string_stream_ts: check for file errors immediately

6 years agofileio: write_string_stream_ts: return errors from fputs and fputc
Mike Gilbert [Thu, 28 Dec 2017 02:46:52 +0000 (21:46 -0500)]
fileio: write_string_stream_ts: return errors from fputs and fputc

Ignoring errors from these functions may mask errors returned by the
kernel.

Fixes: https://github.com/systemd/systemd/issues/7744
6 years agobasic: detect_vm_cpuid: use gcc's __get_cpuid() function (#7758)
Mike Gilbert [Fri, 29 Dec 2017 18:30:38 +0000 (13:30 -0500)]
basic: detect_vm_cpuid: use gcc's __get_cpuid() function (#7758)

The __get_cpuid() function includes a safety check to ensure that
executing the cpuid instruction is valid/safe.

This method also works with clang.

https://lists.freedesktop.org/archives/systemd-devel/2017-December/040054.html

6 years agoupdate TODO
Lennart Poettering [Tue, 26 Dec 2017 15:02:10 +0000 (16:02 +0100)]
update TODO

6 years agosd-daemon: use sockaddr_port() helper
Lennart Poettering [Tue, 26 Dec 2017 12:36:07 +0000 (13:36 +0100)]
sd-daemon: use sockaddr_port() helper

6 years agosocket-util: clarify why sockaddr_port returns unsigned rather than uint16_t
Lennart Poettering [Tue, 26 Dec 2017 12:35:52 +0000 (13:35 +0100)]
socket-util: clarify why sockaddr_port returns unsigned rather than uint16_t

6 years agocondition: extend ConditionKernelVersion= with relative version checks
Lennart Poettering [Sat, 23 Dec 2017 14:02:58 +0000 (15:02 +0100)]
condition: extend ConditionKernelVersion= with relative version checks

Now that we have str_verscmp() in our source tree anyway, let's make it
generic and reuse it for ConditionKernelVersion=.

6 years agoman: systemd: fix typo (#7746)
nulsoh [Tue, 26 Dec 2017 19:45:06 +0000 (20:45 +0100)]
man: systemd: fix typo (#7746)

Add missing _r_ for ctl-alt-del.target

6 years agoupdate TODO
Lennart Poettering [Fri, 22 Dec 2017 14:28:17 +0000 (15:28 +0100)]
update TODO

6 years agoprocess-util: debug log if PR_SET_NAME fails.
Lennart Poettering [Sun, 24 Dec 2017 17:50:17 +0000 (18:50 +0100)]
process-util: debug log if PR_SET_NAME fails.

6 years agoprocess-util: allow rename_process() only in the main thread
Lennart Poettering [Sun, 24 Dec 2017 17:48:49 +0000 (18:48 +0100)]
process-util: allow rename_process() only in the main thread

We make assumptions about the comm name we set via PR_SET_NAME: that it
would reflect the process name, but that's only the case for the main
thread. Moreover, we cache the mmap() region without locking.

Let's hence be safe rather than sorry and support all this only in the
main thread.

6 years agobasic: split out blockdev-util.[ch] from util.h
Lennart Poettering [Fri, 22 Dec 2017 14:22:59 +0000 (15:22 +0100)]
basic: split out blockdev-util.[ch] from util.h

With three functions it makes sense to split this out now.

6 years agoagents: use kill_and_sigcont() where appropriate
Lennart Poettering [Fri, 22 Dec 2017 14:10:56 +0000 (15:10 +0100)]
agents: use kill_and_sigcont() where appropriate

6 years agoprocess-util: move fork_agent() to process-util.[ch]
Lennart Poettering [Fri, 22 Dec 2017 14:07:22 +0000 (15:07 +0100)]
process-util: move fork_agent() to process-util.[ch]

It's a relatively small wrapper around safe_fork() now, hence let's move
it over, and make its signature even more alike. Also, set a different
process name for the polkit and askpw agents.

6 years agotree-wide: use EXIT_SUCCESS/EXIT_FAILURE in exit() where we can
Lennart Poettering [Fri, 22 Dec 2017 12:24:40 +0000 (13:24 +0100)]
tree-wide: use EXIT_SUCCESS/EXIT_FAILURE in exit() where we can

6 years agotree-wide: introduce new safe_fork() helper and port everything over
Lennart Poettering [Fri, 22 Dec 2017 12:08:14 +0000 (13:08 +0100)]
tree-wide: introduce new safe_fork() helper and port everything over

This adds a new safe_fork() wrapper around fork() and makes use of it
everywhere. The new wrapper does a couple of things we previously did
manually and separately in a safer, more correct and automatic way:

1. Optionally resets signal handlers/mask in the child

2. Sets a name on all processes we fork off right after forking off (and
   the patch assigns useful names for all processes we fork off now,
   following a systematic naming scheme: always enclosed in () – in order
   to indicate that these are not proper, exec()ed processes, but only
   forked off children, and if the process is long-running with only our
   own code, without execve()'ing something else, it gets am "sd-" prefix.)

3. Optionally closes all file descriptors in the child

4. Optionally sets a PR_SET_DEATHSIG to SIGTERM in the child, in a safe
   way so that the parent dying before this happens being handled
   safely.

5. Optionally reopens the logs

6. Optionally connects stdin/stdout/stderr to /dev/null

7. Debug logs about the forked off processes.

6 years agoterminal-util: open /dev/null with O_CLOEXEC in make_stdio_null()
Lennart Poettering [Sat, 23 Dec 2017 23:54:40 +0000 (00:54 +0100)]
terminal-util: open /dev/null with O_CLOEXEC in make_stdio_null()

Ultimately, O_CLOEXEC should be off in fd 0, 1, 2, but when we open
/dev/null here it's unlikely to be < 0, and after dupping the fd to 0,
1, 2 we turn off O_CLOEXEC explicitly anyway.

Unless we know that what we are about to open will return 0, 1 or 2 we
should always set O_CLOEXEC in order to be safe to other threads forking
of subprocesses at the wrong moment.

6 years agoterminal-util: return first error, not last in make_stdio()
Lennart Poettering [Fri, 22 Dec 2017 12:05:33 +0000 (13:05 +0100)]
terminal-util: return first error, not last in make_stdio()

Just a minor tweak, making sure we execute as much as we can of the
funciton, but return the first error instead of the last we encounter.

This is usuelly how we do things when we have functions that continue on
the first error, so let's do it like that here too.

6 years agofd-util: use close_nointr() return value instead of errno
Lennart Poettering [Fri, 22 Dec 2017 12:04:24 +0000 (13:04 +0100)]
fd-util: use close_nointr() return value instead of errno

Our own calls return errors in their return values, hence use that
rather than errno when checking errors.

6 years agofd-util: add some (void) casts
Lennart Poettering [Fri, 22 Dec 2017 12:03:35 +0000 (13:03 +0100)]
fd-util: add some (void) casts

6 years agoman: add a systemd-rc-local-generator(8) man page
Lennart Poettering [Sun, 24 Dec 2017 15:50:19 +0000 (16:50 +0100)]
man: add a systemd-rc-local-generator(8) man page

Most importantly, let's highlight the differences to the rc-local
behaviour in SysV.

Fixes: #7703
6 years agoseparate flags from shebang
bleep_blop [Sun, 24 Dec 2017 06:53:20 +0000 (06:53 +0000)]
separate flags from shebang

6 years agomeson: hopefully renameat2() will show up where renameat() is defined
Lennart Poettering [Mon, 25 Dec 2017 11:35:43 +0000 (12:35 +0100)]
meson: hopefully renameat2() will show up where renameat() is defined

Should glibc add this eventually, let's try to be smart where to look
for it.

6 years agomeson: look for gettid() definition where getpid() is defined
Lennart Poettering [Mon, 25 Dec 2017 11:35:28 +0000 (12:35 +0100)]
meson: look for gettid() definition where getpid() is defined

Hopefully, should gettid() show up one day in glibc it'll show up where
getpid() is defined too.

6 years agomeson: when pivot_root() is added one day, look for it in <unistd.h>
Lennart Poettering [Mon, 25 Dec 2017 11:07:40 +0000 (12:07 +0100)]
meson: when pivot_root() is added one day, look for it in <unistd.h>

We of course don't know in which header glibc will export pivot_root()
and if it ever will. But there's a good chance they'll place it where
chroot() is located, given the similarity in the operations, hence let's
try our luck and look for it at the same place.

If we are lucky this means we don't have to patch our code if glibc
decides to expose the call one day.

6 years agomeson: use "args" for setting _GNU_SOURCE when checking for functions
Lennart Poettering [Mon, 25 Dec 2017 11:01:14 +0000 (12:01 +0100)]
meson: use "args" for setting _GNU_SOURCE when checking for functions

This reworks how we set _GNU_SOURCE when checking for the availability
of functions:

1. We set it for most of the functions we look for. After all we set it
for our entire built anyway, and it's usually how Linux-specific
definitions in glibc are protected these days. Given that we usually
have checks for such modern stuff only anyway, let's just blanket enable
it.

2. Use "args" instead of "prefix" to set the macro. This is what is
suggested in the meson docs, hence let's do it.

6 years agomeson: define _GNU_SOURCE to detect copy_file_range() (#7734)
Yu Watanabe [Mon, 25 Dec 2017 10:42:42 +0000 (19:42 +0900)]
meson: define _GNU_SOURCE to detect copy_file_range() (#7734)

Follow-up for bad7a0c81f501fbbcc79af9eaa4b8254441c4a1f of git
repository for glibc.

Recently glibc added `copy_file_range()`, but to use it,
`_GNU_SOURCE` needs to be defined. This adds the flag in
meson.build to detect the function by meson correctly.

6 years agoMove mkdir_label() to mkdir-label.c
Zbigniew Jędrzejewski-Szmek [Sat, 16 Dec 2017 12:32:42 +0000 (13:32 +0100)]
Move mkdir_label() to mkdir-label.c

It just seems strange to have it in a different file if mkdir-label.c exists.

6 years agosmack-util: remove unneeded initalization
Zbigniew Jędrzejewski-Szmek [Sat, 16 Dec 2017 12:22:57 +0000 (13:22 +0100)]
smack-util: remove unneeded initalization

6 years agoAdd mkdir_errno_wrapper() and use instead of mkdir() in various places
Zbigniew Jędrzejewski-Szmek [Fri, 15 Dec 2017 16:08:13 +0000 (17:08 +0100)]
Add mkdir_errno_wrapper() and use instead of mkdir() in various places

We'd pass pointers to mkdir and mkdir_label to call in various places. mkdir
returns the error in errno while mkdir_label returns the error directly.

6 years agobasic: introduce socket_protocol_{from,to}_name()
Yu Watanabe [Sat, 23 Dec 2017 10:32:04 +0000 (19:32 +0900)]
basic: introduce socket_protocol_{from,to}_name()

And use them where they can be applicable.

6 years agosocket-util: add socket_address_type_{from,to}_string()
Yu Watanabe [Sat, 23 Dec 2017 07:55:36 +0000 (16:55 +0900)]
socket-util: add socket_address_type_{from,to}_string()

6 years agonetworkd: Add support for ipvlan L3s and flags (#7726)
Susant Sahani [Sat, 23 Dec 2017 17:55:03 +0000 (23:25 +0530)]
networkd: Add support for ipvlan L3s and flags (#7726)

This works supports to configure L3S mode and flags
such as bridge, private and vepa

6 years agosd-bus: drop check for selinux before calling getsockopt(SO_PEERSEC)
Zbigniew Jędrzejewski-Szmek [Tue, 19 Dec 2017 14:12:50 +0000 (15:12 +0100)]
sd-bus: drop check for selinux before calling getsockopt(SO_PEERSEC)

Quoting Lennart Poettering in
https://github.com/systemd/systemd/pull/6464#issuecomment-319029293:
> If the kernel allows us to query that data we should also be Ok with passing
> it on to our own caller, regardless if selinux is technically on or off...

The advantage is that this allows gcc to be smarter and reduce linkage:
(before)$ ldd build/libnss_systemd.so.2
linux-vdso.so.1 (0x00007ffeb46ff000)
librt.so.1 => /lib64/librt.so.1 (0x00007f2f60da6000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007f2f60ba1000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f2f60978000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2f60759000)
libc.so.6 => /lib64/libc.so.6 (0x00007f2f60374000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2f61294000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f2f600f0000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f2f5feec000)
(after )$ ldd build/libnss_systemd.so.2
linux-vdso.so.1 (0x00007ffe5f543000)
librt.so.1 => /lib64/librt.so.1 (0x00007f427dcaa000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007f427daa5000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f427d886000)
libc.so.6 => /lib64/libc.so.6 (0x00007f427d4a1000)
/lib64/ld-linux-x86-64.so.2 (0x00007f427e196000)

Note that this only works in conjuction with the previous commit: either
of the two commits alone does not have the desired effect on linkage.

Replaces #6464.

6 years agoMove selinux-related stuff from btrfs-util.c to label.c
Zbigniew Jędrzejewski-Szmek [Tue, 19 Dec 2017 13:33:11 +0000 (14:33 +0100)]
Move selinux-related stuff from btrfs-util.c to label.c

In preparation for future changes.

6 years agomore portable perl shebangs (#7701)
Jörg Thalheim [Tue, 19 Dec 2017 10:13:34 +0000 (10:13 +0000)]
more portable perl shebangs (#7701)

same motivation as in #5816:

- distributions have scripts to rewrite shebangs on installation and
  they know what locations to rely on.
- For tests/compilation we should rather rely on the user to have setup
  there PATH correctly.

6 years agomissing: Add DM_DEFERRED_REMOVE
Henrik Grindal Bakken [Thu, 23 Mar 2017 15:19:15 +0000 (16:19 +0100)]
missing: Add DM_DEFERRED_REMOVE

Also include missing.h in dissect-image.c to pick it up.

6 years agomissing: Define SMACK_MAGIC if it's missing
Henrik Grindal Bakken [Thu, 23 Mar 2017 15:09:10 +0000 (16:09 +0100)]
missing: Define SMACK_MAGIC if it's missing

6 years agomissing: Define EFIVARFS_MAGIC if missing
Henrik Grindal Bakken [Thu, 23 Mar 2017 15:02:20 +0000 (16:02 +0100)]
missing: Define EFIVARFS_MAGIC if missing

6 years agomissing: Add MAX_HANDLE_SZ
Henrik Grindal Bakken [Thu, 23 Mar 2017 15:07:33 +0000 (16:07 +0100)]
missing: Add MAX_HANDLE_SZ

6 years agomissing: Add PR_SET_MM_{ARG,ENV}_{START,END}
Henrik Grindal Bakken [Thu, 23 Mar 2017 14:42:15 +0000 (15:42 +0100)]
missing: Add PR_SET_MM_{ARG,ENV}_{START,END}

6 years agomissing: Add some more btrfs structs and constants
Henrik Grindal Bakken [Thu, 23 Mar 2017 14:33:06 +0000 (15:33 +0100)]
missing: Add some more btrfs structs and constants

6 years agobuild-sys: install TRANSIENT-SETTINGS.md and UIDS-GIDS.md (#7690)
Felipe Sateler [Mon, 18 Dec 2017 13:58:13 +0000 (10:58 -0300)]
build-sys: install TRANSIENT-SETTINGS.md and UIDS-GIDS.md (#7690)

6 years agomount-setup: fix MNT_CHECK_WRITABLE error handling, and log about the issue
Lennart Poettering [Fri, 15 Dec 2017 16:37:16 +0000 (17:37 +0100)]
mount-setup: fix MNT_CHECK_WRITABLE error handling, and log about the issue

Let's correct the error handling (the error is in errno, not r), and
let's add logging like the rest of the function has it.

6 years agomeson: libudev_core and udevadm should have LOG_REALM=LOG_REALM_UDEV (#7666)
Franck Bui [Sat, 16 Dec 2017 08:36:36 +0000 (09:36 +0100)]
meson: libudev_core and udevadm should have LOG_REALM=LOG_REALM_UDEV (#7666)

Otherwise, setting udev_log=debug in /etc/udev/udev.conf has no effects since
systemd-udevd is built with LOG_REALM=LOG_REALM_UDEV.

However using LOG_REALM_UDEV (for libudev_core) reveals another similar bug for
udevadm which should also define LOG_REALM_UDEV.

6 years agologind: use free_and_replace in one spot
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 21:16:16 +0000 (22:16 +0100)]
logind: use free_and_replace in one spot

No functional change.

6 years agotree-wide: use SPECIAL_ROOT_SLICE
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 13:28:00 +0000 (14:28 +0100)]
tree-wide: use SPECIAL_ROOT_SLICE

6 years agologind: fix misleading message
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 12:12:13 +0000 (13:12 +0100)]
logind: fix misleading message

This message would also be emitted at boot for any user with linger
enabled, so "logged in" is the wrong term to use.

6 years agologind: simplify one conditional
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 11:57:31 +0000 (12:57 +0100)]
logind: simplify one conditional

Don't bother with removing the directory if we didn't create it.

6 years agoFix logical error in meson.build (#7658)
Max Harmathy [Fri, 15 Dec 2017 15:05:25 +0000 (16:05 +0100)]
Fix logical error in meson.build (#7658)

sysvinit_path and sysvrcnd_path have to be set both to activate Sysv compatibility.

6 years agoman: Clarify when OnFailure= activates after restarts (#7646)
Ken (Bitsko) MacLeod [Fri, 15 Dec 2017 10:10:41 +0000 (04:10 -0600)]
man: Clarify when OnFailure= activates after restarts (#7646)

6 years agotree-wide: add DEBUG_LOGGING macro that checks whether debug logging is on (#7645)
Lennart Poettering [Fri, 15 Dec 2017 10:09:00 +0000 (11:09 +0100)]
tree-wide: add DEBUG_LOGGING macro that checks whether debug logging is on (#7645)

This makes things a bit easier to read I think, and also makes sure we
always use the _unlikely_ wrapper around it, which so far we used
sometimes and other times we didn't. Let's clean that up.

6 years agoTODO: update
Yu Watanabe [Thu, 14 Dec 2017 13:17:17 +0000 (22:17 +0900)]
TODO: update

6 years agoverbs: Rename VERB_OFFLINE to VERB_ONLINE_ONLY, expand MUSTBEROOT
Colin Walters [Thu, 14 Dec 2017 20:23:02 +0000 (15:23 -0500)]
verbs: Rename VERB_OFFLINE to VERB_ONLINE_ONLY, expand MUSTBEROOT

Followup to previous commit. Suggested by @poettering.
Reindented the `verbs[]` tables to match the apparent previous
whitespace rules (indent to one flag, allow multiple flags to overflow?).

6 years agosystemctl,verbs: Introduce SYSTEMD_OFFLINE environment variable
Colin Walters [Wed, 13 Dec 2017 21:04:41 +0000 (16:04 -0500)]
systemctl,verbs: Introduce SYSTEMD_OFFLINE environment variable

A lot of code references the `running_in_chroot()` function; while
I didn't dig I'm pretty certain this arose to deal with situations
like RPM package builds in `mock` - there we don't want the `%post`s
to `systemctl start` for example.

And actually this exact same use case arises for
[rpm-ostree](https://github.com/projectatomic/rpm-ostree/)
where we implement offline upgrades by default; the `%post`s are
always run in a new chroot using [bwrap](https://github.com/projectatomic/bubblewrap).

And here's the problem: bwrap creates proper mount roots, so it
passes `running_in_chroot()`, and then if a script tries to do
`systemctl start` we get:
`System has not been booted with systemd as init system (PID 1)`
but that's an *error*, unlike the `running_in_chroot()` case where we ignore.

Further complicating things is there are real world RPM packages
like `glusterfs` which end up invoking `systemctl start`.

A while ago, the `SYSTEMD_IGNORE_CHROOT` environment variable was
added for the inverse case of running in a chroot, but still wanting
to use systemd as PID 1 (presumably some broken initramfs setups?).

Let's introduce a `SYSTEMD_OFFLINE` environment variable for cases like
mock/rpm-ostree so we can force on the "ignore everything except preset" logic.
This way we'll still not start services even if mock switches to use nspawn or
bwrap or something else that isn't a chroot.

We also cleanly supercede the `SYSTEMD_IGNORE_CHROOT=1` which is now spelled
`SYSTEMD_OFFLINE=0`.  (Suggested by @poettering)

Also I made things slightly nicer here and we now print the ignored operation.

6 years agoCODING_STYLE: provide better explanation why /* */ over // (#7647)
Lennart Poettering [Fri, 15 Dec 2017 09:26:07 +0000 (10:26 +0100)]
CODING_STYLE: provide better explanation why /* */ over // (#7647)

Let's provide a real reason why /* */ should be used for commenting,
rather than //, beyond mere taste.

(This ultimately simply codifies how I use // vs. /* */ comments, and I
think this is useful as an explanation and reason hence.)

6 years agofinal v236 update (#7649)
Lennart Poettering [Thu, 14 Dec 2017 22:09:57 +0000 (23:09 +0100)]
final v236 update (#7649)

6 years agoNEWS: update NEWS again, and prepare for a release tomorrow
Lennart Poettering [Wed, 13 Dec 2017 17:27:59 +0000 (18:27 +0100)]
NEWS: update NEWS again, and prepare for a release tomorrow

6 years agomeson: increase version numbers
Lennart Poettering [Mon, 11 Dec 2017 15:10:25 +0000 (16:10 +0100)]
meson: increase version numbers

6 years agocore: Implement timeout based umount/remount limit
Kyle Walker [Wed, 13 Dec 2017 17:49:26 +0000 (12:49 -0500)]
core: Implement timeout based umount/remount limit

Remount, and subsequent umount, attempts can hang for inaccessible network
based mount points. This can leave a system in a hard hang state that
requires a hard reset in order to recover. This change moves the remount,
and umount attempts into separate child processes. The remount and umount
operations will block for up to 90 seconds (DEFAULT_TIMEOUT_USEC). Should
those waits fail, the parent will issue a SIGKILL to the child and continue
with the shutdown efforts.

In addition, instead of only reporting some additional errors on the final
attempt, failures are reported as they occur.

6 years agotree-wide: make use of new STRLEN() macro everywhere (#7639)
Lennart Poettering [Thu, 14 Dec 2017 18:02:29 +0000 (19:02 +0100)]
tree-wide: make use of new STRLEN() macro everywhere (#7639)

Let's employ coccinelle to do this for us.

Follow-up for #7625.

6 years agobasic: turn off stdio locking for a couple of helper calls
Lennart Poettering [Mon, 11 Dec 2017 19:01:55 +0000 (20:01 +0100)]
basic: turn off stdio locking for a couple of helper calls

These helper calls are potentially called often, and allocate FILE*
objects internally for a very short period of time, let's turn off
locking for them too.

6 years agocore: add EXTEND_TIMEOUT_USEC={usec} - prevent timeouts in startup/runtime/shutdown...
Daniel Black [Thu, 14 Dec 2017 11:17:43 +0000 (22:17 +1100)]
core: add EXTEND_TIMEOUT_USEC={usec} - prevent timeouts in startup/runtime/shutdown (#7214)

With Type=notify services, EXTEND_TIMEOUT_USEC= messages will delay any startup/
runtime/shutdown timeouts.

A service that hasn't timed out, i.e, start time < TimeStartSec,
runtime < RuntimeMaxSec and stop time < TimeoutStopSec, may by sending
EXTEND_TIMEOUT_USEC=, allow the service to continue beyond the limit for
the execution phase (i.e TimeStartSec, RunTimeMaxSec and TimeoutStopSec).

EXTEND_TIMEOUT_USEC= must continue to be sent (in the same way as
WATCHDOG=1) within the time interval specified to continue to reprevent
the timeout from occuring.

Watchdog timeouts are also extended if a EXTEND_TIMEOUT_USEC is greater
than the remaining time on the watchdog counter.

Fixes #5868.

6 years agocheck_tree.pl: Do not allow diff to move name reverts into a mask
Sven Eden [Wed, 30 May 2018 05:47:36 +0000 (07:47 +0200)]
check_tree.pl: Do not allow diff to move name reverts into a mask
block.

Do not replace double dashes in XML comments, that are either the
comment start or end.

6 years agocheck_tree.pl: Move move upstream appends from after our mask blocks
Sven Eden [Tue, 29 May 2018 17:45:35 +0000 (19:45 +0200)]
check_tree.pl: Move move upstream appends from after our mask blocks
up before found #else switches.

6 years agocheck_tree.pl: Added missing detection of mask else switches in prune_hunk().
Sven Eden [Tue, 29 May 2018 16:58:39 +0000 (18:58 +0200)]
check_tree.pl: Added missing detection of mask else switches in prune_hunk().

6 years agoCleanup now obsolete pwx tools.
Sven Eden [Tue, 29 May 2018 06:07:21 +0000 (08:07 +0200)]
Cleanup now obsolete pwx tools.

6 years agocheck_tree.pl: The word "systemd" is no longer changed to "elogind",
Sven Eden [Tue, 29 May 2018 06:04:43 +0000 (08:04 +0200)]
check_tree.pl: The word "systemd" is no longer changed to "elogind",
if it was found in a comment block that is added by the patch.

6 years agocheck_tree.pl: Fixed a bug that caused #else to not be unremoved in __GLIBC__ blocks.
Sven Eden [Tue, 29 May 2018 05:53:05 +0000 (07:53 +0200)]
check_tree.pl: Fixed a bug that caused #else to not be unremoved in __GLIBC__ blocks.

6 years agocheck_tree.pl: Made check_musl() and check_name_reverts() safer.
Sven Eden [Fri, 25 May 2018 17:24:58 +0000 (19:24 +0200)]
check_tree.pl: Made check_musl() and check_name_reverts() safer.
Further policy.in consist of XML code, and are now handled by
(un)prepare_xml().

6 years agocheck_tree.pl: Fixed check_musl(), it must track mask state changes itself.
Sven Eden [Fri, 25 May 2018 05:51:27 +0000 (07:51 +0200)]
check_tree.pl: Fixed check_musl(), it must track mask state changes itself.

6 years agocheck_tree.pl: Enhance the final processing of shell and xml files
Sven Eden [Thu, 24 May 2018 16:46:24 +0000 (18:46 +0200)]
check_tree.pl: Enhance the final processing of shell and xml files
and their patches by remembering mask changes that get pruned from
the hunks.

6 years agocheck_tree.pl: Remove the [e]logind [m]ask [i]nfo code, this was not sufficient.
Sven Eden [Wed, 23 May 2018 05:46:33 +0000 (07:46 +0200)]
check_tree.pl: Remove the [e]logind [m]ask [i]nfo code, this was not sufficient.

6 years agocheck_tree.pl: Keep track of elogind masks although the changing lines get pruned.
Sven Eden [Wed, 23 May 2018 05:43:11 +0000 (07:43 +0200)]
check_tree.pl: Keep track of elogind masks although the changing lines get pruned.

6 years agocheck_tree.pl: Fixed unprepare_xml()
Sven Eden [Thu, 17 May 2018 18:01:49 +0000 (20:01 +0200)]
check_tree.pl: Fixed unprepare_xml()

6 years agomigrate_tree.pl: Only write a new commits file, if the old was finished reading or...
Sven Eden [Thu, 17 May 2018 17:30:11 +0000 (19:30 +0200)]
migrate_tree.pl: Only write a new commits file, if the old was finished reading or none existed.

6 years agocheck_tree.pl : Fix transportation of elogind mask info
Sven Eden [Thu, 17 May 2018 06:19:47 +0000 (08:19 +0200)]
check_tree.pl : Fix transportation of elogind mask info

6 years agocheck_tree.pl : Do not skip mask info with useless hunks.
Sven Eden [Thu, 17 May 2018 06:13:21 +0000 (08:13 +0200)]
check_tree.pl : Do not skip mask info with useless hunks.

6 years agocheck_tree.pl: Remember mask starts and elses in hunks, so the
Sven Eden [Thu, 17 May 2018 06:08:37 +0000 (08:08 +0200)]
check_tree.pl: Remember mask starts and elses in hunks, so the
resulting patches can be reworked without ignoring changes in useless
hunks.

6 years agomigrate_tree.pl : Check target first when creating new files.
Sven Eden [Thu, 17 May 2018 05:44:41 +0000 (07:44 +0200)]
migrate_tree.pl : Check target first when creating new files.

6 years agocheck_tree.pl: Replace the source in creation patches with /dev/null.
Sven Eden [Thu, 17 May 2018 05:38:55 +0000 (07:38 +0200)]
check_tree.pl: Replace the source in creation patches with /dev/null.

6 years agomigrate_tree.pl: Ensure that the commit file is always written on exit.
Sven Eden [Wed, 16 May 2018 16:14:01 +0000 (18:14 +0200)]
migrate_tree.pl: Ensure that the commit file is always written on exit.

6 years agomigrate_tree.pl: Add a signal handler, so the commit file is updated even on SIGINT.
Sven Eden [Wed, 16 May 2018 06:06:32 +0000 (08:06 +0200)]
migrate_tree.pl: Add a signal handler, so the commit file is updated even on SIGINT.

6 years agomigrate_tree.pl: Make the last commit csv location agnostic.
Sven Eden [Wed, 16 May 2018 05:47:58 +0000 (07:47 +0200)]
migrate_tree.pl: Make the last commit csv location agnostic.

6 years agocheck_tree.pl migrate_tree.pl: Move necessary eop stuff into END blocks.
Sven Eden [Wed, 16 May 2018 05:01:59 +0000 (07:01 +0200)]
check_tree.pl migrate_tree.pl: Move necessary eop stuff into END blocks.

6 years agomigrate_tree.pl: Use git rev-parse to get the shortest possible version of each refid...
Sven Eden [Tue, 15 May 2018 16:01:23 +0000 (18:01 +0200)]
migrate_tree.pl: Use git rev-parse to get the shortest possible version of each refid we work with.

6 years agocheck_tree.pl: While unpreparing shell: comment comment lines and do
Sven Eden [Tue, 15 May 2018 15:49:48 +0000 (17:49 +0200)]
check_tree.pl: While unpreparing shell: comment comment lines and do
not add '# ' prefixes to mask blocks in xml patch hunks.

6 years agomeson.build: Clean up, so check_tree.pl does not find a difference to upstream.
Sven Eden [Tue, 15 May 2018 15:47:18 +0000 (17:47 +0200)]
meson.build: Clean up, so check_tree.pl does not find a difference to upstream.

6 years agomigrate_tree.pl: Call 'git am --abort' if it failed to apply.
Sven Eden [Tue, 15 May 2018 06:22:08 +0000 (08:22 +0200)]
migrate_tree.pl: Call 'git am --abort' if it failed to apply.

6 years agomigrate_tree.pl: Fixed Usage of Try::Tiny
Sven Eden [Tue, 15 May 2018 06:16:00 +0000 (08:16 +0200)]
migrate_tree.pl: Fixed Usage of Try::Tiny

6 years agomigrate_tree.pl: Finished the first working version for testing.
Sven Eden [Tue, 15 May 2018 05:55:42 +0000 (07:55 +0200)]
migrate_tree.pl: Finished the first working version for testing.

7 years agomigrate_tree.pl: Application of the reworked patches added.
Sven Eden [Mon, 14 May 2018 16:50:18 +0000 (18:50 +0200)]
migrate_tree.pl: Application of the reworked patches added.

7 years agomigrate_tree.pl: Reworking of the formatted patches added.
Sven Eden [Mon, 14 May 2018 16:34:03 +0000 (18:34 +0200)]
migrate_tree.pl: Reworking of the formatted patches added.

7 years agocheck_tree.pl: Add --create to allow creation of files, and --stay to not reset the...
Sven Eden [Mon, 14 May 2018 05:31:02 +0000 (07:31 +0200)]
check_tree.pl: Add --create to allow creation of files, and --stay to not reset the upstream tree on program end.

7 years agopwx/check_tree.pl: Switch to use Git::Wrapper for checking out the wanted refid on...
Sven Eden [Wed, 9 May 2018 05:19:24 +0000 (07:19 +0200)]
pwx/check_tree.pl: Switch to use Git::Wrapper for checking out the wanted refid on the upstream tree.

7 years agopwx/migrate_tree.pl: New program to consolidate the pwx git bash helpers.
Sven Eden [Mon, 7 May 2018 17:34:57 +0000 (19:34 +0200)]
pwx/migrate_tree.pl: New program to consolidate the pwx git bash helpers.

7 years agomusl_missing.h: add FTW_* macros missing from musl libc.
maxice8 [Fri, 27 Apr 2018 13:05:25 +0000 (10:05 -0300)]
musl_missing.h: add FTW_* macros missing from musl libc.