1SEEKDIR(3P) POSIX Programmer's Manual SEEKDIR(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 seekdir — set the position of a directory stream
14
16 #include <dirent.h>
17
18 void seekdir(DIR *dirp, long loc);
19
21 The seekdir() function shall set the position of the next readdir()
22 operation on the directory stream specified by dirp to the position
23 specified by loc. The value of loc should have been returned from an
24 earlier call to telldir() using the same directory stream. The new
25 position reverts to the one associated with the directory stream when
26 telldir() was performed.
27
28 If the value of loc was not obtained from an earlier call to telldir(),
29 or if a call to rewinddir() occurred between the call to telldir() and
30 the call to seekdir(), the results of subsequent calls to readdir() are
31 unspecified.
32
34 The seekdir() function shall not return a value.
35
37 No errors are defined.
38
39 The following sections are informative.
40
42 None.
43
45 None.
46
48 The original standard developers perceived that there were restrictions
49 on the use of the seekdir() and telldir() functions related to imple‐
50 mentation details, and for that reason these functions need not be sup‐
51 ported on all POSIX-conforming systems. They are required on implemen‐
52 tations supporting the XSI option.
53
54 One of the perceived problems of implementation is that returning to a
55 given point in a directory is quite difficult to describe formally, in
56 spite of its intuitive appeal, when systems that use B-trees, hashing
57 functions, or other similar mechanisms to order their directories are
58 considered. The definition of seekdir() and telldir() does not specify
59 whether, when using these interfaces, a given directory entry will be
60 seen at all, or more than once.
61
62 On systems not supporting these functions, their capability can some‐
63 times be accomplished by saving a filename found by readdir() and later
64 using rewinddir() and a loop on readdir() to relocate the position from
65 which the filename was saved.
66
68 None.
69
71 fdopendir(), readdir(), telldir()
72
73 The Base Definitions volume of POSIX.1‐2008, <dirent.h>, <sys_types.h>
74
76 Portions of this text are reprinted and reproduced in electronic form
77 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
78 -- Portable Operating System Interface (POSIX), The Open Group Base
79 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
80 cal and Electronics Engineers, Inc and The Open Group. (This is
81 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
82 event of any discrepancy between this version and the original IEEE and
83 The Open Group Standard, the original IEEE and The Open Group Standard
84 is the referee document. The original Standard can be obtained online
85 at http://www.unix.org/online.html .
86
87 Any typographical or formatting errors that appear in this page are
88 most likely to have been introduced during the conversion of the source
89 files to man page format. To report such errors, see https://www.ker‐
90 nel.org/doc/man-pages/reporting_bugs.html .
91
92
93
94IEEE/The Open Group 2013 SEEKDIR(3P)