On Sun, Jan 26, 2014 at 6:21 AM, Zbigniew Jędrzejewski-Szmek
<[email protected]> wrote:

> +static int writev_safe(int fd, const struct iovec *w, int j, bool 
> async_signal_safe) {
> +        if (!async_signal_safe)
> +                return writev(fd, w, j);
> +
> +        for (int i = 0; i < j; i++) {
> +                size_t written = 0;
> +
> +                while (written < w[i].iov_len) {
> +                        ssize_t r;
> +
> +                        r = write(fd, w[i].iov_base + written, w[i].iov_len 
> - written);
> +                        if (r < 0 && errno != -EINTR)
> +                                return -errno;
> +
> +                        written += r;
> +                }
> +        }
> +
> +        return 0;
> +}

What kind of logic are you following here? Looping in userspace over n
syscall is safer than calling one single syscall?

Unless you can explain the magic here, please don't do things like that.

Kay
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to