Lines Matching defs:fd
118 short fd;
136 static int fdclose(Service_t *sp, register int fd)
139 service_list[fd] = 0;
140 if(sp->fd==fd)
141 sp->fd = -1;
144 if(file_list[i]==fd)
148 (*sp->actionf)(sp, fd, 1);
185 int r=0, fd = sffileno(iop);
186 Service_t * sp = service_list[fd];
187 if(fd==sp->fd) /* connection socket */
191 fd = accept(fd, &addr, &addrlen);
192 service_list[fd] = sp;
194 file_list[npoll++] = fd;
195 if(fd>=0)
198 r = (*sp->acceptf)(sp,fd);
203 service_list[fd] = 0;
204 r = (*sp->actionf)(sp, fd, 0);
205 service_list[fd] = sp;
207 close(fd);
211 static int waitnotify(int fd, long timeout, int rw)
216 if (fd >= 0)
217 special = sh_fd2sfio(fd);
258 return(fd);
278 service_list[sp->fd] = sp;
279 file_list[npoll++] = sp->fd;
285 int fd;
287 fd = fcntl(accept_fd, F_DUPFD, 10);
288 if (fd >= 0)
298 sfsprintf(buff, sizeof(buff), "%d", fd);
301 close(fd);
307 return fd;
310 static int Action(Service_t *sp, int fd, int close)
326 sfsprintf(buff, sizeof(buff), "%d", fd);
413 register int fd;
444 if((fd = sh_open(path, O_SERVICE|O_RDWR))<=0)
449 if((sp->fd = fcntl(fd, F_DUPFD, 10))>=10)
450 close(fd);
452 sp->fd = fd;