Commit Graph

293 Commits

Author SHA1 Message Date
Kay Sievers 1c574591db udev: hwdb - remove run_once 2012-10-25 21:44:33 +02:00
Lennart Poettering d99ae53a73 journal: properly serialize fields with multiple values into JSON
This now matches the JSON serialization spec from:

http://www.freedesktop.org/wiki/Software/systemd/json
2012-10-25 01:24:44 +02:00
Mantas Mikulėnas 4278aa278c cgls: correctly ellipsize command lines for PIDs >= 1000000 2012-10-23 17:13:20 +02:00
Kay Sievers f1c0ece144 shared: strbuf - add descriprion 2012-10-22 18:21:12 +02:00
Kay Sievers 3c62146280 shared: move sparse-endian.h from journal 2012-10-22 18:08:48 +02:00
Kay Sievers 4693cfb3bf shared: strbuf - add description 2012-10-22 16:57:49 +02:00
Kay Sievers 955bd501c2 shared: strbuf - add string de-duplication facility 2012-10-22 16:27:00 +02:00
Kay Sievers a9e12476ed util: add (x)bsearch_r(), the missing counterpart of qsort_r() 2012-10-22 14:31:46 +02:00
Christian Hesse 20f59e42cd shared/install: fix typo in comment 2012-10-19 17:34:38 +02:00
Michael Olbrich f527b6b8e2 make sure __NR_name_to_handle_at is correctly defined
341 is only valid for x86, so don't use it for other architectures.
Add the correct numbers for ARM and PowerPC while at it.
2012-10-19 17:31:33 +02:00
Lennart Poettering 8c7c140fca util: change endswith() to return a pointer to the suffix 2012-10-19 04:53:46 +02:00
Lennart Poettering 857a493d55 set: introduce strv_sort() 2012-10-19 04:53:45 +02:00
Lennart Poettering 9590dfe771 set: introduce set_get_strv() 2012-10-19 04:52:14 +02:00
Lennart Poettering ed757c0cb0 util: unify line caching and column caching 2012-10-19 00:07:55 +02:00
Lennart Poettering 8481248b9f util: unify usage of on_tty() in util.c 2012-10-19 00:07:55 +02:00
Lennart Poettering 28917d7dc7 util: simplify column caching logic 2012-10-19 00:07:55 +02:00
Lennart Poettering f89a3b6f5b journalctl: unify ellipsation handling between journalctl and systemctl 2012-10-18 23:35:44 +02:00
Lennart Poettering cd4b13e0bf journalctl: don't ellipsize unless on a tty 2012-10-18 23:35:44 +02:00
Lennart Poettering 240a5fe83e journal: add ability to list unique fields to gatewayd 2012-10-18 22:34:42 +02:00
Lennart Poettering 3c1668da62 journal: add ability to list values a specified field can take in all entries of the journal
The new 'unique' API allows listing all unique field values that a field
specified by a field name can take in all entries of the journal. This
allows answering queries such as "What units logged to the journal?",
"What hosts have logged into the journal?", "Which boot IDs have logged
into the journal?".

Ultimately this allows implementation of tools similar to lastlog based
on journal data.

Note that listing these field values will not work for journal files
created with older journald, as the field values are not indexed in
older files.
2012-10-18 03:35:18 +02:00
Lennart Poettering 01539d6ef9 hostnamed: allow UTF8 chars in pretty hostname again 2012-10-17 21:25:42 +02:00
Lennart Poettering 6d0274f115 timedatectl: introduce new command line client for timedated
Much like logind has a client in loginctl, and journald in journalctl
introduce timedatectl, to change the system time (incl. RTC), timezones
and related settings.
2012-10-17 21:25:42 +02:00
Lennart Poettering 706911fba8 journal: don't export MESSAGE_ID() macro
If it is exported it would need to be prefixed, but since we need it
exclusively internally so far, simply move it to an internal header.
2012-10-16 16:26:41 +02:00
Lukas Nykryn 696c245a23 systemctl: append .service when unit does not have valid suffix
systemctl status a and systemctl status a.service lead to same output but
systemctl status a.b and systemctl status a.b.service do not.
2012-10-16 16:07:37 +02:00
Daniel J Walsh 080ffcb4a1 selinux: selabel_lookup_raw can return ENOENT and be a non failure mode. 2012-10-16 01:58:42 +02:00
Michael Olbrich 9388e99e20 build-sys: check for name_to_handle_at declaration instead of its definition
AC_CHECK_FUNCS may be successful, even though name_to_handle_at and
'struct file_handle'  are not available.
2012-10-16 01:30:29 +02:00
Lennart Poettering b1c806231b util: properly handle -1 timespec/timeval 2012-10-16 01:04:32 +02:00
Lennart Poettering cfbc22abd0 journalctl: implement --since= and --until for filtering by time 2012-10-11 16:43:37 +02:00
Lennart Poettering 48383c2511 journal: support epxorting the journal in a format suitable for text/event-stream 2012-10-11 02:37:10 +02:00
Lennart Poettering 96ede2601f detect-virt: install with fs caps by default to allow unprivileged access 2012-10-09 22:25:32 +02:00
Martin Mikkelsen 011afa76fb shared: fix broken string_is_safe 2012-10-08 14:35:46 +02:00
Lennart Poettering 5198dabcce man: document behaviour of ListenStream= with only a port number in regards to IPv4/IPv6 2012-10-03 14:18:55 -04:00
Lennart Poettering 0b507b17a7 dbus: add some more safety checks before accepting data from bus clients 2012-10-03 13:29:20 -04:00
Colin Walters 0b6018f3d9 build-sys: fix !HAVE_SELINUX case 2012-10-03 16:00:33 +02:00
Lennart Poettering c1165f822c audit: turn the audit fd into a static variable
As audit is pretty much just a special kind of logging we should treat
it similar, and manage the audit fd in a static variable.

This simplifies the audit fd sharing with the SELinux access checking
code quite a bit.
2012-10-02 17:40:09 -04:00
Lennart Poettering cad45ba11e selinux: rework selinux access check logic
a) Instead of parsing the bus messages inside of selinux-access.c
simply pass everything pre-parsed in the functions

b) implement the access checking with a macro that resolves to nothing
on non-selinux builds

c) split out the selinux checks into their own sources
selinux-util.[ch]

d) this unifies the job creation code behind the D-Bus calls
Manager.StartUnit() and Unit.Start().
2012-10-02 17:07:00 -04:00
Zbigniew Jędrzejewski-Szmek 5b585b5380 shared: fail mkdir_p if the target exists and is not a directory
This makes mkdir_p actually behave like mkdir -p.
2012-10-02 14:56:26 +02:00
Zbigniew Jędrzejewski-Szmek 27407a01c6 nspawn: use automatic cleanup and provide debug info
The documentation for --link-journal is also reworded.
2012-10-02 14:56:26 +02:00
Lennart Poettering 08ace05beb logs-show: various cleanups
Among other cleanups this introduces a threshold for the size of binary
blobs we serialize as integer arrays in the JSON output. THis can be
disabled via --all.
2012-09-28 00:55:24 +02:00
Lennart Poettering cecd32f648 macro: increase VA_FORMAT_ADVANCE type array and hit assert when it is reached 2012-09-24 23:42:29 +02:00
Lennart Poettering 963ddb917d log: fix repeated invocation of vsnprintf()/vaprintf() in log_struct()
https://bugs.freedesktop.org/show_bug.cgi?id=55213
2012-09-24 23:26:46 +02:00
Lennart Poettering 9086e840ff util: don't export parsed_columns 2012-09-24 14:43:07 +02:00
Dave Reisner 585314e84c journalctl: reset cached column count on SIGWINCH
This requires a little bit of tip-toeing around to explicitly avoid
touching the environment from a sig handler. Instead, simply create a
function to reset the var to its "unset" state, allowing the next call
to columns() to recalculate and cache the new value.
2012-09-24 08:38:03 -04:00
Eelco Dolstra 848af05524 missing: Fix compilation error due to wrong __NR_name_to_handle_at definition
"__NR_name_to_handle" should read "__NR_name_to_handle_at".  This
fixes a compilation error on systems with older kernel headers.
2012-09-21 22:51:48 +02:00
Lennart Poettering 4eeebf70aa hwclock: add missing OOM check 2012-09-21 16:29:09 +02:00
Lukas Nykryn e98055de98 shared: call va_end in all cases 2012-09-21 12:07:41 +02:00
Lennart Poettering aa408e7799 util: fix overflow checks 2012-09-20 17:53:03 +02:00
Lennart Poettering 040f18ea8a util: overflow hardening 2012-09-20 11:08:27 +02:00
Lennart Poettering 4b8772bf5f util: make sure heap allocators fail when array allocations are out of bounds
https://bugzilla.redhat.com/show_bug.cgi?id=858777
2012-09-20 00:02:04 +02:00
Lennart Poettering 7d5e9c0f60 util: define union dirent_storage and make use of it everywhere
Make sure to allocate enough space for readdir_r().

https://bugzilla.redhat.com/show_bug.cgi?id=858754
2012-09-19 22:21:09 +02:00
Lennart Poettering 57f3067825 util: fix bad strstrip() return value in normalize_env_assignment()
https://bugzilla.redhat.com/show_bug.cgi?id=858780
2012-09-19 22:01:31 +02:00
Zbigniew Jędrzejewski-Szmek d3b52baff9 systemctl: use automatic cleanup
Introduce a helper method to unref dbus messages and use it.
2012-09-19 08:25:36 +02:00
Zbigniew Jędrzejewski-Szmek 67445f4e22 core: move ManagerRunningAs to shared
Note: I did s/MANAGER/SYSTEMD/ everywhere, even though it makes the
patch quite verbose. Nevertheless, keeping MANAGER prefix in some
places, and SYSTEMD prefix in others would just lead to confusion down
the road. Better to rip off the band-aid now.
2012-09-18 19:53:34 +02:00
Lennart Poettering c198300fc4 journalctl: don't choke on entries with no MESSAGE= field
https://bugs.freedesktop.org/show_bug.cgi?id=50177
2012-09-18 11:12:31 +02:00
Lennart Poettering 901c3d0d85 util: introduce get_process_gid() 2012-09-18 01:53:15 +02:00
Lennart Poettering cd15c4182b log: avoid function loop
https://bugs.freedesktop.org/show_bug.cgi?id=54766
2012-09-17 22:16:01 +02:00
Lennart Poettering faa368e337 conf-parser: don't unescape parsed configuration strings by default
In many cases this might have a negative effect since we drop escaping
from strings where we better shouldn't have dropped it.

If unescaping makes sense for some settings we can readd it later again,
on a per-case basis.

https://bugs.freedesktop.org/show_bug.cgi?id=54522
2012-09-17 21:58:03 +02:00
Lennart Poettering 669bec5d17 util: various cleanups for printing boot status 2012-09-17 19:05:32 +02:00
Lennart Poettering a866073d35 main: when transitioning from initrd to the main system log to kmsg
When the new PID is invoked the journal socket from the initrd might
still be around. Due to the default log target being journal we'd log to
that initially when the new main systemd initializes even if the kernel
command line included a directive to redirect systemd's logging
elsewhere.

With this fix we initially always log to kmsg now, if we are PID1, and
only after parsing the kernel cmdline try to open the journal if that's
desired.

(The effective benefit of this is that SELinux performance data is now
logged again to kmsg like it used to be.)
2012-09-17 17:47:47 +02:00
Kay Sievers 72edcff5db hwclock: always set the kernel's timezone
Properly tell the kernel at bootup, and any later time zone changes,
the actual system time zone.

Things like the kernel's FAT filesystem driver needs the actual time
zone to calculate the proper local time to use for the on-disk time
stamps.

https://bugzilla.redhat.com/show_bug.cgi?id=802198
2012-09-17 16:56:26 +02:00
Zbigniew Jędrzejewski-Szmek 4db17f291c build-sys: __secure_getenv lost dunder in libc 2.17 2012-09-17 00:21:25 +02:00
Zbigniew Jędrzejewski-Szmek 25ea79fe07 nspawn: use automatic cleanup for umask 2012-09-16 16:20:09 +02:00
Zbigniew Jędrzejewski-Szmek d8831ed554 install: use automatic cleanup 2012-09-16 16:20:06 +02:00
Zbigniew Jędrzejewski-Szmek d5891fdacf install: treat non-existent directory as empty
When looking for symlinks, it doesn't make sense to error-out if
the directory is missing. The user might delete an empty directory.

This check caused test-unit-file to fail when run before installation.
2012-09-16 14:00:25 +02:00
Lennart Poettering 424a19f8a2 timedate: assorted improvements
- Make writing/reading of /etc/timezone dependendent of HAVE_SYSV_COMPAT

- Introduce symlink_atomic() after all, and use it

- Use relative symlink for /etc/localtime
2012-09-14 20:02:52 +02:00
Lennart Poettering 67f3c40265 systemctl: show unit name when a job fails
https://bugzilla.redhat.com/show_bug.cgi?id=845028
https://bugzilla.redhat.com/show_bug.cgi?id=846483
2012-09-14 15:11:07 +02:00
Lennart Poettering 73836c5c43 util: more modernizations 2012-09-14 10:36:50 +02:00
Lennart Poettering a05f97b3ac util: various additional modernizations 2012-09-14 10:24:27 +02:00
Lennart Poettering e67f47e55b util: modernize a few functions with automatic cleanup variables
Just trying to get the feel for it. And it's pretty cool.
2012-09-14 10:06:42 +02:00
Lennart Poettering 2fbe635a83 macro: introduce _cleanup_free_ macro for automatic freeing of scoped vars and make use of it 2012-09-13 22:30:26 +02:00
Lennart Poettering 8556879e0d unit-name: rework unit_name_replace_instance function()
https://bugzilla.redhat.com/show_bug.cgi?id=855863
2012-09-12 04:46:38 +02:00
Tom Gundersen b3d284696c util: rm_rf_children_dangerous: delete all descendants dangerously
Call rm_rf_children_dangerous() recursively rather than falling back to
rm_rf_children(). This fixes a bug in systemd-tmpfiles.

The problem can easily be reproduced by:

  # mount /dev/sda1 /mnt
  # mkdir /mnt/test
  # echo "D /mnt" > /root/test.conf
  # systemd-tmpfiles --remove /root/test.conf
  Attempted to remove disk file system, and we can't allow that.
  rm_rf(/root/test): Operation not permitted

Reported-by: Lukas Jirkovsky <l.jirkovsky@gmail.com>
2012-09-11 02:55:29 +02:00
Lennart Poettering b5b46d5995 when determining unit file list, include invalid unit names in an "invalid" state 2012-09-11 01:14:25 +02:00
Lennart Poettering 3137e0bd52 dbus: minor coding style fixes 2012-09-10 09:38:49 +02:00
Mantas Mikulėnas fa125f4e44 path-util: fall back to stat() if kernel does not support name_to_handle_at()
Fixes instant hang on kernels that do not have CONFIG_FHANDLE enabled.
2012-09-10 09:21:24 +02:00
Mantas Mikulėnas 8ac7549330 path-util: do not fail in path_is_mountpoint() if path doesn't exist
This was accidentally lost in commit 1640a0b6b0.
2012-09-10 09:21:10 +02:00
Lennart Poettering d87be9b0af nspawn: handle poweroff/reboot nicely in containers 2012-09-05 16:23:41 -07:00
Lennart Poettering a6e87e90ed journalctl: rework JSON output mode
This splits the JSON output mode into different modes: json and
json-pretty. The former printing one entry per line, the latter showing
JSON objects nicely indented and in multiple lines to make it easier to
read for humans.
2012-09-05 15:25:32 -07:00
Lennart Poettering f408b8f1bb path: fix invalid variable access in path_is_mount_point() 2012-09-04 17:05:23 -07:00
Lennart Poettering 1640a0b6b0 path-util: in path_is_mount_point() fall back to the classic stat() test if fs does not support name_to_handle_at() 2012-09-04 16:37:57 -07:00
Lennart Poettering a8348796c0 missing: define name_to_handle_at on our own if it is missing 2012-09-04 15:30:24 -07:00
Brandon Philips e268b81e97 shared: logs-show: fflush after each output type
journalctl -f redirected to a pipe or file wasn't working for some
output formats but was working for json. It turns out only json was
doing an fflush.

Make all output formats flush.
2012-09-03 19:16:20 -07:00
Lennart Poettering 1946b0bd55 journalctl: include logs from PID 1 about services in systemctl status 2012-09-03 18:59:05 -07:00
Lennart Poettering cde9cb343a util: make path_is_mount_point() recognize bind mounts, too 2012-09-03 18:59:05 -07:00
Lennart Poettering 81270860a5 journal: suppress structured messages if they'd go to the console 2012-09-03 18:59:04 -07:00
Lennart Poettering 877d54e9b0 journal: generate structured journal messages for a number of events 2012-09-03 18:59:04 -07:00
Lennart Poettering 88fae6e044 shared: in code that might get called from suid programs use __secure_getenv() rather than getenv()
It's better to be safe than sorry.
2012-09-03 18:59:04 -07:00
Lukas Nykryn 9f89986d2b hashmap: hashmap_contains does not need hashmap_entry 2012-08-23 13:53:30 +02:00
Lennart Poettering 5809560d85 journal: move syslog specific calls out of util.c 2012-08-22 03:24:46 +02:00
Lennart Poettering ef63833d53 journald: split /dev/kmsg related stuff into its own .c file 2012-08-22 03:09:44 +02:00
Dave Reisner 84cc2abf34 shared/util: add fstab support for partuuid/partlabel
udev has supported this since 172, so it should be a safe (and welcome)
addition for users of GPT partitioned disks.
2012-08-21 11:48:26 -04:00
Dave Reisner 383182b5c4 shared/util: refactor fstab_node_to_udev_node
Since this is purely duplicated logic, separate it out into a small
static function.
2012-08-21 11:48:26 -04:00
Lennart Poettering 01ed0e2307 dev-setup: make NULL as parameter for dev_setup() equivalent to "" 2012-08-21 17:23:03 +02:00
Dave Reisner 8f0e73f250 dev-setup: allow a path prefix for use in chroots
With this adjustment, we can reuse this code elsewhere, such as in
nspawn.
2012-08-21 17:19:35 +02:00
Lennart Poettering a228a22fda journalctl: really include .journal~ files in listing 2012-08-21 02:13:21 +02:00
Lennart Poettering f6a971bc0b journalctl: output FSS key as QR code on generating 2012-08-20 22:02:19 +02:00
Lennart Poettering 07cacf5f3b conf-parser: make parsing exit status lists non-fatal 2012-08-16 17:10:57 +02:00
Lennart Poettering d046b20b11 conf-parser: simplify a few things by using set_ensure_allocated() rather than set_new() 2012-08-14 18:42:26 +02:00
Lukas Nykryn 96342de68d service: add options RestartPreventExitStatus and SuccessExitStatus
In some cases, like wrong configuration, restarting after error
does not help, so administrator can specify statuses by RestartPreventExitStatus
which will not cause restart of a service.

Sometimes you have non-standart exit status, so this can be specified
by SuccessfulExitStatus.
2012-08-14 14:46:03 +02:00
Lennart Poettering ac0930c892 namespace: rework namespace support
- don't use pivot_root() anymore, just reuse root hierarchy
- first create all mounts, then mark them read-only so that we get the
  right behaviour when people want writable mounts inside of
  read-only mounts
- don't pass invalid combinations of MS_ constants to the kernel
2012-08-13 15:27:04 +02:00