os/ossrv/genericopenlibs/openenvcore/include/sys/fcntl.dosc
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/sys/fcntl.dosc	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,754 @@
     1.4 +/** @file  ../include/sys/fcntl.h
     1.5 +@internalComponent
     1.6 +*/
     1.7 +
     1.8 +/** @fn  open(const char *file, int flags, ...)
     1.9 +@param file
    1.10 +@param flags
    1.11 +@param ...
    1.12 +@return   If successful, open returns a non-negative integer, termed a file descriptor. It returns 
    1.13 +-1 on failure and sets errno to indicate the error.
    1.14 +
    1.15 +  The file name specified by file is opened for reading and/or writing, as specified by the argument flags , and the file descriptor returned to the calling process. The flags argument may indicate that the file is to be created if it does 
    1.16 +not exist (by specifying the O_CREAT flag). In this case open requires a third argument, mode_t mode , and the file is created with mode as described in chmod and modified by the process' umask 
    1.17 +value (see umask )
    1.18 +
    1.19 +
    1.20 +
    1.21 + The flags specified are formed by OR'ing the following values
    1.22 +
    1.23 +@code
    1.24 +
    1.25 +O_RDONLYopen for reading only
    1.26 +O_WRONLYopen for writing only
    1.27 +O_RDWRopen for reading and writing
    1.28 +O_NONBLOCKdo not block on open
    1.29 +O_APPENDappend on each write
    1.30 +O_CREATcreate file if it does not exist
    1.31 +O_TRUNCtruncate size to 0
    1.32 +O_EXCLerror if create and file exists
    1.33 +O_SHLOCKatomically obtain a shared lock
    1.34 +O_EXLOCKatomically obtain an exclusive lock
    1.35 +O_DIRECTeliminate or reduce cache effects
    1.36 +O_FSYNCsynchronous writes
    1.37 +O_NOFOLLOWdo not follow symlinks
    1.38 +Following options are currently not supported :
    1.39 +O_NONBLOCK, O_SHLOCK, O_EXLOCK, O_DIRECT, O_FSYNC, O_NOFOLLOW.
    1.40 +@endcode
    1.41 +O_LARGEFILE
    1.42 +This flag, if passed into the open() API, enables it to open a large file (files with 64 bit file sizes)
    1.43 +
    1.44 +
    1.45 + Opening a file with O_APPEND set causes each write on the file
    1.46 +to be appended to the end.
    1.47 +
    1.48 + If O_TRUNC is specified, and the file exists, the file is truncated to 
    1.49 +  zero length.
    1.50 +
    1.51 + If O_EXCL is set with O_CREAT and the file already
    1.52 +exists, open returns an error.
    1.53 +This may be used to
    1.54 +implement a simple exclusive access locking mechanism.
    1.55 +
    1.56 + If O_EXCL is set and the last component of the pathname is
    1.57 +a symbolic link, open will fail even if the symbolic
    1.58 +link points to a non-existent name.
    1.59 +
    1.60 + If the O_NONBLOCK flag is specified and the open system call would result in the process being blocked for some 
    1.61 +  reason (e.g., waiting for carrier on a dialup line), open returns immediately. The descriptor remains in non-blocking mode 
    1.62 +  for subsequent operations. This mode need not have any effect on files other 
    1.63 +  than FIFOs.
    1.64 +
    1.65 + If O_FSYNC is used in the mask all writes will immediately be written 
    1.66 +  to disk, the kernel will not cache written data and all writes on the descriptor 
    1.67 +  will not return until the data to be written completes.
    1.68 +
    1.69 + If O_NOFOLLOW is used in the mask and the target file passed to open is a symbolic link the open will fail.
    1.70 +
    1.71 + When opening a file, a lock with flock semantics can be obtained by setting O_SHLOCK for a shared lock or O_EXLOCK for an exclusive lock. If creating a file with O_CREAT, the request for the lock will never fail (provided that the 
    1.72 +  underlying file system supports locking).
    1.73 +
    1.74 + O_DIRECT may be used to minimize or eliminate the cache effects of 
    1.75 +  reading and writing. The system will attempt to avoid caching the data being 
    1.76 +  read or written. If it cannot avoid caching the data, it will minimize the impact 
    1.77 +  the data has on the cache. Use of this flag can drastically reduce performance 
    1.78 +  if not used with care.
    1.79 +
    1.80 + If successful, open returns a non-negative integer termed a file descriptor. It returns 
    1.81 +  -1 on failure. The file pointer used to mark the current position within the 
    1.82 +  file is set to the beginning of the file.
    1.83 +
    1.84 + When a new file is created it is given the group of the directory
    1.85 +which contains it.
    1.86 +
    1.87 + The new descriptor is set to remain open across execve system calls.; See close and fcntl .
    1.88 +
    1.89 + The system imposes a limit on the number of file descriptors
    1.90 +open simultaneously by one process.
    1.91 +The getdtablesize system call returns the current system limit.
    1.92 +
    1.93 +
    1.94 +
    1.95 + Notes:
    1.96 +
    1.97 + 1) Mode values for group and others are ignored
    1.98 +
    1.99 + 2) Execute bit and setuid on exec bit are ignored.
   1.100 +
   1.101 + 3) The default working directory of a process is initalized to C: \\private\\UID 
   1.102 +  (UID of the calling application) and any data written into this directory persists 
   1.103 +  between phone resets.
   1.104 +
   1.105 + 4) If the specified file is a symbolic link and the file it is pointing to 
   1.106 +  is invalid, the symbolic link file will be automatically removed.
   1.107 +
   1.108 + 5) A file in cannot be created with write-only permissions. Attempting to create 
   1.109 +  a file with write-only permissions will result in a file with read-write permission.
   1.110 +
   1.111 + 6) Creating a new file with the O_CREAT flag does not alter the time stamp 
   1.112 +  of the parent directory.
   1.113 +
   1.114 + 7) A file has only two time stamps: access and modification. Creation time 
   1.115 +  stamp of the file is not supported and access time stamp is initially set equal 
   1.116 +  to modification time stamp.
   1.117 +
   1.118 + 8) Users should not use O_DIRECT flag as the underlying implementation makes explicit
   1.119 +   use of O_DIRECT by default. Instead if the users want to use read/write 
   1.120 +   buffering they can use O_BUFFERED.
   1.121 +
   1.122 + 9) Users should not use O_BINARY flag as the underlying implementation opens a file 
   1.123 +   in binary mode by default. Instead if the users want to open the file in text mode 
   1.124 +   they can use O_TEXT.
   1.125 +
   1.126 +Examples:
   1.127 +@code
   1.128 +/* This example creates a file in the current working directory and 
   1.129 + * opens it in read-write mode. */
   1.130 +#include <sys/types.h>
   1.131 +#include <sys/stat.h>
   1.132 +#include <fcntl.h>
   1.133 +int main()
   1.134 +{
   1.135 +  int fd = 0;
   1.136 +   fd = open("Example.txt" , O_CREAT | O_EXCL , 0666);
   1.137 +   if(fd < 0 ) 
   1.138 +   {
   1.139 +      printf("Failed to create and open file in current working directory 
   1.140 +");
   1.141 +      return -1;
   1.142 +   }
   1.143 +   printf("File created and opened in current working directory 
   1.144 +"  );
   1.145 +   return 0;
   1.146 +}
   1.147 +
   1.148 +@endcode
   1.149 + Output
   1.150 +@code
   1.151 +File created and opened in current working directory
   1.152 +
   1.153 +@endcode
   1.154 +@see chmod()
   1.155 +@see close()
   1.156 +@see dup()
   1.157 +@see getdtablesize()
   1.158 +@see lseek()
   1.159 +@see read()
   1.160 +@see umask()
   1.161 +@see write()
   1.162 +@see fopen()
   1.163 +
   1.164 +Limitations:
   1.165 +
   1.166 +KErrNotReady of Symbian error code is mapped to ENOENT, which typically means drive
   1.167 +not found or filesystem not mounted on the drive.
   1.168 +
   1.169 +@capability Deferred @ref RFs::Entry(const TDesC16&, TEntry&) const
   1.170 +
   1.171 +@publishedAll
   1.172 +@externallyDefinedApi
   1.173 +*/
   1.174 +
   1.175 +
   1.176 +/** @fn  open64(const char *file, int flags, ...)
   1.177 +@param file
   1.178 +@param flags
   1.179 +@param ...
   1.180 +@return   If successful, open64() returns a non-negative integer, termed a file descriptor. It returns 
   1.181 +-1 on failure and sets errno to indicate the error.
   1.182 +
   1.183 +
   1.184 +For full documentation see: http://www.unix.org/version2/whatsnew/lfs20mar.html#3.0
   1.185 +
   1.186 +@see open()
   1.187 +
   1.188 +@publishedAll
   1.189 +@externallyDefinedApi
   1.190 +*/
   1.191 +
   1.192 +/**@typedef typedef	__off_t		off64_t;
   1.193 +
   1.194 +Large file offsets.
   1.195 +
   1.196 +@publishedAll
   1.197 +@externallyDefinedApi
   1.198 +*/
   1.199 +
   1.200 +/** @fn  creat(const char *file, mode_t mode)
   1.201 +@param file
   1.202 +@param mode
   1.203 +@return   open and creat return the new file descriptor, or -1 if an error occurred (in 
   1.204 +  which case errno is set appropriately).  
   1.205 +
   1.206 +  This interface is made obsolete by: open
   1.207 +
   1.208 + The creat function
   1.209 +is the same as: open(path, O_CREAT | O_TRUNC | O_WRONLY, mode); Limitation :Creating a new file doesn't alter the time stamp of parent directory, created entry has only two time stamps access and modification timestamps.
   1.210 +Creation time stamp of the file is not supported, here accesstime stamp is equal to modification time stamp.
   1.211 +
   1.212 +Examples:
   1.213 +@code
   1.214 +/* Detailed description   : This test code demonstrates creat system call usage, it creates a
   1.215 + * in current working directory(if file exists then it is truncated. Preconditions : None */
   1.216 +#include <sys/types.h>
   1.217 +#include <sys/stat.h>
   1.218 +#include <fcntl.h>
   1.219 +int main()
   1.220 +{
   1.221 + int fd = 0;
   1.222 +  fd = creat("Example.txt" , 0666);
   1.223 +  if(fd < 0 )  
   1.224 +  {
   1.225 +    printf("File creation failed 
   1.226 +");
   1.227 +    return -1;
   1.228 +  }
   1.229 +  printf("Example.txt file created 
   1.230 +");
   1.231 +  return 0;
   1.232 +}
   1.233 +
   1.234 +@endcode
   1.235 + Output
   1.236 +@code
   1.237 +Example.txt file created
   1.238 +
   1.239 +@endcode
   1.240 +@see open()
   1.241 +
   1.242 +Limitations:
   1.243 +
   1.244 +KErrNotReady of Symbian error code is mapped to ENOENT, which typically means drive
   1.245 +not found or filesystem not mounted on the drive.
   1.246 +
   1.247 +@capability Deferred @ref RFs::Entry(const TDesC16&, TEntry&) const
   1.248 +
   1.249 +@publishedAll
   1.250 +@externallyDefinedApi
   1.251 +*/
   1.252 +
   1.253 +/** @fn  creat64(const char *file, mode_t mode)
   1.254 +@param file
   1.255 +@param mode
   1.256 +@return   creat64() returns the new file descriptor, or -1 if an error occurred (in 
   1.257 +  which case errno is set appropriately).  
   1.258 +
   1.259 +For full documentation see: http://www.unix.org/version2/whatsnew/lfs20mar.html#3.0
   1.260 +
   1.261 +@see creat()
   1.262 +
   1.263 +@publishedAll
   1.264 +@externallyDefinedApi
   1.265 +*/
   1.266 +
   1.267 +/** @fn  fcntl(int aFid, int aCmd, ...)
   1.268 +@param aFid
   1.269 +@param aCmd
   1.270 +@param ...
   1.271 +@return   Upon successful completion, the value returned depends on cmd as follows: F_DUPFD A new file descriptor. F_GETFD Value of flag (only the low-order bit is defined). F_GETFL Value of flags. F_GETOWN Value of file descriptor owner (Not supported). other Value other than -1. Otherwise, a value of -1 is returned and errno is set to indicate the error.
   1.272 +
   1.273 +@code
   1.274 +The fcntl system call provides for control over descriptors. The argument fd is a descriptor to be operated on by cmd as described below. Depending on the value of cmd, fcntl can take an additional third argument int arg.
   1.275 +
   1.276 + F_DUPFD Return a new descriptor as follows: Lowest numbered available descriptor greater than or equal to arg. Same object references as the original descriptor. New descriptor shares the same file offset if the object
   1.277 + was a file. Same access mode (read, write or read/write). Same file status flags (i.e., both file descriptors
   1.278 + share the same file status flags). The close-on-exec flag associated with the new file descriptor
   1.279 + is set to remain open across execve
   1.280 + system calls. 
   1.281 + 
   1.282 + Limitations: 
   1.283 + 
   1.284 + The difference between two file descriptors passed must not 
   1.285 +       be greater than 8. If the difference is greater than 8 then behaviour of 
   1.286 +       fcntl system call is undefined.F_SELKW flag is not supported because of underlying platform limitations.
   1.287 + F_RDLCK is not supported because  the native platform only supports exclusive locks and not shared locks.
   1.288 +
   1.289 +
   1.290 +@code
   1.291 +
   1.292 + O_NONBLOCK Non-blocking I/O; if no data is available to a read system call, or if a write operation would block, the read or 
   1.293 +       write call returns -1 with the error EAGAIN. (This flag is Not supported for files)
   1.294 + O_APPEND Force each write to append at the end of file;
   1.295 + corresponds to the O_APPEND flag of open .
   1.296 + (Setting this flag in fcntl currently has no effect on subsequent write system calls)
   1.297 + O_DIRECT Minimize or eliminate the cache effects of reading and writing. The system 
   1.298 +       will attempt to avoid caching data during read or write. If it cannot avoid 
   1.299 +       caching the data it will minimize the impact the data has on the cache. 
   1.300 +       Use of this flag can drastically reduce performance if not used with care 
   1.301 +       (Not supported).
   1.302 + O_ASYNC Enable the SIGIO signal to be sent to the process group when I/O is possible, 
   1.303 +       e.g. upon availability of data to be read (Not supported).
   1.304 +
   1.305 + F_GETLK Get the first lock that blocks the lock description pointed to by the
   1.306 + third argument, arg, taken as a pointer to a struct flock (see above).
   1.307 + The information retrieved overwrites the information passed to fcntl in the flock structure.
   1.308 + If no lock is found that would prevent this lock from being created,
   1.309 + the structure is left unchanged by this system call except for the
   1.310 + lock type which is set to F_UNLCK .
   1.311 + F_SETLK Set or clear a file segment lock according to the lock description
   1.312 + pointed to by the third argument, arg, taken as a pointer to a struct flock (see above). 
   1.313 + F_SETLK is used to establish shared (or read) locks ( F_RDLCK )( "F_RDLCK"  is  not supported)
   1.314 + or exclusive (or write) locks, ( F_WRLCK, ) as well as remove either type of lock ( F_UNLCK. )
   1.315 + If a shared or exclusive lock cannot be set, fcntl returns immediately with EAGAIN. (Not supported)
   1.316 +  
   1.317 + F_SETLKW This command is the same as F_SETLK except that if a shared or exclusive lock is blocked by other locks,
   1.318 + the process waits until the request can be satisfied.(Not Supported)
   1.319 + If a signal that is to be caught is received while fcntl is waiting for a region, the fcntl will be interrupted if the signal handler has not specified the SA_RESTART . (Not supported)
   1.320 +
   1.321 +@endcode
   1.322 +
   1.323 +The fcntl system call provides for control over descriptors.
   1.324 +The argument fd is a descriptor to be operated on by cmd as described below.
   1.325 +Depending on the value of cmd, fcntl can take an additional third argument int arg . F_DUPFD Return a new descriptor as follows:
   1.326 +
   1.327 +Lowest numbered available descriptor greater than or equal to arg. Same object references as the original descriptor. New descriptor shares the same file offset if the object
   1.328 +was a file. Same access mode (read, write or read/write). Same file status flags (i.e., both file descriptors
   1.329 +share the same file status flags). The close-on-exec flag associated with the new file descriptor
   1.330 +is set to remain open across execve
   1.331 +system calls. Limitation: The difference between two file descriptors passed must not 
   1.332 + be greater than 8. If the difference is greater than 8 then behaviour of 
   1.333 +fcntl system call is undefined. F_GETFD Get the close-on-exec flag associated with the file descriptor fd as FD_CLOEXEC. If the returned value ANDed with FD_CLOEXEC is 0 the file will remain open across exec, otherwise the file will be closed upon execution of exec (arg is ignored). F_SETFD Set the close-on-exec flag associated with fd to arg, where arg is either 0 or FD_CLOEXEC, as described above. F_GETFL Get descriptor status flags, as described below (arg is ignored). F_SETFL Set descriptor status flags to arg . F_GETOWN Get the process ID or process group currently receiving SIGIO and SIGURG signals. Process groups are returned as negative values (arg is ignored)(Not supported). F_SETOWN Set the process or process group to receive SIGIO and SIGURG signals. Process groups are specified by supplying arg as negative, otherwise arg is interpreted as a process ID (Not supported).
   1.334 +
   1.335 + The flags for the F_GETFL and F_SETFL flags are as follows: O_NONBLOCK No	n-blocking I/O; if no data is available to a read system call, or if a write operation would block, the read or 
   1.336 +      write call returns -1 with the error EAGAIN. (This flag is Not supported for files) O_APPEND Force each write to append at the end of file;
   1.337 +corresponds to the O_APPEND flag of open .
   1.338 +(Setting this flag in fcntl currently has no effect on subsequent write system calls) O_DIRECT Minimize or eliminate the cache effects of reading and writing. The system 
   1.339 +      will attempt to avoid caching data during read or write. If it cannot avoid 
   1.340 +      caching the data it will minimize the impact the data has on the cache. 
   1.341 +      Use of this flag can drastically reduce performance if not used with care 
   1.342 +      (Not supported). O_ASYNC Enable the SIGIO signal to be sent to the process group when I/O is possible, 
   1.343 +      e.g. upon availability of data to be read (Not supported).
   1.344 +
   1.345 + Several commands are available for doing advisory file locking;
   1.346 +they all operate on the following structure: 
   1.347 +
   1.348 +@code
   1.349 +
   1.350 +struct flock {
   1.351 +off_tl_start;/* starting offset */
   1.352 +off_tl_len;/* len = 0 means until end of file */
   1.353 +pid_tl_pid;/* lock owner */
   1.354 +shortl_type;/* lock type: read/write, etc. */
   1.355 +shortl_whence;/* type of l_start */
   1.356 +}; 
   1.357 +
   1.358 +@endcode
   1.359 +
   1.360 +The commands available for advisory record locking are as follows: 
   1.361 +
   1.362 +F_GETLK Get the first lock that blocks the lock description pointed to by the
   1.363 +third argument, arg, taken as a pointer to a struct flock (see above).
   1.364 +The information retrieved overwrites the information passed to fcntl in the flock structure.
   1.365 +If no lock is found that would prevent this lock from being created,
   1.366 +the structure is left unchanged by this system call except for the
   1.367 +lock type which is set to F_UNLCK .
   1.368 +
   1.369 +F_SETLK  Set or clear a file segment lock according to the lock description
   1.370 +pointed to by the third argument, arg, taken as a pointer to a struct flock (see above). 
   1.371 +F_SETLK is used to establish shared (or read) locks ( F_RDLCK ) . Note "F_RDLCK"  is  not supported)
   1.372 +or exclusive (or write) locks, ( F_WRLCK, ) as well as remove either type of lock ( F_UNLCK. )
   1.373 +If a shared or exclusive lock cannot be set, fcntl returns immediately with EAGAIN. (Not supported) 
   1.374 +
   1.375 +F_SETLKW This command is the same as F_SETLK except that if a shared or exclusive lock is blocked by other locks,
   1.376 +the process waits until the request can be satisfied.
   1.377 +If a signal that is to be caught is received while fcntl is waiting for a region, the fcntl will be interrupted if the signal handler has not specified the SA_RESTART . (Not supported)
   1.378 +
   1.379 + When a shared lock has been set on a segment of a file,other processes can set shared locks on that segment
   1.380 +or a portion of it.A shared lock prevents any other process from setting an exclusive lock on any portion of the protected area.
   1.381 +A request for a shared lock fails if the file descriptor was not opened with read access.
   1.382 +
   1.383 +An exclusive lock prevents any other process from setting a shared lock or an exclusive lock on any portion of the protected area.
   1.384 +A request for an exclusive lock fails if the file was not opened with write access.
   1.385 +
   1.386 + The value of l_whence is SEEK_SET, SEEK_CUR, or SEEK_END to indicate that the relative offset, l_start bytes, will be measured from the start of the file,
   1.387 +current position, or end of the file, respectively.
   1.388 +The value of l_len is the number of consecutive bytes to be locked.
   1.389 +If l_len is negative, l_start means end edge of the region.
   1.390 +The l_pid field is only used with F_GETLK to return the process ID of the process holding a blocking lock .( Not Supported  )
   1.391 +After a successful F_GETLK request, the value of l_whence is SEEK_SET.
   1.392 +
   1.393 + Locks may start and extend beyond the current end of a file,
   1.394 +but may not start or extend before the beginning of the file.
   1.395 +A lock is set to extend to the largest possible value of the
   1.396 +file offset for that file if l_len is set to zero.
   1.397 +If l_whence and l_start point to the beginning of the file, and l_len is zero, the entire file is locked.
   1.398 +If an application wishes only to do entire file locking, the flock system call is much more efficient.
   1.399 +
   1.400 +There is at most one type of lock set for each byte in the file.
   1.401 +Before a successful return from an F_SETLK or an F_SETLKW ( Not Supported  ) request when the calling process has previously existing locks on bytes in the region specified by the request,
   1.402 +the previous lock type for each byte in the specified
   1.403 +region is replaced by the new lock type.
   1.404 +As specified above under the descriptions
   1.405 +of shared locks and exclusive locks, an F_SETLK or an F_SETLKW request fails or blocks respectively when another process has existing
   1.406 +locks on bytes in the specified region and the type of any of those
   1.407 +locks conflicts with the type specified in the request.
   1.408 +
   1.409 + This interface follows the completely stupid [sic] semantics of System 
   1.410 +  V and -p1003.1-88 that require that all locks associated with a file for a 
   1.411 +  given process are removed when any file descriptor for that file is closed by that process. This semantic 
   1.412 +  means that applications must be aware of any files that a subroutine library 
   1.413 +  may access. For example if an application for updating the password file locks 
   1.414 +  the password file database while making the update, and then calls getpwnam to retrieve a record, the lock will 
   1.415 +  be lost because getpwnam opens, reads, and closes the password 
   1.416 +  database. The database close will release all locks that the process has associated 
   1.417 +  with the database, even if the library routine never requested a lock on the 
   1.418 +  database. Another minor semantic problem with this interface is that locks are 
   1.419 +  not inherited by a child process created using the fork system 
   1.420 +  call. The flock interface has much more rational last close semantics and allows locks to be 
   1.421 +  inherited by child processes. The flock system call is recommended for applications that want to ensure the integrity 
   1.422 +  of their locks when using library routines or wish to pass locks to their children.
   1.423 +
   1.424 + The fcntl, flock ,
   1.425 +and lockf locks are compatible.
   1.426 +Processes using different locking interfaces can cooperate
   1.427 +over the same file safely.
   1.428 +However, only one of such interfaces should be used within
   1.429 +the same process.
   1.430 +If a file is locked by a process through flock ,
   1.431 +any record within the file will be seen as locked
   1.432 +from the viewpoint of another process using fcntl or lockf ,
   1.433 +and vice versa.
   1.434 +Note that fcntl (F_GETLK); returns -1 in l_pid if the process holding a blocking lock previously locked the
   1.435 +file descriptor by flock .
   1.436 +
   1.437 + All locks associated with a file for a given process are
   1.438 +removed when the process terminates.
   1.439 +
   1.440 + All locks obtained before a call to execve remain in effect until the new program releases them.
   1.441 +If the new program does not know about the locks, they will not be
   1.442 +released until the program exits.
   1.443 +
   1.444 + A potential for deadlock occurs if a process controlling a locked region
   1.445 +is put to sleep by attempting to lock the locked region of another process.
   1.446 +This implementation detects that sleeping until a locked region is unlocked
   1.447 +would cause a deadlock and fails with an EDEADLK error.
   1.448 +
   1.449 +If 'aFid' corresponds to a shared memory object the only values of cmd that are supported are 
   1.450 +F_DUPFD, F_GETFD, F_SETFD, F_SETFL, F_GETFL.
   1.451 +
   1.452 +Examples:
   1.453 +@code
   1.454 +/* Detailed description : Sample usafe of fcntl system call */
   1.455 +#include <stdio.h>
   1.456 +#include <fcntl.h>
   1.457 +int main()
   1.458 +{
   1.459 +  int fd  = 0;
   1.460 +  int flags = 0;
   1.461 +  fd = open("Example.txt " , O_CREAT | O_RDWR  , 0666);
   1.462 +  if(fd < 0 ) 
   1.463 +  {
   1.464 +     printf("Failed to open file Example.txt
   1.465 +");
   1.466 +     return -1;
   1.467 +  }
   1.468 +  if( (flags = fcntl(fd , F_GETFL) ) < 0 )  
   1.469 +  {
   1.470 +     printf("Fcntl system call failed 
   1.471 +");
   1.472 +     return -1;
   1.473 +  }
   1.474 +  printf("Flags of the file %o 
   1.475 +" , flags);
   1.476 +  return 0;
   1.477 +}
   1.478 +
   1.479 +@endcode
   1.480 + Output
   1.481 +@code
   1.482 +Flags of the file 2
   1.483 +
   1.484 +@endcode
   1.485 +@see close()
   1.486 +@see flock()
   1.487 +@see getdtablesize()
   1.488 +@see open()
   1.489 +
   1.490 +
   1.491 + 
   1.492 +
   1.493 +@publishedAll
   1.494 +@externallyDefinedApi
   1.495 +*/
   1.496 +
   1.497 +
   1.498 +/** @def O_RDONLY
   1.499 +
   1.500 +open for reading only
   1.501 +
   1.502 +@publishedAll
   1.503 +@externallyDefinedApi
   1.504 +*/
   1.505 +
   1.506 +/** @def O_WRONLY
   1.507 +
   1.508 +open for writing only
   1.509 +
   1.510 +@publishedAll
   1.511 +@externallyDefinedApi
   1.512 +*/
   1.513 +
   1.514 +/** @def O_RDWR	
   1.515 +
   1.516 +open for reading and writing 
   1.517 +
   1.518 +@publishedAll
   1.519 +@externallyDefinedApi
   1.520 +*/
   1.521 +
   1.522 +
   1.523 +/** @def O_ACCMODE
   1.524 +
   1.525 +mask for above modes
   1.526 +
   1.527 +@publishedAll
   1.528 +@externallyDefinedApi
   1.529 +*/
   1.530 +
   1.531 +/** @def O_NONBLOCK
   1.532 +
   1.533 +no delay
   1.534 +
   1.535 +@publishedAll
   1.536 +@externallyDefinedApi
   1.537 +*/
   1.538 +
   1.539 +/** @def O_APPEND
   1.540 +
   1.541 +set append mode 
   1.542 +
   1.543 +@publishedAll
   1.544 +@externallyDefinedApi
   1.545 +*/
   1.546 +
   1.547 +/** @def O_CREAT	
   1.548 +
   1.549 +create if nonexistent 
   1.550 +
   1.551 +@publishedAll
   1.552 +@externallyDefinedApi
   1.553 +*/
   1.554 +
   1.555 +/** @def O_TRUNC	
   1.556 +
   1.557 +truncate to zero length
   1.558 +
   1.559 +@publishedAll
   1.560 +@externallyDefinedApi
   1.561 +*/
   1.562 +
   1.563 +
   1.564 +/** @def O_EXCL	
   1.565 +
   1.566 +error if already exists
   1.567 +
   1.568 +@publishedAll
   1.569 +@externallyDefinedApi
   1.570 +*/
   1.571 +
   1.572 +/** @def O_NOCTTY	
   1.573 +
   1.574 +don't assign controlling terminal
   1.575 +
   1.576 +@publishedAll
   1.577 +@externallyDefinedApi
   1.578 +*/
   1.579 +
   1.580 +/** @def F_DUPFD	
   1.581 +
   1.582 +Duplicate file descriptor.
   1.583 +	
   1.584 +@publishedAll
   1.585 +@externallyDefinedApi
   1.586 +*/
   1.587 +
   1.588 +
   1.589 +/** @def F_GETFD	
   1.590 +
   1.591 +Get file descriptor flags.
   1.592 +	
   1.593 +@publishedAll
   1.594 +@externallyDefinedApi
   1.595 +*/
   1.596 +
   1.597 +/** @def F_SETFD	
   1.598 +
   1.599 +set file descriptor flags
   1.600 +		
   1.601 +@publishedAll
   1.602 +@externallyDefinedApi
   1.603 +*/
   1.604 +
   1.605 +/** @def F_GETFL
   1.606 +
   1.607 +get file status flags
   1.608 +		
   1.609 +@publishedAll
   1.610 +@externallyDefinedApi
   1.611 +*/
   1.612 +
   1.613 +/** @def F_SETFL	
   1.614 +
   1.615 +set file status flags 		
   1.616 +
   1.617 +@publishedAll
   1.618 +@externallyDefinedApi
   1.619 +*/
   1.620 +
   1.621 +/** @def F_GETOWN		
   1.622 +
   1.623 +get SIGIO/SIGURG proc/pgrp
   1.624 +
   1.625 +@publishedAll
   1.626 +@externallyDefinedApi
   1.627 +*/
   1.628 +
   1.629 +/** @def F_SETOWN		
   1.630 +
   1.631 +set SIGIO/SIGURG proc/pgrp 
   1.632 +	
   1.633 +@publishedAll
   1.634 +@externallyDefinedApi
   1.635 +*/
   1.636 +
   1.637 +/** @def F_GETLK	
   1.638 +
   1.639 +get record locking information
   1.640 +		
   1.641 +@publishedAll
   1.642 +@externallyDefinedApi
   1.643 +*/
   1.644 +
   1.645 +
   1.646 +/** @def F_SETLK	
   1.647 +
   1.648 +set record locking information
   1.649 +			
   1.650 +@publishedAll
   1.651 +@externallyDefinedApi
   1.652 +*/
   1.653 +
   1.654 +/** @def F_SETLKW	
   1.655 +
   1.656 +F_SETLK; wait if blocked
   1.657 +		
   1.658 +@publishedAll
   1.659 +@externallyDefinedApi
   1.660 +*/
   1.661 +
   1.662 +/** @def F_GETLK64	
   1.663 +
   1.664 +get record locking information of large file
   1.665 +		
   1.666 +@publishedAll
   1.667 +@externallyDefinedApi
   1.668 +*/
   1.669 +
   1.670 +
   1.671 +/** @def F_SETLK64	
   1.672 +
   1.673 +set record locking information to a large file
   1.674 +			
   1.675 +@publishedAll
   1.676 +@externallyDefinedApi
   1.677 +*/
   1.678 +
   1.679 +/** @def F_SETLKW64	
   1.680 +
   1.681 +F_SETLK; wait if blocked in a large file
   1.682 +		
   1.683 +@publishedAll
   1.684 +@externallyDefinedApi
   1.685 +*/
   1.686 +
   1.687 +/** @def F_RDLCK	
   1.688 +
   1.689 +shared or read lock 
   1.690 +		
   1.691 +@publishedAll
   1.692 +@externallyDefinedApi
   1.693 +*/
   1.694 +
   1.695 +/** @def F_UNLCK	
   1.696 +
   1.697 +unlock 
   1.698 +	
   1.699 +@publishedAll
   1.700 +@externallyDefinedApi
   1.701 +*/
   1.702 +
   1.703 +/** @def F_WRLCK
   1.704 +
   1.705 +exclusive or write lock 
   1.706 +	
   1.707 +@publishedAll
   1.708 +@externallyDefinedApi
   1.709 +*/
   1.710 +
   1.711 +/** @def O_SYNC		
   1.712 +
   1.713 +POSIX synonym for O_FSYNC 
   1.714 +	
   1.715 +@publishedAll
   1.716 +@externallyDefinedApi
   1.717 +*/
   1.718 +
   1.719 +/** @def FD_CLOEXEC	
   1.720 +
   1.721 +close-on-exec flag 
   1.722 +
   1.723 +@publishedAll
   1.724 +@externallyDefinedApi
   1.725 +*/
   1.726 +
   1.727 +
   1.728 +/** @def FREAD
   1.729 +
   1.730 +Kernel encoding of open mode; separate read and write bits that are independently testable: 1 greater than the above.
   1.731 +FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH, which was documented to use FREAD/FWRITE, continues to work.
   1.732 +
   1.733 +@publishedAll
   1.734 +@externallyDefinedApi
   1.735 +*/
   1.736 +
   1.737 +
   1.738 +/** @def FWRITE	
   1.739 +
   1.740 +Kernel encoding of open mode; separate read and write bits that are independently testable: 1 greater than the above.
   1.741 +FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH, which was documented to use FREAD/FWRITE, continues to work.
   1.742 +
   1.743 +@publishedAll
   1.744 +@externallyDefinedApi
   1.745 +*/
   1.746 +
   1.747 +
   1.748 +
   1.749 +
   1.750 +
   1.751 +
   1.752 +
   1.753 +
   1.754 +
   1.755 +
   1.756 +
   1.757 +