Date: Wed, 1 Sep 2004 16:00:27 +0400 From: Gleb Smirnoff <glebius@freebsd.org> To: hackers@freebsd.org Subject: copyin() instead of sooptcopyin()? Message-ID: <20040901120027.GA49655@cell.sick.ru>
next in thread | raw e-mail | index | archive | help
Dear hackers, I have a case, when I need to pass a small argument to kernel, and receive large reply using getsockopt(). First I get the argument: char var[MAX]; ... if ((error = sooptcopyin(sopt, var, MAX, 2)) ... Then I push reply to it using sooptcopyout(). But userland receives it truncated to MAX. The problem lives in sooptcopyin() implementation, which changes sopt->sopt_valsize. Now, in my patch I solve this using bare copyin(). Another approach may be saving sopt->sopt_valsize before call to sooptcopyin(), and then restoring it. Not a nice solution however... The questions are: 1) Is it OK to use bare copyin()? Which hidden problems can arise? 2) Is that correct that soopcopy[in|out]() changes sopt's fields? -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040901120027.GA49655>