On Apr 4, 2005 8:28 AM, Vlad Seryakov <[EMAIL PROTECTED]> wrote:
> I think it is safe for us to replace NS poll with attached implementation.
> 
> Stephen Deasey wrote:
> > I think OSX is the only poll() underachiever we care about.
> > Sourceforge has 10.1 and 10.2 hosts you can compile and test on, if
> > you're interested:
> >
> > http://sourceforge.net/docman/display_doc.php?docid=762&group_id=1
> >
> >
> >
> > On Apr 3, 2005 4:44 PM, Vlad Seryakov <[EMAIL PROTECTED]> wrote:
> >
> >>I found this, looks like we can use it.
> >>
> >>i made a copy, so if evrybody is okay i can replace this poll.
> >>
> >>http://mail.python.org/pipermail/python-list/2001-October/069168.html
> >>
> >>--
> >>Vlad Seryakov
> >>571 262-8608 office
> >>[EMAIL PROTECTED]
> >>http://www.crystalballinc.com/vlad/
> >
> >
> >
> > -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT Products from real users.
> > Discover which products truly live up to the hype. Start reading now.
> > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> > _______________________________________________
> > naviserver-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/naviserver-devel
> 
> --
> Vlad Seryakov
> 571 262-8608 office
> [EMAIL PROTECTED]
> http://www.crystalballinc.com/vlad/
> 
> 
> #ifndef HAVE_POLL
> 
> struct pollfd {
>         int fd;
>         short events;
>         short revents;
> };
> 
> #define POLLIN 001
> #define POLLPRI 002
> #define POLLOUT 004
> #define POLLNORM POLLIN
> #define POLLERR 010
> #define POLLHUP 020
> #define POLLNVAL 040
> 
> ----------------------------------------
> /*
>  *  prt
>  *
>  *  Copyright 1994 University of Washington
>  *
>  *  Permission is hereby granted to copy this software, and to
>  *  use and redistribute it, except that this notice may not be
>  *  removed.  The University of Washington does not guarantee
>  *  that this software is suitable for any purpose and will not
>  *  be held liable for any damage it may cause.
>  */
> 
> /*
> **  emulate poll() for those platforms (Ultrix) that don't have it.
> */
> 
> #include <sys/types.h>
> #include <sys/time.h>
> 
> int
> poll(fds, nfds, timo)
>         struct pollfd *fds;
>         unsigned long nfds;
>         int timo;
> {
>     struct timeval timeout, *toptr;
>     fd_set ifds, ofds, efds, *ip, *op, *ep;
>     int i, rc, n;
>     FD_ZERO(&ifds);
>     FD_ZERO(&ofds);
>     FD_ZERO(&efds);
>     for (i = 0, n = -1, op = ip = 0; i < nfds; ++i) {
>         fds[i].revents = 0;
>         if (fds[i].fd < 0)
>                 continue;
>         if (fds[i].fd > n)
>                 n = fds[i].fd;
>         if (fds[i].events & (POLLIN|POLLPRI)) {
>                 ip = &ifds;
>                 FD_SET(fds[i].fd, ip);
>         }
>         if (fds[i].events & POLLOUT) {
>                 op = &ofds;
>                 FD_SET(fds[i].fd, op);
>         }
>         FD_SET(fds[i].fd, &efds);
>     }
>     if (timo < 0)
>         toptr = 0;
>     else {
>         toptr = &timeout;
>         timeout.tv_sec = timo / 1000;
>         timeout.tv_usec = (timo - timeout.tv_sec * 1000) * 1000;
>     }
>     rc = select(++n, ip, op, &efds, toptr);
>     if (rc <= 0)
>         return rc;
> 
>     for (i = 0, n = 0; i < nfds; ++i) {
>         if (fds[i].fd < 0) continue;
>         if (fds[i].events & (POLLIN|POLLPRI) && FD_ISSET(i, &ifds))
>                 fds[i].revents |= POLLIN;
>         if (fds[i].events & POLLOUT && FD_ISSET(i, &ofds))
>                 fds[i].revents |= POLLOUT;
>         if (FD_ISSET(i, &efds))
>                 /* Some error was detected ... should be some way to know. */
>                 fds[i].revents |= POLLHUP;
>     }
>     return rc;
> }
> #endif


Should we be concerned about that last comment (Some error was detected...)?

Reply via email to