summaryrefslogtreecommitdiff
path: root/sysutils/gamin/patches/patch-ab
blob: 20e536cc7d1af856503894a21cfedb52b3b9f417 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$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);