linux(4): Implement poll system call via linux_common_ppol()

for the sake of converting events to/from native.

MFC after:	2 weeks
This commit is contained in:
Dmitry Chagin 2021-06-22 08:07:46 +03:00
parent 26795a0378
commit 2eff670fde
5 changed files with 28 additions and 8 deletions

View File

@ -82,8 +82,8 @@
struct l_newstat *buf
);
}
7 AUE_POLL NOPROTO {
int poll(
7 AUE_POLL STD {
int linux_poll(
struct pollfd *fds,
u_int nfds,
int timeout

View File

@ -887,8 +887,8 @@
}
166 AUE_NULL UNIMPL vm86
167 AUE_NULL UNIMPL query_module
168 AUE_POLL NOPROTO {
int poll(
168 AUE_POLL STD {
int linux_poll(
struct pollfd *fds,
unsigned int nfds,
int timeout

View File

@ -744,8 +744,8 @@
}
166 AUE_NULL UNIMPL ; was linux_vm86
167 AUE_NULL UNIMPL ; was linux_query_module
168 AUE_POLL NOPROTO {
int poll(
168 AUE_POLL STD {
int linux_poll(
struct pollfd* fds,
unsigned int nfds,
long timeout

View File

@ -2858,3 +2858,23 @@ linux_getcpu(struct thread *td, struct linux_getcpu_args *args)
error = copyout(&node, args->node, sizeof(l_int));
return (error);
}
#if defined(__i386__) || defined(__amd64__)
int
linux_poll(struct thread *td, struct linux_poll_args *args)
{
struct timespec ts, *tsp;
if (args->timeout != INFTIM) {
if (args->timeout < 0)
return (EINVAL);
ts.tv_sec = args->timeout / 1000;
ts.tv_nsec = (args->timeout % 1000) * 1000000;
tsp = &ts;
} else
tsp = NULL;
return (linux_common_ppoll(td, args->fds, args->nfds,
tsp, NULL, 0));
}
#endif /* __i386__ || __amd64__ */

View File

@ -912,8 +912,8 @@
int linux_vm86(void);
}
167 AUE_NULL UNIMPL query_module
168 AUE_POLL NOPROTO {
int poll(
168 AUE_POLL STD {
int linux_poll(
struct pollfd *fds,
unsigned int nfds,
long timeout