watcher: add some debugging statements
This commit is contained in:
@@ -250,14 +250,17 @@ static job_requeue_t watch(private_watcher_t *this)
|
|||||||
{
|
{
|
||||||
if (entry->events & WATCHER_READ)
|
if (entry->events & WATCHER_READ)
|
||||||
{
|
{
|
||||||
|
DBG3(DBG_JOB, " watching %d for reading", entry->fd);
|
||||||
FD_SET(entry->fd, &rd);
|
FD_SET(entry->fd, &rd);
|
||||||
}
|
}
|
||||||
if (entry->events & WATCHER_WRITE)
|
if (entry->events & WATCHER_WRITE)
|
||||||
{
|
{
|
||||||
|
DBG3(DBG_JOB, " watching %d for writing", entry->fd);
|
||||||
FD_SET(entry->fd, &wr);
|
FD_SET(entry->fd, &wr);
|
||||||
}
|
}
|
||||||
if (entry->events & WATCHER_EXCEPT)
|
if (entry->events & WATCHER_EXCEPT)
|
||||||
{
|
{
|
||||||
|
DBG3(DBG_JOB, " watching %d for exceptions", entry->fd);
|
||||||
FD_SET(entry->fd, &ex);
|
FD_SET(entry->fd, &ex);
|
||||||
}
|
}
|
||||||
maxfd = max(maxfd, entry->fd);
|
maxfd = max(maxfd, entry->fd);
|
||||||
@@ -272,6 +275,7 @@ static job_requeue_t watch(private_watcher_t *this)
|
|||||||
bool old;
|
bool old;
|
||||||
job_t *job = NULL;
|
job_t *job = NULL;
|
||||||
|
|
||||||
|
DBG2(DBG_JOB, "watcher going to select()");
|
||||||
thread_cleanup_push((void*)activate_all, this);
|
thread_cleanup_push((void*)activate_all, this);
|
||||||
old = thread_cancelability(TRUE);
|
old = thread_cancelability(TRUE);
|
||||||
res = select(maxfd + 1, &rd, &wr, &ex, NULL);
|
res = select(maxfd + 1, &rd, &wr, &ex, NULL);
|
||||||
@@ -281,6 +285,7 @@ static job_requeue_t watch(private_watcher_t *this)
|
|||||||
{
|
{
|
||||||
if (this->notify[0] != -1 && FD_ISSET(this->notify[0], &rd))
|
if (this->notify[0] != -1 && FD_ISSET(this->notify[0], &rd))
|
||||||
{
|
{
|
||||||
|
DBG2(DBG_JOB, "watcher got notification, rebuilding");
|
||||||
ignore_result(read(this->notify[0], buf, sizeof(buf)));
|
ignore_result(read(this->notify[0], buf, sizeof(buf)));
|
||||||
return JOB_REQUEUE_DIRECT;
|
return JOB_REQUEUE_DIRECT;
|
||||||
}
|
}
|
||||||
@@ -291,16 +296,19 @@ static job_requeue_t watch(private_watcher_t *this)
|
|||||||
{
|
{
|
||||||
if (FD_ISSET(entry->fd, &rd))
|
if (FD_ISSET(entry->fd, &rd))
|
||||||
{
|
{
|
||||||
|
DBG2(DBG_JOB, "watched FD %d ready to read", entry->fd);
|
||||||
job = notify(this, entry, WATCHER_READ);
|
job = notify(this, entry, WATCHER_READ);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (FD_ISSET(entry->fd, &wr))
|
if (FD_ISSET(entry->fd, &wr))
|
||||||
{
|
{
|
||||||
|
DBG2(DBG_JOB, "watched FD %d ready to write", entry->fd);
|
||||||
job = notify(this, entry, WATCHER_WRITE);
|
job = notify(this, entry, WATCHER_WRITE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (FD_ISSET(entry->fd, &ex))
|
if (FD_ISSET(entry->fd, &ex))
|
||||||
{
|
{
|
||||||
|
DBG2(DBG_JOB, "watched FD %d has exception", entry->fd);
|
||||||
job = notify(this, entry, WATCHER_EXCEPT);
|
job = notify(this, entry, WATCHER_EXCEPT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -323,6 +331,10 @@ static job_requeue_t watch(private_watcher_t *this)
|
|||||||
return JOB_REQUEUE_DIRECT;
|
return JOB_REQUEUE_DIRECT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DBG1(DBG_JOB, "watcher select() error: %s", strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user