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

fcntl.h.0p (9741B)


  1. '\" et
  2. .TH fcntl.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. fcntl.h
  12. \(em file control options
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <fcntl.h>
  17. .fi
  18. .SH DESCRIPTION
  19. The
  20. .IR <fcntl.h>
  21. header shall define the following symbolic constants for the
  22. .IR cmd
  23. argument used by
  24. \fIfcntl\fR().
  25. The values shall be unique and shall be suitable for use in
  26. .BR #if
  27. preprocessing directives.
  28. .IP F_DUPFD 12
  29. Duplicate file descriptor.
  30. .IP F_DUPFD_CLOEXEC 12
  31. .br
  32. Duplicate file descriptor with the close-on-\c
  33. .IR exec
  34. flag FD_CLOEXEC set.
  35. .IP F_GETFD 12
  36. Get file descriptor flags.
  37. .IP F_SETFD 12
  38. Set file descriptor flags.
  39. .IP F_GETFL 12
  40. Get file status flags and file access modes.
  41. .IP F_SETFL 12
  42. Set file status flags.
  43. .IP F_GETLK 12
  44. Get record locking information.
  45. .IP F_SETLK 12
  46. Set record locking information.
  47. .IP F_SETLKW 12
  48. Set record locking information; wait if blocked.
  49. .IP F_GETOWN 12
  50. Get process or process group ID to receive SIGURG signals.
  51. .IP F_SETOWN 12
  52. Set process or process group ID to receive SIGURG signals.
  53. .P
  54. The
  55. .IR <fcntl.h>
  56. header shall define the following symbolic constant used for the
  57. \fIfcntl\fR()
  58. file descriptor flags, which shall be suitable for use in
  59. .BR #if
  60. preprocessing directives.
  61. .IP FD_CLOEXEC 12
  62. Close the file descriptor upon execution of an
  63. .IR exec
  64. family function.
  65. .P
  66. The
  67. .IR <fcntl.h>
  68. header shall also define the following symbolic constants for the
  69. .IR l_type
  70. argument used for record locking with
  71. \fIfcntl\fR().
  72. The values shall be unique and shall be suitable for use in
  73. .BR #if
  74. preprocessing directives.
  75. .IP F_RDLCK 12
  76. Shared or read lock.
  77. .IP F_UNLCK 12
  78. Unlock.
  79. .IP F_WRLCK 12
  80. Exclusive or write lock.
  81. .P
  82. The
  83. .IR <fcntl.h>
  84. header shall define the values used for
  85. .IR l_whence ,
  86. SEEK_SET, SEEK_CUR, and SEEK_END
  87. as described in
  88. .IR <stdio.h> .
  89. .P
  90. The
  91. .IR <fcntl.h>
  92. header shall define the following symbolic constants as file creation
  93. flags for use in the
  94. .IR oflag
  95. value to
  96. \fIopen\fR()
  97. and
  98. \fIopenat\fR().
  99. The values shall be bitwise-distinct and shall be suitable for use in
  100. .BR #if
  101. preprocessing directives.
  102. .IP O_CLOEXEC 12
  103. The FD_CLOEXEC flag associated with the new descriptor shall be
  104. set to close the file descriptor upon execution of an
  105. .IR exec
  106. family function.
  107. .IP O_CREAT 12
  108. Create file if it does not exist.
  109. .IP O_DIRECTORY 12
  110. Fail if file is a non-directory file.
  111. .IP O_EXCL 12
  112. Exclusive use flag.
  113. .IP O_NOCTTY 12
  114. Do not assign controlling terminal.
  115. .IP O_NOFOLLOW 12
  116. Do not follow symbolic links.
  117. .IP O_TRUNC 12
  118. Truncate flag.
  119. .IP O_TTY_INIT 12
  120. Set the
  121. .BR termios
  122. structure terminal parameters to a state that provides conforming
  123. behavior; see
  124. .IR "Section 11.2" ", " "Parameters that Can be Set".
  125. .P
  126. The O_TTY_INIT flag can have the value zero and in this case it need
  127. not be bitwise-distinct from the other flags.
  128. .P
  129. The
  130. .IR <fcntl.h>
  131. header shall define the following symbolic constants for use as
  132. file status flags for
  133. \fIopen\fR(),
  134. \fIopenat\fR(),
  135. and
  136. \fIfcntl\fR().
  137. The values shall be suitable for use in
  138. .BR #if
  139. preprocessing directives.
  140. .IP O_APPEND 12
  141. Set append mode.
  142. .IP O_DSYNC 12
  143. Write according to synchronized I/O data integrity completion.
  144. .IP O_NONBLOCK 12
  145. Non-blocking mode.
  146. .IP O_RSYNC 12
  147. Synchronized read I/O operations.
  148. .IP O_SYNC 12
  149. Write according to synchronized I/O file integrity completion.
  150. .P
  151. The
  152. .IR <fcntl.h>
  153. header shall define the following symbolic constant for use as the mask
  154. for file access modes. The value shall be suitable for use in
  155. .BR #if
  156. preprocessing directives.
  157. .IP O_ACCMODE 12
  158. Mask for file access modes.
  159. .P
  160. The
  161. .IR <fcntl.h>
  162. header shall define the following symbolic constants for use as
  163. the file access modes for
  164. \fIopen\fR(),
  165. \fIopenat\fR(),
  166. and
  167. \fIfcntl\fR().
  168. The values shall be unique, except that O_EXEC and O_SEARCH may have
  169. equal values. The values shall be suitable for use in
  170. .BR #if
  171. preprocessing directives.
  172. .IP O_EXEC 12
  173. Open for execute only (non-directory files). The result is unspecified
  174. if this flag is applied to a directory.
  175. .IP O_RDONLY 12
  176. Open for reading only.
  177. .IP O_RDWR 12
  178. Open for reading and writing.
  179. .IP O_SEARCH 12
  180. Open directory for search only. The result is unspecified if this flag
  181. is applied to a non-directory file.
  182. .IP O_WRONLY 12
  183. Open for writing only.
  184. .P
  185. The
  186. .IR <fcntl.h>
  187. header shall define the symbolic constants for file modes for use as
  188. values of
  189. .BR mode_t
  190. as described in
  191. .IR <sys/stat.h> .
  192. .P
  193. The
  194. .IR <fcntl.h>
  195. header shall define the following symbolic constant as a special value
  196. used in place of a file descriptor for the
  197. .IR *at (\|)
  198. functions which take a directory file descriptor as a parameter:
  199. .IP AT_FDCWD 12
  200. Use the current working directory to determine the target of relative
  201. file paths.
  202. .P
  203. The
  204. .IR <fcntl.h>
  205. header shall define the following symbolic constant as a value for the
  206. .IR flag
  207. used by
  208. \fIfaccessat\fR():
  209. .IP AT_EACCESS 12
  210. Check access using effective user and group ID.
  211. .P
  212. The
  213. .IR <fcntl.h>
  214. header shall define the following symbolic constant as a value for the
  215. .IR flag
  216. used by
  217. \fIfstatat\fR(),
  218. \fIfchmodat\fR(),
  219. \fIfchownat\fR(),
  220. and
  221. \fIutimensat\fR():
  222. .IP AT_SYMLINK_NOFOLLOW 12
  223. .br
  224. Do not follow symbolic links.
  225. .P
  226. The
  227. .IR <fcntl.h>
  228. header shall define the following symbolic constant as a value for
  229. the flag used by
  230. \fIlinkat\fR():
  231. .IP AT_SYMLINK_FOLLOW 12
  232. .br
  233. Follow symbolic link.
  234. .br
  235. .P
  236. The
  237. .IR <fcntl.h>
  238. header shall define the following symbolic constant as a value
  239. for the flag used by
  240. \fIunlinkat\fR():
  241. .IP AT_REMOVEDIR 12
  242. .br
  243. Remove directory instead of file.
  244. .P
  245. The
  246. .IR <fcntl.h>
  247. header shall define the following symbolic constants for the
  248. .IR advice
  249. argument used by
  250. \fIposix_fadvise\fR():
  251. .IP POSIX_FADV_DONTNEED 6
  252. .br
  253. The application expects that it will not access the specified data in
  254. the near future.
  255. .IP POSIX_FADV_NOREUSE 6
  256. .br
  257. The application expects to access the specified data once and then not
  258. reuse it thereafter.
  259. .IP POSIX_FADV_NORMAL 6
  260. .br
  261. The application has no advice to give on its behavior with respect to
  262. the specified data. It is the default characteristic if no advice is
  263. given for an open file.
  264. .IP POSIX_FADV_RANDOM 6
  265. .br
  266. The application expects to access the specified data in a random
  267. order.
  268. .IP POSIX_FADV_SEQUENTIAL 6
  269. .br
  270. The application expects to access the specified data sequentially from
  271. lower offsets to higher offsets.
  272. .IP POSIX_FADV_WILLNEED 6
  273. .br
  274. The application expects to access the specified data in the near
  275. future.
  276. .P
  277. The
  278. .IR <fcntl.h>
  279. header shall define the
  280. .BR flock
  281. structure describing a file lock. It shall include the following members:
  282. .sp
  283. .RS 4
  284. .nf
  285. short l_type \fRType of lock; F_RDLCK, F_WRLCK, F_UNLCK.\fR
  286. short l_whence \fRFlag for starting offset.\fR
  287. off_t l_start \fRRelative offset in bytes.\fR
  288. off_t l_len \fRSize; if 0 then until EOF.\fR
  289. pid_t l_pid \fRProcess ID of the process holding the lock; returned with F_GETLK.\fR
  290. .fi
  291. .P
  292. .RE
  293. .P
  294. The
  295. .IR <fcntl.h>
  296. header shall define the
  297. .BR mode_t ,
  298. .BR off_t ,
  299. and
  300. .BR pid_t
  301. types as described in
  302. .IR <sys/types.h> .
  303. .P
  304. The following shall be declared as functions and may also be defined as
  305. macros. Function prototypes shall be provided.
  306. .sp
  307. .RS 4
  308. .nf
  309. int creat(const char *, mode_t);
  310. int fcntl(int, int, ...);
  311. int open(const char *, int, ...);
  312. int openat(int, const char *, int, ...);
  313. int posix_fadvise(int, off_t, off_t, int);
  314. int posix_fallocate(int, off_t, off_t);
  315. .fi
  316. .P
  317. .RE
  318. .P
  319. Inclusion of the
  320. .IR <fcntl.h>
  321. header may also make visible all symbols from
  322. .IR <sys/stat.h>
  323. and
  324. .IR <unistd.h> .
  325. .LP
  326. .IR "The following sections are informative."
  327. .SH "APPLICATION USAGE"
  328. Although no existing implementation defines AT_SYMLINK_FOLLOW and
  329. AT_SYMLINK_NOFOLLOW as the same numeric value, POSIX.1\(hy2008 does not prohibit
  330. that as the two constants are not used with the same interfaces.
  331. .SH RATIONALE
  332. While many of the symbolic constants introduced in the
  333. .IR <fcntl.h>
  334. header do not strictly need to be used in
  335. .BR #if
  336. preprocessor directives, widespread historic practice has defined
  337. them as macros that are usable in such constructs, and examination
  338. of existing applications has shown that they are occasionally used in
  339. such a way. Therefore it was decided to retain this requirement on an
  340. implementation in POSIX.1\(hy2008.
  341. .SH "FUTURE DIRECTIONS"
  342. None.
  343. .SH "SEE ALSO"
  344. .IR "\fB<stdio.h>\fP",
  345. .IR "\fB<sys_stat.h>\fP",
  346. .IR "\fB<sys_types.h>\fP",
  347. .IR "\fB<unistd.h>\fP"
  348. .P
  349. The System Interfaces volume of POSIX.1\(hy2017,
  350. .IR "\fIcreat\fR\^(\|)",
  351. .IR "\fIexec\fR\^",
  352. .IR "\fIfcntl\fR\^(\|)",
  353. .IR "\fIfutimens\fR\^(\|)",
  354. .IR "\fIopen\fR\^(\|)",
  355. .IR "\fIposix_fadvise\fR\^(\|)",
  356. .IR "\fIposix_fallocate\fR\^(\|)",
  357. .IR "\fIposix_madvise\fR\^(\|)"
  358. .\"
  359. .SH COPYRIGHT
  360. Portions of this text are reprinted and reproduced in electronic form
  361. from IEEE Std 1003.1-2017, Standard for Information Technology
  362. -- Portable Operating System Interface (POSIX), The Open Group Base
  363. Specifications Issue 7, 2018 Edition,
  364. Copyright (C) 2018 by the Institute of
  365. Electrical and Electronics Engineers, Inc and The Open Group.
  366. In the event of any discrepancy between this version and the original IEEE and
  367. The Open Group Standard, the original IEEE and The Open Group Standard
  368. is the referee document. The original Standard can be obtained online at
  369. http://www.opengroup.org/unix/online.html .
  370. .PP
  371. Any typographical or formatting errors that appear
  372. in this page are most likely
  373. to have been introduced during the conversion of the source files to
  374. man page format. To report such errors, see
  375. https://www.kernel.org/doc/man-pages/reporting_bugs.html .