#define PROCESS_INLINE EXTERN_INLINE
-#include <signal.h>
#include <stdio.h>
#include <errno.h>
#include <setjmp.h>
#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
int wait_child_setup[2];
#endif
- sigset_t procmask;
- sigset_t blocked;
+ sigset_t blocked, procmask;
struct sigaction sigint_action;
struct sigaction sigquit_action;
struct sigaction sigpipe_action;
int xforkin = forkin;
int xforkout = forkout;
-#if 0 /* This was probably a mistake--it duplicates code later on,
- but fails to handle all the cases. */
- /* Make sure SIGCHLD is not blocked in the child. */
- sigsetmask (SIGEMPTYMASK);
-#endif
-
/* Make the pty be the controlling terminal of the process. */
#ifdef HAVE_PTYS
/* First, disconnect its current controlling terminal. */
static _Noreturn void
handle_pipe_signal (int sig)
{
- sigunblock (sigmask (SIGPIPE));
+ sigset_t unblocked;
+ sigemptyset (&unblocked);
+ sigaddset (&unblocked, SIGPIPE);
+ pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
_longjmp (send_process_frame, 1);
}
struct Lisp_Process *p = XPROCESS (proc);
ssize_t rv;
struct coding_system *coding;
- void (*volatile old_sigpipe) (int);
+ struct sigaction old_sigpipe_action;
if (p->raw_status_new)
update_status (p);
/* Send this batch, using one or more write calls. */
ptrdiff_t written = 0;
int outfd = p->outfd;
- old_sigpipe = signal (SIGPIPE, deliver_pipe_signal);
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_pipe_signal);
+ sigaction (SIGPIPE, &action, &old_sigpipe_action);
#ifdef DATAGRAM_SOCKETS
if (DATAGRAM_CHAN_P (outfd))
{
written = rv;
else if (errno == EMSGSIZE)
{
- signal (SIGPIPE, old_sigpipe);
+ sigaction (SIGPIPE, &old_sigpipe_action, 0);
report_file_error ("sending datagram",
Fcons (proc, Qnil));
}
}
#endif
}
- signal (SIGPIPE, old_sigpipe);
+ sigaction (SIGPIPE, &old_sigpipe_action, 0);
if (rv < 0)
{
}
else
{
- signal (SIGPIPE, old_sigpipe);
+ sigaction (SIGPIPE, &old_sigpipe_action, 0);
proc = process_sent_to;
p = XPROCESS (proc);
p->raw_status_new = 0;
#ifndef CANNOT_DUMP
if (! noninteractive || initialized)
#endif
- signal (SIGCHLD, deliver_child_signal);
+ {
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_child_signal);
+ sigaction (SIGCHLD, &action, 0);
+ }
#endif
FD_ZERO (&input_wait_mask);