What new system calls do you want in BSD?

Bill Webb webb at bass.tcspa.ibm.com
Thu Feb 15 07:07:31 AEST 1990


> I'm asking about calls that don't require lots of code or fundamental
> changes in the system; that provide a useful service unavailable with
> current system calls; that, hopefully, simplify other calls; that don't
> hurt security; that don't hurt anything if they're not used.

How about a system call to indicate either the maximum number of file
descriptors allocated, or better still, a bit-map of allocated 
e.g.
	nfound = getfds(nfds, fds);
	int nfound, nfds;
	fd_set *fds;

The parameters are similar to those of select(2), except that bits are
set for any valid file descriptors in the range 0...(nfds-1).

It might be useful to specify two fd_set parameters, e.g.

	nfound = getfds(nfds, readfds, writefds);
	int nfound, nfds;
	fd_set *readfds, *writefds;

where "readfds" returns bits for file descriptors opened for reading, 
"writefds" returns bits for file descriptors open for writing, and bits are
set in both for file descriptors open for read/writing.

These calls would mostly be useful to programs (such as shells) that have
to manage file descriptors and either don't want to clobber existing 
file descriptors, or want to know what file descriptors to close in certain
circumstances. This is particularly important now that the number of
file descriptors allowed is significantly increased in some Unix
implementations. This call should nicely complement 'getdtablesize' which
tells you how many bits you will need to hold the resulting information.

----------------------------------------------------------------
The above views are my own, not those of my employer.
Bill Webb (IBM AWD Palo Alto), (415) 855-4457.
UUCP: ...!uunet!ibmsupt!webb



More information about the Comp.unix.wizards mailing list