summaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-04-21 15:47:29 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-04-21 15:47:29 +0000
commit631703afd6002f38b0b4e76504c91e3ab397f3f3 (patch)
treee1c92eb0a24aa1d97dc1fa06ef01e3e05d518f58 /lib/libc/sys
parent8a8d1486bb7edce317af04782ff5f525856713f9 (diff)
Change kernel-only open flag FNOSYMLINK to userland-visible O_NOFOLLOW;
adapated from FreeBSD. Also change O_FSYNC to the more standard O_SYNC and document it. open(2) needs some real examples for proper usage, to come later.
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/open.239
1 files changed, 36 insertions, 3 deletions
diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2
index 860340e6b63..062ff002537 100644
--- a/lib/libc/sys/open.2
+++ b/lib/libc/sys/open.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: open.2,v 1.14 2000/04/10 19:36:02 deraadt Exp $
+.\" $OpenBSD: open.2,v 1.15 2000/04/21 15:47:27 millert Exp $
.\" $NetBSD: open.2,v 1.8 1995/02/27 12:35:14 cgd Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
@@ -77,8 +77,10 @@ O_APPEND append on each write
O_CREAT create file if it does not exist
O_TRUNC truncate size to 0
O_EXCL error if create and file exists
+O_SYNC perform syncronous I/O operations
O_SHLOCK atomically obtain a shared lock
O_EXLOCK atomically obtain an exclusive lock
+O_NOFOLLOW if last path element is a symlink, don't follow it
.Ed
.Pp
Opening a file with
@@ -97,9 +99,11 @@ exists,
.Fn open
returns an error. This may be used to
implement a simple exclusive access locking mechanism.
-If
+If either of
.Dv O_EXCL
-is set and the last component of the pathname is
+or
+.Dv O_NOFOLLOW
+are set and the last component of the pathname is
a symbolic link,
.Fn open
will fail even if the symbolic
@@ -115,6 +119,9 @@ carrier on a dialup line),
.Fn open
returns immediately.
This flag also has the effect of making all subsequent I/O on the open file non-blocking.
+If the
+.Dv O_SYNC
+flag is set, all I/O operations on the file will be done syncronously.
.Pp
When opening a file, a lock with
.Xr flock 2
@@ -275,6 +282,32 @@ is already locked.
.Xr umask 2 ,
.Xr write 2 ,
.Xr getdtablesize 3
+.Sh STANDARDS
+The
+.Fn open
+function conforms to
+.St -ansiC ,
+.St -p1003.1-90
+and
+.St -xpg4.2 .
+.Pp
+.Dv POSIX
+specifies three different flavors for syncronous I/O:
+.Dv O_SYNC ,
+.Dv O_DSYNC
+and
+.Dv O_RSYNC .
+In
+.Ox ,
+these are all equivalent.
+.Pp
+The
+.Dv O_SHLOCK ,
+.Dv O_EXLOCK
+and
+.Dv O_NOFOLLOW
+flags are non-standard extensions and should not be used if portability
+is of concern.
.Sh HISTORY
An
.Fn open