Add support for fflush and close syscalls
This commit is contained in:
@@ -64,4 +64,28 @@ int32_t openat(int32_t fd, const char* filename, uint32_t flags, uint32_t mode)
|
||||
return file;
|
||||
}
|
||||
|
||||
#define SYS_CLOSE 3
|
||||
int close(unsigned int fd) {
|
||||
int rtn;
|
||||
asm volatile(
|
||||
"syscall"
|
||||
: "=a"(rtn)
|
||||
: "a"(SYS_CLOSE), "D"(fd)
|
||||
: "rcx", "r11"
|
||||
);
|
||||
return rtn;
|
||||
}
|
||||
|
||||
#define SYS_FSYNC 74
|
||||
int fsync(unsigned int fd) {
|
||||
int rtn;
|
||||
asm volatile(
|
||||
"syscall"
|
||||
: "=a"(rtn)
|
||||
: "a"(SYS_FSYNC), "D"(fd)
|
||||
: "rcx", "r11"
|
||||
);
|
||||
return rtn;
|
||||
}
|
||||
|
||||
#endif /* ifdef __x86_64__ */
|
||||
|
||||
Reference in New Issue
Block a user