From: Alex Hornung Date: Mon, 15 Mar 2010 19:08:42 +0000 (+0000) Subject: linux emu - iron out bugs X-Git-Tag: v2.7.0~81 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/1ee65745e2ea6a81c9a06b08f0637840f978660f linux emu - iron out bugs * mmap: make sure that PROT_READ is not set if PROT_NONE is specified. * sysinfo: Updata sysinfo to the new structure used since linux 2.3.something. --- diff --git a/sys/emulation/linux/i386/linux_machdep.c b/sys/emulation/linux/i386/linux_machdep.c index c3b525960c..a02cd51fd9 100644 --- a/sys/emulation/linux/i386/linux_machdep.c +++ b/sys/emulation/linux/i386/linux_machdep.c @@ -699,7 +699,11 @@ linux_mmap_common(caddr_t linux_addr, size_t linux_len, int linux_prot, len = linux_len; } - prot = linux_prot | PROT_READ; + prot = linux_prot; + + if (prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) + prot |= PROT_READ | PROT_EXEC; + if (linux_flags & LINUX_MAP_ANON) { fd = -1; } else { diff --git a/sys/emulation/linux/linux_misc.c b/sys/emulation/linux/linux_misc.c index 124d8409d8..a66c572bf8 100644 --- a/sys/emulation/linux/linux_misc.c +++ b/sys/emulation/linux/linux_misc.c @@ -107,7 +107,11 @@ struct l_sysinfo { l_ulong totalswap; /* Total swap space size */ l_ulong freeswap; /* swap space still available */ l_ushort procs; /* Number of current processes */ - char _f[22]; /* Pads structure to 64 bytes */ + l_ushort pad; /* explicit padding */ + l_ulong totalhigh; /* Total high memory size */ + l_ulong freehigh; /* Available high memory size */ + l_uint mem_unit; /* Memory unit size in bytes */ + char _f[20-2*sizeof(l_long)-sizeof(l_int)]; /* Padding for libc5 */ }; int @@ -174,7 +178,10 @@ sys_linux_sysinfo(struct linux_sysinfo_args *args) } rel_mplock(); - sysinfo.procs = 20; /* Hack */ + sysinfo.procs = nprocs; + sysinfo.totalhigh = 0; + sysinfo.freehigh = 0; + sysinfo.mem_unit = 1; /* Set the basic mem unit to 1 */ error = copyout(&sysinfo, (caddr_t)args->info, sizeof(sysinfo)); return (error);