diff options
author | rsc <devnull@localhost> | 2004-06-09 14:11:28 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-06-09 14:11:28 +0000 |
commit | 9a4289cfdc3a296fddf27592d83523d270018849 (patch) | |
tree | abe1d291ea9b6180c611e7756e3d5a03a27a1ce0 | |
parent | 8baa0cbdff53a5a98f27565c9334ea56ee4a4b76 (diff) | |
download | plan9port-9a4289cfdc3a296fddf27592d83523d270018849.tar.gz plan9port-9a4289cfdc3a296fddf27592d83523d270018849.tar.bz2 plan9port-9a4289cfdc3a296fddf27592d83523d270018849.zip |
add network dialing
-rw-r--r-- | src/libthread/fdwait.c | 29 |
1 files changed, 29 insertions, 0 deletions
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); +} + |