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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [psignalchecksignal.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 158 chris
/*
2 208 chris
 *  $Id: psignalchecksignal.c,v 1.2 2001-09-27 11:59:17 chris Exp $
3 158 chris
 */
4
 
5
#include <assert.h>
6
#include <errno.h>
7
#include <pthread.h>
8
#include <signal.h>
9
 
10
#include <rtems/system.h>
11
#include <rtems/score/isr.h>
12
#include <rtems/score/thread.h>
13
#include <rtems/score/tqdata.h>
14
#include <rtems/score/wkspace.h>
15
#include <rtems/posix/seterr.h>
16
#include <rtems/posix/threadsup.h>
17
#include <rtems/posix/psignal.h>
18
#include <rtems/posix/pthread.h>
19
#include <rtems/posix/time.h>
20
#include <stdio.h>
21
 
22
 
23
/*PAGE
24
 *
25
 *  _POSIX_signals_Check_signal
26
 */
27
 
28
boolean _POSIX_signals_Check_signal(
29
  POSIX_API_Control  *api,
30
  int                 signo,
31
  boolean             is_global
32
)
33
{
34
  siginfo_t                   siginfo_struct;
35
  sigset_t                    saved_signals_blocked;
36
 
37
  if ( ! _POSIX_signals_Clear_signals( api, signo, &siginfo_struct,
38
                                       is_global, TRUE ) )
39
    return FALSE;
40
 
41
  /*
42
   *  Since we made a union of these, only one test is necessary but this is
43
   *  safer.
44
   */
45
 
46
  assert( _POSIX_signals_Vectors[ signo ].sa_handler ||
47
          _POSIX_signals_Vectors[ signo ].sa_sigaction );
48
 
49
  /*
50
   *  Just to prevent sending a signal which is currently being ignored.
51
   */
52
 
53
  if ( _POSIX_signals_Vectors[ signo ].sa_handler == SIG_IGN )
54
    return FALSE;
55
 
56
  /*
57
   *  Block the signals requested in sa_mask
58
   */
59
 
60
  saved_signals_blocked = api->signals_blocked;
61
  api->signals_blocked |= _POSIX_signals_Vectors[ signo ].sa_mask;
62
 
63
  /* Here, the signal handler function executes */
64
 
65
  switch ( _POSIX_signals_Vectors[ signo ].sa_flags ) {
66
    case SA_SIGINFO:
67
/*
68
 *
69
 *     assert( is_global );
70
 */
71
      (*_POSIX_signals_Vectors[ signo ].sa_sigaction)(
72
        signo,
73
        &siginfo_struct,
74
        NULL        /* context is undefined per 1003.1b-1993, p. 66 */
75
      );
76
      break;
77
    default:
78
      (*_POSIX_signals_Vectors[ signo ].sa_handler)( signo );
79
      break;
80
  }
81
 
82
  /*
83
   *  Restore the previous set of blocked signals
84
   */
85
 
86
  api->signals_blocked = saved_signals_blocked;
87
 
88
  return TRUE;
89
}
90
 

powered by: WebSVN 2.1.0

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