summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-12-23 22:01:53 +0100
committerGravatar Nikias Bassen2013-12-23 22:01:53 +0100
commiteb9415e18fda0bf394afe8439319a69bbcb196f4 (patch)
treed717eeb902d7b36704d24de2e32bd260bf6acad7 /src/main.c
parent3d9687b71f73948319931943c75d28a61af36a31 (diff)
downloadusbmuxd-eb9415e18fda0bf394afe8439319a69bbcb196f4.tar.gz
usbmuxd-eb9415e18fda0bf394afe8439319a69bbcb196f4.tar.bz2
increase number of open file descriptors
When a large number of devices are used, the number of open file descriptors can reach the default system limit. Upon startup we now raise it to a much higher value to give more 'space'.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 9e2db60..350fae6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
37#include <sys/un.h> 37#include <sys/un.h>
38#include <sys/stat.h> 38#include <sys/stat.h>
39#include <sys/types.h> 39#include <sys/types.h>
40#include <sys/resource.h>
40#include <fcntl.h> 41#include <fcntl.h>
41#include <getopt.h> 42#include <getopt.h>
42#include <pwd.h> 43#include <pwd.h>
@@ -525,6 +526,12 @@ int main(int argc, char *argv[])
525 goto terminate; 526 goto terminate;
526 } 527 }
527 528
529 // set number of file descriptors to higher value
530 struct rlimit rlim;
531 getrlimit(RLIMIT_NOFILE, &rlim);
532 rlim.rlim_max = 65536;
533 setrlimit(RLIMIT_NOFILE, (const struct rlimit*)&rlim);
534
528 usbmuxd_log(LL_INFO, "Creating socket"); 535 usbmuxd_log(LL_INFO, "Creating socket");
529 res = listenfd = create_socket(); 536 res = listenfd = create_socket();
530 if(listenfd < 0) 537 if(listenfd < 0)