On 23 Jan 2015, at 11:37, Thomas Graf wrote:

On 01/23/15 at 01:17am, Dave Tucker wrote:
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

I think IP_TOS should work fine on MacOSX [0]

[0] https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man4/ip.4.html

Maybe you can just #ifndef the TCLASS socket option call for OSX?

Thanks for the pointer. Will look in to it.

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

An alternative would be to move the definitions for _WIN32 out of
the ifdef and use CLOCK_MONOTONIC=1 CLOCK_REALTIME=2 for both
WIN32 and OSX. I realize that it doesn't really mater for now as
both map to just a gettimeofday() call.

Ack. I'd prefer to keep it as is for now as I believe there is a better way to handle this in Yosemite.
Unfortunately that means reading through a load of API docs.

+
+#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;
+}

This needs some style changes ;-)

Wait, you mean its obvious I'm not a C coder?
Will take a look and see what I can do...
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to