From 52d7c4dcf157745767931d49c9fa9c73448f746a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 29 Apr 2015 21:44:55 +0200 Subject: [PATCH] man: document when the sd_bus_creds_xxx() calls return ENXIO --- Makefile-man.am | 51 ++++++++- man/sd_bus_creds_get_pid.xml | 209 +++++++++++++++++++++++++---------- 2 files changed, 199 insertions(+), 61 deletions(-) diff --git a/Makefile-man.am b/Makefile-man.am index 4344ffbb4d..e297b21041 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -799,16 +799,25 @@ MANPAGES_ALIAS += \ man/sd_bus_creds_get_cgroup.3 \ man/sd_bus_creds_get_cmdline.3 \ man/sd_bus_creds_get_comm.3 \ - man/sd_bus_creds_get_connection_name.3 \ + man/sd_bus_creds_get_description.3 \ + man/sd_bus_creds_get_egid.3 \ + man/sd_bus_creds_get_euid.3 \ man/sd_bus_creds_get_exe.3 \ + man/sd_bus_creds_get_fsgid.3 \ + man/sd_bus_creds_get_fsuid.3 \ man/sd_bus_creds_get_gid.3 \ man/sd_bus_creds_get_mask.3 \ man/sd_bus_creds_get_owner_uid.3 \ + man/sd_bus_creds_get_ppid.3 \ man/sd_bus_creds_get_selinux_context.3 \ man/sd_bus_creds_get_session.3 \ + man/sd_bus_creds_get_sgid.3 \ man/sd_bus_creds_get_slice.3 \ + man/sd_bus_creds_get_suid.3 \ + man/sd_bus_creds_get_supplementary_gids.3 \ man/sd_bus_creds_get_tid.3 \ man/sd_bus_creds_get_tid_comm.3 \ + man/sd_bus_creds_get_tty.3 \ man/sd_bus_creds_get_uid.3 \ man/sd_bus_creds_get_unique_name.3 \ man/sd_bus_creds_get_unit.3 \ @@ -870,16 +879,25 @@ man/sd_bus_creds_get_audit_session_id.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_cgroup.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_cmdline.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_comm.3: man/sd_bus_creds_get_pid.3 -man/sd_bus_creds_get_connection_name.3: man/sd_bus_creds_get_pid.3 +man/sd_bus_creds_get_description.3: man/sd_bus_creds_get_pid.3 +man/sd_bus_creds_get_egid.3: man/sd_bus_creds_get_pid.3 +man/sd_bus_creds_get_euid.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_exe.3: man/sd_bus_creds_get_pid.3 +man/sd_bus_creds_get_fsgid.3: man/sd_bus_creds_get_pid.3 +man/sd_bus_creds_get_fsuid.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_gid.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_mask.3: man/sd_bus_creds_new_from_pid.3 man/sd_bus_creds_get_owner_uid.3: man/sd_bus_creds_get_pid.3 +man/sd_bus_creds_get_ppid.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_selinux_context.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_session.3: man/sd_bus_creds_get_pid.3 +man/sd_bus_creds_get_sgid.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_slice.3: man/sd_bus_creds_get_pid.3 +man/sd_bus_creds_get_suid.3: man/sd_bus_creds_get_pid.3 +man/sd_bus_creds_get_supplementary_gids.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_tid.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_tid_comm.3: man/sd_bus_creds_get_pid.3 +man/sd_bus_creds_get_tty.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_uid.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_unique_name.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_unit.3: man/sd_bus_creds_get_pid.3 @@ -951,12 +969,24 @@ man/sd_bus_creds_get_cmdline.html: man/sd_bus_creds_get_pid.html man/sd_bus_creds_get_comm.html: man/sd_bus_creds_get_pid.html $(html-alias) -man/sd_bus_creds_get_connection_name.html: man/sd_bus_creds_get_pid.html +man/sd_bus_creds_get_description.html: man/sd_bus_creds_get_pid.html + $(html-alias) + +man/sd_bus_creds_get_egid.html: man/sd_bus_creds_get_pid.html + $(html-alias) + +man/sd_bus_creds_get_euid.html: man/sd_bus_creds_get_pid.html $(html-alias) man/sd_bus_creds_get_exe.html: man/sd_bus_creds_get_pid.html $(html-alias) +man/sd_bus_creds_get_fsgid.html: man/sd_bus_creds_get_pid.html + $(html-alias) + +man/sd_bus_creds_get_fsuid.html: man/sd_bus_creds_get_pid.html + $(html-alias) + man/sd_bus_creds_get_gid.html: man/sd_bus_creds_get_pid.html $(html-alias) @@ -966,21 +996,36 @@ man/sd_bus_creds_get_mask.html: man/sd_bus_creds_new_from_pid.html man/sd_bus_creds_get_owner_uid.html: man/sd_bus_creds_get_pid.html $(html-alias) +man/sd_bus_creds_get_ppid.html: man/sd_bus_creds_get_pid.html + $(html-alias) + man/sd_bus_creds_get_selinux_context.html: man/sd_bus_creds_get_pid.html $(html-alias) man/sd_bus_creds_get_session.html: man/sd_bus_creds_get_pid.html $(html-alias) +man/sd_bus_creds_get_sgid.html: man/sd_bus_creds_get_pid.html + $(html-alias) + man/sd_bus_creds_get_slice.html: man/sd_bus_creds_get_pid.html $(html-alias) +man/sd_bus_creds_get_suid.html: man/sd_bus_creds_get_pid.html + $(html-alias) + +man/sd_bus_creds_get_supplementary_gids.html: man/sd_bus_creds_get_pid.html + $(html-alias) + man/sd_bus_creds_get_tid.html: man/sd_bus_creds_get_pid.html $(html-alias) man/sd_bus_creds_get_tid_comm.html: man/sd_bus_creds_get_pid.html $(html-alias) +man/sd_bus_creds_get_tty.html: man/sd_bus_creds_get_pid.html + $(html-alias) + man/sd_bus_creds_get_uid.html: man/sd_bus_creds_get_pid.html $(html-alias) diff --git a/man/sd_bus_creds_get_pid.xml b/man/sd_bus_creds_get_pid.xml index 2d7090b7c8..7d68d1ee8d 100644 --- a/man/sd_bus_creds_get_pid.xml +++ b/man/sd_bus_creds_get_pid.xml @@ -44,9 +44,17 @@ sd_bus_creds_get_pid + sd_bus_creds_get_ppid sd_bus_creds_get_tid sd_bus_creds_get_uid + sd_bus_creds_get_euid + sd_bus_creds_get_suid + sd_bus_creds_get_fsuid sd_bus_creds_get_gid + sd_bus_creds_get_egid + sd_bus_creds_get_sgid + sd_bus_creds_get_fsgid + sd_bus_creds_get_supplementary_gids sd_bus_creds_get_comm sd_bus_creds_get_tid_comm sd_bus_creds_get_exe @@ -64,9 +72,10 @@ sd_bus_creds_get_selinux_context sd_bus_creds_get_audit_session_id sd_bus_creds_get_audit_login_uid + sd_bus_creds_get_tty sd_bus_creds_get_unique_name sd_bus_creds_get_well_known_names - sd_bus_creds_get_connection_name + sd_bus_creds_get_description Retrieve fields from a credentials object @@ -81,6 +90,12 @@ pid_t *pid + + int sd_bus_creds_get_ppid + sd_bus_creds *c + pid_t *ppid + + int sd_bus_creds_get_tid sd_bus_creds *c @@ -88,7 +103,25 @@ - int sd_bus_creds_get_pid + int sd_bus_creds_get_uid + sd_bus_creds *c + uid_t *uid + + + + int sd_bus_creds_get_euid + sd_bus_creds *c + uid_t *uid + + + + int sd_bus_creds_get_suid + sd_bus_creds *c + uid_t *uid + + + + int sd_bus_creds_get_fsuid sd_bus_creds *c uid_t *uid @@ -99,6 +132,30 @@ gid_t *gid + + int sd_bus_creds_get_egid + sd_bus_creds *c + gid_t *gid + + + + int sd_bus_creds_get_sgid + sd_bus_creds *c + gid_t *gid + + + + int sd_bus_creds_get_fsgid + sd_bus_creds *c + gid_t *gid + + + + int sd_bus_creds_get_supplementary_gids + sd_bus_creds *c + const gid_t **gids + + int sd_bus_creds_get_comm sd_bus_creds *c @@ -201,6 +258,12 @@ uid_t *loginuid + + int sd_bus_creds_get_tty + sd_bus_creds *c + const char **tty + + int sd_bus_creds_get_unique_name sd_bus_creds *c @@ -214,7 +277,7 @@ - int sd_bus_creds_get_connection_name + int sd_bus_creds_get_description sd_bus_creds *c const char **name @@ -226,26 +289,43 @@ Description These functions return information from an - sd_bus_creds object. It may be created with + sd_bus_creds credential object. Credential + objects may be created with sd_bus_creds_new_from_pid3, - in which case it will describe the specified process, or it may be - created by + in which case they describe the credentials of the process + identified by the specified PID, with + sd_bus_get_name_creds3, + in which case they describe the credentials of a bus peer + identified by the specified bus name, or with sd_bus_get_owner_creds3, - in which case it will describe the process at the other endpoint - of a connection. - + in which case they describe the credentials of the creator of a + bus. - sd_bus_creds_get_pid() will retrieve the - PID (process identifier). + sd_bus_creds_get_pid() will retrieve + the PID (process identifier). Similar, + sd_bus_creds_get_ppid() will retrieve the + parent PID. Note that PID 1 has no parent process, in which case + -ENXIO is returned. sd_bus_creds_get_tid() will retrieve the TID (thread identifier). - sd_bus_creds_get_uid() will retrieve the - numeric UID (user identifier). + sd_bus_creds_get_uid() will retrieve + the numeric UID (user identifier). Similar, + sd_bus_creds_get_euid() returns the effective + UID, sd_bus_creds_get_suid() the saved UID + and sd_bus_creds_get_fsuid() the file system + UID. sd_bus_creds_get_gid() will retrieve the - numeric GID (group identifier). + numeric GID (group identifier). Similar, + sd_bus_creds_get_egid() returns the effective + GID, sd_bus_creds_get_sgid() the saved GID + and sd_bus_creds_get_fsgid() the file system + GID. + + sd_bus_creds_get_supplementary_gids() + will retrieve the supplementary GIDs list. sd_bus_creds_get_comm() will retrieve the comm field (truncated name of the executable, as stored in @@ -257,32 +337,36 @@ /proc/pid/task/tid/comm). - sd_bus_creds_get_exe() will retrieve the - path to the program (as stored in the + sd_bus_creds_get_exe() will retrieve + the path to the program executable (as stored in the /proc/pid/exe - link, but with (deleted) suffix removed). - + link, but with (deleted) suffix removed). Note + that kernel threads do not have an executable path, in which case + -ENXIO is returned. - sd_bus_creds_get_cmdline() will retrieve - an array of command line arguments (as stored in - /proc/pid/cmdline). - + sd_bus_creds_get_cmdline() will + retrieve an array of command line arguments (as stored in + /proc/pid/cmdline). Note + that kernel threads do not have a command line, in which case + -ENXIO is returned. sd_bus_creds_get_cgroup() will retrieve the cgroup path. See cgroups.txt. - sd_bus_creds_get_unit() will retrieve the - systemd unit name (in the system instance of systemd) that the + sd_bus_creds_get_unit() will retrieve + the systemd unit name (in the system instance of systemd) that the process is part of. See - systemd.unit5. + systemd.unit5. For + processes that are not part of a unit returns -ENXIO. sd_bus_creds_get_user_unit() will retrieve the systemd unit name (in the user instance of systemd) that the process is part of. See - systemd.unit5. + systemd.unit5. For + processes that are not part of a user unit returns -ENXIO. sd_bus_creds_get_slice() will retrieve @@ -291,17 +375,17 @@ systemd.slice5. - sd_bus_creds_get_session() will retrieve - the logind session that the process is part of. See - systemd-logind.service8. + sd_bus_creds_get_session() will + retrieve the logind session that the process is part of. See + systemd-logind.service8. For + processes that are not part of a session returns -ENXIO. - sd_bus_creds_get_owner_uid() will retrieve - the numeric UID (user identifier) of the user who owns the slice - that the process is part of. See + sd_bus_creds_get_owner_uid() will + retrieve the numeric UID (user identifier) of the user who owns + the session that the process is part of. See systemd.slice5 - . + For processes that are not part of a session returns -ENXIO. sd_bus_creds_has_effective_cap() will @@ -331,12 +415,18 @@ sd_bus_creds_get_selinux_context() will retrieve the SELinux security context (label) of the process. - sd_bus_creds_get_audit_session_id() will - retrieve the audit session identifier of the process. + sd_bus_creds_get_audit_session_id() + will retrieve the audit session identifier of the process. Returns + -ENXIO for processes that are not part of an audit session. sd_bus_creds_get_audit_login_uid() will retrieve the audit user login identifier (the identifier of the - user who is "responsible" for the session). + user who is "responsible" for the session). Returns -ENXIO for + processes that are not part of an audit session. + + sd_bus_creds_get_tty() will retrieve + the controlling TTY. Returns -ENXIO for processes that have no + controlling TTY. sd_bus_creds_get_unique_name() will retrieve the D-Bus unique name. See The D-Bus specification. - sd_bus_creds_get_connection_name() will + sd_bus_creds_get_description() will retrieve a descriptive name of the bus connection of the peer. This name is useful to discern multiple bus connections by the same peer, and may be altered by the peer with the - sd_bus_set_name3 + sd_bus_set_description3 call. All functions that take a const @@ -386,31 +476,34 @@ -ENODATA - Given field is not available in - c. - - - - - -ENOENT - - Given field is not specified for the sender. - This will be returned by sd_bus_get_unit(), - sd_bus_get_user_unit(), - sd_bus_get_slice(), - sd_bus_get_session(), and - sd_bus_get_name_creds_uid() if the sender is not - part of a systemd system unit, systemd user unit, systemd - slice, logind session, or a systemd user session. + Given field is not available in the + credentials object c. -ENXIO - An error occurred in parsing cgroup paths. - libsystemd might be out of sync with - the running systemd version. + Given field is not specified for the described + process or peer. This will be returned by + sd_bus_get_unit(), + sd_bus_get_user_unit(), + sd_bus_get_slice(), + sd_bus_get_session(), and + sd_bus_get_owner_uid() if the process is + not part of a systemd system unit, systemd user unit, systemd + slice, or logind session. It will also be returned by + sd_bus_creds_get_exe() and + sd_bus_creds_get_cmdline() for kernel + threads (since these aren't started from an executable binary + or have a command line), + sd_bus_creds_get_audit_session_id() and + sd_bus_creds_get_audit_login_uid() when + the process is not part of an audit session, and + sd_bus_creds_get_tty() if the process has + no controlling TTY. + +