]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man/man3/telldir.3
man/, share/mk/: Move man*/ to man/
[thirdparty/man-pages.git] / man / man3 / telldir.3
CommitLineData
a1eaacb1 1'\" t
fea681da
MK
2.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3.\"
5fbde956 4.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
5.\"
6.\" References consulted:
7.\" Linux libc source code
8.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
9.\" 386BSD man pages
10.\" Modified Sat Jul 24 17:48:42 1993 by Rik Faith (faith@cs.unc.edu)
4c1c5274 11.TH telldir 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
12.SH NAME
13telldir \- return current location in directory stream
715858f5
AC
14.SH LIBRARY
15Standard C library
8fc3b2cf 16.RI ( libc ", " \-lc )
fea681da
MK
17.SH SYNOPSIS
18.nf
19.B #include <dirent.h>
c6d039a3 20.P
48e39fa7 21.BI "long telldir(DIR *" dirp );
fea681da 22.fi
c6d039a3 23.P
d39ad78f 24.RS -4
cc4615cc
MK
25Feature Test Macro Requirements for glibc (see
26.BR feature_test_macros (7)):
d39ad78f 27.RE
c6d039a3 28.P
cc4615cc 29.BR telldir ():
9d281e06
MK
30.nf
31 _XOPEN_SOURCE
75c018a1
AC
32 || /* glibc >= 2.19: */ _DEFAULT_SOURCE
33 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
9d281e06 34.fi
fea681da 35.SH DESCRIPTION
60a90ecd
MK
36The
37.BR telldir ()
38function returns the current location associated with
6dea120e 39the directory stream \fIdirp\fP.
47297adb 40.SH RETURN VALUE
60a90ecd
MK
41On success, the
42.BR telldir ()
43function returns the current location
cca657e2
MK
44in the directory stream.
45On error, \-1 is returned, and
46.I errno
f6a4078b 47is set to indicate the error.
fea681da
MK
48.SH ERRORS
49.TP
50.B EBADF
6dea120e 51Invalid directory stream descriptor \fIdirp\fP.
f7dbb1ea 52.SH ATTRIBUTES
a257b544
PH
53For an explanation of the terms used in this section, see
54.BR attributes (7).
55.TS
56allbox;
c466875e 57lbx lb lb
a257b544
PH
58l l l.
59Interface Attribute Value
60T{
9e54434e
BR
61.na
62.nh
f7dbb1ea 63.BR telldir ()
a257b544
PH
64T} Thread safety MT-Safe
65.TE
3113c7f3 66.SH STANDARDS
4131356c
AC
67POSIX.1-2008.
68.SH HISTORY
69POSIX.1-2001, 4.3BSD.
c6d039a3 70.P
b324e17d 71Up to glibc 2.1.1, the return type of
48e39fa7
MK
72.BR telldir ()
73was
74.IR off_t .
75POSIX.1-2001 specifies
76.IR long ,
77and this is the type used since glibc 2.1.2.
c6d039a3 78.P
9ee4a2b6 79In early filesystems, the value returned by
73f4bf1e
MK
80.BR telldir ()
81was a simple file offset within a directory.
9ee4a2b6 82Modern filesystems use tree or hash structures, rather than flat tables,
73f4bf1e 83to represent directories.
9ee4a2b6 84On such filesystems, the value returned by
73f4bf1e
MK
85.BR telldir ()
86(and used internally by
87.BR readdir (3))
88is a "cookie" that is used by the implementation
89to derive a position within a directory.
90.\" https://lwn.net/Articles/544298/
91Application programs should treat this strictly as an opaque value, making
92.I no
93assumptions about its contents.
47297adb 94.SH SEE ALSO
fea681da
MK
95.BR closedir (3),
96.BR opendir (3),
97.BR readdir (3),
98.BR rewinddir (3),
99.BR scandir (3),
100.BR seekdir (3)