Lines Matching refs:fd
76 int fd = source->sources.file.handle;
88 n = read(fd, buf, ndesired);
104 (void)close(fd);
116 int fd = source->sources.usocket.handle;
134 if ((n = sendto(fd, buf, 1, 0, NULL, 0)) < 0) {
149 if ((n = sendto(fd, buf, 2, 0, NULL, 0)) < 0) {
166 if (recvfrom(fd, buf, 1, 0, NULL, NULL) != 1) {
205 n = recv(fd, buf, sz_to_recv, 0);
236 close(fd);
392 int maxfd, fd;
404 fd = source->sources.file.handle;
405 if (fd >= 0) {
406 maxfd = ISC_MAX(maxfd, fd);
407 FD_SET(fd, &reads);
411 fd = source->sources.usocket.handle;
412 if (fd >= 0) {
419 maxfd = ISC_MAX(maxfd, fd);
420 FD_SET(fd, &writes);
424 maxfd = ISC_MAX(maxfd, fd);
425 FD_SET(fd, &reads);
454 * Make a fd non-blocking
457 make_nonblock(int fd) {
464 ret = ioctl(fd, FIONBIO, (char *)&on);
466 flags = fcntl(fd, F_GETFL, 0);
468 ret = fcntl(fd, F_SETFL, flags);
475 "ioctl(%d, FIONBIO, &on): %s", fd,
477 "fcntl(%d, F_SETFL, %d): %s", fd, flags,
489 int fd;
521 fd = socket(PF_UNIX, SOCK_STREAM, 0);
523 fd = open(fname, O_RDONLY | PORT_NONBLOCK, 0);
525 if (fd < 0) {
530 ret = make_nonblock(fd);
548 if (connect(fd, (struct sockaddr *) &sname,
574 source->sources.usocket.handle = fd;
584 source->sources.file.handle = fd;
598 (void)close(fd);