]>
Commit | Line | Data |
---|---|---|
f2cf0403 LP |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
f2cf0403 LP |
4 | |
5 | <!-- | |
572eb058 | 6 | SPDX-License-Identifier: LGPL-2.1+ |
f2cf0403 LP |
7 | --> |
8 | ||
7d6b2723 | 9 | <refentry id="sd_journal_get_catalog" xmlns:xi="http://www.w3.org/2001/XInclude"> |
f2cf0403 | 10 | |
798d3a52 ZJS |
11 | <refentryinfo> |
12 | <title>sd_journal_get_catalog</title> | |
13 | <productname>systemd</productname> | |
798d3a52 ZJS |
14 | </refentryinfo> |
15 | ||
16 | <refmeta> | |
17 | <refentrytitle>sd_journal_get_catalog</refentrytitle> | |
18 | <manvolnum>3</manvolnum> | |
19 | </refmeta> | |
20 | ||
21 | <refnamediv> | |
22 | <refname>sd_journal_get_catalog</refname> | |
23 | <refname>sd_journal_get_catalog_for_message_id</refname> | |
24 | <refpurpose>Retrieve message catalog entry</refpurpose> | |
25 | </refnamediv> | |
26 | ||
27 | <refsynopsisdiv> | |
28 | <funcsynopsis> | |
29 | <funcsynopsisinfo>#include <systemd/sd-journal.h></funcsynopsisinfo> | |
30 | ||
31 | <funcprototype> | |
32 | <funcdef>int <function>sd_journal_get_catalog</function></funcdef> | |
33 | <paramdef>sd_journal *<parameter>j</parameter></paramdef> | |
34 | <paramdef>char **<parameter>ret</parameter></paramdef> | |
35 | </funcprototype> | |
36 | ||
37 | <funcprototype> | |
38 | <funcdef>int <function>sd_journal_get_catalog_for_message_id</function></funcdef> | |
39 | <paramdef>sd_id128_t <parameter>id</parameter></paramdef> | |
40 | <paramdef>char **<parameter>ret</parameter></paramdef> | |
41 | </funcprototype> | |
42 | ||
798d3a52 ZJS |
43 | </funcsynopsis> |
44 | </refsynopsisdiv> | |
45 | ||
46 | <refsect1> | |
47 | <title>Description</title> | |
48 | ||
49 | <para><function>sd_journal_get_catalog()</function> retrieves a | |
50 | message catalog entry for the current journal entry. This will | |
51 | look up an entry in the message catalog by using the | |
52 | <literal>MESSAGE_ID=</literal> field of the current journal entry. | |
53 | Before returning the entry all journal field names in the catalog | |
54 | entry text enclosed in "@" will be replaced by the respective | |
55 | field values of the current entry. If a field name referenced in | |
56 | the message catalog entry does not exist, in the current journal | |
57 | entry, the "@" will be removed, but the field name otherwise left | |
58 | untouched.</para> | |
59 | ||
60 | <para><function>sd_journal_get_catalog_for_message_id()</function> | |
61 | works similar to <function>sd_journal_get_catalog()</function> but | |
62 | the entry is looked up by the specified message ID (no open | |
63 | journal context is necessary for this), and no field substitution | |
64 | is performed.</para> | |
65 | ||
66 | <para>For more information about the journal message catalog | |
67 | please refer to the <ulink | |
28a0ad81 | 68 | url="https://www.freedesktop.org/wiki/Software/systemd/catalog">Journal |
798d3a52 ZJS |
69 | Message Catalogs</ulink> documentation page.</para> |
70 | </refsect1> | |
71 | ||
72 | <refsect1> | |
73 | <title>Return Value</title> | |
74 | ||
75 | <para><function>sd_journal_get_catalog()</function> and | |
76 | <function>sd_journal_get_catalog_for_message_id()</function> | |
77 | return 0 on success or a negative errno-style error code. If no | |
78 | matching message catalog entry is found, -ENOENT is | |
79 | returned.</para> | |
80 | ||
81 | <para>On successful return, <parameter>ret</parameter> points to a | |
82 | new string, which must be freed with | |
83 | <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>. | |
84 | </para> | |
85 | </refsect1> | |
86 | ||
87 | <refsect1> | |
88 | <title>Notes</title> | |
89 | ||
64a7ef8b LP |
90 | <para>Function <function>sd_journal_get_catalog()</function> is thread-agnostic and only |
91 | a single specific thread may operate on a given object during its entire lifetime. It's safe to allocate multiple | |
92 | independent objects and use each from a specific thread in parallel. However, it's not safe to allocate such an | |
93 | object in one thread, and operate or free it from any other, even if locking is used to ensure these threads don't | |
94 | operate on it at the very same time.</para> | |
95 | ||
96 | <para>Function <function>sd_journal_get_catalog_for_message_id()</function> is are thread-safe and may be called in | |
97 | parallel from multiple threads.</para> | |
a8d46a16 | 98 | |
7d6b2723 | 99 | <xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/> |
798d3a52 ZJS |
100 | </refsect1> |
101 | ||
102 | <refsect1> | |
103 | <title>See Also</title> | |
104 | ||
105 | <para> | |
106 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
107 | <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>, | |
108 | <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
109 | <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
110 | <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
111 | <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
3ba3a79d | 112 | <citerefentry project='man-pages'><refentrytitle>malloc</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
798d3a52 ZJS |
113 | </para> |
114 | </refsect1> | |
f2cf0403 LP |
115 | |
116 | </refentry> |