sd_journal_seek_head.xml revision 12b42c76672a66c2d4ea7212c14f8f1b5a62b78d
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend<?xml version='1.0'?> <!--*-nxml-*-->
2d0611ffc9f91c5fc2ddccb93f9a3d17791ae650takashi<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend<!--
7ec4d5cc4aa574e3191bc5a612e68fd8f25ab7earpluem This file is part of systemd.
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend Copyright 2012 Lennart Poettering
4b311579b2c8aebac85fb7cb8ac89e6c37b4bc1asf
b4a00883f358625923365ca1560c96edec172a52sf systemd is free software; you can redistribute it and/or modify it
50c04f297d76a57ead2fa6b73845f7563b1fc788sf under the terms of the GNU Lesser General Public License as published by
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend the Free Software Foundation; either version 2.1 of the License, or
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend (at your option) any later version.
d9b843d090f14405079b4a61a493316cd3f1e5b9minfrin
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend systemd is distributed in the hope that it will be useful, but
367d146f245f3b1c9f77c18e6ec591b52e0b344cbnicholes WITHOUT ANY WARRANTY; without even the implied warranty of
909ce17e2bd0faef7b1c294f2307f009793fd493nd MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend Lesser General Public License for more details.
0ce5630695a7aa568811a9dd0aceedd685f040dend
a29610af88e278144045bfa1bc63b4a1a4b5ff14trawick You should have received a copy of the GNU Lesser General Public License
42af92a661a06b3cebc88d585aad75064a309d51nd along with systemd; If not, see <http://www.gnu.org/licenses/>.
367d146f245f3b1c9f77c18e6ec591b52e0b344cbnicholes-->
6fe26506780e73be2a412d758af77fafdf03291and
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend<refentry id="sd_journal_seek_head">
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <refentryinfo>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <title>sd_journal_seek_head</title>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <productname>systemd</productname>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend
43f6cc6aa3312619633538b8978619a48c0ce52eminfrin <authorgroup>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <author>
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin <contrib>Developer</contrib>
0734f81384d5f2528bb119f89d135043a280d5b2minfrin <firstname>Lennart</firstname>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <surname>Poettering</surname>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <email>lennart@poettering.net</email>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend </author>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend </authorgroup>
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin </refentryinfo>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <refmeta>
05ede5110427cb9dc071cc671d5aaba5d3b88c79nd <refentrytitle>sd_journal_seek_head</refentrytitle>
e8b603fa9ccf7b17b11b42df6d8916fd97c2331dnd <manvolnum>3</manvolnum>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend </refmeta>
2f39535ac2206b346dcfbcaf271e3addc901f520rbowen
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <refnamediv>
d6ce05b6521a82cc93da69f7c2116c4a5bc54f8cjim <refname>sd_journal_seek_head</refname>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <refname>sd_journal_seek_tail</refname>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <refname>sd_journal_seek_monotonic_usec</refname>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <refname>sd_journal_seek_realtime_usec</refname>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <refname>sd_journal_seek_cursor</refname>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <refpurpose>Seek to a position in the
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend journal</refpurpose>
03a4ff9ac4c9b8009249010e7c53bb86ff05915and </refnamediv>
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <refsynopsisdiv>
1e367a83311e5243e04d68857d007d04765a48f9chrisd <funcsynopsis>
1e367a83311e5243e04d68857d007d04765a48f9chrisd <funcsynopsisinfo>#include &lt;systemd/sd-journal.h&gt;</funcsynopsisinfo>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend
7d15331eeb5429d7148d13d6fd914a641bf1c000pquerna <funcprototype>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <funcdef>int <function>sd_journal_seek_head</function></funcdef>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <paramdef>sd_journal *<parameter>j</parameter></paramdef>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend </funcprototype>
2704de98885368683621b01c8f8f4e4b01557611takashi
2704de98885368683621b01c8f8f4e4b01557611takashi <funcprototype>
2704de98885368683621b01c8f8f4e4b01557611takashi <funcdef>int <function>sd_journal_seek_tail</function></funcdef>
1e367a83311e5243e04d68857d007d04765a48f9chrisd <paramdef>sd_journal *<parameter>j</parameter></paramdef>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend </funcprototype>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend
c819c19c2f1ffbf3a3f12a4070cc6c3f4ea2a6f2sf <funcprototype>
d2b809e5d72658bff23819d8b77f20e4939af541nd <funcdef>int <function>sd_journal_seek_monotonic_usec</function></funcdef>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <paramdef>sd_journal *<parameter>j</parameter></paramdef>
fb51a6b789d85113d0976148685b0063c294220drbowen <paramdef>sd_id128_t <parameter>boot_id</parameter></paramdef>
cfbca4e518f4981f435e93e434f17271e6efc138rbowen <paramdef>uint64_t <parameter>usec</parameter></paramdef>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend </funcprototype>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <funcprototype>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <funcdef>int <function>sd_journal_seek_realtime_usec</function></funcdef>
e81d1e4f661023c964899abcbf2a60c2f8278f4aminfrin <paramdef>sd_journal *<parameter>j</parameter></paramdef>
27d778df0b517e1578f907d2e51eb961cd8ee5fbjim <paramdef>uint64_t <parameter>usec</parameter></paramdef>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend </funcprototype>
6b0fe1f447ba35827cd5cf1d2a703bd8517f33ffmturk
6b0fe1f447ba35827cd5cf1d2a703bd8517f33ffmturk <funcprototype>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <funcdef>int <function>sd_journal_seek_cursor</function></funcdef>
438b4817913a5ff55d9cad4c7ddf133330b4466ejim <paramdef>sd_journal *<parameter>j</parameter></paramdef>
e5ce3ac0e9b720c0fa23782e29168a0810697fdetakashi <paramdef>const char *<parameter>cursor</parameter></paramdef>
f73390048b37c973a8016ffd22108d7a73c6cc22pquerna </funcprototype>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend </funcsynopsis>
4126704c4950bfd46d32ad54e3b106ac6d868a73sf </refsynopsisdiv>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd <refsect1>
ebdfe3e677aaa92fe2df702295eac81a97a4610frbowen <title>Description</title>
68c4447ba8e057cf38cbbec918e0549b817f20b4minfrin
5f4e50966b2b9b58436a1651cbe588d1b595657ewrowe <para><function>sd_journal_seek_head()</function> seeks to the
5332c9934b1c0136e9cd4815fe7d70b79d83fddcsf beginning of the journal, i.e. the oldest available entry.</para>
623eebe956d9c2d6d073ed3eae855b56030b40e9noodl
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <para>Similarly, <function>sd_journal_seek_tail()</function> may
79b024b81f6bb3c44dce77a7552191daf8b522d2jim be used to seek to the end of the journal, i.e. the most recent
4277c95b5a9454a5c25f8d8762634fcff37aa840minfrin available entry.</para>
4277c95b5a9454a5c25f8d8762634fcff37aa840minfrin
4277c95b5a9454a5c25f8d8762634fcff37aa840minfrin <para><function>sd_journal_seek_monotonic_usec()</function> seeks
f195a136dcd90148b116fdae8ce95b41ba92b87eminfrin to the entry with the specified monotonic timestamp, i.e.
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <constant>CLOCK_MONOTONIC</constant>. Since monotonic time
1de1266f0ea387d6373be8415745dfd2ab876341jim restarts on every reboot a boot ID needs to be specified as
1de1266f0ea387d6373be8415745dfd2ab876341jim well.</para>
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend
856894d144a15ef1671032a17965bd00b430d311minfrin <para><function>sd_journal_seek_realtime_usec()</function> seeks
856894d144a15ef1671032a17965bd00b430d311minfrin to the entry with the specified realtime (wallclock) timestamp,
856894d144a15ef1671032a17965bd00b430d311minfrin i.e. <constant>CLOCK_REALTIME</constant>. Note that the realtime
856894d144a15ef1671032a17965bd00b430d311minfrin clock is not necessarily monotonic. If a realtime timestamp is
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend ambiguous, it is not defined which position is sought to.</para>
0ce5630695a7aa568811a9dd0aceedd685f040dend
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <para><function>sd_journal_seek_cursor()</function> seeks to the
10eed2803538d660048f6e733602e82a75ef6885noodl entry located at the specified cursor string. For details on
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend cursors, see
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <citerefentry><refentrytitle>sd_journal_get_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
4db28ee269aa06f7c6232e11cd01f58c3349af23noodl If no entry matching the specified cursor is found the call will
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend seek to the next closest entry (in terms of time) instead. To
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend verify whether the newly selected entry actually matches the
03c25fb6f628ac81f2ecb637d1e7502dcee783f3nd cursor, use
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <citerefentry><refentrytitle>sd_journal_test_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
b43f840409794ed298e8634f6284741f193b6c4ftakashi
4126704c4950bfd46d32ad54e3b106ac6d868a73sf <para>Note that these calls do not actually make any entry the new
0ce5630695a7aa568811a9dd0aceedd685f040dend current entry, this needs to be done in a separate step with a
7fa75a06a4fee19e995c069ee00310455d1452e1pquerna subsequent
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>
316f02e3836836c82e19019ff23f90a7ebc65289nilgun invocation (or a similar call). Only then, entry data may be
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend retrieved via
0ce5630695a7aa568811a9dd0aceedd685f040dend <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
0ce5630695a7aa568811a9dd0aceedd685f040dend If no entry exists that matches exactly the specified seek
f73f2c2fae0ded6c8273c28d025ba8aa8136a0fend address, the next closest is sought to. If
<citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>
is used, the closest following entry will be sought to, if
<citerefentry><refentrytitle>sd_journal_previous</refentrytitle><manvolnum>3</manvolnum></citerefentry>
is used the closest preceding entry is sought to.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>The functions return 0 on success or a negative errno-style
error code.</para>
</refsect1>
<refsect1>
<title>Notes</title>
<para>The <function>sd_journal_seek_head()</function>,
<function>sd_journal_seek_tail()</function>,
<function>sd_journal_seek_monotonic_usec()</function>,
<function>sd_journal_seek_realtime_usec()</function>,
and <function>sd_journal_seek_cursor()</function>
interfaces are available as a shared library, which can
be compiled and linked to with the
<constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
file.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_journal_get_cursor</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_journal_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>