Date: Thu, 23 Jan 2003 10:33:38 +0100 (CET)
From: Hartmut Brandt <brandt@fokus.fraunhofer.de>
To: FreeBSD-gnats-submit@FreeBSD.org
Subject: sparc64/47389: kern.ipc.{maxsockbuf,sockbuf_waste_factor} broken on sparc
Message-ID: <200301230933.h0N9Xc2S000684@catssrv.fokus.gmd.de>
next in thread | raw e-mail | index | archive | help
>Number: 47389
>Category: sparc64
>Synopsis: kern.ipc.{maxsockbuf,sockbuf_waste_factor} broken on sparc
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-sparc
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Jan 23 01:40:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Hartmut Brandt
>Release: FreeBSD 5.0-CURRENT sparc64
>Organization:
FhI Fokus
>Environment:
System: FreeBSD catssrv.fokus.gmd.de 5.0-CURRENT FreeBSD 5.0-CURRENT #8: Wed Jan 22 18:21:10 CET 2003 hbb@catssrv.fokus.gmd.de:/opt/obj/usr/src/sys/CATSSRV sparc64
>Description:
kern.ipc.maxsockbuf and kern.ipc.sockbuf_waste_factor are returned as 0
by sysctl on sparc and cannot be changed.
>How-To-Repeat:
Execute:
sysctl kern.ipc
and see both variables to print as zero.
>Fix:
Apply the attached patch. The problem is, that the variable are declared as
u_long, while the SYSCTL macros and the handler for sb_max uses them as ints.
This will work on architectures where sizeof(u_long) == sizeof(int) or that
are little endian. It will break on sparc.
Index: sys/kern/uipc_socket2.c
===================================================================
RCS file: /home/cvs/freebsd/src/sys/kern/uipc_socket2.c,v
retrieving revision 1.107
diff -c -r1.107 uipc_socket2.c
*** sys/kern/uipc_socket2.c 11 Jan 2003 07:51:52 -0000 1.107
--- sys/kern/uipc_socket2.c 23 Jan 2003 09:28:28 -0000
***************
*** 383,392 ****
int error = 0;
u_long old_sb_max = sb_max;
! error = SYSCTL_OUT(req, arg1, sizeof(int));
if (error || !req->newptr)
return (error);
! error = SYSCTL_IN(req, arg1, sizeof(int));
if (error)
return (error);
if (sb_max < MSIZE + MCLBYTES) {
--- 383,392 ----
int error = 0;
u_long old_sb_max = sb_max;
! error = SYSCTL_OUT(req, arg1, sizeof(u_long));
if (error || !req->newptr)
return (error);
! error = SYSCTL_IN(req, arg1, sizeof(u_long));
if (error)
return (error);
if (sb_max < MSIZE + MCLBYTES) {
***************
*** 989,999 ****
/* This takes the place of kern.maxsockbuf, which moved to kern.ipc. */
static int dummy;
SYSCTL_INT(_kern, KERN_DUMMY, dummy, CTLFLAG_RW, &dummy, 0, "");
! SYSCTL_OID(_kern_ipc, KIPC_MAXSOCKBUF, maxsockbuf, CTLTYPE_INT|CTLFLAG_RW,
! &sb_max, 0, sysctl_handle_sb_max, "I", "Maximum socket buffer size");
SYSCTL_INT(_kern_ipc, OID_AUTO, maxsockets, CTLFLAG_RD,
&maxsockets, 0, "Maximum number of sockets avaliable");
! SYSCTL_INT(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW,
&sb_efficiency, 0, "");
/*
--- 989,999 ----
/* This takes the place of kern.maxsockbuf, which moved to kern.ipc. */
static int dummy;
SYSCTL_INT(_kern, KERN_DUMMY, dummy, CTLFLAG_RW, &dummy, 0, "");
! SYSCTL_OID(_kern_ipc, KIPC_MAXSOCKBUF, maxsockbuf, CTLTYPE_ULONG|CTLFLAG_RW,
! &sb_max, 0, sysctl_handle_sb_max, "LU", "Maximum socket buffer size");
SYSCTL_INT(_kern_ipc, OID_AUTO, maxsockets, CTLFLAG_RD,
&maxsockets, 0, "Maximum number of sockets avaliable");
! SYSCTL_ULONG(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW,
&sb_efficiency, 0, "");
/*
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-sparc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301230933.h0N9Xc2S000684>
