summaryrefslogtreecommitdiff
path: root/src/shared
Commit message (Collapse)AuthorAge
* move utf8 functions from libudev-private.h to utf8.hDave Reisner2013-09-17
| | | | | | | | There's now some more obvious overlap amongst the two utf8 validation functions, but no more than there already was previously. This also adds some menial tests for anyone who wants to do more merging of these two in the future.
* specifier: rework specifier calls to return proper error messageLennart Poettering2013-09-17
| | | | | | Previously the specifier calls could only indicate OOM by returning NULL. With this change they will return negative errno-style error codes like everything else.
* Verify validity of session name when received from outsideZbigniew Jędrzejewski-Szmek2013-09-16
| | | | Only ASCII letters and digits are allowed.
* Assume that /proc/meminfo can be missingZbigniew Jędrzejewski-Szmek2013-09-16
| | | | | | | Travis tests are failing, probably because /proc/meminfo is not available in the test environment. The same might be true in some virtualized systems, so just treat missing /proc/meminfo as a sign that hibernation is not possible.
* Advertise hibernation only if there's enough free swapZbigniew Jędrzejewski-Szmek2013-09-13
| | | | | | | | | | | | | | | | | | | Condition that is checked is taken from upower: active(anon) < free swap * 0.98 This is really stupid, because the kernel knows the situation better, e.g. there could be two swap files, and then hibernation would be impossible despite passing this check, or the kernel could start supporting compressed swap and/or compressed hibernation images, and then this this check would be too stringent. Nevertheless, until we have something better, this should at least return a true negative if there's no swap. Logging of capabilities in the journal is changed to not strip leading zeros. I consider this more readable anyway. http://cgit.freedesktop.org/upower/tree/src/up-daemon.c#n613 https://bugzilla.redhat.com/show_bug.cgi?id=1007059
* Actually allow tabs in environment filesZbigniew Jędrzejewski-Szmek2013-09-12
| | | | Fixup for ac4c8d6da8b5e.
* Allow tabs in environment filesZbigniew Jędrzejewski-Szmek2013-09-11
| | | | | | | | | | | | bash allows them, and so should we. string_has_cc is changed to allow tabs, and if they are not wanted, they must be now checked for explicitly. There are two other callers, apart from the env file loaders, and one already checked anyway, and the other is changed to check. https://bugs.freedesktop.org/show_bug.cgi?id=68592 https://bugs.gentoo.org/show_bug.cgi?id=481554
* Fix two compiler warningsZbigniew Jędrzejewski-Szmek2013-09-09
|
* run: allow non-absolute paths as commandZbigniew Jędrzejewski-Szmek2013-09-09
|
* path-util.c: small modernizationZbigniew Jędrzejewski-Szmek2013-09-09
|
* systemd-run: properly escape argumentsZbigniew Jędrzejewski-Szmek2013-09-09
| | | | | | | Spaces, quotes, and such, were not properly escaped. We should write them like we read them. https://bugs.freedesktop.org/show_bug.cgi?id=67971
* Disallow invalid UTF-8 configurationZbigniew Jędrzejewski-Szmek2013-08-28
| | | | | | | It is best to catch such errors early. If invalid UTF-8 ends up being given to dbus methods, the program will crash: process 20801: arguments to dbus_message_iter_append_basic() were incorrect, assertion "_dbus_check_is_valid_utf8 (*string_p)" failed in file dbus-message.c line 2598.
* "-" prefix for InaccessibleDirectories and ReadOnlyDirectoriesMaciej Wereski2013-08-23
|
* Optimize startswith() to macroKay Sievers2013-08-22
| | | | | I guess it's easier and cleaner anyway to use simple static inline functions instead of defines.
* remove hasprefix(), use startswith()Shawn Landden2013-08-22
|
* logs-show: fix condition for ellipsizing multi-line messagesZbigniew Jędrzejewski-Szmek2013-08-21
| | | | | | falconindy> the ellipsizing seems a bit wrong here.... I got a bit carried away with putting dots everywhere :)
* logs-show: show source timestamp in verbose modeZbigniew Jędrzejewski-Szmek2013-08-20
| | | | | | | | This makes verbose behave like short mode, i.e. try to show the source timestamp, and fall back to journald timestamp only if unavailable or unparsable. I think verbose should be like short, only showing more fields, and showing different timestamps would be confusing.
* logs-show: add short-precise mode with us timestampsZbigniew Jędrzejewski-Szmek2013-08-20
| | | | | | Also, always show us timestamps in verbose mode. https://bugzilla.redhat.com/show_bug.cgi?id=991678
* Rename F_TYPE_CMP() to F_TYPE_EQUAL()Zbigniew Jędrzejewski-Szmek2013-08-20
|
* build-sys: Add configure check for linux/btrfs.hMichael Marineau2013-08-16
| | | | | | | | | | | btrfs.h was added to uapi in Linux 3.9. To fix building with older header versions this adds a configure check for the header and re-adds btrfs definitions to missing.h which was removed in bed2e820 along with two other ioctls used by gpt-auto-generator. [ Apparently, btrfs.h was only added recently: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=55e301fd57a6239ec14b91a1cf2e70b3dd135194 let's re-add it for now -- kay ]
* hashmap: remove empty linesKay Sievers2013-08-15
|
* missing: use btrfs.h instead of defining our own btrfs structuresLennart Poettering2013-08-13
|
* logs-show: limit to 3 lines and use dots if not showing full messageZbigniew Jędrzejewski-Szmek2013-08-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | So far, we would show up to 128 bytes from a message, simply cutting of the rest. With multiline messages, it is quite common for a message to be longer than that, and this model doesn't really work anymore. A new limit is added: up to 3 lines will be shown, unless --full is used (c.f. first line below). The limit for bytes is extended to 300 bytes. An ellipsis will always be used, if some form of truncation occurs. If the tail of the message is cut off, either because of length or line limit, dots will be shown at the end of the last line. If this last line is short, the dots will be simply appended. If the last line is too long for that, it will be ellipsized with dots at the very end. Note that the limits are in bytes, not characters, and we suck at outputting unicode strings (c.f. last three lines below). Aug 11 10:46:21 fedora python[67]: test message line line... Aug 11 10:50:47 fedora python[76]: test message word word word word word word word word word word word wor... Aug 11 10:55:11 fedora python[83]: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx... Aug 11 11:03:21 fedora python[90]: ąąąąąąąąąąąąąąąąąąąąąąąąąąąąąą... Aug 11 11:03:53 fedora python[97]: aąąąąąąąąąąąąąąąąąąąąąąąąąąąąąą... Aug 11 11:25:45 fedora python[121]: aąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąą�...
* logs-show: fix indentation for 2nd and later lines, show lines in fullZbigniew Jędrzejewski-Szmek2013-08-11
| | | | | Now --full will show long fields in full, like it already did with --all.
* systemctl: show hint about --full when lines don't fitZbigniew Jędrzejewski-Szmek2013-08-11
|
* systemd-delta: Only print colors when on a ttyDaniel Schaal2013-08-04
| | | | | | | | | This make systemd-delta follow the behaviour of systemctl and journalctl. https://bugs.freedesktop.org/show_bug.cgi?id=67656 [zj: unify color query methods between those three programs.]
* rework systemd's own process environment handling/passingKay Sievers2013-07-26
| | | | | | | | | | | | | Stop importing non-sensical kernel-exported variables. All parameters in the kernel command line are exported to the initial environment of PID1, but suppressed if they are recognized by kernel built-in code. The EFI booted kernel will add further kernel-internal things which do not belong into userspace. The passed original environ data of the process is not touched and preserved across re-execution, to allow external reading of /proc/self/environ for process properties like container*=.
* journalctl: use _COMM= match for scriptsZbigniew Jędrzejewski-Szmek2013-07-26
| | | | | | | | | | | In case of scripts, _EXE is set to the interpreter name, and _COMM is set based on the file name. Add a match for _COMM, and _EXE if the interpreter is not a link (e.g. for yum, the interpreter is /usr/bin/python, but it is a link to /usr/bin/python2, which in turn is a link to /usr/bin/python2.7, at least on Fedora, so we end up with _EXE=/usr/bin/python2.7). I don't think that such link chasing makes sense, because the final _EXE name is more likely to change.
* shared: split mkdir_*() and mkdir_*_label() from each otherKay Sievers2013-07-26
| | | | | Avoid pulling-in selinux for tools which just create directories but not need to fix the selinux label.
* core: synchronously block when loggingLennart Poettering2013-07-24
| | | | | | | | | | | | | Previously, the logging sockets were asynchronous and if clogged we'd lose messages. We did this to be extra careful given that PID 1 might need to spawn the logging daemon as response to PID 1's own log messages and we really should avoid a deadlock in that case. As it turns out this causes loss of too many messages, hence make the socket blocking again, however put a time limit on it to avoid unbounded deadlocks in the unlikely case they happen. https://bugs.freedesktop.org/show_bug.cgi?id=66664
* shared: fix build on !x86Shawn Landden2013-07-20
|
* core: add %v specifierZbigniew Jędrzejewski-Szmek2013-07-19
|
* util: add split_pair() for splitting foo=bar stringsLennart Poettering2013-07-18
|
* journalctl: add ”short-iso” output format with verbose ISO8601 timestampsTomasz Torcz2013-07-18
| | | | | Example: 2013-07-18T10:10:01+0200 sandworm CROND[20957]: (root) CMD (/usr/lib64/sa/sa1 1 1)
* journalctl,systemctl: fix tiny memleakZbigniew Jędrzejewski-Szmek2013-07-16
|
* util: make gcc shut up by passing a 0 mode param to open()Lennart Poettering2013-07-17
| | | | | | If we pass a variable to open()'s flags parameter it really wants a mode parameter too, otherwise some gcc version whine. Hence, pass 0 in that case.
* util: make some gcc versions shut up regarding unintialized variable accessLennart Poettering2013-07-17
|
* util.c:is_locale_utf8(): check, if "C" was set on purposeHarald Hoyer2013-07-16
| | | | | | | | If you have a ASCII only terminal, there is no way to set the charmap to ANSI_X3.4-1968, other than using LC_CTYPE=C. We don't want to assume a UTF-8 capable terminal in this case and only do so, if LANG, LC_ALL and LC_CTYPE are unset.
* test-tables: allow sparse tables and check mapping for -1Zbigniew Jędrzejewski-Szmek2013-07-16
| | | | | | | Jan: test-tables fails on my system. The one it's failing on is: syscall: 222 → (null) → -1 ... and indeed, our own tables should not have holes, but syscall tables certainly might.
* detect-virt: detect User-Mode LinuxRamkumar Ramachandra2013-07-16
| | | | | | | | | | | | | | | | | | | | In a User-Mode Linux session: $ systemd-detect-virt none Although it is possible to reliably detect virtualization: $ cat /proc/cpuinfo processor : 0 vendor_id : User Mode Linux model name : UML mode : skas host : Linux kytes 3.11.0-rc1-00009-ge5fd680 (...) bogomips : 7007.43 So, grep for the string "\nvendor_id\t: User Mode Linux\n" in /proc/cpuinfo, and say "uml" when asked.
* journal: add logging of effective capabilities _CAP_EFFECTIVEShawn Landden2013-07-16
| | | | I think this is the most important of the capabilities bitmasks to log.
* util: recognize 'ncp' as an alias to 'ncpfs'Frederic Crozat2013-07-16
| | | | | ncp is also used for Netware mount point, recognize it as such. Fixes https://bugzilla.novell.com/show_bug.cgi?id=828905.
* systemd: fix NULL dereference when disabling a nonexistent instanceZbigniew Jędrzejewski-Szmek2013-07-14
| | | | | | | | | | | | | | | | | | | | | Assertion 'p' failed at src/shared/path-util.c:51, function path_get_file_name(). Aborting. The unit file could not be found, and i->path would not be set. In 02b9e969 a code path was added which attempts to remove symlinks to a nonexistent (removed) unit file. This worked OK in case of non-instance services, but broke in the case of instance services. Behaviour wrt. to instance units is changed in the way that 02b9e969 changed it for non-instance units: it is now possible to remove instance symlinks to a template unit that has been removed. This patch isn't a full fix, because the behaviour wrt. to enabling and disabling instance units is still broken: e.g it is possible to start autovt@tty5.service, but it is not possible to enable it, because autovt@.service is a symlink, and on the other hand, disabling getty@tty5.service removes all symlinks to getty@.service, which is wrong too. But segfaults make bad pr, so let's add at least this partial fix for now.
* test: add trivial test for syscall table and extend table tests to error pathsZbigniew Jędrzejewski-Szmek2013-07-13
|
* install: make "reenable" work with templated unitsRoss Lagerwall2013-07-13
| | | | | | | | Before, "systemctl reenable getty@tty1.service" would fail with: Failed to issue method call: File exists To fix this, reimplement "reenable" explicitly as a disable followed by an enable. This is shorter and is how the man page documents its behavior.
* shared/install: fix trivial memleakZbigniew Jędrzejewski-Szmek2013-07-12
| | | | We lost the reference when setting path second time.
* cgroup: simplify how instantiated units are mapped to cgroupsLennart Poettering2013-07-11
| | | | | | | | | Previously for an instantiated unit foo@bar.service we created a cgroup foo@.service/foo@bar.service, in order to place all instances of the same template inside the same subtree. As we now implicitly add all instantiated units into one per-template slice we don't need this complexity anymore, and instance units can map directly to the cgroups of their full name.
* basic SO_REUSEPORT supportShawn Landden2013-07-11
|
* cgroup: when uninstalling agent, actually turn it off firstLennart Poettering2013-07-10
|
* systemctl: suppress error message when doing "systemctl daemon-reexec"Lennart Poettering2013-07-10
| | | | | | When we issue a reexecution request via the private socket we need to expect a "Disconnected" in addition to "NoReply" when the connection is terminated.