OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 #include "primpl.h" | 6 #include "primpl.h" |
7 | 7 |
8 #include <string.h> | 8 #include <string.h> |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 | 10 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 fd->secret->appendMode = appendMode; | 358 fd->secret->appendMode = appendMode; |
359 #endif | 359 #endif |
360 _PR_MD_INIT_FD_INHERITABLE(fd, PR_FALSE); | 360 _PR_MD_INIT_FD_INHERITABLE(fd, PR_FALSE); |
361 } | 361 } |
362 } | 362 } |
363 return fd; | 363 return fd; |
364 } | 364 } |
365 | 365 |
366 PR_IMPLEMENT(PRInt32) PR_GetSysfdTableMax(void) | 366 PR_IMPLEMENT(PRInt32) PR_GetSysfdTableMax(void) |
367 { | 367 { |
368 #if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP) && !defined(QNX) | 368 #if defined(XP_UNIX) && !defined(AIX) && !defined(QNX) |
369 struct rlimit rlim; | 369 struct rlimit rlim; |
370 | 370 |
371 if ( getrlimit(RLIMIT_NOFILE, &rlim) < 0) { | 371 if ( getrlimit(RLIMIT_NOFILE, &rlim) < 0) { |
372 /* XXX need to call PR_SetError() */ | 372 /* XXX need to call PR_SetError() */ |
373 return -1; | 373 return -1; |
374 } | 374 } |
375 | 375 |
376 return rlim.rlim_max; | 376 return rlim.rlim_max; |
377 #elif defined(AIX) || defined(NEXTSTEP) || defined(QNX) | 377 #elif defined(AIX) || defined(QNX) |
378 return sysconf(_SC_OPEN_MAX); | 378 return sysconf(_SC_OPEN_MAX); |
379 #elif defined(WIN32) | 379 #elif defined(WIN32) |
380 /* | 380 /* |
381 * There is a systemwide limit of 65536 user handles. | 381 * There is a systemwide limit of 65536 user handles. |
382 */ | 382 */ |
383 return 16384; | 383 return 16384; |
384 #elif defined (WIN16) | 384 #elif defined (WIN16) |
385 return FOPEN_MAX; | 385 return FOPEN_MAX; |
386 #elif defined(XP_OS2) | 386 #elif defined(XP_OS2) |
387 ULONG ulReqCount = 0; | 387 ULONG ulReqCount = 0; |
388 ULONG ulCurMaxFH = 0; | 388 ULONG ulCurMaxFH = 0; |
389 DosSetRelMaxFH(&ulReqCount, &ulCurMaxFH); | 389 DosSetRelMaxFH(&ulReqCount, &ulCurMaxFH); |
390 return ulCurMaxFH; | 390 return ulCurMaxFH; |
391 #elif defined(XP_BEOS) | 391 #elif defined(XP_BEOS) |
392 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); | 392 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
393 return -1; | 393 return -1; |
394 #else | 394 #else |
395 write me; | 395 write me; |
396 #endif | 396 #endif |
397 } | 397 } |
398 | 398 |
399 PR_IMPLEMENT(PRInt32) PR_SetSysfdTableSize(int table_size) | 399 PR_IMPLEMENT(PRInt32) PR_SetSysfdTableSize(int table_size) |
400 { | 400 { |
401 #if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP) && !defined(QNX) | 401 #if defined(XP_UNIX) && !defined(AIX) && !defined(QNX) |
402 struct rlimit rlim; | 402 struct rlimit rlim; |
403 PRInt32 tableMax = PR_GetSysfdTableMax(); | 403 PRInt32 tableMax = PR_GetSysfdTableMax(); |
404 | 404 |
405 if (tableMax < 0) | 405 if (tableMax < 0) |
406 return -1; | 406 return -1; |
407 | 407 |
408 if (tableMax > FD_SETSIZE) | 408 if (tableMax > FD_SETSIZE) |
409 tableMax = FD_SETSIZE; | 409 tableMax = FD_SETSIZE; |
410 | 410 |
411 rlim.rlim_max = tableMax; | 411 rlim.rlim_max = tableMax; |
(...skipping 14 matching lines...) Expand all Loading... |
426 PRInt32 tableMax = PR_GetSysfdTableMax(); | 426 PRInt32 tableMax = PR_GetSysfdTableMax(); |
427 if (table_size > tableMax) { | 427 if (table_size > tableMax) { |
428 APIRET rc = NO_ERROR; | 428 APIRET rc = NO_ERROR; |
429 rc = DosSetMaxFH(table_size); | 429 rc = DosSetMaxFH(table_size); |
430 if (rc == NO_ERROR) | 430 if (rc == NO_ERROR) |
431 return table_size; | 431 return table_size; |
432 else | 432 else |
433 return -1; | 433 return -1; |
434 } | 434 } |
435 return tableMax; | 435 return tableMax; |
436 #elif defined(AIX) || defined(NEXTSTEP) || defined(QNX) \ | 436 #elif defined(AIX) || defined(QNX) \ |
437 || defined(WIN32) || defined(WIN16) || defined(XP_BEOS) | 437 || defined(WIN32) || defined(WIN16) || defined(XP_BEOS) |
438 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); | 438 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
439 return -1; | 439 return -1; |
440 #else | 440 #else |
441 write me; | 441 write me; |
442 #endif | 442 #endif |
443 } | 443 } |
444 | 444 |
445 PR_IMPLEMENT(PRStatus) PR_Delete(const char *name) | 445 PR_IMPLEMENT(PRStatus) PR_Delete(const char *name) |
446 { | 446 { |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 rv = _PR_MD_GETFILEINFO64_UTF16(fn, info); | 774 rv = _PR_MD_GETFILEINFO64_UTF16(fn, info); |
775 if (rv < 0) { | 775 if (rv < 0) { |
776 return PR_FAILURE; | 776 return PR_FAILURE; |
777 } else { | 777 } else { |
778 return PR_SUCCESS; | 778 return PR_SUCCESS; |
779 } | 779 } |
780 } | 780 } |
781 | 781 |
782 /* ================ UTF16 Interfaces ================================ */ | 782 /* ================ UTF16 Interfaces ================================ */ |
783 #endif /* MOZ_UNICODE */ | 783 #endif /* MOZ_UNICODE */ |
OLD | NEW |