Hi folks,
here's a patch against p9p for an "proxy mode" in 9pserve, like Russ
suggested. It just adds an new "-c" option which tells 9pserve to
dial to an address as it's input connection (instead of taking stdio).
This way, 9pserve can eg. be used as a proxy between a unix socket
and TCP, making p9p servers available via TCP.
cu
--
----------------------------------------------------------------------
Enrico Weigelt, metux IT service -- http://www.metux.de/
cellphone: +49 174 7066481 email: [EMAIL PROTECTED] skype: nekrad666
----------------------------------------------------------------------
Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------
Index: src/cmd/9pserve.c
===================================================================
--- src/cmd/9pserve.c (revision 707)
+++ src/cmd/9pserve.c (working copy)
@@ -136,7 +136,7 @@
void
usage(void)
{
- fprint(2, "usage: 9pserve [-lnv] [-A aname afid] [-M msize] address\n");
+ fprint(2, "usage: 9pserve [-c pipe] [-lnv] [-A aname afid] [-M msize]
address\n");
fprint(2, "\treads/writes 9P messages on stdin/stdout\n");
threadexitsall("usage");
}
@@ -157,6 +157,19 @@
ARGBEGIN{
default:
usage();
+ case 'c':
+ {
+ char* pipename = EARGF(usage());
+ printf("pipename=\"%s\"\n", pipename);
+
+ if((fd = dial(pipename, nil, nil, nil)) < 0)
+ sysfatal("dial %s: %r");
+ dup(fd, 0);
+ dup(fd, 1);
+ if(fd > 1)
+ close(fd);
+ }
+ break;
case 'A':
attached = 1;
xaname = EARGF(usage());