1 /**
2  * D header file for POSIX.
3  *
4  * Copyright: Copyright Sean Kelly 2005 - 2009.
5  * License:   $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
6  * Authors:   Sean Kelly
7  * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
8  */
9 
10 /*          Copyright Sean Kelly 2005 - 2009.
11  * Distributed under the Boost Software License, Version 1.0.
12  *    (See accompanying file LICENSE or copy at
13  *          http://www.boost.org/LICENSE_1_0.txt)
14  */
15 module core.sys.posix.stdlib;
16 
17 import core.sys.posix.config;
18 public import core.stdc.stdlib;
19 public import core.sys.posix.sys.wait;
20 
21 version (OSX)
22     version = Darwin;
23 else version (iOS)
24     version = Darwin;
25 else version (TVOS)
26     version = Darwin;
27 else version (WatchOS)
28     version = Darwin;
29 
30 version (Posix):
31 extern (C):
32 nothrow:
33 @nogc:
34 
35 //
36 // Required (defined in core.stdc.stdlib)
37 //
38 /*
39 EXIT_FAILURE
40 EXIT_SUCCESS
41 NULL
42 RAND_MAX
43 MB_CUR_MAX
44 div_t
45 ldiv_t
46 lldiv_t
47 size_t
48 wchar_t
49 
50 void    _Exit(int);
51 void    abort();
52 int     abs(int);
53 int     atexit(void function());
54 double  atof(const scope char*);
55 int     atoi(const scope char*);
56 c_long  atol(const scope char*);
57 long    atoll(const scope char*);
58 void*   bsearch(const scope void*, const scope void*, size_t, size_t, int function(const scope void*, const scope void*));
59 void*   calloc(size_t, size_t);
60 div_t   div(int, int);
61 void    exit(int);
62 void    free(void*);
63 char*   getenv(const scope char*);
64 c_long  labs(c_long);
65 ldiv_t  ldiv(c_long, c_long);
66 long    llabs(long);
67 lldiv_t lldiv(long, long);
68 void*   malloc(size_t);
69 int     mblen(const scope char*, size_t);
70 size_t  mbstowcs(wchar_t*, const scope char*, size_t);
71 int     mbtowc(wchar_t*, const scope char*, size_t);
72 void    qsort(void*, size_t, size_t, int function(const scope void*, const scope void*));
73 int     rand();
74 void*   realloc(void*, size_t);
75 void    srand(uint);
76 double  strtod(const scope char*, char**);
77 float   strtof(const scope char*, char**);
78 c_long  strtol(const scope char*, char**, int);
79 real    strtold(const scope char*, char**);
80 long    strtoll(const scope char*, char**, int);
81 c_ulong strtoul(const scope char*, char**, int);
82 ulong   strtoull(const scope char*, char**, int);
83 int     system(const scope char*);
84 size_t  wcstombs(char*, const scope wchar_t*, size_t);
85 int     wctomb(char*, wchar_t);
86 */
87 
88 //
89 // Advisory Information (ADV)
90 //
91 /*
92 int posix_memalign(void**, size_t, size_t);
93 */
94 
95 version (CRuntime_Glibc)
96 {
97     int posix_memalign(scope void**, size_t, size_t) pure;
98 }
99 else version (FreeBSD)
100 {
101     int posix_memalign(scope void**, size_t, size_t) pure;
102 }
103 else version (NetBSD)
104 {
105     int posix_memalign(scope void**, size_t, size_t) pure;
106 }
107 else version (OpenBSD)
108 {
109     int posix_memalign(scope void**, size_t, size_t) pure;
110 }
111 else version (DragonFlyBSD)
112 {
113     int posix_memalign(scope void**, size_t, size_t) pure;
114 }
115 else version (Solaris)
116 {
117     int posix_memalign(scope void**, size_t, size_t) pure;
118 }
119 else version (Darwin)
120 {
121     int posix_memalign(scope void**, size_t, size_t) pure;
122 }
123 else version (CRuntime_Bionic)
124 {
125     // Added since Lollipop
126     int posix_memalign(scope void**, size_t, size_t) pure;
127 }
128 else version (CRuntime_Musl)
129 {
130     int posix_memalign(scope void**, size_t, size_t) pure;
131 }
132 else version (CRuntime_UClibc)
133 {
134     int posix_memalign(scope void**, size_t, size_t) pure;
135 }
136 
137 //
138 // C Extension (CX)
139 //
140 /*
141 int setenv(const scope char*, const scope char*, int);
142 int unsetenv(const scope char*);
143 */
144 
145 version (CRuntime_Glibc)
146 {
147     int setenv(const scope char*, const scope char*, int);
148     int unsetenv(const scope char*);
149 
150     void* valloc(size_t); // LEGACY non-standard
151 }
152 else version (Darwin)
153 {
154     int setenv(const scope char*, const scope char*, int);
155     int unsetenv(const scope char*);
156 
157     void* valloc(size_t); // LEGACY non-standard
158 }
159 else version (FreeBSD)
160 {
161     int setenv(const scope char*, const scope char*, int);
162     int unsetenv(const scope char*);
163 
164     void* valloc(size_t); // LEGACY non-standard
165 }
166 else version (NetBSD)
167 {
168     int setenv(const scope char*, const scope char*, int);
169     int __unsetenv13(const scope char*);
170     alias __unsetenv13 unsetenv;
171     void* valloc(size_t); // LEGACY non-standard
172 }
173 else version (OpenBSD)
174 {
175     int setenv(const scope char*, const scope char*, int);
176     int unsetenv(const scope char*);
177 
178     void* valloc(size_t); // LEGACY non-standard
179 }
180 else version (DragonFlyBSD)
181 {
182     int setenv(const scope char*, const scope char*, int);
183     int unsetenv(const scope char*);
184 
185     void* valloc(size_t); // LEGACY non-standard
186 }
187 else version (CRuntime_Bionic)
188 {
189     int setenv(const scope char*, const scope char*, int);
190     int unsetenv(const scope char*);
191 
192     void* valloc(size_t);
193 }
194 else version (Solaris)
195 {
196     int setenv(const scope char*, const scope char*, int);
197     int unsetenv(const scope char*);
198 
199     void* valloc(size_t); // LEGACY non-standard
200 }
201 else version (CRuntime_Musl)
202 {
203     int setenv(const scope char*, const scope char*, int);
204     int unsetenv(const scope char*);
205 }
206 else version (CRuntime_UClibc)
207 {
208     int setenv(const scope char*, const scope char*, int);
209     int unsetenv(const scope char*);
210     void* valloc(size_t);
211 }
212 
213 //
214 // Thread-Safe Functions (TSF)
215 //
216 /*
217 int rand_r(uint*);
218 */
219 
220 version (CRuntime_Glibc)
221 {
222     int rand_r(uint*);
223 }
224 else version (Darwin)
225 {
226     int rand_r(uint*);
227 }
228 else version (FreeBSD)
229 {
230     int rand_r(uint*);
231 }
232 else version (NetBSD)
233 {
234     int rand_r(uint*);
235 }
236 else version (OpenBSD)
237 {
238     int rand_r(uint*);
239 }
240 else version (DragonFlyBSD)
241 {
242     int rand_r(uint*);
243 }
244 else version (Solaris)
245 {
246     int rand_r(uint*);
247 }
248 else version (CRuntime_UClibc)
249 {
250     int rand_r(uint*);
251 }
252 
253 //
254 // XOpen (XSI)
255 //
256 /*
257 WNOHANG     (defined in core.sys.posix.sys.wait)
258 WUNTRACED   (defined in core.sys.posix.sys.wait)
259 WEXITSTATUS (defined in core.sys.posix.sys.wait)
260 WIFEXITED   (defined in core.sys.posix.sys.wait)
261 WIFSIGNALED (defined in core.sys.posix.sys.wait)
262 WIFSTOPPED  (defined in core.sys.posix.sys.wait)
263 WSTOPSIG    (defined in core.sys.posix.sys.wait)
264 WTERMSIG    (defined in core.sys.posix.sys.wait)
265 
266 c_long a64l(const scope char*);
267 double drand48();
268 char*  ecvt(double, int, int *, int *); // LEGACY
269 double erand48(ref ushort[3]);
270 char*  fcvt(double, int, int *, int *); // LEGACY
271 char*  gcvt(double, int, char*); // LEGACY
272 // per spec: int getsubopt(char** char* const*, char**);
273 int    getsubopt(char**, const scope char**, char**);
274 int    grantpt(int);
275 char*  initstate(uint, char*, size_t);
276 c_long jrand48(ref ushort[3]);
277 char*  l64a(c_long);
278 void   lcong48(ref ushort[7]);
279 c_long lrand48();
280 char*  mktemp(char*); // LEGACY
281 int    mkstemp(char*);
282 int    mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
283 c_long mrand48();
284 c_long nrand48(ref ushort[3]);
285 int    posix_openpt(int);
286 char*  ptsname(int);
287 int    putenv(char*);
288 c_long random();
289 char*  realpath(const scope char*, char*);
290 ushort *seed48(ref ushort[3]);
291 void   setkey(const scope char*);
292 char*  setstate(const scope char*);
293 void   srand48(c_long);
294 void   srandom(uint);
295 int    unlockpt(int);
296 */
297 
298 version (CRuntime_Glibc)
299 {
300     //WNOHANG     (defined in core.sys.posix.sys.wait)
301     //WUNTRACED   (defined in core.sys.posix.sys.wait)
302     //WEXITSTATUS (defined in core.sys.posix.sys.wait)
303     //WIFEXITED   (defined in core.sys.posix.sys.wait)
304     //WIFSIGNALED (defined in core.sys.posix.sys.wait)
305     //WIFSTOPPED  (defined in core.sys.posix.sys.wait)
306     //WSTOPSIG    (defined in core.sys.posix.sys.wait)
307     //WTERMSIG    (defined in core.sys.posix.sys.wait)
308 
309     c_long a64l(const scope char*);
310     double drand48();
311     char*  ecvt(double, int, int *, int *); // LEGACY
312     double erand48(ref ushort[3]);
313     char*  fcvt(double, int, int *, int *); // LEGACY
314     char*  gcvt(double, int, char*); // LEGACY
315     int    getsubopt(char**, const scope char**, char**);
316     int    grantpt(int);
317     char*  initstate(uint, char*, size_t);
318     c_long jrand48(ref ushort[3]);
319     char*  l64a(c_long);
320     void   lcong48(ref ushort[7]);
321     c_long lrand48();
322     char*  mktemp(char*); // LEGACY
323     //int    mkstemp(char*);
324     char*  mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
325     c_long mrand48();
326     c_long nrand48(ref ushort[3]);
327     int    posix_openpt(int);
328     char*  ptsname(int);
329     int    putenv(char*);
330     c_long random();
331     char*  realpath(const scope char*, char*);
332     ushort *seed48(ref ushort[3]);
333     void   setkey(const scope char*);
334     char*  setstate(const scope char*);
335     void   srand48(c_long);
336     void   srandom(uint);
337     int    unlockpt(int);
338 
339   static if ( __USE_LARGEFILE64 )
340   {
341     int    mkstemp64(char*);
342     alias  mkstemp64 mkstemp;
343   }
344   else
345   {
346     int    mkstemp(char*);
347   }
348 }
349 else version (Darwin)
350 {
351     //WNOHANG     (defined in core.sys.posix.sys.wait)
352     //WUNTRACED   (defined in core.sys.posix.sys.wait)
353     //WEXITSTATUS (defined in core.sys.posix.sys.wait)
354     //WIFEXITED   (defined in core.sys.posix.sys.wait)
355     //WIFSIGNALED (defined in core.sys.posix.sys.wait)
356     //WIFSTOPPED  (defined in core.sys.posix.sys.wait)
357     //WSTOPSIG    (defined in core.sys.posix.sys.wait)
358     //WTERMSIG    (defined in core.sys.posix.sys.wait)
359 
360     c_long a64l(const scope char*);
361     double drand48();
362     char*  ecvt(double, int, int *, int *); // LEGACY
363     double erand48(ref ushort[3]);
364     char*  fcvt(double, int, int *, int *); // LEGACY
365     char*  gcvt(double, int, char*); // LEGACY
366     int    getsubopt(char**, const scope char**, char**);
367     int    grantpt(int);
368     char*  initstate(uint, char*, size_t);
369     c_long jrand48(ref ushort[3]);
370     char*  l64a(c_long);
371     void   lcong48(ref ushort[7]);
372     c_long lrand48();
373     char*  mktemp(char*); // LEGACY
374     int    mkstemp(char*);
375     char*  mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
376     c_long mrand48();
377     c_long nrand48(ref ushort[3]);
378     int    posix_openpt(int);
379     char*  ptsname(int);
380     int    putenv(char*);
381     c_long random();
382     char*  realpath(const scope char*, char*);
383     ushort *seed48(ref ushort[3]);
384     void   setkey(const scope char*);
385     char*  setstate(const scope char*);
386     void   srand48(c_long);
387     void   srandom(uint);
388     int    unlockpt(int);
389 }
390 else version (FreeBSD)
391 {
392     //WNOHANG     (defined in core.sys.posix.sys.wait)
393     //WUNTRACED   (defined in core.sys.posix.sys.wait)
394     //WEXITSTATUS (defined in core.sys.posix.sys.wait)
395     //WIFEXITED   (defined in core.sys.posix.sys.wait)
396     //WIFSIGNALED (defined in core.sys.posix.sys.wait)
397     //WIFSTOPPED  (defined in core.sys.posix.sys.wait)
398     //WSTOPSIG    (defined in core.sys.posix.sys.wait)
399     //WTERMSIG    (defined in core.sys.posix.sys.wait)
400 
401     c_long a64l(const scope char*);
402     double drand48();
403     //char*  ecvt(double, int, int *, int *); // LEGACY
404     double erand48(ref ushort[3]);
405     //char*  fcvt(double, int, int *, int *); // LEGACY
406     //char*  gcvt(double, int, char*); // LEGACY
407     int    getsubopt(char**, const scope char**, char**);
408     int    grantpt(int);
409     char*  initstate(uint, char*, size_t);
410     c_long jrand48(ref ushort[3]);
411     char*  l64a(c_long);
412     void   lcong48(ref ushort[7]);
413     c_long lrand48();
414     char*  mktemp(char*); // LEGACY
415     int    mkstemp(char*);
416     char*  mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
417     c_long mrand48();
418     c_long nrand48(ref ushort[3]);
419     int    posix_openpt(int);
420     char*  ptsname(int);
421     int    putenv(char*);
422     c_long random();
423     char*  realpath(const scope char*, char*);
424     ushort *seed48(ref ushort[3]);
425     void   setkey(const scope char*);
426     char*  setstate(const scope char*);
427     void   srand48(c_long);
428     void   srandom(uint);
429     int    unlockpt(int);
430 }
431 else version (NetBSD)
432 {
433     //WNOHANG     (defined in core.sys.posix.sys.wait)
434     //WUNTRACED   (defined in core.sys.posix.sys.wait)
435     //WEXITSTATUS (defined in core.sys.posix.sys.wait)
436     //WIFEXITED   (defined in core.sys.posix.sys.wait)
437     //WIFSIGNALED (defined in core.sys.posix.sys.wait)
438     //WIFSTOPPED  (defined in core.sys.posix.sys.wait)
439     //WSTOPSIG    (defined in core.sys.posix.sys.wait)
440     //WTERMSIG    (defined in core.sys.posix.sys.wait)
441 
442     c_long a64l(const scope char*);
443     double drand48();
444     //char*  ecvt(double, int, int *, int *); // LEGACY
445     double erand48(ref ushort[3]);
446     //char*  fcvt(double, int, int *, int *); // LEGACY
447     //char*  gcvt(double, int, char*); // LEGACY
448     int    getsubopt(char**, const scope char**, char**);
449     int    grantpt(int);
450     char*  initstate(uint, char*, size_t);
451     c_long jrand48(ref ushort[3]);
452     char*  l64a(c_long);
453     void   lcong48(ref ushort[7]);
454     c_long lrand48();
455     char*  mktemp(char*); // LEGACY
456     int    mkstemp(char*);
457     char*  mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
458     c_long mrand48();
459     c_long nrand48(ref ushort[3]);
460     int    posix_openpt(int);
461     char*  ptsname(int);
462     int    putenv(char*);
463     c_long random();
464     char*  realpath(const scope char*, char*);
465     ushort *seed48(ref ushort[3]);
466     void   setkey(const scope char*);
467     char*  setstate(const scope char*);
468     void   srand48(c_long);
469     void   srandom(uint);
470     int    unlockpt(int);
471 }
472 else version (OpenBSD)
473 {
474     //WNOHANG     (defined in core.sys.posix.sys.wait)
475     //WUNTRACED   (defined in core.sys.posix.sys.wait)
476     //WEXITSTATUS (defined in core.sys.posix.sys.wait)
477     //WIFEXITED   (defined in core.sys.posix.sys.wait)
478     //WIFSIGNALED (defined in core.sys.posix.sys.wait)
479     //WIFSTOPPED  (defined in core.sys.posix.sys.wait)
480     //WSTOPSIG    (defined in core.sys.posix.sys.wait)
481     //WTERMSIG    (defined in core.sys.posix.sys.wait)
482 
483     c_long a64l(const scope char*);
484     double drand48();
485     //char*  ecvt(double, int, int *, int *); // LEGACY
486     double erand48(ref ushort[3]);
487     //char*  fcvt(double, int, int *, int *); // LEGACY
488     //char*  gcvt(double, int, char*); // LEGACY
489     int    getsubopt(char**, const scope char**, char**);
490     int    grantpt(int);
491     char*  initstate(uint, char*, size_t);
492     c_long jrand48(ref ushort[3]);
493     char*  l64a(c_long);
494     void   lcong48(ref ushort[7]);
495     c_long lrand48();
496     char*  mktemp(char*); // LEGACY
497     int    mkstemp(char*);
498     char*  mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
499     c_long mrand48();
500     c_long nrand48(ref ushort[3]);
501     int    posix_openpt(int);
502     char*  ptsname(int);
503     int    putenv(char*);
504     c_long random();
505     char*  realpath(const scope char*, char*);
506     ushort *seed48(ref ushort[3]);
507     // void   setkey(const scope char*); // not implemented
508     char*  setstate(const scope char*);
509     void   srand48(c_long);
510     void   srandom(uint);
511     int    unlockpt(int);
512 }
513 else version (DragonFlyBSD)
514 {
515     //WNOHANG     (defined in core.sys.posix.sys.wait)
516     //WUNTRACED   (defined in core.sys.posix.sys.wait)
517     //WEXITSTATUS (defined in core.sys.posix.sys.wait)
518     //WIFEXITED   (defined in core.sys.posix.sys.wait)
519     //WIFSIGNALED (defined in core.sys.posix.sys.wait)
520     //WIFSTOPPED  (defined in core.sys.posix.sys.wait)
521     //WSTOPSIG    (defined in core.sys.posix.sys.wait)
522     //WTERMSIG    (defined in core.sys.posix.sys.wait)
523 
524     c_long a64l(const scope char*);
525     double drand48();
526     //char*  ecvt(double, int, int *, int *); // LEGACY
527     double erand48(ref ushort[3]);
528     //char*  fcvt(double, int, int *, int *); // LEGACY
529     //char*  gcvt(double, int, char*); // LEGACY
530     int    getsubopt(char**, const scope char**, char**);
531     int    grantpt(int);
532     char*  initstate(uint, char*, size_t);
533     c_long jrand48(ref ushort[3]);
534     char*  l64a(c_long);
535     void   lcong48(ref ushort[7]);
536     c_long lrand48();
537     char*  mktemp(char*); // LEGACY
538     int    mkstemp(char*);
539     char*  mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
540     c_long mrand48();
541     c_long nrand48(ref ushort[3]);
542     int    posix_openpt(int);
543     char*  ptsname(int);
544     int    putenv(char*);
545     c_long random();
546     char*  realpath(const scope char*, char*);
547     ushort *seed48(ref ushort[3]);
548     void   setkey(const scope char*);
549     char*  setstate(const scope char*);
550     void   srand48(c_long);
551     void   srandom(uint);
552     int    unlockpt(int);
553 }
554 else version (CRuntime_Bionic)
555 {
556     double  drand48();
557     double  erand48(ref ushort[3]);
558     //int   grantpt(int); defined inline, but seems to do nothing in bionic
559     c_long  jrand48(ref ushort[3]);
560     c_long  lrand48();
561     char*   mktemp(char*); // LEGACY
562     int     mkstemp(char*);
563     char*   mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
564     c_long  mrand48();
565     c_long  nrand48(ref ushort[3]);
566     char*   ptsname(int);
567     int     putenv(const scope char*);
568     c_long  random() { return lrand48(); }
569     char*   realpath(const scope char*, char*);
570     ushort* seed48(ref ushort[3]);
571     void    srand48(c_long);
572     void    srandom(uint s) { srand48(s); }
573     int     unlockpt(int);
574 }
575 else version (CRuntime_Musl)
576 {
577     c_long a64l(const scope char*);
578     double drand48();
579     char*  ecvt(double, int, int *, int *); // LEGACY
580     double erand48(ref ushort[3]);
581     char*  fcvt(double, int, int *, int *); // LEGACY
582     char*  gcvt(double, int, char*); // LEGACY
583     int    getsubopt(char**, const scope char**, char**);
584     int    grantpt(int);
585     char*  initstate(uint, char*, size_t);
586     c_long jrand48(ref ushort[3]);
587     char*  l64a(c_long);
588     void   lcong48(ref ushort[7]);
589     c_long lrand48();
590     char*  mktemp(char*); // LEGACY
591     char*  mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
592     int    mkstemp(char*);
593     c_long mrand48();
594     c_long nrand48(ref ushort[3]);
595     int    posix_openpt(int);
596     char*  ptsname(int);
597     int    putenv(char*);
598     c_long random();
599     char*  realpath(const scope char*, char*);
600     ushort *seed48(ref ushort[3]);
601     void   setkey(const scope char*);
602     char*  setstate(const scope char*);
603     void   srand48(c_long);
604     void   srandom(uint);
605     int    unlockpt(int);
606 
607   static if ( __USE_LARGEFILE64 )
608   {
609     int    mkstemp64(char*);
610     alias  mkstemp64 mkstemp;
611   }
612   else
613   {
614     int    mkstemp(char*);
615   }
616 
617 }
618 else version (Solaris)
619 {
620     //WNOHANG     (defined in core.sys.posix.sys.wait)
621     //WUNTRACED   (defined in core.sys.posix.sys.wait)
622     //WEXITSTATUS (defined in core.sys.posix.sys.wait)
623     //WIFEXITED   (defined in core.sys.posix.sys.wait)
624     //WIFSIGNALED (defined in core.sys.posix.sys.wait)
625     //WIFSTOPPED  (defined in core.sys.posix.sys.wait)
626     //WSTOPSIG    (defined in core.sys.posix.sys.wait)
627     //WTERMSIG    (defined in core.sys.posix.sys.wait)
628 
629     c_long a64l(const scope char*);
630     double drand48();
631     char*  ecvt(double, int, int *, int *); // LEGACY
632     double erand48(ref ushort[3]);
633     char*  fcvt(double, int, int *, int *); // LEGACY
634     char*  gcvt(double, int, char*); // LEGACY
635     int    getsubopt(char**, const scope char**, char**);
636     int    grantpt(int);
637     char*  initstate(uint, char*, size_t);
638     c_long jrand48(ref ushort[3]);
639     char*  l64a(c_long);
640     void   lcong48(ref ushort[7]);
641     c_long lrand48();
642     char*  mktemp(char*); // LEGACY
643     //int    mkstemp(char*);
644     char*  mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
645     c_long mrand48();
646     c_long nrand48(ref ushort[3]);
647     int    posix_openpt(int);
648     char*  ptsname(int);
649     int    putenv(char*);
650     c_long random();
651     char*  realpath(const scope char*, char*);
652     ushort *seed48(ref ushort[3]);
653     void   setkey(const scope char*);
654     char*  setstate(const scope char*);
655     void   srand48(c_long);
656     void   srandom(uint);
657     int    unlockpt(int);
658 
659     version (D_LP64)
660     {
661         int mkstemp(char*);
662 
663         static if ( __USE_LARGEFILE64 )
664             alias mkstemp mkstemp64;
665     }
666     else
667     {
668         int mkstemp64(char*);
669 
670         static if ( __USE_LARGEFILE64 )
671             alias mkstemp64 mkstemp;
672         else
673             int mkstemp(char*);
674     }
675 }
676 else version (CRuntime_UClibc)
677 {
678     c_long a64l(const scope char*);
679     double drand48();
680     char*  ecvt(double, int, int *, int *);
681     double erand48(ref ushort[3]);
682     char*  fcvt(double, int, int *, int *);
683     char*  gcvt(double, int, char*);
684     int    getsubopt(char**, const scope char**, char**);
685     int    grantpt(int);
686     char*  initstate(uint, char*, size_t);
687     c_long jrand48(ref ushort[3]);
688     char*  l64a(c_long);
689     void   lcong48(ref ushort[7]);
690     c_long lrand48();
691     char*  mktemp(char*);
692     char*  mkdtemp(char*);
693     c_long mrand48();
694     c_long nrand48(ref ushort[3]);
695     int    posix_openpt(int);
696     char*  ptsname(int);
697     int    putenv(char*);
698     c_long random();
699     char*  realpath(const scope char*, char*);
700     ushort* seed48(ref ushort[3]);
701     void   setkey(const scope char*);
702     char*  setstate(const scope char*);
703     void   srand48(c_long);
704     void   srandom(uint);
705     int    unlockpt(int);
706 
707   static if ( __USE_LARGEFILE64 )
708   {
709     int    mkstemp64(char*);
710     alias  mkstemp64 mkstemp;
711   }
712   else
713   {
714     int    mkstemp(char*);
715   }
716 }