]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/getdents.2
user_namespaces.7: Minor rewordings of recently added text
[thirdparty/man-pages.git] / man2 / getdents.2
CommitLineData
fea681da 1.\" Copyright (C) 1995 Andries Brouwer (aeb@cwi.nl)
51fe959a 2.\" and Copyright 2008, 2015 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 3.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
c13182ef 13.\"
fea681da
MK
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
c13182ef 21.\"
fea681da
MK
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
fea681da
MK
25.\"
26.\" Written 11 June 1995 by Andries Brouwer <aeb@cwi.nl>
27.\" Modified 22 July 1995 by Michael Chastain <mec@duracef.shout.net>:
28.\" Derived from 'readdir.2'.
29.\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
4784c377 30.\"
9ba01802 31.TH GETDENTS 2 2019-03-06 "Linux" "Linux Programmer's Manual"
fea681da 32.SH NAME
51fe959a 33getdents, getdents64 \- get directory entries
fea681da
MK
34.SH SYNOPSIS
35.nf
affa1ac7 36.BI "int getdents(unsigned int " fd ", struct linux_dirent *" dirp ,
8587f5c0 37.BI " unsigned int " count );
51fe959a
MK
38.BI "int getdents64(unsigned int " fd ", struct linux_dirent64 *" dirp ,
39.BI " unsigned int " count );
fea681da 40.fi
dbfe9c70 41.PP
45c99e3e 42.IR Note :
51fe959a 43There are no glibc wrappers for these system calls; see NOTES.
fea681da 44.SH DESCRIPTION
51fe959a 45These are not the interfaces you are interested in.
fea681da
MK
46Look at
47.BR readdir (3)
31f7afcd 48for the POSIX-conforming C library interface.
51fe959a
MK
49This page documents the bare kernel system call interfaces.
50.SS getdents()
fea681da 51The system call
e511ffb6 52.BR getdents ()
c13182ef 53reads several
affa1ac7 54.I linux_dirent
fea681da 55structures from the directory
382d87bd 56referred to by the open file descriptor
fea681da 57.I fd
382d87bd 58into the buffer pointed to by
fea681da 59.IR dirp .
c4bb193f 60The argument
fea681da 61.I count
ade8a1f9 62specifies the size of that buffer.
fea681da
MK
63.PP
64The
affa1ac7 65.I linux_dirent
fea681da
MK
66structure is declared as follows:
67.PP
3f89ebc0 68.in +4n
b76974c1 69.EX
382d87bd
MK
70struct linux_dirent {
71 unsigned long d_ino; /* Inode number */
affa1ac7
MK
72 unsigned long d_off; /* Offset to next \fIlinux_dirent\fP */
73 unsigned short d_reclen; /* Length of this \fIlinux_dirent\fP */
5ff3825e 74 char d_name[]; /* Filename (null-terminated) */
1e9736f3
MK
75 /* length is actually (d_reclen \- 2 \-
76 offsetof(struct linux_dirent, d_name)) */
5ff3825e 77 /*