source: rtems/c/src/exec/posix/src/signal_2.c @ 64f55e7

4.104.114.84.95
Last change on this file since 64f55e7 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 999 bytes
Line 
1/*
2 *  signal(2) - Install signal handler
3 *
4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.OARcorp.com/rtems/license.html.
10 *
11 *  $Id$
12 */
13
14
15#include <signal.h>
16#include <errno.h>
17
18typedef void (*sighandler_t)(int);
19
20sighandler_t signal(
21  int           signum,
22  sighandler_t  handler
23)
24{
25  struct sigaction s;
26  struct sigaction old;
27
28  s.sa_handler = handler ;
29  sigemptyset(&s.sa_mask);
30
31  /*
32   *  Depending on which system we want to behave like, one of
33   *  the following versions should be chosen.
34   */
35
36/* #define signal_like_linux */
37
38#if defined(signal_like_linux)
39  s.sa_flags   = SA_RESTART | SA_INTERRUPT | SA_NOMASK;
40  s.sa_restorer= NULL ;
41#elif defined(signal_like_SVR4)
42  s.sa_flags   = SA_RESTART;
43#else
44  s.sa_flags   = 0;
45#endif
46
47  sigaction( signum, &s, &old );
48  return (sighandler_t) old.sa_handler;
49}
Note: See TracBrowser for help on using the repository browser.