8 static void listenproc(void*);
9 static void srvproc(void*);
10 static void srvend(Srv *);
11 static char *getremotesys(char*);
14 _listensrv(Srv *os, char *addr)
19 sysfatal("no forker");
20 s = emalloc9p(sizeof *s);
22 s->addr = estrdup9p(addr);
23 _forker(listenproc, s, 0);
29 char ndir[NETPATHLEN], dir[NETPATHLEN];
34 ctl = announce(os->addr, dir);
36 fprint(2, "%s: announce %s: %r", argv0, os->addr);
41 nctl = listen(dir, ndir);
43 fprint(2, "%s: listen %s: %r", argv0, os->addr);
47 data = accept(ctl, ndir);
49 fprint(2, "%s: accept %s: %r\n", argv0, ndir);
53 s = emalloc9p(sizeof *s);
55 s->addr = getremotesys(ndir);
56 s->infd = s->outfd = data;
62 _forker(srvproc, s, 0);
83 getremotesys(char *ndir)
85 char buf[128], *serv, *sys;
88 snprint(buf, sizeof buf, "%s/remote", ndir);
90 fd = open(buf, OREAD);
92 n = read(fd, buf, sizeof(buf)-1);
95 serv = strchr(buf, '!');
103 sys = estrdup9p("unknown");