Commit graph

18045 commits

Author SHA1 Message Date
Ronny Chevalier 7d4fb3b1c5 systemctl: add edit verb
It helps editing units by either creating a drop-in file, like
/etc/systemd/system/my.service.d/override.conf, or by copying the
original unit from /usr/lib/systemd/ to /etc/systemd/ if the --full
option is specified.

It invokes an editor on temporary files related to the unit files and
if the editor exited successfully, then it renames the temporary files
to their original names (e.g. my.service or override.conf) and
daemon-reload is invoked.

If the temporary file is empty the modification is canceled.

See https://bugzilla.redhat.com/show_bug.cgi?id=906824
2014-11-29 19:28:14 +01:00
Chris Atkinson 507e28d844 man: update description of default extension for isolate 2014-11-29 13:19:46 -05:00
Zbigniew Jędrzejewski-Szmek 01dc33ce28 nspawn: fix unused variable warning 2014-11-29 11:11:10 -05:00
Zbigniew Jędrzejewski-Szmek 820d3acfe9 delta: diff returns 1 when files differ, ignore this
https://bugs.debian/org/771397
2014-11-29 11:10:51 -05:00
Tom Gundersen 56e73b34ce shared: install - report error if mask symlink can not be marked for removal 2014-11-29 11:14:48 +01:00
Tom Gundersen 681f9718ce shared: time-dst - ensure nulstr is null terminated
Fixes CID #1237772.
2014-11-29 10:40:21 +01:00
WaLyong Cho 0acd5a08f5 README: notice kernel config for CPUQuota 2014-11-28 21:16:52 -05:00
Zbigniew Jędrzejewski-Szmek 4e920142cc mount: use DEFINE_TRIVIAL_CLEANUP_FUNC 2014-11-28 17:04:54 -05:00
Tom Gundersen 9f5ecdb0b1 udev: rules - ignore the lack of trailing newline
Also accept '\r' as newline character.

This dropps warnings of the type:

  invalid key/value pair in file /usr/lib/udev/rules.d/40-usb-media-players.rules
  on line 26, starting at character 25 ('')
2014-11-28 21:57:52 +01:00
Tom Gundersen 6501b52d35 udev: rules - print the first invalid character
The current code would print the character following the first invalid
character.

Given an udev rules-file without a trailing newline we would otherwise print
garbage:

  invalid key/value pair in file /usr/lib/udev/rules.d/40-usb-media-players.rules
  on line 26, starting at character 25 ('m')

This is now changed to print

  invalid key/value pair in file /usr/lib/udev/rules.d/40-usb-media-players.rules
  on line 26, starting at character 25 ('')

(still not very good as printing \0 just gives the empty string)
2014-11-28 21:54:24 +01:00
Tom Gundersen 84198c1892 udev: rules - modernise add_rule a bit 2014-11-28 21:54:24 +01:00
Lennart Poettering 22d097a6bb sd-bus: move packet header definition to bus-protocol.h 2014-11-28 21:12:03 +01:00
Lennart Poettering 46bcf49291 treewide: convert some left-over (usec_t) -1 to USEC_INFINITY 2014-11-28 20:55:04 +01:00
Lennart Poettering fed1e721fd treewide: introduce UID_INVALID (and friends) as macro for (uid_t) -1 2014-11-28 20:55:04 +01:00
Peter Hutterer 36afca67b6 udevadm hwdb: discard extra leading whitespaces in hwdb
Currently a property in the form of
  FOO=bar
is stored as " FOO=bar", i.e. the property name contains a leading space.
That's quite hard to spot.

This patch discards all extra whitespaces but the first one which is required
by libudev's hwdb_add_property.

[zj: modify the check a bit]

https://bugs.freedesktop.org/show_bug.cgi?id=82311
2014-11-28 14:30:50 -05:00
Zbigniew Jędrzejewski-Szmek e6a7b9f455 mount: constify MountParameters 2014-11-28 14:30:50 -05:00
Zbigniew Jędrzejewski-Szmek fddf1a3189 mount: deal with inotify queue overflow
Overflow is very unlikely, since we are watching a privileged directory,
but could be triggered if thousands of mounts are suddently executed.
2014-11-28 14:30:50 -05:00
Zbigniew Jędrzejewski-Szmek 90598531b0 mount: create directory before adding watches on it 2014-11-28 14:30:50 -05:00
Zbigniew Jędrzejewski-Szmek 5cca8defd2 mount: be more careful about errors when parsing mtab
Fixup for 4a3a9ef610.
2014-11-28 14:30:50 -05:00
Zbigniew Jędrzejewski-Szmek 9d05dd2e1e mount: simplify mount_needs_network check 2014-11-28 14:30:50 -05:00
Chris Leech affc3d8343 mount: check options as well as fstype for network mounts
When creating a new mount unit after an event on /proc/self/mountinfo,
check the mount options as well as the fstype to determine if this is a
remote mount that requires network access.
2014-11-28 14:30:50 -05:00
Chris Leech a6d305f91d mount: add remote-fs dependencies if needed after change
This is an attempt to add it the remote-fs dependencies to a mount unit
if the options change, like when the utab options are picked up after
mountinfo has already been processed.  It just adds the remote-fs
dependencies, leaving the local-fs ones in place.

With this change I always get mount units with proper remote-fs
dependencies when mounted with the _netdev option.
2014-11-28 14:30:50 -05:00
Chris Leech befb6d5494 mount: monitor for utab changes with inotify
Parsing the mount table with libmount races against the mount command,
which will handle the actual mounting before updating utab.  This means
the poll event on /proc/self/mountinfo can kick of a reparse in systemd
before the utab information is available.

This change adds in an additional event source using inotify to watch
for changes to utab.  It only watches for IN_MOVED_TO events, matching
libmount behavior of always overwriting this file using rename(2).

This does add a second pass through the mount table parsing when utab is
updated.
2014-11-28 14:30:50 -05:00
Chris Leech 8d3ae2bd4c mount: use libmount to enumerate /proc/self/mountinfo
This lets libmount add in user options from /run/mount/utab, like
_netdev which is needed to get proper ordering against remote-fs.target
2014-11-28 14:30:50 -05:00
Lennart Poettering 8c8549db37 coredump: simplify a few things by allocating small fields on the stack rather than heap 2014-11-28 20:29:44 +01:00
Lennart Poettering 4d84bc2f5f coredump: rework compose_open_fds()
Use FOREACH_DIRENT() and FOREACH_LINE() macros instead of manual loops.

Don't clobber return parameters on failure.

Simplify some other things.
2014-11-28 20:29:44 +01:00
Lennart Poettering cb2264aa0d update TODO 2014-11-28 20:29:44 +01:00
Lennart Poettering 198b158f49 sd-bus: add support for matches against arrays of strings in messages 2014-11-28 20:29:44 +01:00
Lennart Poettering d9fba53316 sd-bus: if a NULL signatures is passed to sd_bus_message_skip(), make it skip a single element of any type 2014-11-28 20:29:44 +01:00
Lennart Poettering 1abe54d9a9 sd-bus: add arrays of strings in the bloom filter
Let's do this right from the beginning, to prepare ground for udev
messages that most likely want to store list of strings (for device
tags) in messages, and filter on them.
2014-11-28 20:29:44 +01:00
Lennart Poettering a6a6ac1603 update TODO 2014-11-28 20:29:44 +01:00
Lennart Poettering 224b378767 sd-bus: make more connection properties readable 2014-11-28 20:29:43 +01:00
Lennart Poettering 5b820358cf sd-bus: add new sd_bus_get_address() for querying the current bus address
Also, update "busctl" to show this in its output.
2014-11-28 20:29:43 +01:00
Lennart Poettering 5c3026927d sd-bus: rename sd_bus_get_owner_id() → sd_bus_get_bus_id()
The ID returned really doesn't identify the owner, but the bus instance,
hence fix this misnaming.

Also, update "busctl status" to show the ID in its output.
2014-11-28 20:29:43 +01:00
Michal Schmidt 4a62c710b6 treewide: another round of simplifications
Using the same scripts as in f647962d64 "treewide: yet more log_*_errno
+ return simplifications".
2014-11-28 19:57:32 +01:00
Michal Schmidt 56f64d9576 treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.

Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'

Plus some whitespace, linewrap, and indent adjustments.
2014-11-28 19:49:27 +01:00
Michal Schmidt 895b3a7b44 core: fix return value in error path after sd_event_add_io() failure
sd_event_add_io() does not set errno, it returns negative errno.

Noticed during log_*_errno conversions.
2014-11-28 19:20:59 +01:00
Michal Schmidt 8d3d7072e6 treewide: a few more log_*_errno + return simplifications
The one in tmpfiles.c:create_item() even looks like it fixes a bug.
2014-11-28 19:17:24 +01:00
Michal Schmidt f647962d64 treewide: yet more log_*_errno + return simplifications
Using:
find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
 'local $/;
  local $_=<>;
  s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg;
  print;'
 $f
done

And a couple of manual whitespace fixups.
2014-11-28 18:56:16 +01:00
Zbigniew Jędrzejewski-Szmek e80733be33 Revert "systemctl: append default suffix only if none present"
This reverts a chunk out of commit 5e03c6e3b5
which was trying to pass NULL to the the '.service' default. Anyway,
it seems better to be explicit.
2014-11-28 12:28:44 -05:00
Michal Schmidt 23bbb0de4e treewide: more log_*_errno + return simplifications 2014-11-28 18:24:30 +01:00
Zbigniew Jędrzejewski-Szmek 5e03c6e3b5 systemctl: append default suffix only if none present
Simplify unit_name_mangle() and unit_name_mangle_with_suffix() to
always behave the same, and only append a suffix if there is no
type suffix. If a user says 'isolate blah.device' it is better to
return an error that the type cannot be isolated, than to try to
isolate blah.device.target.
2014-11-28 11:54:37 -05:00
Tom Gundersen 6872b0ddc4 udevd: don't set receive buffer size when socket activated
The socket unit does this, so no need to redo it in udevd.
2014-11-28 17:41:58 +01:00
Michal Schmidt eb56eb9b40 treewide: simplify log_*_errno(r,...) immediately followed by "return r" 2014-11-28 17:34:26 +01:00
Michal Schmidt c33b329709 treewide: more log_*_errno() conversions, multiline calls
Basically:

find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
'local $/;
 local $_=<>;
 s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \
 $f; done

Plus manual indentation fixups.
2014-11-28 17:17:51 +01:00
Martin Pitt 5567fafbc9 hostnamectl: Exit with zero on success
In show_all_names(), bus_map_all_properties() returns 1 on success which is
then used as the return code of show_all_names() and eventually main(). Exit
with zero in main() on all nonnegative results to guard against similar errors.
2014-11-28 17:08:51 +01:00
Lennart Poettering 755bde375f udev,update-done: more log_xyz_errno() conversions 2014-11-28 16:32:26 +01:00
Lennart Poettering 1797280193 sd-bus: make sure %m resolves to the specified error in bus_error_set_errnofv() 2014-11-28 16:30:53 +01:00
Lennart Poettering 818eae495e update TODO 2014-11-28 16:18:17 +01:00
Lennart Poettering 2e43ad9ca6 bus-proxy: automatically detect scope of bus and derive which XML snippets to load from that 2014-11-28 16:18:17 +01:00