mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
- FreeBSD patches to include <machine/cpufunc.h> to get rdtsc() function,
instead of using local one in hourglass.h. - Other minor amd64 compilation fixes.
This commit is contained in:
parent
dc7fd64b5a
commit
9d438fe6d8
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=183046
3 changed files with 89 additions and 0 deletions
49
sysutils/hourglass/files/patch-hourglass.h
Normal file
49
sysutils/hourglass/files/patch-hourglass.h
Normal file
|
@ -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)
|
||||||
|
{
|
20
sysutils/hourglass/files/patch-main.c
Normal file
20
sysutils/hourglass/files/patch-main.c
Normal file
|
@ -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);
|
20
sysutils/hourglass/files/patch-work.c
Normal file
20
sysutils/hourglass/files/patch-work.c
Normal file
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue