[systemd-devel] sd_journal_send non-blocking call
Lennart Poettering
lennart at poettering.net
Tue Jul 23 15:52:26 UTC 2019
On Mi, 17.07.19 17:53, Vaibhav Dahiya (vdahiya at ncsu.edu) wrote:
> Hello,
>
> I am using sd_journal_send api() api call to log messages on syslog server. I see that this uses
> sendmsg(fd, &mh, MSG_NOSIGNAL) call.
> Is there a provision of passing MSG_DONTWAIT flag to this.
> or else have a separate api like sd_journal_send_non_blocking().
> I want to use this call in an application where I cant make a blocking call for logging.
So the calls are blocking, but the socket buffers in use should be
very large, so IRL it takes a while to make things block.
Making them non-blocking is currently not supported.
If this is useful to you we'd be happy to review and merge a patch
adding that.
Doing non-blocking sockets means dropping messages though, which we#d
have to count client side and eventually mention when we can log
again. i.e. it's not done to se MSG_DONTWAIT/O_NONBLOCK on the socket,
we'd also have to account for dropped msgs and synthesize implicit
messages.
(I figure it would probably make sense to support controlling
SO_SNDTIMEO on the socket btw, which would allow us to take a time
we'd like to block for at most, and then treat the current synchronous
behaviour and the requested MSG_DONTWAIT behaviour just as two special
cases of that where the time is 0 or infinity...)
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list