Date: Thu, 26 Oct 1995 02:50:55 -0700 (PDT) From: Julian Elischer <julian@ref.tfs.com> To: vcapuano@esoc.esa.de (Vincenzo Capuano) Cc: freebsd-hackers@freebsd.org Subject: Re: _SC_PAGESIZE patch to sysconf(3) Message-ID: <199510260950.CAA27831@ref.tfs.com> In-Reply-To: <9510260906.AA17142@dpd16.dpd.esoc.esa.de> from "Vincenzo Capuano" at Oct 26, 95 10:06:28 am
next in thread | previous in thread | raw e-mail | index | archive | help
It's not a bad addition, but it's not in the POSIX definitions that I can see, though I only have the XPG4 definitions which allign this call to posix-1 despite having some posix 2 definitions in it (the posix 2 standard was still not approved when XPG4 went to print I think) if this is not POSIX standard it should be hidden behind a #ifndef _POSIX_SOURCE > > 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?199510260950.CAA27831>