diff options
author | Nikias Bassen | 2013-12-23 22:01:53 +0100 |
---|---|---|
committer | Nikias Bassen | 2013-12-23 22:01:53 +0100 |
commit | eb9415e18fda0bf394afe8439319a69bbcb196f4 (patch) | |
tree | d717eeb902d7b36704d24de2e32bd260bf6acad7 | |
parent | 3d9687b71f73948319931943c75d28a61af36a31 (diff) | |
download | usbmuxd-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'.
-rw-r--r-- | src/main.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include <sys/un.h> #include <sys/stat.h> #include <sys/types.h> +#include <sys/resource.h> #include <fcntl.h> #include <getopt.h> #include <pwd.h> @@ -525,6 +526,12 @@ int main(int argc, char *argv[]) goto terminate; } + // set number of file descriptors to higher value + struct rlimit rlim; + getrlimit(RLIMIT_NOFILE, &rlim); + rlim.rlim_max = 65536; + setrlimit(RLIMIT_NOFILE, (const struct rlimit*)&rlim); + usbmuxd_log(LL_INFO, "Creating socket"); res = listenfd = create_socket(); if(listenfd < 0) |