Skip to content

php-fpm: fix Solaris port events.mechanism #6913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion sapi/fpm/fpm/events/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ static int fpm_event_port_clean() /* {{{ */
*/
static int fpm_event_port_wait(struct fpm_event_queue_s *queue, unsigned long int timeout) /* {{{ */
{
int ret, i, nget;
int ret;
unsigned int i, nget;
timespec_t t;

/* convert timeout into timespec_t */
Expand All @@ -121,13 +122,25 @@ static int fpm_event_port_wait(struct fpm_event_queue_s *queue, unsigned long in

/* wait for incoming event or timeout. We want at least one event or timeout */
nget = 1;
events[0].portev_user = (void *)-1; /* so we can double check that an event was returned */

ret = port_getn(pfd, events, nevents, &nget, &t);
if (ret < 0) {

/* trigger error unless signal interrupt or timeout */
if (errno != EINTR && errno != ETIME) {
zlog(ZLOG_WARNING, "poll() returns %d", errno);
return -1;
} else if (nget > 0 && events[0].portev_user == (void *)-1) {
/* This confusing API can return an event at the same time
* that it reports EINTR or ETIME. If that occurs, just
* report the event. With EINTR, nget can be > 0 without
* any event, so check that portev_user was filled in.
*
* See discussion thread
* http://marc.info/?l=opensolaris-networking-discuss&m=125071205204540
*/
nget = 0;
}
}

Expand Down