~vojtech-horky/helenos/helenos-qemu

« back to all changes in this revision

Viewing changes to uspace/lib/posix/source/stream.c

  • Committer: Jan Mares
  • Date: 2015-08-13 16:30:22 UTC
  • Revision ID: maresja1@gmail.com-20150813163022-2lqo8sxil30q1lcr
Added setenv mockup and fix of abuse of select API for SDL.

Show diffs side-by-side

added added

removed removed

Lines of Context:
660
660
 
661
661
        convert_fd_set_2_pollfd(readfds, writefds, errorfds, &pollfds, &count);
662
662
 
 
663
        /* select API is sometimes abused to wait fot specified timeout */
 
664
        if (!nfds) {
 
665
                if(timeout) {
 
666
                        if (timeout->tv_sec) {
 
667
                                async_usleep(timeout->tv_sec * 1000);
 
668
                        }
 
669
                        if (timeout->tv_usec != 0) {
 
670
                                async_usleep(timeout->tv_usec);
 
671
                        }
 
672
                }
 
673
                return 0;
 
674
        }
663
675
        int result;
664
676
        if (timeout == NULL) {
665
677
                result = select_poll_combined(count, pollfds, NULL, NULL);
683
695
        struct posix_pollfd *pollfds;
684
696
        size_t count;
685
697
 
 
698
        /* select API is sometimes abused to wait fot specified timeout */
 
699
        if (!nfds) {
 
700
                if(timeout) {
 
701
                        if (timeout->tv_sec) {
 
702
                                async_usleep(timeout->tv_sec * 1000);
 
703
                        }
 
704
                        if (timeout->tv_nsec != 0) {
 
705
                                async_usleep(timeout->tv_nsec / 1000);
 
706
                        }
 
707
                }
 
708
                return 0;
 
709
        }
686
710
        convert_fd_set_2_pollfd(readfds, writefds, errorfds, &pollfds, &count);
687
711
        int result = select_poll_combined((size_t)nfds, pollfds, timeout, sigmask);
688
712
        convert_pollfd_2_fd_set(pollfds, count, readfds, writefds, errorfds);