Export intrcnt correctly when running under 32-bit compatibility.

Reviewed by:	gonzo, nwhitehorn
This commit is contained in:
jmallett 2012-03-09 22:30:54 +00:00
parent c84e05a07c
commit d25fa497f7

View File

@ -1881,6 +1881,24 @@ SYSCTL_PROC(_hw, OID_AUTO, intrnames, CTLTYPE_OPAQUE | CTLFLAG_RD,
static int
sysctl_intrcnt(SYSCTL_HANDLER_ARGS)
{
#ifdef SCTL_MASK32
uint32_t *intrcnt32;
unsigned i;
int error;
if (req->flags & SCTL_MASK32) {
if (!req->oldptr)
return (sysctl_handle_opaque(oidp, NULL, sintrcnt / 2, req));
intrcnt32 = malloc(sintrcnt / 2, M_TEMP, M_NOWAIT);
if (intrcnt32 == NULL)
return (ENOMEM);
for (i = 0; i < sintrcnt / sizeof (u_long); i++)
intrcnt32[i] = intrcnt[i];
error = sysctl_handle_opaque(oidp, intrcnt32, sintrcnt / 2, req);
free(intrcnt32, M_TEMP);
return (error);
}
#endif
return (sysctl_handle_opaque(oidp, intrcnt, sintrcnt, req));
}