Deleted Added
full compact
linux_ioctl.c (89306) linux_ioctl.c (89319)
1/*
2 * Copyright (c) 1994-1995 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
1/*
2 * Copyright (c) 1994-1995 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/compat/linux/linux_ioctl.c 89306 2002-01-13 11:58:06Z alfred $
28 * $FreeBSD: head/sys/compat/linux/linux_ioctl.c 89319 2002-01-14 00:13:45Z alfred $
29 */
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/sysproto.h>
34#include <sys/cdio.h>
35#include <sys/dvdio.h>
36#include <sys/consio.h>

--- 67 unchanged lines hidden (view full) ---

104
105static int
106linux_ioctl_disk(struct thread *td, struct linux_ioctl_args *args)
107{
108 struct file *fp;
109 int error;
110 struct disklabel dl;
111
29 */
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/sysproto.h>
34#include <sys/cdio.h>
35#include <sys/dvdio.h>
36#include <sys/consio.h>

--- 67 unchanged lines hidden (view full) ---

104
105static int
106linux_ioctl_disk(struct thread *td, struct linux_ioctl_args *args)
107{
108 struct file *fp;
109 int error;
110 struct disklabel dl;
111
112 fp = ffind_hold(td, args->fd);
113 if (fp == NULL)
114 return (EBADF);
112 if ((error = fget(td, args->fd, &fp)) != 0)
113 return (error);
115 switch (args->cmd & 0xffff) {
116 case LINUX_BLKGETSIZE:
117 error = fo_ioctl(fp, DIOCGDINFO, (caddr_t)&dl, td);
118 fdrop(fp, td);
119 if (error)
120 return (error);
121 return (copyout(&(dl.d_secperunit), (caddr_t)args->arg,
122 sizeof(dl.d_secperunit)));

--- 427 unchanged lines hidden (view full) ---

550linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
551{
552 struct termios bios;
553 struct linux_termios lios;
554 struct linux_termio lio;
555 struct file *fp;
556 int error;
557
114 switch (args->cmd & 0xffff) {
115 case LINUX_BLKGETSIZE:
116 error = fo_ioctl(fp, DIOCGDINFO, (caddr_t)&dl, td);
117 fdrop(fp, td);
118 if (error)
119 return (error);
120 return (copyout(&(dl.d_secperunit), (caddr_t)args->arg,
121 sizeof(dl.d_secperunit)));

--- 427 unchanged lines hidden (view full) ---

549linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
550{
551 struct termios bios;
552 struct linux_termios lios;
553 struct linux_termio lio;
554 struct file *fp;
555 int error;
556
558 fp = ffind_hold(td, args->fd);
559 if (fp == NULL)
560 return (EBADF);
557 if ((error = fget(td, args->fd, &fp)) != 0)
558 return (error);
559
561 switch (args->cmd & 0xffff) {
562
563 case LINUX_TCGETS:
564 error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, td);
565 if (error)
566 break;
567 bsd_to_linux_termios(&bios, &lios);
568 error = copyout(&lios, (caddr_t)args->arg, sizeof(lios));

--- 675 unchanged lines hidden (view full) ---

1244}
1245
1246static int
1247linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
1248{
1249 struct file *fp;
1250 int error;
1251
560 switch (args->cmd & 0xffff) {
561
562 case LINUX_TCGETS:
563 error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, td);
564 if (error)
565 break;
566 bsd_to_linux_termios(&bios, &lios);
567 error = copyout(&lios, (caddr_t)args->arg, sizeof(lios));

--- 675 unchanged lines hidden (view full) ---

1243}
1244
1245static int
1246linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
1247{
1248 struct file *fp;
1249 int error;
1250
1252 fp = ffind_hold(td, args->fd);
1253 if (fp == NULL)
1254 return (EBADF);
1251 if ((error = fget(td, args->fd, &fp)) != 0)
1252 return (error);
1255 switch (args->cmd & 0xffff) {
1256
1257 case LINUX_CDROMPAUSE:
1258 args->cmd = CDIOCPAUSE;
1259 error = (ioctl(td, (struct ioctl_args *)args));
1260 break;
1261
1262 case LINUX_CDROMRESUME:

--- 438 unchanged lines hidden (view full) ---

1701#define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG)
1702
1703static int
1704linux_ioctl_console(struct thread *td, struct linux_ioctl_args *args)
1705{
1706 struct file *fp;
1707 int error;
1708
1253 switch (args->cmd & 0xffff) {
1254
1255 case LINUX_CDROMPAUSE:
1256 args->cmd = CDIOCPAUSE;
1257 error = (ioctl(td, (struct ioctl_args *)args));
1258 break;
1259
1260 case LINUX_CDROMRESUME:

--- 438 unchanged lines hidden (view full) ---

1699#define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG)
1700
1701static int
1702linux_ioctl_console(struct thread *td, struct linux_ioctl_args *args)
1703{
1704 struct file *fp;
1705 int error;
1706
1709 fp = ffind_hold(td, args->fd);
1710 if (fp == NULL)
1711 return (EBADF);
1707 if ((error = fget(td, args->fd, &fp)) != 0)
1708 return (error);
1712 switch (args->cmd & 0xffff) {
1713
1714 case LINUX_KIOCSOUND:
1715 args->cmd = KIOCSOUND;
1716 error = (ioctl(td, (struct ioctl_args *)args));
1717 break;
1718
1719 case LINUX_KDMKTONE:

--- 534 unchanged lines hidden (view full) ---

2254 int error, cmd;
2255
2256#ifdef DEBUG
2257 if (ldebug(ioctl))
2258 printf(ARGS(ioctl, "%d, %04lx, *"), args->fd,
2259 (unsigned long)args->cmd);
2260#endif
2261
1709 switch (args->cmd & 0xffff) {
1710
1711 case LINUX_KIOCSOUND:
1712 args->cmd = KIOCSOUND;
1713 error = (ioctl(td, (struct ioctl_args *)args));
1714 break;
1715
1716 case LINUX_KDMKTONE:

--- 534 unchanged lines hidden (view full) ---

2251 int error, cmd;
2252
2253#ifdef DEBUG
2254 if (ldebug(ioctl))
2255 printf(ARGS(ioctl, "%d, %04lx, *"), args->fd,
2256 (unsigned long)args->cmd);
2257#endif
2258
2262 fp = ffind_hold(td, args->fd);
2263 if (fp == NULL)
2264 return (EBADF);
2259 if ((error = fget(td, args->fd, &fp)) != 0)
2260 return (error);
2265 if ((fp->f_flag & (FREAD|FWRITE)) == 0) {
2266 fdrop(fp, td);
2267 return (EBADF);
2268 }
2269
2270 /* Iterate over the ioctl handlers */
2271 cmd = args->cmd & 0xffff;
2272 TAILQ_FOREACH(he, &handlers, list) {

--- 74 unchanged lines hidden ---
2261 if ((fp->f_flag & (FREAD|FWRITE)) == 0) {
2262 fdrop(fp, td);
2263 return (EBADF);
2264 }
2265
2266 /* Iterate over the ioctl handlers */
2267 cmd = args->cmd & 0xffff;
2268 TAILQ_FOREACH(he, &handlers, list) {

--- 74 unchanged lines hidden ---