]>
Commit | Line | Data |
---|---|---|
639a6a25 | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
eea10b26 | 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
db9ecf05 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
639a6a25 | 5 | |
7d6b2723 | 6 | <refentry id="sd_journal_seek_head" xmlns:xi="http://www.w3.org/2001/XInclude"> |
639a6a25 | 7 | |
798d3a52 ZJS |
8 | <refentryinfo> |
9 | <title>sd_journal_seek_head</title> | |
10 | <productname>systemd</productname> | |
798d3a52 ZJS |
11 | </refentryinfo> |
12 | ||
13 | <refmeta> | |
14 | <refentrytitle>sd_journal_seek_head</refentrytitle> | |
15 | <manvolnum>3</manvolnum> | |
16 | </refmeta> | |
17 | ||
18 | <refnamediv> | |
19 | <refname>sd_journal_seek_head</refname> | |
20 | <refname>sd_journal_seek_tail</refname> | |
21 | <refname>sd_journal_seek_monotonic_usec</refname> | |
22 | <refname>sd_journal_seek_realtime_usec</refname> | |
23 | <refname>sd_journal_seek_cursor</refname> | |
24 | <refpurpose>Seek to a position in the | |
25 | journal</refpurpose> | |
26 | </refnamediv> | |
27 | ||
28 | <refsynopsisdiv> | |
29 | <funcsynopsis> | |
30 | <funcsynopsisinfo>#include <systemd/sd-journal.h></funcsynopsisinfo> | |
31 | ||
32 | <funcprototype> | |
33 | <funcdef>int <function>sd_journal_seek_head</function></funcdef> | |
34 | <paramdef>sd_journal *<parameter>j</parameter></paramdef> | |
35 | </funcprototype> | |
36 | ||
37 | <funcprototype> | |
38 | <funcdef>int <function>sd_journal_seek_tail</function></funcdef> | |
39 | <paramdef>sd_journal *<parameter>j</parameter></paramdef> | |
40 | </funcprototype> | |
41 | ||
42 | <funcprototype> | |
43 | <funcdef>int <function>sd_journal_seek_monotonic_usec</function></funcdef> | |
44 | <paramdef>sd_journal *<parameter>j</parameter></paramdef> | |
45 | <paramdef>sd_id128_t <parameter>boot_id</parameter></paramdef> | |
46 | <paramdef>uint64_t <parameter>usec</parameter></paramdef> | |
47 | </funcprototype> | |
48 | ||
49 | <funcprototype> | |
50 | <funcdef>int <function>sd_journal_seek_realtime_usec</function></funcdef> | |
51 | <paramdef>sd_journal *<parameter>j</parameter></paramdef> | |
52 | <paramdef>uint64_t <parameter>usec</parameter></paramdef> | |
53 | </funcprototype> | |
54 | ||
55 | <funcprototype> | |
56 | <funcdef>int <function>sd_journal_seek_cursor</function></funcdef> | |
57 | <paramdef>sd_journal *<parameter>j</parameter></paramdef> | |
58 | <paramdef>const char *<parameter>cursor</parameter></paramdef> | |
59 | </funcprototype> | |
60 | </funcsynopsis> | |
61 | </refsynopsisdiv> | |
62 | ||
63 | <refsect1> | |
64 | <title>Description</title> | |
65 | ||
88f739cb LP |
66 | <para><function>sd_journal_seek_head()</function> seeks to the beginning of the journal, i.e. to the |
67 | position before the oldest available entry.</para> | |
68 | ||
69 | <para>Similarly, <function>sd_journal_seek_tail()</function> may be used to seek to the end of the | |
70 | journal, i.e. the position after the most recent available entry.</para> | |
71 | ||
72 | <para><function>sd_journal_seek_monotonic_usec()</function> seeks to a position with the specified | |
73 | monotonic timestamp, i.e. <constant>CLOCK_MONOTONIC</constant>. Since monotonic time restarts on every | |
74 | reboot a boot ID needs to be specified as well.</para> | |
75 | ||
76 | <para><function>sd_journal_seek_realtime_usec()</function> seeks to a position with the specified | |
77 | realtime (wallclock) timestamp, i.e. <constant>CLOCK_REALTIME</constant>. Note that the realtime clock is | |
78 | not necessarily monotonic. If a realtime timestamp is ambiguous, it is not defined which position is | |
79 | sought to.</para> | |
80 | ||
81 | <para><function>sd_journal_seek_cursor()</function> seeks to the position at the specified cursor | |
82 | string. For details on cursors, see | |
798d3a52 | 83 | <citerefentry><refentrytitle>sd_journal_get_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>. |
88f739cb | 84 | If no entry matching the specified cursor is found the call will seek to the next closest entry (in terms |
aea6787f | 85 | of time) instead.</para> |
798d3a52 | 86 | |
88f739cb LP |
87 | <para>Note that these calls do not actually make any entry the new current entry, this needs to be done |
88 | in a separate step with a subsequent | |
798d3a52 | 89 | <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
88f739cb LP |
90 | invocation (or a similar call). Only then, entry data may be retrieved via |
91 | <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
92 | or an entry cursor be retrieved via | |
93 | <citerefentry><refentrytitle>sd_journal_get_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>. | |
94 | If no entry exists that matches exactly the specified seek address, the next closest is sought to. If | |
95 | <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry> is | |
96 | used, the closest following entry will be sought to, if | |
798d3a52 ZJS |
97 | <citerefentry><refentrytitle>sd_journal_previous</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
98 | is used the closest preceding entry is sought to.</para> | |
aea6787f ZJS |
99 | |
100 | <para>After the seek is done, and | |
101 | <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
102 | or a similar call has been made, | |
103 | <citerefentry><refentrytitle>sd_journal_test_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
104 | may be used to verify whether the newly selected entry actually matches the cursor. | |
105 | </para> | |
798d3a52 ZJS |
106 | </refsect1> |
107 | ||
108 | <refsect1> | |
109 | <title>Return Value</title> | |
110 | ||
111 | <para>The functions return 0 on success or a negative errno-style | |
112 | error code.</para> | |
113 | </refsect1> | |
114 | ||
115 | <refsect1> | |
116 | <title>Notes</title> | |
117 | ||
64a7ef8b | 118 | <xi:include href="threads-aware.xml" xpointer="strict"/> |
a8d46a16 | 119 | |
7d6b2723 | 120 | <xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/> |
798d3a52 ZJS |
121 | </refsect1> |
122 | ||
69106f47 AK |
123 | <refsect1> |
124 | <title>History</title> | |
00f95506 AK |
125 | <para><function>sd_journal_seek_head()</function>, |
126 | <function>sd_journal_seek_tail()</function>, | |
127 | <function>sd_journal_seek_monotonic_usec()</function>, | |
128 | <function>sd_journal_seek_realtime_usec()</function>, and | |
129 | <function>sd_journal_seek_cursor()</function> were added in version 187.</para> | |
69106f47 AK |
130 | </refsect1> |
131 | ||
798d3a52 ZJS |
132 | <refsect1> |
133 | <title>See Also</title> | |
134 | ||
13a69c12 DT |
135 | <para><simplelist type="inline"> |
136 | <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> | |
137 | <member><citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
138 | <member><citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
139 | <member><citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
140 | <member><citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
141 | <member><citerefentry><refentrytitle>sd_journal_get_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
142 | <member><citerefentry><refentrytitle>sd_journal_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
143 | </simplelist></para> | |
798d3a52 | 144 | </refsect1> |
639a6a25 LP |
145 | |
146 | </refentry> |