mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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:
parent
7141a35f1c
commit
4fc8feafc7
2 changed files with 38 additions and 4 deletions
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
Loading…
Reference in a new issue