* src/afs/AIX/osi_gcpags.c for how to look at the process list */
#define osi_procname(procname, size) strncpy(procname, "", size)
-#define osi_GetTime(x) do {curtime(x); (x)->tv_usec = (x)->tv_usec/1000;} while (0)
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+ struct timestruc_t now;
+ curtime(&now);
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_nsec / 1000;
+}
#endif /* _OSI_MACHDEP_H_ */
#define osi_procname(procname, size) strncpy(procname, curproc->p_comm, size)
#endif
-#define osi_GetTime(x) microtime(x)
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+ struct timeval now;
+ microtime(&now);
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_usec;
+}
#endif /* _OSI_MACHDEP_H_ */
#ifndef _OSI_MACHDEP_H_
#define _OSI_MACHDEP_H_
-#define osi_GetTime(x) microtime(x)
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+ struct timeval now;
+ microtime(&now);
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_usec;
+}
#endif /* _OSI_MACHDEP_H_ */
#define osi_procname(procname, size) strncpy(procname, curproc->p_comm, size)
-#define osi_GetTime(x) microtime(x)
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+ struct timeval now;
+ microtime(&now);
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_usec;
+}
#endif /* _OSI_MACHDEP_H_ */
#define osi_procname(procname, size) strncpy(procname, "", size)
-#define osi_GetTime(x) do { struct timeval osi_GetTimeVar; uniqtime(&osi_GetTimeVar); (x)->tv_sec = osi_GetTimeVar.tv_sec; (x)->tv_usec = osi_GetTimeVar.tv_usec; } while(0)
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+ struct timeval now;
+ uniqtime(&now);
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_usec;
+}
#endif /* _OSI_MACHDEP_H_ */
#define osi_procname(procname, size) strncpy(procname, proc_name(curproc()), size)
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
#ifdef _K64U64
-# define osi_GetTime(x) irix5_microtime((struct __irix5_timeval*)(x))
+ struct __irix5_timeval now;
+ irix5_microtime(&now);
#else
-# define osi_GetTime(x) microtime(x)
+ struct timeval now;
+ microtime(&now);
#endif
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_usec;
+}
#endif /* _OSI_MACHDEP_H_ */
#endif
#if defined(HAVE_LINUX_KTIME_GET_REAL_TS64)
-# define osi_GetTime(V) \
- do { \
- struct timespec64 __afs_tv; \
- ktime_get_real_ts64(&__afs_tv); \
- (V)->tv_sec = (afs_int32)__afs_tv.tv_sec; \
- (V)->tv_usec = (afs_int32)__afs_tv.tv_nsec / 1000; \
- } while(0)
-#elif defined(AFS_LINUX_64BIT_KERNEL) || !defined(HAVE_LINUX_TIME_T)
-# define osi_GetTime(V) \
- do { \
- struct timeval __afs_tv; \
- do_gettimeofday(&__afs_tv); \
- (V)->tv_sec = (afs_int32)__afs_tv.tv_sec; \
- (V)->tv_usec = (afs_int32)__afs_tv.tv_usec; \
- } while (0)
+static inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+ struct timespec64 now;
+ ktime_get_real_ts64(&now);
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_nsec / 1000;
+}
#else
-# define osi_GetTime(V) do_gettimeofday((V))
+static inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+ struct timeval now;
+ do_gettimeofday(&now);
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_usec;
+}
#endif
#undef gop_lookupname
/* time */
#define afs_hz hz
-#define osi_GetTime(x) getmicrotime(x)
#define osi_Time() time_second
/* str */
#define AFS_USE_NBSD_NAMECACHE 0
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+ struct timeval now;
+ getmicrotime(&now);
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_usec;
+}
+
#endif /* _OSI_MACHDEP_H_ */
/* time */
#define afs_hz hz
-#define osi_GetTime(x) microtime(x)
extern time_t osi_Time();
/* str */
#define osi_procname(procname, size) strncpy(procname, curproc->p_comm, size)
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+ struct timeval now;
+ microtime(&now);
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_usec;
+}
+
#endif /* _OSI_MACHDEP_H_ */
#define osi_procname(procname, size) strncpy(procname, PTOU(ttoproc(curthread))->u_comm, size)
-#define osi_GetTime(x) uniqtime32(x)
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+ struct timeval32 now;
+ uniqtime32(&now);
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_usec;
+}
#endif /* _OSI_MACHDEP_H_ */
}
int
-osi_GetTime(struct timeval *tv)
-{
- gettimeofday(tv, NULL);
- return 0;
-}
-
-int
osi_Active(struct vcache *avc)
{
AFS_STATCNT(osi_Active);
#define osi_curcred() get_user_struct()->u_cred
#define osi_procname(procname, size) strncpy(procname, "(unknown)", size)
+
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+ struct timeval now;
+ gettimeofday(&now, NULL);
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_usec;
+}
+
#endif /* _OSI_MACHDEP_H_ */
* different platforms. We require a fixed size timeval, at least for the
* xstats.
*/
-#if defined(AFS_HPUX_ENV) || defined(AFS_LINUX_64BIT_KERNEL) || (defined(AFS_LINUX26_ENV) && !defined(HAVE_LINUX_TIME_T)) || (defined(AFS_SGI61_ENV) && defined(KERNEL) && defined(_K64U64))
typedef struct {
afs_int32 tv_sec;
afs_int32 tv_usec;
} osi_timeval32_t;
-#elif defined(AFS_SUN5_ENV)
-typedef struct timeval32 osi_timeval32_t;
-#else
-typedef struct timeval osi_timeval32_t;
-#endif /* AFS_SGI61_ENV */
#ifndef UKERNEL
#define osi_getpid() getpid()
extern void uafs_Shutdown(void);
extern void osi_ReleaseVM(struct vcache *avc, int len,
afs_ucred_t *credp);
-extern int osi_GetTime(struct timeval *tv);
extern int iodone(struct usr_buf *bp);
extern int usr_ioctl(void);
extern int lookupname(char *fnamep, int segflg, int followlink,
#endif /* AFS_USE_GETTIMEOFDAY || AFS_PTHREAD_ENV */
#else /* KERNEL */
#define clock_Init()
-#if defined(AFS_SGI61_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX_64BIT_KERNEL)
-#define clock_GetTime(cv) osi_GetTime((osi_timeval32_t *)cv)
-#else
-#if (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || (defined(AFS_DARWIN100_ENV) && defined(__amd64__)) || defined(AFS_XBSD_ENV)
-#define clock_GetTime(cv) \
- BEGIN \
- struct timeval tv; \
- osi_GetTime(&tv); \
- (cv)->sec = (afs_int32)tv.tv_sec; \
- (cv)->usec = (afs_int32)tv.tv_usec; \
- END
-#else /* defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) */
-#define clock_GetTime(cv) osi_GetTime((osi_timeval32_t *)(cv))
-#endif /* defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) */
-#endif
+static_inline void
+clock_GetTime(struct clock *cv)
+{
+ osi_timeval32_t now;
+ osi_GetTime(&now);
+ cv->sec = now.tv_sec;
+ cv->usec = now.tv_usec;
+}
#define clock_Sec() osi_Time()
#define clock_NewTime() /* don't do anything; clock is fast enough in kernel */
#endif /* KERNEL */