chiark / gitweb /
journald: store _SYSTEMD_UNIT= instead of _SYSTEMD_SERVICE= field, since processes...
authorLennart Poettering <lennart@poettering.net>
Wed, 4 Jan 2012 14:35:30 +0000 (15:35 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 4 Jan 2012 14:35:30 +0000 (15:35 +0100)
Makefile.am
man/sd_pid_get_session.xml
src/journal/journald.c
src/journal/sd-journal.h
src/login/libsystemd-login.sym
src/login/sd-login.c
src/login/sd-login.h
src/logs-show.c

index 6c0fd055d0c2bdf3f7e6fcbcd67584a26480f27d..21cac4e56f6e25b81d079d3393ef83656785ef8b 100644 (file)
@@ -1912,7 +1912,7 @@ MANPAGES_ALIAS += \
        man/sd_session_get_uid.3 \
        man/sd_session_get_seat.3 \
        man/sd_pid_get_owner_uid.3 \
-       man/sd_pid_get_service.3 \
+       man/sd_pid_get_unit.3 \
        man/sd_uid_is_on_seat.3 \
        man/sd_uid_get_sessions.3 \
        man/sd_uid_get_seats.3 \
@@ -1927,7 +1927,7 @@ man/sd_login_monitor_get_fd.3: man/sd_login_monitor_new.3
 man/sd_session_get_uid.3: man/sd_session_is_active.3
 man/sd_session_get_seat.3: man/sd_session_is_active.3
 man/sd_pid_get_owner_uid.3: man/sd_pid_get_session.3
-man/sd_pid_get_service.3: man/sd_pid_get_session.3
+man/sd_pid_get_unit.3: man/sd_pid_get_session.3
 man/sd_uid_is_on_seat.3: man/sd_uid_get_state.3
 man/sd_uid_get_sessions.3: man/sd_uid_get_state.3
 man/sd_uid_get_seats.3: man/sd_uid_get_state.3
index 4086c5a826e270c0a028dc0c4037a3b4b7fd2d84..bd958046281af9a1952fb600ef8d816f7aced44e 100644 (file)
@@ -44,7 +44,7 @@
 
         <refnamediv>
                 <refname>sd_pid_get_session</refname>
-                <refname>sd_pid_get_service</refname>
+                <refname>sd_pid_get_unit</refname>
                 <refname>sd_pid_get_owner_uid</refname>
                 <refpurpose>Determine session, service or owner of a session of a specific PID</refpurpose>
         </refnamediv>
@@ -60,9 +60,9 @@
                         </funcprototype>
 
                         <funcprototype>
-                                <funcdef>int <function>sd_pid_get_service</function></funcdef>
+                                <funcdef>int <function>sd_pid_get_unit</function></funcdef>
                                 <paramdef>pid_t <parameter>pid</parameter></paramdef>
-                                <paramdef>char** <parameter>service</parameter></paramdef>
+                                <paramdef>char** <parameter>unit</parameter></paramdef>
                         </funcprototype>
 
                         <funcprototype>
                 <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
                 call after use.</para>
 
-                <para><function>sd_pid_get_service()</function> may be
-                used to determine the system service identifier of a
-                process identified by the specified process
-                identifier. The service name is a short string,
-                suitable for usage in file system paths. Note that not
-                all processes are part of a service (e.g. user
-                processes, or kernel threads). For processes not being
-                part of a system service this function will fail. The
-                returned string needs to be freed with the libc
+                <para><function>sd_pid_get_unit()</function> may be
+                used to determine the systemd unit (i.e. system
+                service) identifier of a process identified by the
+                specified process identifier. The unit name is a short
+                string, suitable for usage in file system paths. Note
+                that not all processes are part of a unit/service
+                (e.g. user processes, or kernel threads). For
+                processes not being part of a systemd unit/system
+                service this function will fail. The returned string
+                needs to be freed with the libc
                 <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
                 call after use.</para>
 
                 <title>Notes</title>
 
                 <para>The <function>sd_pid_get_session()</function>,
-                <function>sd_pid_get_service()</function>, and
+                <function>sd_pid_get_pid()</function>, and
                 <function>sd_pid_get_owner_uid()</function> interfaces
                 are available as shared library, which can be compiled
                 and linked to with the
index 47fe6edb0cad2ac85ca42f972837551937c41595..b029ab97814d1845ff5cf18c454e8b453dc55243 100644 (file)
@@ -431,7 +431,7 @@ static void dispatch_message_real(Server *s,
                 *comm = NULL, *cmdline = NULL, *hostname = NULL,
                 *audit_session = NULL, *audit_loginuid = NULL,
                 *exe = NULL, *cgroup = NULL, *session = NULL,
-                *owner_uid = NULL, *service = NULL;
+                *owner_uid = NULL, *unit = NULL;
 
         char idbuf[33];
         sd_id128_t id;
@@ -515,12 +515,12 @@ static void dispatch_message_real(Server *s,
                                 IOVEC_SET_STRING(iovec[n++], session);
                 }
 
-                if (sd_pid_get_service(ucred->pid, &t) >= 0) {
-                        service = strappend("_SYSTEMD_SERVICE=", t);
+                if (sd_pid_get_unit(ucred->pid, &t) >= 0) {
+                        unit = strappend("_SYSTEMD_UNIT=", t);
                         free(t);
 
-                        if (service)
-                                IOVEC_SET_STRING(iovec[n++], service);
+                        if (unit)
+                                IOVEC_SET_STRING(iovec[n++], unit);
                 }
 
                 if (sd_pid_get_owner_uid(ucred->uid, &owner) >= 0)
@@ -596,7 +596,7 @@ retry:
         free(cgroup);
         free(session);
         free(owner_uid);
-        free(service);
+        free(unit);
 }
 
 static void dispatch_message(Server *s,
index d7e2528a35d47ec0a70f6147439981b44d723057..87da17ddc6d14ff066f5ce316170a2a9f6a4b068 100644 (file)
@@ -35,7 +35,6 @@
  *   - OR of matches is borked...
  *   - extend hash tables table as we go
  *   - accelerate looking for "all hostnames" and suchlike.
- *   - hookup with systemctl
  *   - handle incomplete header
  *
  *   - local deserializer
index bac46f4064c9f87086f39134d223da3f7f9e6d23..15e505e83ba233310ab4c1028cb37e190efbc1e2 100644 (file)
@@ -36,5 +36,5 @@ local:
 
 LIBSYSTEMD_LOGIN_38 {
 global:
-        sd_pid_get_service;
+        sd_pid_get_unit;
 } LIBSYSTEMD_LOGIN_31;
index e857ae08d2c8f73ecbcfc8105b6af1df10dd1b87..8893b1de80cfa4449850a9a08b7e424c6d334d2e 100644 (file)
@@ -121,11 +121,11 @@ _public_ int sd_pid_get_session(pid_t pid, char **session) {
         return 0;
 }
 
-_public_ int sd_pid_get_service(pid_t pid, char **service) {
+_public_ int sd_pid_get_unit(pid_t pid, char **unit) {
         int r;
         char *cgroup, *p;
 
-        if (!service)
+        if (!unit)
                 return -EINVAL;
 
         r = pid_get_cgroup(pid, NULL, &cgroup);
@@ -144,7 +144,7 @@ _public_ int sd_pid_get_service(pid_t pid, char **service) {
         if (!p)
                 return -ENOMEM;
 
-        *service = p;
+        *unit = p;
         return 0;
 }
 
index 1d8a55e906e6f2fa902a4765ff6ad5d908ce1961..00de6716b0d0780d4e25e0149eea97a3a730d8b0 100644 (file)
@@ -53,9 +53,9 @@ 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 service name from PID. This will return an error for
- * non-service processes. */
-int sd_pid_get_service(pid_t, char **service);
+/* 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 state from uid. Possible states: offline, lingering, online, active */
 int sd_uid_get_state(uid_t uid, char**state);
index d178f95f94a6c34a70c7c3b47d9798abdb99c690..e28fe8fa2154adf5e218ec7b3d7110472e04bcdf 100644 (file)
@@ -359,7 +359,7 @@ int show_journal_by_service(
         if (!prefix)
                 prefix = "";
 
-        if (asprintf(&m, "_SYSTEMD_SERVICE=%s", service) < 0) {
+        if (asprintf(&m, "_SYSTEMD_UNIT=%s", service) < 0) {
                 r = -ENOMEM;
                 goto finish;
         }