mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-06 21:45:29 +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:
@@ -193,6 +193,17 @@ FILE* fopen(const char* pathname, const char* mode)
|
||||
return fp;
|
||||
}
|
||||
|
||||
FILE* fdopen(int fd, const char* mode)
|
||||
{
|
||||
assert(!strcmp(mode, "r") || !strcmp(mode, "rb"));
|
||||
if (fd < 0)
|
||||
return nullptr;
|
||||
auto* fp = (FILE*)malloc(sizeof(FILE));
|
||||
fp->fd = fd;
|
||||
fp->eof = false;
|
||||
return fp;
|
||||
}
|
||||
|
||||
int fclose(FILE* stream)
|
||||
{
|
||||
int rc = close(stream->fd);
|
||||
|
||||
Reference in New Issue
Block a user