16 years agoUndo part of the last commit. OBJFORMAT_PATH controls how the cross
Matthew Dillon [Sun, 21 Mar 2004 03:48:38 +0000 (03:48 +0000)]
Undo part of the last commit.  OBJFORMAT_PATH controls how the cross
compiler is exec'd, it is necessary for buildworld to find the correct
compiler and include file base directory.

16 years agocorrect a buildworld failure, fix the include file filter to allow the
Matthew Dillon [Sun, 21 Mar 2004 02:09:15 +0000 (02:09 +0000)]
correct a buildworld failure, fix the include file filter to allow the
primary directory names and filter most of the dummy softlinks that exist
for ports compatibility.

16 years agoNo changes. force commit / update timestamp so ioctl.c is regenerated.
Matthew Dillon [Sun, 21 Mar 2004 01:30:48 +0000 (01:30 +0000)]
No changes. force commit / update timestamp so ioctl.c is regenerated.

16 years agoAdd a missing resetpriority() which was causing all newly forked processes
Matthew Dillon [Sat, 20 Mar 2004 23:35:18 +0000 (23:35 +0000)]
Add a missing resetpriority() which was causing all newly forked processes
to get realtime priority until the next reschedule.  This permanently fixes
the 'jerky X pointer' problem.

Redo the parent estcpu inheritance code, make it much smarter by giving
child processes a small initial batch priority boost relative to the parent
and then allowing them to float back down if they are interactive, and
take this into account when aggregating the child's estcpu back into the
parent when the child exits.  This handles initial conditions for batch

16 years agoFix p_pctcpu and p_estcpu (addendum). Add a ESTCPUFREQ and set it to 10hz.
Matthew Dillon [Sat, 20 Mar 2004 19:21:08 +0000 (19:21 +0000)]
Fix p_pctcpu and p_estcpu (addendum).  Add a ESTCPUFREQ and set it to 10hz.
Change the systimer initialization to use the new constant.

16 years agoFix p_pctcpu and p_estcpu. When the new systimer stuff was put in the
Matthew Dillon [Sat, 20 Mar 2004 19:16:24 +0000 (19:16 +0000)]
Fix p_pctcpu and p_estcpu.  When the new systimer stuff was put in the
scheduler got its own clock interrupt for scheduling updates which was set
to 10Hz.  pctcpu was still being calculated based on 100hz, so change that
to 10hz.

The systimer stuff also broke estcpu, which in turn broke NICE.  Change
the estcpu equations to operate properly and get rid of some crufty comments.

Note that NICE really works now.  A cpu-bound nice +20 process will get
very little cpu relative to a cpu-bounce nice +0 process, and none relative
to a negatively-niced process.  From a standing start each nice level of
difference immediately shifts about 5% of the cpu between processes.  Once
the load and estcpu has stabilized (if the processes are cpu-bound), the
difference is around 2% per level, for two processes.  When starting a
highly-niced process in the face of lower-niced cpu-bound processes, the
highly-niced process may not get any cpu at all for up to 60 seconds.  This
is because the system 1-min loadav is used to scale estcpu.

16 years agoStyle(9) cleanup.
Chris Pressey [Sat, 20 Mar 2004 17:46:48 +0000 (17:46 +0000)]
Style(9) cleanup.

- Remove ``register'' keywords.
- No space after ``sizeof''.
- Convert K&R-style function declarations to ANSI style.
- Remove (void) when ignoring return values.

16 years agoStyle(9) cleanup.
Chris Pressey [Sat, 20 Mar 2004 17:22:46 +0000 (17:22 +0000)]
Style(9) cleanup.

- Remove ``register'' keywords.
- Convert K&R-style declarations to ANSI style.
- Fix typo in comment.

16 years agoStyle(9) cleanup.
Chris Pressey [Sat, 20 Mar 2004 17:09:44 +0000 (17:09 +0000)]
Style(9) cleanup.

- Remove ``register'' keywords.
- Convert K&R-style declarations to ANSI style.
- Remove whitespace before EOL.

16 years agoStyle(9) cleanup.
Chris Pressey [Sat, 20 Mar 2004 17:00:52 +0000 (17:00 +0000)]
Style(9) cleanup.

- Remove ``register'' keywords.
- Add parentheses and remove space after ``sizeof'' and ``return''.

16 years agoStart removing the old build infrastructure for the a.out
David Rhodus [Sat, 20 Mar 2004 16:27:42 +0000 (16:27 +0000)]
Start removing the old build infrastructure for the a.out
binaries. MOst of the interface had already been depreciated
for a while now and we only had remnants remaining.

16 years ago64-byte-align the test functions so they appear on different cache lines.
Matthew Dillon [Sat, 20 Mar 2004 02:04:28 +0000 (02:04 +0000)]
64-byte-align the test functions so they appear on different cache lines.
It doesn't seem to make much of a difference through for some unknown
reason nop1() seems to have slightly lower overhead then nop2().

    dhcp62# /tmp/call3
    call nop() function through function pointer in loop
    call3/nop1-1 10.508s 1000000000 loops =  0.011uS/loop
    call3/nop1-2 14.610s 1000000000 loops =  0.015uS/loop
    call3/nop2-2  7.046s 1000000000 loops =  0.007uS/loop

16 years agoAdd some additional spaces so the ctl string does not bump the
Matthew Dillon [Sat, 20 Mar 2004 02:02:20 +0000 (02:02 +0000)]
Add some additional spaces so the ctl string does not bump the
timing values.

16 years agoAdd function call overhead tests for (1) direct calls, (2) indirect calls,
Matthew Dillon [Sat, 20 Mar 2004 01:51:01 +0000 (01:51 +0000)]
Add function call overhead tests for (1) direct calls, (2) indirect calls,
and (3) call(func) -> func() indirect calls where (a) function 1 is passed
to the call, (b) function 1 and function 2 alternate being passed to the
call, and (c) function 2 is passed to the call (as a double check).  i.e.
call3 is explicitly testing branch prediction misses.

16 years agoClean up the code in bin/ to reduce warnings from GCC3.
Chris Pressey [Fri, 19 Mar 2004 18:39:41 +0000 (18:39 +0000)]
Clean up the code in bin/ to reduce warnings from GCC3.

Stage 5 of 5: clean up sh.
- Add ``const'' to  appropriate variable declarations and casts.
- Add function prototypes and #include's as needed.
- Convert K&R style declarations to ANSI style.

Submitted-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
16 years agoMerge: FreeBSD (RELENG_4) ip_fw2.c rev.
Hiten Pandya [Fri, 19 Mar 2004 18:22:00 +0000 (18:22 +0000)]
Merge: FreeBSD (RELENG_4) ip_fw2.c rev.

IN_MULTICAST wants an address in host byte order.

16 years agoMerge: FreeBSD (HEAD) sys/kern/sysv_sem.c rev. 1.69
Hiten Pandya [Fri, 19 Mar 2004 18:00:25 +0000 (18:00 +0000)]
Merge: FreeBSD (HEAD) sys/kern/sysv_sem.c rev. 1.69

Adjust the number of processes waiting on a semaphore properly
if we are woken up in the middle of sleeping.

Reminded by: Colin Percival <cperciva@FreeBSD.org>

16 years agoClean up the code in bin/ to reduce warnings from GCC3.
Chris Pressey [Fri, 19 Mar 2004 17:47:49 +0000 (17:47 +0000)]
Clean up the code in bin/ to reduce warnings from GCC3.

Stage 4 of 5 or so: cleanups to ed and ps.
- Add ``const'' and ``static'' to  appropriate variable delcarations
  and casts.
- Fix signedness on appropriate ``int'' declarations.
- Convert appropriate ``int'' types to ``size_t''.
- Rename functions/variables to not conflict with globals.
- Add missing #include's.

Submitted-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
16 years agoClean up the code in bin/ to reduce warnings from GCC3.
Chris Pressey [Fri, 19 Mar 2004 17:30:59 +0000 (17:30 +0000)]
Clean up the code in bin/ to reduce warnings from GCC3.

Stage 3 of 5 or so: cleanups to cp, cpdup, and date.
- Add ``const'' to  appropriate variable declarations and casts.
- Convert ``quad'' types to ``long long''.
- Convert appropriate ``int'' types to ``size_t'' and ``dev_t''.
- Rename functions/variables to not conflict with globals.
- Add/remove function prototypes and #includes as appropriate.
- Split a long string constant.
- Convert K&R style declarations to ANSI style.

Submitted-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
16 years agoClean up the code in bin/ to reduce warnings from GCC3.
Chris Pressey [Fri, 19 Mar 2004 17:17:46 +0000 (17:17 +0000)]
Clean up the code in bin/ to reduce warnings from GCC3.

Stage 2 of 5 or so: small cleanups across several programs.
- Convert ``quad'' types to ``long long''.
- Convert appropriate ``int'' types to ``size_t''.
- Fix comment syntax to use /* */ instead of //.
- Initialize a variable before using it.
- Remove an unneeded cast.

Submitted-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
16 years agoGet rid of the obsolete SMP checks in SMBFS.
Matthew Dillon [Fri, 19 Mar 2004 17:06:08 +0000 (17:06 +0000)]
Get rid of the obsolete SMP checks in SMBFS.

16 years agoMake ALWAYS_MSG the default. This introduces an extra procedural call
Matthew Dillon [Fri, 19 Mar 2004 17:00:06 +0000 (17:00 +0000)]
Make ALWAYS_MSG the default.  This introduces an extra procedural call
level but has the advantage of making the so_pru_*() API functions uniform
across all builds, which we will need for things like the smbfs module.
We will fix up any performance issues down the line.

16 years agoClean up the code in bin/ to reduce warnings from GCC3.
Chris Pressey [Fri, 19 Mar 2004 16:37:24 +0000 (16:37 +0000)]
Clean up the code in bin/ to reduce warnings from GCC3.

Stage 1 of 5 or so: clean up usr.bin/prinf, as it gets included by
- Convert ``quad'' types to ``long long''.

Submitted-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
16 years agoFix minor formatting errors in cpdup(1)'s man page.
Chris Pressey [Fri, 19 Mar 2004 07:46:46 +0000 (07:46 +0000)]
Fix minor formatting errors in cpdup(1)'s man page.

16 years agoIf XL cannot properly attach it tries to detach to clean up. Unfortunately,
Matthew Dillon [Fri, 19 Mar 2004 06:30:08 +0000 (06:30 +0000)]
If XL cannot properly attach it tries to detach to clean up.  Unfortunately,
the detach code expects it to have gotten most of the way through the attach
and if it hasn't the system will crash.  This commit adds a flag that tells
the detach code whether the attach got far enough along for the detach to
be able to reset the card (and do certain other things).

16 years agoIncorporate NetBSD rev 1.111: Set the device address before reading the
Matthew Dillon [Fri, 19 Mar 2004 00:35:57 +0000 (00:35 +0000)]
Incorporate NetBSD rev 1.111:  Set the device address before reading the
device descriptor.  This makes certain non-conforming devices work.  Suggested
by Peter Burnett in [NetBSD]kern/24716.

16 years agoFix generation of USB_EVENT_DEVICE_DETACH, which was commented out in
Matthew Dillon [Fri, 19 Mar 2004 00:30:32 +0000 (00:30 +0000)]
Fix generation of USB_EVENT_DEVICE_DETACH, which was commented out in
FreeBSD.  Incorporate NetBSD rev 1.110 which fixes an access to freed
memory which was previously causing the detach event to crash the system.

Reported-By: Andreas Fuchs <asf@boinkor.net>
16 years agoBring in MODULE_VERSION from FreeBSD-5. Even though our kernel doesn't
Matthew Dillon [Thu, 18 Mar 2004 18:51:56 +0000 (18:51 +0000)]
Bring in MODULE_VERSION from FreeBSD-5.  Even though our kernel doesn't
check version numbers, the boot loader apparently does.

16 years agoAdjust the Makefile's to move the iconv files to libiconv, and add it to
Matthew Dillon [Thu, 18 Mar 2004 18:47:41 +0000 (18:47 +0000)]
Adjust the Makefile's to move the iconv files to libiconv, and add it to
the module build.

16 years agoRepository copy libkern/{Makefile,iconv*} -> libiconv, and modify the
Matthew Dillon [Thu, 18 Mar 2004 18:27:47 +0000 (18:27 +0000)]
Repository copy libkern/{Makefile,iconv*} -> libiconv, and modify the
Makefile appropriately.

16 years agoAdd lock.9 man page, it is also symlinked to: lockcount.9, lockinit.9,
Eirik Nygaard [Thu, 18 Mar 2004 15:18:02 +0000 (15:18 +0000)]
Add lock.9 man page, it is also symlinked to: lockcount.9, lockinit.9,
lockmgr.9, lockmgr_printinfo.9 and lockstatus.9.

Obtained from: FreeBSD

16 years agoPractice commit: learn how to use 'cvs remove', so that, should I need
Chris Pressey [Thu, 18 Mar 2004 02:52:44 +0000 (02:52 +0000)]
Practice commit: learn how to use 'cvs remove', so that, should I need
to use it someday, I won't accidentally burn down the entire CVS tree.

16 years agoAdd manual page for the busdma(9) API. It has detailed information on
Hiten Pandya [Thu, 18 Mar 2004 00:07:53 +0000 (00:07 +0000)]
Add manual page for the busdma(9) API.  It has detailed information on
the access methods of busdma and specifications for its usage.

Requested by: Joerg

16 years agoPre-test spot removal solutions in an inconspicuous area before use.
Chris Pressey [Wed, 17 Mar 2004 21:21:27 +0000 (21:21 +0000)]
Pre-test spot removal solutions in an inconspicuous area before use.

Suggested-by: dillon
16 years agoAdd additional default-generation entries for usb2-5, most new PCs these
Matthew Dillon [Wed, 17 Mar 2004 19:20:12 +0000 (19:20 +0000)]
Add additional default-generation entries for usb2-5, most new PCs these
days have more then two USB busses and EHCI also renumbers for companion

16 years agoAdd some USB specific documentation to make life easier for people
Matthew Dillon [Wed, 17 Mar 2004 19:19:17 +0000 (19:19 +0000)]
Add some USB specific documentation to make life easier for people
playing around with DragonFly/USB directly from the live CD.

16 years agoAdd some missing SRCS dependancies to the EHCI module.
Matthew Dillon [Wed, 17 Mar 2004 19:11:26 +0000 (19:11 +0000)]
Add some missing SRCS dependancies to the EHCI module.

16 years agoSeparate the pieces a bit. The usb.ko module does not build EHCI, and
Matthew Dillon [Wed, 17 Mar 2004 18:12:57 +0000 (18:12 +0000)]
Separate the pieces a bit.  The usb.ko module does not build EHCI, and
probably isn't stable enough to include EHCI by default yet, so
reorganize the Makefile's into subdirectories so we can build a separate
EHCI companion KLD.

16 years agoMerge FreeBSD ifconfig.c rev 1.94, strlcpy() cannot be used if the source
Matthew Dillon [Wed, 17 Mar 2004 09:32:18 +0000 (09:32 +0000)]
Merge FreeBSD ifconfig.c rev 1.94, strlcpy() cannot be used if the source
string is not terminated.  This is a clean rewrite of the (minor) patch and
not a direct MFC.

Reminded-by: Brooks Davis <brooks@one-eyed-alien.net>
16 years agoCreate /usr/src/test/test ... a dummy directory that new committers can
Matthew Dillon [Wed, 17 Mar 2004 05:41:23 +0000 (05:41 +0000)]
Create /usr/src/test/test ... a dummy directory that new committers can
use to learn the ropes.

16 years agoUpdate the 825xx GigE support. Add a large number of new device id's and
Matthew Dillon [Wed, 17 Mar 2004 04:59:41 +0000 (04:59 +0000)]
Update the 825xx GigE support.  Add a large number of new device id's and
support for the 82541 (e.g. Intel PRO/1000 MT DESKTOP ADAPTER) and 82544.
Also add sysctl support for various interrupt related delay parameters,
and add workarounds for chip issues.

In-Discussion-With: "Peter Avalos" <pavalos@theshell.com>
Submitted-by: Hiten Pandya <hmp@backplane.com>
Adapted-from: FreeBSD-5

16 years agoFix a bug in the recent connectionless commit. When sending a UDP packet
Matthew Dillon [Wed, 17 Mar 2004 02:27:59 +0000 (02:27 +0000)]
Fix a bug in the recent connectionless commit.  When sending a UDP packet
over a connected socket but with a source address of INADDR_ANY, udp_output()
was calling in_pcbladdr() with a NULL sockaddr pointer, causing a null
pointer panic.

Construct a temporary sockaddr_in to pass to in_pcbladdr() with the foreign
address instead.  in_pcbladdr() takes an address and returns the interface
source IP address that best characterizes the interface the packet will be
sent out of.

16 years agoAn strlcpy() in the last commit was unconditionally overwriting 'name'
Matthew Dillon [Wed, 17 Mar 2004 02:18:23 +0000 (02:18 +0000)]
An strlcpy() in the last commit was unconditionally overwriting 'name'
in the sysctl sdl scan, causing all ifconfig commands to always operate
on the first interface.

16 years agoAdd default case of error = EINVAL to ether_ioctl
Joerg Sonnenberger [Tue, 16 Mar 2004 23:06:11 +0000 (23:06 +0000)]
Add default case of error = EINVAL to ether_ioctl

16 years agoCleanup sis(4):
Joerg Sonnenberger [Tue, 16 Mar 2004 22:48:00 +0000 (22:48 +0000)]
Cleanup sis(4):
- conform somewhat to style(9)
- rename sis_crc to sis_mchash
- use LIST_FOREACH for ifp->if_multiaddrs and mii->mii_phys scans
- make sis_rxeoc static
- use BPF_MTAP

16 years agoAdd support for building dependent modules automatically by
Joerg Sonnenberger [Tue, 16 Mar 2004 19:16:36 +0000 (19:16 +0000)]
Add support for building dependent modules automatically by
specifying KLD_DEPS.

Idea and initial implemenation from Hiten.

16 years agoGive the VFS initialisation functions an update:
Hiten Pandya [Tue, 16 Mar 2004 18:42:35 +0000 (18:42 +0000)]
Give the VFS initialisation functions an update:

* Use a better fix for revision 1.3 of vfs_init.c (ours).
  I have integrated the change from FreeBSD's vfs_init.c
  revision 1.59.  Serious issues are fixed with this
  change and a much more cleaner way of handling disappearing
  VFS operation vectors.  At least vfs_opv_numops are
  allocated and recycled as appropriate.  The number of
  pre-allocated vfs_opv_numops can be changed at boot time
  by a tunable.  $FreeBSD$ ID tag updated accordingly.

  NOTE: this *removes* the temporary fix committed my dillon@
  a few days ago, by giving it a more cleaner solution.

* Use M_VNODE instead of M_TEMP for storing VFS buffers and

* Document the functions in this file to make it easier
  for file system implementors.

* Cleanup unused variables in vfs_add_vnops().

* Use M_ZERO instead of malloc+bzero.

* Do not panic when a VFS operation is not available,
  instead return EOPNOTSUPP.  This is better because
  the error value can be passed up by the system calls
  instead of giving an obscure panic about unavailable
  VFS operation.  One can run into this when a VFS op
  call is made when no filesystem supports that
  particular op.  A similar change was made by Peter
  Wemm in FreeBSD's sys/kern/vfs_init.c.

* Better document the various stages of vfs_opv_recalc().

Note, our value of the minimum number of available VFS operation
vectors is `96' at the moment, since a few tests show that the
previous code initialised to values of between 53-60.  The default
probably can be tuned a little bit better; although tunable access
is available at boot to `vfs.opv_numops'.

Reviewed by: Matt Dillon

16 years agomain() more typically uses 'char **argv' instead of 'char *argv[]'. Remove
Matthew Dillon [Tue, 16 Mar 2004 18:09:32 +0000 (18:09 +0000)]
main() more typically uses 'char **argv' instead of 'char *argv[]'.  Remove
the requirement that an empty line be inserted in function definitions without
local variables (the requirement is actually that NO empty line be inserted).
Revamp the documentation on when and when not to use braces around

Submitted-by: Chris Pressey <cpressey@catseye.mine.nu>
Additional-changes-by: dillon
16 years agoSeparate chroot() into kern_chroot(). Rename change_dir() to checkvp_chdir()
Matthew Dillon [Tue, 16 Mar 2004 17:53:53 +0000 (17:53 +0000)]
Separate chroot() into kern_chroot().  Rename change_dir() to checkvp_chdir()
and reorganize the code to avoid doing weird things to the passed vnode's
lock and ref count in deep subroutines (which lead to buggy code).

Fix a bug in chdir()/kern_chdir() (the namei data was not being freed in all
cases), and also fix a bug in symlink() (missing zfree in error case).

Submitted-by: Paul Herman <pherman@frenchfries.net>
Additional-work-by: dillon
16 years agoMerge FreeBSD's rev. 1.81:
Joerg Sonnenberger [Tue, 16 Mar 2004 16:58:16 +0000 (16:58 +0000)]
Merge FreeBSD's rev. 1.81:

o add IF_*bps macros for netbsd compatibility
o add interface capabilities for vlan use and to signal jumbo frame support

Reviewed by:many
Approved by:re

16 years agoFix loading of the SMBFS kernel module. The KMODDEPS line in the SMBFS
Hiten Pandya [Tue, 16 Mar 2004 07:45:59 +0000 (07:45 +0000)]
Fix loading of the SMBFS kernel module.  The KMODDEPS line in the SMBFS
Makefile generated incorrect (read fake) symbols; the build system was
pretty satisified but kldload was not and returned ENOEXEC.

Instead, add a Makefile for libiconv as it is supposed to be, because
SMBFS requires it as a module dependency.

Note, the SMBFS module needs to be recompiled for it to work, and the
libiconv KLD needs to be built using the newly added Makefile.  Also
rebuild 'libmchain'.

16 years agoIntegrate the remaining parts of the network interface aliasing
Hiten Pandya [Mon, 15 Mar 2004 22:39:37 +0000 (22:39 +0000)]
Integrate the remaining parts of the network interface aliasing
functionality.  While I am there, bring in some of the fixes
made to FreeBSD's ifconfig.

Update the $FreeBSD$ ID tag accordingly.

16 years agoIntegrate remaining part of the network interface aliasing
Hiten Pandya [Mon, 15 Mar 2004 22:37:41 +0000 (22:37 +0000)]
Integrate remaining part of the network interface aliasing
functionality.  This is the kernel part.

16 years agonextsoftcheck (which is a really aweful interrupt interlock hack) needs to
Matthew Dillon [Mon, 15 Mar 2004 20:23:48 +0000 (20:23 +0000)]
nextsoftcheck (which is a really aweful interrupt interlock hack) needs to
be volatile.

16 years agoThe kernel realloc() does not support M_ZERO, assert the case.
Matthew Dillon [Mon, 15 Mar 2004 20:22:54 +0000 (20:22 +0000)]
The kernel realloc() does not support M_ZERO, assert the case.

16 years agoAdd a new function ether_ifattach_bpf which can be used by NICs not using
Joerg Sonnenberger [Mon, 15 Mar 2004 20:08:40 +0000 (20:08 +0000)]
Add a new function ether_ifattach_bpf which can be used by NICs not using
the default arguments for bpfattach for dlt and hdrlen. ether_ifattach
calls this routine and provides the old standard arguments to keep the API.

This call can be used instead of the multiple BPF interfaces mess in the
coming generic 802.11 layer.

Fix I4B's isppp by using the new call.

16 years agoANSIfication, K&R cleanups, 'register' removal.
Matthew Dillon [Mon, 15 Mar 2004 18:10:29 +0000 (18:10 +0000)]
ANSIfication, K&R cleanups, 'register' removal.

Submitted-by: Chris Pressey <cpressey@catseye.mine.nu>
16 years agoAdd a Makefile stub to build ep as a module.
Matthew Dillon [Mon, 15 Mar 2004 17:19:19 +0000 (17:19 +0000)]
Add a Makefile stub to build ep as a module.

Submitted-by: Dheeraj Reddy <dheerajs@comcast.net>
Taken-From: FreeBSD-5

16 years agoAdd a Makefile stub to build pccard as a module.
Matthew Dillon [Mon, 15 Mar 2004 17:16:23 +0000 (17:16 +0000)]
Add a Makefile stub to build pccard as a module.

Submitted-by: Dheeraj Reddy <dheerajs@comcast.net>
Taken-From: FreeBSD-5

16 years agoPartial merge from FBsd-5, code to make some PCCARDs work under NEWCARD.
Matthew Dillon [Mon, 15 Mar 2004 17:15:18 +0000 (17:15 +0000)]
Partial merge from FBsd-5, code to make some PCCARDs work under NEWCARD.

Submitted-by: Dheeraj Reddy <dheerajs@comcast.net>
Taken-From: FreeBSD-5

16 years agoMove a drain output call to before a dirty block check instead of after
Matthew Dillon [Mon, 15 Mar 2004 16:27:04 +0000 (16:27 +0000)]
Move a drain output call to before a dirty block check instead of after
to make all dirty buffers visible.

Submitted-by: Max Khon <fjoe@FreeBSD.org> for FreeBSD-4.x
Reviewed-by: Kirk McKusick <mckusick@beastie.mckusick.com>
16 years agoCode cleanup, remove 'register' and (void) casts. No functional changes.
Matthew Dillon [Mon, 15 Mar 2004 16:24:22 +0000 (16:24 +0000)]
Code cleanup, remove 'register' and (void) casts.  No functional changes.

Submitted-by: Chris Pressey <cpressey@catseye.mine.nu>
16 years agoSome drivers depend on the link layer address in ac_enaddr.
Joerg Sonnenberger [Mon, 15 Mar 2004 08:25:50 +0000 (08:25 +0000)]
Some drivers depend on the link layer address in ac_enaddr.
Temporary save a copy of lla there too until all drivers some been

Idea from FreeBSD.

16 years agoDo not free the old VFS vector when recomputing the vectors. If a module
Matthew Dillon [Mon, 15 Mar 2004 06:10:51 +0000 (06:10 +0000)]
Do not free the old VFS vector when recomputing the vectors.  If a module
is loaded which causes the vectors to recompute, the v_op on existing
vnodes can wind up pointing to freed memory.  This fix does cause a memory
leak, and is a hack, but it's better then crashing.

Taken-from: FreeBSD-5

16 years agoWhen detaching UMASS, abort all the pipes before detaching the sim. Note
Matthew Dillon [Mon, 15 Mar 2004 05:45:19 +0000 (05:45 +0000)]
When detaching UMASS, abort all the pipes before detaching the sim.  Note
sim detachment path is:  umass_cam_detach_sim -> xpt_bus_deregister ->
cam_sim_free.  If there is anything pending as of the cam_sim_free() bad
things will happen.

16 years agoWhen deregistering a bus, pending device bus scan timeouts are not deleted
Matthew Dillon [Mon, 15 Mar 2004 05:43:52 +0000 (05:43 +0000)]
When deregistering a bus, pending device bus scan timeouts are not deleted
and pending ccb's are not necessary aborted/processed prior to the sim
potentially being destroyed.  Adjust AC_LOST_DEVICE to release any pending
timeouts (and it should also restart the command queue).  This may interlock
against the detaching device (e.g. UMASS) having set a flag in its softc
that causes all future commands to fail immediately.  Note that we have to
also run any pending ISRs synchronously before xpt_bus_deregister() can
safely return.

When freeing a device queue, print a warning if the device queue contains
active commands.  If a device queue is freed while holding active commands
all sorts of bad things can happen, including the machine locking up on
boot while waiting for CAM to finish scanning its SCSI busses.

16 years agoThe cam_sim structure was being deallocated unconditionally by device
Matthew Dillon [Mon, 15 Mar 2004 03:05:11 +0000 (03:05 +0000)]
The cam_sim structure was being deallocated unconditionally by device
driver detach routines.  The problem with this is that part of the CAM
bus structure may still be active (for example, with pending timeout()'s),
and even though the bus, target, and device is freed, since the sim IS
freed any accesses through the sim will hit 0xdeadc0de.  This case most often
occurs with USB UMASS devices.

16 years agoDo some M_WAITOK<->M_INTWAIT cleanups. Code entered from userland, such as
Matthew Dillon [Mon, 15 Mar 2004 02:27:57 +0000 (02:27 +0000)]
Do some M_WAITOK<->M_INTWAIT cleanups.  Code entered from userland, such as
device open and device ioctl, generally use M_WAITOK, while low level
structures such as the capacity structure are allocated using M_INTWAIT.

16 years agoThe cam_sim structure was being deallocated unconditionally by device
Matthew Dillon [Mon, 15 Mar 2004 01:10:45 +0000 (01:10 +0000)]
The cam_sim structure was being deallocated unconditionally by device
driver detach routines.  The problem with this is that part of the CAM
bus structure may still be active (for example, with pending timeout()'s),
and even though the bus, target, and device is freed, since the sim IS
freed any accesses through the sim will hit 0xdeadc0de.  This case most often
occurs with USB UMASS devices.

The CAM_XPT and CAM_SIM layer has been revamped.  CAM_DEV_UNCONFIGURED is now
accounted for in the device->refcount, and the cam_sim structure is now
ref-counted as well.  Additionally, the cam_simq* code which handles the
device queues has been revamped to refcount as well, so shared device queues
(raid and multi-channel devices) are not free()'d before all references have
gone away.

scsi_low free'd its cam_sim twice.  Fixed.

USB was improperly using M_NOWAIT.  All M_NOWAIT instances have been renamed

16 years agoTurn TDF_SYSTHREAD into TDF_RESERVED0100 since the flag is never used
Hiten Pandya [Sun, 14 Mar 2004 20:54:02 +0000 (20:54 +0000)]
Turn TDF_SYSTHREAD into TDF_RESERVED0100 since the flag is never used
and such a flag is not required.

Discussed with:  Matt Dillon

16 years agoRemove BPF_MTAP definition
Joerg Sonnenberger [Sun, 14 Mar 2004 17:12:05 +0000 (17:12 +0000)]
Remove BPF_MTAP definition

16 years agoBPF has been in the kernel for ages and is supported by all NICs but I4B.
Joerg Sonnenberger [Sun, 14 Mar 2004 15:36:54 +0000 (15:36 +0000)]
BPF has been in the kernel for ages and is supported by all NICs but I4B.

This removes the second argument of ether_ifattach and ether_ifdetach as
done by sam in FreeBSD's rev. 1.130 of net/if_ethersubr.c.

Add an argument for the link layer address to ether_ifattach as done by
is in NetBSD's rev of the same file.

Adjust if_ef.c based on FreeBSD's version of that file.

Remove the now unused ETHER_BPF_[UN]SUPPORTED define from ethernet.h.

16 years agoRemove unused BSDI I4B interface
Joerg Sonnenberger [Sun, 14 Mar 2004 15:19:54 +0000 (15:19 +0000)]
Remove unused BSDI I4B interface

16 years agoRemove macro definitions for BPF_MTAP
Joerg Sonnenberger [Sun, 14 Mar 2004 14:37:39 +0000 (14:37 +0000)]
Remove macro definitions for BPF_MTAP

16 years agoFix warning about missing prototyp for psignal
Joerg Sonnenberger [Sun, 14 Mar 2004 14:35:23 +0000 (14:35 +0000)]
Fix warning about missing prototyp for psignal

16 years agoDe-perlify.
Eirik Nygaard [Sun, 14 Mar 2004 13:47:12 +0000 (13:47 +0000)]

Submitted by: Dheeraj Reddy <dheerajr@comcast.net>
Obtained from: FreeBSD

16 years agoCorrect typo in comment.
Hiten Pandya [Sun, 14 Mar 2004 11:04:12 +0000 (11:04 +0000)]
Correct typo in comment.

16 years agoIfdef out unused variable.
Jeffrey Hsu [Sun, 14 Mar 2004 08:26:31 +0000 (08:26 +0000)]
Ifdef out unused variable.

16 years agoMake tcp_drain() per-cpu.
Jeffrey Hsu [Sun, 14 Mar 2004 08:21:53 +0000 (08:21 +0000)]
Make tcp_drain() per-cpu.

16 years agoMake tcp_drain() per-cpu.
Jeffrey Hsu [Sun, 14 Mar 2004 07:57:26 +0000 (07:57 +0000)]
Make tcp_drain() per-cpu.

16 years ago * Remove ``register'' keywords.
Eirik Nygaard [Sat, 13 Mar 2004 21:08:39 +0000 (21:08 +0000)]
 * Remove ``register'' keywords.
 * Convert K&R-style function declarations to ANSI-style.

Submitted by: Chris Pressey <cpressey@catseye.mine.nu>

16 years agoUpdate libcr with recent libc updates.
Eirik Nygaard [Sat, 13 Mar 2004 19:46:56 +0000 (19:46 +0000)]
Update libcr with recent libc updates.

16 years agoAdd BPF_TAP and BPF_MTAB macros from FreeBSD
Joerg Sonnenberger [Sat, 13 Mar 2004 19:18:56 +0000 (19:18 +0000)]
Add BPF_TAP and BPF_MTAB macros from FreeBSD

16 years agoAdd convient functions for the bus interface: child_present,
Joerg Sonnenberger [Sat, 13 Mar 2004 14:38:22 +0000 (14:38 +0000)]
Add convient functions for the bus interface: child_present,
child_pnpinfo_str, child_location_str.

From FreeBSD.

16 years agoMerge from FreeBSD 5:
Joerg Sonnenberger [Sat, 13 Mar 2004 12:39:56 +0000 (12:39 +0000)]
Merge from FreeBSD 5:

Add some handy macros to remove e.g. const from a pointer.

16 years agoFix a bunch of NFS races. These races existed in FreeBSD 4.x but are more
Matthew Dillon [Sat, 13 Mar 2004 03:13:53 +0000 (03:13 +0000)]
Fix a bunch of NFS races.  These races existed in FreeBSD 4.x but are more
likely to occur now due to the additional thread switching that DragonFly
performs when doing things like sending UDP packets.  Three bugs are
being fixed:

* nfs_request() adds the request to the nfs_timer queue before doing initial
  processing (e.g. transmission) of the request.  The initial transmission of
  the request will race between nfs_request and nfs_timer, potentially causing
  the congestion window calculation (nm_sent) to be bumped twice instead of
  once.  This eventually closes the congestion window permanently and
  causes the NFS mount to freeze.  (Additionally the request could be
  transmitted twice unnecessarily, also fixed).

* Updates to rep->r_flags and nmp->nm_sent were not being properly protected
  against nfs_timer due to splsoftclock() being released too early.  All
  such accesses are now protected.

* nfs_reply() depends on nfs_rcvlock to do an interlock check to see if the
  request has already been replied, but nfs_rcvlock() only does this if it
  cannot immediately get the receiver lock.  The problem is that the NFS
  code in between request transmission and nfs_reply() can block, potentially
  allowing a reply to be returned to another nfsiod.  The NFS receiver winds
  up getting stuck waiting for a reply that has already been returned.
  nfs_rcvlock() now unconditionally checks to see if the reply has already
  occured before entering the loop.

16 years agoIn an rfork'd or vfork'd situation where multiple processes are sharing
Matthew Dillon [Fri, 12 Mar 2004 23:09:37 +0000 (23:09 +0000)]
In an rfork'd or vfork'd situation where multiple processes are sharing
the same vmspace, and one process goes zombie, the vmspace's vm_exitingcnt
will be non-zero.  If another process then forks or execs the exitingcnt will
be improperly inherited by the new vmspace.  The solution is to not copy
exitingcnt when copying to a new vmspace.

Additionally, for DragonFly, I also had to fix a few cases where the upcall
list was also being improperly inherited.

Heads-up-by: Xin LI <delphij@frontfree.net>
Obtained-From: Peter Wemm <peter@wemm.org> (FreeBSD-5)

16 years agoAdd userland UDF support based on mount_cd9660
Joerg Sonnenberger [Fri, 12 Mar 2004 22:46:25 +0000 (22:46 +0000)]
Add userland UDF support based on mount_cd9660

16 years agoMerge the kernel part of UDF support from FreeBSD 5.
Joerg Sonnenberger [Fri, 12 Mar 2004 22:38:15 +0000 (22:38 +0000)]
Merge the kernel part of UDF support from FreeBSD 5.

This doesn't include the iconv hocks and makes use of M_WAITOK everywhere.

16 years agoThe free(9) implementation based on the slab allocator doesn't handle
Joerg Sonnenberger [Fri, 12 Mar 2004 22:29:21 +0000 (22:29 +0000)]
The free(9) implementation based on the slab allocator doesn't handle
the special case of freeing NULL anymore. Make this behaviour explicit
by adding a panic and adjusting the man page.

16 years agoThink before commit and remove some more cruft
Joerg Sonnenberger [Fri, 12 Mar 2004 22:21:12 +0000 (22:21 +0000)]
Think before commit and remove some more cruft

16 years agoAdd a short cut for DVD_INVALIDATE_AGID to simplify the rest
Joerg Sonnenberger [Fri, 12 Mar 2004 22:19:08 +0000 (22:19 +0000)]
Add a short cut for DVD_INVALIDATE_AGID to simplify the rest

16 years agoInitialize all fields in MALLOC_DEFINE and VFS_SET to fix warnings.
Joerg Sonnenberger [Fri, 12 Mar 2004 22:05:53 +0000 (22:05 +0000)]
Initialize all fields in MALLOC_DEFINE and VFS_SET to fix warnings.

16 years agoInitialize the interface name for if_de
Joerg Sonnenberger [Fri, 12 Mar 2004 15:42:49 +0000 (15:42 +0000)]
Initialize the interface name for if_de

16 years agoCollapse the if(...) block in pim_stats added by my previous commit
Hiten Pandya [Fri, 12 Mar 2004 11:29:51 +0000 (11:29 +0000)]
Collapse the if(...) block in pim_stats added by my previous commit
and nuke an `error' variable.

Discussed with: Dag-Erling Smorgrav <des at freebsd.org>

16 years agoUse M_INTWAIT and M_WAITOK instead of M_NOWAIT within the USB bus
Matthew Dillon [Fri, 12 Mar 2004 03:43:06 +0000 (03:43 +0000)]
Use M_INTWAIT and M_WAITOK instead of M_NOWAIT within the USB bus
infrastructure.  For the system to operate as expected, allocations
done in this layer have to be reliable.

16 years agoChange M_NOWAIT to M_INTWAIT or M_WAITOK. CAM does a mediocre job checking
Matthew Dillon [Fri, 12 Mar 2004 03:24:43 +0000 (03:24 +0000)]
Change M_NOWAIT to M_INTWAIT or M_WAITOK.  CAM does a mediocre job checking
for NULL returns from malloc() and even when it does it generally causes
the device operation to fail instead of retrying, resulting in unacceptable
behavior.  M_NOWAIT semantics allow NULL to be returned during normal system
operation.  This is especially true in DragonFly.

Also remove much of the code that previously checked for NULL.  By using
M_INTWAIT or M_WAITOK, malloc() will panic rather then return NULL.  Only
the addition of M_NULLOK allows a blocking malloc() to return NULL, and we
do not use that flag in CAM.

Add M_ZERO to a number of malloc()'s and remove subsequent bzero()'s, and
add M_ZERO to a few mallocs (primarily for the read capacity data structure)
that did not bother zeroing out the structure before.  While the data is
supposed to be overwritten read-capacity is often quite fragile due to the
SCSI simulation layer, so we do not take any chances.

16 years agoUse info->td instead of curthread in ffs_reload_scan1(); although
Hiten Pandya [Thu, 11 Mar 2004 20:17:36 +0000 (20:17 +0000)]
Use info->td instead of curthread in ffs_reload_scan1(); although
info->td will be curthread in this case anyway, but purely for

Discussed with:  Matthew Dillon

16 years agoReplace a manual check for a VMIO candidate with vn_canvmio() under
Hiten Pandya [Thu, 11 Mar 2004 20:14:46 +0000 (20:14 +0000)]
Replace a manual check for a VMIO candidate with vn_canvmio() under

This silences an annoying warning in getblk() when VMIO'ing on a
VDIR (directory) vnode; this happens due to vmiodirenable sysctl
being set to `1'.

Discussed with:  Matthew Dillon

16 years agoUse local cpu tcbinfo
Joerg Sonnenberger [Thu, 11 Mar 2004 17:22:52 +0000 (17:22 +0000)]
Use local cpu tcbinfo