shithub: riscv

Download patch

ref: 0a7e9ba1f567da92a4de50232e77dda924a9b7b8
parent: c198a557d9daf28f6b69f818ad570f88c78d7693
author: cinap_lenrek <[email protected]>
date: Fri Jun 14 19:28:59 EDT 2013

rdbfs: add -s srvname (from charles forsyth's rdbfs-srvname patch)

Add a -s srvname option to rdbfs, allowing debugging sessions to be shared
or later reattached after disconnection.

--- a/sys/man/4/rdbfs
+++ b/sys/man/4/rdbfs
@@ -11,6 +11,10 @@
 .I pid
 ]
 [
+.B -s
+.I srvname
+]
+[
 .B -t
 .I text
 ]
@@ -28,6 +32,15 @@
 .I device
 (default 
 .BR /dev/eia0 ).
+If the
+.B -s
+option is given,
+.I rdbfs
+will post its channel in
+.BI /srv/ srvname
+(see
+.IR srv (3)),
+allowing the session to be shared or reattached later.
 .PP
 The 
 .B text
--- a/sys/src/cmd/rdbfs.c
+++ b/sys/src/cmd/rdbfs.c
@@ -137,12 +137,13 @@
 char*	portname = "/dev/eia0";
 char*	textfile = "/386/9pc";
 char*	procname = "1";
+char*	srvname;
 Channel* rchan;
 
 void
 usage(void)
 {
-	fprint(2, "usage: rdbfs [-p procnum] [-t textfile] [serialport]\n");
+	fprint(2, "usage: rdbfs [-p procnum] [-s srvname] [-t textfile] [serialport]\n");
 	exits("usage");
 }
 
@@ -397,6 +398,9 @@
 	case 'p':
 		procname = EARGF(usage());
 		break;
+	case 's':
+		srvname = EARGF(usage());
+		break;
 	case 't':
 		textfile = EARGF(usage());
 		break;
@@ -427,7 +431,7 @@
 	for(i=0; i<nelem(tab); i++)
 		closefile(createfile(dir, tab[i].s, "rdbfs", tab[i].mode, (void*)tab[i].id));
 	closefile(dir);
-	threadpostmountsrv(&fs, nil, "/proc", MBEFORE);
+	threadpostmountsrv(&fs, srvname, "/proc", MBEFORE);
 	exits(0);
 }