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.
This commit is contained in:
parent
4c3a31668e
commit
44ded3abc2
|
@ -854,6 +854,7 @@ MANPAGES_ALIAS += \
|
||||||
man/sd_session_get_tty.3 \
|
man/sd_session_get_tty.3 \
|
||||||
man/sd_session_get_type.3 \
|
man/sd_session_get_type.3 \
|
||||||
man/sd_session_get_uid.3 \
|
man/sd_session_get_uid.3 \
|
||||||
|
man/sd_session_get_vt.3 \
|
||||||
man/sd_uid_get_seats.3 \
|
man/sd_uid_get_seats.3 \
|
||||||
man/sd_uid_get_sessions.3 \
|
man/sd_uid_get_sessions.3 \
|
||||||
man/sd_uid_is_on_seat.3 \
|
man/sd_uid_is_on_seat.3 \
|
||||||
|
@ -882,6 +883,7 @@ man/sd_session_get_state.3: man/sd_session_is_active.3
|
||||||
man/sd_session_get_tty.3: man/sd_session_is_active.3
|
man/sd_session_get_tty.3: man/sd_session_is_active.3
|
||||||
man/sd_session_get_type.3: man/sd_session_is_active.3
|
man/sd_session_get_type.3: man/sd_session_is_active.3
|
||||||
man/sd_session_get_uid.3: man/sd_session_is_active.3
|
man/sd_session_get_uid.3: man/sd_session_is_active.3
|
||||||
|
man/sd_session_get_vt.3: man/sd_session_is_active.3
|
||||||
man/sd_uid_get_seats.3: man/sd_uid_get_state.3
|
man/sd_uid_get_seats.3: man/sd_uid_get_state.3
|
||||||
man/sd_uid_get_sessions.3: man/sd_uid_get_state.3
|
man/sd_uid_get_sessions.3: man/sd_uid_get_state.3
|
||||||
man/sd_uid_is_on_seat.3: man/sd_uid_get_state.3
|
man/sd_uid_is_on_seat.3: man/sd_uid_get_state.3
|
||||||
|
@ -958,6 +960,9 @@ man/sd_session_get_type.html: man/sd_session_is_active.html
|
||||||
man/sd_session_get_uid.html: man/sd_session_is_active.html
|
man/sd_session_get_uid.html: man/sd_session_is_active.html
|
||||||
$(html-alias)
|
$(html-alias)
|
||||||
|
|
||||||
|
man/sd_session_get_vt.html: man/sd_session_is_active.html
|
||||||
|
$(html-alias)
|
||||||
|
|
||||||
man/sd_uid_get_seats.html: man/sd_uid_get_state.html
|
man/sd_uid_get_seats.html: man/sd_uid_get_state.html
|
||||||
$(html-alias)
|
$(html-alias)
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
<refname>sd_session_get_class</refname>
|
<refname>sd_session_get_class</refname>
|
||||||
<refname>sd_session_get_display</refname>
|
<refname>sd_session_get_display</refname>
|
||||||
<refname>sd_session_get_tty</refname>
|
<refname>sd_session_get_tty</refname>
|
||||||
|
<refname>sd_session_get_vt</refname>
|
||||||
<refpurpose>Determine state of a specific session</refpurpose>
|
<refpurpose>Determine state of a specific session</refpurpose>
|
||||||
</refnamediv>
|
</refnamediv>
|
||||||
|
|
||||||
|
@ -111,6 +112,12 @@
|
||||||
<paramdef>const char* <parameter>session</parameter></paramdef>
|
<paramdef>const char* <parameter>session</parameter></paramdef>
|
||||||
<paramdef>char** <parameter>tty</parameter></paramdef>
|
<paramdef>char** <parameter>tty</parameter></paramdef>
|
||||||
</funcprototype>
|
</funcprototype>
|
||||||
|
|
||||||
|
<funcprototype>
|
||||||
|
<funcdef>int <function>sd_session_get_vt</function></funcdef>
|
||||||
|
<paramdef>const char* <parameter>session</parameter></paramdef>
|
||||||
|
<paramdef>unsigned* <parameter>vt</parameter></paramdef>
|
||||||
|
</funcprototype>
|
||||||
</funcsynopsis>
|
</funcsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
|
@ -202,6 +209,12 @@
|
||||||
<citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
<citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||||
call after use.</para>
|
call after use.</para>
|
||||||
|
|
||||||
|
<para><function>sd_session_get_vt()</function>
|
||||||
|
may be used to determine the VT number of the
|
||||||
|
session identified by the specified session
|
||||||
|
identifier. This function will return an error if
|
||||||
|
the seat does not support VTs.</para>
|
||||||
|
|
||||||
<para>If the <varname>session</varname> parameter of
|
<para>If the <varname>session</varname> parameter of
|
||||||
any of these functions is passed as
|
any of these functions is passed as
|
||||||
<constant>NULL</constant> the operation is executed
|
<constant>NULL</constant> the operation is executed
|
||||||
|
|
|
@ -80,3 +80,8 @@ LIBSYSTEMD_LOGIN_205 {
|
||||||
global:
|
global:
|
||||||
sd_pid_get_slice;
|
sd_pid_get_slice;
|
||||||
} LIBSYSTEMD_LOGIN_203;
|
} LIBSYSTEMD_LOGIN_203;
|
||||||
|
|
||||||
|
LIBSYSTEMD_LOGIN_207 {
|
||||||
|
global:
|
||||||
|
sd_session_get_vt;
|
||||||
|
} LIBSYSTEMD_LOGIN_205;
|
||||||
|
|
|
@ -347,6 +347,23 @@ _public_ int sd_session_get_tty(const char *session, char **tty) {
|
||||||
return session_get_string(session, "TTY", tty);
|
return session_get_string(session, "TTY", tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_public_ int sd_session_get_vt(const char *session, unsigned *vtnr) {
|
||||||
|
_cleanup_free_ char *vtnr_string;
|
||||||
|
unsigned u;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
r = session_get_string(session, "VTNr", &vtnr_string);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
r = safe_atou(vtnr_string, &u);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
*vtnr = u;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
_public_ int sd_session_get_service(const char *session, char **service) {
|
_public_ int sd_session_get_service(const char *session, char **service) {
|
||||||
return session_get_string(session, "SERVICE", service);
|
return session_get_string(session, "SERVICE", service);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,9 @@ int sd_session_get_display(const char *session, char **display);
|
||||||
/* Determine the TTY of this session. */
|
/* Determine the TTY of this session. */
|
||||||
int sd_session_get_tty(const char *session, char **display);
|
int sd_session_get_tty(const char *session, char **display);
|
||||||
|
|
||||||
|
/* Determine the VT number of this session. */
|
||||||
|
int sd_session_get_vt(const char *session, unsigned *vtnr);
|
||||||
|
|
||||||
/* Return active session and user of seat */
|
/* Return active session and user of seat */
|
||||||
int sd_seat_get_active(const char *seat, char **session, uid_t *uid);
|
int sd_seat_get_active(const char *seat, char **session, uid_t *uid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue