Commit Graph

48360 Commits

Author SHA1 Message Date
Mike Silbersack
4ca037c6c8 Add a #error requiring KDB if DDB is specified. (This can probably be
relocated to a better place, if one exists.)
2004-07-19 02:46:34 +00:00
Peter Grehan
8653f72f6e Empty GENERIC.hints file needed by make release.
Noticed by:  Suleiman Souhlal <refugee@segfaulted.com>
2004-07-19 02:08:22 +00:00
Julian Elischer
55d44f79ea When calling scheduler entrypoints for creating new threads and processes,
specify "us" as the thread not the process/ksegrp/kse.
You can always find the others from the thread but the converse is not true.
Theorotically this would lead to runtime being allocated to the wrong
entity in some cases though it is not clear how often this actually happenned.
(would only affect threaded processes and would probably be pretty benign,
but it WAS a bug..)

Reviewed by: peter
2004-07-18 23:36:13 +00:00
Pawel Jakub Dawidek
ece2d9891e Now we have NO_ADAPTIVE_MUTEXES option, so use it here too.
Missed by:	scottl
2004-07-18 23:27:14 +00:00
Julian Elischer
505fad52f7 Reverse a lock/unlock pair that were the wrong way around in some code that
is obviously not run a lot. (but is in some test cases).
This code is not usually run because it covers a case that doesn't
happen a lot (removing a node that has data traversing it).
2004-07-18 22:57:46 +00:00
Robert Watson
08f85b089e Comment clarifying debug_mpsafenet. 2004-07-18 21:50:22 +00:00
Alan Cox
aec86de47b Utilize pmap_pte_quick() rather than pmap_pte() in pmap_protect(). The
reason being that pmap_pte_quick() requires the page queues lock, which is
already held, rather than Giant.
2004-07-18 21:19:10 +00:00
Marcel Moolenaar
1f7a1baa37 After maintaining previous behaviour in writing out the core notes, it's
time now to break with the past: do not write the PID in the first note.
Rationale:
1.  [impact of the breakage] Process IDs in core files serve no immediate
    purpose to the debugger itself. They are only useful to relate a core
    file to a process. This can provide context to the person looking at
    the core file, provided one keeps track of this. Overall, not having
    the PID in the core file is only in very rare occasions unfortunate.
2.  [reason of the breakage] Having one PRSTATUS note contain the PID,
    while all others contain the LWPID of the corresponding kernel thread
    creates an irregularity for the debugger that cannot easily be worked
    around. This is caused by libthread_db correlating user thread IDs to
    kernel thread (aka LWP) IDs and thus aware of the actual LWPIDs.

Update comments accordingly.
2004-07-18 20:28:07 +00:00
Gary Jennejohn
eab6e771a0 Fix a possible hang which apparently occurs during a warm boot (cold boot
does not display the symptom). Evidently the ifpi2 controller needs to be
massaged more than it was.

Note that this does not close the PR since it was filed against 4.9.

MFC: 5 days
PR: kern/68756
Submitted by: Ari Suutari <ari.suutari@syncrontech.com>
2004-07-18 20:13:31 +00:00
Robert Watson
8bbfdc98e4 Gratuitous whitespace change to un-wrap a short line. 2004-07-18 19:53:35 +00:00
David Malone
cdb71f7526 The recent changes to control message passing broke some things
that get certain types of control messages (ping6 and rtsol are
examples). This gets the new code closer to working:

	1) Collect control mbufs for processing in the controlp ==
	NULL case, so that they can be freed by externalize.

	2) Loop over the list of control mbufs, as the externalize
	function may not know how to deal with chains.

	3) In the case where there is no externalize function,
	remember to add the control mbuf to the controlp list so
	that it will be returned.

	4) After adding stuff to the controlp list, walk to the
	end of the list of stuff that was added, incase we added
	a chain.

This code can be further improved, but this is enough to get most
things working again.

Reviewed by:	rwatson
2004-07-18 19:10:36 +00:00
Alexander Kabaev
8024a9da08 Unbreak kernel compiles by preserving an old opt_adaptive_mutexes.h file
name.
2004-07-18 18:21:39 +00:00
Pawel Jakub Dawidek
726cb09fbc Fix copy&paste bug. 2004-07-18 16:51:58 +00:00
Doug Rabson
4c4392e791 Add doxygen doc comments for most of newbus and the BUS interface. 2004-07-18 16:30:31 +00:00
Scott Long
701f140800 Enable ADAPTIVE_MUTEXES by default by changing the sense of the option to
NO_ADAPTIVE_MUTEXES.  This option has been enabled by default on amd64 for
quite some time, and has been extensively tested on i386 and sparc64.  It
shows measurable performance gains in many circumstances, and few negative
effects.  It would be nice in t he future if adaptive mutexes actually went
to sleep after a certain amount of spinning, but that will require quite a
bit more testing.
2004-07-18 15:59:03 +00:00
Max Laier
e89865e516 Fix a stupid attemp to apply host arithmetics to network byte ordered data.
This fixes checksum for some drivers with partial H/W ckcsum offloads.

Reported by:	Simon 'corecode' Schubert, Devon H. O'Dell, hmp
Reviewed by:	Pyun YongHyeon
2004-07-18 14:25:48 +00:00
David Malone
fb75797e40 I missed two pieces of the commit to this file. Robert has already
added one, this adds the other.
2004-07-18 09:26:34 +00:00
Mark Murray
587d5fc63b Start the entropy device insecure/unblocked. I'll be handing over
responsibility for critical randomness requirements (like sshd)
to rc.d/*

Requested by: many
2004-07-18 09:07:58 +00:00
Maxim Konovalov
aa355a2679 In -CURRENT pseudo devices are not statically assigned at compile time,
remove a stale comment.

PR:		kern/62285
2004-07-18 09:03:12 +00:00
Pawel Jakub Dawidek
be7695cf65 Fix exclusive-bit leakage. 2004-07-18 06:54:29 +00:00
MIHIRA Sanpei Yoshiro
788b424006 Add support System TALKS Inc. SGC-X2UL
PR:		FreeBSD-users-jp/80137
Submitted by:	HORIO Shinsuke <shin@happynet.co.jp>
2004-07-18 06:45:38 +00:00
MIHIRA Sanpei Yoshiro
ab625e4edf Quirk for SEGRAND NP-900 USB MP3Player
PR:		kern/64563
Submitted by:	Kunitada Kokubun <unix_grandy@yahoo.co.jp>
MFC after:	1 week
2004-07-18 05:39:14 +00:00
Alan Cox
4a28f15ccd Only extract a physical address from a pte in pmap_extract() if the pte is
valid.

Implement the protection check required by the pmap_extract_and_hold()
specification.  (This enables the elimination of Giant from that function.)
2004-07-18 05:09:28 +00:00
Alan Cox
d8582da660 Remove GIANT_REQUIRED from vmapbuf(). 2004-07-18 04:57:49 +00:00
Alan Cox
3e36afbe27 Remove the GIANT_REQUIRED preceding pmap_remove() in
vm_pageout_map_deactivate_pages().
2004-07-18 04:38:11 +00:00
Robert Watson
38da2381cd Remove 'sg' argument to linux_sendto_hdrincl, which is what I think was
intended.  This fixes the build, but might require revision.
2004-07-18 04:09:40 +00:00
Robert Watson
2260c03d77 Drop Giant and acquire the UNIX domain socket subsystem lock a bit
earlier in unp_connect() so that vp->v_socket can't change between
our copying its value to a local variable and later use of that
variable.  This may have been responsible for a panic during
shutdown that I experienced where simultaneous closing of a listen
socket by rpcbind and a new connection being made to rpcbind by
mountd.
2004-07-18 01:29:43 +00:00
Max Laier
a9ce8750b6 m_tag_copy takes an additional "how" parameter in FreeBSD.
Submitted by:	rwatson
2004-07-18 00:51:56 +00:00
Alfred Perlstein
2603507443 Fix macro so that we don't get missing initializer warnings. 2004-07-17 23:56:24 +00:00
Alfred Perlstein
86db59f8ab Change named parameters from max (which conflicts with a macro in libkern.h)
to maxval.
2004-07-17 23:53:37 +00:00
Alan Cox
b73cfbb3e4 Remedy my omission of one change in the prevision revision: pmap_remove()
must pin the current thread in order to call pmap_pte_quick().
2004-07-17 23:44:59 +00:00
David Xu
c3d88cbab8 Fix typo. 2004-07-17 23:15:41 +00:00
Alan Cox
c9829537f4 - Utilize pmap_pte_quick() rather than pmap_pte() in pmap_remove() and
pmap_remove_page().  The reason being that pmap_pte_quick() requires
   the page queues lock, which is already held, rather than Giant.
 - Assert that the page queues lock is held in pmap_remove_page() and
   pmap_remove_pte().
2004-07-17 22:20:53 +00:00
David Malone
932312d60b Fix the !INET6 build.
Reported by:	alc
2004-07-17 21:40:14 +00:00
David Malone
e140eb430c Add a kern_setsockopt and kern_getsockopt which can read the option
values from either user land or from the kernel. Use them for
[gs]etsockopt and to clean up some calls to [gs]etsockopt in the
Linux emulation code that uses the stackgap.
2004-07-17 21:06:36 +00:00
David Malone
969860f3ed The tcp syncache code was leaving the IPv6 flowlabel uninitialised
for the SYN|ACK packet and then letting in6_pcbconnect set the
flowlabel later. Arange for the syncache/syncookie code to set and
recall the flow label so that the flowlabel used for the SYN|ACK
is consistent. This is done by using some of the cookie (when tcp
cookies are enabeled) and by stashing the flowlabel in syncache.

Tested and Discovered by:	Orla McGann <orly@cnri.dit.ie>
Approved by:			ume, silby
MFC after:			1 month
2004-07-17 19:44:13 +00:00
Max Laier
0ad9506fab Merge in a stable fix from OpenBSD:
MFC:
  Fix by dhartmei@

  change pf_route() loop detection: introduce a counter (number of times
  a packet is routed already) in the mbuf tag, allow at most four times.
  Fixes some legitimate cases broken by the previous change.

Reviewed by:	dhartmei
2004-07-17 17:15:15 +00:00
Søren Schmidt
4ad91b11e7 Dont set "address setup timing" on newer VIA chips.
closes PR:	69180
2004-07-17 14:48:46 +00:00
Yoshihiro Takahashi
2b117a5ab9 Rename the sound device drivers. 2004-07-17 10:22:42 +00:00
Yoshihiro Takahashi
b13793039c Merged from the following changes.
- sys/dev/fdc/fdc.c revision 1.281
  - sys/dev/fdc/fdcvar.h revision 1.3
  - sys/dev/fdc/fdc_isa.c revision 1.7
2004-07-17 10:07:19 +00:00
Yoshihiro Takahashi
5ceae6b826 Correct typo. 2004-07-17 10:05:56 +00:00
Yoshihiro Takahashi
55d553460e Remove duplicate include. 2004-07-17 10:05:32 +00:00
Hidetoshi Shimokawa
6e2b0d0b25 Add some PCI IDs for OHCI chips.
Obtained from: DragonFly BSD
2004-07-17 09:41:20 +00:00
Peter Grehan
b7ef1c19e4 Resurrect kld support. Support ADDR16_HA/LA relocations, and sync
the icache on module load. Requires "-mlongcall" support, in gcc >= 3.3
but needs a bugfix to support gcc arith builtins.
2004-07-17 07:26:32 +00:00
Max Laier
c550f2206d Define semantic of M_SKIP_FIREWALL more precisely, i.e. also pass associated
icmp_error() packets. While here retire PACKET_TAG_PF_GENERATED (which
served the same purpose) and use M_SKIP_FIREWALL in pf as well. This should
speed up things a bit as we get rid of the tag allocations.

Discussed with:	juli
2004-07-17 05:10:06 +00:00
Alan Cox
cd1f927d84 MFamd64 revision 1.478
Simplify pmap_remove_pages(), eliminating unnecessary indirection.
2004-07-17 04:01:29 +00:00
Juli Mallett
765d141c78 Make M_SKIP_FIREWALL a global (and semantic) flag, preventing anything from
using M_PROTO6 and possibly shooting someone's foot, as well as allowing the
firewall to be used in multiple passes, or with a packet classifier frontend,
that may need to explicitly allow a certain packet.  Presently this is handled
in the ipfw_chk code as before, though I have run with it moved to upper
layers, and possibly it should apply to ipfilter and pf as well, though this
has not been investigated.

Discussed with:	luigi, rwatson
2004-07-17 02:40:13 +00:00
Warner Losh
59f7a82d52 Be consistant with probe 2004-07-16 23:07:38 +00:00
Maxime Henrion
d49311a74f Ignore more strange return values of the test_aux_port() function,
because some notebooks (apparently Compaq, Toshiba and Acer ones)
erroneously return 2 or 3 there.

PR:		kern/61482, kern/54188
Submitted by:	Ulf Lilleengen <lulf@kerneled.org>,
		Victor Balada Diaz <victor@alf.dyndns.ws>
MFC after:	3 days
2004-07-16 22:04:29 +00:00
Paul Saab
a146798856 Fix the build. pcm is no more. 2004-07-16 21:48:30 +00:00
Alan Cox
2c45ce1b42 Remove dead or unused code, such as spl calls. 2004-07-16 21:38:48 +00:00
John Baldwin
52eb84641d - Move TDF_OWEPREEMPT, TDF_OWEUPC, and TDF_USTATCLOCK over to td_pflags
since they are only accessed by curthread and thus do not need any
  locking.
- Move pr_addr and pr_ticks out of struct uprof (which is per-process)
  and directly into struct thread as td_profil_addr and td_profil_ticks
  as these variables are really per-thread.  (They are used to defer an
  addupc_intr() that was too "hard" until ast()).
2004-07-16 21:04:55 +00:00
John Baldwin
d3373e371b Whitespace fix. 2004-07-16 21:01:52 +00:00
John Baldwin
6dbc085016 Improve readability a bit by changing some code at the end of a function
that did:

	if (foo)
		return
	else
		blah

to just do the simpler

	if (!foo)
		blah

instead.
2004-07-16 21:00:50 +00:00
David E. O'Brien
6946a5bfcb /usr/libexec/ld-elf.so.1 -> /libexec/ld-elf32.so.1 2004-07-16 20:53:00 +00:00
Nate Lawson
021730ab36 Use ACPI_ALL_NOTIFY instead of registering handlers separately. 2004-07-16 19:05:40 +00:00
Nate Lawson
b9e96ac139 Fix the alpha (and others) module build by only building fdc_acpi.c on
i386 and amd64.  The only other ACPI machine (ia64) doesn't support
floppy drives.  Tested by:  make MACHINE={pc98,i386,amd64,alpha,sparc64}
2004-07-16 18:37:00 +00:00
Hajimu UMEMOTO
8a59da300c when IN6P_AUTOFLOWLABEL is set, the flowlabel is not set on
outgoing tcp connections.

Reported by:	Orla McGann <orly@cnri.dit.ie>
Reviewed by:	Orla McGann <orly@cnri.dit.ie>
Obtained from:	KAME
2004-07-16 18:08:13 +00:00
Hartmut Brandt
149562005e According to POSIX sys/socket.h must define CMSG_NXTHDR but most not
define NULL. This means we cannot use NULL in the definition of CMSG_NXTHDR.
So replace NULL with 0.

PR:		kern/60309
Submitted by:	Jeff King <peff-freebsd@peff.net>
2004-07-16 17:42:48 +00:00
Nate Lawson
7051c84dd3 Fix acpi_video loading. When we started cleaning up the duplicate handles
left around after the PCI probe, acpi_video stopped attaching because while
it was an acpi child device, it really is a PCI device.  Fix this by making
it a PCI child.

* Remove non-handle ivars accesses since child busses only implement
acpi_get_handle().
* Access the acpi softc directly through the devclass instead of through
the implied parent.
* Clean up a potential panic on unload by freeing the sysctl context before
storing NULL in the OID.

Found by:	marks
2004-07-16 16:59:32 +00:00
Colin Percival
24283cc01b Add a SUSER_RUID flag to suser_cred. This flag indicates that we want to
check if the *real* user is the superuser (vs. the normal behaviour, which
checks the effective user).

Reviewed by:	rwatson
2004-07-16 15:57:16 +00:00
Seigo Tanimura
684acf8506 Sync the example of MODULES_OVERRIDE with the renamed sound drivers.
Pointed out by:	Christoph Mallon <christoph.mallon@gmx.de>
2004-07-16 08:12:14 +00:00
Seigo Tanimura
10ad45d2fc Rename snd_pcm as sound. 2004-07-16 07:24:20 +00:00
Seigo Tanimura
0739ea1de2 Rename the sound device drivers:
- `sound'
  The generic sound driver, always required.

- `snd_*'
  Device-dependent drivers, named after the sound module names.
  Configure accordingly to your hardware.

In addition, rename the `snd_pcm' module to `sound' in order to sync
with the driver names.

Suggested by:	cg
2004-07-16 04:00:08 +00:00
Alan Cox
6fe30ff3f2 Remove unused fields from the pmap. 2004-07-16 03:42:45 +00:00
Robert Watson
dee57980c5 Rename Biba and MLS _single label elements to _effective, which more
accurately represents the intention of the 'single' label element in
Biba and MLS labels.  It also approximates the use of 'effective' in
traditional UNIX credentials, and avoids confusion with 'singlelabel'
in the context of file systems.

Inspired by:	trhodes
2004-07-16 02:03:50 +00:00
Robert Watson
dad7b41a9b When entering soclose(), assert that SS_NOFDREF is not already set. 2004-07-16 00:37:34 +00:00
Gleb Smirnoff
8250de8330 Use qsort_r() instead of qsort() when sorting links by latency
This helps us to remove a global variable and a mutex protecting it.

Reviewed by:	rwatson
Approved by:	julian (mentor)
2004-07-16 00:07:44 +00:00
Gleb Smirnoff
b1e34c44ef Copy qsort_r(3) from libc to libkern.
Reviewed by:	phk
Approved by:	julian (mentor)
2004-07-15 23:58:23 +00:00
Jim Rees
af341d82c4 fix array index out of bounds in rpc->rc_srtt[], rpc->rc_sdrtt[]
Noticed by: tedu
Approved by: alfred
2004-07-15 22:21:25 +00:00
Poul-Henning Kamp
672c05d49c Preparation commit for the tty cleanups that will follow in the near
future:

rename ttyopen() -> tty_open() and ttyclose() -> tty_close().

We need the ttyopen() and ttyclose() for the new generic cdevsw
functions for tty devices in order to have consistent naming.
2004-07-15 20:47:41 +00:00
Lukas Ertl
e65b8f47b3 MFNetBSD.
rev. 1.67, author: mycroft
   Fix a byte order error.

rev. 1.68, author: mycroft
   Adjust some silliness that was causing us to do extra work for
   "frame list rollover" interrupts, which we pretty much ignore.

Obtained from:   NetBSD
2004-07-15 19:25:06 +00:00
Alan Cox
3d2e54c317 Push down the acquisition and release of the page queues lock into
pmap_protect() and pmap_remove().  In general, they require the lock in
order to modify a page's pv list or flags.  In some cases, however,
pmap_protect() can avoid acquiring the lock.
2004-07-15 18:00:43 +00:00
Nate Lawson
aa21251d11 Add fdc_acpi to module build, bump WARNS to 2. 2004-07-15 16:44:14 +00:00
Nate Lawson
32cfa66575 Hook up fdc_acpi for the kernel build. 2004-07-15 16:43:52 +00:00
Nate Lawson
0bdf1a5508 Clean up resources properly if attach fails. Always reset ISA drives on
probe.
2004-07-15 16:41:07 +00:00
Nate Lawson
a6e4d8c453 Re-work for fdc_acpi. Expose fdc_add_child() and move the static
hints-based probe to fdc_hints_probe().

Also:
* Fix some resource leaks when attach fails.
* Remove the FDC_ATTACHED flag.  It was supposed to prevent multiple
  unloads but this is not necessary.
2004-07-15 16:39:40 +00:00
Nate Lawson
a54c9cb131 Add an ACPI floppy drive attachment that probes via the _FDE and _FDI
methods.  It also now handles ordinary floppy drive probing for drives
attached to ACPI.

Reviewed by:	imp
2004-07-15 16:38:07 +00:00
John Baldwin
fe96955252 Fix a typo in a comment. 2004-07-15 16:37:48 +00:00
Nate Lawson
df8d2a326e Update the interface for child drivers. Add acpi_scan_children, which
allows a bus to re-enumerate its child handles and optionally replace
them with new children, arranged to the bus's liking.  (The current device
space is flat with all devices immediately under acpi0).  Add comments
for each interface.
2004-07-15 16:29:08 +00:00
Yoshihiro Takahashi
dc6ea865f7 Move the fdc_alloc_resources function into the bus front end. 2004-07-15 15:00:02 +00:00
Poul-Henning Kamp
3e019deaed Do a pass over all modules in the kernel and make them return EOPNOTSUPP
for unknown events.

A number of modules return EINVAL in this instance, and I have left
those alone for now and instead taught MOD_QUIESCE to accept this
as "didn't do anything".
2004-07-15 08:26:07 +00:00
Alfred Perlstein
bb5faea34f Cleanup shutdown output. 2004-07-15 08:01:00 +00:00
Peter Pentchev
a2f87f4268 A couple of grammar fixes in the bktr options section.
PR:		66828 (mostly)
Submitted by:	Michel Lavondes <fox@vader.aacc.cc.md.us>
MFC after:	2 weeks
2004-07-15 07:52:27 +00:00
Alfred Perlstein
da6303bacc Tidy up system shutdown. 2004-07-15 04:29:48 +00:00
David Xu
b87323363c type prgregset_t really should be an array. this is odd, however, other
systems defined interfaces in thread_db.h use prgregset_t but not
prgregset_t * to be a output parameter, this is the only way to maintain
source code compatible with them.
2004-07-15 03:52:17 +00:00
Alfred Perlstein
a88295bb83 Disable SIGIO for now, leave a comment as to why it's busted and hard
to fix.
2004-07-15 03:49:52 +00:00
Nate Lawson
8916adb1c9 Clean up the output on reboot by keeping completion messages on the same
line as the announcement.  Someone should probably update the "buffers
remaining" message since we now no longer should have any buffers remaining
at that point.
2004-07-15 03:20:08 +00:00
Alan Cox
72826d0f4a A loop in pmap_remove() should use TAILQ_FOREACH_SAFE(), not
TAILQ_FOREACH(), because the loop deletes elements from the list.

Reviewed by:	marcel@
2004-07-15 03:20:00 +00:00
Poul-Henning Kamp
e2ad640e13 A module with no modevent function gets modevent_nop() as default.
Until now the function has just returned zero for any event, but
that is downright wrong for MOD_UNLOAD and not very useful for any
future events we add where it may be crucial to be able to tell
if the event was unhandled or successful.

Change the function to return as follows:

	MOD_LOAD -> 0
	MOD_UNLOAD -> EBUSY
	anything else -> EOPNOTSUPP
2004-07-14 22:37:36 +00:00
Nate Lawson
6f41379967 Add a comment separator. 2004-07-14 22:09:32 +00:00
Robert Watson
6f7d64c44a Add a note indicating that the eh_prototype field used to construct
ethernet headers is unsynchronized.
2004-07-14 20:31:37 +00:00
Robert Watson
c61340f374 Add a mutex ng_tty_mtx to protect the global variable ngt_unit. Note
that the locking of globals here isn't complete, and there's also a
locking issue relating to calling into and out of the tty code.
2004-07-14 20:31:05 +00:00
Robert Watson
489264ddae Add ng_ppp_latencies_mtx, a global mutex to protect the latency list.
Note that the table is a hack, and so is this mutex.

Reviewed by:	glebius
2004-07-14 20:29:54 +00:00
Robert Watson
544fc3d562 Introduce a new mutex, ng_fec_mtx, to protect the global unit list to
synchronization allocation of FEC unit numbers.

Reviewed by:	glebius
2004-07-14 20:27:33 +00:00
Robert Watson
dffa5be1a4 Introduce a new mutex, ng_eiface_mtx, to protect the global unit list
lock used to synchronize allocation of unit numbers for new netgraph
ethernet interfaces.

Reviewed by:	glebius
2004-07-14 20:26:29 +00:00
Robert Watson
9a668fa4d8 Introduce a new mutex, ng_iface_mtx, to protect the global unit list
lock used to synchronize allocation of unit numbers for new netgraph
interfaces.

Reviewed by:	glebius
Tested by:	glebius
2004-07-14 20:24:21 +00:00
Mark Santcroos
9b7b2aeff6 Some laptops report the "design-capacity" instead of the "real-capacity"
when the battery is fully charged. That breaks some of the arithmetic in
calculating the remaining capacity (ends up with more than 100%).
This commit makes sure the max is 100.

Approved by:	njl
2004-07-14 19:31:31 +00:00
Christian S.J. Peron
ed6c545cf0 In addition to the real user ID check, do an explicit jail
check to ensure that the caller is not prison root.

The intention is to fix file descriptor creation so that
prison root can not use the last remaining file descriptors.
This privilege should be reserved for non-jailed root users.

Approved by:	bmilekic (mentor)
2004-07-14 19:04:31 +00:00
John Baldwin
0c9cb34441 Correct bounds check in lapic_create().
Submitted by:	"Ted Unangst" tedu at coverity.com
2004-07-14 18:12:15 +00:00
Dag-Erling Smørgrav
09a23520c0 Unbreak LINT: device card no longer takes a count. 2004-07-14 17:50:08 +00:00
Poul-Henning Kamp
d8d3d4158b Make sure to update the mnt_stats before UFS1 extattr tried to
do I/O on the device.  Otherwise the blocksize is undefined in the
buffer cache.
2004-07-14 14:19:32 +00:00
Max Laier
bfe4641596 Fix a copy-and-paste-o in IFQ_DRV_PREPEND - all pointyhats to me.
While here also fix a (not less stupid) braino in IFQ_DRV_PURGE.

Reported-by:	clement
Tested-by:	clement (_PREPEND in sis(4))
2004-07-14 13:31:41 +00:00
Peter Wemm
6897c4aef7 Like on i386, eliminate pv_ptem (which was suggested by alc). This
reduces the size of the pv_entry structure a small but significant amount.

This is implemented a little differently because it isn't so cheap to get
the physical address of the page tabke page on amd64.. instead of it
being directly accessible from the top level page directory, it is now
two additional tree levels down.  However.. In almost all cases, we
recently had the physical address if the page table page a short while
before we needed it, but it slipped through our fingers.  This patch
saves it for when we do need it.  Also, for the one case where we do not
have the ptp paddr, we are always running in curproc context and so we
can do a vtopte-like trick.  I've implemented vtopde() for this purpose.

There is still a CYA entry in pmap_unuse_pt() that needs to be removed.  I
think it can be removed now but I forgot to test with it gone.
2004-07-14 07:13:35 +00:00
Warner Losh
16629bd982 Remove fdc_alloc_resources, which should have happened in last commit. 2004-07-14 07:04:17 +00:00
Alfred Perlstein
67543ab1e3 Make FIOASYNC, FIOSETOWN and FIOGETOWN work on kqueues. 2004-07-14 07:02:03 +00:00
Warner Losh
aad6416500 Fix the pccard attachment to have a chance of working.
Move the resource allocation into the bus front ends.
2004-07-14 06:59:58 +00:00
Takanori Watanabe
8c4c207db4 Follow PnP location string change in acpi.c. 2004-07-14 06:58:39 +00:00
Alfred Perlstein
215bb69ffa do { } while(0) KNOTE macro, whitespace 2004-07-14 06:47:32 +00:00
Alan Cox
4b6df2ead7 Additional pmap locking 2004-07-14 05:49:44 +00:00
Robert Watson
66ea137d89 Switch snoop device to using C99 initialization for struct linesw. 2004-07-14 05:32:55 +00:00
Robert Watson
efe0ab01b2 Convert SLIP to using C99 structure initialization for its struct
linesw.
2004-07-14 05:01:40 +00:00
Alan Cox
8b6587f4c5 In pmap_remove_pages(), when clearing a pte, update the corresponding
page's dirty mask.

Reviewed by:	gallatin@
2004-07-14 03:05:19 +00:00
Peter Wemm
707783de09 Regen 2004-07-14 00:03:51 +00:00
Peter Wemm
1174965ee2 Unmapped syscalls should be NOPROTO so that we don't get a duplicate
prototype.  (kldunloadf in this case)
2004-07-14 00:03:30 +00:00
Olivier Houchard
8908521788 In pmap_remove_pages(), when the pv_list is entry, we want to clean the
PG_WRITEABLE flag, not the PG_REFERENCED flag.

Submitted by:   alc
2004-07-13 22:40:59 +00:00
John Baldwin
6942d4339e Set TDF_NEEDRESCHED when a higher priority thread is scheduled in
sched_add() rather than just doing it in sched_wakeup().  The old
ithread preemption code used to set NEEDRESCHED unconditionally if it
didn't preempt which masked this bug in SCHED_4BSD.

Noticed by:	jake
Reported by:	kensmith, marcel
2004-07-13 20:49:13 +00:00
Poul-Henning Kamp
65a311fcb2 Give kldunload a -f(orce) argument.
Add a MOD_QUIESCE event for modules.  This should return error (EBUSY)
of the module is in use.

MOD_UNLOAD should now only fail if it is impossible (as opposed to
inconvenient) to unload the module.  Valid reasons are memory references
into the module which cannot be tracked down and eliminated.

When kldunloading, we abandon if MOD_UNLOAD fails, and if -force is
not given, MOD_QUIESCE failing will also prevent the unload.

For backwards compatibility, we treat EOPNOTSUPP from MOD_QUIESCE as
success.

Document that modules should return EOPNOTSUPP for unknown events.
2004-07-13 19:36:59 +00:00
Poul-Henning Kamp
1a946b9fef Add kldunloadf() system call. Stay tuned for follwing commit messages. 2004-07-13 19:35:11 +00:00
Nate Lawson
d40c0f5324 Clean up our pnpinfo and location strings. 2004-07-13 18:59:49 +00:00
Nate Lawson
edc136334b Call device_identify routines after doing the namespace walk. This is
needed so that sysresource objects are created first to reserve all regions,
then other devices can allocate from them.  Otherwise, acpi_timer (the only
ACPI device with an identify routine), would allocate its resources from
the nexus, causing the later sysresource reserve to fail.

Debugging by:	Taku YAMAMOTO, Andrea Campi
2004-07-13 17:57:41 +00:00
Poul-Henning Kamp
3f4324df4d Send the fla driver in the Attic 2004-07-13 17:44:17 +00:00
Poul-Henning Kamp
ec712659ef Desupport M-Systems DiskOnChip driver "fla" 2004-07-13 17:43:03 +00:00
Poul-Henning Kamp
49bddf0c9f fix compilation. 2004-07-13 16:33:38 +00:00
Warner Losh
4b5239229c oldcard's card device no longer requires a count 2004-07-13 16:11:34 +00:00
Ken Smith
546d42ad9d Rev 1.24 of sys/ptrace.h adds ptrace_clear_single_step() prototype
definition so this one causes "redundant declaration" error and breaks
Alpha kernel build.

Reviewed by:	gallatin@ and test build on beast
2004-07-13 16:11:04 +00:00
Stefan Farfeleder
439dfb0c35 Remove erroneous semicolons. 2004-07-13 16:06:19 +00:00
Yoshihiro Takahashi
64c232e672 Merged from recent fdc driver changes.
Make a separate function to check FDD type.
2004-07-13 13:14:37 +00:00
Colin Percival
65bba83fef Replace "uid != 0" with "suser(td->td_ucred) != 0" when checking if we've
hit the maximum number of processes.  The last ten processes are reserved
for the *non-jailed* superuser.
2004-07-13 13:10:07 +00:00
Yoshihiro Takahashi
61e878c58c MFi386: revision 1.213.
Fix miss merging in previous change.
2004-07-13 12:58:36 +00:00
Pawel Jakub Dawidek
f3b3b0ce27 Remove unused macro. 2004-07-13 12:01:29 +00:00
Pawel Jakub Dawidek
45c26487a7 Decrease log level of one debug message, so there is no hole (level 2
wasn't used at all).
2004-07-13 12:01:11 +00:00
Pawel Jakub Dawidek
71df072547 Minor sysctl description fixes.
Submitted by:	simon
2004-07-13 11:23:31 +00:00
Poul-Henning Kamp
d521eae21d Another LINT compilation fix 2004-07-13 09:47:27 +00:00
Poul-Henning Kamp
a546742dd7 Make LINT compile 2004-07-13 09:46:46 +00:00
Hidetoshi Shimokawa
20021e6afd Re-enable debugger port. 2004-07-13 09:41:45 +00:00
Hidetoshi Shimokawa
fbf96e52bb Replace DDB with KDB. 2004-07-13 09:37:49 +00:00
David Xu
4d47dc5549 Add code to support debugging threaded process.
1. Add tm_lwpid into kse_thr_mailbox to indicate which kernel
     thread current user thread is running on. Add tm_dflags into
     kse_thr_mailbox, the flags is written by debugger, it tells
     UTS and kernel what should be done when the process is being
     debugged, current, there two flags TMDF_SSTEP and TMDF_DONOTRUNUSER.

     TMDF_SSTEP is used to tell kernel to turn on single stepping,
     or turn off if it is not set.

     TMDF_DONOTRUNUSER is used to tell kernel to schedule upcall
     whenever possible, to UTS, it means do not run the user thread
     until debugger clears it, this behaviour is necessary because
     gdb wants to resume only one thread when the thread's pc is
     at a breakpoint, and thread needs to go forward, in order to
     avoid other threads sneak pass the breakpoints, it needs to remove
     breakpoint, only wants one thread to go. Also, add km_lwp to
     kse_mailbox, the lwp id is copied to kse_thr_mailbox at context
     switch time when process is not being debugged, so when process
     is attached, debugger can map kernel thread to user thread.

  2. Add p_xthread to proc strcuture and td_xsig to thread structure.
     p_xthread is used by a thread when it wants to report event
     to debugger, every thread can set the pointer, especially, when
     it is used in ptracestop, it is the last thread reporting event
     will win the race. Every thread has a td_xsig to exchange signal
     with debugger, thread uses TDF_XSIG flag to indicate it is reporting
     signal to debugger, if the flag is not cleared, thread will keep
     retrying until it is cleared by debugger, p_xthread may be
     used by debugger to indicate CURRENT thread. The p_xstat is still
     in proc structure to keep wait() to work, in future, we may
     just use td_xsig.

  3. Add TDF_DBSUSPEND flag, the flag is used by debugger to suspend
     a thread. When process stops, debugger can set the flag for
     thread, thread will check the flag in thread_suspend_check,
     enters a loop, unless it is cleared by debugger, process is
     detached or process is existing. The flag is also checked in
     ptracestop, so debugger can temporarily suspend a thread even
     if the thread wants to exchange signal.

  4. Current, in ptrace, we always resume all threads, but if a thread
     has already a TDF_DBSUSPEND flag set by debugger, it won't run.

Encouraged by: marcel, julian, deischen
2004-07-13 07:33:40 +00:00
David Xu
ef9457becb Implement following commands: PT_CLEARSTEP, PT_SETSTEP, PT_SUSPEND
PT_RESUME, PT_GETNUMLWPS, PT_GETLWPLIST.
2004-07-13 07:25:24 +00:00
David Xu
53dbf30349 Add ptrace_clear_single_step(), alpha already has it for years, the function
will be used by ptrace to clear a thread's single step state.
2004-07-13 07:22:56 +00:00
David Xu
cbf4e354ec Add code to support debugging threaded process.
1. Add tm_lwpid into kse_thr_mailbox to indicate which kernel
   thread current user thread is running on. Add tm_dflags into
   kse_thr_mailbox, the flags is written by debugger, it tells
   UTS and kernel what should be done when the process is being
   debugged, current, there two flags TMDF_SSTEP and TMDF_DONOTRUNUSER.

   TMDF_SSTEP is used to tell kernel to turn on single stepping,
   or turn off if it is not set.

   TMDF_DONOTRUNUSER is used to tell kernel to schedule upcall
   whenever possible, to UTS, it means do not run the user thread
   until debugger clears it, this behaviour is necessary because
   gdb wants to resume only one thread when the thread's pc is
   at a breakpoint, and thread needs to go forward, in order to
   avoid other threads sneak pass the breakpoints, it needs to remove
   breakpoint, only wants one thread to go. Also, add km_lwp to
   kse_mailbox, the lwp id is copied to kse_thr_mailbox at context
   switch time when process is not being debugged, so when process
   is attached, debugger can map kernel thread to user thread.

2. Add p_xthread to proc strcuture and td_xsig to thread structure.
   p_xthread is used by a thread when it wants to report event
   to debugger, every thread can set the pointer, especially, when
   it is used in ptracestop, it is the last thread reporting event
   will win the race. Every thread has a td_xsig to exchange signal
   with debugger, thread uses TDF_XSIG flag to indicate it is reporting
   signal to debugger, if the flag is not cleared, thread will keep
   retrying until it is cleared by debugger, p_xthread may be
   used by debugger to indicate CURRENT thread. The p_xstat is still
   in proc structure to keep wait() to work, in future, we may
   just use td_xsig.

3. Add TDF_DBSUSPEND flag, the flag is used by debugger to suspend
   a thread. When process stops, debugger can set the flag for
   thread, thread will check the flag in thread_suspend_check,
   enters a loop, unless it is cleared by debugger, process is
   detached or process is existing. The flag is also checked in
   ptracestop, so debugger can temporarily suspend a thread even
   if the thread wants to exchange signal.

4. Current, in ptrace, we always resume all threads, but if a thread
   has already a TDF_DBSUSPEND flag set by debugger, it won't run.

Encouraged by: marcel, julian, deischen
2004-07-13 07:20:10 +00:00
Alfred Perlstein
d83ed0fac0 Do not call sorecieve() in the context of a socket callback as it causes
lock order reversals so->inpcb since we're called with the socket lock
held.
2004-07-13 07:05:38 +00:00
Alan Cox
440382a953 Simplify pmap_protect(). 2004-07-13 06:54:23 +00:00
Alfred Perlstein
8f0a7125a1 Turn off SO_REUSEADDR and SO_REUSEPORT, they were causing EADDRINUSE
to be returned from the protocol stack.

Pointy hat to me for not groking what those options _really_ mean.
2004-07-13 05:42:59 +00:00
Alan Cox
ce8da3091f Push down the acquisition and release of the page queues lock into
pmap_remove_pages().  (The implementation of pmap_remove_pages() is
optional.  If pmap_remove_pages() is unimplemented, the acquisition and
release of the page queues lock is unnecessary.)

Remove spl calls from the alpha, arm, and ia64 pmap_remove_pages().
2004-07-13 02:49:22 +00:00
Warner Losh
b0c2b92548 Set fdc_dev in attach 2004-07-13 02:44:40 +00:00
Warner Losh
c3ae4c40ef Don't depend on implicit include of machine/bus.h in sys/rman.h, but instead
explicitly include it.
2004-07-13 02:42:23 +00:00
Warner Losh
e79a88db72 pccard no longer requires a count because the floppy driver that
nominally had a non-working reference to card.h has been removed.
2004-07-13 02:37:40 +00:00
Warner Losh
7eb52d171e Remove even more references to generating usbdevs_data.h, et al.
Noticed by: njl
2004-07-12 23:11:09 +00:00
Warner Losh
77967bd75c Remove the instructions for regenerating usbdevs.h: that's now no
longer necessary.
2004-07-12 22:57:06 +00:00
Peter Grehan
441e42eaf4 Rename low-level code ddb -> db. Use KDB instead of DDB.
Fix bug in setup of stack frame where 8 bytes wasn't being
saved for the callee's frame pointer and saved LR.
2004-07-12 22:32:08 +00:00
Peter Grehan
b188ee2269 Bring into KDB new order. 2004-07-12 22:26:20 +00:00
Peter Grehan
20d21fe9ef - DDB -> KDB, with kdb routines
- ddb -> db for low-level trapcode
- implement makectx. I think it only matters that the stack is setup
  correctly.
- bring over ddb_trap_glue and rename to db_trap_glue
2004-07-12 22:25:09 +00:00
Peter Grehan
def828503c No need for ddb option. Never a need for ipkdb option. 2004-07-12 22:22:53 +00:00
Peter Grehan
e3c25f5d33 Catch up with gratuitous ddb -> db renaming 2004-07-12 22:22:09 +00:00
Peter Grehan
d8570880e8 Bring into line with KDB. Bring in NetBSD updates for backtrace routine,
although it really needs a decent re-work.
2004-07-12 22:21:34 +00:00
Peter Grehan
a136236e5c Remove unused NetBSD code. Bring mem r/w routines into here in line
with sparc64, although keep the size deref checks: they are useful
when accessing PCI space where some devices may not implement byte
access.
2004-07-12 22:20:01 +00:00
Peter Grehan
4539337da0 Gratuitous namechange to avoid low-level association with ddb. 2004-07-12 22:18:02 +00:00
Peter Grehan
abdc8ff1bc Add prototype for KDB's makectx routine 2004-07-12 22:17:20 +00:00
Peter Grehan
5f40873a1f Remove old NetBSD-derived unused code and stuff that is now obsolete
due to KDB.
2004-07-12 22:16:50 +00:00
Peter Grehan
9917bd81ed DDB -> KDB, and rename low-level trap handler to avoid name conflict. 2004-07-12 22:16:04 +00:00
Peter Grehan
f4ec5aece7 kdb.h for PowerPC. Stubs for now. 2004-07-12 22:15:03 +00:00
Peter Grehan
24c1c57156 Add new KDB option, and also drop in long-held fxp/dc eth drivers. 2004-07-12 22:14:21 +00:00
Peter Grehan
cd445f61f9 db_memrw.c has been subsumed into db_interface.c ala sparc64 2004-07-12 22:13:27 +00:00
Warner Losh
8edceb05bf Remove stray line with just a tab
Remove usbdevs_data.h, it isn't used by the module

Noticed by: Pawel Worach
2004-07-12 21:59:06 +00:00
David Malone
dcee93dcf9 Rename Alfred's kern_setsockopt to so_setsockopt, as this seems a
a better name. I have a kern_[sg]etsockopt which I plan to commit
shortly, but the arguments to these function will be quite different
from so_setsockopt.

Approved by:	alfred
2004-07-12 21:42:33 +00:00
Olivier Houchard
2f6d0d8fde Update to kdb. 2004-07-12 21:25:01 +00:00
Olivier Houchard
219f08214b Remove the kbd_trap() declaration. 2004-07-12 21:24:21 +00:00
Olivier Houchard
98fe51fc99 Protect setjmp.h with #ifndef _MACHINE_SETJMP_H_. 2004-07-12 21:23:58 +00:00
Olivier Houchard
dd7c1e993e Forward declare "struct pcb", so that one does not need to include
<machine/pcb.h> before including <machine/pmap.h>.
2004-07-12 21:22:40 +00:00
Olivier Houchard
4628245baa Implement a stub breakpoint(). 2004-07-12 21:20:38 +00:00
Olivier Houchard
8b39400fc8 Implement makectx(). 2004-07-12 21:19:43 +00:00
Olivier Houchard
33f588f13b Prototype makectx(). 2004-07-12 21:19:22 +00:00
Olivier Houchard
ad9e08c34b Import bus_memio.h and bus_pio.h for arm. 2004-07-12 21:18:30 +00:00
Olivier Houchard
55b81ba244 Import a kdb.h for arm, which contains stubs right now. 2004-07-12 21:17:51 +00:00
Nate Lawson
bd0416f2d2 Remove unnecessary softc bzero calls. 2004-07-12 21:15:36 +00:00
Nate Lawson
7a5230b8ad Add the ability to detach a battery. Now batteries that are detached are
also removed from the battery list.
2004-07-12 20:53:04 +00:00
Nate Lawson
752d473505 Update in preparation for adding the ACPI attachment.
* Add an fdtype ivar.  This will be the equivalent of fd->type.
* Move enabling the FIFO to the end of attach.
* Unify reset code into fdc_initial_reset().
* Add fdc_write_ivar().
* Update isa and pccard attachments accordingly.
* Set the flags unconditionally in probe since they may be overridden by
  other probe routines.  Both before and now, we're depending on probe
  being called a final time on the winning driver so the flags we get are
  the ones we intended.
* Use the bus accessor macros instead of defining our own.
* Remove duplicate assigns of fd->type.
2004-07-12 20:49:26 +00:00
Robert Watson
f3ce707a18 Constify 'rpcclnt_backoff'. 2004-07-12 19:37:08 +00:00
Robert Watson
ab89ee6253 Constify 'spx_backoff'. 2004-07-12 19:35:29 +00:00
Robert Watson
7cfc690440 After each label in tcp_input(), assert the inpcbinfo and inpcb lock
state that we expect.
2004-07-12 19:28:07 +00:00
Robert Watson
8375a14422 Procotol control block locking for netatalk DDP. 2004-07-12 18:39:59 +00:00
Robert Watson
dedfa2fb68 Imperfect synchronization solution to imperfect code: use a static 256
byte buffer in the stack for temporary printf results rather than a
global buffer without synchronization.
2004-07-12 18:37:31 +00:00
Robert Watson
598a1cadf1 Remove 'Not used' comment: at_org_code is used, just not in netatalk/. 2004-07-12 18:35:30 +00:00
Alan Cox
26354d4c08 Remove an unused and unimplemented sysctl. (For the record, it was marked
as unimplemented in revision 1.129 nearly six years ago.)
2004-07-12 17:45:37 +00:00
Mike Makonnen
c21e3b38bd writers must hold both sched_lock and the process lock; therefore, readers
need only obtain the process lock.
2004-07-12 15:28:31 +00:00
Robert Watson
ee3c585ae5 Remove 'td = curthread' that shadows the arguments to coda_root().
Missed by:	alfred
2004-07-12 14:11:26 +00:00
Doug Rabson
363eade1f1 Add fwip module. 2004-07-12 13:13:17 +00:00
Doug Rabson
1b2d87d900 Add fwip module.
Submitted by: simokawa
2004-07-12 13:12:56 +00:00
Doug Rabson
d07c9778d0 Make if_fwsubr.c dependant on fwip instead of firewire - there is not
much point including it if you aren't using IP over firewire.
2004-07-12 11:52:14 +00:00
Søren Schmidt
cc97de873c Attempt to handle suspend/resume better. 2004-07-12 10:50:50 +00:00
Alfred Perlstein
993f3fc432 Bump __FreeBSD_version for VFS_ROOT, vflush and kinfo_proc changes. 2004-07-12 08:23:10 +00:00
Alfred Perlstein
f257b7a54b Make VFS_ROOT() and vflush() take a thread argument.
This is to allow filesystems to decide based on the passed thread
which vnode to return.
Several filesystems used curthread, they now use the passed thread.
2004-07-12 08:14:09 +00:00
David Xu
507b03186a Change kse_switchin to accept kse_thr_mailbox pointer, the syscall
will be used heavily in debugging KSE threads. This breaks libpthread
on IA64, but because libpthread was not in 5.2.1 release, I would like
to change it so we needn't to introduce another syscall.
2004-07-12 07:39:20 +00:00
Alfred Perlstein
d58d3648dd Use SO_REUSEADDR and SO_REUSEPORT when reconnecting NFS mounts.
Tune the timeout from 5 seconds to 12 seconds.
Provide a sysctl to show how many reconnects the NFS client has done.

Seems to fix IPv6 from: kuriyama
2004-07-12 06:22:42 +00:00
Marcel Moolenaar
fbc3247d81 Implement the PT_LWPINFO request. This request can be used by the
tracing process to obtain information about the LWP that caused the
traced process to stop. Debuggers can use this information to select
the thread currently running on the LWP as the current thread.

The request has been made compatible with NetBSD for as much as
possible. This implementation differs from NetBSD in the following
ways:
1.  The data argument is allowed to be smaller than the size of the
    ptrace_lwpinfo structure known to the kernel, but not 0. This
    is opposite to what NetBSD allows. The reason for this is that
    we can extend the structure without affecting older binaries.
2.  On NetBSD the tracing process is to set the pl_lwpid field to
    the Id of the LWP it wants information of. We don't do that.
    Our ptrace interface allows passing the LWP Id instead of the
    PID. The tracing process is to set the PID to the LWP Id it
    wants information of.
3.  When the PID is actually the PID of the tracing process, this
    request returns the information about the LWP that caused the
    process to stop. This was the whole purpose of the request in
    the first place.

When the traced process has exited, this request will return the
LWP Id 0, indicating that the process state is not the result of
an event specific to a LWP.
2004-07-12 05:07:50 +00:00
Alfred Perlstein
8a3f1adf3b Reserve a pointer "ki_udata" in kinfo_proc as a convenience for userland. 2004-07-12 04:53:33 +00:00
Robert Watson
943bb929af Introduce a global mtx 'ngsocketlist_mtx' to protect the global
ng_socket list during insert/delete.
2004-07-12 04:45:46 +00:00
Alan Cox
eba90ac75f pmap_remove_pages() must not remove wired mappings. Since
pmap_remove_pages() is an optimization, its implementation is optional.

Discussed with:	grehan
2004-07-12 04:40:26 +00:00
Robert Watson
f011f4041a Mark 'makeup' in ng_frame_relay as const, as its values are immutable. 2004-07-12 04:35:42 +00:00
Robert Watson
effb15c0c5 Remove spl's from netatalk in preparation to merge locking. 2004-07-12 04:33:58 +00:00
Alfred Perlstein
7ae8ce5df1 Dump the actual bad values when this assertion is tripped. 2004-07-12 04:13:38 +00:00
Marcel Moolenaar
f3be7cb3e9 Re-add the gdb command. It was removed to be replaced by something
more generic, but that didn't actually happen. Since the feature to
switch backends (and historically this means from DDB to GDB) is
important, make sure people can do just that until such the generic
mechanism actually sees the light of day.

Suggested by: rwatson@
2004-07-12 01:38:07 +00:00
Marcel Moolenaar
3bcd2440db Make kdb_dbbe_select() available as an interface function. This allows
changing the backend from outside the KDB frontend. For example from
within a backend. Rewrite kdb_sysctl_current to make use of this
function as well.
2004-07-12 01:15:55 +00:00
Robert Watson
a294c3664f Use sockbuf_pushsync() to synchronize stack and socket buffer state
in soreceive() after removing an MT_SONAME mbuf from the head of the
socket buffer.

When processing MT_CONTROL mbufs in soreceive(), first remove all of
the MT_CONTROL mbufs from the head of the socket buffer to a local
mbuf chain, then feed them into dom_externalize() as a set, which
both avoids thrashing the socket buffer lock when handling multiple
control mbufs, and also avoids races with other threads acting on
the socket buffer when the socket buffer mutex is released to enter
the externalize code.  Existing races that might occur if the protocol
externalize method blocked during processing have also been closed.

Now that we synchronize socket buffer and stack state following
modifications to the socket buffer, turn the manual synchronization
that previously followed control mbuf processing with a set of
assertions.  This can eventually be removed.

The soreceive() code is now substantially more MPSAFE.
2004-07-11 23:13:14 +00:00
Poul-Henning Kamp
2e30562054 Remove the last bits of SPECHASH. 2004-07-11 23:03:37 +00:00
Robert Watson
b7562e178c Add sockbuf_pushsync(), an inline function that, following a change to
the head of the mbuf chains in a socket buffer, re-synchronizes the
cache pointers used to optimize socket buffer appends.  This will be
used by soreceive() before dropping socket buffer mutexes to make sure
a consistent version of the socket buffer is visible to other threads.

While here, update copyright to account for substantial rewrite of much
socket code required for fine-grained locking.
2004-07-11 22:59:32 +00:00
Poul-Henning Kamp
9ef295b7e0 Better descriptions of the cdev malloc class and mutex. 2004-07-11 19:26:43 +00:00
Robert Watson
d861372b14 Add additional annotations to soreceive(), documenting the effects of
locking on 'nextrecord' and concerns regarding potentially inconsistent
or stale use of socket buffer or stack fields if they aren't carefully
synchronized whenever the socket buffer mutex is released.  Document
that the high-level sblock() prevents races against other readers on
the socket.

Also document the 'type' logic as to how soreceive() guarantees that
it will only return one of normal data or inline out-of-band data.
2004-07-11 18:29:47 +00:00
Marcel Moolenaar
35e454b36c MFi386: rev 1.213 -- fix DELAY while the debugger is active.
This also fixes the (runtime) breakage introduced in the previous
commit that was the result of a botched merge. This hasn't even
been compile-tested...
2004-07-11 18:07:55 +00:00
Marcel Moolenaar
45cfc0a914 Partially revert previous commit. Calling getit() unconditionally fixed
a problem that could also be fixed differently without reverting previous
attempts to fix DELAY while the debugger is active (rev 1.204). The bug
was that the i8254 implements a countdown timer, while for (k)db_active
a countup timer was implemented. This resulted in premature termination
and consequently the breakage of DELAY. The fix (relative to rev 1.211)
is to implement a countdown timer for the kdb_active case. As such the
ability to step clock initialization is preserved and DELAY does what is
expected of it.

Blushed: bde :-)
Submitted by: bde
2004-07-11 17:50:59 +00:00
Doug Rabson
67f8f14a6e Expand and rewrite documentation using doxygen markup so that we can
generate funky web pages from it.
2004-07-11 16:17:42 +00:00
Doug Rabson
8ff7da8ce8 Pass doxygen doc comments through to the output. 2004-07-11 16:14:24 +00:00
Doug Rabson
a52b6f787c Experimental support for using doxygen to generate kernel documentation. 2004-07-11 16:13:57 +00:00
Darren Reed
99e89d6725 Add sx_unlock() macro as a frontend to both sx_sunlock() and sx_xunlock(),
using sx_cnt to determine what state the lock is in and call the respective
function appropriately.
2004-07-11 16:07:07 +00:00
Warner Losh
fa5afa1df0 Until I'm ready to commit the better pccard probe/attach routines, effectively
comment them out.
2004-07-11 16:01:25 +00:00
Marcel Moolenaar
a8bfba1a27 Fix braino: Make sure there is a current backend before we return its
name in the debug.kdb.current sysctl. All other dereferences are
properly guarded, but this one was overlooked.

Reported by: Morten Rodal (morten at rodal dot no)
2004-07-11 15:22:43 +00:00
Poul-Henning Kamp
911dbd84c7 Introduce ttygone() which indicates that the hardware is detached.
Move dtrwait logic to the generic TTY level.
2004-07-11 15:18:39 +00:00
Yoshihiro Takahashi
167b6b11dd MFi386: revision 1.212. 2004-07-11 13:46:10 +00:00
Yoshihiro Takahashi
fac5bedd49 MFi386: revision 1.406 2004-07-11 13:45:39 +00:00
Darren Reed
781950a42f Clean up a bunch of white-space difference with IPFilter source as well as
remove some superfluous assignments for .d_version/.d_flags in a cdevsw
structure initialisation that never sees the light of day in FreeBSD.
2004-07-11 10:13:05 +00:00
Marcel Moolenaar
bd9e523bb3 Bump __FreeBSD_version for the following (weak) reasons:
o  Sources that are shared between kernel and userland and that may
   contain references to DDB or any of its functions may need to
   know this.
o  Userland tools may include <machine/gdb_machdep.h> from now on.
   Think kernel debugger...
o  The kernel core file now contains the TID of the kernel thread
   that made the dump.
2004-07-11 04:05:44 +00:00
Marcel Moolenaar
e8d5eed9c1 The SC_DISABLE_DDBKEY options has been renamed to SC_DISABLE_KDBKEY. 2004-07-11 03:21:24 +00:00
Marcel Moolenaar
8bcb1e9e84 Add options KDB and GDB. KDB takes on the function of what DDB used
to be. Both DDB and GDB specify which KDB backends to include.
2004-07-11 03:20:09 +00:00
Marcel Moolenaar
9faba323b6 Now that the console setup is identical to that on other platforms,
we also need to have the right sio(4) flags:
sio0: flags=0x10 so that it will be console.
sio1: flags=0x80 so that it can be used as debug port.
2004-07-11 03:07:28 +00:00
Marcel Moolenaar
cb9d2f078d Add options KDB and GDB. KDB takes on the function of what DDB used
to be. Both DDB and GDB specify which KDB backends to include.
2004-07-11 03:03:48 +00:00
Marcel Moolenaar
412e1faf02 Remove now unused files:
db_elf.c, db_kld.c: The new KDB backend supports both at the same time.
db_sysctl.c: The functionality has been moved to sys/kern/subr_kdb.c.
db_trap.c: The DDB entry point has been moved to sys/ddb/db_main.c.
2004-07-11 01:50:09 +00:00
Marcel Moolenaar
1ca618fcaa Remove the now unused GDB stubs. See src/sys/gdb/* for the new KDB
backend.
2004-07-11 01:47:26 +00:00
Robert Watson
0014b343e0 In the 'dontblock' section of soreceive(), assert that the mbuf on hand
('m') is in fact the first mbuf in the receive socket buffer.
2004-07-11 01:44:12 +00:00
Marcel Moolenaar
e2ee21738f Update for the KDB framework:
o  Rename WITNESS_DDB to WITNESS_KDB. In the new world order KDB is the
   acronym to use for debugging related code. The DDB option is used
   to enable the DDB debugger backend only.
o  Likewise, rename DDB_TRACE to KDB_TRACE, rename DDB_UNATTENDED to
   KDB_UNATTENDED and rename SC_HISTORY_DDBKEY to SC_HISTORY_KDBKEY.
o  Remove DDB_NOKLDSYM. The new DDB backend supports pre-linker symbol
   lookups as well as KLD symbol lookups at the same time.
o  Remove GDB_REMOTE_CHAT. The GDB protocol hacks to allow this are
   FreeBSD specific. At the same time, the GDB protocol has packets
   for console output.
2004-07-11 01:44:07 +00:00
Peter Grehan
e700eaa049 Fix build for non-WITNESS case
spotted by:  Suleiman Souhlal <refugee@segfaulted.com>
2004-07-11 01:38:25 +00:00
Robert Watson
5e44d93ffc Break out non-inline out-of-band data receive code from soreceive()
and put it in its own helper function soreceive_rcvoob().
2004-07-11 01:34:34 +00:00
Robert Watson
a04b09398c Assign pointers values of NULL rather than 0 in soreceive(). 2004-07-11 01:22:40 +00:00
Bill Paul
7602de354f Make NdisReadPcmciaAttributeMemory() and NdisWritePcmciaAttributeMemory()
actually work.

Make the PCI and PCCARD attachments provide a bus_get_resource_list()
method so that resource listing for PCCARD works. PCCARD does not
have a bus_get_resource_list() method (yet), so I faked up the
resource list management in if_ndis_pccard.c, and added
bus_get_resource_list() methods to both if_ndis_pccard.c and if_ndis_pci.c.
The one in the PCI attechment just hands off to the PCI bus code.
The difference is transparent to the NDIS resource handler code.

Fixed ndis_open_file() so that opening files which live on NFS
filesystems work: pass an actual ucred structure to VOP_GETATTR()
(NFS explodes if the ucred structure is NOCRED).

Make NdisMMapIoSpace() handle mapping of PCMCIA attribute memory
resources correctly.

Turn subr_ndis.c:my_strcasecmp() into ndis_strcasecmp() and export
it so that if_ndis_pccard.c can use it, and junk the other copy
of my_strcasecmp() from if_ndis_pccard.c.
2004-07-11 00:19:30 +00:00
Marcel Moolenaar
37224cd3fc Mega update for the KDB framework: turn DDB into a KDB backend.
Most of the changes are a direct result of adding thread awareness.
Typically, DDB_REGS is gone. All registers are taken from the
trapframe and backtraces use the PCB based contexts. DDB_REGS was
defined to be a trapframe on all platforms anyway.
Thread awareness introduces the following new commands:
	thread X	switch to thread X (where X is the TID),
	show threads	list all threads.

The backtrace code has been made more flexible so that one can
create backtraces for any thread by giving the thread ID as an
argument to trace.

With this change, ia64 has support for breakpoints.
2004-07-10 23:47:20 +00:00
Marcel Moolenaar
5971a234e5 Hook the GDB backend into the build. 2004-07-10 23:31:17 +00:00
Marcel Moolenaar
a5a3d76272 Update for the KDB framework:
o  Make debugging code conditional upon KDB instead of DDB.
o  Call kdb_enter() instead of Debugger().
o  Remove implementation of Debugger().
o  Check kdb_active instead of db_active.
o  Call kdb_trap() according to the new world order.
2004-07-10 23:10:07 +00:00
Marcel Moolenaar
eda20064f9 Update for the KDB framework:
o  Call kdb_enter() instead of Debugger().
2004-07-10 23:06:41 +00:00
Marcel Moolenaar
2aaf890c2f Remove obsolete prototype of kdb_trap(). 2004-07-10 23:05:38 +00:00
Marcel Moolenaar
153af0fa47 MFi386: Update for the KDB framework:
o  Implement makectx().
o  Call kdb_enter() instead of Debugger().
o  Remove implementation of Debugger().
2004-07-10 23:04:42 +00:00
Marcel Moolenaar
3096307b3d Build uart_dbg.c for remote GDB support. 2004-07-10 23:01:35 +00:00
Marcel Moolenaar
6d33366c74 Update for the KDB framework:
o  ksym_start and ksym_end changed type to vm_offset_t.
o  Make debugging support conditional upon KDB instead of DDB.
o  Call kdb_enter() instead of breakpoint().
o  Remove implementation of Debugger().
o  Call kdb_trap() according to the new world order.

unwinder:
o  s/db_active/kdb_active/g
o  Various s/ddb/kdb/g
o  Add support for unwinding from the PCB as well as the trapframe.
   Abuse a spare field in the special register set to flag whether
   the PCB was actually constructed from a trapframe so that we can
   make the necessary adjustments.

md_var.h:
o   Add RSE convenience macros.
o   Add ia64_bsp_adjust() to add or subtract from BSP while taking
    NaT collections into account.
2004-07-10 22:59:30 +00:00
Marcel Moolenaar
3875c9304a Update for the KDB framework:
o  Make debugging code conditional upon KDB instead of DDB.
o  Declare ksym_start and ksym_end as extern and initialize them.
   This was previously and bogusly handled by DDB itself.
o  Call kdb_enter() instead of Debugger().
o  Remove implementation of Debugger().
2004-07-10 22:47:06 +00:00
Marcel Moolenaar
417e3e7b6f MFi386: don't fake the time counter when the debugger is active.
This breaks the fundamental property of DELAY(). Instead, avoid
grabbing clock_lock when kdb_active is non-zero.
2004-07-10 22:42:22 +00:00
Marcel Moolenaar
f9c8fc6017 Remove obsolete prototype of kdb_trap(). 2004-07-10 22:39:56 +00:00
Marcel Moolenaar
4b0cc40d57 Update for the KDB framework:
o  Make debugging support conditional upon KDB instead of DDB.
o  Remove implementation of Debugger().
o  Don't make setjump() and longjump() conditional upon DDB.
o  s/ddb_on_nmi/kdb_on_nmi/g
o  Call kdb_reenter() when kdb_active is non-zero. Call kdb_trap()
   otherwise.
2004-07-10 22:39:17 +00:00
Marcel Moolenaar
5704f2350a Update fr the KDB framework:
o  Make debugging support conditional upon KDB instead of DDB.
o  Call kdb_trap() according to the new world order.
o  Kill the NO_SIO option completely.
o  Respect the boot_gdb environment variable.
o  Don't make debug specific kernel options conditional.
o  Remove implementation of Debugger().
2004-07-10 22:35:05 +00:00
Marcel Moolenaar
6af8e47df7 Update for the KDB framework. Sanitize the alpha console code now that
it's in the way even more. Basicly: remove all alpha specific console
support from gfb(4), sio(4) and syscons(4). Rewrite the alpha console
initialization to be identical to all other platforms. In a nutshell:
call cninit().
The platform specific code now only sets or clears RB_SERIAL and thus
automaticly causes the right console to be selected.

sio.c:
o  Replace the remote GDB hacks and use the GDB debug port interface
   instead.
o  Make debugging code conditional upon KDB instead of DDB.
o  Call kdb_alt_break() instead of db_alt_break().
o  Call kdb_enter() instead of breakpoint().
o  Remove the ugly compatibility of using the console as the debug
   port.
2004-07-10 22:29:41 +00:00
Marcel Moolenaar
7f46949fdf Call getit() unconditionally and only grab clock_lock when the
debugger is not active. The fixes breakages of DELAY() when
running in the debugger, because not calling getit() when the
debugger is active yields a DELAY that doesn't.
2004-07-10 22:16:18 +00:00
Alan Cox
790bdd0f2e Increase the scope of the page queues lock in vm_page_alloc() to cover
a diagnostic check that accesses the cache queue count.
2004-07-10 22:12:49 +00:00