Commit graph

11300 commits

Author SHA1 Message Date
Lennart Poettering 5954c07433 cgroup: do not allow manipulating the cgroup path of units within the systemd:/system subtree 2013-04-30 08:36:01 -03:00
Lennart Poettering aa96c6cb44 id128: when taking user input for a 128bit ID, validate syntax
Also, always accept both our simple hexdump syntax and UUID syntax.
2013-04-30 08:36:01 -03:00
Mantas Mikulėnas 6886b0449d kernel-install: Clean up
- Consistent use of $VAR vs ${VAR}
- Consistent use of && vs 'if'
- Add error checking to some places
- Consistent error messages ("Can't" vs "Cannot", etc.)
- Function declarations at the top
- Miscellaneous adjustments
2013-04-30 12:14:35 +02:00
Zbigniew Jędrzejewski-Szmek a827e37371 man: clarify what Restart= means
Related to https://bugzilla.redhat.com/show_bug.cgi?id=957135.
2013-04-29 19:52:30 -04:00
Evangelos Foutras d7e011e5bf nspawn: add -M option to optstring
This was missed in commit 7027ff61a3 and
means that the --machine option would work but not its shorthand, -M.
2013-04-29 09:00:27 -04:00
Kay Sievers e29380ebbe Makefile-man.am: update 2013-04-27 00:01:32 +02:00
Harald Hoyer bb150966c0 systemd-analyse: add "critical-chain" command
"critical-chain" prints a tree of the critical chain of units

$ ./systemd-analyze critical-chain
graphical.target @1.226s
└─multi-user.target @1.226s
  └─nfs-lock.service @961ms +265ms
    └─rpcbind.service @958ms +1ms
      └─network.target @957ms
        └─NetworkManager.service @434ms +522ms
          └─basic.target @428ms
            └─sockets.target @428ms
              └─dbus.socket @428ms
                └─sysinit.target @427ms
                  └─systemd-tmpfiles-setup.service @411ms +15ms
                    └─local-fs.target @410ms
                      └─boot-efi.automount @410ms
                        └─boot.mount @397ms +9ms
                          └─local-fs-pre.target @192ms
                            └─systemd-udevd.service @187ms +5ms
                              └─systemd-udevd-control.socket @140ms
                                └─-.mount

With the "--fuzz=<ms>" parameter one can display more units around
the critical units.

$ ./systemd-analyze --fuzz=10ms critical-chain
└─multi-user.target @1.226s
  └─nfs-lock.service @961ms +265ms
    ├─rpcbind.service @958ms +1ms
    │ └─network.target @957ms
    │   └─NetworkManager.service @434ms +522ms
    │     ├─basic.target @428ms
    │     │ ├─sockets.target @428ms
    │     │ │ ├─dbus.socket @428ms
    │     │ │ │ └─sysinit.target @427ms
    │     │ │ │   ├─systemd-tmpfiles-setup.service @411ms +15ms
    │     │ │ │   │ └─local-fs.target @410ms
    │     │ │ │   │   └─boot-efi.automount @410ms
    │     │ │ │   │     └─boot.mount @397ms +9ms
    │     │ │ │   │       └─local-fs-pre.target @192ms
    │     │ │ │   │         └─systemd-udevd.service @187ms +5ms
    │     │ │ │   │           ├─systemd-udevd-control.socket @140ms
    │     │ │ │   │           │ └─-.mount
    │     │ │ │   │           └─systemd-udevd-kernel.socket @140ms
    │     │ │ │   └─swap.target @421ms
    │     │ │ │     └─dev-disk-by\x2duuid-....swap @414ms +6ms
    │     │ │ │       └─systemd-journald.socket
    │     │ │ ├─rpcbind.socket @428ms
    │     │ │ └─cups.socket @428ms
    │     │ ├─paths.target @428ms
    │     │ │ └─cups.path @428ms
    │     │ ├─timers.target @427ms
    │     │ │ └─systemd-tmpfiles-clean.timer @427ms
    │     │ └─sysinit.target @427ms
    │     │   └─...
    │     └─dbus.socket @428ms
    │       └─...
    └─network.target @957ms
      └─...
2013-04-26 13:34:22 +02:00
Harald Hoyer 17f5e4577b dbus-manager.c: log error, why switch-root is refused 2013-04-26 13:33:28 +02:00
Colin Walters 910003d022 coredump: use realloc() loop instead of malloc(768M)
I typically run VMs with 1024MiB allocated; systemd is unable to write
coredumps in this scenario at all because the default kernel
configuration will only overcommit 50% of available RAM.

Avoid this failure by using a realloc() loop.

See: http://lists.freedesktop.org/archives/systemd-devel/2013-April/010709.html
2013-04-25 22:51:31 -04:00
Cristian Rodríguez 45df1f2c9a build-sys: add --with-debug-shell=PATH
Distributions may have selinux but not sushell or might
need to set a custom debug shell.

Defaults to /sbin/sushell if selinux is enabled, /bin/sh if not.

[zj: Renamed --with-debugshelltty to --with-debug-tty, and
     added a line in output showing DEBUGSHELL and DEBUGTTY.
     I figure that debug shell is pretty useful, and I hope
     the extra line in configure status will draw attention
     to it.]
2013-04-25 22:26:58 -04:00
Mirco Tischler fcf8c44041 core: remove duplicate MESSAGE= from log message
This was needed with log_struct_unit() but log_notice_unit() adds it
anyway.
2013-04-25 21:50:48 -04:00
Zbigniew Jędrzejewski-Szmek 2a371001f8 Use attribute(unused) in PROTECT_ERRNO
clang emits warnings about unused attribute _saved_errno_, which drown
out other—potentially useful—warnings. gcc documentation is not exactly
verbose about the effects of __attribute__((unused)) on variables, but
let's assume that it works if the unit test passes.
2013-04-25 21:50:48 -04:00
Zbigniew Jędrzejewski-Szmek e0a974b471 bus: avoid gcc warning about casting a pointer to int of different size 2013-04-25 21:50:48 -04:00
Zbigniew Jędrzejewski-Szmek 406e86fdd5 readahead: fix format string issue
(struct stat).st is off_t, which usually is a long, or a long long.
There's no good format string modifier for it, so use a cast.
2013-04-25 21:50:48 -04:00
Zbigniew Jędrzejewski-Szmek e4d2bfdd73 Add printf attributes in exported headers
gcc (and other compilers) sometimes generate spurious warnings, and
thus users of public headers must be able to disable warnings.

Printf format attributes can be disabled by setting
    #define _sd_printf_attr_
before including the header file.

Also, add similar logic for sentinel attribute:
    #define _sd_sentinel_attr_
before including the header file disables the attribute.
2013-04-25 21:50:48 -04:00
Cristian Rodríguez b1e2b33c52 Add some extra __attribute__ ((format)) s 2013-04-25 21:50:48 -04:00
Zbigniew Jędrzejewski-Szmek 750ef27274 Make up for attribute malloc with alloc_size
It is imperative that open source code be well attributed.
Sprinkle attribute((alloc_size)) here and there, telling gcc
how much memory we are actually allocating.
2013-04-25 21:50:48 -04:00
Zbigniew Jędrzejewski-Szmek b231b54780 Remove erroneous attribute((malloc)) annotations
According to gcc documentation, returned pointer "cannot alias any
other pointer valid when the function returns" and "the memory has
undefined content". This second part is (hopefully) untrue for all
those functions.
2013-04-25 21:28:05 -04:00
Zbigniew Jędrzejewski-Szmek b5edbff035 systemd-python: attach fields to JournalHandler, add SYSLOG_IDENTIFIER
Arbitrary fields can be attached at the level of the handler,
and they'll be sent with all messages from this handler.

This facility is used to attach SYSLOG_IDENTIFIER to all messages,
since otherwise journald attaches SYSLOG_IDENTIFIER=python or
something similar, which is completely useless.
2013-04-25 21:20:27 -04:00
Lennart Poettering 31afa0a44c unit: rework stop pending logic
When a trigger unit wants to know if a stop is queued for it, we should
just check precisely that and do not check whether it is actually
stopped already. This is because we use these checks usually from state
change calls where the state variables are not updated yet.

This change splits unit_pending_inactive() into two calls
unit_inactive_or_pending() and unit_stop_pending(). The former checks
state and pending jobs, the latter only pending jobs.
2013-04-25 22:01:49 -03:00
Kay Sievers 67fb4482ac always unconditionally create /dev/rtc and use it internally
Partially revert 2b3c81b02f, which
tried to avoid inconsistent rules about when and how to create the
/dev/rtc symlink.

Instead of conditionally or not creating the /dev/rtc link at all,
now always create it with additional and more reliable udev rules.

First try to find the "system rtc" with the hctosys flag, if this
is not found, fall back to create the link for /dev/rtc0.

Our code now never actively searches for the "system rtc" it can
always use /dev/rtc.
2013-04-26 01:11:52 +02:00
Harald Hoyer c3a170f3d3 systemd: record the timestamps as early as possible
The time for systemd initialization and selinux policy loading
is accounted to the initrd or the kernel, which is wrong.

Instead of:

Startup finished in 5.559s (firmware) + 36ms (loader) + 665ms (kernel) +
975ms (initrd) + 1.410s (userspace) = 8.647s

the more correct output is:

Startup finished in 5.559s (firmware) + 36ms (loader) + 665ms (kernel) +
475ms (initrd) + 1.910s (userspace) = 8.647s
2013-04-25 09:13:05 +02:00
Lennart Poettering d6dd604b55 util: rework safe_atod() to be locale-independent
This adds some syntactic sugar with a macro RUN_WITH_LOCALE() that reset
the thread-specific locale temporarily.
2013-04-25 00:05:14 -03:00
Lennart Poettering db5c012285 conf-parser: restrict .include usage
Disallow recursive .include, and make it unavailable in anything but
unit files.
2013-04-25 00:05:14 -03:00
Kay Sievers 60b6991a4d kdbus: update kdbus.h from upstream 2013-04-25 02:18:32 +02:00
Greg Kroah-Hartman e7ff4e7fe9 journal: remove build warning when SELinux is disabled
A small patch to remove a build warnining when SELinux is disabled.
2013-04-25 02:13:56 +02:00
Lennart Poettering 78edb35ab4 cgroup: always validate cgroup controller names
Let's better be safe than sorry.
2013-04-24 19:02:13 -03:00
Lennart Poettering e10375f2c0 login: allow watching virtual machines with sd_get_machine_names() 2013-04-24 19:02:13 -03:00
Lennart Poettering a20affe2f0 login: add new call sd_get_machine_names() to get a list of current virtual machines and containers 2013-04-24 19:02:13 -03:00
Lennart Poettering e8a7a31539 nss-myhostname: resolve 'localhost' so that /etc/hosts becomes optional
This makes sure nss-myhostname not only resolves the local host name to
127.0.0.2/::1 but also the host name 'localhost: to 127.0.0.1/::1. This
makes installation of /etc/passwd optional, as it usually only includes
a mapping for 'localhost'.

This change also resolves ::1 to the local hostname (as before), but
also lists 'localhost' as an alias. This means look-ups are now fully
reversible, even though they are 1:n mappings.

Finally, the module will no longer erroneously claim that local IP
addresses which aren't on the loopback device were.
2013-04-24 19:02:13 -03:00
Lennart Poettering 2b77f67e78 fileio: unify how we chop off whitespace from key and value in parse_env_file_internal() 2013-04-24 19:02:13 -03:00
Lennart Poettering 842865365e logind: don't busy loop if a job is still running but the delay timeout expires 2013-04-24 19:02:12 -03:00
Lennart Poettering 391a4f7242 inhbit: show comm field of inhibiting processes 2013-04-24 19:02:12 -03:00
Lennart Poettering 1f8497905d bus: add monitoring facility to busctl 2013-04-24 19:02:12 -03:00
Kay Sievers 2b3c81b02f do not create /dev/rtc symlink, let systemd search for it if needed
The export of the RTCs hctosys flag is uneccesary, the kernel takes care
of the persistemt clock management itself, without any need for:
  CONFIG_RTC_HCTOSYS=y
  CONFIG_RTC_HCTOSYS_DEVICE="rtc0"

"Chaotic hardware platforms" without native kernel persistent clock
support will find the proper RTC with the logic rtc_open() without
the need for a custom symlink.
2013-04-24 19:20:51 +02:00
Harald Hoyer 83cb95b530 add bash completion for systemd-analyze 2013-04-24 16:49:33 +02:00
Lennart Poettering 4470d84137 logind: properly enumerate user/session cgroups under their new suffixed names 2013-04-24 10:34:38 -03:00
Zbigniew Jędrzejewski-Szmek afba41995d systemctl: show reverse dependencies or before/after ordering
Also update completion scripts a bit.
2013-04-24 00:25:04 -04:00
Zbigniew Jędrzejewski-Szmek a6b26d9011 Small cleanup 2013-04-24 00:25:04 -04:00
Zbigniew Jędrzejewski-Szmek 90ae6c0b82 readahead: be more verbose about creation failures
systemd-readahead reports "Failed to create shared memory segment:
No such file or directory", but it's unclear how it can happen. Be
more verbose about failures.
2013-04-24 00:25:04 -04:00
Zbigniew Jędrzejewski-Szmek ef42202ac8 Add set_consume which always takes ownership
Freeing in error path is the common pattern with set_put().
2013-04-24 00:25:04 -04:00
Zbigniew Jędrzejewski-Szmek c79bb9e4e2 Standarize on one spelling of symlink error message
It's polite to print the name of the link that wasn't created,
and it makes little sense to print the target.
2013-04-24 00:25:04 -04:00
Zbigniew Jędrzejewski-Szmek fff87a35d9 test: make it easier to override kernel version 2013-04-24 00:25:04 -04:00
Zbigniew Jędrzejewski-Szmek 0ee679580e systemd: fall back to mounting /sys/fs/cgroup sans xattr
xattrs on cgroup fs were added back in v3.6-rc3-3-g03b1cde. But we
support kernels >= 2.6.39, and we should also support kernels compiled
w/o xattr support, even if systemd is compiled with xattr support.
Fall back to mounting without xattr support.

Tested-by: Colin Walters <walters@verbum.org>
2013-04-24 00:25:04 -04:00
Kay Sievers 2e3ffafcab kdbus: update kdbus.h from upstream 2013-04-24 05:20:20 +02:00
Lennart Poettering e41e194340 timer: make sure we restart timers even if units are still running or if one of their conditions fails 2013-04-23 17:42:31 -03:00
Lennart Poettering 0e99f1d6f8 update TODO 2013-04-23 16:00:32 -03:00
Lennart Poettering 3ecaa09bcc unit: rework trigger dependency logic
Instead of having explicit type-specific callbacks that inform the
triggering unit when a triggered unit changes state, make this generic
so that state changes are forwarded betwee any triggered and triggering
unit.

Also, get rid of UnitRef references from automount, timer, path units,
to the units they trigger and rely exclsuively on UNIT_TRIGGER type
dendencies.
2013-04-23 16:00:32 -03:00
Lennart Poettering a34cb32e54 units: update user@.service to reflect new user cgroup paths 2013-04-23 16:00:32 -03:00
Lennart Poettering 7066618570 bus: add cal to determine machine id of an owner of a service 2013-04-23 16:00:32 -03:00