From owner-svn-src-all@FreeBSD.ORG Fri Oct 29 22:22:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23DA11065670; Fri, 29 Oct 2010 22:22:52 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id BC6298FC13; Fri, 29 Oct 2010 22:22:41 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id D0C6345CA6; Sat, 30 Oct 2010 00:22:39 +0200 (CEST) Received: from localhost (chello089073192049.chello.pl [89.73.192.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 0B8F845683; Sat, 30 Oct 2010 00:22:33 +0200 (CEST) Date: Sat, 30 Oct 2010 00:21:59 +0200 From: Pawel Jakub Dawidek To: David Xu Message-ID: <20101029222159.GA2160@garage.freebsd.pl> References: <201010291331.o9TDVAtm027022@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="d6Gm4EdcadzBjdND" Content-Disposition: inline In-Reply-To: <201010291331.o9TDVAtm027022@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214510 - in head: include lib/libc/gen sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 22:22:52 -0000 --d6Gm4EdcadzBjdND Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 29, 2010 at 01:31:10PM +0000, David Xu wrote: > Author: davidxu > Date: Fri Oct 29 13:31:10 2010 > New Revision: 214510 > URL: http://svn.freebsd.org/changeset/base/214510 >=20 > Log: > Add sysctl kern.sched.cpusetsize to export the size of kernel cpuset, > also add sysconf() key _SC_CPUSET_SIZE to get sysctl value. > =20 > Submitted by: gcooper [...] > +#ifdef _SC_CPUSET_SIZE > + case _SC_CPUSET_SIZE: > + len =3D sizeof(lvalue); > + if (sysctlbyname("kern.sched.cpusetsize", &lvalue, &len, NULL, > + 0) =3D=3D -1) > + return (-1); > + return (lvalue); > +#endif [...] > +static size_t _kern_cpuset_size =3D sizeof(cpuset_t); [...] > +/*=20 > + * Return the size of cpuset_t at the kernel level > + * > + * XXX (gcooper): replace ULONG with SIZE once CTLTYPE_SIZE is implement= ed. > + */ > +SYSCTL_ULONG(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD, > + &_kern_cpuset_size, 0, "Kernel-level cpuset_t struct size"); > + Because it is used via sysconf(3), I don't think it should be converted to CTLTYPE_SIZE at all. I even think it would be safer to make _kern_cpuset_size a long (sysconf's lvalue is long) and (just for consistency) use SYSCTL_LONG(). Also note, that on i386 long is 32bit and on amd64 long is 64bit, so 32bit process running on 64bit system won't be able to read this sysctl. Or do we detect 32bit processes on 64bit systems and convert such types in the kernel? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --d6Gm4EdcadzBjdND Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkzLSQcACgkQForvXbEpPzT9zgCgu05p5kDCR6F2Jq/fLwkInLyP 0FoAoIHy+zaUSTmZ6k638am2GQyXJGHg =pnvc -----END PGP SIGNATURE----- --d6Gm4EdcadzBjdND--