]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/telldir.3
Many pages: Fix style issues reported by `make lint-groff`
[thirdparty/man-pages.git] / man3 / telldir.3
CommitLineData
fea681da
MK
1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2.\"
5fbde956 3.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
4.\"
5.\" References consulted:
6.\" Linux libc source code
7.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
8.\" 386BSD man pages
9.\" Modified Sat Jul 24 17:48:42 1993 by Rik Faith (faith@cs.unc.edu)
1ae6b2c7 10.TH TELLDIR 3 2021-03-22 GNU "Linux Programmer's Manual"
fea681da
MK
11.SH NAME
12telldir \- return current location in directory stream
715858f5
AC
13.SH LIBRARY
14Standard C library
8fc3b2cf 15.RI ( libc ", " \-lc )
fea681da
MK
16.SH SYNOPSIS
17.nf
18.B #include <dirent.h>
68e4db0a 19.PP
48e39fa7 20.BI "long telldir(DIR *" dirp );
fea681da 21.fi
68e4db0a 22.PP
d39ad78f 23.RS -4
cc4615cc
MK
24Feature Test Macro Requirements for glibc (see
25.BR feature_test_macros (7)):
d39ad78f 26.RE
68e4db0a 27.PP
cc4615cc 28.BR telldir ():
9d281e06
MK
29.nf
30 _XOPEN_SOURCE
31 || /* Glibc since 2.19: */ _DEFAULT_SOURCE
32 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
33.fi
fea681da 34.SH DESCRIPTION
60a90ecd
MK
35The
36.BR telldir ()
37function returns the current location associated with
6dea120e 38the directory stream \fIdirp\fP.
47297adb 39.SH RETURN VALUE
60a90ecd
MK
40On success, the
41.BR telldir ()
42function returns the current location
cca657e2
MK
43in the directory stream.
44On error, \-1 is returned, and
45.I errno
f6a4078b 46is set to indicate the error.
fea681da
MK
47.SH ERRORS
48.TP
49.B EBADF
6dea120e 50Invalid directory stream descriptor \fIdirp\fP.
f7dbb1ea 51.SH ATTRIBUTES
a257b544
PH
52For an explanation of the terms used in this section, see
53.BR attributes (7).
c466875e
MK
54.ad l
55.nh
a257b544
PH
56.TS
57allbox;
c466875e 58lbx lb lb
a257b544
PH
59l l l.
60Interface Attribute Value
61T{
f7dbb1ea 62.BR telldir ()
a257b544
PH
63T} Thread safety MT-Safe
64.TE
c466875e
MK
65.hy
66.ad
67.sp 1
47297adb 68.SH CONFORMING TO
12c3c485 69POSIX.1-2001, POSIX.1-2008, 4.3BSD.
48e39fa7
MK
70.SH NOTES
71In glibc up to version 2.1.1, the return type of
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.
847e0d88 78.PP
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)