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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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