1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00
Commit Graph

11027 Commits

Author SHA1 Message Date
Thomas Hindoe Paaboel Andersen
eef8df097d timedatectl: remove unused variables 2015-03-24 22:56:28 +01:00
Kay Sievers
16c6ea2934 timedate: remove daylight saving time handling and tzfile parser
We planned to support (the conceptually broken) daylight saving
time/local time features in the kernel, SCSI, networking, FAT
filesystem, but it turned out to be a race we cannot win and do
not want to get involved. Systemd should not fiddle with daylight
saving time or parse timezone information itself.

Leave everything to glibc or tools like date(1) and do not make any
promises or raise expectations that systemd should handle anything
like this.
2015-03-24 15:03:36 +01:00
Shawn Landden
3e5e74d5b7 timedatectl: fix when queried system has differn't timezone
Also allow getting time from time(2) when BUS_TRANSPORT_MACHINE.

v2: check for error
2015-03-24 13:42:43 +01:00
Shawn Landden
de49f273e2 bootchart: more useful error message for common error
Reported-by: tfirg_ on IRC
2015-03-24 00:12:03 -04:00
Shawn Landden
b53a2485a4 bootchart: remove duplicated code, prevent creating empty files
In Debian and rawhide Fedora, which have CONFIG_SCHEDSTATS=n,
bootchart creates empty files in /run/log before printing an error.
Stop doing that.

Moreover this duplicated part of the code doesn't even have error checking
so there is no error avoided by doing this early.

Reported-by: tfirg_ on IRC
2015-03-24 00:12:03 -04:00
Tobias Hunger
fb02a2775a fstab-generator: Do not check deviceless filesystems
There is no need to check those.
2015-03-24 00:12:03 -04:00
Tobias Hunger
b043846208 fstab-generator: Support root on tmpfs (or other deviceless FS)
This allows for stateless systems.
2015-03-24 00:12:03 -04:00
Alin Rauta
ea342a99fd sd-rtnl: handle empty multi-part message from the kernel
We strips out NLMSG_DONE piece from a multi-part message adding into the
receive queue only the messages containing actual data.

If we send a request to the kernel for getting the forwarding database table (just an example),
the response will be a multi-part message like below:
1. FDB entry 1;
2. FDB entry 2;
3. NLMSG_DONE;

We strip out "3. NLMSG_DONE;" part and places into the receive queue a pointer to
"1. FDB entry 1; 2. FDB entry 2".

But if the FDB table is empty, the respose from the kernel will look like below:
1. NLMSG_DONE;

We strip out "1. NLMSG_DONE;" part and since there is no actual data got, it continues
waiting until reaching timeout.

Therefore, a call to "sd_rtnl_call" to send and wait for a response from kernel will exit
with timeout which is interpreted as error in communication.

This patch puts the NLMSG_DONE message on the receive queue if it ends an empty multi-part
message. This situation is detected in sd_rtnl_call() and in the callback code and NULL is
returned to the caller instead.

[tomegun:
  - added/reworded commit message
  - extend the same support to sd_rtnl_call_async()
  - drop debug logging from library, we only do this if something is really wrong, but an
    empty multi-part message is perfectly normal
  - modernize the code we touch whilst we are at it]
2015-03-23 22:36:17 +01:00
Zbigniew Jędrzejewski-Szmek
81b8439902 timedated: fix enable/disable reversal
Bug introduced in 984f1b1d1b. The state was flipped later,
but the enable/disable routine made use of the state to decide
what to do.

context_enable_ntp() and context_start_ntp() now get the desired
state directly, so the Context parameter can be removed.
2015-03-21 19:55:33 -04:00
Zbigniew Jędrzejewski-Szmek
df823e23f0 core: make SELinux enable/disable check symmetric
We'd use the generic check for disable, and a unit-file-specific one for enable.
Use the more specific one both ways.

systemd[1]: SELinux access check scon=system_u:system_r:systemd_timedated_t:s0 tcon=system_u:system_r:init_t:s0 tclass=system perm=disable path=(null) cmdline=/usr/lib/systemd/systemd-timedated: -13
systemd[1]: SELinux access check scon=system_u:system_r:systemd_timedated_t:s0 tcon=system_u:object_r:systemd_unit_file_t:s0 tclass=service perm=enable path=/usr/lib/systemd/system/systemd-timesyncd.service cmdline=/usr/lib/systemd/systemd-timedated: -13

https://bugzilla.redhat.com/show_bug.cgi?id=1014315
2015-03-21 19:55:33 -04:00
Zbigniew Jędrzejewski-Szmek
192b98b8fe timedated: flip internal status after executing operation
timedated would set the internal status before calling out to systemd to do
the actual change. When the operation was refused because of a SELinux denial,
the state kept in timedated would get out of sync, and the second call from
timedatectl would appear to succeed.

https://bugzilla.redhat.com/show_bug.cgi?id=1014315
2015-03-21 17:40:57 -04:00
Michael Olbrich
8e8ba79229 missing.h: add more btrfs types and defines 2015-03-21 15:37:22 -04:00
Zbigniew Jędrzejewski-Szmek
e0952d9d02 fstab-generator: ignore invalid swap priority
A failed priority is not something worth stopping boot over. Most people
have only one swap device, in which case priority is irrelevant, and even
if there is more than one swap device, they are all usable, and ignoring the
priority field should only result in some loss of performance.

The kernel will report the priority as -1 if not set, so it's easy for
people to make this mistake.

https://bugzilla.redhat.com/show_bug.cgi?id=1204336
2015-03-21 11:54:46 -04:00
Zbigniew Jędrzejewski-Szmek
8bde1d0c9d networkd: use LOG_WARN not LOG_ERR for non-fatal errors 2015-03-21 11:51:43 -04:00
Zbigniew Jędrzejewski-Szmek
2e6534a9a5 shared/mkdir: do not set errno in addition to return value
All callers look at the return value anyway.
2015-03-21 11:51:42 -04:00
Goffredo Baroncelli
22c3a6cadb Allow systemd-tmpfiles to set the file/directory attributes
Allow systemd-tmpfiles to set the file/directory attributes, like
chattr(1) does. Two more commands are added: 'H' and 'h' to set the
attributes, recursively and not.
2015-03-19 22:20:12 -04:00
Goffredo Baroncelli
5b9fbd354e Add change_attr_fd()
Add change_attr_fd() function to modify the file/directory attribute.
2015-03-19 22:20:12 -04:00
Thomas Hindoe Paaboel Andersen
1bc48c0471 fsck: use %zu for size_t
cur and max were changed to size_t in ac6e2f0dfc
update the format accordingly.
2015-03-19 21:11:32 +01:00
David Herrmann
33c2ce7b20 strv: return NULL from strv_free()
We always return NULL/invalid-object from destructors, fix strv_free() to
do the same.
2015-03-19 14:12:00 +01:00
David Herrmann
e0d065d405 bootctl: drop redundant parse_argv()
We already call parse_argv() from main(), don't call it here again.
2015-03-19 14:11:54 +01:00
Tom Gundersen
bf0e00ec58 libudev: private - introduce udev_device_new_from_synthetic_event()
This allows set_action(), read_uevent_file() and read_db() to be made internal to libudev.
2015-03-18 14:49:20 +01:00
Michal Schmidt
a0827e2b12 core/namespace: fix path sorting
The comparison function we use for qsorting paths is overly indifferent.
Consider these 3 paths for sorting:
 /foo
 /bar
 /foo/foo
qsort() may compare:
 "/foo" with "/bar" => 0, indifference
 "/bar" with "/foo/foo" => 0, indifference
and assume transitively that "/foo" and "/foo/foo" are also indifferent.

But this is wrong, we want "/foo" sorted before "/foo/foo".
The comparison function must be transitive.

Use path_compare(), which behaves properly.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1184016
2015-03-16 22:17:15 +01:00
Michal Schmidt
2230852bd9 shared: add path_compare(), an ordering path comparison
... and make path_equal() a simple wrapper around it.
2015-03-16 22:01:41 +01:00
Didier Roche
e26169bd48 fsckd: check if plymouth is running before attempting connection 2015-03-16 18:30:20 +01:00
Didier Roche
186c9f993a fsckd: Don't use strjoina on gettext() call 2015-03-16 18:30:20 +01:00
Tom Gundersen
a88c8750b3 shared - reinstate plymouth_running()
This will be used by fsckd. This reverts part of
031886edfc.
2015-03-16 18:30:20 +01:00
Jasper St. Pierre
031886edfc core: Remove explicit Plymouth integration
Even if plymouth is running, it might have not displayed the splash yet,
so we'll see a few lines on fbcon when we should have otherwise had
nothing.

Plymouth integration was added to systemd in commit
6faa11140b. That same day, Plymouth got
systemd integration [0]. As such, the Plymouth integration has always
been obsolete, and was probably only for older Plymouth's. But I can't
imagine anybody running a Plymouth from 2011 with a systemd from 2015.

Remove the Plymouth/systemd integration, and let Plymouth's code tell
systemd to print the details.

[0] http://cgit.freedesktop.org/plymouth/commit/?id=537c16422cd49f1beeaab1ad39846a00018faec1

Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net>
Cc: Daniel Drake <dsd@endlessm.com>
Cc: Ray Strode <rstrode@redhat.com>
2015-03-16 17:47:27 +01:00
Martin Pitt
496068a828 core: don't change removed devices to state "tentative"
Commit 628c89c introduced the "tentative" device state, which caused
devices to go from "plugged" to "tentative" on a remove uevent. This
breaks the cleanup of stale mounts (see commit 3b48ce4), as that only
applies to "dead" devices.

The "tentative" state only really makes sense on adding a device when
we don't know where it was coming from (i. e. not from udev). But when
we get a device removal from udev we definitively know that it's gone,
so change the device state back to "dead" as before 628c89c.
2015-03-16 09:21:57 -04:00
Lucas De Marchi
8931278c8a vconsole-setup: check error of child process
If we don't check the error of the child process, systemd-vconsole-setup
would exit with 0 even if it could not really setup the console.

For a simple test, move loadkeys elsewhere and execute
systemd-vconsole-setup:

	[root@localhost ~]# strace -f -e execve /usr/lib/systemd/systemd-vconsole-setup
	execve("/usr/lib/systemd/systemd-vconsole-setup", ["/usr/lib/systemd/systemd-vconsol"...], [/* 15 vars */]) = 0
	Process 171 attached
	[pid   171] execve("/usr/bin/loadkeys", ["/usr/bin/loadkeys", "-q", "-C", "/dev/tty0", "br-abnt2"], [/* 15 vars */]) = -1 ENOENT (No such file or directory)
	[pid   171] +++ exited with 1 +++
	--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=171, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
	+++ exited with 0 +++

Note that loadkeys returned 1 while systemd-vconsole-setup return 0.

Since the font and keyboard setup are already serialized, refactor the
code a little bit so the functions do the wait by themselves. One change
in behavior in this patch is that we don't return early, but we do try
to setup the keyboard even if the font load failed.
2015-03-15 20:42:42 -04:00
Michael Marineau
301f4073fe network: add UseNTP DHCP option
Despite having the internal logic in place to enable/disable using NTP
servers provided by DHCP the network config didn't expose the option.
2015-03-15 17:26:58 -04:00
Zbigniew Jędrzejewski-Szmek
e62d9b8192 Add (void) where we don't care about return value 2015-03-15 17:26:58 -04:00
Zbigniew Jędrzejewski-Szmek
cc02a7b330 journal-gatewayd: factor out opening of temp file
Also use our own mkostemp wrapper, which tries to use O_TMPFILE.
2015-03-15 17:26:58 -04:00
Zbigniew Jędrzejewski-Szmek
ad8780c969 logind: check return value of session_release
It allocates memory, so it can fail.

CID #1237527.
2015-03-15 17:26:58 -04:00
Zbigniew Jędrzejewski-Szmek
0daa5666da util: check asprintf return value
CID #1237546.
2015-03-15 17:26:58 -04:00
Zbigniew Jędrzejewski-Szmek
cc3bc3e620 core: remove useless debug message
Mar 13 19:48:28 adam.happyassassin.net systemd[1]: Collecting (null)
Mar 13 19:48:28 adam.happyassassin.net systemd[1]: Collecting (null)
Mar 13 19:48:28 adam.happyassassin.net systemd[1]: Collecting (null)
Mar 13 19:48:28 adam.happyassassin.net systemd[1]: Collecting (null)
Mar 13 19:48:28 adam.happyassassin.net systemd[1]: Collecting (null)
Mar 13 19:48:28 adam.happyassassin.net systemd[1]: Collecting (null)
Mar 13 19:48:28 adam.happyassassin.net systemd[1]: Collecting (null)
2015-03-15 17:26:58 -04:00
Zbigniew Jędrzejewski-Szmek
81b9fe5440 libudev-monitor: use initialization 2015-03-15 17:26:58 -04:00
Zbigniew Jędrzejewski-Szmek
cd556b6ca8 journald: add syslog fields for audit messages
Audit messages would be displayed as "unknown[1]".

Also specify AUTH as facility... This seems to be the closest match
(/* security/authorization messages */).
2015-03-14 23:03:45 -04:00
Zbigniew Jędrzejewski-Szmek
924bc14fef sysctl: tweak debug message 2015-03-14 23:03:45 -04:00
Zbigniew Jędrzejewski-Szmek
71e4e12584 cryptsetup-generator: remove warning about crypttab access mode
This file contains no privileged data — just names of devices to decrypt
and files containing keys. On a running system most of this can be inferred from
the device tree anyway.
2015-03-14 23:03:44 -04:00
Zbigniew Jędrzejewski-Szmek
cdd45c1ffb udev: downgrade "has devpath" and "filled with db file" messages
Udev debug messages have to be significantly overhauled... For now
just downgrade those two. They are responsible for approximately 25%
of debug output during boot and are rather useless.
2015-03-14 23:03:22 -04:00
Zbigniew Jędrzejewski-Szmek
d2a623823f gpt-auto-generator: prefix messages with device name 2015-03-14 23:03:21 -04:00
Zbigniew Jędrzejewski-Szmek
d3f8667978 core: do not use quotes around virt and arch
Quotes are useful when the string can contain spaces or be otherwise
confusing. Not possible with those two.
2015-03-14 23:03:21 -04:00
Zbigniew Jędrzejewski-Szmek
a8ffe6fbcb sysv-generator: initialize LookupPaths just once
With debugging on, sysv-generator would print the full set of
lookup paths for *every* sysv script.

While at it, pass LookupPaths as a pointer in sysv-generator,
and constify it everywhere.
2015-03-14 23:03:21 -04:00
Zbigniew Jędrzejewski-Szmek
51bfdaf66c tmpfiles: remove redundant debug message
Mar 13 19:48:30 adam.happyassassin.net systemd-tmpfiles[970]: "/var/lib/machines" has right mode 40700
Mar 13 19:48:30 adam.happyassassin.net systemd-tmpfiles[970]: /var/lib/machines created successfully.
2015-03-14 23:03:21 -04:00
Zbigniew Jędrzejewski-Szmek
7034e9db51 util: remove redundant debug message
mar 14 20:05:34 fedora22 systemd[4058]: /usr/lib/systemd/system-generators/kdump-dep-generator.sh will be executed.
mar 14 20:05:34 fedora22 systemd[4058]: Spawned /usr/lib/systemd/system-generators/kdump-dep-generator.sh as 4059.

The second line already says everything.
2015-03-14 23:03:21 -04:00
Zbigniew Jędrzejewski-Szmek
bdb26d423a core: remove left-over debug message 2015-03-14 17:42:10 -04:00
Michael Biebl
6962fd3bd2 service: don't add After= dependencies on .busname units if kdbus support is disabled 2015-03-14 16:50:47 +01:00
Shawn Landden
6421348d52 udev-ctrl: fix strict aliasing issues
it is ironic that
"The only purpose of this structure is to cast the structure pointer
passed in addr in order to avoid compiler warnings.  See EXAMPLE below."
from bind(2)
2015-03-14 14:50:45 +01:00
Shawn Landden
6ec8e7c763 sd-dhcp-client: fix strict aliasing issue 2015-03-14 14:50:45 +01:00
Tom Gundersen
02d30981b1 sd-event: sd_event_run - only return 0 on timeout
sd_event_dispatch() returns 0 on FINISH, so let's eat that up.
2015-03-14 12:17:24 +01:00
Tom Gundersen
2b0c9ef735 sd-event: rename PASSIVE/PREPARED to INITIAL/ARMED 2015-03-14 12:17:24 +01:00
Will Woods
f5ce2b4958 selinux: fix SEGV during switch-root if SELinux policy loaded
If you've got SELinux policy loaded, label_hnd is your labeling handle.
When systemd is shutting down, we free that handle via mac_selinux_finish().

But: switch_root() calls mkdir_p_label(), which tries to look up a label
using that freed handle, and so we get a bunch of garbage and eventually
SEGV in libselinux.

(This doesn't happen in the switch-root from initramfs to real root because
there's no SELinux policy loaded in initramfs, so label_hnd is NULL and we
never attempt any lookups.)

So: make sure that mac_selinux_finish() actually sets label_hnd to NULL, so
nobody tries to use it after it becomes invalid.

https://bugzilla.redhat.com/show_bug.cgi?id=1185604
2015-03-13 23:42:18 -04:00
Zbigniew Jędrzejewski-Szmek
64144440a5 sd-daemon: simplify sd_pid_notify_with_fds
Coverity was complaining that CMSG_NXTHDR is used without
checking the return value. In this case it cannot fail, but
it is a good excuse to simplify the function a bit.

CID #1261726.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
24bfda116c udev: properly calculate size of remaining data
The data comes from the kernel, so chances of it being
garbled are low, but for correctness' sake, add the check.

CID #996458.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
9116b40692 test-dhcp-option: conform to usual coding style 2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
0915fda60a test-dhcp-option: add assert to check index is nonnegative
CID #1237623.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
d6483ba783 core: check asprintf return value
CID #1261729.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
e64d523579 core: print warning on invalid swap pri= field
CID #1264371.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
8fa158e79d core: one more (void)
CID #996308.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
2bf105232f logind: explicitly ignore errors we can do nothing about
CID #1237545.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
d3839740fa bus: explicitly ignore failure during error handling
CID #1237548.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
42b1b9907d core: explicitly ignore failure during cleanup
CID #1237550.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
cd972d6911 core: don't wait for reply if writing to pipe fails
This shouldn't really happen, but it's seems cleaner to
continue on error.

CID #1237552.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
3164e3cbc5 core: either ignore or handle mount failures
/dev/pts/ptmx is as important as /dev/pts, so error out if that
fails. Others seem less important, since the namespace is usable
without them, so ignore failures.

CID #123755, #123754.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
dc75168823 Use space after a silencing (void)
We were using a space more often than not, and this way is
codified in CODING_STYLE.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
2ae56591b5 core: ignore any issues with setting time on jobs_in_progress_event_source
CID #1237559.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
d448c7927a sd-resolve: use different element of union to make code more readable
They both point to the same location, but the reader
is not forced to look back to the beginning of the function
to see that.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
39d0fd9c0c journal-remote: explain why source->buf cannot be null
In reference to CID #1238956.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
012d7b4217 Check that EWOULDBLOCK is the same as EAGAIN
It certainly is everywhere on Linux, but as a courtesy
to people doing some strange cross-compilation, check
that the assumption holds.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
be7e1319ea journal-remote: make process_data static 2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
48861960ac nspawn: tell coverity that we ignore return value
CID #1271353.
2015-03-13 23:42:16 -04:00
Zbigniew Jędrzejewski-Szmek
a0b1209c4a gpt-auto-generator: allow type check to fail
add_mount() is OK with unknow file type, but we have to initalize
the variable to NULL not to pass garbage on error.
2015-03-13 23:42:16 -04:00
Zbigniew Jędrzejewski-Szmek
7c5925a448 efi: widen operand to avoid overflow
CID #1287141.
2015-03-13 23:42:16 -04:00
Zbigniew Jędrzejewski-Szmek
9fff898181 core: issue error on oom we can do nothing about
CID #1287142.
2015-03-13 23:42:16 -04:00
Zbigniew Jędrzejewski-Szmek
d357562c48 µhttp-util: setup gnutls logs in one function 2015-03-13 23:42:16 -04:00
Tom Gundersen
1b14c3cfbe udev: make set_usec_initialized() internal to libudev
Instead introduce ensure_usec_initialized(), which copies the timestamp if possible otherwise
sets it to now(CLOCK_MONOTONIC).
2015-03-13 18:47:07 +01:00
Tom Gundersen
0964dcd772 sd-rtnl: read_message - don't set group if not needed 2015-03-13 16:15:03 +01:00
Tom Gundersen
f436aa11f7 sd-rtnl: process - only apply matches to broadcast messages 2015-03-13 16:13:24 +01:00
Tom Gundersen
3f42446d28 sd-rtnl: improve detection of broadcast messages
Do not rely on nl_pid == 0, but check the groups instead. We currently avoid using
nl_pid == 0 for unicast anyway, so this should be redundant, but let's try to be
correct.
2015-03-13 16:12:57 +01:00
Tom Gundersen
913b0eef1a sd-rtnl: never set serial to 0
In the unlikely event that we wrap the counter, skip 0 as this is used
for broadcasts.

Suggested by Richard Maw.
2015-03-13 15:56:08 +01:00
David Herrmann
15411c0cb1 tree-wide: there is no ENOTSUP on linux
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
2015-03-13 14:10:39 +01:00
David Herrmann
32a568fb90 bus: stop using EDEADLOCK
The error code is called EDEADLK, stop using legacy names like EDEADLOCK.
Note that _some_ weird architectures define them differently (namely, mips
and sparc), but on all sane architectures they're exactly the same. So
stay with the widely used code, which is EDEADLK.
2015-03-13 14:10:39 +01:00
David Herrmann
ff55c3c732 journal-remote: stop using EWOULDBLOCK
There is no reason to ever use EWOULDBLOCK. It's equivalent to EAGAIN on
all architectures on linux.
2015-03-13 14:10:35 +01:00
David Herrmann
ca2031fcc8 udev: dont use EWOULDBLOCK
EWOULDBLOCK is the same as EAGAIN, stop using it.
2015-03-13 14:09:55 +01:00
Mathieu Chevrier
d736e4f3e7 gpt-auto-generator: fix detection of /srv
https://bugs.freedesktop.org/show_bug.cgi?id=89226
2015-03-13 00:36:02 -04:00
Zbigniew Jędrzejewski-Szmek
a2360a467b sd-event: fix typo 2015-03-13 00:26:02 -04:00
Zbigniew Jędrzejewski-Szmek
043945b938 journal-remote: process events without delay
journal-remote buffers input, and then parses it handling one journal entry at a time.
It was possible for useful data to be left in the buffer after some entries were
processesed. But all data would be already read from the fd, so there would be
no reason for the event loop to call the handler again. After some new data came in,
the handler would be called again, and would then process the "old" data in the buffer.

Fix this by enabling a handler wherever we process input data and do not exhaust data
from the input buffer (i.e. when EAGAIN was not encountered). The handler runs until
we encounter EAGAIN.

Looping over the input data is done in this roundabout way to allow the event loop
to dispatch other events in the meanwhile. If the loop was inside the handler, a
source which produced data fast enough could completely monopolize the process.

https://bugs.freedesktop.org/show_bug.cgi?id=89516
2015-03-13 00:26:02 -04:00
Zbigniew Jędrzejewski-Szmek
f53f7c8fc4 journal-remote: check also for EWOULDBLOCK
This matches similar code elsewhere.
2015-03-13 00:26:02 -04:00
Zbigniew Jędrzejewski-Szmek
0e72da6fe8 journal-remote: downgrade routine messages to debug
https://bugs.freedesktop.org/show_bug.cgi?id=89486
2015-03-13 00:26:02 -04:00
Zbigniew Jędrzejewski-Szmek
c066b4746b sd-pppoe: workaround for incomplete include in old kernels 2015-03-12 20:50:08 -04:00
Richard Maw
d422e52a35 networkd: Begin with serial number 1 for netlink requests
"Notifications are of informal nature and no reply is expected, therefore the
sequence number is typically set to 0."[1]

If networkd is started soon after recent netlink activity, then there
will be messages with sequence number 0 in the buffer.

The first thing networkd does is to request a dump of all the links. If
it uses sequence number 0 for this, then it may confuse the dump request's
response with that of a notification.

This will result in it failing to properly enumerate all the links,
but more importantly, when it comes to enumerate all the addresses, it
will still have the link dump in progress, so the address enumeration
will fail with -EBUSY.

[1]: http://www.infradead.org/~tgr/libnl/doc/core.html#core_msg_types

[tomegun: sequence -> serial]
2015-03-12 19:34:35 +01:00
Tom Gundersen
103635db51 core: add missing words to my fix of explanation of associativity 2015-03-12 12:23:59 +01:00
Tom Gundersen
6969c349df udevd: improve handling of failed worker
The information in the db is stale, so it does not make sense to
expose it any longer. Also, don't drop the kernel event, but simply
pass it on to userspace without ammending it.
2015-03-12 12:03:50 +01:00
Tom Gundersen
090b6bc520 udevd: don't free event when killing the worker, wait until it has been reaped
This will allow us to clean up the device when we are notified about the worker being killed.
2015-03-12 12:03:50 +01:00
Tom Gundersen
8f0f13f045 libudev: introduce clone_with_db()
This allows us to move the db reading from udevd to libudev.
2015-03-12 12:03:50 +01:00
Tom Gundersen
a4445e88ce libudev: monitor - fix error path in send_device
Return -errno rather than -1 in case sendmsg() fails.
2015-03-12 12:03:50 +01:00
Tom Gundersen
3c0bab4aaf udevd: event - make db loading lazy in REMOVE event handling
We were explicitly eagerly loading the db, then deletenig the backing file and then processing the
rules/symlinks. Instead we delete the backnig db file as the last step and let the db loading be
lazy as everywhere else.

This may save us a bit of work in casese where the db is not needed, but more importantly it hides
some implementation details of libudev-device form udevd.
2015-03-12 12:03:50 +01:00
Tom Gundersen
1cd0a77022 libudev: introduce udev_device_properties_copy()
To copy properties from one device to another. Drop the equivalent functionality from udevd.
2015-03-12 11:59:04 +01:00
Kay Sievers
4db7e6d781 boot: efi - add config option to disable the command line editor 2015-03-11 23:33:53 +01:00
Umut Tezduyar Lindskog
510c4a0f1e cgtop: fix assert when not on tty
systemd-cgtop --dept=1 -b -n 10 -d 0.1 | cat

Assertion 'new_length >= 3' failed at src/shared/util.c:3 \
595, function ellipsize_mem(). Aborting.
Aborted (core dumped)

(David: add comment)
2015-03-11 16:59:53 +01:00
David Herrmann
f5b51ea7fc core: fix cgroups-agent match for kdbus
On kdbus, we get cgroups-agent messages via the system bus, not the
private systemd socket. Therefore, we must install the match properly or
we will never receive cgroup notifications.
2015-03-11 16:36:41 +01:00
David Herrmann
39881ed299 core: rewind message before forwarding it
Forwarding messages that are not rewinded will drop data. Fix this for
cgroups-agent messages that we might remarshal before forwarding to the
system bus.
2015-03-11 16:36:41 +01:00
David Herrmann
908b8a42e6 bus: remarshal kdbus messages received from the kernel
If we receive an sd_bus_message from the kernel, m->kdbus will contain
additional items that cannot be used when sending a message. Therefore,
always remarshal the message if it is used again.
2015-03-11 16:36:41 +01:00
David Herrmann
8b9972db83 bus: drop redundant assignment
This assignment is already done in the parent context, no need to do it
again.
2015-03-11 16:36:41 +01:00
Zbigniew Jędrzejewski-Szmek
fc25ad25e0 socket-util: refactor error handling in sockaddr_pretty 2015-03-11 10:08:12 -04:00
Tom Gundersen
48b4eab497 core: fix explanation of associativity 2015-03-11 14:55:18 +01:00
David Herrmann
ec2c7b5659 bus-proxy: complain only once about queue overflows
If the local peer does not dispatch its incoming queue, the bus-proxy will
slowly fill its outgoing queue. Once its full, it will continously
complain that it cannot forward its messages.

As it turns out, pulseaudio does have an idle background dbus connection
that is not integrated into any mainloop (and given that gdbus and
libdbus1 both support background shared connections, PA is probably not
the only example), therefore, the bus-proxy will loudly complain if it
cannot forward NameOwnerChanged events once the queue is full.

This commit makes the proxy track queue-state and complain only once the
queue runs full, not if it is already full.

A PA bug-report (and patch) has been filed, and other applications should
be fixed similarly. Hence, lets keep the error message, instead of
dropping it. It's unused resources we really want to get rid of, so
silencing the message does not really help (which is actually what
dbus-daemon does).
2015-03-11 13:57:38 +01:00
David Herrmann
b2068772f5 terminal/sysview: introduce SETTLE events
This introduces a new SYSVIEW_EVENT_SETTLE notification that is sent after
initial scanning via sysview is done. This is very handy to let the
application raise warnings in case requested resources are not found
during startup.

The SETTLE event is sent after systemd-logind and udev enumerations are
done. This event does in no way guarantee that a given resource is
available. All it does is notify the application that scanning is done!
You must not react to SETTLE if you don't have external synchronization
with the resource you're waiting for.

The main use-case for SETTLE is to run applications _inside_ of logind
sessions and startup sysview. You really want to make sure that the own
session you're running in was found during enumeration. If not, something
is seriously wrong.
2015-03-11 12:32:48 +01:00
David Herrmann
84c3561c58 console: fix error-code inversion
The error-code propagated via sysview is always negative. Avoid
multiplying by -1 before returning it. Otherwise, we will return >0
instead of <0, which will not be detected as error by sysview-core.
2015-03-11 12:32:48 +01:00
Kay Sievers
f4cf2e5b2f udev: add SYSCTL{} support 2015-03-11 11:15:53 +01:00
Kay Sievers
88a60da054 sysctl: move property handling to shared/ 2015-03-11 10:37:45 +01:00
Lennart Poettering
c6ac7e4b98 machine-id-setup: simplifications 2015-03-10 19:09:38 +01:00
Lennart Poettering
d9dde2bb03 machine-id-commit: simplifications 2015-03-10 18:56:56 +01:00
Alban Crequy
f85ef957e6 util: add rename_noreplace
renameat2() exists since Linux 3.15 but btrfs support for the flag
RENAME_NOREPLACE was added later.

This patch implements a fallback when renameat2() returns EINVAL.
EINVAL is the error returned when the filesystem does not support one of
the flags.
2015-03-10 18:23:46 +01:00
Harald Hoyer
27cc6f166b path-util: fix path_is_mount_point() for symlinks
path_is_mount_point() compares the mount_id of a directory and the
mount_id of the parent directory. When following symlinks, the function
to get the parent directory does not take the symlink into account.

/bin -> /usr/bin with /usr being a mountpoint:
mount_id of /bin with AT_SYMLINK_FOLLOW != mount_id of /
2015-03-10 17:46:20 +01:00
Lukasz Skalski
52fa7a3af1 bus-proxy: add support for "GetConnectionCredentials" method
GetConnectionCredentials method was added to dbus-1 specification
more than one year ago. This method should return "[...] as many
credentials as possible for the process connected to the server",
but at this moment only "UnixUserID", "LinuxSecurityLabel" and
"ProcessID" are defined by the specification. We should add support
for next credentials after extending dbus-1 spec.
2015-03-10 16:12:14 +01:00
daurnimator
657cf7f4f8 tmpfiles: port to unquote_many_words() 2015-03-10 16:08:20 +01:00
Lennart Poettering
cb81cd8073 shared: the btrfs quota field is called "referenced" not "referred" 2015-03-10 15:55:58 +01:00
Lennart Poettering
6e9efa5920 man: document "machinectl export-tar" and "export-raw" 2015-03-10 15:48:14 +01:00
Shawn Landden
3b1c524154 add REMOTE_ADDR and REMOTE_PORT for Accept=yes 2015-03-10 09:00:27 -04:00
Didier Roche
54bcf1557c fsckd: clean up log messages
Avoid double logs printing. Not that we don't return
manager_update_global_progress() to the handler callback as if the console or
plymouth isn't available momentarily, we still desire to handle future
fd progress events if those are available again (like cancellation, reports…)
2015-03-10 11:45:54 +01:00
Didier Roche
867ce6a516 fsckd: Reduce the SAK window when writing to console
We don't want to keep /dev/console open all the time, but only open it when
needed, to avoid interfering with SAK.
2015-03-10 11:43:09 +01:00
Thomas Hindoe Paaboel Andersen
0c900704e7 Add type specifier for int 2015-03-10 05:37:01 +01:00
Thomas Hindoe Paaboel Andersen
6c767d1e1a logs-show: fix check of loop_read_exact
just a typo fix
2015-03-10 05:37:01 +01:00
Zbigniew Jędrzejewski-Szmek
a6dcc7e592 Introduce loop_read_exact helper
Usually when using loop_read(), we want to read the full buffer.
Add a helper that mirrors loop_write(), and returns 0 when full buffer
was read, and an error otherwise.

Use -ENODATA for the short read, to distinguish it from a read error.
2015-03-09 22:10:54 -04:00
Zbigniew Jędrzejewski-Szmek
ad7bcf526d efivars: itialize variable
Introduced a few commits ago.
2015-03-09 22:10:54 -04:00
Zbigniew Jędrzejewski-Szmek
d92f98b4f6 bootchart: use _cleanup_ 2015-03-09 22:10:54 -04:00
Zbigniew Jędrzejewski-Szmek
6410074b4f Add missing includes
audit.h uses uint32_t and bool.
log.h uses abs.
2015-03-09 22:10:54 -04:00
Zbigniew Jędrzejewski-Szmek
faf9da01ad journalctl: unlink without checking with access first
It is more elegant to do this in one step.

Coverity complains about the TOCTOU difference, but it is not an
actual problem (CID #1237777).
2015-03-09 22:06:46 -04:00
Zbigniew Jędrzejewski-Szmek
977eaa1eae journal: fix return code
Introduced in fa6ac76083.

Might be related to CID #1261724, but I don't know if coverity can
recurse this deep.
2015-03-09 22:02:25 -04:00
Zbigniew Jędrzejewski-Szmek
d587eca510 journal-file: update format string to remove cast 2015-03-09 22:02:25 -04:00
Zbigniew Jędrzejewski-Szmek
288359dba1 journal: align comments to make them more legible 2015-03-09 22:02:25 -04:00
Tom Gundersen
b94da8cf72 libudev: add missing hunks
This should have been committed with
  udev_device_add_property - implicitly mark properties for saving to db
2015-03-09 23:36:27 +01:00
Tom Gundersen
570b83cc62 libudev: udev_device_read_db - drop unused argument 2015-03-09 23:27:12 +01:00
Tom Gundersen
df546eb56a libudev: udev_device_add_property - implicitly mark properties for saving to db
Properties should only be saved to the db when added to the udev_device by udevd, and only if
the property does not start with a '.'. Make this implicit rather than expose the marking of
properties.
2015-03-09 22:50:44 +01:00
Tom Gundersen
3738cc858d udev/libudev: event - move {OLD_,}INTERFACE handling from udevd to libudev
This should be internal to the library as it is only about reflecting the sysfs state in the udev_device.
2015-03-09 22:50:44 +01:00
Tom Gundersen
bd57b6de74 libudev: private - make property_from_string_parse* static 2015-03-09 22:50:44 +01:00
Tom Gundersen
dfc4b6acf0 udev: simplify event_queue_update() and add debug logging
This essentially replaces
  open("/run/udev/queue", O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444)
with
  open("/run/udev/queue", O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, 0644),
which is ok for our purposes.
2015-03-09 22:38:51 +01:00
Zbigniew Jędrzejewski-Szmek
7432b24b83 efivars: use greedy_realloc 2015-03-09 16:45:28 -04:00
Zbigniew Jędrzejewski-Szmek
0797f2329c efivars: use more _cleanup_
Also rename r to buf, since r is customarily reserved for the return value.
2015-03-09 16:45:27 -04:00
Zbigniew Jędrzejewski-Szmek
0aa3b7830f efivars: do binary and before converting to bool
I'm pretty sure that this is what was meant here.
2015-03-09 16:45:27 -04:00
Zbigniew Jędrzejewski-Szmek
a8436474fa efivars: rename last remaining err to r 2015-03-09 16:45:27 -04:00
Zbigniew Jędrzejewski-Szmek
b7749eb517 efivars: modernization
Fix return value if unlink fails.
2015-03-09 16:45:27 -04:00
Zbigniew Jędrzejewski-Szmek
56c70b32af boot/efi: do not assign variable twice
If the highlighted line did not move outside of the visible
region, it should not be necessary to update idx_last.

CID #1287137, #1287138.
2015-03-09 16:45:27 -04:00
Thomas Hindoe Paaboel Andersen
061a237dd2 machinectl: remove unused variables 2015-03-09 21:09:18 +01:00
Lennart Poettering
566690fdb0 fsck: modernize error handling 2015-03-09 19:57:39 +01:00
Lennart Poettering
1952708abb fsck: use _cleanup_close_pair_ where appropriate 2015-03-09 19:50:37 +01:00
Lennart Poettering
57b394b505 fsckd: make sure we free the connection event source before we close the connection fd 2015-03-09 19:41:01 +01:00
Lennart Poettering
e78e0674f3 fsckd: don't allow unbounded numbers of clients 2015-03-09 19:38:23 +01:00
Lennart Poettering
d42688ef21 fsckd: free client event source before we close its fd 2015-03-09 19:38:23 +01:00