crabc 0.7.8

A Rust musl-compatible libc with a dynamic linker
/* Copyright (c) 2026 Meng Zhuo */
/* SPDX-License-Identifier: BSD-3-Clause */

#ifndef _SYS_WAIT_H
#define _SYS_WAIT_H

#include <features.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <signal.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef WNOHANG
#define WNOHANG   1
#define WUNTRACED 2
#define WSTOPPED  2
#define WEXITED   4
#define WCONTINUED 8
#define WNOWAIT   0x1000000
#endif

#ifndef WEXITSTATUS
#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
#define WTERMSIG(s)    ((s) & 0x7f)
#define WSTOPSIG(s)    WEXITSTATUS(s)
#define WIFEXITED(s)   (!WTERMSIG(s))
#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
#define WIFSTOPPED(s)  ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
#define WIFCONTINUED(s) ((s) == 0xffff)
#endif

typedef enum {
    P_ALL = 0,
    P_PID = 1,
    P_PGID = 2,
    P_PIDFD = 3,
} idtype_t;

pid_t wait(int *);
pid_t waitpid(pid_t, int *, int);
int waitid(idtype_t, id_t, siginfo_t *, int);

#ifdef __cplusplus
}
#endif


/* musl 1.2.6 compatibility macros */
#define __WALL 0x40000000
#define __WCLONE 0x80000000
#define __WNOTHREAD 0x20000000

/* musl 1.2.6 per-header compatibility macros */
#define WCOREDUMP(s) ((s) & 0x80)
#endif