~ubuntu-branches/ubuntu/precise/manpages-posix/precise

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "SEEKDIR" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" seekdir 
.SH NAME
seekdir \- set the position of a directory stream
.SH SYNOPSIS
.LP
\fB#include <dirent.h>
.br
.sp
void seekdir(DIR *\fP\fIdirp\fP\fB, long\fP \fIloc\fP\fB); \fP
\fB
.br
\fP
.SH DESCRIPTION
.LP
The \fIseekdir\fP() function shall set the position of the next \fIreaddir\fP()
operation on the directory stream specified by \fIdirp\fP to the position
specified by \fIloc\fP. The value of \fIloc\fP should
have been returned from an earlier call to \fItelldir\fP(). The new
position reverts to
the one associated with the directory stream when \fItelldir\fP()
was performed.
.LP
If the value of \fIloc\fP was not obtained from an earlier call to
\fItelldir\fP(), or
if a call to \fIrewinddir\fP() occurred between the call to \fItelldir\fP()
and the call to \fIseekdir\fP(), the results of subsequent calls to
\fIreaddir\fP() are unspecified.
.SH RETURN VALUE
.LP
The \fIseekdir\fP() function shall not return a value.
.SH ERRORS
.LP
No errors are defined.
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.LP
None.
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
The original standard developers perceived that there were restrictions
on the use of the \fIseekdir\fP() and \fItelldir\fP() functions related
to implementation details, and for that reason these functions
need not be supported on all POSIX-conforming systems. They are required
on implementations supporting the XSI extension.
.LP
One of the perceived problems of implementation is that returning
to a given point in a directory is quite difficult to describe
formally, in spite of its intuitive appeal, when systems that use
B-trees, hashing functions, or other similar mechanisms to order
their directories are considered. The definition of \fIseekdir\fP()
and \fItelldir\fP()
does not specify whether, when using these interfaces, a given directory
entry will be seen at all, or more than once.
.LP
On systems not supporting these functions, their capability can sometimes
be accomplished by saving a filename found by \fIreaddir\fP() and
later using \fIrewinddir\fP() and a
loop on \fIreaddir\fP() to relocate the position from which the filename
was saved.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIopendir\fP() , \fIreaddir\fP() , \fItelldir\fP() , the Base Definitions
volume of IEEE\ Std\ 1003.1-2001, \fI<dirent.h>\fP, \fI<stdio.h>\fP,
\fI<sys/types.h>\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .