Commit Graph

3522 Commits

Author SHA1 Message Date
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
yamt 6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
drochner b3d10c788a regen 2005-03-31 16:36:03 +00:00
drochner 014fa21e82 emulate setreuid()/setregid(), from Eric Schnoebelen per PR
port-alpha/21870
2005-03-31 16:34:54 +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
christos 7254715c73 add file locking. 2005-03-05 17:47:38 +00:00
christos 44f6417295 - someone must have been confused about how to use the stackgap.
- remove extra caddr_t
- cleanup unneeded syscalls.
- add locking.
2005-03-05 17:47:06 +00:00
jdolecek 07ad370ac0 const sptab[] 2005-03-05 17:31:07 +00:00
christos cfa16776df cleanup and fix locking. 2005-03-05 17:16:17 +00:00
christos 8eb274055a Some ibcs2 binaries need executable stacks. Thanks to J Chapman Flack
for determining this and coming up with a fix.
2005-03-03 04:39:37 +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 bcaf99655c remove trailing whitespace after the "created from: NetBSD..." line. 2005-02-26 23:55:49 +00:00
perry ed10d3c508 make this rebuild generated files by default 2005-02-26 23:50:14 +00:00
perry 44e692be50 make this rebuild generated files by default, also clean up and make
more like other similar Makefiles.
2005-02-26 23:49:20 +00:00
perry 84f4fbb117 make this rebuild generated files by default 2005-02-26 23:46:50 +00:00
perry afd17eee3b make this rebuild generated files by default
also, remove unneeded clean target
2005-02-26 23:46:05 +00:00
perry 5acf93db4e make this rebuild generated files by default 2005-02-26 23:44:37 +00:00
perry 6377fcfee3 make this rebuild generated files by default, and don't build .bak files 2005-02-26 23:43:15 +00:00
perry 834b86bb6d eliminate creation of .bak files -- we have source control 2005-02-26 23:42:13 +00:00
perry fa91538c32 make this rebuild generated files by default 2005-02-26 23:35:00 +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
simonb c1530b6999 Remove an erroneous semicolon. 2005-02-26 12:03:15 +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
heas e8dfc3dc8e Re-gen for sysctl emulation 2005-02-22 16:16:48 +00:00
heas b8fe1f6779 Add FreeBSD sysctl emulation for their undocumented special OIDs rooted at
OID 0.  Only OID 0.3 is implemented for now, it 0.3 is the equivalent of
NetBSD's sysctlgetmibinfo().
This includes a new sysctl kern.osreldate with the value __NetBSD_Version__
for kernels with COMPAT_FREEBSD.

Both of these are used by 3ware's FreeBSD tw_cli, which seems to work now.
2005-02-22 16:14:50 +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 be3704c73f pass the flag to fdclone. 2005-02-12 23:14:03 +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
drochner 613f1d9cdb Hmm - vax is different. sendsig_sigcontext() is for __mips only.
Should fix build error found by Havard Eidnes.
2005-01-25 14:56:09 +00:00
matt 027c11539b Add IFNET_FOREACH and IFADDR_FOREACH macros and start using them. 2005-01-24 21:25:09 +00:00
drochner 7c10815d09 use sendsig_sigcontext() directly instead of the generic sendsig() 2005-01-24 10:08:02 +00:00
oki 50d1aadd13 kill __P. 2005-01-22 01:36:59 +00:00
drochner 2eaf2fb804 Use sendsig_sigcontext() as signal delivery function instead
of the generic (NetBSD specific) sendsig().
We can only work with ...sigcontext for now anyway; the
versioning stuff in sendsig() isn't helpful for osf1 emul.
2005-01-16 20:01:48 +00:00
drochner 2fdf16521b Make osf1_sys_sigaction() use the internal sigaction1()
instead of the compat16_ thing.
This saves 2 pointless copyout/copyin cycles to/from
the "stackgap" buffer, and it gets us a step closer
to a COMPAT_OSF! which works w/o COMPAT_16.
This still doesn't support SA_SIGINFO because the old
COMPAT_16 signal trampoline is used.
2005-01-16 19:57:09 +00:00
thorpej 1c95472d01 Add the system call and VFS infrastructure for file system extended
attributes.

From FreeBSD.
2005-01-02 16:08:28 +00:00
christos 5fd3b99d04 check that signum is valid correctly. 2004-12-22 18:16:47 +00:00
abs 5958dd944e Fix comments slighly 2004-12-12 20:42:53 +00:00
christos 31c81b28f5 Cloning cleanup:
1. make fileops const
2. add 2 new negative errno's to `officially' support the cloning hack:
    - EDUPFD (used to overload ENODEV)
    - EMOVEFD (used to overload ENXIO)
3. Created an fdclone() function to encapsulate the operations needed for
   EMOVEFD, and made all cloners use it.
4. Centralize the local noop/badop fileops functions to:
   fnullop_fcntl, fnullop_poll, fnullop_kqfilter, fbadop_stat
2004-11-30 04:25:43 +00:00
kent b285c03873 getdevinfo():
If a mixer item does not match with AudioNsomething, check whether
it ends with '.' + AudioNsomething.  PR#15441
2004-11-18 14:02:42 +00:00
christos 4de5735102 off-by-one 2004-11-15 23:28:50 +00:00
atatat 612e86b46d Wrap TIMEVAL_TO_TIMESPEC and TIMESPEC_TO_TIMEVAL macros in
do { ... } while(/*CONSTCOND*/0)

so that they can be used unadorned in if/else blocks, etc.  This means
that you now *have* to put a ; at the end of the "call" to these
macros.
2004-11-14 03:30:08 +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
david bf4bf03db8 Refine bounds check code. 2004-11-07 04:08:37 +00:00
david d7d15131bb Bounds check syscall arguments where appropriate 2004-10-27 19:29:57 +00:00
david a710461910 Log Msg was corrected, Nov 6th, 2004. Whitespace cleanup 2004-10-27 19:29:56 +00:00
david 090b8be8f9 Bounds check syscall arguments where appropriate 2004-10-27 19:29:56 +00:00
skrll 3780f859c7 Only create a KTR_USER record if it's one of the tracepoints.
OK'd by manu.
2004-10-24 14:42:10 +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
christos 7e7288c064 Bounds check signal number. 2004-10-13 23:21:41 +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
yamt 0994e6acb8 introduce a function, proclist_foreach_call, to iterate all procs on
a proclist and call the specified function for each of them.
primarily to fix a procfs locking problem, but i think that it's useful for
others as well.

while i'm here, introduce PROCLIST_FOREACH macro, which is similar to
LIST_FOREACH but skips marker entries which are used by proclist_foreach_call.
2004-10-01 16:30:52 +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 52c9439e95 regen:
remove all alternative path check code, and (empty) ioctl wrapper
2004-09-14 17:40:59 +00:00
jdolecek c2e4e13382 remove all alternative path check code, and (empty) ioctl wrapper 2004-09-14 17:39:18 +00:00
jdolecek 120bb37404 remove COMPAT_AOUT 2004-09-14 16:57:31 +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
jdolecek f7ec3be35d use native syscallnames[] for SYSCALL_DEBUG 2004-09-12 11:09:32 +00:00
jdolecek f83c14f534 only include emulation syscallnames with SYSCALL_DEBUG, it's not used otherwise 2004-09-12 10:38:25 +00:00
he 936dfb04a0 More removal of references to aoutm68k_syscalls.c, following that file's
removal.  Allows our m68k ports to build again.
2004-09-12 08:04:50 +00:00
wiz be98c25ecf Fix typo in comment. 2004-09-10 22:22:20 +00:00
jdolecek 725814cc94 garbage-collect aoutm68k_syscalls.c, it's just taking up space (it's not used) 2004-09-10 07:11:26 +00:00
tron e5f111e223 Next attempt to fix the RCS Id. *sigh* 2004-09-09 10:45:52 +00:00
tron e22003b771 Finish linux_sys_exit_group() with a (never reached) "return" statement so
that GCC will actually compile this.
2004-09-09 07:02:50 +00:00
jdolecek 3b18315bb9 regen: add exit_group(2) 2004-09-08 19:46:17 +00:00
jdolecek 78569d6650 implement basic exit_group(2), which just terminates calling thread;
apparently not many apps use thread groups yet, at least not with default
SuSE 9.1 libraries, so this is enough for now
2004-09-08 19:45:21 +00:00
jdolecek 6b3117d804 do more strict flag checking in clone(2) (matches what Linux does) 2004-09-08 19:41:24 +00:00
jdolecek ec083dc43c linux_sa_get: g/c curproc use, we get the process as one of arguments 2004-09-05 09:38:17 +00:00
jdolecek 4032a79979 improve the (#ifdef DEBUG_LINUX) socketcall argument dump code:
- print the socketcall type
- special case socket(2) call, it's also the only one with first argument
  not being a socket descriptor
- only dump the relevant part of linux_socketcall_dummy_args, instead
  of always the whole structure
2004-09-05 09:09:02 +00:00
jdolecek bae3c8fbb8 add some newer clone flags 2004-09-05 07:22:20 +00:00
jdolecek 6cfdd8bdbf dump socketcall data #ifdef DEBUG_LINUX 2004-08-29 20:45:18 +00:00
jdolecek 0659b2b55e in debug log, data dump is more useful unsigned 2004-08-29 20:10:42 +00:00
jdolecek 466a837559 handle mmap() request with MAP_GROWSDOWN flag (request for stack-like
grow-down auto extend segment) by allocating segment sized at
current stack size limit, and offsetting requested/returned address
as required

due to how normal virtual memory management work, allocating the
full sized stack memory segment up-front actually requires exactly same
amount of VA space and physical memory as the Linux 'grow' scheme and the
'grow' scheme is quite a lot more difficult to use in applications correctly,
so it's not very apparent why Linux introduced this feature at all

this fixes Thomas Klausner's Heroes3 crash, and might also
fix PR 26687 by Jan Schaumann
2004-08-29 14:08:06 +00:00
jdolecek a95e4d7c87 g/c LINUX_MAP_IGNMASK define - it's not used anywhere 2004-08-28 18:58:57 +00:00
jdolecek b63de69b76 fix debug printf - lm_addr is not pointer anumore 2004-08-24 17:41:54 +00:00
jdolecek c341a3a03a make struct linux_oldmmap members explicitly unsigned (with exception
of lm_fd, which can be -1), rename lm_pos to lm_offset, g/c some unneeded casts

no functional change
2004-08-22 15:40:41 +00:00
cgd 61d7e536bd Fix my license notice. Back when hpux_exec.c was cloned from
sys/kern/exec_aout.c back in *1995*, apparently the line from my
license notice:
 *    must display the following acknowledgement:
was accidentally dropped.  This mistake was propagated into
hpux_exec_aout.c when it was split out of hpux_exec.c.
(Thanks to hubertf for noticing!)
2004-08-21 22:27:04 +00:00
hubertf 4592bf2278 Fix copyright notice - OK'd by the copyright holder. 2004-08-21 18:58:31 +00:00
mycroft 45a21b76f0 Fixing age old cruft:
* Rather than using mnt_maxsymlinklen to indicate that a file systems returns
  d_type fields(!), add a new internal flag, IMNT_DTYPE.

Add 3 new elements to ufsmount:
* um_maxsymlinklen, replaces mnt_maxsymlinklen (which never should have existed
  in the first place).
* um_dirblksiz, which tracks the current directory block size, eliminating the
  FS-specific checks littered throughout the code.  This may be used later to
  make the block size variable.
* um_maxfilesize, which is the maximum file size, possibly adjusted lower due
  to implementation issues.

Sync some bug fixes from FFS into ext2fs, particularly:
* ffs_lookup.c 1.21, 1.28, 1.33, 1.48
* ffs_inode.c 1.43, 1.44, 1.45, 1.66, 1.67
* ffs_vnops.c 1.84, 1.85, 1.86

Clean up some crappy pointer frobnication.
2004-08-15 07:19:54 +00:00
jdolecek 42d15fca03 on Linux, unlink() fails with EISDIR if the target is directory,
rather than EPERM; to emulate this properly, translate the error to EISDIR
if the target patch exists and points to a directory

this fixes the 'ant clean' problem reported by Marc Recht on current-users@
with SuSE 9.1 libraries
2004-08-13 21:27:32 +00:00
jdolecek b43cbaf291 fix two bugs in previous:
* flags passed from fork1() are FORK_*, not CLONE_*; thus, correct is to check
  for FORK_SHAREVM, not CLONE_VM
* fix a reference counting bug
2004-08-08 19:52:37 +00:00
jdolecek a714ac8294 linux processes sharing VM space (via clone() call) must also
share same 'break' value used for brk()/sbrk(), otherwise application SIGSEGVs
quickly once different threads try to adjust data segment size

this fixes linux Mozilla crashes with SuSE 9.1 libraries, and possibly
other linux applications using real threads
2004-08-08 09:40:50 +00:00
jdolecek 74436be135 pass the fork flags down to the emulation fork hook, so that emulation
code can use the information for setup
2004-08-08 08:42:03 +00:00
manu 158fe62cd6 Fix a build problem pointed out by wiz 2004-08-02 18:45:53 +00:00
jdolecek 10a205d5d1 Linux returns ENOMEM (not EFAULT) if the address specified in mprotect()
is not part of process address space

this fixes Linux libgcc_s's stack executability setup
2004-08-01 22:44:10 +00:00
jdolecek 88c36114af regen - sync syscall lists with Linux kernel 2.6.7 2004-08-01 15:38:10 +00:00
jdolecek 6e41cd161f add entries for #403, #404 (unused) 2004-08-01 15:36:23 +00:00
jdolecek d1d5ac79b4 sync the syscall lists with Linux kernel 2.6.7 2004-08-01 15:34:22 +00:00
jdolecek 945fc3e577 regen:
add stub entries for syscalls added until Linux kernel 2.6.7

move the ARM-specific syscall range up to offset 0x180, to make room
for the new syscalls
2004-08-01 14:17:19 +00:00
jdolecek 2873b62b57 add stub entries for syscalls added until Linux kernel 2.6.7
move the ARM-specific syscall range up to offset 0x180, to make room
for the new syscalls
2004-08-01 14:16:32 +00:00
jdolecek 4b33174cf9 regen:
connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
2004-08-01 10:38:38 +00:00
jdolecek ae85fa27f7 connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
2004-08-01 10:32:40 +00:00
manu cdd12932c6 Regen 2004-07-28 22:25:10 +00:00
manu 66fc5fb621 Empty shell for Darwin audit API 2004-07-28 22:24:06 +00:00
manu bc620e30a6 Added the utrace system call 2004-07-28 21:30:00 +00:00
manu 6c669327ef Add the emul.mach.exception.hang sysctl, which helps catching programs
that die before they disapear. This is usefull because we cannot start
Mach-O binaries under gdb. We attach the hung process instead.
2004-07-27 22:01:56 +00:00
manu 09ee1c0349 The entropy collection sysctl returns the number of record and not the
copied data size.
2004-07-27 20:41:48 +00:00
manu 0a61854f64 Build with debug enabled 2004-07-27 20:41:13 +00:00
chs f8fa568ead remove the LINUX_SP_WRAP hack since it doesn't seem to be needed anymore,
and removing it lets us go back to mapping the stack non-executable again.
2004-07-25 23:26:44 +00:00
manu a380f938d4 Added kern.debug.getentropy sysctl 2004-07-25 07:54:54 +00:00
manu 7e06aa42fb Regen 2004-07-24 15:47:23 +00:00
manu 4bc8afece2 Added port_get_refs and port_mod_refs 2004-07-24 15:46:02 +00:00
manu c0431a8e23 - Perform alternate path checks in emulation tree for connect with AF_LOCAL
sockets
- When converting Darwin to native sockets, beware that darwin does not set
the size to AF_LOCAL sockets. We need to recompute by hand.
2004-07-24 15:45:27 +00:00
manu 86cd319fea Add a wrapper for connect that check an alternate path in emulation tree
for AF_LOCAL sockets.
2004-07-24 15:44:09 +00:00
manu e7d6d3e79b garbage data following darwin_if_msghdr was in fact a struct sockaddr_dl
Fixing this makes ifconfig nearly happy.
2004-07-24 01:00:29 +00:00
manu 59c4edd145 typo that caused ifaddr to report no addresses. 2004-07-23 21:34:01 +00:00
manu ebac5544ba Don't try to pre-compute the ifaddr data, it just leads to mistakes when
the code that fills the structure is modified and the the size computation
code.

Instead compute while filling the data.
2004-07-23 21:03:33 +00:00
he e3def7a76a It's not supposed to be possible to commit files with remnants of
CVS conflicts in them, but apparently this happened here around
__KERNEL_RCSID().  Fix it.
2004-07-22 09:43:19 +00:00
manu d5cb507ae3 If struct sockaddr's sa_family must be transalted, then struct sockaddr
itself needs to be translated. It means that we must translate it in
every system call using it: recvfrom, sendto, connect, accept, bind,
getpeername, getsockname.
2004-07-21 23:43:25 +00:00
manu 828bbdacac Don't assume ARG_MAX < MAXPATHLEN: someone might build with a modified
constant
2004-07-21 21:45:34 +00:00
manu 00c1d07082 Simplify the socket translation code.
Have the same size in the darwin/native and native/darwin AF translators
2004-07-21 20:57:30 +00:00
manu 941b113c0e Add the sysctl that provides interface enumeration (used by getifaddrs()
library call). Programs such as ifconfig or XFree86 4.4 XDarwin use it.
The emulation is not complete, as ifconfig is not able to display inet6
addresses correctly.
2004-07-21 01:37:57 +00:00
manu f58d4a42e1 bugfix: vm_copy was only copying the first page 2004-07-18 23:19:52 +00:00
kent a9236e26b4 pass the whole of pecoff_opthdr, not only pecoff_imghdr. 2004-07-18 04:36:42 +00:00
manu d4d3cc307c commpage function changes:
Copy all the commpages instead of one
Add the missing bcopy function
Wrong function name: pthread_getspecific instead of pthread_specific
2004-07-11 19:38:14 +00:00
christos b970e18139 Regen 2004-07-07 22:04:27 +00:00
christos 63c19634d0 no #ifdef __powerpc__ here. 2004-07-07 22:03:38 +00:00
manu 67cf1bc043 MacOS X.3 introduces a new sigreturn for PowerPC, with a usercontext
versionning argument. For now we only implement the X.2 flavor.
2004-07-04 21:03:55 +00:00
manu aab7e2ab6f Useful debug since ktrace doesn't show sysctl arg array. 2004-07-04 20:30:14 +00:00
christos 439d1da971 #ifdef the altivec option, because only powerpc has it. To be fixed in
a better way later.
2004-07-04 15:27:26 +00:00
manu 7fef082024 Move all the MD bits of commpage to a new file.
Map the comm page as RW in kernel (we want to modify it but not to execute it),
and RX in userland (no need to modify it but we want to execute it
2004-07-03 22:17:18 +00:00
manu 318748a9d0 Wrong argument to memset for bzero in commpage. 2004-07-03 17:29:17 +00:00
manu 5d33c4b91c 2^53 does not compute 2 power 53... 2004-07-03 16:47:13 +00:00
manu 4d933c5be0 Mark the thread id as clean in cthread_set_self 2004-07-03 09:44:04 +00:00
manu 26200ee754 In MacOS X.3, the kernel maps tw opages of memory in every user process.
This areas is called the comm pages. It is used to provide fast access to
several data and functions.

The comm pages are mapped starting at 0xffff800 (address chosed so that
absolute branch can be used, so it can be accessed even when dynamic linking
is not ready). NetBSD has the user stack here, so we need to provide a
Darwin-specific stack setup routine which sets the top of the stack at
0xbfff0000.

This implementation is not complete but it does enough to get MacOS X.3
starting again (static binaries run, dynamic binaries still have an issue).
in the comm pages functions, we only implement bcopy, pthread_self and
memcpy.

TODO:
- clean up the powerpc specific code from MD parts
- for now we map only one page to avoid a crash, we want two pages.
- write all the comm functions.
2004-07-03 00:14:30 +00:00
drochner 6f8b4c1216 There is no point in mapping a NetBSD signal trampoline
(which doesn't exist unless COMPAT_16 anyway)
into a Darwin emulation process' address space.
2004-06-24 17:02:06 +00:00
manu 31f25e173c Fix a reversed errno issue for Linux binaries on mips. While we are there,
fix broken includes for alpha and m68k.
2004-06-19 22:59:40 +00:00
manu b2563527a8 Build COMPAT_LINUX again on mips after the siginfo change. 2004-06-19 18:45:30 +00:00
manu 0d510f3e7e include <sys/resourcevar.h>. It is not required for building -current,
but it is for -netbsd-2-0. Next step is to pull up the change...
2004-06-18 17:06:15 +00:00
cube 4277a3964f Regen. 2004-06-17 18:30:54 +00:00
cube 4b2667d3ec o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
  netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.
2004-06-17 18:29:40 +00:00
manu 6b1a152604 COMPAT_LINUX/powerpc used the native stack setup routine, but now the
native version does non executable mappings on the stack. This is a
showstopper for Linux binaries.

To fix that we supply a copy f the native stack setup function for Linux
binaries, with the executable bit set.
2004-06-16 00:03:25 +00:00
yamt 6c4915e34d linux_sys_ioctl: map EPASSTHROUGH to EINVAL as sys_ioctl does.
otherwise, linux_syscall() returns garbage, at least on i386.
(it returns native_to_linux_errno[EPASSTHROUGH] where EPASSTHROUGH == -4.)

i choose EINVAL rather than ENOTTY, because linux's pipe returns it
and i think that it's a common case.
2004-06-03 01:53:28 +00:00
pk c245462cb8 hpux_ioctl(): acquire a reference to the file. 2004-06-01 11:05:40 +00:00
pk f0f0f16529 svr4_sys_ioctl(): acquire a reference to the file. 2004-06-01 10:38:39 +00:00
pk c6c77837c9 sunos_ioctl(): acquire a reference to the file.
This also fixes a locking botch reported in PR#25738.
2004-06-01 10:27:39 +00:00
hannken 8c21bc6224 Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.
- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
    may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
    Snapshots may not be opened for writing and the attributes are read-only.
    Use the mtime as the time this snapshot was taken.
    Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
  one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
  a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-05-25 14:54:55 +00:00
atatat 190adb15c3 Sysctl descriptions under emul subtree. 2004-05-25 04:29:08 +00:00
jonathan 230fb9b8ab Eliminate several uses of `curproc' from the socket-layer code and from NFS.
Add a new explicit `struct proc *p' argument to socreate(), sosend().
Use that argument instead of curproc. Follow-on changes to pass that
argument to socreate(), sosend(), and (*so->so_send)() calls.
These changes reviewed and independently recoded  by Matt Thomas.

Changes to soreceive() and (*dom->dom_exernalize() from Matt Thomas:
pass soreceive()'s struct uio* uio->uio_procp to unp_externalize().
Eliminate curproc from unp_externalize.   Also, now soreceive() uses
its uio->uio_procp value, pass that same value downward to
((pr->pru_usrreq)() calls for consistency, instead of (struct proc * )0.

Similar changes in sys/nfs to eliminate (most) uses of curproc,
either via the req-> r_procp field of a struct nfsreq *req argument,
or by passing down new explicit struct proc * arguments.

Reviewed by: Matt Thomas, posted to tech-kern.
NB: The (*pr->pru_usrreq)() change should be tested on more (all!) protocols.
2004-05-22 22:52:13 +00:00
christos 85699649e2 grr, forgot to take out the & 2004-05-22 20:53:26 +00:00
christos 9a0b176050 allocate memory for statvfs instead of using the stack. 2004-05-22 20:46:53 +00:00
atatat 10a7ba9ef6 Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
2004-05-20 06:34:24 +00:00
drochner 644e697b54 regen 2004-05-11 10:55:29 +00:00
drochner c736283f11 FreeBSD emulation should not depend on NetBSD binary compatibility
options. Include compat_20_sys_*statfs* unconditionally.
2004-05-11 10:54:51 +00:00
jonathan d2dde9d018 Regen src/sys/compat/freebsd_sys{call.h,callargs.h,calls.c,ent.c} from
syscalls.master rev 1.45, with COMPAT_2.0 fix.
2004-05-10 20:47:14 +00:00
christos cec7684b79 Add opt_compat_netbsd.h because we need it for COMPAT_20; pointed out
by Jonathan Stone.
2004-05-10 20:27:42 +00:00
kent e3f4d77dda regenerate for fsync_range, uuidgen, getvfsstat, statvfs1, fstatvfs1, and fhstatvfs1 2004-05-08 14:33:12 +00:00
kent af38d21dbd add fsync_range, uuidgen, getvfsstat, statvfs1, fstatvfs1, and fhstatvfs1. 2004-05-08 14:31:59 +00:00
pk 4a04452106 Use crdup(), instead of crget()+memcpy(). 2004-05-02 12:32:22 +00:00
fair 5b3531cc87 Line 175 VFS_STAVTFS -> STATVFS (tyop) 2004-04-27 21:37:49 +00:00
atatat e5004170aa Be consistent about using sysc_init_field() 2004-04-27 03:49:03 +00:00
christos f987d253b9 PR/25335: Erik E. Fair: statvfs lossage in sys/lkm/compat/osf1 2004-04-26 20:33:50 +00:00
matt b1fee09f27 Constify sreq2breq 2004-04-25 06:25:52 +00:00
matt 22120ad628 Constify the speedtab arrays 2004-04-25 06:23:40 +00:00
matt c768d54573 Constify an array. 2004-04-25 06:04:54 +00:00
matt 48011c94e7 Constify a few read-only arrays/variables. 2004-04-25 06:02:20 +00:00
atatat 3f800573aa Be consistent about using sysc_init_field() 2004-04-25 05:54:38 +00:00
christos dede52abd3 PR/25288: Erik E. Fair: convert this file to statvfs 2004-04-23 12:02:39 +00:00
hannken fcd7f3df90 Fix statfs->statvfs fallout. 2004-04-22 14:32:09 +00:00
christos 924e775ac7 fix statvfs->statvfs1 fallout 2004-04-22 14:06:31 +00:00
christos e6f05cd289 Add the missing 'v' to fhstatvfs1 2004-04-22 12:04:03 +00:00
hannken 754675a0e1 Make it compile again after statvfs import. 2004-04-22 10:18:03 +00:00
matt 633d902c65 Regen for statvfs changes. 2004-04-22 05:44:30 +00:00
christos 22df5bb240 try to make this compile. XXX: this will not work yet (hi simon) 2004-04-21 11:50:26 +00:00
simonb b81e6f2ef6 ANSIfy, some KNF. 2004-04-21 07:05:07 +00:00
simonb 0495170a7a Fix some statfs->statvfs fallout. Compile tested only... 2004-04-21 05:20:27 +00:00
christos 34728fd71f more statvfs1 fallout. 2004-04-21 02:40:05 +00:00
christos 36d3802e0f fix more statvfs1 fallout 2004-04-21 02:37:20 +00:00
christos 5ccca4a99a s/statvfs/statvfs1/ 2004-04-21 02:27:34 +00:00
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +00:00
dmcmahill 888e67edcc Fix the sysinfo(SI_HW_SERIAL, emulation so that we actually get the
hostid of the machine rather than always getting "0".  Tested with
hostid(1) from solaris-2.8 and with lmhostid (part of FlexLM) for solaris.
Approved by atatat@.
2004-04-19 02:55:40 +00:00
matt a6b639c3a5 Switch to using PSL_USEROK_P()
Use new save_fpu_lwp sematics to save or discard the fpu state appropriately.
2004-04-17 08:47:15 +00:00
christos a97d60211a fix undefined variable. 2004-03-29 21:43:28 +00:00
drochner 60cbbd8f70 use netbsd32_sigcode with COMPAT_16 only 2004-03-26 18:38:55 +00:00
drochner d19f706361 all ports define __HAVE_SIGINFO now, so remove the CPP conditionals 2004-03-26 17:34:18 +00:00
drochner 4f4ec7e627 regen after __HAVE_SIGINFO removal 2004-03-26 15:29:28 +00:00
drochner 9fd8e8983b all ports define __HAVE_SIGINFO now, so remove the CPP conditionals 2004-03-26 15:18:54 +00:00
drochner 4f5b1431f9 all ports define __HAVE_SIGINFO now, so remove the CPP conditionals 2004-03-26 15:01:16 +00:00
drochner 20c83a3f1e while this is dead code appearently, define e_sigobject only
if sigcode/esigcode are useful, otherwise bad things will
happen in kern_exec.c:exec_sigcode_map()
(from code inspection, untested)
2004-03-25 16:54:10 +00:00
pooka 8b2eb5b87e Use PR_WAITOK instead of M_WAITOK for pool_get(). This is polite,
since M_WAITOK happens to be PR_NOWAIT.
2004-03-24 16:55:07 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
mrg 0275cc80b8 fix a (syscall args) comment. 2004-03-21 13:26:44 +00:00
he 545d50632e Remove local declaration of 'sg', since it is no longer used. 2004-03-11 10:14:10 +00:00
atatat c2309bcca6 *Don't* call sys___sysctl() from within the kernel. Use old_sysctl()
instead.
2004-03-09 03:18:03 +00:00
atatat 0d4caad924 Remove useless comment about stuff that never happened. 2004-03-09 03:13:07 +00:00
atatat bb33b98bad I obviously put this (__SYSCTL_PRIVATE) here, but I have no
recollection of what it was for and it's now just useless, so it goes.
2004-03-09 03:11:39 +00:00
drochner aaececd2f4 allow to start other emulations (eg native code)
from here: set p_execsw to the new thing, and call
the new emulation's syscall_intern()

XXX there are more differences to kern_exec.c, sa/ras
related afaics, this is harmliss for now since
netbsd32 doesn't support multithreaded programs yet --
one day one execve() implementation should be shared
by native and netbsd32 code.
2004-02-25 18:15:45 +00:00
drochner b07c616019 did this ever work? The EXEC_32 flag must be set _before_
exec_aout_prep_*magic(), otherwise setup_stack() fails.
2004-02-20 17:04:27 +00:00
drochner f0423dfad5 -MID_SPARC->NETBSD32_MID_MACHINE
-check for zero BSS size, as in kern/exec_aout.c rev. 1.23
2004-02-20 16:14:38 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
junyoung 9a410f9ed0 Rename es_check in struct execsw to es_makecmds. 2004-02-06 08:02:58 +00:00
tsarna 72489e1ea0 uuidgen(2) syscall. Originally from FreeBSD, ported by John Franklin in
PR#23470, with minor updates by me. This is only the syscall support
from that PR, for now.

Changes: port over fix from FreeBSD for multicast address generation.
Changed bcopy to memcpy.  For now, #ifdef notyet the portions of
kern_uuid.c that are meant to be used by (currently nonexistent) other
things in the kernel.  Added syscall to COMPAT_FREEBSD as well, though
that's currently not useful, as any program new enough to use this call
also uses other syscalls we don't (yet) emulate.
2004-01-29 02:00:02 +00:00
yamt 2a93afdfd5 rename i386 mdlwp flags from MDP_ to MDL_
to avoid confusion with mdproc flags which also have MDP_ prefixes.
2004-01-28 10:48:55 +00:00
mrg 6f15ac16fc delete ktrsyscall32() prototype 2004-01-21 11:28:30 +00:00
atatat 4604fb0abe Remove useless comment 2004-01-17 03:30:14 +00:00
mrg 23884e8622 clean up a little:
- delete ktrsyscall32()
- add a check #ifdef _LP64 to do the conversion if P_32 is set to the
standard ktrsyscall()
- add a couple of similar _LP64/P_32 checks to the systrace code.

this should get systrace working for 32 bit apps as well as complete
ktrace support for "trace_enter/trace_exit" using platforms such as amd64.

XXX: systrace isn't supported on sparc64 currently... (it doesn't use
trace_enter/trace_exit, or have it's own calls to systrace_xxx()...)
2004-01-16 05:03:02 +00:00
mrg 1d9c8161a0 begin to implement some ifreq ioctls... long long way to go. 2004-01-15 14:36:28 +00:00
mrg 28a83c2d9f add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.
2004-01-15 14:34:38 +00:00
manu 29638672ea off-by-one error in ary subscript. 2004-01-02 02:09:52 +00:00
manu 996e659ce6 Try to do a better job at Mach port refcount. That's not perfect, though. 2004-01-01 22:48:54 +00:00
manu 0dc13ccc05 Added the getattrlist system call. That was annoying. 2003-12-31 02:55:04 +00:00
manu d1845c906c - Rework the Mach semaphore code to handle threads instead of processes
- Add 2 system calls: semaphore_signal_thread and sempaphore_signal_all (the
latter being untested)
- semaphore_signal_thread arguments list was wrong
2003-12-30 00:15:46 +00:00
manu 1a96ea0da6 In DPRINTF? replace uprintf, so that we get debug output for daemons too. 2003-12-30 00:14:20 +00:00
manu 5c83b03a81 Added DARWIN_IOFBSETGAMMATABLE
In DARWIN_IOFBSETCLUTWITHENTRIES, split big tables into 128 items chunks
so that they fit in the stackgap (currently 512 bytes)
2003-12-29 01:34:02 +00:00
manu 7ab97b2c76 Added Mach services (no real implementation, just empty shells to make
userland happy)
processor_set_default, host_processor_set_priv, and thread_set_policy
2003-12-29 01:30:27 +00:00
manu 31b3c2a056 Added the semaphore_wait_signal_trap Mach system call (untested) 2003-12-28 23:00:36 +00:00
manu 2c772b20d9 When the catcher of an exception dies before releasing the thread that
raised the exception, don't release the lock, this causes a crash (the lock
shall be released by the process that took it). Wakeup the thread instead,
it will release the lock itself.
2003-12-28 13:28:39 +00:00
manu 48d72491a9 The VRAM offset seems to be the offset of the framebuffer within the VRAM.
Until we really map the whole VRAM, this is 0.
Two missing files in the last commit
2003-12-27 22:06:19 +00:00
manu afc357e66b Correctly return the VRAM offset in IOFBGETVRAMMAPOFFSET connect method.
With this, WindowServer blanks hals of my screen before crashing the kernel.
That's sweet.
2003-12-26 20:34:34 +00:00
manu d0de7398af union without a name does not build on i386... 2003-12-26 16:31:29 +00:00
manu 219b24a068 Chand emul.darwin MIB to fit best current practice.
emul.darwin.init.pid instead of emul.darwin.init_pid, and so on.

This breaks backward compatibility with the pre-dynamic sysctl(8) for
emul.darwin, but it has never been available in a formal release, so
it should be alright.
2003-12-26 16:00:53 +00:00
manu 834aafd284 Rework Mach exception and Darwin's ptrace. gdb is now able to attach a
remote process. This new implementation also passes all the test programs
I've written so far.

- When exceptions come from traps, no UNIX signal should evet be sent.
- Add a lock to ensure a debugger handles only one exception at a time
- Use a structure to hold flavor and behavior in exception ports, instead
  of stuffing the two argument into an int.
- Implement new Mach services: thread_suspend, thread_resume and thread_abort
- Implement Darwin's ptrace PT_ATTACHEXC and PT_THUPDATE commands
- Handle NULL second argument correctly in sigprocmask.
- One mistake in the last commit (darwin_tracesig prototype)
2003-12-24 23:22:22 +00:00