Kernel+LibC: Add some Unix signal types & definitions

This commit is contained in:
Sergey Bugaev 2020-02-05 19:41:52 +03:00 committed by Andreas Kling
parent aafa5a9d09
commit a6cb7f759e
Notes: sideshowbarker 2024-07-19 09:39:16 +09:00
4 changed files with 58 additions and 2 deletions

View file

@ -274,7 +274,21 @@ typedef void (*__sighandler_t)(int);
typedef __sighandler_t sighandler_t;
typedef u32 sigset_t;
typedef void siginfo_t;
union sigval {
int sival_int;
void* sival_ptr;
};
typedef struct siginfo {
int si_signo;
int si_code;
pid_t si_pid;
uid_t si_uid;
void* si_addr;
int si_status;
union sigval si_value;
} siginfo_t;
struct sigaction {
union {
@ -294,6 +308,13 @@ struct sigaction {
#define SIG_UNBLOCK 1
#define SIG_SETMASK 2
#define CLD_EXITED 0
#define CLD_KILLED 1
#define CLD_DUMPED 2
#define CLD_TRAPPED 3
#define CLD_STOPPED 4
#define CLD_CONTINUED 5
#define OFF_T_MAX 2147483647
typedef i32 off_t;
@ -432,6 +453,12 @@ struct timespec {
long tv_nsec;
};
typedef enum {
P_ALL = 1,
P_PID,
P_PGID
} idtype_t;
typedef int clockid_t;
#define CLOCK_MONOTONIC 1

View file

@ -35,9 +35,23 @@ typedef void (*__sighandler_t)(int);
typedef __sighandler_t sighandler_t;
typedef uint32_t sigset_t;
typedef void siginfo_t;
typedef uint32_t sig_atomic_t;
union sigval {
int sival_int;
void* sival_ptr;
};
typedef struct siginfo {
int si_signo;
int si_code;
pid_t si_pid;
uid_t si_uid;
void* si_addr;
int si_status;
union sigval si_value;
} siginfo_t;
struct sigaction {
union {
void (*sa_handler)(int);
@ -82,4 +96,11 @@ extern const char* sys_siglist[NSIG];
#define SIG_UNBLOCK 1
#define SIG_SETMASK 2
#define CLD_EXITED 0
#define CLD_KILLED 1
#define CLD_DUMPED 2
#define CLD_TRAPPED 3
#define CLD_STOPPED 4
#define CLD_CONTINUED 5
__END_DECLS

View file

@ -43,6 +43,8 @@ typedef uint32_t gid_t;
typedef int __pid_t;
#define pid_t __pid_t
typedef int id_t;
typedef int __ssize_t;
#define ssize_t __ssize_t

View file

@ -44,6 +44,12 @@ __BEGIN_DECLS
#define WEXITED 4
#define WCONTINUED 8
typedef enum {
P_ALL = 1,
P_PID,
P_PGID
} idtype_t;
pid_t waitpid(pid_t, int* wstatus, int options);
pid_t wait(int* wstatus);