Subject: getpagesize(2) is redundant (#399)
Index:	lib/libc/gen/getpagesize.c,lib/libc/sys/Makefile,others 2.11BSD

Description:
	getpagesize(2) duplicates the functionality of sysctl(2).  

Repeat-By:
	Observation.

Fix:
	In previous updates numerous other system calls (gethostid for
	example) have been deprecated and placed into '4.3 compatibility'
	status.  The getpagesize(2) system call was overlooked and now
	joins the 'compatibility club' and is scheduled for removal
	some time in the future.

	While several files in the kernel are updated the changes are
	strictly to the comments.  Thus NO recompilation of the kernel
	is needed at this time.

	The C library must be rebuilt to make sure the old getpagesize
	routine (syscall stub) is removed and the new C sysctl based routine
	is added.
	
	These are the files modified or added ('*') indicates a new file
	being added to the system:

/usr/include/syscall.h
/usr/src/sys/sys/init_sysent.c
/usr/src/sys/sys/syscalls.c
/usr/src/sys/sys/kern_mman.c
/usr/src/bin/adb/opset.c
/usr/src/lib/libc/gen/Makefile
/usr/src/lib/libc/pdp/sys/Makefile
/usr/src/usr.sbin/sa/Makefile
/VERSION
* /usr/src/lib/libc/gen/getpagesize.c

	To install this update cut where indicated and save to a file
	(/tmp/399).  Then:

		cd /tmp
		sh 399
		sh 399.shar
		patch -p0 < 399.patch
		./399.sh
	
	As always this and previous updates to 2.11BSD are available via
	anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the
	directory /pub/2.11BSD.

------------------------------cut here----------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	399.sh
#	399.patch
#	399.shar
# This archive created: Thu Jan 15 20:22:14 1998
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f '399.sh'
then
	echo shar: "will not over-write existing file '399.sh'"
else
sed 's/^Z//' << \SHAR_EOF > '399.sh'
Z#!/bin/sh -x
Z
Zcd /usr/src/lib/libc
Zmake clean
Zmake
Zmake install
Zcd /usr/src/bin/adb
Zmake clean
Zmake
Zmake install
Zmake clean
Zcd /usr/src/bin
Zmake pagesize
Zinstall -s -m 755 pagesize /bin
Zcd /usr/src/usr.sbin/sa
Zmake clean
Zmake
Zmake install
Zmake clean
SHAR_EOF
chmod 755 '399.sh'
fi
if test -f '399.patch'
then
	echo shar: "will not over-write existing file '399.patch'"
else
sed 's/^Z//' << \SHAR_EOF > '399.patch'
Z*** /usr/include/syscall.h.old	Sun Nov 30 21:25:32 1997
Z--- /usr/include/syscall.h	Wed Dec 31 22:56:18 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)syscall.h	5.4.8 (2.11BSD GTE) 1997/11/30
Z   */
Z  
Z  /*
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)syscall.h	5.4.8 (2.11BSD GTE) 1997/12/31
Z   */
Z  
Z  /*
Z***************
Z*** 74,80 ****
Z  #define	SYS_chroot	61
Z  #define	SYS_fstat	62
Z  				/* 63 is unused */
Z! #define	SYS_getpagesize 64
Z  				/* 65 is unused 4.3: mremap */
Z  #define	SYS_vfork	66
Z  				/* 67 is old: vread */
Z--- 74,80 ----
Z  #define	SYS_chroot	61
Z  #define	SYS_fstat	62
Z  				/* 63 is unused */
Z! 				/* 64 - old getpagesize */
Z  				/* 65 is unused 4.3: mremap */
Z  #define	SYS_vfork	66
Z  				/* 67 is old: vread */
Z*** /usr/src/sys/sys/init_sysent.c.old	Sun Nov 30 20:27:18 1997
Z--- /usr/src/sys/sys/init_sysent.c	Wed Dec 31 22:57:38 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)init_sysent.c	1.12 (2.11BSD GTE) 1997/11/28
Z   */
Z  
Z  /*
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)init_sysent.c	1.13 (2.11BSD GTE) 1997/12/31
Z   */
Z  
Z  /*
Z***************
Z*** 29,35 ****
Z  
Z  /* 1.2 memory management */
Z  int	sbrk();
Z! int	getpagesize();
Z  int	lock(),phys(),fetchi(),nostk(),fperr();		/* 2BSD calls */
Z  
Z  /* 1.3 signals */
Z--- 29,35 ----
Z  
Z  /* 1.2 memory management */
Z  int	sbrk();
Z! int	getpagesize();					/* COMPAT-43 */
Z  int	lock(),phys(),fetchi(),nostk(),fperr();		/* 2BSD calls */
Z  
Z  /* 1.3 signals */
Z***************
Z*** 175,181 ****
Z  	1, chroot,			/*  61 = chroot */
Z  	2, fstat,			/*  62 = fstat */
Z  	0, nosys,			/*  63 = reserved */
Z! 	0, getpagesize,			/*  64 = getpagesize */
Z  	0, nosys,			/*  65 = unused */
Z  	0, vfork,			/*  66 = vfork */
Z  	0, nosys,			/*  67 = unused */
Z--- 175,181 ----
Z  	1, chroot,			/*  61 = chroot */
Z  	2, fstat,			/*  62 = fstat */
Z  	0, nosys,			/*  63 = reserved */
Z! 	0, getpagesize,			/*  64 = getpagesize COMPAT-43 */
Z  	0, nosys,			/*  65 = unused */
Z  	0, vfork,			/*  66 = vfork */
Z  	0, nosys,			/*  67 = unused */
Z*** /usr/src/sys/sys/syscalls.c.old	Fri Nov 28 16:13:42 1997
Z--- /usr/src/sys/sys/syscalls.c	Wed Dec 31 23:01:19 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)syscalls.c	1.9 (2.11BSD GTE) 1997/11/28
Z   */
Z  
Z  /*
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)syscalls.c	1.10 (2.11BSD GTE) 1997/12/31
Z   */
Z  
Z  /*
Z***************
Z*** 75,81 ****
Z  	"chroot",		/*  61 = chroot */
Z  	"fstat",		/*  62 = fstat */
Z  	"#63",			/*  63 = unused */
Z! 	"getpagesize",		/*  64 = getpagesize */
Z  	"#65",			/*  65 = unused */
Z  	"vfork",		/*  66 = vfork */
Z  	"#67",			/*  67 = unused */
Z--- 75,81 ----
Z  	"chroot",		/*  61 = chroot */
Z  	"fstat",		/*  62 = fstat */
Z  	"#63",			/*  63 = unused */
Z! 	"old getpagesize",	/*  64 = getpagesize COMPAT */
Z  	"#65",			/*  65 = unused */
Z  	"vfork",		/*  66 = vfork */
Z  	"#67",			/*  67 = unused */
Z*** /usr/src/sys/sys/kern_mman.c.old	Sat Jun 20 10:07:10 1987
Z--- /usr/src/sys/sys/kern_mman.c	Wed Dec 31 23:02:03 1997
Z***************
Z*** 3,9 ****
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_mman.c	1.1 (2.10BSD Berkeley) 12/1/86
Z   */
Z  
Z  #include "param.h"
Z--- 3,9 ----
Z   * All rights reserved.  The Berkeley software License Agreement
Z   * specifies the terms and conditions for redistribution.
Z   *
Z!  *	@(#)kern_mman.c	1.2 (2.11BSD) 1997/12/31
Z   */
Z  
Z  #include "param.h"
Z***************
Z*** 15,20 ****
Z--- 15,23 ----
Z  #include "text.h"
Z  #include "systm.h"
Z  
Z+ /*
Z+  * 4.3 compatibility 
Z+ */
Z  getpagesize()
Z  {
Z  
Z*** /usr/src/bin/adb/opset.c.old	Sun Nov 30 21:59:49 1997
Z--- /usr/src/bin/adb/opset.c	Sat Jan  3 20:03:30 1998
Z***************
Z*** 1,5 ****
Z  #if	!defined(lint) && defined(DOSCCS)
Z! static	char	sccsid[] = "@(#)opset.c 2.5 (2.11BSD GTE) 1997/11/30";
Z  #endif
Z  
Z  #include "defs.h"
Z--- 1,5 ----
Z  #if	!defined(lint) && defined(DOSCCS)
Z! static	char	sccsid[] = "@(#)opset.c 2.6 (2.11BSD GTE) 1998/1/3";
Z  #endif
Z  
Z  #include "defs.h"
Z***************
Z*** 196,202 ****
Z  	"chroot",
Z  	"fstat",
Z  	NULL,			/* 63 - unused */
Z! 	"getpagesize",
Z  	NULL,			/* 65 - mremap */
Z  	"vfork",
Z  	NULL,			/* 67 - unused */
Z--- 196,202 ----
Z  	"chroot",
Z  	"fstat",
Z  	NULL,			/* 63 - unused */
Z! 	"old getpagesize",	/* 64 - old getpagesize COMPAT-43 */
Z  	NULL,			/* 65 - mremap */
Z  	"vfork",
Z  	NULL,			/* 67 - unused */
Z*** /usr/src/lib/libc/gen/Makefile.old	Sun Nov 30 20:23:15 1997
Z--- /usr/src/lib/libc/gen/Makefile	Wed Dec 31 22:53:48 1997
Z***************
Z*** 3,9 ****
Z  # All rights reserved.  The Berkeley software License Agreement
Z  # specifies the terms and conditions for redistribution.
Z  #
Z! #	@(#)Makefile	5.7.10 (2.11BSD) 1997/11/30
Z  #
Z  # Several routines have been rewritten in assembly language for the VAX and
Z  # the PDP. If you are not running on a VAX or PDP, you should use the
Z--- 3,9 ----
Z  # All rights reserved.  The Berkeley software License Agreement
Z  # specifies the terms and conditions for redistribution.
Z  #
Z! #	@(#)Makefile	5.7.11 (2.11BSD) 1997/12/31
Z  #
Z  # Several routines have been rewritten in assembly language for the VAX and
Z  # the PDP. If you are not running on a VAX or PDP, you should use the
Z***************
Z*** 17,23 ****
Z  	ctime.c ctype_.c daemon.c devname.c disklabel.c err.c \
Z  	execvp.c fakcu.c \
Z  	fstab.c gcvt.c getenv.c getgrent.c getgrgid.c getgrnam.c getlogin.c \
Z! 	getgrouplist.c gethostname.c \
Z  	getpass.c getpwent.c getloadavg.c getmntinfo.c \
Z  	getttyent.c getttynam.c getusershell.c getwd.c \
Z  	initgroups.c isatty.c malloc.c mktemp.c ndbm.c nlist.c \
Z--- 17,23 ----
Z  	ctime.c ctype_.c daemon.c devname.c disklabel.c err.c \
Z  	execvp.c fakcu.c \
Z  	fstab.c gcvt.c getenv.c getgrent.c getgrgid.c getgrnam.c getlogin.c \
Z! 	getgrouplist.c gethostname.c getpagesize.c \
Z  	getpass.c getpwent.c getloadavg.c getmntinfo.c \
Z  	getttyent.c getttynam.c getusershell.c getwd.c \
Z  	initgroups.c isatty.c malloc.c mktemp.c ndbm.c nlist.c \
Z***************
Z*** 34,40 ****
Z  	ctime.o ctype_.o daemon.o devname.o disklabel.o err.o \
Z  	execvp.o fakcu.o \
Z  	fstab.o gcvt.o getenv.o getgrent.o getgrgid.o getgrnam.o getlogin.o \
Z! 	getgrouplist.o gethostname.o \
Z  	getpass.o getpwent.o getloadavg.o getmntinfo.o \
Z  	getttyent.o getttynam.o getusershell.o getwd.o \
Z  	initgroups.o isatty.o malloc.o mktemp.o ndbm.o nlist.o \
Z--- 34,40 ----
Z  	ctime.o ctype_.o daemon.o devname.o disklabel.o err.o \
Z  	execvp.o fakcu.o \
Z  	fstab.o gcvt.o getenv.o getgrent.o getgrgid.o getgrnam.o getlogin.o \
Z! 	getgrouplist.o gethostname.o getpagesize.o \
Z  	getpass.o getpwent.o getloadavg.o getmntinfo.o \
Z  	getttyent.o getttynam.o getusershell.o getwd.o \
Z  	initgroups.o isatty.o malloc.o mktemp.o ndbm.o nlist.o \
Z*** /usr/src/lib/libc/pdp/sys/Makefile.old	Sun Nov 30 20:20:59 1997
Z--- /usr/src/lib/libc/pdp/sys/Makefile	Wed Dec 31 22:54:30 1997
Z***************
Z*** 1,6 ****
Z  # Placed in the public domain - 1995/05/06
Z  #
Z! #	@(#)Makefile	1.5 (2.11BSD) 1997/11/30
Z  
Z  CPP= /lib/cpp
Z  LD= /bin/ld
Z--- 1,6 ----
Z  # Placed in the public domain - 1995/05/06
Z  #
Z! #	@(#)Makefile	1.6 (2.11BSD) 1997/12/31
Z  
Z  CPP= /lib/cpp
Z  LD= /bin/ld
Z***************
Z*** 47,53 ****
Z  
Z  # these are generated with a second argument to SYSCALL of 'noerror'
Z  
Z! NOERROR= getgid.o getegid.o getpagesize.o getpgrp.o getpid.o \
Z  	getppid.o getuid.o geteuid.o profil.o sigpending.o sync.o \
Z  	umask.o vhangup.o
Z  
Z--- 47,53 ----
Z  
Z  # these are generated with a second argument to SYSCALL of 'noerror'
Z  
Z! NOERROR= getgid.o getegid.o getpgrp.o getpid.o \
Z  	getppid.o getuid.o geteuid.o profil.o sigpending.o sync.o \
Z  	umask.o vhangup.o
Z  
Z*** /usr/src/usr.sbin/sa/Makefile.old	Sat Nov 16 16:44:26 1996
Z--- /usr/src/usr.sbin/sa/Makefile	Sat Jan  3 22:01:50 1998
Z***************
Z*** 1,7 ****
Z  #
Z  # Public Domain.  1996/11/16 - Steven Schultz
Z  #
Z! #	@(#)Makefile	1.0 (2.11BSD) 1996/11/16
Z  #
Z  CFLAGS=	 -O
Z  SEPFLAG= -i
Z--- 1,7 ----
Z  #
Z  # Public Domain.  1996/11/16 - Steven Schultz
Z  #
Z! #	@(#)Makefile	1.1 (2.11BSD) 1998/1/3
Z  #
Z  CFLAGS=	 -O
Z  SEPFLAG= -i
Z***************
Z*** 24,30 ****
Z  depend: ${SRCS}
Z  	mkdep ${CFLAGS} ${SRCS}
Z  
Z! install: sa
Z  	install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat8
Z  	-rm -f ${DESTDIR}/usr/man/cat8/accton.0
Z  	ln ${DESTDIR}/usr/man/cat8/sa.0 ${DESTDIR}/usr/man/cat8/accton.0
Z--- 24,30 ----
Z  depend: ${SRCS}
Z  	mkdep ${CFLAGS} ${SRCS}
Z  
Z! install: all
Z  	install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat8
Z  	-rm -f ${DESTDIR}/usr/man/cat8/accton.0
Z  	ln ${DESTDIR}/usr/man/cat8/sa.0 ${DESTDIR}/usr/man/cat8/accton.0
Z*** /VERSION.old	Sat Dec 27 23:25:26 1997
Z--- /VERSION	Sat Jan  3 22:25:30 1998
Z***************
Z*** 1,5 ****
Z! Current Patch Level: 398
Z! Date: December 28, 1997
Z  
Z  2.11 BSD
Z  ============
Z--- 1,5 ----
Z! Current Patch Level: 399
Z! Date: January 3, 1998
Z  
Z  2.11 BSD
Z  ============
SHAR_EOF
chmod 644 '399.patch'
fi
if test -f '399.shar'
then
	echo shar: "will not over-write existing file '399.shar'"
else
sed 's/^Z//' << \SHAR_EOF > '399.shar'
Z#! /bin/sh
Z# This is a shell archive, meaning:
Z# 1. Remove everything above the #! /bin/sh line.
Z# 2. Save the resulting text in a file.
Z# 3. Execute the file with /bin/sh (not csh) to create:
Z#	/usr/src/lib/libc/gen/getpagesize.c
Z# This archive created: Thu Jan 15 20:13:13 1998
Zexport PATH; PATH=/bin:/usr/bin:$PATH
Zif test -f '/usr/src/lib/libc/gen/getpagesize.c'
Zthen
Z	echo shar: "will not over-write existing file '/usr/src/lib/libc/gen/getpagesize.c'"
Zelse
Zsed 's/^Y//' << \SHAR_EOF > '/usr/src/lib/libc/gen/getpagesize.c'
ZY/*
ZY * Copyright (c) 1989, 1993
ZY *	The Regents of the University of California.  All rights reserved.
ZY *
ZY * Redistribution and use in source and binary forms, with or without
ZY * modification, are permitted provided that the following conditions
ZY * are met:
ZY * 1. Redistributions of source code must retain the above copyright
ZY *    notice, this list of conditions and the following disclaimer.
ZY * 2. Redistributions in binary form must reproduce the above copyright
ZY *    notice, this list of conditions and the following disclaimer in the
ZY *    documentation and/or other materials provided with the distribution.
ZY * 3. All advertising materials mentioning features or use of this software
ZY *    must display the following acknowledgement:
ZY *	This product includes software developed by the University of
ZY *	California, Berkeley and its contributors.
ZY * 4. Neither the name of the University nor the names of its contributors
ZY *    may be used to endorse or promote products derived from this software
ZY *    without specific prior written permission.
ZY *
ZY * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ZY * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
ZY * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ZY * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
ZY * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
ZY * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
ZY * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
ZY * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
ZY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
ZY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
ZY * SUCH DAMAGE.
ZY */
ZY
ZY#if defined(LIBC_SCCS) && !defined(lint)
ZYstatic char sccsid[] = "@(#)getpagesize.c	8.1 (Berkeley) 6/4/93";
ZY#endif /* LIBC_SCCS and not lint */
ZY
ZY#include <sys/param.h>
ZY#include <sys/sysctl.h>
ZY
ZYint
ZYgetpagesize()
ZY{
ZY	size_t size;
ZY	int mib[2], value;
ZY
ZY	mib[0] = CTL_HW;
ZY	mib[1] = HW_PAGESIZE;
ZY	size = sizeof(value);
ZY	if (sysctl(mib, 2, &value, &size, NULL, 0) == -1)
ZY		return (-1);
ZY	return (value);
ZY}
ZSHAR_EOF
Zchmod 644 '/usr/src/lib/libc/gen/getpagesize.c'
Zfi
Zexit 0
Z#	End of shell archive
SHAR_EOF
chmod 644 '399.shar'
fi
exit 0
#	End of shell archive
