posix: Add and use <rtems/posix/psignalimpl.h>

This file contains the parts of <rtems/posix/psignal.h> that are only
necessary for the POSIX API implementation.
This commit is contained in:
Sebastian Huber
2012-12-03 11:35:43 +01:00
parent ba31631317
commit f9340ed7f4
31 changed files with 148 additions and 134 deletions

View File

@@ -34,6 +34,7 @@ include_rtems_posix_HEADERS += include/rtems/posix/mutex.h
include_rtems_posix_HEADERS += include/rtems/posix/posixapi.h
include_rtems_posix_HEADERS += include/rtems/posix/priority.h
include_rtems_posix_HEADERS += include/rtems/posix/psignal.h
include_rtems_posix_HEADERS += include/rtems/posix/psignalimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/pthread.h
include_rtems_posix_HEADERS += include/rtems/posix/ptimer.h
include_rtems_posix_HEADERS += include/rtems/posix/semaphore.h

View File

@@ -16,44 +16,9 @@
#ifndef _RTEMS_POSIX_PSIGNAL_H
#define _RTEMS_POSIX_PSIGNAL_H
#include <rtems/posix/pthread.h>
#include <rtems/posix/sigset.h>
#include <sys/signal.h>
#define _States_Is_interruptible_signal( _states ) \
( ((_states) & \
(STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) == \
(STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL))
#define SIGACTION_TERMINATE \
{ 0, SIGNAL_ALL_MASK, {_POSIX_signals_Abnormal_termination_handler} }
#define SIGACTION_IGNORE \
{ 0, SIGNAL_ALL_MASK, {SIG_IGN} }
#define SIGACTION_STOP \
{ 0, SIGNAL_ALL_MASK, {_POSIX_signals_Stop_handler} }
#define SIGACTION_CONTINUE \
{ 0, SIGNAL_ALL_MASK, {_POSIX_signals_Continue_handler} }
#define SIG_ARRAY_MAX (SIGRTMAX + 1)
/*
* Variables
*/
extern sigset_t _POSIX_signals_Pending;
extern const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ];
extern struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ];
extern Watchdog_Control _POSIX_signals_Alarm_timer;
extern Watchdog_Control _POSIX_signals_Ualarm_timer;
extern Thread_queue_Control _POSIX_signals_Wait_queue;
extern Chain_Control _POSIX_signals_Inactive_siginfo;
extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ];
#include <rtems/score/chain.h>
/*
* POSIX internal siginfo structure
@@ -64,58 +29,5 @@ typedef struct {
siginfo_t Info;
} POSIX_signals_Siginfo_node;
/*
* Internal routines
*/
void _POSIX_signals_Manager_Initialization(void);
void _POSIX_signals_Post_switch_extension(
Thread_Control *the_thread
);
bool _POSIX_signals_Unblock_thread(
Thread_Control *the_thread,
int signo,
siginfo_t *info
);
bool _POSIX_signals_Check_signal(
POSIX_API_Control *api,
int signo,
bool is_global
);
bool _POSIX_signals_Clear_signals(
POSIX_API_Control *api,
int signo,
siginfo_t *info,
bool is_global,
bool check_blocked
);
int killinfo(
pid_t pid,
int sig,
const union sigval *value
);
void _POSIX_signals_Set_process_signals(
sigset_t mask
);
void _POSIX_signals_Clear_process_signals(
int signo
);
/*
* Default signal handlers
*/
#define _POSIX_signals_Stop_handler NULL
#define _POSIX_signals_Continue_handler NULL
void _POSIX_signals_Abnormal_termination_handler( int signo );
#endif
/* end of file */

View File

@@ -0,0 +1,113 @@
/**
* @file rtems/posix/psignal.h
*
* This include file defines internal information about POSIX signals.
*/
/*
* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifndef _RTEMS_POSIX_PSIGNALIMPL_H
#define _RTEMS_POSIX_PSIGNALIMPL_H
#include <rtems/posix/psignal.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/sigset.h>
#define _States_Is_interruptible_signal( _states ) \
( ((_states) & \
(STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) == \
(STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL))
#define SIGACTION_TERMINATE \
{ 0, SIGNAL_ALL_MASK, {_POSIX_signals_Abnormal_termination_handler} }
#define SIGACTION_IGNORE \
{ 0, SIGNAL_ALL_MASK, {SIG_IGN} }
#define SIGACTION_STOP \
{ 0, SIGNAL_ALL_MASK, {_POSIX_signals_Stop_handler} }
#define SIGACTION_CONTINUE \
{ 0, SIGNAL_ALL_MASK, {_POSIX_signals_Continue_handler} }
#define SIG_ARRAY_MAX (SIGRTMAX + 1)
/*
* Variables
*/
extern sigset_t _POSIX_signals_Pending;
extern const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ];
extern struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ];
extern Watchdog_Control _POSIX_signals_Alarm_timer;
extern Watchdog_Control _POSIX_signals_Ualarm_timer;
extern Thread_queue_Control _POSIX_signals_Wait_queue;
extern Chain_Control _POSIX_signals_Inactive_siginfo;
extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ];
/*
* Internal routines
*/
void _POSIX_signals_Manager_Initialization(void);
void _POSIX_signals_Post_switch_extension(
Thread_Control *the_thread
);
bool _POSIX_signals_Unblock_thread(
Thread_Control *the_thread,
int signo,
siginfo_t *info
);
bool _POSIX_signals_Check_signal(
POSIX_API_Control *api,
int signo,
bool is_global
);
bool _POSIX_signals_Clear_signals(
POSIX_API_Control *api,
int signo,
siginfo_t *info,
bool is_global,
bool check_blocked
);
int killinfo(
pid_t pid,
int sig,
const union sigval *value
);
void _POSIX_signals_Set_process_signals(
sigset_t mask
);
void _POSIX_signals_Clear_process_signals(
int signo
);
/*
* Default signal handlers
*/
#define _POSIX_signals_Stop_handler NULL
#define _POSIX_signals_Continue_handler NULL
void _POSIX_signals_Abnormal_termination_handler( int signo );
#endif
/* end of file */

View File

@@ -80,6 +80,10 @@ $(PROJECT_INCLUDE)/rtems/posix/psignal.h: include/rtems/posix/psignal.h $(PROJEC
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/psignal.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/psignal.h
$(PROJECT_INCLUDE)/rtems/posix/psignalimpl.h: include/rtems/posix/psignalimpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/psignalimpl.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/psignalimpl.h
$(PROJECT_INCLUDE)/rtems/posix/pthread.h: include/rtems/posix/pthread.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/pthread.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/pthread.h

View File

@@ -18,7 +18,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
/*
* _POSIX_signals_Alarm_TSR

View File

@@ -18,7 +18,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
int kill(
pid_t pid,

View File

@@ -18,7 +18,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#if defined(RTEMS_NEWLIB)

View File

@@ -19,7 +19,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/seterr.h>
#include <rtems/score/isr.h>

View File

@@ -13,13 +13,9 @@
#include "config.h"
#endif
#include <pthread.h>
#include <stddef.h>
#include <signal.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <unistd.h>
/*
* 3.4.2 Suspend Process Execution, P1003.1b-1993, p. 81

View File

@@ -28,7 +28,7 @@
#include <rtems/score/wkspace.h>
#include <rtems/seterr.h>
#include <rtems/posix/threadsup.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/time.h>
#include <stdio.h>

View File

@@ -26,7 +26,7 @@
#include <rtems/score/wkspace.h>
#include <rtems/seterr.h>
#include <rtems/posix/threadsup.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/time.h>
#include <stdio.h>

View File

@@ -22,7 +22,7 @@
#include <rtems/score/wkspace.h>
#include <rtems/seterr.h>
#include <rtems/posix/threadsup.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/time.h>
#include <stdio.h>

View File

@@ -22,7 +22,7 @@
#include <rtems/score/wkspace.h>
#include <rtems/seterr.h>
#include <rtems/posix/threadsup.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/time.h>
#include <stdio.h>

View File

@@ -22,7 +22,7 @@
#include <rtems/score/wkspace.h>
#include <rtems/seterr.h>
#include <rtems/posix/threadsup.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/time.h>
#include <stdio.h>

View File

@@ -22,7 +22,7 @@
#include <rtems/score/wkspace.h>
#include <rtems/seterr.h>
#include <rtems/posix/threadsup.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/time.h>
#include <stdio.h>

View File

@@ -25,7 +25,7 @@
#include <rtems/posix/cancel.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/priority.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/config.h>
#include <rtems/posix/key.h>
#include <rtems/posix/time.h>

View File

@@ -24,7 +24,6 @@
#include <rtems/posix/cancel.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/priority.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/config.h>
#include <rtems/posix/key.h>
#include <rtems/posix/time.h>

View File

@@ -19,7 +19,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/score/isr.h>
#include <rtems/seterr.h>

View File

@@ -21,7 +21,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/seterr.h>
int pthread_sigmask(

View File

@@ -32,7 +32,6 @@
#include <rtems/rtems/types.h>
#include <rtems/rtems/timer.h>
#include <rtems/rtems/clock.h>
#include <rtems/posix/psignal.h>
#include <rtems/score/wkspace.h>
#include <pthread.h>
#include <stdio.h>

View File

@@ -19,7 +19,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/seterr.h>
#include <rtems/score/isr.h>

View File

@@ -18,7 +18,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/seterr.h>
int sigpending(

View File

@@ -18,7 +18,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
int sigqueue(
pid_t pid,

View File

@@ -13,13 +13,11 @@
#include "config.h"
#endif
#include <stddef.h>
#include <assert.h>
#include <signal.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/seterr.h>
int sigsuspend(
@@ -29,9 +27,6 @@ int sigsuspend(
sigset_t saved_signals_blocked;
sigset_t current_unblocked_signals;
int status;
POSIX_API_Control *api;
api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
/*
* We use SIG_BLOCK and not SIG_SETMASK because there may be

View File

@@ -19,7 +19,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/seterr.h>
#include <rtems/posix/time.h>
#include <rtems/score/isr.h>

View File

@@ -15,14 +15,10 @@
#include "config.h"
#endif
#include <pthread.h>
#include <stddef.h>
#include <signal.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
int sigwait(
const sigset_t *set,
int *sig

View File

@@ -15,12 +15,8 @@
#include "config.h"
#endif
#include <stddef.h>
#include <signal.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
int sigwaitinfo(
const sigset_t *set,

View File

@@ -20,7 +20,7 @@
#include <rtems/system.h>
#include <rtems/seterr.h>
#include <rtems/score/thread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/sigset.h>
#include <rtems/posix/time.h>
#include <rtems/posix/timer.h>

View File

@@ -18,7 +18,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/time.h>
/*

View File

@@ -1651,6 +1651,7 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
#include <rtems/posix/mutex.h>
#include <rtems/posix/key.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/rwlock.h>
#include <rtems/posix/semaphore.h>
#include <rtems/posix/spinlock.h>

View File

@@ -11,6 +11,8 @@
#include "config.h"
#endif
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
#define TEST_NAME "05"
#define TEST_STRING "User Signals"
#define SIGNAL_ONE SIGUSR1
@@ -20,7 +22,7 @@
#include <signal.h>
#include <errno.h>
#include <errno.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/psignalimpl.h>
/* forward declarations to avoid warnings */
void *POSIX_Init(void *argument);