Lines Matching refs:listenfd
552 dnssd_sock_t listenfd = dnssd_InvalidSocket, errsd = dnssd_InvalidSocket;
579 listenfd = socket(AF_DNSSD, SOCK_STREAM, 0);
580 if (!dnssd_SocketValid(listenfd)) deliver_request_bailout("TCP socket");
585 if (bind(listenfd, (struct sockaddr*) &caddr, sizeof(caddr)) < 0) deliver_request_bailout("TCP bind");
586 if (getsockname(listenfd, (struct sockaddr*) &caddr, &len) < 0) deliver_request_bailout("TCP getsockname");
587 if (listen(listenfd, 1) < 0) deliver_request_bailout("TCP listen");
597 listenfd = socket(AF_DNSSD, SOCK_STREAM, 0);
598 if (!dnssd_SocketValid(listenfd)) deliver_request_bailout("USE_NAMED_ERROR_RETURN_SOCKET socket");
608 bindresult = bind(listenfd, (struct sockaddr *)&caddr, sizeof(caddr));
611 if (listen(listenfd, 1) < 0) deliver_request_bailout("USE_NAMED_ERROR_RETURN_SOCKET listen");
620 listenfd = sp[1]; // We'll send sp[1] to the daemon
676 if ((err = wait_for_daemon(listenfd, DNSSD_CLIENT_TIMEOUT)) != kDNSServiceErr_NoError) goto cleanup;
677 errsd = accept(listenfd, (struct sockaddr *)&daddr, &len);
705 listenfd = open(p, O_RDWR, 0);
706 //if (dnssd_SocketValid(listenfd)) syslog(LOG_WARNING, "Sending fd %d for %s", listenfd, p);
707 if (!dnssd_SocketValid(listenfd) && dnssd_errno != EBUSY)
709 if (dnssd_SocketValid(listenfd) || dnssd_errno != EBUSY) break;
724 *((dnssd_sock_t *)CMSG_DATA(cmsg)) = listenfd;
732 errsd, listenfd, sizeof(dnssd_sock_t), sizeof(void*),
741 errsd, listenfd, dnssd_errno, dnssd_strerror(dnssd_errno));
747 syslog(LOG_WARNING, "dnssd_clientstub sendmsg read sd=%d write sd=%d okay", errsd, listenfd);
754 dnssd_close(listenfd);
755 listenfd = dnssd_InvalidSocket; // Make sure we don't close it a second time in the cleanup handling below
775 if (dnssd_SocketValid(listenfd)) dnssd_close(listenfd);