/contrib/cvs/lib/wait.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 42 lines · 28 code · 2 blank · 12 comment · 6 complexity · 0ce6f7dacd43a296c8fbfde9f491da9e MD5 · raw file

  1. /* wait.h -- POSIX macros for evaluating exit statuses
  2. Copyright (C) 1990 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details. */
  11. #ifdef HAVE_SYS_WAIT_H
  12. #include <sys/types.h> /* For pid_t. */
  13. #ifdef HAVE_SYS_RESOURCE_H
  14. #include <sys/resource.h> /* for rusage */
  15. #endif
  16. #include <sys/wait.h>
  17. #endif
  18. #ifndef WIFSTOPPED
  19. #define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
  20. #endif
  21. #ifndef WIFSIGNALED
  22. #define WIFSIGNALED(w) (((w) & 0xff) != 0x7f && ((w) & 0xff) != 0)
  23. #endif
  24. #ifndef WIFEXITED
  25. #define WIFEXITED(w) (((w) & 0xff) == 0)
  26. #endif
  27. #ifndef WCOREDUMP /* not POSIX, but common and useful */
  28. #define WCOREDUMP(w) (((w) & 0x80) != 0)
  29. #endif
  30. #ifndef WSTOPSIG
  31. #define WSTOPSIG(w) (((w) >> 8) & 0xff)
  32. #endif
  33. #ifndef WTERMSIG
  34. #define WTERMSIG(w) ((w) & 0x7f)
  35. #endif
  36. #ifndef WEXITSTATUS
  37. #define WEXITSTATUS(w) (((w) >> 8) & 0xff)
  38. #endif