PERFORCE change 128258 for review
John Birrell
jb at FreeBSD.org
Sun Oct 28 16:13:15 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=128258
Change 128258 by jb at jb_freebsd1 on 2007/10/28 23:13:10
Move compatibility definitions in here rather than having them
enabled by _SOLARIS_C_SOURCE in the main FreeBSD headers.
Affected files ...
.. //depot/projects/dtrace/src/sys/compat/opensolaris/sys/time.h#2 edit
.. //depot/projects/dtrace/src/sys/compat/opensolaris/sys/types.h#2 edit
Differences ...
==== //depot/projects/dtrace/src/sys/compat/opensolaris/sys/time.h#2 (text+ko) ====
@@ -31,6 +31,13 @@
#include_next <sys/time.h>
+#define SEC 1
+#define MILLISEC 1000
+#define MICROSEC 1000000
+#define NANOSEC 1000000000
+
+typedef longlong_t hrtime_t;
+
#ifdef _KERNEL
#define lbolt ((gethrtime() * hz) / NANOSEC)
#define lbolt64 (int64_t)(lbolt)
@@ -53,6 +60,15 @@
#define gethrestime_sec() (time_second)
#define gethrestime(ts) getnanotime(ts)
+#else
+
+static __inline hrtime_t gethrtime(void) {
+ struct timespec ts;
+ clock_gettime(CLOCK_UPTIME,&ts);
+ return (((u_int64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec);
+}
+
+
#endif /* _KERNEL */
#endif /* !_OPENSOLARIS_SYS_TIME_H_ */
==== //depot/projects/dtrace/src/sys/compat/opensolaris/sys/types.h#2 (text+ko) ====
@@ -39,6 +39,18 @@
#define MAXNAMELEN 256
typedef struct timespec timestruc_t;
+typedef u_int uint_t;
+typedef u_char uchar_t;
+typedef u_short ushort_t;
+typedef u_long ulong_t;
+typedef long long longlong_t;
+typedef unsigned long long u_longlong_t;
+typedef off_t off64_t;
+typedef id_t taskid_t;
+typedef id_t projid_t;
+typedef id_t poolid_t;
+typedef id_t zoneid_t;
+typedef id_t ctid_t;
#ifdef _KERNEL
@@ -53,6 +65,12 @@
#else
+#if defined(__XOPEN_OR_POSIX)
+typedef enum { _B_FALSE, _B_TRUE } boolean_t;
+#else
+typedef enum { B_FALSE, B_TRUE } boolean_t;
+#endif /* defined(__XOPEN_OR_POSIX) */
+
typedef longlong_t offset_t;
typedef u_longlong_t u_offset_t;
typedef uint64_t upad64_t;
More information about the p4-projects
mailing list