From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hannes Reinecke Date: Thu, 15 Jul 2004 08:51:11 +0000 Subject: getpagesize / libsysfs broken with 0.148 Message-Id: <40F6457F.8050200@suse.de> MIME-Version: 1 Content-Type: multipart/mixed; boundary="------------080104090507010600040807" List-Id: To: linux-hotplug@vger.kernel.org This is a multi-part message in MIME format. --------------080104090507010600040807 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Hi all, the implementation of getpagesize() is broken in klibc. klibc uses sysinfo.mem_unit, which linux interpretes as the memory unit=20 all other memory values returned are to be multiplied with. So it's perfectly ok for the linux sysinfo() to return a mem_unit of=20 '1', which is does if the memory available for this machine fits into=20 the counter. For the unbelievers, have a look in kernel/timer.c:sys_sysinfo(). As a quick hack I've added a check for mem_unit=3D=3D1 and reset the=20 page_size to 4096 on those cases. Naturally, this is not the right fix. The right fix would be to get the=20 values from the kernel headers and/or some magic juju for those machines=20 with variable pagesize. It probably would not have been noticed, but as libsysfs insists on=20 doing all reads from sysfs attributes with a length of pagesize, the=20 failures were ... interesting. So in short, udev does _not_ work with klibc until that (or an=20 equivalent) patch is applied. Cheers, Hannes --=20 Dr. Hannes Reinecke hare@suse.de SuSE Linux AG S390 & zSeries Maxfeldstra=DFe 5 +49 911 74053 688 90409 N=FCrnberg http://www.suse.de --------------080104090507010600040807 Content-Type: text/x-patch; name="klibc-0.148-getpagesize.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="klibc-0.148-getpagesize.patch" --- klibc-0.148/klibc/getpagesize.c.orig 2004-07-07 11:56:31.000000000 +0200 +++ klibc-0.148/klibc/getpagesize.c 2004-07-15 10:32:32.749143222 +0200 @@ -20,5 +20,6 @@ if ( rv == -1 ) return -1; - return (page_size = si.mem_unit); + /* sysinfo returns 1 for mem_unit in some cases, so default to 4096. */ + return (page_size = (si.mem_unit == 1 ? 4096 : si.mem_unit)); } --------------080104090507010600040807-- ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel