wait.h 878 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <signal.h>
  8. #include <sys/cdefs.h>
  9. #include <sys/types.h>
  10. __BEGIN_DECLS
  11. #define WEXITSTATUS(status) (((status)&0xff00) >> 8)
  12. #define WSTOPSIG(status) WEXITSTATUS(status)
  13. #define WTERMSIG(status) ((status)&0x7f)
  14. #define WIFEXITED(status) (WTERMSIG(status) == 0)
  15. #define WIFSTOPPED(status) (((status)&0xff) == 0x7f)
  16. #define WIFSIGNALED(status) (((char)(((status)&0x7f) + 1) >> 1) > 0)
  17. #define WNOHANG 1
  18. #define WUNTRACED 2
  19. #define WSTOPPED WUNTRACED
  20. #define WEXITED 4
  21. #define WCONTINUED 8
  22. #define WNOWAIT 0x1000000
  23. typedef enum {
  24. P_ALL = 1,
  25. P_PID,
  26. P_PGID
  27. } idtype_t;
  28. pid_t waitpid(pid_t, int* wstatus, int options);
  29. pid_t wait(int* wstatus);
  30. int waitid(idtype_t idtype, id_t id, siginfo_t* infop, int options);
  31. __END_DECLS