|
AquilaOS documentation
How it works, and its code
|
System calls about signals, timers and the time: kill(), sigaction(), the signal mask, sigsuspend() and sigreturn(), setitimer(), nanosleep(), and the clocks. More...
#include "syscalls.h"Go to the source code of this file.
Functions | |
| long | sys_kill (pid_t pid, int sig) |
| Implements kill(): sends a signal to a process or a process group. | |
| long | sys_sigaction (int sig, const struct aquila_sigaction *act, struct aquila_sigaction *oact) |
| Implements sigaction(): reads a signal's action, and sets a new one. | |
| long | sys_gettimeofday (struct timeval *tv, struct timezone *tz) |
| Implements gettimeofday(): the time of day. | |
| long | sys_sigmask (int how, const sigset_t *set, sigset_t *oldset) |
| Implements sigprocmask(): reads and changes the process's signal mask. | |
| long | sys_sigsuspend (const sigset_t *set) |
| Implements sigsuspend(): replaces the signal mask and waits for a signal. | |
| long | sys_sigreturn (void) |
| Implements sigreturn(): a signal handler returns, and the registers and signal mask that its frame saved are restored. | |
| long | sys_setitimer (int which, const struct aquila_itimer *new, struct aquila_itimer *old) |
| Implements setitimer(): sets the real time timer, which sends SIGALRM, and reads the old one. | |
| long | sys_nanosleep (const struct aquila_timespec *req, struct aquila_timespec *rem) |
| Implements nanosleep(): sleeps for a time. | |
| long | sys_clock_gettime (int clock, struct aquila_timespec *ts) |
| Implements clock_gettime(): reads a clock. | |
System calls about signals, timers and the time: kill(), sigaction(), the signal mask, sigsuspend() and sigreturn(), setitimer(), nanosleep(), and the clocks.
Definition in file sys_signal.c.
| long sys_clock_gettime | ( | int | clock, |
| struct aquila_timespec * | ts ) |
Implements clock_gettime(): reads a clock.
| clock | CLOCK_REALTIME or CLOCK_MONOTONIC |
| ts | where to put the time |
Definition at line 293 of file sys_signal.c.
References arch_rtime_ns(), clock, gettime(), LOG_DEBUG, sys_clock_gettime(), timespec::tv_nsec, and timespec::tv_sec.
Referenced by sys_clock_gettime().
Implements gettimeofday(): the time of day.
| tv | where to put the time, or NULL |
| tz | where to put the time zone, or NULL |
Definition at line 85 of file sys_signal.c.
References gettimeofday(), LOG_DEBUG, and sys_gettimeofday().
Referenced by sys_gettimeofday().
| long sys_kill | ( | pid_t | pid, |
| int | sig ) |
Implements kill(): sends a signal to a process or a process group.
| pid | whom to: a process if > 0, the caller's process group if 0, every process but init and the caller if -1, or process group -pid if < -1 |
| sig | the signal, or 0 to only check that the target exists |
Definition at line 19 of file sys_signal.c.
References LOG_DEBUG, signal_send(), and sys_kill().
Referenced by sys_kill().
| long sys_nanosleep | ( | const struct aquila_timespec * | req, |
| struct aquila_timespec * | rem ) |
Implements nanosleep(): sleeps for a time.
A stop doesn't change the deadline: the call is restarted until the same time.
| req | how long to sleep |
| rem | where to put the time left if a signal ends the sleep, or NULL |
Definition at line 242 of file sys_signal.c.
References arch_rtime_ns(), curthread, ERESTARTNOHAND, LOG_DEBUG, sched_sleep(), and sys_nanosleep().
Referenced by sys_nanosleep().
| long sys_setitimer | ( | int | which, |
| const struct aquila_itimer * | new, | ||
| struct aquila_itimer * | old ) |
Implements setitimer(): sets the real time timer, which sends SIGALRM, and reads the old one.
| which | AQUILA_ITIMER_REAL (the only timer supported) |
| new | the new timer, or NULL to only read the old one |
| old | where to put the old timer, or NULL |
Definition at line 201 of file sys_signal.c.
References curproc, LOG_DEBUG, sched_alarm(), sched_alarm_get(), and sys_setitimer().
Referenced by sys_setitimer().
| long sys_sigaction | ( | int | sig, |
| const struct aquila_sigaction * | act, | ||
| struct aquila_sigaction * | oact ) |
Implements sigaction(): reads a signal's action, and sets a new one.
| sig | the signal |
| act | the new action, or NULL to leave it |
| oact | where to put the old action, or NULL |
Definition at line 37 of file sys_signal.c.
References curproc, LOG_DEBUG, SIG_DFL, SIG_IGN, SIG_MAX, signal_action_set(), sys_sigaction(), and uaccess_check().
Referenced by sys_sigaction().
Implements sigprocmask(): reads and changes the process's signal mask.
SIGKILL and SIGSTOP can't be blocked.
| how | SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK |
| set | the signals, or NULL to leave the mask |
| oldset | where to put the old mask, or NULL |
Definition at line 108 of file sys_signal.c.
References curproc, LOG_DEBUG, SIG_UNMASKABLE, and sys_sigmask().
Referenced by sys_sigmask().
| long sys_sigreturn | ( | void | ) |
Implements sigreturn(): a signal handler returns, and the registers and signal mask that its frame saved are restored.
The kernel's signal code page calls it when a handler returns.
Definition at line 182 of file sys_signal.c.
References arch_sigreturn(), LOG_DEBUG, and sys_sigreturn().
Referenced by sys_sigreturn().
| long sys_sigsuspend | ( | const sigset_t * | set | ) |
Implements sigsuspend(): replaces the signal mask and waits for a signal.
The old mask comes back once a handler has run.
| set | the mask to wait with |
Definition at line 146 of file sys_signal.c.
References curproc, curthread, ERESTARTNOHAND, LOG_DEBUG, thread::sig_oldmask, thread::sig_oldmask_set, SIG_UNMASKABLE, sys_sigsuspend(), and waitq_sleep().
Referenced by sys_sigsuspend().