Rename the definition of lbolt to LBOLT to avoid a clash with a global

variable in FreeBSD. Until now lbolt in sys/proc.h has been #ifdef'ed
out based on _SOLARIS_C_SOURCE, but that is going away now.
This commit is contained in:
jb 2007-11-28 21:44:17 +00:00
parent 817ac88e3e
commit 68f7a0964d
2 changed files with 38 additions and 4 deletions

View File

@ -31,9 +31,17 @@
#include_next <sys/time.h>
#define SEC 1
#define MILLISEC 1000
#define MICROSEC 1000000
#define NANOSEC 1000000000
typedef longlong_t hrtime_t;
#define LBOLT ((gethrtime() * hz) / NANOSEC)
#ifdef _KERNEL
#define lbolt ((gethrtime() * hz) / NANOSEC)
#define lbolt64 (int64_t)(lbolt)
#define lbolt64 (int64_t)(LBOLT)
static __inline hrtime_t
gethrtime(void) {
@ -53,6 +61,15 @@ gethrtime(void) {
#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_ */

View File

@ -31,9 +31,17 @@
#include_next <sys/time.h>
#define SEC 1
#define MILLISEC 1000
#define MICROSEC 1000000
#define NANOSEC 1000000000
typedef longlong_t hrtime_t;
#define LBOLT ((gethrtime() * hz) / NANOSEC)
#ifdef _KERNEL
#define lbolt ((gethrtime() * hz) / NANOSEC)
#define lbolt64 (int64_t)(lbolt)
#define lbolt64 (int64_t)(LBOLT)
static __inline hrtime_t
gethrtime(void) {
@ -53,6 +61,15 @@ gethrtime(void) {
#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_ */