Use sysctl_handle_long() instead of duplicating it's logic for

kern.ipc.maxsockbuf so that this sysctl works for 32-bit binaries running
on amd64 via compat/freebsd32.

MFC after:	3 days
This commit is contained in:
John Baldwin 2006-09-06 21:59:36 +00:00
parent da271ed509
commit 86a93d51e3

View File

@ -253,18 +253,14 @@ static int
sysctl_handle_sb_max(SYSCTL_HANDLER_ARGS)
{
int error = 0;
u_long old_sb_max = sb_max;
u_long tmp_sb_max = sb_max;
error = SYSCTL_OUT(req, arg1, sizeof(u_long));
error = sysctl_handle_long(oidp, &tmp_sb_max, arg2, req);
if (error || !req->newptr)
return (error);
error = SYSCTL_IN(req, arg1, sizeof(u_long));
if (error)
return (error);
if (sb_max < MSIZE + MCLBYTES) {
sb_max = old_sb_max;
if (tmp_sb_max < MSIZE + MCLBYTES)
return (EINVAL);
}
sb_max = tmp_sb_max;
sb_max_adj = (u_quad_t)sb_max * MCLBYTES / (MSIZE + MCLBYTES);
return (0);
}