LibC: Implement dirfd().

This commit is contained in:
Andreas Kling 2019-06-03 18:42:40 +02:00
parent 3fa0b6cd92
commit 8af495495b
Notes: sideshowbarker 2024-07-19 13:45:58 +09:00
2 changed files with 17 additions and 9 deletions

View File

@ -1,14 +1,15 @@
#include <dirent.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <AK/Assertions.h>
#include <AK/StdLibExtras.h>
#include <Kernel/Syscall.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <unistd.h>
extern "C" {
@ -85,5 +86,11 @@ dirent* readdir(DIR* dirp)
return &dirp->cur_ent;
}
int dirfd(DIR* dirp)
{
ASSERT(dirp);
return dirp->fd;
}
}

View File

@ -25,5 +25,6 @@ typedef struct __DIR DIR;
DIR* opendir(const char* name);
int closedir(DIR*);
struct dirent* readdir(DIR*);
int dirfd(DIR*);
__END_DECLS