Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/open.2
Show First 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | |||||
O_NONBLOCK do not block on open | O_NONBLOCK do not block on open | ||||
O_APPEND append on each write | O_APPEND append on each write | ||||
O_CREAT create file if it does not exist | O_CREAT create file if it does not exist | ||||
O_TRUNC truncate size to 0 | O_TRUNC truncate size to 0 | ||||
O_EXCL error if create and file exists | O_EXCL error if create and file exists | ||||
O_SHLOCK atomically obtain a shared lock | O_SHLOCK atomically obtain a shared lock | ||||
O_EXLOCK atomically obtain an exclusive lock | O_EXLOCK atomically obtain an exclusive lock | ||||
O_DIRECT eliminate or reduce cache effects | O_DIRECT eliminate or reduce cache effects | ||||
O_FSYNC synchronous writes | O_FSYNC synchronous writes (historical synonym for O_SYNC) | ||||
O_SYNC synchronous writes | O_SYNC synchronous writes | ||||
O_DSYNC synchronous data writes | |||||
O_NOFOLLOW do not follow symlinks | O_NOFOLLOW do not follow symlinks | ||||
O_NOCTTY ignored | O_NOCTTY ignored | ||||
O_TTY_INIT ignored | O_TTY_INIT ignored | ||||
O_DIRECTORY error if file is not a directory | O_DIRECTORY error if file is not a directory | ||||
O_CLOEXEC set FD_CLOEXEC upon open | O_CLOEXEC set FD_CLOEXEC upon open | ||||
O_VERIFY verify the contents of the file | O_VERIFY verify the contents of the file | ||||
O_BENEATH require resolved path to be strictly relative to topping directory | O_BENEATH require resolved path to be strictly relative to topping directory | ||||
O_RESOLVE_BENEATH require walked path to be strictly relative to topping directory | O_RESOLVE_BENEATH require walked path to be strictly relative to topping directory | ||||
Show All 31 Lines | |||||
system call would result | system call would result | ||||
in the process being blocked for some reason (e.g., waiting for | in the process being blocked for some reason (e.g., waiting for | ||||
carrier on a dialup line), | carrier on a dialup line), | ||||
.Fn open | .Fn open | ||||
returns immediately. | returns immediately. | ||||
The descriptor remains in non-blocking mode for subsequent operations. | The descriptor remains in non-blocking mode for subsequent operations. | ||||
.Pp | .Pp | ||||
If | If | ||||
.Dv O_FSYNC | .Dv O_SYNC | ||||
is used in the mask, all writes will | is used in the mask, all writes will | ||||
immediately and synchronously be written to disk. | immediately and synchronously be written to disk. | ||||
.Pp | |||||
.Dv O_SYNC | |||||
is a synonym for | |||||
.Dv O_FSYNC | .Dv O_FSYNC | ||||
required by | is an historical synonym for | ||||
.Tn POSIX . | .Dv O_SYNC . | ||||
.Pp | .Pp | ||||
If | If | ||||
.Dv O_DSYNC | |||||
is used in the mask, all data and metadata required to read the data will be | |||||
kib: ... all data and metadata required to read the data back will be ... | |||||
synchronously written to disk, but changes to metadata such as file access and | |||||
modification timestamps may be written later. | |||||
.Pp | |||||
If | |||||
.Dv O_NOFOLLOW | .Dv O_NOFOLLOW | ||||
is used in the mask and the target file passed to | is used in the mask and the target file passed to | ||||
.Fn open | .Fn open | ||||
is a symbolic link then the | is a symbolic link then the | ||||
.Fn open | .Fn open | ||||
will fail. | will fail. | ||||
.Pp | .Pp | ||||
When opening a file, a lock with | When opening a file, a lock with | ||||
▲ Show 20 Lines • Show All 394 Lines • ▼ Show 20 Lines | |||||
The | The | ||||
.Fn open | .Fn open | ||||
function appeared in | function appeared in | ||||
.At v1 . | .At v1 . | ||||
The | The | ||||
.Fn openat | .Fn openat | ||||
function was introduced in | function was introduced in | ||||
.Fx 8.0 . | .Fx 8.0 . | ||||
.Dv O_DSYNC | |||||
appeared in 13.0. | |||||
Not Done Inline ActionsBTW I see no reason to not merge this to 12. kib: BTW I see no reason to not merge this to 12. | |||||
.Sh BUGS | .Sh BUGS | ||||
The Open Group Extended API Set 2 specification requires that the test | The Open Group Extended API Set 2 specification requires that the test | ||||
for whether | for whether | ||||
.Fa fd | .Fa fd | ||||
is searchable is based on whether | is searchable is based on whether | ||||
.Fa fd | .Fa fd | ||||
is open for searching, not whether the underlying directory currently | is open for searching, not whether the underlying directory currently | ||||
permits searches. | permits searches. | ||||
The present implementation of the | The present implementation of the | ||||
.Fa openat | .Fa openat | ||||
checks the current permissions of directory instead. | checks the current permissions of directory instead. | ||||
.Pp | .Pp | ||||
The | The | ||||
.Fa mode | .Fa mode | ||||
argument is variadic and may result in different calling conventions | argument is variadic and may result in different calling conventions | ||||
than might otherwise be expected. | than might otherwise be expected. |
... all data and metadata required to read the data back will be ...