[systemd-devel] [PATCH] sd-login: add a public accessor for the VT number

Giovanni Campagna scampa.giovanni at gmail.com
Thu Aug 22 02:21:05 PDT 2013


From: Giovanni Campagna <gcampagn at redhat.com>

The VT number was already part of the DBus API, but was not
exposed in the C API.
---
 src/login/sd-login.c   | 4 ++++
 src/systemd/sd-login.h | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/login/sd-login.c b/src/login/sd-login.c
index 0658792..2ea823d 100644
--- a/src/login/sd-login.c
+++ b/src/login/sd-login.c
@@ -347,6 +347,10 @@ _public_ int sd_session_get_tty(const char *session, char **tty) {
         return session_get_string(session, "TTY", tty);
 }
 
+_public_ int sd_session_get_vt(const char *session, char **vtnr) {
+        return session_get_string(session, "VTNr", vtnr);
+}
+
 _public_ int sd_session_get_service(const char *session, char **service) {
         return session_get_string(session, "SERVICE", service);
 }
diff --git a/src/systemd/sd-login.h b/src/systemd/sd-login.h
index e37aeda..4ecf83e 100644
--- a/src/systemd/sd-login.h
+++ b/src/systemd/sd-login.h
@@ -124,6 +124,9 @@ int sd_session_get_display(const char *session, char **display);
 /* Determine the TTY of this session. */
 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, char **vtnr);
+
 /* Return active session and user of seat */
 int sd_seat_get_active(const char *seat, char **session, uid_t *uid);
 
-- 
1.8.3.1



More information about the systemd-devel mailing list