Home
last modified time | relevance | path

Searched refs:dirp (Results 1 – 25 of 116) sorted by relevance

12345

/freebsd/lib/libc/gen/
H A Dreaddir.c48 _readdir_unlocked(DIR *dirp, int flags) in _readdir_unlocked() argument
56 if (dirp->dd_loc >= dirp->dd_size) { in _readdir_unlocked()
57 if (dirp->dd_flags & __DTF_READALL) in _readdir_unlocked()
59 initial_loc = dirp->dd_loc; in _readdir_unlocked()
60 dirp->dd_flags &= ~__DTF_SKIPREAD; in _readdir_unlocked()
61 dirp->dd_loc = 0; in _readdir_unlocked()
63 if (dirp->dd_loc == 0 && in _readdir_unlocked()
64 !(dirp->dd_flags & (__DTF_READALL | __DTF_SKIPREAD))) { in _readdir_unlocked()
65 dirp->dd_size = 0; in _readdir_unlocked()
66 initial_seek = dirp->dd_seek; in _readdir_unlocked()
[all …]
H A Dtelldir.c49 telldir(DIR *dirp) in telldir() argument
55 _pthread_mutex_lock(&dirp->dd_lock); in telldir()
62 if (dirp->dd_seek < (off_t)(1l << DD_SEEK_BITS) && in telldir()
63 dirp->dd_loc < (1l << DD_LOC_BITS)) { in telldir()
65 ddloc.s.loc = dirp->dd_loc; in telldir()
66 ddloc.s.seek = dirp->dd_seek; in telldir()
71 LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) { in telldir()
72 if (lp->loc_seek == dirp->dd_seek) { in telldir()
75 if (lp->loc_loc == dirp->dd_loc) in telldir()
86 _pthread_mutex_unlock(&dirp->dd_lock); in telldir()
[all …]
H A Dopendir2.c86 _filldir(DIR *dirp, bool use_current_pos) in _filldir() argument
121 if ((fd2 = _openat(dirp->dd_fd, ".", O_RDONLY | O_CLOEXEC)) == -1) in _filldir()
125 pos = lseek(dirp->dd_fd, 0, SEEK_CUR); in _filldir()
152 n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek); in _filldir()
172 dirp->dd_buf = buf; in _filldir()
227 (dirp->dd_flags & DTF_HIDEW)) in _filldir()
240 dirp->dd_len = len; in _filldir()
241 dirp->dd_size = ddptr - dirp->dd_buf; in _filldir()
265 DIR *dirp; in __opendir_common() local
271 if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL) in __opendir_common()
[all …]
H A Dclosedir.c48 fdclosedir(DIR *dirp) in fdclosedir() argument
53 _pthread_mutex_lock(&dirp->dd_lock); in fdclosedir()
54 fd = dirp->dd_fd; in fdclosedir()
55 dirp->dd_fd = -1; in fdclosedir()
56 dirp->dd_loc = 0; in fdclosedir()
57 free((void *)dirp->dd_buf); in fdclosedir()
58 free(dirp->dd_compat_de); in fdclosedir()
59 _reclaim_telldir(dirp); in fdclosedir()
61 _pthread_mutex_unlock(&dirp->dd_lock); in fdclosedir()
62 _pthread_mutex_destroy(&dirp->dd_lock); in fdclosedir()
[all …]
H A Drewinddir.c44 rewinddir(DIR *dirp) in rewinddir() argument
47 _pthread_mutex_lock(&dirp->dd_lock); in rewinddir()
48 dirp->dd_flags &= ~__DTF_SKIPREAD; /* current contents are invalid */ in rewinddir()
49 if (dirp->dd_flags & __DTF_READALL) in rewinddir()
50 _filldir(dirp, false); in rewinddir()
52 (void) lseek(dirp->dd_fd, 0, SEEK_SET); in rewinddir()
53 dirp->dd_seek = 0; in rewinddir()
55 dirp->dd_loc = 0; in rewinddir()
56 _reclaim_telldir(dirp); in rewinddir()
58 _pthread_mutex_unlock(&dirp->dd_lock); in rewinddir()
H A Dreaddir-compat11.c67 freebsd11_readdir(DIR *dirp) in freebsd11_readdir() argument
73 _pthread_mutex_lock(&dirp->dd_lock); in freebsd11_readdir()
74 dp = _readdir_unlocked(dirp, RDU_SKIP); in freebsd11_readdir()
76 if (dirp->dd_compat_de == NULL) in freebsd11_readdir()
77 dirp->dd_compat_de = malloc(sizeof(struct in freebsd11_readdir()
79 if (freebsd11_cvtdirent(dirp->dd_compat_de, dp)) in freebsd11_readdir()
80 dstdp = dirp->dd_compat_de; in freebsd11_readdir()
86 _pthread_mutex_unlock(&dirp->dd_lock); in freebsd11_readdir()
92 freebsd11_readdir_r(DIR *dirp, struct freebsd11_dirent *entry, in freebsd11_readdir_r() argument
98 error = __readdir_r(dirp, &xentry, &xresult); in freebsd11_readdir_r()
H A Dscandir.c68 scandir_dirp_b(DIR *dirp, struct dirent ***namelist, select_block select, in scandir_dirp_b() argument
71 scandir_dirp(DIR *dirp, struct dirent ***namelist, in scandir_dirp_b()
84 while (errno = 0, (d = readdir(dirp)) != NULL) { in scandir_dirp_b()
151 DIR *dirp; in scandir_b() local
154 dirp = opendir(dirname); in scandir_b()
155 if (dirp == NULL) in scandir_b()
163 (dirp, namelist, select, dcomp); in scandir_b()
165 closedir(dirp); in scandir_b()
180 DIR *dirp; in fdscandir_b() local
183 dirp = fdopendir(dirfd); in fdscandir_b()
[all …]
H A Ddirfd.c38 dirfd(DIR *dirp) in dirfd() argument
40 if (dirp == NULL || _dirfd(dirp) < 0) { in dirfd()
44 return (_dirfd(dirp)); in dirfd()
H A Dseekdir.c47 seekdir(DIR *dirp, long loc) in seekdir() argument
50 _pthread_mutex_lock(&dirp->dd_lock); in seekdir()
51 _seekdir(dirp, loc); in seekdir()
53 _pthread_mutex_unlock(&dirp->dd_lock); in seekdir()
H A Dscandir-compat11.c67 DIR *dirp; in freebsd11_scandir() local
69 if ((dirp = opendir(dirname)) == NULL) in freebsd11_scandir()
79 while ((d = freebsd11_readdir(dirp)) != NULL) { in freebsd11_scandir()
111 closedir(dirp); in freebsd11_scandir()
122 closedir(dirp); in freebsd11_scandir()
H A Dgen-private.h61 #define _dirfd(dirp) ((dirp)->dd_fd) argument
64 int __readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
/freebsd/sbin/fsck_ffs/
H A Dpass2.c280 struct direct *dirp = idesc->id_dirp; in pass2check() local
294 if (dirp->d_ino != 0 && strcmp(dirp->d_name, ".") == 0) { in pass2check()
295 if (dirp->d_ino != idesc->id_number) { in pass2check()
298 dirp->d_ino = idesc->id_number; in pass2check()
302 if (dirp->d_type != DT_DIR) { in pass2check()
305 dirp->d_type = DT_DIR; in pass2check()
318 if (dirp->d_reclen < entrysize + DIRSIZ(0, dirp)) { in pass2check()
320 if (dirp->d_ino != 0) { in pass2check()
322 dirp->d_name); in pass2check()
327 proto.d_reclen = dirp->d_reclen; in pass2check()
[all …]
H A Ddir.c527 struct direct *dirp = idesc->id_dirp; in mkentry() local
533 if (dirp->d_ino != 0) in mkentry()
534 oldlen = DIRSIZ(0, dirp); in mkentry()
537 if (dirp->d_reclen - oldlen < newlen) in mkentry()
539 newent.d_reclen = dirp->d_reclen - oldlen; in mkentry()
540 dirp->d_reclen = oldlen; in mkentry()
541 dirp = (struct direct *)(((char *)dirp) + oldlen); in mkentry()
542 dirp->d_ino = idesc->id_parent; /* ino to be entered is in id_parent */ in mkentry()
543 dirp in mkentry()
553 struct direct *dirp = idesc->id_dirp; chgino() local
917 struct dirtemplate *dirp; allocdir() local
[all...]
/freebsd/lib/libc/tests/gen/
H A Ddir2_test.c53 DIR *dirp; in ATF_TC_BODY() local
78 dirp = fdopendir(dd); in ATF_TC_BODY()
80 beginning = telldir(dirp); in ATF_TC_BODY()
82 de = readdir(dirp); in ATF_TC_BODY()
85 middle = telldir(dirp); in ATF_TC_BODY()
87 de = readdir(dirp); in ATF_TC_BODY()
90 end = telldir(dirp); in ATF_TC_BODY()
98 seekdir(dirp, beginning); in ATF_TC_BODY()
99 td = telldir(dirp); in ATF_TC_BODY()
101 ATF_REQUIRE_MSG(NULL != readdir(dirp), "invalid directory index"); in ATF_TC_BODY()
[all …]
H A Dopendir_test.c32 opendir_check(const struct atf_tc *tc, DIR *dirp) in opendir_check() argument
36 ATF_REQUIRE((ent = readdir(dirp)) != NULL); in opendir_check()
40 ATF_REQUIRE((ent = readdir(dirp)) != NULL); in opendir_check()
44 ATF_REQUIRE((ent = readdir(dirp)) != NULL); in opendir_check()
48 ATF_CHECK(readdir(dirp) == NULL); in opendir_check()
49 ATF_CHECK(readdir(dirp) == NULL); in opendir_check()
59 DIR *dirp; in ATF_TC_BODY() local
62 ATF_REQUIRE((dirp = opendir("dir")) != NULL); in ATF_TC_BODY()
63 opendir_check(tc, dirp); in ATF_TC_BODY()
64 ATF_CHECK_EQ(0, closedir(dirp)); in ATF_TC_BODY()
[all …]
/freebsd/sbin/restore/
H A Ddirs.c103 static RST_DIR *dirp; variable
183 dirp = opendirfile(dirfile); in extractdirs()
184 if (dirp == NULL) in extractdirs()
238 rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt); in treescan()
239 dp = rst_readdir(dirp); /* "." */ in treescan()
241 dp = rst_readdir(dirp); /* ".." */ in treescan()
246 dp = rst_readdir(dirp); /* first real entry */ in treescan()
250 bpt = rst_telldir(dirp); in treescan()
262 rst_seekdir(dirp, bpt, itp->t_seekpt); in treescan()
264 dp = rst_readdir(dirp); in treescan()
[all …]
/freebsd/tools/test/stress2/misc/
H A Dseekdir.sh49 SeekDir(DIR *dirp, long loc)
52 seekdir(dirp, loc);
56 TellDir(DIR *dirp)
60 loc = telldir(dirp);
68 DIR *dirp;
94 dirp = opendir(".");
95 offset = TellDir(dirp);
110 if ((dp = readdir(dirp)) != NULL) {
117 offset = TellDir(dirp);
132 SeekDir(dirp, prev_offset);
[all …]
/freebsd/usr.sbin/rpc.umntall/
H A Dmounttab.c55 add_mtab(char *hostp, char *dirp) in add_mtab() argument
63 (long)time(NULL), hostp, dirp); in add_mtab()
76 char *hostp, *dirp, *cp; in read_mtab() local
108 dirp = strsep(&cp, " \t\n"); in read_mtab()
109 if (dirp == NULL || *dirp == '\0') { in read_mtab()
110 badline("dir", dirp); in read_mtab()
127 memmove(mtabp->mtab_dirp, dirp, MNTPATHLEN); in read_mtab()
186 clean_mtab(char *hostp, char *dirp, int verbose) in clean_mtab() argument
196 if (dirp != NULL && strcmp(mtabp->mtab_dirp, dirp) != 0) in clean_mtab()
201 (dirp == NULL) ? " by host" : "", in clean_mtab()
H A Drpc.umntall.c197 do_umount(char *hostname, char *dirp) { in do_umount() argument
211 clnt_stat = clnt_call(clp, MOUNTPROC_UMNT, (xdrproc_t)xdr_dir, dirp, in do_umount()
224 is_mounted(char *hostname, char *dirp) { in is_mounted() argument
230 if (strlen(hostname) + strlen(dirp) >= MNAMELEN) in is_mounted()
232 snprintf(name, sizeof(name), "%s:%s", hostname, dirp); in is_mounted()
254 xdr_dir(XDR *xdrsp, char *dirp) { in xdr_dir() argument
255 return (xdr_string(xdrsp, &dirp, MNTPATHLEN)); in xdr_dir()
/freebsd/libexec/tftpd/
H A Dtftpd.c196 struct dirlist *dirp; in main() local
199 for (dirp = dirs; optind < argc && dirp < &dirs[MAXDIRS]; in main()
202 dirp->name = argv[optind]; in main()
203 dirp->len = strlen(dirp->name); in main()
204 dirp++; in main()
692 struct dirlist *dirp; in validate_access() local
708 for (dirp = dirs; dirp->name != NULL; dirp++) { in validate_access()
709 if (dirp->len == 1) in validate_access()
712 if (strncmp(filename, dirp->name, dirp->len) == 0 && in validate_access()
713 filename[dirp->len] == '/') in validate_access()
[all …]
/freebsd/contrib/kyua/utils/fs/
H A Dlua_module.cpp177 DIR** dirp = state.to_userdata< DIR* >(state.upvalue_index(1)); in files_iterator() local
178 const struct dirent* entry = ::readdir(*dirp); in files_iterator()
207 DIR** dirp = state.to_userdata< DIR* >(-1); in files_gc() local
210 if (*dirp != NULL) { in files_gc()
211 ::closedir(*dirp); in files_gc()
212 *dirp = NULL; in files_gc()
234 DIR** dirp = state.new_userdata< DIR* >(); in lua_fs_files() local
243 *dirp = ::opendir(path.c_str()); in lua_fs_files()
244 if (*dirp == NULL) { in lua_fs_files()
/freebsd/share/examples/sunrpc/dir/
H A Ddir_proc.c16 DIR *dirp; local
25 dirp = opendir(*dirname);
26 if (dirp == NULL) {
40 while (d = readdir(dirp)) {
52 closedir(dirp);
/freebsd/tools/build/cross-build/
H A Dclosefrom.c130 DIR *dirp; in closefrom_procfs() local
144 dirp = opendir(path); in closefrom_procfs()
145 if (dirp == NULL) in closefrom_procfs()
148 while ((dent = readdir(dirp)) != NULL) { in closefrom_procfs()
153 if (errstr != NULL || fd == dirfd(dirp)) in closefrom_procfs()
179 (void)closedir(dirp); in closefrom_procfs()
/freebsd/usr.sbin/lpr/lpq/
H A Dlpq.c161 DIR *dirp; in ckqueue() local
165 if ((dirp = opendir(spooldir)) == NULL) in ckqueue()
167 while ((d = readdir(dirp)) != NULL) { in ckqueue()
170 closedir(dirp); in ckqueue()
173 closedir(dirp); in ckqueue()
/freebsd/crypto/openssh/openbsd-compat/
H A Dbsd-closefrom.c128 DIR *dirp; in closefrom() local
138 if (len > 0 && (size_t)len < sizeof(fdpath) && (dirp = opendir(fdpath))) { in closefrom()
139 while ((dent = readdir(dirp)) != NULL) { in closefrom()
142 fd >= 0 && fd < INT_MAX && fd >= lowfd && fd != dirfd(dirp)) in closefrom()
145 (void) closedir(dirp); in closefrom()

12345