From cb74a64d630a10818d2ff88ffdeda8a77a3622b8 Mon Sep 17 00:00:00 2001 From: Sebastien Estienne Date: Sun, 13 Nov 2005 17:18:35 +0000 Subject: [PATCH] * fixed a problem on FreeBSD where sysctl needs locked memory git-svn-id: file:///home/lennart/svn/public/avahi/trunk@956 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-core/iface-pfroute.c | 6 +++++- avahi-daemon/main.c | 3 ++- docs/TODO | 2 -- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/avahi-core/iface-pfroute.c b/avahi-core/iface-pfroute.c index c573075..c3a342d 100644 --- a/avahi-core/iface-pfroute.c +++ b/avahi-core/iface-pfroute.c @@ -321,10 +321,14 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) { mib[4] = NET_RT_IFLIST; mib[5] = 0; /* no flags */ if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) - return; + { + avahi_log_warn("sysctl failed: %s", strerror(errno)); + return; + } if ((buf = avahi_malloc(needed)) == NULL) return; if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) { + avahi_log_warn("sysctl failed: %s", strerror(errno)); if (errno == ENOMEM && count++ < 10) { sleep(1); avahi_free(buf); diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c index 821820e..12af74c 100644 --- a/avahi-daemon/main.c +++ b/avahi-daemon/main.c @@ -971,7 +971,8 @@ static void enforce_rlimits(void) { set_one_rlimit(RLIMIT_NPROC, config.rlimit_nproc, "RLIMIT_NPROC"); #endif -#ifdef RLIMIT_MEMLOCK + /* the sysctl() call from iface-pfroute.c needs locked memory on FreeBSD */ +#if defined(RLIMIT_MEMLOCK) && !defined(__FreeBSD__) /* We don't need locked memory */ set_one_rlimit(RLIMIT_MEMLOCK, 0, "RLIMIT_MEMLOCK"); #endif diff --git a/docs/TODO b/docs/TODO index 3ccf6ec..77a2016 100644 --- a/docs/TODO +++ b/docs/TODO @@ -5,8 +5,6 @@ for 0.6: * Expose AvahiSRecordBrowser over D-BUS and implement in avahi-client [lathiat] * fix python scripts * update man pages -* add some avahi_warn_log in iface-pfroute for the sysctl call [sebest] -* find why the sysctl call in iface-pfroute fails on FreeBSD "Cannot allocate memory" needs --no-rtlimits to workaround this [sebest] * portability: implement avahi_exe_name() in avahi-compat-libdns_sd/warn.c on non-linux architectures [sebest] later: -- 2.39.5