Contents of /trunk/mkinitrd-magellan/klibc/usr/include/stdlib.h
Parent Directory | Revision Log
Revision 815 -
(show annotations)
(download)
Fri Apr 24 18:32:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 2257 byte(s)
Fri Apr 24 18:32:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 2257 byte(s)
-updated to klibc-1.5.15
1 | /* |
2 | * stdlib.h |
3 | */ |
4 | |
5 | #ifndef _STDLIB_H |
6 | #define _STDLIB_H |
7 | |
8 | #include <klibc/extern.h> |
9 | #include <klibc/compiler.h> |
10 | #include <stddef.h> |
11 | |
12 | #include <malloc.h> |
13 | |
14 | #define EXIT_FAILURE 1 |
15 | #define EXIT_SUCCESS 0 |
16 | |
17 | __extern __noreturn abort(void); |
18 | static __inline__ int abs(int __n) |
19 | { |
20 | return (__n < 0) ? -__n : __n; |
21 | } |
22 | __extern int system(const char *string); |
23 | __extern int atexit(void (*)(void)); |
24 | __extern int on_exit(void (*)(int, void *), void *); |
25 | __extern int atoi(const char *); |
26 | __extern long atol(const char *); |
27 | __extern long long atoll(const char *); |
28 | __extern __noreturn exit(int); |
29 | __extern __noreturn _exit(int); |
30 | #define _Exit _exit |
31 | static __inline__ long labs(long __n) |
32 | { |
33 | return (__n < 0L) ? -__n : __n; |
34 | } |
35 | |
36 | static __inline__ long long llabs(long long __n) |
37 | { |
38 | return (__n < 0LL) ? -__n : __n; |
39 | } |
40 | |
41 | __extern long strtol(const char *, char **, int); |
42 | __extern long long strtoll(const char *, char **, int); |
43 | __extern unsigned long strtoul(const char *, char **, int); |
44 | __extern unsigned long long strtoull(const char *, char **, int); |
45 | |
46 | __extern char *getenv(const char *); |
47 | __extern int putenv(const char *); |
48 | __extern int setenv(const char *, const char *, int); |
49 | __extern int unsetenv(const char *); |
50 | __extern int clearenv(void); |
51 | |
52 | typedef int (*__comparefunc_t) (const void *, const void *); |
53 | __extern void *bsearch(const void *, const void *, size_t, size_t, |
54 | __comparefunc_t); |
55 | __extern void qsort(void *, size_t, size_t, __comparefunc_t); |
56 | |
57 | __extern long jrand48(unsigned short *); |
58 | __extern long mrand48(void); |
59 | __extern long nrand48(unsigned short *); |
60 | __extern long lrand48(void); |
61 | __extern unsigned short *seed48(const unsigned short *); |
62 | __extern void srand48(long); |
63 | |
64 | #define RAND_MAX 0x7fffffff |
65 | static __inline__ int rand(void) |
66 | { |
67 | return (int)lrand48(); |
68 | } |
69 | static __inline__ void srand(unsigned int __s) |
70 | { |
71 | srand48(__s); |
72 | } |
73 | static __inline__ long random(void) |
74 | { |
75 | return lrand48(); |
76 | } |
77 | static __inline__ void srandom(unsigned int __s) |
78 | { |
79 | srand48(__s); |
80 | } |
81 | |
82 | /* Basic PTY functions. These only work if devpts is mounted! */ |
83 | |
84 | __extern int unlockpt(int); |
85 | __extern char *ptsname(int); |
86 | __extern int getpt(void); |
87 | __extern int posix_openpt(int); |
88 | |
89 | static __inline__ int grantpt(int __fd) |
90 | { |
91 | (void)__fd; |
92 | return 0; /* devpts does this all for us! */ |
93 | } |
94 | |
95 | #endif /* _STDLIB_H */ |