logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

dirent.h.0p (4358B)


  1. '\" et
  2. .TH dirent.h "0P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. dirent.h
  12. \(em format of directory entries
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <dirent.h>
  17. .fi
  18. .SH DESCRIPTION
  19. The internal format of directories is unspecified.
  20. .P
  21. The
  22. .IR <dirent.h>
  23. header shall define the following type:
  24. .IP "\fBDIR\fR" 8
  25. A type representing a directory stream. The
  26. .BR DIR
  27. type may be an incomplete type.
  28. .P
  29. It shall also define the structure
  30. .BR dirent
  31. which shall include the following members:
  32. .sp
  33. .RS 4
  34. .nf
  35. ino_t d_ino \fRFile serial number.\fR
  36. char d_name[] \fRFilename string of entry.\fR
  37. .fi
  38. .P
  39. .RE
  40. .P
  41. The
  42. .IR <dirent.h>
  43. header shall define the
  44. .BR ino_t
  45. type as described in
  46. .IR <sys/types.h> .
  47. .P
  48. The array
  49. .IR d_name
  50. is of unspecified size, but shall contain a filename of at most
  51. {NAME_MAX}
  52. bytes followed by a terminating null byte.
  53. .P
  54. The following shall be declared as functions and may also be defined as
  55. macros. Function prototypes shall be provided.
  56. .sp
  57. .RS 4
  58. .nf
  59. int alphasort(const struct dirent **, const struct dirent **);
  60. int closedir(DIR *);
  61. int dirfd(DIR *);
  62. DIR *fdopendir(int);
  63. DIR *opendir(const char *);
  64. struct dirent *readdir(DIR *);
  65. int readdir_r(DIR *restrict, struct dirent *restrict,
  66. struct dirent **restrict);
  67. void rewinddir(DIR *);
  68. int scandir(const char *, struct dirent ***,
  69. int (*)(const struct dirent *),
  70. int (*)(const struct dirent **,
  71. const struct dirent **));
  72. void seekdir(DIR *, long);
  73. long telldir(DIR *);
  74. .fi
  75. .P
  76. .RE
  77. .LP
  78. .IR "The following sections are informative."
  79. .SH "APPLICATION USAGE"
  80. None.
  81. .SH RATIONALE
  82. Information similar to that in the
  83. .IR <dirent.h>
  84. header is contained in a file
  85. .IR <sys/dir.h>
  86. in 4.2 BSD and 4.3 BSD. The equivalent in these implementations of
  87. .BR "struct dirent"
  88. from this volume of POSIX.1\(hy2017 is
  89. .BR "struct direct" .
  90. The filename was changed because the name
  91. .IR <sys/dir.h>
  92. was also used in earlier implementations to refer to definitions
  93. related to the older access method; this produced name conflicts. The
  94. name of the structure was changed because this volume of POSIX.1\(hy2017 does not completely
  95. define what is in the structure, so it could be different on some
  96. implementations from
  97. .BR "struct direct" .
  98. .P
  99. The name of an array of
  100. .BR char
  101. of an unspecified size should not be used as an lvalue. Use of:
  102. .sp
  103. .RS 4
  104. .nf
  105. sizeof(d_name)
  106. .fi
  107. .P
  108. .RE
  109. .P
  110. is incorrect; use:
  111. .sp
  112. .RS 4
  113. .nf
  114. strlen(d_name)
  115. .fi
  116. .P
  117. .RE
  118. .P
  119. instead.
  120. .P
  121. The array of
  122. .BR char
  123. .IR d_name
  124. is not a fixed size. Implementations may need to declare
  125. .BR "struct dirent"
  126. with an array size for
  127. .IR d_name
  128. of 1, but the actual number of bytes provided matches (or only slightly
  129. exceeds) the length of the filename string.
  130. .SH "FUTURE DIRECTIONS"
  131. None.
  132. .SH "SEE ALSO"
  133. .IR "\fB<sys_types.h>\fP"
  134. .P
  135. The System Interfaces volume of POSIX.1\(hy2017,
  136. .IR "\fIalphasort\fR\^(\|)",
  137. .IR "\fIclosedir\fR\^(\|)",
  138. .IR "\fIdirfd\fR\^(\|)",
  139. .IR "\fIfdopendir\fR\^(\|)",
  140. .IR "\fIreaddir\fR\^(\|)",
  141. .IR "\fIrewinddir\fR\^(\|)",
  142. .IR "\fIseekdir\fR\^(\|)",
  143. .IR "\fItelldir\fR\^(\|)"
  144. .\"
  145. .SH COPYRIGHT
  146. Portions of this text are reprinted and reproduced in electronic form
  147. from IEEE Std 1003.1-2017, Standard for Information Technology
  148. -- Portable Operating System Interface (POSIX), The Open Group Base
  149. Specifications Issue 7, 2018 Edition,
  150. Copyright (C) 2018 by the Institute of
  151. Electrical and Electronics Engineers, Inc and The Open Group.
  152. In the event of any discrepancy between this version and the original IEEE and
  153. The Open Group Standard, the original IEEE and The Open Group Standard
  154. is the referee document. The original Standard can be obtained online at
  155. http://www.opengroup.org/unix/online.html .
  156. .PP
  157. Any typographical or formatting errors that appear
  158. in this page are most likely
  159. to have been introduced during the conversion of the source files to
  160. man page format. To report such errors, see
  161. https://www.kernel.org/doc/man-pages/reporting_bugs.html .