From 5fda4b10a2eba9885d6401aef20bd0290aba73be Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 11 Apr 1996 12:54:40 +0000 Subject: [PATCH] - small ioctl naming changes. - pass ioctl fd explicitly. --- sys/compat/svr4/svr4_filio.c | 16 +++++++--------- sys/compat/svr4/svr4_ioctl.c | 20 ++++++++++++++------ sys/compat/svr4/svr4_ioctl.h | 24 +++++++++++++----------- sys/compat/svr4/svr4_sockio.c | 9 +++++---- sys/compat/svr4/svr4_ttold.c | 9 +++++---- 5 files changed, 44 insertions(+), 34 deletions(-) diff --git a/sys/compat/svr4/svr4_filio.c b/sys/compat/svr4/svr4_filio.c index f7a5062922a9..28f09f59b6e8 100644 --- a/sys/compat/svr4/svr4_filio.c +++ b/sys/compat/svr4/svr4_filio.c @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_filio.c,v 1.4 1996/03/30 22:37:52 christos Exp $ */ +/* $NetBSD: svr4_filio.c,v 1.5 1996/04/11 12:54:40 christos Exp $ */ /* * Copyright (c) 1994 Christos Zoulas @@ -53,17 +53,17 @@ int -svr4_filioctl(fp, cmd, data, p, retval) +svr4_fil_ioctl(fp, p, retval, fd, cmd, data) struct file *fp; - u_long cmd; - caddr_t data; struct proc *p; register_t *retval; -{ - struct filedesc *fdp = p->p_fd; - int error; int fd; + u_long cmd; + caddr_t data; +{ + int error; int num; + struct filedesc *fdp = p->p_fd; int (*ctl) __P((struct file *, u_long, caddr_t, struct proc *)) = fp->f_ops->fo_ioctl; @@ -71,12 +71,10 @@ svr4_filioctl(fp, cmd, data, p, retval) switch (cmd) { case SVR4_FIOCLEX: - fd = fp - fdp->fd_ofiles[0]; fdp->fd_ofileflags[fd] |= UF_EXCLOSE; return 0; case SVR4_FIONCLEX: - fd = fp - fdp->fd_ofiles[0]; fdp->fd_ofileflags[fd] &= ~UF_EXCLOSE; return 0; diff --git a/sys/compat/svr4/svr4_ioctl.c b/sys/compat/svr4/svr4_ioctl.c index 3ad7d1d76d4d..63a33d8ac239 100644 --- a/sys/compat/svr4/svr4_ioctl.c +++ b/sys/compat/svr4/svr4_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_ioctl.c,v 1.15 1996/03/30 22:37:57 christos Exp $ */ +/* $NetBSD: svr4_ioctl.c,v 1.16 1996/04/11 12:54:41 christos Exp $ */ /* * Copyright (c) 1994 Christos Zoulas @@ -92,6 +92,8 @@ svr4_sys_ioctl(p, v, retval) struct file *fp; struct filedesc *fdp; u_long cmd; + int (*fun) __P((struct file *, struct proc *, register_t *, + int, u_long, caddr_t)); #ifdef DEBUG_SVR4 char dir[4]; char c; @@ -115,22 +117,28 @@ svr4_sys_ioctl(p, v, retval) switch (cmd & 0xff00) { case SVR4_tIOC: - return svr4_ttoldioctl(fp, cmd, SCARG(uap, data), p, retval); + fun = svr4_ttold_ioctl; + break; case SVR4_TIOC: - return svr4_termioctl(fp, cmd, SCARG(uap, data), p, retval); + fun = svr4_term_ioctl; + break; case SVR4_STR: - return svr4_streamioctl(fp, cmd, SCARG(uap, data), p, retval); + fun = svr4_stream_ioctl; + break; case SVR4_FIOC: - return svr4_filioctl(fp, cmd, SCARG(uap, data), p, retval); + fun = svr4_fil_ioctl; + break; case SVR4_SIOC: - return svr4_sockioctl(fp, cmd, SCARG(uap, data), p, retval); + fun = svr4_sock_ioctl; + break; default: DPRINTF(("Unimplemented ioctl %lx\n", cmd)); return 0; /* XXX: really ENOSYS */ } + return (*fun)(fp, p, retval, SCARG(uap, fd), cmd, SCARG(uap, data)); } diff --git a/sys/compat/svr4/svr4_ioctl.h b/sys/compat/svr4/svr4_ioctl.h index ba35ae9701bd..eee5cc849c7b 100644 --- a/sys/compat/svr4/svr4_ioctl.h +++ b/sys/compat/svr4/svr4_ioctl.h @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_ioctl.h,v 1.4 1995/10/07 06:27:42 mycroft Exp $ */ +/* $NetBSD: svr4_ioctl.h,v 1.5 1996/04/11 12:54:43 christos Exp $ */ /* * Copyright (c) 1994 Christos Zoulas @@ -43,15 +43,17 @@ #define SVR4_IOW(g,n,t) SVR4_IOC(SVR4_IOC_IN, (g), (n), sizeof(t)) #define SVR4_IOWR(g,n,t) SVR4_IOC(SVR4_IOC_INOUT,(g), (n), sizeof(t)) -int svr4_streamioctl __P((struct file *fp, u_long cmd, caddr_t data, - struct proc *p, register_t *retval)); -int svr4_termioctl __P((struct file *fp, u_long cmd, caddr_t data, - struct proc *p, register_t *retval)); -int svr4_ttoldioctl __P((struct file *fp, u_long cmd, caddr_t data, - struct proc *p, register_t *retval)); -int svr4_filioctl __P((struct file *fp, u_long cmd, caddr_t data, - struct proc *p, register_t *retval)); -int svr4_sockioctl __P((struct file *fp, u_long cmd, caddr_t data, - struct proc *p, register_t *retval)); +int svr4_stream_ti_ioctl __P((struct file *, struct proc *, register_t *, + int, u_long, caddr_t)); +int svr4_stream_ioctl __P((struct file *, struct proc *, register_t *, + int, u_long, caddr_t)); +int svr4_term_ioctl __P((struct file *, struct proc *, register_t *, + int, u_long, caddr_t)); +int svr4_ttold_ioctl __P((struct file *, struct proc *, register_t *, + int, u_long, caddr_t)); +int svr4_fil_ioctl __P((struct file *, struct proc *, register_t *, + int, u_long, caddr_t)); +int svr4_sock_ioctl __P((struct file *, struct proc *, register_t *, + int, u_long, caddr_t)); #endif /* !_SVR4_IOCTL_H_ */ diff --git a/sys/compat/svr4/svr4_sockio.c b/sys/compat/svr4/svr4_sockio.c index c3e319fca7de..7ba851e5447e 100644 --- a/sys/compat/svr4/svr4_sockio.c +++ b/sys/compat/svr4/svr4_sockio.c @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_sockio.c,v 1.7 1996/03/30 22:38:14 christos Exp $ */ +/* $NetBSD: svr4_sockio.c,v 1.8 1996/04/11 12:54:44 christos Exp $ */ /* * Copyright (c) 1995 Christos Zoulas @@ -76,12 +76,13 @@ bsd_to_svr4_flags(bf) } int -svr4_sockioctl(fp, cmd, data, p, retval) +svr4_sock_ioctl(fp, p, retval, fd, cmd, data) struct file *fp; - u_long cmd; - caddr_t data; struct proc *p; register_t *retval; + int fd; + u_long cmd; + caddr_t data; { int error; int (*ctl) __P((struct file *, u_long, caddr_t, struct proc *)) = diff --git a/sys/compat/svr4/svr4_ttold.c b/sys/compat/svr4/svr4_ttold.c index bfc1c5747819..7f61ea30bf53 100644 --- a/sys/compat/svr4/svr4_ttold.c +++ b/sys/compat/svr4/svr4_ttold.c @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_ttold.c,v 1.8 1996/03/30 22:38:27 christos Exp $ */ +/* $NetBSD: svr4_ttold.c,v 1.9 1996/04/11 12:54:45 christos Exp $ */ /* * Copyright (c) 1994 Christos Zoulas @@ -147,12 +147,13 @@ bsd_ltchars_to_svr4_ltchars(bl, sl) int -svr4_ttoldioctl(fp, cmd, data, p, retval) +svr4_ttold_ioctl(fp, p, retval, fd, cmd, data) struct file *fp; - u_long cmd; - caddr_t data; struct proc *p; register_t *retval; + int fd; + u_long cmd; + caddr_t data; { int error; int (*ctl) __P((struct file *, u_long, caddr_t, struct proc *)) =