summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/login/libsystemd-login.sym5
-rw-r--r--src/login/sd-login.c11
-rw-r--r--src/systemd/sd-login.h9
3 files changed, 23 insertions, 2 deletions
diff --git a/src/login/libsystemd-login.sym b/src/login/libsystemd-login.sym
index ce2304a1ba..9048de86a9 100644
--- a/src/login/libsystemd-login.sym
+++ b/src/login/libsystemd-login.sym
@@ -64,3 +64,8 @@ global:
sd_login_monitor_get_events;
sd_login_monitor_get_timeout;
} LIBSYSTEMD_LOGIN_198;
+
+LIBSYSTEMD_LOGIN_202 {
+global:
+ sd_pid_get_user_unit;
+} LIBSYSTEMD_LOGIN_201;
diff --git a/src/login/sd-login.c b/src/login/sd-login.c
index f433e3e80b..4c918f2105 100644
--- a/src/login/sd-login.c
+++ b/src/login/sd-login.c
@@ -84,6 +84,17 @@ _public_ int sd_pid_get_unit(pid_t pid, char **unit) {
return cg_pid_get_unit(pid, unit);
}
+_public_ int sd_pid_get_user_unit(pid_t pid, char **unit) {
+
+ if (pid < 0)
+ return -EINVAL;
+
+ if (!unit)
+ return -EINVAL;
+
+ return cg_pid_get_user_unit(pid, unit);
+}
+
_public_ int sd_pid_get_owner_uid(pid_t pid, uid_t *uid) {
int r;
char *root, *cgroup, *p, *cc;
diff --git a/src/systemd/sd-login.h b/src/systemd/sd-login.h
index d05424dbf3..11282b7611 100644
--- a/src/systemd/sd-login.h
+++ b/src/systemd/sd-login.h
@@ -62,10 +62,15 @@ int sd_pid_get_session(pid_t pid, char **session);
* 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. */
+/* 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, 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, char **unit);
+
/* Get state from uid. Possible states: offline, lingering, online, active, closing */
int sd_uid_get_state(uid_t uid, char**state);