LibC: implement close

This commit is contained in:
Bananymous 2023-06-11 01:10:28 +03:00
parent 52c4eebd77
commit f0b22c48b2
2 changed files with 6 additions and 1 deletions

View File

@ -52,7 +52,7 @@ char* ctermid(char* buffer)
int fclose(FILE* file) int fclose(FILE* file)
{ {
if (syscall(SYS_CLOSE, file->fd) < 0) if (close(file->fd) == -1)
return EOF; return EOF;
file->fd = -1; file->fd = -1;
return 0; return 0;

View File

@ -187,6 +187,11 @@ long syscall(long syscall, ...)
return ret; return ret;
} }
int close(int fd)
{
return syscall(SYS_CLOSE, fd);
}
int execl(const char* pathname, const char* arg0, ...) int execl(const char* pathname, const char* arg0, ...)
{ {
if (arg0 == nullptr) if (arg0 == nullptr)