Mercurial > projects > ldc
comparison druntime/import/stdc/posix/sys/wait.d @ 760:6f33b427bfd1
Seems like hg ignores .di files, so I missed a bunch of stuff. complete druntime should be there now :)
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 12 Nov 2008 00:19:18 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
759:d3eb054172f9 | 760:6f33b427bfd1 |
---|---|
1 /** | |
2 * D header file for POSIX. | |
3 * | |
4 * Copyright: Public Domain | |
5 * License: Public Domain | |
6 * Authors: Sean Kelly | |
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition | |
8 */ | |
9 module stdc.posix.sys.wait; | |
10 | |
11 private import stdc.posix.config; | |
12 public import stdc.posix.sys.types; // for id_t, pid_t | |
13 public import stdc.posix.signal; // for siginfo_t (XSI) | |
14 //public import stdc.posix.resource; // for rusage (XSI) | |
15 | |
16 extern (C): | |
17 | |
18 // | |
19 // Required | |
20 // | |
21 /* | |
22 WNOHANG | |
23 WUNTRACED | |
24 | |
25 WEXITSTATUS | |
26 WIFCONTINUED | |
27 WIFEXITED | |
28 WIFSIGNALED | |
29 WIFSTOPPED | |
30 WSTOPSIG | |
31 WTERMSIG | |
32 | |
33 pid_t wait(int*); | |
34 pid_t waitpid(pid_t, int*, int); | |
35 */ | |
36 | |
37 version( linux ) | |
38 { | |
39 const WNOHANG = 1; | |
40 const WUNTRACED = 2; | |
41 | |
42 private | |
43 { | |
44 const __W_CONTINUED = 0xFFFF; | |
45 | |
46 extern (D) int __WTERMSIG( int status ) { return status & 0x7F; } | |
47 } | |
48 | |
49 // | |
50 // NOTE: These macros assume __USE_BSD is not defined in the relevant | |
51 // C headers as the parameter definition there is different and | |
52 // much more complicated. | |
53 // | |
54 extern (D) int WEXITSTATUS( int status ) { return ( status & 0xFF00 ) >> 8; } | |
55 extern (D) int WIFCONTINUED( int status ) { return status == __W_CONTINUED; } | |
56 extern (D) bool WIFEXITED( int status ) { return __WTERMSIG( status ) == 0; } | |
57 extern (D) bool WIFSIGNALED( int status ) | |
58 { | |
59 return ( cast(byte) ( ( status & 0x7F ) + 1 ) >> 1 ) > 0; | |
60 } | |
61 extern (D) bool WIFSTOPPED( int status ) { return ( status & 0xFF ) == 0x7F; } | |
62 extern (D) int WSTOPSIG( int status ) { return WEXITSTATUS( status ); } | |
63 extern (D) int WTERMSIG( int status ) { return status & 0x7F; } | |
64 } | |
65 else version( darwin ) | |
66 { | |
67 const WNOHANG = 1; | |
68 const WUNTRACED = 2; | |
69 | |
70 private | |
71 { | |
72 const _WSTOPPED = 0177; | |
73 } | |
74 | |
75 extern (D) int _WSTATUS(int status) { return (status & 0177); } | |
76 extern (D) int WEXITSTATUS( int status ) { return (status >> 8); } | |
77 extern (D) int WIFCONTINUED( int status ) { return status == 0x13; } | |
78 extern (D) bool WIFEXITED( int status ) { return _WSTATUS(status) == 0; } | |
79 extern (D) bool WIFSIGNALED( int status ) | |
80 { | |
81 return _WSTATUS( status ) != _WSTOPPED && _WSTATUS( status ) != 0; | |
82 } | |
83 extern (D) bool WIFSTOPPED( int status ) { return _WSTATUS( status ) == _WSTOPPED; } | |
84 extern (D) int WSTOPSIG( int status ) { return status >> 8; } | |
85 extern (D) int WTERMSIG( int status ) { return _WSTATUS( status ); } | |
86 } | |
87 else version( freebsd ) | |
88 { | |
89 const WNOHANG = 1; | |
90 const WUNTRACED = 2; | |
91 const WCONTINUED = 4; | |
92 | |
93 private | |
94 { | |
95 const _WSTOPPED = 0177; | |
96 } | |
97 | |
98 extern (D) int _WSTATUS(int status) { return (status & 0177); } | |
99 extern (D) int WEXITSTATUS( int status ) { return (status >> 8); } | |
100 extern (D) int WIFCONTINUED( int status ) { return status == 0x13; } | |
101 extern (D) bool WIFEXITED( int status ) { return _WSTATUS(status) == 0; } | |
102 extern (D) bool WIFSIGNALED( int status ) | |
103 { | |
104 return _WSTATUS( status ) != _WSTOPPED && _WSTATUS( status ) != 0; | |
105 } | |
106 extern (D) bool WIFSTOPPED( int status ) { return _WSTATUS( status ) == _WSTOPPED; } | |
107 extern (D) int WSTOPSIG( int status ) { return status >> 8; } | |
108 extern (D) int WTERMSIG( int status ) { return _WSTATUS( status ); } | |
109 } | |
110 else | |
111 { | |
112 static assert( false ); | |
113 } | |
114 | |
115 pid_t wait(int*); | |
116 pid_t waitpid(pid_t, int*, int); | |
117 | |
118 // | |
119 // XOpen (XSI) | |
120 // | |
121 /* | |
122 WEXITED | |
123 WSTOPPED | |
124 WCONTINUED | |
125 WNOHANG | |
126 WNOWAIT | |
127 | |
128 enum idtype_t | |
129 { | |
130 P_ALL, | |
131 P_PID, | |
132 P_PGID | |
133 } | |
134 | |
135 int waitid(idtype_t, id_t, siginfo_t*, int); | |
136 */ |