4 #include <sys/dirent.h>
11 __export
DIR *opendir(const char *path
)
16 rv
= searchdir(path
, O_RDONLY
|O_DIRECTORY
);
20 file
= handle_to_file(rv
);
22 if (file
->inode
->mode
!= DT_DIR
) {
31 * Read one directory entry at one time.
33 __export
struct dirent
*readdir(DIR *dir
)
35 static struct dirent buf
;
36 struct file
*dd_dir
= (struct file
*)dir
;
40 if (dd_dir
->fs
->fs_ops
->readdir
) {
41 rv
= dd_dir
->fs
->fs_ops
->readdir(dd_dir
, &buf
);
45 return rv
< 0 ? NULL
: &buf
;
51 __export
int closedir(DIR *dir
)
53 struct file
*dd_dir
= (struct file
*)dir
;