Changeset 13586


Ignore:
Timestamp:
Mar 4, 2000, 8:53:34 PM (25 years ago)
Author:
sandervl
Message:

DosOpen out of file handles fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tags/trunk/src/opengl/glide/swlibs/pcilib/fxos2.cpp

    r13547 r13586  
    2222#define INCL_DOSDEVIOCTL
    2323#define INCL_DOSPROCESS
     24#define INCL_DOSERRORS
    2425#define INCL_DOSMODULEMGR
    2526#define INCL_DOSDEVICES
     
    4344#ifdef __WIN32OS2__
    4445#define FX_CSTYLE __stdcall
     46#include <misc.h>
    4547#else
    4648#define FX_CSTYLE _System
     
    753755  io_init1();
    754756
     757tryopen1:
    755758  rc = DosOpen("OEMHLP$", &hOemHlp, &ulAction, 0, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS, OPEN_ACCESS_READWRITE|OPEN_SHARE_DENYREADWRITE, 0L);
     759  if(rc == ERROR_TOO_MANY_OPEN_FILES) {
     760   ULONG CurMaxFH;
     761   LONG  ReqCount = 32;
     762
     763        rc = DosSetRelMaxFH(&ReqCount, &CurMaxFH);
     764        if(rc) {
     765                dprintf(("DosSetRelMaxFH returned %d", rc));
     766                pciErrorCode = PCI_ERR_NO_IO_PERM;
     767                return FXFALSE;
     768        }
     769        dprintf(("DosOpen failed -> increased nr open files to %d", CurMaxFH));
     770        goto tryopen1;
     771  }
     772  else
    756773  if(rc) {
    757774     pciErrorCode = PCI_ERR_NO_IO_PERM;
    758775     return FXFALSE;
    759776  }
     777tryopen2:
    760778  rc = DosOpen("TESTCFG$", &hTestCfg, &ulAction, 0, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS, OPEN_ACCESS_READWRITE|OPEN_SHARE_DENYNONE, 0L );
     779  if(rc == ERROR_TOO_MANY_OPEN_FILES) {
     780   ULONG CurMaxFH;
     781   LONG  ReqCount = 32;
     782
     783        rc = DosSetRelMaxFH(&ReqCount, &CurMaxFH);
     784        if(rc) {
     785                dprintf(("DosSetRelMaxFH returned %d", rc));
     786                pciErrorCode = PCI_ERR_NO_IO_PERM;
     787                return FXFALSE;
     788        }
     789        dprintf(("DosOpen failed -> increased nr open files to %d", CurMaxFH));
     790        goto tryopen2;
     791  }
     792  else
    761793  if(rc) {
    762794     pciErrorCode = PCI_ERR_NO_IO_PERM;
    763795     return FXFALSE;
    764796  }
     797tryopen3:
    765798  rc = DosOpen("SCREEN$", &hScreenDD, &ulAction, 0, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS, OPEN_ACCESS_READWRITE|OPEN_SHARE_DENYNONE, 0L );
     799  if(rc == ERROR_TOO_MANY_OPEN_FILES) {
     800   ULONG CurMaxFH;
     801   LONG  ReqCount = 32;
     802
     803        rc = DosSetRelMaxFH(&ReqCount, &CurMaxFH);
     804        if(rc) {
     805                dprintf(("DosSetRelMaxFH returned %d", rc));
     806                pciErrorCode = PCI_ERR_NO_IO_PERM;
     807                return FXFALSE;
     808        }
     809        dprintf(("DosOpen failed -> increased nr open files to %d", CurMaxFH));
     810        goto tryopen3;
     811  }
     812  else
    766813  if(rc) {
    767814     pciErrorCode = PCI_ERR_NO_IO_PERM;
Note: See TracChangeset for help on using the changeset viewer.