[comp.bugs.4bsd] pstat getw

chris@mimsy.UUCP (08/30/87)

Index:	etc/pstat.c 4.3BSD Fix

Description:
	pstat has its own getw, whose type differs from that of
	the one in the stdio library.

Repeat-By:
	Install a new stdio.h with function type definitions.

Fix:
	Change getw to getword, or something else suitable.

RCS file: RCS/pstat.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -c2 -r1.2 -r1.3
*** /tmp/,RCSt1006287	Sat Aug 29 23:43:09 1987
--- /tmp/,RCSt2006287	Sat Aug 29 23:43:11 1987
***************
*** 125,129 ****
  struct	pte *Usrptma;
  struct	pte *usrpt;
! u_long	getw();
  off_t	mkphys();
  
--- 125,129 ----
  struct	pte *Usrptma;
  struct	pte *usrpt;
! u_long	getword();
  off_t	mkphys();
  
***************
*** 246,252 ****
  
  	nin = 0;
! 	ninode = getw(nl[SNINODE].n_value);
  	xinode = (struct inode *)calloc(ninode, sizeof (struct inode));
! 	ainode = (struct inode *)getw(nl[SINODE].n_value);
  	if (ninode < 0 || ninode > 10000) {
  		fprintf(stderr, "number of inodes is preposterous (%d)\n",
--- 246,252 ----
  
  	nin = 0;
! 	ninode = getword(nl[SNINODE].n_value);
  	xinode = (struct inode *)calloc(ninode, sizeof (struct inode));
! 	ainode = (struct inode *)getword(nl[SINODE].n_value);
  	if (ninode < 0 || ninode > 10000) {
  		fprintf(stderr, "number of inodes is preposterous (%d)\n",
***************
*** 301,305 ****
  
  u_long
! getw(loc)
  	off_t loc;
  {
--- 301,305 ----
  
  u_long
! getword(loc)
  	off_t loc;
  {
***************
*** 329,335 ****
  
  	ntx = ntxca = 0;
! 	ntext = getw(nl[SNTEXT].n_value);
  	xtext = (struct text *)calloc(ntext, sizeof (struct text));
! 	atext = (struct text *)getw(nl[STEXT].n_value);
  	if (ntext < 0 || ntext > 10000) {
  		fprintf(stderr, "number of texts is preposterous (%d)\n",
--- 329,335 ----
  
  	ntx = ntxca = 0;
! 	ntext = getword(nl[SNTEXT].n_value);
  	xtext = (struct text *)calloc(ntext, sizeof (struct text));
! 	atext = (struct text *)getword(nl[STEXT].n_value);
  	if (ntext < 0 || ntext > 10000) {
  		fprintf(stderr, "number of texts is preposterous (%d)\n",
***************
*** 389,395 ****
  	struct pte apte;
  
! 	nproc = getw(nl[SNPROC].n_value);
  	xproc = (struct proc *)calloc(nproc, sizeof (struct proc));
! 	aproc = (struct proc *)getw(nl[SPROC].n_value);
  	if (nproc < 0 || nproc > 10000) {
  		fprintf(stderr, "number of procs is preposterous (%d)\n",
--- 389,395 ----
  	struct pte apte;
  
! 	nproc = getword(nl[SNPROC].n_value);
  	xproc = (struct proc *)calloc(nproc, sizeof (struct proc));
! 	aproc = (struct proc *)getword(nl[SPROC].n_value);
  	if (nproc < 0 || nproc > 10000) {
  		fprintf(stderr, "number of procs is preposterous (%d)\n",
***************
*** 711,717 ****
  
  	nf = 0;
! 	nfile = getw(nl[SNFILE].n_value);
  	xfile = (struct file *)calloc(nfile, sizeof (struct file));
! 	afile = (struct file *)getw(nl[SFIL].n_value);
  	if (nfile < 0 || nfile > 10000) {
  		fprintf(stderr, "number of files is preposterous (%d)\n",
--- 711,717 ----
  
  	nf = 0;
! 	nfile = getword(nl[SNFILE].n_value);
  	xfile = (struct file *)calloc(nfile, sizeof (struct file));
! 	afile = (struct file *)getword(nl[SFIL].n_value);
  	if (nfile < 0 || nfile > 10000) {
  		fprintf(stderr, "number of files is preposterous (%d)\n",
***************
*** 777,782 ****
  	int i, j;
  
! 	nproc = getw(nl[SNPROC].n_value);
! 	ntext = getw(nl[SNTEXT].n_value);
  	if (nproc < 0 || nproc > 10000 || ntext < 0 || ntext > 10000) {
  		fprintf(stderr, "number of procs/texts is preposterous (%d, %d)\n",
--- 777,782 ----
  	int i, j;
  
! 	nproc = getword(nl[SNPROC].n_value);
! 	ntext = getword(nl[SNTEXT].n_value);
  	if (nproc < 0 || nproc > 10000 || ntext < 0 || ntext > 10000) {
  		fprintf(stderr, "number of procs/texts is preposterous (%d, %d)\n",
***************
*** 794,798 ****
  		exit(1);
  	}
! 	nswapmap = getw(nl[SNSWAPMAP].n_value);
  	swapmap = (struct map *)calloc(nswapmap, sizeof (struct map));
  	if (swapmap == NULL) {
--- 794,798 ----
  		exit(1);
  	}
! 	nswapmap = getword(nl[SNSWAPMAP].n_value);
  	swapmap = (struct map *)calloc(nswapmap, sizeof (struct map));
  	if (swapmap == NULL) {
***************
*** 800,804 ****
  		exit(1);
  	}
! 	nswdev = getw(nl[SNSWDEV].n_value);
  	swdevt = (struct swdevt *)calloc(nswdev, sizeof (struct swdevt));
  	if (swdevt == NULL) {
--- 800,804 ----
  		exit(1);
  	}
! 	nswdev = getword(nl[SNSWDEV].n_value);
  	swdevt = (struct swdevt *)calloc(nswdev, sizeof (struct swdevt));
  	if (swdevt == NULL) {
***************
*** 808,821 ****
  	lseek(fc, mkphys((off_t)nl[SSWDEVT].n_value), L_SET);
  	read(fc, swdevt, nswdev * sizeof (struct swdevt));
! 	lseek(fc, mkphys((off_t)getw(nl[SPROC].n_value)), 0);
  	read(fc, proc, nproc * sizeof (struct proc));
! 	lseek(fc, mkphys((off_t)getw(nl[STEXT].n_value)), 0);
  	read(fc, xtext, ntext * sizeof (struct text));
! 	lseek(fc, mkphys((off_t)getw(nl[SWAPMAP].n_value)), 0);
  	read(fc, swapmap, nswapmap * sizeof (struct map));
  	swapmap->m_name = "swap";
  	swapmap->m_limit = (struct mapent *)&swapmap[nswapmap];
! 	dmmin = getw(nl[SDMMIN].n_value);
! 	dmmax = getw(nl[SDMMAX].n_value);
  	nswap = 0;
  	for (sw = swdevt; sw < &swdevt[nswdev]; sw++)
--- 808,821 ----
  	lseek(fc, mkphys((off_t)nl[SSWDEVT].n_value), L_SET);
  	read(fc, swdevt, nswdev * sizeof (struct swdevt));
! 	lseek(fc, mkphys((off_t)getword(nl[SPROC].n_value)), 0);
  	read(fc, proc, nproc * sizeof (struct proc));
! 	lseek(fc, mkphys((off_t)getword(nl[STEXT].n_value)), 0);
  	read(fc, xtext, ntext * sizeof (struct text));
! 	lseek(fc, mkphys((off_t)getword(nl[SWAPMAP].n_value)), 0);
  	read(fc, swapmap, nswapmap * sizeof (struct map));
  	swapmap->m_name = "swap";
  	swapmap->m_limit = (struct mapent *)&swapmap[nswapmap];
! 	dmmin = getword(nl[SDMMIN].n_value);
! 	dmmax = getword(nl[SDMMAX].n_value);
  	nswap = 0;
  	for (sw = swdevt; sw < &swdevt[nswdev]; sw++)
***************
*** 1100,1104 ****
  	addr &= PG_PFNUM;
  	addr *=  NBPW;
! 	addr = getw(nl[SYSMAP].n_value + addr);
  	addr = ((addr & PG_PFNUM) << PGSHIFT) | o;
  	return(addr);
--- 1100,1104 ----
  	addr &= PG_PFNUM;
  	addr *=  NBPW;
! 	addr = getword(nl[SYSMAP].n_value + addr);
  	addr = ((addr & PG_PFNUM) << PGSHIFT) | o;
  	return(addr);
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
Domain:	chris@mimsy.umd.edu	Path:	seismo!mimsy!chris