Date: Sun, 23 Jul 2000 15:33:45 -0700 From: Alfred Perlstein <bright@wintelcom.net> To: hackers@freebsd.org Cc: wollman@freebsd.org Subject: kern.ipc.maxsockbuf vs reality? Message-ID: <20000723153345.P13979@fw.wintelcom.net>
next in thread | raw e-mail | index | archive | help
I have some code that does a sysctlbyname to pull in "kern.ipc.maxsockbuf", I then use that value to setsockopt the SNDBUF to that amount, but I get ENOBUFS back from the kernel. I think I'm failing here in uipc_socket2.c" line 432 in the function sbreserve(): if ((u_quad_t)cc > (u_quad_t)sb_max * MCLBYTES / (MSIZE + MCLBYTES)) return (0); I'm not sure why the sysctl seems to lie about it: u_long sb_max = SB_MAX; /* XXX should be static */ shouldn't it be: u_long sb_max = SB_MAX > (u_quad_t)SB_MAX * MCLBYTES / (MSIZE + MCLBYTES) ? (u_quad_t)SB_MAX * MCLBYTES / (MSIZE + MCLBYTES) : SB_MAX; ? Also, if sb_max is to remain a read/write sysctl we'll need to cap it so that kern.ipc.maxsockbuf is always true and we don't allow sysadmins to shoot thier feet by scaling it too high or low, the only problem is that I can't for the life of me figure out the magic to keep sb_max (kern.ipc.maxsockbuf) as a ulong (which it should be, instead of an int) as well as provide a filtering function. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000723153345.P13979>