This adds the fchdir syscall and a new opendir() function.
diff -purNx linux ../klibc-0.172/klibc/SYSCALLS.def ./klibc/SYSCALLS.def
--- ../klibc-0.172/klibc/SYSCALLS.def 2004-08-25 23:56:49.000000000 +0200
+++ ./klibc/SYSCALLS.def 2004-09-11 20:46:10.187551992 +0200
@@ -86,6 +86,7 @@ int access(const char *, int)
int link(const char *, const char *)
int unlink(const char *)
int chdir(const char *)
+int fchdir(int)
int rename(const char *, const char *)
int mknod(const char *, mode_t, dev_t)
int chmod(const char *, mode_t)
diff -purNx linux ../klibc-0.172/klibc/include/dirent.h ./klibc/include/dirent.h
--- ../klibc-0.172/klibc/include/dirent.h 2002-08-11 06:35:43.000000000 +0200
+++ ./klibc/include/dirent.h 2004-09-11 20:57:27.268620024 +0200
@@ -16,5 +16,6 @@ typedef struct _IO_dir DIR;
__extern DIR *opendir(const char *);
__extern struct dirent *readdir(DIR *);
__extern int closedir(DIR *);
+__extern int dirfd (DIR *);
#endif /* _DIRENT_H */
diff -purNx linux ../klibc-0.172/klibc/include/unistd.h ./klibc/include/unistd.h
--- ../klibc-0.172/klibc/include/unistd.h 2004-08-25 23:56:50.000000000 +0200
+++ ./klibc/include/unistd.h 2004-09-11 21:06:09.259265384 +0200
@@ -60,6 +60,7 @@ __extern int access(const char *, int);
__extern int link(const char *, const char *);
__extern int unlink(const char *);
__extern int chdir(const char *);
+__extern int fchdir(int);
__extern int chmod(const char *, mode_t);
__extern int fchmod(int, mode_t);
__extern int mkdir(const char *, mode_t);
diff -purNx linux ../klibc-0.172/klibc/readdir.c ./klibc/readdir.c
--- ../klibc-0.172/klibc/readdir.c 2004-07-27 00:10:31.000000000 +0200
+++ ./klibc/readdir.c 2004-09-11 21:00:34.842104520 +0200
@@ -65,3 +65,8 @@ int closedir(DIR *dir)
free(dir);
return rv;
}
+
+int dirfd(DIR *dir)
+{
+ return dir->fd;
+}