64 lines
1.9 KiB
C
64 lines
1.9 KiB
C
|
struct stat;
|
||
|
|
||
|
// system calls
|
||
|
int fork(void);
|
||
|
#ifdef _ZCC
|
||
|
int exit(int);
|
||
|
#else
|
||
|
int exit(int) __attribute__((noreturn));
|
||
|
#endif
|
||
|
int wait(int*);
|
||
|
int pipe(int*);
|
||
|
int write(int, const void*, int);
|
||
|
int read(int, void*, int);
|
||
|
int close(int);
|
||
|
int kill(int);
|
||
|
int execve(const char*, char**, char**); // New/modified system call
|
||
|
int open(const char*, int);
|
||
|
int mknod(const char*, short, short);
|
||
|
int unlink(const char*);
|
||
|
int fstat(int fd, struct stat*);
|
||
|
int link(const char*, const char*);
|
||
|
int mkdir(const char*);
|
||
|
int chdir(const char*);
|
||
|
int dup(int);
|
||
|
int getpid(void);
|
||
|
char* sbrk(int);
|
||
|
int sleep(int);
|
||
|
int uptime(void);
|
||
|
// New system call, set priority
|
||
|
// first implementation only works/worked on current pid
|
||
|
int prio(int pid, int newprio, int newlimit);
|
||
|
// Set processor affinity, pid must be current pid and range must be 0 for now
|
||
|
int affin(int pid, int range, uint64 mask);
|
||
|
// New system call, start thread
|
||
|
// Typedef for the thread function
|
||
|
typedef void (*thrd_fnc_t)(uint64 arg);
|
||
|
// Less-typesafe version: int thrd(int pid, uint64 fnc, uint64 stk, uint64 arg);
|
||
|
int thrd(int frompid, thrd_fnc_t fnc, void* stk, uint64 arg);
|
||
|
|
||
|
// ulib.c
|
||
|
int exec(const char*, char**); // Now implemented on top of execve
|
||
|
int stat(const char*, struct stat*);
|
||
|
char* strcpy(char*, const char*);
|
||
|
void *memmove(void*, const void*, uint);
|
||
|
char* strchr(const char*, int c);
|
||
|
int strcmp(const char*, const char*);
|
||
|
#ifdef _ZCC
|
||
|
void __classic_call fprintf(int, const char*, ...);
|
||
|
void __classic_call printf(const char*, ...);
|
||
|
#else
|
||
|
void fprintf(int, const char*, ...) __attribute__ ((format (printf, 2, 3)));
|
||
|
void printf(const char*, ...) __attribute__ ((format (printf, 1, 2)));
|
||
|
#endif
|
||
|
char* gets(char*, int max);
|
||
|
long int strlen(const char*);
|
||
|
void* memset(void*, int, long int);
|
||
|
int atoi(const char*);
|
||
|
int memcmp(const void *, const void *, uint);
|
||
|
void *memcpy(void *, const void *, long int);
|
||
|
|
||
|
// umalloc.c
|
||
|
void* malloc(uint);
|
||
|
void free(void*);
|