Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/lib/ape/man/3/seekdir

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "SEEKDIR" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" seekdir 
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.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 .

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].