Commit graph

48 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 0ef14adc1c Rewrite sd_machine_get_ifindices() to avoid FOREACH_WORD()
If we fail to parse the index, the failure is propogated as -EUNCLEAN.
(-EINVAL would be confused with invalid args to the function itself.)
2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek aa3b40c3f9 Fix output value of sd_seat_get_sessions() and drop FOREACH_WORD use
sd_seat_get_sessions() would return 0 in the 'n_uids' (now 'ret_n_uids') output
parameter when 'uid' (now 'ret_uids') was passed as NULL.

While at it, drop FOREACH_WORD() use.

Also use any whitespace as separator. In practice this shouldn't matter, since
logind always uses spaces, but it seems nicer to not specify this explicitly,
and the default is more flexible.
2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek 8f8cc84ba4 sd-login: get rid of seat_can_multi_session()
Follow-up for fa2cf64a91.
Backwards-compat is retained. A short note is added in docs, in case
people see sd_seat_can_multi_session() mentioned somewhere and wonder what
happened to it.

Also see https://github.com/systemd/systemd/pull/15337#issuecomment-610369404.
2020-04-17 16:15:30 +02:00
Yu Watanabe 1e089bf805 tree-wide: drop empty lines in the begining of comments 2018-06-29 10:50:23 +09:00
Lennart Poettering 0c69794138 tree-wide: remove Lennart's copyright lines
These lines are generally out-of-date, incomplete and unnecessary. With
SPDX and git repository much more accurate and fine grained information
about licensing and authorship is available, hence let's drop the
per-file copyright notice. Of course, removing copyright lines of others
is problematic, hence this commit only removes my own lines and leaves
all others untouched. It might be nicer if sooner or later those could
go away too, making git the only and accurate source of authorship
information.
2018-06-14 10:20:20 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Zbigniew Jędrzejewski-Szmek 53e1b68390 Add SPDX license identifiers to source files under the LGPL
This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
2017-11-19 19:08:15 +01:00
Zbigniew Jędrzejewski-Szmek ee7dca21f7 Typo 2016-02-11 21:52:02 -05:00
Daniel Mack b26fa1a2fb tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
2016-02-10 13:41:57 +01:00
Lennart Poettering 4afd3348c7 tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
GLIB has recently started to officially support the gcc cleanup
attribute in its public API, hence let's do the same for our APIs.

With this patch we'll define an xyz_unrefp() call for each public
xyz_unref() call, to make it easy to use inside a
__attribute__((cleanup())) expression. Then, all code is ported over to
make use of this.

The new calls are also documented in the man pages, with examples how to
use them (well, I only added docs where the _unref() call itself already
had docs, and the examples, only cover sd_bus_unrefp() and
sd_event_unrefp()).

This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we
tend to call our destructors these days.

Note that this defines no public macro that wraps gcc's attribute and
makes it easier to use. While I think it's our duty in the library to
make our stuff easy to use, I figure it's not our duty to make gcc's own
features easy to use on its own. Most likely, client code which wants to
make use of this should define its own:

       #define _cleanup_(function) __attribute__((cleanup(function)))

Or similar, to make the gcc feature easier to use.

Making this logic public has the benefit that we can remove three header
files whose only purpose was to define these functions internally.

See #2008.
2015-11-27 19:19:36 +01:00
Thomas Hindoe Paaboel Andersen 71d35b6b55 tree-wide: sort includes in *.h
This is a continuation of the previous include sort patch, which
only sorted for .c files.
2015-11-18 23:09:02 +01:00
Lennart Poettering a67c56bff4 sd-login: minor header commenting improvements 2015-09-05 14:56:23 +02:00
Lennart Poettering f5aaf57562 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.
2015-09-05 14:56:23 +02:00
Lennart Poettering 329ac4bc54 sd-bus,sd-login: add api for querying the slice within the the user systemd instance of a process
units are organized in slice trees, not only for the system instance,
but also for user systemd instances, expose this properly.
2015-04-30 11:58:06 +02:00
Torstein Husebø f7340ab269 treewide: correct spacing near eol in code comments 2014-12-11 15:10:03 +01:00
Lennart Poettering 090771492f sd-login: let's not needlessly yell at users
While GNOME/KDE are generally capitalized, systemd tools generally are
not, hence let's not start doing so in the XDG_CURRENT_SESSION
environment variable.
2014-10-28 12:31:11 +01:00
David Herrmann c72d5456e2 login: add public sd_session_get_desktop() API
The desktop brand is stored as DESKTOP variable for sessions. It can be
set arbitrarily by the session owner and identifies the desktop
environment that is running on that session.
2014-09-22 14:27:02 +02:00
Lennart Poettering 634af5665f sd-login: always use "indices" as plural of "index"
So far both "indexes" and "indices" was used. Let's clean this up, and
stick to indices, since it appears to be used more frequently.
2014-07-17 01:48:40 +02:00
Lennart Poettering cabb0bc6b1 nss-mymachines: add new NSS module for automatically resolving addresses of all local containers 2014-07-11 03:15:21 +02:00
Lennart Poettering a077b666cb sd-login: add C API to query primary session of a user 2014-05-19 09:33:20 +09:00
David Herrmann 9541666b8d login: add 'mir' to the list of session types
Add Mir to the list of session types. This is implemented for LightDM
in lp:~robert-ancell/lightdm/xdg-session-desktop [1].

[1] https://code.launchpad.net/~robert-ancell/lightdm/xdg-session-desktop/+merge/214108

(david: adjusted commit-header and fixed whitespace issues)
2014-04-09 21:22:48 +02:00
Jason St. John 10b17992ee src/systemd: fix grammar and spelling errors in comments 2014-03-25 20:23:33 +01:00
Marc-Antoine Perennou e43e3e3eed libsystemd: Don't use "class" in public headers
For compatibility with C++
2014-03-24 20:36:57 +01:00
Lennart Poettering bf34ab149f sd-login: add calls that retrieve credentials of peers connected to AF_UNIX peers
This is supposed to be an extension of SO_PEERCRED and SO_PEERSEC,
except for cgroup information.
2014-03-17 18:15:57 +01:00
Lennart Poettering 0325941fff sd-login: add sd_machine_get_class() call 2014-03-12 20:54:29 +01:00
Mantas Mikulėnas 5b04fe6000 libsystemd-login: add sd_session_get_remote_{host, user} 2013-12-21 22:02:57 -05:00
Lennart Poettering 0095c45415 api: replace manual C++ guards by macros 2013-11-07 16:53:26 +01:00
Bastien Nocera 5f34246c75 sd-login: Fix typo
s/sessio,/session,/
2013-11-02 15:54:02 -04:00
Giovanni Campagna 44ded3abc2 sd-login: add a public accessor for the VT number
The VT number was already part of the DBus API, but was not
exposed in the C API.
2013-09-11 19:08:20 +02:00
Lennart Poettering 1021b21bc6 login: add an api to determine the slice a PID is located in to libsystemd-login 2013-06-21 01:46:27 +02:00
Lennart Poettering e10375f2c0 login: allow watching virtual machines with sd_get_machine_names() 2013-04-24 19:02:13 -03:00
Lennart Poettering a20affe2f0 login: add new call sd_get_machine_names() to get a list of current virtual machines and containers 2013-04-24 19:02:13 -03:00
Lennart Poettering 7027ff61a3 nspawn: introduce the new /machine/ tree in the cgroup tree and move containers there
Containers will now carry a label (normally derived from the root
directory name, but configurable by the user), and the container's root
cgroup is /machine/<label>. This label is called "machine name", and can
cover both containers and VMs (as soon as libvirt also makes use of
/machine/).

libsystemd-login can be used to query the machine name from a process.

This patch also includes numerous clean-ups for the cgroup code.
2013-04-16 04:41:21 +02:00
Lennart Poettering 97e1305817 sd-login: add a sd_pid_get_user_unit() call 2013-04-15 14:16:45 +02:00
Lennart Poettering 667c24a6a8 login: add sd_login_monitor_get_timeout() public api call
We don't need this right now, but we should keep our options open, in
case we need more than just an fd for waking up.
2013-04-04 18:31:22 +02:00
Lennart Poettering dace83cbd0 login: add new public API call sd_login_monitor_get_events() to get poll() flags to wait for
We should keep our options open, so that we can watch for POLLOUT later
on if we wish to. CUrrently this call will always return POLLIN however.
2013-04-04 17:38:08 +02:00
Lennart Poettering c84f5e4a82 login: introduce sd_session_get_tty() 2013-01-15 03:01:35 +01:00
Lennart Poettering cb07866b1b man: move header file man pages from section 7 to 3
This way we can include documentation about minor macros/inline function
within the introducionary man page in a sane way.
2012-07-13 01:50:05 +02:00
Lennart Poettering 20747498c6 login: wrap CanTTY and CanGraphical seat attributes in libsystemd-login 2012-06-21 16:52:54 +02:00
Lennart Poettering 0604381b9d logind: introduce a state for session, being one of online, active, closing
online = logged in
active = logged in and session is in the fg
closing = nominally logged out but some left-over processes still around

Related to:

https://bugzilla.gnome.org/show_bug.cgi?id=677556
2012-06-21 16:14:53 +02:00
Lennart Poettering ee1f44bd9a sd-login: update header docs a bit 2012-05-14 22:41:30 +02:00
Lennart Poettering 5430f7f2bc relicense to LGPLv2.1 (with exceptions)
We finally got the OK from all contributors with non-trivial commits to
relicense systemd from GPL2+ to LGPL2.1+.

Some udev bits continue to be GPL2+ for now, but we are looking into
relicensing them too, to allow free copy/paste of all code within
systemd.

The bits that used to be MIT continue to be MIT.

The big benefit of the relicensing is that closed source code may now
link against libsystemd-login.so and friends.
2012-04-12 00:24:39 +02:00
Lennart Poettering e09a9a35a1 sd-login: c++ compatibility 2012-03-05 15:16:10 +01:00
Lennart Poettering fc8af9ff3f login: introduce sd_session_get_display() 2012-02-15 04:56:10 +01:00
Lennart Poettering 51f58f083a login: add new sd_session_get_type() and sd_session_get_class API calls 2012-02-14 21:54:00 +01:00
Lennart Poettering f987397649 api: add C++ guards to all headers 2012-01-13 00:49:21 +01:00
Lennart Poettering eff406331a login: implement sd_session_get_service() 2012-01-05 23:14:22 +01:00
Lennart Poettering 81527be142 build-sys: move public header files into a dir of their own 2012-01-05 16:01:58 +01:00
Renamed from src/login/sd-login.h (Browse further)