Update comments and simplify conditionals for compat32

Only amd64 (because of i386) needs 32-bit time_t compat now, everything else is
64-bit time_t.  Rather than checking on all 64-bit time_t archs, only check the
oddball amd64/i386.

Reviewed By: emaste, kib, andrew
Differential Revision: https://reviews.freebsd.org/D11364
This commit is contained in:
Justin Hibbits 2017-06-27 01:29:10 +00:00
parent 4323355e76
commit b436609213
3 changed files with 12 additions and 14 deletions

View File

@ -43,12 +43,12 @@
do { (dst).fld = PTROUT((src).fld); } while (0)
/*
* Being a newer port, 32-bit FreeBSD/MIPS uses 64-bit time_t.
* i386 is the only arch with a 32-bit time_t
*/
#if defined (__mips__) || defined(__powerpc__)
typedef int64_t time32_t;
#else
#ifdef __amd64__
typedef int32_t time32_t;
#else
typedef int64_t time32_t;
#endif
struct timeval32 {

View File

@ -109,13 +109,13 @@ __FBSDID("$FreeBSD$");
FEATURE(compat_freebsd_32bit, "Compatible with 32-bit FreeBSD");
#if !defined(__mips__) && !defined(__powerpc__)
#ifdef __amd64__
CTASSERT(sizeof(struct timeval32) == 8);
CTASSERT(sizeof(struct timespec32) == 8);
CTASSERT(sizeof(struct itimerval32) == 16);
#endif
CTASSERT(sizeof(struct statfs32) == 256);
#if !defined(__mips__) && !defined(__powerpc__)
#ifdef __amd64__
CTASSERT(sizeof(struct rusage32) == 72);
#endif
CTASSERT(sizeof(struct sigaltstack32) == 12);
@ -124,8 +124,6 @@ CTASSERT(sizeof(struct iovec32) == 8);
CTASSERT(sizeof(struct msghdr32) == 28);
#ifdef __amd64__
CTASSERT(sizeof(struct stat32) == 208);
#endif
#if !defined(__mips__) && !defined(__powerpc__)
CTASSERT(sizeof(struct freebsd11_stat32) == 96);
#endif
CTASSERT(sizeof(struct sigaction32) == 24);

View File

@ -1283,7 +1283,7 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
#endif
case BIOCGETIF:
case BIOCGRTIMEOUT:
#if defined(COMPAT_FREEBSD32) && !defined(__mips__) && !defined(__powerpc__)
#if defined(COMPAT_FREEBSD32) && defined(__amd64__)
case BIOCGRTIMEOUT32:
#endif
case BIOCGSTATS:
@ -1295,7 +1295,7 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
case FIONREAD:
case BIOCLOCK:
case BIOCSRTIMEOUT:
#if defined(COMPAT_FREEBSD32) && !defined(__mips__) && !defined(__powerpc__)
#if defined(COMPAT_FREEBSD32) && defined(__amd64__)
case BIOCSRTIMEOUT32:
#endif
case BIOCIMMEDIATE:
@ -1519,7 +1519,7 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
* Set read timeout.
*/
case BIOCSRTIMEOUT:
#if defined(COMPAT_FREEBSD32) && !defined(__mips__) && !defined(__powerpc__)
#if defined(COMPAT_FREEBSD32) && defined(__amd64__)
case BIOCSRTIMEOUT32:
#endif
{
@ -1550,12 +1550,12 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
* Get read timeout.
*/
case BIOCGRTIMEOUT:
#if defined(COMPAT_FREEBSD32) && !defined(__mips__) && !defined(__powerpc__)
#if defined(COMPAT_FREEBSD32) && defined(__amd64__)
case BIOCGRTIMEOUT32:
#endif
{
struct timeval *tv;
#if defined(COMPAT_FREEBSD32) && !defined(__mips__) && !defined(__powerpc__)
#if defined(COMPAT_FREEBSD32) && defined(__amd64__)
struct timeval32 *tv32;
struct timeval tv64;
@ -1567,7 +1567,7 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
tv->tv_sec = d->bd_rtout / hz;
tv->tv_usec = (d->bd_rtout % hz) * tick;
#if defined(COMPAT_FREEBSD32) && !defined(__mips__) && !defined(__powerpc__)
#if defined(COMPAT_FREEBSD32) && defined(__amd64__)
if (cmd == BIOCGRTIMEOUT32) {
tv32 = (struct timeval32 *)addr;
tv32->tv_sec = tv->tv_sec;