chiark / gitweb /
elogind.git
6 years agoutil: always enforce O_NOCTTY and O_CLOEXEC in openpt_in_namespace()
Lennart Poettering [Wed, 7 Oct 2015 18:08:49 +0000 (20:08 +0200)]
util: always enforce O_NOCTTY and O_CLOEXEC in openpt_in_namespace()

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.

6 years agologin: fix re-use of users
David Herrmann [Tue, 29 Sep 2015 09:36:18 +0000 (11:36 +0200)]
login: fix re-use of users

If the last reference to a user is released, we queue stop-jobs for the
user-service and slice. Only once those are finished, we drop the
user-object. However, if a new session is opened before the user object is
fully dropped, we currently incorrectly re-use the object. This has the
effect, that we get stale sessions without a valid "elogind --user"
instance.

Fix this by properly allowing user_start() to be called, even if
user->stopping is true.

6 years agoVersion 227.4 v227.4
Sven Eden [Wed, 26 Apr 2017 10:52:55 +0000 (12:52 +0200)]
Version 227.4

6 years agoMerge pull request #9 from Gottox/fix-musl-ro-stdout
Sven Eden [Wed, 26 Apr 2017 10:47:42 +0000 (11:47 +0100)]
Merge pull request #9 from Gottox/fix-musl-ro-stdout

fix musl-libc for 227.2/227.3: do not change stderr/stdout variables.

6 years agodo not change stderr/stdout variables.
Enno Boland [Wed, 26 Apr 2017 09:02:13 +0000 (11:02 +0200)]
do not change stderr/stdout variables.

musl for example marks those variables as const and therefore
fails while building at this file.

6 years agoVersion 227.3 v227.3
Sven Eden [Wed, 26 Apr 2017 06:38:52 +0000 (08:38 +0200)]
Version 227.3

6 years agoconfigure.ac: Make -flto optimization optional
Sven Eden [Wed, 26 Apr 2017 06:38:14 +0000 (08:38 +0200)]
configure.ac: Make -flto optimization optional

6 years agoMerge pull request #5 from elogind/dev_v227 v227.2
Sven Eden [Mon, 24 Apr 2017 07:57:58 +0000 (08:57 +0100)]
Merge pull request #5 from elogind/dev_v227

Candidate for next Version v227

7 years agoVersion 227.2
Sven Eden [Wed, 12 Apr 2017 10:43:44 +0000 (12:43 +0200)]
Version 227.2

7 years agoPrep v227: Add missing Makefile symlinks
Sven Eden [Wed, 12 Apr 2017 10:17:45 +0000 (12:17 +0200)]
Prep v227: Add missing Makefile symlinks

7 years agoPrep v227: Fix man page index building.
Sven Eden [Wed, 12 Apr 2017 06:25:04 +0000 (08:25 +0200)]
Prep v227: Fix man page index building.

7 years agoPrep v227: Removed src/shared/cgroup-show.[hc], it is not needed.
Sven Eden [Mon, 10 Apr 2017 09:25:07 +0000 (11:25 +0200)]
Prep v227: Removed src/shared/cgroup-show.[hc], it is not needed.

7 years agoPrep v227: Clean up some headers in src/systemd
Sven Eden [Sun, 9 Apr 2017 18:56:14 +0000 (20:56 +0200)]
Prep v227: Clean up some headers in src/systemd

- src/systemd/sd-bus.h
- src/systemd/sd-daemon.h
- src/systemd/sd-event.h

7 years agoPrep v227: Clean up various *-util.[hc] files
Sven Eden [Sun, 9 Apr 2017 12:14:36 +0000 (14:14 +0200)]
Prep v227: Clean up various *-util.[hc] files

- 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]

7 years agoAdd Code::Blocks project file
Sven Eden [Sun, 9 Apr 2017 12:04:20 +0000 (14:04 +0200)]
Add Code::Blocks project file

7 years agoFix assertion failure when resuming from sleep/suspend
Sven Eden [Tue, 4 Apr 2017 06:51:33 +0000 (08:51 +0200)]
Fix assertion failure when resuming from sleep/suspend

7 years agoUpdate Build files
Sven Eden [Tue, 21 Mar 2017 17:05:54 +0000 (18:05 +0100)]
Update Build files

7 years ago[5/5] Apply missing fixes from upstream
Sven Eden [Wed, 29 Mar 2017 08:06:43 +0000 (10:06 +0200)]
[5/5] Apply missing fixes from upstream

7 years ago[4/5] Apply missing fixes from upstream
Sven Eden [Wed, 29 Mar 2017 08:06:29 +0000 (10:06 +0200)]
[4/5] Apply missing fixes from upstream

7 years ago[3/5] Apply missing fixes from upstream
Sven Eden [Wed, 29 Mar 2017 08:06:16 +0000 (10:06 +0200)]
[3/5] Apply missing fixes from upstream

7 years ago[2/5] Apply missing fixes from upstream
Sven Eden [Wed, 29 Mar 2017 08:05:50 +0000 (10:05 +0200)]
[2/5] Apply missing fixes from upstream

7 years ago[1/5] Apply missing fixes from upstream
Sven Eden [Wed, 29 Mar 2017 08:05:39 +0000 (10:05 +0200)]
[1/5] Apply missing fixes from upstream

7 years agopo files: Update to upstream and some cleanup.
Марко М. Костић (Marko M. Kostić) [Sat, 3 Oct 2015 20:07:29 +0000 (22:07 +0200)]
po files: Update to upstream and some cleanup.

7 years agomissing.h : add bridge params
Susant Sahani [Mon, 5 Oct 2015 04:05:36 +0000 (09:35 +0530)]
missing.h : add bridge params

7 years agosiphash24: expose the internal helper functions
Tom Gundersen [Sat, 3 Oct 2015 22:23:25 +0000 (00:23 +0200)]
siphash24: expose the internal helper functions

7 years agosiphash24: make siphash24_compress decomposable
Tom Gundersen [Sat, 3 Oct 2015 20:21:44 +0000 (22:21 +0200)]
siphash24: make siphash24_compress decomposable

This allows the input to siphash24_compress to be decomposed into
smaller chunks and the function to be called on each individual
chunk.

7 years agosiphash24: move last compression iteration from compression step to finalization...
Tom Gundersen [Sat, 3 Oct 2015 19:27:25 +0000 (21:27 +0200)]
siphash24: move last compression iteration from compression step to 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.

7 years agosiphash24: split out the compression step
Tom Gundersen [Sat, 3 Oct 2015 18:21:01 +0000 (20:21 +0200)]
siphash24: split out the compression step

7 years agosiphash24: split out the finalization step
Tom Gundersen [Sat, 3 Oct 2015 18:14:18 +0000 (20:14 +0200)]
siphash24: split out the finalization step

7 years agosiphash24: introduce state struct
Tom Gundersen [Sat, 3 Oct 2015 18:09:43 +0000 (20:09 +0200)]
siphash24: introduce state struct

Encapsulate the four state variables in a struct so we can more easily pass
them around.

7 years agolog: properly return -EINVAL from log_set_max_level_from_string()
Lennart Poettering [Wed, 30 Sep 2015 12:16:40 +0000 (14:16 +0200)]
log: properly return -EINVAL from log_set_max_level_from_string()

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.

7 years agosd-event: don't provide priority stability
David Herrmann [Tue, 29 Sep 2015 18:56:17 +0000 (20:56 +0200)]
sd-event: don't provide priority stability

Currently, we guarantee that if two event-sources with the same priority
fire at the same time, they're always dispatched in the same order. While
this might sound nice in theory, there's is little benefit in providing
stability on that level. We have no control over the order the events are
reported, hence, we cannot guarantee that we get notified about both at
the same time.

By dropping the stability guarantee, we loose roughly 10% Heap swaps in
the prioq on a desktop cold-boot. Krzysztof Kotlenga even reported up to
20% on his tests. This sounds worth optimizing, so drop the stability
guarantee.

7 years agoprioq: never shuffle identical entries
David Herrmann [Tue, 29 Sep 2015 18:41:29 +0000 (20:41 +0200)]
prioq: never shuffle identical entries

Skip shuffling identical entries in shuffle_up(), just like we already do
in shuffle_down().

7 years agosd-event: fix prepare priority queue comparison function
Krzysztof Kotlenga [Wed, 23 Sep 2015 22:34:51 +0000 (00:34 +0200)]
sd-event: fix prepare priority queue comparison function

Otherwise a disabled event source can get swapped with an enabled one
and cause a severe sd-event malfunction.

http://lists.freedesktop.org/archives/elogind-devel/2015-September/034356.html

7 years agomising: add __NR_memfd_create syscall number for s390
Hendrik Brueckner [Wed, 23 Sep 2015 11:42:56 +0000 (13:42 +0200)]
mising: add __NR_memfd_create syscall number for s390

7 years agobuild-sys: properly quote m4 macro arguments in CC_CHECK_FLAGS_APPEND
Filipe Brandenburger [Tue, 22 Sep 2015 16:41:32 +0000 (09:41 -0700)]
build-sys: properly quote m4 macro arguments in CC_CHECK_FLAGS_APPEND

The variables should be quoted inside [...] to avoid double macro
expansion.  This is currently not an issue, since the values (-W...) are
not really macros, but we might as well just fix that issue now.

Tested by re-running autogen.sh and comparing the value of OUR_CFLAGS in
the generated Makefile.  Ran a full build from a clean tree to confirm
no other issues were introduced.

7 years agomount: propagate error codes correctly
David Herrmann [Mon, 21 Sep 2015 17:59:07 +0000 (19:59 +0200)]
mount: propagate error codes correctly

Make sure to propagate error codes from mount-loops correctly. Right now,
we return the return-code of the first mount that did _something_. This is
not what we want. Make sure we return an error if _any_ mount fails (and
then make sure to return the first error to not hide proper errors due to
consequential errors like -ENOTDIR).

Reported by cee1 <fykcee1@gmail.com>.

7 years agoutil: clean-ups to enum parsers
Lennart Poettering [Fri, 18 Sep 2015 22:50:34 +0000 (00:50 +0200)]
util: clean-ups to enum parsers

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.

7 years agoutil: minor cleanups for loop_read() and friends
Lennart Poettering [Fri, 18 Sep 2015 22:47:08 +0000 (00:47 +0200)]
util: minor cleanups for loop_read() and friends

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.

7 years agopam: elogind-user - call selinux module
Kay Sievers [Thu, 17 Sep 2015 15:15:28 +0000 (17:15 +0200)]
pam: elogind-user - call selinux module

https://bugzilla.redhat.com/show_bug.cgi?id=1262933

7 years agosd-id128: make size constraints a bit more obvious
Lennart Poettering [Wed, 16 Sep 2015 23:22:10 +0000 (01:22 +0200)]
sd-id128: make size constraints a bit more obvious

7 years agosd-bus: correct size calculation in DBus fd receive
Michal Schmidt [Wed, 16 Sep 2015 20:55:02 +0000 (22:55 +0200)]
sd-bus: correct size calculation in DBus fd receive

The size of the allocated array for received file descriptors was
incorrectly calculated. This did not matter when a single file
descriptor was received, but for more descriptors the allocation was
insufficient.

7 years agoAdd fallback for kcmp() in case __NR_kcmp is undefined
Mike Gilbert [Mon, 14 Sep 2015 22:55:09 +0000 (18:55 -0400)]
Add fallback for kcmp() in case __NR_kcmp is undefined

IA64 is missing this syscall as of linux-4.2.
This works around it until the necessary kernel patch gets merged.

7 years agoAdd Galician language to LINGUAS file
Fran Dieguez [Mon, 14 Sep 2015 22:20:51 +0000 (00:20 +0200)]
Add Galician language to LINGUAS file

7 years agobasic: make sure argument of ELEMENTSOF is an array
Michal Schmidt [Mon, 14 Sep 2015 18:32:17 +0000 (20:32 +0200)]
basic: make sure argument of ELEMENTSOF is an array

Using ELEMENTSOF on a pointer will result in a compilation error.

7 years agobasic: nicer assert messages
Michal Schmidt [Mon, 14 Sep 2015 13:53:36 +0000 (15:53 +0200)]
basic: nicer assert messages

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)

7 years agologinctl: print nontrivial properties in logictl show-*
Lukas Nykryn [Fri, 11 Sep 2015 11:37:59 +0000 (13:37 +0200)]
loginctl: print nontrivial properties in logictl show-*

7 years agologin: support more than just power-gpio-key
doubleodoug [Thu, 10 Sep 2015 02:00:26 +0000 (22:00 -0400)]
login: support more than just power-gpio-key

Adding additional keys prevents this gpio-keys powerswitch from working,
e.g. this wouldn't poweroff:

button@23 {
    label = "power-switch";
    linux,code = <116>;
    gpios = <&gpio 23 1>;
};
button@25 {
    label = "KEY_A";
    linux,code = <30>;
    gpios = <&gpio 25 1>;
};

Changing ATTRS{keys}=="116" to ATTRS{keys}=="*116*" makes the
power-switch and the A key both work properly.

(David: rephrase and merge-commits)

7 years agosd-bus: drop weird empty lines
David Herrmann [Wed, 9 Sep 2015 12:57:04 +0000 (14:57 +0200)]
sd-bus: drop weird empty lines

We should never put empty lines between `if` and `else if`, unless we use
braces.

7 years agotree-wide: drop redundant if checks before safe_close()
Lennart Poettering [Tue, 8 Sep 2015 16:58:28 +0000 (18:58 +0200)]
tree-wide: drop redundant if checks before safe_close()

Replace this:

        if (fd >= 0)
                safe_close(fd);

by this:

        safe_close(fd);

7 years agotree-wide: make more code use safe_close()
Lennart Poettering [Tue, 8 Sep 2015 16:53:19 +0000 (18:53 +0200)]
tree-wide: make more code use safe_close()

Replace this:

        close(fd);
        fd = -1;

write this:

        fd = safe_close(fd);

7 years agosd_pid_notify_with_fds: fix computing msg_controllen
Maciej Wereski [Tue, 8 Sep 2015 13:36:30 +0000 (15:36 +0200)]
sd_pid_notify_with_fds: fix computing msg_controllen

CMSG_SPACE(0) may return value other than 0. This caused sendmsg to fail
with EINVAL, when have_pid or n_fds was 0.

7 years agosmack: bugfix the smack label of symlink when '--with-smack-run-label' is set
Sangjung Woo [Tue, 8 Sep 2015 06:09:40 +0000 (15:09 +0900)]
smack: bugfix the smack label of symlink when '--with-smack-run-label' is set

Even though elogind has its own smack label since
'--with-smack-run-label' configuration is set, the smack label of each
CGROUP root directory should have the star (i.e. *) label. This is
mainly because current Linux Kernel set the label in this way.
(Refer to smack_d_instantiate() in security/smack/smack_lsm.c)

However, if elogind has its own smack label and arg_join_controllers is
explicitly set or initialized by initialize_join_controllers() function,
current elogind creates the symlink in CGROUP root directory with its
own smack label as below.

lrwxrwxrwx. 1 root root System  11 Dec 31 16:00 cpu -> cpu,cpuacct
dr-xr-xr-x. 4 root root *        0 Dec 31 16:01 cpu,cpuacct
lrwxrwxrwx. 1 root root System  11 Dec 31 16:00 cpuacct -> cpu,cpuacct

This patch fixes that bug by copying the smack label from the origin.

7 years agosmack: introduce new mac_smack_copy() function
Sangjung Woo [Tue, 8 Sep 2015 05:58:22 +0000 (14:58 +0900)]
smack: introduce new mac_smack_copy() function

This adds a new mac_smack_copy() function in order to read the smack
label from the source and apply it to the destination.

7 years agosd-daemon: fix sd_is_mq for non-mq fds
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2015 13:20:15 +0000 (15:20 +0200)]
sd-daemon: fix sd_is_mq for non-mq fds

mq_getattr returns -1/EBADF for file descriptors which are not mq.
But we should return 0 in this case.

We first check that fd is a valid fd, so we can assume that if
mq_getattr returns EBADF, it is simply a non-mq fd. There is a slight
race, but there doesn't seem to be a nice way to fix it.

7 years agosd-login: rework error handling
Lennart Poettering [Fri, 4 Sep 2015 07:05:52 +0000 (09:05 +0200)]
sd-login: rework error handling

Makre sure we always return sensible errors for the various, following
the same rules, and document them in a comment in sd-login.c. Also,
update all relevant man pages accordingly.

7 years agologind: Listen to WMI hotkeys to catch SW_DOCK state/events
Martin Pitt [Tue, 1 Sep 2015 08:51:15 +0000 (10:51 +0200)]
logind: Listen to WMI hotkeys to catch SW_DOCK state/events

On Dell and HP laptops the dock state/events (SW_DOCK) come from the "{Dell,HP}
WMI hotkeys" input devices. Tag them as power-switch so that login actually
considers them. Use a general match in case this affects other vendors, too.

Thanks to Andreas Schultz for debugging this!

https://launchpad.net/bugs/1450009

7 years agosd-login: improve error handling
Lennart Poettering [Mon, 31 Aug 2015 22:40:20 +0000 (00:40 +0200)]
sd-login: improve error handling

let's return ENXIO whenever we don't know something rather than ENOENT.

ENOENT suggests this was really about a file or directory, while ENXIO
is a more generic "not found" indicator.

7 years agopager: set $LESSCHARSET when we output UTF8 chars
Lennart Poettering [Fri, 28 Aug 2015 16:17:14 +0000 (18:17 +0200)]
pager: set $LESSCHARSET when we output UTF8 chars

This way we can be sure that less has the same idea of the terminal as
we do.

This solves issues in systems that have locale uninitalized, where
elogind would output UTF-8 but less wouldn't allow it and show them as
control characters.

7 years agopager: also redirect stderr
Lennart Poettering [Thu, 27 Aug 2015 22:13:34 +0000 (00:13 +0200)]
pager: also redirect stderr

It's really confusing if stdout goes to the pager, but stderr is written
directly to the screen. Hence, make sure both stdout and stderr are
passed to the pager when doing autopaging.

7 years agologind: add standard gpio power button support
Kefeng Wang [Mon, 3 Aug 2015 01:55:07 +0000 (09:55 +0800)]
logind: add standard gpio power button support

Many boards like hisilicon D02 board use standard gpio key to power down system.
A description of gpio-key in dts shown below,

gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;

pwrbutton {
label = "Power Button";
gpios = <&porta 8 1>;
linux,code = <116>;  // KEY_POWER, used by SC System Power Down
};
};

-bash-4.3# udevadm info -a /dev/input/event3

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/platform/gpio_keys/input/input3/event3':
    KERNEL=="event3"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device '/devices/platform/gpio_keys/input/input3':
    KERNELS=="input3"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{name}=="gpio_keys"
    ATTRS{phys}=="gpio-keys/input0"
    ATTRS{uniq}==""
    ATTRS{properties}=="0"

  looking at parent device '/devices/platform/gpio_keys':
    KERNELS=="gpio_keys"
    SUBSYSTEMS=="platform"
    DRIVERS=="gpio-keys"
    ATTRS{keys}=="116"
    ATTRS{switches}==""
    ATTRS{driver_override}=="(null)"
    ATTRS{disabled_keys}==""
    ATTRS{disabled_switches}==""

  looking at parent device '/devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""

7 years agoVersion bump to v226.5 v226.5
Sven Eden [Wed, 29 Mar 2017 08:33:45 +0000 (10:33 +0200)]
Version bump to v226.5

8 years agoinclude sys/sysmacros.h in more places
Mike Frysinger [Mon, 14 Mar 2016 21:44:49 +0000 (17:44 -0400)]
include sys/sysmacros.h in more places

    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.

7 years agoVersion bump to 226.4 v226.4
Sven Eden [Tue, 21 Mar 2017 07:49:30 +0000 (08:49 +0100)]
Version bump to 226.4

7 years agoMerge pull request #3 from elogind/dev_v226-r1
Sven Eden [Tue, 21 Mar 2017 07:44:38 +0000 (08:44 +0100)]
Merge pull request #3 from elogind/dev_v226-r1

Full upgrade path via upstream to v226

7 years agobasic/musl_missing.h : __compar_fn_t was defined twice - fixed.
Sven Eden [Fri, 17 Mar 2017 15:37:52 +0000 (16:37 +0100)]
basic/musl_missing.h : __compar_fn_t was defined twice - fixed.

7 years agoVersion bump to 226.3
Sven Eden [Tue, 14 Mar 2017 11:13:14 +0000 (12:13 +0100)]
Version bump to 226.3

7 years agoRename ELOGIND_CGROUP_CONTROLLER back to SYSTEMD_CGROUP_CONTROLLER
Sven Eden [Tue, 14 Mar 2017 10:56:01 +0000 (11:56 +0100)]
Rename ELOGIND_CGROUP_CONTROLLER back to SYSTEMD_CGROUP_CONTROLLER

Although it is nice to have it read ELOGIND instead of SYSTEMD, all
diffs just show too many irrelevant (false) positives.

7 years agoMajor cleanup of all leftovers after rebasing on master.
Sven Eden [Tue, 14 Mar 2017 10:30:17 +0000 (11:30 +0100)]
Major cleanup of all leftovers after rebasing on 

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.

7 years agoUnifiy free() usage
Sven Eden [Mon, 13 Mar 2017 08:20:24 +0000 (09:20 +0100)]
Unifiy free() usage

This commit substitutes all occurrences of
        free(foo);
        foo = NULL;
with
        foo = mfree(foo);

7 years agoFix bug that program_invocation_name is NULL when backgrounding
Sven Eden [Sun, 12 Mar 2017 11:34:34 +0000 (12:34 +0100)]
Fix bug that program_invocation_name is NULL when backgrounding

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.

7 years agoAdd mounting of a name=elogind cgroup if no init controller is found.
Sven Eden [Fri, 10 Mar 2017 07:33:22 +0000 (08:33 +0100)]
Add mounting of a name=elogind cgroup if no init controller is found.

This is done for systems, which init systems are no cgroup
controllers. One example is runit on Void Linux.

7 years agoAdd support for building elogind against musl libc
Sven Eden [Tue, 7 Mar 2017 09:29:34 +0000 (10:29 +0100)]
Add support for building elogind against musl libc

* 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.

7 years agoFixed gawk script for git-tar target.
Sven Eden [Thu, 23 Feb 2017 16:20:49 +0000 (17:20 +0100)]
Fixed gawk script for git-tar target.

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.

7 years agoMakefile.am: Add a git-tar target, that removes all elogind masks from the sources...
Sven Eden [Wed, 22 Feb 2017 14:13:33 +0000 (15:13 +0100)]
Makefile.am: Add a git-tar target, that removes all elogind masks from the sources before packing the tar.

7 years agoconfigure.ac: Do not allow -Werror in gperf length test.
Sven Eden [Wed, 22 Feb 2017 08:19:22 +0000 (09:19 +0100)]
configure.ac: Do not allow -Werror in gperf length test.

7 years agoRemove (non.existent) support for logging to journald.
Sven Eden [Tue, 21 Feb 2017 22:16:29 +0000 (23:16 +0100)]
Remove (non.existent) support for logging to journald.

7 years agoCleaned up more unneeded functions and types in:
Sven Eden [Tue, 21 Feb 2017 18:16:19 +0000 (19:16 +0100)]
Cleaned up more unneeded functions and types in:

- 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

7 years agoelogind_cgroup_agent registers as elogind.Agent, not systemd1.Agent.
Sven Eden [Tue, 21 Feb 2017 18:15:20 +0000 (19:15 +0100)]
elogind_cgroup_agent registers as elogind.Agent, not systemd1.Agent.

7 years agoVersion bump to 226.2
Sven Eden [Mon, 20 Feb 2017 21:31:53 +0000 (22:31 +0100)]
Version bump to 226.2

7 years agoUpdated man pages.
Sven Eden [Tue, 21 Feb 2017 06:54:50 +0000 (07:54 +0100)]
Updated man pages.

7 years agoCleaned up more unneeded types and functions.
Sven Eden [Mon, 20 Feb 2017 16:13:50 +0000 (17:13 +0100)]
Cleaned up more unneeded types and functions.

- 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

7 years agoFix libelogind.pc.in
Sven Eden [Mon, 20 Feb 2017 21:13:35 +0000 (22:13 +0100)]
Fix libelogind.pc.in

7 years agoVersion bump to 226.1
Sven Eden [Mon, 20 Feb 2017 08:08:41 +0000 (09:08 +0100)]
Version bump to 226.1

7 years agouser_start_slice() : The slice name must end with .slice:
Sven Eden [Mon, 20 Feb 2017 07:27:13 +0000 (08:27 +0100)]
user_start_slice() : The slice name must end with .slice:

7 years agocg_shift_path(): Do not shift if cgroup and root are equal
Sven Eden [Mon, 20 Feb 2017 07:26:32 +0000 (08:26 +0100)]
cg_shift_path(): Do not shift if cgroup and root are equal

7 years agoAdd --enable-debug=elogind configure option and fix cgroup path
Sven Eden [Mon, 20 Feb 2017 04:57:50 +0000 (05:57 +0100)]
Add --enable-debug=elogind configure option and fix cgroup path

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".

7 years agoMakefile.am: Fixed paths and cleaned up unneeded values.
Sven Eden [Thu, 16 Feb 2017 15:46:53 +0000 (16:46 +0100)]
Makefile.am: Fixed paths and cleaned up unneeded values.

7 years agoAllow NULL session parameter for manager_get_session_by_pid()
Sven Eden [Thu, 16 Feb 2017 07:16:57 +0000 (08:16 +0100)]
Allow NULL session parameter for manager_get_session_by_pid()

The reason is, that method_create_session() calls that function to
detect whether there is already a running session.

7 years agoDetect running cgroup controller.
Sven Eden [Thu, 16 Feb 2017 05:16:10 +0000 (06:16 +0100)]
Detect running cgroup controller.

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...)

7 years agoEmit PrepareForSleep when resuming and clear pending action after resume from delayed...
Sven Eden [Fri, 10 Feb 2017 13:14:29 +0000 (14:14 +0100)]
Emit PrepareForSleep when resuming and clear pending action after resume from delayed sleep.

7 years agoClassify processes from sessions into cgroups
Sven Eden [Fri, 10 Feb 2017 13:09:39 +0000 (14:09 +0100)]
Classify processes from sessions into cgroups

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.

7 years agoUpdate README
Sven Eden [Wed, 8 Feb 2017 06:57:09 +0000 (07:57 +0100)]
Update README

7 years agoStop sessions on ReleaseSession
Sven Eden [Wed, 8 Feb 2017 06:50:07 +0000 (07:50 +0100)]
Stop sessions on ReleaseSession

7 years agoPKTTYAGENT make variable
Sven Eden [Tue, 7 Feb 2017 08:56:44 +0000 (09:56 +0100)]
PKTTYAGENT make variable

* Makefile.am (PKTTYAGENT): Define as a variable so that users can make
  PKTTYAGENT=/whatever to select a specific pkttyagent path.

7 years agolibbasic_la_LDFLAGS : Add CAP_LDFLAGS.
Sven Eden [Tue, 7 Feb 2017 07:22:53 +0000 (08:22 +0100)]
libbasic_la_LDFLAGS : Add CAP_LDFLAGS.

7 years agoUninstall the cgroup release agent when the manager is shut down.
Sven Eden [Tue, 7 Feb 2017 06:26:17 +0000 (07:26 +0100)]
Uninstall the cgroup release agent when the manager is shut down.

7 years agoRemove src/basic/special.h, as all defines in there are systemd-only.
Sven Eden [Tue, 7 Feb 2017 05:50:04 +0000 (06:50 +0100)]
Remove src/basic/special.h, as all defines in there are systemd-only.

7 years agoAdd poweroff, suspend etc. loginctl commands
Sven Eden [Mon, 6 Feb 2017 06:28:54 +0000 (07:28 +0100)]
Add poweroff, suspend etc. loginctl commands

* 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.

7 years agoIncorporate sleep.conf into logind.conf
Sven Eden [Thu, 2 Feb 2017 08:10:41 +0000 (09:10 +0100)]
Incorporate sleep.conf into logind.conf

* src/login/logind-action.c (shutdown_or_sleep, do_sleep): Take modes
  from the manager instead of parsing them ourselves.

* src/login/logind-dbus.c (execute_shutdown_or_sleep): Adapt to
  shutdown_or_sleep prototype change.

* src/login/logind-gperf.gperf: Add config items from sleep.conf.
* src/login/logind.c (manager_new): Wire up defaults for new config
  items.
  (manager_free): Free new config items.
  (manager_parse_config_file): Arrange to parse a single
  elogind/logind.conf file, not grovelling all over the filesystem.
  Take the file from the ELOGIND_CONF_FILE environment variable if
  present.