mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
linux(4): add struct timespec64 definition and conversion routine for
future use. MFC after: 2 weeks
This commit is contained in:
parent
d7bfb412a7
commit
bfcce1a9f6
4 changed files with 44 additions and 0 deletions
|
|
@ -81,6 +81,7 @@ typedef l_int l_pid_t;
|
|||
typedef l_uint l_size_t;
|
||||
typedef l_long l_suseconds_t;
|
||||
typedef l_long l_time_t;
|
||||
typedef l_longlong l_time64_t;
|
||||
typedef l_uint l_uid_t;
|
||||
typedef l_ushort l_uid16_t;
|
||||
typedef l_int l_timer_t;
|
||||
|
|
@ -171,6 +172,12 @@ struct l_timespec {
|
|||
l_long tv_nsec;
|
||||
};
|
||||
|
||||
/* __kernel_timespec */
|
||||
struct l_timespec64 {
|
||||
l_time64_t tv_sec;
|
||||
l_longlong tv_nsec;
|
||||
};
|
||||
|
||||
struct l_newstat {
|
||||
l_ushort st_dev;
|
||||
l_ushort __pad1;
|
||||
|
|
|
|||
|
|
@ -124,6 +124,30 @@ linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp)
|
|||
return (0);
|
||||
}
|
||||
|
||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
||||
int
|
||||
native_to_linux_timespec64(struct l_timespec64 *ltp64, struct timespec *ntp)
|
||||
{
|
||||
|
||||
ltp64->tv_sec = ntp->tv_sec;
|
||||
ltp64->tv_nsec = ntp->tv_nsec;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
linux_to_native_timespec64(struct timespec *ntp, struct l_timespec64 *ltp64)
|
||||
{
|
||||
|
||||
if (ltp64->tv_sec < 0 || ltp64->tv_nsec < 0 || ltp64->tv_nsec > 999999999)
|
||||
return (EINVAL);
|
||||
ntp->tv_sec = ltp64->tv_sec;
|
||||
ntp->tv_nsec = ltp64->tv_nsec;
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
native_to_linux_itimerspec(struct l_itimerspec *ltp, struct itimerspec *ntp)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,6 +108,12 @@ int native_to_linux_timespec(struct l_timespec *,
|
|||
struct timespec *);
|
||||
int linux_to_native_timespec(struct timespec *,
|
||||
struct l_timespec *);
|
||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
||||
int native_to_linux_timespec64(struct l_timespec64 *,
|
||||
struct timespec *);
|
||||
int linux_to_native_timespec64(struct timespec *,
|
||||
struct l_timespec64 *);
|
||||
#endif
|
||||
int linux_to_native_clockid(clockid_t *, clockid_t);
|
||||
int native_to_linux_itimerspec(struct l_itimerspec *,
|
||||
struct itimerspec *);
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ typedef l_int l_pid_t;
|
|||
typedef l_uint l_size_t;
|
||||
typedef l_long l_suseconds_t;
|
||||
typedef l_long l_time_t;
|
||||
typedef l_longlong l_time64_t;
|
||||
typedef l_uint l_uid_t;
|
||||
typedef l_ushort l_uid16_t;
|
||||
typedef l_int l_timer_t;
|
||||
|
|
@ -142,6 +143,12 @@ struct l_timespec {
|
|||
l_long tv_nsec;
|
||||
};
|
||||
|
||||
/* __kernel_timespec */
|
||||
struct l_timespec64 {
|
||||
l_time64_t tv_sec;
|
||||
l_longlong tv_nsec;
|
||||
};
|
||||
|
||||
struct l_newstat {
|
||||
l_ushort st_dev;
|
||||
l_ushort __pad1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue