Hi,
Attached is a fix for the poll implementation on Solaris using port. The
issue is that when calling port_dissociate with a file descriptor has
not been associated, port_dissociate will return -1 and set errno to ENOENT.
The apr_pollcb_poll should also re-associate the fd with port.
Per the man page for port_dissociate:
The port_dissociate() function will fail if:
EACCES The process is not the owner of the association.
ENOENT The specified object is not associated with the
port.
Cheers,
Henry
Index: poll/unix/port.c
===================================================================
--- poll/unix/port.c (revision 591399)
+++ poll/unix/port.c (working copy)
@@ -192,6 +192,7 @@
pfd_elem_t *ep;
apr_status_t rv = APR_SUCCESS;
int res;
+ int err;
pollset_lock_rings();
@@ -205,6 +206,7 @@
res = port_dissociate(pollset->port_fd, PORT_SOURCE_FD, fd);
if (res < 0) {
+ err = errno;
rv = APR_NOTFOUND;
}
@@ -233,6 +235,9 @@
APR_RING_REMOVE(ep, link);
APR_RING_INSERT_TAIL(&(pollset->dead_ring),
ep, pfd_elem_t, link);
+ if (ENOENT == err) {
+ rv = APR_SUCCESS;
+ }
break;
}
}
@@ -464,6 +469,7 @@
if (rv) {
return rv;
}
+ rv = apr_pollcb_add(pollcb, pollfd);
}
}