> Thanks for the fix! Sorry, I don't know too much about the intricacies of > NetBSD. My first version seemed to work on my NetBSD instance though, so I > wrongly assumed it would work for most versions of NetBSD.
it picked the old (pre-64bit-time_t) compat version of the function. yes, it should work. but better to use the latest one which all newly compiled C programs would use. YAMAMOTO Takashi > > I tested this on FreeBSD and it works, but I don't know the intricacies of > FreeBSD either. > > I applied your incremental in my next patch. > > http://patchwork.openvswitch.org/patch/4367/ > > > Again thanks! > > Ryan > > On 6/2/14 10:38 PM, "YAMAMOTO Takashi" <yamam...@valinux.co.jp> wrote: > >>> This patch also checks the system platform as clock_gettime >>> could exist on different platforms but with different values of >>> CLOCK_MONOTONIC and different definitions of 'struct timespec'. >>> In this case, the system call would be expected to catch the >>> error, which is dangerous. >>> >>> This patch ensures Linux, NetBSD and FreeBSD platforms use >>> clock_gettime with their corresponding correct values and >>> definitions. All other platforms use time.time(). >> >>thanks. >> >>the following is incremental diff to fix NetBSD case. >>please feel free to fold it into yours. >> >>i haven't checked FreeBSD part. >> >>YAMAMOTO Takashi >> >>From 71891a0fc4ba892e26fec8e704167ab8ccde408a Mon Sep 17 00:00:00 2001 >>From: YAMAMOTO Takashi <yamam...@valinux.co.jp> >>Date: Tue, 3 Jun 2014 14:17:23 +0900 >>Subject: [PATCH] timeval: Fix NetBSD case >> >>Signed-off-by: YAMAMOTO Takashi <yamam...@valinux.co.jp> >>--- >> python/ovs/timeval.py | 9 ++++++++- >> 1 file changed, 8 insertions(+), 1 deletion(-) >> >>diff --git a/python/ovs/timeval.py b/python/ovs/timeval.py >>index 6f3cbb3..a34ef2b 100644 >>--- a/python/ovs/timeval.py >>+++ b/python/ovs/timeval.py >>@@ -16,6 +16,7 @@ import sys >> import time >> >> LIBRT = 'librt.so.1' >>+clock_gettime_name = 'clock_gettime' >> >> try: >> import ctypes >>@@ -24,6 +25,12 @@ try: >> CLOCK_MONOTONIC = 1 >> time_t = ctypes.c_long >> elif sys.platform.startswith("netbsd"): >>+ # NetBSD uses function renaming for ABI versioning. While the >>proper >>+ # way to get the appropriate version is of course "#include >><time.h>", >>+ # it is difficult with ctypes. The following is appropriate for >>+ # recent versions of NetBSD, including NetBSD-6. >>+ LIBRT = 'libc.so.12' >>+ clock_gettime_name = '__clock_gettime50' >> CLOCK_MONOTONIC = 3 >> time_t = ctypes.c_int64 >> elif sys.platform.startswith("freebsd"): >>@@ -39,7 +46,7 @@ try: >> ] >> >> librt = ctypes.CDLL(LIBRT) >>- clock_gettime = librt.clock_gettime >>+ clock_gettime = getattr(librt, clock_gettime_name) >> clock_gettime.argtypes = [ctypes.c_int, ctypes.POINTER(timespec)] >> except: >> # Librt shared library could not be loaded >>-- >>1.9.0 >>_______________________________________________ >>dev mailing list >>dev@openvswitch.org >>https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/ >>listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=TfBS78Vw3dzttvXidhbffg% >>3D%3D%0A&m=EIzWMNYZlk7pLtwllkmlJqm%2FDcGWDbOB7Icp95%2Fr1tA%3D%0A&s=0e9550c >>56b07bdd67032cee1451ade1acb6b88ebcdc237cc36e1cb1f61e8855b > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev