source: bootcd/isolinux/syslinux-6.03/com32/include/stdlib.h

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 2.2 KB
Line 
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#define EXIT_FAILURE 1
13#define EXIT_SUCCESS 0
14
15__extern __noreturn abort(void);
16static __inline__ int abs(int __n)
17{
18    return (__n < 0) ? -__n : __n;
19}
20
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 *);
29static __inline__ long labs(long __n)
30{
31    return (__n < 0L) ? -__n : __n;
32}
33
34static __inline__ long long llabs(long long __n)
35{
36    return (__n < 0LL) ? -__n : __n;
37}
38
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);
47
48static __inline__ char *getenv(const char *name)
49{
50    (void)name;
51    return NULL;
52}
53
54__extern int putenv(const char *);
55__extern int setenv(const char *, const char *, int);
56__extern int unsetenv(const char *);
57
58__extern void qsort(void *, size_t, size_t,
59                    int (*)(const void *, const void *));
60
61__extern long jrand48(unsigned short *);
62__extern long mrand48(void);
63__extern long nrand48(unsigned short *);
64__extern long lrand48(void);
65__extern unsigned short *seed48(const unsigned short *);
66__extern void srand48(long);
67
68#define RAND_MAX 0x7fffffff
69static __inline__ int rand(void)
70{
71    return (int)lrand48();
72}
73
74static __inline__ void srand(unsigned int __s)
75{
76    srand48(__s);
77}
78
79static __inline__ long random(void)
80{
81    return lrand48();
82}
83
84static __inline__ void srandom(unsigned int __s)
85{
86    srand48(__s);
87}
88
89/* Basic PTY functions.  These only work if devpts is mounted! */
90
91__extern int unlockpt(int);
92__extern char *ptsname(int);
93__extern int getpt(void);
94
95static __inline__ int grantpt(int __fd)
96{
97    (void)__fd;
98    return 0;                   /* devpts does this all for us! */
99}
100
101#endif /* _STDLIB_H */
Note: See TracBrowser for help on using the repository browser.