From 9a4289cfdc3a296fddf27592d83523d270018849 Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 9 Jun 2004 14:11:28 +0000 Subject: add network dialing --- src/libthread/fdwait.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/libthread/fdwait.c b/src/libthread/fdwait.c index b544f16d..a715706a 100644 --- a/src/libthread/fdwait.c +++ b/src/libthread/fdwait.c @@ -343,3 +343,32 @@ threadwrite(int fd, const void *a, long n) return tot; } +int +threadannounce(char *addr, char *dir) +{ + return p9announce(addr, dir); +} + +int +threadlisten(char *dir, char *newdir) +{ + int fd, ret; + extern int _p9netfd(char*); + + fd = _p9netfd(dir); + if(fd < 0){ + werrstr("bad 'directory' in listen: %s", dir); + return -1; + } + threadfdnoblock(fd); + while((ret = p9listen(dir, newdir)) < 0 && errno==EAGAIN) + _threadfdwait(fd, 'r', getcallerpc(&dir)); + return ret; +} + +int +threadaccept(int cfd, char *dir) +{ + return p9accept(cfd, dir); +} + -- cgit v1.2.3