Add memtest support.
[syslinux-debian/hramrach.git] / com32 / include / stdlib.h
blob14412972f6144310963c83b9f565a33e616a8631
1 /*
2 * stdlib.h
3 */
5 #ifndef _STDLIB_H
6 #define _STDLIB_H
8 #include <klibc/extern.h>
9 #include <klibc/compiler.h>
10 #include <stddef.h>
12 #define EXIT_FAILURE 1
13 #define EXIT_SUCCESS 0
15 __extern __noreturn abort(void);
16 static __inline__ int abs(int __n)
18 return (__n < 0) ? -__n : __n;
21 __extern int atexit(void (*)(void));
22 __extern int on_exit(void (*)(int, void *), void *);
23 __extern int atoi(const char *);
24 __extern long atol(const char *);
25 __extern long long atoll(const char *);
26 __extern __noreturn exit(int);
27 __extern __noreturn _Exit(int);
28 __extern void free(void *);
29 static __inline__ long labs(long __n)
31 return (__n < 0L) ? -__n : __n;
34 static __inline__ long long llabs(long long __n)
36 return (__n < 0LL) ? -__n : __n;
39 __extern __mallocfunc void *malloc(size_t);
40 __extern __mallocfunc void *zalloc(size_t);
41 __extern __mallocfunc void *calloc(size_t, size_t);
42 __extern __mallocfunc void *realloc(void *, size_t);
43 __extern long strtol(const char *, char **, int);
44 __extern long long strtoll(const char *, char **, int);
45 __extern unsigned long strtoul(const char *, char **, int);
46 __extern unsigned long long strtoull(const char *, char **, int);
48 __extern char *getenv(const char *);
49 __extern int putenv(const char *);
50 __extern int setenv(const char *, const char *, int);
51 __extern int unsetenv(const char *);
53 __extern void qsort(void *, size_t, size_t,
54 int (*)(const void *, const void *));
56 __extern long jrand48(unsigned short *);
57 __extern long mrand48(void);
58 __extern long nrand48(unsigned short *);
59 __extern long lrand48(void);
60 __extern unsigned short *seed48(const unsigned short *);
61 __extern void srand48(long);
63 #define RAND_MAX 0x7fffffff
64 static __inline__ int rand(void)
66 return (int)lrand48();
69 static __inline__ void srand(unsigned int __s)
71 srand48(__s);
74 static __inline__ long random(void)
76 return lrand48();
79 static __inline__ void srandom(unsigned int __s)
81 srand48(__s);
84 /* Basic PTY functions. These only work if devpts is mounted! */
86 __extern int unlockpt(int);
87 __extern char *ptsname(int);
88 __extern int getpt(void);
90 static __inline__ int grantpt(int __fd)
92 (void)__fd;
93 return 0; /* devpts does this all for us! */
96 #endif /* _STDLIB_H */