Changeset 16382 in vbox for trunk/src/libs/xpcom18a4
- Timestamp:
- Jan 29, 2009 5:16:22 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src/ipcdUnix.cpp
r16371 r16382 47 47 #if defined(VBOX) && !defined(XP_OS2) 48 48 # include <sys/resource.h> 49 # include <errno.h> 49 50 #endif 50 51 … … 397 398 PRFileDesc *clientFD; 398 399 399 // @todo : We need to handle errors from accept() especially something like 400 // @todo : We need to handle errors from accept() especially something like 400 401 // EMFILE, which happens when we run out of file descriptors. 401 402 // and puts XPCOMIPCD in a poll/accept endless loop! … … 530 531 531 532 #if defined(VBOX) && !defined(XP_OS2) 532 struct rlimit lim; 533 if (getrlimit(RLIMIT_NOFILE, &lim) == 0) 534 { 535 int k = 10240; 536 for (; k >= 2048; k -= 1024) 533 // Increase the file table size to 10240 or as high as possible. 534 struct rlimit lim; 535 if (getrlimit(RLIMIT_NOFILE, &lim) == 0) 537 536 { 538 if (lim.rlim_cur < k) 537 if ( lim.rlim_cur < 10240 538 && lim.rlim_cur < lim.rlim_max) 539 539 { 540 lim.rlim_cur = k;541 if (setrlimit(RLIMIT_NOFILE, &lim) == 0)542 break;540 lim.rlim_cur = lim.rlim_max <= 10240 ? lim.rlim_max : 10240; 541 if (setrlimit(RLIMIT_NOFILE, &lim) == -1) 542 printf("WARNING: failed to increase file descriptor limit. (%d)\n", errno); 543 543 } 544 else545 break;546 544 } 547 if (k <= 2048) 548 printf("WARNING: failed to increase file descriptor limit.\n"); 549 } 550 else 551 printf ("WARNING: failed to obtain per-process file-descriptor limit.\n"); 545 else 546 printf("WARNING: failed to obtain per-process file-descriptor limit (%d).\n", errno); 552 547 #endif 553 548
Note:
See TracChangeset
for help on using the changeset viewer.