2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 POSIX.1-2008 function open().
11 /*****************************************************************************
19 const char * pathname
,
24 Opens a file with the specified flags and name.
27 pathname - Path and filename of the file you want to open.
28 flags - Most be exactly one of: O_RDONLY, O_WRONLY or O_RDWR
29 to open a file for reading, writing or for reading and
32 The mode can be modified by or'ing the following bits in:
34 O_CREAT: Create the file if it doesn't exist (only for
35 O_WRONLY or O_RDWR). If this flag is set, then
36 open() will look for a third parameter mode. mode
37 must contain the access modes for the file
39 O_EXCL: Only with O_CREAT. If the file does already exist,
40 then open() fails. See BUGS.
42 O_TRUNC: If the file exists, then it gets overwritten. This
43 is the default and the opposite to O_APPEND.
44 O_APPEND: If the file exists, then the startung position for
45 writes is the end of the file.
46 O_NONBLOCK or O_NDELAY: Opens the file in non-blocking mode.
47 If there is no data in the file, then read() on a
48 terminal will return immediately instead of waiting
49 until data arrives. Has no effect on write().
50 O_SYNC: The process will be stopped for each write() and the
51 data will be flushed before the write() returns.
52 This ensures that the data is physically written
53 when write() returns. If this flag is not specified,
54 the data is written into a buffer and flushed only
58 -1 for error or a file descriptor for use with read(), write(), etc.
61 If the filesystem doesn't allow to specify different access modes
62 for users, groups and others, then the user modes are used.
64 This function must not be used in a shared library or
65 in a threaded application.
71 The flag O_EXCL is not very reliable if the file resides on a NFS
74 Most flags are not supported right now.
77 close(), read(), write(), fopen()
81 ******************************************************************************/
90 mode
= va_arg(ap
, int);
94 return __open(__getfirstfd(0), pathname
, flags
, mode
);