open.2 (69336) | open.2 (77115) |
---|---|
1.\" Copyright (c) 1980, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)open.2 8.2 (Berkeley) 11/16/93 | 1.\" Copyright (c) 1980, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)open.2 8.2 (Berkeley) 11/16/93 |
33.\" $FreeBSD: head/lib/libc/sys/open.2 69336 2000-11-29 04:08:49Z alfred $ | 33.\" $FreeBSD: head/lib/libc/sys/open.2 77115 2001-05-24 07:22:27Z dillon $ |
34.\" 35.Dd November 16, 1993 36.Dt OPEN 2 37.Os BSD 4 38.Sh NAME 39.Nm open 40.Nd open or create a file for reading or writing 41.Sh LIBRARY --- 36 unchanged lines hidden (view full) --- 78O_RDWR open for reading and writing 79O_NONBLOCK do not block on open 80O_APPEND append on each write 81O_CREAT create file if it does not exist 82O_TRUNC truncate size to 0 83O_EXCL error if create and file exists 84O_SHLOCK atomically obtain a shared lock 85O_EXLOCK atomically obtain an exclusive lock | 34.\" 35.Dd November 16, 1993 36.Dt OPEN 2 37.Os BSD 4 38.Sh NAME 39.Nm open 40.Nd open or create a file for reading or writing 41.Sh LIBRARY --- 36 unchanged lines hidden (view full) --- 78O_RDWR open for reading and writing 79O_NONBLOCK do not block on open 80O_APPEND append on each write 81O_CREAT create file if it does not exist 82O_TRUNC truncate size to 0 83O_EXCL error if create and file exists 84O_SHLOCK atomically obtain a shared lock 85O_EXLOCK atomically obtain an exclusive lock |
86O_DIRECT eliminate or reduce cache effects |
|
86O_FSYNC synchronous writes 87O_NOFOLLOW do not follow symlinks 88.Ed 89.Pp 90Opening a file with 91.Dv O_APPEND 92set causes each write on the file 93to be appended to the end. If --- 51 unchanged lines hidden (view full) --- 145for a shared lock, or 146.Dv O_EXLOCK 147for an exclusive lock. 148If creating a file with 149.Dv O_CREAT , 150the request for the lock will never fail 151(provided that the underlying filesystem supports locking). 152.Pp | 87O_FSYNC synchronous writes 88O_NOFOLLOW do not follow symlinks 89.Ed 90.Pp 91Opening a file with 92.Dv O_APPEND 93set causes each write on the file 94to be appended to the end. If --- 51 unchanged lines hidden (view full) --- 146for a shared lock, or 147.Dv O_EXLOCK 148for an exclusive lock. 149If creating a file with 150.Dv O_CREAT , 151the request for the lock will never fail 152(provided that the underlying filesystem supports locking). 153.Pp |
154.Dv O_DIRECT may be used to 155minimize or eliminate the cache effects of reading and writing. The system 156will attempt to avoid caching the data you read or write. If it cannot 157avoid caching the data, it will minimize the impact the data has on the cache. 158Use of this flag can drastically reduce performance if not used with care. 159.Pp |
|
153If successful, 154.Fn open 155returns a non-negative integer, termed a file descriptor. 156It returns -1 on failure. 157The file pointer used to mark the current position within the 158file is set to the beginning of the file. 159.Pp 160When a new file is created it is given the group of the directory --- 171 unchanged lines hidden --- | 160If successful, 161.Fn open 162returns a non-negative integer, termed a file descriptor. 163It returns -1 on failure. 164The file pointer used to mark the current position within the 165file is set to the beginning of the file. 166.Pp 167When a new file is created it is given the group of the directory --- 171 unchanged lines hidden --- |