mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-29 13:03:38 +01:00
cd7fe7a329
This version of signal (which does not rely on a notion of userland processes and is thus excluded from Vhex) follows C99 semantics but does not generate any signals by default. Basically, the signal function sets up function pointers and the signal function calls them. Termination signals call exit() while other signals call _Exit(), which is a quicker program termination similar to abort(). C99 allows programs to long jump out of signal handlers (!) which is unbelievably scary because it would bypass stack switching code in Vhex as well as normal interrupt handler termination in gint.
51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
#ifndef __SIGNAL_H__
|
|
# define __SIGNAL_H__
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdatomic.h>
|
|
|
|
/* C99 API. */
|
|
|
|
typedef volatile atomic_int sig_atomic_t;
|
|
|
|
/* Type of a signal handler.*/
|
|
typedef void (*__sighandler_t)(int);
|
|
|
|
#include <bits/signum.h>
|
|
|
|
/* Set the handler for __signum. */
|
|
extern __sighandler_t signal(int __signum, __sighandler_t __handler);
|
|
|
|
/* Raise signal __signum. */
|
|
extern int raise(int __signum);
|
|
|
|
/* POSIX API (Vhex only). */
|
|
|
|
#ifdef _POSIX_C_SOURCE
|
|
|
|
/* Type of signal set */
|
|
typedef uint32_t sigset_t;
|
|
typedef uint32_t kernel_sigset_t;
|
|
|
|
/*
|
|
** Get the system-specific definitions of `struct sigaction' and the `SA_*'
|
|
** and `SIG_*'. constants.
|
|
*/
|
|
#include <bits/sigaction.h>
|
|
#include <sys/types.h>
|
|
|
|
/* Get and/or change the set of blocked signals. */
|
|
extern int sigprocmask (int __how, const sigset_t *restrict __set,
|
|
sigset_t *restrict __oldset);
|
|
|
|
/*
|
|
** Send signal SIG to process number PID. If PID is zero, send SIG to all
|
|
** processes in the current process's process group. If PID is < -1, send SIG to
|
|
** all processes in process group - PID.
|
|
*/
|
|
extern int kill(pid_t __pid, int __sig);
|
|
|
|
#endif /*_POSIX_C_SOURCE*/
|
|
|
|
#endif /*__SIGNAL_H__*/
|