emfile error

Vance Shipley vances@REDACTED
Tue Dec 4 17:46:37 CET 2001


Here's a snippet from one of our C drivers:

   /*  see if we're going to run out of file descriptors  */
   getrlimit(RLIMIT_NOFILE, &rlp);
   if(num_fd > (rlp.rlim_max - 3)) {    /* stdin + stdout + stderr = 3  */
      fprintf(stderr, "number of dchannels causes process limit of %d "
            "open files to be exceeded\n", rlp.rlim_max);
      exit(-1);
   }
   /*  bump up the limit if needed  */
   if(num_fd > (rlp.rlim_cur - 3)) {
      rlp.rlim_cur = num_fd + 3;
      setrlimit(RLIMIT_NOFILE, &rlp);
   }


	-Vance
 



More information about the erlang-questions mailing list