PERFORCE change 100654 for review

John Baldwin jhb at FreeBSD.org
Wed Jul 5 20:42:46 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=100654

Change 100654 by jhb at jhb_mutex on 2006/07/05 20:42:09

	Just use regular poll() for ibcs2_poll().  ibcs2_poll() was broken in
	so many ways and completely unnecessary.

Affected files ...

.. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_msg.c#7 edit
.. //depot/projects/smpng/sys/i386/ibcs2/syscalls.master#12 edit
.. //depot/projects/smpng/sys/notes#71 edit

Differences ...

==== //depot/projects/smpng/sys/i386/ibcs2/ibcs2_msg.c#7 (text+ko) ====

@@ -38,7 +38,6 @@
 #include <i386/ibcs2/ibcs2_types.h>
 #include <i386/ibcs2/ibcs2_signal.h>
 #include <i386/ibcs2/ibcs2_util.h>
-#include <i386/ibcs2/ibcs2_poll.h>
 #include <i386/ibcs2/ibcs2_proto.h>
 
 
@@ -57,79 +56,3 @@
 {
 	return 0; /* fake */
 }
-
-
-int
-ibcs2_poll(td, uap)
-	struct thread *td;
-	struct ibcs2_poll_args *uap;
-{
-	int error, i, nfds;
-	fd_set *readfds, *writefds, *exceptfds;
-	struct timeval timeout, *tp;
-	struct ibcs2_poll conv;
-	caddr_t sg = stackgap_init();
-
-	if (uap->nfds > FD_SETSIZE)
-		return EINVAL;
-	readfds   = stackgap_alloc(&sg, sizeof(fd_set *));
-	writefds  = stackgap_alloc(&sg, sizeof(fd_set *));
-	exceptfds = stackgap_alloc(&sg, sizeof(fd_set *));
-
-	FD_ZERO(readfds);
-	FD_ZERO(writefds);
-	FD_ZERO(exceptfds);
-	if (uap->timeout == -1)
-		tp = NULL;
-	else {
-		timeout.tv_usec = (uap->timeout % 1000)*1000;
-		timeout.tv_sec  = uap->timeout / 1000;
-		tp = &timeout;
-	}
-
-	nfds = 0;
-	for (i = 0; i < uap->nfds; i++) {
-		if ((error = copyin(uap->fds + i*sizeof(struct ibcs2_poll),
-				   &conv, sizeof(conv))) != 0)
-			return error;
-		conv.revents = 0;
-		if (conv.fd < 0 || conv.fd >= FD_SETSIZE)
-			continue;
-		if (conv.fd >= nfds)
-			nfds = conv.fd + 1;
-		if (conv.events & IBCS2_READPOLL)
-			FD_SET(conv.fd, readfds);
-		if (conv.events & IBCS2_WRITEPOLL)
-			FD_SET(conv.fd, writefds);
-		FD_SET(conv.fd, exceptfds);
-	}
-	error = kern_select(td, nfds, readfds, writefds, exceptfds, tp);
-	if (error != 0)
-		return error;
-	if (td->td_retval[0] == 0)
-		return 0;
-	td->td_retval[0] = 0;
-	for (td->td_retval[0] = 0, i = 0; i < uap->nfds; i++) {
-		copyin(uap->fds + i*sizeof(struct ibcs2_poll),
-		       &conv, sizeof(conv));
-		conv.revents = 0;
-		if (conv.fd < 0 || conv.fd > FD_SETSIZE)
-			/* should check for open as well */
-			conv.revents |= IBCS2_POLLNVAL;
-		else {
-			if (FD_ISSET(conv.fd, readfds))
-				conv.revents |= IBCS2_POLLIN;
-			if (FD_ISSET(conv.fd, writefds))
-				conv.revents |= IBCS2_POLLOUT;
-			if (FD_ISSET(conv.fd, exceptfds))
-				conv.revents |= IBCS2_POLLERR;
-			if (conv.revents)
-				++td->td_retval[0];
-		}
-		if ((error = copyout(&conv,
-				    uap->fds + i*sizeof(struct ibcs2_poll),
-				    sizeof(conv))) != 0)
-			return error;
-	}
-	return 0;
-}

==== //depot/projects/smpng/sys/i386/ibcs2/syscalls.master#12 (text+ko) ====

@@ -158,8 +158,8 @@
 86	AUE_PUTMSG	MSTD	{ int ibcs2_putmsg(int fd, \
 				    struct ibcs2_stropts *ctl, \
 				    struct ibcs2_stropts *dat, int flags); }
-87	AUE_POLL	STD	{ int ibcs2_poll(struct ibcs2_poll *fds, \
-				    long nfds, int timeout); }
+87	AUE_POLL	MNOPROTO { int poll(struct pollfd *fds, u_int nfds, \
+				    int timeout); }
 88	AUE_NULL	UNIMPL	nosys
 89	AUE_NULL	MSTD	{ int ibcs2_secure(int cmd, int a1, int a2, \
 				    int a3, int a4, int a5); }

==== //depot/projects/smpng/sys/notes#71 (text+ko) ====

@@ -79,6 +79,40 @@
   recursion) and panic if we try to sleep with any held to provide a cheaper
   version of the current WITNESS check that doesn't bog the system down quite
   as bad.
+- compat ABI cleanups
+  - axe stackgap
+    + svr4
+    + linux
+    - ibcs2
+      - ibcs2_msg.c
+  - push Giant down and mark all remaining syscalls MPSAFE
+    + freebsd
+    + compat32
+    - svr4
+	- svr4_sys_ioctl()
+	- svr4_sys_getmsg()
+	- svr4_sys_putmsg()
+	- svr4_sys_waitsys()
+	- svr4_sys_fchroot()
+	- svr4_sys_resolvepath()
+    - linux
+	- linux_uselib()
+    - ibcs2
+	- ibcs2_read()
+	- ibcs2_mount()
+	- ibcs2_umount()
+	- ibcs2_msgsys()
+	- ibcs2_shmsys()
+	- ibcs2_semsys()
+	- ibcs2_ioctl()
+	- ibcs2_getdents()
+	+ ibcs2_poll()
+	  + axe ibcs2_poll.h
+	- ibcs2_sigprocmask()
+	- xenix_rdchk()
+	- ibcs2_getgroups()
+	- ibcs2_setgruops()
+  - don't mess with td_retval in any kern_foo() functions
 
 Active child branches:
 - jhb_intr - fast ithreads and MSI? (perhaps do MSI in jhb_acpipci)


More information about the p4-projects mailing list