From: Lennart Poettering Date: Fri, 13 Jul 2012 19:04:38 +0000 (+0200) Subject: man: forgot sd_journal_get_fd() man page X-Git-Tag: v187~96 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=91a031725396faebf51ea7b5475532453b8d6df3 man: forgot sd_journal_get_fd() man page --- diff --git a/man/sd_journal_get_fd.xml b/man/sd_journal_get_fd.xml new file mode 100644 index 000000000..f4db2a392 --- /dev/null +++ b/man/sd_journal_get_fd.xml @@ -0,0 +1,160 @@ + + + + + + + + + sd_journal_get_fd + systemd + + + + Developer + Lennart + Poettering + lennart@poettering.net + + + + + + sd_journal_get_fd + 3 + + + + sd_journal_get_fd + sd_journal_get_process + sd_journal_get_wait + Journal change notification + interface + + + + + #include <systemd/sd-journal.h> + + + int sd_journal_get_fd + sd_journal* j + + + + int sd_journal_process + sd_journal* j + + + + int sd_journal_wait + sd_journal* j + uint64_t timeout_usec + + + + + + + Description + + sd_journal_get_fd() returns + a file descriptor that may be asynchronously polled in + an external event loop and is signalled readable as + soon as the journal changes, for example because new + entries were added. The file descriptor is suitable + for usage in + poll2 + where it will yield POLLIN on all changes. The call + takes one argument: the journal context object. + + After each POLLIN wake-up + sd_journal_process() needs to be + called to process events and reset the readable state + of the file descriptor. This call will also indicate + what kind of change has been detected (see below; note + that spurious wake-ups are possible). + + A synchronous alternative for using + sd_journal_get_fd() and + sd_journal_process() is + sd_journal_wait(). It will + synchronously wait until the journal gets changed up + to a certain time-out as specified in its second + argument. Pass (uint64_t) -1 to + wait indefinitely. Internally this call simply + combines sd_journal_get_fd(), + poll() and + sd_journal_process() into + one. + + + + + Return Value + + sd_journal_get_fd() returns a valid file descriptor on success or a negative errno-style error + code. + + sd_journal_process() and + sd_journal_wait() return one of + SD_JOURNAL_NOP, + SD_JOURNAL_APPEND or + SD_JOURNAL_INVALIDATE on success or + a negative errno-style error code. If + SD_JOURNAL_NOP is returned the + journal didn't change since the last invocation. If + SD_JOURNAL_APPEND is returned new + entries have been appended to the end of the + journal. If SD_JOURNAL_INVALIDATE + journal files were added or removed (possibly due to + rotation). In the latter event live-view UIs should + probably refresh their entire display while in the + case of SD_JOURNAL_APPEND it is + sufficient to simply continue reading at the previous + end of the journal. + + + + Notes + + The sd_journal_get_fd(), + sd_journal_process() and + sd_journal_wait() interfaces are + available as shared library, which can be compiled and + linked to with the + libsystemd-journal + pkg-config1 + file. + + + + See Also + + + systemd1, + sd-journal3, + sd_journal_open3, + sd_journal_next3 + + + +