source: rtems/cpukit/posix/src/signal_2.c @ f22ebf0

4.104.114.84.95
Last change on this file since f22ebf0 was f42b726, checked in by Joel Sherrill <joel.sherrill@…>, on 01/24/01 at 14:17:28

2001-01-24 Ralf Corsepius <corsepiu@…>

  • configure.in: Add src/config.h
  • src/Makefile.am: Add INCLUDES += -I. to pickup config.h
  • src/.cvsignore: Add config.h and stamp-h
  • src/*.c: Add config.h support.
  • Property mode set to 100644
File size: 1.0 KB
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#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <signal.h>
19#include <errno.h>
20
21typedef void (*sighandler_t)(int);
22
23sighandler_t signal(
24  int           signum,
25  sighandler_t  handler
26)
27{
28  struct sigaction s;
29  struct sigaction old;
30
31  s.sa_handler = handler ;
32  sigemptyset(&s.sa_mask);
33
34  /*
35   *  Depending on which system we want to behave like, one of
36   *  the following versions should be chosen.
37   */
38
39/* #define signal_like_linux */
40
41#if defined(signal_like_linux)
42  s.sa_flags   = SA_RESTART | SA_INTERRUPT | SA_NOMASK;
43  s.sa_restorer= NULL ;
44#elif defined(signal_like_SVR4)
45  s.sa_flags   = SA_RESTART;
46#else
47  s.sa_flags   = 0;
48#endif
49
50  sigaction( signum, &s, &old );
51  return (sighandler_t) old.sa_handler;
52}
Note: See TracBrowser for help on using the repository browser.