$NetBSD: patch-ab,v 1.3 2007/08/05 20:03:35 tnn Exp $ --- server/gam_kqueue.c.orig 2007-07-04 15:50:41.000000000 +0200 +++ server/gam_kqueue.c @@ -326,7 +326,7 @@ gam_kqueue_isdir (const char *pathname, static gboolean gam_kqueue_get_uint_sysctl (const char *name, unsigned int *value) { - unsigned int value_len = sizeof(*value); + size_t value_len = sizeof(*value); if (sysctlbyname(name, value, &value_len, (void *)NULL, 0) < 0) { @@ -1135,8 +1135,10 @@ gam_kqueue_init (void) if (! gam_kqueue_get_uint_sysctl("kern.maxfiles", &maxfiles)) return FALSE; +#if defined(KERN_MAXFILESPERPROC) if (! gam_kqueue_get_uint_sysctl("kern.maxfilesperproc", &maxfilesperproc)) return FALSE; +#endif /* * We make sure to: @@ -1145,9 +1147,13 @@ gam_kqueue_init (void) */ maxfiles *= CFG_GLOBAL_FILE_RESERVE_RATIO; +#if defined(KERN_MAXFILESPERPROC) maxfilesperproc = maxfilesperproc > CFG_SELF_FILE_RESERVE ? maxfilesperproc - CFG_SELF_FILE_RESERVE : 0; +#else + maxfilesperproc = maxfiles; +#endif max_open_files = MIN(maxfiles, maxfilesperproc);