1SEEKDIR(3P)                POSIX Programmer's Manual               SEEKDIR(3P)
2
3
4

PROLOG

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

NAME

12       seekdir — set the position of a directory stream
13

SYNOPSIS

15       #include <dirent.h>
16
17       void seekdir(DIR *dirp, long loc);
18

DESCRIPTION

20       The seekdir() function shall set the position  of  the  next  readdir()
21       operation  on  the  directory  stream specified by dirp to the position
22       specified by loc.  The value of loc should have been returned  from  an
23       earlier  call  to  telldir()  using  the same directory stream. The new
24       position reverts to the one associated with the directory  stream  when
25       telldir() was performed.
26
27       If the value of loc was not obtained from an earlier call to telldir(),
28       or if a call to rewinddir() occurred between the call to telldir()  and
29       the call to seekdir(), the results of subsequent calls to readdir() are
30       unspecified.
31

RETURN VALUE

33       The seekdir() function shall not return a value.
34

ERRORS

36       No errors are defined.
37
38       The following sections are informative.
39

EXAMPLES

41       None.
42

APPLICATION USAGE

44       None.
45

RATIONALE

47       The original standard developers perceived that there were restrictions
48       on  the  use of the seekdir() and telldir() functions related to imple‐
49       mentation details, and for that reason these functions need not be sup‐
50       ported  on all POSIX-conforming systems. They are required on implemen‐
51       tations supporting the XSI option.
52
53       One of the perceived problems of implementation is that returning to  a
54       given  point in a directory is quite difficult to describe formally, in
55       spite of its intuitive appeal, when systems that use  B-trees,  hashing
56       functions,  or  other similar mechanisms to order their directories are
57       considered. The definition of seekdir() and telldir() does not  specify
58       whether,  when  using these interfaces, a given directory entry will be
59       seen at all, or more than once.
60
61       On systems not supporting these functions, their capability  can  some‐
62       times be accomplished by saving a filename found by readdir() and later
63       using rewinddir() and a loop on readdir() to relocate the position from
64       which the filename was saved.
65

FUTURE DIRECTIONS

67       None.
68

SEE ALSO

70       fdopendir(), readdir(), telldir()
71
72       The Base Definitions volume of POSIX.1‐2017, <dirent.h>, <sys_types.h>
73
75       Portions  of  this text are reprinted and reproduced in electronic form
76       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
77       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
78       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
79       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
80       event of any discrepancy between this version and the original IEEE and
81       The  Open Group Standard, the original IEEE and The Open Group Standard
82       is the referee document. The original Standard can be  obtained  online
83       at http://www.opengroup.org/unix/online.html .
84
85       Any  typographical  or  formatting  errors that appear in this page are
86       most likely to have been introduced during the conversion of the source
87       files  to  man page format. To report such errors, see https://www.ker
88       nel.org/doc/man-pages/reporting_bugs.html .
89
90
91
92IEEE/The Open Group                  2017                          SEEKDIR(3P)
Impressum