Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2005/1106/18

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


64-bit fixes.
 [rsc] --rw-rw-r-- M 451989 glenda sys 23778 Nov  6 11:07 sys/src/cmd/ar.c
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:22,28 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:22,28
	  	char	*name;
	  	int	type;
	  	int	len;
	- 	long	offset;
	+ 	vlong	offset;
	  	struct	Arsymref *next;
	  } Arsymref;
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:40,46 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:40,46
	  	int	paged;		/* set when some data paged to disk */
	  	char	*fname;		/* paging file name */
	  	int	fd;		/* paging file descriptor */
	- 	long	size;
	+ 	vlong	size;
	  	Armember *head;		/* head of member chain */
	  	Armember *tail;		/* tail of member chain */
	  	Arsymref *sym;		/* head of defined symbol chain */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:118,132 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:118,132
	  int	page(Arfile*);
	  void	pmode(long);
	  void	rl(int);
	- void	scanobj(Biobuf*, Arfile*, int);
	+ void	scanobj(Biobuf*, Arfile*, long);
	  void	select(int*, long);
	  void	setcom(void(*)(char*, int, char**));
	- void	skip(Biobuf*, long);
	+ void	skip(Biobuf*, vlong);
	  int	symcomp(void*, void*);
	  void	trim(char*, char*, int);
	  void	usage(void);
	  void	wrerr(void);
	- void	wrsym(Biobuf*, int, Arsymref*);
	+ void	wrsym(Biobuf*, long, Arsymref*);
	  
	  void	rcmd(char*, int, char**);		/* command processing */
	  void	dcmd(char*, int, char**);
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:316,322 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:316,321
	  	Armember *bp;
	  	int fd, i;
	  
	- 
	  	if (!count)
	  		return;
	  	fd = openar(arname, ORDWR, 0);
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:517,526 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:516,525
	   *	extract the symbol references from an object file
	   */
	  void
	- scanobj(Biobuf *b, Arfile *ap, int size)
	+ scanobj(Biobuf *b, Arfile *ap, long size)
	  {
	  	int obj;
	- 	long offset;
	+ 	vlong offset;
	  	Dir *d;
	  	static int lastobj = -1;
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:634,639 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:633,639
	  	}
	  	return fd;
	  }
	+ 
	  /*
	   *	create an archive and set its header
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:651,656 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:651,657
	  		wrerr();
	  	return fd;
	  }
	+ 
	  /*
	   *		error handling
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:681,686 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:682,688
	  	fprint(2, "usage: ar [%s][%s] archive files ...\n", opt, man);
	  	exits("error");
	  }
	+ 
	  /*
	   *	read the header for the next archive member
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:704,713 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:706,716
	  		;
	  	cp[1] = '\0';
	  	file = name;
	- 	bp->date = atol(bp->hdr.date);
	- 	bp->size = atol(bp->hdr.size);
	+ 	bp->date = strtol(bp->hdr.date, 0, 0);
	+ 	bp->size = strtol(bp->hdr.size, 0, 0);
	  	return bp;
	  }
	+ 
	  /*
	   *	Copy the file referenced by fd to the temp file
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:742,747 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:745,751
	  	}
	  	free(d);
	  }
	+ 
	  /*
	   *	Copy the archive member at the current offset into the temp file.
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:748,754 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:752,758
	  void
	  arcopy(Biobuf *b, Arfile *ap, Armember *bp)
	  {
	- 	int n;
	+ 	long n;
	  
	  	n = bp->size;
	  	if (n & 01)
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:759,774 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:763,780
	  		ap->size += n+SAR_HDR;
	  	}
	  }
	+ 
	  /*
	   *	Skip an archive member
	   */
	  void
	- skip(Biobuf *bp, long len)
	+ skip(Biobuf *bp, vlong len)
	  {
	  	if (len & 01)
	  		len++;
	  	Bseek(bp, len, 1);
	  }
	+ 
	  /*
	   *	Stream the three temp files to an archive
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:850,860 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:856,867
	  		Bputc(&b, 0);
	  	Bterm(&b);
	  }
	+ 
	  /*
	   *	Write the defined symbols to the symdef file
	   */
	  void
	- wrsym(Biobuf *bp, int offset, Arsymref *as)
	+ wrsym(Biobuf *bp, long offset, Arsymref *as)
	  {
	  	int off;
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:870,875 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:877,883
	  		as = as->next;
	  	}
	  }
	+ 
	  /*
	   *	Check if the archive member matches an entry on the command line.
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:891,896 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:899,905
	  	}
	  	return 0;
	  }
	+ 
	  /*
	   *	compare the current member to the name of the pivot member
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:920,925 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:929,935
	  	}
	  	return 0;
	  }
	+ 
	  /*
	   *	output a message, if 'v' option was specified
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:930,935 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:940,946
	  	if(vflag)
	  		Bprint(&bout, "%c - %s\n", c, file);
	  }
	+ 
	  /*
	   *	isolate file name by stripping leading directories and trailing slashes
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:951,956 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:962,968
	  		*p = 0;			/* strip trailing slash */
	  	}
	  }
	+ 
	  /*
	   *	utilities for printing long form of 't' command
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:973,979 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:985,991
	  	char *cp;
	  
	  	pmode(strtoul(bp->hdr.mode, 0, 8));
	- 	Bprint(&bout, "%3ld/%1ld", atol(bp->hdr.uid), atol(bp->hdr.gid));
	+ 	Bprint(&bout, "%3ld/%1ld", strtol(bp->hdr.uid, 0, 0), strtol(bp->hdr.gid, 0, 0));
	  	Bprint(&bout, "%7ld", bp->size);
	  	cp = ctime(bp->date);
	  	Bprint(&bout, " %-12.12s %-4.4s ", cp+4, cp+24);
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:1010,1015 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:1022,1028
	  		ap++;
	  	Bputc(&bout, *ap);
	  }
	+ 
	  /*
	   *	Temp file I/O subsystem.  We attempt to cache all three temp files in
	   *	core.  When we run out of memory we spill to disk.
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:1049,1054 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:1062,1068
	  		rderr();
	  	}
	  }
	+ 
	  /*
	   * insert a member buffer into the member chain
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:1062,1067 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:1076,1082
	  		ap->tail->next = bp;
	  	ap->tail = bp;
	  }
	+ 
	  /*
	   *	stream the members in a temp file to the file referenced by 'fd'.
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:1092,1097 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:1107,1113
	  			wrerr();
	  	}
	  }
	+ 
	  /*
	   *	write a member to 'fd'.
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:1109,1114 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:1125,1131
	  		return 0;
	  	return 1;
	  }
	+ 
	  /*
	   *	Spill a member to a disk copy of a temp file
	   */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:1136,1141 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:1153,1159
	  	free(bp);
	  	return 1;
	  }
	+ 
	  /*
	   *	try to reclaim space by paging.  we try to spill the start, middle,
	   *	and end files, in that order.  there is no particular reason for the
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/ar.c:1166,1171 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/ar.c:1184,1190
	  	}
	  	free(ap);
	  }
	+ 
	  /*
	   *	allocate space for a control block or member buffer.  if the malloc
	   *	fails we try to reclaim space by spilling previously allocated


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].