svn commit: r194262 - in head: include lib/libc/sys sys/compat/freebsd32 sys/kern tools/regression/file/closefrom

Colin Percival cperciva at freebsd.org
Mon Jun 15 20:49:35 UTC 2009


John Baldwin wrote:
>   One difference from other *BSD is that this closefrom() does not
>   fail with any errors.  In practice, while the manpages for NetBSD and
>   OpenBSD claim that they return EINTR, they ignore internal errors from
>   close() and never return EINTR.  DFly does return EINTR, but for the common
>   use case (closing fd's prior to execve()), the caller really wants all
>   fd's closed and returning EINTR just forces callers to call closefrom() in
>   a loop until it stops failing.

Wouldn't it be better for portability if closefrom(2) is defined to return an
int, even if the value returned is always zero?  Otherwise people who want to
write code which works on all BSDs end up having to do something like
#ifdef __FreeBSD__
	closefrom(x);
#else
	while (closefrom(x))
		continue;
#endif

-- 
Colin Percival
Security Officer, FreeBSD | freebsd.org | The power to serve
Founder / author, Tarsnap | tarsnap.com | Online backups for the truly paranoid


More information about the svn-src-head mailing list