From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 03:10:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AC4D106566C; Wed, 27 Oct 2010 03:10:43 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6DF178FC18; Wed, 27 Oct 2010 03:10:42 +0000 (UTC) Received: by wyb42 with SMTP id 42so208042wyb.13 for ; Tue, 26 Oct 2010 20:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=HH6PN73P7eMsBlKzcqfrrKpkoJwME17Pa6ugKOAACOc=; b=pVNH1fituXFYRorCacq6vh/yWtHUyvMLY6OyJ0cDLPY7WV/xsYPw2ausluiNrmBlCH TIHWFro7fyWUN/XYjHajPAVbRqknGhyesNovuLQRAuWzadjiCpJVm2SeRZBfJbXX9uZy Ydkz9AMzclrkuDjMSmuHZZ+CudeKduxvWYrQk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=pa66NpKY1Jyx97E27vrF0P2J2qXJElvuBJ23F8K44MbmBVYUMObUqmu9gvSl1EJEW4 OUF/hK+wT3rhnzoD9iLHhzJK4soJxcpNf9hm/JcmFipPu6CWvmnYqBFnSulY8fdjVxR0 2KIY9gxHJXa0XxkqN/3EZuefiMO8d6lMLaf5M= MIME-Version: 1.0 Received: by 10.216.231.82 with SMTP id k60mr1893751weq.64.1288149041286; Tue, 26 Oct 2010 20:10:41 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Tue, 26 Oct 2010 20:10:41 -0700 (PDT) In-Reply-To: <4CC803A8.3040602@freebsd.org> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> Date: Tue, 26 Oct 2010 20:10:41 -0700 X-Google-Sender-Auth: VrpRtpbwABd_53udK2ZH0LgXm0M Message-ID: From: Garrett Cooper To: David Xu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 03:10:43 -0000 On Wed, Oct 27, 2010 at 3:49 AM, David Xu wrote: > Garrett Cooper wrote: >> >> On Tue, Oct 26, 2010 at 7:32 PM, David Xu wrote: >>> >>> Author: davidxu >>> Date: Wed Oct 27 02:32:54 2010 >>> New Revision: 214409 >>> URL: http://svn.freebsd.org/changeset/base/214409 >>> >>> Log: >>> =A0If input parameter cpusetsize is zero, give userland size of cpuset = mask >>> =A0kernel is using. >>> >>> Modified: >>> =A0head/sys/kern/kern_cpuset.c >>> >>> Modified: head/sys/kern/kern_cpuset.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/kern/kern_cpuset.c Wed Oct 27 02:07:25 2010 =A0 =A0 =A0 = =A0(r214408) >>> +++ head/sys/kern/kern_cpuset.c Wed Oct 27 02:32:54 2010 =A0 =A0 =A0 = =A0(r214409) >>> @@ -889,6 +889,10 @@ cpuset_getaffinity(struct thread *td, st >>> =A0 =A0 =A0 int error; >>> =A0 =A0 =A0 size_t size; >>> >>> + =A0 =A0 =A0 if (uap->cpusetsize =3D=3D 0) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 td->td_retval[0] =3D sizeof(cpuset_t); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (0); >>> + =A0 =A0 =A0 } >>> =A0 =A0 =A0 if (uap->cpusetsize < sizeof(cpuset_t) || >>> =A0 =A0 =A0 =A0 =A0 uap->cpusetsize > CPU_MAXSIZE / NBBY) >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (ERANGE); >> >> =A0 =A0Isn't this requirement partly broken now? >> >> =A0 =A0 [ERANGE] =A0 =A0 =A0 =A0 =A0 The cpusetsize was either preposter= ously large or >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0smaller than the kernel s= et size. >> >> =A0 =A0Why should cpuset(2) be broken in favor of people not passing val= id >> values? > > I really hate to see such a problem that userland can not figure out > what kernel is using, I try hardly to guess, but still can not find > what it is using. yes, I think the doc may need to be fixed or > another syscall is needed. Well... Jeff's code in cpuset(1) does some trivial sizeof(mask) 's, but it just passes in cpuset_t for mask. I've seen different calling conventions at the kernel level when I tried to get my brain in sync with that for a bug I was looking at a few weeks ago (and sadly, failed to some degree). These syscalls are a bit confusing though, and apart from cpuset(1) there aren't any really good examples in the sourcebase on how to use them (at least not the last time I checked)... Thanks, -Garrett