Debian Codegraph @

upstream/debian-unstable/man3/sd_get_seats.3

raw
1 '\" t
2 .TH "SD_GET_SEATS" "3" "" "systemd 261~rc3" "sd_get_seats"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 sd_get_seats, sd_get_sessions, sd_get_uids, sd_get_machine_names \- Determine available seats, sessions, logged in users and virtual machines/containers
24 .SH "SYNOPSIS"
25 .sp
26 .ft B
27 .nf
28 #include <systemd/sd\-login\&.h>
29 .fi
30 .ft
31 .HP \w'int\ sd_get_seats('u
32 .BI "int sd_get_seats(char\ ***" "seats" ");"
33 .HP \w'int\ sd_get_sessions('u
34 .BI "int sd_get_sessions(char\ ***" "sessions" ");"
35 .HP \w'int\ sd_get_uids('u
36 .BI "int sd_get_uids(uid_t\ **" "users" ");"
37 .HP \w'int\ sd_get_machine_names('u
38 .BI "int sd_get_machine_names(char\ ***" "machines" ");"
39 .SH "DESCRIPTION"
40 .PP
41 \fBsd_get_seats()\fR
42 may be used to determine all currently available local seats\&. Returns the number of seat identifiers and if the input pointer is non\-\fBNULL\fR, a
43 \fBNULL\fR\-terminated array of seat identifiers is stored at the address\&. The returned array and all strings it references need to be freed with the libc
44 \fBfree\fR(3)
45 call after use\&. Note that instead of an empty array
46 \fBNULL\fR
47 may be returned and should be considered equivalent to an empty array\&.
48 .PP
49 Similarly,
50 \fBsd_get_sessions()\fR
51 may be used to determine all current login sessions\&.
52 .PP
53 Similarly,
54 \fBsd_get_uids()\fR
55 may be used to determine all Unix users who currently have login sessions\&.
56 .PP
57 Similarly,
58 \fBsd_get_machine_names()\fR
59 may be used to determine all current virtual machines and containers on the system\&.
60 .PP
61 Note that the returned lists are not sorted and in an undefined order\&.
62 .SH "RETURN VALUE"
63 .PP
64 On success,
65 \fBsd_get_seats()\fR,
66 \fBsd_get_sessions()\fR,
67 \fBsd_get_uids()\fR
68 and
69 \fBsd_get_machine_names()\fR
70 return the number of entries in the arrays\&. On failure, these calls return a negative errno\-style error code\&.
71 .SS "Errors"
72 .PP
73 Returned errors may indicate the following problems:
74 .PP
75 \fB\-ENOMEM\fR
76 .RS 4
77 Memory allocation failed\&.
78 .RE
79 .SH "NOTES"
80 .PP
81 Functions described here are available as a shared library, which can be compiled against and linked to with the
82 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
83 file\&.
84 .PP
85 The code described here uses
86 \fBgetenv\fR(3), which is declared to be not multi\-thread\-safe\&. This means that the code calling the functions described here must not call
87 \fBsetenv\fR(3)
88 from a parallel thread\&. It is recommended to only do calls to
89 \fBsetenv()\fR
90 from an early phase of the program when no other threads have been started\&.
91 .SH "HISTORY"
92 .PP
93 \fBsd_get_machine_names()\fR
94 was added in version 203\&.
95 .SH "SEE ALSO"
96 .PP
97 \fBsystemd\fR(1), \fBsd-login\fR(3), \fBsd_session_get_seat\fR(3)