Date: Thu, 26 Oct 1995 10:06:28 +0100 From: vcapuano@esoc.esa.de (Vincenzo Capuano) To: freebsd-hackers@freebsd.org Subject: _SC_PAGESIZE patch to sysconf(3) Message-ID: <9510260906.AA17142@dpd16.dpd.esoc.esa.de>
next in thread | raw e-mail | index | archive | help
I was porting a program I developed on Solaris to FreeBSD when I got into a missing call: sysconf(_SC_PAGESIZE). I know I could use getpagesize(3), but I then had to ifdef my code. So, if you like it here is a patch to sysconf that will recognise _SC_PAGESIZE. Here are the diffs: ------------------------------------------------------------------------------- *** /usr/src/lib/libc/gen/sysconf.c.orig Wed Oct 25 20:57:03 1995 --- /usr/src/lib/libc/gen/sysconf.c Wed Oct 25 21:15:33 1995 *************** *** 179,184 **** --- 179,188 ---- return (-1); return (value); break; + case _SC_PAGESIZE: + mib[0] = CTL_HW; + mib[1] = HW_PAGESIZE; + break; default: errno = EINVAL; return (-1); *** /usr/src/lib/libc/gen/sysconf.3.orig Thu Oct 26 00:13:26 1995 --- /usr/src/lib/libc/gen/sysconf.3 Thu Oct 26 00:20:38 1995 *************** *** 142,147 **** --- 142,150 ---- .It Li _SC_2_UPE Return 1 if the system supports the User Portability Utilities Option, otherwise \-1. + .It Li _SC_PAGESIZE + Number of bytes in a system memory page. Page granularity is the granularity + of many of the memory management calls. See also getpagesize(3). .El .Sh RETURN VALUES If the call to *** /usr/include/sys/unistd.h.orig Wed Oct 25 21:00:56 1995 --- /usr/include/sys/unistd.h Thu Oct 26 00:27:55 1995 *************** *** 115,120 **** --- 115,121 ---- #define _SC_2_UPE 25 #define _SC_STREAM_MAX 26 #define _SC_TZNAME_MAX 27 + #define _SC_PAGESIZE 28 /* configurable system strings */ #define _CS_PATH 1 ------------------------------------------------------------------------------- They apply to -current. Vincenzo ======================================================================== Vincenzo Capuano, Vitrociset /\_/\ Tel: +49 (0)6151 90-3159 European Space Agency - ESOC ( o.o ) Fax: +49 (0)6151 90-3414 Robert Bosch Strasse 5 > - < Email: vcapuano@vmprofs.esoc.esa.de D-64293 Darmstadt, Germany
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9510260906.AA17142>