mirror of
https://git.proxmox.com/git/systemd
synced 2025-08-04 19:50:24 +00:00
202 lines
6.2 KiB
Groff
202 lines
6.2 KiB
Groff
'\" t
|
|
.TH "SD_BUS_CREDS_NEW_FROM_PID" "3" "" "systemd 219" "sd_bus_creds_new_from_pid"
|
|
.\" -----------------------------------------------------------------
|
|
.\" * Define some portability stuff
|
|
.\" -----------------------------------------------------------------
|
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
.\" http://bugs.debian.org/507673
|
|
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
.ie \n(.g .ds Aq \(aq
|
|
.el .ds Aq '
|
|
.\" -----------------------------------------------------------------
|
|
.\" * set default formatting
|
|
.\" -----------------------------------------------------------------
|
|
.\" disable hyphenation
|
|
.nh
|
|
.\" disable justification (adjust text to left margin only)
|
|
.ad l
|
|
.\" -----------------------------------------------------------------
|
|
.\" * MAIN CONTENT STARTS HERE *
|
|
.\" -----------------------------------------------------------------
|
|
.SH "NAME"
|
|
sd_bus_creds_new_from_pid, sd_bus_creds_get_mask, sd_bus_creds_ref, sd_bus_creds_unref \- Retrieve credentials object for the specified PID
|
|
.SH "SYNOPSIS"
|
|
.sp
|
|
.ft B
|
|
.nf
|
|
#include <systemd/sd\-bus\&.h>
|
|
.fi
|
|
.ft
|
|
.HP \w'int\ sd_bus_creds_new_from_pid('u
|
|
.BI "int sd_bus_creds_new_from_pid(pid_t\ " "pid" ", uint64_t\ " "creds_mask" ", sd_bus_creds\ **" "ret" ");"
|
|
.HP \w'uint64_t\ sd_bus_creds_get_mask('u
|
|
.BI "uint64_t sd_bus_creds_get_mask(const\ sd_bus_creds\ *" "c" ");"
|
|
.HP \w'sd_bus_creds\ *sd_bus_creds_ref('u
|
|
.BI "sd_bus_creds *sd_bus_creds_ref(sd_bus_creds\ *" "c" ");"
|
|
.HP \w'sd_bus_creds\ *sd_bus_creds_unref('u
|
|
.BI "sd_bus_creds *sd_bus_creds_unref(sd_bus_creds\ *" "c" ");"
|
|
.PP
|
|
\fBSD_BUS_CREDS_PID\fR,
|
|
\fBSD_BUS_CREDS_TID\fR,
|
|
\fBSD_BUS_CREDS_UID\fR,
|
|
\fBSD_BUS_CREDS_GID\fR,
|
|
\fBSD_BUS_CREDS_COMM\fR,
|
|
\fBSD_BUS_CREDS_TID_COMM\fR,
|
|
\fBSD_BUS_CREDS_EXE\fR,
|
|
\fBSD_BUS_CREDS_CMDLINE\fR,
|
|
\fBSD_BUS_CREDS_CGROUP\fR,
|
|
\fBSD_BUS_CREDS_UNIT\fR,
|
|
\fBSD_BUS_CREDS_USER_UNIT\fR,
|
|
\fBSD_BUS_CREDS_SLICE\fR,
|
|
\fBSD_BUS_CREDS_SESSION\fR,
|
|
\fBSD_BUS_CREDS_OWNER_UID\fR,
|
|
\fBSD_BUS_CREDS_EFFECTIVE_CAPS\fR,
|
|
\fBSD_BUS_CREDS_PERMITTED_CAPS\fR,
|
|
\fBSD_BUS_CREDS_INHERITABLE_CAPS\fR,
|
|
\fBSD_BUS_CREDS_BOUNDING_CAPS\fR,
|
|
\fBSD_BUS_CREDS_SELINUX_CONTEXT\fR,
|
|
\fBSD_BUS_CREDS_AUDIT_SESSION_ID\fR,
|
|
\fBSD_BUS_CREDS_AUDIT_LOGIN_UID\fR,
|
|
\fBSD_BUS_CREDS_UNIQUE_NAME\fR,
|
|
\fBSD_BUS_CREDS_WELL_KNOWN_NAMES\fR,
|
|
\fB_SD_BUS_CREDS_ALL\fR
|
|
.SH "DESCRIPTION"
|
|
.PP
|
|
\fBsd_bus_creds_new_from_pid()\fR
|
|
creates a new credentials object and fills it with information about the process
|
|
\fIpid\fR\&. This pointer to this object will be stored in
|
|
\fIret\fR
|
|
pointer\&.
|
|
.PP
|
|
The information that will be stored is determined by
|
|
\fIcreds_mask\fR\&. It may contain a subset of ORed constants
|
|
\fBSD_BUS_CREDS_PID\fR,
|
|
\fBSD_BUS_CREDS_TID\fR,
|
|
\fBSD_BUS_CREDS_UID\fR,
|
|
\fBSD_BUS_CREDS_GID\fR,
|
|
\fBSD_BUS_CREDS_COMM\fR,
|
|
\fBSD_BUS_CREDS_TID_COMM\fR,
|
|
\fBSD_BUS_CREDS_EXE\fR,
|
|
\fBSD_BUS_CREDS_CMDLINE\fR,
|
|
\fBSD_BUS_CREDS_CGROUP\fR,
|
|
\fBSD_BUS_CREDS_UNIT\fR,
|
|
\fBSD_BUS_CREDS_USER_UNIT\fR,
|
|
\fBSD_BUS_CREDS_SLICE\fR,
|
|
\fBSD_BUS_CREDS_SESSION\fR,
|
|
\fBSD_BUS_CREDS_OWNER_UID\fR,
|
|
\fBSD_BUS_CREDS_EFFECTIVE_CAPS\fR,
|
|
\fBSD_BUS_CREDS_PERMITTED_CAPS\fR,
|
|
\fBSD_BUS_CREDS_INHERITABLE_CAPS\fR,
|
|
\fBSD_BUS_CREDS_BOUNDING_CAPS\fR,
|
|
\fBSD_BUS_CREDS_SELINUX_CONTEXT\fR,
|
|
\fBSD_BUS_CREDS_AUDIT_SESSION_ID\fR,
|
|
\fBSD_BUS_CREDS_AUDIT_LOGIN_UID\fR,
|
|
\fBSD_BUS_CREDS_UNIQUE_NAME\fR,
|
|
\fBSD_BUS_CREDS_WELL_KNOWN_NAMES\fR, or
|
|
\fB_SD_BUS_CREDS_ALL\fR
|
|
to indicate all known fields\&.
|
|
.PP
|
|
Fields can be retrieved from the credentials object using
|
|
\fBsd_bus_creds_get_pid\fR(3)
|
|
and other functions which correspond directly to the constants listed above\&.
|
|
.PP
|
|
A mask of fields which were actually successfully set (acquired from
|
|
/proc, etc\&.) can be retrieved with
|
|
\fBsd_bus_creds_get_mask()\fR\&. If the credentials object was created with
|
|
\fBsd_bus_creds_new_from_pid()\fR, this will be a subset of fields requested in
|
|
\fIcreds_mask\fR\&.
|
|
.PP
|
|
\fBsd_bus_creds_ref\fR
|
|
creates a new reference to the credentials object
|
|
\fIc\fR\&. This object will not be destroyed until
|
|
\fBsd_bus_creds_unref\fR
|
|
has been called as many times plus once more\&. Once the reference count has dropped to zero,
|
|
\fIc\fR
|
|
cannot be used anymore, so further calls to
|
|
\fBsd_bus_creds_ref(c)\fR
|
|
or
|
|
\fBsd_bus_creds_unref(c)\fR
|
|
are illegal\&.
|
|
.PP
|
|
\fBsd_bus_creds_unref\fR
|
|
destroys a reference to
|
|
\fIc\fR\&.
|
|
.SH "RETURN VALUE"
|
|
.PP
|
|
On success,
|
|
\fBsd_bus_creds_new_from_pid()\fR
|
|
returns 0 or a positive integer\&. On failure, it returns a negative errno\-style error code\&.
|
|
.PP
|
|
\fBsd_bus_creds_get_mask()\fR
|
|
returns the mask of successfully acquired fields\&.
|
|
.PP
|
|
\fBsd_bus_creds_ref\fR
|
|
always returns the argument\&.
|
|
.PP
|
|
\fBsd_bus_creds_unref\fR
|
|
always returns
|
|
\fBNULL\fR\&.
|
|
.SH "REFERENCE OWNERSHIP"
|
|
.PP
|
|
Function
|
|
\fBsd_bus_creds_new_from_pid()\fR
|
|
creates a new object and the caller owns the sole reference\&. When not needed anymore, this reference should be destroyed with
|
|
\fBsd_bus_creds_unref\fR(3)\&.
|
|
.SH "ERRORS"
|
|
.PP
|
|
Returned errors may indicate the following problems:
|
|
.PP
|
|
\fB\-ESRCH\fR
|
|
.RS 4
|
|
Specified
|
|
\fIpid\fR
|
|
could not be found\&.
|
|
.RE
|
|
.PP
|
|
\fB\-EINVAL\fR
|
|
.RS 4
|
|
Specified parameter is invalid (\fBNULL\fR
|
|
in case of output parameters)\&.
|
|
.RE
|
|
.PP
|
|
\fB\-ENOMEM\fR
|
|
.RS 4
|
|
Memory allocation failed\&.
|
|
.RE
|
|
.SH "NOTES"
|
|
.PP
|
|
\fBsd_bus_creds_new_from_pid()\fR
|
|
is available as a shared library, which can be compiled and linked to with the
|
|
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
|
|
file\&.
|
|
.SH "SEE ALSO"
|
|
.PP
|
|
\fBsystemd\fR(1),
|
|
\fBsd-bus\fR(3),
|
|
\fBsd_bus_creds_ref\fR(3),
|
|
\fBsd_bus_creds_unref\fR(3),
|
|
\fBsd_bus_creds_get_pid\fR(3),
|
|
\fBsd_bus_creds_get_tid\fR(3),
|
|
\fBsd_bus_creds_get_uid\fR(3),
|
|
\fBsd_bus_creds_get_gid\fR(3),
|
|
\fBsd_bus_creds_get_comm\fR(3),
|
|
\fBsd_bus_creds_get_tid_comm\fR(3),
|
|
\fBsd_bus_creds_get_exe\fR(3),
|
|
\fBsd_bus_creds_get_cmdline\fR(3),
|
|
\fBsd_bus_creds_get_cgroup\fR(3),
|
|
\fBsd_bus_creds_get_unit\fR(3),
|
|
\fBsd_bus_creds_get_user_unit\fR(3),
|
|
\fBsd_bus_creds_get_slice\fR(3),
|
|
\fBsd_bus_creds_get_session\fR(3),
|
|
\fBsd_bus_creds_get_owner_uid\fR(3),
|
|
\fBsd_bus_creds_has_effective_cap\fR(3),
|
|
\fBsd_bus_creds_has_permitted_cap\fR(3),
|
|
\fBsd_bus_creds_has_inheritable_cap\fR(3),
|
|
\fBsd_bus_creds_has_bounding_cap\fR(3),
|
|
\fBsd_bus_creds_get_selinux_context\fR(3),
|
|
\fBsd_bus_creds_get_audit_session_id\fR(3),
|
|
\fBsd_bus_creds_get_audit_login_uid\fR(3),
|
|
\fBsd_bus_creds_get_unique_name\fR(3),
|
|
\fBsd_bus_creds_get_well_known_names\fR(3)
|