Commit Graph

537 Commits

Author SHA1 Message Date
cube 1277ee639e - Make better use of COMPAT_XX type in syscalls.master
- Remove useless (thanks to COMPAT_XX behaviour) #ifdefs in
  syscalls.master
- Make netbsd32_compat_43.c compiled per COMPAT_LINUX32 because the latter
  needs stuff from it.

Fixes Perry's PR#34951.
2006-11-09 14:09:37 +00:00
drochner b1af2cb9b9 -SUS says that a successful call to setcontext(2) does not return. This
implies that _UC_CPU must be set in the context passed. Check for this
 and return EINVAL if not; this gives a cheap test for corrupted
 ucontexts eg on a signal handler stack which would go unnoticed otherwise.
-Don't ckeck for NULL ucontext pointers explicitely. This is an error,
 except in the swapcontext() case where it can be easily caught in
 userland.
2006-11-08 20:18:32 +00:00
fvdl fc06b6e99a EPASSTHROUGH from lower layers is returned as ENOTTY to the (system) caller.
Make it so.
2006-09-24 10:20:16 +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
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
cube 12092a2b5c Regen (netbsd32_ptrace protection). 2006-08-30 13:58:51 +00:00
cube 1282264dd1 Protect netbsd32_ptrace with options PTRACE. 2006-08-30 13:57:47 +00:00
cube f5dc39b8bf netbsd32_core.c is need only under options COREDUMP. 2006-08-30 13:57:11 +00:00
cube ed78ad7eae Protect netbsd32_ptrace with options PTRACE. 2006-08-30 13:56:48 +00:00
yamt 4977b4bbc0 some filehandle syscall related changes.
- remove the support of variable-sized filehandle from compat version of
  syscalls.  (strictly speaking, it breaks abi.  i don't think it's a problem
  because this feature is short-lived and there are no affected in-tree
  filesystems.)
- unify vfs_copyinfh_alloc and vfs_copyinfh_alloc_size.
- vfs_copyinfh_alloc_size: check fhsize strictly.
- reduce code duplication between compat and current syscalls.
2006-08-04 16:29:51 +00:00
martin b4cb63a646 Make filehandles opaque to userland 2006-07-31 16:34:42 +00:00
martin f956f13e21 Step 1 to make filehandles completely opaque to userland 2006-07-31 16:32:51 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
yamt 402cb9eb95 adapt to vfs_copyinfh -> vfs_copyinfh_alloc rename. 2006-07-16 07:52:02 +00:00
martin b9dade0e59 netbsd32_sys___fhstat30 and netbsd32_sys___fhstatvfs have nothing to do
with compat_30 - so use full/variable sized filehandles here too.
Fixes PR kern/34004.
2006-07-14 22:09:01 +00:00
pavel 56194475a6 regen. 2006-07-13 23:23:52 +00:00
pavel 037b2fed75 do not protect the getfh syscall by
#if defined(NFS) || defined(NFSSERVER).
The native syscall also isn't.
2006-07-13 23:22:30 +00:00
martin f8fef2f801 regen 2006-07-13 23:10:40 +00:00
martin a3b5baed42 Fix alignement problems for fhandle_t, exposed by gcc4.1.
While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
2006-07-13 12:00:24 +00:00
mrg 1b7ff51599 regenerate. 2006-06-26 21:30:50 +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
yamt bf0859e932 netbsd32_sacopyout: don't leak kernel stack garbage to userland. 2006-06-25 08:11:06 +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
drochner 05a790f438 regen 2006-05-31 09:54:45 +00:00
drochner 5529c06d6a support ntp_gettime again
compile tested by Havard Eidnes
2006-05-31 09:52:27 +00:00
drochner 21166bafa5 regen 2006-05-29 09:46:54 +00:00
drochner 9575ca7cfd Remove emulation of ntp_gettime. In preparation for "timecounters" we
will change "struct ntptimeval", so some translation would be necessary.
ntp_gettine is considered dispensable, the only userland program known
to use it is "ntptime".
2006-05-29 09:44:51 +00:00
simonb e78022e1d6 Limit the size of any kernel buffers allocated by the VOP_READDIR
routines to MAXBSIZE.
2006-05-27 23:46:49 +00:00
elad 874fef3711 integrate kauth. 2006-05-14 21:19:33 +00:00
mrg f068df14bb use socklen_t where appropriate. 2006-05-11 00:59:10 +00:00
mrg 13e3bbe4e1 add an extra (uintptr_t) cast to NETBSD32TOP. 2006-05-11 00:58:25 +00:00
cube 1233d0b5cd Move fhstat as sys___fhstat30 in netbsd32_fs.c because it doesn't belong
to netbsd32_netbsd.c (which incidentally means it had been broken for a
while I guess).  Add compat_30 version.
2006-05-05 13:31:30 +00:00
cube 8332bbc306 Regen (fhstat versioning, posix_fadvise). 2006-05-05 13:29:50 +00:00
cube 8a02261127 Follow on fhstat(2) versioning. While there, add sys_posix_fadvise (no
emulation needed there).
2006-05-05 13:28:52 +00:00
cube a107f9847e Add compat_30 as a compatopts. 2006-05-05 13:27:29 +00:00
cube 69a77971a8 Regen (_lwp*, sa_*). 2006-03-29 23:04:48 +00:00
cube 99a30ba980 Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.
2006-03-29 23:04:12 +00:00
matt 6a9dc55430 More variable sized MALLOC -> malloc changes. 2006-03-19 22:39:28 +00:00
matt 170f4f3a59 MALLOC -> malloc 2006-03-18 18:56:19 +00:00
cube daab1bf18c Move malloc calls outside of the block where a lock is held. 2006-03-15 11:36:42 +00:00
cube 37b7f4fbd8 SA introduce a new case of siginfo structure. Be ready for it when the
time comes to support SA in COMPAT_NETBSD32 (which is soon).
2006-03-15 09:09:47 +00:00
thorpej be8b235384 Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
  trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
  about KTRACE and SYSTRACE, but do no more.
2006-03-07 03:32:04 +00:00
cube ceafd0acdb Regen (SysV IPC). 2006-03-06 14:41:28 +00:00
cube 754cf030b7 Implement the SysV IPC family of syscalls. 2006-03-06 14:40:55 +00:00
cube 40a483cd0b Regen (ksem_*). 2006-03-05 01:29:28 +00:00
cube 6d0cb97ff8 Implement the ksem_* family of syscalls. 2006-03-05 01:28:20 +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
he 1f315c6ab1 Paste in the conditional declaration of the pps_* extern variables
from kern_ntptime.c, so that this file can build under PPS_SYNC.
2006-02-17 15:44:17 +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 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
cube 16b23e6e66 More ktrace-lwp merge fallout: netbsd_elf32_signature's prototype has
changed.  Too bad C doesn't have signatures in symbols.

Fixes PR#32388 by Nicolas Joly.
2005-12-27 00:36:00 +00:00
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
christos fa7190ea1a more proc to lwp problems. 2005-12-12 02:51:07 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
christos 0e0397d742 netbsd32_timevalp_t is not really a pointer. 2005-12-06 13:37:35 +00:00
christos 58b2cd40fa remove conflict. 2005-12-05 15:17:18 +00:00
christos 9612f9a4de untagle a bit. 2005-12-05 15:16:51 +00:00
kleink cb3b376555 Sync with kern_time.c rev. 1.98:
- make settime take timespec.
- pass struct proc down so that we can log a detailed message.
2005-12-05 10:31:00 +00:00
simonb a21c456e2e Call nanotime() directly, instead of doing the
microtime()/TIMEVAL_TO_TIMESPEC() dance.
2005-11-11 07:07:42 +00:00
christos 82eba32c06 need compat/sys/shm.h 2005-11-10 18:47:53 +00:00
cube 75d561e358 Move prototypes for siginfo32 to/from siginfo converters at the right
place.
2005-10-24 15:28:09 +00:00
cube fc1218444f Regen (kqueue, kevent). 2005-10-23 01:34:33 +00:00
cube 97e4d77453 - Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
  kevent1 that points to functions that do the actual copyin/copyout
  operations.  This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.
2005-10-23 01:33:32 +00:00
cube 388b97e039 Implement a few changes needed to properly resolve PR#30924, as
discussed in the PR.

- introduce sys/timevar.h to hold kernel-specific stuff relevant to
  sys/time.h.  Ideally, timevar.h would contain all (or almost) of the
  #ifdef _KERNEL part of time.h, but that's a pretty big and tedious
  change to make.  For now, it will contain only the prototypes I
  introduced when working on COMPAT_NETBSD32.

- split copyinout_t into copyin_t and copyout_t, it makes prototypes more
  explicit about the meaning of a given argument.  Suggested by yamt@.

- move copyinout_t definition in sys/time.h to systm.h as copyin_t and
  copyout_t

- make everything uses the new types and include the proper headers at
  the proper places.
2005-10-23 00:09:14 +00:00
chs ffd3aa297e make the previous apply only to x86_64. 2005-10-07 14:46:04 +00:00
chs 26a2ca0397 add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world:  they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.
2005-10-07 14:40:06 +00:00
chs 8a6025c821 this needs stuff from compat/sys/siginfo.h now, just include it here. 2005-09-27 15:09:04 +00:00
chs 94be8205d7 make this compile again. 2005-09-27 14:37:06 +00:00
christos a5d6ab9188 need compat/sys/socket.h 2005-09-24 21:34:35 +00:00
christos 91e84b20b0 make the siginfo converters static and comment out the one that is not used. 2005-09-24 21:34:18 +00:00
christos dd40a9f6f6 include new compat siginfo header. 2005-09-24 17:29:47 +00:00
chs 33359b3121 need to include sys/socket.h here now, sys/mount.h no longer does it for us. 2005-09-24 15:42:58 +00:00
christos 58b392c018 make this compile again. 2005-09-13 03:23:09 +00:00
kent 868a42c866 fix a compilation problem on NetBSD/amd64 2005-08-20 15:02:36 +00:00
christos b041fac92d Fix lossage I created with the 64 bit ino_t change. 2005-08-19 04:24:38 +00:00
christos 758a209d23 64 bit inode changes. 2005-08-19 02:03:49 +00:00
cube ae35d4a4e9 Regen (__sigtimedwait(2)). 2005-07-23 22:04:12 +00:00
cube 73fe747f11 Implement __sigtimedwait(2). 2005-07-23 22:03:45 +00:00
cube a6b803a79f Constify conversion functions. 2005-07-23 21:51:29 +00:00
cube 21472d491b Regen (timer_create(2) and friends). 2005-07-23 18:57:07 +00:00
cube 23a1110cbd Implement the timer_create(2) family of syscalls. 2005-07-23 18:56:15 +00:00
cube ee24060ae4 Remove duplication of code for netbsd32_wait4() by using stackgap(9). 2005-07-22 22:46:29 +00:00
cube 86f97cc446 Do the CHECK_ALT_EXIST dance again in netbsd32_execve(). It was lost in
previous commit.
2005-07-13 11:55:19 +00:00
cube e13e6c14c7 netbsd32_execve2() doesn't exist anymore. 2005-07-13 11:53:57 +00:00
martin e14ba58310 When returning 64bit values (from netbsd32_lseek) fix up the return
value vector (of 32bit values, most likely) via a MD macro.
2005-07-12 15:06:17 +00:00
cube e937141b42 Regen (*xattr(2)). 2005-07-12 07:46:19 +00:00
cube 728e5e01bd Add the *xattr(2) family of syscalls. Just like the *extattr(2) family,
they're waiting for an actual FS back-end to be tested, but are still
straightforward enough.
2005-07-12 07:45:34 +00:00
cube 0477abe883 Regen (rasctl(2)). 2005-07-11 20:18:52 +00:00
cube 241e7db4d5 Add rasctl(2). Thanks to the regression tests for that syscall, I was able
to discover the bugs in netbsd32_setitimer() and netbsd32_execve().
2005-07-11 20:18:05 +00:00
cube 355bcba766 Split sys_execve() and add execve1() that does most of the work, and takes
as an argument a function that will retrieve an element of the pointer
arrays in user space.  This allows COMPAT_NETBSD32 to share the code for
the emulated version of execve(2), and fixes various issues that came from
the slow drift between the two implementations.

Note:  when splitting up a syscall function, I'll use two different ways
       of naming the resulting helper function.  If it stills does
       copyin/out operations, it will be named <syscall>1().  If it does
       not (as it was the case for get/setitimer), it will be named
       do<syscall>.
2005-07-11 20:15:26 +00:00
cube 08fd92bac5 Split sys_getitimer and sys_setitimer to make it possible to share the
relevant code with the COMPAT_NETBSD32 version, and make the latter use
the new functions.

This fixes netbsd32_setitimer() which had drifted from the native syscall
and did not work properly anymore.
2005-07-11 19:50:42 +00:00
cube 0057da6efa NOFOLLOW should be passed to NDINIT() instead of FOLLOW for lstat(2).
Reported by Martin Husemann.
2005-07-10 16:34:53 +00:00
cube 4a8942e74c Regen. 2005-07-10 14:32:35 +00:00
cube 7e3a28a419 Add support for fsync_range(2). 2005-07-10 14:32:16 +00:00
cube c6a5f27efa Regen. 2005-07-10 11:29:35 +00:00
cube b01a57e4ce Implement __clone(2). 2005-07-10 11:28:58 +00:00
cube 91598566dc Report changes from sys_wait4(). 2005-07-10 11:28:03 +00:00
cube 16e20b37d6 Regen. 2005-07-09 22:40:34 +00:00
cube 57017881b4 Implement pselect(2) and pollts(2). 2005-07-09 22:40:13 +00:00
cube 0056ee71b1 Make netbsd32_select() use selcommon() instead of a gross copy/paste of
the old sys_select() code.
2005-07-09 21:58:09 +00:00
cube 0d4567cd91 Regen. 2005-07-08 22:22:19 +00:00
cube 01f1f7ce7d Add mlockall(2) and munlockall(2). 2005-07-08 22:21:43 +00:00
cube e1c5d71d3d Regen 2005-07-08 21:40:26 +00:00
cube dfc332d6df Implement the extattr(3) family of syscalls.
XXX However, those remain untested as there are currently no backend for
XXX extattr(9) in NetBSD.
2005-07-08 21:39:39 +00:00
cube a31209bb48 Regen 2005-07-04 00:27:15 +00:00
cube d500f440df Implement uuidgen(2). 2005-07-04 00:26:06 +00:00
cube 72f6b3a65c Constify machine32 and machine_arch32. 2005-07-03 17:18:02 +00:00
cube 6f082c10a9 Make COMPAT_NETBSD32 emulate hw.machine. While it might seem wrong to do
so, it introduces breakage because a lot of applications make assumptions
from its value.  It's especially bad in the sparc64 case, where 64-bits
instructions can be used in 32-bits addressing mode.  However, there are
other means to know the capabilities of the CPU.
2005-07-03 16:53:46 +00:00
atatat fc1ed39348 Also fix (wrt the new const stuff) the one user of sysctl_locate()
outside of the main sysctl code.
2005-06-22 03:13:34 +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
matt e1245a3c46 Rework the coredump code to have no explicit knownledge of how coredump
i/o is done.  Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o.  This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.
2005-06-10 05:10:12 +00:00
matt 25a0e29a75 When writing coredumps, don't write zero uninstantiated demand-zero pages.
Also, with ELF core dumps, trim trailing zeroes from sections.  These two
changes can shrink coredumps by over 50% in size.
2005-06-02 17:01:43 +00:00
drochner bce73c1519 in siginfo conversion functions, declare the source operand as "const" 2005-06-02 10:27:43 +00:00
christos d2dc83130f - add const
- avoid shadowed variables.
2005-05-31 00:41:09 +00:00
chs a38226d23a regen 2005-05-30 23:00:39 +00:00
chs 3f12eda6dc track change to swapctl args in kern/syscalls.master. 2005-05-30 22:59:55 +00:00
elad 5888b16eef Some changes in veriexec.
New features:

  - Add a veriexec_report() routine to make most reporting consistent and
    remove some common code.
  - Add 'strict' mode that controls how veriexec behaves.
  - Add sysctl knobs:
     o kern.veriexec.verbose controls verbosity levels. Value: 0, 1.
     o kern.veriexec.strict controls strict level. Values: 0, 1, 2. See
       documentation in sysctl(3) for details.
     o kern.veriexec.algorithms returns a string with a space separated
       list of supported hashing algorithms in veriexec.
  - Updated documentation in man pages for sysctl(3) and sysctl(8).

Bug fixes:

  - veriexec_removechk(): Code cleanup + handle FINGERPRINT_NOTEVAL
    correctly.
  - exec_script(): Don't pass 0 as flag when executing a script; use the
    defined VERIEXEC_INDIRECT - which is 1. Makes indirect execution
    enforcement work.
  - Fix some printing formats and types..
2005-05-19 20:16:19 +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
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
perry 77f2a006d0 regen 2005-02-26 23:58:19 +00:00
perry 5acf93db4e make this rebuild generated files by default 2005-02-26 23:44:37 +00:00
perry 477853c351 nuke trailing whitespace 2005-02-26 22:58:54 +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
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
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
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
atatat e5004170aa Be consistent about using sysc_init_field() 2004-04-27 03:49:03 +00:00
hannken fcd7f3df90 Fix statfs->statvfs fallout. 2004-04-22 14:32:09 +00:00
christos e6f05cd289 Add the missing 'v' to fhstatvfs1 2004-04-22 12:04:03 +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
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +00:00
drochner 60cbbd8f70 use netbsd32_sigcode with COMPAT_16 only 2004-03-26 18:38:55 +00:00
drochner 4f5b1431f9 all ports define __HAVE_SIGINFO now, so remove the CPP conditionals 2004-03-26 15:01:16 +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
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
mrg 6f15ac16fc delete ktrsyscall32() prototype 2004-01-21 11:28:30 +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
fvdl d99705e941 Put back Emmanuel's sigfilter hooks, as decided by Core. 2003-12-20 19:01:29 +00:00
manu b23b73b953 Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.
2003-12-20 18:22:16 +00:00
jdolecek 0e253cf5f5 back the sigfilter emulation hook change off 2003-12-05 21:12:42 +00:00
atatat 13f8d2ce5f Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 19:38:21 +00:00
manu 18e13eee35 Add a sigfilter emulation hook. It is used at the beginning of kpsignal2()
so that a specific emulation has the oportunity to filter out some signals.

if sigfilter returns 0, then no signal is sent by kpsignal2().

There is another place where signals can be generated: trapsignal. Since this
function is already an emulation hook, no call to the sigfilter hook was
introduced in trapsignal.

This is needed to emulate the softsignal feature in COMPAT_DARWIN (signals
sent as Mach exception messages)
2003-12-03 20:24:51 +00:00
thorpej 052ba0ec50 We have CVS; there is no reason to make .bak files when generating the
syscall tables.
2003-11-15 20:30:59 +00:00
drochner 714de0452f adapt for changes to kern/exec_elf32.c 2003-10-31 14:04:35 +00:00
christos 2e92e66166 don't use extra variables where there is no need to. 2003-10-26 19:13:18 +00:00
christos 4ca54df1ef Don't do the tsleep dance if timo is 0; simplify the code. 2003-10-26 19:12:50 +00:00
lukem f85d2d1c14 Use ${HOST_SH} instead of `sh'.
If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
2003-10-26 07:25:33 +00:00
chs 359e5c8c2e regen 2003-10-25 16:28:09 +00:00
chs b9a4f8c809 allow COMPAT_SUNOS without COMPAT_43. 2003-10-25 16:27:25 +00:00
fvdl f4fff513a1 Fix NULL vs. int comparison. 2003-10-21 01:44:45 +00:00
fvdl 38bee36b4c Fix some int vs. NULL comparisons. 2003-10-21 01:38:42 +00:00
fvdl d114e05b9c Don't compare an integer value against 0. 2003-10-21 01:20:12 +00:00
fvdl 4b84b8d930 Don't put the netbsd32_compat*.c files in the 'compat library'. Unconditionally
compiling these causes a ripple effect making it hard to conditionalize
anything on COMPAT_* in the kernel.
2003-10-15 13:32:14 +00:00
fvdl ff376b0763 Implement 32bit get/setcontext entry points. 2003-10-13 18:55:30 +00:00
fvdl fd1fb232de Regenerate. 2003-10-13 18:54:57 +00:00
fvdl 4a68d0f9cb Define compat_16 as valid prefix; define the 1.6 compat sigreturn. 2003-10-13 18:53:35 +00:00
agc b2b49933f4 Move Matt Green's code from a 4-clause to a 3-clause licence by removing
the advertising clause. Diffs provided in PR 22396 by Joel Baker, the changes
were confirmed to the board by Matt Green.
2003-10-13 14:22:20 +00:00
chs efdef4fa03 fix typo in previous. 2003-10-11 10:36:46 +00:00
matt 77a7f39625 Define SIGINFO variant of netbsd32_sendsig when __HAVE_SIGINFO is defined. 2003-10-10 23:18:57 +00:00
christos deacebb910 Add necessary include file. 2003-09-26 21:28:24 +00:00
christos 25f1b29f36 bring in MI declarations. 2003-09-26 18:10:32 +00:00
jdolecek 7cea8a1389 cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
  the owner of descriptor, according to appropriate sematics
  of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
  these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
  properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
  in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
  pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
2003-09-21 19:16:48 +00:00
christos dd61a2eb87 catch up with latest sigctx changes; reported by John Heasley, thanks! 2003-09-15 18:35:02 +00:00
rafal ece5b8e67d Catch up to Christos' SIGINFO changes. 2003-09-07 21:37:19 +00:00
chs 939df36e55 add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default.  the changes
fall into two basic catagories:

 - pmap and trap-handler changes.  these are all MD:
   = alpha: we already track per-page execute permission with the (software)
	PG_EXEC bit, so just have the trap handler pay attention to it.
   = i386: use a new GDT segment for %cs for processes that have no
	executable mappings above a certain threshold (currently the
	bottom of the stack).  track per-page execute permission with
	the last unused PTE bit.
   = powerpc/ibm4xx: just use the hardware exec bit.
   = powerpc/oea: we already track per-page exec bits, but the hardware only
	implements non-exec mappings at the segment level.  so track the
	number of executable mappings in each segment and turn on the no-exec
	segment bit iff the count is 0.  adjust the trap handler to deal.
   = sparc (sun4m): fix our use of the hardware protection bits.
	fix the trap handler to recognize text faults.
   = sparc64: split the existing unified TSB into data and instruction TSBs,
	and only load TTEs into the appropriate TSB(s) for the permissions.
	fix the trap handler to check for execute permission.
   = not yet implemented: amd64, hppa, sh5

 - changes in all the emulations that put a signal trampoline on the stack.
   instead, we now put the trampoline into a uvm_aobj and map that into
   the process separately.

originally from openbsd, adapted for netbsd by me.
2003-08-24 17:52:28 +00:00
christos 3b9c3c5aab - GC all the setup_stack functions
- add one for linux/i386
2003-08-08 18:57:01 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
martin 69cd0c4a54 struct proc * -> struct lwp * 2003-06-29 13:33:51 +00:00
martin 2edcbf6bb2 struct proc * -> struct lwp * 2003-06-29 10:37:45 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
martin d505b18964 Make sure to include opt_foo.h if a defflag option FOO is used. 2003-06-23 11:00:59 +00:00
christos c56f7f428b get rid of the ASYNCMAP ioctls 2003-04-12 05:00:38 +00:00
thorpej f4a068d5c2 Use PAGE_SIZE rather than NBPG. 2003-04-01 01:43:29 +00:00
dsl 71d53fb2ed Use find_stopped_child() and proc_free() in compat wait() code to
avoid code duplication.
(approved by christos)
2003-02-14 10:19:14 +00:00
fvdl a3ff3a3038 Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
2003-01-24 21:55:02 +00:00
thorpej d88bc9c3a2 Regen for correct RCS ID. 2003-01-18 23:36:48 +00:00
thorpej 27bb1001b7 Regen: Merge the nathanw_sa branch. 2003-01-18 08:29:08 +00:00
thorpej 6acc60d22d Merge the nathanw_sa branch. 2003-01-18 08:28:25 +00:00
thorpej e8cc3884de Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is. 2002-12-10 17:14:02 +00:00
thorpej 78ea2dd367 Use __LDPGSZ (which must be == USRTEXT) as the text address for a.out
executables, and eliminate the USRTEXT constant, which was only used
by the a.out exec code.
2002-12-10 05:14:24 +00:00
scw dc63c50793 After a discussion with various folks, fix the strict-alias warning
by ditching 'void *rt' and passing retval directly to sys_mmap().
2002-12-06 12:00:57 +00:00
scw f88b19a600 Avoid strict-alias warnings. 2002-12-06 09:57:58 +00:00
agc 35a5ff86d4 Make this compile in the presence of -Werror 2002-12-01 11:02:11 +00:00
jdolecek 1bf46cc0f0 use emul_find_interp(), rathern than calling emul_find() second time
with prefix set to "/"
XXX not tested
2002-11-29 19:15:15 +00:00
atatat 7caa308c63 Complete the rename: s/sa_/<compat>_sa_/g
Also tweak the darwin siginfo stuff to avoid the same type of collision.
2002-11-27 16:44:01 +00:00
jdolecek 22ca1fc9f1 set nsysent to 512 2002-11-01 20:32:13 +00:00
jdolecek 1524c4bf08 set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL 2002-11-01 19:26:21 +00:00
scw 305ef1efe0 Regen to pick up netbsd32___sigaction_sigtramp addition. 2002-10-23 13:18:17 +00:00
scw cb52115837 In preparation for COMPAT_NETBSD32 on SH-5:
- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
   instead of using u_int32_t everywhere,
 - The MD netbsd32_machdep.h header now defines a macro (at least on
   current implementations) which converts a 32-bit pointer to its 64-bit
   equivalent,
 - Change the MI code to utilise the above two items in all the right places,
 - Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
2002-10-23 13:16:38 +00:00
chs 993948e989 count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
2002-10-05 22:34:02 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00