chiark / gitweb /
udevadm-settle: add missing brace
[elogind.git] / man / sd_journal_get_cursor.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_get_cursor">
25
26         <refentryinfo>
27                 <title>sd_journal_get_cursor</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_get_cursor</refentrytitle>
42                 <manvolnum>3</manvolnum>
43         </refmeta>
44
45         <refnamediv>
46                 <refname>sd_journal_get_cursor</refname>
47                 <refname>sd_journal_test_cursor</refname>
48                 <refpurpose>Get cursor string for or test cursor string against the current journal entry</refpurpose>
49         </refnamediv>
50
51         <refsynopsisdiv>
52                 <funcsynopsis>
53                         <funcsynopsisinfo>#include &lt;systemd/sd-journal.h&gt;</funcsynopsisinfo>
54
55                         <funcprototype>
56                                 <funcdef>int <function>sd_journal_get_cursor</function></funcdef>
57                                 <paramdef>sd_journal* <parameter>j</parameter></paramdef>
58                                 <paramdef>char ** <parameter>cursor</parameter></paramdef>
59                         </funcprototype>
60
61                         <funcprototype>
62                                 <funcdef>int <function>sd_journal_test_cursor</function></funcdef>
63                                 <paramdef>sd_journal* <parameter>j</parameter></paramdef>
64                                 <paramdef>const char * <parameter>cursor</parameter></paramdef>
65                         </funcprototype>
66
67                 </funcsynopsis>
68         </refsynopsisdiv>
69
70         <refsect1>
71                 <title>Description</title>
72
73                 <para><function>sd_journal_get_cursor()</function>
74                 returns a cursor string for the current journal
75                 entry. A cursor is a serialization of the current
76                 journal position formatted as text. The string only
77                 contains printable characters and can be passed around
78                 in text form. The cursor identifies a journal entry
79                 globally and in a stable way and may be used to later
80                 seek to it via
81                 <citerefentry><refentrytitle>sd_journal_seek_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>. The
82                 cursor string should be considered opaque and not be
83                 parsed by clients. Seeking to a cursor position
84                 without the specific entry being available locally
85                 will seek to the next closest (in terms of time)
86                 available entry. The call takes two arguments: a
87                 journal context object and a pointer to a string
88                 pointer where the cursor string will be placed. The
89                 string is allocated via libc
90                 <citerefentry><refentrytitle>malloc</refentrytitle><manvolnum>3</manvolnum></citerefentry>
91                 and should be freed after use with
92                 <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
93
94                 <para>Note that
95                 <function>sd_journal_get_cursor()</function> will not
96                 work before
97                 <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>
98                 (or related call) has been called at least once, in
99                 order to position the read pointer at a valid
100                 entry.</para>
101
102                 <para><function>sd_journal_test_cursor()</function>
103                 may be used to check whether the current position in
104                 the journal matches the specified cursor. This is
105                 useful since cursor strings do not uniquely identify
106                 an entry: the same entry might be referred to by
107                 multiple different cursor strings, and hence string
108                 comparing cursors is not possible. Use this call to
109                 verify after an invocation of
110                 <citerefentry><refentrytitle>sd_journal_seek_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>
111                 whether the entry being sought to was actually found
112                 in the journal or the next closest entry was used
113                 instead.</para>
114         </refsect1>
115
116         <refsect1>
117                 <title>Return Value</title>
118
119                 <para><function>sd_journal_get_cursor()</function>
120                 returns 0 on success or a negative errno-style error
121                 code. <function>sd_journal_test_cursor()</function>
122                 returns positive if the current entry matches the
123                 specified cursor, 0 if it does not match the specified
124                 cursor or a negative errno-style error code on
125                 failure.</para>
126         </refsect1>
127
128         <refsect1>
129                 <title>Notes</title>
130
131                 <para>The <function>sd_journal_get_cursor()</function>
132                 and <function>sd_journal_test_cursor()</function>
133                 interfaces are available as shared library, which can
134                 be compiled and linked to with the
135                 <constant>libsystemd-journal</constant> <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
136                 file.</para>
137         </refsect1>
138
139         <refsect1>
140                 <title>See Also</title>
141
142                 <para>
143                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
144                         <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
145                         <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
146                         <citerefentry><refentrytitle>sd_journal_seek_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>
147                 </para>
148         </refsect1>
149
150 </refentry>