* Thread that monitors csock and dsock while main thread * can be blocked in el_gets(). */
| 276 | * can be blocked in el_gets(). |
| 277 | */ |
| 278 | static void * |
| 279 | Monitor(void *v __unused) |
| 280 | { |
| 281 | struct sigaction act; |
| 282 | const int maxfd = MAX(csock, dsock) + 1; |
| 283 | |
| 284 | act.sa_handler = Unblock; |
| 285 | sigemptyset(&act.sa_mask); |
| 286 | act.sa_flags = 0; |
| 287 | sigaction(SIGUSR1, &act, NULL); |
| 288 | |
| 289 | pthread_mutex_lock(&mutex); |
| 290 | for (;;) { |
| 291 | fd_set rfds; |
| 292 | |
| 293 | /* See if any data or control messages are arriving. */ |
| 294 | FD_ZERO(&rfds); |
| 295 | FD_SET(csock, &rfds); |
| 296 | FD_SET(dsock, &rfds); |
| 297 | unblock = 0; |
| 298 | if (select(maxfd, &rfds, NULL, NULL, NULL) <= 0) { |
| 299 | if (errno == EINTR) { |
| 300 | if (unblock == 1) |
| 301 | pthread_cond_wait(&cond, &mutex); |
| 302 | continue; |
| 303 | } |
| 304 | err(EX_OSERR, "select"); |
| 305 | } |
| 306 | ReadSockets(&rfds); |
| 307 | } |
| 308 | |
| 309 | return (NULL); |
| 310 | } |
| 311 | #endif |
| 312 | |
| 313 | static char * |
nothing calls this directly
no test coverage detected