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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [signal_2.c] - Blame information for rev 609

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: signal_2.c,v 1.2 2001-09-27 11:59:17 chris Exp $
12
 */
13
 
14
 
15
#include <signal.h>
16
#include <errno.h>
17
 
18
typedef void (*sighandler_t)(int);
19
 
20
sighandler_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
}

powered by: WebSVN 2.1.0

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