Date: Sat, 30 Oct 2010 00:21:59 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: David Xu <davidxu@FreeBSD.org> 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 Message-ID: <20101029222159.GA2160@garage.freebsd.pl> In-Reply-To: <201010291331.o9TDVAtm027022@svn.freebsd.org> References: <201010291331.o9TDVAtm027022@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101029222159.GA2160>