Commit Graph

45 Commits

Author SHA1 Message Date
njoly 471f710a5a Sync with recent compat linux termios changes. 2007-03-26 13:46:50 +00:00
njoly 1f4051d826 Fix generated file names from makesyscalls.sh (s/linux/linux32/).
From Edgar Fuß in PR/35956.
2007-03-23 12:26:10 +00:00
njoly f408971232 Fix TIOCGPTN ioctl.
Do not use sysioctl() directly, but netbsd32_ioctl() instead.
2007-03-19 10:16:46 +00:00
dsl d364d308c7 Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx). 2007-03-18 21:38:32 +00:00
dsl a065e51621 remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers.  Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
2007-03-16 22:21:40 +00:00
dsl 6803111cb3 Fix amd64 build for compat sys_stat() changes.
This file isn't included in amd64:GENERIC
2007-03-11 19:36:37 +00:00
dsl 893faeae9e Update all the compat stuff to not use the 'stackgap' for processing
sys_stat() and friends, instead use do_sys_stat() and do_sys_fstat()
that write the answer into a kernel buffer (on stack) that can be
converted to the correct form and written the userspace.
I've test compiled a few kernels, and tested i386 netbsd1.6 ls.
Given I think I've fixed some bugs, it might be 50-50 with new ones.
2007-03-10 21:40:23 +00:00
christos 033371b01a fix caddr_t lossage 2007-03-05 14:24:18 +00:00
christos c74f0279ea more caddr_t lossage. 2007-03-05 14:13:10 +00:00
christos a4c52808c6 fix caddr_t lossage. 2007-03-05 05:10:04 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
pavel 934634a18c Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
2007-02-17 22:31:36 +00:00
njoly 5f6b6270e4 Regen. 2007-02-16 20:49:40 +00:00
njoly 11f77cf45a Add support for a few syscalls:
setfsuid16/getfsuid16
setfsuid/getfsuid
sched_yield

ok by manu
2007-02-16 20:49:06 +00:00
ad 12460decf9 Fix COMPAT_LINUX32. 2007-02-15 15:29:07 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
njoly 8fbf55addb Regen (aliases cleanup). 2007-02-08 12:32:17 +00:00
njoly fb1562ae0f Remove some aliases, for syscalls that use their netbsd32 equivalent.
This makes the ktrace output more consistent.

ok by manu.
2007-02-08 12:29:39 +00:00
njoly 835e659d6b Regen (poll argument fix). 2007-02-07 15:35:00 +00:00
njoly 398ec1833a Use netbsd32_pollfdp_t instead of wrong `struct pollfd *'.
ok by manu.
2007-02-07 15:32:52 +00:00
christos 91ad430f6c adjust_limits takes p, not l again 2006-11-22 13:56:09 +00:00
christos 1882355e27 From Nicolas Joly:
> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.
2006-11-21 14:32:27 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
elad 68f43d80fe Clean some KAUTH_GENERIC_ISSUSER usage in compat code. 2006-11-14 13:34:29 +00:00
manu 63ac93df54 Add sysctl tracing to emulations.
While we are there, fix a bug in FreeBSD sysctl emulation: use copyin for
moving data to the kernel
2006-09-23 22:11:59 +00:00
manu 717102f4bb Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
  and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
2006-09-13 19:55:49 +00:00
manu 99bb1b27be This file was not used anymore 2006-09-13 19:47:30 +00:00
manu f0cbe4f3bf Implement Linux's fdatasync, patch from Nicolas Joly 2006-09-06 12:01:23 +00:00
manu 84b03d19fe Fix linux32_sys_setres{uid|gid}: -1 does not means the same thing on i386
and amd64...
2006-09-06 08:32:00 +00:00
manu 4d5f807455 Fix linux32_sys_sysctl, it was horribly broken. 2006-09-05 17:12:19 +00:00
manu ea514e44f5 typo 2006-09-05 08:17:09 +00:00
matt 280b69066a Regen. 2006-09-01 21:19:44 +00:00
manu 753fce01f4 netbsd32_sys_ioctl was called with improper syscall argument structure, this
caused any X11 program to fail because FIONREAD ioctl always returned an
error.
2006-08-25 16:17:05 +00:00
manu 01f2e16aa8 Add support for socket ioctl. 2006-08-25 08:25:03 +00:00
manu 81c909dd45 1) Complete Linux exit_group() emulation
Members of the thread group must die without reporting to the parent and
without going to zombie stage. We do that by reparenting to init before
catching a SIGKILL. The parent will not see the child death.

The thread group leader must report the exit status, even if it exits
because of another thread calling exit_group(). We do that by storing the
exit status in struct linux_emuldata_shared, and the exit hook has the
duty of setting struct proc's p_xstat for the thread group leader.

2) For exit/fork/exec hooks, move the NPTL specific code to separate functions
that are shared between COMPAT_LINUX and COMPAT_LINUX32

3) Fix LINUX_CLONE_PARENT_SETTID semantics
2006-08-23 19:49:09 +00:00
manu 05c8a1b827 Add a new signature test for linux probe function. We look for a .debuglink
section, which is specific to the Linux dynamic interpeter (yes, Linux
can execute it as a stand alone program)
2006-08-07 14:19:57 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
manu ce7e36a5a9 Regen 2006-06-25 16:16:52 +00:00
manu b7432513dc - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
2006-06-25 16:15:39 +00:00
skd 99e52fdeb8 include kauth.h
workaround a gcc4 warning.
2006-06-13 16:23:57 +00:00
elad 874fef3711 integrate kauth. 2006-05-14 21:19:33 +00:00
manu c7fca50583 Fix compat_linux32 time(2) emulation 2006-02-24 06:39:47 +00:00
manu 5e9b532be2 Add getcwd (for real this time), fix dup and dup2 2006-02-15 15:23:18 +00:00
manu f806470fb3 - Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
2006-02-15 09:31:17 +00:00
manu ee0c5b44de Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
2006-02-09 19:18:56 +00:00