Commit Graph

172 Commits

Author SHA1 Message Date
tnn 8134e656ee fd_revoke: variable vattr is no longer used. 2008-01-09 20:45:19 +00:00
elad 4b3ae01c7d Refactor part of the sys_revoke() code so that it can be used in the
compat code. Allows for the removal of two redundant kauth(9) calls.

okay christos@.
2008-01-09 08:18:12 +00:00
elad 9798c4cd61 In svr4_32_sys_systeminfo(), remove two redundant kauth(9) calls for
SVR4_SI_SET_HOSTNAME and SVR4_SI_SET_SRPC_DOMAIN, as permission is already
checked by old_sysctl().

okay christos@.
2008-01-08 22:13:07 +00:00
dsl 95a195791a Use FILE_LOCK() and FILE_UNLOCK().
Attempt to fix all the code paths so that the 'fp' returned by fd_getfile()
isn't left locked, and is always unlocked (and ref-counted) before
doing anything that might sleep.
2008-01-05 19:14:07 +00:00
hannken bdc290470e maxfiles is now an u_int. 2007-12-28 10:00:18 +00:00
hannken f20fe37f57 Fix include order: netbsd32_syscallargs.h needs svr4_32_types.h. 2007-12-23 10:18:48 +00:00
dsl 9b6e62c6a8 Reinstate some code I commented out. 2007-12-20 23:16:13 +00:00
dsl 6fb2884c3a regen 2007-12-20 23:07:25 +00:00
dsl 7e2790cf6f Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
    int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
2007-12-20 23:02:38 +00:00
martin 3abe4cb17d Remove *64 versions identical to their 32 bit version and aliased differently
now.
2007-12-18 11:05:53 +00:00
dsl 5c3e6d0c07 Regen for 'const' killing. 2007-12-17 22:05:41 +00:00
dsl 06bce1608a Remove all the 'const', they end up applying to the structure members
themselves, not where the 32bit pointers reference.
2007-12-17 22:04:32 +00:00
dsl 4f69eadcae svr4_32_sys_creat64() and svr4_32_sys_creat() are equivalent, as are
open64 and open, so just have one set of entry points.
2007-12-17 21:58:34 +00:00
dsl 36fb6d9db7 Revert previous. 2007-12-17 21:48:23 +00:00
dsl a098759aae creat64 and open64 just called the creat/open function.
Change to do it here.
2007-12-17 21:39:17 +00:00
dogcow 9ad45b39e6 more NDINIT fallout. not completely compile-tested. 2007-12-09 13:34:23 +00:00
dsl 28bae79b27 ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
2007-12-08 18:35:53 +00:00
dyoung 5a740a2a51 Extract common code into subroutine svr4_count_ifnum().
Don't open-code queue(3) macros (x = ifnet.tqh_first; y =
x.if_list.tqe_next).  Instead, use the macros themselves.

Use IFNET_FOREACH() and IFADDR_FOREACH().
2007-12-05 01:10:47 +00:00
dsl f2af9174b9 Remove all the __P 2007-12-04 18:40:07 +00:00
ad 23589af2fb lwp arg to VOPs is gone. 2007-11-27 22:12:24 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
ad 99b0354fb8 v_flag -> v_iflag 2007-10-10 21:59:11 +00:00
ad 451aacda90 Merge file descriptor locking, cwdi locking and cross-call changes
from the vmlocking branch.
2007-10-08 15:12:05 +00:00
dsl 4f7a91fae3 Do the sysv ipc calls without the stackgap.
Only the SET and STAT operations have a buffer arg - so don't xlat
the buffer for the other commands.
2007-06-17 18:54:20 +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
dsl 79b4d16759 KNF and layout changes to match (my copy of) svr4/svr4_stream.c 2007-06-01 22:15:38 +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 701496b5c6 Split the fcntl locking code out from its copyin/out.
Use to avoid all the stackgap stuff in compat code.
2007-05-12 23:02:49 +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 8932ebd238 Remove some unused calls to stackgap_init() 2007-04-30 09:20:18 +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
cube e80df1a6aa Typo. Reported by martin. 2007-03-20 09:11:04 +00:00
dsl d364d308c7 Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx). 2007-03-18 21:38:32 +00:00
dsl a065e51621 remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers.  Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
2007-03-16 22:21:40 +00:00
dsl 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 fffc9c66c9 fix fallout from caddr_t changes. 2007-03-04 07:54:07 +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 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