Blame gnulib/lib/safe-write.h

Packit eba2e2
/* An interface to write() that retries after interrupts.
Packit eba2e2
   Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
Packit eba2e2
Packit eba2e2
   This program is free software: you can redistribute it and/or modify
Packit eba2e2
   it under the terms of the GNU General Public License as published by
Packit eba2e2
   the Free Software Foundation; either version 3 of the License, or
Packit eba2e2
   (at your option) any later version.
Packit eba2e2
Packit eba2e2
   This program is distributed in the hope that it will be useful,
Packit eba2e2
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit eba2e2
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit eba2e2
   GNU General Public License for more details.
Packit eba2e2
Packit eba2e2
   You should have received a copy of the GNU General Public License
Packit eba2e2
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit eba2e2
Packit eba2e2
/* Some system calls may be interrupted and fail with errno = EINTR in the
Packit eba2e2
   following situations:
Packit eba2e2
     - The process is stopped and restarted (signal SIGSTOP and SIGCONT, user
Packit eba2e2
       types Ctrl-Z) on some platforms: Mac OS X.
Packit eba2e2
     - The process receives a signal for which a signal handler was installed
Packit eba2e2
       with sigaction() with an sa_flags field that does not contain
Packit eba2e2
       SA_RESTART.
Packit eba2e2
     - The process receives a signal for which a signal handler was installed
Packit eba2e2
       with signal() and for which no call to siginterrupt(sig,0) was done,
Packit eba2e2
       on some platforms: AIX, HP-UX, IRIX, OSF/1, Solaris.
Packit eba2e2
Packit eba2e2
   This module provides a wrapper around write() that handles EINTR.  */
Packit eba2e2
Packit eba2e2
#include <stddef.h>
Packit eba2e2
Packit eba2e2
#define SAFE_WRITE_ERROR ((size_t) -1)
Packit eba2e2
Packit eba2e2
/* Write up to COUNT bytes at BUF to descriptor FD, retrying if interrupted.
Packit eba2e2
   Return the actual number of bytes written, zero for EOF, or SAFE_WRITE_ERROR
Packit eba2e2
   upon error.  */
Packit eba2e2
extern size_t safe_write (int fd, const void *buf, size_t count);