Debian Codegraph @

upstream/debian-trixie/man3/closedir.3

raw
1 '\" t
2 .\" Copyright (C) 1993 David Metcalfe ([email protected])
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
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 21:25:52 1993 by Rik Faith ([email protected])
11 .\" Modified 11 June 1995 by Andries Brouwer ([email protected])
12 .TH closedir 3 2024-05-02 "Linux man-pages 6.9.1"
13 .SH NAME
14 closedir \- close a directory
15 .SH LIBRARY
16 Standard C library
17 .RI ( libc ", " \-lc )
18 .SH SYNOPSIS
19 .nf
20 .B #include <sys/types.h>
21 .B #include <dirent.h>
22 .P
23 .BI "int closedir(DIR *" dirp );
24 .fi
25 .SH DESCRIPTION
26 The
27 .BR closedir ()
28 function closes the directory stream associated with
29 .IR dirp .
30 A successful call to
31 .BR closedir ()
32 also closes the underlying file descriptor associated with
33 .IR dirp .
34 The directory stream descriptor
35 .I dirp
36 is not available
37 after this call.
38 .SH RETURN VALUE
39 The
40 .BR closedir ()
41 function returns 0 on success.
42 On error, \-1 is returned, and
43 .I errno
44 is set to indicate the error.
45 .SH ERRORS
46 .TP
47 .B EBADF
48 Invalid directory stream descriptor
49 .IR dirp .
50 .SH ATTRIBUTES
51 For an explanation of the terms used in this section, see
52 .BR attributes (7).
53 .TS
54 allbox;
55 lbx lb lb
56 l l l.
57 Interface Attribute Value
58 T{
59 .na
60 .nh
61 .BR closedir ()
62 T} Thread safety MT-Safe
63 .TE
64 .SH STANDARDS
65 POSIX.1-2008.
66 .SH HISTORY
67 POSIX.1-2001, SVr4, 4.3BSD.
68 .SH SEE ALSO
69 .BR close (2),
70 .BR opendir (3),
71 .BR readdir (3),
72 .BR rewinddir (3),
73 .BR scandir (3),
74 .BR seekdir (3),
75 .BR telldir (3)