1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1982-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * David Korn <dgk@research.att.com> *
19 ***********************************************************************/
25 * Rewritten by David Korn
33 #include "FEATURE/setjmp"
34 #include "FEATURE/sigfeatures"
39 # define SIGWINCH SIGWIND
42 # define SIGWINCH SIGWINDOW
47 typedef void (*SH_SIGTYPE
)(int,void(*)(int));
49 #define SH_FORKLIM 16 /* fork timeout interval */
51 #define SH_TRAP 0200 /* bit for internal traps */
52 #define SH_ERRTRAP 0 /* trap for non-zero exit status */
53 #define SH_KEYTRAP 1 /* trap for keyboard event */
54 #define SH_DEBUGTRAP 4 /* must be last internal trap */
57 #define SH_SIGFAULT 1 /* signal handler is sh_fault */
58 #define SH_SIGOFF 2 /* signal handler is SIG_IGN */
59 #define SH_SIGSET 4 /* pending signal */
60 #define SH_SIGTRAP 010 /* pending trap */
61 #define SH_SIGDONE 020 /* default is exit */
62 #define SH_SIGIGNORE 040 /* default is ingore signal */
63 #define SH_SIGINTERACTIVE 0100 /* handle interactive specially */
64 #define SH_SIGTSTP 0200 /* tstp signal received */
65 #define SH_SIGALRM 0200 /* timer alarm received */
66 #define SH_SIGTERM SH_SIGOFF /* term signal received */
67 #define SH_SIGRUNTIME 0400 /* runtime value */
69 #define SH_SIGRTMIN 0 /* sh.sigruntime[] index */
70 #define SH_SIGRTMAX 1 /* sh.sigruntime[] index */
73 * These are longjmp values
84 #define SH_JMPERREXIT 10
86 #define SH_JMPSCRIPT 12
91 struct openlist
*next
;
100 struct openlist
*olist
;
101 #if (ERROR_VERSION >= 20030214L)
104 struct errorcontext err
;
108 #define sh_pushcontext(bp,n) ( (bp)->mode=(n) , (bp)->olist=0, \
109 (bp)->topfd=sh.topfd, (bp)->prev=sh.jmplist, \
110 (bp)->err = *ERROR_CONTEXT_BASE, \
111 sh.jmplist = (sigjmp_buf*)(&(bp)->buff) \
113 #define sh_popcontext(bp) (sh.jmplist=(bp)->prev, errorpop(&((bp)->err)))
115 extern void sh_fault(int);
116 extern void sh_done(void*,int);
117 extern void sh_chktrap(void);
118 extern void sh_sigclear(int);
119 extern void sh_sigdone(void);
120 extern void sh_siginit(void*);
121 extern void sh_sigtrap(int);
122 extern void sh_sigreset(int);
123 extern void sh_timetraps(void);
124 extern void *sh_timeradd(unsigned long,int ,void (*)(void*),void*);
125 extern void timerdel(void*);
127 extern const char e_alarm
[];
129 #endif /* !SH_SIGBITS */