18 years agoMerge from vendor branch TCPDUMP:
Eirik Nygaard [Sat, 15 May 2004 12:25:28 +0000 (12:25 +0000)]
Merge from vendor branch TCPDUMP:
Import of tcpdump 3.8.3

Submitted-by: Brock Johnson <wildefire@isentry.homelinux.org>
18 years agoImport of tcpdump 3.8.3
Eirik Nygaard [Sat, 15 May 2004 12:25:28 +0000 (12:25 +0000)]
Import of tcpdump 3.8.3

Submitted-by: Brock Johnson <wildefire@isentry.homelinux.org>
18 years agoMerge from vendor branch LIBPCAP:
Eirik Nygaard [Sat, 15 May 2004 12:19:49 +0000 (12:19 +0000)]
Merge from vendor branch LIBPCAP:
Import of libpcap 0.8.3

Submitted-by: Brock Johnson <wildefire@isentry.homelinux.org>
18 years agoImport of libpcap 0.8.3
Eirik Nygaard [Sat, 15 May 2004 12:19:49 +0000 (12:19 +0000)]
Import of libpcap 0.8.3

Submitted-by: Brock Johnson <wildefire@isentry.homelinux.org>
18 years agoAdd a manual page which documents the generic hash routines, i.e.
Hiten Pandya [Fri, 14 May 2004 18:11:44 +0000 (18:11 +0000)]
Add a manual page which documents the generic hash routines, i.e.
hashinit(9) and phashinit(9).  Code references also provided.

Relevant MLINKs have been added.

18 years agoRemove an extra comma at the end of .Nm list.
Hiten Pandya [Fri, 14 May 2004 16:23:17 +0000 (16:23 +0000)]
Remove an extra comma at the end of .Nm list.

18 years agodevice switch 1/many: Remove d_autoq, add d_clone (where d_autoq was).
Matthew Dillon [Thu, 13 May 2004 23:49:26 +0000 (23:49 +0000)]
device switch 1/many: Remove d_autoq, add d_clone (where d_autoq was).

d_autoq was used to allow the device port dispatch to mix old-style synchronous
calls with new style messaging calls within a particular device.  It was never
used for that purpose.

d_clone will be more fully implemented as work continues.  We are going to
install d_port in the dev_t (struct specinfo) structure itself and d_clone
will be needed to allow devices to 'revector' the port on a minor-number
by minor-number basis, in particular allowing minor numbers to be directly
dispatched to distinct threads.  This is something we will be needing later

18 years agosf_buf_ref() needs a critical section. Note that the function is not
Matthew Dillon [Thu, 13 May 2004 19:46:18 +0000 (19:46 +0000)]
sf_buf_ref() needs a critical section.  Note that the function is not
currently used.

Noticed-by: hmp
18 years agomalloc() flags cleanup and fixes. Get rid of M_NOWAIT in places where the
Matthew Dillon [Thu, 13 May 2004 19:44:33 +0000 (19:44 +0000)]
malloc() flags cleanup and fixes.  Get rid of M_NOWAIT in places where the
malloc must succeed for proper device operation to occur, replacing with
M_WAITOK or M_INTWAIT as appropriate.  Use M_ZERO instead of bzero().

18 years agoClose an interrupt race between vm_page_lookup() and (typically) a
Matthew Dillon [Thu, 13 May 2004 17:40:19 +0000 (17:40 +0000)]
Close an interrupt race between vm_page_lookup() and (typically) a
vm_page_sleep_busy() check by using the correct spl protection.
An interrupt can occur inbetween the two operations and unbusy/free
the page in question, causing the busy check to fail and for the code
to fall through and then operate on a page that may have been freed
and possibly even reused.   Also note that vm_page_grab() had the same
issue between the lookup, busy check, and vm_page_busy() call.

Close an interrupt race when scanning a VM object's memq.  Interrupts
can free pages, removing them from memq, which interferes with memq scans
and can cause a page unassociated with the object to be processed as if it
were associated with the object.

Calls to vm_page_hold() and vm_page_unhold() require spl protection.

Rename the passed socket descriptor argument in sendfile() to make the
code more readable.

Fix several serious bugs in procfs_rwmem().  In particular, force it to
block if a page is busy and then retry.

Get rid of vm_pager_map_pag() and vm_pager_unmap_page(), make the functions
that used to use these routines use SFBUF's instead.

Get rid of the (userland?) 4MB page mapping feature in pmap_object_init_pt()
for now.  The code appears to not track the page directory properly and
could result in a non-zero page being freed as PG_ZERO.

This commit also includes updated code comments and some additional
non-operational code cleanups.

18 years agoRemove DIAGNOSTIC elements that are no longer correct.
Matthew Dillon [Thu, 13 May 2004 17:24:49 +0000 (17:24 +0000)]
Remove DIAGNOSTIC elements that are no longer correct.

18 years agoAdd PCI IDs for i865 agpgart support.
Joerg Sonnenberger [Thu, 13 May 2004 14:33:14 +0000 (14:33 +0000)]
Add PCI IDs for i865 agpgart support.

Submitted-by: Patrick mauritz <oxygene@studentenbude.ath.cx>
18 years agosf_buf_free() requires a critical section to safely manipulate the free
Matthew Dillon [Thu, 13 May 2004 01:34:03 +0000 (01:34 +0000)]
sf_buf_free() requires a critical section to safely manipulate the free
list and possibly even the reference count field.  ( sf_buf_alloc() is
already using a critical section ).

18 years agoAdd a read-only sysctl for observing the maximum number of
Hiten Pandya [Thu, 13 May 2004 00:44:12 +0000 (00:44 +0000)]
Add a read-only sysctl for observing the maximum number of
available sf_bufs.

In the future, we could add another sysctl for observing
the number of sf_bufs in use.

18 years agoAttempting to access a device which has been destroyed, such as a UMASS
Matthew Dillon [Thu, 13 May 2004 00:23:39 +0000 (00:23 +0000)]
Attempting to access a device which has been destroyed, such as a UMASS
device which has been pulled out and detached from its /dev/daX entry,
panics the system.  This occurs because the device might not be immediately
(or ever) removed from the device hash after the device has been destroyed.
It's fields are cleared, leading to a NULL function call.

Fix the panic by installing a dummy cdevsw when the device is destroyed
rather then NULLing it out.

Reported-by: Sascha Wildner <saw@online.de>
18 years agoIn sodealloc(), use do_setopt_accept_filter() to free an accept filter
Hiten Pandya [Wed, 12 May 2004 20:21:21 +0000 (20:21 +0000)]
In sodealloc(), use do_setopt_accept_filter() to free an accept filter
instead of doing it manually.

18 years agoThree minor fixes:
Chris Pressey [Wed, 12 May 2004 01:48:40 +0000 (01:48 +0000)]
Three minor fixes:

- Add viddev definition for serial console support.
- In moused_start, run vidcontrol only once instead of (number of
/dev/ttyv* minus 1) times.  This gets rid of a slew of redundant
boot-time error messages.
- Add moused_stop routine to kill the mouse daemon and turn off the
mouse pointer when the 'stop' argument is specified.

Submitted-by: Sascha Wildner <saw@online.de>
Tested-by: walt <wa1ter@myrealbox.com>,
           YONETANI Tomokazu <qhwt+dragonfly-submit@les.ath.cx>

18 years agoReadd em_read_reg_io and em_write_reg_io for workarounds in various
Joerg Sonnenberger [Tue, 11 May 2004 22:55:15 +0000 (22:55 +0000)]
Readd em_read_reg_io and em_write_reg_io for workarounds in various
chip revision. This is a newbusifyed version of the original code.

18 years agoFix a bug in sys/pipe.c. xio_init_ubuf() might not be able to load up the
Matthew Dillon [Tue, 11 May 2004 22:48:53 +0000 (22:48 +0000)]
Fix a bug in sys/pipe.c.  xio_init_ubuf() might not be able to load up the
requested number of bytes even if the request is limited to XIO_INTERNAL_SIZE
if the user buffer base is not page-aligned.  XIO will set xio_bytes to the
actual size of the buffer.

Note that this bug was never exercised due to the 64KB pipe kmem buffer size
limit, so it could not have been the cause of recent problems.

Use kmem_alloc_nofault() instead of kmem_alloc_pageable() for the kmem
reservation.  This is more correct but should have no actual effect on
the system.

18 years agoFollowup log-only addendum: It turns out that last commit did not solve
Matthew Dillon [Tue, 11 May 2004 20:37:21 +0000 (20:37 +0000)]
Followup log-only addendum: It turns out that last commit did not solve
anything, there was a protective conditional in place that I missed.

18 years agoMerge with FreeBSD (RELENG_4) src/usr.sbin/timed/timedc/timedc.c,
Chris Pressey [Tue, 11 May 2004 19:22:25 +0000 (19:22 +0000)]
Merge ... FreeBSD (RELENG_4) src/usr.sbin/timed/timedc/timedc.c,
revision 1.4:

Prefer #include'ing <string.h> over <strings.h>.

Submitted-by: Xin Li <delphij@frontfree.net>
18 years agoAdd an assertion to sys_pipe to cover a possible overrun case and reorder
Matthew Dillon [Tue, 11 May 2004 18:05:08 +0000 (18:05 +0000)]
Add an assertion to sys_pipe to cover a possible overrun case and reorder
the zone cache code in zalloc() to not assign the link pointer until
after various sanity checks are performed.

18 years ago- remove em_adapter_list, it was not used for anything beside adding and
Joerg Sonnenberger [Tue, 11 May 2004 14:00:20 +0000 (14:00 +0000)]
- remove em_adapter_list, it was not used for anything beside adding and
  removing entries
- fix const warning for em_strings
- convert u_intXX_t to uintXX_t
- style(9) changes for whitespace e.g. consistent use of tabs
- use snprintf to build the adapter version string, we are embedding a
  string which could grow in size
- remove check for device_get_softc(dev) == NULL, this must not happen
- prefer device_printf and if_printf over printf("em0d: ...", addapter->unit)
- make some pointer checks explicit against NULL
- remove some of the #ifdef FreeBSD cases which are not interesting for us
- remove trailing return; in void functions
- use the pci accessor functions for the subsystem id and vendor
- start using bus_alloc_resource_any
- remove em_read_reg_io, em_write_reg_io, em_io_read and em_io_write,
  those are unused and doesn't fit into our newbus scheme.

18 years agoAdd the lockf regression test from NetBSD, slightly modified to test
Joerg Sonnenberger [Tue, 11 May 2004 08:03:57 +0000 (08:03 +0000)]
Add the lockf regression test from NetBSD, slightly modified to test
setuid as well. If this is installed setuid, testing the change_euid
is possible, but this is not the default.

18 years agolf_alloc_range() must initialize the returned structure sufficiently such that
Matthew Dillon [Tue, 11 May 2004 02:11:36 +0000 (02:11 +0000)]
lf_alloc_range() must initialize the returned structure sufficiently such that
lf_destroy_range() doesn't explode on us and corrupt system memory.

This should fix the serious FS corruption reports we've been getting.

18 years agolf_setlock() was not returning the correct error code due to an 'int error'
Matthew Dillon [Tue, 11 May 2004 00:06:20 +0000 (00:06 +0000)]
lf_setlock() was not returning the correct error code due to an 'int error'
shadow declaration.

18 years agoDo not specify a macro as first argument to the literal macros
Hiten Pandya [Mon, 10 May 2004 13:49:28 +0000 (13:49 +0000)]
Do not specify a macro as first argument to the literal macros
(.Ql,.Li etc) otherwise the desired effect is not achieved.

18 years agoCorrect usage of the `.Em' macro.
Hiten Pandya [Mon, 10 May 2004 13:47:42 +0000 (13:47 +0000)]
Correct usage of the `.Em' macro.

18 years agoCorrect the usage of the .Dx macro.
Hiten Pandya [Mon, 10 May 2004 13:47:02 +0000 (13:47 +0000)]
Correct the usage of the .Dx macro.

18 years agoRemove extraneous `.El' macro.
Hiten Pandya [Mon, 10 May 2004 13:46:35 +0000 (13:46 +0000)]
Remove extraneous `.El' macro.

18 years agoCorrect the usage of the .Dx macro to avoid mdoc errors.
Hiten Pandya [Mon, 10 May 2004 13:46:10 +0000 (13:46 +0000)]
Correct the usage of the .Dx macro to avoid mdoc errors.

18 years agoAdd entry for the CAPS IPC library. It is now possible to refer to the
Hiten Pandya [Mon, 10 May 2004 13:37:35 +0000 (13:37 +0000)]
Add entry for the CAPS IPC library.  It is now possible to refer to the
CAPS library in manual pages.

18 years agoCorrect the use of the .Dx/.Fx macro.
Hiten Pandya [Mon, 10 May 2004 13:22:50 +0000 (13:22 +0000)]
Correct the use of the .Dx/.Fx macro.

18 years agoRemove erroneous use of the `Fl' mdoc macro and replace it with
Hiten Pandya [Mon, 10 May 2004 13:17:41 +0000 (13:17 +0000)]
Remove erroneous use of the `Fl' mdoc macro and replace it with
a an escaped hyphen.

18 years agoMdoc(7) police:
Hiten Pandya [Mon, 10 May 2004 13:16:43 +0000 (13:16 +0000)]
Mdoc(7) police:

* use .Po/.Pc for parenthesis that extend more than one line

* correct position of the .Fx macro to silence mdoc errors

18 years agoMdoc(7) police:
Hiten Pandya [Mon, 10 May 2004 13:11:12 +0000 (13:11 +0000)]
Mdoc(7) police:

* move the .Dx macro onto second line so that it does not generate
  an mdoc error.

* correct and simplify a nearby sentence.

18 years agoRemove unneeded empty line to silence mdoc(7) warnings.
Hiten Pandya [Mon, 10 May 2004 13:07:18 +0000 (13:07 +0000)]
Remove unneeded empty line to silence mdoc(7) warnings.

18 years agoCorrect mdoc(7).
Hiten Pandya [Mon, 10 May 2004 13:06:53 +0000 (13:06 +0000)]
Correct mdoc(7).

* use .Po/.Pc for parenthesis which extend more than a line

* .In is not a callable macro from anything other than SYNOPSIS,
  use .Pa (pathname) macro instead

18 years agoUpdate the suser(9) manual page about reality.
Hiten Pandya [Mon, 10 May 2004 13:00:37 +0000 (13:00 +0000)]
Update the suser(9) manual page about reality.

* cleanup prototypes and add suser_proc(9) and suser_cred(9)

* use correct english and grammer, nuke hard sentence breaks

* remove deprecated and old information

* inform about the necessity of doing credential checks
  (i.e. only if it is attached to a process)

* cleanup mdoc(7) and bump date

18 years agoUpdate the KASSERT(9) manual page to reality.
Hiten Pandya [Mon, 10 May 2004 12:22:36 +0000 (12:22 +0000)]
Update the KASSERT(9) manual page to reality.

* document the KKASSERT(9) macro

* cleanup sentences and grammar, consolidate information

* use correct mdoc(7)

* update EXAMPLES section

18 years agoUpdate the DELAY(9) manual page about the header file where
Hiten Pandya [Mon, 10 May 2004 12:07:20 +0000 (12:07 +0000)]
Update the DELAY(9) manual page about the header file where
it lives.  Cleanup some mdoc(7) while I am here.

18 years agoUpdate the tsleep(9) manual page about our reality.
Hiten Pandya [Mon, 10 May 2004 12:04:36 +0000 (12:04 +0000)]
Update the tsleep(9) manual page about our reality.

* update prototype of tsleep(9)

* remove information about deprecated interfaces which existed
  in FreeBSD-3.x/4.x land, such as asleep/await etc.

* provide an IMPLEMENTATION NOTES section which informs the user
  about why we do not require priority information for tsleep(9).

* explain the P_SINTR flag.

* cleanup mdoc(7), bump the date and provide more informationa in
  the description line of the manual page so it easily appears when
  an apropos for `sleep' or 'block' is done.

Note, the MLINKs to the deprecated interfaces have not been removed
so that if someone comes hoping along looking for it, they are
directed to a manual page which at the least provides some information
on the subject of waiting on events.

18 years agoAdd MLINK busdma(9) which points to bus_dma(9).
Hiten Pandya [Mon, 10 May 2004 11:20:46 +0000 (11:20 +0000)]
Add MLINK busdma(9) which points to bus_dma(9).

18 years agoRemove newline from panic(9) message, it is redundant.
Hiten Pandya [Mon, 10 May 2004 11:05:13 +0000 (11:05 +0000)]
Remove newline from panic(9) message, it is redundant.

18 years agoRemove newline from panic(9) message, it is redundant.
Hiten Pandya [Mon, 10 May 2004 10:51:32 +0000 (10:51 +0000)]
Remove newline from panic(9) message, it is redundant.

18 years agoRemove redundant newline in a call to panic(9).
Hiten Pandya [Mon, 10 May 2004 10:37:46 +0000 (10:37 +0000)]
Remove redundant newline in a call to panic(9).

18 years agoSync em(4) with FreeBSD current. Most important is the initial bus DMA support.
Joerg Sonnenberger [Mon, 10 May 2004 10:36:25 +0000 (10:36 +0000)]
Sync em(4) with FreeBSD current. Most important is the initial bus DMA support.
Also use callout directly and not timeout.

18 years agoFix a bug in bsd.port.mk that was causing 'make clean' to fail in some
Chris Pressey [Mon, 10 May 2004 04:46:01 +0000 (04:46 +0000)]
Fix a bug in bsd.port.mk that was causing 'make clean' to fail in some
ports directories with mysterious symptoms like 'cd: can't cd to &&'.

The problem was that the text of the DragonFly port override warning
message was mistakenly being injected into the output of the
'*-depends-list' targets.  Although the message was being explicitly
filtered out if the target was 'all-depends-list', the targets
'build-depends-list' and 'run-depends-list', exercised indirectly by
'make clean', still allowed it to slip through.

Encountered-by: walt <wa1ter@myrealbox.com> and others
Detective-work-by: walt <wa1ter@myrealbox.com>
Patch-written-by: cpressey
Approved-by: dillon
18 years agoAdd a readonly sysctl for the `kern.mmxopt' loader tunable (same name).
Hiten Pandya [Sun, 9 May 2004 22:56:22 +0000 (22:56 +0000)]
Add a readonly sysctl for the `kern.mmxopt' loader tunable (same name).

18 years agoMake a small grammar correction: "...most forms of the disklabel
Chris Pressey [Sun, 9 May 2004 22:55:31 +0000 (22:55 +0000)]
Make a small grammar correction: "...most forms of the disklabel
command access the..." instead of "...most disklabel access the..."

18 years agoStyle(9) cleanup to src/sys/vfs, stage 17/21: udf.
Chris Pressey [Sun, 9 May 2004 22:15:00 +0000 (22:15 +0000)]
Style(9) cleanup to src/sys/vfs, stage 17/21: udf.

- Convert K&R-style function definitions to ANSI style.

Note: I chose to leave the formatting of the existing ANSI declarations
alone, as changes to them would mess up the alignment of the associated
comments and the net effect would fail to make the source any more
readable.  A future cleanup could move these comments into the comment
blocks preceding each function definition.

Submitted-by: Andre Nathan <andre@digirati.com.br>
Additional-reformatting-by: cpressey
18 years agoFix two bugs in the lockf code. The first one is a missing reinitialization
Joerg Sonnenberger [Sun, 9 May 2004 11:51:10 +0000 (11:51 +0000)]
Fix two bugs in the lockf code. The first one is a missing reinitialization
of the type field if an existing lock is extended to cover a bigger range
with a different type. The second is related to the problem reported by
Joerg Anslik <joerg@anslik.de> and comes from capturing real uid changes,
but using the effective uid userinfo structure for the accounting.

18 years agoMove accounting of sendfile header bytes sent down one level to handle
Jeffrey Hsu [Sun, 9 May 2004 00:32:41 +0000 (00:32 +0000)]
Move accounting of sendfile header bytes sent down one level to handle
non-blocking sockets properly.

18 years agoKKASSERT that we require inp->inp_pcbinfo, in in_pcbinswildcardhash().
Hiten Pandya [Sat, 8 May 2004 13:30:52 +0000 (13:30 +0000)]
KKASSERT that we require inp->inp_pcbinfo, in in_pcbinswildcardhash().

18 years agoPeter Edwards brought up an interesting NFS bug which we both originally
Matthew Dillon [Sat, 8 May 2004 04:11:48 +0000 (04:11 +0000)]
Peter Edwards brought up an interesting NFS bug which we both originally
thought would be a fairly straightforward bug fix.  But it turns out to
require a nasty hack to fix.

The issue is that near the file EOF NFS uses piecemeal writes and
piecemeal buffer cache buffers.  The result is that manipulation through
the buffer cache only sets some of the m->valid bits in the associated
vm_page(s).  This case may also occur in the middle of a file if for
example a file is piecemeal written and then ftruncated to be much
larger (or lseek/write at a much higher seek position).

The nfs_getpages() routine was assuming that if m->valid was non-0, the
page is basically valid and no read rpc is required to fill it.

The problem is that if you mmap() a piecemeal VM page and fault it in,
m->valid is set to VM_PAGE_BITS_ALL (0xFF). Then, later, when NFS flushes
the buffer cache, only some of the m->valid bits are clear (e.g. 0xFC).
A later page fault will cause NFS to believe that the page is sufficiently
valid and vm_fault will then zero-out the first X bytes of the page when,
in fact, we really should have done an I/O to refill those X bytes.

The fix in PR misc/64816 (FreeBSD) tried to solve this by checking to see
if the m->valid bits were 'sufficiently valid' in the file EOF case but
tesing with fsx resulted in several failure modes.  This doesn't work
because (1) if you extend the file w/ ftruncate or lseek/write these
partially valid pages can end up in the middle of the file rather then
just at the end and (2) There may be a dirty buffer associated with these
pages, meaning that the pages may contain dirty data, and we cannot safely
overwrite the pages with a new read I/O.

The solution in this patch is to deal with the screwy m->valid bit clearing
but special-casing NFS and then having the BIO system clear ALL the m->valid
bits instead of just some of them when NFS calls vinvalbuf().  That way
m->valid will be set to 0 when the buffer is invalidated and the
nfs_getpages() code can be left doing it's simple 'if any m->valid bits
are set assume the whole page is valid' test.  In order for the BIO system
to safely be able to do this (so as not to invalidate portions of a VM page
associated with an adjacent buffer), the NFS io size has been further
restricted to be an integral multiple of PAGE_SIZE.

This is a terrible hack but there is no other way to fix the problem short
of rewriting the entire buffer cache.  We will do that eventually, but not

Reported-by: Peter Edwards <peter.edwards@vordel.com>
Referencing-PR: misc/64816 by Patrick Mackinlay <patrick@spacesurfer.com>

18 years agoFix IPV6 listen(). It was simply a matter of a missing
Matthew Dillon [Sat, 8 May 2004 02:38:36 +0000 (02:38 +0000)]
Fix IPV6 listen().  It was simply a matter of a missing
in_pcbinswildcardhash() call.

Submitted-by: Jeffrey Hsu <hsu@freebsd.org>
Reported-by: "Erik P. Skaalerud" <erik@pentadon.com> and others
18 years agoMove the fsx filesystem tester program from /usr/src/tools/regression to
Matthew Dillon [Fri, 7 May 2004 18:04:46 +0000 (18:04 +0000)]
Move the fsx filesystem tester program from /usr/src/tools/regression to
/usr/src/test/stress and add a sample script.

18 years agoAdd the filesystem/NFS stress tester program, adapted for BSD by Jordan
Matthew Dillon [Fri, 7 May 2004 17:51:02 +0000 (17:51 +0000)]
Add the filesystem/NFS stress tester program, adapted for BSD by Jordan
Hubbard of Apple, originally written by Silicon Graphics, Inc, and
modified by many people, including the SUSE Linux project.

18 years agoMerge rev 1.10 from FreeBSD:
Joerg Sonnenberger [Fri, 7 May 2004 14:37:31 +0000 (14:37 +0000)]
Merge rev 1.10 from FreeBSD:
- stream bus spce access functions, which do not perform a byte order
  conversion (while the normal access functinos would if the bus endianess
  differs from the CPU endianess).

18 years agoFix panic due to the way change_ruid handles the userinfo.
Joerg Sonnenberger [Fri, 7 May 2004 10:09:25 +0000 (10:09 +0000)]
Fix panic due to the way change_ruid handles the userinfo.
The old code assumed that both the structure for the old and the new
user exists. This works fine if change_ruid is called for a real change,
but doesn't if new_ruid == ruid since the old structure == new struct, which
is dropped in the middle.

18 years agoOne of the lf_create_range() calls in lf_clearlock() was passing a bogus
Matthew Dillon [Fri, 7 May 2004 05:45:31 +0000 (05:45 +0000)]
One of the lf_create_range() calls in lf_clearlock() was passing a bogus
owner (nrange->lf_owner instead of range->lf_owner), causing a panic
later on.  'atq now' triggers the panic.  This minor bug was introduced in
the recent fix to the malloc blocking issues.

Noticed-by: David Rhodus <drhodus@machdep.com>
18 years agoFollowup, fix some missing ODFM->OFDM conversions.
Matthew Dillon [Thu, 6 May 2004 20:46:37 +0000 (20:46 +0000)]
Followup, fix some missing ODFM->OFDM conversions.

Reported-by: Joerg Anslik <joerg@anslik.de>
18 years agoDocument the fact that SYSTIMERS operate without the MP lock.
Matthew Dillon [Thu, 6 May 2004 18:09:29 +0000 (18:09 +0000)]
Document the fact that SYSTIMERS operate without the MP lock.

18 years agoTwo more defines from FreeBSD.
Joerg Sonnenberger [Thu, 6 May 2004 16:34:51 +0000 (16:34 +0000)]
Two more defines from FreeBSD.

18 years agoAdd ifmedia infrastructure for the generic IEEE 802.11 support.
Joerg Sonnenberger [Thu, 6 May 2004 16:33:24 +0000 (16:33 +0000)]
Add ifmedia infrastructure for the generic IEEE 802.11 support.

Obtained-from: FreeBSD 5

18 years agoSwitch to the callout interface and rename the associated entry to sis_timer,
Joerg Sonnenberger [Thu, 6 May 2004 10:15:37 +0000 (10:15 +0000)]
Switch to the callout interface and rename the associated entry to sis_timer,
which is more accurate.

18 years agoUse M_INTWAIT instead of M_NOWAIT for the rest of the acpica support code.
Matthew Dillon [Wed, 5 May 2004 22:19:24 +0000 (22:19 +0000)]
Use M_INTWAIT instead of M_NOWAIT for the rest of the acpica support code.
Also remove (now unneeded) NULL checks.

18 years agoDo not trust the third-party ACPI code. Track memory mapping requests
Matthew Dillon [Wed, 5 May 2004 22:18:10 +0000 (22:18 +0000)]
Do not trust the third-party ACPI code.  Track memory mapping requests
via AcpiOsMapMemory() and match them up to unmapping requests.

Use M_INTWAIT instead of M_NOWAIT.

18 years agopmap_qremove() takes a page count, not a byte count. This should fix
Matthew Dillon [Wed, 5 May 2004 22:09:16 +0000 (22:09 +0000)]
pmap_qremove() takes a page count, not a byte count.  This should fix
acpica related booting issues that people have reported.

18 years agoAnother major mmx/xmm/FP commit. This is a combination of several patches
Matthew Dillon [Wed, 5 May 2004 19:26:44 +0000 (19:26 +0000)]
Another major mmx/xmm/FP commit.  This is a combination of several patches
but since the earlier patches didn't actually fix the crashing and corruption
issues we were seeing everything has been rolled into one well tested commit.

Make the FP more deterministic by requiring that npxthread and the FP state
be properly synchronized, and that the FP be in a 'safe' state (meaning
that mmx/xmm registers be useable) when npxthread is NULL.  Allow the FP
save area to be revectored.  Kernel entities which use the FP unit,
such as the bcopy code, must save the app state if it hasn't already been
saved, then revector the save area.

Note that combinations of operations must be protected by a critical section
or interrupt disablement.  Any clearing or setting npxthread combined with
an fxsave/fnsave/frstor/fxrstor/fninit must be protected as an atomic entity.
Since interrupts are threads and can preempt, such preemption will cause
a thread switch to occur and thus cause npxthread and the FP state to be
manipulated.  The kernel can only depend on the FP state being stable for its
use after it has revectored the FP save area.

This commit fixes a number of issues, including potential filesystem
corruption and kernel crashes.

18 years agoAdd bus_alloc_resource_any(9).
Hiten Pandya [Wed, 5 May 2004 16:57:11 +0000 (16:57 +0000)]
Add bus_alloc_resource_any(9).

Obtained-from: FreeBSD-4

18 years agoSerialize access to lockf via pool tokens.
Joerg Sonnenberger [Wed, 5 May 2004 09:17:04 +0000 (09:17 +0000)]
Serialize access to lockf via pool tokens.

18 years agoAdd restrict keyword to string functions.
Jeffrey Hsu [Wed, 5 May 2004 00:17:45 +0000 (00:17 +0000)]
Add restrict keyword to string functions.

Identical to my changes to FreeBSD on Feb 9, 2003.

18 years agoFix an exit-race with ^T. If a process is exiting it may be detached from
Matthew Dillon [Tue, 4 May 2004 23:22:43 +0000 (23:22 +0000)]
Fix an exit-race with ^T.  If a process is exiting it may be detached from
its thread.  p_wmesg is actually p_thread->td_wmesg, so do not dereference
p_wmesg unless a thread is still attached to the process!

Reported-by: "Jonas Trollvik" <Jonas.Trollvik@telia.com>
18 years agoip6_input() must call the IP6_EXTHDR_CHECK() macro with a specified return
Matthew Dillon [Tue, 4 May 2004 23:08:43 +0000 (23:08 +0000)]
ip6_input() must call the IP6_EXTHDR_CHECK() macro with a specified return
value of EASYNC instead of <empty>.

18 years agoA memory ordering barrier is needed in crit_exit() ensure that td_pri
Matthew Dillon [Tue, 4 May 2004 17:13:04 +0000 (17:13 +0000)]
A memory ordering barrier is needed in crit_exit() ensure that td_pri
is adjusted before gd_reqflags is tested.

Reorder the tests in crit_exit() as a branch prediction optimization.
Check gd_reqflags first, since it is likely to be NULL, and td_pri second,
since thd td_pri check may oscillate depending on the critical section's
nesting level.

Load the globaldata pointer before adjusting td_pri in crit_exit_quick()
as an instruction ordering optimization.

18 years agoFix races in lf_getlock and lf_clearlock when waiting for memory.
Joerg Sonnenberger [Tue, 4 May 2004 17:00:55 +0000 (17:00 +0000)]
Fix races in lf_getlock and lf_clearlock when waiting for memory.

The current solution pre-allocates memory in the beginning of both
functions and frees unused before returning. If this is too costly,
keeping the last two lockf_range allocations in a per-CPU cache can
improve the performance further with minimal code changes.

18 years agoCorrect pre-processor conditional surrounding mmxopt's declaration by
Hiten Pandya [Tue, 4 May 2004 12:22:46 +0000 (12:22 +0000)]
Correct pre-processor conditional surrounding mmxopt's declaration by
taking CPU_DISABLE_SSE into account.

Noticed-by: LINT
18 years agonetif/cx/cx.c:
Hiten Pandya [Tue, 4 May 2004 12:12:13 +0000 (12:12 +0000)]
* Provide arguments to strlcpy() in correct order.

* Comment-out unwanted prototypes and externs.

Noticed-by: LINT
18 years agoBring le(4) up-to-speed with 64-bit physical addressing.
Hiten Pandya [Tue, 4 May 2004 12:09:36 +0000 (12:09 +0000)]
Bring le(4) up-to-speed with 64-bit physical addressing.

Noticed-by: LINT
18 years agoCatch up with if_ioctl prototype changes (see rev. 1.10 of net/if_var.h).
Hiten Pandya [Tue, 4 May 2004 12:08:45 +0000 (12:08 +0000)]
Catch up with if_ioctl prototype changes (see rev. 1.10 of net/if_var.h).

Noticed-by: LINT
18 years agoJust pass NULL to sync(), no need to create a `dummyarg'.
Hiten Pandya [Tue, 4 May 2004 12:06:44 +0000 (12:06 +0000)]
Just pass NULL to sync(), no need to create a `dummyarg'.

Noticed-by: LINT
18 years agoHandle UIO_USERISPACE (just fallthrough to UIO_NOCOPY), to silence
Hiten Pandya [Tue, 4 May 2004 12:05:29 +0000 (12:05 +0000)]
Handle UIO_USERISPACE (just fallthrough to UIO_NOCOPY), to silence
build warnings.

Noticed-by: LINT
18 years agoBring the I4B layer up-to-speed with 64-bit physical addressing.
Hiten Pandya [Tue, 4 May 2004 12:03:49 +0000 (12:03 +0000)]
Bring the I4B layer up-to-speed with 64-bit physical addressing.

While I am there, add some preprocessor conditionals to deal with
FreeBSD-5 and DragonFly differences.

Noticed-by: LINT
18 years agoAdd a forward declaration of 'struct uidinfo'.
Hiten Pandya [Tue, 4 May 2004 11:58:26 +0000 (11:58 +0000)]
Add a forward declaration of 'struct uidinfo'.

Noticed-by: LINT
18 years agoMove around some #ifdefs to silence warnings.
Hiten Pandya [Tue, 4 May 2004 11:56:54 +0000 (11:56 +0000)]
Move around some #ifdefs to silence warnings.

While I am cleaning, add a #warning about spp_usrreq() not being
up-to-speed with reality.

Noticed-by: LINT
18 years agoUse the correct cast, ns_ifra_addr -> ns_ifaddr.
Hiten Pandya [Tue, 4 May 2004 11:54:40 +0000 (11:54 +0000)]
Use the correct cast, ns_ifra_addr -> ns_ifaddr.

Noticed-by: LINT
18 years agoClean warnings under DIAGNOSTIC.
Hiten Pandya [Tue, 4 May 2004 11:53:26 +0000 (11:53 +0000)]
Clean warnings under DIAGNOSTIC.

Noticed-by: LINT
18 years agoMerge with FreeBSD (RELENG_4) src/sys/msdosfs/msdosfs_vfsops.c,
Chris Pressey [Mon, 3 May 2004 19:08:08 +0000 (19:08 +0000)]
Merge ... FreeBSD (RELENG_4) src/sys/msdosfs/msdosfs_vfsops.c,

Handle the "next free cluster" field of an FSInfo block more
intelligently when it has the value 0xFFFFFFFF (details in FreeBSD
PR kern/62826).

Reviewed-by: hmp
18 years agoMerge with FreeBSD (RELENG_4) src/bin/mv/mv.c, revision
Chris Pressey [Mon, 3 May 2004 18:54:37 +0000 (18:54 +0000)]
Merge ... FreeBSD (RELENG_4) src/bin/mv/mv.c, revision

Fix a bug that would not allow a symbolic link to be moved if its
destination was a mount point (details in FreeBSD PR bin/64430).

Reviewed-by: hmp
18 years agoStyle(9) cleanup to src/sys/vfs, stage 17/21: specfs.
Chris Pressey [Mon, 3 May 2004 18:46:34 +0000 (18:46 +0000)]
Style(9) cleanup to src/sys/vfs, stage 17/21: specfs.

- Convert K&R-style function definitions to ANSI style.

Submitted-by: Andre Nathan <andre@digirati.com.br>
Additional-reformatting-by: cpressey
18 years agoipstat needs thread2.h for MP stuff and mycpu.
Matthew Dillon [Mon, 3 May 2004 18:43:22 +0000 (18:43 +0000)]
ipstat needs thread2.h for MP stuff and mycpu.

Reported-by: David Rhodus <drhodus@machdep.com>
18 years agoPOSIX lock resource limit part 3/4
Joerg Sonnenberger [Mon, 3 May 2004 16:06:27 +0000 (16:06 +0000)]
POSIX lock resource limit part 3/4

This splits "struct lockf" into the general book-keeping of ranges and
blocked request and the "struct lockf_range" which constists of the data
for a specific range. Adjust the interface of lf_advlock to remove one
level of pointer indirection and embedded "struct lockf" directly in the
inodes. Don't mess with wait channels any more.

Change the algorithm for determing locks to a more direct approach, which
both simplifies the lock acquisition and proper book-keeping of the number
of ranges currently used. The later is necessary to prevent local resource

The code is not fully malloc block-safe, but as good or bad as
the old code.

Add the kernel part of the posixlocks rlimit. This is the maximum number of
POSIX lock ranges any user can acquire. These numbers are tracked for each
user and process and checked at lock/unlock time. If a process changes uid,
its locks are transfered to the new uid which can effectivly boost that
number above the limit.

This is based on the patch set from Devon H. O'Dell <dodell@sitetronics.com>
for the general infrastructure with some adjustment to better integrate with
the new lockf code.

18 years agoMake IP statistics counters per-CPU so they can be updated safely.
Hiten Pandya [Mon, 3 May 2004 15:18:25 +0000 (15:18 +0000)]
Make IP statistics counters per-CPU so they can be updated safely.

* For SMP, we index into the array with the current CPU's
  as ipstats_ary[gd->gd_cpuid], and for UP we just return
  struct at ipstats_ary[0] (CPU-0).

* Rename the structure from ipstat to ip_stats.

* Wrap function definition of CPU counter aggregation in a
  macro called CPU_STATS_FUNC() to avoid duplication.

* Retain support for resetting the counters using netstat(1).

18 years agoStyle(9) cleanup to src/sys/vfs, stage 16/21: smbfs.
Chris Pressey [Mon, 3 May 2004 05:19:50 +0000 (05:19 +0000)]
Style(9) cleanup to src/sys/vfs, stage 16/21: smbfs.

- Convert K&R-style function definitions to ANSI style.

Submitted-by: Andre Nathan <andre@digirati.com.br>
Additional-reformatting-by: cpressey
18 years ago(non bug) The hash routines are never called with a size of 1, but make
Matthew Dillon [Sun, 2 May 2004 07:59:34 +0000 (07:59 +0000)]
(non bug) The hash routines are never called with a size of 1, but make
the minimum size 2 to avoid a degenerate masking case.

18 years agoWe must pmap_qremove() pages that we previously pmap_qenter()'d before
Matthew Dillon [Sun, 2 May 2004 07:57:45 +0000 (07:57 +0000)]
We must pmap_qremove() pages that we previously pmap_qenter()'d before
we can safely call kmem_free().  This corrects a serious corruption issue
that occured when using PIPE algorithms other then the default.

The default SFBUF algorithm was not effected by this bug.

18 years agoStyle(9) cleanup to src/sys/vfs, stage 15/21: procfs.
Chris Pressey [Sun, 2 May 2004 03:05:11 +0000 (03:05 +0000)]
Style(9) cleanup to src/sys/vfs, stage 15/21: procfs.

- Convert K&R-style function definitions to ANSI style.

Submitted-by: Andre Nathan <andre@digirati.com.br>
Additional-reformatting-by: cpressey
18 years agoCommit an update to the pipe code that implements various pipe algorithms.
Matthew Dillon [Sat, 1 May 2004 18:16:46 +0000 (18:16 +0000)]
Commit an update to the pipe code that implements various pipe algorithms.
Note that the newer algorithms are either experimental or only exist for
testing purposes.  The default remains the same (sfbuf mode), which is
considered to be stable.  The code is just too useful not to commit it.

Add pmap_qenter2() for installing cpu-localized KVM mappings.

Add pmap_page_assertzero() which will be used in a later diagnostic commit.

18 years agoAdd bcopyb() back in for the PCVT driver. bcopyb() is explicitly
Matthew Dillon [Sat, 1 May 2004 03:38:36 +0000 (03:38 +0000)]
Add bcopyb() back in for the PCVT driver.  bcopyb() is explicitly
byte-granular for the few (one?) memory mapped device which cannot always
handle 16 or 32 bit ops.

Reported-by: David Rhodus