MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsdRemoveSelect

Function cupsdRemoveSelect

scheduler/select.c:695–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

693 */
694
695void
696cupsdRemoveSelect(int fd) /* I - File descriptor */
697{
698 _cupsd_fd_t *fdptr; /* File descriptor record */
699#ifdef HAVE_EPOLL
700 struct epoll_event event; /* Event data */
701#elif defined(HAVE_KQUEUE)
702 struct kevent event; /* Event data */
703 struct timespec timeout; /* Timeout value */
704#elif defined(HAVE_POLL)
705 /* No variables for poll() */
706#endif /* HAVE_EPOLL */
707
708
709 /*
710 * Range check input...
711 */
712
713 cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdRemoveSelect(fd=%d)", fd);
714
715 if (fd < 0)
716 return;
717
718 /*
719 * Find the file descriptor...
720 */
721
722 if ((fdptr = find_fd(fd)) == NULL)
723 return;
724
725#ifdef HAVE_EPOLL
726 if (epoll_ctl(cupsd_epoll_fd, EPOLL_CTL_DEL, fd, &event))
727 {
728 close(cupsd_epoll_fd);
729 cupsd_epoll_fd = -1;
730 cupsd_update_pollfds = 1;
731 }
732
733#elif defined(HAVE_KQUEUE)
734 timeout.tv_sec = 0;
735 timeout.tv_nsec = 0;
736
737 if (fdptr->read_cb)
738 {
739 EV_SET(&event, fd, EVFILT_READ, EV_DELETE, 0, 0, fdptr);
740
741 if (kevent(cupsd_kqueue_fd, &event, 1, NULL, 0, &timeout))
742 {
743 cupsdLogMessage(CUPSD_LOG_EMERG, "kevent() returned %s",
744 strerror(errno));
745 goto cleanup;
746 }
747 }
748
749 if (fdptr->write_cb)
750 {
751 EV_SET(&event, fd, EVFILT_WRITE, EV_DELETE, 0, 0, fdptr);
752

Callers 10

cupsdStopAllNotifiersFunction · 0.85
cupsdCloseClientFunction · 0.85
cupsdWriteClientFunction · 0.85
write_pipeFunction · 0.85
cupsdStopSystemMonitorFunction · 0.85
cupsdStopServerFunction · 0.85
cupsdContinueJobFunction · 0.85
finalize_jobFunction · 0.85
dnssdStopFunction · 0.85
cupsdPauseListeningFunction · 0.85

Calls 5

cupsdLogMessageFunction · 0.85
find_fdFunction · 0.85
keventClass · 0.85
cupsArrayRemoveFunction · 0.85
cupsArrayAddFunction · 0.85

Tested by

no test coverage detected