diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 1999-08-14 13:26:44 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 1999-08-14 13:26:44 +0000 |
commit | 3bde119b1e157bd30d22dcf1e40c527b73e16a12 (patch) | |
tree | ed6ef6b1ae0475b16e51485c928f29fac9c8090b /sys/compat | |
parent | dd473d08e0c51d208e03a6d44657c7d108a0317b (diff) | |
download | src-3bde119b1e157bd30d22dcf1e40c527b73e16a12.tar.gz src-3bde119b1e157bd30d22dcf1e40c527b73e16a12.zip |
Fix LINUX_TIOC{S|G}SERIAL implementation. Both do not copy data in or out
of kernel space. Remove the ioctl supporting functions, and move the actual
code to the switch-statement. Now everybody can clearly see that the
implementation is really poor.
Also fix a typo in LINUX_TIOCGETD. The underlying function was given command
TIOCSETD instead op TIOCGETD...
Notes
Notes:
svn path=/head/; revision=49774
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_ioctl.c | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index ea9cb6f66387..b65b2fa856e1 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_ioctl.c,v 1.38 1999/08/14 10:05:50 marcel Exp $ + * $Id: linux_ioctl.c,v 1.39 1999/08/14 10:30:38 marcel Exp $ */ #include <sys/param.h> @@ -436,24 +436,6 @@ linux_to_bsd_termio(struct linux_termio *linux_termio, linux_to_bsd_termios(&tmios, bsd_termios); } -static void -linux_tiocgserial(struct file *fp, struct linux_serial_struct *lss) -{ - if (!fp || !lss) - return; - - lss->type = LINUX_PORT_16550A; - lss->flags = 0; - lss->close_delay = 0; -} - -static void -linux_tiocsserial(struct file *fp, struct linux_serial_struct *lss) -{ - if (!fp || !lss) - return; -} - struct linux_cdrom_msf { u_char cdmsf_min0; @@ -803,7 +785,7 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args) case LINUX_TIOCGETD: bsd_line = TTYDISC; - error =(*func)(fp, TIOCSETD, (caddr_t)&bsd_line, p); + error =(*func)(fp, TIOCGETD, (caddr_t)&bsd_line, p); if (error) return error; switch (bsd_line) { @@ -1031,13 +1013,27 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args) args->cmd = SOUND_MIXER_READ_DEVMASK; return ioctl(p, (struct ioctl_args *)args); - case LINUX_TIOCGSERIAL: - linux_tiocgserial(fp, (struct linux_serial_struct *)args->arg); - return 0; + case LINUX_TIOCGSERIAL: { + struct linux_serial_struct lss; + + lss.type = LINUX_PORT_16550A; + lss.flags = 0; + lss.close_delay = 0; + return copyout((caddr_t)&lss, (caddr_t)args->arg, sizeof(lss)); + } + + case LINUX_TIOCSSERIAL: { + struct linux_serial_struct lss; - case LINUX_TIOCSSERIAL: - linux_tiocsserial(fp, (struct linux_serial_struct *)args->arg); + error = copyin((caddr_t)args->arg, (caddr_t)&lss, sizeof(lss)); + if (error) + return error; + /* + * XXX - It really helps to have an implementation that does nothing. + * NOT! + */ return 0; + } case LINUX_TCXONC: switch (args->arg) { |