1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_journal_seek_head</title><meta name="generator" content="DocBook XSL Stylesheets V1.77.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><a href="index.html">Index </a>·
2
<a href="systemd.directives.html">Directives </a>·
3
<a href="../python-systemd/index.html">Python </a>·
4
<a href="../libudev/index.html">libudev </a>·
5
<a href="../libudev/index.html">gudev </a><span style="float:right">systemd 202</span><hr><div class="refentry"><a name="sd_journal_seek_head"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_journal_seek_head, sd_journal_seek_tail, sd_journal_seek_monotonic_usec, sd_journal_seek_realtime_usec, sd_journal_seek_cursor — Seek to a position in the
6
journal</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_seek_head</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">int <b class="fsfunc">sd_journal_seek_tail</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">int <b class="fsfunc">sd_journal_seek_monotonic_usec</b>(</code></td><td>sd_journal* <var class="pdparam">j</var>, </td></tr><tr><td> </td><td>sd_id128_t <var class="pdparam">boot_id</var>, </td></tr><tr><td> </td><td>uint64_t <var class="pdparam">usec</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_seek_realtime_usec</b>(</code></td><td>sd_journal* <var class="pdparam">j</var>, </td></tr><tr><td> </td><td>uint64_t <var class="pdparam">usec</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_seek_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="idp57024"></a><h2>Description</h2><p><code class="function">sd_journal_seek_head()</code>
7
seeks to the beginning of the journal, i.e. the oldest
8
available entry.</p><p>Similar,
9
<code class="function">sd_journal_seek_tail()</code> may be
10
used to seek to the end of the journal, i.e. the most
11
recent available entry.</p><p><code class="function">sd_journal_seek_monotonic_usec()</code>
12
seeks to the entry with the specified monotonic
13
timestamp, i.e. CLOCK_MONOTONIC. Since monotonic time
14
restarts on every reboot a boot ID needs to be
15
specified as well.</p><p><code class="function">sd_journal_seek_realtime_usec()</code>
16
seeks to the entry with the specified realtime
17
(wallclock) timestamp, i.e. CLOCK_REALTIME. Note that
18
the realtime clock is not necessarily monotonic. If a
19
realtime timestamp is ambiguous it is not defined
20
which position is sought to.</p><p><code class="function">sd_journal_seek_cursor()</code>
21
seeks to the entry located at the specified cursor
22
string. For details on cursors see
23
<a href="sd_journal_get_cursor.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_cursor</span>(3)</span></a>. If
24
no entry matching the specified cursor is found the
25
call will seek to the next closest entry (in terms of
26
time) instead. To verify whether the newly selected
27
entry actually matches the cursor use
28
<a href="sd_journal_test_cursor.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_test_cursor</span>(3)</span></a>.</p><p>Note that these calls do not actually make any
29
entry the new current entry, this needs to be done in
30
a separate step with a subsequent
31
<a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>
32
invocation (or a similar call). Only then entry data
34
<a href="sd_journal_get_data.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_data</span>(3)</span></a>. If
35
no entry exists that matches exactly the specified
36
seek address the next closest is sought to. If
37
<a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>
38
is used the closest following entry will be sought to,
40
<a href="sd_journal_previous.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_previous</span>(3)</span></a>
41
is used the closest preceding entry is sought
42
to.</p></div><div class="refsect1"><a name="idp69872"></a><h2>Return Value</h2><p>The functions return 0 on success or a negative
43
errno-style error code.</p></div><div class="refsect1"><a name="idp71056"></a><h2>Notes</h2><p>The <code class="function">sd_journal_seek_head()</code>,
44
<code class="function">sd_journal_seek_tail()</code>,
45
<code class="function">sd_journal_seek_monotonic_usec()</code>,
46
<code class="function">sd_journal_seek_realtime_usec()</code>,
47
and <code class="function">sd_journal_seek_cursor()</code>
48
interfaces are available as shared library, which can
49
be compiled and linked to with the
50
<code class="literal">libsystemd-journal</code>
51
<a href="pkg-config.html"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
52
file.</p></div><div class="refsect1"><a name="idp109360"></a><h2>See Also</h2><p>
53
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
54
<a href="sd-journal.html"><span class="citerefentry"><span class="refentrytitle">sd-journal</span>(3)</span></a>,
55
<a href="sd_journal_open.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_open</span>(3)</span></a>,
56
<a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>,
57
<a href="sd_journal_get_data.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_data</span>(3)</span></a>,
58
<a href="sd_journal_get_cursor.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_cursor</span>(3)</span></a>,
59
<a href="sd_journal_get_realtime_usec.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_realtime_usec</span>(3)</span></a>
60
</p></div></div></body></html>