Lines 65-70
__FBSDID("$FreeBSD$");
Link Here
|
65 |
#include <sys/vnode.h> |
65 |
#include <sys/vnode.h> |
66 |
#include <sys/wait.h> |
66 |
#include <sys/wait.h> |
67 |
#include <sys/cpuset.h> |
67 |
#include <sys/cpuset.h> |
|
|
68 |
#include <sys/poll.h> |
68 |
|
69 |
|
69 |
#include <security/mac/mac_framework.h> |
70 |
#include <security/mac/mac_framework.h> |
70 |
|
71 |
|
Lines 567-572
select_out:
Link Here
|
567 |
} |
568 |
} |
568 |
|
569 |
|
569 |
int |
570 |
int |
|
|
571 |
linux_ppoll(struct thread *td, struct linux_ppoll_args *pargs) |
572 |
{ |
573 |
struct l_timespec lts; |
574 |
struct timeval tv, *tvp, tv0, tv1; |
575 |
sigset_t usigmask, *usigmaskp; |
576 |
l_sigset_t lsigmask; |
577 |
int error, retval; |
578 |
|
579 |
/* Get the time */ |
580 |
if (pargs->timeout_ts != NULL) |
581 |
{ |
582 |
error = copyin(pargs->timeout_ts, <s, sizeof(lts)); |
583 |
if (error != 0) |
584 |
return (error); |
585 |
|
586 |
TIMESPEC_TO_TIMEVAL(&tv, <s); |
587 |
if (itimerfix(&tv)) |
588 |
return (EINVAL); |
589 |
|
590 |
/* Mark the time before the call */ |
591 |
microtime(&tv0); |
592 |
tvp = &tv; |
593 |
} else |
594 |
tvp = NULL; |
595 |
|
596 |
/* Get the sigmask */ |
597 |
if (pargs->sigmask != NULL) { |
598 |
error = copyin(pargs->sigmask, &lsigmask, sizeof(lsigmask)); |
599 |
if (error) |
600 |
return (error); |
601 |
linux_to_bsd_sigset(&lsigmask, &usigmask); |
602 |
usigmaskp = &usigmask; |
603 |
} else |
604 |
usigmaskp = NULL; |
605 |
|
606 |
/* Create the poll_args struct */ |
607 |
struct poll_args pa, *pap; |
608 |
|
609 |
pa.fds = pargs->fds; |
610 |
pa.nfds = pargs->nfds; |
611 |
pap = &pa; |
612 |
|
613 |
/* Linux's ppoll allows NULL timeout which is translated to FreeBSD's INFTIM (-1) */ |
614 |
if (tvp==NULL) |
615 |
pa.timeout = INFTIM; |
616 |
else |
617 |
{ |
618 |
if ( tvp->tv_sec == 0 ) |
619 |
pa.timeout = tvp->tv_usec / 1000; |
620 |
else |
621 |
pa.timeout = tvp->tv_sec * 1000 + tvp->tv_usec / 1000; |
622 |
} |
623 |
|
624 |
error = kern_sigprocmask (td, SIG_SETMASK, usigmaskp, &td->td_oldsigmask, 0); |
625 |
if (error) |
626 |
return (error); |
627 |
|
628 |
/* call sys_poll */ |
629 |
retval = sys_poll(td, pap); |
630 |
|
631 |
error = kern_sigprocmask (td, SIG_SETMASK, &td->td_oldsigmask, NULL, 0); |
632 |
if (error) |
633 |
return (error); |
634 |
|
635 |
if (retval == 0 && pargs->timeout_ts) { |
636 |
if (td->td_retval[0]) { |
637 |
/* |
638 |
* Compute how much time was left of the timeout, |
639 |
* by subtracting the current time and the time |
640 |
* before we started the call, and subtracting |
641 |
* that result from the user-supplied value. |
642 |
*/ |
643 |
microtime(&tv1); |
644 |
timevalsub(&tv1, &tv0); |
645 |
timevalsub(&tv, &tv1); |
646 |
if (tv.tv_sec < 0) |
647 |
timevalclear(&tv); |
648 |
} else |
649 |
timevalclear(&tv); |
650 |
|
651 |
TIMEVAL_TO_TIMESPEC(&tv, <s); |
652 |
|
653 |
error = copyout(<s, pargs->timeout_ts, sizeof(lts)); |
654 |
if (error) |
655 |
return (error); |
656 |
} |
657 |
return retval; |
658 |
} |
659 |
|
660 |
int |
570 |
linux_mremap(struct thread *td, struct linux_mremap_args *args) |
661 |
linux_mremap(struct thread *td, struct linux_mremap_args *args) |
571 |
{ |
662 |
{ |
572 |
struct munmap_args /* { |
663 |
struct munmap_args /* { |