]>
Commit | Line | Data |
---|---|---|
639a6a25 | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
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 LP |
84 | If no entry matching the specified cursor is found the call will seek to the next closest entry (in terms |
85 | of time) instead. To verify whether the newly selected entry actually matches the cursor, use | |
798d3a52 ZJS |
86 | <citerefentry><refentrytitle>sd_journal_test_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para> |
87 | ||
88f739cb LP |
88 | <para>Note that these calls do not actually make any entry the new current entry, this needs to be done |
89 | in a separate step with a subsequent | |
798d3a52 | 90 | <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
88f739cb LP |
91 | invocation (or a similar call). Only then, entry data may be retrieved via |
92 | <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
93 | or an entry cursor be retrieved via | |
94 | <citerefentry><refentrytitle>sd_journal_get_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>. | |
95 | If no entry exists that matches exactly the specified seek address, the next closest is sought to. If | |
96 | <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry> is | |
97 | used, the closest following entry will be sought to, if | |
798d3a52 ZJS |
98 | <citerefentry><refentrytitle>sd_journal_previous</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
99 | is used the closest preceding entry is sought to.</para> | |
100 | </refsect1> | |
101 | ||
102 | <refsect1> | |
103 | <title>Return Value</title> | |
104 | ||
105 | <para>The functions return 0 on success or a negative errno-style | |
106 | error code.</para> | |
107 | </refsect1> | |
108 | ||
109 | <refsect1> | |
110 | <title>Notes</title> | |
111 | ||
64a7ef8b | 112 | <xi:include href="threads-aware.xml" xpointer="strict"/> |
a8d46a16 | 113 | |
7d6b2723 | 114 | <xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/> |
798d3a52 ZJS |
115 | </refsect1> |
116 | ||
117 | <refsect1> | |
118 | <title>See Also</title> | |
119 | ||
120 | <para> | |
121 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
122 | <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
123 | <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
124 | <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
125 | <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
126 | <citerefentry><refentrytitle>sd_journal_get_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
127 | <citerefentry><refentrytitle>sd_journal_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
128 | </para> | |
129 | </refsect1> | |
639a6a25 LP |
130 | |
131 | </refentry> |