1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" References consulted:
6 .\" Linux libc source code
7 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
9 .\" Modified Sat Jul 24 17:48:42 1993 by Rik Faith (faith@cs.unc.edu)
10 .TH TELLDIR 3 2021-03-22 "" "Linux Programmer's Manual"
12 telldir \- return current location in directory stream
15 .RI ( libc ", " \-lc )
18 .B #include <dirent.h>
20 .BI "long telldir(DIR *" dirp );
24 Feature Test Macro Requirements for glibc (see
25 .BR feature_test_macros (7)):
31 || /* Glibc since 2.19: */ _DEFAULT_SOURCE
32 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
37 function returns the current location associated with
38 the directory stream \fIdirp\fP.
42 function returns the current location
43 in the directory stream.
44 On error, \-1 is returned, and
46 is set to indicate the error.
50 Invalid directory stream descriptor \fIdirp\fP.
52 For an explanation of the terms used in this section, see
60 Interface Attribute Value
63 T} Thread safety MT-Safe
69 POSIX.1-2001, POSIX.1-2008, 4.3BSD.
71 In glibc up to version 2.1.1, the return type of
75 POSIX.1-2001 specifies
77 and this is the type used since glibc 2.1.2.
79 In early filesystems, the value returned by
81 was a simple file offset within a directory.
82 Modern filesystems use tree or hash structures, rather than flat tables,
83 to represent directories.
84 On such filesystems, the value returned by
86 (and used internally by
88 is a "cookie" that is used by the implementation
89 to derive a position within a directory.
90 .\" https://lwn.net/Articles/544298/
91 Application programs should treat this strictly as an opaque value, making
93 assumptions about its contents.