mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:07:34 +00:00
More work towards getting bash to build.
Implemented some syscalls: dup(), dup2(), getdtablesize(). FileHandle is now a retainable, since that's needed for dup()'ed fd's. I didn't really test any of this beyond a basic smoke check.
This commit is contained in:
parent
82f84bab11
commit
9f2b9c82bf
17 changed files with 114 additions and 23 deletions
|
@ -3,6 +3,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
|
||||
extern "C" {
|
||||
|
@ -20,6 +21,16 @@ DIR* opendir(const char* name)
|
|||
return dirp;
|
||||
}
|
||||
|
||||
int closedir(DIR* dirp)
|
||||
{
|
||||
if (!dirp || dirp->fd == -1)
|
||||
return -EBADF;
|
||||
int rc = close(dirp->fd);
|
||||
if (rc == 0)
|
||||
dirp->fd = -1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
struct sys_dirent {
|
||||
ino_t ino;
|
||||
byte file_type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue