Changeset 16370 in vbox
- Timestamp:
- Jan 29, 2009 2:49:44 PM (16 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xpcom/server.cpp
r16267 r16370 61 61 #include <getopt.h> 62 62 63 #if def RT_OS_SOLARIS63 #ifndef RT_OS_OS2 64 64 # include <sys/resource.h> 65 65 #endif … … 1051 1051 do 1052 1052 { 1053 #ifdef RT_OS_SOLARIS1054 struct rlimit lim;1055 if (getrlimit(RLIMIT_NOFILE, &lim) == 0)1056 {1057 if (lim.rlim_cur < 2048)1058 {1059 lim.rlim_cur = 2048;1060 if (setrlimit(RLIMIT_NOFILE, &lim) != 0)1061 {1062 getrlimit(RLIMIT_NOFILE, &lim);1063 printf ("WARNING: failed to increase per-process file-descriptor limit to 2048.\n", lim.rlim_cur);1064 }1065 }1066 }1067 else1068 printf ("WARNING: failed to obtain per-process file-descriptor limit.\n");1069 #endif1070 1071 1053 rc = com::Initialize(); 1072 1054 if (NS_FAILED (rc)) … … 1186 1168 } 1187 1169 1170 #ifndef RT_OS_OS2 1171 struct rlimit lim; 1172 if (getrlimit(RLIMIT_NOFILE, &lim) == 0) 1173 { 1174 int k = 10240; 1175 for (; k >= 2048; k -= 1024) 1176 { 1177 if (lim.rlim_cur < k) 1178 { 1179 lim.rlim_cur = k; 1180 if (setrlimit(RLIMIT_NOFILE, &lim) == 0) 1181 break; 1182 } 1183 else 1184 break; 1185 } 1186 if (k <= 2048) 1187 printf("WARNING: failed to increase file descriptor limit.\n"); 1188 } 1189 else 1190 printf ("WARNING: failed to obtain per-process file-descriptor limit.\n"); 1191 #endif 1192 1188 1193 PLEvent *ev; 1189 1194 while (gKeepRunning) -
trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src/ipcdUnix.cpp
r16267 r16370 45 45 #include <string.h> 46 46 47 #ifdef RT_OS_ SOLARIS47 #ifdef RT_OS_OS2 48 48 # include <sys/resource.h> 49 49 #endif … … 397 397 PRFileDesc *clientFD; 398 398 399 // @todo : We need to handle errors from accept() especially something like 400 // EMFILE, which happens when we run out of file descriptors. 401 // and puts XPCOMIPCD in a poll/accept endless loop! 399 402 clientFD = PR_Accept(listenFD, &clientAddr, PR_INTERVAL_NO_WAIT); 400 403 if (clientFD == NULL) { … … 478 481 PL_strncpyz(addr.local.path, argv[1], sizeof(addr.local.path)); 479 482 480 #ifdef RT_OS_SOLARIS481 struct rlimit lim;482 if (getrlimit(RLIMIT_NOFILE, &lim) == 0)483 {484 if (lim.rlim_cur < 2048)485 {486 lim.rlim_cur = 2048;487 if (setrlimit(RLIMIT_NOFILE, &lim) != 0)488 {489 getrlimit(RLIMIT_NOFILE, &lim);490 printf ("WARNING: failed to increase per-process file-descriptor limit to 2048\n", lim.rlim_cur);491 }492 }493 }494 else495 printf ("WARNING: failed to obtain per-process file-descriptor limit.\n");496 #endif497 498 483 #ifdef IPC_USE_FILE_LOCK 499 484 Status status = InitDaemonDir(addr.local.path); … … 544 529 IPC_NotifyParent(); 545 530 531 #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) 537 { 538 if (lim.rlim_cur < k) 539 { 540 lim.rlim_cur = k; 541 if (setrlimit(RLIMIT_NOFILE, &lim) == 0) 542 break; 543 } 544 else 545 break; 546 } 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"); 552 #endif 553 546 554 PollLoop(listenFD); 547 555 }
Note:
See TracChangeset
for help on using the changeset viewer.