summaryrefslogtreecommitdiff
path: root/man/sd_bus_negotiate_creds.html
blob: 63d991599074c65383b0c223736dc3c5d89a6873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_bus_negotiate_fds</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>·

  <span style="float:right">systemd 221</span><hr><div class="refentry"><a name="sd_bus_negotiate_fds"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_bus_negotiate_fds, sd_bus_negotiate_timestamps, sd_bus_negotiate_creds — Control feature negotiation on bus connections</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;systemd/sd-bus.h&gt;</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_negotiate_fds</b>(</code></td><td>sd_bus *<var class="pdparam">bus</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">b</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">int <b class="fsfunc">sd_bus_negotiate_timestamp</b>(</code></td><td>sd_bus *<var class="pdparam">bus</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">b</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">int <b class="fsfunc">sd_bus_negotiate_creds</b>(</code></td><td>sd_bus *<var class="pdparam">bus</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">b</var>, </td></tr><tr><td> </td><td>uint64_t <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm47509299939648"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_bus_negotiate_fds()</code> controls whether
    file descriptor passing shall be negotiated for the specified bus
    connection. It takes a bus object and a boolean, which, when true,
    enables file descriptor passing, and, when false, disables it. Note
    that not all transports and servers support file descriptor
    passing. To find out whether file descriptor passing is available
    after negotiation, use
    <a href="sd_bus_can_send.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_can_send</span>(3)</span></a>
    and pass <code class="constant">SD_BUS_TYPE_UNIX_FD</code>. Note that file
    descriptor passing is always enabled for both sending and
    receiving or for neither, but never only in one direction. By
    default, file descriptor passing is negotiated for all
    connections.</p><p>Note that when bus activation is used, it is highly
    recommended to set the <code class="option">AcceptFileDescriptors=</code>
    setting in the <code class="filename">.busname</code> unit file to the same
    setting as negotiated by the program ultimately activated. By
    default, file descriptor passing is enabled for both.</p><p><code class="function">sd_bus_negotiate_timestamps()</code> controls
    whether implicit sender timestamps shall be attached automatically
    to all incoming messages. Takes a bus object and a boolean, which,
    when true, enables timestamping, and, when false, disables it. If
    this is disabled,
    <a href="sd_bus_message_get_monotonic_usec.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_message_get_monotonic_usec</span>(3)</span></a>,
    <a href="sd_bus_message_get_realtime_usec.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_message_get_realtime_usec</span>(3)</span></a>,
    <a href="sd_bus_message_get_seqnum.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_message_get_seqnum</span>(3)</span></a>
    fail with <code class="constant">-ENODATA</code> on incoming messages. Note
    that not all transports support timestamping of messages. On local
    transports, the timestamping is applied by the kernel and cannot
    be manipulated by userspace. By default, message timestamping is
    not negotiated for all connections.</p><p><code class="function">sd_bus_negotiate_creds()</code> controls
    whether implicit sender credentials shall be attached
    automatically to all incoming messages. Takes a bus object, a
    boolean indicating whether to enable or disable the credential
    parts encoded in the bit mask value argument. Note that not all
    transports support attaching sender credentials to messages, or do
    not support all types of sender credential parameters, or might
    suppress them under certain circumstances for individual
    messages. On local transports, the sender credentials are attached
    by the kernel and cannot be manipulated by userspace. By default,
    no sender credentials are attached.</p><p>The <code class="function">sd_bus_negotiate_fds()</code> function may
    be called only before the connection has been started with
    <a href="sd_bus_start.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_start</span>(3)</span></a>. Both
    <code class="function">sd_bus_negotiate_timestamp()</code> and
    <code class="function">sd_bus_negotiate_creds()</code> also may be called
    after a connection has been set up. Note that when operating on a
    connection that is shared between multiple components of the same
    program (for example via
    <a href="sd_bus_default.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_default</span>(3)</span></a>)
    it is highly recommended to only enable additional per message
    metadata fields, but never disable them again, in order not to
    disable functionality needed by other components.</p></div><div class="refsect1"><a name="idm47509298512896"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value">¶</a></h2><p>On success, these functions returns 0 or a
    positive integer. On failure, they return a negative errno-style
    error code.</p></div><div class="refsect1"><a name="idm47509298684432"></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="-EPERM"><span class="term"><code class="constant">-EPERM</code></span><a class="headerlink" title="Permalink to this term" href="#-EPERM">¶</a></dt><dd><p>The bus connection has already been started.</p></dd></dl></div></div><div class="refsect1"><a name="idm47509300034448"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p><code class="function">sd_bus_negotiate_fs()</code> and the other
    functions described here are 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="idm47509297918176"></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_start.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_start</span>(3)</span></a>,
      <a href="sd_bus_message_can_send.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_message_can_send</span>(3)</span></a>,
      <a href="sd_bus_message_get_monotonic_usec.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_message_get_monotonic_usec</span>(3)</span></a>,
      <a href="sd_bus_message_get_creds.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_message_get_creds</span>(3)</span></a>,
      <a href="systemd.busname.html"><span class="citerefentry"><span class="refentrytitle">systemd.busname</span>(5)</span></a>
    </p></div></div></body></html>