mirror of
https://git.proxmox.com/git/systemd
synced 2025-07-15 08:38:18 +00:00
138 lines
14 KiB
HTML
138 lines
14 KiB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_bus_creds_new_from_pid</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
|
||
a.headerlink {
|
||
color: #c60f0f;
|
||
font-size: 0.8em;
|
||
padding: 0 4px 0 4px;
|
||
text-decoration: none;
|
||
visibility: hidden;
|
||
}
|
||
|
||
a.headerlink:hover {
|
||
background-color: #c60f0f;
|
||
color: white;
|
||
}
|
||
|
||
h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
|
||
visibility: visible;
|
||
}
|
||
</style><a href="index.html">Index </a>·
|
||
<a href="systemd.directives.html">Directives </a>·
|
||
<a href="../python-systemd/index.html">Python </a>·
|
||
<a href="../libudev/index.html">libudev </a>·
|
||
<a href="../libudev/index.html">gudev </a><span style="float:right">systemd 219</span><hr><div class="refentry"><a name="sd_bus_creds_new_from_pid"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>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</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <systemd/sd-bus.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_new_from_pid</b>(</code></td><td>pid_t <var class="pdparam">pid</var>, </td></tr><tr><td> </td><td>uint64_t <var class="pdparam">creds_mask</var>, </td></tr><tr><td> </td><td>sd_bus_creds **<var class="pdparam">ret</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">uint64_t <b class="fsfunc">sd_bus_creds_get_mask</b>(</code></td><td>const sd_bus_creds *<var class="pdparam">c</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">sd_bus_creds *<b class="fsfunc">sd_bus_creds_ref</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">sd_bus_creds *<b class="fsfunc">sd_bus_creds_unref</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>
|
||
<code class="constant">SD_BUS_CREDS_PID</code>,
|
||
<code class="constant">SD_BUS_CREDS_TID</code>,
|
||
<code class="constant">SD_BUS_CREDS_UID</code>,
|
||
<code class="constant">SD_BUS_CREDS_GID</code>,
|
||
<code class="constant">SD_BUS_CREDS_COMM</code>,
|
||
<code class="constant">SD_BUS_CREDS_TID_COMM</code>,
|
||
<code class="constant">SD_BUS_CREDS_EXE</code>,
|
||
<code class="constant">SD_BUS_CREDS_CMDLINE</code>,
|
||
<code class="constant">SD_BUS_CREDS_CGROUP</code>,
|
||
<code class="constant">SD_BUS_CREDS_UNIT</code>,
|
||
<code class="constant">SD_BUS_CREDS_USER_UNIT</code>,
|
||
<code class="constant">SD_BUS_CREDS_SLICE</code>,
|
||
<code class="constant">SD_BUS_CREDS_SESSION</code>,
|
||
<code class="constant">SD_BUS_CREDS_OWNER_UID</code>,
|
||
<code class="constant">SD_BUS_CREDS_EFFECTIVE_CAPS</code>,
|
||
<code class="constant">SD_BUS_CREDS_PERMITTED_CAPS</code>,
|
||
<code class="constant">SD_BUS_CREDS_INHERITABLE_CAPS</code>,
|
||
<code class="constant">SD_BUS_CREDS_BOUNDING_CAPS</code>,
|
||
<code class="constant">SD_BUS_CREDS_SELINUX_CONTEXT</code>,
|
||
<code class="constant">SD_BUS_CREDS_AUDIT_SESSION_ID</code>,
|
||
<code class="constant">SD_BUS_CREDS_AUDIT_LOGIN_UID</code>,
|
||
<code class="constant">SD_BUS_CREDS_UNIQUE_NAME</code>,
|
||
<code class="constant">SD_BUS_CREDS_WELL_KNOWN_NAMES</code>,
|
||
<code class="constant">_SD_BUS_CREDS_ALL</code>
|
||
</p></div><div class="refsect1"><a name="idm139761132848624"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_bus_creds_new_from_pid()</code> creates a new
|
||
credentials object and fills it with information about the process
|
||
<em class="parameter"><code>pid</code></em>. This pointer to this object will
|
||
be stored in <em class="parameter"><code>ret</code></em> pointer.</p><p>The information that will be stored is determined by
|
||
<em class="parameter"><code>creds_mask</code></em>. It may contain a subset of ORed
|
||
constants <code class="constant">SD_BUS_CREDS_PID</code>,
|
||
<code class="constant">SD_BUS_CREDS_TID</code>,
|
||
<code class="constant">SD_BUS_CREDS_UID</code>,
|
||
<code class="constant">SD_BUS_CREDS_GID</code>,
|
||
<code class="constant">SD_BUS_CREDS_COMM</code>,
|
||
<code class="constant">SD_BUS_CREDS_TID_COMM</code>,
|
||
<code class="constant">SD_BUS_CREDS_EXE</code>,
|
||
<code class="constant">SD_BUS_CREDS_CMDLINE</code>,
|
||
<code class="constant">SD_BUS_CREDS_CGROUP</code>,
|
||
<code class="constant">SD_BUS_CREDS_UNIT</code>,
|
||
<code class="constant">SD_BUS_CREDS_USER_UNIT</code>,
|
||
<code class="constant">SD_BUS_CREDS_SLICE</code>,
|
||
<code class="constant">SD_BUS_CREDS_SESSION</code>,
|
||
<code class="constant">SD_BUS_CREDS_OWNER_UID</code>,
|
||
<code class="constant">SD_BUS_CREDS_EFFECTIVE_CAPS</code>,
|
||
<code class="constant">SD_BUS_CREDS_PERMITTED_CAPS</code>,
|
||
<code class="constant">SD_BUS_CREDS_INHERITABLE_CAPS</code>,
|
||
<code class="constant">SD_BUS_CREDS_BOUNDING_CAPS</code>,
|
||
<code class="constant">SD_BUS_CREDS_SELINUX_CONTEXT</code>,
|
||
<code class="constant">SD_BUS_CREDS_AUDIT_SESSION_ID</code>,
|
||
<code class="constant">SD_BUS_CREDS_AUDIT_LOGIN_UID</code>,
|
||
<code class="constant">SD_BUS_CREDS_UNIQUE_NAME</code>,
|
||
<code class="constant">SD_BUS_CREDS_WELL_KNOWN_NAMES</code>,
|
||
or <code class="constant">_SD_BUS_CREDS_ALL</code> to indicate
|
||
all known fields.</p><p>Fields can be retrieved from the credentials object using
|
||
<a href="sd_bus_creds_get_pid.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_pid</span>(3)</span></a>
|
||
and other functions which correspond directly to the constants
|
||
listed above.</p><p>A mask of fields which were actually successfully set
|
||
(acquired from <code class="filename">/proc</code>, etc.) can be retrieved
|
||
with <code class="function">sd_bus_creds_get_mask()</code>. If the
|
||
credentials object was created with
|
||
<code class="function">sd_bus_creds_new_from_pid()</code>, this will be a
|
||
subset of fields requested in <em class="parameter"><code>creds_mask</code></em>.
|
||
</p><p><code class="function">sd_bus_creds_ref</code> creates a new
|
||
reference to the credentials object <em class="parameter"><code>c</code></em>. This
|
||
object will not be destroyed until
|
||
<code class="function">sd_bus_creds_unref</code> has been called as many
|
||
times plus once more. Once the reference count has dropped to zero,
|
||
<em class="parameter"><code>c</code></em> cannot be used anymore, so further
|
||
calls to <code class="function">sd_bus_creds_ref(c)</code> or
|
||
<code class="function">sd_bus_creds_unref(c)</code> are illegal.</p><p><code class="function">sd_bus_creds_unref</code> destroys a reference
|
||
to <em class="parameter"><code>c</code></em>.</p></div><div class="refsect1"><a name="idm139761132815936"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value">¶</a></h2><p>On success, <code class="function">sd_bus_creds_new_from_pid()</code>
|
||
returns 0 or a positive integer. On failure, it returns a negative
|
||
errno-style error code.</p><p><code class="function">sd_bus_creds_get_mask()</code> returns the
|
||
mask of successfully acquired fields.</p><p><code class="function">sd_bus_creds_ref</code> always returns the
|
||
argument.</p><p><code class="function">sd_bus_creds_unref</code> always returns
|
||
<code class="constant">NULL</code>.</p></div><div class="refsect1"><a name="idm139761132810576"></a><h2 id="Reference ownership">Reference ownership<a class="headerlink" title="Permalink to this headline" href="#Reference%20ownership">¶</a></h2><p>Function <code class="function">sd_bus_creds_new_from_pid()</code>
|
||
creates a new object and the caller owns the sole reference. When
|
||
not needed anymore, this reference should be destroyed with
|
||
<a href="sd_bus_creds_unref.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_unref</span>(3)</span></a>.
|
||
</p></div><div class="refsect1"><a name="idm139761127895152"></a><h2 id="Errors">Errors<a class="headerlink" title="Permalink to this headline" href="#Errors">¶</a></h2><p>Returned errors may indicate the following problems:</p><div class="variablelist"><dl class="variablelist"><dt id="-ESRCH"><span class="term"><code class="constant">-ESRCH</code></span><a class="headerlink" title="Permalink to this term" href="#-ESRCH">¶</a></dt><dd><p>Specified <em class="parameter"><code>pid</code></em> could not
|
||
be found.</p></dd><dt id="-EINVAL"><span class="term"><code class="constant">-EINVAL</code></span><a class="headerlink" title="Permalink to this term" href="#-EINVAL">¶</a></dt><dd><p>Specified parameter is invalid
|
||
(<code class="constant">NULL</code> in case of output
|
||
parameters).</p></dd><dt id="-ENOMEM"><span class="term"><code class="constant">-ENOMEM</code></span><a class="headerlink" title="Permalink to this term" href="#-ENOMEM">¶</a></dt><dd><p>Memory allocation failed.</p></dd></dl></div></div><div class="refsect1"><a name="idm139761127888384"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p><code class="function">sd_bus_creds_new_from_pid()</code> is
|
||
available as a shared library, which can be compiled and linked to
|
||
with the
|
||
<code class="constant">libsystemd</code> <a href="http://linux.die.net/man/1/pkg-config"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
|
||
file.</p></div><div class="refsect1"><a name="idm139761127885232"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
|
||
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
|
||
<a href="sd-bus.html"><span class="citerefentry"><span class="refentrytitle">sd-bus</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_ref.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_ref</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_unref.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_unref</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_pid.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_pid</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_tid.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_tid</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_uid.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_uid</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_gid.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_gid</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_comm.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_comm</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_tid_comm.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_tid_comm</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_exe.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_exe</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_cmdline.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_cmdline</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_cgroup.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_cgroup</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_unit.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_unit</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_user_unit.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_user_unit</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_slice.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_slice</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_session.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_session</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_owner_uid.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_owner_uid</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_has_effective_cap.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_has_effective_cap</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_has_permitted_cap.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_has_permitted_cap</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_has_inheritable_cap.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_has_inheritable_cap</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_has_bounding_cap.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_has_bounding_cap</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_selinux_context.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_selinux_context</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_audit_session_id.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_audit_session_id</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_audit_login_uid.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_audit_login_uid</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_unique_name.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_unique_name</span>(3)</span></a>,
|
||
<a href="sd_bus_creds_get_well_known_names.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_get_well_known_names</span>(3)</span></a>
|
||
</p></div></div></body></html>
|