| Modifier and Type | Field and Description
|
|---|
| public static final int | DN_ACCESSEnum values:
DN_ACCESS - A file was accessed (read(2), pread(2), readv(2), and similar).
DN_MODIFY - A file was modified (write(2), pwrite(2), writev(2), truncate(2), ftruncate(2), and similar).
DN_CREATE -
A file was created (open(2), creat(2), mknod(2), mkdir(2), link(2), symlink(2), rename(2)
into this directory).
DN_DELETE - A file was unlinked (unlink(2), rename(2) to another directory, rmdir(2)).
DN_RENAME - A file was renamed within this directory (rename(2)).
DN_ATTRIB - The attributes of a file were changed (chown(2), chmod(2), utime(2), utimensat(2), and similar).
DN_MULTISHOT - Don't remove notifier
|
| public static final int | DN_ATTRIBEnum values:
DN_ACCESS - A file was accessed (read(2), pread(2), readv(2), and similar).
DN_MODIFY - A file was modified (write(2), pwrite(2), writev(2), truncate(2), ftruncate(2), and similar).
DN_CREATE -
A file was created (open(2), creat(2), mknod(2), mkdir(2), link(2), symlink(2), rename(2)
into this directory).
DN_DELETE - A file was unlinked (unlink(2), rename(2) to another directory, rmdir(2)).
DN_RENAME - A file was renamed within this directory (rename(2)).
DN_ATTRIB - The attributes of a file were changed (chown(2), chmod(2), utime(2), utimensat(2), and similar).
DN_MULTISHOT - Don't remove notifier
|
| public static final int | DN_CREATEEnum values:
DN_ACCESS - A file was accessed (read(2), pread(2), readv(2), and similar).
DN_MODIFY - A file was modified (write(2), pwrite(2), writev(2), truncate(2), ftruncate(2), and similar).
DN_CREATE -
A file was created (open(2), creat(2), mknod(2), mkdir(2), link(2), symlink(2), rename(2)
into this directory).
DN_DELETE - A file was unlinked (unlink(2), rename(2) to another directory, rmdir(2)).
DN_RENAME - A file was renamed within this directory (rename(2)).
DN_ATTRIB - The attributes of a file were changed (chown(2), chmod(2), utime(2), utimensat(2), and similar).
DN_MULTISHOT - Don't remove notifier
|
| public static final int | DN_DELETEEnum values:
DN_ACCESS - A file was accessed (read(2), pread(2), readv(2), and similar).
DN_MODIFY - A file was modified (write(2), pwrite(2), writev(2), truncate(2), ftruncate(2), and similar).
DN_CREATE -
A file was created (open(2), creat(2), mknod(2), mkdir(2), link(2), symlink(2), rename(2)
into this directory).
DN_DELETE - A file was unlinked (unlink(2), rename(2) to another directory, rmdir(2)).
DN_RENAME - A file was renamed within this directory (rename(2)).
DN_ATTRIB - The attributes of a file were changed (chown(2), chmod(2), utime(2), utimensat(2), and similar).
DN_MULTISHOT - Don't remove notifier
|
| public static final int | DN_MODIFYEnum values:
DN_ACCESS - A file was accessed (read(2), pread(2), readv(2), and similar).
DN_MODIFY - A file was modified (write(2), pwrite(2), writev(2), truncate(2), ftruncate(2), and similar).
DN_CREATE -
A file was created (open(2), creat(2), mknod(2), mkdir(2), link(2), symlink(2), rename(2)
into this directory).
DN_DELETE - A file was unlinked (unlink(2), rename(2) to another directory, rmdir(2)).
DN_RENAME - A file was renamed within this directory (rename(2)).
DN_ATTRIB - The attributes of a file were changed (chown(2), chmod(2), utime(2), utimensat(2), and similar).
DN_MULTISHOT - Don't remove notifier
|
| public static final int | DN_MULTISHOTEnum values:
DN_ACCESS - A file was accessed (read(2), pread(2), readv(2), and similar).
DN_MODIFY - A file was modified (write(2), pwrite(2), writev(2), truncate(2), ftruncate(2), and similar).
DN_CREATE -
A file was created (open(2), creat(2), mknod(2), mkdir(2), link(2), symlink(2), rename(2)
into this directory).
DN_DELETE - A file was unlinked (unlink(2), rename(2) to another directory, rmdir(2)).
DN_RENAME - A file was renamed within this directory (rename(2)).
DN_ATTRIB - The attributes of a file were changed (chown(2), chmod(2), utime(2), utimensat(2), and similar).
DN_MULTISHOT - Don't remove notifier
|
| public static final int | DN_RENAMEEnum values:
DN_ACCESS - A file was accessed (read(2), pread(2), readv(2), and similar).
DN_MODIFY - A file was modified (write(2), pwrite(2), writev(2), truncate(2), ftruncate(2), and similar).
DN_CREATE -
A file was created (open(2), creat(2), mknod(2), mkdir(2), link(2), symlink(2), rename(2)
into this directory).
DN_DELETE - A file was unlinked (unlink(2), rename(2) to another directory, rmdir(2)).
DN_RENAME - A file was renamed within this directory (rename(2)).
DN_ATTRIB - The attributes of a file were changed (chown(2), chmod(2), utime(2), utimensat(2), and similar).
DN_MULTISHOT - Don't remove notifier
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int | F_SEAL_FUTURE_WRITEEnum values:
F_SEAL_SEAL -
If this seal is set, any further call to fcntl() with F_ADD_SEALS fails with the error EPERM.
Therefore, this seal prevents any modifications to the set of seals itself. If the initial set of seals of a file includes F_SEAL_SEAL,
then this effectively causes the set of seals to be constant and locked.
F_SEAL_SHRINK -
If this seal is set, the file in question cannot be reduced in size.
This affects open(2) with the O_TRUNC flag as well as truncate(2) and ftruncate(2). Those calls fail with EPERM if
you try to shrink the file in question. Increasing the file size is still possible.
F_SEAL_GROW -
If this seal is set, the size of the file in question cannot be increased.
This affects write(2) beyond the end of the file, truncate(2), ftruncate(2), and fallocate(2). These calls fail
with EPERM if you use them to increase the file size. If you keep the size or shrink it, those calls still work as expected.
F_SEAL_WRITE -
If this seal is set, you cannot modify the contents of the file.
Note that shrinking or growing the size of the file is still possible and allowed. Thus, this seal is normally used in combination with one of the
other seals. This seal affects write(2) and fallocate(2) (only in combination with the FALLOC_FL_PUNCH_HOLE flag). Those
calls fail with EPERM if this seal is set. Furthermore, trying to create new shared, writable memory-mappings via mmap(2) will also
fail with EPERM.
Using the F_ADD_SEALS operation to set the F_SEAL_WRITE seal fails with EBUSY if any writable, shared mapping exists. Such
mappings must be unmapped before you can add this seal. Furthermore, if there are any asynchronous I/O operations (io_submit(2)) pending on
the file, all outstanding writes will be discarded.
F_SEAL_FUTURE_WRITE -
The effect of this seal is similar to F_SEAL_WRITE, but the contents of the file can still be modified via shared writable mappings that were
created prior to the seal being set.
Any attempt to create a new writable mapping on the file via mmap(2) will fail with EPERM. Likewise, an attempt to write to the
file via write(2) will fail with EPERM.
Using this seal, one process can create a memory buffer that it can continue to modify while sharing that buffer on a "read-only" basis with other
processes.
(since Linux 5.1)
|
| public static final int | F_SEAL_GROWEnum values:
F_SEAL_SEAL -
If this seal is set, any further call to fcntl() with F_ADD_SEALS fails with the error EPERM.
Therefore, this seal prevents any modifications to the set of seals itself. If the initial set of seals of a file includes F_SEAL_SEAL,
then this effectively causes the set of seals to be constant and locked.
F_SEAL_SHRINK -
If this seal is set, the file in question cannot be reduced in size.
This affects open(2) with the O_TRUNC flag as well as truncate(2) and ftruncate(2). Those calls fail with EPERM if
you try to shrink the file in question. Increasing the file size is still possible.
F_SEAL_GROW -
If this seal is set, the size of the file in question cannot be increased.
This affects write(2) beyond the end of the file, truncate(2), ftruncate(2), and fallocate(2). These calls fail
with EPERM if you use them to increase the file size. If you keep the size or shrink it, those calls still work as expected.
F_SEAL_WRITE -
If this seal is set, you cannot modify the contents of the file.
Note that shrinking or growing the size of the file is still possible and allowed. Thus, this seal is normally used in combination with one of the
other seals. This seal affects write(2) and fallocate(2) (only in combination with the FALLOC_FL_PUNCH_HOLE flag). Those
calls fail with EPERM if this seal is set. Furthermore, trying to create new shared, writable memory-mappings via mmap(2) will also
fail with EPERM.
Using the F_ADD_SEALS operation to set the F_SEAL_WRITE seal fails with EBUSY if any writable, shared mapping exists. Such
mappings must be unmapped before you can add this seal. Furthermore, if there are any asynchronous I/O operations (io_submit(2)) pending on
the file, all outstanding writes will be discarded.
F_SEAL_FUTURE_WRITE -
The effect of this seal is similar to F_SEAL_WRITE, but the contents of the file can still be modified via shared writable mappings that were
created prior to the seal being set.
Any attempt to create a new writable mapping on the file via mmap(2) will fail with EPERM. Likewise, an attempt to write to the
file via write(2) will fail with EPERM.
Using this seal, one process can create a memory buffer that it can continue to modify while sharing that buffer on a "read-only" basis with other
processes.
(since Linux 5.1)
|
| public static final int | F_SEAL_SEALEnum values:
F_SEAL_SEAL -
If this seal is set, any further call to fcntl() with F_ADD_SEALS fails with the error EPERM.
Therefore, this seal prevents any modifications to the set of seals itself. If the initial set of seals of a file includes F_SEAL_SEAL,
then this effectively causes the set of seals to be constant and locked.
F_SEAL_SHRINK -
If this seal is set, the file in question cannot be reduced in size.
This affects open(2) with the O_TRUNC flag as well as truncate(2) and ftruncate(2). Those calls fail with EPERM if
you try to shrink the file in question. Increasing the file size is still possible.
F_SEAL_GROW -
If this seal is set, the size of the file in question cannot be increased.
This affects write(2) beyond the end of the file, truncate(2), ftruncate(2), and fallocate(2). These calls fail
with EPERM if you use them to increase the file size. If you keep the size or shrink it, those calls still work as expected.
F_SEAL_WRITE -
If this seal is set, you cannot modify the contents of the file.
Note that shrinking or growing the size of the file is still possible and allowed. Thus, this seal is normally used in combination with one of the
other seals. This seal affects write(2) and fallocate(2) (only in combination with the FALLOC_FL_PUNCH_HOLE flag). Those
calls fail with EPERM if this seal is set. Furthermore, trying to create new shared, writable memory-mappings via mmap(2) will also
fail with EPERM.
Using the F_ADD_SEALS operation to set the F_SEAL_WRITE seal fails with EBUSY if any writable, shared mapping exists. Such
mappings must be unmapped before you can add this seal. Furthermore, if there are any asynchronous I/O operations (io_submit(2)) pending on
the file, all outstanding writes will be discarded.
F_SEAL_FUTURE_WRITE -
The effect of this seal is similar to F_SEAL_WRITE, but the contents of the file can still be modified via shared writable mappings that were
created prior to the seal being set.
Any attempt to create a new writable mapping on the file via mmap(2) will fail with EPERM. Likewise, an attempt to write to the
file via write(2) will fail with EPERM.
Using this seal, one process can create a memory buffer that it can continue to modify while sharing that buffer on a "read-only" basis with other
processes.
(since Linux 5.1)
|
| public static final int | F_SEAL_SHRINKEnum values:
F_SEAL_SEAL -
If this seal is set, any further call to fcntl() with F_ADD_SEALS fails with the error EPERM.
Therefore, this seal prevents any modifications to the set of seals itself. If the initial set of seals of a file includes F_SEAL_SEAL,
then this effectively causes the set of seals to be constant and locked.
F_SEAL_SHRINK -
If this seal is set, the file in question cannot be reduced in size.
This affects open(2) with the O_TRUNC flag as well as truncate(2) and ftruncate(2). Those calls fail with EPERM if
you try to shrink the file in question. Increasing the file size is still possible.
F_SEAL_GROW -
If this seal is set, the size of the file in question cannot be increased.
This affects write(2) beyond the end of the file, truncate(2), ftruncate(2), and fallocate(2). These calls fail
with EPERM if you use them to increase the file size. If you keep the size or shrink it, those calls still work as expected.
F_SEAL_WRITE -
If this seal is set, you cannot modify the contents of the file.
Note that shrinking or growing the size of the file is still possible and allowed. Thus, this seal is normally used in combination with one of the
other seals. This seal affects write(2) and fallocate(2) (only in combination with the FALLOC_FL_PUNCH_HOLE flag). Those
calls fail with EPERM if this seal is set. Furthermore, trying to create new shared, writable memory-mappings via mmap(2) will also
fail with EPERM.
Using the F_ADD_SEALS operation to set the F_SEAL_WRITE seal fails with EBUSY if any writable, shared mapping exists. Such
mappings must be unmapped before you can add this seal. Furthermore, if there are any asynchronous I/O operations (io_submit(2)) pending on
the file, all outstanding writes will be discarded.
F_SEAL_FUTURE_WRITE -
The effect of this seal is similar to F_SEAL_WRITE, but the contents of the file can still be modified via shared writable mappings that were
created prior to the seal being set.
Any attempt to create a new writable mapping on the file via mmap(2) will fail with EPERM. Likewise, an attempt to write to the
file via write(2) will fail with EPERM.
Using this seal, one process can create a memory buffer that it can continue to modify while sharing that buffer on a "read-only" basis with other
processes.
(since Linux 5.1)
|
| public static final int | F_SEAL_WRITEEnum values:
F_SEAL_SEAL -
If this seal is set, any further call to fcntl() with F_ADD_SEALS fails with the error EPERM.
Therefore, this seal prevents any modifications to the set of seals itself. If the initial set of seals of a file includes F_SEAL_SEAL,
then this effectively causes the set of seals to be constant and locked.
F_SEAL_SHRINK -
If this seal is set, the file in question cannot be reduced in size.
This affects open(2) with the O_TRUNC flag as well as truncate(2) and ftruncate(2). Those calls fail with EPERM if
you try to shrink the file in question. Increasing the file size is still possible.
F_SEAL_GROW -
If this seal is set, the size of the file in question cannot be increased.
This affects write(2) beyond the end of the file, truncate(2), ftruncate(2), and fallocate(2). These calls fail
with EPERM if you use them to increase the file size. If you keep the size or shrink it, those calls still work as expected.
F_SEAL_WRITE -
If this seal is set, you cannot modify the contents of the file.
Note that shrinking or growing the size of the file is still possible and allowed. Thus, this seal is normally used in combination with one of the
other seals. This seal affects write(2) and fallocate(2) (only in combination with the FALLOC_FL_PUNCH_HOLE flag). Those
calls fail with EPERM if this seal is set. Furthermore, trying to create new shared, writable memory-mappings via mmap(2) will also
fail with EPERM.
Using the F_ADD_SEALS operation to set the F_SEAL_WRITE seal fails with EBUSY if any writable, shared mapping exists. Such
mappings must be unmapped before you can add this seal. Furthermore, if there are any asynchronous I/O operations (io_submit(2)) pending on
the file, all outstanding writes will be discarded.
F_SEAL_FUTURE_WRITE -
The effect of this seal is similar to F_SEAL_WRITE, but the contents of the file can still be modified via shared writable mappings that were
created prior to the seal being set.
Any attempt to create a new writable mapping on the file via mmap(2) will fail with EPERM. Likewise, an attempt to write to the
file via write(2) will fail with EPERM.
Using this seal, one process can create a memory buffer that it can continue to modify while sharing that buffer on a "read-only" basis with other
processes.
(since Linux 5.1)
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int | O_ACCMODEEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_APPENDEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_ASYNCEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_CLOEXECEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_CREATEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_DIRECTEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_DIRECTORYEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_DSYNCEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_EXCLEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_LARGEFILEEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_NDELAYEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_NOATIMEEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_NOCTTYEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_NOFOLLOWEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_NONBLOCKEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_PATHEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_RDONLYEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_RDWREnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_SYNCEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_TMPFILEEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_TRUNCEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int | O_WRONLYEnum values:
O_ACCMODE
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND -
The file is opened in append mode.
Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to
corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a
file, so the client kernel has to simulate it, which can't be done without a race condition.
O_ASYNC -
Enable signal-driven I/O: generate a signal (SIGIO by default, but this can be changed via fcntl(2)) when input or output becomes
possible on this file descriptor.
This feature is only available for terminals, pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See fcntl(2) for further
details.
O_CLOEXEC -
Enable the close-on-exec flag for the new file descriptor.
Specifying this flag permits a program to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. Additionally,
use of this flag is essential in some multithreaded programs since using a separate fcntl(2) F_SETFD operation to set the
FD_CLOEXEC flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same time as another thread does
a fork(2) plus execve(2).
O_CREAT -
If the file does not exist it will be created.
The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group
ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent
directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
O_DIRECT -
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done
directly to/from user-space buffers. The O_DIRECT flag on its own makes an effort to transfer data synchronously, but does not give the
guarantees of the O_SYNC flag that data and necessary metadata are transferred. To guarantee synchronous I/O, O_SYNC must be used
in addition to O_DIRECT.
A semantically similar (but deprecated) interface for block devices is described in raw(8).
O_DIRECTORY -
If pathname is not a directory, cause the open to fail.
This flag is Linux-specific, and was added in kernel version 2.1.126, to avoid denial-of-service problems if opendir(3) is called on a FIFO
or tape device, but should not be used outside of the implementation of opendir(3).
O_DSYNC
O_EXCL -
Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then
open() will fail.
When these two flags are specified, symbolic links are not followed: if pathname is a symbolic link, then open() fails regardless
of where the symbolic link points to.
In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one exception: on Linux 2.6 and later,
O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g.,
mounted), open() fails with the error EBUSY.
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel 2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will contain a race condition. Portable programs that want to perform atomic file
locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can create a unique file on the same file system (e.g.,
incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful.
O_LARGEFILE -
(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.
The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the
_FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on
32-bit systems (see feature_test_macros(7)).
O_NOATIME -
Do not update the file last access time (st_atime in the inode) when the file is read(2).
This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag may not
be effective on all file systems. One example is NFS, where the server maintains the access time.
O_NOCTTY -
If pathname refers to a terminal device --see tty(4)-- it will not become the process's controlling terminal even if the process
does not have one.
O_NOFOLLOW -
If pathname is a symbolic link, then the open fails.
This is a FreeBSD extension, which was added to Linux in version 2.1.126. Symbolic links in earlier components of the pathname will still
be followed.
O_NONBLOCK -
When possible, the file is opened in nonblocking mode.
Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the
handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file
locks and with file leases, see fcntl(2).
O_NDELAY
O_PATH
O_SYNC -
The file is opened for synchronous I/O.
Any write(2)s on the resulting file descriptor will block the calling process until the data has been physically written to the underlying
hardware.
O_TMPFILE
O_TRUNC -
If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0.
If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int |
|
| public static final int | S_IFBLKFile types encoded in type mode_t.
|
| public static final int | S_IFCHRFile types encoded in type mode_t.
|
| public static final int | S_IFDIRFile types encoded in type mode_t.
|
| public static final int | S_IFIFOFile types encoded in type mode_t.
|
| public static final int | S_IFLNKFile types encoded in type mode_t.
|
| public static final int | S_IFMTFile types encoded in type mode_t.
|
| public static final int | S_IFREGFile types encoded in type mode_t.
|
| public static final int | S_IFSOCKFile types encoded in type mode_t.
|
| public static final int | S_IRGRPFile mode bits encoded in type mode_t.
|
| public static final int | S_IROTHFile mode bits encoded in type mode_t.
|
| public static final int | S_IRUSRFile mode bits encoded in type mode_t.
|
| public static final int | S_IRWXGFile mode bits encoded in type mode_t.
|
| public static final int | S_IRWXOFile mode bits encoded in type mode_t.
|
| public static final int | S_IRWXUFile mode bits encoded in type mode_t.
|
| public static final int | S_ISGIDFile mode bits encoded in type mode_t.
|
| public static final int | S_ISUIDFile mode bits encoded in type mode_t.
|
| public static final int | S_ISVTXFile mode bits encoded in type mode_t.
|
| public static final int | S_IWGRPFile mode bits encoded in type mode_t.
|
| public static final int | S_IWOTHFile mode bits encoded in type mode_t.
|
| public static final int | S_IWUSRFile mode bits encoded in type mode_t.
|
| public static final int | S_IXGRPFile mode bits encoded in type mode_t.
|
| public static final int | S_IXOTHFile mode bits encoded in type mode_t.
|
| public static final int | S_IXUSRFile mode bits encoded in type mode_t.
|