[BACK]Return to fcntl.2 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / sys

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libc/sys/fcntl.2 between version 1.18 and 1.18.6.4

version 1.18, 1999/12/02 21:42:36 version 1.18.6.4, 2002/10/18 02:16:50
Line 33 
Line 33 
 .\"  .\"
 .\"     @(#)fcntl.2     8.2 (Berkeley) 1/12/94  .\"     @(#)fcntl.2     8.2 (Berkeley) 1/12/94
 .\"  .\"
 .Dd January 12, 1994  .Dd May 5, 2001
 .Dt FCNTL 2  .Dt FCNTL 2
 .Os  .Os
 .Sh NAME  .Sh NAME
Line 42 
Line 42 
 .Sh LIBRARY  .Sh LIBRARY
 .Lb libc  .Lb libc
 .Sh SYNOPSIS  .Sh SYNOPSIS
 .Fd #include <fcntl.h>  .Fd #include \*[Lt]fcntl.h\*[Gt]
 .Ft int  .Ft int
 .Fn fcntl "int fd" "int cmd" "..."  .Fn fcntl "int fd" "int cmd" "..."
 .Sh DESCRIPTION  .Sh DESCRIPTION
Line 86  system calls.
Line 86  system calls.
 .El  .El
 .It Dv F_GETFD  .It Dv F_GETFD
 Get the close-on-exec flag associated with the file descriptor  Get the close-on-exec flag associated with the file descriptor
 .Fa fd .  .Fa fd
 If the low-order bit of the returned value is 0,  as
   .Dv FD_CLOEXEC .
   If the returned value ANDed with
   .Dv FD_CLOEXEC
   is 0,
 the file will remain open across  the file will remain open across
 .Fn exec ,  .Fn exec ,
 otherwise the file will be closed upon execution of  otherwise the file will be closed upon execution of
Line 97  is ignored).
Line 101  is ignored).
 .It Dv F_SETFD  .It Dv F_SETFD
 Set the close-on-exec flag associated with  Set the close-on-exec flag associated with
 .Fa fd  .Fa fd
 to the low order bit of  to
   .Fa arg ,
   where
 .Fa arg  .Fa arg
 (0 or 1 as above).  is either 0 or
   .Dv FD_CLOEXEC ,
   as described above.
 .It Dv F_GETFL  .It Dv F_GETFL
 Get descriptor status flags, as described below  Get descriptor status flags, as described below
 .Fa ( arg  .Fa ( arg
Line 127  and
Line 135  and
 signals;  signals;
 process groups are specified by supplying  process groups are specified by supplying
 .Fa arg  .Fa arg
 as negative, otherwise  as negative, otherwise
 .Fa arg  .Fa arg
 is interpreted as a process ID.  is interpreted as a process ID.
 The argument  The argument
Line 190  in the
Line 198  in the
 structure.  structure.
 If no lock is found that would prevent this lock from being created,  If no lock is found that would prevent this lock from being created,
 the structure is left unchanged by this function call except for the  the structure is left unchanged by this function call except for the
 lock type which is set to  lock type
   .Fa l_type ,
   which is set to
 .Dv F_UNLCK .  .Dv F_UNLCK .
 .It Dv F_SETLK  .It Dv F_SETLK
 Set or clear a file segment lock according to the lock description  Set or clear a file segment lock according to the lock description
Line 199  pointed to by the third argument,
Line 209  pointed to by the third argument,
 taken as a pointer to a  taken as a pointer to a
 .Fa "struct flock"  .Fa "struct flock"
 (see above).  (see above).
   As specified by the value of
   .Fa l_type ,
 .Dv F_SETLK  .Dv F_SETLK
 is used to establish shared (or read) locks  is used to establish shared (or read) locks
 .Dv (F_RDLCK)  .Pq Dv F_RDLCK
 or exclusive (or write) locks,  or exclusive (or write) locks,
 .Dv (F_WRLCK) ,  .Pq Dv F_WRLCK ,
 as well as remove either type of lock  as well as remove either type of lock
 .Dv (F_UNLCK) .  .Pq Dv F_UNLCK .
 If a shared or exclusive lock cannot be set,  If a shared or exclusive lock cannot be set,
 .Nm  .Nm
 returns immediately with  returns immediately with
Line 272  but may not start or extend before the b
Line 284  but may not start or extend before the b
 A lock is set to extend to the largest possible value of the  A lock is set to extend to the largest possible value of the
 file offset for that file if  file offset for that file if
 .Fa l_len  .Fa l_len
 is set to zero. If  is set to zero.
   If
 .Fa l_whence  .Fa l_whence
 and  and
 .Fa l_start  .Fa l_start
Line 313  For example if an application for updati
Line 326  For example if an application for updati
 password file database while making the update, and then calls  password file database while making the update, and then calls
 .Xr getpwnam 3  .Xr getpwnam 3
 to retrieve a record,  to retrieve a record,
 the lock will be lost because  the lock will be lost because
 .Xr getpwnam 3  .Xr getpwnam 3
 opens, reads, and closes the password database.  opens, reads, and closes the password database.
 The database close will release all locks that the process has  The database close will release all locks that the process has
Line 332  Calling
Line 345  Calling
 is recommended for applications that want to ensure the integrity  is recommended for applications that want to ensure the integrity
 of their locks when using library routines or wish to pass locks  of their locks when using library routines or wish to pass locks
 to their children.  to their children.
 Note that  Note that
 .Xr flock 2  .Xr flock 2
 and  and
 .Xr fcntl 2  .Nm
 locks may be safely used concurrently.  locks may be safely used concurrently.
 .Pp  .Pp
 All locks associated with a file for a given process are  All locks associated with a file for a given process are
Line 377  The argument
Line 390  The argument
 is  is
 .Dv F_SETLK ,  .Dv F_SETLK ,
 the type of lock  the type of lock
 .Fa (l_type)  .Pq Fa l_type
 is a shared lock  is a shared lock
 .Dv (F_RDLCK)  .Pq Dv F_RDLCK
 or exclusive lock  or exclusive lock
 .Dv (F_WRLCK) ,  .Pq Dv F_WRLCK ,
 and the segment of a file to be locked is already  and the segment of a file to be locked is already
 exclusive-locked by another process;  exclusive-locked by another process;
 or the type is an exclusive lock and some portion of the  or the type is an exclusive lock and some portion of the
Line 398  is
Line 411  is
 or  or
 .Dv F_SETLKW ,  .Dv F_SETLKW ,
 the type of lock  the type of lock
 .Fa (l_type)  .Pq Fa l_type
 is a shared lock  is a shared lock
 .Dv (F_RDLCK) ,  .Pq Dv F_RDLCK ,
 and  and
 .Fa fildes  .Fa fildes
 is not a valid file descriptor open for reading.  is not a valid file descriptor open for reading.
Line 412  is
Line 425  is
 or  or
 .Dv F_SETLKW ,  .Dv F_SETLKW ,
 the type of lock  the type of lock
 .Fa (l_type)  .Pq Fa l_type
 is an exclusive lock  is an exclusive lock
 .Dv (F_WRLCK) ,  .Pq Dv F_WRLCK ,
 and  and
 .Fa fildes  .Fa fildes
 is not a valid file descriptor open for writing.  is not a valid file descriptor open for writing.
Line 489  the process ID given as argument is not 
Line 502  the process ID given as argument is not 
 .Xr execve 2 ,  .Xr execve 2 ,
 .Xr flock 2 ,  .Xr flock 2 ,
 .Xr open 2 ,  .Xr open 2 ,
 .Xr getdtablesize 3 ,  .Xr sigaction 2 ,
 .Xr sigaction 2  .Xr getdtablesize 3
 .Sh STANDARDS  .Sh STANDARDS
 The  The
 .Fn fcntl  .Fn fcntl

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.18.6.4

CVSweb <webmaster@jp.NetBSD.org>