cvs diff: Diffing .
Index: Makefile
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/Makefile,v
retrieving revision 1.76
diff -u -p -u -p -r1.76 Makefile
--- Makefile	12 Jan 2016 13:58:44 -0000	1.76
+++ Makefile	15 Jan 2016 14:14:43 -0000
@@ -63,6 +63,10 @@ BASEOPT=-fPIC $(OPT) $(M5C) -Wall -W -We
 CCOPT=$(BASEOPT) $(FILAOPT) -Wbad-function-cast -Wstrict-prototypes
 CXXOPT=$(BASEOPT) $(FILAOPT) $(GCCSIGN) -Wno-long-long -Wno-unused-function
 
+ifeq ($(shell uname),OpenBSD)
+	# OpenBSD system headers redeclare the same stuff many times ...
+	override CXXOPT += -Wno-redundant-decls
+endif
 
 ifeq ($(B2B),32)
 	override AS    += -m32
Index: evlbidebug.h
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/evlbidebug.h,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 evlbidebug.h
--- evlbidebug.h	29 Jan 2013 11:30:49 -0000	1.6
+++ evlbidebug.h	15 Jan 2016 14:14:43 -0000
@@ -61,7 +61,7 @@ void do_cerr_unlock( void );
             struct timeval raw_t1m3;                                            \
             ::gettimeofday(&raw_t1m3, NULL);                                 \
             ::strftime( t1m3_buff3r, sizeof(t1m3_buff3r), "%Y-%m-%d %H:%M:%S", gmtime(&raw_t1m3.tv_sec) ); \
-            ::sprintf( t1m3_buff3r + 19, ".%02ld: ", (long int)(raw_t1m3.tv_usec / 10000) ); \
+            ::snprintf( t1m3_buff3r + 19, sizeof(t1m3_buff3r)-19, ".%02ld: ", (long int)(raw_t1m3.tv_usec / 10000) ); \
             OsS_ZyP << t1m3_buff3r;\
             if( dbglev_fn()>fnthres_fn() ) \
                 OsS_ZyP << EVDBG_FUNC; \
Index: jit.h
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/jit.h,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 jit.h
--- jit.h	19 Apr 2012 09:19:47 -0000	1.1
+++ jit.h	15 Jan 2016 14:14:43 -0000
@@ -32,7 +32,7 @@
 #include <countedpointer.h>
 
 // Set linker command + extension of shared library based on O/S
-#if defined(__linux__) || defined(__sun__)
+#if defined(__linux__) || defined(__sun__) || defined(__OpenBSD__)
     #define LOPT  " -shared"
     #define SOEXT ".so"
 #elif defined(__APPLE__) && defined(__MACH__)
Index: mountpoint.cc
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/mountpoint.cc,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 mountpoint.cc
--- mountpoint.cc	10 Nov 2015 11:16:48 -0000	1.6
+++ mountpoint.cc	15 Jan 2016 14:14:43 -0000
@@ -703,6 +703,22 @@ mountpointinfo_type statmountpoints(moun
         return mps;
     }
 
+#elif defined(__OpenBSD__)
+    // On OpenBSD we use getfsent(3) and friends
+    #include <fstab.h>
+
+    sysmountpointlist_type find_sysmountpoints( void ) {
+        struct fstab*          fs;
+        sysmountpointlist_type mps;
+
+        ASSERT2_COND(::setfsent()==1, SCINFO(" failed to open fstab file?"));
+        while( (fs=::getfsent())!=0 )
+            mps.push_back( sysmountpoint_type(fs->fs_file, fs->fs_spec) );
+        ::endfsent();
+        // clean up
+        return mps;
+    }
+
 #else // ! __APPLE__
     // Everywhere else we use getmntent(3)
     #include <stdio.h>
Index: runtime.cc
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/runtime.cc,v
retrieving revision 1.53
diff -u -p -u -p -r1.53 runtime.cc
--- runtime.cc	18 Sep 2015 14:24:53 -0000	1.53
+++ runtime.cc	15 Jan 2016 14:14:43 -0000
@@ -38,7 +38,6 @@
 // C and system includes
 #include <signal.h>
 #include <math.h>
-#include <sys/timeb.h>
 #include <time.h>
 
 using namespace std;
Index: test.cc
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/test.cc,v
retrieving revision 1.73
diff -u -p -u -p -r1.73 test.cc
--- test.cc	12 Jan 2016 13:58:44 -0000	1.73
+++ test.cc	15 Jan 2016 14:14:43 -0000
@@ -53,7 +53,6 @@
 // system headers (for sockets and, basically, everything else :))
 #include <time.h>
 #include <sys/poll.h>
-#include <sys/timeb.h>
 #include <sys/time.h>
 #include <netdb.h>
 #include <fcntl.h>
Index: threadfns.cc
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/threadfns.cc,v
retrieving revision 1.115
diff -u -p -u -p -r1.115 threadfns.cc
--- threadfns.cc	6 Jan 2016 08:48:28 -0000	1.115
+++ threadfns.cc	15 Jan 2016 14:14:43 -0000
@@ -55,7 +55,6 @@
 #include <stdexcept>
 
 #include <sys/time.h>
-#include <sys/timeb.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
@@ -3396,7 +3395,7 @@ void fifowriter(inq_type<block>* inq, sy
     SSHANDLE             sshandle;
     // variables for restricting the output-rate of errormessages +
     // count how many data was NOT written to the device
-    struct timeb*        tptr = 0;
+    struct timeval*      tptr = 0;
 
     // indicate we're writing to the 'FIFO'
     // and take over stuff from the runtime.
@@ -3421,19 +3420,17 @@ void fifowriter(inq_type<block>* inq, sy
         // the blockage has lifted and produce no output.
         if( tptr ) {
             double         dt;
-            struct timeb   tnow;
+            struct timeval tnow;
 
-            ::ftime( &tnow );
-            dt = ((double)tnow.time + ((double)tnow.millitm/1000.0)) -
-                ((double)tptr->time + ((double)tptr->millitm/1000.0));
+            ::gettimeofday(&tnow, 0);
+            dt = (double)(tnow.tv_sec - tptr->tv_sec) + 
+                 ((double)(tnow.tv_usec - tptr->tv_usec))/1.0e6;
             if( dt>=2.0 ) {
                 if( nskipped ) {
                     char      tb[32];
-                    time_t    time_t_now;
                     struct tm tm_now;
 
-                    time_t_now = ::time(0);
-                    ::localtime_r(&time_t_now, &tm_now);
+                    ::localtime_r(&tnow.tv_sec, &tm_now);
                     ::strftime(tb, sizeof(tb), "%T", &tm_now);
                     *tptr    = tnow;
                     DEBUG(-1, "fifowriter: " << tb << " FIFO too full! " <<
@@ -3454,10 +3451,10 @@ void fifowriter(inq_type<block>* inq, sy
 
             // if no timeptr yet, create it
             if( !tptr ) {
-                tptr = new struct timeb;
+                tptr = new struct timeval;
 
                 // and initialize it
-                ::ftime( tptr );
+                ::gettimeofday(tptr, 0);
             }
             continue;
         }
@@ -3785,7 +3782,7 @@ void timechecker(inq_type<frame>* inq, s
 
             oss.str( string() );
             for( unsigned int i=0; i<4; i++ ) {
-                ::sprintf(buff, "0x%08x ", bytes[i]);
+                ::snprintf(buff, sizeof(buff), "0x%08x ", bytes[i]);
                 oss << buff;
             }
             DEBUG(-1, "  " << oss.str() << endl);
Index: timezooi.cc
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/timezooi.cc,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 timezooi.cc
--- timezooi.cc	16 Mar 2014 20:58:29 -0000	1.3
+++ timezooi.cc	15 Jan 2016 14:14:43 -0000
@@ -156,7 +156,7 @@ time_t normalize_tm_gm(struct tm *tm) {
 }
 
 
-#if defined( __APPLE__ )
+#if defined( __APPLE__ ) || defined(__OpenBSD__)
 #include <unistd.h>  // for ::sleep()
 
 int clock_nanosleep(clockid_t, int, const struct timespec* ts, struct timespec*) {
Index: timezooi.h
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/timezooi.h,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 timezooi.h
--- timezooi.h	6 Dec 2012 15:49:33 -0000	1.2
+++ timezooi.h	15 Jan 2016 14:14:43 -0000
@@ -52,12 +52,15 @@ time_t normalize_tm(struct tm *tm);
 time_t normalize_tm_gm(struct tm *tm);
 
 
+// Mac OSX and OpenBSD don't have no clock_nanosleep!
+// but OpenBSD does have clockid_t ...
 #if defined(__APPLE__)
-// Mac OSX don't have no clock_nanosleep!
 typedef int clockid_t;
 const clockid_t CLOCK_REALTIME = 0;
 const int       TIMER_ABSTIME  = 0;
+#endif // defined (__APPLE__)
 
+#if defined(__APPLE__) || defined(__OpenBSD__)
 int clock_nanosleep(clockid_t, int, const struct timespec* ts, struct timespec*);
 #endif // defined (__APPLE__)
 
Index: xlrdevice.cc
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/xlrdevice.cc,v
retrieving revision 1.36
diff -u -p -u -p -r1.36 xlrdevice.cc
--- xlrdevice.cc	2 Jul 2015 10:12:58 -0000	1.36
+++ xlrdevice.cc	15 Jan 2016 14:14:43 -0000
@@ -43,11 +43,16 @@ DEFINE_EZEXCEPT(xlrreg_exception)
 
 
 #ifdef NOSSAPI
+#define NOTSUPPORTED "Compiled without support for StreamStor"
 XLR_RETURN_CODE XLRClose(SSHANDLE) { return XLR_FAIL; }
 UINT            XLRDeviceFind( void )   { return 0; }
 XLR_RETURN_CODE XLRGetDBInfo(SSHANDLE,PS_DBINFO) { return XLR_FAIL; }
 XLR_RETURN_CODE XLRGetErrorMessage(char* e,XLR_ERROR_CODE) { 
-    ::strcpy(e, "Compiled without support for StreamStor"); return XLR_SUCCESS; }
+#if defined(__APPLE__) || defined(__OpenBSD__)
+    ::strlcpy(e, NOTSUPPORTED, sizeof(NOTSUPPORTED)); return XLR_SUCCESS; }
+#else
+    ::strcpy(e, NOTSUPPORTED); return XLR_SUCCESS; }
+#endif
 DWORDLONG       XLRGetFIFOLength(SSHANDLE)  { return 0; }
 // StreamStor error codes start at 2 so we must be sure to return something
 // that counts as an error
Index: libudt5ab/Makefile
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/libudt5ab/Makefile,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 Makefile
--- libudt5ab/Makefile	19 Mar 2014 16:08:50 -0000	1.2
+++ libudt5ab/Makefile	15 Jan 2016 14:14:43 -0000
@@ -25,6 +25,10 @@ ifeq ($(UNAME),SunOS)
     os     = BSD
     target = libudt5ab.a
 endif
+ifeq ($(UNAME),OpenBSD)
+    os     = BSD
+    target = libudt5ab.a
+endif
 
 ifeq ($(os),)
 	target=failos
cvs diff: Diffing mk5command
Index: mk5command/disk2file.cc
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/mk5command/disk2file.cc,v
retrieving revision 1.7
diff -u -p -u -p -r1.7 disk2file.cc
--- mk5command/disk2file.cc	6 Jul 2015 15:39:30 -0000	1.7
+++ mk5command/disk2file.cc	15 Jan 2016 14:14:43 -0000
@@ -145,7 +145,7 @@ string disk2file_fn(bool qry, const vect
             mk5b_inputmode_type curipm;
 
             rte.get_input( curipm );
-            sprintf(tmp, "%08x", curipm.bitstreammask);
+            ::snprintf(tmp, sizeof(tmp), "%08x", curipm.bitstreammask);
             suffix = string("_bm=0x") + string(tmp) + ".m5b";
         }
         d2f.file_name = current_scan.name() + suffix;
Index: mk5command/tstat.cc
===================================================================
RCS file: /export/home/jive_cvs/HAAVEE/CVSRepository/evlbi5a/mk5command/tstat.cc,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 tstat.cc
--- mk5command/tstat.cc	28 Nov 2014 14:32:23 -0000	1.3
+++ mk5command/tstat.cc	15 Jan 2016 14:14:43 -0000
@@ -18,7 +18,6 @@
 //          7990 AA Dwingeloo
 #include <mk5_exception.h>
 #include <mk5command/mk5.h>
-#include <sys/timeb.h>
 #include <sciprint.h>
 #include <iostream>
 
@@ -44,18 +43,18 @@ using namespace std;
 //       This allows you to poll at your own frequency and compute the rates
 //       for over that period. Or graph them. Or throw them away.
 string tstat_fn(bool q, const vector<string>& args, runtime& rte ) {
-    double                          dt;
-    uint64_t                        fifolen;
-    const double                    fifosize( 512 * 1024 * 1024 );
-    ostringstream                   reply;
-    chainstats_type                 current;
-    transfer_type                   transfermode;
-    struct timeb                    time_cur;
-    static per_runtime<timeb*>      time_last_per_runtime;
-    struct timeb*&                  time_last = time_last_per_runtime[&rte];
+    double                              dt;
+    uint64_t                            fifolen;
+    const double                        fifosize( 512 * 1024 * 1024 );
+    ostringstream                       reply;
+    chainstats_type                     current;
+    transfer_type                       transfermode;
+    struct timeval                      time_cur;
+    static per_runtime<struct timeval*> time_last_per_runtime;
+    struct timeval*&                    time_last = time_last_per_runtime[&rte];
     static per_runtime<chainstats_type> laststats_per_runtime;
-    chainstats_type&                laststats = laststats_per_runtime[&rte];
-    chainstats_type::const_iterator lastptr, curptr;
+    chainstats_type&                    laststats = laststats_per_runtime[&rte];
+    chainstats_type::const_iterator     lastptr, curptr;
 
     // The tstat command and query can always be performed
 
@@ -73,13 +72,13 @@ string tstat_fn(bool q, const vector<str
     // must serialize access to the StreamStor
     // (hence the do_xlr_[un]lock();
     do_xlr_lock();
-    ::ftime( &time_cur );
+    ::gettimeofday(&time_cur, 0);
     fifolen = ::XLRGetFIFOLength(rte.xlrdev.sshandle());
     do_xlr_unlock();
 
     // Are we called as a command? Then our lives are much easier!
     if( !q ) {
-        double tijd = (double)time_cur.time + ((double)time_cur.millitm)/1.0e3;
+        double tijd = (double)time_cur.tv_sec + ((double)time_cur.tv_usec)/1.0e6;
 
         // indicate succes and output timestamp + transfermode
         reply << " 0 : "
@@ -113,13 +112,13 @@ string tstat_fn(bool q, const vector<str
     }
 
     if( !time_last ) {
-        time_last = new struct timeb;
+        time_last = new struct timeval;
         *time_last = time_cur;
     }
 
     // Compute 'dt'. If it's too small, do not even try to compute rates
-    dt = (time_cur.time + time_cur.millitm/1000.0) - 
-         (time_last->time + time_last->millitm/1000.0);
+    dt = (time_cur.tv_sec - time_last->tv_sec) +
+         ((double)time_cur.tv_usec - time_last->tv_usec)/1.0e6;
 
     if( dt>0.1 ) {
         double fifolevel    = ((double)fifolen/fifosize) * 100.0;
cvs diff: Diffing threadfns
