Commit Graph

507 Commits

Author SHA1 Message Date
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
dsl 1cb4e9208d Rip out the support for /dev/ptmx, the netbsd ptm driver will now DTRT.
It probably ought to have minor 2 (ie do the chown/chmod/revoke on open)
because the SVR4 programs dont know anything about revoke.
2007-07-05 19:19:24 +00:00
dsl a9e905f23c Refactor this to use the new do_sys_xxx() functions from uipc_syscalls.c
so that it isn't necessary to copy data to/from the stackgap.
Given the nature of the code in this file, it is now probably slightly
  more broken than previously. but nothing serious should be worse!
2007-06-24 18:09:52 +00:00
dsl c99470165c Do the sysv ipc calls without the stackgap.
Only the SET and STAT operations have a buffer arg - so don't xlat
onbe for teh other commands.
2007-06-17 18:32:14 +00:00
dsl ec918d6dc6 Modify the (recently added) compat_sigaltstack() #define to take the
values of the SS_ONSTACK and SS_DISABLE constants.
Use it to shorten the source files when this action is replicated.
Actually, given the monstrous complexity of sigaltstack1() there is
probably a much better way to do this...
2007-06-16 20:04:27 +00:00
dsl 44250a9038 Add some 'magic' defines so that we can build the svr4_32 version of this
code from the same source file as the svr4 copy.
I suspect this cpuld be done in other places....
2007-06-02 21:39:27 +00:00
dsl d7f93c5c67 Split sys_bind() and sys_connect() so that compat code can use common code
once the 'address' has been copied into an mbuf.
Add extra flags for 'struct msghdr.msg_flags' to indicate that the address
  and control are already in mbufs, and that the uio structure is in userspace
  for sending data, rename sendit() to do_sys_sendmsg() to ensure no old code
  passes in random flags.
Changes to compat code to use new functions - removing some stackgap use.
Fix a 'use after free' in compat_43_sys_recvmsg.
I ***THINK*** the code that converts 'cmsg' formatted data is borked!
svr4_stream.c ought to be generated from svr4_32_stream.c during the build.
2007-06-01 22:53:52 +00:00
christos 20bfd9898e Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
2007-05-29 21:32:27 +00:00
dsl e3b7b0151e Rework the svr4_32 fcntl support (again).
Make the same changes to the svr4 code.
Add some 'missing' simple_unlock(&fp->f_slock) to the svr4_32 version of this
code. These files now compare if feed the svr4_32 copy though:
	sed -e 's/4_32/4/g;s/_P32//g'
Note in passing that the code paths that call simple_unlock(&fp->f_slock)
are completely broken.
2007-05-13 08:14:06 +00:00
dsl c0ac33ed01 Remember to call calcru() before using the rusage values. 2007-05-12 18:10:20 +00:00
dsl c83f8a10ad Change the compat sys_[fl]utime code to not use the stackgap. 2007-05-12 17:28:19 +00:00
dsl 76bef02b3a Remove some more uses of the 'stackgap' - the code is a lot simpler if
we just access stuff like l->l_proc->p_stats->p_ru instead of copying it
to and from userspace.
2007-05-12 14:09:34 +00:00
dsl 1844147fa9 Split sys_wait4() so that compat code can fiddle with the returned 'status'
and 'rusage' without having to copy data to/from stackgap buffers.
The old split (find_stopped_child) could be removed.
amd64 seems to run netbsd32, linux and linux32 emulations. sparc64 compiles.
2007-05-07 16:53:17 +00:00
dsl 92ab0cdf99 Always pick 'rusage' from p->p_stats->p_ru, p->p_ru is dead and gone. 2007-05-01 17:22:32 +00:00
dsl 906b9af2a7 Rework compat stat() and statvfs() code so that it no longer uses the stackgap. 2007-04-30 14:05:47 +00:00
dsl b8fbaf8c4b Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
  - which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
  the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
  during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
  search for absolute pathnames in the emulation root, if that fails it will
  retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
  of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
  relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
  inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
  the real root is returned instead (matching the behaviour of emul_lookup,
  but being a cheap comparison here) so that programs that scan "../.."
  looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
  CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
  TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
2007-04-22 08:29:55 +00:00
hannken e956461048 Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-07 15:06:53 +00:00
dsl 893faeae9e Update all the compat stuff to not use the 'stackgap' for processing
sys_stat() and friends, instead use do_sys_stat() and do_sys_fstat()
that write the answer into a kernel buffer (on stack) that can be
converted to the correct form and written the userspace.
I've test compiled a few kernels, and tested i386 netbsd1.6 ls.
Given I think I've fixed some bugs, it might be 50-50 with new ones.
2007-03-10 21:40:23 +00:00
ad c147748d84 - Make the proclist_lock a mutex. The write:read ratio is unfavourable,
and mutexes are cheaper use than RW locks.
- LOCK_ASSERT -> KASSERT in some places.
- Hold proclist_lock/kernel_lock longer in a couple of places.
2007-03-09 14:11:22 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
cube 632ece3eaf Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create.  It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.
2007-02-19 15:10:02 +00:00
ad 57aa4fbf3b proc_free() was returning a NULL rusage pointer to wait() when a traced
process was reparented. Change proc_free() to copy the rusage to a buffer
on the stack if required, so it can be passed both to the debugger and
to the real parent process.

Fixes kern/35582 (kernel panics with gdb).
2007-02-16 00:39:16 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +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 b31e9c44cf Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 18:27:36 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
martin dda2fa3e76 Make it compile with -Wextra 2006-10-16 20:18:55 +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
yamt 9d3e3eab23 merge yamt-pdpolicy branch.
- separate page replacement policy from the rest of kernel
	- implement an alternative replacement policy
2006-09-15 15:51:12 +00:00
christos 1ae1244b82 avoid empty if body. 2006-09-13 00:57:29 +00:00
christos 1b87f8e9cc add missing initializer 2006-09-03 06:29:03 +00:00
christos 59d19c4947 add missing initializers 2006-09-03 06:28:16 +00:00
christos 35ca6c8b5b Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!
2006-08-17 17:11:27 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +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
christos 430ad9c2a9 don't allocate > 1K on the stack. 2006-06-13 02:31:28 +00:00
christos d5ba7564d8 stack police: don't allocate statvfs on the stack. 2006-06-09 23:24:24 +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
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 a07ab709de cast to (lwpid_t *) where appropriate. 2006-05-11 01:00:43 +00:00
mrg de67006891 cast to (socklen_t *) where appropriate. 2006-05-11 01:00:02 +00:00
macallan f8e479a39b correct a typo 2006-04-02 17:09:01 +00:00
macallan 3bd975beb8 declare len before using it 2006-04-02 17:08:23 +00:00
christos af0a2a9e7a Add a new lifnum sockio. 2006-04-02 07:17:16 +00:00
christos e5c9c0c478 minor nits 2006-04-02 06:44:23 +00:00
macallan c0007febd1 add a dummy implementation of the schedctl() syscall 2006-04-02 06:34:18 +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