Print this page
opendir, dirfd are in XPG7

*** 1,77 **** ! '\" te .\" Copyright (c) 2007, Sun Microsystems Inc. All Rights Reserved. .\" Portions of this manual page are derived from documentation obtained from linuxmanpages.com .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] ! .TH DIRFD 3C "Oct 24, 2007" ! .SH NAME ! dirfd \- get directory stream file descriptor ! .SH SYNOPSIS ! .LP ! .nf ! #include <dirent.h> ! ! \fBint\fR \fBdirfd\fR(\fBDIR *\fR\fIdir\fR); ! .fi ! ! .SH DESCRIPTION ! .sp ! .LP ! The \fBdirfd()\fR function returns the file descriptor associated with the ! directory stream \fIdir\fR. ! .sp ! .LP This file descriptor is the one used internally by the directory stream ! operations. See \fBopendir\fR(3C), \fBclosedir\fR(3C), \fBreaddir\fR(3C), ! \fBrewinddir\fR(3C), \fBseekdir\fR(3C), \fBtelldir\fR(3C). The file descriptor ! is automatically closed when \fBclosedir()\fR is called for the directory ! stream \fIdir\fR or when one of the \fBexec\fR functions is called. See ! \fBexec\fR(2). ! .sp ! .LP The file descriptor can safely be used only by functions that do not depend on ! or alter the file position, such as \fBfstat\fR(2) and \fBfchdir\fR(2). ! Closing the file descriptor with \fBclose\fR(2) or modifying the file position by means other than the directory stream operations listed above causes undefined behavior to occur when one of the directory stream operations is ! subsequently called with the directory stream \fIdir\fR. ! .SH RETURN VALUES ! .sp ! .LP ! Upon successful completion, the \fBdirfd()\fR function returns an open file ! descriptor for the directory associated with the directory stream \fIdir\fR. ! .SH ERRORS ! .sp ! .LP There are no defined error returns. Passing an invalid directory stream as an ! argument to the \fBdirfd()\fR function results in undefined behavior. ! .SH USAGE ! .sp ! .LP ! The \fBdirfd()\fR function is intended to be used to obtain a file descriptor ! for use with the \fBfchdir()\fR function. ! .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 Committed ! _ ! MT-Level Safe ! .TE ! ! .SH SEE ALSO ! .sp ! .LP ! \fBclose\fR(2), \fBexec\fR(2), \fBfchdir\fR(2), \fBfstat\fR(2), ! \fBclosedir\fR(3C), \fBopendir\fR(3C), \fBreaddir\fR(3C), \fBrewinddir\fR(3C), ! \fBseekdir\fR(3C), \fBtelldir\fR(3C), \fBattributes\fR(5) --- 1,96 ---- ! .\" Copyrigh 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 2007, Sun Microsystems Inc. All Rights Reserved. .\" Portions of this manual page are derived from documentation obtained from linuxmanpages.com .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] ! .Dd "Jul 22, 2014" ! .Dt DIRFD 3C ! .Os ! .Sh NAME ! .Nm dirfd ! .Nd get directory stream file descriptor ! .Sh SYNOPSIS ! .In dirent.h ! .Ft int ! .Fn dirfd "DIR *dir" ! .Sh DESCRIPTION ! The ! .Fn dirfd ! function returns the file descriptor associated with the ! directory stream ! .Fa dir . ! .Lp This file descriptor is the one used internally by the directory stream ! operations. See ! .Xr opendir 3C , ! .Xr closedir 3C , ! .Xr readdir 3C , ! .Xr rewinddir 3C , ! .Xr seekdir 3C , ! and ! .Xr telldir 3C . ! The file descriptor ! is automatically closed when ! .Xr closedir 3C ! is called for the directory stream ! .Fa dir ! or when one of the ! .Xr exec 2 ! functions is called. ! .Lp The file descriptor can safely be used only by functions that do not depend on ! or alter the file position, such as ! .Xr fstat 2 ! and ! .Xr fchdir . ! Closing the file descriptor with ! .Xr close 2 ! or modifying the file position by means other than the directory stream operations listed above causes undefined behavior to occur when one of the directory stream operations is ! subsequently called with the directory stream ! .Fa dir . ! .Sh RETURN VALUES ! Upon successful completion, the ! .Fn dirfd ! function returns an open file ! descriptor for the directory associated with the directory stream ! .Fa dir . ! .Sh ERRORS There are no defined error returns. Passing an invalid directory stream as an ! argument to the ! .Fn dirfd ! function results in undefined behavior. ! .Sh USAGE ! The ! .Fn dirfd ! function is intended to be used to obtain a file descriptor ! for use with the ! .Xr fchdir ! function. ! . ! .Sh INTERFACE STABILITY ! .Sy Standard . ! . ! .Sh MT-LEVEL ! .Sy Safe . ! . ! .Sh SEE ALSO ! .Xr close 2 , ! .Xr exec 2 , ! .Xr fchdir 2 , ! .Xr fstat 2 , ! .Xr closedir 3C , ! .Xr opendir 3C , ! .Xr readdir 3C , ! .Xr rewinddir 3C , ! .Xr seekdir 3C , ! .Xr telldir 3C , ! .Xr standards 5 ! . ! .Sh STANDARDS ! The ! .Fn dirfd ! function was introduced in ! .St -p1003.1-2008 .