30 lines
1001 B
C
30 lines
1001 B
C
#ifndef MINIMALSYS_H
|
|
#include "int.h"
|
|
|
|
void exit(int8_t status);
|
|
|
|
#define STDIO 1
|
|
#define STDERR 2
|
|
intptr_t write(int32_t fd, const void* buf, intptr_t size);
|
|
intptr_t read(int32_t fd, const void* buf, intptr_t size);
|
|
|
|
#define O_RDONLY 00
|
|
#define O_WRONLY 01
|
|
#define O_RDWR 02
|
|
#define AT_FDCWD -100
|
|
int32_t openat(int32_t fd, const char* filename, uint32_t flags, uint32_t mode);
|
|
#define open(...) openat(AT_FDCWD, __VA_ARGS__, 0)
|
|
//inline int32_t openat(int32_t fd, const char* filename, uint32_t flags) {return openat(fd, filename, flags, 0);}
|
|
//inline int32_t open(const char* filename, uint32_t flags, uint32_t mode) {return openat(AT_FDCWD, filename, flags, mode);}
|
|
//inline int32_t open(const char* filename, uint32_t flags) {return openat(AT_FDCWD, filename, flags, 0);}
|
|
|
|
uint32_t fork();
|
|
|
|
// Provide memset for clang
|
|
void *memset(void* s, int c, unsigned long n) {
|
|
int8_t* mem = s;
|
|
for(long int i = 0; i < n; ++i) mem[i] = c;
|
|
return s;
|
|
}
|
|
#endif // !MINIMALSYS_H
|