chiark / gitweb /
4 years ago[Patch 3/3] Add cgroups initialization and handling
Sven Eden [Thu, 26 Jan 2017 07:30:04 +0000 (08:30 +0100)]
[Patch 3/3] Add cgroups initialization and handling

Let elogind setup cgroups support on its manager initialization and
free the cgroups subsystem when the manager is destroyed.

4 years ago[Patch 2/3] Add cgroups initialization and handling
Sven Eden [Thu, 26 Jan 2017 07:21:20 +0000 (08:21 +0100)]
[Patch 2/3] Add cgroups initialization and handling

Add a highly reduced src/core/cgroup.[hc] to enable elogind to setup
cgroups for proper usage.

4 years ago[Patch 1/3] Add cgroups initialization and handling
Sven Eden [Thu, 26 Jan 2017 07:14:54 +0000 (08:14 +0100)]
[Patch 1/3] Add cgroups initialization and handling

Re-add elogind-cgroups-agent. elogind will not be able to support the
new unified hierarchy, and the agent is needed for the classical

4 years agoCreate /run/systemd as needed
Sven Eden [Fri, 20 Jan 2017 16:14:35 +0000 (17:14 +0100)]
Create /run/systemd as needed

* src/login/logind.c (main): Also create /run/systemd at startup.
* Create /run/systemd/machines, so that the login monitor works.
* Fail if any of the needed directories could not be created.
* But do not fail if any of the needed directories exist.

4 years agoFix logind startup
Sven Eden [Fri, 20 Jan 2017 15:35:48 +0000 (16:35 +0100)]
Fix logind startup

* src/login/logind.c (manager_connect_bus):
  - Notice instead of error if we can't subscribe to updates from
    systemd. Perhaps we should remove this entirely. But leaving
    it optional means, that a system managed by systemd can use
    elogind substituting systemd-login.
  - Warn instead of error if we can't add receiver matches from
    systemd events. On a system not run by systemd, such events
    wouldn't occur anyway.

4 years agoRemove obsolete headers and the src/core directory.
Sven Eden [Fri, 20 Jan 2017 04:39:16 +0000 (05:39 +0100)]
Remove obsolete headers and the src/core directory.

4 years agoRemove librt dependency.
Sven Eden [Fri, 20 Jan 2017 03:58:34 +0000 (04:58 +0100)]
Remove librt dependency.

The only function still using librt was

But that function is not really needed, because elogind does not call
mq_open() anywhere, or any other mqueue related functions.

4 years agoRemove sd_is_mq
Sven Eden [Thu, 19 Jan 2017 13:05:12 +0000 (14:05 +0100)]
Remove sd_is_mq

* src/systemd/sd-daemon.h:
* src/libelogind/sd-daemon/sd-daemon.c (sd_is_mq): Remove unused
  function that depended on librt.  Ultimately we should remove this
  header at some point.

4 years agoFix man page building to be less systemd and more elogind.
Sven Eden [Thu, 19 Jan 2017 12:04:18 +0000 (13:04 +0100)]
Fix man page building to be less systemd and more elogind.

4 years agoRemove man/sd[-_]bus[-_]error*.xml files, as elogind does not provide a systemd dbus...
Sven Eden [Thu, 19 Jan 2017 07:22:21 +0000 (08:22 +0100)]
Remove man/sd[-_]bus[-_]error*.xml files, as elogind does not provide a systemd dbus interface to control.

4 years agoChange systemd occurences in factory/etc/pam.d to elogind.
Sven Eden [Thu, 19 Jan 2017 07:21:21 +0000 (08:21 +0100)]
Change systemd occurences in factory/etc/pam.d to elogind.

4 years agoFix pkginclude_HEADERS to what elogind needs and provides.
Sven Eden [Thu, 19 Jan 2017 07:19:25 +0000 (08:19 +0100)]
Fix pkginclude_HEADERS to what elogind needs and provides.

4 years agoRemove APPARMOR, BLKID and SECCOMP checks and feature.
Sven Eden [Tue, 17 Jan 2017 07:51:20 +0000 (08:51 +0100)]
Remove APPARMOR, BLKID and SECCOMP checks and feature.
Remove logind check, it is always built as elogind anyway.
Remove ENABLE_LOGIND conditional from man pages.

4 years agoRemove dbus checks, it isn't used anywhere.
Sven Eden [Tue, 17 Jan 2017 07:46:02 +0000 (08:46 +0100)]
Remove dbus checks, it isn't used anywhere.

4 years agoRemove unused and invalid udev definitions
Sven Eden [Tue, 17 Jan 2017 07:34:05 +0000 (08:34 +0100)]
Remove unused and invalid udev definitions

These definitions were not valid when compiling against eudev.

As a nice consequence, our own copies of any udev includes are no
longer needed and could be removed for good.

Add label.h include to logind.c, as "udev.h" is no longer available which would have done so otherwise.

4 years agoRemove libidn feature
Sven Eden [Mon, 16 Jan 2017 07:42:48 +0000 (08:42 +0100)]
Remove libidn feature

Sven Eden [Mon, 16 Jan 2017 06:50:35 +0000 (07:50 +0100)]
LZ4 and XZ features from build.h

4 years agoRemove rogue compat-libs checks
Sven Eden [Mon, 16 Jan 2017 06:47:49 +0000 (07:47 +0100)]
Remove rogue compat-libs checks

4 years agoFix lookup_errno by adding a gperf length parameter detection.
Sven Eden [Thu, 12 Jan 2017 08:28:02 +0000 (09:28 +0100)]
Fix lookup_errno by adding a gperf length parameter detection.

build-sys: add check for gperf lookup function signature (#5055)

gperf-3.1 generates lookup functions that take a size_t length
parameter instead of unsigned int. Test for this at configure time.


4 years agoRemove sd-path interface.
Sven Eden [Thu, 12 Jan 2017 10:13:58 +0000 (11:13 +0100)]
Remove sd-path interface.

4 years agoCleanup a bit more and disable -flto support.
Sven Eden [Thu, 12 Jan 2017 09:19:34 +0000 (10:19 +0100)]
Cleanup a bit more and disable -flto support.

4 years agoRemove kmod
Sven Eden [Thu, 12 Jan 2017 09:06:55 +0000 (10:06 +0100)]
Remove kmod

4 years agoRemove cgroups-agent, it is not really needed.
Sven Eden [Thu, 12 Jan 2017 09:03:46 +0000 (10:03 +0100)]
Remove cgroups-agent, it is not really needed.

4 years agoRemove python dependencies for dist, we only need it for
Sven Eden [Thu, 12 Jan 2017 08:40:43 +0000 (09:40 +0100)]
Remove python dependencies for dist, we only need it for

4 years agoRemove SysV compat
Sven Eden [Thu, 12 Jan 2017 08:34:38 +0000 (09:34 +0100)]
Remove SysV compat

4 years agoRemove DISTRO_PORTING and catalog/ files that have slithered back in.
Sven Eden [Tue, 10 Jan 2017 04:20:43 +0000 (05:20 +0100)]
Remove DISTRO_PORTING and catalog/ files that have slithered back in.

4 years agoRemove utmp stuff that has found it's way back in.
Sven Eden [Thu, 12 Jan 2017 08:27:29 +0000 (09:27 +0100)]
Remove utmp stuff that has found it's way back in.

4 years agoRemove tmpfiles.d
Sven Eden [Tue, 10 Jan 2017 04:31:13 +0000 (05:31 +0100)]
Remove tmpfiles.d

4 years agoPrep 4xx6: Fix logind_gperf_lookup declaration
Sven Eden [Tue, 10 Jan 2017 04:17:13 +0000 (05:17 +0100)]
Prep 4xx6: Fix logind_gperf_lookup declaration

4 years agoPrep v226: Mask all unneeded functions
Sven Eden [Mon, 9 Jan 2017 05:04:26 +0000 (06:04 +0100)]
Prep v226: Mask all unneeded functions

4 years agoPrep v226: loginctl.c: Fix call to (changed) cg_is_empty_recursive().
Sven Eden [Mon, 9 Jan 2017 05:18:16 +0000 (06:18 +0100)]
Prep v226: loginctl.c: Fix call to (changed) cg_is_empty_recursive().

4 years agoPrep v226: Fix some function prototypes in bus-util.h
Sven Eden [Mon, 9 Jan 2017 05:16:42 +0000 (06:16 +0100)]
Prep v226: Fix some function prototypes in bus-util.h

4 years agoPrep v226: Add src/basic/copy.[hc] to libbasic, the function copy_bytes() is needed...
Sven Eden [Mon, 9 Jan 2017 05:13:40 +0000 (06:13 +0100)]
Prep v226: Add src/basic/copy.[hc] to libbasic, the function copy_bytes() is needed by pager.c

4 years agoPrep v220: Fix src/basic/time-util.h, unmask timezone_is_valid, mask unneeded functions.
Sven Eden [Mon, 9 Jan 2017 04:58:48 +0000 (05:58 +0100)]
Prep v220: Fix src/basic/time-util.h, unmask timezone_is_valid, mask unneeded functions.

4 years agoPrep v226: Apply missing fixes and changes to src/shared
Sven Eden [Mon, 9 Jan 2017 04:53:02 +0000 (05:53 +0100)]
Prep v226: Apply missing fixes and changes to src/shared

4 years agoPrep v226: Apply missing fixes and changes to src/login
Sven Eden [Mon, 9 Jan 2017 04:53:01 +0000 (05:53 +0100)]
Prep v226: Apply missing fixes and changes to src/login

4 years agoPrep v226: Apply missing fixes and changes to src/libelogind
Sven Eden [Mon, 9 Jan 2017 04:53:01 +0000 (05:53 +0100)]
Prep v226: Apply missing fixes and changes to src/libelogind

4 years agoPrep v226: Apply missing fixes and changes to src/basic
Sven Eden [Mon, 9 Jan 2017 04:53:00 +0000 (05:53 +0100)]
Prep v226: Apply missing fixes and changes to src/basic

4 years agoPrep v226: Sync build files with upstream
Sven Eden [Thu, 5 Jan 2017 05:21:16 +0000 (06:21 +0100)]
Prep v226: Sync build files with upstream

4 years agosd-bus: when connecting to a container AF_UNIX bus, return error
Lennart Poettering [Mon, 7 Sep 2015 17:52:11 +0000 (19:52 +0200)]
sd-bus: when connecting to a container AF_UNIX bus, return error

When forking of a child process for connecting to a container, pass
the preicse connection error to the calling process.

We already did this correctly for kdbus busses, let's do so for dbus1
busses, too.

4 years agoUpdated Polish translation
Piotr Drąg [Sun, 6 Sep 2015 18:42:16 +0000 (20:42 +0200)]
Updated Polish translation

4 years agologind: make scope of wall message handling smaller
Lennart Poettering [Sat, 5 Sep 2015 18:24:08 +0000 (20:24 +0200)]
logind: make scope of wall message handling smaller

4 years agosd-bus: make introspection data non-recursive
David Herrmann [Sat, 5 Sep 2015 17:43:29 +0000 (19:43 +0200)]
sd-bus: make introspection data non-recursive

Currently, our introspection data looks like this:

         <interface name="org.freedesktop.DBus.Peer">
         <interface name="org.freedesktop.DBus.Introspectable">
         <interface name="org.freedesktop.DBus.Properties">
         <node name="org"/>
         <node name="org/freedesktop"/>
         <node name="org/freedesktop/login1"/>
         <node name="org/freedesktop/login1/user"/>
         <node name="org/freedesktop/login1/user/self"/>
         <node name="org/freedesktop/login1/user/_1000"/>
         <node name="org/freedesktop/login1/seat"/>
         <node name="org/freedesktop/login1/seat/self"/>
         <node name="org/freedesktop/login1/seat/seat0"/>
         <node name="org/freedesktop/login1/session"/>
         <node name="org/freedesktop/login1/session/self"/>
         <node name="org/freedesktop/login1/session/c1"/>

(ordered alphabetically for better visibility)

This is grossly incorrect. The spec says that we're allowed to return
non-directed children, however, it does not allow us to return data
recursively in multiple parents. If we return "org", then we must not
return anything else that starts with "org/".

It is unclear, whether we can include child-nodes as a tree. Moreover, it
is usually not what the caller wants. Hence, this patch changes sd-bus to
never return introspection data recursively. Instead, only a single
child-layer is returned.

This patch relies on enumerators to never return hierarchies. If someone
registers an enumerator via sd_bus_add_enumerator, they better register
sub-enumerators if they support *TRUE* hierarchies. Each enumerator is
treated as a single layer and not filtered.
Enumerators are still allowed to return nested data. However, that data
is still required to be a single hierarchy. For instance, returning
"/org/foo" and "/com/bar" is fine, but including "/com" or "/org" in that
dataset is not.
This should be the default for enumerators and I see no reason to filter
in sd-bus. Moreover, filtering that data-set would require to sort the
strv by path and then do prefix-filtering. This is O(n log n), which
would be fine, but still better to avoid.

Fixes #664.

4 years agosd-bus: derive uid from cgroup if possible
David Herrmann [Sat, 5 Sep 2015 15:54:30 +0000 (17:54 +0200)]
sd-bus: derive uid from cgroup if possible

Whenever we run in a user context, sd_bus_{default_user,open_user}() and
friends should always connect to the user-bus of the current context,
instead of deriving the uid from getuid(). This allows us running
programs via sudo/su, without the nasty side-effect of accidentally
connecting to the root user-bus.

This patch enforces the idea of making su/sudo *not* opening sessions by
default. That is, all they do is raising privileges, but keeping
everything set as before. You can still use su/sudo to open real sessions
by requesting a login-session (or loading pam_elogind otherwise).
However, in this case XDG_RUNTIME_DIR= will not be set (as usual in these
cases), hence, you will not be able to connect to *any* user-bus.

Long story short: With this patch applied, both:
        - ./busctl --user
        - sudo ./busctl --user
..will successfully connect to the user-bus of the local user.

Fixes #390.

4 years agologin: fix NULL-deref on wall_message
David Herrmann [Sat, 5 Sep 2015 10:56:04 +0000 (12:56 +0200)]
login: fix NULL-deref on wall_message

We treat an empty wall-message equal to a NULL wall-message since:

        commit 5744f59a3ee883ef3a78214bd5236157acdc35ba
        Author: Lennart Poettering <>
        Date:   Fri Sep 4 10:34:47 2015 +0200

            logind: treat an empty wall message like a NULL one

Fix the shutdown scheduler to not deref a NULL pointer, but properly
check for an empty wall-message.

Fixes: #1120

4 years agologind: when parsing a boolean via sd-bus the type must be "int"
Lennart Poettering [Fri, 4 Sep 2015 08:35:46 +0000 (10:35 +0200)]
logind: when parsing a boolean via sd-bus the type must be "int"

And not bool.

4 years agologind: treat an empty wall message like a NULL one
Lennart Poettering [Fri, 4 Sep 2015 08:34:47 +0000 (10:34 +0200)]
logind: treat an empty wall message like a NULL one

4 years agosd-login: minor header commenting improvements
Lennart Poettering [Fri, 4 Sep 2015 07:57:51 +0000 (09:57 +0200)]
sd-login: minor header commenting improvements

4 years agosd-login: add new sd_pid_get_cgroup() API
Lennart Poettering [Fri, 4 Sep 2015 07:54:14 +0000 (09:54 +0200)]
sd-login: add new sd_pid_get_cgroup() API

This adds a new sd_pid_get_cgroup() call to sd-login which may be used
to query the control path of a process. This is useful for programs when
making use of delegation units, in order to figure out which subtree has
been delegated.

In light of the unified control group hierarchy this is finally safe to
do, hence let's add a proper API for it, to make it easier to use this.

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

4 years agocgroup: when comparing agent paths, use path_equal()
Lennart Poettering [Thu, 3 Sep 2015 16:27:19 +0000 (18:27 +0200)]
cgroup: when comparing agent paths, use path_equal()

After all a path is a path is a path and we should use path_equal() to
comapre those.

4 years agoaudit: audit calls should return ENODATA when process are not in an audit session
Lennart Poettering [Thu, 3 Sep 2015 16:24:57 +0000 (18:24 +0200)]
audit: audit calls should return ENODATA when process are not in an audit session

ENODATA is how we usually indicate such "missing info" cases, so we
should do this here, too.

4 years agoutil: add new uid_is_valid() call
Lennart Poettering [Thu, 3 Sep 2015 11:29:53 +0000 (13:29 +0200)]
util: add new uid_is_valid() call

This simply factors out the uid validation checks from parse_uid() and
uses them everywhere. This simply verifies that the passed UID is
neither 64bit -1 nor 32bit -1.

4 years agosd-bus: when connecting to a container, don't fall back to host bus
Lennart Poettering [Tue, 1 Sep 2015 18:38:37 +0000 (20:38 +0200)]
sd-bus: when connecting to a container, don't fall back to host bus

We should never connect to the host bus as fallback if connecting to a
container failed via one method. Otherwise connecting to a dbus1
container will always result in a connection to the host.

4 years agosd-bus: when connecting to a kdbus container bus pass error up
Lennart Poettering [Tue, 1 Sep 2015 18:36:52 +0000 (20:36 +0200)]
sd-bus: when connecting to a kdbus container bus pass error up

We rely on the correct error used when opening the kdbus device node,
hence let's make sure we pass it up from the namespaced child process to
the process which actually wants to connect.

4 years agocgroup: don't allow hidden cgroups
Lennart Poettering [Tue, 1 Sep 2015 15:54:17 +0000 (17:54 +0200)]
cgroup: don't allow hidden cgroups

We really should care for all cgroups, and not allow hidden ones.

4 years agocgroup: never migrate kernel threads out of the root cgroup
Lennart Poettering [Tue, 1 Sep 2015 15:53:14 +0000 (17:53 +0200)]
cgroup: never migrate kernel threads out of the root cgroup

It won't work anyway.

4 years agoset: return NULL on destructors
Lennart Poettering [Tue, 1 Sep 2015 15:13:53 +0000 (17:13 +0200)]
set: return NULL on destructors

Like we do it pretty much everywhere else.

4 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!

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

4 years agologin: support user-bus on dbus1
David Herrmann [Mon, 31 Aug 2015 16:07:46 +0000 (18:07 +0200)]
login: support user-bus on dbus1

dbus-1.10 was just released, including systemd units to run
`dbus-daemon --session` as systemd user unit. This allows using a
user-bus with dbus1, just like we do per default with kdbus.

All the dbus libraries have already been fixed long ago to use the
user-bus as default. Hence, there's no need to set
DBUS_SESSION_BUS_ADDRESS= if we use the user-bus. However, gdm and
friends continue to spawn a session bus if this variable is not set
(instead of checking for the existence of the user-bus). Hence, we force
the user-bus, if it is available, in pam_elogind. Once gdm and friends
are fixed, we can continue to drop this again. However, that might take
a while.

With this in place, all that is needed to make the user-bus work is:
    `systemctl --global enable dbus.socket`

If dbus.socket is not enabled, the legacy session-bus is still used.

Based on a patch by: Jan Alexander Steffens <>

4 years agosd-event: improve debug message when we fail to remove and fd from an epoll
Lennart Poettering [Mon, 31 Aug 2015 11:07:24 +0000 (13:07 +0200)]
sd-event: improve debug message when we fail to remove and fd from an epoll

Let's help users to debug issues with epoll fd removal by printing the
name of the event source.

4 years agoextract_first_word: Refactor EXTRACT_DONT_COALESCE_SEPARATORS handling
Filipe Brandenburger [Mon, 31 Aug 2015 02:40:44 +0000 (19:40 -0700)]
extract_first_word: Refactor EXTRACT_DONT_COALESCE_SEPARATORS handling

Refactor allocation of the result string to the top, since it is
currently done in both branches of the condition.

Remove unreachable code checking for EXTRACT_DONT_COALESCE_SEPARATORS
when state == SEPARATOR (the only place where SEPARATOR is assigned to
state follows a check for EXTRACT_DONT_COALESCE_SEPARATORS that jumps to
the end of the function.)

Tested by running test-util successfully.

Follow up to: 206644aedeb8859801051ac170ec562c6a113a79

4 years agoextract_first_word: Refactor allocation in empty argument case
Filipe Brandenburger [Mon, 31 Aug 2015 02:16:50 +0000 (19:16 -0700)]
extract_first_word: Refactor allocation in empty argument case

This covers the case where an argument is an empty string, such as ''.

Instead of allocating the empty string in the individual conditions when
state == VALUE, just always allocate it at the end of state == START, at
which point we know we will have an argument.

Tested that test-util keeps passing after the refactor.

Follow up to: 14e685c29d5b317b815e3e9f056648027852b07e

4 years agopo: update Polish translation
Piotr Drąg [Sat, 29 Aug 2015 18:33:02 +0000 (20:33 +0200)]
po: update Polish translation

4 years agoutil: make malloc0 ask calloc for one block of size n
Thomas Hindoe Paaboel Andersen [Fri, 28 Aug 2015 19:16:39 +0000 (21:16 +0200)]
util: make malloc0 ask calloc for one block of size n

... instead of an array of n individual bytes.

Silences a lot of warnings in smatch.

4 years agoprocess-util: trivial optimization
Lennart Poettering [Fri, 28 Aug 2015 17:29:03 +0000 (19:29 +0200)]
process-util: trivial optimization

4 years agoutil: treat 'C' and 'POSIX' locale identical
Lennart Poettering [Fri, 28 Aug 2015 16:22:14 +0000 (18:22 +0200)]
util: treat 'C' and 'POSIX' locale identical

4 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
systemd would output UTF-8 but less wouldn't allow it and show them as
control characters.

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

4 years agocgroup-show: unescape cgroups on presentation
Lennart Poettering [Thu, 27 Aug 2015 22:12:38 +0000 (00:12 +0200)]
cgroup-show: unescape cgroups on presentation

Let's unescape cgroups on presentation, so that we show literal unit

4 years agopager: port fallback pager to use copy_bytes()
Lennart Poettering [Thu, 27 Aug 2015 22:11:49 +0000 (00:11 +0200)]
pager: port fallback pager to use copy_bytes()

4 years agosd-bus: it's not a user error to query the error contained in a bus message
Lennart Poettering [Thu, 27 Aug 2015 10:54:35 +0000 (12:54 +0200)]
sd-bus: it's not a user error to query the error contained in a bus message

It's an OK way to check whether a message contains an erro, let's not
consider this a loggable assertion event.

4 years agobasic: document that people shouldn't use refcnt.h without reason
Lennart Poettering [Wed, 26 Aug 2015 19:04:38 +0000 (21:04 +0200)]
basic: document that people shouldn't use refcnt.h without reason

refcnt.h only exists for cases where objects are simultaneously handled
by different threads. Otherwise it should not be used. The only case
where this applies is sd_bus, really, and pretty much none of our APIs,
since we do not claim thread-safety for them.

4 years agoPrep v225: Added needed udev support and re-enabled some masked cgroup functions.
Sven Eden [Wed, 4 Jan 2017 11:55:04 +0000 (12:55 +0100)]
Prep v225: Added needed udev support and re-enabled some masked cgroup functions.

4 years agoPrep v225: Applying various fixes and changes to src/systemd that got lost during...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/systemd that got lost during git am transfer.

4 years agoPrep v225: Applying various fixes and changes to src/shared that got lost during...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/shared that got lost during git am transfer.

4 years agoPrep v225: Applying various fixes and changes to src/login that got lost during git...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/login that got lost during git am transfer.

4 years agoPrep v225: Applying various fixes and changes to src/libelogind/sd-login that got...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/libelogind/sd-login that got lost during git am transfer.

4 years agoPrep v225: Applying various fixes and changes to src/libelogind/sd-event that got...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/libelogind/sd-event that got lost during git am transfer.

4 years agoPrep v225: Applying various fixes and changes to src/libelogind/sd-bus that got lost...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/libelogind/sd-bus that got lost during git am transfer.

4 years agoPrep v225: Applying various fixes and changes to src/cgroups-agent that got lost...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/cgroups-agent that got lost during git am transfer.

4 years agoPrep v225: Applying various fixes and changes to src/basic that got lost during git...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/basic that got lost during git am transfer.

4 years agoPrep v225: Regenerate
Sven Eden [Wed, 4 Jan 2017 05:39:53 +0000 (06:39 +0100)]
Prep v225: Regenerate

4 years agoPrep v225: Remove some orphaned files
Sven Eden [Wed, 4 Jan 2017 05:18:32 +0000 (06:18 +0100)]
Prep v225: Remove some orphaned files

4 years agoPrep v225: Sync build files with upstream
Sven Eden [Tue, 3 Jan 2017 11:52:57 +0000 (12:52 +0100)]
Prep v225: Sync build files with upstream

4 years agobus-util: make more properties settable in --property=
Lennart Poettering [Tue, 25 Aug 2015 16:39:50 +0000 (18:39 +0200)]
bus-util: make more properties settable in --property=

Add a couple of new properties to the supported set we can pass in
systemd-run's and systemd-nspawn's --property= switch.

4 years agosd-bus: don't list activators as proper peers
David Herrmann [Mon, 24 Aug 2015 11:41:03 +0000 (13:41 +0200)]
sd-bus: don't list activators as proper peers

If a connection passed KDBUS_HELLO_ACTIVATOR, it cannot do I/O on the
bus. Hence, we should not treat it as proper peer. To actually query it,
you have to explicitly ask for activators.

This makes kdbus in-line with what dbus-daemon does.

4 years agologind: get a fresh file descriptor to clean up a VT
Owen W. Taylor [Tue, 18 Aug 2015 19:19:05 +0000 (15:19 -0400)]
logind: get a fresh file descriptor to clean up a VT

When the controlling process exits, any existing file descriptors
for that FD will be marked as hung-up and ioctls on them will
file with EIO. To work around this, open a new file descriptor
for the VT we want to clean up.

Thanks to Ray Strode for help in sorting out the problem and
coming up with a fix!

4 years agologind: use open_terminal() instead of open()
Owen W. Taylor [Tue, 18 Aug 2015 18:41:24 +0000 (14:41 -0400)]
logind: use open_terminal() instead of open()

The open_terminal() function adds retries in case a terminal
is in the process of being closed when we open it, and should
generally be used to open a terminal. We especially need it
for code that a subsequent commit adds that reopens the terminal
at session shut-down time; such races would be more likely in
that case.

Found by Ray Strode.

4 years agoBug #944: Replacement of a free() call by mfree()
Markus Elfring [Mon, 17 Aug 2015 07:10:56 +0000 (09:10 +0200)]
Bug #944: Replacement of a free() call by mfree()

The function "mfree" should be called instead of "free" at a specific
source code place.

4 years agologind: actually fail on OOM
Thomas Hindoe Paaboel Andersen [Thu, 13 Aug 2015 21:36:08 +0000 (23:36 +0200)]
logind: actually fail on OOM

Since dacd6cee76a08331b8c8616c5f30f70ee49aa2f9 the two OOM's are
ignored as the value of r will be overwritten and we only log in
the fail section anyway.

This patch jumps to fail on OOM.

Note that this is different behavior compared to both the current
code and previous to dacd6cee76a08331b8c8616c5f30f70ee49aa2f9. Before
that commit we would log that saving the inhibit data failed, but
still write the file, though without the WHO/WHY section.

CID# 1313545

4 years agoCoverity #1299015
reverendhomer [Sat, 8 Aug 2015 06:49:39 +0000 (09:49 +0300)]
Coverity #1299015

bus can never be NULL due to assert

4 years agosd-daemon: return EBADF for invalid fd numbers
Zbigniew Jędrzejewski-Szmek [Fri, 7 Aug 2015 15:30:18 +0000 (11:30 -0400)]
sd-daemon: return EBADF for invalid fd numbers

This matches what open(2) and other system functions do.

4 years agosd-bus: ignore BLOOM_FILTER kdbus items
Lennart Poettering [Thu, 6 Aug 2015 12:48:33 +0000 (15:48 +0300)]
sd-bus: ignore BLOOM_FILTER kdbus items

The kernel nowadays sends these along, and that's OK, hence don't even
debug log about it, but completely ignore it.

4 years agoUse getxpid syscall on alpha for raw_getpid()
Matt Turner [Tue, 4 Aug 2015 21:47:01 +0000 (14:47 -0700)]
Use getxpid syscall on alpha for raw_getpid()

Alpha does not have a getpid syscall, but rather has getxpid to match

4 years agobasic: add LIST_INSERT_BEFORE
Alex Crawford [Tue, 4 Aug 2015 06:11:53 +0000 (23:11 -0700)]

Similar in function to LIST_INSERT_AFTER, this will insert a new element
into the list before the specified position. If the specified position
is NULL, the element is added as the tail of the list.

4 years agoterminal-util: no real reason to assert on O_CREAT
Lennart Poettering [Mon, 3 Aug 2015 17:06:01 +0000 (19:06 +0200)]
terminal-util: no real reason to assert on O_CREAT

That's just handle this as a normal error.

4 years agoterminal-util: when resetting terminals, don't wait for carrier
Lennart Poettering [Mon, 3 Aug 2015 17:04:08 +0000 (19:04 +0200)]
terminal-util: when resetting terminals, don't wait for carrier

In case of non-CLOCAL lines (i.e. those with carrier detect configured)
we shouldnt wait for a carrier if all we try to do is reset the TTY.
Hence, whenever we open such a TTY pass O_NONBLOCK.

Note that we continue to open ttys we intend to write to without
O_ONBLOCK, we only add it in cases we invoke ioctl()s or other terminal
operations without reading or writing to the device.

Fixes #835.

4 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':

  looking at parent device '/devices/platform/gpio_keys/input/input3':

  looking at parent device '/devices/platform/gpio_keys':

  looking at parent device '/devices/platform':