Adding upstream version 3.53.
[syslinux-debian/hramrach.git] / com32 / include / stdlib.h
blobbe4e76ed9f83fef33b14765610f88200e92d89a3
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 static __inline__ __noreturn _Exit(int __n) {
16 __extern __noreturn _exit(int);
17 _exit(__n);
18 for(;;); /* Some gcc versions are stupid */
20 __extern __noreturn abort(void);
21 static __inline__ int abs(int __n) {
22 return (__n < 0) ? -__n : __n;
24 __extern int atexit(void (*)(void));
25 __extern int on_exit(void (*)(int, void *), void *);
26 __extern int atoi(const char *);
27 __extern long atol(const char *);
28 __extern long long atoll(const char *);
29 __extern __noreturn exit(int);
30 __extern void free(void *);
31 static __inline__ long labs(long __n) {
32 return (__n < 0L) ? -__n : __n;
35 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 *calloc(size_t, size_t);
41 __extern __mallocfunc void *realloc(void *, size_t);
42 __extern long strtol(const char *, char **, int);
43 __extern long long strtoll(const char *, char **, int);
44 __extern unsigned long strtoul(const char *, char **, int);
45 __extern unsigned long long strtoull(const char *, char **, int);
47 __extern char *getenv(const char *);
48 __extern int putenv(const char *);
49 __extern int setenv(const char *, const char *, int);
50 __extern int unsetenv(const char *);
52 __extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
55 __extern long jrand48(unsigned short *);
56 __extern long mrand48(void);
57 __extern long nrand48(unsigned short *);
58 __extern long lrand48(void);
59 __extern unsigned short *seed48(const unsigned short *);
60 __extern void srand48(long);
62 #define RAND_MAX 0x7fffffff
63 static __inline__ int rand(void) {
64 return (int)lrand48();
66 static __inline__ void srand(unsigned int __s) {
67 srand48(__s);
69 static __inline__ long random(void)
71 return lrand48();
73 static __inline__ void srandom(unsigned int __s)
75 srand48(__s);
78 /* Basic PTY functions. These only work if devpts is mounted! */
80 __extern int unlockpt(int);
81 __extern char *ptsname(int);
82 __extern int getpt(void);
84 static __inline__ int grantpt(int __fd)
86 (void)__fd;
87 return 0; /* devpts does this all for us! */
90 #endif /* _STDLIB_H */