summaryrefslogtreecommitdiff
path: root/src/shared
AgeCommit message (Collapse)Author
2013-12-06Get rid of our reimplementation of basenameZbigniew Jędrzejewski-Szmek
The only problem is that libgen.h #defines basename to point to it's own broken implementation instead of the GNU one. This can be fixed by #undefining basename.
2013-12-05util: fix misuse of memcmpYuxuan Shui
2013-12-03trivial coding style clean upsThomas Hindoe Paaboel Andersen
- Add space between if/for and the opening parentheses - Place the opening brace on same line as the function (not for udev) From the CODING_STYLE Try to use this: void foo() { } instead of this: void foo() { }
2013-12-03macro: better make IN_SET() macro use const arraysLennart Poettering
2013-12-03bus: add generator that turns old dbus1 activation files into .busname + ↵Lennart Poettering
.service units
2013-12-02bus: add .busname unit type to implement kdbus-style bus activationLennart Poettering
2013-12-02macro: add a macro to test whether a value is in a specified listLennart Poettering
Introduce IN_SET() macro to nicely check whether a value a is one of a few listed values. This makes writing this: if (a == 1 || a == 7 || a == 8 || a == 9) nicer, by allowing this: if (IN_SET(a, 1, 7, 8, 9)) This is particularly useful for state machine enums.
2013-12-01util: add greedy_realloc0()David Herrmann
Compared to greedy_realloc(), this sets all newly allocated memory to 0. As the old variant has been used a lot for string-handling, we avoid changing it as clearing memory is not needed there.
2013-11-30fix regression of read_full_file() in fileio.cShawn Landden
my e93c33d4aa broke this stupidly
2013-11-30systemctl: add "systemctl cat"Shawn Landden
2013-12-01util.c: check if return value from ttyname_r is > 0 instead of != 0Thomas Hindoe Paaboel Andersen
We must return a negative error code from getttyname_malloc but that would not be the case if ttyname_r returned a negative value. ttyname_r should only return EBADF, ENOTTY, or ERANGE so it should be safe to change.
2013-11-30macro.h: fix typo in commentThomas Hindoe Paaboel Andersen
2013-11-30bus: include unique and well known names in credentials objectLennart Poettering
2013-11-28virt: split detect_vm into separate functionsZbigniew Jędrzejewski-Szmek
It didn't build on arm. Let's simplify it a bit by splitting x86 specific parts out, which should also make things easier when arm virtualization support is added.
2013-11-28bus: add new sd_bus_creds object to encapsulate process credentialsLennart Poettering
This way we can unify handling of credentials that are attached to messages, or can be queried for bus name owners or connection peers. This also adds the ability to extend incomplete credential information with data from /proc, Also, provide a convenience call that will automatically determine the most appropriate credential object for an incoming message, by using the the attached information if possible, the sending name information if available and otherwise the peer's credentials.
2013-11-28util: fix handling of trailing whitespace in split_quoted()Lennart Poettering
Inspired by a patch by Lukas Nykryn.
2013-11-27service: add the ability for units to join other unit's PrivateNetwork= and ↵Lennart Poettering
PrivateTmp= namespaces
2013-11-25conf-parser: fix memory realloc errorYin Kangkai
Otherwise there is some memory corruption and undefined behavior, e.g., in my case systemd-udev was always aborted at the _cleanup_freep_ around that code blocks.
2013-11-25shutdown: during final killing spree also send SIGHUP in addition to SIGTERM ↵Lennart Poettering
to deal with shells This makes shutdown a bit faster if debug-shell.service is enabled.
2013-11-25conf-parser: distinguish between multiple sections with the same nameTom Gundersen
Pass on the line on which a section was decleared to the parsers, so they can distinguish between multiple sections (if they chose to). Currently no parsers take advantage of this, but a follow-up patch will do that to distinguish [Address] Address=192.168.0.1/24 Label=one [Address] Address=192.168.0.2/24 Label=two from [Address] Address=192.168.0.1/24 Label=one Address=192.168.0.2/24 Label=two
2013-11-25swap: split state machine state ACTIVATING into twoLennart Poettering
We expect the event on /proc/swaps before we expect the SIGCHILD, reflect this in the state machine.
2013-11-25udev: net_setup_link - don't use Description as AliasTom Gundersen
Use Description only internally, and allow Alias to be set as a separate option. For instance SNMP uses ifalias for a specific purpose, so let's not write to it by default.
2013-11-22systemctl: indicate in list-dependencies whether a unit is already runningLennart Poettering
2013-11-22build-sys: move more files from core/ to share/ that are generic enoughLennart Poettering
2013-11-22macro: fix problem with __LINE__ macro expansionLukasz Skalski
David: I already applied a fix for that, but this patch definitely looks nicer. I changed CONCATENATE_HELPER() -> XCONCATENATE() similar to XSTRINGIFY and added the UNIQUE() helper.
2013-11-22macro: fix assert_cc() fallbackDavid Herrmann
We need two-level macro-expansion, otherwise __LINE__ will not get evaluated.
2013-11-22bus: rework sd_bus_error APIsLennart Poettering
All calls that set a sd_bus_error structure will now return the same error converted to a negative errno. This may be used as syntactic sugar to return from a function and setting a bus_error structure in one go. Also, translate all Linux Exyz (EIO, EINVAL, EUCLEAN, EPIPE, ...) automatically into counterparts in the (new) "Posix.Error." namespace. If we fail to allocate memory for the components of a sd_bus_error automatically reset it to an OOM error which we always can write.
2013-11-21bus: add API calls to escape string components of objects pathsLennart Poettering
2013-11-20core: convert PID 1 to libsystemd-busLennart Poettering
This patch converts PID 1 to libsystemd-bus and thus drops the dependency on libdbus. The only remaining code using libdbus is a test case that validates our bus marshalling against libdbus' marshalling, and this dependency can be turned off. This patch also adds a couple of things to libsystem-bus, that are necessary to make the port work: - Synthesizing of "Disconnected" messages when bus connections are severed. - Support for attaching multiple vtables for the same interface on the same path. This patch also fixes the SetDefaultTarget() and GetDefaultTarget() bus calls which used an inappropriate signature. As a side effect we will now generate PropertiesChanged messages which carry property contents, rather than just invalidation information.
2013-11-20hashmap: be a bit more conservative with pre-allocating hash tables and itemsLennart Poettering
2013-11-20install: when determining where default.target points to, accept a file ↵Lennart Poettering
instead of a symlink, too
2013-11-20calendar: support 'yearly' and 'annually' names the same way as cronLennart Poettering
2013-11-20hwclock: modernizationsLennart Poettering
2013-11-20macro: add _unlikely_() to assert_return()Lennart Poettering
As the name indicates assert_return() is really just for assertions, i.e. where it's a programming error if the assertion does not hold. Hence it is safe to add _unlikely_() decorators for the expression to check.
2013-11-20macro: change assert_cc() so that it can appear outside of functionsLennart Poettering
2013-11-20install: use const where we canLennart Poettering
2013-11-20conf-parser: don't leak section namesTom Gundersen
If we encounter an unknown section, we must free the previous section before clearing the pointer.
2013-11-18localed: match converted keymaps before legacyZbigniew Jędrzejewski-Szmek
Before, X11 keymap fr-pc105-oss would be converted to fr, even though fr-oss exists. Now, if /usr/lib/kbd/keymaps/xkb/<layout>[-<variant>].map[.gz] exists, <layout>[-<variant>] will be used as the console keymap, falling back to the legacy mappings otherwise. % sudo localectl set-x11-keymap pl pc105 % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: pl (was pl2 before) X11 Layout: pl X11 Model: pc105 % sudo localectl set-x11-keymap fr pc105 oss % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: fr-oss (was fr before) X11 Layout: fr X11 Model: pc105 X11 Variant: oss % sudo localectl set-x11-keymap fr pc105 % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: fr X11 Layout: fr X11 Model: pc105 % sudo localectl set-x11-keymap gb % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: gb (was uk before) X11 Layout: gb
2013-11-18Remove duplicate includesKarel Zak
2013-11-18use #pragma once instead of foo*foo define guardsShawn Landden
2013-11-13Resolve /dev/console to the active tty instead of just "tty0"Olivier Brunel
When resolving /dev/console one would often get "tty0" meaning the active VT. Resolving to the actual tty (e.g. "tty1") will notably help on boot when determining whether or not PID1 can output to the console.
2013-11-11timer: consider (usec_t) -1 an invalid timestampLennart Poettering
2013-11-11timer: properly format relative timestamps in the futureLennart Poettering
2013-11-09net-util: add inet address/family parsingTom Gundersen
2013-11-08shutdown: unify handling of reboot() syscall a bitLennart Poettering
2013-11-08Remove dead code and unexport some callsLennart Poettering
"make check-api-unused" informs us about code that is not used anymore or that is exported but only used internally. Fix these all over the place.
2013-11-08manager: configurable StartLimit default valuesLukas Nykryn
https://bugzilla.redhat.com/show_bug.cgi?id=821723
2013-11-08install: don't override caller's parameterLennart Poettering
2013-11-07polkit: don't spawn local client if we access a remote systemLennart Poettering
2013-11-07util: add circle to special chars we can drawLennart Poettering