Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2006/0211/6

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


Add ping -f.
 [rsc] --rw-rw-r-- M 771144 glenda sys 3489 Feb 11 09:12 sys/man/8/ping
	/n/sourcesdump/2006/0211/plan9/sys/man/8/ping:4,10 - 
	/n/sourcesdump/2006/0212/plan9/sys/man/8/ping:4,10
	  .SH SYNOPSIS
	  .B ping
	  [
	- .B -alq
	+ .B -aflq
	  ] [
	  .B -i
	  .I interval
	/n/sourcesdump/2006/0211/plan9/sys/man/8/ping:73,78 - 
	/n/sourcesdump/2006/0212/plan9/sys/man/8/ping:73,81
	  .TP
	  .B a
	  adds the IP source and destination addresses to each report.
	+ .TP
	+ .B f
	+ send messages as fast as possible (flood).
	  .TP
	  .B i
	  sets the time between messages
 [rsc] --rw-rw-r-- M 771144 glenda sys 5708 Feb 11 09:12 sys/src/cmd/ip/ping.c
	/n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:67,72 - 
	/n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:67,73
	  vlong sum;
	  ushort firstseq;
	  int addresses;
	+ int flood;
	  
	  void usage(void);
	  void lost(Req*, Icmp*);
	/n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:93,98 - 
	/n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:94,100
	  	Req **l, *r;
	  
	  	lock(&listlock);
	+ 	last = nil;
	  	for(l = &first; *l; ){
	  		r = *l;
	  
	/n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:110,116 - 
	/n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:112,118
	  			if(r->replied == 0)
	  				lost(r, ip);
	  			free(r);
	- 		} else {
	+ 		}else{
	  			last = r;
	  			l = &(r->next);
	  		}
	/n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:147,152 - 
	/n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:149,156
	  			hnputs(ip->seq, seq);
	  			r->seq = seq;
	  			r->next = nil;
	+ 			r->replied = 0;
	+ 			r->time = nsec();	/* avoid early free in reply! */
	  			lock(&listlock);
	  			if(first == nil)
	  				first = r;
	/n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:154,160 - 
	/n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:158,163
	  				last->next = r;
	  			last = r;
	  			unlock(&listlock);
	- 			r->replied = 0;
	  			r->time = nsec();
	  			if(write(fd, ip, msglen) < msglen){
	  				fprint(2, "%s: write failed: %r\n", argv0);
	/n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:261,272 - 
	/n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:264,278
	  	case 'r':
	  		rint = 1;
	  		break;
	+ 	case 'f':
	+ 		flood = 1;
	+ 		break;
	  	} ARGEND;
	  	if(msglen < 32)
	  		msglen = 64;
	  	if(msglen >= 65*1024)
	  		msglen = 65*1024-1;
	- 	if(interval <= 0)
	+ 	if(interval <= 0 && !flood)
	  		interval = SLEEPMS;
	  
	  	if(argc < 1)


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.