summaryrefslogtreecommitdiff
path: root/src/basic
Commit message (Collapse)AuthorAge
* Prep v228: Added missing src/basic/unaligned.h from upstreamSven Eden2017-04-26
|
* siphash24: fix memory alignmentDaniel Mack2017-04-26
| | | | | | | Use unaligned_read_le64() to access input buffer when reading complete 64-bit words. This should fix memory traps on platforms with strict aliasing.
* virt: make sure that we detect unknown container managers as ↵Lennart Poettering2017-04-26
| | | | | | | | VIRTUALIZATION_CONTAINER_OTHER If we don't know a container manager, we should consider it as "other" rather than as no container manager at all, to provide a somwhat useful upgrade path.
* log: whitespace style fixMichal Schmidt2017-04-26
|
* detect-virt: detect in best-heuristic orderAndrew Jones2017-04-26
| | | | | | | | afaict, this will fix a regression caused by commit 75f86906c5. Where we used to report "kvm" before that patch, without this patch, we would only report "qemu". The reason is because cpuid detection must come before dmi detection. Also, both can safely come before other xen heuristics. Untested.
* detect-virt: dmi: look for KVMAndrew Jones2017-04-26
| | | | | | | | | | | | Some guests (ARM, AArch64, x86-RHEL) have 'KVM' in the product name. Look for that first in order to more precisely report "kvm" when detecting a QEMU/KVM guest. Without this patch we report "qemu", even if KVM acceleration is in use on ARM/AArch64 guests. I've only tested a backported version of this and the previous patch on an AArch64 guest (which worked). Of course it would be nice to get regression testing on all guest types that depend on dmi done.
* arm/aarch64: detect-virt: check dmiAndrew Jones2017-04-26
| | | | | | | | ARM/AArch64 guests now have SMBIOS tables populated (when boot with a late enough QEMU and a late enough AAVMF is used as the bootloader). Furthermore, when booting ARM/AArch64 guests with ACPI, the DT detection obviously no longer works, so we need dmi detection.
* process-util: make some minor corrections to PID live detectionLennart Poettering2017-04-26
|
* path-util: minor coding style fixLennart Poettering2017-04-26
| | | | | | We usually avoid relying on C's degrade-to-boolean functionality when comparing numerical variables with 0. We use it only for pointers and actual booleans.
* util-lib: move formats-util.h from shared/ to basic/Lennart Poettering2017-04-26
| | | | | It's only a header file, definining format strings for basic system types, hence it should be in src/basic/, not src/shared/.
* basic: parse_timestamp UTC and fractional seconds supportHristo Venev2017-04-26
|
* util: minor modernization of vt_disallocate()Lennart Poettering2017-04-26
|
* util: always enforce O_NOCTTY and O_CLOEXEC in openpt_in_namespace()Lennart Poettering2017-04-26
| | | | | | | The child process is shortliving, hence always set O_NOCTTY so that the tty doesn't quickly become controlling TTY and then gives it up again. Also set O_CLOEXEC, because it's cleaner, and doesn't affect the parent anyway.
* Prep v227: Clean up various *-util.[hc] filesSven Eden2017-04-09
| | | | | | | | - src/basic/cgroup-util.[hc] - src/basic/memfd-util.[hc] - src/basic/path-util.[hc] - src/basic/process-util.[hc] - src/basic/smack-util.[hc]
* [2/5] Apply missing fixes from upstreamSven Eden2017-03-29
|
* [1/5] Apply missing fixes from upstreamSven Eden2017-03-29
|
* missing.h : add bridge paramsSusant Sahani2017-03-29
|
* siphash24: expose the internal helper functionsTom Gundersen2017-03-29
|
* siphash24: make siphash24_compress decomposableTom Gundersen2017-03-29
| | | | | | This allows the input to siphash24_compress to be decomposed into smaller chunks and the function to be called on each individual chunk.
* siphash24: move last compression iteration from compression step to ↵Tom Gundersen2017-03-29
| | | | | | | finalization step The last compression is special as it deals with the length byte, and padding. Move it to the finalization step in preparation for making compression decomposable.
* siphash24: split out the compression stepTom Gundersen2017-03-29
|
* siphash24: split out the finalization stepTom Gundersen2017-03-29
|
* siphash24: introduce state structTom Gundersen2017-03-29
| | | | | Encapsulate the four state variables in a struct so we can more easily pass them around.
* log: properly return -EINVAL from log_set_max_level_from_string()Lennart Poettering2017-03-29
| | | | | | | | If we just return the value we got from log_level_from_string() on failure we'll return -1, which is not a proper error code. log_set_target_from_string() did get this right already, hence let's fix this here too.
* prioq: never shuffle identical entriesDavid Herrmann2017-03-29
| | | | | Skip shuffling identical entries in shuffle_up(), just like we already do in shuffle_down().
* mising: add __NR_memfd_create syscall number for s390Hendrik Brueckner2017-03-29
|
* util: clean-ups to enum parsersLennart Poettering2017-03-29
| | | | | | | | | | | | Never log when we fail due to OOM when translating enums, let the caller do that. Translating basic types like enums should be something where the caller logs, not the translatior functions. Return -1 when NULL is passed to all enum parser functions. The non-fallback versions of the enum translator calls already handle NULL as failure, instead of hitting an assert, and we should do this here, too.
* util: minor cleanups for loop_read() and friendsLennart Poettering2017-03-29
| | | | | | | | When 0 bytes are to be written, make sure to go into read() at least once, in order to validate the parameters, such as the passed fd. Return error on huge values, add a couple of asserts and casts where appropriate.
* Add fallback for kcmp() in case __NR_kcmp is undefinedMike Gilbert2017-03-29
| | | | | IA64 is missing this syscall as of linux-4.2. This works around it until the necessary kernel patch gets merged.
* basic: make sure argument of ELEMENTSOF is an arrayMichal Schmidt2017-03-29
| | | | Using ELEMENTSOF on a pointer will result in a compilation error.
* basic: nicer assert messagesMichal Schmidt2017-03-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure the assert expression is not macro-expanded before stringification. This makes several assertion failure messages more readable. As an example: assert(streq("foo", "bar")); I'd rather see this: Assertion 'streq("foo", "bar")' failed at foo.c:5, function main(). Aborting. ...than this, though awesome, incomprehensible truncated mess: Assertion '(__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (( "foo")) && __builtin_constant_p (("bar")) && (__s1_len = strlen (("foo")), __s2_ len = strlen (("bar")), (!((size_t)(const void *)((("foo")) + 1) - (size_t)(cons t void *)(("foo")) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((("bar") ) + 1) - (size_t)(const void *)(("bar")) == 1) || __s2_len >= 4)) ? __builtin_st rcmp (("foo"), ("bar")) : (__builtin_constant_p (("foo")) && ((size_t)(const voi d *)((("foo")) + 1) - (size_t)(const void *)(("foo")) == 1) && (__s1_len = strle n (("foo")), __s1_len < 4) ? (__builtin_constant_p (("bar")) && ((size_t)(const void *)((("bar")) + 1) - (size_t)(const void *)(("bar")) == 1) ? __builtin_strcm p (("foo"), ("bar")) : (__extension__ ({ const unsigned char *__s2 = (const unsi gned char *) (const char *) (("bar")); int __result = (((const unsigned char *) (const char *) (("foo")))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __ result = (((const unsigned char *) (const char *) (("foo")))[1] - __s2[1]); if ( __s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const cha r *) (("foo")))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = ((( const unsigned char *) (const char *) (("foo")))[3] - __s2[3]); } } __result; }) )) : (__builtin_constant_p (("bar")) && ((size_t)(const void *)((("bar")) + 1) - (size_t)(const void *)(("bar")) == 1) && (__s2_len = strlen (("bar")), __s2_len < 4) ? (__builtin_constant_p (("foo")) && ((size_t)(const void *)((("foo")) + 1 ) - (size_t)(const void *)(("foo")) == 1) ? __builtin_strcmp (("foo"), ("bar")) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (cons t char *) (("foo")); int __result = (((const unsigned char *) (const char *) ((" bar")))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (("bar")))[1] - __s2[1]); if (__s2_len > 1 && __ result == 0) { __result = (((const unsigned char *) (const char *) (("bar")))[2] - __s2[2]); if (__s2_len > 2 && __result == 0)
* smack: introduce new mac_smack_copy() functionSangjung Woo2017-03-29
| | | | | This adds a new mac_smack_copy() function in order to read the smack label from the source and apply it to the destination.
* include sys/sysmacros.h in more placesMike Frysinger2016-03-14
| | | | | | Since glibc is moving away from implicitly including sys/sysmacros.h all the time via sys/types.h, include the header directly in more places. This seems to cover most makedev/major/minor usage.
* basic/musl_missing.h : __compar_fn_t was defined twice - fixed.Sven Eden2017-03-17
|
* Rename ELOGIND_CGROUP_CONTROLLER back to SYSTEMD_CGROUP_CONTROLLERSven Eden2017-03-14
| | | | | Although it is nice to have it read ELOGIND instead of SYSTEMD, all diffs just show too many irrelevant (false) positives.
* Major cleanup of all leftovers after rebasing on master.Sven Eden2017-03-14
| | | | | | | | The patching of elogind in several steps with only partly rebasing on a common commit with upstream, left the tree in a state, that was unmergeable with master. By rebasing on master and manually cleaning up all commits, this merge is now possible. However, this process left some orphans, that are cleanup now.
* Unifiy free() usageSven Eden2017-03-14
| | | | | | | | This commit substitutes all occurrences of free(foo); foo = NULL; with foo = mfree(foo);
* Fix bug that program_invocation_name is NULL when backgroundingSven Eden2017-03-14
| | | | | | | | | | | | | | | This is a weird issue. When elogind is started from a tty, everything works just fine. But since adding the fixes to build elogind against the musl libc, which does not provide program_invocation_name and program_invocation_short_name, glibc does not set them when elogind is background. Neither when done manually, nor when doing it using a system init tool like openrc /sbin/start-stop-daemon. The "workaround" is to allow elogind_set_program_name() to (re-)set both globals if they are either NULL, or not set to the correct value. This should work fine with both glibc and musl-libc.
* Add mounting of a name=elogind cgroup if no init controller is found.Sven Eden2017-03-14
| | | | | This is done for systems, which init systems are no cgroup controllers. One example is runit on Void Linux.
* Add support for building elogind against musl libcSven Eden2017-03-14
| | | | | | | | | | | | | | | | | | | * Check whether printf.h is available and define/undef HAVE_PRINTF_H accordingly. * Added src/shared/parse-printf-format.[hc] by Emil Renner Berthing <systemd@esmil.dk> that provides parse_printf_format() if printf.h is unavailable * Added src/basic/musl_missing.h by Juergen Buchmueller <pullmoll@t-online.de> that implements glibc functions missing in musl libc as macros. * Extended src/basic/musl_missing.h and added src/basic/musl_missing.c providing - program_invocation_name - program_invocation_short_name and - elogind_set_program_name() to set the two where appropriate. * Added calls to elogind_set_program_name() to all main() functions where needed. * A few other fixes to work nicely with musl libc.
* Fixed gawk script for git-tar target.Sven Eden2017-03-14
| | | | | | | | | | | | | | | | | | | | | | | The previous variant was nice and sleek. But unfortunately, there are constructs like: #if 0 (... old code ...) #else (... alternative code for elogind ...) #endif // 0 These fragments couldn't be handled by the old code, but can by the new one. To make this work, the precompiler macros must be set like shown above. Apart from that, all lines like: /// Any doxygen one-line-comments with elogind in it are removed are removed, too. Please note the three slashes. And finally, all commented out #include directives are removed as well.
* Remove (non.existent) support for logging to journald.Sven Eden2017-03-14
|
* Cleaned up more unneeded functions and types in:Sven Eden2017-03-14
| | | | | | | | | | | | | | | | | | | | - src/basic/ioprio.h - removed - src/basic/ring.h - removed - src/basic/capability.[hc] - cleaned - src/basic/cgroup-util.[hc] - cleaned - src/basic/hostname-util.[hc] - cleaned - src/basic/path-util.[hc] - cleaned - src/basic/socket-util.h - cleaned - src/basic/strv.[hc] - cleaned - src/basic/time-util.[hc] - cleaned - src/basic/unit-name.[hc] - cleaned - src/basic/util.[hc] - cleaned - src/libelogind/sd-bus/bus-introspect.c - cleaned - src/login/loginctl.c - cleaned - src/login/logind-dbus.c - cleaned - src/login/logind.h - cleaned - src/shared/conf-parser.[hc] - cleaned
* Cleaned up more unneeded types and functions.Sven Eden2017-03-14
| | | | | | | | | | | | | | - src/shared/install.h - removed - src/basic/unit-name.[hc] - cleaned - src/core/cgroup.[hc] - cleaned - src/libelogind/libelogind.sym - cleaned - src/libelogind/sd-daemon/sd-daemon.c - cleaned - src/shared/acl-util.[hc] - cleaned - src/shared/bus-util.[hc] - cleaned - src/shared/output-mode.h - cleaned - src/shared/path-lookup.h - cleaned - src/systemd/sd-daemon.h - cleaned
* cg_shift_path(): Do not shift if cgroup and root are equalSven Eden2017-03-14
|
* Add --enable-debug=elogind configure option and fix cgroup pathSven Eden2017-03-14
| | | | | | | a) Add some debugging messages to track what's going on with eloginds cgroup handling. b) Do not create a cgroup path "/elogind" if our cgroup root is already "/elogind".
* Detect running cgroup controller.Sven Eden2017-03-14
| | | | | | | | elogind has to run on any system, no matter which init system is in control of the cgroups. So instead of hardcoding "name=foo", configure now greps 1: in /proc/self/cgroup - which is hopefully the right choice. (Well, to be honest, if it isn't, something is really wrong with the running system...)
* Classify processes from sessions into cgroupsSven Eden2017-03-14
| | | | | | | Create a private cgroup tree associated with no controllers, and use it to map PIDs to sessions. Since we use our own path structure, remove internal cgroup-related helpers that interpret the cgroup path structure to pull out users, slices, and scopes.
* Remove src/basic/special.h, as all defines in there are systemd-only.Sven Eden2017-03-14
|
* Add poweroff, suspend etc. loginctl commandsSven Eden2017-03-14
| | | | | | | * src/login/loginctl.c: Add poweroff, reboot, suspend, hibernate, and hybrid-sleep commands. Normally these are handled by systemctl but since elogind is targeted at the no-systemd use case, we incorporate them here.