dragonfly.git
16 years agoReorder cpu interrupt enablement, do it in the code that drops
Matthew Dillon [Mon, 30 Apr 2007 16:46:01 +0000 (16:46 +0000)]
Reorder cpu interrupt enablement, do it in the code that drops
the critical section during booting.  Add a new interrupt controller
ABI function 'cleanup' which is called after interrupts are enabled
but before the critical section is dropped.

16 years agoEST's module was being installed before the module list got initialized,
Matthew Dillon [Mon, 30 Apr 2007 16:39:20 +0000 (16:39 +0000)]
EST's module was being installed before the module list got initialized,
adjust its priority from SI_BOOT2_BIOS to SI_BOOT2_KLD.

Reported-by: Sascha Wildner <saw@online.de>
16 years ago- Don't use the status block's link state change bit to micro-optimize
Sepherosa Ziehau [Mon, 30 Apr 2007 14:05:22 +0000 (14:05 +0000)]
- Don't use the status block's link state change bit to micro-optimize
  performance, instead, read MAC_STS which always contains the correct
  value about link state changing.  Enormous amount of superflucious
  link up events, which keep coming originally when the interface is
  brought up before cable is plugged in, disappear after this change.
- Nuke the no longer needed PCI bridge cache flush.
- Minor style change.

16 years agoRevamp SYSINIT ordering. Relabel sysinit IDs (SI_* in sys/kernel.h) to
Matthew Dillon [Mon, 30 Apr 2007 07:18:57 +0000 (07:18 +0000)]
Revamp SYSINIT ordering.  Relabel sysinit IDs (SI_* in sys/kernel.h) to
make them less confusing, particularly with regard to the relative order
init routines are called in.

Reorder many sysinits.  Reorder the SMP and CLOCK code to bring all the
cpus up far earlier in the boot sequence and to make the full threading and
clocking subsystems available for device config.

16 years agoStore the frequency and cputimer used to initialize a periodic systimer.
Matthew Dillon [Mon, 30 Apr 2007 06:57:38 +0000 (06:57 +0000)]
Store the frequency and cputimer used to initialize a periodic systimer.
If the system cputimer changes, periodic systimers will be adjusted at
the next timeout.

This allows the cputimer to be changed with only minor glitches, which
in turn will allow us to initialize with the 8254 and then later change
over to the ACPI timer.

Theoretically this allows the cputimer to be changed on the fly, after
the system has booted, but the sysctl is read-only for now.

16 years ago* Use SYSREF for vmspace structures. This replaces the vmspace structure's
Matthew Dillon [Sun, 29 Apr 2007 18:25:41 +0000 (18:25 +0000)]
* Use SYSREF for vmspace structures.  This replaces the vmspace structure's
  roll-your-own refcnt implementation and replaces its zalloc backing store.
  Numerous procedures have been added to handle termination and DTOR
  operations and to properly interlock with vm_exitingcnt, all centered
  around the vmspace_sysref_class declaration.

* Replace pmap_activate() and pmap_deactivate() with add pmap_replacevm().
  This replaces numerous instances where roll-your-own deactivate/activate
  sequences were being used, creating small windows of opportunity where
  an update to the kernel pmap would not be visible to running code.

* Properly deactivate pmaps and add assertions to the fact in the teardown
  code.  Cases had to be fixed in cpu_exit_switch(), the exec code, the
  AIO code, and a few other places.

* Add pmap_puninit() which is called as part of the DTOR sequence for
  vmspaces, allowing the kmem mapping and VM object to be recovered.
  We could not do this with the previous zalloc() implementation.

* Properly initialize the per-cpu sysid allocator (globaldata->gd_sysid_alloc).

Make the following adjustments to the LWP exiting code.

* P_WEXIT interlocks the master exiting thread, eliminating races which can
  occur when it is signaling the 'other' threads.

* LWP_WEXIT interlocks individual exiting threads, eliminating races which
  can occur there and streamlining some of the tests.

* Don't bother queueing the last LWP to the reaper.  Instead, just leave it
  in the p_lwps list (but still decrement nthreads), and add code to
  kern_wait() to reap the last thread.  This improves exit/wait performance
  for unthreaded applications.

* Fix a VMSPACE teardown race in the LWP code.  It turns out that it was
  still possible for the VMSPACE for an exiting LWP to be ripped out from
  under it by the reaper (due to a conditional that was really supposed to
  be a loop), or by kern_wait() (due to not waiting for all the LWPs to
  enter an exiting state).  The fix is to have the LWPs PHOLD() the process
  and then PRELE() it when they are reaped.

This is a little mixed up because the addition of SYSREF revealed a number
of other semi-related bugs in the pmap and LWP code which also had to be
fixed.

16 years agoAlthough defined in sys/time.h we don't have CLOCK_VIRTUAL and CLOCK_PROF
Hasso Tepper [Sun, 29 Apr 2007 12:23:52 +0000 (12:23 +0000)]
Although defined in sys/time.h we don't have CLOCK_VIRTUAL and CLOCK_PROF
implemented yet. But we have CLOCK_MONOTONIC.

16 years agoRemove unneeded references to sys/syslink.h. Get syslink_desc from
Matthew Dillon [Sun, 29 Apr 2007 06:11:19 +0000 (06:11 +0000)]
Remove unneeded references to sys/syslink.h.  Get syslink_desc from
sys/syslink_rpc.h

16 years agoUse the __boolean_t defined in machine/stdint.h instead of the
Matthew Dillon [Sun, 29 Apr 2007 06:05:02 +0000 (06:05 +0000)]
Use the __boolean_t defined in machine/stdint.h instead of the
boolean_t from sys/types.h, which doesn't work from userland unless
sys/user.h is carefully positioned.

16 years agoWhen <sys/user.h> is included, it MUST be included first because it sets
Matthew Dillon [Sun, 29 Apr 2007 01:36:04 +0000 (01:36 +0000)]
When <sys/user.h> is included, it MUST be included first because it sets
a preprocessor variable that effects other header files.

16 years agoImplement SYSREF - structural reference counting, allocation, and sysid
Matthew Dillon [Sun, 29 Apr 2007 01:29:33 +0000 (01:29 +0000)]
Implement SYSREF - structural reference counting, allocation, and sysid
management subsystem.

* Structural reference count management, including creation and termination
  sequencing (e.g. where the structure might be temporarily referenced
  during termination).

* Allocation.  It uses an objcache backend for optimal allocation,
  deallocation, and memory recovery.

* Sysid assignment and red-black tree indexing.  It does this in the
  objcache CTOR and DTOR so it costs us absolutely nothing in the
  resource allocation / deallocation critical path.  sysids will be
  reused unless they are externally accessed.

16 years agoAdd a shortcut function, objcache_create_mbacked(), which is more complex
Matthew Dillon [Sun, 29 Apr 2007 01:26:46 +0000 (01:26 +0000)]
Add a shortcut function, objcache_create_mbacked(), which is more complex
then objcache_create_simple() but less complex then objcache_create().

16 years agoWhen <sys/user.h> is included, it MUST be included first because it sets
Matthew Dillon [Sun, 29 Apr 2007 01:10:33 +0000 (01:10 +0000)]
When <sys/user.h> is included, it MUST be included first because it sets
a preprocessor variable that effects other header files.

16 years agoUse the new PLATFORM_CONFIG_H mechanism rather than maintaining patches
Peter Avalos [Sat, 28 Apr 2007 16:16:31 +0000 (16:16 +0000)]
Use the new PLATFORM_CONFIG_H mechanism rather than maintaining patches
against contrib/.

Reminded-by: joerg
16 years agoAdd FreeBSD 6.3 (for archive_write_disk(3)).
Sascha Wildner [Sat, 28 Apr 2007 16:11:37 +0000 (16:11 +0000)]
Add FreeBSD 6.3 (for archive_write_disk(3)).

16 years ago- PHY error bit no longer exists in RX descriptor flags.
Sepherosa Ziehau [Sat, 28 Apr 2007 14:40:13 +0000 (14:40 +0000)]
- PHY error bit no longer exists in RX descriptor flags.
- Cipher error mask is off by one bit.
Obtained-from: Ralink Linux RT61 driver

- Cache host byte order RX descriptor flags.

16 years agoImplement ncpus_fit and ncpus_fit_mask. Admittedly not the best name.
Matthew Dillon [Fri, 27 Apr 2007 23:27:18 +0000 (23:27 +0000)]
Implement ncpus_fit and ncpus_fit_mask.  Admittedly not the best name.
This variable is the nearest power of 2 >= ncpus (ncpus2 is the nearest
power of 2 <= ncpus).

16 years agoAdd a generally accessible cpu_pause() inline for spin loops.
Matthew Dillon [Fri, 27 Apr 2007 23:23:59 +0000 (23:23 +0000)]
Add a generally accessible cpu_pause() inline for spin loops.

16 years agoGC old libarchive version.
Peter Avalos [Fri, 27 Apr 2007 23:02:55 +0000 (23:02 +0000)]
GC old libarchive version.

16 years agoUpgrade to libarchive 2.1.9. Including bug fixes, this improves ar support
Peter Avalos [Fri, 27 Apr 2007 22:56:18 +0000 (22:56 +0000)]
Upgrade to libarchive 2.1.9.  Including bug fixes, this improves ar support
and adds read/write_compress_program.

Discussed-with:  joerg

16 years agoAdd our READMEs.
Peter Avalos [Fri, 27 Apr 2007 22:14:42 +0000 (22:14 +0000)]
Add our READMEs.

16 years agoThese weren't supposed to get imported.
Peter Avalos [Fri, 27 Apr 2007 22:13:31 +0000 (22:13 +0000)]
These weren't supposed to get imported.

16 years agoMerge from vendor branch LIBARCHIVE:
Peter Avalos [Fri, 27 Apr 2007 22:01:15 +0000 (22:01 +0000)]
Merge from vendor branch LIBARCHIVE:
Import libarchive 2.1.9.

16 years agoImport libarchive 2.1.9.
Peter Avalos [Fri, 27 Apr 2007 22:01:15 +0000 (22:01 +0000)]
Import libarchive 2.1.9.

16 years agoSpecify section number for .Xr
Sascha Wildner [Fri, 27 Apr 2007 08:49:42 +0000 (08:49 +0000)]
Specify section number for .Xr

16 years agoTestcommit.
Hasso Tepper [Fri, 27 Apr 2007 06:56:36 +0000 (06:56 +0000)]
Testcommit.

16 years agoMerge from vendor branch SENDMAIL:
Gregory Neil Shapiro [Fri, 27 Apr 2007 03:55:39 +0000 (03:55 +0000)]
Merge from vendor branch SENDMAIL:
Bring in sendmail.org code from the future 8.14.2 release which restores
ABI compatibility to users of the libmilter.so shared library.

16 years agoBring in sendmail.org code from the future 8.14.2 release which restores
Gregory Neil Shapiro [Fri, 27 Apr 2007 03:55:39 +0000 (03:55 +0000)]
Bring in sendmail.org code from the future 8.14.2 release which restores
ABI compatibility to users of the libmilter.so shared library.

16 years agoFix various paths in rc.d/diskless and friends.
Matthew Dillon [Thu, 26 Apr 2007 23:34:27 +0000 (23:34 +0000)]
Fix various paths in rc.d/diskless and friends.

Submitted-by: Thomas Nikolajsen <thomas.nikolajsen@mail.dk>
16 years agoRemove unneeded comma.
Sascha Wildner [Thu, 26 Apr 2007 20:08:56 +0000 (20:08 +0000)]
Remove unneeded comma.

16 years agoUse .Xr for manpage references.
Sascha Wildner [Thu, 26 Apr 2007 17:35:03 +0000 (17:35 +0000)]
Use .Xr for manpage references.

16 years agoAdd a reference to manpath.config(5).
Sascha Wildner [Thu, 26 Apr 2007 15:47:43 +0000 (15:47 +0000)]
Add a reference to manpath.config(5).

16 years agoUse a smaller indentation because it looks better.
Sascha Wildner [Thu, 26 Apr 2007 15:45:59 +0000 (15:45 +0000)]
Use a smaller indentation because it looks better.

16 years ago- Factor out ieee80211_reset_state() from ieee80211_newstate(), so
Sepherosa Ziehau [Thu, 26 Apr 2007 12:59:14 +0000 (12:59 +0000)]
- Factor out ieee80211_reset_state() from ieee80211_newstate(), so
  802.11 layer can clean up its internal state machine without state
  changing or going through driver code.
- Merge sta_disassoc() and sta_disauth() into sta_disconnect(), which
  sends disassoc to associated STA and deauth to authenticating STA.
- Call ieee80211_reset_state(), if operational mode is going to be
  changed, so we will do a proper state machine clean up.  In the
  original way, if we are acting as AP and switch directly to act as
  STA, we will send out wrong management frames.
- Call ieee80211_reset_state(), if PHY is going to be changed.  This
  prevents panic (due to a proper assertion) under following scenario:
  o  Current PHY of the AP is 11b.
  o  An 11b STA joins the BSS created by the AP.  Since AP's current
     PHY is 11b, this STA will not be counted as long slot time STA,
     i.e. long slot time STA count left untouched.
  o  Switch AP's PHY to 11g.
  AP will panick (long slot time STA count is zero, while there is a
  long slot time STA associated, in ieee80211_node_leave_11g()).  The
  assertion fails, because 802.11 state machine is doing its clean up
  as if AP were using 11g PHY, but it actually used 11b PHY.

16 years ago- Don't disable interrupt in bge_intr(), just acknowledge it. This avoids
Sepherosa Ziehau [Thu, 26 Apr 2007 11:58:10 +0000 (11:58 +0000)]
- Don't disable interrupt in bge_intr(), just acknowledge it.  This avoids
  potential lose of interrupt when interrupt gets re-enabled, since writing
  to BGE_MBX_IRQ0_LO also serves as interrupt acknowledgment.
- Move interrupt acknowledgment before reading status block.  This lets us
  read the correct/complete status block.
- Reset ifnet.if_timer, only if there is nothing pending to be TXed.

Obtained-from: FreeBSD (bde@freebsd.org)

16 years agoAdd a manual page explaining the format of /etc/manpath.config.
Sascha Wildner [Thu, 26 Apr 2007 08:35:52 +0000 (08:35 +0000)]
Add a manual page explaining the format of /etc/manpath.config.

16 years agoSort alphabetically.
Sascha Wildner [Thu, 26 Apr 2007 08:33:24 +0000 (08:33 +0000)]
Sort alphabetically.

16 years agoRevert my previous commit to nrelease/Makefile and add /usr/local/share/man
Sascha Wildner [Thu, 26 Apr 2007 08:25:41 +0000 (08:25 +0000)]
Revert my previous commit to nrelease/Makefile and add /usr/local/share/man
to manpath.config.

Requested-by: dillon
16 years agoEnable manpath(1) to map more than one man dir to a bin dir.
Sascha Wildner [Thu, 26 Apr 2007 08:17:54 +0000 (08:17 +0000)]
Enable manpath(1) to map more than one man dir to a bin dir.

16 years agoMove syslink_desc to sys/syslink_rpc.h so kernel code does not need
Matthew Dillon [Thu, 26 Apr 2007 02:11:00 +0000 (02:11 +0000)]
Move syslink_desc to sys/syslink_rpc.h so kernel code does not need
to #include sys/syslink.h.  Add a kernel config option 'SYSLINK' to build
with kern_syslink.c, so it can be worked on (read: broken) without
interfering with other developer's kernel builds.  Add a shims file for
the syslink() system call for kernels not built with kern_syslink.c.  The
shims file can be used generally for this purpose.

16 years agoIPV6 type 0 route headers are a flawed design, insecure by default, and
Matthew Dillon [Wed, 25 Apr 2007 21:55:33 +0000 (21:55 +0000)]
IPV6 type 0 route headers are a flawed design, insecure by default, and
open hosts and networks up to DOS attacks by allowing normal router IP
filtering to be bypassed.  Disable them by default.

Submitted-by: Hasso Tepper <hasso@estpak.ee>
Obtained-from: OpenBSD

16 years agostyle(9) cleanup: Remove parameter names from prototypes.
Sascha Wildner [Wed, 25 Apr 2007 11:45:28 +0000 (11:45 +0000)]
style(9) cleanup: Remove parameter names from prototypes.

Submitted-by: Hasso Tepper <hasso@estpak.ee>
16 years agoUse .Nm
Sascha Wildner [Wed, 25 Apr 2007 09:35:31 +0000 (09:35 +0000)]
Use .Nm

16 years agoCreate a symbolic link /usr/local/share/man -> /usr/local/man because
Sascha Wildner [Wed, 25 Apr 2007 09:22:06 +0000 (09:22 +0000)]
Create a symbolic link /usr/local/share/man -> /usr/local/man because
apparently stuff using autotools prefers to install its manual pages
in this location.

Observed-and-suggested-by: Hasso Tepper <hasso@estpak.ee>
16 years agoUse .Fn instead of .Xr.
Sascha Wildner [Wed, 25 Apr 2007 08:13:36 +0000 (08:13 +0000)]
Use .Fn instead of .Xr.

16 years ago- Cleanup header file inclusion.
Sepherosa Ziehau [Tue, 24 Apr 2007 11:06:47 +0000 (11:06 +0000)]
- Cleanup header file inclusion.
- Nuke no longer needed functions.
- Nuke no longer needed fields in bge_softc.

16 years agoCorrect hardware csum offload support for bge(4)
Sepherosa Ziehau [Mon, 23 Apr 2007 15:14:37 +0000 (15:14 +0000)]
Correct hardware csum offload support for bge(4)

Obtained-from: FreeBSD (w/ modification)

16 years agoMention wlan_ratectl_{onoe,sample}
Sepherosa Ziehau [Mon, 23 Apr 2007 13:15:57 +0000 (13:15 +0000)]
Mention wlan_ratectl_{onoe,sample}

Reminded-by: swildner@
16 years agoNuke unnecessary setting of ural(4)'s security registers. ural(4) only
Sepherosa Ziehau [Mon, 23 Apr 2007 12:35:03 +0000 (12:35 +0000)]
Nuke unnecessary setting of ural(4)'s security registers.  ural(4) only
supports software encrypt/decrypt.  The nuked code itself is quite
problematic, as pointed out by Sam Leffler -- wk->wk_keyix should be
replaced by the loop count.

Noticed-by: Hans Petter Selasky <hselasky@c2i.net>
17 years agoAdd support for generic prosigns by enabling ligatures.
Simon Schubert [Sun, 22 Apr 2007 23:03:48 +0000 (23:03 +0000)]
Add support for generic prosigns by enabling ligatures.

A ligature can be created by putting the letters in angle brackets, like `<KA>'.

17 years agoAdd the possibility to dump the generated audio to a file instead of playing it.
Simon Schubert [Sun, 22 Apr 2007 22:04:20 +0000 (22:04 +0000)]
Add the possibility to dump the generated audio to a file instead of playing it.

This can be used to create morse mp3s from input texts, like this:

morse -o | lame -r -s 44.1 -x -m m --resample 11 - morse.mp3

Add a comment on the timing calculation.

17 years agoProperly use .Cd
Sascha Wildner [Sun, 22 Apr 2007 20:40:20 +0000 (20:40 +0000)]
Properly use .Cd

17 years agoFix function name.
Sascha Wildner [Sun, 22 Apr 2007 16:29:50 +0000 (16:29 +0000)]
Fix function name.

17 years agoTurn off Sample TX rate control algorithm support for 2661d BBP. Due to
Sepherosa Ziehau [Sun, 22 Apr 2007 11:44:56 +0000 (11:44 +0000)]
Turn off Sample TX rate control algorithm support for 2661d BBP.  Due to
delayed/batched TX status report, Sample does not play well with this kind
of BBP.  Use Onoe TX rate control algorithm for 2661d BBP.

17 years agoPut a DELAY in the AT-style keyboard detection loop to wait
YONETANI Tomokazu [Sun, 22 Apr 2007 10:54:43 +0000 (10:54 +0000)]
Put a DELAY in the AT-style keyboard detection loop to wait
certain amount of time without relying on ISA bus timing.

Suggested-by: Matt
DragonFly-Bug: http://bugs.dragonflybsd.org/issue573

17 years agoWhen enabling A20, put upper limit on amount of time we wait for the
YONETANI Tomokazu [Sun, 22 Apr 2007 10:43:00 +0000 (10:43 +0000)]
When enabling A20, put upper limit on amount of time we wait for the
keyboard controller to get ready (65K x ISA access time, visually
around 1 second).  If we have wait more than that amount it's likely
that the hardware is a legacy-free one and simply doesn't have keyboard
controller and doesn't require enabling A20 at all.

Taken-from: FreeBSD (with modifications suggested by Matt)

 relavant commit logs(and discussion):
  http://docs.FreeBSD.org/cgi/mid.cgi?200604110439.k3B4dTOD072774
  http://docs.FreeBSD.org/cgi/mid.cgi?200604112053.k3BKrnC1053262
  http://docs.FreeBSD.org/cgi/mid.cgi?200604260605.k3Q65GZZ095546

17 years agoPull morse(6) into the new millenium and teach it to use sound(4).
Simon Schubert [Sun, 22 Apr 2007 10:22:32 +0000 (10:22 +0000)]
Pull morse(6) into the new millenium and teach it to use sound(4).

Feedback-by: swildner@
17 years ago- Define macro for the number of channels. Use it instead of the magic
Sepherosa Ziehau [Sun, 22 Apr 2007 09:14:46 +0000 (09:14 +0000)]
- Define macro for the number of channels.  Use it instead of the magic
  number.
- Define maximum and default channel TX power.
- The EEPROM regions, which contain 5GHz and 2GHz channels' TX power, are
  not contiguous.  Add rt2661_read_txpower_config() to read them seperately.
- Lower channel's TX power is in the lower byte of the 16bits EEPROM value,
  while upper channel's TX power is in the upper byte of the 16bits EEPROM
  value.
- Channel's TX power should never exceed maximum channel TX power, if it is
  set it to default channel TX power.
- Rename rt2661_read_eeprom() to rt2661_read_config(), since we already have
  rt2661_eeprom_read().

EEPROM layout, EEPROM values' layout and various limit values are obtained
from Ralink RT61 Linux driver.

17 years agoFix typo and use section numbers for .Xr.
Sascha Wildner [Sun, 22 Apr 2007 07:57:31 +0000 (07:57 +0000)]
Fix typo and use section numbers for .Xr.

17 years agoTXRX_CSR5 stores allowable ACK rates instead of basic rates, so rename
Sepherosa Ziehau [Sun, 22 Apr 2007 05:18:38 +0000 (05:18 +0000)]
TXRX_CSR5 stores allowable ACK rates instead of basic rates, so rename
rt2661_set_basicrates() to rt2661_set_ackrates().  Also turn on 6Mbits/s,
12Mbits/s and 24Mbits/s in ACK rates, if we are not forced to be in 11b
mode and to start/join an ERP BSS.  Now rt2661 part will send ACK at
24Mbits/s instead of 6Mbits/s, if the data to be acknowledged are sent at
rate above/equal 24Mbits/s, which is standard conforming and improves
performance a bit.

# This problem is identified by running following command on any NIC
# that can capture control frames and is aware of ERP:
#   tcpdump -ni iface -y ieee802_11_radio not wlan type mgt
# Pay attention to the rate, at which ACK gets sent ;]

17 years agoConst-fy rate set argument of ieee80211_iserp_rateset().
Sepherosa Ziehau [Sun, 22 Apr 2007 04:35:12 +0000 (04:35 +0000)]
Const-fy rate set argument of ieee80211_iserp_rateset().

17 years agoBusdma(9)-fy, mainly obtained from FreeBSD:
Sepherosa Ziehau [Sun, 22 Apr 2007 04:16:26 +0000 (04:16 +0000)]
Busdma(9)-fy, mainly obtained from FreeBSD:
if_bge.c rev 1.{45,76,81,85,101,105,106,109,151}
if_bgereg.h rev 1.{19,40}

Local changes:
- Factor out bge_dma_block_{alloc,free}() to avoid code duplication.
- Move jumbo buffer pool allocation/free into bge_dma_{alloc,free}().
- In bge_newbuf_std(), use bus_dmamap_load_mbuf() instead of bus_dmamap_load().
- Nuke vm header files inclusion.
- In bge_start():
  o   Bail out if OACTIVE is turned on or if bge(4) is not running yet.
  o   Move ifq_dequeue() before bge_encap(), since m_defrag() in bge_encap()
      will trash the mbuf parameter passed in.
  o   Make sure there are enough TX descriptors, before dequeuing mbuf and
      calling bge_encap().
- Don't call ifnet.if_start() on very interrupt, but at the end of bge_txeof().
- In bge_txeof(), if there are not enough TX descriptors, then don't clear
  OACTIVE.
- Minor style changes.

17 years agosbappendcontrol() was improperly setting sb_lastmbuf, creating a possible
Matthew Dillon [Sun, 22 Apr 2007 04:08:59 +0000 (04:08 +0000)]
sbappendcontrol() was improperly setting sb_lastmbuf, creating a possible
mbuf leak and/or sb_cc count mismatch.  The passed mbuf 'm' is a chain,
not a single mbuf, and must be iterated through to locate the last mbuf.

Optimize sbappend().  M_EOR is always set in the last mbuf and the sockbuf's
sb_lastmbuf and sb_lastrecord fields can be used instead of iterating
through all the mbufs in the sockbuf.  Only UNIX domain stream sockets used
this function.  Normal TCP connections use the already-optimized
sbappendstream() call.

Properly propogate M_EOR in sbappendcontrol() and sbappendaddr().

Do various code and comment cleanups.

17 years agoSync netstat up to the sockbuf changes.
Matthew Dillon [Sun, 22 Apr 2007 01:25:04 +0000 (01:25 +0000)]
Sync netstat up to the sockbuf changes.

17 years agoGive the sockbuf structure its own header file and supporting source file.
Matthew Dillon [Sun, 22 Apr 2007 01:13:17 +0000 (01:13 +0000)]
Give the sockbuf structure its own header file and supporting source file.
Move all sockbuf-specific functions from kern/uipc_socket2.c into the new
kern/uipc_sockbuf.c and move all the sockbuf-specific structures from
sys/socketvar.h to sys/sockbuf.h.

Change the sockbuf structure to only contain those fields required to
properly management a chain of mbufs.  Create a signalsockbuf structure
to hold the remaining fields (e.g. selinfo, mbmax, etc).

Change the so_rcv and so_snd structures in the struct socket from
a sockbuf to a signalsockbuf.

Remove the recently added sorecv_direct structure which was being used
to provide a direct mbuf path to consumers for socket I/O.  Use the newly
revamped sockbuf base structure instead.  This gives mbuf consumers
direct access to the sockbuf API functions for use outside of a struct
socket.  This will also allow new API functions to be added to the sockbuf
interface to ease the job of parsing data out of chained mbufs.

17 years agoJust throw all the main arguments for syslink() into syslink_info and
Matthew Dillon [Sun, 22 Apr 2007 00:59:27 +0000 (00:59 +0000)]
Just throw all the main arguments for syslink() into syslink_info and
pass the structure.  Do not pass the descriptor separately, do not pass
a pointer to the structure size (just pass the size directly).  The
search routines just return one structure at a time so a return size
field is not needed.

Start revamping syslink() to make it more mbuf-centric.  This work is
very much still in progress.

17 years agoDon't use .Xr for pathnames.
Sascha Wildner [Sat, 21 Apr 2007 22:42:22 +0000 (22:42 +0000)]
Don't use .Xr for pathnames.

17 years agoMerge from vendor branch TNFTP:
Peter Avalos [Sat, 21 Apr 2007 20:18:21 +0000 (20:18 +0000)]
Merge from vendor branch TNFTP:
Sync with NetBSD.  In addition to some bug fixes, this brings in -s srcaddr
functionality -- using srcaddr as the local IP address for the connection.

17 years agoSync with NetBSD. In addition to some bug fixes, this brings in -s srcaddr
Peter Avalos [Sat, 21 Apr 2007 20:18:21 +0000 (20:18 +0000)]
Sync with NetBSD.  In addition to some bug fixes, this brings in -s srcaddr
functionality -- using srcaddr as the local IP address for the connection.

17 years agoFix a memory leak in the uname/gname lookup cache.
Peter Avalos [Sat, 21 Apr 2007 17:44:12 +0000 (17:44 +0000)]
Fix a memory leak in the uname/gname lookup cache.

Obtained-from:  FreeBSD

17 years agoRemove argument to .Os.
Sascha Wildner [Sat, 21 Apr 2007 15:34:26 +0000 (15:34 +0000)]
Remove argument to .Os.

17 years agoBump .Dd for the -L option and add -L to the SYNOPSIS.
Sascha Wildner [Sat, 21 Apr 2007 15:25:18 +0000 (15:25 +0000)]
Bump .Dd for the -L option and add -L to the SYNOPSIS.

17 years agoConvert all pr_usrreqs structure initializations to the .name = data format.
Matthew Dillon [Sat, 21 Apr 2007 02:26:48 +0000 (02:26 +0000)]
Convert all pr_usrreqs structure initializations to the .name = data format.

17 years agoMake 'last mounted on' reporting by fsck work again. Add a new option
Matthew Dillon [Fri, 20 Apr 2007 22:20:12 +0000 (22:20 +0000)]
Make 'last mounted on' reporting by fsck work again.  Add a new option
to fsck (-L) which dumps the last mounted on field.

Submitted-by: Dave Hayes <dave@jetcafe.org>
17 years agoCreate the right symlinks for libpthread.so.0.
Simon Schubert [Fri, 20 Apr 2007 20:36:34 +0000 (20:36 +0000)]
Create the right symlinks for libpthread.so.0.

Submitted-by: Hasso Tepper <hasso@estpak.ee>
17 years agoFix link names with $DESTDIR.
Sascha Wildner [Fri, 20 Apr 2007 11:00:56 +0000 (11:00 +0000)]
Fix link names with $DESTDIR.

17 years ago1) Remove redundant -print's in EXAMPLES.
Sascha Wildner [Fri, 20 Apr 2007 08:04:20 +0000 (08:04 +0000)]
1) Remove redundant -print's in EXAMPLES.

2) Remove ports specific example.

[2] Spotted-by: Trevor Kendall <trevorjkendall@gmail.com>

17 years agoAdd a DEVICES section and vkd(4)/vke(4) MLINKS.
Sascha Wildner [Fri, 20 Apr 2007 07:04:09 +0000 (07:04 +0000)]
Add a DEVICES section and vkd(4)/vke(4) MLINKS.

17 years agoMake hw.vkeX.tap_unit sysctl read only.
Sascha Wildner [Fri, 20 Apr 2007 06:24:42 +0000 (06:24 +0000)]
Make hw.vkeX.tap_unit sysctl read only.

17 years agoClean up the so_pru_soreceive() API a bit to make it easier to read
Matthew Dillon [Fri, 20 Apr 2007 05:42:25 +0000 (05:42 +0000)]
Clean up the so_pru_soreceive() API a bit to make it easier to read
mbuf chains without having to use a fake UIO.

17 years agoWe have a few generation sets for Red-Black trees that implement RLOOKUP
Matthew Dillon [Thu, 19 Apr 2007 19:06:01 +0000 (19:06 +0000)]
We have a few generation sets for Red-Black trees that implement RLOOKUP
(ranged-lookup) for fixed numeric fields.  Add another one implementing
a generic RLOOKUP where the comparison function is passed to the generator.

17 years agoError out when parsing invalid IPv6 addresses.
Simon Schubert [Thu, 19 Apr 2007 12:52:29 +0000 (12:52 +0000)]
Error out when parsing invalid IPv6 addresses.

Submitted-by: Tatsuya BIZENN <bizenn@visha.org>
Obtained-from: NetBSD (supposedly)
DragonFly-Bug: http://bugs.dragonflybsd.org/issue591

17 years agoAllocations of size greater then the radix were not returning the correct
Matthew Dillon [Thu, 19 Apr 2007 03:16:33 +0000 (03:16 +0000)]
Allocations of size greater then the radix were not returning the correct
starting block.  For example, the second allocation of 32 blocks was returning
block 1 instead of block 32.

Also remove a redundant check in the code that was wasting cycles.

Submitted-by: Jason Smethers <jason@smethers.net>
17 years agoRemove 'register'.
Sascha Wildner [Wed, 18 Apr 2007 18:39:11 +0000 (18:39 +0000)]
Remove 'register'.

17 years agoAnsify parameter declarations and fix minor style issues.
Sascha Wildner [Wed, 18 Apr 2007 18:32:12 +0000 (18:32 +0000)]
Ansify parameter declarations and fix minor style issues.

17 years agoBuild libc_r before other libs, particularly before libpthread.
Simon Schubert [Tue, 17 Apr 2007 23:20:54 +0000 (23:20 +0000)]
Build libc_r before other libs, particularly before libpthread.

Fixes world breakage reported by tuxillo, aggelos and chlamydia.

17 years agoPoint P_tmpdir to /tmp instead of /var/tmp.
Simon Schubert [Tue, 17 Apr 2007 22:25:45 +0000 (22:25 +0000)]
Point P_tmpdir to /tmp instead of /var/tmp.

Temp files are much better of placed in /tmp than in the not-so-volatile
/var/tmp.  Additionally, people might get space issues or might have tuned
their /tmp for speed, but not /var/tmp.

Libiberty, among other consumers is using P_tmpdir to place the temp files,
leading compiler temp files being created in /var/tmp.

17 years agoDon't allow snd_nxt to be set to a value less then snd_una when restoring
Matthew Dillon [Tue, 17 Apr 2007 17:28:04 +0000 (17:28 +0000)]
Don't allow snd_nxt to be set to a value less then snd_una when restoring
snd_nxt in the TCP limited transmit code.  This can occur if the code
blocks and acks are processed prior to restoration.

This bug fix is currently unverified.  The possible trigger is running
netstat -an on a machine very heavily loaded with 6000+ network connections.

Reported-by: Peter Avalos <pavalos@theshell.com>
17 years agoAdd a proxy libpthread.
Simon Schubert [Tue, 17 Apr 2007 12:34:07 +0000 (12:34 +0000)]
Add a proxy libpthread.

In short, it works like this:  ld uses libpthread.so when linking.  There
the SONAME is set to libpthread.so.0.  This however is a symlink (or maybe
varsymlink) to one of the threading libs.  Voila, threading libs can be
switched at execution time and we won't get breakage because of two different
threading libs being used in the same binary.

Idea-by: joerg and me.
17 years agoChange the compilers to alias -pthread to -lpthread.
Simon Schubert [Tue, 17 Apr 2007 12:18:37 +0000 (12:18 +0000)]
Change the compilers to alias -pthread to -lpthread.

Now threaded programs do not get linked to libc_r anymore, but to the
proxy lib libpthread.  As soon as all programs and libraries are relinked
to use libpthread exclusively (and not libc_r.so anymore), threading libs
can be switched by changing the /usr/lib/libpthread.so.0 symlink.

Use the following command to find all packages still linking to libc_r:

find /usr/pkg/bin /usr/pkg/sbin /usr/pkg/lib /usr/pkg/libexec -type f \
  -exec sh -c '\
    objdump -p $0 2>/dev/null | grep -q "NEEDED.*libc_r\.so" || exit 0; \
    pkg_info -F -e $0' {} \; | sort | uniq

17 years agoProbably the last change to the syslink() system call. Allow a generic
Matthew Dillon [Mon, 16 Apr 2007 17:40:16 +0000 (17:40 +0000)]
Probably the last change to the syslink() system call.  Allow a generic
structure to be passed and returned and revamp the command structure.

17 years agoBring in the skeleton infrastructure and manual page for the new syslink
Matthew Dillon [Mon, 16 Apr 2007 17:36:04 +0000 (17:36 +0000)]
Bring in the skeleton infrastructure and manual page for the new syslink
utility.

17 years agoExpose number of TX/RX descriptors through read-only sysctl hw.emX.{txd,rxd}.
Sepherosa Ziehau [Sun, 15 Apr 2007 12:50:49 +0000 (12:50 +0000)]
Expose number of TX/RX descriptors through read-only sysctl hw.emX.{txd,rxd}.

Submitted-by: Hasso Tepper <hasso@estpak.ee>
Approved-by: dillon@
17 years agoChange build infrastructure over to sendmail 8.14.1.
Gregory Neil Shapiro [Sat, 14 Apr 2007 17:43:48 +0000 (17:43 +0000)]
Change build infrastructure over to sendmail 8.14.1.

Note that mail filters (aka, milters) compiled against the libmilter
included in the base operating system should be recompiled.

17 years agoFor bge_rxeof(), return immediately if no RX descs need to be processed, this
Sepherosa Ziehau [Sat, 14 Apr 2007 05:14:40 +0000 (05:14 +0000)]
For bge_rxeof(), return immediately if no RX descs need to be processed, this
optimization avoids two unnecessary register accessing and increase performance
a lot.  Same optimization is applied to bge_txeof(), but it will not have
real effect until bge(4) uses busdma(4) (i.e. will avoid extra sync)

Obtained-from: FreeBSD (oleg@freebsd.org)

17 years ago- Return error if reading eeprom times out.
Sepherosa Ziehau [Sat, 14 Apr 2007 04:35:10 +0000 (04:35 +0000)]
- Return error if reading eeprom times out.
  Obtained-from: FreeBSD
- Strip extra blank lines in bge_attach().

17 years agoBGE_MBX_TX_HOST_PROD0_LO is write-only, avoid reading it.
Sepherosa Ziehau [Sat, 14 Apr 2007 04:22:14 +0000 (04:22 +0000)]
BGE_MBX_TX_HOST_PROD0_LO is write-only, avoid reading it.

Obtained-from: NetBSD via FreeBSD

17 years agoSwitch binutils default to 2.17 and remove old gcc2 code.
Simon Schubert [Fri, 13 Apr 2007 12:26:56 +0000 (12:26 +0000)]
Switch binutils default to 2.17 and remove old gcc2 code.

17 years agoHook binutils-2.17 into the build.
Simon Schubert [Fri, 13 Apr 2007 12:26:42 +0000 (12:26 +0000)]
Hook binutils-2.17 into the build.

17 years agoAdd build infrastructure for binutils-2.17.
Simon Schubert [Fri, 13 Apr 2007 12:24:33 +0000 (12:24 +0000)]
Add build infrastructure for binutils-2.17.