[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS: cvs.openbsd.org: src



CVSROOT:	/cvs
Module name:	src
Changes by:	art_(_at_)_cvs_(_dot_)_openbsd_(_dot_)_org	2002/02/05 09:02:27

Modified files:
	sys/kern       : kern_descrip.c kern_event.c sys_generic.c 
	                 uipc_usrreq.c vfs_syscalls.c 
	sys/miscfs/portal: portal_vfsops.c 
	sys/nfs        : nfs_syscalls.c 
	sys/sys        : file.h 

Log message:
Add counting of temporary references to a struct file (as opposed to references
from fd tables and other long-lived objects). This is to avoid races between
using a file descriptor and having another process (with shared fd table)
close it. We use a separate refence count so that error values from close(2)
will be correctly returned to the caller of close(2).

The macros for those reference counts are FILE_USE(fp) and FILE_UNUSE(fp).

Make sure that the cases where closef can be called "incorrectly" (most notably
dup2(2)) are handled.

Right now only callers of closef (and {,p}read) use FILE_{,UN}USE correctly,
more fixes incoming soon.



Visit your host, monkey.org