3.st.osx.kqueue.patch 593 B

12345678910111213141516171819
  1. *** io.c Fri Oct 2 06:49:07 2009
  2. --- ../st-1.9-patch/io.c Mon Mar 16 15:06:28 2015
  3. ***************
  4. *** 89,94 ****
  5. --- 89,102 ----
  6. if (fdlim > 0 && rlim.rlim_max > (rlim_t) fdlim) {
  7. rlim.rlim_max = fdlim;
  8. }
  9. +
  10. + /* when rlimit max is negative, for example, osx, use cur directly. */
  11. + /* @see https://github.com/winlinvip/simple-rtmp-server/issues/336 */
  12. + if ((int)rlim.rlim_max < 0) {
  13. + _st_osfd_limit = (int)(fdlim > 0? fdlim : rlim.rlim_cur);
  14. + return 0;
  15. + }
  16. +
  17. rlim.rlim_cur = rlim.rlim_max;
  18. if (setrlimit(RLIMIT_NOFILE, &rlim) < 0)
  19. return -1;