forked from PoliEcho-holding-org/kern
Implemented stdlib.h
This commit is contained in:
+23
-2
@@ -3,7 +3,28 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void* malloc(const size_t size);
|
||||
void free(const void* ptr);
|
||||
#define EXIT_SUCCESS 0
|
||||
#define EXIT_FAILURE 1
|
||||
#define RAND_MAX 0x7FFFFFF
|
||||
|
||||
/* Memory allocation */
|
||||
void* malloc(size_t size);
|
||||
void* calloc(size_t count, size_t size);
|
||||
void* realloc(void* ptr, size_t size);
|
||||
void free(void* ptr);
|
||||
|
||||
/* Process controll */
|
||||
void _Exit(int status);
|
||||
void exit(int status);
|
||||
|
||||
// TODO: move atoi() here
|
||||
|
||||
/* Random number generator */
|
||||
int rand(void);
|
||||
void srand(unsigned int seed);
|
||||
|
||||
/* Sort & search */
|
||||
void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
|
||||
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,16 +17,6 @@ typedef enum {
|
||||
SYS_SLEEP,
|
||||
} SYSCALL_NUMBERS;
|
||||
|
||||
typedef enum {
|
||||
O_CREAT = 0x01, // Create if does not exist
|
||||
O_RDONLY = 0x02, // Read only
|
||||
O_WRONLY = 0x04, // Write only
|
||||
O_RDWR = 0x08, // Read and write
|
||||
O_APPEND = 0x10, // Always writes at the end (appends)
|
||||
O_TRUNC = 0x20, // Truncate file size and position to 0 on Open
|
||||
O_BIN = 0x40, // Read bytes, not text
|
||||
} OFLAGS;
|
||||
|
||||
int syscall(int nr, int arg0, int arg1, int arg2);
|
||||
|
||||
/* Syscall wrappers */
|
||||
|
||||
Reference in New Issue
Block a user