12 #include <sys/socket.h>
13 #include <netinet/in.h>
19 accept(int fd, void *a, int *alen)
23 struct sockaddr_in *ip;
25 char file[8+Ctlsize+1];
28 r = _sock_findrock(fd, 0);
45 /* get control file name from listener process */
46 n = read(fd, name, sizeof(name)-1);
52 cfd = open(name, O_RDWR);
58 nfd = _sock_data(cfd, net, r->domain, r->stype, r->protocol, &nr);
64 if(write(fd, "OK", 2) < 0){
70 /* get remote address */
71 ip = (struct sockaddr_in*)&nr->raddr;
72 _sock_ingetaddr(nr, ip, &n, "remote");
74 memmove(a, ip, sizeof(struct sockaddr_in));
75 *alen = sizeof(struct sockaddr_in);
86 /* read path to new connection */
87 n = read(fd, name, sizeof(name) - 1);
94 /* open new connection */
95 _sock_srvname(file, name);
96 nfd = open(file, O_RDWR);
100 /* confirm opening on new connection */
101 if(write(nfd, name, strlen(name)) > 0)
107 nr = _sock_newrock(nfd);
112 nr->domain = r->domain;
113 nr->stype = r->stype;
114 nr->protocol = r->protocol;