summaryrefslogtreecommitdiffstats
path: root/upstream/debian-unstable/man3/sd_journal_stream_fd.3
diff options
context:
space:
mode:
Diffstat (limited to 'upstream/debian-unstable/man3/sd_journal_stream_fd.3')
-rw-r--r--upstream/debian-unstable/man3/sd_journal_stream_fd.343
1 files changed, 27 insertions, 16 deletions
diff --git a/upstream/debian-unstable/man3/sd_journal_stream_fd.3 b/upstream/debian-unstable/man3/sd_journal_stream_fd.3
index f505e221..8642d2ef 100644
--- a/upstream/debian-unstable/man3/sd_journal_stream_fd.3
+++ b/upstream/debian-unstable/man3/sd_journal_stream_fd.3
@@ -1,5 +1,5 @@
'\" t
-.TH "SD_JOURNAL_STREAM_FD" "3" "" "systemd 255" "sd_journal_stream_fd"
+.TH "SD_JOURNAL_STREAM_FD" "3" "" "systemd 256~rc3" "sd_journal_stream_fd"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -20,7 +20,7 @@
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
-sd_journal_stream_fd \- Create log stream file descriptor to the journal
+sd_journal_stream_fd, sd_journal_stream_fd_with_namespace \- Create log stream file descriptor to the journal
.SH "SYNOPSIS"
.sp
.ft B
@@ -30,6 +30,8 @@ sd_journal_stream_fd \- Create log stream file descriptor to the journal
.ft
.HP \w'int\ sd_journal_stream_fd('u
.BI "int sd_journal_stream_fd(const\ char\ *" "identifier" ", int\ " "priority" ", int\ " "level_prefix" ");"
+.HP \w'int\ sd_journal_stream_fd_with_namespace('u
+.BI "int sd_journal_stream_fd_with_namespace(const\ char\ *" "name_space" ", const\ char\ *" "identifier" ", int\ " "priority" ", int\ " "level_prefix" ");"
.SH "DESCRIPTION"
.PP
\fBsd_journal_stream_fd()\fR
@@ -54,11 +56,19 @@ for details\&. The third argument is a boolean: if true kernel\-style log level
\fBsd-daemon\fR(3)
for more information\&.
.PP
+\fBsd_journal_stream_fd_with_namespace()\fR
+is similar to
+\fBsd_journal_stream_fd()\fR, but takes an additional
+\fIname_space\fR
+parameter that specifies which journal namespace to operate on\&. If specified as
+\fBNULL\fR
+the call is identical to
+\fBsd_journal_stream_fd()\fR\&. For details about journal namespaces, see
+\fBsystemd-journald.service\fR(8)\&.
+.PP
It is recommended that applications log UTF\-8 messages only with this API, but this is not enforced\&.
.PP
-Each invocation of
-\fBsd_journal_stream_fd()\fR
-allocates a new log stream file descriptor, that is not shared with prior or later invocations\&. The file descriptor is write\-only (its reading direction is shut down), and
+Each invocation of these functions allocates a new log stream file descriptor, that is not shared with prior or later invocations\&. The file descriptor is write\-only (its reading direction is shut down), and
\fBO_NONBLOCK\fR
is turned off initially\&.
.SH "RETURN VALUE"
@@ -67,7 +77,9 @@ The call returns a valid write\-only file descriptor on success or a negative er
.SH "SIGNAL SAFETY"
.PP
\fBsd_journal_stream_fd()\fR
-is "async signal safe" in the meaning of
+and
+\fBsd_journal_stream_fd_with_namespace()\fR
+are "async signal safe" in the meaning of
\fBsignal-safety\fR(7)\&.
.SH "NOTES"
.PP
@@ -87,6 +99,7 @@ Creating a log stream suitable for
.nf
/* SPDX\-License\-Identifier: MIT\-0 */
+#define _GNU_SOURCE 1
#include <errno\&.h>
#include <syslog\&.h>
#include <stdio\&.h>
@@ -97,15 +110,16 @@ Creating a log stream suitable for
int main(int argc, char *argv[]) {
int fd;
FILE *log;
+
fd = sd_journal_stream_fd("test", LOG_INFO, 1);
if (fd < 0) {
- errno = \-fd;
- fprintf(stderr, "Failed to create stream fd: %m\en");
+ fprintf(stderr, "Failed to create stream fd: %s\en", strerror(\-fd));
return 1;
}
+
log = fdopen(fd, "w");
if (!log) {
- fprintf(stderr, "Failed to create file object: %m\en");
+ fprintf(stderr, "Failed to create file object: %s\en", strerror(errno));
close(fd);
return 1;
}
@@ -122,12 +136,9 @@ int main(int argc, char *argv[]) {
.PP
\fBsd_journal_stream_fd()\fR
was added in version 187\&.
+.PP
+\fBsd_journal_stream_fd_with_namespace()\fR
+was added in version 256\&.
.SH "SEE ALSO"
.PP
-\fBsystemd\fR(1),
-\fBsd-journal\fR(3),
-\fBsd-daemon\fR(3),
-\fBsd_journal_print\fR(3),
-\fBsyslog\fR(3),
-\fBfprintf\fR(3),
-\fBsystemd.journal-fields\fR(7)
+\fBsystemd\fR(1), \fBsd-journal\fR(3), \fBsd-daemon\fR(3), \fBsd_journal_print\fR(3), \fBsyslog\fR(3), \fBfprintf\fR(3), \fBsystemd.journal-fields\fR(7)