add network dialing

This commit is contained in:
rsc 2004-06-09 14:11:28 +00:00
parent 8baa0cbdff
commit 9a4289cfdc

View file

@ -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);
}