PARA_ERROR(SIGNAL_SIG_ERR, "signal() retured SIG_ERR"), \
PARA_ERROR(SIGNAL_READ, "read error from signal pipe"), \
PARA_ERROR(WAITPID, "waitpid error"), \
- PARA_ERROR(SIGNAL_PIPE, "failed to setup signal pipe"), \
#define STRING_ERRORS \
static int signal_pipe[2];
/**
- * initialize the paraslash signal subsystem
+ * Initialize the paraslash signal subsystem.
*
* This function creates a pipe, the signal pipe, to deliver pending
* signals to the application (Bernstein's trick). It should be called
*/
int para_signal_init(void)
{
- int ret = -E_SIGNAL_PIPE;
- if (pipe(signal_pipe))
+ int ret;
+ if (pipe(signal_pipe) < 0) {
+ ret = -ERRNO_TO_PARA_ERROR(errno);
goto err_out;
+ }
ret = mark_fd_nonblock(signal_pipe[0]);
if (ret < 0)
goto err_out;
* This should be called if the fd for the signal pipe is ready for reading.
*
* \return On success, the number of the received signal is returned. \p
- * -E_SIGNAL_READ is returned if a read error occured while reading the signal
+ * -E_SIGNAL_READ is returned if a read error occurred while reading the signal
* pipe. If the read was interrupted by another signal the function returns 0.
*/
int para_next_signal(void)