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