diff options
author | netchild <netchild@FreeBSD.org> | 2006-03-18 18:20:17 +0000 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2006-03-18 18:20:17 +0000 |
commit | c1829f604cdf8a3f393bfa6cb85fe9a6d4908919 (patch) | |
tree | 0bfbd4f21076e4935e7376b8d0502c8d258d4cfa /sys/compat/linux/linux_ioctl.c | |
parent | d4f801f4ab01a2c0d88e59ddabc9757533800554 (diff) | |
download | FreeBSD-src-c1829f604cdf8a3f393bfa6cb85fe9a6d4908919.zip FreeBSD-src-c1829f604cdf8a3f393bfa6cb85fe9a6d4908919.tar.gz |
Get rid of the need of COMPAT_43 in the linuxolator.
Submitted by: Divacky Roman <xdivac02@stud.fit.vutbr.cz>
Obtained from: DragonFly (some parts)
Diffstat (limited to 'sys/compat/linux/linux_ioctl.c')
-rw-r--r-- | sys/compat/linux/linux_ioctl.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index 14568e2..a8e494d 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -2280,6 +2280,29 @@ linux_gifhwaddr(struct ifnet *ifp, struct l_ifreq *ifr) return (ENOENT); } + + /* +* If we fault in bsd_to_linux_ifreq() then we will fault when we call +* the native ioctl(). Thus, we don't really need to check the return +* value of this function. +*/ +static int +bsd_to_linux_ifreq(struct ifreq *arg) +{ + struct ifreq ifr; + size_t ifr_len = sizeof(struct ifreq); + int error; + + if ((error = copyin(arg, &ifr, ifr_len))) + return (error); + + *(u_short *)&ifr.ifr_addr = ifr.ifr_addr.sa_family; + + error = copyout(&ifr, arg, ifr_len); + + return (error); +} + /* * Socket related ioctls */ @@ -2411,8 +2434,9 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args) break; case LINUX_SIOCGIFADDR: - args->cmd = OSIOCGIFADDR; + args->cmd = SIOCGIFADDR; error = ioctl(td, (struct ioctl_args *)args); + bsd_to_linux_ifreq((struct ifreq *)args->arg); break; case LINUX_SIOCSIFADDR: @@ -2422,18 +2446,21 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args) break; case LINUX_SIOCGIFDSTADDR: - args->cmd = OSIOCGIFDSTADDR; + args->cmd = SIOCGIFDSTADDR; error = ioctl(td, (struct ioctl_args *)args); + bsd_to_linux_ifreq((struct ifreq *)args->arg); break; case LINUX_SIOCGIFBRDADDR: - args->cmd = OSIOCGIFBRDADDR; + args->cmd = SIOCGIFBRDADDR; error = ioctl(td, (struct ioctl_args *)args); + bsd_to_linux_ifreq((struct ifreq *)args->arg); break; case LINUX_SIOCGIFNETMASK: - args->cmd = OSIOCGIFNETMASK; + args->cmd = SIOCGIFNETMASK; error = ioctl(td, (struct ioctl_args *)args); + bsd_to_linux_ifreq((struct ifreq *)args->arg); break; case LINUX_SIOCSIFNETMASK: |