]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_journal_get_cutoff_realtime_usec.xml
man: be more explicit about thread safety of sd_journal
[thirdparty/systemd.git] / man / sd_journal_get_cutoff_realtime_usec.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 SPDX-License-Identifier: LGPL-2.1+
7 -->
8
9 <refentry id="sd_journal_get_cutoff_realtime_usec" xmlns:xi="http://www.w3.org/2001/XInclude">
10
11 <refentryinfo>
12 <title>sd_journal_get_cutoff_realtime_usec</title>
13 <productname>systemd</productname>
14 </refentryinfo>
15
16 <refmeta>
17 <refentrytitle>sd_journal_get_cutoff_realtime_usec</refentrytitle>
18 <manvolnum>3</manvolnum>
19 </refmeta>
20
21 <refnamediv>
22 <refname>sd_journal_get_cutoff_realtime_usec</refname>
23 <refname>sd_journal_get_cutoff_monotonic_usec</refname>
24 <refpurpose>Read cut-off timestamps from the current journal entry</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <funcsynopsis>
29 <funcsynopsisinfo>#include &lt;systemd/sd-journal.h&gt;</funcsynopsisinfo>
30
31 <funcprototype>
32 <funcdef>int <function>sd_journal_get_cutoff_realtime_usec</function></funcdef>
33 <paramdef>sd_journal *<parameter>j</parameter></paramdef>
34 <paramdef>uint64_t *<parameter>from</parameter></paramdef>
35 <paramdef>uint64_t *<parameter>to</parameter></paramdef>
36 </funcprototype>
37
38 <funcprototype>
39 <funcdef>int <function>sd_journal_get_cutoff_monotonic_usec</function></funcdef>
40 <paramdef>sd_journal *<parameter>j</parameter></paramdef>
41 <paramdef>sd_id128_t <parameter>boot_id</parameter></paramdef>
42 <paramdef>uint64_t *<parameter>from</parameter></paramdef>
43 <paramdef>uint64_t *<parameter>to</parameter></paramdef>
44 </funcprototype>
45
46 </funcsynopsis>
47 </refsynopsisdiv>
48
49 <refsect1>
50 <title>Description</title>
51
52 <para><function>sd_journal_get_cutoff_realtime_usec()</function>
53 retrieves the realtime (wallclock) timestamps of the first and
54 last entries accessible in the journal. It takes three arguments:
55 the journal context object <parameter>j</parameter> and two
56 pointers <parameter>from</parameter> and <parameter>to</parameter>
57 pointing at 64-bit unsigned integers to store the timestamps in.
58 The timestamps are in microseconds since the epoch, i.e.
59 <constant>CLOCK_REALTIME</constant>. Either one of the two
60 timestamp arguments may be passed as <constant>NULL</constant> in
61 case the timestamp is not needed, but not both.</para>
62
63 <para><function>sd_journal_get_cutoff_monotonic_usec()</function>
64 retrieves the monotonic timestamps of the first and last entries
65 accessible in the journal. It takes three arguments: the journal
66 context object <parameter>j</parameter>, a 128-bit identifier for
67 the boot <parameter>boot_id</parameter>, and two pointers to
68 64-bit unsigned integers to store the timestamps,
69 <parameter>from</parameter> and <parameter>to</parameter>. The
70 timestamps are in microseconds since boot-up of the specific boot,
71 i.e. <constant>CLOCK_MONOTONIC</constant>. Since the monotonic
72 clock begins new with every reboot it only defines a well-defined
73 point in time when used together with an identifier identifying
74 the boot, see
75 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>
76 for more information. The function will return the timestamps for
77 the boot identified by the passed boot ID. Either one of the two
78 timestamp arguments may be passed as <constant>NULL</constant> in
79 case the timestamp is not needed, but not both.</para>
80 </refsect1>
81
82 <refsect1>
83 <title>Return Value</title>
84
85 <para><function>sd_journal_get_cutoff_realtime_usec()</function>
86 and <function>sd_journal_get_cutoff_monotonic_usec()</function>
87 return 1 on success, 0 if not suitable entries are in the journal
88 or a negative errno-style error code.</para>
89
90 <para>Locations pointed to by parameters
91 <parameter>from</parameter> and <parameter>to</parameter> will be
92 set only if the return value is positive, and obviously, the
93 parameters are non-null.</para>
94 </refsect1>
95
96 <refsect1>
97 <title>Notes</title>
98
99 <xi:include href="threads-aware.xml" xpointer="strict" />
100
101 <xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
102 </refsect1>
103
104 <refsect1>
105 <title>See Also</title>
106
107 <para>
108 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
109 <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
110 <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
111 <citerefentry><refentrytitle>sd_journal_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
112 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
113 <citerefentry><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>
114 </para>
115 </refsect1>
116
117 </refentry>