]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_journal_get_catalog.xml
test-hostname-util: add assert_se's to make coverity happy
[thirdparty/systemd.git] / man / sd_journal_get_catalog.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 This file is part of systemd.
9
10 Copyright 2012 Lennart Poettering
11
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
16
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 -->
25
26 <refentry id="sd_journal_get_catalog">
27
28 <refentryinfo>
29 <title>sd_journal_get_catalog</title>
30 <productname>systemd</productname>
31
32 <authorgroup>
33 <author>
34 <contrib>Developer</contrib>
35 <firstname>Lennart</firstname>
36 <surname>Poettering</surname>
37 <email>lennart@poettering.net</email>
38 </author>
39 </authorgroup>
40 </refentryinfo>
41
42 <refmeta>
43 <refentrytitle>sd_journal_get_catalog</refentrytitle>
44 <manvolnum>3</manvolnum>
45 </refmeta>
46
47 <refnamediv>
48 <refname>sd_journal_get_catalog</refname>
49 <refname>sd_journal_get_catalog_for_message_id</refname>
50 <refpurpose>Retrieve message catalog entry</refpurpose>
51 </refnamediv>
52
53 <refsynopsisdiv>
54 <funcsynopsis>
55 <funcsynopsisinfo>#include &lt;systemd/sd-journal.h&gt;</funcsynopsisinfo>
56
57 <funcprototype>
58 <funcdef>int <function>sd_journal_get_catalog</function></funcdef>
59 <paramdef>sd_journal *<parameter>j</parameter></paramdef>
60 <paramdef>char **<parameter>ret</parameter></paramdef>
61 </funcprototype>
62
63 <funcprototype>
64 <funcdef>int <function>sd_journal_get_catalog_for_message_id</function></funcdef>
65 <paramdef>sd_id128_t <parameter>id</parameter></paramdef>
66 <paramdef>char **<parameter>ret</parameter></paramdef>
67 </funcprototype>
68
69
70 </funcsynopsis>
71 </refsynopsisdiv>
72
73 <refsect1>
74 <title>Description</title>
75
76 <para><function>sd_journal_get_catalog()</function> retrieves a
77 message catalog entry for the current journal entry. This will
78 look up an entry in the message catalog by using the
79 <literal>MESSAGE_ID=</literal> field of the current journal entry.
80 Before returning the entry all journal field names in the catalog
81 entry text enclosed in "@" will be replaced by the respective
82 field values of the current entry. If a field name referenced in
83 the message catalog entry does not exist, in the current journal
84 entry, the "@" will be removed, but the field name otherwise left
85 untouched.</para>
86
87 <para><function>sd_journal_get_catalog_for_message_id()</function>
88 works similar to <function>sd_journal_get_catalog()</function> but
89 the entry is looked up by the specified message ID (no open
90 journal context is necessary for this), and no field substitution
91 is performed.</para>
92
93 <para>For more information about the journal message catalog
94 please refer to the <ulink
95 url="https://www.freedesktop.org/wiki/Software/systemd/catalog">Journal
96 Message Catalogs</ulink> documentation page.</para>
97 </refsect1>
98
99 <refsect1>
100 <title>Return Value</title>
101
102 <para><function>sd_journal_get_catalog()</function> and
103 <function>sd_journal_get_catalog_for_message_id()</function>
104 return 0 on success or a negative errno-style error code. If no
105 matching message catalog entry is found, -ENOENT is
106 returned.</para>
107
108 <para>On successful return, <parameter>ret</parameter> points to a
109 new string, which must be freed with
110 <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
111 </para>
112 </refsect1>
113
114 <refsect1>
115 <title>Notes</title>
116
117 <para>Function <function>sd_journal_get_catalog()</function> is thread-agnostic and only a
118 single thread may operate on a given <structname>sd_journal</structname> object. Function
119 <function>sd_journal_get_catalog_for_message_id()</function> is thread-safe.</para>
120
121 <para>The <function>sd_journal_get_catalog()</function> and
122 <function>sd_journal_get_catalog_for_message_id()</function>
123 interfaces are available as a shared library, which can be
124 compiled and linked to with the
125 <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
126 file.</para>
127 </refsect1>
128
129 <refsect1>
130 <title>See Also</title>
131
132 <para>
133 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
134 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
135 <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
136 <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
137 <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
138 <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
139 <citerefentry project='man-pages'><refentrytitle>malloc</refentrytitle><manvolnum>3</manvolnum></citerefentry>
140 </para>
141 </refsect1>
142
143 </refentry>