Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Nov 2014 23:12:08 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r274257 - in user/dchagin/lemul/sys: compat/freebsd32 kern
Message-ID:  <201411072312.sA7NC86v017392@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Fri Nov  7 23:12:07 2014
New Revision: 274257
URL: https://svnweb.freebsd.org/changeset/base/274257

Log:
  Add native ppoll system call.

Modified:
  user/dchagin/lemul/sys/compat/freebsd32/freebsd32_misc.c
  user/dchagin/lemul/sys/compat/freebsd32/syscalls.master
  user/dchagin/lemul/sys/kern/sys_generic.c
  user/dchagin/lemul/sys/kern/syscalls.master

Modified: user/dchagin/lemul/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- user/dchagin/lemul/sys/compat/freebsd32/freebsd32_misc.c	Fri Nov  7 22:52:02 2014	(r274256)
+++ user/dchagin/lemul/sys/compat/freebsd32/freebsd32_misc.c	Fri Nov  7 23:12:07 2014	(r274257)
@@ -3017,3 +3017,31 @@ freebsd32_fcntl(struct thread *td, struc
 	}
 	return (kern_fcntl_freebsd(td, uap->fd, uap->cmd, tmp));
 }
+
+int
+freebsd32_ppoll(struct thread *td, struct freebsd32_ppoll_args *uap)
+{
+	struct timespec32 ts32;
+	struct timespec ts, *tsp;
+	sigset_t set, *ssp;
+	int error;
+
+	if (uap->ts != NULL) {
+		error = copyin(uap->ts, &ts32, sizeof(ts32));
+		if (error != 0)
+			return (error);
+		CP(ts32, ts, tv_sec);
+		CP(ts32, ts, tv_nsec);
+		tsp = &ts;
+	} else
+		tsp = NULL;
+	if (uap->set != NULL) {
+		error = copyin(uap->set, &set, sizeof(set));
+		if (error != 0)
+			return (error);
+		ssp = &set;
+	} else
+		ssp = NULL;
+
+	return (kern_ppoll(td, uap->fds, uap->nfds, tsp, ssp));
+}

Modified: user/dchagin/lemul/sys/compat/freebsd32/syscalls.master
==============================================================================
--- user/dchagin/lemul/sys/compat/freebsd32/syscalls.master	Fri Nov  7 22:52:02 2014	(r274256)
+++ user/dchagin/lemul/sys/compat/freebsd32/syscalls.master	Fri Nov  7 23:12:07 2014	(r274257)
@@ -1066,3 +1066,6 @@
 				    uint32_t id1, uint32_t id2, int com, \
 				    void *data); }
 #endif
+545	AUE_POLL	STD	{ int freebsd32_ppoll(struct pollfd *fds, \
+				    u_int nfds, const struct timespec32 *ts, \
+				    const sigset_t *set); }

Modified: user/dchagin/lemul/sys/kern/sys_generic.c
==============================================================================
--- user/dchagin/lemul/sys/kern/sys_generic.c	Fri Nov  7 22:52:02 2014	(r274256)
+++ user/dchagin/lemul/sys/kern/sys_generic.c	Fri Nov  7 23:12:07 2014	(r274257)
@@ -1377,6 +1377,41 @@ out:
 	return (error);
 }
 
+#ifndef _SYS_SYSPROTO_H_
+struct ppoll_args {
+	struct pollfd *fds;
+	u_int	nfds;
+	struct timespec	*ts;
+	sigset_ *set;
+};
+#endif
+int
+sys_ppoll(td, uap)
+	struct thread *td;
+	struct ppoll_args *uap;
+{
+	struct timespec ts, *tsp;
+	sigset_t set, *ssp;
+	int error;
+
+	if (uap->ts != NULL) {
+		error = copyin(uap->ts, &ts, sizeof(ts));
+		if (error)
+			return (error);
+		tsp = &ts;
+	} else
+		tsp = NULL;
+	if (uap->set != NULL) {
+		error = copyin(uap->set, &set, sizeof(set));
+		if (error)
+			return (error);
+		ssp = &set;
+	} else
+		ssp = NULL;
+
+	return (kern_ppoll(td, uap->fds, uap->nfds, tsp, ssp));
+}
+
 int
 kern_ppoll(struct thread *td, struct pollfd *fds, u_int nfds,
     struct timespec *tsp, sigset_t *uset)

Modified: user/dchagin/lemul/sys/kern/syscalls.master
==============================================================================
--- user/dchagin/lemul/sys/kern/syscalls.master	Fri Nov  7 22:52:02 2014	(r274256)
+++ user/dchagin/lemul/sys/kern/syscalls.master	Fri Nov  7 23:12:07 2014	(r274257)
@@ -980,5 +980,8 @@
 543	AUE_NULL	NOSTD	{ int aio_mlock(struct aiocb *aiocbp); }
 544	AUE_NULL	STD	{ int procctl(idtype_t idtype, id_t id, \
 				    int com, void *data); }
+545	AUE_POLL	STD	{ int ppoll(struct pollfd *fds, u_int nfds, \
+				    const struct timespec *ts, \
+				    const sigset_t *set); }
 ; Please copy any additions and changes to the following compatability tables:
 ; sys/compat/freebsd32/syscalls.master



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