home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / sys / signal.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  8.5 KB  |  255 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    signal.h,v $
  29.  * Revision 2.1  92/04/21  17:16:59  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. /*
  36.  * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
  37.  * All rights reserved.
  38.  *
  39.  * Redistribution and use in source and binary forms, with or without
  40.  * modification, are permitted provided that the following conditions
  41.  * are met:
  42.  * 1. Redistributions of source code must retain the above copyright
  43.  *    notice, this list of conditions and the following disclaimer.
  44.  * 2. Redistributions in binary form must reproduce the above copyright
  45.  *    notice, this list of conditions and the following disclaimer in the
  46.  *    documentation and/or other materials provided with the distribution.
  47.  * 3. All advertising materials mentioning features or use of this software
  48.  *    must display the following acknowledgement:
  49.  *    This product includes software developed by the University of
  50.  *    California, Berkeley and its contributors.
  51.  * 4. Neither the name of the University nor the names of its contributors
  52.  *    may be used to endorse or promote products derived from this software
  53.  *    without specific prior written permission.
  54.  *
  55.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  56.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  57.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  58.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  59.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  60.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  61.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  62.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  63.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  64.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  65.  * SUCH DAMAGE.
  66.  *
  67.  *    @(#)signal.h    7.16 (Berkeley) 3/17/91
  68.  */
  69.  
  70. #ifndef    _SIGNAL_H_
  71. #define    _SIGNAL_H_
  72.  
  73. #define NSIG    32        /* counting 0; could be 33 (mask is 1-32) */
  74.  
  75. #ifndef _POSIX_SOURCE
  76. #include <machine/trap.h>    /* codes for SIGILL, SIGFPE */
  77. #endif /* _POSIX_SOURCE */
  78.  
  79. #define    SIGHUP    1    /* hangup */
  80. #define    SIGINT    2    /* interrupt */
  81. #define    SIGQUIT    3    /* quit */
  82. #define    SIGILL    4    /* illegal instruction (not reset when caught) */
  83. #ifndef _POSIX_SOURCE
  84. #define    SIGTRAP    5    /* trace trap (not reset when caught) */
  85. #endif
  86. #define    SIGABRT    6    /* abort() */
  87. #ifndef _POSIX_SOURCE
  88. #define    SIGIOT    SIGABRT    /* compatibility */
  89. #define    SIGEMT    7    /* EMT instruction */
  90. #endif
  91. #define    SIGFPE    8    /* floating point exception */
  92. #define    SIGKILL    9    /* kill (cannot be caught or ignored) */
  93. #ifndef _POSIX_SOURCE
  94. #define    SIGBUS    10    /* bus error */
  95. #endif
  96. #define    SIGSEGV    11    /* segmentation violation */
  97. #ifndef _POSIX_SOURCE
  98. #define    SIGSYS    12    /* bad argument to system call */
  99. #endif
  100. #define    SIGPIPE    13    /* write on a pipe with no one to read it */
  101. #define    SIGALRM    14    /* alarm clock */
  102. #define    SIGTERM    15    /* software termination signal from kill */
  103. #ifndef _POSIX_SOURCE
  104. #define    SIGURG    16    /* urgent condition on IO channel */
  105. #endif
  106. #define    SIGSTOP    17    /* sendable stop signal not from tty */
  107. #define    SIGTSTP    18    /* stop signal from tty */
  108. #define    SIGCONT    19    /* continue a stopped process */
  109. #define    SIGCHLD    20    /* to parent on child stop or exit */
  110. #define    SIGTTIN    21    /* to readers pgrp upon background tty read */
  111. #define    SIGTTOU    22    /* like TTIN for output if (tp->t_local<OSTOP) */
  112. #ifndef _POSIX_SOURCE
  113. #define    SIGIO    23    /* input/output possible signal */
  114. #define    SIGXCPU    24    /* exceeded CPU time limit */
  115. #define    SIGXFSZ    25    /* exceeded file size limit */
  116. #define    SIGVTALRM 26    /* virtual time alarm */
  117. #define    SIGPROF    27    /* profiling time alarm */
  118. #define SIGWINCH 28    /* window size changes */
  119. #define SIGINFO    29    /* information request */
  120. #endif
  121. #define SIGUSR1 30    /* user defined signal 1 */
  122. #define SIGUSR2 31    /* user defined signal 2 */
  123.  
  124. #include <sys/cdefs.h>
  125.  
  126. #ifndef _POSIX_SOURCE
  127. typedef    void (*sig_t) __P((int));
  128. #endif
  129.  
  130. typedef unsigned int sigset_t;
  131.  
  132. __BEGIN_DECLS
  133. int    sigaddset __P((sigset_t *, int));
  134. int    sigdelset __P((sigset_t *, int));
  135. int    sigemptyset __P((sigset_t *));
  136. int    sigfillset __P((sigset_t *));
  137. int    sigismember __P((const sigset_t *, int));
  138. __END_DECLS
  139.  
  140. #define sigemptyset(set)    ( *(set) = 0 )
  141. #define sigfillset(set)        ( *(set) = ~(sigset_t)0, 0 )
  142. #define sigaddset(set, signo)    ( *(set) |= 1 << ((signo) - 1), 0)
  143. #define sigdelset(set, signo)    ( *(set) &= ~(1 << ((signo) - 1)), 0)
  144. #define sigismember(set, signo)    ( (*(set) & (1 << ((signo) - 1))) != 0)
  145.  
  146. /*
  147.  * Signal vector "template" used in sigaction call.
  148.  */
  149. struct    sigaction {
  150.     void    (*sa_handler)();    /* signal handler */
  151.     sigset_t sa_mask;        /* signal mask to apply */
  152.     int    sa_flags;        /* see signal options below */
  153. };
  154. #ifndef _POSIX_SOURCE
  155. #define SA_ONSTACK    0x0001    /* take signal on signal stack */
  156. #define SA_RESTART    0x0002    /* do not restart system on signal return */
  157. #endif
  158. #define SA_NOCLDSTOP    0x0004    /* do not generate SIGCHLD on child stop */
  159.  
  160. /*
  161.  * Flags for sigprocmask:
  162.  */
  163. #define    SIG_BLOCK    1    /* block specified signal set */
  164. #define    SIG_UNBLOCK    2    /* unblock specified signal set */
  165. #define    SIG_SETMASK    3    /* set specified signal set */
  166.  
  167. #ifndef _POSIX_SOURCE
  168. /*
  169.  * 4.3 compatibility:
  170.  * Signal vector "template" used in sigvec call.
  171.  */
  172. struct    sigvec {
  173.     void    (*sv_handler)();    /* signal handler */
  174.     int    sv_mask;        /* signal mask to apply */
  175.     int    sv_flags;        /* see signal options below */
  176. };
  177. #define SV_ONSTACK    SA_ONSTACK
  178. #define SV_INTERRUPT    SA_RESTART    /* same bit, opposite sense */
  179. #define sv_onstack sv_flags    /* isn't compatibility wonderful! */
  180.  
  181. /*
  182.  * Structure used in sigaltstack call.
  183.  */
  184. struct    sigaltstack {
  185.     char    *ss_base;        /* signal stack base */
  186.     int    ss_len;            /* signal stack length */
  187.     int    ss_onstack;        /* current status */
  188. };
  189.  
  190. /*
  191.  * Structure used in sigstack call.
  192.  */
  193. struct    sigstack {
  194.     char    *ss_sp;            /* signal stack pointer */
  195.     int    ss_onstack;        /* current status */
  196. };
  197.  
  198. /*
  199.  * Information pushed on stack when a signal is delivered.
  200.  * This is used by the kernel to restore state following
  201.  * execution of the signal handler.  It is also made available
  202.  * to the handler to allow it to restore state properly if
  203.  * a non-standard exit is performed.
  204.  */
  205. struct    sigcontext {
  206.     int    sc_onstack;        /* sigstack state to restore */
  207.     int    sc_mask;        /* signal mask to restore */
  208.     int    sc_sp;            /* sp to restore */
  209.     int    sc_fp;            /* fp to restore */
  210.     int    sc_ap;            /* ap to restore */
  211.     int    sc_pc;            /* pc to restore */
  212.     int    sc_ps;            /* psl to restore */
  213. };
  214.  
  215. /*
  216.  * Macro for converting signal number to a mask suitable for
  217.  * sigblock().
  218.  */
  219. #define sigmask(m)    (1 << ((m)-1))
  220.  
  221. #define    BADSIG        (void (*)())-1
  222. #endif    /* _POSIX_SOURCE */
  223.  
  224. #define    SIG_DFL        (void (*)())0
  225. #define    SIG_IGN        (void (*)())1
  226.  
  227. #ifndef KERNEL
  228. #include <sys/types.h>
  229.  
  230. __BEGIN_DECLS
  231. void    (*signal __P((int, void (*) __P((int))))) __P((int));
  232. int    raise __P((int));
  233. #ifndef    _ANSI_SOURCE
  234. int    kill __P((pid_t, int));
  235. int    sigaction __P((int, const struct sigaction *, struct sigaction *));
  236. int    sigpending __P((sigset_t *));
  237. int    sigprocmask __P((int, const sigset_t *, sigset_t *));
  238. int    sigsuspend __P((const sigset_t *));
  239. #endif    /* !_ANSI_SOURCE */
  240. #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
  241. int    killpg __P((pid_t, int));
  242. void    psignal __P((unsigned, const char *));
  243. int    sigblock __P((int));
  244. int    siginterrupt __P((int, int));
  245. int    sigpause __P((int));
  246. int    sigreturn __P((struct sigcontext *));
  247. int    sigsetmask __P((int));
  248. int    sigstack __P((const struct sigstack *, struct sigstack *));
  249. int    sigvec __P((int, struct sigvec *, struct sigvec *));
  250. #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
  251. __END_DECLS
  252.  
  253. #endif    /* !KERNEL */
  254. #endif    /* !_SIGNAL_H_ */
  255.