aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_ioctl.c
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2004-08-16 07:28:16 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2004-08-16 07:28:16 +0000
commit4af27623361335eef9a191f7d3a76047095d0f52 (patch)
tree8df9260c749ffef486077cca195f2e786112fc5d /sys/compat/linux/linux_ioctl.c
parent0e73a96209a64276238d8a875e70f7e0bb2741f6 (diff)
downloadsrc-4af27623361335eef9a191f7d3a76047095d0f52.tar.gz
src-4af27623361335eef9a191f7d3a76047095d0f52.zip
Changes to MI Linux emulation code necessary to run 32-bit Linux binaries
on AMD64, and the general case where the emulated platform has different size pointers than we use natively: - declare certain structure members as l_uintptr_t and use the new PTRIN and PTROUT macros to convert to and from native pointers. - declare some structures __packed on amd64 when the layout would differ from that used on i386. - include <machine/../linux32/linux.h> instead of <machine/../linux/linux.h> if compiling with COMPAT_LINUX32. This will need to be revisited before 32-bit and 64-bit Linux emulation support can coexist in the same kernel. - other small scattered changes. This should be a no-op on i386 and Alpha.
Notes
Notes: svn path=/head/; revision=133816
Diffstat (limited to 'sys/compat/linux/linux_ioctl.c')
-rw-r--r--sys/compat/linux/linux_ioctl.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index 0ee8e8e6c445..677d8ffccdbc 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -56,8 +56,15 @@ __FBSDID("$FreeBSD$");
#include <net/if_dl.h>
#include <net/if_types.h>
+#include "opt_compat.h"
+
+#if !COMPAT_LINUX32
#include <machine/../linux/linux.h>
#include <machine/../linux/linux_proto.h>
+#else
+#include <machine/../linux32/linux.h>
+#include <machine/../linux32/linux32_proto.h>
+#endif
#include <compat/linux/linux_ioctl.h>
#include <compat/linux/linux_mib.h>
@@ -2081,7 +2088,11 @@ ifname_linux_to_bsd(const char *lxname, char *bsdname)
static int
linux_ifconf(struct thread *td, struct ifconf *uifc)
{
+#if COMPAT_LINUX32
+ struct l_ifconf ifc;
+#else
struct ifconf ifc;
+#endif
struct l_ifreq ifr;
struct ifnet *ifp;
struct ifaddr *ifa;
@@ -2094,7 +2105,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
return (error);
/* handle the 'request buffer size' case */
- if (ifc.ifc_buf == NULL) {
+ if (ifc.ifc_buf == PTROUT(NULL)) {
ifc.ifc_len = 0;
TAILQ_FOREACH(ifp, &ifnet, if_link) {
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
@@ -2108,7 +2119,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
}
/* much easier to use uiomove than keep track ourselves */
- iov.iov_base = ifc.ifc_buf;
+ iov.iov_base = PTRIN(ifc.ifc_buf);
iov.iov_len = ifc.ifc_len;
uio.uio_iov = &iov;
uio.uio_iovcnt = 1;