11 typedef struct DirStor {
25 struct fdopendir_args {
37 RUNESYSCALL(opendir) (struct opendir_args *args, int *resp)
39 DirStor *ds = args->ds;
40 const char *path = args->path;
42 ds->dir = opendir(path);
43 if (ds->dir == NULL) {
53 RUNESYSCALL(fdopendir) (struct fdopendir_args *args, int *resp)
55 DirStor *ds = args->ds;
57 ds->dir = fdopendir(args->fd);
58 if (ds->dir == NULL) {
68 RUNESYSCALL(readdir) (DirStor *ds, int *resp)
74 den = readdir(ds->dir);
75 ptr = ds->namelvs.lv_Addr;
76 type = ds->namelvs.lv_Type;
78 ds->type = den->d_type;
79 ds->namlen = den->d_namlen;
81 dassert(ds->namlen + 1 <= type->ty_Bytes);
82 bcopy(den->d_name, ptr, ds->namlen);
89 dassert(1 <= type->ty_Bytes);
96 RUNESYSCALL(rewinddir) (DirStor *ds, void *resp __unused)
103 RUNESYSCALL(closedir) (DirStor *ds, void *resp __unused)
112 RUNESYSCALL(dirfd) (DirStor *ds, int *resp)
115 *resp = dirfd(ds->dir);