Lines Matching defs:fd

117 static void add_pollfd(int fd, short events);
118 static void remove_pollfd(int fd);
119 static void __svc_remove_input_of_fd(int fd);
125 * - one callback we call if the fd pops,
130 * only one callback may be associated to a couple (fd, event).
144 int fd;
281 int fd = pfd->fd;
288 if ((fd < 0) || (fd >= svc_nuserfds)) {
293 node = svc_userfds[fd].lnk.next;
296 if (0 == (revents & svc_userfds[fd].mask)) {
301 while ((svc_userfds[fd].mask != 0) &&
302 ((_svc_user_link *)node != &(svc_userfds[fd].lnk))) {
321 node->callback(node->id, node->fd,
335 __svc_remove_input_of_fd(fd);
342 * To do this, just check that the array indexed on fd has a non-void linked
346 __is_a_userfd(int fd)
349 if ((fd < 0) || (fd >= svc_nuserfds))
351 return ((svc_userfds[fd].mask == 0x0000)? FALSE:TRUE);
354 /* free everything concerning user fd */
361 /* Clean user fd */
386 * Remove all the callback associated with a fd => useful when the fd is
390 __svc_remove_input_of_fd(int fd)
394 if ((fd < 0) || (fd >= svc_nuserfds))
397 one_node = svc_userfds[fd].lnk.next;
399 != (_svc_user_link *) &(svc_userfds[fd].lnk)) {
405 LIST_CLR(svc_userfds[fd]);
406 svc_userfds[fd].mask = 0;
410 * Allow user to add an fd in the poll list. If it does not succeed, return
475 new_node->fd = user_fd;
508 int fd; /* caching optim */
526 fd = node->fd; /* caching optim */
533 svc_userfds[fd].mask ^= node->events;
536 if (svc_userfds[fd].mask == 0) {
537 LIST_CLR(svc_userfds[fd]);
538 assert(LIST_ISEMPTY(svc_userfds[fd]));
539 remove_pollfd(fd);
596 * Add fd to svc_pollfd
599 add_pollfd(int fd, short events)
601 if (fd < FD_SETSIZE) {
602 FD_SET(fd, &svc_fdset);
604 FD_SET(fd, &_new_svc_fdset);
608 if (fd >= svc_max_fd)
609 svc_max_fd = fd + 1;
611 if (fd >= svc_max_pollfd)
612 svc_max_pollfd = fd + 1;
632 if (fd < FD_SETSIZE) {
633 FD_CLR(fd, &svc_fdset);
635 FD_CLR(fd, &_new_svc_fdset);
639 if (fd == (svc_max_fd - 1))
642 if (fd == (svc_max_pollfd - 1))
649 svc_pollfd[fd].fd = fd;
650 svc_pollfd[fd].events = events;
656 * the fd is still active but only the bit in fdset is cleared.
660 clear_pollfd(int fd)
662 if (fd < FD_SETSIZE && FD_ISSET(fd, &svc_fdset)) {
663 FD_CLR(fd, &svc_fdset);
665 FD_CLR(fd, &_new_svc_fdset);
669 if (fd < svc_pollfd_allocd && POLLFD_ISSET(fd, svc_pollfd)) {
670 POLLFD_CLR(fd, svc_pollfd);
676 * sets the bit in fdset for an active fd so that poll() is done for that
679 set_pollfd(int fd, short events)
681 if (fd < FD_SETSIZE) {
682 FD_SET(fd, &svc_fdset);
684 FD_SET(fd, &_new_svc_fdset);
688 if (fd < svc_pollfd_allocd) {
689 svc_pollfd[fd].fd = fd;
690 svc_pollfd[fd].events = events;
699 remove_pollfd(int fd)
701 clear_pollfd(fd);
702 if (fd == (svc_max_fd - 1))
705 if (fd == (svc_max_pollfd - 1))
715 delete_pollfd(int fd)
717 remove_pollfd(fd);
739 int fd = xprt->xp_fd;
760 * recv's a call from another client on the server fd's,
769 while (fd >= nsvc_xports) {
786 svc_xports[fd] = (SVCXPRT *)xprt;
788 add_pollfd(fd, MASKVAL);
827 int fd = xprt->xp_fd;
831 if ((fd < nsvc_xports) && (svc_xports[fd] == xprt)) {
832 svc_xports[fd] = NULL;
833 delete_pollfd(fd);
1275 /* fd has input waiting */
1291 /* fd has input waiting */
1305 if (__is_a_userfd(p->fd) == TRUE) {
1312 remove_pollfd(p->fd); /* XXX */
1315 svc_getreq_common(p->fd);
1323 svc_getreq_common(const int fd)
1334 if (__is_a_userfd(fd) == TRUE) {
1338 virtual_fd.fd = fd;
1345 * The transport associated with this fd could have been
1348 * passed to svc_getreq_poll/set, the first fd is seviced by
1350 * one of the dead transports removed is the other fd that
1352 * xprt associated with the fd that had the original read event.
1354 if ((fd >= nsvc_xports) || (xprt = svc_xports[fd]) == NULL) {
1380 if (xprt != svc_xports[fd]) {