diff options
| author | Joerg Wunsch <joerg@FreeBSD.org> | 1996-04-06 09:56:25 +0000 |
|---|---|---|
| committer | Joerg Wunsch <joerg@FreeBSD.org> | 1996-04-06 09:56:25 +0000 |
| commit | 02653efcc463c87d83e43f8b1a1fb5b7e759f655 (patch) | |
| tree | 98b4daa601c4859f46a52fd60db0a6cc2d2c41c9 /lib/libc | |
| parent | f1d02b48c58aace361e7b6b36ac5ec33a21cedd9 (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/sys/fcntl.2 | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/lib/libc/sys/fcntl.2 b/lib/libc/sys/fcntl.2 index f53c02f2403d..5587bcfba35c 100644 --- a/lib/libc/sys/fcntl.2 +++ b/lib/libc/sys/fcntl.2 @@ -128,9 +128,9 @@ flags are as follows: .Bl -tag -width O_NONBLOCKX .It Dv O_NONBLOCK Non-blocking I/O; if no data is available to a -.Xr read +.Xr read 2 call, or if a -.Xr write +.Xr write 2 operation would block, the read or write call returns -1 with the error .Er EAGAIN . @@ -295,10 +295,10 @@ This semantic means that applications must be aware of any files that a subroutine library may access. For example if an application for updating the password file locks the password file database while making the update, and then calls -.Xr getpwname 3 +.Xr getpwnam 3 to retrieve a record, the lock will be lost because -.Xr getpwname 3 +.Xr getpwnam 3 opens, reads, and closes the password database. The database close will release all locks that the process has associated with the database, even if the library routine never @@ -330,6 +330,29 @@ This implementation detects that sleeping until a locked region is unlocked would cause a deadlock and fails with an .Er EDEADLK error. +.Sh IMPLEMENTATION NOTES +.Pp +In the non-threaded library +.Fn fcntl +is implemented as the +.Va fcntl +syscall. +.Pp +In the threaded library, the +.Va fcntl +syscall is assembled to +.Fn _thread_sys_fcntl +and +.Fn fcntl +is implemented as a function which disables thread rescheduling, locks +.Va fd +for read and write, then calls +.Fn _thread_sys_fcntl . +Before returning, +.Fn fcntl +unlocks +.Va fd +and enables thread rescheduling. .Sh RETURN VALUES Upon successful completion, the value returned depends on .Fa cmd @@ -467,13 +490,31 @@ is and the process ID given as argument is not in use. .El +.Pp +In addition, if +.Fa fd +refers to a descriptor open on a terminal device (as opposed to a +descriptor open on a socket), a +.Fa cmd +of +.Dv F_SETOWN +can fail for the same reasons as in +.Xr tcsetpgrp 3 , +and a +.Fa cmd +of +.Dv F_GETOWN +for the reasons as stated in +.Xr tcgetpgrp 3 . .Sh SEE ALSO .Xr close 2 , .Xr execve 2 , .Xr flock 2 , .Xr getdtablesize 2 , .Xr open 2 , -.Xr sigvec 2 +.Xr sigvec 2 , +.Xr tcgetpgrp 3 , +.Xr tcsetpgrp 3 .Sh HISTORY The .Nm |
