summaryrefslogtreecommitdiffstats
path: root/avahi-core
diff options
context:
space:
mode:
authorSebastien Estienne <sebastien.estienne@gmail.com>2006-05-02 15:10:31 +0000
committerSebastien Estienne <sebastien.estienne@gmail.com>2006-05-02 15:10:31 +0000
commitd0a63590d4730eb0af3ec6027818cb62d50ea657 (patch)
treed8d6ffcee0522b8c7e5910e168b033d8a6dca5b1 /avahi-core
parent1a944fb979cf994bdf3b669248f8508394c1697b (diff)
Patch from Padraig O'Briain <Padraig.Obriain@sun.com> to build avahi on Solaris
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1206 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core')
-rw-r--r--avahi-core/iface-pfroute.c12
-rw-r--r--avahi-core/socket.c3
2 files changed, 15 insertions, 0 deletions
diff --git a/avahi-core/iface-pfroute.c b/avahi-core/iface-pfroute.c
index 8b76afa..51f6773 100644
--- a/avahi-core/iface-pfroute.c
+++ b/avahi-core/iface-pfroute.c
@@ -32,7 +32,9 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/param.h>
+#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
+#endif
#include <net/route.h>
#include <net/if.h>
@@ -108,7 +110,11 @@ static void rtm_info(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
#define ROUNDUP(a) \
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+#ifdef HAVE_SYS_SYSCTL_H
#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
+#else
+#define ADVANCE(x, n) (x += ROUNDUP(sizeof(struct sockaddr)))
+#endif
static void rtm_addr(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
{
@@ -140,8 +146,10 @@ static void rtm_addr(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
if (!(addrs & 1<<i))
continue;
sa = (struct sockaddr *)cp;
+#ifdef HAVE_SYS_SYSCTL_H
if (sa->sa_len == 0)
continue;
+#endif
switch(sa->sa_family) {
case AF_INET:
switch (1<<i) {
@@ -317,6 +325,7 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
assert(m);
retry2:
+#ifdef HAVE_SYS_SYSCTL_H
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
mib[2] = 0; /* protocol */
@@ -329,11 +338,13 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
avahi_log_error("route-sysctl-estimate");
return;
}
+#endif
if ((buf = avahi_malloc(needed)) == NULL)
{
avahi_log_error("malloc failed in avahi_interface_monitor_sync");
return;
}
+#ifdef HAVE_SYS_SYSCTL_H
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
avahi_log_warn("sysctl failed: %s", strerror(errno));
if (errno == ENOMEM && count++ < 10) {
@@ -343,6 +354,7 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
goto retry2;
}
}
+#endif
lim = buf + needed;
for (next = buf; next < lim; next += rtm->rtm_msglen) {
rtm = (struct rt_msghdr *)next;
diff --git a/avahi-core/socket.c b/avahi-core/socket.c
index 0eb0374..bd72934 100644
--- a/avahi-core/socket.c
+++ b/avahi-core/socket.c
@@ -31,6 +31,9 @@
#include <fcntl.h>
#include <sys/time.h>
#include <sys/ioctl.h>
+#ifdef HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
#include <assert.h>
#include <sys/types.h>