From d7cf13b968b99cb070c7d5d2e1f7ff1a8072f2f3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 12 Jul 2016 10:42:29 +0200 Subject: Implement re-exec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/util.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/util.h') diff --git a/src/util.h b/src/util.h index 858d972..18066fa 100644 --- a/src/util.h +++ b/src/util.h @@ -33,6 +33,8 @@ void* memdup(const void* src, size_t n); /** * Read an entire file * + * Not cancelled by `EINTR` + * * @param fd The file descriptor * @param n Output for the size of the file * @return The read content, plus a NUL byte at @@ -41,6 +43,20 @@ void* memdup(const void* src, size_t n); void* nread(int fd, size_t* n); +/** + * Write an entire buffer to a file + * + * Not cancelled by `EINTR` + * + * @param fd The file descriptor + * @param buf The buffer which shall be written to the fail + * @param n The size of the buffer + * @return The number of written bytes, less than `n` + * on error, cannot exceed `n` + */ +size_t nwrite(int fd, const void* buf, size_t n); + + /** * Duplicate a file descriptor an make sure * the new file descriptor's index as a -- cgit v1.2.3-70-g09d2