2014-08-07 17:58:41 -07:00
|
|
|
|
|
|
|
#ifndef __SYSCALL_H__
|
|
|
|
#define __SYSCALL_H__
|
|
|
|
|
2014-12-05 00:25:20 -08:00
|
|
|
#include <sys/stat.h>
|
2015-01-23 13:02:31 -08:00
|
|
|
#include <sys/nic.h>
|
2015-01-27 10:34:44 -08:00
|
|
|
#include <sys/mbuf.h>
|
2015-11-15 15:17:18 -08:00
|
|
|
#include <sys/mount.h>
|
2014-12-05 00:25:20 -08:00
|
|
|
|
2015-01-02 14:04:14 -08:00
|
|
|
uint64_t OSTime();
|
|
|
|
uint64_t OSGetPID();
|
2015-01-18 15:08:12 -08:00
|
|
|
void OSExit(int status);
|
2023-08-20 19:04:28 -04:00
|
|
|
uint64_t OSSpawn(const char *path, const char *argv[]);
|
2015-01-18 15:08:12 -08:00
|
|
|
uint64_t OSWait(uint64_t pid);
|
2014-08-07 17:58:41 -07:00
|
|
|
|
|
|
|
// Memory
|
2015-01-02 14:04:14 -08:00
|
|
|
void *OSMemMap(void *addr, uint64_t len, int flags);
|
|
|
|
int OSMemUnmap(void *addr, uint64_t len);
|
|
|
|
int OSMemProtect(void *addr, uint64_t len, int flags);
|
2014-08-07 17:58:41 -07:00
|
|
|
|
2014-10-14 16:24:47 -07:00
|
|
|
// IO
|
2015-01-02 14:04:14 -08:00
|
|
|
int OSRead(uint64_t fd, void *addr, uint64_t off, uint64_t length);
|
|
|
|
int OSWrite(uint64_t fd, const void *addr, uint64_t off, uint64_t length);
|
|
|
|
int OSFlush(uint64_t fd);
|
|
|
|
uint64_t OSOpen(const char *path, uint64_t flags);
|
|
|
|
int OSClose(uint64_t fd);
|
2014-10-14 16:24:47 -07:00
|
|
|
|
2014-12-05 00:25:20 -08:00
|
|
|
// Directory
|
2015-01-02 14:04:14 -08:00
|
|
|
int OSStat(const char *path, struct stat *sb);
|
|
|
|
int OSReadDir(uint64_t fd, char *buf, size_t length, uint64_t *offset);
|
2014-12-05 00:25:20 -08:00
|
|
|
|
2014-11-29 15:46:17 -08:00
|
|
|
// Threads
|
2015-01-16 17:57:21 -08:00
|
|
|
int OSThreadCreate(uint64_t rip, uint64_t arg);
|
2015-01-30 20:43:28 -08:00
|
|
|
int OSGetTID();
|
2015-01-14 14:57:47 -08:00
|
|
|
int OSThreadExit(uint64_t status);
|
2015-01-02 14:04:14 -08:00
|
|
|
int OSThreadSleep(uint64_t time);
|
2015-01-14 14:57:47 -08:00
|
|
|
int OSThreadWait(uint64_t tid);
|
2014-11-29 15:46:17 -08:00
|
|
|
|
2015-01-23 13:02:31 -08:00
|
|
|
// Network
|
|
|
|
int OSNICStat(uint64_t nicNo, NIC *nic);
|
2015-01-27 10:34:44 -08:00
|
|
|
int OSNICSend(uint64_t nicNo, MBuf *mbuf);
|
|
|
|
int OSNICRecv(uint64_t nicNo, MBuf *mbuf);
|
2015-01-23 13:02:31 -08:00
|
|
|
|
2015-11-15 15:17:18 -08:00
|
|
|
// System
|
|
|
|
int OSSysCtl(const char *node, void *oldval, void *newval);
|
|
|
|
int OSFSMount(const char *mntpt, const char *device, uint64_t flags);
|
|
|
|
int OSFSUnmount(const char *mntpt);
|
|
|
|
int OSFSInfo(struct statfs *info, uint64_t max);
|
|
|
|
|
2014-08-07 17:58:41 -07:00
|
|
|
#endif /* __SYSCALL_H__ */
|
|
|
|
|