1TELLDIR(3)                 Linux Programmer's Manual                TELLDIR(3)
2
3
4

NAME

6       telldir - return current location in directory stream
7

SYNOPSIS

9       #include <dirent.h>
10
11       long telldir(DIR *dirp);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       telldir():
16           _XOPEN_SOURCE
17              || /* Glibc since 2.19: */ _DEFAULT_SOURCE
18              || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
19

DESCRIPTION

21       The telldir() function returns the current location associated with the
22       directory stream dirp.
23

RETURN VALUE

25       On success, the telldir() function returns the current location in  the
26       directory  stream.  On error, -1 is returned, and errno is set to indi‐
27       cate the error.
28

ERRORS

30       EBADF  Invalid directory stream descriptor dirp.
31

ATTRIBUTES

33       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
34       tributes(7).
35
36       ┌────────────────────────────────────────────┬───────────────┬─────────┐
37Interface                                   Attribute     Value   
38       ├────────────────────────────────────────────┼───────────────┼─────────┤
39telldir()                                   │ Thread safety │ MT-Safe │
40       └────────────────────────────────────────────┴───────────────┴─────────┘
41

CONFORMING TO

43       POSIX.1-2001, POSIX.1-2008, 4.3BSD.
44

NOTES

46       In  glibc  up to version 2.1.1, the return type of telldir() was off_t.
47       POSIX.1-2001 specifies long, and this is  the  type  used  since  glibc
48       2.1.2.
49
50       In early filesystems, the value returned by telldir() was a simple file
51       offset within a directory.  Modern filesystems use tree or hash  struc‐
52       tures,  rather  than  flat  tables,  to represent directories.  On such
53       filesystems, the value returned by telldir() (and  used  internally  by
54       readdir(3))  is a "cookie" that is used by the implementation to derive
55       a position within a directory.  Application programs should treat  this
56       strictly as an opaque value, making no assumptions about its contents.
57

SEE ALSO

59       closedir(3),    opendir(3),   readdir(3),   rewinddir(3),   scandir(3),
60       seekdir(3)
61

COLOPHON

63       This page is part of release 5.13 of the Linux  man-pages  project.   A
64       description  of  the project, information about reporting bugs, and the
65       latest    version    of    this    page,    can     be     found     at
66       https://www.kernel.org/doc/man-pages/.
67
68
69
70                                  2021-03-22                        TELLDIR(3)
Impressum