mirror of
https://git.proxmox.com/git/systemd
synced 2025-06-03 23:29:44 +00:00
75 lines
6.9 KiB
HTML
75 lines
6.9 KiB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_journal_get_cursor</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 214</span><hr><div class="refentry"><a name="sd_journal_get_cursor"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_journal_get_cursor, sd_journal_test_cursor — Get cursor string for or test cursor string against the current journal entry</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <systemd/sd-journal.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_journal_get_cursor</b>(</code></td><td>sd_journal *<var class="pdparam">j</var>, </td></tr><tr><td> </td><td>char **<var class="pdparam">cursor</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_test_cursor</b>(</code></td><td>sd_journal *<var class="pdparam">j</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">cursor</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm214192150240"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_journal_get_cursor()</code>
|
||
returns a cursor string for the current journal
|
||
entry. A cursor is a serialization of the current
|
||
journal position formatted as text. The string only
|
||
contains printable characters and can be passed around
|
||
in text form. The cursor identifies a journal entry
|
||
globally and in a stable way and may be used to later
|
||
seek to it via
|
||
<a href="sd_journal_seek_cursor.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_seek_cursor</span>(3)</span></a>. The
|
||
cursor string should be considered opaque and not be
|
||
parsed by clients. Seeking to a cursor position
|
||
without the specific entry being available locally
|
||
will seek to the next closest (in terms of time)
|
||
available entry. The call takes two arguments: a
|
||
journal context object and a pointer to a string
|
||
pointer where the cursor string will be placed. The
|
||
string is allocated via libc
|
||
<a href="malloc.html"><span class="citerefentry"><span class="refentrytitle">malloc</span>(3)</span></a>
|
||
and should be freed after use with
|
||
<a href="free.html"><span class="citerefentry"><span class="refentrytitle">free</span>(3)</span></a>.</p><p>Note that
|
||
<code class="function">sd_journal_get_cursor()</code> will not
|
||
work before
|
||
<a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>
|
||
(or related call) has been called at least once, in
|
||
order to position the read pointer at a valid
|
||
entry.</p><p><code class="function">sd_journal_test_cursor()</code>
|
||
may be used to check whether the current position in
|
||
the journal matches the specified cursor. This is
|
||
useful since cursor strings do not uniquely identify
|
||
an entry: the same entry might be referred to by
|
||
multiple different cursor strings, and hence string
|
||
comparing cursors is not possible. Use this call to
|
||
verify after an invocation of
|
||
<a href="sd_journal_seek_cursor.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_seek_cursor</span>(3)</span></a>
|
||
whether the entry being sought to was actually found
|
||
in the journal or the next closest entry was used
|
||
instead.</p></div><div class="refsect1"><a name="idm214192215984"></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_cursor()</code>
|
||
returns 0 on success or a negative errno-style error
|
||
code. <code class="function">sd_journal_test_cursor()</code>
|
||
returns positive if the current entry matches the
|
||
specified cursor, 0 if it does not match the specified
|
||
cursor or a negative errno-style error code on
|
||
failure.</p></div><div class="refsect1"><a name="idm214192213184"></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_cursor()</code>
|
||
and <code class="function">sd_journal_test_cursor()</code>
|
||
interfaces are available as a shared library, which can
|
||
be compiled and linked to with the
|
||
<code class="constant">libsystemd</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="idm214192209056"></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_open.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_open</span>(3)</span></a>,
|
||
<a href="sd_journal_seek_cursor.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_seek_cursor</span>(3)</span></a>
|
||
</p></div></div></body></html>
|