@@ -353,3 +353,154 @@ Helper functions
353353 any attempts to close it or to use it after closing the fd may lead to malfunction.
354354
355355 .. versionadded:: 1.12.0
356+
357+ File open constants
358+ -------------------
359+
360+ .. c:macro:: UV_FS_O_APPEND
361+
362+ The file is opened in append mode. Before each write, the file offset is
363+ positioned at the end of the file.
364+
365+ .. c:macro:: UV_FS_O_CREAT
366+
367+ The file is created if it does not already exist.
368+
369+ .. c:macro:: UV_FS_O_DIRECT
370+
371+ File I/O is done directly to and from user-space buffers, which must be
372+ aligned. Buffer size and address should be a multiple of the physical sector
373+ size of the block device.
374+
375+ .. note::
376+ `UV_FS_O_DIRECT` is supported on Linux, and on Windows via
377+ `FILE_FLAG_NO_BUFFERING <https:// msdn.microsoft.com/en-us/library/windows/desktop/cc644950.aspx>`_.
378+ `UV_FS_O_DIRECT` is not supported on macOS.
379+
380+ .. c:macro:: UV_FS_O_DIRECTORY
381+
382+ If the path is not a directory, fail the open.
383+
384+ .. note::
385+ `UV_FS_O_DIRECTORY` is not supported on Windows.
386+
387+ .. c:macro:: UV_FS_O_DSYNC
388+
389+ The file is opened for synchronous I/O. Write operations will complete once
390+ all data and a minimum of metadata are flushed to disk.
391+
392+ .. note::
393+ `UV_FS_O_DSYNC` is supported on Windows via
394+ `FILE_FLAG_WRITE_THROUGH <https:// msdn.microsoft.com/en-us/library/windows/desktop/cc644950.aspx>`_.
395+
396+ .. c:macro:: UV_FS_O_EXCL
397+
398+ If the `O_CREAT` flag is set and the file already exists, fail the open.
399+
400+ .. note::
401+ In general, the behavior of `O_EXCL` is undefined if it is used without
402+ `O_CREAT`. There is one exception: on Linux 2.6 and later, `O_EXCL` can
403+ be used without `O_CREAT` if pathname refers to a block device. If the
404+ block device is in use by the system (e.g., mounted), the open will fail
405+ with the error `EBUSY`.
406+
407+ .. c:macro:: UV_FS_O_EXLOCK
408+
409+ Atomically obtain an exclusive lock.
410+
411+ .. note::
412+ `UV_FS_O_EXLOCK` is only supported on macOS.
413+
414+ .. c:macro:: UV_FS_O_NOATIME
415+
416+ Do not update the file access time when the file is read.
417+
418+ .. note::
419+ `UV_FS_O_NOATIME` is not supported on Windows.
420+
421+ .. c:macro:: UV_FS_O_NOCTTY
422+
423+ If the path identifies a terminal device, opening the path will not cause
424+ that terminal to become the controlling terminal for the process (if the
425+ process does not already have one).
426+
427+ .. note::
428+ `UV_FS_O_NOCTTY` is not supported on Windows.
429+
430+ .. c:macro:: UV_FS_O_NOFOLLOW
431+
432+ If the path is a symbolic link, fail the open.
433+
434+ .. note::
435+ `UV_FS_O_NOFOLLOW` is not supported on Windows.
436+
437+ .. c:macro:: UV_FS_O_NONBLOCK
438+
439+ Open the file in nonblocking mode if possible.
440+
441+ .. note::
442+ `UV_FS_O_NONBLOCK` is not supported on Windows.
443+
444+ .. c:macro:: UV_FS_O_RANDOM
445+
446+ Access is intended to be random. The system can use this as a hint to
447+ optimize file caching.
448+
449+ .. note::
450+ `UV_FS_O_RANDOM` is only supported on Windows via
451+ `FILE_FLAG_RANDOM_ACCESS <https:// msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
452+
453+ .. c:macro:: UV_FS_O_RDONLY
454+
455+ Open the file for read-only access.
456+
457+ .. c:macro:: UV_FS_O_RDWR
458+
459+ Open the file for read-write access.
460+
461+ .. c:macro:: UV_FS_O_SEQUENTIAL
462+
463+ Access is intended to be sequential from beginning to end. The system can
464+ use this as a hint to optimize file caching.
465+
466+ .. note::
467+ `UV_FS_O_SEQUENTIAL` is only supported on Windows via
468+ `FILE_FLAG_SEQUENTIAL_SCAN <https:// msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
469+
470+ .. c:macro:: UV_FS_O_SHORT_LIVED
471+
472+ The file is temporary and should not be flushed to disk if possible.
473+
474+ .. note::
475+ `UV_FS_O_SHORT_LIVED` is only supported on Windows via
476+ `FILE_ATTRIBUTE_TEMPORARY <https:// msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
477+
478+ .. c:macro:: UV_FS_O_SYMLINK
479+
480+ Open the symbolic link itself rather than the resource it points to.
481+
482+ .. c:macro:: UV_FS_O_SYNC
483+
484+ The file is opened for synchronous I/O. Write operations will complete once
485+ all data and all metadata are flushed to disk.
486+
487+ .. note::
488+ `UV_FS_O_SYNC` is supported on Windows via
489+ `FILE_FLAG_WRITE_THROUGH <https:// msdn.microsoft.com/en-us/library/windows/desktop/cc644950.aspx>`_.
490+
491+ .. c:macro:: UV_FS_O_TEMPORARY
492+
493+ The file is temporary and should not be flushed to disk if possible.
494+
495+ .. note::
496+ `UV_FS_O_TEMPORARY` is only supported on Windows via
497+ `FILE_ATTRIBUTE_TEMPORARY <https:// msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
498+
499+ .. c:macro:: UV_FS_O_TRUNC
500+
501+ If the file exists and is a regular file, and the file is opened
502+ successfully for write access, its length shall be truncated to zero.
503+
504+ .. c:macro:: UV_FS_O_WRONLY
505+
506+ Open the file for write-only access.
0 commit comments