diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-12-18 21:58:40 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-12-18 21:58:40 +0000 |
commit | fbae7873aaba3bccd2740f827f35b547bff4d11c (patch) | |
tree | 6f307778f3d2ad8b0895cd1a4f5e019b521914df /bin/ksh | |
parent | 05fa6b4a5e651b080838958a6da002ff617331a3 (diff) |
Use the BSD sig_t instead of homegrown handler_t
Remove KSH_SA_FLAGS
Diffstat (limited to 'bin/ksh')
-rw-r--r-- | bin/ksh/proto.h | 4 | ||||
-rw-r--r-- | bin/ksh/sh.h | 13 | ||||
-rw-r--r-- | bin/ksh/trap.c | 12 |
3 files changed, 11 insertions, 18 deletions
diff --git a/bin/ksh/proto.h b/bin/ksh/proto.h index 6158592773d..bf7fa8c20f6 100644 --- a/bin/ksh/proto.h +++ b/bin/ksh/proto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proto.h,v 1.16 2004/12/18 21:25:44 millert Exp $ */ +/* $OpenBSD: proto.h,v 1.17 2004/12/18 21:58:39 millert Exp $ */ /* * prototypes for PD-KSH @@ -233,7 +233,7 @@ void restoresigs(void); void settrap(Trap *p, char *s); int block_pipe(void); void restore_pipe(int restore_dfl); -int setsig(Trap *p, handler_t f, int flags); +int setsig(Trap *p, sig_t f, int flags); void setexecsig(Trap *p, int restore); /* tree.c */ int fptreef(struct shf *f, int indent, const char *fmt, ...); diff --git a/bin/ksh/sh.h b/bin/ksh/sh.h index a552f721745..4161a8c0738 100644 --- a/bin/ksh/sh.h +++ b/bin/ksh/sh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sh.h,v 1.21 2004/12/18 21:04:52 millert Exp $ */ +/* $OpenBSD: sh.h,v 1.22 2004/12/18 21:58:39 millert Exp $ */ /* * Public Domain Bourne/Korn shell @@ -25,13 +25,6 @@ #include <signal.h> -/* struct sigaction.sa_flags is set to KSH_SA_FLAGS. Used to ensure - * system calls are interrupted - */ -#define KSH_SA_FLAGS 0 - -typedef void (*handler_t)(int); /* signal handler */ - #include <paths.h> /* Find a integer type that is at least 32 bits (or die) - SIZEOF_* defined @@ -265,8 +258,8 @@ typedef struct trap { char *trap; /* trap command */ int volatile set; /* trap pending */ int flags; /* TF_* */ - handler_t cursig; /* current handler (valid if TF_ORIG_* set) */ - handler_t shtrap; /* shell signal handler */ + sig_t cursig; /* current handler (valid if TF_ORIG_* set) */ + sig_t shtrap; /* shell signal handler */ } Trap; /* values for Trap.flags */ diff --git a/bin/ksh/trap.c b/bin/ksh/trap.c index 3cf79cacb3d..18fee382e88 100644 --- a/bin/ksh/trap.c +++ b/bin/ksh/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.16 2004/12/18 21:25:44 millert Exp $ */ +/* $OpenBSD: trap.c,v 1.17 2004/12/18 21:58:39 millert Exp $ */ /* * signal handling @@ -30,7 +30,7 @@ inittraps() sigtraps[i].mess = sys_siglist[i]; sigemptyset(&Sigact_ign.sa_mask); - Sigact_ign.sa_flags = KSH_SA_FLAGS; + Sigact_ign.sa_flags = 0; /* interruptible */ Sigact_ign.sa_handler = SIG_IGN; Sigact_trap = Sigact_ign; Sigact_trap.sa_handler = trapsig; @@ -289,7 +289,7 @@ settrap(p, s) Trap *p; char *s; { - handler_t f; + sig_t f; if (p->trap) afree(p->trap, APERM); @@ -355,7 +355,7 @@ restore_pipe(restore_dfl) int setsig(p, f, flags) Trap *p; - handler_t f; + sig_t f; int flags; { struct sigaction sigact; @@ -388,7 +388,7 @@ setsig(p, f, flags) * all users of shtrap are lifetime users (SIGCHLD, SIGALRM, SIGWINCH). */ if (!(flags & SS_USER)) - p->shtrap = (handler_t) 0; + p->shtrap = NULL; if (flags & SS_SHTRAP) { p->shtrap = f; f = trapsig; @@ -397,7 +397,7 @@ setsig(p, f, flags) if (p->cursig != f) { p->cursig = f; sigemptyset(&sigact.sa_mask); - sigact.sa_flags = KSH_SA_FLAGS; + sigact.sa_flags = 0 /* interruptible */; sigact.sa_handler = f; sigaction(p->signal, &sigact, (struct sigaction *) 0); } |