Changeset 1366


Ignore:
Timestamp:
Apr 15, 2004, 12:50:33 AM (21 years ago)
Author:
bird
Message:

Expand in 64 chunks. Cleaned up max+inc config.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/sys/filehandles.c

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r1365 r1366  
    2222 *
    2323 */
     24
     25/*******************************************************************************
     26*   Defined Constants And Macros                                               *
     27*******************************************************************************/
     28/** Maximum number of file handles. */
     29#define __LIBC_MAX_FHS  10000
     30/** Number of file handles to increase the max value with. */
     31#define __LIBC_INC_FHS    64
    2432
    2533/*******************************************************************************
     
    247255     * How many handles?
    248256     * Now, we must be somewhat sensibel about incrementing this number
    249      * into unreasonable values. If an application requires 10000+ files
    250      * it must take steps to tell that to OS/2. If he has we'll receive
    251      * cMin > 10000, else keep 10000 as a max limit for auto increase.
     257     * into unreasonable values. If an application requires __LIBC_MAX_FHS+
     258     * files it must take steps to tell that to OS/2. If he has we'll receive
     259     * cMin > __LIBC_MAX_FHS, else keep __LIBC_MAX_FHS as a max limit for
     260     * auto increase.
    252261     */
    253262    lDeltaFHs = 0;
     
    260269    if (cMin < cNewMaxFHs)
    261270    {   /* auto increment. */
    262         cMin = cNewMaxFHs + 100;
    263         if (cMin > 10000 && gcFHs > 10000)
     271        cMin = cNewMaxFHs + __LIBC_INC_FHS;
     272        if (cMin > __LIBC_MAX_FHS)
    264273        {
    265             FS_RESTORE();
    266             return ERROR_TOO_MANY_OPEN_FILES;
     274            if (gcFHs >= __LIBC_MAX_FHS)
     275            {
     276                FS_RESTORE();
     277                return ERROR_TOO_MANY_OPEN_FILES;
     278            }
     279            cMin = __LIBC_MAX_FHS;
    267280        }
    268281    }
     
    281294    if (!rc)
    282295    {
    283 
    284296        /*
    285297         * Reallocate the array of handle pointers.
     
    327339}
    328340
     341
     342/**
     343 * Auto increase the MAX FH limit for this process.
     344 *
     345 * @returns 0 on success.
     346 * @returns -1 on failure.
     347 */
     348int __libc_FHMoreHandles(void)
     349{
     350    int rc;
     351    if (_fmutex_request(&gmtx, 0))
     352        return -1;
     353
     354    rc = __libc_fhMoreHandles(0);
     355
     356    _fmutex_release(&gmtx);
     357    return rc;
     358}
    329359
    330360
Note: See TracChangeset for help on using the changeset viewer.