<refname>sd_session_get_vt</refname>
<refname>sd_session_get_remote_host</refname>
<refname>sd_session_get_remote_user</refname>
+ <refname>sd_session_get_leader</refname>
<refpurpose>Determine state of a specific session</refpurpose>
</refnamediv>
<paramdef>char **<parameter>display</parameter></paramdef>
</funcprototype>
+ <funcprototype>
+ <funcdef>int <function>sd_session_get_leader</function></funcdef>
+ <paramdef>const char *<parameter>session</parameter></paramdef>
+ <paramdef>pid_t *<parameter>leader</parameter></paramdef>
+ </funcprototype>
+
<funcprototype>
<funcdef>int <function>sd_session_get_remote_host</function></funcdef>
<paramdef>const char *<parameter>session</parameter></paramdef>
<citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
call after use.</para>
+ <para><function>sd_session_get_leader()</function> may be used to
+ determine the PID of the leader of the session identified by the
+ specified session identifier.</para>
+
<para><function>sd_session_get_remote_host()</function> may be
used to determine the remote hostname of the session identified by
the specified session identifier. The returned string needs to be
<function>sd_session_get_type()</function>,
<function>sd_session_get_class()</function>,
<function>sd_session_get_display()</function>,
+ <function>sd_session_get_leader()</function>,
<function>sd_session_get_remote_user()</function>,
<function>sd_session_get_remote_host()</function> and
<function>sd_session_get_tty()</function> return 0 or
return session_get_string(session, "REMOTE_HOST", remote_host);
}
+_public_ int sd_session_get_leader(const char *session, pid_t *leader) {
+ _cleanup_free_ char *leader_string = NULL;
+ pid_t pid;
+ int r;
+
+ assert_return(leader, -EINVAL);
+
+ r = session_get_string(session, "LEADER", &leader_string);
+ if (r < 0)
+ return r;
+
+ r = parse_pid(leader_string, &pid);
+ if (r < 0)
+ return r;
+
+ *leader = pid;
+ return 0;
+}
+
_public_ int sd_seat_get_active(const char *seat, char **session, uid_t *uid) {
_cleanup_free_ char *p = NULL, *s = NULL, *t = NULL;
int r;
/* Determine the X11 display of this session. */
int sd_session_get_display(const char *session, char **display);
+/* Determine the leader process of this session. */
+int sd_session_get_leader(const char *session, pid_t *leader);
+
/* Determine the remote host of this session. */
int sd_session_get_remote_host(const char *session, char **remote_host);