[systemd-devel] [RFC PATCH 2/2] journal: add async-signal-safe mode for sd_journald_sendv

Cristian Rodríguez crrodriguez at opensuse.org
Mon Jan 27 08:07:47 PST 2014


El 26/01/14 02:21, Zbigniew Jędrzejewski-Szmek escribió:

> +static int writev_safe(int fd, const struct iovec *w, int j, bool async_signal_safe) {

> +                        r = write(fd, w[i].iov_base + written, w[i].iov_len - written);
> +                        if (r < 0 && errno != -EINTR)
> +                                return -errno;
> +


There is a documented macro for that particular purpose .. defined in 
unistd.h TEMP_FAILURE_RETRY


  r = TEMP_FAILURE_RETRY(write(fd, w[i].iov_base + written, w[i].iov_len 
- written))

if(r == -1)
	return -errno;

...


More information about the systemd-devel mailing list