#ifdef WITH_DNSSD_SUPPORT
#include <dns_sd.h>
+#include "system/select.h"
/* Holds service instances found during DNS browse */
struct mdns_smbsrv_result
int mdnsfd;
int fdsetsz;
int ret;
- fd_set *fdset = NULL;
struct timeval tv;
DNSServiceErrorType err;
mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref);
for (;;) {
- if (fdset != NULL) {
- TALLOC_FREE(fdset);
- }
-
- fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask);
- fdset = TALLOC_ZERO(ctx, fdsetsz);
- FD_SET(mdnsfd, fdset);
-
- tv.tv_sec = 1;
- tv.tv_usec = 0;
+ int revents;
- /* Wait until response received from mDNS daemon */
- ret = sys_select(mdnsfd + 1, fdset, NULL, NULL, &tv);
+ ret = poll_one_fd(mdnsfd, POLLIN|POLLHUP, 1000, &revents);
if (ret <= 0 && errno != EINTR) {
break;
}
- if (FD_ISSET(mdnsfd, fdset)) {
+ if (revents & (POLLIN|POLLHUP|POLLERR)) {
/* Invoke callback function */
DNSServiceProcessResult(mdns_conn_sdref);
break;
int mdnsfd;
int fdsetsz;
int ret;
- fd_set *fdset = NULL;
struct mdns_browse_state bstate;
struct mdns_smbsrv_result *resptr;
struct timeval tv;
mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref);
for (;;) {
- if (fdset != NULL) {
- TALLOC_FREE(fdset);
- }
-
- fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask);
- fdset = TALLOC_ZERO(ctx, fdsetsz);
- FD_SET(mdnsfd, fdset);
-
- tv.tv_sec = 1;
- tv.tv_usec = 0;
+ int revents;
- /* Wait until response received from mDNS daemon */
- ret = sys_select(mdnsfd + 1, fdset, NULL, NULL, &tv);
+ ret = poll_one_fd(mdnsfd, POLLIN|POLLHUP, &revents, 1000);
if (ret <= 0 && errno != EINTR) {
break;
}
- if (FD_ISSET(mdnsfd, fdset)) {
+ if (revents & (POLLIN|POLLHUP|POLLERR)) {
/* Invoke callback function */
if (DNSServiceProcessResult(mdns_conn_sdref)) {
break;