***/
#include <sys/types.h>
+#include <inttypes.h>
#ifdef __cplusplus
extern "C" {
* These functions access data in /proc, /sys/fs/cgroup and /run. All
* of these are virtual file systems, hence the accesses are
* relatively cheap.
+ *
+ * See sd-login(3) for more information.
*/
/* Get session from PID. Note that 'shared' processes of a user are
* return an error for system processes. */
int sd_pid_get_owner_uid(pid_t pid, uid_t *uid);
-/* Get systemd unit (i.e. service) name from PID. This will return an
- * error for non-service processes. */
-int sd_pid_get_unit(pid_t, char **unit);
+/* Get systemd unit (i.e. service) name from PID, for system
+ * services. This will return an error for non-service processes. */
+int sd_pid_get_unit(pid_t pid, char **unit);
+
+/* Get systemd unit (i.e. service) name from PID, for user
+ * services. This will return an error for non-user-service
+ * processes. */
+int sd_pid_get_user_unit(pid_t pid, char **unit);
+
+/* Get machine name from PID, for processes assigned to VM or
+ * container. This will return an error for non-service processes. */
+int sd_pid_get_machine_name(pid_t pid, char **name);
/* Get state from uid. Possible states: offline, lingering, online, active, closing */
int sd_uid_get_state(uid_t uid, char**state);
/* Determine the X11 display of this session. */
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);
+
/* Return active session and user of seat */
int sd_seat_get_active(const char *seat, char **session, uid_t *uid);
/* Return whether the seat is multi-session capable */
int sd_seat_can_multi_session(const char *seat);
+/* Return whether the seat is TTY capable, i.e. suitable for showing console UIs */
+int sd_seat_can_tty(const char *seat);
+
+/* Return whether the seat is graphics capable, i.e. suitable for showing graphical UIs */
+int sd_seat_can_graphical(const char *seat);
+
/* Get all seats, store in *seats. Returns the number of seats. If
* seats is NULL only returns number of seats. */
int sd_get_seats(char ***seats);
/* Get FD from monitor */
int sd_login_monitor_get_fd(sd_login_monitor *m);
+/* Get poll() mask to monitor */
+int sd_login_monitor_get_events(sd_login_monitor *m);
+
+/* Get timeout for poll(), as usec value relative to CLOCK_MONOTONIC's epoch */
+int sd_login_monitor_get_timeout(sd_login_monitor *m, uint64_t *timeout_usec);
+
#ifdef __cplusplus
}
#endif