summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* We no longer need to acqure Giant in ast() for ktrpsig() in postsig() nowjhb2002-06-071-2/+0
| | | | that ktrace no longer needs Giant.
* - trapsignal() no longer needs to acquire Giant for ktrpsig().jhb2002-06-071-7/+5
| | | | - Catch up to new ktrace API.
* - Proper locking for p_tracep and p_traceflag.jhb2002-06-071-7/+7
| | | | - Catch up to new ktrace API.
* Properly lock accesses to p_tracep and p_traceflag. Also make a fewjhb2002-06-073-3/+27
| | | | ktrace-only things #ifdef KTRACE that were not before.
* - Catch up to new ktrace API.jhb2002-06-072-28/+23
| | | | - ktrace trace points in msleep() and cv_wait() no longer need Giant.
* Catch up to changes in ktrace API.jhb2002-06-073-20/+21
|
* Overhaul the ktrace subsystem a bit. For the most part, the actual vnodejhb2002-06-071-227/+446
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | operations to dump a ktrace event out to an output file are now handled asychronously by a ktrace worker thread. This enables most ktrace events to not need Giant once p_tracep and p_traceflag are suitably protected by the new ktrace_lock. There is a single todo list of pending ktrace requests. The various ktrace tracepoints allocate a ktrace request object and tack it onto the end of the queue. The ktrace kernel thread grabs requests off the head of the queue and processes them using the trace vnode and credentials of the thread triggering the event. Since we cannot assume that the user memory referenced when doing a ktrgenio() will be valid and since we can't access it from the ktrace worker thread without a bit of hassle anyways, ktrgenio() requests are still handled synchronously. However, in order to ensure that the requests from a given thread still maintain relative order to one another, when a synchronous ktrace event (such as a genio event) is triggered, we still put the request object on the todo list to synchronize with the worker thread. The original thread blocks atomically with putting the item on the queue. When the worker thread comes across an asynchronous request, it wakes up the original thread and then blocks to ensure it doesn't manage to write a later event before the original thread has a chance to write out the synchronous event. When the original thread wakes up, it writes out the synchronous using its own context and then finally wakes the worker thread back up. Yuck. The sychronous events aren't pretty but they do work. Since ktrace events can be triggered in fairly low-level areas (msleep() and cv_wait() for example) the ktrace code is designed to use very few locks when posting an event (currently just the ktrace_mtx lock and the vnode interlock to bump the refcoun on the trace vnode). This also means that we can't allocate a ktrace request object when an event is triggered. Instead, ktrace request objects are allocated from a pre-allocated pool and returned to the pool after a request is serviced. The size of this pool defaults to 100 objects, which is about 13k on an i386 kernel. The size of the pool can be adjusted at compile time via the KTRACE_REQUEST_POOL kernel option, at boot time via the kern.ktrace_request_pool loader tunable, or at runtime via the kern.ktrace_request_pool sysctl. If the pool of request objects is exhausted, then a warning message is printed to the console. The message is rate-limited in that it is only printed once until the size of the pool is adjusted via the sysctl. I have tested all kernel traces but have not tested user traces submitted by utrace(2), though they should work fine in theory. Since a ktrace request has several properties (content of event, trace vnode, details of originating process, credentials for I/O, etc.), I chose to drop the first argument to the various ktrfoo() functions. Currently the functions just assume the event is posted from curthread. If there is a great desire to do so, I suppose I could instead put back the first argument but this time make it a thread pointer instead of a vnode pointer. Also, KTRPOINT() now takes a thread as its first argument instead of a process. This is because the check for a recursive ktrace event is now per-thread instead of process-wide. Tested on: i386 Compiles on: sparc64, alpha
* Change the all locks list from a STAILQ to a TAILQ. This bloats structjhb2002-06-061-6/+6
| | | | | | | | | | lock_object by another pointer (though all of lock_object should be conditional on LOCK_DEBUG anyways) in exchange for an O(1) TAILQ_REMOVE() in witness_destroy() (called for every mtx_destroy() and sx_destroy()) instead of an O(n) STAILQ_REMOVE. Since WITNESS is so dog slow as it is, the speed-up is worth the space cost. Suggested by: iedowse
* s/!SIGNOTEMPY/SIGISEMPTY/davidc2002-06-061-1/+1
| | | | Reviewed by: marcel, jhb, alfred
* Handle "dead" witnesses better in the situation of several short term locksjhb2002-06-061-13/+11
| | | | | | | | | | | | | | being created and destroyed without a single long-term one around to ensure the witness associated with that group of locks stays alive. The pipe mutexes are an example of this group. For a dead witness we no longer clear the witness name. Instead, when looking up the witness for a lock, if a dead witness' (a witness with a refcount of 0) w_name pointer is identical to the witness name of the lock then we revive that witness instead of using a new witness for the lock. This results in far fewer dead witness objects and also better preserves locking orders over the long term resulting in more correct lock order checking. Note that we can't ever derefence w_name of a dead witness since we don't know if the string it is pointing to has been free()'d or kldunload()'d out from under us.
* Move some sysctls from the debug tree to the vfs tree.des2002-06-061-3/+3
|
* Gratuitous whitespace cleanup.des2002-06-061-28/+27
|
* Use "bwrbg" as description when we sleep for background writing,phk2002-06-061-1/+1
| | | | "biord" was misleading in every possible way.
* Fixed overflow in the bounds checking in dscheck(). It assumed thatbde2002-06-061-4/+4
| | | | | | | | daadr_t is no larger than a long, and some other relatively harmless things (*blush*). Overflow for subtracting a daddr_t from a u_long caused "truncation" of the i/o for attempts to access blocks beyond the end of the actually cause expansion of the i/o to a preposterous size.
* Replace thread_runnable() with thread_running() as the latter is morejhb2002-06-042-12/+10
| | | | | | accurate. Suggested by: julian
* Optimize the adaptive mutex spin a bit. Use a simple while loop withjhb2002-06-042-2/+8
| | | | | | | | | simple reads (and on IA32, a "pause" instruction for each interation of the loop) to spin until either the mutex owner field changes, or the lock owner stops executing. Suggested by: tanimura Tested on: i386
* Add a private thread_runnable() macro to make the code more readable andjhb2002-06-042-6/+10
| | | | make the KSE diff easier to maintain.
* ANSIfy the one remaining K&R function.des2002-06-021-4/+1
|
* Whitespace nits.des2002-06-021-2/+2
|
* Add support for 'j' flag. Simplify the size modifier code and reduce codedes2002-06-021-100/+71
| | | | | | duplication. Also add support for 'n' specifier. Reviewed by: bde
* Fix typo in the BSD copyright: s/withough/without/schweikh2002-06-021-1/+1
| | | | | Spotted and suggested by: des MFC after: 3 weeks
* Add POSIX.1-2001 WCONTINUED option for waitpid(2). A proc flagmike2002-06-012-1/+19
| | | | | | | | | | (P_CONTINUED) is set when a stopped process receives a SIGCONT and cleared after it has notified a parent process that has requested notification via waitpid(2) with WCONTINUED specified in its options operand. The status value can be checked with the new WIFCONTINUED() macro. Reviewed by: jake
* Fix a bug in m_split(): the "m->m_ext.ext_size" field of an mbuf was beingarchie2002-05-311-1/+5
| | | | | | | | | | | | | set to zero. This field indicates the total space in the external buffer and therefore should not be modified after the external buffer is added. Add a comment warning that the mbufs returned by m_split() might be read-only. Fix M_TRAILINGSPACE() to return zero if !M_WRITABLE(m). Reviewed by: freebsd-net Obtained from: Vernier Networks, Inc. MFC after: 1 week
* Nit: kern.ttys is of type S,xtty, not S,tty.des2002-05-311-1/+1
|
* Back out my lats commit of locking down a socket, it conflicts with hsu's work.tanimura2002-05-319-402/+158
| | | | Requested by: hsu
* - Replace the bandaid introduced in revision 1.110 withrobert2002-05-311-1/+3
| | | | | | a better solution. - Add braces for a ``for'' statement containing a single multi-line statement.
* Mistyped and lost a '&' in previous commit.phk2002-05-301-1/+1
|
* Don't forget to factor in the boottime when we calculate PPS timestamps.phk2002-05-301-0/+1
| | | | Submitted by: Akira Watanabe <akira@myaw.ei.meisei-u.ac.jp>
* Record the file, line, and pid of the last successful shared lock holder. Thisjeff2002-05-301-0/+6
| | | | | is useful as a last effort in debugging file system deadlocks. This is enabled via 'options DEBUG_LOCKS'
* CURSIG() is not a macro so rename it cursig().julian2002-05-294-16/+16
| | | | Obtained from: KSE tree
* diff reduction from KSE to keep WW-III from happenning on -currentjulian2002-05-291-1/+2
|
* Add some checks to prevent NULL dereferences.des2002-05-281-3/+6
| | | | Submitted by: jhay
* Remove a duplicated vfs_freeopts() that I introduced in lastmux2002-05-282-4/+2
| | | | revision.
* Add NAI copyright.des2002-05-281-0/+8
|
* Add uuidgen(2) and uuidgen(1).marcel2002-05-283-2/+226
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The uuidgen command, by means of the uuidgen syscall, generates one or more Universally Unique Identifiers compatible with OSF/DCE 1.1 version 1 UUIDs. From the Perforce logs (change 11995): Round of cleanups: o Give uuidgen() the correct prototype in syscalls.master o Define struct uuid according to DCE 1.1 in sys/uuid.h o Use struct uuid instead of uuid_t. The latter is defined in sys/uuid.h but should not be used in kernel land. o Add snprintf_uuid(), printf_uuid() and sbuf_printf_uuid() to kern_uuid.c for use in the kernel (currently geom_gpt.c). o Rename the non-standard struct uuid in kern/kern_uuid.c to struct uuid_private and give it a slightly better definition for better byte-order handling. See below. o In sys/gpt.h, fix the broken uuid definitions to match the now compliant struct uuid definition. See below. o In usr.bin/uuidgen/uuidgen.c catch up with struct uuid change. A note about byte-order: The standard failed to provide a non-conflicting and unambiguous definition for the binary representation. My initial implementation always wrote the timestamp as a 64-bit little-endian (2s-complement) integral. The clock sequence was always written as a 16-bit big-endian (2s-complement) integral. After a good nights sleep and couple of Pan Galactic Gargle Blasters (not necessarily in that order :-) I reread the spec and came to the conclusion that the time fields are always written in the native by order, provided the the low, mid and hi chopping still occurs. The spec mentions that you "might need to swap bytes if you talk to a machine that has a different byte-order". The clock sequence is always written in big-endian order (as is the IEEE 802 address) because its division is resulting in bytes, making the ordering unambiguous.
* Add syscall uuidgen() for generating Univerally Unique Identifiersmarcel2002-05-281-0/+1
| | | | | | (UUIDs). On ia64 UUIDs, aka GUIDs, are used by EFI and the firmware among others. To create GUID Partition Tables (GPTs), we need to be able to generate UUIDs.
* Introduce struct xtty, used when exporting tty information to userland.des2002-05-281-5/+30
| | | | | | | Make kern.ttys export a struct xtty rather than struct tty. Since struct tty is no longer exposed to userland, remove the dev_t / udev_t hack. Sponsored by: DARPA, NAI Labs
* o Remove some unnecessary casting from and add some necessary casting toalc2002-05-251-3/+3
| | | | | | aio_suspend() and lio_listio(). Submitted by: bde
* ANSIfy (significant portions were already partly ANSIfied)des2002-05-251-115/+42
|
* Remove register.des2002-05-251-51/+51
|
* Automated whitespace cleanup.des2002-05-251-10/+10
|
* Make the run queue parameters machine dependent. Optimize 64 bitjake2002-05-251-0/+2
| | | | | | | architectures by using a 64 bit word for the bit array which keeps track of non-empty queues. Reviewed by: peter
* Fix warnings. Also, removed an unused variable that I found that was justpeter2002-05-241-6/+4
| | | | initialized and never used afterwards.
* Style nit, no functional changes.mux2002-05-232-0/+2
|
* Slightly change the way we pass mount options to the filesystemmux2002-05-232-12/+24
| | | | | | VFS_NMOUNT operations. Reviewed by: phk
* In m_aux_delete, no need to chase beyond victim.ume2002-05-231-0/+1
| | | | | Submitted by: archie Obtained from: KAME
* Minor nit: get p pointer in msleep() from td->td_proc (wherejhb2002-05-231-1/+1
| | | | td == curthread) rather than from curproc.
* Whitespace: trim a trailing tab.jhb2002-05-231-1/+1
|
* Make the counters uintmax_ts, and use %ju rather than %llu.des2002-05-232-4/+6
|
* Rename pause() to ia32_pause() so it doesn't conflict with the pause()jhb2002-05-222-10/+10
| | | | | function defined in <unistd.h>. I didn't #ifdef _KERNEL it because the mutex implementation in libpthread will probably need this.
OpenPOWER on IntegriCloud