OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [posix/] [src/] [signal_2.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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
 *  signal_2.c,v 1.3 2001/01/24 14:17:28 joel Exp
12
 */
13
 
14
#if HAVE_CONFIG_H
15
#include "config.h"
16
#endif
17
 
18
#include <signal.h>
19
#include <errno.h>
20
 
21
typedef void (*sighandler_t)(int);
22
 
23
sighandler_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
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.