Maximum open _setmaxstdio files - only 2048?

http://msdn.microsoft.com/en-us/library/6e3b887c(VS.80).aspx

There is a way to have more than 2048 open files at a time for each application using _wopen.

32 or 64-bit OS - same limit!

+3
source share
3 answers

No. Studying the source code of CRT, we can know that CRT limits the maximum amount.

 /*
 * Make sure the request is reasonable.
 */
_VALIDATE_RETURN(((maxnum >= _IOB_ENTRIES) && (maxnum <= _NHANDLE_)), EINVAL, -1);

Niderl:

#define _NHANDLE_           (IOINFO_ARRAYS * IOINFO_ARRAY_ELTS)

These constants are:

/*
 * 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

As you can see, this is limited to CRT implementation.

+2
source

No.

, CreateProcess. CreateProcess 2048 ( 32-, 64-). , exec spawn CRT, 2048.

API- Win32 (CreateFile, WriteFile, ReadFile, CloseHandle ..), (, , , , ).

+1

. Windows.

From the comments on the accepted answer, there seems to be no way to change this. Perhaps instead of "_wopen?" Can you use the "CreateFile" api call?

0
source

Source: https://habr.com/ru/post/1724002/


All Articles