Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jun 2022 19:32:02 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b7289a2e083f - stable/13 - linux(4): Implement poll system call via linux_common_ppol() for the sake of converting events to/from native.
Message-ID:  <202206171932.25HJW2rV007936@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=b7289a2e083f127c4c7abd9157d4412ad75d733a

commit b7289a2e083f127c4c7abd9157d4412ad75d733a
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2021-06-22 05:07:46 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:30:19 +0000

    linux(4): Implement poll system call via linux_common_ppol()
    for the sake of converting events to/from native.
    
    MFC after:      2 weeks
    
    (cherry picked from commit 2eff670fde51762239fc64139b0cfb5272ce9cdd)
---
 sys/amd64/linux/syscalls.master   |  4 ++--
 sys/amd64/linux32/syscalls.master |  4 ++--
 sys/arm/linux/syscalls.master     |  4 ++--
 sys/compat/linux/linux_misc.c     | 20 ++++++++++++++++++++
 sys/i386/linux/syscalls.master    |  4 ++--
 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 90a89578fc8f..a6e170f47435 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -2867,3 +2867,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206171932.25HJW2rV007936>