]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libphobos/libdruntime/core/sys/posix/sys/wait.d
libphobos: Merge upstream druntime 94686651
[thirdparty/gcc.git] / libphobos / libdruntime / core / sys / posix / sys / wait.d
index 123dd1429509cb65a3bc30c8c470be8e42da7855..af54450b07f6e85b879a0fe05e57c880d4cc28c0 100644 (file)
@@ -144,6 +144,29 @@ else version (NetBSD)
     extern (D) int  WSTOPSIG( int status )     { return status >> 8;                     }
     extern (D) int  WTERMSIG( int status )     { return _WSTATUS( status );              }
 }
+else version (OpenBSD)
+{
+    enum WNOHANG        = 1;
+    enum WUNTRACED      = 2;
+
+    private
+    {
+        enum _WSTOPPED   = 0x7F;   // octal 0177
+        enum _WCONTINUED = 0xFFFF; // octal 0177777
+    }
+
+    extern (D) int _WSTATUS(int status)         { return (status & 0x7F);                     }
+    extern (D) int  WEXITSTATUS(int status)   { return (status >> 8) & 0xFF;                  }
+    extern (D) int  WIFCONTINUED(int status)  { return (status & _WCONTINUED) == _WCONTINUED; }
+    extern (D) bool WIFEXITED(int status)     { return _WSTATUS(status) == 0;                 }
+    extern (D) bool WIFSIGNALED(int status)
+    {
+        return _WSTATUS(status) != _WSTOPPED && _WSTATUS(status) != 0;
+    }
+    extern (D) bool WIFSTOPPED(int status)   { return (status & 0xFF) == _WSTOPPED; }
+    extern (D) int  WSTOPSIG(int status)     { return (status >> 8) & 0xFF;         }
+    extern (D) int  WTERMSIG(int status)     { return _WSTATUS(status);             }
+}
 else version (DragonFlyBSD)
 {
     enum WNOHANG        = 1;
@@ -312,6 +335,13 @@ else version (NetBSD)
     //enum WCONTINUED     = 4;
     enum WNOWAIT        = 0x00010000;
 }
+else version (OpenBSD)
+{
+    enum WCONTINUED     = 8;
+    // OpenBSD does not define the following:
+    //enum WSTOPPED
+    //enum WNOWAIT
+}
 else version (DragonFlyBSD)
 {
     enum WSTOPPED       = WUNTRACED;