SCCS-vsn: bin/csh/Makefile 8.2
SCCS-vsn: bin/csh/set.c 8.2
SCCS-vsn: bin/csh/proc.c 8.2
SCCS-vsn: bin/csh/sem.c 8.2
SCCS-vsn: bin/csh/exec.c 8.2
SCCS-vsn: bin/csh/file.c 8.3
SCCS-vsn: bin/csh/func.c 8.2
SCCS-vsn: bin/csh/hist.c 8.2
SCCS-vsn: bin/csh/csh.c 8.3
-# @(#)Makefile 8.1 (Berkeley) %G%
+# @(#)Makefile 8.2 (Berkeley) %G%
#
# C Shell with process control; VM/UNIX VAX Makefile
# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
#
# C Shell with process control; VM/UNIX VAX Makefile
# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
PROG= csh
DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_STRINGS
#CFLAGS+=-g
PROG= csh
DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_STRINGS
#CFLAGS+=-g
-#CFLAGS+=-Wall -ansi -pedantic
CFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
SRCS= alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \
func.c glob.c hist.c init.c lex.c misc.c parse.c printf.c proc.c \
CFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
SRCS= alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \
func.c glob.c hist.c init.c lex.c misc.c parse.c printf.c proc.c \
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)csh.c 8.3 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
register char *tcp;
register int f;
register char **tempv;
register char *tcp;
register int f;
register char **tempv;
+ struct sigaction oact;
+ sigset_t sigset;
cshin = stdin;
cshout = stdout;
cshin = stdin;
cshout = stdout;
* only if we are the login shell.
*/
/* parents interruptibility */
* only if we are the login shell.
*/
/* parents interruptibility */
- (void) sigvec(SIGINT, NULL, &osv);
- parintr = (void (*) ()) osv.sv_handler;
- (void) sigvec(SIGTERM, NULL, &osv);
- parterm = (void (*) ()) osv.sv_handler;
+ (void) sigaction(SIGINT, NULL, &oact);
+ parintr = oact.sa_handler;
+ (void) sigaction(SIGTERM, NULL, &oact);
+ parterm = oact.sa_handler;
if (loginsh) {
(void) signal(SIGHUP, phup); /* exit processing on HUP */
if (loginsh) {
(void) signal(SIGHUP, phup); /* exit processing on HUP */
if (!quitit) /* Wary! */
(void) signal(SIGQUIT, SIG_IGN);
(void) signal(SIGINT, pintr);
if (!quitit) /* Wary! */
(void) signal(SIGQUIT, SIG_IGN);
(void) signal(SIGINT, pintr);
- (void) sigblock(sigmask(SIGINT));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_BLOCK, &sigset, NULL);
(void) signal(SIGTERM, SIG_IGN);
if (quitit == 0 && arginp == 0) {
(void) signal(SIGTSTP, SIG_IGN);
(void) signal(SIGTERM, SIG_IGN);
if (quitit == 0 && arginp == 0) {
(void) signal(SIGTSTP, SIG_IGN);
{
int osetintr = setintr;
sig_t oparintr = parintr;
{
int osetintr = setintr;
sig_t oparintr = parintr;
- sigset_t omask = sigblock(sigmask(SIGINT));
+ sigset_t osigset;
+
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
setintr = 0;
parintr = SIG_IGN; /* Disable onintr */
setintr = 0;
parintr = SIG_IGN; /* Disable onintr */
if (loginsh)
(void) srcfile(_PATH_DOTLOGIN, 0, 0);
#endif
if (loginsh)
(void) srcfile(_PATH_DOTLOGIN, 0, 0);
#endif
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
setintr = osetintr;
parintr = oparintr;
}
setintr = osetintr;
parintr = oparintr;
}
bool otell = cantell;
struct Bin saveB;
bool otell = cantell;
struct Bin saveB;
- volatile sigset_t omask;
+ sigset_t sigset, osigset;
jmp_buf oldexit;
/* The (few) real local variables */
jmp_buf oldexit;
/* The (few) real local variables */
*/
insource = 1;
getexit(oldexit);
*/
insource = 1;
getexit(oldexit);
- if (setintr)
- omask = sigblock(sigmask(SIGINT));
+ if (setintr) {
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
+ }
/* Setup the new values of the state stuff saved above */
bcopy((char *) &B, (char *) &(saveB), sizeof(B));
fbuf = NULL;
/* Setup the new values of the state stuff saved above */
bcopy((char *) &B, (char *) &(saveB), sizeof(B));
fbuf = NULL;
* interrupted.
*/
if (setintr)
* interrupted.
*/
if (setintr)
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
settell();
if ((my_reenter = setexit()) == 0)
process(0); /* 0 -> blow away on errors */
if (setintr)
settell();
if ((my_reenter = setexit()) == 0)
process(0); /* 0 -> blow away on errors */
if (setintr)
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
if (oSHIN >= 0) {
register int i;
if (oSHIN >= 0) {
register int i;
+ sigset_t sigset, osigset;
- omask = sigblock((sigset_t) 0);
+ sigemptyset(&sigset);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
- (void) sigsetmask(omask & ~sigmask(SIGINT));
+ sigset = osigset;
+ sigdelset(&sigset, SIGINT);
+ sigprocmask(SIG_SETMASK, &sigset, NULL);
if (pjobs) {
pjobs = 0;
(void) fprintf(cshout, "\n");
if (pjobs) {
pjobs = 0;
(void) fprintf(cshout, "\n");
stderror(ERR_NAME | ERR_INTR);
}
}
stderror(ERR_NAME | ERR_INTR);
}
}
- (void) sigsetmask(omask & ~sigmask(SIGCHLD));
+ sigdelset(&osigset, SIGCHLD);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
(void) fpurge(cshout);
(void) endpwent();
(void) fpurge(cshout);
(void) endpwent();
{
jmp_buf osetexit;
struct command *t = savet;
{
jmp_buf osetexit;
struct command *t = savet;
savet = NULL;
getexit(osetexit);
savet = NULL;
getexit(osetexit);
/*
* Interruptible during interactive reads
*/
/*
* Interruptible during interactive reads
*/
- if (setintr)
- (void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
+ if (setintr) {
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_UNBLOCK, &sigset, NULL);
+ }
/*
* For the sake of reset()
/*
* For the sake of reset()
* The parser may lose space if interrupted.
*/
if (setintr)
* The parser may lose space if interrupted.
*/
if (setintr)
- (void) sigblock(sigmask(SIGINT));
+ sigprocmask(SIG_BLOCK, &sigset, NULL);
/*
* Save input text on the history list if reading in old history, or it
/*
* Save input text on the history list if reading in old history, or it
-static char sccsid[] = "@(#)exec.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)exec.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
register bool slash;
register int hashval = 0, hashval1, i;
Char *blk[2];
register bool slash;
register int hashval = 0, hashval1, i;
Char *blk[2];
/*
* Glob the command name. We will search $path even if this does something,
/*
* Glob the command name. We will search $path even if this does something,
* We must do this AFTER any possible forking (like `foo` in glob) so that
* this shell can still do subprocesses.
*/
* We must do this AFTER any possible forking (like `foo` in glob) so that
* this shell can still do subprocesses.
*/
- (void) sigsetmask((sigset_t) 0);
+ sigemptyset(&sigset);
+ sigprocmask(SIG_SETMASK, &sigset, NULL);
/*
* If no path, no words in path, or a / in the filename then restrict the
* command search.
/*
* If no path, no words in path, or a / in the filename then restrict the
* command search.
-static char sccsid[] = "@(#)file.c 8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)file.c 8.3 (Berkeley) %G%";
#endif /* not lint */
#ifdef FILEC
#endif /* not lint */
#ifdef FILEC
back_to_col_1()
{
struct termios tty, tty_normal;
back_to_col_1()
{
struct termios tty, tty_normal;
+ sigset_t sigset, osigset;
- omask = sigblock(sigmask(SIGINT));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
(void) tcgetattr(SHOUT, &tty);
tty_normal = tty;
tty.c_iflag &= ~INLCR;
(void) tcgetattr(SHOUT, &tty);
tty_normal = tty;
tty.c_iflag &= ~INLCR;
(void) tcsetattr(SHOUT, TCSANOW, &tty);
(void) write(SHOUT, "\r", 1);
(void) tcsetattr(SHOUT, TCSANOW, &tty_normal);
(void) tcsetattr(SHOUT, TCSANOW, &tty);
(void) write(SHOUT, "\r", 1);
(void) tcsetattr(SHOUT, TCSANOW, &tty_normal);
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
{
register Char *p;
struct termios tty, tty_normal;
{
register Char *p;
struct termios tty, tty_normal;
+ sigset_t sigset, osigset;
- omask = sigblock(sigmask(SIGINT));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
(void) tcgetattr(SHOUT, &tty);
tty_normal = tty;
tty.c_lflag &= ~(ECHOKE | ECHO | ECHOE | ECHOK | ECHONL | ECHOPRT | ECHOCTL);
(void) tcgetattr(SHOUT, &tty);
tty_normal = tty;
tty.c_lflag &= ~(ECHOKE | ECHO | ECHOE | ECHOK | ECHONL | ECHOPRT | ECHOCTL);
for (p = string; (c = *p) != '\0'; p++)
(void) ioctl(SHOUT, TIOCSTI, (ioctl_t) & c);
(void) tcsetattr(SHOUT, TCSANOW, &tty_normal);
for (p = string; (c = *p) != '\0'; p++)
(void) ioctl(SHOUT, TIOCSTI, (ioctl_t) & c);
(void) tcsetattr(SHOUT, TCSANOW, &tty_normal);
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
}
#define FREE_ITEMS(items) { \
}
#define FREE_ITEMS(items) { \
+ sigset_t sigset, osigset;\
- omask = sigblock(sigmask(SIGINT));\
+ sigemptyset(&sigset);\
+ sigaddset(&sigset, SIGINT);\
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);\
free_items(items);\
items = NULL;\
free_items(items);\
items = NULL;\
- (void) sigsetmask(omask);\
+ sigprocmask(SIG_SETMASK, &osigset, NULL);\
-static char sccsid[] = "@(#)func.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)func.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
{
register Char *cp;
register Char *vv = v[1];
{
register Char *cp;
register Char *vv = v[1];
if (parintr == SIG_IGN)
return;
if (parintr == SIG_IGN)
return;
gointr = 0;
xfree((ptr_t) cp);
if (vv == 0) {
gointr = 0;
xfree((ptr_t) cp);
if (vv == 0) {
- if (setintr)
- (void) sigblock(sigmask(SIGINT));
- else
+ if (setintr) {
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_BLOCK, &sigset, NULL);
+ } else
(void) signal(SIGINT, SIG_DFL);
gointr = 0;
}
(void) signal(SIGINT, SIG_DFL);
gointr = 0;
}
whyles->w_end.type = I_SEEK;
whyles->w_end.type = I_SEEK;
- if (setintr)
- (void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
+ if (setintr) {
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_UNBLOCK, &sigset, NULL);
+ }
search(T_BREAK, 0, NULL); /* read the expression in */
if (setintr)
search(T_BREAK, 0, NULL); /* read the expression in */
if (setintr)
- (void) sigblock(sigmask(SIGINT));
+ sigprocmask(SIG_BLOCK, &sigset, NULL);
struct command *kp;
{
register int i;
struct command *kp;
{
register int i;
- register sigset_t omask = 0;
- if (setintr)
- omask = sigblock(sigmask(SIGINT)) & ~sigmask(SIGINT);
+ if (setintr) {
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_BLOCK, &sigset, NULL);
+ }
lshift(v, 2);
while (i > 0) {
if (setintr)
lshift(v, 2);
while (i > 0) {
if (setintr)
- (void) sigsetmask(omask);
+ sigprocmask(SIG_UNBLOCK, &sigset, NULL);
reexecute(kp);
--i;
}
donefds();
if (setintr)
reexecute(kp);
--i;
}
donefds();
if (setintr)
- (void) sigsetmask(omask);
+ sigprocmask(SIG_UNBLOCK, &sigset, NULL);
{
register Char *cp;
int nonl = 0;
{
register Char *cp;
int nonl = 0;
- if (setintr)
- (void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
+ if (setintr) {
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_UNBLOCK, &sigset, NULL);
+ }
v++;
if (*v == 0)
return;
v++;
if (*v == 0)
return;
else
(void) fflush(cshout);
if (setintr)
else
(void) fflush(cshout);
if (setintr)
- (void) sigblock(sigmask(SIGINT));
+ sigprocmask(SIG_BLOCK, &sigset, NULL);
if (gargv)
blkfree(gargv), gargv = 0;
}
if (gargv)
blkfree(gargv), gargv = 0;
}
struct command *t;
{
Char *vp, *lp;
struct command *t;
{
Char *vp, *lp;
v++;
if ((vp = *v++) == 0) {
register Char **ep;
v++;
if ((vp = *v++) == 0) {
register Char **ep;
- if (setintr)
- (void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
+ if (setintr) {
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_UNBLOCK, &sigset, NULL);
+ }
for (ep = STR_environ; *ep; ep++)
(void) fprintf(cshout, "%s\n", vis_str(*ep));
return;
for (ep = STR_environ; *ep; ep++)
(void) fprintf(cshout, "%s\n", vis_str(*ep));
return;
-static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)hist.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
struct command *t;
{
int n, rflg = 0, hflg = 0;
struct command *t;
{
int n, rflg = 0, hflg = 0;
if (getn(value(STRhistory)) == 0)
return;
if (getn(value(STRhistory)) == 0)
return;
- if (setintr)
- (void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
+ if (setintr) {
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_UNBLOCK, &sigset, NULL);
+ }
while (*++v && **v == '-') {
Char *vp = *v;
while (*++v && **v == '-') {
Char *vp = *v;
-static char sccsid[] = "@(#)proc.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)proc.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
{
register struct process *pp;
int flags;
{
register struct process *pp;
int flags;
+ sigset_t sigset, osigset;
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGCHLD);
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next) {
if (pp->p_flags & PNEEDNOTE) {
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next) {
if (pp->p_flags & PNEEDNOTE) {
- omask = sigblock(sigmask(SIGCHLD));
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
pp->p_flags &= ~PNEEDNOTE;
flags = pprint(pp, NUMBER | NAME | REASON);
if ((flags & (PRUNNING | PSTOPPED)) == 0)
pflush(pp);
pp->p_flags &= ~PNEEDNOTE;
flags = pprint(pp, NUMBER | NAME | REASON);
if ((flags & (PRUNNING | PSTOPPED)) == 0)
pflush(pp);
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
pwait()
{
register struct process *fp, *pp;
pwait()
{
register struct process *fp, *pp;
+ sigset_t sigset, osigset;
/*
* Here's where dead procs get flushed.
*/
/*
* Here's where dead procs get flushed.
*/
- omask = sigblock(sigmask(SIGCHLD));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
for (pp = (fp = &proclist)->p_next; pp != NULL; pp = (fp = pp)->p_next)
if (pp->p_pid == 0) {
fp->p_next = pp->p_next;
for (pp = (fp = &proclist)->p_next; pp != NULL; pp = (fp = pp)->p_next)
if (pp->p_pid == 0) {
fp->p_next = pp->p_next;
xfree((ptr_t) pp);
pp = fp;
}
xfree((ptr_t) pp);
pp = fp;
}
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
{
register struct process *fp;
int jobflags, reason;
{
register struct process *fp;
int jobflags, reason;
+ sigset_t sigset, osigset;
while (pp->p_pid != pp->p_jobid)
pp = pp->p_friends;
while (pp->p_pid != pp->p_jobid)
pp = pp->p_friends;
* target process, or any of its friends, are running
*/
fp = pp;
* target process, or any of its friends, are running
*/
fp = pp;
- omask = sigblock(sigmask(SIGCHLD));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
- (void) sigblock(sigmask(SIGCHLD));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &sigset, NULL);
jobflags = 0;
do
jobflags |= fp->p_flags;
jobflags = 0;
do
jobflags |= fp->p_flags;
if ((jobflags & PRUNNING) == 0)
break;
#ifdef JOBDEBUG
if ((jobflags & PRUNNING) == 0)
break;
#ifdef JOBDEBUG
- (void) fprintf(csherr, "starting to sigpause for SIGCHLD on %d\n",
+ (void) fprintf(csherr, "starting to sigsuspend for SIGCHLD on %d\n",
fp->p_pid);
#endif /* JOBDEBUG */
fp->p_pid);
#endif /* JOBDEBUG */
- (void) sigpause(omask & ~sigmask(SIGCHLD));
+ sigset = osigset;
+ sigdelset(&sigset, SIGCHLD);
+ sigsuspend(&sigset);
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
if (tpgrp > 0) /* get tty back */
(void) tcsetpgrp(FSHTTY, tpgrp);
if ((jobflags & (PSIGNALED | PSTOPPED | PTIME)) ||
if (tpgrp > 0) /* get tty back */
(void) tcsetpgrp(FSHTTY, tpgrp);
if ((jobflags & (PSIGNALED | PSTOPPED | PTIME)) ||
struct command *t;
{
register struct process *pp;
struct command *t;
{
register struct process *pp;
+ sigset_t sigset, osigset;
- omask = sigblock(sigmask(SIGCHLD));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
loop:
for (pp = proclist.p_next; pp; pp = pp->p_next)
if (pp->p_pid && /* pp->p_pid == pp->p_jobid && */
pp->p_flags & PRUNNING) {
loop:
for (pp = proclist.p_next; pp; pp = pp->p_next)
if (pp->p_pid && /* pp->p_pid == pp->p_jobid && */
pp->p_flags & PRUNNING) {
- (void) sigpause((sigset_t) 0);
+ sigemptyset(&sigset);
+ sigsuspend(&sigset);
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
register struct process *pp, *np;
register int jobflags = 0;
int pid, err1 = 0;
register struct process *pp, *np;
register int jobflags = 0;
int pid, err1 = 0;
- omask = sigmask(SIGCHLD);
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGCHLD);
- omask |= sigmask(SIGINT);
- omask = sigblock(omask) & ~omask;
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_BLOCK, &sigset, NULL);
gflag = 0, tglob(v);
if (gflag) {
v = globall(v);
gflag = 0, tglob(v);
if (gflag) {
v = globall(v);
}
if (gargv)
blkfree(gargv), gargv = 0;
}
if (gargv)
blkfree(gargv), gargv = 0;
- (void) sigsetmask(omask);
+ sigprocmask(SIG_UNBLOCK, &sigset, NULL);
if (err1)
stderror(ERR_SILENT);
}
if (err1)
stderror(ERR_SILENT);
}
int foregnd;
{
register struct process *np;
int foregnd;
{
register struct process *np;
+ sigset_t sigset, osigset;
- omask = sigblock(sigmask(SIGCHLD));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
np = pp;
do {
jobflags |= np->p_flags;
np = pp;
do {
jobflags |= np->p_flags;
(void) tcsetpgrp(FSHTTY, pp->p_jobid);
if (jobflags & PSTOPPED)
(void) killpg((pid_t) pp->p_jobid, SIGCONT);
(void) tcsetpgrp(FSHTTY, pp->p_jobid);
if (jobflags & PSTOPPED)
(void) killpg((pid_t) pp->p_jobid, SIGCONT);
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
register int pid;
bool ignint = 0;
int pgrp;
register int pid;
bool ignint = 0;
int pgrp;
+ sigset_t sigset, osigset;
/*
* A child will be uninterruptible only under very special conditions.
/*
* A child will be uninterruptible only under very special conditions.
/*
* Hold SIGCHLD until we have the process installed in our table.
*/
/*
* Hold SIGCHLD until we have the process installed in our table.
*/
- omask = sigblock(sigmask(SIGCHLD));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
while ((pid = fork()) < 0)
if (setintr == 0)
(void) sleep(FORKSLEEP);
else {
while ((pid = fork()) < 0)
if (setintr == 0)
(void) sleep(FORKSLEEP);
else {
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
stderror(ERR_NOPROC);
}
if (pid == 0) {
stderror(ERR_NOPROC);
}
if (pid == 0) {
if (wanttty >= 0)
(void) setpgid(pid, pcurrjob ? pcurrjob->p_jobid : pid);
palloc(pid, t);
if (wanttty >= 0)
(void) setpgid(pid, pcurrjob ? pcurrjob->p_jobid : pid);
palloc(pid, t);
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
pgetty(wanttty, pgrp)
int wanttty, pgrp;
{
pgetty(wanttty, pgrp)
int wanttty, pgrp;
{
+ sigset_t sigset, osigset;
/*
* christos: I am blocking the tty signals till I've set things
* correctly....
*/
/*
* christos: I am blocking the tty signals till I've set things
* correctly....
*/
- if (wanttty > 0)
- omask = sigblock(sigmask(SIGTSTP)|sigmask(SIGTTIN)|sigmask(SIGTTOU));
+ if (wanttty > 0) {
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGTSTP);
+ sigaddset(&sigset, SIGTTIN);
+ sigaddset(&sigset, SIGTTOU);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
+ }
/*
* From: Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de>
* Don't check for tpgrp >= 0 so even non-interactive shells give
/*
* From: Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de>
* Don't check for tpgrp >= 0 so even non-interactive shells give
if (wanttty > 0) {
(void) tcsetpgrp(FSHTTY, pgrp);
if (wanttty > 0) {
(void) tcsetpgrp(FSHTTY, pgrp);
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
-static char sccsid[] = "@(#)sem.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)sem.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
struct biltins *bifunc;
int pid = 0;
int pv[2];
struct biltins *bifunc;
int pid = 0;
int pv[2];
- static sigset_t csigmask;
+ static sigset_t csigset;
- static sigset_t ocsigmask;
+ static sigset_t ocsigset;
static int onosigchld = 0;
static int nosigchld = 0;
static int onosigchld = 0;
static int nosigchld = 0;
* not die before we can set the process group
*/
if (wanttty >= 0 && !nosigchld) {
* not die before we can set the process group
*/
if (wanttty >= 0 && !nosigchld) {
- csigmask = sigblock(sigmask(SIGCHLD));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &sigset, &csigset);
nosigchld = 1;
}
pid = pfork(t, wanttty);
if (pid == 0 && nosigchld) {
nosigchld = 1;
}
pid = pfork(t, wanttty);
if (pid == 0 && nosigchld) {
- (void) sigsetmask(csigmask);
+ sigprocmask(SIG_SETMASK, &csigset, NULL);
nosigchld = 0;
}
else if (pid != 0 && (t->t_dflg & F_AMPERSAND))
nosigchld = 0;
}
else if (pid != 0 && (t->t_dflg & F_AMPERSAND))
else {
int ochild, osetintr, ohaderr, odidfds;
int oSHIN, oSHOUT, oSHERR, oOLDSTD, otpgrp;
else {
int ochild, osetintr, ohaderr, odidfds;
int oSHIN, oSHOUT, oSHERR, oOLDSTD, otpgrp;
/*
* Prepare for the vfork by saving everything that the child
* corrupts before it exec's. Note that in some signal
* implementations which keep the signal info in user space
* (e.g. Sun's) it will also be necessary to save and restore
/*
* Prepare for the vfork by saving everything that the child
* corrupts before it exec's. Note that in some signal
* implementations which keep the signal info in user space
* (e.g. Sun's) it will also be necessary to save and restore
- * the current sigvec's for the signals the child touches
+ * the current sigaction's for the signals the child touches
* before it exec's.
*/
if (wanttty >= 0 && !nosigchld && !noexec) {
* before it exec's.
*/
if (wanttty >= 0 && !nosigchld && !noexec) {
- csigmask = sigblock(sigmask(SIGCHLD));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &sigset, &csigset);
- omask = sigblock(sigmask(SIGCHLD) | sigmask(SIGINT));
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_BLOCK, &sigset, &osigset);
ochild = child;
osetintr = setintr;
ohaderr = haderr;
ochild = child;
osetintr = setintr;
ohaderr = haderr;
oSHERR = SHERR;
oOLDSTD = OLDSTD;
otpgrp = tpgrp;
oSHERR = SHERR;
oOLDSTD = OLDSTD;
otpgrp = tpgrp;
onosigchld = nosigchld;
Vsav = Vdp = 0;
Vexpath = 0;
onosigchld = nosigchld;
Vsav = Vdp = 0;
Vexpath = 0;
pid = vfork();
if (pid < 0) {
pid = vfork();
if (pid < 0) {
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
stderror(ERR_NOPROC);
}
forked++;
stderror(ERR_NOPROC);
}
forked++;
SHERR = oSHERR;
OLDSTD = oOLDSTD;
tpgrp = otpgrp;
SHERR = oSHERR;
OLDSTD = oOLDSTD;
tpgrp = otpgrp;
nosigchld = onosigchld;
xfree((ptr_t) Vsav);
nosigchld = onosigchld;
xfree((ptr_t) Vsav);
Vt = 0;
/* this is from pfork() */
palloc(pid, t);
Vt = 0;
/* this is from pfork() */
palloc(pid, t);
- (void) sigsetmask(omask);
+ sigprocmask(SIG_SETMASK, &osigset, NULL);
}
else { /* child */
/* this is from pfork() */
}
else { /* child */
/* this is from pfork() */
bool ignint = 0;
if (nosigchld) {
bool ignint = 0;
if (nosigchld) {
- (void) sigsetmask(csigmask);
+ sigprocmask(SIG_SETMASK, &csigset, NULL);
}
if ((t->t_dflg & F_PIPEOUT) == 0) {
if (nosigchld) {
}
if ((t->t_dflg & F_PIPEOUT) == 0) {
if (nosigchld) {
- (void) sigsetmask(csigmask);
+ sigprocmask(SIG_SETMASK, &csigset, NULL);
nosigchld = 0;
}
if ((t->t_dflg & F_AMPERSAND) == 0)
nosigchld = 0;
}
if ((t->t_dflg & F_AMPERSAND) == 0)
-static char sccsid[] = "@(#)set.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)set.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
{
register struct varent *c;
register len;
{
register struct varent *c;
register len;
- if (setintr)
- (void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
+ if (setintr) {
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGINT);
+ sigprocmask(SIG_UNBLOCK, &sigset, NULL);
+ }
for (;;) {
while (p->v_left)
for (;;) {
while (p->v_left)