Re: MemPool.c's

From: Guido Serassio <serassio@dont-contact.us>
Date: Wed, 17 Apr 2002 22:46:23 +0200

Hi Henrik,

Il 08.36 17/04/2002 Henrik Nordstrom ha scritto:

> > >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?
>
>Are you sure there is no simpler way? Maybe it is possible to realloc
>the internal array or something similar..

I have just take a look on MSVCRT sources, and it seems not possible to
realloc the internal structures:

This is the limit definition in _NHANDLE_:

/*
  * Definition of IOINFO_L2E, the log base 2 of the number of elements in each
  * array of ioinfo structs.
  */
#define IOINFO_L2E 5

/*
  * Definition of IOINFO_ARRAY_ELTS, the number of elements in ioinfo array
  */
#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)

/*
  * Definition of IOINFO_ARRAYS, maximum number of supported ioinfo arrays.
  */
#define IOINFO_ARRAYS 64

#define _NHANDLE_ (IOINFO_ARRAYS * IOINFO_ARRAY_ELTS)

/*
  * Access macros for getting at an ioinfo struct and its fields from a
  * file handle
  */
#define _pioinfo(i) ( __pioinfo[(i) >> IOINFO_L2E] + ((i) &
(IOINFO_ARRAY_ELTS - \
                               1)) )

and this is the arrays allocation:

/* number of allowable file handles */
int _nfile = _NHANDLE_;

/* file handle database -- stdout, stdin, stderr are NOT open */
char _osfile[_NHANDLE_] = {(unsigned char)(FOPEN+FTEXT), (unsigned
char)(FOPEN+FTEXT), (unsigned char)(FOPEN+FTEXT)};
int _osfhnd [_NHANDLE_] = {-1, -1, -1};
unsigned char _osperm [_NHANDLE_];
short _osVRefNum [_NHANDLE_];
unsigned char _osfileflags[_NHANDLE_];

The big problem is that they load in _nfile the number of allowable file
handles but after they use the _NHANDLE_ define in others sources for the
upper limit check.
Typical great Micro$oft code style ......

Regards

Guido

>Regards
>Henrik

-
=======================================================
Serassio Guido
Via Albenga, 11/4 10134 - Torino - ITALY
E-mail: guido.serassio@serassio.it
WWW: http://www.serassio.it
Received on Wed Apr 17 2002 - 14:51:55 MDT

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