Declarations for the string core, stdio, stdlib, unistd, errno, sys/types, and the raw syscall interface; the FILE layout stays private in src/internal.h. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <[email protected]>
39 lines
729 B
C
39 lines
729 B
C
/*
|
|
* stdlib.h — general utilities for nulsl-libc.
|
|
*
|
|
* The memory functions are ENOSYS stubs until the brk-based allocator
|
|
* lands; atoi and the exit paths are already real.
|
|
*/
|
|
|
|
#ifndef _NULSL_STDLIB_H
|
|
#define _NULSL_STDLIB_H
|
|
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define EXIT_SUCCESS 0
|
|
#define EXIT_FAILURE 1
|
|
|
|
/* Stubs: brk()/mmap() allocator is on the roadmap. */
|
|
void *malloc(size_t size);
|
|
void *calloc(size_t nmemb, size_t size);
|
|
void *realloc(void *ptr, size_t size);
|
|
void free(void *ptr);
|
|
|
|
/* Real. */
|
|
void exit(int status);
|
|
void abort(void);
|
|
int atoi(const char *s);
|
|
|
|
/* Stub. */
|
|
long strtol(const char *s, char **endptr, int base);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _NULSL_STDLIB_H */
|