chiark / gitweb /
include <poll.h> instead of <sys/poll.h>
[elogind.git] / man / sd_journal_seek_head.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6   This file is part of systemd.
7
8   Copyright 2012 Lennart Poettering
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="sd_journal_seek_head">
25
26   <refentryinfo>
27     <title>sd_journal_seek_head</title>
28     <productname>systemd</productname>
29
30     <authorgroup>
31       <author>
32         <contrib>Developer</contrib>
33         <firstname>Lennart</firstname>
34         <surname>Poettering</surname>
35         <email>lennart@poettering.net</email>
36       </author>
37     </authorgroup>
38   </refentryinfo>
39
40   <refmeta>
41     <refentrytitle>sd_journal_seek_head</refentrytitle>
42     <manvolnum>3</manvolnum>
43   </refmeta>
44
45   <refnamediv>
46     <refname>sd_journal_seek_head</refname>
47     <refname>sd_journal_seek_tail</refname>
48     <refname>sd_journal_seek_monotonic_usec</refname>
49     <refname>sd_journal_seek_realtime_usec</refname>
50     <refname>sd_journal_seek_cursor</refname>
51     <refpurpose>Seek to a position in the
52     journal</refpurpose>
53   </refnamediv>
54
55   <refsynopsisdiv>
56     <funcsynopsis>
57       <funcsynopsisinfo>#include &lt;systemd/sd-journal.h&gt;</funcsynopsisinfo>
58
59       <funcprototype>
60         <funcdef>int <function>sd_journal_seek_head</function></funcdef>
61         <paramdef>sd_journal *<parameter>j</parameter></paramdef>
62       </funcprototype>
63
64       <funcprototype>
65         <funcdef>int <function>sd_journal_seek_tail</function></funcdef>
66         <paramdef>sd_journal *<parameter>j</parameter></paramdef>
67       </funcprototype>
68
69       <funcprototype>
70         <funcdef>int <function>sd_journal_seek_monotonic_usec</function></funcdef>
71         <paramdef>sd_journal *<parameter>j</parameter></paramdef>
72         <paramdef>sd_id128_t <parameter>boot_id</parameter></paramdef>
73         <paramdef>uint64_t <parameter>usec</parameter></paramdef>
74       </funcprototype>
75
76       <funcprototype>
77         <funcdef>int <function>sd_journal_seek_realtime_usec</function></funcdef>
78         <paramdef>sd_journal *<parameter>j</parameter></paramdef>
79         <paramdef>uint64_t <parameter>usec</parameter></paramdef>
80       </funcprototype>
81
82       <funcprototype>
83         <funcdef>int <function>sd_journal_seek_cursor</function></funcdef>
84         <paramdef>sd_journal *<parameter>j</parameter></paramdef>
85         <paramdef>const char *<parameter>cursor</parameter></paramdef>
86       </funcprototype>
87     </funcsynopsis>
88   </refsynopsisdiv>
89
90   <refsect1>
91     <title>Description</title>
92
93     <para><function>sd_journal_seek_head()</function> seeks to the
94     beginning of the journal, i.e. the oldest available entry.</para>
95
96     <para>Similarly, <function>sd_journal_seek_tail()</function> may
97     be used to seek to the end of the journal, i.e. the most recent
98     available entry.</para>
99
100     <para><function>sd_journal_seek_monotonic_usec()</function> seeks
101     to the entry with the specified monotonic timestamp, i.e.
102     <constant>CLOCK_MONOTONIC</constant>. Since monotonic time
103     restarts on every reboot a boot ID needs to be specified as
104     well.</para>
105
106     <para><function>sd_journal_seek_realtime_usec()</function> seeks
107     to the entry with the specified realtime (wallclock) timestamp,
108     i.e. <constant>CLOCK_REALTIME</constant>. Note that the realtime
109     clock is not necessarily monotonic. If a realtime timestamp is
110     ambiguous, it is not defined which position is sought to.</para>
111
112     <para><function>sd_journal_seek_cursor()</function> seeks to the
113     entry located at the specified cursor string. For details on
114     cursors, see
115     <citerefentry><refentrytitle>sd_journal_get_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
116     If no entry matching the specified cursor is found the call will
117     seek to the next closest entry (in terms of time) instead. To
118     verify whether the newly selected entry actually matches the
119     cursor, use
120     <citerefentry><refentrytitle>sd_journal_test_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
121
122     <para>Note that these calls do not actually make any entry the new
123     current entry, this needs to be done in a separate step with a
124     subsequent
125     <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>
126     invocation (or a similar call). Only then, entry data may be
127     retrieved via
128     <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
129     If no entry exists that matches exactly the specified seek
130     address, the next closest is sought to. If
131     <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>
132     is used, the closest following entry will be sought to, if
133     <citerefentry><refentrytitle>sd_journal_previous</refentrytitle><manvolnum>3</manvolnum></citerefentry>
134     is used the closest preceding entry is sought to.</para>
135   </refsect1>
136
137   <refsect1>
138     <title>Return Value</title>
139
140     <para>The functions return 0 on success or a negative errno-style
141     error code.</para>
142   </refsect1>
143
144   <refsect1>
145     <title>Notes</title>
146
147     <para>The <function>sd_journal_seek_head()</function>,
148     <function>sd_journal_seek_tail()</function>,
149     <function>sd_journal_seek_monotonic_usec()</function>,
150     <function>sd_journal_seek_realtime_usec()</function>,
151     and <function>sd_journal_seek_cursor()</function>
152     interfaces are available as a shared library, which can
153     be compiled and linked to with the
154     <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
155     file.</para>
156   </refsect1>
157
158   <refsect1>
159     <title>See Also</title>
160
161     <para>
162       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
163       <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
164       <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
165       <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
166       <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
167       <citerefentry><refentrytitle>sd_journal_get_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
168       <citerefentry><refentrytitle>sd_journal_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>
169     </para>
170   </refsect1>
171
172 </refentry>