systemd/man/sd_journal_open_directory.html
Michael Stapelberg ba573a3afc Use orig tarball systemd-204.tar.xz.
Instead of tracking git upstream directly, the upstream branch now
contains the contents of the orig tarball available at
http://www.freedesktop.org/software/systemd/
2014-04-26 10:16:11 +02:00

91 lines
8.6 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_journal_open</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 204</span><hr><div class="refentry"><a name="sd_journal_open"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_journal_open, sd_journal_open_directory, sd_journal_close, sd_journal, SD_JOURNAL_LOCAL_ONLY, SD_JOURNAL_RUNTIME_ONLY, SD_JOURNAL_SYSTEM_ONLY — Open the system journal for reading</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_open</b>(</code></td><td>sd_journal** <var class="pdparam">ret</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</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_open_directory</b>(</code></td><td>sd_journal** <var class="pdparam">ret</var>, </td></tr><tr><td> </td><td>const char* <var class="pdparam">path</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</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_close</b>(</code></td><td>sd_journal* <var class="pdparam">j</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm259776818528"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p><code class="function">sd_journal_open()</code> opens
the log journal for reading. It will find all journal
files automatically and interleave them automatically
when reading. As first argument it takes a pointer to
a <code class="literal">sd_journal</code> pointer, which on
success will contain journal context object afterwards. The
second argument is a flags field, which may consist of
the following flags ORed together:
<code class="literal">SD_JOURNAL_LOCAL_ONLY</code> makes sure
only journal files generated on the local machine will
be opened. <code class="literal">SD_JOURNAL_RUNTIME_ONLY</code>
makes sure only volatile journal files will be opened,
excluding those which are stored on persistent
storage. <code class="literal">SD_JOURNAL_SYSTEM_ONLY</code>
will ensure that only journal files of system services
and the kernel (in opposition to user session processes) will
be opened.</p><p><code class="function">sd_journal_open_directory()</code>
is similar to <code class="function">sd_journal_open()</code>
but takes an absolute directory path as argument. All
journal files in this directory will be opened and
interleaved automatically. This call also takes a
flags argument, but it must be passed as 0 as no flags
are currently understood for this call.</p><p><code class="function">sd_journal_close()</code> will
close the journal context allocated with
<code class="function">sd_journal_open()</code> or
<code class="function">sd_journal_open_directory()</code> and
free its resources.</p><p>When opening the journal only journal files
accessible to the calling user will be opened. If
journal files are not accessible to the caller this
will be silently ignored.</p><p>See
<a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>
for an example how to iterate through the journal
after opening it with
<code class="function">sd_journal_open()</code>.</p><p>A journal context object returned by
<code class="function">sd_journal_open()</code> references a
specific journal entry as <span class="emphasis"><em>current</em></span> entry,
similar to a file seek index in a classic file system
file, but without absolute positions. It may be
altered with
<a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>
and
<a href="sd_journal_seek_head.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_seek_head</span>(3)</span></a>
and related calls. The current entry position may be
exported in <span class="emphasis"><em>cursor</em></span> strings, as accessible
via
<a href="sd_journal_get_cursor.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_cursor</span>(3)</span></a>. Cursor
strings may be used to globally identify a specific
journal entry in a stable way and then later to seek
to it (or if the specific entry is not available
locally, to its closest entry in time)
<a href="sd_journal_seek_cursor.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_seek_cursor</span>(3)</span></a>.</p><p>Notification of journal changes is available via
<code class="function">sd_journal_get_fd()</code> and related
calls.</p></div><div class="refsect1"><a name="idm259780692640"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value"></a></h2><p>The <code class="function">sd_journal_open()</code> and
<code class="function">sd_journal_open_directory()</code> calls
return 0 on success or a negative errno-style error
code. <code class="function">sd_journal_close()</code> returns
nothing.</p></div><div class="refsect1"><a name="idm259780689152"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes"></a></h2><p>The <code class="function">sd_journal_open()</code>,
<code class="function">sd_journal_open_directory()</code> and
<code class="function">sd_journal_close()</code> interfaces are
available as shared library, which can be compiled and
linked to with the
<code class="literal">libsystemd-journal</code>
<a href="pkg-config.html"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
file.</p></div><div class="refsect1"><a name="idm259780684064"></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-journal.html"><span class="citerefentry"><span class="refentrytitle">sd-journal</span>(3)</span></a>,
<a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>,
<a href="sd_journal_get_data.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_data</span>(3)</span></a>
</p></div></div></body></html>