diff options
author | wtc%netscape.com <devnull@localhost> | 2003-07-09 04:53:36 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2003-07-09 04:53:36 +0000 |
commit | 6857b3b4bd650b507b6c296a6144dbbee10ee23a (patch) | |
tree | 8085c97b41a161f2a0456c15d03e059d40226d9e | |
parent | 3c51d8b09876fec9b9054ee4f7ff08c53fddc4b5 (diff) | |
download | nspr-hg-6857b3b4bd650b507b6c296a6144dbbee10ee23a.tar.gz |
Bug 126937: implement PR_GetSysfdTableMax and PR_SetSysfdTableSize for
OS/2. The patch is contributed by Michael Kaply <mkaply@us.ibm.com>.
r=pedemont.
Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
-rw-r--r-- | pr/src/io/prfile.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/pr/src/io/prfile.c b/pr/src/io/prfile.c index 1b3acaec..25354453 100644 --- a/pr/src/io/prfile.c +++ b/pr/src/io/prfile.c @@ -422,14 +422,18 @@ PRInt32 PR_GetSysfdTableMax(void) return rlim.rlim_max; #elif defined(AIX) || defined(NEXTSTEP) || defined(QNX) return sysconf(_SC_OPEN_MAX); -#elif defined(WIN32) || defined(OS2) +#elif defined(WIN32) /* * There is a systemwide limit of 65536 user handles. - * Not sure on OS/2, but sounds good. */ return 16384; #elif defined (WIN16) return FOPEN_MAX; +#elif defined(XP_OS2) + ULONG ulReqCount = 0; + ULONG ulCurMaxFH = 0; + DosSetRelMaxFH(&ulReqCount, &ulCurMaxFH); + return ulCurMaxFH; #elif defined (XP_MAC) || defined(XP_BEOS) PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); return -1; @@ -464,9 +468,19 @@ PRInt32 PR_SetSysfdTableSize(int table_size) } return rlim.rlim_cur; +#elif defined(XP_OS2) + PRInt32 tableMax = PR_GetSysfdTableMax(); + if (table_size > tableMax) { + APIRET rc = NO_ERROR; + rc = DosSetMaxFH(table_size); + if (rc == NO_ERROR) + return table_size; + else + return -1; + } + return tableMax; #elif defined(AIX) || defined(NEXTSTEP) || defined(QNX) \ - || defined(WIN32) || defined(WIN16) || defined(OS2) \ - || defined(XP_BEOS) + || defined(WIN32) || defined(WIN16) || defined(XP_BEOS) PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); return -1; #elif defined (XP_MAC) |