Commit Graph

20248 Commits

Author SHA1 Message Date
Tom Gundersen 24c083dfcb networkd: network_get - allow udev_device to be NULL
In containers we never have udev devices, so drop the assert.

This fixes an assertion introduced in af3aa30274.
2015-05-12 00:43:45 +02:00
Tom Gundersen e4f66b7773 udevd: make udev_ctrl_connection global
This allows us to simplify the ctrl_msg handler. Eventually all this global state should move to
a Manager object or so.
2015-05-12 00:43:45 +02:00
Thomas Hindoe Paaboel Andersen eacd853425 systemctl: fix check for template units
A typo from 7410616c. We want to ignore EINVAL but only catch errors.
2015-05-12 00:26:14 +02:00
Lennart Poettering 0a98c46d50 update TODO 2015-05-11 22:59:11 +02:00
Lennart Poettering cab6235f74 install: when exporting prefix InstallInfo to become UnitFileInstallInfo
All other types exported from install.h should be namespaces like this,
hence namespace InstallInfo the same way.

Also, remove external forward definition of UnitFileScope type.
2015-05-11 22:53:54 +02:00
Lennart Poettering b2c23da8ce core: rename SystemdRunningAs to ManagerRunningAs
It's primarily just a property of the Manager object after all, and we
try to refer to PID 1 as "manager" instead of "systemd", hence let's to
stick to this here too.
2015-05-11 22:51:49 +02:00
Lennart Poettering 8b4305c735 unit: move unit_warn_if_dir_nonempty() and friend to unit.c
The call is only used by the mount and automount unit types, but that's
already enough to consider it generic unit functionality, hence move it
out of mount.c and into unit.c.
2015-05-11 22:28:52 +02:00
Lennart Poettering f2341e0a87 core,network: major per-object logging rework
This changes log_unit_info() (and friends) to take a real Unit* object
insted of just a unit name as parameter. The call will now prefix all
logged messages with the unit name, thus allowing the unit name to be
dropped from the various passed romat strings, simplifying invocations
drastically, and unifying log output across messages. Also, UNIT= vs.
USER_UNIT= is now derived from the Manager object attached to the Unit
object, instead of getpid(). This has the benefit of correcting the
field for --test runs.

Also contains a couple of other logging improvements:

- Drops a couple of strerror() invocations in favour of using %m.

- Not only .mount units now warn if a symlinks exist for the mount
  point already, .automount units do that too, now.

- A few invocations of log_struct() that didn't actually pass any
  additional structured data have been replaced by simpler invocations
  of log_unit_info() and friends.

- For structured data a new LOG_UNIT_MESSAGE() macro has been added,
  that works like LOG_MESSAGE() but prefixes the message with the unit
  name. Similar, there's now LOG_LINK_MESSAGE() and
  LOG_NETDEV_MESSAGE().

- For structured data new LOG_UNIT_ID(), LOG_LINK_INTERFACE(),
  LOG_NETDEV_INTERFACE() macros have been added that generate the
  necessary per object fields. The old log_unit_struct() call has been
  removed in favour of these new macros used in raw log_struct()
  invocations. In addition to removing one more function call this
  allows generated structured log messages that contain two object
  fields, as necessary for example for network interfaces that are
  joined into another network interface, and whose messages shall be
  indexed by both.

- The LOG_ERRNO() macro has been removed, in favour of
  log_struct_errno(). The latter has the benefit of ensuring that %m in
  format strings is properly resolved to the specified error number.

- A number of logging messages have been converted to use
  log_unit_info() instead of log_info()

- The client code in sysv-generator no longer #includes core code from
  src/core/.

- log_unit_full_errno() has been removed, log_unit_full() instead takes
  an errno now, too.

- log_unit_info(), log_link_info(), log_netdev_info() and friends, now
  avoid double evaluation of their parameters
2015-05-11 22:24:45 +02:00
Lennart Poettering 6f856a0992 core: always initialize ExecParamters.bus_endpoint_fd to -1
Otherwise it might be passed in as 0, which is a valid fd, but usually
does not refer to a real endpoint.
2015-05-11 22:18:21 +02:00
Lennart Poettering d3650f0c4b units: order nspawn containers after network.target
This way we know that any bridges and other user-created network devices
are in place, and can be properly added to the container.

In the long run this should be dropped, and replaced by direct calls
inside nspawn that cause the devices to be created when necessary.
2015-05-11 22:18:20 +02:00
Lennart Poettering 4b64536ee7 util: optimize free_and_strdup() if NOP
Under the assumption that strcmp() is cheaper than memory allocation,
let's avoid the allocation, if the new value is identical to the old.
2015-05-11 22:10:36 +02:00
Lennart Poettering 27023c0ef5 nspawn: pass on kill signal setting to contaner scope
Let's just pass on what the user set for us.
2015-05-11 22:10:36 +02:00
Lennart Poettering c2570ab99b update TODO 2015-05-11 22:10:36 +02:00
Thomas Hindoe Paaboel Andersen 86ff9f1173 test-libudev: fix leak in error case
CID# 1297428
2015-05-11 21:42:59 +02:00
Thomas Hindoe Paaboel Andersen 12322d4100 swap: avoid null pointer dereference
CID#1297436
2015-05-11 21:03:50 +02:00
Torstein Husebø ff9b60f38b treewide: Correct typos and spell plural of bus consistent 2015-05-11 15:51:30 +02:00
Zbigniew Jędrzejewski-Szmek 4dda4e637e Generate systemd-fsck-root.service in the initramfs
In the initrafms, generate a systemd-fsck-root.service to replace
systemd-fsck@<sysroot-device>.service. This way, after we transition
to the real root, systemd-fsck-root.service is marked as already done.

This introduces an unnecessary synchronization point, because
systemd-fsck@* is ordered after systemd-fsck-root also in the
initramfs. In practice this shouldn't be a problem.

https://bugzilla.redhat.com/show_bug.cgi?id=1201979

C.f. 956eaf2b8d.
2015-05-10 13:17:57 -04:00
Zbigniew Jędrzejewski-Szmek 7703bd4d28 man: fix typos in previous comimt 2015-05-09 19:46:23 -04:00
Zbigniew Jędrzejewski-Szmek 589532d0c6 man: document forwarding to syslog better
https://bugzilla.redhat.com/show_bug.cgi?id=1147651
2015-05-09 17:21:18 -04:00
Cristian Rodríguez 7e273016de buildsys: *_la_CPPFLAGS takes $(AM_CPPFLAGS) not $(AM_CFLAGS) 2015-05-09 19:12:12 +02:00
Thomas Hindoe Paaboel Andersen 74bddd6f19 udevd: remove unused function 2015-05-07 07:27:38 +02:00
Tom Gundersen 020328e197 udevd: don't explicitly count the number of workers
Simply query the size of the hashmap keeping all the worker contexts instead.
2015-05-06 23:45:10 +02:00
Tom Gundersen a505965d95 udevd: keep workers in a hashmap rather than a list
This makes the code somewhat more readable.
2015-05-06 23:45:10 +02:00
Tom Gundersen c6aa11f200 udevd: worker - drop reference counting
Make the worker context have the same life-span as the worker process. It is created on fork()
and free'd on SIGCHLD.

The change means that we can get worker_returned() for a worker context that is no longer around,
this is not a problem and we can just drop the message. The only use for worker_returned() is to
know to reschedule events to workers that are still around, so if the worker has already exited
it is not important to keep track of. We still print a debug statement in this case to be on the
safe side.
2015-05-06 23:45:10 +02:00
Thomas Hindoe Paaboel Andersen 7f629b74c4 device: avoid null pointer dereference 2015-05-06 19:58:03 +02:00
David Herrmann f7e3c6f5f8 udev: fix weird coding-style
Eeeew!
2015-05-06 18:59:03 +02:00
Thomas Hindoe Paaboel Andersen c0c6a4fc1c test-libudev: add error handling
CID#1296244
2015-05-06 18:40:30 +02:00
Tom Gundersen c4fcf70a01 udevd: worker - allow passing NULL to worker_unref() 2015-05-06 18:35:55 +02:00
Tom Gundersen 8b46c3fc48 udevd: worker - use _exit() rather than exit()
Follow the coding style and avoid the exit handlers.
2015-05-06 18:35:55 +02:00
Tom Gundersen 6af5e6a4c9 udevd: modernize error handling
We never return magic exit codes, but just EXIT_FAILUER or EXIT_SUCCESS.
2015-05-06 18:35:55 +02:00
Tom Gundersen 614a823c44 udevd: use kernel cmdline parser 2015-05-06 18:35:55 +02:00
Tom Gundersen 9c2dabd05f udevd: worker - move some fields from the worker to the event 2015-05-06 18:35:55 +02:00
Tom Gundersen 39c19cf13a udevd: worker - introduce worker_attach_event() 2015-05-06 18:35:55 +02:00
Tom Gundersen 3a19b32a67 udevd: worker - make refcounting clearer
Take and drop explicit references where it makes sense.
2015-05-06 18:35:55 +02:00
Tom Gundersen e03c7cc26e udevd: worker - only allocate the worker struct in the main process
This is not used in the worker, so avoid having to free it there.
2015-05-06 18:35:55 +02:00
Tom Gundersen f96a5160c4 udevd: rename worker_new() to worker_spawn() 2015-05-06 18:35:55 +02:00
Tom Gundersen 4914cb2ddc udevd: don't track worker exitcode
We used to use this to track failed events so they could be retriggered,
but that is no longer done, so the code can be dropped.
2015-05-06 18:35:55 +02:00
David Herrmann a44816e94e Update TODO 2015-05-06 18:30:01 +02:00
Susant Sahani 61087906e0 udev: fix coding style 2015-05-06 09:27:46 -07:00
Daniel Buch cafbecf31c systemctl: null-initialize pointer with cleanup attribute 2015-05-06 09:26:20 -07:00
Thomas Hindoe Paaboel Andersen 90615ad791 machinectl: remove unused variable 2015-05-06 18:23:46 +02:00
David Herrmann d79acc3093 bus: don't switch to kdbus if not requested
Whenever systemd is re-executed, it tries to create a system bus via
kdbus. If the system did not have kdbus loaded during bootup, but the
module is loaded later on manually, this will cause two system buses
running (kdbus and dbus-daemon in parallel).

This patch makes sure we never try to create kdbus buses if it wasn't
explicitly requested on the command-line.
2015-05-06 18:21:51 +02:00
Zbigniew Jędrzejewski-Szmek f2bf5007a9 timedated: remove unnecessary goto
Not needed since 99f861310d.
2015-05-06 00:44:52 -04:00
Michael Olbrich f44b28fda0 tmpfiles: try to handle read-only file systems gracefully
On read-only filesystems trying to create the target will not fail with
EEXIST but with EROFS. Handle EROFS by checking if the target already
exists, and if empty when truncating.
This avoids reporting errors if tmpfiles doesn't actually needs to do
anything.

[zj: revert condition to whitelist rather then blacklisting, and add goto
to avoid stat'ting twice.]
2015-05-06 00:10:40 -04:00
Michael Olbrich 3e7f33ada9 shared/utmp-wtmp: fix copy/paste error 2015-05-05 23:41:10 -04:00
Zbigniew Jędrzejewski-Szmek 236e1cc4cf Add audit type generated files to gitignore
They are not currently used, but the Makefile rules don't know that.
It's easier to ignore them, then to special-case creation rules.
2015-05-05 22:41:42 -04:00
Colin Walters cd2eb9e942 lockfile-util.[ch]: Split out from util.[ch]
Continuing the general trend of splitting up util.[ch].  I specifically
want to reuse this code in https://github.com/GNOME/libglnx and
having it split up will make future copy-pasting easier.
2015-05-05 22:35:29 -04:00
Seth Jennings 7e7cddb224 Fix permissions on /run/systemd/nspawn/locks
machined is getting an EACCES when trying to create the lock file for
images because the mode on /run/systemd/nspawn/locks is 0600.

mkdir("/run/systemd/nspawn/locks", 0600) = -1 EEXIST (File exists)
stat("/run/systemd/nspawn/locks", {st_mode=S_IFDIR|0600, st_size=40, ...}) = 0
open("/run/systemd/nspawn/locks/inode-41:256", O_RDWR|O_CREAT|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC, 0600) = -1 EACCES (Permission denied)

This commit adjusts the mode to 0700 to correct the issue.
2015-05-05 22:21:26 -04:00
Torstein Husebø e5f270f5d0 treewide: fix typos 2015-05-05 22:19:28 -04:00
Lennart Poettering d89e647542 update TODO 2015-05-05 15:07:00 -07:00