Mail Archives: djgpp/1998/02/04/15:01:22
Gisle Vanem wrote:
[...]
> Since `socket' doesn't call _open(), there is a chance that X=Y.
> Maybe I have to allocate the socket() handle using __FSEXT_alloc_fd()
> after all?
>
That is exactly what it is meant for.
On closing the socket, you'll need to say
...
case __FSEXT_close:
clean_up_socket_stuff();
__FSEXT_set_function(handle, NULL);
*return_value = _close(handle);
break;
This first cleans up whatever needs to be cleaned up,
then disconnects your handler function from the
FSEXT internal table, and the closes the file handle
you obtained from alloc_fd().
That function opens the NUL device to get a handle from DOS,
and you must close it, otherwise DOS will run out of handles sooner
or later. The disconnecting has to happen before _close(),
because otherwise _close() would call your handler again.
--
Ciao
Tom
*************************************************************
* Thomas Demmer *
* Lehrstuhl fuer Stroemungsmechanik *
* Ruhr-Uni-Bochum *
* Universitaetsstr. 150 *
* D-44780 Bochum *
* Tel: +49 234 700 6434 *
* Fax: +49 234 709 4162 *
* http://www.lstm.ruhr-uni-bochum.de/~demmer *
*************************************************************
- Raw text -