summaryrefslogtreecommitdiff
path: root/usr/src/man/man3c/closedir.3c
diff options
context:
space:
mode:
authorDan McDonald <danmcd@joyent.com>2021-03-04 18:38:38 -0500
committerDan McDonald <danmcd@joyent.com>2021-03-04 18:38:40 -0500
commita20b12c5450be0d2fc1b64450605364b6f188003 (patch)
tree0f33927ddf3cdf6de26270e13dd4a1e5899c4a43 /usr/src/man/man3c/closedir.3c
parente54a0cf73ce61b42e31dc46b40a139be2e68fd5d (diff)
parent3aa10614c270c8e3c84f2fe819f8fc4db741f47e (diff)
downloadillumos-joyent-a20b12c5450be0d2fc1b64450605364b6f188003.tar.gz
[illumos-gate merge]
commit 3aa10614c270c8e3c84f2fe819f8fc4db741f47e 13579 readdir(3C) and closedir(3C) should document dirent lifetime commit 7db0d1931e7f4e135600dcbe0f4c5b10c732181e 13256 bhyve should shadow %cr0 on AMD 13338 bhyve should be able to emulate CLTS commit 0f56e145e1bddbb7bdc804efe2d5fcbe21d5aec2 13560 smbios(1m) should sanitize strings commit cd12acafe1f95ec0f3308baba673d2653990a014 2766 zoneadm install fails with root of zpool not mounted commit 6ed464ecaed26b9c4fc83c9edf03813e1c37c7e7 13592 remove .Sx attempt at cross-linking in mac manuals commit f2db47a16aa8decb07a3891af701f32bba6990cd 13594 Valid flag for fchownat(2) is AT_SYMLINK_NOFOLLOW, not SYMLNK Conflicts: usr/src/cmd/smbios/smbios.c
Diffstat (limited to 'usr/src/man/man3c/closedir.3c')
-rw-r--r--usr/src/man/man3c/closedir.3c143
1 files changed, 75 insertions, 68 deletions
diff --git a/usr/src/man/man3c/closedir.3c b/usr/src/man/man3c/closedir.3c
index 09e7d3e3f7..c88ecd707c 100644
--- a/usr/src/man/man3c/closedir.3c
+++ b/usr/src/man/man3c/closedir.3c
@@ -43,72 +43,79 @@
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright 2021 Oxide Computer Company
.\"
-.TH CLOSEDIR 3C "Jul 24, 2002"
-.SH NAME
-closedir \- close a directory stream
-.SH SYNOPSIS
-.LP
-.nf
-#include <sys/types.h>
-#include <dirent.h>
-
-\fBint\fR \fBclosedir\fR(\fBDIR *\fR\fIdirp\fR);
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-The \fBclosedir()\fR function closes the directory stream referred to by the
-argument \fIdirp.\fR Upon return, the value of \fIdirp\fR may no longer point
-to an accessible object of the type \fBDIR\fR. If a file descriptor is used to
-implement type \fBDIR\fR, that file descriptor will be closed.
-.SH RETURN VALUES
-.sp
-.LP
-Upon successful completion, \fBclosedir()\fR returns \fB0\fR. Otherwise,
-\fB\(mi1\fR is returned and \fBerrno\fR is set to indicate the error.
-.SH ERRORS
-.sp
-.LP
-The \fBclosedir()\fR function may fail if:
-.sp
-.ne 2
-.na
-\fB\fBEBADF\fR\fR
-.ad
-.RS 9n
-The \fIdirp\fR argument does not refer to an open directory stream.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINTR\fR\fR
-.ad
-.RS 9n
-The \fBclosedir()\fR function was interrupted by a signal.
-.RE
-
-.SH ATTRIBUTES
-.sp
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-Interface Stability Standard
-_
-MT-Level Safe
-.TE
-
-.SH SEE ALSO
-.sp
-.LP
-\fBopendir\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)
+.Dd February 25, 2021
+.Dt CLOSEDIR 3C
+.Os
+.Sh NAME
+.Nm closedir
+.Nd close a directory stream
+.Sh SYNOPSIS
+.In sys/types.h
+.In dirent.h
+.Ft int
+.Fo closedir
+.Fa "DIR *dirp"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn closedir
+function closes the directory stream referred to by the argument
+.Fa dirp ,
+which generally came from calling
+.Xr opendir 3C
+or
+.Xr fdopendir 3C .
+Upon return, the value of
+.Fa dirp
+will no longer point to an accessible object of the type
+.Ft DIR .
+The underlying file descriptor for the directory stream will be closed.
+This includes a
+.Ft DIR
+created by passing a file descriptor to
+.Xr fdopendir 3C .
+.Pp
+When the directory stream is closed, any memory that is associated with
+the stream will no longer be valid.
+Most notably, the dirent structures returned from
+.Xr readdir 3C
+use memory associated with the corresponding
+.Ft "DIR *"
+argument.
+Each directory stream has its own independent memory.
+Closing one stream does not impact the validity of other streams.
+.Sh RETURN VALUES
+Upon successful completion, the
+.Fn closedir
+function returns
+.Sy 0 .
+Otherwise,
+.Sy -1
+is returned and
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+The
+.Fn closedir
+function may fail if:
+.Bl -tag -width Er
+.It Er EBADF
+The
+.Fa dirp
+argument does not refer to an open directory stream.
+.It Er EINTR
+The
+.Fn closedir
+function was interrupted by a signal.
+.El
+.Sh INTERFACE STABILITY
+.Sy Standard
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr fdopendir 3C ,
+.Xr opendir 3C ,
+.Xr readdir 3C ,
+.Xr attributes 5