aboutsummaryrefslogtreecommitdiff
path: root/sysutils/hourglass
diff options
context:
space:
mode:
authorCraig Rodrigues <rodrigc@FreeBSD.org>2007-01-23 05:34:13 +0000
committerCraig Rodrigues <rodrigc@FreeBSD.org>2007-01-23 05:34:13 +0000
commit9d438fe6d8966f645386f8b39c0545c8e676107c (patch)
treea178d97fe3afda44f510f14b145c5b81020a3ca2 /sysutils/hourglass
parentdc7fd64b5aefc509d9bfe64cac33ca0a76c3795b (diff)
downloadports-9d438fe6d8966f645386f8b39c0545c8e676107c.tar.gz
ports-9d438fe6d8966f645386f8b39c0545c8e676107c.zip
- FreeBSD patches to include <machine/cpufunc.h> to get rdtsc() function,
instead of using local one in hourglass.h. - Other minor amd64 compilation fixes.
Notes
Notes: svn path=/head/; revision=183046
Diffstat (limited to 'sysutils/hourglass')
-rw-r--r--sysutils/hourglass/files/patch-hourglass.h49
-rw-r--r--sysutils/hourglass/files/patch-main.c20
-rw-r--r--sysutils/hourglass/files/patch-work.c20
3 files changed, 89 insertions, 0 deletions
diff --git a/sysutils/hourglass/files/patch-hourglass.h b/sysutils/hourglass/files/patch-hourglass.h
new file mode 100644
index 000000000000..8bbbc3c7f444
--- /dev/null
+++ b/sysutils/hourglass/files/patch-hourglass.h
@@ -0,0 +1,49 @@
+--- src/hourglass.h.orig Wed Oct 8 20:26:08 2003
++++ src/hourglass.h Tue Jan 23 05:28:40 2007
+@@ -38,6 +38,11 @@
+ #include <pthread.h>
+ #include <assert.h>
+
++#ifdef __FreeBSD__
++#include <machine/cpufunc.h>
++#include <machine/atomic.h>
++#endif
++
+ #include "config.h"
+
+ #define DBGPrint(lev,str) do { \
+@@ -197,6 +202,8 @@
+ cycle_time start, end;
+ };
+
++#ifndef __FreeBSD__
++
+ #ifdef CPU_586
+ /*
+ * a bit of documentation since the rdrsc function seems to often be
+@@ -228,7 +235,7 @@
+
+ static inline int my_InterlockedIncrement (long *dest)
+ {
+- return my_InterlockedExchangeAdd (dest, 1) + 1;
++ return my_InterlockedExchangeAdd (dest, 1L) + 1;
+ }
+
+ #endif /* defined CPU_586 */
+@@ -275,6 +282,16 @@
+ }
+
+ #endif /* defined CPU_PPC */
++
++#else
++
++static inline long my_InterlockedIncrement (long *dest)
++{
++ atomic_add_long(dest, 1L);
++ return *dest;
++}
++
++#endif /* !__FreeBSD__ */
+
+ static inline sec_time cycle_to_sec (cycle_time c)
+ {
diff --git a/sysutils/hourglass/files/patch-main.c b/sysutils/hourglass/files/patch-main.c
new file mode 100644
index 000000000000..871ab43dc525
--- /dev/null
+++ b/sysutils/hourglass/files/patch-main.c
@@ -0,0 +1,20 @@
+--- src/main.c.orig Tue Jan 23 04:45:05 2007
++++ src/main.c Tue Jan 23 04:46:29 2007
+@@ -168,7 +168,7 @@
+ retval = pthread_create (&thrd_data[i].thrd,
+ NULL,
+ thrd_func,
+- (void *)i);
++ (void *)(intptr_t)i);
+ if (retval != 0) {
+ printf ("Hrm: error creating thread %d\n", i);
+ exit (-1);
+@@ -178,7 +178,7 @@
+ retval = pthread_create (&thrd_data[i].monitor_thrd,
+ NULL,
+ monitor_thrd_func,
+- (void *)i);
++ (void *)(intptr_t)i);
+ if (retval != 0) {
+ printf ("Hrm: error creating monitor thread %d\n", i);
+ exit (-1);
diff --git a/sysutils/hourglass/files/patch-work.c b/sysutils/hourglass/files/patch-work.c
new file mode 100644
index 000000000000..3eebe290b37c
--- /dev/null
+++ b/sysutils/hourglass/files/patch-work.c
@@ -0,0 +1,20 @@
+--- src/work.c.orig Tue Jan 23 04:28:43 2007
++++ src/work.c Tue Jan 23 05:09:28 2007
+@@ -176,7 +176,7 @@
+
+ void *monitor_thrd_func (void *arg)
+ {
+- int id = (int)arg;
++ int id = (int)(intptr_t)arg;
+
+ assert (thrd_data[id].s_time != -1);
+
+@@ -202,7 +202,7 @@
+
+ void *thrd_func (void *arg)
+ {
+- int id = (int)arg;
++ int id = (int)(intptr_t )arg;
+
+ set_priority (thrd_data[id].pri);
+