diff options
author | наб <[email protected]> | 2021-04-02 21:31:23 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2021-04-07 14:52:30 -0700 |
commit | 54f6daea7ae060763b4b4d3cdf1218a81102980c (patch) | |
tree | fc44d8752272da5c335c013bfdc56d095dcbead1 /cmd/zed/zed_file.c | |
parent | 3d62acf0adbceadeac472db22619a389027ec4cf (diff) |
zed: replace zed_file_write_n() with write(2), purge it
We set SA_RESTART early on, which will prevent EINTRs (indeed, to the
point of needing to clear it in the reaper, since it interferes with
pause(2)), which is the only error zed_file_write_n() actually handled
(plus, the pid write is no bigger than 12 bytes anyway)
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #11834
Diffstat (limited to 'cmd/zed/zed_file.c')
-rw-r--r-- | cmd/zed/zed_file.c | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/cmd/zed/zed_file.c b/cmd/zed/zed_file.c index aeaa7a014..401ab89eb 100644 --- a/cmd/zed/zed_file.c +++ b/cmd/zed/zed_file.c @@ -25,33 +25,6 @@ #include "zed_log.h" /* - * Write [n] bytes from [buf] out to [fd]. - * Return the number of bytes written, or -1 on error. - */ -ssize_t -zed_file_write_n(int fd, void *buf, size_t n) -{ - const unsigned char *p; - size_t n_left; - ssize_t n_written; - - p = buf; - n_left = n; - while (n_left > 0) { - if ((n_written = write(fd, p, n_left)) < 0) { - if (errno == EINTR) - continue; - else - return (-1); - - } - n_left -= n_written; - p += n_written; - } - return (n); -} - -/* * Set an exclusive advisory lock on the open file descriptor [fd]. * Return 0 on success, 1 if a conflicting lock is held by another process, * or -1 on error (with errno set). |