Signed-off-by: Dave Tucker <d...@dtucker.co.uk> --- lib/automake.mk | 5 +++++ lib/byte-order.h | 2 +- lib/socket-util.c | 5 +++++ lib/timeval.c | 26 ++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/lib/automake.mk b/lib/automake.mk index 2a5844b..8168322 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -335,6 +335,11 @@ lib_libopenvswitch_la_SOURCES += \ lib/route-table.h endif +if OSX +lib_libopenvswitch_la_SOURCES += \ + lib/route-table-stub.c +endif + if DPDK_NETDEV lib_libopenvswitch_la_SOURCES += \ lib/netdev-dpdk.c \ diff --git a/lib/byte-order.h b/lib/byte-order.h index 544f46f..142d378 100644 --- a/lib/byte-order.h +++ b/lib/byte-order.h @@ -22,7 +22,7 @@ #include "openvswitch/types.h" #ifndef __CHECKER__ -#ifndef _WIN32 +#if !defined(__APPLE__) && !defined(_WIN32) static inline ovs_be64 htonll(uint64_t n) { diff --git a/lib/socket-util.c b/lib/socket-util.c index 8949da7..732fd89 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -112,6 +112,11 @@ set_dscp(int fd, uint8_t dscp) return 0; #endif +#ifdef __APPLE__ + /* ToDo: Look at OSX QoS API */ + return 0; +#endif + if (dscp > 63) { return EINVAL; } diff --git a/lib/timeval.c b/lib/timeval.c index 6173aff..2c354de 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -56,6 +56,19 @@ typedef unsigned int clockid_t; const static unsigned long long unix_epoch = 116444736000000000; #endif /* _WIN32 */ +#ifdef __APPLE__ +typedef unsigned int clockid_t; + +#ifndef CLOCK_MONOTONIC +#define CLOCK_MONOTONIC 0 +#endif + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +#endif /* __APPLE__ */ + /* Structure set by unixctl time/warp command. */ struct large_warp { struct unixctl_conn *conn; /* Connection waiting for warp response. */ @@ -417,6 +430,19 @@ clock_gettime(clock_t id, struct timespec *ts) } #endif /* _WIN32 */ +#ifdef __APPLE__ +//clock_gettime is not implemented on OSX +int +clock_gettime(clock_t id, struct timespec* ts) { + struct timeval now; + int rv = gettimeofday(&now, NULL); + if (rv) return rv; + ts->tv_sec = now.tv_sec; + ts->tv_nsec = now.tv_usec * 1000; + return 0; +} +#endif + void xgettimeofday(struct timeval *tv) { -- 1.9.3 (Apple Git-50) _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev