aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2021-06-22 05:07:46 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2021-06-22 05:07:46 +0000
commit2eff670fde51762239fc64139b0cfb5272ce9cdd (patch)
treee734c84aefdba8389bd95311d26c19886b5d9baa
parent26795a0378b58c3e26b68577a4cc446ab527e8b5 (diff)
downloadsrc-2eff670fde51762239fc64139b0cfb5272ce9cdd.tar.gz
src-2eff670fde51762239fc64139b0cfb5272ce9cdd.zip
linux(4): Implement poll system call via linux_common_ppol()
for the sake of converting events to/from native. MFC after: 2 weeks
-rw-r--r--sys/amd64/linux/syscalls.master4
-rw-r--r--sys/amd64/linux32/syscalls.master4
-rw-r--r--sys/arm/linux/syscalls.master4
-rw-r--r--sys/compat/linux/linux_misc.c20
-rw-r--r--sys/i386/linux/syscalls.master4
5 files changed, 28 insertions, 8 deletions
diff --git a/sys/amd64/linux/syscalls.master b/sys/amd64/linux/syscalls.master
index 0cac26337ef1..4762a2ccc6a5 100644
--- a/sys/amd64/linux/syscalls.master
+++ b/sys/amd64/linux/syscalls.master
@@ -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
diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master
index 0ca919182998..be6c150eebfa 100644
--- a/sys/amd64/linux32/syscalls.master
+++ b/sys/amd64/linux32/syscalls.master
@@ -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
diff --git a/sys/arm/linux/syscalls.master b/sys/arm/linux/syscalls.master
index 42adc18bbe1e..46cf988c3dfe 100644
--- a/sys/arm/linux/syscalls.master
+++ b/sys/arm/linux/syscalls.master
@@ -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
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 80458364017f..1c1a8952bd79 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -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__ */
diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master
index f75b1253bc14..acbe5628e7ce 100644
--- a/sys/i386/linux/syscalls.master
+++ b/sys/i386/linux/syscalls.master
@@ -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