Commit Graph

1378 Commits

Author SHA1 Message Date
ad 087fdb9080 Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.
2007-02-15 20:32:47 +00:00
ad d0a51fd23b Fix Linux compat on amd64. 2007-02-15 15:13:33 +00:00
mlelstv 8d08c62fcc Make setsockopt return compatible error codes for AF_UNIX sockets. 2007-02-11 08:00:59 +00:00
ad 88cb6cb846 Acquire proclist_mutex before sending signals. 2007-02-09 23:51:20 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
njoly 0d81683020 Add a new linux_emuldata_shared flag value LINUX_LES_USE_NPTL to allow
both NPTL and old linuxthreads behaviour depending on process needs.

Apply to exit_group(), getpid() and getppid() to share them between
compat linux32 (non NPTL) and compat linux (NPTL) on amd64.

ok by manu and christos
2007-02-05 18:31:36 +00:00
hubertf eda05c6413 Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
2007-01-29 01:52:43 +00:00
elad 1113a3afe4 Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-05 15:40:51 +00:00
elad b31e9c44cf Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 18:27:36 +00:00
elad 0ffd2bf379 Adapt to recent machdep scope changes.
Pointed out by Kouichirou Hiratsuka, thanks!
2006-12-26 16:42:06 +00:00
elad c96fdfd49b Part of PR/33280: Christian Ehrhardt: The call to FILE_USE should be
immediatly before the FREAD | FWRITE test not after it or FILE_UNUSE will
be called after the jump to out without a corresponding FILE_USE.
2006-11-25 22:03:41 +00:00
wiz 6919c6578c s/independant/independent/, from Zafer. 2006-11-24 22:04:21 +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
cbiere 4b14bb6309 Changed error message of ENOPROTOOPT to "Protocol option not available". 2006-10-31 00:38:06 +00:00
christos a2161fece4 sprinkle __unused. 2006-10-14 18:57:06 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos ed106f137b Coverity CID 2990: fix memory leak (from Arnaud Lacombe) 2006-09-29 14:24:55 +00:00
pavel 3cdb79bdae Replace homegrown tests for FIFO (... & S_IFIFO) by S_ISFIFO. The old code
was "correct" by luck - we don't have any other file type whose S_IF* bits
in sys/stat.h overlap with S_IFIFO.

Originally discovered by Paul Stoeber in OpenBSD.
2006-09-25 16:16:18 +00:00
dbj 2df12fb8b5 use _KERNEL_OPT instead of _LKM to check whether to include "opt_ktrace.h" 2006-09-24 21:44:58 +00:00
dogcow e15e9231e6 opt_ktrace.h doesn't exist when building LKMs. 2006-09-24 05:48:27 +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
christos 487c57538b Pretend to implement TIOCSPTLCK. Although failing is harmless, there is no
point in doing so.
2006-09-22 15:12:02 +00:00
manu 876294b403 Proprely convert devices on amd64 2006-09-20 09:54:55 +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
christos 46c5717199 avoid empty if body. 2006-09-13 00:52:07 +00:00
christos 6a76f8e0d2 Avoid empty body in if 2006-09-13 00:51:12 +00:00
christos 193447d4bd avoid empty if 2006-09-13 00:49:07 +00:00
christos de02317b32 comment out impossible code 2006-09-02 06:53:17 +00:00
christos c4501e2800 fix incomplete initializer 2006-09-02 06:52:13 +00:00
matt 2e04559304 When calling PTRACE from an LKM, use sysent[SYS_ptrace].sy_call in case
the sys_ptrace symbol isn't present.
2006-09-01 21:20:46 +00:00
matt 280b69066a Regen. 2006-09-01 21:19:44 +00:00
matt 30183e299f Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt
with differently.
2006-09-01 20:58:18 +00:00
he 7fae0d129f Allow this to build as an LKM by testing for _KERNEL_OPT before
including opt_ptrace.h.
2006-08-30 17:14:34 +00:00
matt 3a7b10b907 Regen 2006-08-30 11:19:23 +00:00
matt ad6aa2b08e Update to deal with options PTRACE 2006-08-30 11:14:39 +00:00
manu 432f035fa6 The return value for Linux shmat on amd64 does not suffer the same horrible
hack as on i386.
2006-08-24 16:36:59 +00:00
dogcow 51faed03f9 move #ifdef up a few lines to prevent unused variable warning/error 2006-08-23 21:17:48 +00:00
bjh21 a707189c87 Use VALID_R15_PSR() to check the context we're restoring in
linux_sys_sigreturn().  Somehow this got missed when I introduced that macro.
2006-08-23 21:16:58 +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
manu a640310a53 typo 2006-07-24 19:01:49 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
manu 2e26811b6b If the user process requests a non null timeout, make sure we do not turn
it into an infinite timeout because of a conversion
2006-07-09 18:51:28 +00:00
pavel a78062784c Use the new socket call for Linux and SVR4, because those systems (at
least Linux 2.4.31, Irix 6.5.20 and Solaris 10) use EAFNOSUPPORT.

Only the Linux emulation has been tested.

XXX somebody should audit the other emulations...
2006-06-27 09:09:40 +00:00
mrg e2eb31d3a3 version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
2006-06-26 21:23:56 +00:00
manu 0a52064ba3 Do not implement exit_group() the right way on platforms that do not
define LINUX_NPTL yet, that cause firefox-bin to fail.
2006-06-26 07:42:00 +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
he fe98fdf977 Regenerate after fixing the getpriority syscall definition. 2006-06-13 22:24:34 +00:00
he e100449f69 We need the argument structure for the getpriority syscall defined, so
change NOARGS to STD.
2006-06-13 22:23:03 +00:00
christos 9d7289ea69 change 20 to NZERO; pointed out by mrg. 2006-06-13 16:54:56 +00:00
christos 155721b1be don't allocate a crapload of struct's on the stack. Use a couple of unions
and use malloc for them.
2006-06-12 00:42:18 +00:00
christos 9cfe87267e PR/33671: Nicolas Joly: Add a getpriority syscall to account for the fact
that the linux getpriority is off by 20.
2006-06-10 21:18:11 +00:00
christos ee08f35b9a regen 2006-06-10 21:16:49 +00:00
christos c02c268f6b linux getpriority is off-by-20 so use our own function.
From PR/33671: Nicolas Joly
2006-06-10 21:15:33 +00:00
kardel de4337ab21 merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
2006-06-07 22:33:33 +00:00
yamt 9c86170376 include kauth.h for kauth_cred_getgid. 2006-05-15 13:12:13 +00:00
yamt 88f8ec6c15 include kauth.h for kauth_authorize_generic. 2006-05-15 13:11:29 +00:00
yamt 17e49bf47c include kauth.h for kauth_cred_geteuid, etc. 2006-05-15 13:11:00 +00:00
yamt 1e7ca6733e include kauth.h for kauth_cred_getegid, etc. 2006-05-15 13:04:08 +00:00
yamt 6c89e74b38 include kauth.h for kauth_cred_geteuid. 2006-05-15 09:17:05 +00:00
elad 874fef3711 integrate kauth. 2006-05-14 21:19:33 +00:00
christos ca0ec852e6 XXX: GCC uninitialized 2006-05-14 03:40:02 +00:00
mrg 84e6307a04 use socklen_t when talking to the NetBSD side of things 2006-05-12 01:58:55 +00:00
yamt f5ff7e4897 cleanup user.h.
- remove several #include which are not directly related to
  this header anymore.  tweak *.c accordingly.
- update comments.
- move some !_KERNEL #include to proc.h because it's more appropriate
  place these days.
- whitespace.
2006-05-11 11:54:36 +00:00
yamt f3e4e9f8a2 don't allocate struct statvfs on stack as it's too large.
while i'm here, remove some unnecessary casts.
2006-05-10 11:05:34 +00:00
dyoung 448664e102 Use __arraycount(). 2006-03-27 21:27:02 +00:00
erh 8ad33681f8 Fix Coverity issues 2321 and 2320. Make sure to free allocated memory. 2006-03-17 06:01:14 +00:00
jonathan b9c6a2634b Rework Linux sysctl()-emulation, so that on amd64, we return the same
Linux kernel-version as on i386 and ppc (currently 2.4.18), and a date
in Feb 2002.

On all other NetBSD platforms we return a Linux-kernel version of
2.0.38 and a date sometime in 2000, which (AFAIK) predates the
existence of amd64, and therefore predates Linux support for amd64.

To me, it makes much more sense to return the same Linux-kernel-version
and date for both 32-bit x86 and 64-bit x86.

Empirically (and not least), this change also allows SuSE 10 amd64
binaries to run under our Linux amd64 binary emulation (both static
and dynamic-linked, given suitable setup) , which they didn't when we
reported a Linux/x86_64 kernel version of 2.0.38.
2006-03-08 03:55:31 +00:00
thorpej 6e72296875 Remove SET/CLR/ISSET definitions. 2006-03-06 23:19:50 +00:00
yamt ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
perry fbae48b901 Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
2006-02-16 20:17:12 +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
dogcow 663b29bb4a make linux emulation compile on i386 again. 2006-02-09 23:27:08 +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
yamt cab41a8b8a linux_sys_mremap: validate flags. 2006-01-31 14:02:55 +00:00
yamt e8e7ab8637 implement compat_linux mremap. 2006-01-21 13:34:15 +00:00
perry 00d6acb4b6 bare asm -> __asm 2005-12-24 22:59:39 +00:00
christos 55f7db0668 PR/32303: Nicolas Joly: Fix -current amd64 kernel compilation failure with
options COMPAT_LINUX
2005-12-16 14:16:14 +00:00
christos 7330d168b8 proc to lwp change 2005-12-14 18:33:32 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
christos 184ad089a7 - make settime take timespec.
- avoid wrapping of time in settime.
- pass struct proc down so that we can log a detailed message.
2005-12-05 00:16:33 +00:00
rpaulo 462d39494a Remove the debugging printf left in linux_sys_getrlimit(). 2005-11-30 11:36:22 +00:00
jdolecek a2e3927e39 undo linux_sys_exit_group() change _again_ - please do not commit known
broken code
2005-11-29 22:31:59 +00:00
manu 35923ac2fc Threads should not send a signal on exit. 2005-11-29 16:24:41 +00:00
manu 2697809839 To awake all processes sleeping on a futex, set maximum value to 0x7fffffff
instead of -1 (0xffffffff): the value is signed...
2005-11-23 22:38:46 +00:00
manu c06b3dd8a8 Remove a debug printf 2005-11-23 22:23:30 +00:00
manu 23cf341ea0 - Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
2005-11-23 16:14:57 +00:00
chs 001ec1422b include additional headers that are now needed. 2005-11-11 23:22:08 +00:00
jdolecek 95d0b66d28 undo the linux_sys_exit_group() change for now - complete CLONE_THREAD support
is necessary for this to work properly
2005-11-11 22:45:41 +00:00
christos 65de380a95 More ipc support for linux; makes oracle work. From chuq and
jlrodriguez at terra dot es
2005-11-10 18:33:37 +00:00
manu e75bcb9ebf Fix build problem 2005-11-09 21:56:11 +00:00
manu f98d5d856e Improve Linux exit_group emulation by sending a SIGKILL to all other
processes in the group instead of letting them live. It would be better
to properly terminate them.
2005-11-09 14:56:50 +00:00
manu f53c4d1d1e Prevent integer overflow in timout calculation.
changed DEBUG_LINUX to DEBUG_LINUX_FUTEX so that we have less debug
messages on the console
2005-11-09 14:52:18 +00:00
manu 26222780eb Correctly computes futex timeout. 2005-11-08 21:28:49 +00:00
manu d72135b371 Include linux_machdep.h so that LINUX_UNAME_ARCH ges defined (fixes
uname emulation)
2005-11-07 14:17:45 +00:00
manu a5d2387dbb regen 2005-11-06 21:50:28 +00:00
manu 7505cb92a6 Back out sched_{set|get}affinity addition because it breaks the
build again on i386 now it is fixed for other archs (Tom's fix and
mine got in colision)
2005-11-06 18:16:31 +00:00
tron 0c24d80f02 Regen with correct RCS Ids. 2005-11-06 14:25:48 +00:00
manu 35f76b0ac2 ifdef out sched_{get|set}affinity for ports that don't use it yet. That
should fix build.
2005-11-05 23:44:25 +00:00
dogcow b3b0932a5d mirror manu's amd64 changes to implement linux sched_{seg,get}affinity;
the kernel and linux lkm now compile again.
2005-11-05 10:56:48 +00:00
manu 2ae48df4fc regen 2005-11-05 08:11:30 +00:00
manu 0cf4b35fe6 Implement more of Linux futex(2) 2005-11-05 08:07:44 +00:00
manu 41455b2ed0 Implement Linux sched_{set|get}affinity 2005-11-05 08:06:58 +00:00
manu 67fcd6abf5 Fix build when LINUX_NPTL is not defined 2005-11-05 07:26:45 +00:00
manu 2cac35470c Fix a messed up patch 2005-11-05 00:58:57 +00:00
manu 88a5eb33ed Instead of ifdef'ing __amd64__ all the Linux NPTL stuff, introduce an
ifdef LINUX_NPTL.
Also implement SETTLS flag to Linux clone()
2005-11-05 00:47:26 +00:00
chs df018c387b make this compile on m68k by including sys/device.h explicitly.
on other platforms it's apparently included implicitly, probably through cpu.h.
2005-11-04 17:00:43 +00:00
manu b72e0d5382 Fix machine name returned by uname on Linux 2005-11-04 16:58:14 +00:00
manu 78ad642708 regen 2005-11-04 16:57:03 +00:00
manu e7609e6478 Implement Linux futex ang gettid 2005-11-04 16:54:11 +00:00
manu 3b8100b96a register_t is not an int on amd64 2005-11-04 16:52:51 +00:00
manu e1c0c1c9dd Implement Linux futex and gettid system calls for amd64 2005-11-04 16:51:56 +00:00
manu 0a3dbc01d5 build fix 2005-11-04 16:49:55 +00:00
manu b7ba0ebc16 Fix pipe linux emulation on amd64 2005-10-31 18:00:30 +00:00
manu 5d2a593dcd build fix 2005-10-31 17:58:07 +00:00
chs d17f6e14bc add support for the linux PROT_GROWS{DOWN,UP} mprotect() flags.
fixes PR 30008.
2005-10-30 16:25:50 +00:00
christos 6f981830a9 PR/31905: Wolfgang Stukenbrock: Termios ioctls TIOCMBIC and TIOCMBIS missing
in linux emulation code
2005-10-24 12:58:34 +00:00
christos e780c5edaf regen 2005-10-18 19:52:07 +00:00
christos 8fc452caf8 add the missing %% that confused joerg and the parser. 2005-10-18 19:51:47 +00:00
joerg 5e74202601 Regen. 2005-10-18 19:08:51 +00:00
joerg 39fcee12fe sys_uselib is needed by COMPAT_LINUX for EXEC_AOUT. Since it doesn't get
build when EXEC_AOUT is not defined, the syscalls.master entry has to be
conditionalized. Alpha did so already, so let the other archs catch up
with it.

Go-on: christos
2005-10-18 18:37:44 +00:00
christos ca3a193432 factor out some of the osockaddr, omsghdr code. 2005-09-24 15:51:03 +00:00
christos d359ae5c43 MINSIGSTKSZ on linux is different depending on the platform and usually
smaller than ours.
2005-09-19 02:46:49 +00:00
christos ff66f5797e need linux_syscallargs.h to compile, and remove inline function. 2005-09-13 22:08:21 +00:00
jmmv ec93365612 Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program.  This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*.  Therefore, it is disabled by
default in all kernels.  However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).
2005-09-10 19:20:48 +00:00
yamt 0ed4057082 linux_machdepioctl: remove duplicated FILE_USE/UNUSE. 2005-08-21 13:13:50 +00:00
christos 758a209d23 64 bit inode changes. 2005-08-19 02:03:49 +00:00
christos 5ae508513d - include <sys/wait.h> so that this compile
- use the code field directly, instead of redoing the logic.
- XXX: the status field must be wrong. I think that the _WSTATUS()
  should not be used directly.
2005-06-25 02:19:06 +00:00
manu d83c516040 More accurate SIGCHLD code and status for siginfo 2005-06-24 22:57:05 +00:00
manu c8b33aa328 report the right process status 2005-06-22 21:57:30 +00:00
manu 5e803980cd Fix siginfo to return the right child's status. 2005-06-22 20:20:30 +00:00
manu 6593739f61 Implent CLONE_PARENT_SETTID, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
options to clone(). This makes fork() work on amd64.

clone() prototype has changed and the changes is probably revelant on some
other arches.
2005-06-22 15:10:51 +00:00
atatat df13e3579e Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone.  Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
2005-06-20 02:49:18 +00:00
christos 6f86542bb2 remove duplicate declaration. 2005-06-19 23:46:32 +00:00
tsutsui bce385b9f7 Add a const. 2005-06-02 16:54:52 +00:00
drochner c2a5fd0191 more cast-qual fallout 2005-06-02 13:03:27 +00:00
christos fb4b40b7e8 - sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
  an api change.
- avoid variable shadowing.
2005-05-29 22:08:16 +00:00
jmc 36b625d324 Regen 2005-05-23 23:22:27 +00:00
jmc 55c161e3ff Add clock_* POSIX functions. 2005-05-23 23:21:49 +00:00
fvdl 57409f3466 sigreturn doesn't take arguments. Instead, find out where the signal
frame is from the stack pointer in the frame frame.

Also, don't forget to copy %rip back in.
2005-05-22 19:31:15 +00:00
fvdl e83accc0f6 Regen after sigreturn argument change. 2005-05-22 19:29:40 +00:00
fvdl 8251c0b501 Change sigreturn to have no arguments. 2005-05-22 19:29:15 +00:00
fvdl beae305307 Use a modified buildcontext function for Linux signals. It doesn't set
the unused segment registers, it just uses the already used values.
2005-05-22 14:52:12 +00:00
fvdl 33e2d79f47 Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
2005-05-20 12:48:26 +00:00
mrg f56c2db8b9 tramp and vers are used unconditionally, make them visible everywhere. 2005-05-20 01:06:50 +00:00
manu 53fb6703e5 Add support for Linux SA_RESTORER on amd64. 2005-05-19 21:16:29 +00:00
fvdl 046b9a57dc Implement clock_* POSIX functions. 2005-05-16 21:18:34 +00:00
fvdl 5acb6d8367 Regen. 2005-05-16 21:18:18 +00:00
fvdl fe3dd48a91 Add clock_* POSIX functions. 2005-05-16 21:17:11 +00:00
fvdl e18d1a8ee1 Regen. 2005-05-16 16:03:58 +00:00
fvdl 711b0df630 Add *xattr functions (they all return EOPNOTSUPP). 2005-05-16 16:02:19 +00:00
fvdl 2d668e070c Include linux_sigevent.h (to be used later). 2005-05-16 16:00:31 +00:00
fvdl 33e6ca90d5 Add Linux sigevent definitions. 2005-05-16 15:56:41 +00:00
fvdl 7d91366682 Fix up COMPAT_LINUX support for amd64. Still a work in progress, not
usable yet ("Hello World" runs, but many other things do not work).
2005-05-15 21:44:41 +00:00
fvdl 49395ac65e Make the arch_prctl system call use the saved %gs and %fs mechanism. 2005-05-15 21:43:08 +00:00
jmc 9962871387 #endif for LINUX_SS_ONSTACK needs to go after linux_sys_sigaltstack or builds
break on platforms that don't define it (alpha, sparc)
2005-05-09 19:04:50 +00:00
manu 89647c7ca6 First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
2005-05-03 16:26:27 +00:00
christos a5fb891bb9 PR/29696: Joel Carnat: NetBSD freezes when accessing smbfs mounted FS with
firefox/linux due to compat getdents() call assumption that all filesystems
support cookies.
2005-04-19 19:00:25 +00:00
christos 14685cd241 s/uvm_map_defaultaddr/uvm_default_mapaddr/ HI FRANK! 2005-03-26 17:10:43 +00:00
fvdl c487efe4a7 Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
  that will return the default VM map address. The default function
  is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
  macro. This gives emulations control over the default map address,
  and allows things to be mapped at the right address (in 32bit range)
  for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
  or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
  instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
2005-03-26 05:12:34 +00:00
christos 37e322ddf6 revert part of previous commit (the block size type and the pad renumbering).
tron says it breaks compat mode.
2005-03-10 23:39:27 +00:00
christos 47e40fce3a Add nanosecond handling on the stat and stat64 code for the i386. 2005-03-10 14:12:27 +00:00
soren 18d6a3043f Emulate basic mtio ioctls. 2005-02-28 22:11:31 +00:00
soren 4f02ad16c6 Remove duplicate statement. 2005-02-28 22:10:46 +00:00
perry 77f2a006d0 regen 2005-02-26 23:58:19 +00:00
perry a7f74206ba regen 2005-02-26 23:20:00 +00:00
perry 477853c351 nuke trailing whitespace 2005-02-26 22:58:54 +00:00
martin 6192fdeaf6 Fix number of elements calculation when converting socket options.
Fixes bugs 4 and 5 reported by Ted Unangst on tech-kern.
2005-02-24 08:15:53 +00:00
soren f4fa62bcd9 SG_GET_VERSION_NUM returns an int. Also make the version number patchable. 2005-02-13 12:53:54 +00:00
christos d59582c127 Don't zero out the linux request; we still need values from it.
Limit the sense len to the linux input buffer.
2005-02-13 09:05:31 +00:00
christos 47be3434ec We were zeroing out the wrong struct. 2005-02-13 09:01:25 +00:00
christos e042c0475e Add scsi-generic stuff. 2005-02-03 00:09:30 +00:00
christos d3b9209df0 Add linux scsi-generic to work for simple cases. Allows gendalia's change
to limp along. From soren with fixes from me.
2005-02-03 00:09:09 +00:00
christos 0b71a2d5de Don't try to map a 0 size bss. 2005-01-30 23:59:57 +00:00
abs 5958dd944e Fix comments slighly 2004-12-12 20:42:53 +00:00
christos 040c934485 Remove setup stack function. It moved to linux_exec_machdep.c. 2004-11-13 08:58:23 +00:00
christos b7286f5ccd Add ptyfs pty device number translation. 2004-11-13 07:20:54 +00:00
christos 1265044e00 add LINUX_TIOCGPTN 2004-11-13 07:20:35 +00:00
christos 44264ea2a6 Add ptyfs magic number and entry. 2004-11-13 07:19:27 +00:00
christos d5b128a728 Add LINUX_TIOCGPTN for ptyfs pty emulation. 2004-11-13 07:18:34 +00:00
christos 7bd9648b13 Split out the setup stack function for the benefit of lkms.
XXX: Our lkm system sucks. We really need to be exporting symbols, but
that leads to symbol conflicts.
2004-11-13 06:01:34 +00:00
thorpej 42b8fac3b8 Move boot device detection code from i386 and amd64 ports to x86_autoconf.c.
Rename i386_alldisks and x86_64_alldisks to x86_alldisks, adjust other
references to compensate.
2004-10-20 04:20:05 +00:00
erh f747989e34 PR kern/27184: Have linux_sys_waitpid() call linux_sys_wait4() so the
supported options can't get out of sync.  This add support for the
  linux __WCLONE and __WALL options (NetBSD version: WALTSIG and WALLSIG)
Add a diagnostic check to see if the one unhandled option (__WNOTHREAD) is
  specified.
This should prevent linux processes from losing their children and creating
  tons of zombie processes.
2004-10-07 19:30:28 +00:00
jdolecek 6513aa8291 regen: generate struct linux_sys_shmget_args for linux_sys_shmget(2) 2004-10-05 06:02:36 +00:00
jdolecek 361bf102b8 mark linux_sys_shmget() STD, so that appropriate struct linux_sys_shmget_args
would be defined for use by alpha linux_sysent.c
2004-10-05 06:01:20 +00:00
jdolecek decdc3f95c regen - now using wrapper for shmget(2) 2004-09-28 19:05:58 +00:00
jdolecek f64366a240 add flag for shmget(2) to specify that later shmat(2) for the shared memory
segment should succeed even if the segment would be marked removed; use this
to implement the Linux-compatible semantics of shmat(2)

this fixes the old Linux VMware3 graphics problem with local display,
and possibly other local Linux X clients using MIT-SHM
2004-09-28 19:05:19 +00:00
jdolecek 68ee548306 fold shmat1() back into sys_shmat(), the change in rev 1.64 is not sufficient
for Linux-compatible shmat() behaviour - shmat() for the removed shared memory
segment must work from all callers, the shared memory id could be passed e.g.
to native X server via MIT-SHM

temporarily remove the functionality, the Linux-compatible semantics
will be reimplemented differently
2004-09-28 17:26:25 +00:00
he 9f596d4761 Since the implementation of bsd_to_linux_statfs64() is conditional,
also make the forward declaration conditional.  Fixes compile
problem for m68k ports.
2004-09-24 13:10:46 +00:00
jdolecek 81ed8f7972 move definition of linux_fsid_t to common/linux_types.h - it's identical
across all Linux archs
2004-09-20 18:51:55 +00:00
jdolecek 43b3feff28 regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
2004-09-20 18:42:23 +00:00
jdolecek 110cc1cc61 implement support for Linux statfs64() syscall - 64bit variant of statfs() 2004-09-20 18:41:07 +00:00
christos dbac2396e8 Add a linux_fsid_t typedef for the ports that don't have architecture dependent
linux_types.h. Fixes sparc build.
2004-09-20 03:21:40 +00:00
jdolecek 48373456d4 Adjust struct statfs content to flag that the newer Linux kernel do
provide f_frsize. It cannot be actually used to GNU C statvfs() bug
in f_frsize != f_bsize case, so just keep pretending we don't support it.
Update comments and explain the situation in detail there.
2004-09-19 16:50:11 +00:00
jdolecek 2580579147 move definition of struct linux_stafs to common/linux_types.h, and use
explicit size types - the structure definition is actually identical
on currently support COMPAT_LINUX archs, so no point to have 6 copies of it
in the tree
2004-09-19 15:06:32 +00:00
skrll f7155e40f6 There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
2004-09-17 14:11:20 +00:00
jdolecek f16bab2269 bsd_to_linux_statfs():
- filesystem size is expressed in number of fragments, not blocks;
  this fixes computed filesystem sizes for Linux df(1) and other Linux
  binaries using statfs(2) for filesystems, which use different value
  for frament and block, such as FFS
- use FS f_namemax instead of always using MAXNAMLEN
2004-09-13 20:09:44 +00:00
jdolecek 9cc50db4c5 if passed sockaddr has family AF_UNSPEC, use socket family of the socket
the sockaddr is used for

this fixes bind() problem in Linux version of Theocracy, testing
by Thomas Klausner
2004-09-12 15:32:55 +00:00