Re: MemPool.c's

From: Guido Serassio <>
Date: Wed, 17 Apr 2002 15:46:59 +0200


Il 08.36 17/04/2002 Henrik Nordstrom ha scritto:
>On Wednesday 17 April 2002 00:17, Guido Serassio wrote:
> > _open_osfhandle() and _free_osfhnd() are required too, and
> > _free_osfhnd() is undocumented, I have found it looking in the
> > MSVCRT sources.
>_open_osfhandle(), _get_fhandle() etc was all documented at this
>availability or greater.. Not sure about _free_osfhnd().
>Are you sure you need _free_osfhnd()? From what I understand it
>should be sufficient to close().

Experimental result:

close() closes MSVCRT handle, but not socket handle, and closesocket()
close only the socket handle, so closesocket() must be:

#define closesocket(s) \
         { \
         (SOCKET_ERROR == closesocket(_get_osfhandle(s)) ? \
         (errno = WSAGetLastError()), -1 : 0); \
         _free_osfhnd(s); \
         _osfile(s) = 0; \

_free_osfhnd is called internally from close().

>The Watcom C library docs can be found here:
>[alphabetically sorted, don't let the "menu" confuse you]
>Also tried searching MSDN, but there nothing could be found on these

There is something about _open_osfhandle(), _get_osfhandle() on MSVC manuals.

> > >But 2K filedescriptors is a noticeable limit. Any chance of
> > > increasing this?
> >
> > May be recompiling the MSVCRT ....
>Can this be done in a sane manner? And distributed?

The sources are distributed with Visual Studio and the CRT is redistributable,

>Are you sure there is no simpler way? Maybe it is possible to realloc
>the internal array or something similar..

May be, but at this time I have not time to investigate, in the next week I
will take a look about.




Serassio Guido
Via Albenga, 11/4 10134 - Torino - ITALY
Received on Wed Apr 17 2002 - 07:47:14 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:11 MST