>It would be simple to add a (maybe hidden) flag to the FILE * >data structures that tell stdio that the calling program is >aware of the new interface because it has been compiled with >the new include files.
There's always an issue with old libraries and such and FILE *'s being passed around to such libraries. >This needs to apply to _endopen() which does the real work for >fopen() and friends. Of course, stdin/stdout/stderr need to be >patched too...... > >Then old binaries would see the old behaviro and new binaries >(not using fileno() as macro) would be able to use more than 256 >FILE * streams. The outline of the proposed implementation is something like this: - the ability to mark a file descriptors 3 <= fd <= 255 bad in the kernel (attempts to dup2() to it will fail and the kernel will never return it. close(badfd) fails with EBADF Any other operations will either fail with EBADF or will cause the kernel to send a pre determined signal. - FILE's can either use an ordinary fd <= 255 or they can use a shadow fd; in the later case a flag is set in the FILE structure and the fp->_file is set to "badfd". - the default behaviour still limits to 256 fds. - applications can request the behaviour by doing a specific call. - libraries can request "no bounds FDs" without affecting the behaviour for other programs (this means that badfd is not created under those circumstances); that part of the interface will likely not be supported (i.e., not a documented interface, only for use in Sun's libraries which now duplicate part of stdio just to get around the restriction. Casper _______________________________________________ opensolaris-discuss mailing list opensolaris-discuss@opensolaris.org