]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 years agodocs: Convert HACKING to Markdown
Faheel Ahmad [Tue, 30 Oct 2018 10:28:58 +0000 (15:58 +0530)] 
docs: Convert HACKING to Markdown

Also fix minor grammatical errors

5 years agodocs: Convert CODING_STYLE to Markdown
Faheel Ahmad [Tue, 30 Oct 2018 10:28:44 +0000 (15:58 +0530)] 
docs: Convert CODING_STYLE to Markdown

Also fix minor grammatical errors

5 years agoMerge pull request #10564 from evverx/lldp-fuzzer
Yu Watanabe [Mon, 29 Oct 2018 22:54:20 +0000 (07:54 +0900)] 
Merge pull request #10564 from evverx/lldp-fuzzer

 tests: add an lldp fuzzer

5 years agodoc: spell initramfs properly (#10566)
dkg [Mon, 29 Oct 2018 17:28:11 +0000 (13:28 -0400)] 
doc: spell initramfs properly (#10566)

5 years agotests: add an lldp fuzzer 10564/head
Evgeny Vereshchagin [Mon, 29 Oct 2018 15:24:16 +0000 (15:24 +0000)] 
tests: add an lldp fuzzer

I went through my antique collection of fuzzers the other day
to see which ones I hadn't sent upstream yet. This one
seems to be nice to have and ready to be merged. As far as I can
tell, it hasn't managed to find anything useful yet,
but it's better to be safe than sorry especially when it comes to networking
code :-)

5 years agojournal: drop an unused variable clang is complaining about
Evgeny Vereshchagin [Mon, 29 Oct 2018 15:21:58 +0000 (15:21 +0000)] 
journal: drop an unused variable clang is complaining about

../../src/systemd/src/journal/journal-file.c:3592:30: warning: unused variable 'p' [-Wunused-variable]
        _cleanup_free_ char *p = NULL;
                             ^
1 warning generated.

This is a follow-up to 681276589159fa08e0a.

5 years agohwdb: Add Asus T300CHI accelerator matrix
TJ [Mon, 29 Oct 2018 02:06:03 +0000 (02:06 +0000)] 
hwdb: Add Asus T300CHI accelerator matrix

5 years agoMerge pull request #10551 from keszybz/two-trivial-cleanups
Yu Watanabe [Mon, 29 Oct 2018 03:03:27 +0000 (12:03 +0900)] 
Merge pull request #10551 from keszybz/two-trivial-cleanups

Two trivial cleanups

5 years agoutil: do not assign return value if it is not used (#10552)
Yu Watanabe [Mon, 29 Oct 2018 01:41:35 +0000 (10:41 +0900)] 
util: do not assign return value if it is not used (#10552)

5 years agotest-chown-rec: use logging helper here too 10551/head
Zbigniew Jędrzejewski-Szmek [Sun, 28 Oct 2018 22:28:34 +0000 (23:28 +0100)] 
test-chown-rec: use logging helper here too

5 years agotest-network-tables: remove duplicate line
Zbigniew Jędrzejewski-Szmek [Sun, 28 Oct 2018 17:27:48 +0000 (18:27 +0100)] 
test-network-tables: remove duplicate line

5 years agoMerge pull request #10512 from yuwata/udev-event-cleanup
Zbigniew Jędrzejewski-Szmek [Sun, 28 Oct 2018 12:00:14 +0000 (13:00 +0100)] 
Merge pull request #10512 from yuwata/udev-event-cleanup

udev-event: replace udev_device by sd_device

5 years agopo: update Polish translation
Piotr Drąg [Fri, 26 Oct 2018 19:18:15 +0000 (21:18 +0200)] 
po: update Polish translation

5 years agocurl-util: fix error code check from curl_multi_socket_action
Dave Reisner [Sat, 27 Oct 2018 03:46:49 +0000 (23:46 -0400)] 
curl-util: fix error code check from curl_multi_socket_action

After curl 7.20.0, this function never returns negative error codes.
Make this consistent with the other call to this function and only
compare against CURLM_OK.

5 years agopo: update Japanese translation
Yu Watanabe [Fri, 26 Oct 2018 22:42:11 +0000 (07:42 +0900)] 
po: update Japanese translation

5 years agoMerge pull request #10537 from poettering/sentinelimania
Yu Watanabe [Fri, 26 Oct 2018 22:49:28 +0000 (07:49 +0900)] 
Merge pull request #10537 from poettering/sentinelimania

add some missing _sentinel_ decorators

5 years agoudev-event: replace udev_device in subst_format_var() by sd_device 10512/head
Yu Watanabe [Thu, 25 Oct 2018 04:59:03 +0000 (13:59 +0900)] 
udev-event: replace udev_device in subst_format_var() by sd_device

5 years agoudev-event: drop prototype of nonexistent function
Yu Watanabe [Thu, 25 Oct 2018 05:00:36 +0000 (14:00 +0900)] 
udev-event: drop prototype of nonexistent function

5 years agoudev-event: move definition of struct subst_map
Yu Watanabe [Thu, 25 Oct 2018 04:07:09 +0000 (13:07 +0900)] 
udev-event: move definition of struct subst_map

5 years agoudev-event: replace udev_device in udev_event_execute_rules() by sd_device
Yu Watanabe [Thu, 25 Oct 2018 02:14:11 +0000 (11:14 +0900)] 
udev-event: replace udev_device in udev_event_execute_rules() by sd_device

Also, this adds many logs.

5 years agoudev-event: move devnode handling logic to a new function
Yu Watanabe [Thu, 25 Oct 2018 01:32:35 +0000 (10:32 +0900)] 
udev-event: move devnode handling logic to a new function

Also, replace udev_device by sd_device.

5 years agoudev-event: move conditions to rename network interface into rename_netif()
Yu Watanabe [Wed, 24 Oct 2018 22:45:48 +0000 (07:45 +0900)] 
udev-event: move conditions to rename network interface into rename_netif()

Also, replace udev_device by sd_device.

5 years agoudev-event: rename udev_event_unref() to udev_event_free()
Yu Watanabe [Wed, 24 Oct 2018 22:04:59 +0000 (07:04 +0900)] 
udev-event: rename udev_event_unref() to udev_event_free()

As struct udev_event does not have a reference counter.

5 years agoudev-event: fix memleak in udev_event
Yu Watanabe [Wed, 24 Oct 2018 22:03:24 +0000 (07:03 +0900)] 
udev-event: fix memleak in udev_event

The leak was introduced by 29448498c724da7ade1b5efb20d7472c1b128d2c.

5 years agoudev-event: use structured initializer at one more place
Yu Watanabe [Wed, 24 Oct 2018 22:02:03 +0000 (07:02 +0900)] 
udev-event: use structured initializer at one more place

5 years agoudev-event: add more assert()
Yu Watanabe [Wed, 24 Oct 2018 21:39:48 +0000 (06:39 +0900)] 
udev-event: add more assert()

5 years agoudev-event: check command is not empty before executing
Yu Watanabe [Wed, 24 Oct 2018 21:35:16 +0000 (06:35 +0900)] 
udev-event: check command is not empty before executing

5 years agoudev-event: include device name in error message one more place
Yu Watanabe [Wed, 24 Oct 2018 21:33:26 +0000 (06:33 +0900)] 
udev-event: include device name in error message one more place

5 years agonetwork,udev: drop unnecessary check whether ifindex is positive
Yu Watanabe [Thu, 25 Oct 2018 01:09:19 +0000 (10:09 +0900)] 
network,udev: drop unnecessary check whether ifindex is positive

As sd_device_get_ifindex() now returns positive ifindex when it
succeeds.

5 years agotest: check sd_device_get_ifindex() returns positive ifindex when it succeeds
Yu Watanabe [Thu, 25 Oct 2018 01:04:19 +0000 (10:04 +0900)] 
test: check sd_device_get_ifindex() returns positive ifindex when it succeeds

5 years agosd-device: return positive ifindex when sd_device_get_ifindex() succeeds
Yu Watanabe [Thu, 25 Oct 2018 00:56:15 +0000 (09:56 +0900)] 
sd-device: return positive ifindex when sd_device_get_ifindex() succeeds

As valid ifindex is positive value, not non-negative value.

Follow-up for dcfbde3a43d632ff6e286c77e1081087eca59d8e.

5 years agoMerge pull request #10506 from poettering/cgroup-mini-fixes
Lennart Poettering [Fri, 26 Oct 2018 18:16:50 +0000 (20:16 +0200)] 
Merge pull request #10506 from poettering/cgroup-mini-fixes

various cgroups mini fixes

5 years agocore: add free_and_replace() at one more place 10537/head
Lennart Poettering [Fri, 26 Oct 2018 17:33:10 +0000 (19:33 +0200)] 
core: add free_and_replace() at one more place

5 years agotree-wide: add a few missing _sentinel_ decorators
Lennart Poettering [Fri, 26 Oct 2018 17:32:43 +0000 (19:32 +0200)] 
tree-wide: add a few missing _sentinel_ decorators

5 years agocgroup-util: make definition of CGROUP_CONTROLLER_TO_MASK() unsigned 10506/head
Lennart Poettering [Fri, 26 Oct 2018 13:31:30 +0000 (15:31 +0200)] 
cgroup-util: make definition of CGROUP_CONTROLLER_TO_MASK() unsigned

Otherwise doing comparing a CGroupMask (which is unsigned in effect)
with the result of CGROUP_CONTROLLER_TO_MASK() will result in warnings
about signedness differences.

5 years agocgroup-util: FLAGS_SET()ify all things
Lennart Poettering [Fri, 26 Oct 2018 13:25:21 +0000 (15:25 +0200)] 
cgroup-util: FLAGS_SET()ify all things

5 years agocgroup: when discovering which controllers the kernel supports mask with what we...
Lennart Poettering [Wed, 24 Oct 2018 15:35:19 +0000 (17:35 +0200)] 
cgroup: when discovering which controllers the kernel supports mask with what we support

Let's use our new CGROUP_MASK_V1 and CGROUP_MASK_V2 definitions for
this.

5 years agocgroup-util: before operating on a mounted cgroup controller check if it actually...
Lennart Poettering [Wed, 24 Oct 2018 15:31:51 +0000 (17:31 +0200)] 
cgroup-util: before operating on a mounted cgroup controller check if it actually can be mounted

We now have the "BPF" pseudo-controllers. These should never be assumed
to be accessible as /sys/fs/cgroup/<controller> and not through
"cgroup.subtree_control" either, hence always check explicitly before we
go to the file system. We do this through our new CGROUP_MASK_V1 and
CGROUP_MASK_V2 definitions.

5 years agocgroup-util: add mask definitions for sets of controllers supported by cgroupsv1...
Lennart Poettering [Wed, 24 Oct 2018 15:30:46 +0000 (17:30 +0200)] 
cgroup-util: add mask definitions for sets of controllers supported by cgroupsv1 vs. cgroupsv2

5 years agocgroup-util: disable buffering for cg_enable_everywhere() when writing to cgroup...
Lennart Poettering [Wed, 24 Oct 2018 15:28:17 +0000 (17:28 +0200)] 
cgroup-util: disable buffering for cg_enable_everywhere() when writing to cgroup attributes

Let's better be safe than sorry.

5 years agocgroup-util: don't expect cg_mask_from_string()'s return value to be initialized
Lennart Poettering [Wed, 24 Oct 2018 15:25:51 +0000 (17:25 +0200)] 
cgroup-util: don't expect cg_mask_from_string()'s return value to be initialized

Also, when we fail, don't clobber the return value.

This brings the call more in-line with our usual coding style, and
removes surprises.

None of the callers seemed to care about this behaviour.

5 years agocgroup-util: debug log if /proc/self/ns/cgroup is not available for unexpected reasons
Lennart Poettering [Wed, 24 Oct 2018 15:25:11 +0000 (17:25 +0200)] 
cgroup-util: debug log if /proc/self/ns/cgroup is not available for unexpected reasons

5 years agoMerge pull request #10536 from keszybz/serialize-fixes
Lennart Poettering [Fri, 26 Oct 2018 15:56:43 +0000 (17:56 +0200)] 
Merge pull request #10536 from keszybz/serialize-fixes

Tests for the new serialization functions

5 years agoMerge pull request #10517 from poettering/chown-rec-fixes
Lennart Poettering [Fri, 26 Oct 2018 14:26:20 +0000 (16:26 +0200)] 
Merge pull request #10517 from poettering/chown-rec-fixes

recursive chowning fixes

5 years agotest: add test case for recursive chown()ing 10517/head
Lennart Poettering [Fri, 19 Oct 2018 09:31:37 +0000 (11:31 +0200)] 
test: add test case for recursive chown()ing

5 years agochown-recursive: TAKE_FD() is your friend
Lennart Poettering [Fri, 19 Oct 2018 09:42:11 +0000 (11:42 +0200)] 
chown-recursive: TAKE_FD() is your friend

5 years agochown-recursive: also drop ACLs when recursively chown()ing
Lennart Poettering [Fri, 19 Oct 2018 09:28:40 +0000 (11:28 +0200)] 
chown-recursive: also drop ACLs when recursively chown()ing

Let's better be safe than sorry and also drop ACLs.

5 years agochown-recursive: let's rework the recursive logic to use O_PATH
Lennart Poettering [Fri, 19 Oct 2018 09:26:59 +0000 (11:26 +0200)] 
chown-recursive: let's rework the recursive logic to use O_PATH

That way we can pin a specific inode and analyze it and manipulate it
without it being swapped out beneath our hands.

Fixes a vulnerability originally found by Jann Horn from Google.

CVE-2018-15687
LP: #1796692
https://bugzilla.redhat.com/show_bug.cgi?id=1639076

5 years agolgtm: drop redundant newlines
Evgeny Vereshchagin [Fri, 26 Oct 2018 10:25:36 +0000 (10:25 +0000)] 
lgtm: drop redundant newlines

5 years agoMerge pull request #10508 from poettering/watchdog-original-fix
Lennart Poettering [Fri, 26 Oct 2018 12:50:17 +0000 (14:50 +0200)] 
Merge pull request #10508 from poettering/watchdog-original-fix

various service watchdog fixes

5 years agoMerge pull request #10534 from poettering/cmdline-fixlets
Lennart Poettering [Fri, 26 Oct 2018 12:49:53 +0000 (14:49 +0200)] 
Merge pull request #10534 from poettering/cmdline-fixlets

proc-cmdline.c fixlets

5 years agoMove tests for *serialize_environment into test-serialize.c 10536/head
Zbigniew Jędrzejewski-Szmek [Fri, 26 Oct 2018 10:30:04 +0000 (12:30 +0200)] 
Move tests for *serialize_environment into test-serialize.c

The implementation is in serialize.c.

5 years agotest-serialize: allocate long_string dynamically
Zbigniew Jędrzejewski-Szmek [Fri, 26 Oct 2018 11:17:44 +0000 (13:17 +0200)] 
test-serialize: allocate long_string dynamically

5 years agoservice: when starting a service make a copy of the watchdog timeout and use that 10508/head
Lennart Poettering [Wed, 24 Oct 2018 17:04:41 +0000 (19:04 +0200)] 
service: when starting a service make a copy of the watchdog timeout and use that

When we start a service process we pass the selected watchdog timeout to
it with the $WATCHDOG_USEC environment variable. If the unit file is
reconfigured later, we need to make sure to continue to honour the
original timeout, i.e. watch $WATCHDOG_USEC was set to, otherwise we'll
expect the ping at a different time as the service process is sending it
to us.

Hence, whenever we start a unit, save the watchdog timeout, and stick to
that for everything we do.

Fixes: #9467
5 years agoservice: continue to use the overriden timeout when forking off again
Lennart Poettering [Wed, 24 Oct 2018 17:03:41 +0000 (19:03 +0200)] 
service: continue to use the overriden timeout when forking off again

Let's make sure we always use the right watchdog timeout: when a service
has overwritten it, then stick to it, also for follow-up processes of
the same service.

5 years agoservice: rename service_reset_watchdog_timeout() → service_override_watchdog_timeout()
Lennart Poettering [Wed, 24 Oct 2018 17:03:04 +0000 (19:03 +0200)] 
service: rename service_reset_watchdog_timeout() → service_override_watchdog_timeout()

This is what the function really does, hence name it that way.

5 years agoservice: rework service_extend_timeout()
Lennart Poettering [Wed, 24 Oct 2018 17:02:13 +0000 (19:02 +0200)] 
service: rework service_extend_timeout()

Let's unify common code: let's extend the watchdog timeout and the
regular timeout with the same helper function.

5 years agotest-serialize: a smoke test for the serialization functions
Zbigniew Jędrzejewski-Szmek [Tue, 23 Oct 2018 10:00:31 +0000 (12:00 +0200)] 
test-serialize: a smoke test for the serialization functions

5 years agotest: _cleanup_(unlink_tempfilep) in two more places
Zbigniew Jędrzejewski-Szmek [Tue, 23 Oct 2018 08:50:38 +0000 (10:50 +0200)] 
test: _cleanup_(unlink_tempfilep) in two more places

5 years agoIntroduce fmkostemp_safe and use it in tests
Zbigniew Jędrzejewski-Szmek [Tue, 23 Oct 2018 08:50:09 +0000 (10:50 +0200)] 
Introduce fmkostemp_safe and use it in tests

No functional change.

5 years agoservice: explicit stop the watchdog when we shall not use it
Lennart Poettering [Wed, 24 Oct 2018 16:59:03 +0000 (18:59 +0200)] 
service: explicit stop the watchdog when we shall not use it

This is useful so that WATCHDOG_USEC=0 sent from a process does the
right thing if turning off the watchdog logic.

5 years agojournalctl: in --follow mode watch stdout for POLLHUP/POLLERR and exit
Lennart Poettering [Wed, 24 Oct 2018 19:49:52 +0000 (21:49 +0200)] 
journalctl: in --follow mode watch stdout for POLLHUP/POLLERR and exit

Fixes: #9374
5 years agolgtm: add a custom query for catching the use of fgets
Evgeny Vereshchagin [Fri, 26 Oct 2018 09:19:09 +0000 (09:19 +0000)] 
lgtm: add a custom query for catching the use of fgets

As everybody knows, nodoby really reads CODING_STYLE (especially
the last paragraph :-)) so let's utilize LGTM to help us catch the
use of fgets.

5 years agoMerge pull request #10519 from poettering/serialize-fixes
Zbigniew Jędrzejewski-Szmek [Fri, 26 Oct 2018 10:17:13 +0000 (12:17 +0200)] 
Merge pull request #10519 from poettering/serialize-fixes

pid1 serialization/deserialization fixes

5 years agoproc-cmdline: teach proc_cmdline_get_key() the same flags magic as proc_cmdline_parse() 10534/head
Lennart Poettering [Fri, 26 Oct 2018 10:02:55 +0000 (12:02 +0200)] 
proc-cmdline: teach proc_cmdline_get_key() the same flags magic as proc_cmdline_parse()

5 years agoproc-cmdline: use FLAGS_SET() where appropriate
Lennart Poettering [Fri, 26 Oct 2018 10:00:37 +0000 (12:00 +0200)] 
proc-cmdline: use FLAGS_SET() where appropriate

This was mostly prompted by seeing the expression "in_initrd() && flags
& PROC_CMDLINE_RD_STRICT", which uses & and && without any brackets.
Let's make that a bit more readable and hide all doubts about operator
precedence.

5 years agoproc-cmdline: use our usual syntax for denoting bit mask enums
Lennart Poettering [Fri, 26 Oct 2018 10:00:01 +0000 (12:00 +0200)] 
proc-cmdline: use our usual syntax for denoting bit mask enums

5 years agoCODING_STYLE: briefly mention that fgets() should not be used anymore 10519/head
Lennart Poettering [Fri, 19 Oct 2018 19:56:10 +0000 (21:56 +0200)] 
CODING_STYLE: briefly mention that fgets() should not be used anymore

5 years agofileio: drop FOREACH_LINE(), it's not used anymore
Lennart Poettering [Fri, 19 Oct 2018 19:56:29 +0000 (21:56 +0200)] 
fileio: drop FOREACH_LINE(), it's not used anymore

5 years agocore: rework serialization
Lennart Poettering [Wed, 17 Oct 2018 18:40:09 +0000 (20:40 +0200)] 
core: rework serialization

Let's be more careful with what we serialize: let's ensure we never
serialize strings that are longer than LONG_LINE_MAX, so that we know we
can read them back with read_line(…, LONG_LINE_MAX, …) safely.

In order to implement this all serialization functions are move to
serialize.[ch], and internally will do line size checks. We'd rather
skip a serialization line (with a loud warning) than write an overly
long line out. Of course, this is just a second level protection, after
all the data we serialize shouldn't be this long in the first place.

While we are at it also clean up logging: while serializing make sure to
always log about errors immediately. Also, (void)ify all calls we don't
expect errors in (or catch errors as part of the general
fflush_and_check() at the end.

5 years agocore: make manager_serialize() a bit easier to read by adding predicate function
Lennart Poettering [Wed, 17 Oct 2018 18:35:28 +0000 (20:35 +0200)] 
core: make manager_serialize() a bit easier to read by adding predicate function

The predicate function manager_timestamp_shall_serialize() simply says
whether to serialize or not serialize a timestamp, and should make
things a bit easier to read.

5 years agocore: strjoina() in a loop is never OK
Lennart Poettering [Wed, 17 Oct 2018 18:32:20 +0000 (20:32 +0200)] 
core: strjoina() in a loop is never OK

Let's use plain strjoin() instead.

5 years agoautomount: fix deserialization of dev_t
Lennart Poettering [Wed, 17 Oct 2018 18:15:26 +0000 (20:15 +0200)] 
automount: fix deserialization of dev_t

let's prefer "unsigned long" rather than "unsigned", in case there are
archs that have 32bit int, but 64bit dev_t.

(Also one cast was wrong anyway.)

5 years agocore: enforce a limit on STATUS= texts recvd from services
Lennart Poettering [Wed, 17 Oct 2018 16:37:48 +0000 (18:37 +0200)] 
core: enforce a limit on STATUS= texts recvd from services

Let's better be safe than sorry, and put a limit on what we receive.

5 years agocore: when deserializing state always use read_line(…, LONG_LINE_MAX, …)
Lennart Poettering [Wed, 17 Oct 2018 16:36:24 +0000 (18:36 +0200)] 
core: when deserializing state always use read_line(…, LONG_LINE_MAX, …)

This should be much better than fgets(), as we can read substantially
longer lines and overly long lines result in proper errors.

Fixes a vulnerability discovered by Jann Horn at Google.

CVE-2018-15686
LP: #1796402
https://bugzilla.redhat.com/show_bug.cgi?id=1639071

5 years agoMerge pull request #10525 from poettering/journal-vaccum-all
Zbigniew Jędrzejewski-Szmek [Fri, 26 Oct 2018 08:36:25 +0000 (10:36 +0200)] 
Merge pull request #10525 from poettering/journal-vaccum-all

journald: add ability to vacuum active files too

5 years agoMerge pull request #10522 from lnykryn/initrd_debug
Zbigniew Jędrzejewski-Szmek [Fri, 26 Oct 2018 08:08:39 +0000 (10:08 +0200)] 
Merge pull request #10522 from lnykryn/initrd_debug

Let's make systemd-debug-generator usable also in initrd

5 years agoman: journalctl: expand description of --all
Lucas Werkmeister [Thu, 25 Oct 2018 21:34:05 +0000 (23:34 +0200)] 
man: journalctl: expand description of --all

In the default journalctl output, unprintable entries are abbreviated as
“[<amount> blob data]”; using the same term in the documentation helps
users to quickly discover the option they need to add in order to see
those entries.

5 years agosd-device: fix wrong assertion (#10530)
Yu Watanabe [Fri, 26 Oct 2018 01:16:00 +0000 (10:16 +0900)] 
sd-device: fix wrong assertion (#10530)

5 years agoMerge pull request #10523 from poettering/fd-get-path-optimize
Yu Watanabe [Fri, 26 Oct 2018 00:34:07 +0000 (09:34 +0900)] 
Merge pull request #10523 from poettering/fd-get-path-optimize

fd_get_path() optimization

5 years agocore: reword polkit request a bit (#10524)
Lennart Poettering [Thu, 25 Oct 2018 21:01:41 +0000 (23:01 +0200)] 
core: reword polkit request a bit (#10524)

"killing" is very UNIX terminology, and not really what this is about.
Let's be more correct and say "send a UNIX signal" for the operation.

Otherwise things are really weird if users call "journalctl --rotate"
from the command line, which internally asks systemd to send SIGUSR2 to
to journald: when german locale is selected this asks the user — roughly
transliterated — whether they want to "eliminate" journald, which is
definitely not the intended meaning.

5 years agojournal-file: structured initialization is your friend 10525/head
Lennart Poettering [Thu, 25 Oct 2018 19:35:32 +0000 (21:35 +0200)] 
journal-file: structured initialization is your friend

5 years agojournald: when we are asked to rotate all files, let's also look at closed files
Lennart Poettering [Thu, 25 Oct 2018 16:39:27 +0000 (18:39 +0200)] 
journald: when we are asked to rotate all files, let's also look at closed files

Before this when asked for rotation we'd only rotate files we have open
anyway. However there might be a number of other files on disk that are
active (i.e. not archived yet) but not open. Let's take care of those
too, so that rotation is always comprehensive, and the user gets the
guarantee that afterthe rotation all stored data is in archived files.

Fixes: #1017
5 years agoman: document the new combined --vacuum*= and --rotate invocation
Lennart Poettering [Thu, 25 Oct 2018 19:16:38 +0000 (21:16 +0200)] 
man: document the new combined --vacuum*= and --rotate invocation

5 years agojournalctl: fix error number in error message
Lennart Poettering [Thu, 25 Oct 2018 16:38:50 +0000 (18:38 +0200)] 
journalctl: fix error number in error message

5 years agojournalctl: add ability to vacuum and rotate in one step
Lennart Poettering [Thu, 25 Oct 2018 16:36:56 +0000 (18:36 +0200)] 
journalctl: add ability to vacuum and rotate in one step

journalctl --vacuum-*= only vacuums archived files. To archive all
active files the rotate operation is used. Let's add a new switch that
combines both, so that the user a single command to first move all
running journal files into archival and then vacuum them.

See: #1017

5 years agojournald: log about an OOM condition
Lennart Poettering [Thu, 25 Oct 2018 16:35:55 +0000 (18:35 +0200)] 
journald: log about an OOM condition

5 years agojournald: debug log when we cannot read the machine ID
Lennart Poettering [Thu, 25 Oct 2018 16:35:39 +0000 (18:35 +0200)] 
journald: debug log when we cannot read the machine ID

5 years agojournal-file: refactor journal_file_open_reliably()
Lennart Poettering [Thu, 25 Oct 2018 17:23:23 +0000 (19:23 +0200)] 
journal-file: refactor journal_file_open_reliably()

Let's split out the part that actually renames the file in case we can't
open it into a new function journal_file_dispose().

This way we can reuse the function in other cases where we want to open
a file but can't.

5 years agojournal-file: refactor journal_file_rotate()
Lennart Poettering [Thu, 25 Oct 2018 16:33:11 +0000 (18:33 +0200)] 
journal-file: refactor journal_file_rotate()

Let's split the function in three: the part where we archive the old
file into journal_file_archive(), and the part where we initiate the
deferred closing into journal_file_initiate_close().
journal_file_rotate() then simply becomes a wrapper around these two
calls, and the opening of the new journal file.

This useful so that we can archive journal files without having to open
new ones, i.e. to do only the archival part of the rotation, without the
rotation part.

5 years agojournal: refactor out loop that processes deferred closes into its own function
Lennart Poettering [Thu, 25 Oct 2018 15:42:30 +0000 (17:42 +0200)] 
journal: refactor out loop that processes deferred closes into its own function

5 years agojournal: fix some type confusion in journal_directory_vacuum()
Lennart Poettering [Thu, 25 Oct 2018 15:40:41 +0000 (17:40 +0200)] 
journal: fix some type confusion in journal_directory_vacuum()

Let's store array sizes and indexes in size_t. And let's count numbers
of files in uint64_t (simply because that is the type of the input
parameter for this of the function)

5 years agojournald: use structured initialization
Lennart Poettering [Thu, 25 Oct 2018 10:30:48 +0000 (12:30 +0200)] 
journald: use structured initialization

5 years agojournald: use usec_sub_unsigned() where we can
Lennart Poettering [Thu, 25 Oct 2018 10:30:36 +0000 (12:30 +0200)] 
journald: use usec_sub_unsigned() where we can

5 years agofd-util: optimize fd_get_path() a bit 10523/head
Lennart Poettering [Thu, 25 Oct 2018 19:27:00 +0000 (21:27 +0200)] 
fd-util: optimize fd_get_path() a bit

journald calls fd_get_path() a lot (it probably shouldn't, there's some
room for improvement there, but I'll leave that for another time), hence
it's worth optimizing the call a bit, in particular as it's easy.

Previously we'd open the dir /proc/self/fd/ first, before reading the
symlink inside it. This means the whole function requires three system
calls: open(), readlinkat(), close(). The reason for doing it this way
is to distinguish the case when we see ENOENT because /proc is not
mounted and the case when the fd doesn't exist.

With this change we'll directly go for the readlink(), and only if that
fails do an access() to see if /proc is mounted at all.

This optimizes the common case (where the fd is valid and /proc
mounted), in favour of the uncommon case (where the fd doesn#t exist or
/proc is not mounted).

5 years agofs-util: increase start buffer size in readlinkat_malloc()
Lennart Poettering [Thu, 25 Oct 2018 19:16:47 +0000 (21:16 +0200)] 
fs-util: increase start buffer size in readlinkat_malloc()

I noticed while profiling journald that we invoke readlinkat() a ton on
open /proc/self/fd/<fd>, and that the returned paths are more often than
not longer than the 99 chars used before, when we look at archived
journal files. This means for these cases we generally need to execute
two rather than one syscalls.

Let's increase the buffer size a tiny bit, so that we reduce the number
of syscalls executed. This is really a low-hanging fruit of
optimization.

5 years agodebug-generator: introduce rd.* version of all options 10522/head
Lukas Nykryn [Thu, 25 Oct 2018 14:34:00 +0000 (16:34 +0200)] 
debug-generator: introduce rd.* version of all options

5 years agoMerge pull request #10378 from poettering/json-fuzz-fix
Zbigniew Jędrzejewski-Szmek [Thu, 25 Oct 2018 14:25:39 +0000 (16:25 +0200)] 
Merge pull request #10378 from poettering/json-fuzz-fix

json: a comprehensive fix for oss-fuzz#10908

5 years agoproc-cmdline: introduce PROC_CMDLINE_RD_STRICT
Lukas Nykryn [Thu, 25 Oct 2018 14:21:26 +0000 (16:21 +0200)] 
proc-cmdline: introduce PROC_CMDLINE_RD_STRICT

Our current set of flags allows an option to be either
use just in initrd or both in initrd and normal system.
This new flag is intended to be used in the case where
you want apply some settings just in initrd or just
in normal system.

5 years agoMerge pull request #10518 from poettering/dhcp6-size-fixes
Lennart Poettering [Thu, 25 Oct 2018 11:29:42 +0000 (13:29 +0200)] 
Merge pull request #10518 from poettering/dhcp6-size-fixes

dhcp6 packet size calculation fixes