summaryrefslogtreecommitdiffstats
path: root/sys/i386/ibcs2
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-07-08 20:12:14 +0000
committerjhb <jhb@FreeBSD.org>2006-07-08 20:12:14 +0000
commit094306d69d41989862ff128380df0e7e2bdbe80d (patch)
tree08f1122008ef638646627d52e5fc05db3ffc64ba /sys/i386/ibcs2
parent28bb163264ff66e4b22bed304a675e7ab2ca723a (diff)
downloadFreeBSD-src-094306d69d41989862ff128380df0e7e2bdbe80d.zip
FreeBSD-src-094306d69d41989862ff128380df0e7e2bdbe80d.tar.gz
- Split ioctl() up into ioctl() and kern_ioctl(). The kern_ioctl() assumes
that the 'data' pointer is already setup to point to a valid KVM buffer or contains the copied-in data from userland as appropriate (ioctl(2) still does this). kern_ioctl() takes care of looking up a file pointer, implementing FIONCLEX and FIOCLEX, and calling fi_ioctl(). - Use kern_ioctl() to implement xenix_rdchk() instead of using the stackgap and mark xenix_rdchk() MPSAFE.
Diffstat (limited to 'sys/i386/ibcs2')
-rw-r--r--sys/i386/ibcs2/ibcs2_xenix.c17
-rw-r--r--sys/i386/ibcs2/syscalls.xenix2
2 files changed, 8 insertions, 11 deletions
diff --git a/sys/i386/ibcs2/ibcs2_xenix.c b/sys/i386/ibcs2/ibcs2_xenix.c
index faa9d7c..e3fbc04 100644
--- a/sys/i386/ibcs2/ibcs2_xenix.c
+++ b/sys/i386/ibcs2/ibcs2_xenix.c
@@ -84,18 +84,15 @@ xenix_rdchk(td, uap)
struct thread *td;
struct xenix_rdchk_args *uap;
{
- int error;
- struct ioctl_args sa;
- caddr_t sg = stackgap_init();
+ int data, error;
DPRINTF(("IBCS2: 'xenix rdchk'\n"));
- sa.fd = uap->fd;
- sa.com = FIONREAD;
- sa.data = stackgap_alloc(&sg, sizeof(int));
- if ((error = ioctl(td, &sa)) != 0)
- return error;
- td->td_retval[0] = (*((int*)sa.data)) ? 1 : 0;
- return 0;
+
+ error = kern_ioctl(td, uap->fd, FIONREAD, (caddr_t)&data);
+ if (error)
+ return (error);
+ td->td_retval[0] = data ? 1 : 0;
+ return (0);
}
int
diff --git a/sys/i386/ibcs2/syscalls.xenix b/sys/i386/ibcs2/syscalls.xenix
index 8b9b84a..2fc1838 100644
--- a/sys/i386/ibcs2/syscalls.xenix
+++ b/sys/i386/ibcs2/syscalls.xenix
@@ -14,7 +14,7 @@
4 AUE_NULL UNIMPL xenix_sigsem
5 AUE_NULL UNIMPL xenix_waitsem
6 AUE_NULL UNIMPL xenix_nbwaitsem
-7 AUE_NULL STD { int xenix_rdchk(int fd); }
+7 AUE_NULL MSTD { int xenix_rdchk(int fd); }
8 AUE_NULL UNIMPL nosys
9 AUE_NULL UNIMPL nosys
10 AUE_FTRUNCATE MSTD { int xenix_chsize(int fd, long size); }
OpenPOWER on IntegriCloud