linux_ioctl.c (83130) | linux_ioctl.c (83221) |
---|---|
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 83130 2001-09-06 02:40:43Z jlemon $ | 28 * $FreeBSD: head/sys/compat/linux/linux_ioctl.c 83221 2001-09-08 19:07:04Z marcel $ |
29 */ 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/sysproto.h> 34#include <sys/proc.h> 35#include <sys/cdio.h> 36#include <sys/consio.h> --- 1337 unchanged lines hidden (view full) --- 1374 args->cmd = OSIOCGIFNETMASK; 1375 return (ioctl(p, (struct ioctl_args *)args)); 1376 1377 case LINUX_SIOCGIFHWADDR: { 1378 int ifn; 1379 struct ifnet *ifp; 1380 struct ifaddr *ifa; 1381 struct sockaddr_dl *sdl; | 29 */ 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/sysproto.h> 34#include <sys/proc.h> 35#include <sys/cdio.h> 36#include <sys/consio.h> --- 1337 unchanged lines hidden (view full) --- 1374 args->cmd = OSIOCGIFNETMASK; 1375 return (ioctl(p, (struct ioctl_args *)args)); 1376 1377 case LINUX_SIOCGIFHWADDR: { 1378 int ifn; 1379 struct ifnet *ifp; 1380 struct ifaddr *ifa; 1381 struct sockaddr_dl *sdl; |
1382 struct linux_ifreq *ifr = (struct linux_ifreq *)args->arg; | 1382 struct l_ifreq *ifr = (struct l_ifreq *)args->arg; |
1383 1384 /* Note that we don't actually respect the name in the ifreq 1385 * structure, as Linux interface names are all different. 1386 */ 1387 for (ifn = 0; ifn < if_index; ifn++) { 1388 ifp = ifnet_byindex(ifn); 1389 if (ifp->if_type == IFT_ETHER) { 1390 ifa = TAILQ_FIRST(&ifp->if_addrhead); --- 28 unchanged lines hidden (view full) --- 1419 1420/* 1421 * main ioctl syscall function 1422 */ 1423 1424int 1425linux_ioctl(struct proc *p, struct linux_ioctl_args *args) 1426{ | 1383 1384 /* Note that we don't actually respect the name in the ifreq 1385 * structure, as Linux interface names are all different. 1386 */ 1387 for (ifn = 0; ifn < if_index; ifn++) { 1388 ifp = ifnet_byindex(ifn); 1389 if (ifp->if_type == IFT_ETHER) { 1390 ifa = TAILQ_FIRST(&ifp->if_addrhead); --- 28 unchanged lines hidden (view full) --- 1419 1420/* 1421 * main ioctl syscall function 1422 */ 1423 1424int 1425linux_ioctl(struct proc *p, struct linux_ioctl_args *args) 1426{ |
1427 struct filedesc *fdp = p->p_fd; | 1427 struct filedesc *fdp; |
1428 struct file *fp; 1429 struct handler_element *he; 1430 int error, cmd; 1431 1432#ifdef DEBUG 1433 if (ldebug(ioctl)) 1434 printf(ARGS(ioctl, "%d, %04lx, *"), args->fd, args->cmd); 1435#endif 1436 | 1428 struct file *fp; 1429 struct handler_element *he; 1430 int error, cmd; 1431 1432#ifdef DEBUG 1433 if (ldebug(ioctl)) 1434 printf(ARGS(ioctl, "%d, %04lx, *"), args->fd, args->cmd); 1435#endif 1436 |
1437 fdp = p->p_fd; |
|
1437 if ((unsigned)args->fd >= fdp->fd_nfiles) 1438 return (EBADF); | 1438 if ((unsigned)args->fd >= fdp->fd_nfiles) 1439 return (EBADF); |
1439 | |
1440 fp = fdp->fd_ofiles[args->fd]; 1441 if (fp == NULL || (fp->f_flag & (FREAD|FWRITE)) == 0) 1442 return (EBADF); 1443 1444 /* Iterate over the ioctl handlers */ 1445 cmd = args->cmd & 0xffff; 1446 TAILQ_FOREACH(he, &handlers, list) { 1447 if (cmd >= he->low && cmd <= he->high) { --- 71 unchanged lines hidden --- | 1440 fp = fdp->fd_ofiles[args->fd]; 1441 if (fp == NULL || (fp->f_flag & (FREAD|FWRITE)) == 0) 1442 return (EBADF); 1443 1444 /* Iterate over the ioctl handlers */ 1445 cmd = args->cmd & 0xffff; 1446 TAILQ_FOREACH(he, &handlers, list) { 1447 if (cmd >= he->low && cmd <= he->high) { --- 71 unchanged lines hidden --- |