461 ses_contract_thread(void *arg)
462 {
463 int efd, ctlfd, statfd;
464 ct_evthdl_t ev;
465 ctevid_t evid;
466 uint_t event;
467 char path[PATH_MAX];
468 char buf[80];
469 ses_enum_target_t *stp;
470 ct_stathdl_t stathdl;
471 ctid_t ctid;
472 struct pollfd fds;
473 int pollret;
474 sigset_t sigset;
475
476 ses_ct_print("start contract event thread");
477 efd = open64(CTFS_ROOT "/device/pbundle", O_RDONLY);
478 fds.fd = efd;
479 fds.events = POLLIN;
480 fds.revents = 0;
481 sigaddset(&sigset, sesthread.thr_sig);
482 pthread_sigmask(SIG_UNBLOCK, &sigset, NULL);
483 for (;;) {
484 /* check if we've been asked to exit */
485 (void) pthread_mutex_lock(&sesthread.mt);
486 if (sesthread.doexit) {
487 (void) pthread_mutex_unlock(&sesthread.mt);
488 break;
489 }
490 (void) pthread_mutex_unlock(&sesthread.mt);
491
492 /* poll until an event arrives */
493 if ((pollret = poll(&fds, 1, 10000)) <= 0) {
494 if (pollret == 0)
495 ses_recheck_dir();
496 continue;
497 }
498
499 /* read the event */
500 (void) pthread_mutex_lock(&ses_sslmt);
501 ses_ct_print("read contract event");
502 if (ct_event_read(efd, &ev) != 0) {
|
461 ses_contract_thread(void *arg)
462 {
463 int efd, ctlfd, statfd;
464 ct_evthdl_t ev;
465 ctevid_t evid;
466 uint_t event;
467 char path[PATH_MAX];
468 char buf[80];
469 ses_enum_target_t *stp;
470 ct_stathdl_t stathdl;
471 ctid_t ctid;
472 struct pollfd fds;
473 int pollret;
474 sigset_t sigset;
475
476 ses_ct_print("start contract event thread");
477 efd = open64(CTFS_ROOT "/device/pbundle", O_RDONLY);
478 fds.fd = efd;
479 fds.events = POLLIN;
480 fds.revents = 0;
481 (void) sigaddset(&sigset, sesthread.thr_sig);
482 (void) pthread_sigmask(SIG_UNBLOCK, &sigset, NULL);
483 for (;;) {
484 /* check if we've been asked to exit */
485 (void) pthread_mutex_lock(&sesthread.mt);
486 if (sesthread.doexit) {
487 (void) pthread_mutex_unlock(&sesthread.mt);
488 break;
489 }
490 (void) pthread_mutex_unlock(&sesthread.mt);
491
492 /* poll until an event arrives */
493 if ((pollret = poll(&fds, 1, 10000)) <= 0) {
494 if (pollret == 0)
495 ses_recheck_dir();
496 continue;
497 }
498
499 /* read the event */
500 (void) pthread_mutex_lock(&ses_sslmt);
501 ses_ct_print("read contract event");
502 if (ct_event_read(efd, &ev) != 0) {
|