kernel - Move mplock to machine-independent C * Remove the per-platform mplock code and move it all into machine-independent code: sys/mplock2.h and kern/kern_mplock.c. * Inline the critical path. * When a conflict occurs kern_mplock.c will KTR log the file and line number of both the holder and conflicting acquirer. Set debug.ktr.giant_enable=-1 to enable conflict logging.
kernel - use new td_ucred in numerous places * Use curthread->td_ucred in numerous places, primarily system calls, where curproc->p_ucred was used before. * Clean up local variable use related to the above. * Adjust several places where p_ucred is replaced to properly deal with lwp threading races to avoid accessing and freeing a potentially stale ucred. * Adjust static procedures in the ktrace code to generally take lwp pointers instead of proc pointers.
kernel - Move MP lock inward, plus misc other stuff * Remove the MPSAFE flag from the syscalls.master file. All system calls are now called without the MP lock held and will acquire the MP lock if necessary. * Shift the MP lock inward. Try to leave most copyin/copyout operations outside the MP lock. Reorder some of the copyouts in the linux emulation code to suit. Kernel resource operations are MP safe. Process ucred access is now outside the MP lock but not quite MP safe yet (will be fixed in a followup). * Remove unnecessary KKASSERT(p) calls left over from the time before system calls where prefixed with sys_* * Fix a bunch of cases in the linux emulation code when setting groups where the ngrp range check is incorrect.
Clean up the XIO API and structure. XIO no longer tries to 'track' partial copies into or out of an XIO. It no longer adjusts xio_offset or xio_bytes once they have been initialized. Instead, a relative offset is now passed to API calls to handle partial copies. This makes the API a lot less confusing and makes the XIO structure a lot more flexible, shareable, and more suitable for use by higher level entities (buffer cache, pipe code, upcoming MSFBUF work, etc).
If the server goes away while the client is trying to copy a message from it, the kernel may panic with a null-pointer indirection through the caps ci_td field (which becomes NULL). The field is properly becoming NULL, the culprit was some debugging code that indirected through it without checking first. Reported-by: Chris Pressey <cpressey@catseye.mine.nu>
Additional CAPS IPC work. Add additional system calls to allow a CAPS server to set a generation number and a CAPS client to query it, which can be used for any purpose but which is intended to allow a server to tell its clients to invalidate their caches. Add missing fork-handling code. CAPS links are only good on a thread-by-thread basis. When a process forks/rforks/clones any active CAPS links will be created as dummy entries in the forked process, causing CAPS syscalls to return ENOTCONN. This allows code based on CAPS to detect when it has been forked so it can re-connect to the service. Make a slight change to the API. caps_sys_put() now returns an immediate ENOTCONN if it forked. Note that userland CAPS code must still deal with the case where a message has been sent and the connection is lost before the reply is returned. The kernel automatically replies unreplied messages with 0-length data in these cases. Add additional flags to the API, including one that allows a client to block when connecting to a non-existant service.
CAPS IPC library stage 1/3: The core CAPS IPC code, providing system calls to create and connect to named rendezvous points. The CAPS interface implements a many-to-1 (client:server) capability and is totally self contained. The messaging is designed to support single and multi-threading, synchronous or asynchronous (as of this commit: polling and synchronous only). Message data is 100% opaque and so while the intention is to integrate it into a userland LWKT messaging subsystem, the actual system calls do not depend on any LWKT structures. Since these system calls are experiemental and may contain root holes, they must be enabled via the sysctl kern.caps_enabled.