Commit Graph

4645 Commits

Author SHA1 Message Date
njoly
26a5edd122 Add some padding members to linux_msqid64_ds for 32-bit archs. This
fix msgctl(2) IPC_STAT|IPC_64 calls, at least, on i386.
2008-12-09 11:09:11 +00:00
njoly
bd398db254 Remove unused timeval_to_clock_t function, superseeded by CONVTCK
macro.
2008-12-08 11:52:35 +00:00
njoly
adf5b0a542 Regen for netbsd32_caddr_t removal. 2008-12-06 23:15:09 +00:00
njoly
e7377ec502 Cleanup; kill netbsd32_caddr_t use. 2008-12-06 23:14:03 +00:00
njoly
9321a67e19 Small setres{uid,gid} cleanup; there is no need to use a specific
handling for -1 uid values.
2008-12-06 23:01:32 +00:00
njoly
14e966b9e0 Regen for getres{uid,gid} syscalls. 2008-12-05 23:31:54 +00:00
njoly
533a52241a Add getres{uid,gid} syscalls. 2008-12-05 23:30:19 +00:00
ad
dc5f414733 PR port-amd64/40091 compat_linux32 module loading = panic due to missing syms 2008-12-03 12:51:11 +00:00
njoly
96d7b57e0f Regen for getdirentries fix. 2008-12-02 13:45:40 +00:00
njoly
488fb8373c Fix getdirentries(2) by not calling compat_43_sys_getdirentries, but
letting do its own job instead (native and osf1 dirent structure have
different member number and types).
2008-12-02 13:45:02 +00:00
njoly
d42a74a9ba Regen for sched_get_priority_{min,max}. 2008-12-01 14:19:45 +00:00
njoly
aba771042c Add sched_get_priority_{min,max} syscalls. 2008-12-01 14:18:44 +00:00
ad
1a85128fea COMPAT_ULTRIX does not work on vax because there are no hooks, but make
it compile anyway.
2008-11-24 11:19:53 +00:00
njoly
6d6fb02ffd Regen for getpgid. 2008-11-24 00:26:34 +00:00
njoly
010c8bc9c7 Add getpgid, needed for Tru64 4.0g ksh. 2008-11-24 00:25:30 +00:00
njoly
6709281d18 Move si_code definitions from MD to MI linux_siginfo.h, all archs
(except mips for 3 values) are identical.
While here, remove unused/unneeded LINUX__SI_CODE macro. Only the
lower 16-bits are used for userland si_code.
2008-11-23 23:48:48 +00:00
mrg
56585a9fd3 initialise a variable to avoid a GCC warning. 2008-11-23 00:15:13 +00:00
mrg
3b1d48844e regenerate 2008-11-22 23:14:01 +00:00
mrg
672c98ee5a implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().
2008-11-22 23:13:38 +00:00
cegger
53d5928d58 make this compile 2008-11-21 20:53:28 +00:00
he
2df25715bb Need to include <sys/module.h> when using the MODULE() macro. 2008-11-21 19:55:38 +00:00
he
b9e9d5c919 Commit regenerated files after this change to syscalls.master:
sys_nfssvc() is actually only defined when NFSSERVER is defined,
not when only NFS is defined, according to sys/nfs/files.nfs.
Adapt accordingly.  Fixes build of amiga INSTALL kernel.
2008-11-21 15:15:31 +00:00
he
5ed8abf7d9 sys_nfssvc() is actually only defined when NFSSERVER is defined,
not when only NFS is defined, according to sys/nfs/files.nfs.
Adapt accordingly.  Fixes build of amiga INSTALL kernel.
2008-11-21 15:14:56 +00:00
tron
709a35c482 Make it possible to compile a kernel with COMPAT_NETBSD32 but without
COMPAT_40. This fixes PR port-amd64/39967.
2008-11-20 11:56:40 +00:00
ad
1ab7ca8fdc PR port-amd64/39964 modules/compat_linux: missing symbols on amd64 2008-11-20 09:26:06 +00:00
ad
11c98a4abf PR port-amd64 modules/compat missing symbols on amd64
Also, test for compat_??_machdep.c so we don't have to grow more ifdefs
in the makefile.
2008-11-20 09:22:57 +00:00
cegger
f20e076be5 take ecoff header for ecoff code. 2008-11-20 00:28:07 +00:00
cegger
89ba8d828a make this compile (for next68k) 2008-11-19 23:31:13 +00:00
cegger
20a167ec1c make this compile 2008-11-19 22:27:19 +00:00
cegger
3076d30653 make this compile for alpha 2008-11-19 22:02:21 +00:00
ad
c4d65a7c5e Additionally, set emul_netbsd_object=NULL after detaching it. 2008-11-19 21:29:25 +00:00
ad
5473327d60 compat_modcmd: emul_netbsd_object will be NULL if no exec has taken place
between load and unload of the compat module.
2008-11-19 21:27:54 +00:00
ad
e157b99c7c Regen. 2008-11-19 18:39:43 +00:00
ad
92ce8c6a3d Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
2008-11-19 18:35:57 +00:00
njoly
2b470c165e Regen for futex timeout argument cleanup/fix. 2008-11-19 13:11:15 +00:00
njoly
377975c175 futex(2) timeout argument cleanup/fix.
- Use `struct linux_timespec', converted to native structure.
- Ensure that provided values are correct.
- Replace timeval+tvtohz by tstohz.
2008-11-19 13:09:19 +00:00
njoly
d64736c6b8 noisy printf. 2008-11-18 15:25:13 +00:00
ad
7369e64e54 LINUX_GCC_SIGNATURE also matches NetBSD/i386 ELF binaries, so disable it. 2008-11-17 13:03:42 +00:00
martin
42cab0447c Make it compile 2008-11-16 15:17:05 +00:00
njoly
ef05808702 Do not call namei anymore, but use the result from the previous
emul_find_interp call instead. This make dynamic executables work
again under compat OSF1 (fix PR/39255).

ok by christos.
2008-11-15 00:49:53 +00:00
ad
57de28fac5 - Move some more compat code into sys/compat.
- Split 4.3BSD ifioctl stuff into its own file.
- Remove some ifdefs that include small fragments of vfs compat code
  which are difficult to relocate elsewhere.
2008-11-14 23:10:57 +00:00
ad
7dbfda5cca Unneeded ifdef 2008-11-14 15:56:17 +00:00
ad
7bd1ee08d6 Regen. 2008-11-14 15:50:01 +00:00
ad
18e73e1ebe Replace semid_t with intptr_t. No function change. This is a libc/kernel
private interface and so the name change should not affect any third
party code.
2008-11-14 15:49:20 +00:00
ad
c5122072aa _KERNEL_OPT 2008-11-14 13:10:33 +00:00
ad
a682ddf568 Make it build again. 2008-11-13 12:09:52 +00:00
ad
b11cbdbb9d compat_ossaudio module, so others can depend on it. 2008-11-13 10:05:52 +00:00
njoly
7712a0fc6c Regen for nanosleep(2) fix. 2008-11-12 18:09:22 +00:00
njoly
cf19223289 Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
2008-11-12 18:07:40 +00:00
njoly
1eff3fc2c0 Add missing sys/syscall.h include for SYS_ptrace definition. 2008-11-12 15:22:18 +00:00
ad
0efea177e3 Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
2008-11-12 12:35:50 +00:00
wrstuden
ab61b53b27 Adjust the sleeps in lwpcache and lwpublk. Make them uninterruptable
for now. This will prevent signals from waking them. Adjust
exit_lwps() to explicitly add LW_SINTR to all of them, so that
the process exit code can wake them up.

This is needed as threads in both of these wait channels die once
they are woken. So they aren't interruptable in the typical sense.

I am now able to suspend & resume firefox successfully now.
2008-11-01 05:59:33 +00:00
wrstuden
04ca26c586 Tweak change to move SA support from userret() to lwp_userret().
1) Since we want to check for upcalls only once, take LW_SA_UPCALL
out of the while(l->l_flags & LW_USERRET) loop.

2) since the goal is to keep SA code out of userret() (and especially
all the emulations that include userret() but will never do SA),
ALWAYS set LW_SA_UPCALL when we set SAVP_FLAG_NOUPCALLS. Drop the
test for it in lwp_userret() since it will never be set bare.

3) Adapt sa_upcall_userret() to clear LW_SA_UPCALL if it's no longer
needed. If we have gained upcalls since sa_yield(), we will deliver
them next time around.

Tested by skrll at.
2008-10-28 22:11:36 +00:00
christos
e4b18f1168 populate init_thread_area. 2008-10-28 18:37:41 +00:00
jmcneill
af9ee6c291 Only call release_futexes if LINUX_NPTL 2008-10-28 11:42:30 +00:00
wrstuden
1698883b6a Ok. Some calls to sa_upcall() pass in an 'l' that is not the current
lwp. Our "no-upcall" flagging however accesses l_pflag, and so we
can't access l->l_pflag. So access curlwp for the no-upcall-blocking
part.
2008-10-27 16:52:04 +00:00
jmcneill
1b69e667f6 Need opt_multiprocessor.h for MULTIPROCESSOR definition. 2008-10-26 22:33:03 +00:00
christos
fbc6c6a8e6 changes from pengo that make initializing skype more reliable. 2008-10-26 20:46:05 +00:00
christos
3ce1cee82d regen. 2008-10-26 20:26:53 +00:00
christos
b5a45a5fad catch up with i386 changes. 2008-10-26 20:25:49 +00:00
christos
1b9e833438 multiprocessor fixes, from rmind 2008-10-26 20:22:01 +00:00
jmcneill
e143becdb6 linux_sys_get_robust_list: copyout the entire struct, not the size of the
pointer to it.
2008-10-26 19:13:16 +00:00
christos
1b618d0f6e use a symbolic constant instead of 6. 2008-10-26 17:57:49 +00:00
christos
60485d403e use GUGS_SEL instead of 3. 2008-10-26 17:42:37 +00:00
christos
68a065aac1 regen 2008-10-26 16:38:41 +00:00
christos
5dfa1e6b4a futex support fixes from FreeBSD via cube+pengo. 2008-10-26 16:38:22 +00:00
ad
49169f6211 Assert that the segment descriptors we generate for TLS will not allow
privilege elevation.
2008-10-26 11:02:14 +00:00
mrg
27498ba7bc if the interpreter is literally "/usr/libexec/ld.elf_so" or
"/libexec/ld.elf_so", try <path>-<machine32arch>.
2008-10-26 07:07:35 +00:00
christos
a893abf3f5 regen 2008-10-26 03:44:04 +00:00
christos
86f314b4bf don't forget the percpu stuff and load gs immediately. 2008-10-26 03:43:42 +00:00
christos
47ab401cc8 fix include order; machdep needs to be first for LINUX_NPTL to be defined. 2008-10-26 02:00:57 +00:00
christos
f6382710ee Add preliminary tls support for i386. Does not work yet. From FreeBSD. 2008-10-25 23:38:28 +00:00
apb
f46c1de7cb Use ${TOOL_SED} instead if plain sed in Makefiles. 2008-10-25 22:27:34 +00:00
njoly
d05df800a8 Do not use native_to_linux_si_code() outside LINUX_NPTL; until i
figure a better way to handle it.
2008-10-21 21:52:29 +00:00
njoly
beff3f7516 Remove LINUX_SI_xxx from MI siginfo.h, that should not have been
committed. Rather add them to amd64 MD header.
Fix compilation failures on non x86 archs.
2008-10-21 20:24:15 +00:00
njoly
db06152637 tkill/tgkill syscalls cleanup.
- Make both syscalls set si_code to SI_LWP (which will be converted to
  Linux SI_TKILL value). Fix thread some cancellation under NPTL
  emulation.
- Merge code in a new linux_do_tkill() function that will do its own
  job, instead of calling linux_sys_kill().
- Do only alter single tasks, by rejecting non positive tid/tgid
  values.
2008-10-21 13:36:28 +00:00
njoly
d7732b5cc7 Add native to linux siginfo si_code translation, mostly for negative
values. Adjust amd64 and i386 accordingly, not sure about aother archs
i can't test.
2008-10-19 09:44:31 +00:00
njoly
ea7b260958 g/c amd64 ifndef/endif. 2008-10-17 20:21:34 +00:00
njoly
d0b5229aea Remove unneeded linux_sigaction.c 2008-10-17 20:17:19 +00:00
wrstuden
27724c38ae Adjust locking on the sadata::sa_vps list. The main time we
walk the list, we're looking for a vp to do something with. We do
this in the signal code and in the timer code. The signal code already
runs with proc::p_lock held, so it's a very natural lock to use. The
timer code, however, calls into the sa timer code with a spinlock held.
Since proc::p_lock is an adaptable mutex, we can sleep to get it. Sleeping
with a spinlock is BAD. So proc::p_lock is _not_ the right lock there,
and something like sadata::sa_mutex would be best.

Address this difficulty by noting that both uses actually just read
the list. Changing the list of VPs is rare - once one's added, it stays
until the process ends. So make the locking protocol that to write the
list you have to hold both proc::p_lock and sadata::sa_mutex (taken
in that order). Thus holding either one individually grants read access.

This removes a case where we could sleep with timer_lock, a spinlock at
IPL_SCHED (!!), while trying to get p_lock. If that ever happened, we'd
pretty much be dead. So don't do that!

This fixes a merge botch from how I handled our gaining p_lock - p_lock
should not have simply replaced p_smutex.

While here, tweak the sa_unblock_userret() code for the case
when the blessed vp is actually running (on another CPU). Make its
resched RESCHED_IMMED so we whack the CPU. Addresses a hang I've
observed in starting firefox on occasion when I see one thread running
in userland and another thread sitting in lwpublk, which means it's on
the list of threads for which we need an unblocked upcall. This list is
one on which things should NOT linger.
2008-10-16 18:21:45 +00:00
cegger
968d25010f build fix: get prototype for membar_producer() 2008-10-15 10:05:07 +00:00
wrstuden
4fb41e761e Merge wrstuden-revivesa into HEAD. Catch some files that I forgot
to revive on HEAD in previous commit.
2008-10-15 06:52:38 +00:00
wrstuden
fc7511b00e Merge wrstuden-revivesa into HEAD. 2008-10-15 06:51:17 +00:00
njoly
2c98237db9 Fix linux32 siginfo si_signo value. Do not convert ksi_signo twice. 2008-10-09 23:03:45 +00:00
njoly
249f1f85c5 Regen. 2008-10-06 14:53:58 +00:00
njoly
33b4e768ba Cleanup. Reduce diffs against netbsd32 syscalls.master.
- Remove const keyword for pointer types.
- Update some argument types.
2008-10-06 14:53:01 +00:00
njoly
1b1270d3b5 Compat linux/linux32 nice(2) fix. The syscall argument is an increment
to be added to the current nice value, not an absolute value to be
set.
2008-10-03 22:39:36 +00:00
njoly
b6ef5a15fb Regen after cleanup. 2008-09-22 13:08:50 +00:00
njoly
2fedf4a0fb Kill a few linux32 syscalls identical to netbsd32 ones.
No functional changes expected.
2008-09-22 13:07:46 +00:00
christos
95ffbb8bc9 Define a PSL_CLEARSIG macro for the psl flags to be cleared on signal delivery
and use it everywhere.
2008-09-18 15:57:04 +00:00
scw
5a856ae120 In linux32_shmat() don't try to copyout a 64-bit pointer where userspace
is expecting a 32-bit result.

Fixes nspluginwrapper on amd64.
2008-09-17 20:11:51 +00:00
christos
96bd7a0192 make this compile again. 2008-09-08 15:31:19 +00:00
christos
ae6357afe4 fix broken linux32_sys_times, copied from linux_sys_times. 2008-09-08 11:29:42 +00:00
tron
0f256b9d59 Compile NetBSD/amd64 kernels with "-Wextra". Patches contributed by
Juan RP in PR port-amd64/39266.
2008-09-05 13:37:24 +00:00
njoly
46da4ade28 Make linux32 getdents(2) do its own job instead of calling the
corresponding compat linux function, where struct dirent members types
differs.
2008-09-04 17:45:00 +00:00
bjs
91b72f6613 'if (error = 0)' -> 'if (error == 0)' 2008-08-08 16:21:44 +00:00
plunky
772d60cfb9 convert some [left behind] compat code to use new sockopt API 2008-08-07 20:15:32 +00:00
plunky
fd7356a917 Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
2008-08-06 15:01:23 +00:00
jmcneill
551b501a8f linux_sys_rt_sigreturn: properly restore stack flags, pointed out by
Juan RP and modified by myself. ok christos@
2008-08-01 18:49:28 +00:00
njoly
a3adeaa5f9 Fix linux_sigismember/linux_sigaddset to work on amd64 (and other
64bits archs), by ensuring that bit shifts are done on correct type.
2008-07-30 16:05:26 +00:00
njoly
c1c4ce8861 Regen for rt_sigpending. 2008-07-24 12:11:14 +00:00
njoly
efde75ae99 Add rt_sigpending syscall. 2008-07-24 12:09:56 +00:00
njoly
066b9aabb5 Add linux32_getifconf, following recent linux_getifconf addition. 2008-07-23 12:32:09 +00:00
jmcneill
a9b5dcaa70 ioctl compatibility for v4l2 and drm 2008-07-19 23:01:52 +00:00
cegger
1ca90441b2 use device_xname 2008-07-17 13:39:50 +00:00
cegger
f2b690d08e remove redundant declaration of tvtohz(). It's declared in <sys/timevar.h>.
Makes i386 ALL kernel build again.
2008-07-17 13:35:07 +00:00
christos
aa389c698d Use more timespecs internally. From Alexander Shishkin and me.
Welcome to 4.99.70, 30 more to go for 100.
2008-07-15 16:18:08 +00:00
matthias
1797e3b14b make LINUX_TCSBRK work. The code is mostly copied from
sys/compat/ibcs2/ibcs2_ioctl.c.
2008-07-04 11:06:31 +00:00
matthias
1b4ed9ea4e make LINUX_TCSBRK work. The code is mostly copied from
sys/compat/ibcs2/ibcs2_ioctl.c.
2008-07-04 10:13:52 +00:00
njoly
153124ee21 Fix SIOCGIFCONF ioctl for 64bit platforms. Add a new linux_ifreq
structure and linux_getifconf function (cleaned up version from
compat_ifconf).

While here, update linux_getifhwaddr to use the new structure.

Ok by christos.
2008-07-03 14:07:09 +00:00
rmind
160268aca6 Remove proc_representative_lwp(), use a simple LIST_FIRST() instead.
OK by <ad>.
2008-07-02 19:49:58 +00:00
matt
7408df1239 Change {ff,fd}_exclose and ff_allocated to bool. Change exclose arg to
fd_dup to bool.  Switch assignments from 1/0 to true/false.

This make alpha kernels compile.  Bump kern to 4.99.69 since structure
changed.
2008-07-02 16:45:19 +00:00
njoly
06e75299f3 Move amd64 MD termois types definitions from linux_termios.h to linux_types.h
following other archs.
2008-06-29 08:50:09 +00:00
chris
d890fb22e6 Fix warnings about type conversions by using linux_speed_t type on
linux_speeds[] rather than speed_t.

On Arm (and others) linux uses unsigned long, however, NetBSD uses
unsigned int.
2008-06-28 21:34:32 +00:00
njoly
9084eed1a8 Add SIOCGIFHWADDR support.
Tested by Cem Kayali.
2008-06-27 12:38:25 +00:00
ad
a00bd89dab Replace references to getsock/getvnode. 2008-06-24 11:18:14 +00:00
gmcgarry
035e707304 ioctl commands are defined unsigned long, so cast cmd to unsigned long before comparison. 2008-06-24 10:03:17 +00:00
njoly
0fe964b56f Fix SIOCGIFCONF ioctl under compat linux32. 2008-06-24 09:00:04 +00:00
njoly
0237fe6def Update compat netbsd32 SIOCGIFCONF ioctls definitions to follow native
ones.
2008-06-23 23:14:42 +00:00
njoly
8cb9e382ae netbsd32_ifreq_tp_t should be of type netbsd32_pointer_t, not int32_t. 2008-06-22 22:40:15 +00:00
he
acba26b8f9 Commit regenerated files after adding include of <sys/sched.h>. 2008-06-21 19:59:09 +00:00
he
3824f75f83 <sys/sycallargs.h> needs <sys/sched.h> now. 2008-06-21 19:58:27 +00:00
tsutsui
cda67469e5 Regen from syscalls.master rev 1.69:
> Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
2008-06-21 13:22:04 +00:00
tsutsui
f1d9471407 Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t. 2008-06-21 13:20:46 +00:00
njoly
72a97d4bed Do not return 0 for unsupported/unknown futex operations, but ENOSYS
instead. From Roman Divacky in private email.
2008-06-20 11:38:26 +00:00
njoly
d1a60f16f0 Fix futex locking. Move all locking to linux_sys_futex function, and
KASSERT that futex_{get,put,sleep,wake} are now called with lock held.
2008-06-20 11:31:40 +00:00
christos
d83ff0cd7b an attempt at linux32_ioctl_socket(). 2008-06-19 16:09:25 +00:00
hans
58cba3df2d regen from syscalls.master r1.46 2008-06-19 12:29:34 +00:00
hans
c1b31bd183 include <sys/sched.h> for cpuset_t 2008-06-19 12:28:12 +00:00
hans
372b2ea344 regen from syscalls.master r1.35 2008-06-19 12:27:04 +00:00
hans
3a83008141 include <sys/sched.h> for cpuset_t 2008-06-19 12:24:22 +00:00
njoly
9cbea9441c linux32_sys_ptrace() fixes.
- Add opt_ptrace.h include to activate syscall.
- Convert to use sys_ptrace() instead of netbsd32_ptrace().
- Do not use arch specific call for now.
2008-06-18 22:58:21 +00:00
tsutsui
4482e41e15 Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t. 2008-06-18 12:24:17 +00:00
tsutsui
5ff92ba4da Regen from syscalls.master rev 1.62:
> Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
2008-06-18 12:23:06 +00:00
tsutsui
181592d5b7 Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t. 2008-06-18 12:21:20 +00:00
dogcow
8b20d17adf Regen. 2008-06-18 02:09:19 +00:00
dogcow
f76aab4a72 include sys/sched.h for cpuset-related build lossage 2008-06-18 02:08:36 +00:00
tsutsui
d7d2a525b1 Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t. 2008-06-17 16:17:21 +00:00
he
f776c48636 <sys/syscallargs.h> now needs <sys/sched.h> included for the cpuset_t type
declaragion, so comply with that so that this builds again.
2008-06-17 16:13:08 +00:00
christos
7a9a590e57 regen 2008-06-16 20:00:53 +00:00
christos
5f09cf30c9 an attempt at ptrace32 2008-06-16 19:57:43 +00:00
ad
f9e99b470b PPWAIT is now in proc::p_lflag. 2008-06-16 12:25:54 +00:00
njoly
d0c76a36cb In linux_sys_sendto, do not unconditionnally set MSG_NAMEMBUF to
msg_flags; add it only if a target adress was provided and needs to be
converted.
2008-06-11 13:02:00 +00:00
njoly
f7cecd2466 Do set mbuf in all cases, even for salen value of 0; otherwise this
will make a panic later when trying to free memory from a random
adress.

XXX Need to revisit it later to avoid mbuf allocation in this case.
2008-06-09 21:17:58 +00:00
njoly
80639b2f02 Add missing cv_destroy in futex_sleep. 2008-06-05 10:58:16 +00:00
njoly
e8822e5c92 When converting msqid_ds structure from/to netbsd32 for msgctl(2)
IPC_STAT/IPC_SET, do not try to fill private struct members
_msg_first/_msg_last which do not exists.
2008-06-02 14:12:08 +00:00
mrg
c2b95373bf remove clause #3 from my license where there are no other
copyright holders involved.
2008-05-29 14:51:25 +00:00
njoly
7cdbbcf80d Add LINUX_TMPFS_SUPER_MAGIC, and map it to our tmpfs.
This makes sem_open/sem_unlink (POSIX named semaphores) work under
NPTL emulation.
2008-05-28 12:01:10 +00:00
njoly
c188bc4dd4 Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.
2008-05-24 16:02:44 +00:00
njoly
e82000b55e Add IPC_64 support to msgctl, needed for amd64. 2008-05-21 11:15:57 +00:00
njoly
da21dc40ec Regen for ipc(2) syscall support. 2008-05-20 17:33:13 +00:00
njoly
84db622836 Add compat linux32 ipc(2) syscall support, for shared memory and
semaphores.
2008-05-20 17:31:56 +00:00
njoly
763d4d3608 Fix linux_sys_getres{uid,gid}16 arguments type in comment. 2008-05-20 15:48:24 +00:00
njoly
4c3e8d3656 Fix free() argument in linux_read_ldt. 2008-05-19 09:36:55 +00:00
martin
79eec0c146 Follow FreeBSD's rev 1.18 (by imp):
Replace (name) with Henric Vestergaard Draboel since it was clear that
this was just cut N paste and '(name)' doesn't make any sense.
2008-05-12 17:46:08 +00:00
jmcneill
9e5e643a12 Pull in machine/cpufunc.h for wrmsr definition. 2008-05-11 17:13:43 +00:00
wrstuden
97003b024b Oops. These are supposed to come alive on the branch, not the head. 2008-05-11 00:18:09 +00:00
wrstuden
dbbab92bc9 Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
2008-05-10 23:48:44 +00:00
tnn
503997e388 Try to adapt the usema driver to new select/poll world order.
Also fix build with DEBUG_IRIX defined.
Fixes PR port-sgimips/38367 and makes GENERIC build again.
Only build tested because something else is still wrong with compat_irix.
2008-05-10 12:57:18 +00:00
martin
b46765907d Minor typo in license 2008-05-10 11:49:37 +00:00
tnn
a1744e1285 Make it build, struct vfsops gained a member.
(Making compat_irix actually work again is a project for another day.)
2008-05-09 20:49:14 +00:00
njoly
88ca4016fd Restore sched_native2linux() KASSERTs, i accidentally disabled in a
previous commit.
2008-05-07 15:18:35 +00:00
ad
42d0626726 PR kern/38141 lookup/vfs_busy acquire rwlock recursively
Simplify the mount locking. Remove all the crud to deal with recursion on
the mount lock, and crud to deal with unmount as another weirdo lock.

Hopefully this will once and for all fix the deadlocks with this. With this
commit there are two locks on each mount:

- krwlock_t mnt_unmounting. This is used to prevent unmount across critical
  sections like getnewvnode(). It's only ever read locked with rw_tryenter(),
  and is only ever write locked in dounmount(). A write hold can't be taken
  on this lock if the current LWP could hold a vnode lock.

- kmutex_t mnt_updating. This is taken by threads updating the mount, for
  example when going r/o -> r/w, and is only present to serialize updates.
  In order to take this lock, a read hold must first be taken on
  mnt_unmounting, and the two need to be held across the operation.

One effect of this change: previously if an unmount failed, we would make a
half hearted attempt to back out of it gracefully, but that was unlikely to
work in a lot of cases. Now while an unmount that will be aborted is in
progress, new file operations within the mount will fail instead of being
delayed. That is unlikely to be a problem though, because if the admin
requests unmount of a file system then s(he) has made a decision to deny
access to the resource.
2008-05-06 18:43:44 +00:00
jmcneill
473a55317b Wrap debug printfs in #ifdef DEBUG_LINUX (hi njoly!) 2008-05-05 02:29:31 +00:00
ad
104f8564ec Remove unneeded includes. 2008-05-05 00:33:32 +00:00
martin
673523f500 Move to standard TNF 2 clause license 2008-05-04 00:35:37 +00:00
njoly
4c44d432ea Add SCHED_FIFO/SCHED_RR support to sched_get_priority_{min,max}. 2008-05-01 16:06:17 +00:00
ad
1498ad220e Make various bits of debug code compile again. 2008-04-30 14:07:13 +00:00
ad
928a6b2096 PR kern/38135 vfs_busy/vfs_trybusy confusion
The previous fix worked, but it opened a window where mounts could have
disappeared from mountlist while the caller was traversing it using
vfs_trybusy(). Fix that.
2008-04-30 12:49:16 +00:00
jmmv
b8f1187ff1 Fix build of these files after the vfs_trybusy change. Apply the same
modification done in compat/common/vfs_syscalls_20.c:1.27.
2008-04-30 06:49:23 +00:00
ad
e3610f1886 kern/38135 vfs_busy/vfs_trybusy confusion
The symptom was that sometimes file systems would occasionally not appear
in output from 'df' or 'mount' if the system was busy. Resolution:

- Make mount locks work somewhat like vm_map locks.
- vfs_trybusy() now only fails if the mount is gone, or if someone is
  unmounting the file system. Simple contention on mnt_lock doesn't
  cause it to fail.
- vfs_busy() will wait even if the file system is being unmounted.
2008-04-29 23:51:04 +00:00
ad
e8acac827e Remove now bogus assertion. 2008-04-29 19:02:14 +00:00
ad
1074fa7182 Ignore processes with PK_MARKER set. 2008-04-29 15:55:24 +00:00
njoly
4490c7c69a In linux_get_sa(), make salen parameter unsigned.
Avoid kernel DIAGNOSTIC 0 bytes uvm mapping assertion, for negative
values.
2008-04-29 09:56:38 +00:00
martin
3028e483e4 Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
njoly
659effb31a Remove a duplicate mutex_enter call in linux32_e_proc_init().
Fix a kernel panic for processes created with FORK_SHAREVM.
2008-04-26 22:55:10 +00:00
ad
284c2b9aef Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
2008-04-24 18:39:20 +00:00
njoly
436fa0ef05 Add IPC_64 support for semctl IPC_STAT/IPC_SET. 2008-04-24 16:42:54 +00:00
ad
6d70f903e6 Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
  be sent from a hardware interrupt handler. Signal activity must be
  deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
  and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
2008-04-24 15:35:27 +00:00
ad
026542bb25 Regen. 2008-04-24 11:51:47 +00:00
ad
30abe39468 - Retire SYCALL_MPSAFE. With the exceptions of darwin and irix emulations,
all system calls are now MPSAFE.
- Remove unneeded acquire/release of kernel_lock.
2008-04-24 11:51:18 +00:00
ad
15e29e981b Merge the socket locking patch:
- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.
2008-04-24 11:38:36 +00:00
christos
f6889916d7 Make this compile again, from Jan-Benedict Glaw jbglaw at lug-owl dot de 2008-04-23 23:34:11 +00:00
ad
bfb6f31431 Disable bitrotted linux ptrace interfaces, which are likely now a
security hole. Can be re-enabled at runtime. If you want to repair
them please look at the native implementation.
2008-04-23 14:18:50 +00:00
ad
dd55791531 Regen. 2008-04-23 14:10:03 +00:00
ad
7cb840338e -SYCALL_MPSAFE 2008-04-23 14:07:49 +00:00
ad
1265474f26 sys_kill -> sys__lwp_kill 2008-04-23 14:01:09 +00:00
ad
f1b58cdc9b Sprinkle locks. 2008-04-23 13:58:06 +00:00
ad
98c2709959 Sprinkle locking. 2008-04-23 13:51:48 +00:00
ad
dc31d7f7e9 sys_kill -> sys__lwp_kill 2008-04-23 13:49:21 +00:00
ad
494c1ad8d6 Fix locking. 2008-04-23 13:44:46 +00:00
ad
8d0205c623 Grab kernel_lock for cpu_reboot(). 2008-04-23 13:40:17 +00:00
ad
e0b56ca8f5 Fix locking. 2008-04-23 13:34:44 +00:00
ad
6bf00a454d Catch up with linux. 2008-04-23 13:30:41 +00:00
ad
ce69e3e9c8 Fix locking. 2008-04-23 13:13:25 +00:00
ad
d0466d413e Tweak locking. 2008-04-23 13:11:42 +00:00
ad
bb0c94d223 Tweak previous. 2008-04-23 13:09:40 +00:00
ad
14f88acc9b Fix locking. 2008-04-23 13:02:32 +00:00
ad
1e216688e1 - Use cdev_tty().
- Tweak locking.
2008-04-23 12:55:16 +00:00
ad
a87ccd221c Sprinkle locking. 2008-04-23 12:50:53 +00:00
ad
624dcd9102 Sprinkle locking. 2008-04-22 21:33:13 +00:00
ad
dce30353aa Add a comment. 2008-04-22 21:29:21 +00:00
ad
be60f17289 Repair copyright. 2008-04-22 21:26:48 +00:00
ad
9e0517c26f Grab proclist_lock for p->p_pgrp. 2008-04-22 21:23:17 +00:00
njoly
d8f896655c Add LINUX_IPC_64 support for LINUX_IPC_SET in shmctl. Required, at
least, for amd64 which use LINUX_IPC_FORCE64.
2008-04-21 22:57:06 +00:00
njoly
f1bd64daf3 Rename LINUX_SHMCTL_FORCEIPC64 define to LINUX_IPC_FORCE64. 2008-04-21 22:38:18 +00:00
ad
08b44dd8b9 timer fixes for PR 37093:
- Fix serious concurrency problems, making the code MT and MP safe in
  the process.
- Don't allocate memory or inspect process state from hardclock().
2008-04-21 00:13:46 +00:00
njoly
3dadb2a2df Regen for sys_clock_{getres,gettime,settime} syscalls. 2008-04-17 17:48:40 +00:00
njoly
c007e33a3a Add compat linux32 sys_clock_{getres,gettime,settime} syscalls. 2008-04-17 17:47:23 +00:00
njoly
69614dfece Remove an obsolete comment about SHM_LOCK/SHM_UNLOCK being no-op. 2008-04-16 14:47:31 +00:00
njoly
14183438ed Kill a few other unused linux syscall arguments/prototypes
definitions.
2008-04-16 10:03:31 +00:00
njoly
a73122f64e Make linux32_sys_nice call sys_setpriority directly instead of
netbsd32_setpriority.
2008-04-15 21:13:34 +00:00
njoly
8529e0b201 Remove syscall prototypes forgotten in previous commit. 2008-04-15 21:10:06 +00:00
njoly
80b21f4457 Remove unused linux_sys_setresgid16_args/linux_sys_setresuid16_args
definitions.
2008-04-15 19:10:19 +00:00
njoly
3ce80f6407 Remove unneeded amd64 ifdef/endif. 2008-04-15 11:08:05 +00:00
njoly
26457ccc1d Under NPTL emulation, do not reparent all members of a thread group,
but only the processes that emulate threads (with LINUX_CLONE_THREAD
set).

This fix a problem for child processes that share address space with
the parent. At exit, the child will die silently, leaving the parent
waiting indefinitely for its end ...
2008-04-11 16:47:50 +00:00
njoly
112605d50a Cleanup unneeded LINUX_NPTL ifdef/endif. 2008-04-08 20:25:00 +00:00
yamt
3426b80b5e - l_wmesg is not always valid. check l_wchan when using l_wmesg.
should fix a crash reported by Juan RP on current-users@.
- ttyinfo: lock lwp when accessing l_wmesg.
- fill_lwp: add an assertion.
2008-04-05 14:03:16 +00:00
njoly
8c5bd726ed Regen for msync(2) support. 2008-04-04 12:59:15 +00:00
njoly
dc80a00302 Add msync(2) syscall. 2008-04-04 12:57:55 +00:00
njoly
2b6f0cc5e4 Regen for linux_sys_msync removal. 2008-04-04 12:43:00 +00:00
njoly
dcde97da0e Cleanup. Kill linux_sys_msync and use sys___msync13 instead.
No functional changes expected.
2008-04-04 12:38:52 +00:00
christos
c2126f5e21 print size_t with %zu. 2008-03-30 20:58:08 +00:00
ad
be04ac4896 Make rusage collection per-LWP and collate in the appropriate places.
cloned threads need a little bit more work but the locking needs to
be fixed first.
2008-03-27 19:06:51 +00:00
njoly
2467d28cba Be sure to not include linux_mmap.h before linux_syscallargs.h.
Otherwise wrong syscallarg macro may used for linux_sys_mmap_args
definition.
This makes mmap2 works again (at least to launch oo2 binary).
2008-03-27 14:14:06 +00:00
ad
02141d72c7 - Remove uneeded splsoftnet().
- Use fd_getsock().
2008-03-26 20:08:22 +00:00
cube
d94699ecbb Split device_t and softc for wskbd(4), wsmouse(4) and that creepy wsmux(4). 2008-03-25 00:49:19 +00:00
ad
f12243c34d linux_get_sa: fix botched fd handling. 2008-03-23 19:35:54 +00:00
ad
c9a93c8c58 Make this build again. From isaki@. 2008-03-23 13:58:47 +00:00
bjs
3b2cc68264 fdputfile -> fd_putfile 2008-03-22 01:24:23 +00:00
ad
a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
tnn
f85d89c5de v_interlock is a kmutex_t now, simple_lock() -> mutex_enter(). 2008-03-07 00:03:39 +00:00
elad
2a9368a7e7 In linux_sys_sched_getparam(), get the native policy too, so that we have
a better chance at properly converting the priority.

Noted by & okay yamt@.
2008-02-29 14:29:06 +00:00
dogcow
15debf8a40 Add some of those pesky semicolons, and correct number of args. 2008-02-29 08:41:51 +00:00
elad
67470a76a1 Factor out the guts of get/setparam so it can be used from the compat code.
Make the FreeBSD and Linux compat code convert the parameters to their
native representation and call the native routines.

Remove KAUTH_PROCESS_SCHEDULER_GET/SET.

Update documentation and examples.

XXX: For now, only the Linux compat code does the priority conversion
XXX: right.

Linux priority conversion code from yamt@, thanks!

Okay yamt@.
2008-02-28 16:09:18 +00:00
martin
777a451a3d Remove old posix_fadvise compat code 2008-02-24 15:02:15 +00:00
martin
c84d2ae11b Remove compat code for posix_fadvise 2008-02-24 12:54:15 +00:00
martin
93cbe0f210 Regen (old posix_fadvise ignored) 2008-02-24 12:53:47 +00:00
martin
a8ed8bb731 Desupport compatibility for the old posix_fadvise syscall per yamt's
request and just ignore it.
2008-02-24 12:52:54 +00:00
njoly
ac6668f329 Regen for mlock/munlock syscalls 2008-02-20 21:51:39 +00:00
njoly
e578f6862b Add mlock/munlock syscalls 2008-02-20 21:49:56 +00:00
njoly
6d3975648f Regen for pread/pwrite fixes. 2008-02-17 21:50:36 +00:00
njoly
fc9f8f74de pread/pwrite fixes: use SCARG_P32 to access pointers, and update
syscalls definitions.
2008-02-17 21:49:17 +00:00
elad
e99760e7e4 Fold KAUTH_REQ_PROCESS_SCHEDULER_* to KAUTH_PROCESS_SCHEDULER_*. In other
words, don't pass an action and a request, and just use a single action to
indicate what is the operation in question.

This is the first step in fixing PR/37986, which calls for policy/priority
checking in the secmodel code. Right now we're lacking room for another
parameter required to make a decision, and this change makes room for such.
2008-02-16 16:39:34 +00:00
matt
14f857fff2 Update to c99. 2008-02-13 17:41:09 +00:00
joerg
e69482d49d Introduce device_find_by_xname and device_find_by_driver_unit to replace
alldevs iterations all over src.

Patch discussed with and improved on suggestioned from cube@.
2008-02-12 17:30:57 +00:00
he
301a1d2d21 Need to include <sys/fstypes.h> before <sys/vfs_syscalls.h> to get
fhandle_t defined, which is used in a function prototype in the latter.
2008-02-12 10:59:57 +00:00
ad
d7f6ec471c Don't lock the socket to set/clear FNONBLOCK. Just set it atomically. 2008-02-06 21:57:53 +00:00
dsl
c060191386 Regen for merging fcntl() and fcntl64(). 2008-02-04 22:24:33 +00:00