chiark / gitweb /
man: document sd_journal_add_match()
[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                 <refpurpose>Get cursor string for the current journal entry</refpurpose>
48         </refnamediv>
49
50         <refsynopsisdiv>
51                 <funcsynopsis>
52                         <funcsynopsisinfo>#include &lt;systemd/sd-journal.h&gt;</funcsynopsisinfo>
53
54                         <funcprototype>
55                                 <funcdef>int <function>sd_journal_get_cursor</function></funcdef>
56                                 <paramdef>sd_journal* <parameter>j</parameter></paramdef>
57                                 <paramdef>char ** <parameter>cursor</parameter></paramdef>
58                         </funcprototype>
59
60                 </funcsynopsis>
61         </refsynopsisdiv>
62
63         <refsect1>
64                 <title>Description</title>
65
66                 <para><function>sd_journal_get_cursor()</function>
67                 returns a cursor string for the current journal
68                 entry. A cursor is a serialization of the current
69                 journal position in text form. The string only
70                 contains printable characters and can be passed around
71                 in text form. The cursor identifies a journal entry
72                 globally and in a stable way and may be used to later
73                 seek to it via
74                 <citerefentry><refentrytitle>sd_journal_seek_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>. The
75                 cursor string should be considered opaque and not be
76                 parsed by clients. Seeking to a cursor position
77                 without the specific entry being available locally
78                 will seek to the next closest (in terms of time)
79                 available entry. The call takes two arguments: a
80                 journal context object and a pointer to a
81                 string pointer where the cursor string will be
82                 placed. The string is allocated via libc <citerefentry><refentrytitle>malloc</refentrytitle><manvolnum>3</manvolnum></citerefentry> and should
83                 be freed after use with
84                 <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
85
86                 <para>Note that this function will not work before
87                 <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>
88                 (or related call) has been called at least
89                 once, in order to position the read pointer at a valid entry.</para>
90         </refsect1>
91
92         <refsect1>
93                 <title>Return Value</title>
94
95                 <para><function>sd_journal_get_cursor()</function>
96                 returns 0 on success or a negative errno-style error
97                 code.</para>
98         </refsect1>
99
100         <refsect1>
101                 <title>Notes</title>
102
103                 <para>The <function>sd_journal_get_cursor()</function>
104                 interface is available as shared library, which can be
105                 compiled and linked to with the
106                 <literal>libsystemd-journal</literal>
107                 <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
108                 file.</para>
109         </refsect1>
110
111         <refsect1>
112                 <title>See Also</title>
113
114                 <para>
115                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
116                         <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
117                         <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
118                         <citerefentry><refentrytitle>sd_journal_seek_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>
119                 </para>
120         </refsect1>
121
122 </refentry>