summaryrefslogtreecommitdiff
path: root/src/shared
AgeCommit message (Collapse)Author
2014-01-02Use format patterns for usec_t, pid_t, nsec_t, usec_tZbigniew Jędrzejewski-Szmek
It is nicer to predefine patterns using configure time check instead of using casts everywhere. Since we do not need to use any flags, include "%" in the format instead of excluding it like PRI* macros.
2014-01-02Move bus path definitions to def.hZbigniew Jędrzejewski-Szmek
2014-01-02networkd: improve loggingTom Gundersen
Remove redundant messages, add some debugging ones and make wording more uniform.
2013-12-31sleep-config: fix double freeZbigniew Jędrzejewski-Szmek
Before 34a3baa4d 'sleep-config: Dereference pointer before check for NULL' oom conditions would not be detected properly. After that commit, a double free was performed. Rework the whole function to be easier to understand, and also replace strv_split_nulstr with strv_new, since we know the strings anyway.
2013-12-30sleep-config: Dereference pointer before check for NULLStefan Beller
This fixes a bug pointed out by http://css.csail.mit.edu/stack/ (Optimization-unstable code) It is a similar fix as f146f5e159 (2013-12-30, core: Forgot to dereference pointer when checking for NULL) To explain this bug consider the following similar, but simpler code: if (!p) free(*p) Assume the if condition evaluates to true, then we will access *p, which means the compiler can assume p is a valid pointer, so it could dereference p and use the value *p. Assuming p as a valid pointer, !p will be false. But initally we assumed the condition evaluates to true. By this reasoning the optimizing compiler can deduce, we have dead code. ("The if will never be taken, as *p must be valid, because otherwise accessing *p inside the if would segfault") This led to an error message of the static code checker, so I checked the code in question. As we access *modes and *states before the check in the changed line of this patch, I assume the line to be wrong and we actually wanted to check for *modes and *states being both non null.
2013-12-28shared: add simplistic XML parser for usage in the D-Bus policy language ↵Lennart Poettering
compat parser
2013-12-26Use enums to make it obvious what boolean params meanZbigniew Jędrzejewski-Szmek
Suggested-by: Russ Allbery <rra@debian.org>
2013-12-26systemctl: allow globbing in commands which take multiple unit namesZbigniew Jędrzejewski-Szmek
2013-12-25bus: rename message "serial" to "cookie"Lennart Poettering
Even if the lower-leveld dbus1 protocol calls it "serial", let's expose the word "cookie" for this instead, as this is what kdbus uses and since it doesn't imply monotonicity the same way "serial" does.
2013-12-25shared: fix getpeername_pretty() for AF_UNIX socketsLennart Poettering
2013-12-25unit: include peer identity in description of per-connection ↵Lennart Poettering
socket-activated services
2013-12-24sleep-config: fix useless check for swapfile typeDave Reisner
Since 0c6f1f4ea49 the check was useless, because the kernel will ever only write "partition" or "file" there. OTOH, it is possible that "\\040(deleted)" (escaped " (deleted)") will be added for removed files. This should not happen, so add a warning to detect those cases.
2013-12-24bus: properly shift cgroup data returned from kdbus by the container's root ↵Lennart Poettering
before parsing
2013-12-24log: log_error() and friends add a newline after each line anyway, so avoid ↵Lennart Poettering
including it in the log strings
2013-12-24util: don't accept an empty peer label as validLennart Poettering
2013-12-24util: unify SO_PEERCRED/SO_PEERSEC invocationsLennart Poettering
Introduce new call getpeercred() which internally just uses SO_PEERCRED but checks if the returned data is actually useful due to namespace quirks.
2013-12-23bus: when getting a kdbus connection into a container wait first for child, ↵Lennart Poettering
then read message There's no EOF generated for AF_UNIX/SOCK_DGRAM sockets, hence let's wait for the child first to see if it succeeded, only then read the socket.
2013-12-23util: when we try to read /proc/cmdline in a container, read /proc/1/cmdline ↵Lennart Poettering
instead
2013-12-23log: als turn on debug logging in non-PID1 if /proc/cmdline contains "debug"Lennart Poettering
2013-12-23bus: switch kdbus bloom filter over to SipHash (from MurmurHash3)Lennart Poettering
Let's try to standardize on a single non-cryptographic hash algorithm, and for that SipHash appears to be the best answer. With this change there are two other hash functions left in systemd: an older version of MurmurHash embedded into libudev for the bloom filters in udev messages (which is hard to update, given that the we probably should stay compatible with older versions of the library). And lookup3 in the journal files (which we could replace for new files, but which is probably not worth the work).
2013-12-23libudev: ship the original MurmurHash2.[ch] fileKay Sievers
2013-12-22Fix extraction of _SYSTEMD_USER_UNITZbigniew Jędrzejewski-Szmek
Units from user services underneath user@.service would not be detected properly.
2013-12-22shared: switch our hash table implementation over to SipHashLennart Poettering
SipHash appears to be the new gold standard for hashing smaller strings for hashtables these days, so let's make use of it.
2013-12-21util: remove union dirent_storageFlorian Weimer
2013-12-21conf-files: replace readdir_r with readdirFlorian Weimer
2013-12-21util: replace readdir_r with readdirFlorian Weimer
This fixes rm_rf_children_dangerous to detect errors during directory reading. Previously, it could dereference an uninitialized pointer.
2013-12-21install: replace readdir_r with readdirFlorian Weimer
The old code incorrectly assumed that readdir_r updates errno.
2013-12-20DEFAULT_PATH_SPLIT_USR macroShawn Landden
2013-12-20logging: reduce send timeout to something more sensibleZbigniew Jędrzejewski-Szmek
For a user, the timeout of 1 min per message seems equivalent to a hang. If journald cannot process a message from PID1 for 10 ms then something is significantly wrong. It's better to lose the message and continue.
2013-12-19def: lower exit-on-idle timeLennart Poettering
2013-12-18udevadm: modernizationZbigniew Jędrzejewski-Szmek
2013-12-18Revert "ptyfwd: make master terminal attributes raw, too"Lennart Poettering
This reverts commit e7d43b3cc30764138c90eaaf95d3d8f49e448890. This broke the console terminal when booting up a container, so let's not do this.
2013-12-18ptyfwd: make master terminal attributes raw, tooLennart Poettering
2013-12-18log: when we log to /dev/console and got disconnected (maybe due to vhangup) ↵Lennart Poettering
reconnect
2013-12-18log: don't reopen /dev/console each time we call log_open()Lennart Poettering
Instead, force reopen it only if we really really have to.
2013-12-18service: watch main pid even in final statesLennart Poettering
In some circumstances, for example when start-up times out we immediately jump into the final state, at which point we still should try to watch the main pid so that the SIGCHLD allows us to quickly move into dead state.
2013-12-18busctl: output a single sorted list of names, including activatable and ↵Lennart Poettering
activated
2013-12-17_noreturn_ --> noreturn for C11 compatShawn Landden
also define noreturn w/o <stdnoreturn.h>
2013-12-17util: no need for in_initrd() cache to be thread-localShawn Landden
the process only has one working directory, and a race is harmless
2013-12-17__thread --> thread_local for C11 compatShawn Landden
Also make thread_local available w/o including <threads.h>. (as the latter hasn't been implemented, but this part is trivial)
2013-12-17libsystemd-bus: true/false instead of yes/no in msg dumpLukasz Skalski
Due to this patch, message dump (for message which includes boolean type) is more consistent with dbus-send (which display true/false instead of yes/no for boolean). It's only simple 'cosmetics change'. ** For dbus-send ** dbus-send --system --dest=org.freedesktop.DBus --type=method_call --print-reply / org.freedesktop.DBus.NameHasOwner string:org.freedesktop.login1 method return sender=org.freedesktop.DBus -> dest=:1.97 reply_serial=2 boolean true ** For libsystemd-bus (without this patch) ** ‣ Type=method_call Endian=l Flags=0 Version=2 Serial=8 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=NameHasOwner MESSAGE "s" { STRING "org.freedesktop.login1"; }; ‣ Type=method_return Endian=l Flags=1 Version=2 Serial=51 ReplySerial=8 Sender=:1.59 Destination=:1.67 UniqueName=:1.59 WellKnownNames={org.freedesktop.DBus} MESSAGE "b" { BOOLEAN yes; }; For me true/false seems to be better readable than yes/no for BOOLEAN.
2013-12-16systemctl: highlight filenames in catZbigniew Jędrzejewski-Szmek
2013-12-17bus: when entering an existing namespace to connect to a container's system ↵Lennart Poettering
bus also switch over PID namespace This is necessary to ensure that kdbus can collect creds of the destination namespace when connecting.
2013-12-16util: try harder to increase the send/recv buffers of socketsLennart Poettering
If we have the priviliges we will try SO_SNDBUFFORCE/SO_RCVBUFFORCE and only fall back to SO_SNDBUF/SO_RCVBUF if that fails.
2013-12-16core: refuse doing %h, %s, %U specifier resolving in PID 1Lennart Poettering
These specifiers require NSS lookups to work, and we really shouldn't do them from PID 1 hence. With this change they are now only supported for user systemd instance, or when the configured user for a unit is root.
2013-12-15Fix a few signed/unsigned format string issuesZbigniew Jędrzejewski-Szmek
Since numbers involved are all small, behaviour was correct already. https://bugzilla.redhat.com/show_bug.cgi?id=1043304
2013-12-14util: port last code over to new namespace utility callsLennart Poettering
2013-12-14util: when joining a namespace make sure to reset all uids to 0 afterLennart Poettering
the transition
2013-12-14bus: when connecting to a container's kdbus instance, enter namespace firstLennart Poettering
Previously we'd open the connection in the originating namespace, which meant most peers of the bus would not be able to make sense of the PID/UID/... identity of us since we didn't exist in the namespace they run in. However they require this identity for privilege decisions, hence disallowing access to anything from the host. Instead, when connecting to a container, create a temporary subprocess, make it join the container's namespace and then connect from there to the kdbus instance. This is similar to how we do it for socket conections already. THis also unifies the namespacing code used by machinectl and the bus APIs.
2013-12-12shared: Add struct sockaddr_ll to sockaddr_unionPatrik Flykt