diff options
author | abs <abs@pkgsrc.org> | 2010-12-07 22:26:10 +0000 |
---|---|---|
committer | abs <abs@pkgsrc.org> | 2010-12-07 22:26:10 +0000 |
commit | cbbbb2284d81699c951087a453ef4d7531f24210 (patch) | |
tree | a0bb6a9f3d87716fe0c73f73adc2c1db54b1d48c /net/dhcpcd-dbus | |
parent | 28b81a53b557795a43b58fa7a8f3a756cf69104c (diff) | |
download | pkgsrc-cbbbb2284d81699c951087a453ef4d7531f24210.tar.gz |
Add patch from roy@ to enable building on Darwin. Bump PKGREVISION
Diffstat (limited to 'net/dhcpcd-dbus')
-rw-r--r-- | net/dhcpcd-dbus/Makefile | 3 | ||||
-rw-r--r-- | net/dhcpcd-dbus/distinfo | 3 | ||||
-rw-r--r-- | net/dhcpcd-dbus/patches/patch-aa | 101 |
3 files changed, 105 insertions, 2 deletions
diff --git a/net/dhcpcd-dbus/Makefile b/net/dhcpcd-dbus/Makefile index 7a830b3bfc2..806c60fd165 100644 --- a/net/dhcpcd-dbus/Makefile +++ b/net/dhcpcd-dbus/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.8 2010/07/04 09:03:00 roy Exp $ +# $NetBSD: Makefile,v 1.9 2010/12/07 22:26:10 abs Exp $ # DISTNAME= dhcpcd-dbus-0.5.2 +PKGREVISION= 1 CATEGORIES= net MASTER_SITES= ftp://roy.marples.name/pub/dhcpcd/ MASTER_SITES+= http://roy.aydogan.net/dhcpcd/ diff --git a/net/dhcpcd-dbus/distinfo b/net/dhcpcd-dbus/distinfo index 5238514b61a..54c3ac26b7d 100644 --- a/net/dhcpcd-dbus/distinfo +++ b/net/dhcpcd-dbus/distinfo @@ -1,5 +1,6 @@ -$NetBSD: distinfo,v 1.7 2010/07/04 09:03:00 roy Exp $ +$NetBSD: distinfo,v 1.8 2010/12/07 22:26:10 abs Exp $ SHA1 (dhcpcd-dbus-0.5.2.tar.bz2) = 4adb224ed4f99613949bbadad7ba01dd61d5d69b RMD160 (dhcpcd-dbus-0.5.2.tar.bz2) = 690028759968235546648b8ed2674d4aa96a3f09 Size (dhcpcd-dbus-0.5.2.tar.bz2) = 19781 bytes +SHA1 (patch-aa) = bc4ae42c3b1cd30f38713a3254c7dddcdb5aa026 diff --git a/net/dhcpcd-dbus/patches/patch-aa b/net/dhcpcd-dbus/patches/patch-aa new file mode 100644 index 00000000000..1bef40db07c --- /dev/null +++ b/net/dhcpcd-dbus/patches/patch-aa @@ -0,0 +1,101 @@ +$NetBSD: patch-aa,v 1.1 2010/12/07 22:26:10 abs Exp $ + +--- eloop.c.orig 2010-12-06 14:41:51.000000000 +0000 ++++ eloop.c +@@ -25,6 +25,11 @@ + * SUCH DAMAGE. + */ + ++#ifdef __APPLE__ ++# include <mach/mach_time.h> ++# include <mach/kern_return.h> ++#endif ++ + #include <sys/time.h> + + #include <errno.h> +@@ -33,6 +38,7 @@ + #include <stdarg.h> + #include <stdlib.h> + #include <syslog.h> ++#include <unistd.h> + + #include "eloop.h" + +@@ -65,16 +71,71 @@ static struct timeout *free_timeouts; + static struct pollfd *fds; + static size_t fds_len; + +-static int get_monotonic(struct timeval *tp) ++/* Handy function to get the time. ++ * We only care about time advancements, not the actual time itself ++ * Which is why we use CLOCK_MONOTONIC, but it is not available on all ++ * platforms. ++ */ ++#define NO_MONOTONIC "host does not support a monotonic clock - timing can skew" ++static int clock_monotonic; ++static int ++get_monotonic(struct timeval *tp) + { ++ static int posix_clock_set = 0; ++#if defined(_POSIX_MONOTONIC_CLOCK) && defined(CLOCK_MONOTONIC) + struct timespec ts; ++ static clockid_t posix_clock; ++ ++ if (!posix_clock_set) { ++ if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { ++ posix_clock = CLOCK_MONOTONIC; ++ clock_monotonic = posix_clock_set = 1; ++ } ++ } + +- if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { +- tp->tv_sec = ts.tv_sec; +- tp->tv_usec = ts.tv_nsec / 1000; ++ if (clock_monotonic) { ++ if (clock_gettime(posix_clock, &ts) == 0) { ++ tp->tv_sec = ts.tv_sec; ++ tp->tv_usec = ts.tv_nsec / 1000; ++ return 0; ++ } ++ } ++#elif defined(__APPLE__) ++#define NSEC_PER_SEC 1000000000 ++ /* We can use mach kernel functions here. ++ * This is crap though - why can't they implement clock_gettime?*/ ++ static struct mach_timebase_info info = { 0, 0 }; ++ static double factor = 0.0; ++ uint64_t nano; ++ long rem; ++ ++ if (!posix_clock_set) { ++ if (mach_timebase_info(&info) == KERN_SUCCESS) { ++ factor = (double)info.numer / (double)info.denom; ++ clock_monotonic = posix_clock_set = 1; ++ } ++ } ++ if (clock_monotonic) { ++ nano = mach_absolute_time(); ++ if ((info.denom != 1 || info.numer != 1) && factor != 0.0) ++ nano *= factor; ++ tp->tv_sec = nano / NSEC_PER_SEC; ++ rem = nano % NSEC_PER_SEC; ++ if (rem < 0) { ++ tp->tv_sec--; ++ rem += NSEC_PER_SEC; ++ } ++ tp->tv_usec = rem / 1000; + return 0; + } +- return -1; ++#endif ++ ++ /* Something above failed, so fall back to gettimeofday */ ++ if (!posix_clock_set) { ++ syslog(LOG_WARNING, NO_MONOTONIC); ++ posix_clock_set = 1; ++ } ++ return gettimeofday(tp, NULL); + } + + static int |