Pablo Greco 48fc63
From dd004bcc058dbb7c66b8eb1a728732ccfce746c7 Mon Sep 17 00:00:00 2001
Pablo Greco 48fc63
From: Jan Synacek <jsynacek@redhat.com>
Pablo Greco 48fc63
Date: Tue, 5 Mar 2019 10:45:07 +0100
Pablo Greco 48fc63
Subject: [PATCH] man: be more explicit about thread safety of sd_journal
Pablo Greco 48fc63
Pablo Greco 48fc63
This adds two generic paragaphs we include via xinclude. One is the
Pablo Greco 48fc63
"strict" version, which contains wording saying that we are thread
Pablo Greco 48fc63
agnostic and what that means. And the other is the "safe" version, for
Pablo Greco 48fc63
the cases we provide fully safety.
Pablo Greco 48fc63
Pablo Greco 48fc63
Let's then change most man pages to use either of these generic
Pablo Greco 48fc63
paragraphs. With one exception: man/sd_journal_get_catalog.xml contains
Pablo Greco 48fc63
both kinds of function, we hence use manual wording.
Pablo Greco 48fc63
Pablo Greco 48fc63
(cherry picked from commit 64a7ef8bc06b5dcfcd9f99ea10a43bde75c4370f)
Pablo Greco 48fc63
Pablo Greco 48fc63
Related: #1609349
Pablo Greco 48fc63
---
Pablo Greco 48fc63
 man/sd-journal.xml                          | 14 ++++++++++++++
Pablo Greco 48fc63
 man/sd_journal_get_catalog.xml              |  9 +++++++++
Pablo Greco 48fc63
 man/sd_journal_get_cursor.xml               |  4 +++-
Pablo Greco 48fc63
 man/sd_journal_get_cutoff_realtime_usec.xml |  4 +++-
Pablo Greco 48fc63
 man/sd_journal_get_data.xml                 |  4 +++-
Pablo Greco 48fc63
 man/sd_journal_get_fd.xml                   |  4 +++-
Pablo Greco 48fc63
 man/sd_journal_get_realtime_usec.xml        |  4 +++-
Pablo Greco 48fc63
 man/sd_journal_get_usage.xml                |  4 +++-
Pablo Greco 48fc63
 man/sd_journal_has_runtime_files.xml        |  8 +++++++-
Pablo Greco 48fc63
 man/sd_journal_next.xml                     |  4 +++-
Pablo Greco 48fc63
 man/sd_journal_open.xml                     |  4 +++-
Pablo Greco 48fc63
 man/sd_journal_print.xml                    |  4 +++-
Pablo Greco 48fc63
 man/sd_journal_query_unique.xml             |  4 +++-
Pablo Greco 48fc63
 man/sd_journal_seek_head.xml                |  4 +++-
Pablo Greco 48fc63
 man/sd_journal_stream_fd.xml                |  4 +++-
Pablo Greco 48fc63
 man/threads-aware.xml                       | 17 +++++++++++++++++
Pablo Greco 48fc63
 16 files changed, 83 insertions(+), 13 deletions(-)
Pablo Greco 48fc63
 create mode 100644 man/threads-aware.xml
Pablo Greco 48fc63
Pablo Greco 48fc63
diff --git a/man/sd-journal.xml b/man/sd-journal.xml
Pablo Greco 48fc63
index a1185d372b..11af4cd9b9 100644
Pablo Greco 48fc63
--- a/man/sd-journal.xml
Pablo Greco 48fc63
+++ b/man/sd-journal.xml
Pablo Greco 48fc63
@@ -97,6 +97,20 @@
Pablo Greco 48fc63
     tool.</para>
Pablo Greco 48fc63
   </refsect1>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+  <refsect1>
Pablo Greco 48fc63
+    <title>Thread safety</title>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+    <para>Functions that operate on <structname>sd_journal</structname> objects are thread agnostic — given
Pablo Greco 48fc63
+    <structname>sd_journal</structname> pointer may only be used from one specific thread at all times (and it has to
Pablo Greco 48fc63
+    be the very same one during the entire lifetime of the object), but multiple, independent threads may use multiple,
Pablo Greco 48fc63
+    independent objects safely. Other functions — those that are used to send entries to the journal, like
Pablo Greco 48fc63
+    <citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>3</manvolnum></citerefentry> and similar,
Pablo Greco 48fc63
+    or those that are used to retrieve global information like
Pablo Greco 48fc63
+    <citerefentry><refentrytitle>sd_journal_stream_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
Pablo Greco 48fc63
+    <citerefentry><refentrytitle>sd_journal_get_catalog_for_message_id</refentrytitle><manvolnum>3</manvolnum></citerefentry>
Pablo Greco 48fc63
+    are fully thread-safe and may be called from multiple threads in parallel.</para>
Pablo Greco 48fc63
+  </refsect1>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
   <xi:include href="libsystemd-pkgconfig.xml" />
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
diff --git a/man/sd_journal_get_catalog.xml b/man/sd_journal_get_catalog.xml
Pablo Greco 48fc63
index c19eb11b20..86eb659fe5 100644
Pablo Greco 48fc63
--- a/man/sd_journal_get_catalog.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_get_catalog.xml
Pablo Greco 48fc63
@@ -112,6 +112,15 @@
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <para>Function <function>sd_journal_get_catalog()</function> is thread-agnostic and only
Pablo Greco 48fc63
+    a single specific thread may operate on a given object during its entire lifetime. It's safe to allocate multiple
Pablo Greco 48fc63
+    independent objects and use each from a specific thread in parallel. However, it's not safe to allocate such an
Pablo Greco 48fc63
+    object in one thread, and operate or free it from any other, even if locking is used to ensure these threads don't
Pablo Greco 48fc63
+    operate on it at the very same time.</para>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+    <para>Function <function>sd_journal_get_catalog_for_message_id()</function> is are thread-safe and may be called in
Pablo Greco 48fc63
+    parallel from multiple threads.</para>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_get_catalog()</function> and
Pablo Greco 48fc63
     <function>sd_journal_get_catalog_for_message_id()</function>
Pablo Greco 48fc63
     interfaces are available as a shared library, which can be
Pablo Greco 48fc63
diff --git a/man/sd_journal_get_cursor.xml b/man/sd_journal_get_cursor.xml
Pablo Greco 48fc63
index a400d8b1b5..0a20c36146 100644
Pablo Greco 48fc63
--- a/man/sd_journal_get_cursor.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_get_cursor.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_get_cursor">
Pablo Greco 48fc63
+<refentry id="sd_journal_get_cursor" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_get_cursor</title>
Pablo Greco 48fc63
@@ -122,6 +122,8 @@
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="strict" />
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_get_cursor()</function> and
Pablo Greco 48fc63
     <function>sd_journal_test_cursor()</function> interfaces are
Pablo Greco 48fc63
     available as a shared library, which can be compiled and linked to
Pablo Greco 48fc63
diff --git a/man/sd_journal_get_cutoff_realtime_usec.xml b/man/sd_journal_get_cutoff_realtime_usec.xml
Pablo Greco 48fc63
index 23e7cc65e8..782228009d 100644
Pablo Greco 48fc63
--- a/man/sd_journal_get_cutoff_realtime_usec.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_get_cutoff_realtime_usec.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_get_cutoff_realtime_usec">
Pablo Greco 48fc63
+<refentry id="sd_journal_get_cutoff_realtime_usec" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_get_cutoff_realtime_usec</title>
Pablo Greco 48fc63
@@ -120,6 +120,8 @@
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="strict" />
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The
Pablo Greco 48fc63
     <function>sd_journal_get_cutoff_realtime_usec()</function> and
Pablo Greco 48fc63
     <function>sd_journal_get_cutoff_monotonic_usec()</function>
Pablo Greco 48fc63
diff --git a/man/sd_journal_get_data.xml b/man/sd_journal_get_data.xml
Pablo Greco 48fc63
index 1afbd7371c..dce421795a 100644
Pablo Greco 48fc63
--- a/man/sd_journal_get_data.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_get_data.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_get_data">
Pablo Greco 48fc63
+<refentry id="sd_journal_get_data" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_get_data</title>
Pablo Greco 48fc63
@@ -183,6 +183,8 @@
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="strict"/>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_get_data()</function>,
Pablo Greco 48fc63
     <function>sd_journal_enumerate_data()</function>,
Pablo Greco 48fc63
     <function>sd_journal_restart_data()</function>,
Pablo Greco 48fc63
diff --git a/man/sd_journal_get_fd.xml b/man/sd_journal_get_fd.xml
Pablo Greco 48fc63
index 3a38f733ab..a96857d0df 100644
Pablo Greco 48fc63
--- a/man/sd_journal_get_fd.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_get_fd.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_get_fd">
Pablo Greco 48fc63
+<refentry id="sd_journal_get_fd" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_get_fd</title>
Pablo Greco 48fc63
@@ -231,6 +231,8 @@ else {
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="strict"/>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_get_fd()</function>,
Pablo Greco 48fc63
     <function>sd_journal_get_events()</function>,
Pablo Greco 48fc63
     <function>sd_journal_reliable_fd()</function>,
Pablo Greco 48fc63
diff --git a/man/sd_journal_get_realtime_usec.xml b/man/sd_journal_get_realtime_usec.xml
Pablo Greco 48fc63
index 607d74666b..b67e4d6c2d 100644
Pablo Greco 48fc63
--- a/man/sd_journal_get_realtime_usec.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_get_realtime_usec.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_get_realtime_usec">
Pablo Greco 48fc63
+<refentry id="sd_journal_get_realtime_usec" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_get_realtime_usec</title>
Pablo Greco 48fc63
@@ -115,6 +115,8 @@
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="strict"/>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_get_realtime_usec()</function> and
Pablo Greco 48fc63
     <function>sd_journal_get_monotonic_usec()</function> interfaces
Pablo Greco 48fc63
     are available as a shared library, which can be compiled and
Pablo Greco 48fc63
diff --git a/man/sd_journal_get_usage.xml b/man/sd_journal_get_usage.xml
Pablo Greco 48fc63
index 72c804d834..6281bc850d 100644
Pablo Greco 48fc63
--- a/man/sd_journal_get_usage.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_get_usage.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_get_usage">
Pablo Greco 48fc63
+<refentry id="sd_journal_get_usage" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_get_usage</title>
Pablo Greco 48fc63
@@ -80,6 +80,8 @@
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="strict"/>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_get_usage()</function> interface is
Pablo Greco 48fc63
     available as a shared library, which can be compiled and linked to
Pablo Greco 48fc63
     with the
Pablo Greco 48fc63
diff --git a/man/sd_journal_has_runtime_files.xml b/man/sd_journal_has_runtime_files.xml
Pablo Greco 48fc63
index 237e649206..4dff3c67d0 100644
Pablo Greco 48fc63
--- a/man/sd_journal_has_runtime_files.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_has_runtime_files.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_has_runtime_files">
Pablo Greco 48fc63
+<refentry id="sd_journal_has_runtime_files" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_has_runtime_files</title>
Pablo Greco 48fc63
@@ -85,6 +85,12 @@
Pablo Greco 48fc63
     </para>
Pablo Greco 48fc63
   </refsect1>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+  <refsect1>
Pablo Greco 48fc63
+    <title>Notes</title>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="strict"/>
Pablo Greco 48fc63
+  </refsect1>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>See Also</title>
Pablo Greco 48fc63
     <para>
Pablo Greco 48fc63
diff --git a/man/sd_journal_next.xml b/man/sd_journal_next.xml
Pablo Greco 48fc63
index 115fe26661..c8664994ce 100644
Pablo Greco 48fc63
--- a/man/sd_journal_next.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_next.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_next">
Pablo Greco 48fc63
+<refentry id="sd_journal_next" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_next</title>
Pablo Greco 48fc63
@@ -146,6 +146,8 @@
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="strict"/>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_next()</function>,
Pablo Greco 48fc63
     <function>sd_journal_previous()</function>,
Pablo Greco 48fc63
     <function>sd_journal_next_skip()</function> and
Pablo Greco 48fc63
diff --git a/man/sd_journal_open.xml b/man/sd_journal_open.xml
Pablo Greco 48fc63
index fb572802a3..c3044670de 100644
Pablo Greco 48fc63
--- a/man/sd_journal_open.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_open.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_open">
Pablo Greco 48fc63
+<refentry id="sd_journal_open" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_open</title>
Pablo Greco 48fc63
@@ -196,6 +196,8 @@
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="strict"/>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_open()</function>,
Pablo Greco 48fc63
     <function>sd_journal_open_directory()</function> and
Pablo Greco 48fc63
     <function>sd_journal_close()</function> interfaces are available
Pablo Greco 48fc63
diff --git a/man/sd_journal_print.xml b/man/sd_journal_print.xml
Pablo Greco 48fc63
index 0cd0b45b9a..50ad5de7be 100644
Pablo Greco 48fc63
--- a/man/sd_journal_print.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_print.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_print">
Pablo Greco 48fc63
+<refentry id="sd_journal_print" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_print</title>
Pablo Greco 48fc63
@@ -232,6 +232,8 @@ sd_journal_send("MESSAGE=Hello World, this is PID %lu!", (unsigned long) getpid(
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="safe"/>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_print()</function>,
Pablo Greco 48fc63
     <function>sd_journal_printv()</function>,
Pablo Greco 48fc63
     <function>sd_journal_send()</function> and
Pablo Greco 48fc63
diff --git a/man/sd_journal_query_unique.xml b/man/sd_journal_query_unique.xml
Pablo Greco 48fc63
index ac0e5f633f..074dfd6789 100644
Pablo Greco 48fc63
--- a/man/sd_journal_query_unique.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_query_unique.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_query_unique">
Pablo Greco 48fc63
+<refentry id="sd_journal_query_unique" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_query_unique</title>
Pablo Greco 48fc63
@@ -145,6 +145,8 @@
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="strict"/>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_query_unique()</function>,
Pablo Greco 48fc63
     <function>sd_journal_enumerate_unique()</function> and
Pablo Greco 48fc63
     <function>sd_journal_restart_unique()</function> interfaces are
Pablo Greco 48fc63
diff --git a/man/sd_journal_seek_head.xml b/man/sd_journal_seek_head.xml
Pablo Greco 48fc63
index d74c2d5bbc..8bbbb22a73 100644
Pablo Greco 48fc63
--- a/man/sd_journal_seek_head.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_seek_head.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_seek_head">
Pablo Greco 48fc63
+<refentry id="sd_journal_seek_head" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_seek_head</title>
Pablo Greco 48fc63
@@ -144,6 +144,8 @@
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="strict"/>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_seek_head()</function>,
Pablo Greco 48fc63
     <function>sd_journal_seek_tail()</function>,
Pablo Greco 48fc63
     <function>sd_journal_seek_monotonic_usec()</function>,
Pablo Greco 48fc63
diff --git a/man/sd_journal_stream_fd.xml b/man/sd_journal_stream_fd.xml
Pablo Greco 48fc63
index 2ea7731b48..340760ba36 100644
Pablo Greco 48fc63
--- a/man/sd_journal_stream_fd.xml
Pablo Greco 48fc63
+++ b/man/sd_journal_stream_fd.xml
Pablo Greco 48fc63
@@ -21,7 +21,7 @@
Pablo Greco 48fc63
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
Pablo Greco 48fc63
 -->
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-<refentry id="sd_journal_stream_fd">
Pablo Greco 48fc63
+<refentry id="sd_journal_stream_fd" xmlns:xi="http://www.w3.org/2001/XInclude">
Pablo Greco 48fc63
 
Pablo Greco 48fc63
   <refentryinfo>
Pablo Greco 48fc63
     <title>sd_journal_stream_fd</title>
Pablo Greco 48fc63
@@ -104,6 +104,8 @@
Pablo Greco 48fc63
   <refsect1>
Pablo Greco 48fc63
     <title>Notes</title>
Pablo Greco 48fc63
 
Pablo Greco 48fc63
+    <xi:include href="threads-aware.xml" xpointer="safe"/>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
     <para>The <function>sd_journal_stream_fd()</function> interface is
Pablo Greco 48fc63
     available as a shared library, which can be compiled and linked to
Pablo Greco 48fc63
     with the
Pablo Greco 48fc63
diff --git a/man/threads-aware.xml b/man/threads-aware.xml
Pablo Greco 48fc63
new file mode 100644
Pablo Greco 48fc63
index 0000000000..7985f4acd1
Pablo Greco 48fc63
--- /dev/null
Pablo Greco 48fc63
+++ b/man/threads-aware.xml
Pablo Greco 48fc63
@@ -0,0 +1,17 @@
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+  SPDX-License-Identifier: LGPL-2.1+
Pablo Greco 48fc63
+-->
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+<refsect1>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+<para id="strict">All functions listed here are thread-agnostic and only a single specific thread may operate on a
Pablo Greco 48fc63
+given object during its entire lifetime. It's safe to allocate multiple independent objects and use each from a
Pablo Greco 48fc63
+specific thread in parallel. However, it's not safe to allocate such an object in one thread, and operate or free it
Pablo Greco 48fc63
+from any other, even if locking is used to ensure these threads don't operate on it at the very same time.</para>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+<para id="safe">All functions listed here are thread-safe and may be called in parallel from multiple threads.</para>
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+</refsect1>