1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:37:35 +00:00

Kernel+LibC: Add sys$waitid(), and make sys$waitpid() wrap it

sys$waitid() takes an explicit description of whether it's waiting for a single
process with the given PID, all of the children, a group, etc., and returns its
info as a siginfo_t.

It also doesn't automatically imply WEXITED, which clears up the confusion in
the kernel.
This commit is contained in:
Sergey Bugaev 2020-02-05 19:42:43 +03:00 committed by Andreas Kling
parent a6cb7f759e
commit b3a24d732d
5 changed files with 140 additions and 55 deletions

View file

@ -26,6 +26,7 @@
#pragma once
#include <signal.h>
#include <sys/cdefs.h>
#include <sys/types.h>
@ -35,7 +36,7 @@ __BEGIN_DECLS
#define WSTOPSIG(status) WEXITSTATUS(status)
#define WTERMSIG(status) ((status)&0x7f)
#define WIFEXITED(status) (WTERMSIG(status) == 0)
#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
#define WIFSTOPPED(status) (((status)&0xff) == 0x7f)
#define WIFSIGNALED(status) (((char)(((status)&0x7f) + 1) >> 1) > 0)
#define WNOHANG 1
@ -52,5 +53,6 @@ typedef enum {
pid_t waitpid(pid_t, int* wstatus, int options);
pid_t wait(int* wstatus);
int waitid(idtype_t idtype, id_t id, siginfo_t* infop, int options);
__END_DECLS