Commit Graph

76209 Commits

Author SHA1 Message Date
jhb
eb29fde68b Properly lock accesses to p_tracep and p_traceflag. Also make a few
ktrace-only things #ifdef KTRACE that were not before.
2002-06-07 05:41:27 +00:00
jmallett
e277387a70 Describe ia64_unaligned and geom directories. I hope I got these right. 2002-06-07 05:41:15 +00:00
jhb
fd3d90c2c8 - Catch up to new ktrace API.
- ktrace trace points in msleep() and cv_wait() no longer need Giant.
2002-06-07 05:39:16 +00:00
jhb
fbebc83b5b Catch up to changes in ktrace API. 2002-06-07 05:37:18 +00:00
jhb
ab80d12ef1 Overhaul the ktrace subsystem a bit. For the most part, the actual vnode
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
2002-06-07 05:32:59 +00:00
jmallett
92c9b7b198 Add the m4(1) regression test. 2002-06-07 05:32:00 +00:00
jmallett
a3f088af5b Add a regression test for m4(1).
This checks the behaviour of changecom() in both GNU and BSD modes of our m4.
2002-06-07 05:31:32 +00:00
mdodd
355983613b Use a larger data type to prevent counters wrapping so quickly.
Silence a warning.
2002-06-07 05:29:13 +00:00
mdodd
8293541622 Sync this up with changes made in v1.8 of sys/netatm/atm_if.h 2002-06-07 05:25:10 +00:00
mdodd
da76203a8f Recognize Adaptec ANA-5910/30/40[A] boards.
Read the MAC address from Adaptec boards correctly.

Bits borrowed from sys/pci/if_en_pci.c.
2002-06-07 05:23:01 +00:00
jhb
3c64b3be28 Add a new SYSINIT subsystem for KTRACE. 2002-06-07 05:11:39 +00:00
jhb
d224bb103f - Add a per-thread member 'td_inktrace' to be used by ktrace to detect
when a thread is in the ktrace subsystem to avoid ktrace'ing internal
  ktrace events.
- Update the locking notes for p_traceflag and p_tracep taking into account
  the new ktrace_lock mutex.
2002-06-07 05:11:08 +00:00
tjr
586068906c No need to check for "-" explicitly in getopt() loop. 2002-06-07 02:35:21 +00:00
tjr
c4d587cfbc Exit >1 when an error occurs, regardless of whether -s is specified (SUSv3) 2002-06-07 02:30:56 +00:00
mdodd
be7ae7357c 'device hea' is no longer broken.
Add 'nowerror' to a few 'hea' files to ignore warnings on volatiles.
2002-06-07 02:04:09 +00:00
mdodd
d148b5fbbd Move some code around.
Minor whitespace changes.
2002-06-07 01:55:42 +00:00
jmallett
ecd7ab07f9 ANSI style function declarations. 2002-06-07 01:41:54 +00:00
tjr
8a3a920fbc Expand description of environment variables, refer to environ(7) where
appropriate.
2002-06-07 01:29:49 +00:00
tjr
336b5c6bdc Style nit: group together optional flags under the one Fl macro. 2002-06-07 01:17:54 +00:00
jmallett
01f3abcecd Back out previous back out of previously correct code.
Double-plus-pointy-hat to:	jmallett
Submitted by:			bde
2002-06-07 01:14:05 +00:00
tjr
e20227aeb2 Respect LC_CTYPE and LC_COLLATE environment variables, mainly for their
effects on regular expressions. The libc regex code does not handle
equivalence classes well (for example), but we do our best.
2002-06-07 01:04:24 +00:00
keramida
c1a85efa3a Use size_t or ino_t instead of int, and remove a few warnings.
The makewhatis utility is now ok with WARNS=3.

Reviewed by:	bde
2002-06-07 01:01:08 +00:00
tjr
385a534007 Refer to environ(7) for description of COLUMNS. Note the effects of LANG,
LC_ALL and LC_TIME upon the utility.
2002-06-07 00:50:22 +00:00
tjr
6a0bd60d3a Document the standard COLUMNS environment variable here to avoid redundant
descriptions of its effects in utilities' manual pages.
2002-06-07 00:45:06 +00:00
sobomax
87323b540c IMO it was a quite ugly idea that if we are running as uid 0 then we can
safely ignore current umask(2) and assume that permissions should be set
right like in the archive. Not only it violates POLA, but introduces
huge potential security vulnerability, particularly for ports, where
many popular archives come with 777 files and dirs.
2002-06-07 00:03:23 +00:00
jmallett
865fcaca35 Remove tunables to hide warnings that no longer exist. 2002-06-07 00:01:00 +00:00
jmallett
95a388cd9a Cast to long to match format. Hidden by revision 1.18 of Makefile. 2002-06-07 00:00:29 +00:00
des
b858776460 debug.{numvnodes,freevnodes} moved to vfs. 2002-06-06 23:01:50 +00:00
marcel
dc5340bd65 Work around a bug in the Linux version of ski, that's specific to
SSC_GET_RTC. This fixes the panic seen shortly after mounting the
root file system.

Thanks to: "K.Sumitani" <ksumitani@mui.biglobe.ne.jp>
2002-06-06 22:49:23 +00:00
keramida
df281667d3 Clarify the bit about realloc() and its `ptr' argument a bit.
Hopefully, now it is more clear that the memory referenced by the
ptr argument of realloc(ptr,size) is freed and only the return value
of realloc() points to a valid memory area upon successful completion.

Submitted by:	Martin Faxer <gmh003532@brfmasthugget.se>
2002-06-06 22:11:19 +00:00
jmallett
d11731ff43 Use a global `now' variable for the current time, and initialise it at
startup, right after calling setlocale(3).
2002-06-06 21:21:25 +00:00
jmallett
becd81c4a9 Implement a SUSv3-ignorant but "time"-similar format for "etime", elapsed
run time (NOT cpu time).  cputime() and elapsed() both need to honour SUSv3
now.
2002-06-06 21:18:37 +00:00
jmallett
b00060629b sysctlbyname(3) returns -1 on failure, not any other value < 0. 2002-06-06 20:59:15 +00:00
jhb
165d918ce2 Change the all locks list from a STAILQ to a TAILQ. This bloats struct
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
2002-06-06 20:51:04 +00:00
semenu
f48bc32790 Fix a typo in my recently added comment: s/beleived/believed/
Submitted by:	keramida
2002-06-06 20:43:03 +00:00
jmallett
b9515c4b9c Support the SUSv3 `rgroup' format.
Clean up some local style bogons.
2002-06-06 20:42:16 +00:00
dougb
bfb17f2ab2 * Use the new stat(1) to get mode information from the files we
are installing.
* Since this means that for now we can't accomodate non-standard
umask's, warn the user accordingly.
* Convert the "press enter to continue" prompt into a function.
2002-06-06 20:38:22 +00:00
jmallett
7916563c61 Cast arg_max to size_t when comparing it (times 4, plus 1) against SIZE_MAX. I
was worried about truncation of arg_max by this cast, but if it gets truncated,
we know it'll obviously be greater than SIZE_MAX anyway.

Big pointy hat to:	jmallett
Submitted by:		keramida
2002-06-06 20:29:39 +00:00
jmallett
562b4c0250 SUSv3 conform on the "comm" and "args" formats, and make correct the "command"
format, since it's BSDlike, and "comm" is actually different.
2002-06-06 20:21:47 +00:00
gordon
e5b172f462 Remove the old nextboot from Whistler. AFAIK this hasn't been useable in
quite a while and only works on i386.
2002-06-06 20:20:58 +00:00
phk
efb6005b12 s/daddr_t/ufs_daddr_t/g
This should fix the issues which cropped up after daddr_t grew up.

Sponsored by:	DARPA & NAI Labs.
2002-06-06 19:59:46 +00:00
dougb
a251620880 Hook stat into the build
Fix a trailing ws nit while I'm here
2002-06-06 19:36:51 +00:00
dougb
4bbb3471b5 This commit was generated by cvs2svn to compensate for changes in r97952,
which included commits to RCS files with non-trunk default branches.
2002-06-06 19:27:17 +00:00
dougb
b1ea4d6a24 Virgin import of NetBSD's stat(1) 2002-06-06 19:27:17 +00:00
gordon
6fef03564b Unhook the old nextboot(8) from the build. If no one yells too loudly, this
will be accompanied by a cvs rm of the actual nextboot sources.

Approved by:	jake (mentor)
2002-06-06 19:26:15 +00:00
davidc
b44a13481e s/!SIGNOTEMPY/SIGISEMPTY/
Reviewed by: marcel, jhb, alfred
2002-06-06 19:12:41 +00:00
davidc
7b59b3310d Document MTX_DUPOK
Requested by: jeff (long ago)
2002-06-06 19:08:11 +00:00
jhb
de3e290d8f Handle "dead" witnesses better in the situation of several short term locks
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.
2002-06-06 19:04:38 +00:00
alfred
63b8dfa515 fix typo in _SYS_SYSPROTO_H_ case: s/mlockall_args/munlockall_args
Submitted by: Mark Santcroos <marks@ripe.net>
2002-06-06 18:51:14 +00:00
des
5c7a83ed1d Factor out some code in preparation for un-kmeming fstat(1).
Sponsored by:	DARPA, NAI Labs
2002-06-06 18:39:53 +00:00