2
.\" Title: sd_seat_get_active
3
.\" Author: Lennart Poettering <lennart@poettering.net>
4
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
6
.\" Manual: sd_seat_get_active
10
.TH "SD_SEAT_GET_ACTIVE" "3" "03/16/2012" "systemd" "sd_seat_get_active"
11
.\" -----------------------------------------------------------------
12
.\" * Define some portability stuff
13
.\" -----------------------------------------------------------------
14
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
.\" http://bugs.debian.org/507673
16
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20
.\" -----------------------------------------------------------------
21
.\" * set default formatting
22
.\" -----------------------------------------------------------------
23
.\" disable hyphenation
25
.\" disable justification (adjust text to left margin only)
27
.\" -----------------------------------------------------------------
28
.\" * MAIN CONTENT STARTS HERE *
29
.\" -----------------------------------------------------------------
31
sd_seat_get_active, sd_seat_get_sessions, sd_seat_can_multi_session \- Determine state of a specific seat
36
#include <systemd/sd\-login\&.h>
39
.HP \w'int\ sd_seat_get_active('u
40
.BI "int sd_seat_get_active(const\ char*\ " "seat" ", char**\ " "session" ", uid_t*\ " "uid" ");"
41
.HP \w'int\ sd_seat_get_sessions('u
42
.BI "int sd_seat_get_sessions(const\ char*\ " "seat" ", char***\ " "sessions" ", uid_t**\ " "uid" ", unsigned*\ " "n_uids" ");"
43
.HP \w'int\ sd_seat_can_multi_session('u
44
.BI "int sd_seat_can_multi_session(const\ char*\ " "seat" ");"
47
\fBsd_seat_get_active()\fR
48
may be used to determine which session is currently active on a seat, if there is any\&. Returns the session identifier and the user identifier of the Unix user the session is belonging to\&. Either the session or the user identifier parameter can be be passed NULL, in case only one of the parameters shall be queried\&. The returned string needs to be freed with the libc
52
\fBsd_seat_get_sessions()\fR
53
may be used to determine all sessions on the specified seat\&. Returns two arrays, one (NULL terminated) with the session identifiers of the sessions and one with the user identifiers of the Unix users the sessions belong to\&. An additional parameter may be used to return the number of entries in the latter array\&. The two arrays and the latter parameter may be passed as NULL in case these values need not to be determined\&. The arrays and the strings referenced by them need to be freed with the libc
55
call after use\&. Note that instead of an empty array NULL may be returned and should be considered equivalent to an empty array\&.
57
\fBsd_seat_can_multi_session()\fR
58
may be used to determine whether a specific seat is capable of multi\-session, i\&.e\&. allows multiple login sessions in parallel (whith only one being active at a time)\&.
62
parameter of any of these functions is passed as NULL the operation is executed for the seat of the session of the calling process, if there is any\&.
66
\fBsd_seat_get_active()\fR
67
return return 0 or a positive integer\&. On success
68
\fBsd_seat_get_sessions()\fR
69
returns the number of entries in the session identifier array\&. If the test succeeds
70
\fBsd_seat_can_multi_session\fR
71
returns a positive integer, if it fails 0\&. On failure, these calls return a negative errno\-style error code\&.
75
\fBsd_seat_get_active()\fR,
76
\fBsd_seat_get_sessions()\fR, and
77
\fBsd_seat_can_multi_session()\fR
78
interfaces are available as shared library, which can be compiled and linked to with the
87
\fBsd_session_get_seat\fR(3)
90
\fBLennart Poettering\fR <\&lennart@poettering\&.net\&>