~ubuntu-branches/ubuntu/trusty/systemd/trusty

« back to all changes in this revision

Viewing changes to man/sd_journal_enumerate_data.html

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Michael Biebl, Michael Stapelberg, Daniel Schaal, Ondrej Balaz
  • Date: 2013-09-12 00:13:11 UTC
  • mfrom: (1.1.11) (9.1.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: package-import@ubuntu.com-20130912001311-dz35it34wr2lbday
Tags: 204-3
[ Michael Biebl ]
* Upload to unstable.
* Use /bin/bash in debug-shell.service as Debian doesn't have /sbin/sushell.
* Only import net.ifaces cmdline property for network devices.
* Generate strict dependencies between the binary packages using a
  shlibs.local file and add an explicit versioned dependency on
  libsystemd-login0 to systemd to ensure packages are upgraded in sync.
  Closes: #719444
* Drop obsolete Replaces: libudev0 from udev package.
* Use correct paths for various binaries, like /sbin/quotaon, which are
  installed in / and not /usr in Debian.  Closes: #721347
* Don't install kernel-install(8) man page since we don't install the
  corresponding binary either.  Closes: #722180
* Cherry-pick upstream fixes to make switching runlevels and starting
  reboot via ctrl-alt-del more robust.
* Cherry-pick upstream fix to properly apply ACLs to Journal files.

[ Michael Stapelberg ]
* Make systemctl enable|disable call update-rc.d for SysV init scripts.
  Closes: #709780
* Don't mount /tmp as tmpfs by default and make it possible to enable this
  feature via "systemctl enable tmp.mount".

[ Daniel Schaal ]
* Add bug-script to systemd and udev.  Closes: #711245

[ Ondrej Balaz ]
* Recognize discard option in /etc/crypttab.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_journal_get_data</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
 
2
    a.headerlink {
 
3
      color: #c60f0f;
 
4
      font-size: 0.8em;
 
5
      padding: 0 4px 0 4px;
 
6
      text-decoration: none;
 
7
      visibility: hidden;
 
8
    }
 
9
 
 
10
    a.headerlink:hover {
 
11
      background-color: #c60f0f;
 
12
      color: white;
 
13
    }
 
14
 
 
15
    h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
 
16
      visibility: visible;
 
17
    }
 
18
  </style><a href="index.html">Index </a>·
 
19
  <a href="systemd.directives.html">Directives </a>·
 
20
  <a href="../python-systemd/index.html">Python </a>·
 
21
  <a href="../libudev/index.html">libudev </a>·
 
22
  <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 204</span><hr><div class="refentry"><a name="sd_journal_get_data"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_journal_get_data, sd_journal_enumerate_data, sd_journal_restart_data, SD_JOURNAL_FOREACH_DATA, sd_journal_set_data_threshold, sd_journal_get_data_threshold — Read data fields from the current journal entry</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;systemd/sd-journal.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_journal_get_data</b>(</code></td><td>sd_journal* <var class="pdparam">j</var>, </td></tr><tr><td> </td><td>const char* <var class="pdparam">field</var>, </td></tr><tr><td> </td><td>const void** <var class="pdparam">data</var>, </td></tr><tr><td> </td><td>size_t* <var class="pdparam">length</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_journal_enumerate_data</b>(</code></td><td>sd_journal* <var class="pdparam">j</var>, </td></tr><tr><td> </td><td>const void** <var class="pdparam">data</var>, </td></tr><tr><td> </td><td>size_t* <var class="pdparam">length</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">void <b class="fsfunc">sd_journal_restart_data</b>(</code></td><td>sd_journal* <var class="pdparam">j</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"><b class="fsfunc">SD_JOURNAL_FOREACH_DATA</b>(</code></td><td>sd_journal* <var class="pdparam">j</var>, </td></tr><tr><td> </td><td>const void* <var class="pdparam">data</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">length</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_journal_set_data_threshold</b>(</code></td><td>sd_journal* <var class="pdparam">j</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">sz</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_journal_get_data_threshold</b>(</code></td><td>sd_journal* <var class="pdparam">j</var>, </td></tr><tr><td> </td><td>size_t* <var class="pdparam">sz</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm259782712960"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_journal_get_data()</code> gets
 
23
                the data object associated with a specific field from
 
24
                the current journal entry. It takes four arguments:
 
25
                the journal context object, a string with the field
 
26
                name to request, plus a pair of pointers to
 
27
                pointer/size variables where the data object and its
 
28
                size shall be stored in. The field name should be an
 
29
                entry field name. Well-known field names are listed in
 
30
                <a href="systemd.journal-fields.html"><span class="citerefentry"><span class="refentrytitle">systemd.journal-fields</span>(7)</span></a>. The
 
31
                returned data is in a read-only memory map and is only
 
32
                valid until the next invocation of
 
33
                <code class="function">sd_journal_get_data()</code> or
 
34
                <code class="function">sd_journal_enumerate_data()</code>, or
 
35
                the read pointer is altered. Note that the data
 
36
                returned will be prefixed with the field name and
 
37
                '='. Also note that by default data fields larger than
 
38
                64K might get truncated to 64K. This threshold may be
 
39
                changed and turned off with
 
40
                <code class="function">sd_journal_set_data_threshold()</code> (see
 
41
                below).</p><p><code class="function">sd_journal_enumerate_data()</code>
 
42
                may be used to iterate through all fields of the
 
43
                current entry. On each invocation the data for the
 
44
                next field is returned. The order of these fields is
 
45
                not defined. The data returned is in the same format
 
46
                as with <code class="function">sd_journal_get_data()</code> and
 
47
                also follows the same life-time semantics.</p><p><code class="function">sd_journal_restart_data()</code>
 
48
                resets the data enumeration index to the beginning of
 
49
                the entry. The next invocation of
 
50
                <code class="function">sd_journal_enumerate_data()</code> will return the first
 
51
                field of the entry again.</p><p>Note that the
 
52
                <code class="function">SD_JOURNAL_FOREACH_DATA()</code> macro
 
53
                may be used as a handy wrapper around
 
54
                <code class="function">sd_journal_restart_data()</code> and
 
55
                <code class="function">sd_journal_enumerate_data()</code>.</p><p>Note that these functions will not work before
 
56
                <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>
 
57
                (or related call) has been called at least
 
58
                once, in order to position the read pointer at a valid entry.</p><p><code class="function">sd_journal_set_data_threshold()</code>
 
59
                may be used to change the data field size threshold
 
60
                for data returned by
 
61
                <code class="function">sd_journal_get_data()</code>,
 
62
                <code class="function">sd_journal_enumerate_data()</code> and
 
63
                <code class="function">sd_journal_enumerate_unique()</code>. This
 
64
                threshold is a hint only: it indicates that the client
 
65
                program is interested only in the initial parts of the
 
66
                data fields, up to the threshold in size -- but the
 
67
                library might still return larger data objects. That
 
68
                means applications should not rely exclusively on this
 
69
                setting to limit the size of the data fields returned,
 
70
                but need to apply a explicit size limit on the
 
71
                returned data as well. This threshold defaults to 64K
 
72
                by default. To retrieve the complete data fields this
 
73
                threshold should be turned off by setting it to 0, so
 
74
                that the library always returns the complete data
 
75
                objects. It is recommended to set this threshold as
 
76
                low as possible since this relieves the library from
 
77
                having to decompress large compressed data objects in
 
78
                full.</p><p><code class="function">sd_journal_get_data_threshold()</code>
 
79
                returns the currently configured data field size
 
80
                threshold.</p></div><div class="refsect1"><a name="idm259782687296"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value">¶</a></h2><p><code class="function">sd_journal_get_data()</code>
 
81
                returns 0 on success or a negative errno-style error
 
82
                code. If the current entry does not include the
 
83
                specified field -ENOENT is returned. If
 
84
                <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>
 
85
                has not been called at least once -EADDRNOTAVAIL is
 
86
                returned. <code class="function">sd_journal_enumerate_data()</code>
 
87
                returns a positive integer if the next field has been
 
88
                read, 0 when no more fields are known, or a negative
 
89
                errno-style error
 
90
                code. <code class="function">sd_journal_restart_data()</code>
 
91
                returns
 
92
                nothing. <code class="function">sd_journal_set_data_threshold()</code>
 
93
                and <code class="function">sd_journal_get_threshold()</code>
 
94
                return 0 on success or a negative errno-style error
 
95
                code.</p></div><div class="refsect1"><a name="idm259782681248"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p>The <code class="function">sd_journal_get_data()</code>,
 
96
                <code class="function">sd_journal_enumerate_data()</code>,
 
97
                <code class="function">sd_journal_restart_data()</code>,
 
98
                <code class="function">sd_journal_set_data_threshold()</code>
 
99
                and
 
100
                <code class="function">sd_journal_get_data_threshold()</code>
 
101
                interfaces are available as shared library, which can
 
102
                be compiled and linked to with the
 
103
                <code class="literal">libsystemd-journal</code>
 
104
                <a href="pkg-config.html"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
 
105
                file.</p></div><div class="refsect1"><a name="idm259777759888"></a><h2 id="Examples">Examples<a class="headerlink" title="Permalink to this headline" href="#Examples">¶</a></h2><p>See
 
106
                <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>
 
107
                for a complete example how to use
 
108
                <code class="function">sd_journal_get_data()</code>.</p><p>Use the
 
109
                <code class="function">SD_JOURNAL_FOREACH_DATA</code> macro to
 
110
                iterate through all fields of the current journal
 
111
                entry:</p><pre class="programlisting">...
 
112
int print_fields(sd_journal *j) {
 
113
        const void *data;
 
114
        size_t l;
 
115
        SD_JOURNAL_FOREACH_DATA(j, data, length)
 
116
                printf("%.*s\n", (int) length, data);
 
117
}
 
118
...</pre></div><div class="refsect1"><a name="idm259777755392"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
 
119
                        <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
 
120
                        <a href="systemd.journal-fields.html"><span class="citerefentry"><span class="refentrytitle">systemd.journal-fields</span>(7)</span></a>,
 
121
                        <a href="sd-journal.html"><span class="citerefentry"><span class="refentrytitle">sd-journal</span>(3)</span></a>,
 
122
                        <a href="sd_journal_open.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_open</span>(3)</span></a>,
 
123
                        <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>,
 
124
                        <a href="sd_journal_get_realtime_usec.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_realtime_usec</span>(3)</span></a>,
 
125
                        <a href="sd_journal_query_unique.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_query_unique</span>(3)</span></a>
 
126
                </p></div></div></body></html>