source: rtems/cpukit/posix/src/pthreadkill.c @ 781262bb

4.104.114.84.95
Last change on this file since 781262bb was 781262bb, checked in by Joel Sherrill <joel.sherrill@…>, on 10/31/00 at 16:33:48

2000-10-30 Joel Sherrill <joel@…>

  • include/Makefile.am: Updated to reflect files merged into newlib. This resulted in some definitions moving to other files and thus some secondary effects in RTEMS source code.
  • include/unistd.h: Removed. Now use newlib's.
  • include/rtems/posix/mqueue.h: Add include of <signal.h>.
  • include/rtems/posix/threadsup.h: Add include of <sys/signal.h>
  • src/execv.c: Corrected prototype to agree with newlib.
  • src/execve.c: Corrected prototype to agree with newlib.
  • src/execvp.c: Corrected prototype to agree with newlib.
  • src/psignal.c: Rewrote reference to <siginfo.h> in comment since that file no longer exists.
  • src/pthreadkill.c: Added include of <signal.h>.
  • src/sigaction.c: Added include of <signal.h>.
  • src/sigtimedwait.c: Rewrote reference to <siginfo.h> in comment since that file no longer exists. *
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  3.3.10 Send a Signal to a Thread, P1003.1c/D10, p. 43
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
15#include <pthread.h>
16#include <signal.h>
17#include <errno.h>
18
19#include <rtems/system.h>
20#include <rtems/posix/pthread.h>
21#include <rtems/posix/psignal.h>
22#include <rtems/score/isr.h>
23#include <rtems/seterr.h>
24
25int pthread_kill(
26  pthread_t   thread,
27  int         sig
28)
29{
30  POSIX_API_Control  *api;
31  Thread_Control     *the_thread;
32  Objects_Locations  location;
33
34  if ( sig && !is_valid_signo(sig) )
35    set_errno_and_return_minus_one( EINVAL );
36
37/* commented out when posix timers added
38  if ( _POSIX_signals_Vectors[ sig ].sa_flags == SA_SIGINFO )
39    set_errno_and_return_minus_one( ENOSYS );
40*/
41
42  the_thread = _POSIX_Threads_Get( thread, &location );
43  switch ( location ) {
44    case OBJECTS_ERROR:
45    case OBJECTS_REMOTE:
46      set_errno_and_return_minus_one( ESRCH );
47    case OBJECTS_LOCAL:
48      /*
49       *  If sig == 0 then just validate arguments
50       */
51
52      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
53
54      if ( sig ) {
55
56        if ( _POSIX_signals_Vectors[ sig ].sa_handler == SIG_IGN ) {
57          _Thread_Enable_dispatch();
58          return 0;
59        }
60
61        /* XXX critical section */
62
63        api->signals_pending |= signo_to_mask( sig );
64
65        (void) _POSIX_signals_Unblock_thread( the_thread, sig, NULL );
66
67        the_thread->do_post_task_switch_extension = TRUE;
68
69        if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
70          _ISR_Signals_to_thread_executing = TRUE;
71      }
72      _Thread_Enable_dispatch();
73      return 0;
74  }
75
76  return POSIX_BOTTOM_REACHED();
77}
Note: See TracBrowser for help on using the repository browser.