/* Return the current working directory. Returns NULL on errors.
Any other returned value must be freed with free. This is used
only when get_current_dir_name is not defined on the system. */
-char*
+char *
get_current_dir_name (void)
{
char *buf;
void
stuff_char (char c)
{
- if (! FRAME_TERMCAP_P (SELECTED_FRAME ()))
+ if (! (FRAMEP (selected_frame)
+ && FRAME_LIVE_P (XFRAME (selected_frame))
+ && FRAME_TERMCAP_P (XFRAME (selected_frame))))
return;
/* Should perhaps error if in batch mode */
signal (SIGIO, SIG_IGN);
#endif
}
+\f
+#ifndef MSDOS
+/* Block SIGCHLD. */
+
+void
+block_child_signal (sigset_t *oldset)
+{
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGCHLD);
+ sigaddset (&blocked, SIGINT);
+ pthread_sigmask (SIG_BLOCK, &blocked, oldset);
+}
+
+/* Unblock SIGCHLD. */
+void
+unblock_child_signal (sigset_t const *oldset)
+{
+ pthread_sigmask (SIG_SETMASK, oldset, 0);
+}
+
+#endif /* !MSDOS */
\f
/* Saving and restoring the process group of Emacs's terminal. */
int i;
tty_turn_off_insert (tty_out);
- for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++)
+ for (i = cursorX (tty_out); i < FrameCols (tty_out) - 1; i++)
{
fputc (' ', tty_out->output);
}
/* When handling a signal, block nonfatal system signals that are caught
by Emacs. This makes race conditions less likely. */
sigaddset (&action->sa_mask, SIGALRM);
+#ifdef SIGCHLD
sigaddset (&action->sa_mask, SIGCHLD);
+#endif
#ifdef SIGDANGER
sigaddset (&action->sa_mask, SIGDANGER);
#endif
static _Noreturn void
handle_arith_signal (int sig)
{
- sigset_t blocked;
- sigemptyset (&blocked);
- sigaddset (&blocked, sig);
- pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
xsignal0 (Qarith_error);
}
# ifdef SIGBUS
sys_siglist[SIGBUS] = "Bus error";
# endif
+# ifdef SIGCHLD
sys_siglist[SIGCHLD] = "Child status changed";
+# endif
# ifdef SIGCONT
sys_siglist[SIGCONT] = "Continued";
# endif
int
emacs_pipe (int fd[2])
{
+#ifdef MSDOS
+ return pipe (fd);
+#else /* !MSDOS */
int result = pipe2 (fd, O_CLOEXEC);
if (! O_CLOEXEC && result == 0)
{
fcntl (fd[1], F_SETFD, FD_CLOEXEC);
}
return result;
+#endif /* !MSDOS */
}
/* Approximate posix_close and POSIX_CLOSE_RESTART well enough for Emacs.