Commit Graph

4270 Commits

Author SHA1 Message Date
dsl
cfc18fc34b Remove all the __P from here, including the other other mismatched one
that my sed script left behind and 'he' didn't notice.
2007-12-05 00:31:01 +00:00
he
5b4fada2e1 Re-balance a parenthesis. 2007-12-04 22:43:50 +00:00
dsl
f2af9174b9 Remove all the __P 2007-12-04 18:40:07 +00:00
ad
86b20896d3 Use system-provided atomic ops. 2007-11-29 14:29:29 +00:00
pooka
e49789dd46 more l removal 2007-11-28 18:50:10 +00:00
ad
16b547ec7f Please can we nuke this code? 2007-11-28 18:45:03 +00:00
he
756f91194a Follow up the removal of the lwp argument to VOP_ functions.
In some cases, use curlwp instead of the now missing argument.
2007-11-28 10:34:37 +00:00
dogcow
3c143b9440 more lwp cacking fallout 2007-11-27 23:30:56 +00:00
ad
23589af2fb lwp arg to VOPs is gone. 2007-11-27 22:12:24 +00:00
dogcow
6c09f19fb4 and one more lwp removal victim 2007-11-27 11:25:29 +00:00
dogcow
3465a006e9 more VFS_STATVFS(x,y,z) fallout; change them to VFS_STATVFS(x,y). (hi, pooka!) 2007-11-27 09:47:15 +00:00
he
0bfa260fce Remove a now-unused variable. 2007-11-26 23:16:15 +00:00
pooka
61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +00:00
elad
abb7851f4d Refactor time modification checks and place them in the secmodel code.
okay christos@
2007-11-25 00:35:26 +00:00
christos
3714528495 - move the save context before the signal reset (Arto Huusko)
- set the sigcontext cr2
2007-11-24 23:52:56 +00:00
elad
1d139a3075 Modify hpux_sys_stime_6x() to call settime(), like everyone else do.
okay christos@.
2007-11-24 20:43:34 +00:00
njoly
204ebc94bf Regen. 2007-11-16 12:58:12 +00:00
njoly
601a0e5173 Update, for linux_sys_readlink() removal. 2007-11-16 12:56:50 +00:00
njoly
cb572617af Regen, for syscalls cleanup. 2007-11-16 12:53:56 +00:00
njoly
6412bda281 Cleanup. Remove a few linux syscalls definitions, now identical to
native ones (with stackgap and ALT_CHECK_xxx removal). No functional
changes expected.
2007-11-16 12:51:54 +00:00
dsl
300078900a regen 2007-11-12 22:23:29 +00:00
dsl
9bb5de8a76 syscall() needs to be 'NOARGS INDIR'.
Actually I wonder if this code could use the standard syscall table ?
2007-11-12 22:23:01 +00:00
christos
2e3ee66dc7 regen 2007-11-11 18:28:18 +00:00
dsl
f36a9ec28b Fix builds for ports that don't define __HAVE_MINIMAL_EMUL (eg sparc64).
Fallout from a change that made #define names for syscalls (etc) start
NETBSD32 (not netbsd32).
2007-11-10 18:55:42 +00:00
dsl
ddd89ca02b regen 2007-11-10 13:24:27 +00:00
dsl
b6b07a31fd Mark 'syscall' as 'NOARGS INDIR" 2007-11-10 13:23:18 +00:00
dsl
2cabf5c1f0 Remove the pecoff system table defines, they aren't needed since the
emulation uses a user-space library and normal netbsd calls.
2007-11-10 09:41:01 +00:00
njoly
d16de24e5a Make linux32_sys_oldolduname use LINUX_UNAME_ARCH instead of machine,
like other uname syscalls. While here, remove unneeded
LINUX_UNAME_ARCH #ifdef/#endif checks.
2007-11-09 17:43:17 +00:00
dsl
ee077208d9 Regen 2007-11-09 15:10:27 +00:00
dsl
3107f9cd42 Add arguments to sys_syscall and sys___syscall.
Use MI wrappers for them in netbsd32.
Change prefix for constants from netbsd32 to NETBSD32 (used in #defines etc).
2007-11-09 15:05:33 +00:00
njoly
23e9f9fa6f Replace strncpy with strlcpy in compat linux and linux32 uname,
old_uname and oldold_uname syscalls to ensure that all *utsname fields
are always NUL terminated.
2007-11-08 21:07:23 +00:00
njoly
577cb10855 Regen for 64-bit linux syscalls removal. 2007-11-07 00:25:39 +00:00
njoly
b32d95bfbf Remove remaining 64-bit compat linux syscalls linux_sys_xxx() (except
for ones without arguments), and replace them by their 32-bit
equivalent linux32_sys_xxxx().
2007-11-07 00:24:29 +00:00
ad
d831186d55 Merge scheduler changes from the vmlocking branch. All discussed on
tech-kern:

- Invert priority space so that zero is the lowest priority. Rearrange
  number and type of priority levels into bands. Add new bands like
  'kernel real time'.
- Ignore the priority level passed to tsleep. Compute priority for
  sleep dynamically.
- For SCHED_4BSD, make priority adjustment per-LWP, not per-process.
2007-11-06 00:42:39 +00:00
rmind
6364fdeba5 - Replace lockmgr with mutex;
- Use condvars instead of tsleep/wakeup;
- Replace malloc with kmem;
- Use itimespecfix/tstohz;

Reviewed by <ad>.
2007-11-04 11:10:34 +00:00
oster
77002eb972 This should be a mutex_enter() instead of a mutex_exit().
Fixes:
Mutex error: mutex_vector_exit: assertion failed: MUTEX_OWNER(mtx->mtx_owner) == curthread
...
mutex_abort(c0aba23c,c07bf8b0,c09c9164,bfbfee34,10) at netbsd:mutex_abort+0x36
mutex_vector_exit(c0aba23c,10,c0aba23c,ca8efc6c,ca8f8540) at netbsd:mutex_vector_exit+0xe2
compat_20_sys_getfsstat(ca8f8540,cb243c48,cb243c68,805eb24,805e000) at netbsd:compat_20_sys_getfsstat+0x1bf
...
2007-11-01 03:49:52 +00:00
dsl
36acfb90ed regen 2007-10-31 22:39:17 +00:00
dsl
16c3c9c541 This file must use the netbsd32_xxx() system calls, not the sys_xxx() ones.
The latter actually function (due to luck) for calls with one argument,
but will fail badly if more than one is required.
Noticed as an error in the ktrace outut by Nicolas Joly, reported on
tech-kern.
2007-10-31 22:35:34 +00:00
njoly
beab9df119 Regen for syscalls cleanup. 2007-10-31 21:06:19 +00:00
njoly
6f36d09e87 compat linux32 syscalls cleanup.
With stackgap and CHECK_ALT_xxx removal, some linux32 and netbsd32
syscalls are now identical.
To avoid code duplication, remove the linux32 definition and use the
netbsd32 one (no functional change).
2007-10-31 21:04:02 +00:00
njoly
99e027abbb Remove extra return 2007-10-31 09:16:55 +00:00
njoly
d57ae6a62d Regen for chown additions. 2007-10-27 09:17:50 +00:00
njoly
97151f15f1 Add missing chown's syscalls family members.
This makes chown(1)/chgrp(1) works under compat linux32.

Problem reported and fix tested by Arto Huusko. Thanks.
2007-10-27 09:16:24 +00:00
pooka
ea84bd1c76 vfs_getopsbyname("ngs") -> vfs_getopsbyname("nfs"). 'nuff said 2007-10-23 15:21:31 +00:00
njoly
a478f23b9e Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
2007-10-19 18:52:09 +00:00
ad
a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
he
167a62205a Follow up the removal of the lwp_t* argument to do_filereadv() and
do_filewritev().
2007-10-11 13:51:12 +00:00
ad
53b26d467e mountlist_slock is now a mutex. 2007-10-10 22:00:53 +00:00
ad
99b0354fb8 v_flag -> v_iflag 2007-10-10 21:59:11 +00:00
ad
7dad9f7391 Merge from vmlocking:
- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
2007-10-10 20:42:20 +00:00
ad
62fdbc4b9a LOCK_ASSERT -> KASSERT 2007-10-08 18:07:24 +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
ad
74dc12ed8b fxsave() is a function, don't re-use the name. 2007-10-03 10:54:16 +00:00
he
525420f3c8 Remove a now-unused local variable. 2007-09-30 10:35:16 +00:00
dsl
2e20a70dbf Change the way p->p_limit (and hence p->p_rlimit) is locked.
Should fix PR/36939 and make the rlimit code MP safe.
Posted for comment to tech-kern (non received!)

The p_limit field (for a process) is only be changed once (on the first
  write), and a reference to the old structure is kept (for code paths
  that have cached the pointer).
Only p->p_limit is now locked by p->p_mutex, and since the referenced memory
  will not go away, is only needed if the pointer is to be changed.
The contents of 'struct plimit' are all locked by pl_mutex, except that the
  code doesn't bother to acquire it for reads (which are basically atomic).
Add FORK_SHARELIMIT that causes fork1() to share the limits between parent
  and child, use it for the IRIX_PR_SULIMIT.
Fix borked test for both IRIX_PR_SUMASK and IRIX_PR_SDIR being set.
2007-09-29 12:22:30 +00:00
dsl
2b7c33c183 Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.
2007-09-29 10:47:45 +00:00
dsl
4bacff8183 Rename members of 'struct plimit' so that the fields are 'pl_xxx' and
no longer have the same names as members of 'struct proc'.
2007-09-21 19:19:20 +00:00
mlelstv
4bb7dae272 Implement OSS_SNDCTL_DSP_GETODELAY and provide a no-op function
for OSS_SNDCTL_DSP_PROFILE.
2007-09-18 19:49:53 +00:00
dsl
06b0a1bdab Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.
2007-09-16 22:35:01 +00:00
gdt
9768560fd7 remove SIOCSIFALIFETIME_IN6 (should have been part of previous commit) 2007-09-11 19:59:18 +00:00
cube
7a185660d8 Some more licence clean up. 2007-09-10 10:54:20 +00:00
cube
c725329722 Remove 3rd clause and my name from all the licences which were only in my
name.
2007-09-10 10:35:51 +00:00
dyoung
f59a11881a Constify: LLADDR() -> CLLADDR(). 2007-08-29 22:33:42 +00:00
dyoung
f004b71d98 Constify. 2007-08-26 22:36:35 +00:00
dyoung
e6fc91327f Use satosdl(). 2007-08-26 22:33:25 +00:00
martin
4418b58c3f Remove all ioctls from the conversion list that are explicitly defined
to use struct oifreq - the magic size changing makes them fail.
2007-08-20 19:19:33 +00:00
martin
2adca4d368 Sigh - revert previous. Seems we can't avoid the big list, so fill it.
Now both "ifconfig ... create" and "pppoectl -d" work again with old
userland.
2007-08-20 17:48:17 +00:00
martin
1bcc2150d3 Put back the previous hack to make compat_cvtcmd() work for all the ioctls
that use struct ifreq which have not been explicitly versioned.
If someone feels like fixing it with a list aproach, I think below is
a complete list - the one used in the previous version missed a lot of them.

BIOCGETIF
BIOCSETIF
GREDSOCK
GREGADDRD
GREGADDRS
GREGPROTO
GRESADDRD
GRESADDRS
GRESPROTO
GRESSOCK
SIOCADDMULTI
SIOCDELMULTI
SIOCDIFADDR
SIOCDIFADDR_IN6
SIOCDIFPHYADDR
SIOCGDEFIFACE_IN6
SIOCGIFADDR
SIOCGIFADDR_IN6
SIOCGIFAFLAG_IN6
SIOCGIFALIFETIME_IN6
SIOCGIFBRDADDR
SIOCGIFDLT
SIOCGIFDSTADDR
SIOCGIFDSTADDR_IN6
SIOCGIFFLAGS
SIOCGIFGENERIC
SIOCGIFMETRIC
SIOCGIFMTU
SIOCGIFNETMASK
SIOCGIFNETMASK_IN6
SIOCGIFPDSTADDR
SIOCGIFPDSTADDR_IN6
SIOCGIFPSRCADDR
SIOCGIFPSRCADDR_IN6
SIOCGIFSTAT_ICMP6
SIOCGIFSTAT_IN6
SIOCGPVCSIF
SIOCGVH
SIOCIFCREATE
SIOCIFDESTROY
SIOCSDEFIFACE_IN6
SIOCSIFADDR
SIOCSIFADDR_IN6
SIOCSIFALIFETIME_IN6
SIOCSIFBRDADDR
SIOCSIFDSTADDR
SIOCSIFDSTADDR_IN6
SIOCSIFFLAGS
SIOCSIFGENERIC
SIOCSIFMEDIA
SIOCSIFMETRIC
SIOCSIFMTU
SIOCSIFNETMASK
SIOCSIFNETMASK_IN6
SIOCSNDFLUSH_IN6
SIOCSPFXFLUSH_IN6
SIOCSPVCSIF
SIOCSRTRFLUSH_IN6
SIOCSVH
TAPGIFNAME
2007-08-20 16:52:59 +00:00
skd
d4509b0376 Clean up net compat ioctls, and clean up handling of wireless ioctls. 2007-08-20 04:49:40 +00:00
ad
d3675885a8 Regen. 2007-08-15 12:09:12 +00:00
ad
63c4506184 Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
2007-08-15 12:07:23 +00:00
ad
06f7ccf01d Regen. 2007-08-07 19:01:23 +00:00
ad
830ab6bb3c - Fix a bug with _lwp_park() where if the computed wakeup time was under
1 microsecond into the future, the thread could enter an untimed sleep.
- Change the signature of _lwp_park() to accept an lwpid_t and second
  hint pointer, but do so in a way that remains compatible with older
  pthread libraries. This can be used to wake another thread before the
  calling thread goes asleep, saving at least one syscall + involuntary
  context switch. This turns out to be a fairly large win on the condvar
  benchmarks that I have tried.
- Mark some more syscalls MP safe.
2007-08-07 19:00:42 +00:00
xtraeme
bd0460e614 <sys/proc.h> is needed to get nprocs... fixes the build on amd64. 2007-07-21 23:39:46 +00:00
he
2eb0397ad6 Fix three identical typos in the previous (fs_fstypename -> f_fstypename). 2007-07-20 13:48:24 +00:00
dsl
f3ade04dc0 include sys/cdefs.h 2007-07-19 22:17:23 +00:00
briggs
883152ac0b Fix typo: mnfromname -> mntfromname. 2007-07-18 13:53:34 +00:00
christos
f25f73fe50 include <compat/sys/mount.h> for MFSNAMELEN 2007-07-17 20:54:45 +00:00
christos
9558d8b2f1 include <compat/sys/mount.h> for MFSNAMELEN. 2007-07-17 20:53:49 +00:00
christos
289334c878 include <compat/sys/mount.h> for MFSNAMELEN 2007-07-17 20:51:15 +00:00
christos
35cb28e6eb kill MFSNAMELEN 2007-07-17 20:41:23 +00:00
christos
18754a7640 kill silly constants. 2007-07-17 20:39:42 +00:00
christos
ecb7144e3a include <compat/sys/mount.h> MFSNAMELEN 2007-07-17 20:36:11 +00:00
christos
66c05241ca include compat/sys/mount.h for MFSNAMELEN, although not used yet. 2007-07-17 20:34:40 +00:00
christos
1b3668b8ef use the compat MFSNAMELEN 2007-07-17 20:33:17 +00:00
christos
515c243672 MFSNAMELEN only belongs in compat. 2007-07-17 20:31:03 +00:00
joerg
e4fc1154a4 Add native mremap system call based on the UVM implementation for
Linux compat. Add code to enforce alignment of the new location.
Special thanks to wizd for helping with the man page.
2007-07-17 17:42:07 +00:00
ad
3fc1741f68 <dsl> I suspect my set of test build kernels is longer than ad's :-)
tsk!
2007-07-14 17:11:28 +00:00
dsl
0bfa8b4ee7 Adapt for sys_mount() becoming compat_40_sys_mount(), 2007-07-14 15:47:26 +00:00
dsl
df57a27c09 Change calls from sys_mount() to compat_40_sys_mount() 2007-07-14 15:45:48 +00:00
dsl
6b182ed9a7 Put the stackgap code under OPT_SYSTRACE. 2007-07-13 21:04:29 +00:00
dsl
12da34644a Update generated files. 2007-07-13 20:49:07 +00:00
dsl
f02523fb6e Remove all the syscall stubs that were only there to get files lookup
up in the alternate path.
2007-07-13 20:48:39 +00:00
dsl
cfc71184cd Make thsi compile again after the recent changes to select/poll.
It really should be doing things properly though.
2007-07-13 20:46:04 +00:00
dsl
758f9f5cde Change compat mount code to pass do_sys_mount() kernel resident buffers.
Possibly the standard nfs code needs teaching how to set the length and
address family in order to support non-netbsd sockaddr.
There are now no active stackgap() calls in the compat tree.
2007-07-12 19:41:57 +00:00
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
pooka
b6caa3be1b fix pasto: sigframe.sf_sc is of type linux_sigcontext 2007-07-08 09:41:00 +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
513b927545 It seems that min(16,16) isn't a compile time constant.
So don't bother limiting the local arrays to NGROUPS, just use 16.
2007-07-04 21:59:16 +00:00
dsl
8d3eb2476f Comment out the code that uses the stackgap to issue the WSDISPLAYIO_PUTCMAP
ioctl in order to change the display colours.
Changing the code to not need the stackgap is rather pervasive, and it isn't
at all clear this is useful effort given the suspected bitrottedness
of compat darwin.
2007-07-01 20:14:17 +00:00
dsl
813e1c7584 Fix long-term breakage in the definition of 'control' data for linux.
cmsg->cmsg_len is 'size_t' not 'socklen_t' - so it is 8 bytes on 64bit
platforms instead of 4.  There is also never padding after the header.
Redo linux sendmsg() so that it stands a chance of getting it right.
Redo linux recvmsg() so that it process control data directly from the mbuf
  list.  Allowing it to hack the data without using the stackgap.
2007-07-01 18:45:36 +00:00
dsl
bf215415ab Fix LINUX_HDIO_GET_IDENTITY so that it returns the entire 512 byte buffer.
Rely on the code in dev/ata/wd.c doing a relay for the short read needed
for LINUX_HDIO_OBSOLETE_IDENTITY.
2007-07-01 09:54:16 +00:00
dsl
168c1071b4 Call fp->f_ops->fo_ioctl() directly (not by sys_ioctl() for LINUX_VT_GETMODE
and LINUX_VT_SETMODE.  One fewer use of the stackgap.
2007-06-30 22:54:33 +00:00
dsl
a1188737bf Use the new CDIOCREADSUBCHANNEL_BUF and CDIOREADTOCENTRIES_BUF ioctls to
avoid copying into the stackgap.
2007-06-30 22:18:17 +00:00
dsl
53e0243f27 Changes to sompat socket function to avoid the dreaded stackgap. 2007-06-30 15:31:49 +00:00
dsl
4be2514b94 Match updates to kauth_cred_set/getgroups. 2007-06-30 13:34:19 +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
a150e6e4f5 Use do_sys_recvmsg(), so_sys_accept(), do_sys_getsockname() and do_sys_senmsg()
in order to avoid the stackgap (etc).
Note that since changing the darwin socket address is simply a matter of
  translating the address family and adding sa_len, it can easily be done
  on the mbuf resident address before/after copying to/from userspace.
Simplify the convertion of AF_LOCAL addresses by usingthe user-supplied
  buffer length instead of dowing an unbounded strlen().
Untested - did this work before?
2007-06-24 18:07:34 +00:00
dsl
0bb6928543 Update to call do_sys_recv() instead of recvit(). 2007-06-24 18:01:48 +00:00
dsl
6d0a5fcf1a Simplify code to get/set 16bit group lists.
Cloned from ibcs2 copy (maybe I should have worked out somewhere to put this
as common code...)
2007-06-23 15:27:23 +00:00
dsl
a5b4569076 Read and write the ldt without using the stackgap. 2007-06-23 15:26:16 +00:00
dsl
e773713d08 Comment out support for FREEBSD_PT_READ_U and FREEBSD_PT_WRITE_U.
It all looks like a rather broken hack.
If nothing else it accesses userspace without copyin/out.
2007-06-23 15:24:26 +00:00
dsl
23ec3e8012 Use the functions in kern_auth.c for setting/getting group lists.
All we have to do here is copy the 16bit to 32bit group numbers across.
2007-06-23 09:11:12 +00:00
dsl
049a22a9db These now need sys/prot.h 2007-06-23 09:09:56 +00:00
dsl
4147586696 There is no need for the stackgap in sys_bind() and sys_connect().
If sa_len is zero, believing the size passed to bind/connect seems
better than trying to strlen somthing that might run off the mapped kma.
Verify the address family against the array size before indexing.
2007-06-17 21:30:11 +00:00
dsl
cf80941288 Kill that stackgap...
Use vn_stat() and dostatvfs() on the vnode the code always has got - even
though it used compat versions of the other syscalls.
2007-06-17 20:43:10 +00:00
dsl
95206f19b1 No need for stackgap for darwin_sys_sigaction and sigprocmask.
XXX: it doesn't look right that the new and old 'sigaction' parameters
have different types.
2007-06-17 20:15:19 +00:00
dsl
6111df536a Remove stackgap use:
osf1_sys_select() calls selcommon().
osf1_sys_readv() and writev() read the iov into kernel memory then call
  do_filereadv/writev().
KNF.
2007-06-17 19:50:01 +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
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
c271f319e5 Do the sysv ipc calls without the stackgap. 2007-06-17 18:17:46 +00:00
dsl
8ef23ff995 Directly call the relevant system support routines instead of going via
the compat_10 and compat_14 functions - makes the code neater and, removes
many data copies and also removes the stackgap use.
Also (indirectly) fixes some code paths that fotgot to do copyin/out.
2007-06-17 16:32:51 +00:00
dsl
353f1bdbac Call semctl1() directly, not via stackgap and compat_14_sys___semctl(). 2007-06-17 10:24:21 +00:00
dsl
82cfad02f8 Expose semid_ds14_to_native() to otherparts of the system.
Don't leak kernel stack back to userspace.
2007-06-17 10:23:27 +00:00
dsl
879c84a74d The code to directly call sigaction1() and sigaltstack1() is much shorter
than the mess required to call the compat_43_xxx functions.
2007-06-16 22:31:08 +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
5977ce1bd5 Remove a spare 'timeval' structure - makes this version of this function
match some of the other copies lurking in the world of compat.
2007-06-16 19:55:26 +00:00
dsl
8e418a4b13 Delete stuff in comment about use of stackgap. 2007-06-16 19:54:02 +00:00
christos
46502fd059 regen 2007-06-13 20:57:56 +00:00
christos
89e2b251a2 Get ready for NPTL but don't turn it on as of yet. 2007-06-13 20:57:33 +00:00
christos
344a5bd80c regen. 2007-06-13 14:31:30 +00:00
christos
76af51a354 Add futex. 2007-06-13 14:31:07 +00:00
christos
564f9b3b2f cleanup some bitrot; from Matthew Orgass 2007-06-13 02:11:40 +00:00
joerg
5ccf1c578a Add a new ioctl AUDIO_GETBUFINFO. It works like AUDIO_GETINFO, but
doesn't obtain the ports, gain and balance related parameters.
Those generally require reading from the hardware and therefore are much
more expensive to obtain. Modify OSS emulation to use the new ioctl
where possible.

This reduces CPU usage of mplayer during mp3 playback with my Thinkpad
from 20% to < 1% and from 50% to 20% during Xvid playback.

Review and comments from jmcneill@
2007-06-11 13:05:46 +00:00
ad
c741f88d56 Acquire proclist_mutex before sending signals. XXX irix emul needs a bit
of work.
2007-06-09 21:25:49 +00:00
rjs
ef2a6ab865 Wrap ktrace calls with #ifdef KTRACE. 2007-06-06 17:08:27 +00:00
dsl
3e4175ccc9 Fix select() without a timeout parameter. 2007-06-04 21:02:22 +00:00
dsl
938cde68e5 Add a #define that expands to the compat wrapper for sigaltstack1().
Use it for the netbsd32_compat_13.c version of the code.
2007-06-03 14:59:46 +00:00
dsl
671dc7790c sendmsg() shouldn't modify the 'msg' parameter, and recvmsg() doesn't have
to modify the 'iov' array - it isn't updated.
2007-06-03 11:30:59 +00:00
dsl
97d93705e5 Calling sigaltstack1() directly is so much easier than going via
compat_13_sys_sigaltstack().
2007-06-03 11:09:35 +00:00
dsl
ed63ffe787 Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!
2007-06-03 10:55:10 +00:00
dsl
7ba299c5d4 Split sys__lwp_park() so that the compat/netbsd32 code can copyin and convert
its timeout then call the standard function.
2007-06-03 09:50:12 +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
yamt
a15e4b5b1b wrap #include "opt_ktrace.h" by #ifdef _KERNEL_OPT. 2007-06-02 13:16:19 +00:00
dsl
3d0e15d3b2 Call selcommon() directly instead of using the stackgap... 2007-06-02 11:51:42 +00:00
dsl
e12ac31b52 Remove an unsed call to stackgap_init() 2007-06-02 10:09:05 +00:00
enami
0c8f6382c6 Reduce difference between compat_ifconf() and ifconf():
- exit on error rather than proceeding to next interface.
- make code simpler.
2007-06-02 01:29:25 +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
d95fed7315 (Ab)use a KTR_USER trace entry for the linux socket command and arguments. 2007-06-01 22:42:47 +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
he
8f77cc1c43 Fallout from the interface ioctl changes:
OSIOCGIFADDR -> OOSIOCGIFADDR
OSIOCGIFDSTADDR -> OOSIOCGIFDSTADDR
OSIOCGIFNETMASK -> OOSIOCGIFNETMASK

Also, one instance of needing to include <net/if.h> before
<compat/sys/sockio.h> due to use of IFNAMSIZ in the latter.

Discussed with christos.
2007-06-01 11:36:35 +00:00
hannken
b110563f3a Fallout from last commit:
OSIOCGIFADDR -> OOSIOCGIFADDR
OSIOCGIFDSTADDR -> OOSIOCGIFDSTADDR
OSIOCGIFNETMASK -> OOSIOCGIFNETMASK

Sparc64 compiles again.
2007-06-01 10:21:22 +00:00
christos
ab89ea8ca6 message size == 0 is valid. From Markus Mayer 2007-05-31 23:34:42 +00:00
christos
d81aadc176 Move the nasty ifdefs in one place. Requested by ad and dyoung. 2007-05-30 21:02:02 +00:00
xtraeme
e09d1dbb48 Fix for SIOGIFCAP provided by christos, test successful. 2007-05-30 17:03:30 +00:00
christos
9bf57b1f3a make this compile again
XXX: The ioctls will need to be fixed.
2007-05-30 00:00:59 +00:00
christos
d5dcfde7aa wrap the whole function in COMPAT_40 2007-05-29 23:57:33 +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
njoly
f70cd37804 Fix restart of interrupted system calls.
- Make linux_sys_rt_sigreturn() return EJUSTRETURN on success.
- Add missing rax to linux_sigcontext structure; and save/restore
  its value like other members in linux_sendsig()/linux_sys_rt_sigreturn().

With valuable help from manu.
2007-05-24 11:21:52 +00:00
cube
03744d91f8 Rename si_sigval -> si_value to match POSIX RTS. [hi christos!] 2007-05-22 03:51:54 +00:00
christos
c61eed39a8 rename si_sigval -> si_value to match POSIX RTS. 2007-05-21 15:35:47 +00:00
yamt
f03010953f merge yamt-idlelwp branch. asked by core@. some ports still needs work.
from doc/BRANCHES:

	idle lwp, and some changes depending on it.

	1. separate context switching and thread scheduling.
	   (cf. gmcgarry_ctxsw)
	2. implement idle lwp.
	3. clean up related MD/MI interfaces.
	4. make scheduler(s) modular.
2007-05-17 14:51:11 +00:00
dsl
a163d15464 This is deja vu - I fixed this earlier....
No need to use stackgap for ioctl to get PTM name, directly call file's
ioctl function with kernel buffer.
2007-05-13 16:04:00 +00:00
dsl
10b01b226a There is no need to copy data out to userspace when its address is being
passed to the driver as the ioctl 'data' argument.
Change boths parts to expect a kernel memory buffer.
2007-05-13 15:57:39 +00:00
dsl
06b3498b98 Fix compilation 2007-05-13 15:56:17 +00:00
dsl
dc41e5b5bd Change the way the irix 32bit signal mask request is done to avoid the
stackgap.  I'm actually susre this code is buggy, possibly slightly less
so than before.
2007-05-13 15:39:29 +00:00
dsl
959f589c73 This code is already set for directly calling a files ioctl fn with a
kernel buffer - so why not use it when getting the slave pty number.
2007-05-13 15:38:14 +00:00
dsl
9e2165cbd3 Time functions have had wrappers for ~ages, no need for the stackgap gere. 2007-05-13 14:47:54 +00:00
dsl
b8cecbd5b3 Delete fom stackgap lines that seem to have got left in. 2007-05-13 11:06:41 +00:00
dsl
2cc0d0a9c4 Stop using the stackgap for time functions. 2007-05-13 11:04:11 +00:00
dsl
9a585a457d Stop using the stackgap for timer functions, fcntl locks and FIONREAD ioctl.
Add code for X_LK_RLCK - seemed to be absent!
2007-05-13 11:03:06 +00:00
dsl
d4540f5b2a Call sigaltstack1() directly instead of using the stackgap to call
sys___sigaltstack14().
Prototype up some code under #if 0 to use sigaction1().
2007-05-13 09:07:25 +00:00
dsl
0a4e8a3014 Remove the stackgap from some more flockking code.
Note that I've removed the bug where this code 'forgot' to use copyin/out
for the stackgap buffers.
2007-05-13 08:38:34 +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
8beba9d093 There is no need to use the stackgap for get/setrlimit. 2007-05-12 21:07:02 +00:00
dsl
ef3fdc4a07 Change interface to settimeofday1() so that it can also be used from
compat code in order to avoid the stackgap.
2007-05-12 20:27:13 +00:00
dsl
dd490a6f18 Get rusage directly, not via 64bit linux call and stackgap. 2007-05-12 20:24:54 +00:00
dsl
a08b772cae Fix comment and indent. 2007-05-12 20:23:36 +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
rumble
18ae6034fe Make this compile again (untested). 2007-05-11 02:25:34 +00:00
christos
48f401a8e0 - linux uname -m on x86 returns i{3,4,5,6}86 make it so.
- delete the machine sysctl that never worked, and gc linux_machine.
2007-05-10 21:30:14 +00:00
christos
ef061fd462 move the #if 0 down a few lines so linux_machine gets initialized. Pointed
out by Joachim K�nig
2007-05-10 17:12:32 +00:00
dsl
1769aced1d Fix build. 2007-05-09 20:42:12 +00:00
dsl
99ec301ce3 Remember to copy the rusage to the users buffer. 2007-05-08 20:54:15 +00:00
dogcow
01b74015fe fixes from dsl for compile errors 2007-05-07 21:18:26 +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
he
1276917b53 Remove now-unused declarations of "struct proc *p". 2007-05-07 14:13:00 +00:00
he
2751cf9440 Remove two local declarations of *p, now no longer needed. 2007-05-07 12:24:00 +00:00
christos
f844889627 Remove change that obviously was not tested (since it uses LINUX_KERN_VERSION
again, producing EEXIST). There is no machine sysctl in linux that corresponds
to this (at least on my i386 suse box)
2007-05-06 23:25:26 +00:00
rumble
c5e64595c9 Make this compile again after dsl's stackgap rototill. 2007-05-05 13:12:51 +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
dd85830e7b Include extra header (vfs_syscalls.h). 2007-04-30 20:20:28 +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
0df00dcf55 Split the statvfs functions so that the 'work' is done to a kernel buffer
which can either be copied directly to userspace, or converted then copied.
Saves replicating a lot of code in the compat functions (esp. for
getvfsstat) at a cast of an extra function call in the non-emulated case -
which is unlikely to be measurable given the other costs of the actions
involved (even on vax).
Remove dofhstat() and dofhstatvfs() (and the last caller).
Remove some redundant stackgap_init() calls.
2007-04-30 08:32:14 +00:00
dogcow
7d60d09883 and unbork some more changes. 2007-04-28 00:03:37 +00:00
dogcow
b4fa94e8ef fix unused variable fallout b0rkenness 2007-04-27 23:53:15 +00:00
dsl
9f6d43522e Pass the emulation root string into namei() from emul_find_interp() so that
the ktrace entries for lookups done during exec can have the full filename.
This is rather a hack :-)
2007-04-26 20:06:55 +00:00
matt
3af169362e Make this compile again (after stackgap removal) 2007-04-25 12:54:26 +00:00
dsl
461647c21e Update using no pecoff specific system call code. 2007-04-23 21:23:13 +00:00
dsl
ad5f09d13c Having removed all the CHECK_ALT_XXX() none of these syscall functions
do anything except call a standard function.  Nuke them all.
2007-04-23 21:22:29 +00:00
manu
262a61f00a Linux's uname should return x86_64 as machine_arch 2007-04-23 12:45:42 +00:00
christos
92ae584013 avoid zerodivide. 2007-04-23 00:13:14 +00:00
dsl
d0b9f67395 Delete a diagnostic printf and some unused 'stack gap' initialisation. 2007-04-22 14:10:30 +00:00
dsl
313aae0af3 Actually report an error when sys__stat30() fails. 2007-04-22 10:54:43 +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
njoly
44d4cbded2 Regen (ftruncate fix). 2007-04-20 13:38:20 +00:00
njoly
12a8f9478e Fix ftruncate syscall. Do not use compat_43_sys_ftruncate, but
compat_43_netbsd32_oftruncate instead.
2007-04-20 13:37:05 +00:00
ad
8aefa8aa0c Share the sysarch stuff between the x86 ports. PR kern/36046. 2007-04-16 19:12:17 +00:00
pooka
652606289c I'm not sure if I want to know what MNT_LAXY means, so I'll just
assume the comment has a tyop of MNT_LAZY.
2007-04-16 18:33:39 +00:00
njoly
bc7c2c3b94 Regen (statfs support). 2007-04-11 11:51:19 +00:00
njoly
f771d34a84 - Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
  between both linux compats.

ok by manu.
2007-04-11 11:45: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
njoly
a926b97a8e Enable stat/stat64 nsec time support, for amd64 compat linux/linux32. 2007-04-05 16:39:11 +00:00
dsl
007d96a7bb Get emul_find() to update SCARG(uap, path) instead of assuming that the
updated path parameter is ever valid - especially when emul_find() fails.
Use the modified path for the access() calls.
Found when compiling with emul_find() hacked to always fail.
2007-04-05 07:37:14 +00:00
njoly
5c37954c94 Fix select() behaviour with NULL timeout, to blocks indefinitely
instead of returning immediately.
Reported by Edgar Fuß on port-amd64@.
2007-04-02 16:29:55 +00:00
hubertf
ef314e20d0 Remove duplicate #include <sys/param.h>,
and pull in the <sys/cdefs.h> needed for __KERNEL_RCSID

From: Slava Semushin <php-coder@altlinux.ru>
2007-03-26 22:44:40 +00:00
cube
c8ff1b6980 Count environment vars with envc, not argc [hi dsl!]. Reported by Nicolas
Joly in private mail.
2007-03-26 17:12:02 +00:00
njoly
471f710a5a Sync with recent compat linux termios changes. 2007-03-26 13:46:50 +00:00
njoly
6bf18aa85e Update i386 LINUX_{TIOCGPTN,TIOCSPTLCK} definitions for latest
linux_ioctl_termios() changes.
2007-03-26 12:26:11 +00:00
rmind
7b9af0160d Handle newlwp() error case. Currently, newlwp() cannot fail, but this
will likely change in the future.
2007-03-24 16:43:56 +00:00
njoly
1f4051d826 Fix generated file names from makesyscalls.sh (s/linux/linux32/).
From Edgar Fuß in PR/35956.
2007-03-23 12:26:10 +00:00
mrg
2cdaa49944 implement emul.linux.kern.machine, which can be set to "i686", like
some applications seem to want.
2007-03-23 04:16:13 +00:00
tsutsui
251bb51bf0 Fix shadowed declaration warning. 2007-03-20 11:39:34 +00:00
njoly
226b6c843f Add ktrace I/O support to netbsd32_ioctl() syscall.
Reviewed by cube.
2007-03-20 11:02:18 +00:00
cube
e80df1a6aa Typo. Reported by martin. 2007-03-20 09:11:04 +00:00
cube
e8beebe1e2 More SCARG_P32 fallout. 2007-03-20 08:25:37 +00:00
cube
35a0a309fb Fix typo. Reported by martin. 2007-03-20 08:12:42 +00:00
njoly
f408971232 Fix TIOCGPTN ioctl.
Do not use sysioctl() directly, but netbsd32_ioctl() instead.
2007-03-19 10:16:46 +00:00
dsl
d364d308c7 Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx). 2007-03-18 21:38:32 +00:00
tsutsui
3f372aff43 Fix compile errors in the previous:
- include <sys/filedesc.h> for do_sys_stat()
- include <sys/namei.h> for FOLLOW and NOFOLLOW
- add missing semicolons
- fix typos
2007-03-17 17:02:44 +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
manu
91e99f33d3 Add ptmx fakedevice hack for amd64
Fix a bug in ioctl handling
2007-03-14 21:52:17 +00:00
njoly
de5304fe4b Regen (statfs/fstatfs fixes). 2007-03-14 12:47:46 +00:00
njoly
4e3a8d7d1d Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.

ok by manu
2007-03-14 12:44:39 +00:00
ad
59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
dsl
6803111cb3 Fix amd64 build for compat sys_stat() changes.
This file isn't included in amd64:GENERIC
2007-03-11 19:36:37 +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
dsl
935d2b1c7f Use the support routines from kern_syscalls.c instead of rolling our own code. 2007-03-10 17:33:29 +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
tsutsui
4fc7add5a3 Use (char *) to appease -Wpointer-arith. 2007-03-06 12:41:52 +00:00
dogcow
f18ef70a25 semimechanically convert 'void foo' -> 'void *foo', as part of the continuing
caddr_t fallout.
2007-03-05 21:05:00 +00:00
christos
033371b01a fix caddr_t lossage 2007-03-05 14:24:18 +00:00
christos
c74f0279ea more caddr_t lossage. 2007-03-05 14:13:10 +00:00
he
1564bbc49c Need a char* for doing pointer arithmetic. 2007-03-05 13:56:24 +00:00
tsutsui
48174a79c0 Use (char *) cast on pointer arith. 2007-03-05 10:43:32 +00:00
christos
a4c52808c6 fix caddr_t lossage. 2007-03-05 05:10:04 +00:00