Browse Source

Plan 9 from Bell Labs 2003-03-04

David du Colombier 21 years ago
parent
commit
bd74bb0265
4 changed files with 33 additions and 9 deletions
  1. 2 3
      dist/replica/plan9.db
  2. 3 0
      dist/replica/plan9.log
  3. 14 0
      sys/man/5/remove
  4. 14 6
      sys/src/cmd/rx.c

+ 2 - 3
dist/replica/plan9.db

@@ -4788,7 +4788,7 @@ sys/man/5/error - 664 sys sys 1015024830 505
 sys/man/5/flush - 664 sys sys 1015024830 1688
 sys/man/5/open - 664 sys sys 1015024830 4739
 sys/man/5/read - 664 sys sys 1015024830 2358
-sys/man/5/remove - 664 sys sys 1015024830 624
+sys/man/5/remove - 664 sys sys 1046704639 1078
 sys/man/5/stat - 664 sys sys 1015024830 6218
 sys/man/5/version - 664 sys sys 1015024830 2657
 sys/man/5/walk - 664 sys sys 1015024830 3622
@@ -9767,7 +9767,7 @@ sys/src/cmd/rtstats/resproc.c - 664 sys sys 1037669163 2287
 sys/src/cmd/rtstats/rtstats.c - 664 sys sys 1037669162 13204
 sys/src/cmd/rtstats/time.c - 664 sys sys 1038425433 2094
 sys/src/cmd/rtstats/time.h - 664 sys sys 1038425434 164
-sys/src/cmd/rx.c - 664 sys sys 1025393134 3044
+sys/src/cmd/rx.c - 664 sys sys 1046668081 3266
 sys/src/cmd/sam - 20000000775 sys sys 944961629 0
 sys/src/cmd/sam/address.c - 664 sys sys 944961628 3985
 sys/src/cmd/sam/buff.c - 664 sys sys 1014926937 5161
@@ -9914,7 +9914,6 @@ sys/src/cmd/ssh - 20000000775 sys sys 1016927305 0
 sys/src/cmd/ssh/agent.c - 664 sys sys 1038371941 9079
 sys/src/cmd/ssh/authpasswd.c - 664 sys sys 1016466378 758
 sys/src/cmd/ssh/authrsa.c - 664 sys sys 1016466378 2649
-sys/src/cmd/ssh/authrsafile.c - 664 sys sys 1016466378 3002
 sys/src/cmd/ssh/authsrvpasswd.c - 664 sys sys 1016466379 296
 sys/src/cmd/ssh/authsrvtis.c - 664 sys sys 1016466379 726
 sys/src/cmd/ssh/authtis.c - 664 sys sys 1016466379 1013

+ 3 - 0
dist/replica/plan9.log

@@ -18167,3 +18167,6 @@
 1046657484 27 c 386/lib/libmemdraw.a - 664 sys sys 1046656926 292604
 1046657484 28 c acme/bin/386/win - 775 sys sys 1046656923 178512
 1046657484 29 c sys/man/2/access - 664 sys sys 1046657167 1102
+1046667674 0 d sys/src/cmd/ssh/authrsafile.c - 664 sys sys 1016466378 0
+1046669474 0 c sys/src/cmd/rx.c - 664 sys sys 1046668081 3266
+1046705484 0 c sys/man/5/remove - 664 sys sys 1046704639 1078

+ 14 - 0
sys/man/5/remove

@@ -29,6 +29,20 @@ It is correct to consider
 to be a
 .B clunk
 with the side effect of removing the file if permissions allow.
+.PP
+If a file has been opened as multiple fids,
+possibly on different connections,
+and one fid is used to remove the file,
+whether the other fids continue to provide access to the file
+is implementation-defined.
+The Plan 9 file servers (like
+.IR fs (4))
+remove the file immediately: attempts to use the other fids
+will yield a
+``phase error.''
+.IR U9fs (4)
+follows the semantics of the underlying Unix file system,
+so other fids typically remain usable.
 .SH ENTRY POINTS
 .B Remove
 messages are generated by

+ 14 - 6
sys/src/cmd/rx.c

@@ -6,7 +6,7 @@ int	eof;		/* send an eof if true */
 char	*note = "die: yankee dog";
 char	*ruser;
 
-void	rex(int, char*);
+void	rex(int, char*, char*);
 void	tcpexec(int, char*, char*);
 int	call(char *, char*, char*, char**);
 char	*buildargs(char*[]);
@@ -48,10 +48,15 @@ main(int argc, char *argv[])
 	if(fd >= 0)
 		tcpexec(fd, addr, args);
 
-	/* generic attempts */
+	/* generic attempts: try p9any then dial again with p9sk2 */
 	fd = call(0, host, "rexexec", &addr);
 	if(fd >= 0)
-		rex(fd, args);
+		rex(fd, args, "p9any");
+	close(fd);
+	fd = call(0, host, "rexexec", &addr);
+	if(fd >= 0)
+		rex(fd, args, "p9sk2");
+	close(fd);
 
 	error("can't dial", host);
 	exits(0);
@@ -65,15 +70,18 @@ call(char *net, char *host, char *service, char **na)
 }
 
 void
-rex(int fd, char *cmd)
+rex(int fd, char *cmd, char *proto)
 {
 	char buf[4096];
 	int kid, n;
 	AuthInfo *ai;
 
-	ai = auth_proxy(fd, auth_getkey, "proto=p9any role=client");
-	if(ai == nil)
+	ai = auth_proxy(fd, auth_getkey, "proto=%s role=client", proto);
+	if(ai == nil){
+		if(strcmp(proto, "p9any") == 0)
+			return;
 		error("auth_proxy", nil);
+	}
 	write(fd, cmd, strlen(cmd)+1);
 
 	kid = send(fd);