mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-22 11:17:19 +00:00
struct xswdev on amd64 requires compat32 shims after ino64.
i386 is the only architecture where uint64_t does not specify 8-bytes alignment, which makes struct xswdev layout not compatible between 64bit and i386. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
9492d971eb
commit
f6d281e8aa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343966
@ -2478,10 +2478,23 @@ struct xswdev11 {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(__amd64__) && defined(COMPAT_FREEBSD32)
|
||||
struct xswdev32 {
|
||||
u_int xsw_version;
|
||||
u_int xsw_dev1, xsw_dev2;
|
||||
int xsw_flags;
|
||||
int xsw_nblks;
|
||||
int xsw_used;
|
||||
};
|
||||
#endif
|
||||
|
||||
static int
|
||||
sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct xswdev xs;
|
||||
#if defined(__amd64__) && defined(COMPAT_FREEBSD32)
|
||||
struct xswdev32 xs32;
|
||||
#endif
|
||||
#if defined(COMPAT_FREEBSD11)
|
||||
struct xswdev11 xs11;
|
||||
#endif
|
||||
@ -2492,6 +2505,18 @@ sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS)
|
||||
error = swap_dev_info(*(int *)arg1, &xs, NULL, 0);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
#if defined(__amd64__) && defined(COMPAT_FREEBSD32)
|
||||
if (req->oldlen == sizeof(xs32)) {
|
||||
xs32.xsw_version = XSWDEV_VERSION;
|
||||
xs32.xsw_dev1 = xs.xsw_dev;
|
||||
xs32.xsw_dev2 = xs.xsw_dev >> 32;
|
||||
xs32.xsw_flags = xs.xsw_flags;
|
||||
xs32.xsw_nblks = xs.xsw_nblks;
|
||||
xs32.xsw_used = xs.xsw_used;
|
||||
error = SYSCTL_OUT(req, &xs32, sizeof(xs32));
|
||||
return (error);
|
||||
}
|
||||
#endif
|
||||
#if defined(COMPAT_FREEBSD11)
|
||||
if (req->oldlen == sizeof(xs11)) {
|
||||
xs11.xsw_version = XSWDEV_VERSION_11;
|
||||
@ -2500,9 +2525,10 @@ sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS)
|
||||
xs11.xsw_nblks = xs.xsw_nblks;
|
||||
xs11.xsw_used = xs.xsw_used;
|
||||
error = SYSCTL_OUT(req, &xs11, sizeof(xs11));
|
||||
} else
|
||||
return (error);
|
||||
}
|
||||
#endif
|
||||
error = SYSCTL_OUT(req, &xs, sizeof(xs));
|
||||
error = SYSCTL_OUT(req, &xs, sizeof(xs));
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user