dragonfly.git
14 years agoDiscard accepted and pending connections after we detach the listen socket
Matthew Dillon [Wed, 11 Aug 2004 02:24:16 +0000 (02:24 +0000)]
Discard accepted and pending connections after we detach the listen socket
rather then before in order to be sure to catch any connections that occur
while we are attempting to detach the listen socket.

14 years agoPPP stupidly hardwires some flag constants that it 'steals' from the mbuf
Matthew Dillon [Tue, 10 Aug 2004 22:05:30 +0000 (22:05 +0000)]
PPP stupidly hardwires some flag constants that it 'steals' from the mbuf
structure.  We are now using the flag bits it stole, which resulted in
packets being dropped and other issues.

Having ppp use M_PROTOx flags rather then hardwired constants fixes the
problem.

Reported-by: Sarunas Vancevicius <vsarunas@eircom.net>
14 years agoFix gcc 3.4 build.
Eirik Nygaard [Tue, 10 Aug 2004 16:03:12 +0000 (16:03 +0000)]
Fix gcc 3.4 build.

Reported by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>

14 years agoYet another hack for x11/xorg-clients.
Joerg Sonnenberger [Tue, 10 Aug 2004 10:58:37 +0000 (10:58 +0000)]
Yet another hack for x11/xorg-clients.

14 years agoRemoved freebsd.mc line, added ports/arabic line as found in the FreeBSD
Justin C. Sherrill [Mon, 9 Aug 2004 20:55:19 +0000 (20:55 +0000)]
Removed freebsd.mc line, added ports/arabic line as found in the FreeBSD
version of refuse.  Synced refuse.README with FreeBSD version 1.1.2.11 too.

Suggested by: Adrian Nida <nida@musc.edu>

14 years agoBring in FreeBSD mount.c/1.58, original commit message:
Matthew Dillon [Mon, 9 Aug 2004 20:15:23 +0000 (20:15 +0000)]
Bring in FreeBSD mount.c/1.58, original commit message:
 date: 2004/01/07 05:37:56;  author: anholt;  state: Exp;  lines: +1 -1
 Allow trailing slashes for MNT_UPDATE case (mount -u), too.

 PR:             bin/59144
 Submitted by:   Stefan Farfeleder <stefan@fafoe.narf.at>

Suggested-by: Barry Bouwsma
14 years agoSynchronize syslogd with FreeBSD. Primarily syslogd.c/1.129. This primarily
Matthew Dillon [Mon, 9 Aug 2004 20:11:19 +0000 (20:11 +0000)]
Synchronize syslogd with FreeBSD.  Primarily syslogd.c/1.129.  This primarily
adds code to avoid fsync()ing the log file line-by-line when further input
from the pipe is pending.

The FreeBSD commit message for 1.129:
 date: 2004/07/04 19:13:58;  author: cperciva;  state: Exp;  lines: +25 -3
 Where syslogd would have fsync()ed a file in the past, instead set a flag
 FFLAG_NEEDSYNC and fsync the file when select() next returns zero.  This
 dramatically speeds up the process of logging large amounts of data, while
 leaving the essential semantics (that data can be expected to be on disk
 if we crash) unchanged.

 In my tests, this speeds up the rc phase of booting by 18-20%. [1]

Suggested-by: Barry Bouwsma
Source: FreeBSD

14 years agoMerge FreeBSD ip.c/1.101, commit message:
Matthew Dillon [Mon, 9 Aug 2004 19:54:36 +0000 (19:54 +0000)]
Merge FreeBSD ip.c/1.101, commit message:

Make getprotobynumber() calls in FilterCheck conditional on the log
levels by which they are used.  On a typical production setting (no
debug or filter logging) this will save an open/read/close system
call sequence per packet, approximately halving the system overhead
and reducing the overall overhead by 38%.

Suggested-by: Barry Bouwsma
14 years agoThe SF64-PCR card has no sound support but stupidly uses the same PCI id
Matthew Dillon [Mon, 9 Aug 2004 19:49:28 +0000 (19:49 +0000)]
The SF64-PCR card has no sound support but stupidly uses the same PCI id
as other cards.  The hack that was supposed to detect the lack of sound
support does not work, causing a number of other cards to improperly probe
as not having sound support.  so disable it for the moment.  People who
actually have this card will have to set I_HAVE_SF64_PCR in their
/etc/make.conf.

Source: Barry Bouwsma

14 years agoffs_dirpref() calculates dirsize = (fs->fs_avgfilesize * fs->fs_avgfpdir).
Matthew Dillon [Mon, 9 Aug 2004 19:41:04 +0000 (19:41 +0000)]
ffs_dirpref() calculates dirsize = (fs->fs_avgfilesize * fs->fs_avgfpdir).
However, these two paramters can be set by the sysop such that they easily
overflow a 32 bit integer.  Use 64 bit arithmatic to prevent the overflow
and special-case values > 0x7fffffff to simply set maxcontigdirs to 1 rather
then waste time doing further 64 bit arithmatic.

Note that NetBSD also changed 'cgsize' to a 64 bit integer, but fails to
properly cast at least one of the arguments in both the dirsize and cgsize
multiplication which means that the overflow bug in NetBSD has not actually
been fixed.

This patch does not change the cgsize calculation yet, it requires more
review.

Source: NetBSD ffs_alloc.c/1.74 from Barry Bouwsma of Tiengen.

14 years agoSince we are DragonFly we want to use the DragonFly version instead of the
Eirik Nygaard [Mon, 9 Aug 2004 15:06:44 +0000 (15:06 +0000)]
Since we are DragonFly we want to use the DragonFly version instead of the
FreeBSD one.

14 years agoSince we are DragonFly we want to use the DragonFly version instead of the
Eirik Nygaard [Mon, 9 Aug 2004 14:53:38 +0000 (14:53 +0000)]
Since we are DragonFly we want to use the DragonFly version instead of the
FreeBSD one.

14 years agoFix gcc 3.4 build.
Eirik Nygaard [Mon, 9 Aug 2004 14:47:54 +0000 (14:47 +0000)]
Fix gcc 3.4 build.
__FreeBSD_version is now not defined if __FreeBSD__ is not defined.

Reported by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de> and
             "Martin P. Hellwig" <mhellwig@xs4all.nl>

14 years agoFix gcc 3.4 build.
Eirik Nygaard [Mon, 9 Aug 2004 14:40:08 +0000 (14:40 +0000)]
Fix gcc 3.4 build.
__FreeBSD_version is now not defined if __FreeBSD__ is not defined.

Reported by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de> and
             "Martin P. Hellwig" <mhellwig@xs4all.nl>

14 years agoFix gcc 3.4 build.
Eirik Nygaard [Mon, 9 Aug 2004 13:55:35 +0000 (13:55 +0000)]
Fix gcc 3.4 build.
__FreeBSD_version is now not defined if __FreeBSD__ is not defined.

Reported by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de> and
             "Martin P. Hellwig" <mhellwig@xs4all.nl>

14 years agoDocument that there seems to be a problem with the syncer not running
David Rhodus [Mon, 9 Aug 2004 02:59:31 +0000 (02:59 +0000)]
Document that there seems to be a problem with the syncer not running
here and that we are using a work around. If a buffer won't flush after
6 attempts we allow the syncer to run to process any soft update
dependency lists.

14 years agoGet cosmetic changes out of the way before committing SACK.
Jeffrey Hsu [Sun, 8 Aug 2004 06:33:24 +0000 (06:33 +0000)]
Get cosmetic changes out of the way before committing SACK.

14 years agoAdd bzip2 to the bootstrap tools list. The compat libs (if enabled in
Matthew Dillon [Sun, 8 Aug 2004 03:21:59 +0000 (03:21 +0000)]
Add bzip2 to the bootstrap tools list.  The compat libs (if enabled in
make.conf) need it.

14 years agoImprove compatibility with older FreeBSD-4.x systems when cross-building
Matthew Dillon [Sat, 7 Aug 2004 21:38:16 +0000 (21:38 +0000)]
Improve compatibility with older FreeBSD-4.x systems when cross-building
the DragonFly world by having the bootstrap and build tools use the
bootstrap/buildtools binaries.  In particular, we need the -i option to
patch to work to properly build csh.

14 years agoDo not hack a #define __FreeBSD_version if __FreeBSD__ does not exist,
Matthew Dillon [Sat, 7 Aug 2004 21:22:25 +0000 (21:22 +0000)]
Do not hack a #define __FreeBSD_version if __FreeBSD__ does not exist,
to keep our gcc-3.4 builds freebsd-free.

Suggested-by: Richard Nyberg <rnyberg@it.su.se>
14 years agoRemove the unconditional timer_restore in the bios call path, it is
Matthew Dillon [Sat, 7 Aug 2004 03:42:37 +0000 (03:42 +0000)]
Remove the unconditional timer_restore in the bios call path, it is
creating more problems then it is solving.

14 years agoAdd an event handler to adjust the cpu throttle state automatically when
Matthew Dillon [Sat, 7 Aug 2004 00:59:53 +0000 (00:59 +0000)]
Add an event handler to adjust the cpu throttle state automatically when
power is disconnected and when power is reconnected.  See 'sysctl hw.acpi'.
The new sysctls are hw.acpi.cpu.performance_speed and
hw.acpi.cpu.economy_speed.

14 years agoCorrect an inaccuracy in disklabel(8)'s manual page: the default
Chris Pressey [Fri, 6 Aug 2004 22:49:41 +0000 (22:49 +0000)]
Correct an inaccuracy in disklabel(8)'s manual page: the default
fragment size for partitions over 1GB in size is 2048, not 4096.

14 years agoeventhandler_register() M_NOWAIT->M_INTWAIT.
Matthew Dillon [Fri, 6 Aug 2004 22:32:07 +0000 (22:32 +0000)]
eventhandler_register() M_NOWAIT->M_INTWAIT.

14 years agoGCC3.4's (default) unit-at-a-time optimization is incompatible with -mrtd.
Matthew Dillon [Fri, 6 Aug 2004 20:50:35 +0000 (20:50 +0000)]
GCC3.4's (default) unit-at-a-time optimization is incompatible with -mrtd.
Bad code (missing stack pops) will be produced.  See the assembly generated
for 'xputc' with -mrtd and unit-at-a-time enabled for an example of this.

GCC3.4's unit-at-a-time seems to cause other problems as well, specifically
in boot2, as yet not tracked down, so disable unit-at-a-time optimizations
for the boot code if the compiler is not GCC2.

14 years agomake the __asm for the pushfl fakery __volatile.
Matthew Dillon [Fri, 6 Aug 2004 20:48:36 +0000 (20:48 +0000)]
make the __asm for the pushfl fakery __volatile.

14 years agoUpgrade our CVS build from 1.12.8 to 1.12.9 to fix a number of pserver
Matthew Dillon [Tue, 3 Aug 2004 18:11:56 +0000 (18:11 +0000)]
Upgrade our CVS build from 1.12.8 to 1.12.9 to fix a number of pserver
and remote cvs (ssh based) related security holes.

From-Security-Advisory: http://security.e-matters.de/advisories/092004.html
Recommended-by: Oliver Eikemeier <eikemeier@fillmore-labs.com>
14 years agoMerge from vendor branch CVS:
Matthew Dillon [Tue, 3 Aug 2004 18:08:51 +0000 (18:08 +0000)]
Merge from vendor branch CVS:
Bring cvs-1.12.9 into the CVS repository

14 years agoBring cvs-1.12.9 into the CVS repository
Matthew Dillon [Tue, 3 Aug 2004 18:08:51 +0000 (18:08 +0000)]
Bring cvs-1.12.9 into the CVS repository

14 years agoAdd re(4) to LINT as well.
Joerg Sonnenberger [Tue, 3 Aug 2004 07:26:57 +0000 (07:26 +0000)]
Add re(4) to LINT as well.

14 years agoAdd re(4) to GENERIC.
Joerg Sonnenberger [Tue, 3 Aug 2004 07:16:14 +0000 (07:16 +0000)]
Add re(4) to GENERIC.

14 years agoFix bug with tracking the previous element in a list.
Jeffrey Hsu [Tue, 3 Aug 2004 01:59:58 +0000 (01:59 +0000)]
Fix bug with tracking the previous element in a list.

Found by: edrt@citiz.net
Submitted by: pavlin@icir.org

14 years agoThe obj hierarchy must be built before the ssh-etc target can be run
Matthew Dillon [Tue, 3 Aug 2004 01:32:15 +0000 (01:32 +0000)]
The obj hierarchy must be built before the ssh-etc target can be run
(e.g. when building in nrelease), otherwise the ssh_config patch will
attempt to write out into /usr/src.  /usr/src is allowed to be read-only
(e.g. NFS mounts of /usr/src) so this doesn't work particularly well without
an obj hierarchy.

14 years agoThe TCP stack is notified every time userland reads from the TCP socket
Matthew Dillon [Tue, 3 Aug 2004 00:25:54 +0000 (00:25 +0000)]
The TCP stack is notified every time userland reads from the TCP socket
buffer, because a pure-window-update ACK might be required.  The previous
code would send a pure window update once the difference between the last
advertised window and the current window exceeded 2 segments and also when it
exceeded 1/2 the high water mark.

On GigE networks this can cause a pure window update to occur once every
8 packets (resulting in 5 acks instead of 4) prior to the TCP t_outputq
commit and once every 8 packets (resulting in 2 acks instead of 1) after
the TCP t_outputq commit.  So on a GigE network servicing a high performance
TCP stream, the result is double the number of acks that are actually
necessary.

Conditionalize the 2 segment test with a sysctl.  The sysctl is
net.inet.tcp.avoid_pure_win_update and is set to 1 by default, meaning
that the 2 segment ack does NOT occur (i.e. we should get higher
performance).  It may be turned off to revert to the prior two-ack
algorithm.

This code is considered experimental but since it involves only a pure
window update and we still have the catch-all case this commit is enabling
the new algorithm.  Further tuning might be required, possibly reducing the
1/2 hiwat test to 1/3 or 1/4 hiwat.

Ideally we want to avoid pure window update acks entirely in the normal
streaming case, which means we want to have a TCP buffer that is large
enough to pipeline the networked stream AND the process consuming the data.
On a GigE network this typically equates to the packet batching that occurs
per interrupt.  This batching is typically 8 1448 byte segments == ~11K,
plus turn around overhead and the 1/2 hiwat test so we want an incoming
socket buffer of at least ~11K * 2 + slop which should come to around ~32K
in order to avoid sending (unnecessary) pure window updates on a high
performance TCP stream.

14 years agotcp_input()'s DELAY_ACK() code checks to see if the delayed ack timer is
Matthew Dillon [Tue, 3 Aug 2004 00:04:13 +0000 (00:04 +0000)]
tcp_input()'s DELAY_ACK() code checks to see if the delayed ack timer is
running and if it is not it starts it and returns rather then issue an
ack.  If the timer is already running tcp_input() will generate an immediate
ack, resulting in one ack every other packet.  This every-other-packet ack
is usually required to ensure that the window does not close too much and
stall the sender, but it really only exists because the tcp stack does not
look ahead to see if there are other incoming packets that need to be
processed that might themselves require additional acks.  For optimal
operation we really want to process all the pending TCP packets for
the connection before sending any 'normal' acks.

Many ethernet interfaces, including and most especially GigE interfaces,
rate-limit their interrupts.  This results in several packets being moved
from the RX ring to the TCP/IP stack all at once, in a batch.

GIVE THE TCP stack its own netisr dispatcher loop rather then using the
generic netisr dispatcher loop.  The TCP dispatcher loop will call an
additional routine, tcp_willblock(), after all messages queued to the TCP
protocol stack have been exhausted.

When tcp_input() needs to send an ack in the normal header-prediction case
it now places the TCPCB on a queue rather then send an immediate ack.
tcp_willblock() processes this queue and calls tcp_output() to send the
actual ack.

The result is that on a GigE interface which typically queues 8+ packets
per interrupt, a TCP stream will only be acked once per ~8 packets rather
then 4 times (every other packet) per ~8 packets.  This *GREATLY* reduces TCP
protocol overhead and network ack traffic on both ends of the connection.

NOTE: a later commit will deal with pure window space updates which generate
an additional ACK per ~8 packets when the user program drains the buffer.

Reviewed-by: Jeffrey Hsu <hsu@crater.dragonflybsd.org>
14 years agoMake doubly sure that timer2 is not used for speaker operation.
Matthew Dillon [Mon, 2 Aug 2004 23:20:31 +0000 (23:20 +0000)]
Make doubly sure that timer2 is not used for speaker operation.

14 years agoRip out the badly designed softint-based taskqueue used by ACPI for callbacks.
Matthew Dillon [Mon, 2 Aug 2004 19:51:09 +0000 (19:51 +0000)]
Rip out the badly designed softint-based taskqueue used by ACPI for callbacks.
This was deadlocking tsleep() calls made from AcpiOsSleep() when early ACPI
interrupts occured, such as when a laptop is booted without AC connected.

Use a kernel thread and LWKT messaging to queue callbacks requests and add
code to use DELAY instead of tsleep() for calls made to AcpiOsSleep() in
early boot before the system timeout/ticks subsystem is initialized.

Fix two bugged AcpiOsSleep() calls that were sleeping for 10 seconds instead
of 10 milliseconds.

14 years agoAdd a global, clocks_running, which tells us when timeout/ticks based clocks
Matthew Dillon [Mon, 2 Aug 2004 19:36:27 +0000 (19:36 +0000)]
Add a global, clocks_running, which tells us when timeout/ticks based clocks
can be used.

14 years agotaskqueue_create() should use M_INTWAIT rather then M_NOWAIT.
Matthew Dillon [Mon, 2 Aug 2004 19:32:28 +0000 (19:32 +0000)]
taskqueue_create() should use M_INTWAIT rather then M_NOWAIT.

14 years agoFix buggaboos that prevented ACPI_DEBUG from working.
Matthew Dillon [Mon, 2 Aug 2004 18:41:50 +0000 (18:41 +0000)]
Fix buggaboos that prevented ACPI_DEBUG from working.

14 years agoRelease to correct ressource in re_detach, this is PCI_LOIO now.
Joerg Sonnenberger [Mon, 2 Aug 2004 15:10:08 +0000 (15:10 +0000)]
Release to correct ressource in re_detach, this is PCI_LOIO now.
Remove a RE_DESC_INC from re_rxeof, a left-over from the while loop.

14 years agoForced commit to annotate the (unrelated) changes from the last commit.
Joerg Sonnenberger [Mon, 2 Aug 2004 13:35:02 +0000 (13:35 +0000)]
Forced commit to annotate the (unrelated) changes from the last commit.

RealTek doesn't seem to support memory-mapped IO for re(4), the card
generates an interrupt storm under pretty low load. Therefore change
re(4) to the slower port-mapped IO.

14 years agoChange (almost) all references to tqh_first and tqe_next and tqe_prev
Joerg Sonnenberger [Mon, 2 Aug 2004 13:22:34 +0000 (13:22 +0000)]
Change (almost) all references to tqh_first and tqe_next and tqe_prev
to the correct TAILQ macros. Exceptions are contrib/ipfilter, which will
be handled separately, and dev/misc/labpc, which makes some very wiered
things and therefore needs much more care.

14 years agoSync with FreeBSD CURRENT (most white space cleanup and ordering).
Joerg Sonnenberger [Mon, 2 Aug 2004 11:21:57 +0000 (11:21 +0000)]
Sync with FreeBSD CURRENT (most white space cleanup and ordering).
Correct a typo in the bpcd entry.

14 years agoCorrect path location search when pulling packages from GoBSD.
David Rhodus [Sun, 1 Aug 2004 04:22:49 +0000 (04:22 +0000)]
Correct path location search when pulling packages from GoBSD.
We are currently not dealing with different package versioning to
system version numbering as there is currenly no need to.

Heads up from <kg245@bellsouth.net>

14 years agoMerge from vendor branch OPENSSH:
Scott Ullrich [Sat, 31 Jul 2004 20:05:00 +0000 (20:05 +0000)]
Merge from vendor branch OPENSSH:
Missing files from OpenSSH import

14 years agoMissing files from OpenSSH import
Scott Ullrich [Sat, 31 Jul 2004 20:05:00 +0000 (20:05 +0000)]
Missing files from OpenSSH import

14 years agoMissing files from OpenSSH import
Scott Ullrich [Sat, 31 Jul 2004 20:05:00 +0000 (20:05 +0000)]
Missing files from OpenSSH import

14 years agoMerge from vendor branch OPENSSH:
Scott Ullrich [Sat, 31 Jul 2004 19:49:08 +0000 (19:49 +0000)]
Merge from vendor branch OPENSSH:
Missing files during OpenSSH import.

14 years agoMissing files during OpenSSH import.
Scott Ullrich [Sat, 31 Jul 2004 19:49:08 +0000 (19:49 +0000)]
Missing files during OpenSSH import.

14 years agoUpdate mk files list with the current supplied one.
Jeroen Ruigrok/asmodai [Sat, 31 Jul 2004 19:29:24 +0000 (19:29 +0000)]
Update mk files list with the current supplied one.
NOTE: still missing descriptions.

14 years agoMissed file from OpenSSH import.
Scott Ullrich [Sat, 31 Jul 2004 19:21:59 +0000 (19:21 +0000)]
Missed file from OpenSSH import.

Noticed-by: Kim Culhan
14 years agoImport OpenSSH 3.8.1.p1 into base.
Scott Ullrich [Sat, 31 Jul 2004 19:03:00 +0000 (19:03 +0000)]
Import OpenSSH 3.8.1.p1 into base.

Patch-submitted-by: Simon 'corecode' Schubert
Reviewed-by: Chris Pressey
Parts-obtained-from: FreeBSD

14 years agoMerge from vendor branch OPENSSH:
Scott Ullrich [Sat, 31 Jul 2004 19:03:00 +0000 (19:03 +0000)]
Merge from vendor branch OPENSSH:
Import OpenSSH 3.8.1.p1 into base.

Patch-submitted-by: Simon 'corecode' Schubert
Reviewed-by: Chris Pressey
Parts-obtained-from: FreeBSD

14 years agoImport OpenSSH 3.8.1.p1 into base.
Scott Ullrich [Sat, 31 Jul 2004 19:03:02 +0000 (19:03 +0000)]
Import OpenSSH 3.8.1.p1 into base.

Patch-submitted-by: Simon 'corecode' Schubert
Reviewed-by: Chris Pressey
Parts-obtained-from: FreeBSD

14 years agoRemove local main() definition.
Eirik Nygaard [Sat, 31 Jul 2004 11:18:43 +0000 (11:18 +0000)]
Remove local main() definition.

14 years agoAdd WARNS?=6 and remove CFLAGS=.
Eirik Nygaard [Sat, 31 Jul 2004 10:23:11 +0000 (10:23 +0000)]
Add WARNS?=6 and remove CFLAGS=.
Add missing $DragonFly$ keyword.

14 years agoDon't depend on pollution in <limits.h> for the definition of <stdint.h> macros.
Eirik Nygaard [Sat, 31 Jul 2004 10:19:53 +0000 (10:19 +0000)]
Don't depend on pollution in <limits.h> for the definition of <stdint.h> macros.
Remove local prototype for main().

Submitted by: "Liam J. Foy" <liamfoy@sepulcrum.org>
Obtained from: FreeBSD

14 years agoSince mbufs are no longer limited by an mb_map the kern.ipc.nmbufs and
Matthew Dillon [Sat, 31 Jul 2004 07:58:23 +0000 (07:58 +0000)]
Since mbufs are no longer limited by an mb_map the kern.ipc.nmbufs and
kern.ipc.nmbclusters sysctls can be made writable.

14 years agoGet rid of mb_map. Retool the mbuf and mbuf cluster allocator to use
Matthew Dillon [Sat, 31 Jul 2004 07:52:58 +0000 (07:52 +0000)]
Get rid of mb_map.  Retool the mbuf and mbuf cluster allocator to use
malloc() (our slab allocator).  Get rid of the NULL callback function for
M_EXT buffers, assign real functions for standard M_EXT buffers and add
a new flag M_EXT_CLUSTER to tell the mbuf code when an M_EXT buffer is
under management by the mbuf cluster allocator.  Get rid of the address
calculations and the char array ref count that used to exist for mbuf
clusters.  Replace with a meta-data structure to keep track of ref
counts.  Note that the new cluster code uses the new M_EXT mechanism.

Increase the default mbuf+cluster pool from 10 to 20.  Add sysctl's to
set the mbuf and mbuf cluster free-pool maximums (kern.ipc.mcl_free_max and
kern.ipc.mbuf_free_max), beyond which mbuf and mbuf cluster memory is
returned to the system.

14 years agoChange sendfile() to use the new m_ext callback scheme for cleaning up after
Matthew Dillon [Fri, 30 Jul 2004 21:56:17 +0000 (21:56 +0000)]
Change sendfile() to use the new m_ext callback scheme for cleaning up after
SFBUF's.  Remove the sf_buf_tosf() function (a hack that existed only to
support sendfile()).

14 years agoBring in the latest pkg_install sources from FreeBSD-5.
Matthew Dillon [Fri, 30 Jul 2004 04:46:14 +0000 (04:46 +0000)]
Bring in the latest pkg_install sources from FreeBSD-5.

Note that the only substantive DragonFly changes, apart from adding our
CVS id and doing a few other cleanups, are in add/main.c:getpackagesite().

14 years agoAdd the ndiscvt utility from FreeBSD-5, which is used to compile windows
Matthew Dillon [Fri, 30 Jul 2004 00:24:24 +0000 (00:24 +0000)]
Add the ndiscvt utility from FreeBSD-5, which is used to compile windows
device drivers for NDIS.

14 years agoProvide some basic instructions on how to create an NDIS wireless driver
Matthew Dillon [Thu, 29 Jul 2004 21:51:55 +0000 (21:51 +0000)]
Provide some basic instructions on how to create an NDIS wireless driver
based on instructions I found on the net and my own playing around.

14 years agoFix more __stdcall issues. Move the __stdcall into the function typedefs
Matthew Dillon [Thu, 29 Jul 2004 21:35:57 +0000 (21:35 +0000)]
Fix more __stdcall issues.  Move the __stdcall into the function typedefs
themselves instead of specifying it later on when the function typedef is
declared.  This fixes a number of warnings plus it also fixes internal
compiler errors that occur with gcc-2.95.x.

14 years agoNDIS_INFO -> NDIS_LOCK_INFO
Matthew Dillon [Thu, 29 Jul 2004 21:07:32 +0000 (21:07 +0000)]
NDIS_INFO -> NDIS_LOCK_INFO

14 years agoGenerally speaking modules should unconditionally enable things like
Matthew Dillon [Thu, 29 Jul 2004 21:05:54 +0000 (21:05 +0000)]
Generally speaking modules should unconditionally enable things like
INET.  INET is not something developers usually set in /etc/make.conf.

Follow what other modules are doing and unconditionally #define INET and IPX.
This fixes an ARP problem with this module :-).

14 years agoBring in NDIS emulation support from FreeBSD-5. NDIS is a Windows device
Matthew Dillon [Thu, 29 Jul 2004 20:51:36 +0000 (20:51 +0000)]
Bring in NDIS emulation support from FreeBSD-5.  NDIS is a Windows device
driver API emulator.  The FreeBSD work was done by Bill Paul
<wpaul@windriver.com>, who has again proven himself to be a more insane
hacker then the rest of us.

Bring in IF_NDIS from FreeBSD-5.

Make a number of additional changes to the driver.  Windows API calls are not
compatible with standard gnu C.   The FreeBSD-5 NDIS code properly uses
__attribute__((__stdcall__)) to deal with the target-pops-argument-stack
issue but had terrible __asm hacks to deal with regargs.  Consolidate the
regargs support into a new header file, regcall.h, and use
__attribute__((__regparm__(3))) to formalize argument passing in registers.
Note that __regparm__(3) places three arguments in registers in the
following order: %eax, %edx, %ecx, but Windoz reg calls place registered
arguments in %ecx and %edx (and additional arguments go on the stack).
regcall.h provides macros to do the proper (I hope) translations.

DragonFly's kernel threads do not have proc structures.  Convert up all the
proc references to thread references.

Convert mutex ops into token ops.

Fix a number of prototypes, including one that was causing an internal
compiler error in gcc2.

Testing: Doesn't crash with Sony-TR3A Intel Centrino 2200 based wireless
chipset, is able to DHCP up the IP address, but cannot yet ping due
to an issue in the ARP code somewhere.
Taken from: FreeBSD-5 / Bill Paul

14 years agoSync the IFM_MAKEMODE() macro from FreeBSD-5.
Matthew Dillon [Thu, 29 Jul 2004 20:34:29 +0000 (20:34 +0000)]
Sync the IFM_MAKEMODE() macro from FreeBSD-5.

14 years agoWork to allow pure threads to issue VFS lookups: (untested/experimental)
Matthew Dillon [Thu, 29 Jul 2004 20:34:09 +0000 (20:34 +0000)]
Work to allow pure threads to issue VFS lookups:  (untested/experimental)
Use the rootvnode as the basis for searches initiated from pure threads
since no proc or fdp structure exists.

14 years agoWork to allow pure threads to issue VFS lookups: fp_open() uses proc0's
Matthew Dillon [Thu, 29 Jul 2004 20:32:59 +0000 (20:32 +0000)]
Work to allow pure threads to issue VFS lookups:  fp_open() uses proc0's
ucred if called from a pure thread.

14 years agoWork to allow pure threads to issue VFS lookups: Only check p->p_ucred
Matthew Dillon [Thu, 29 Jul 2004 20:32:24 +0000 (20:32 +0000)]
Work to allow pure threads to issue VFS lookups:  Only check p->p_ucred
if p is not NULL.

14 years agoAdd a test-and-set and release poll function. This is really just a hack
Matthew Dillon [Thu, 29 Jul 2004 20:31:13 +0000 (20:31 +0000)]
Add a test-and-set and release poll function.  This is really just a hack
to support NDIS emulation.

14 years agoRemove a recently added incorrect assertion. I was assuming that
Matthew Dillon [Thu, 29 Jul 2004 20:30:32 +0000 (20:30 +0000)]
Remove a recently added incorrect assertion.  I was assuming that
pmap_init_thread() was only being called for processes but it is called
for both processes and threads.

14 years agoadd the 'y' and 'Y' options to ps, and add the 'iac' keyword. The 'y'
Matthew Dillon [Thu, 29 Jul 2004 09:20:39 +0000 (09:20 +0000)]
add the 'y' and 'Y' options to ps, and add the 'iac' keyword.  The 'y'
option and 'iac' keyword displays the interactive heuristic calcualtion.
It is a value between -127 and 127 where lower numbers indicate more
interactive and higher numbers indicate more batch-like.

14 years agoMove kthread_create() from lwkt_thread.c to kern_kthread.c. Add a new
Matthew Dillon [Thu, 29 Jul 2004 09:02:33 +0000 (09:02 +0000)]
Move kthread_create() from lwkt_thread.c to kern_kthread.c.  Add a new
api function, kthread_create_stk(), which allows a custom stack size to be
specified.

14 years agoAdd LWKT convenience functions lwkt_getpri() and lwkt_getpri_self().
Matthew Dillon [Thu, 29 Jul 2004 08:55:48 +0000 (08:55 +0000)]
Add LWKT convenience functions lwkt_getpri() and lwkt_getpri_self().

14 years agoAdd a stack-size argument to the LWKT threading code so threads can be
Matthew Dillon [Thu, 29 Jul 2004 08:55:02 +0000 (08:55 +0000)]
Add a stack-size argument to the LWKT threading code so threads can be
created with different-sized stacks.  Adjust libcaps to match.

This is a pre-requisit to adding NDIS support.  NDIS threads need larger
stacks because microsoft drivers expect larger stacks.

14 years agoImplement a kernel strdup() function (API synch with FreeBSD).
Matthew Dillon [Thu, 29 Jul 2004 08:50:09 +0000 (08:50 +0000)]
Implement a kernel strdup() function (API synch with FreeBSD).

14 years agoStage 1/many: mbuf/cluster accounting rewrite and mbuf allocator rewrite.
Matthew Dillon [Thu, 29 Jul 2004 08:46:23 +0000 (08:46 +0000)]
Stage 1/many: mbuf/cluster accounting rewrite and mbuf allocator rewrite.

Implement 'new' style mbuf m_ext buffers where the callbacks are called with
a custom argument instead of with (buf, size).  Old style m_ext buffers have
to jump through loops to properly track reference counters in a manner that
is tightly integrated with the old mbuf/cluster KVA allocation array.

The old clustering methodology is going to have to be converted to the new
methodology before we can rip out the old mbuf allocator, plus we want to
use the new mechanism anyway because it is a whole lot cleaner and because
it's easier to import driver code (aka NDIS) from FreeBSD-5 with the new
mechanism.

This commit still supports the old mechanism via M_EXT_OLD, and all
existing function-based M_EXT's have been converted to use M_EXT_OLD.  The
old mechanism (and M_EXT_OLD) will be removed in later stages.

14 years agoOutput a more descriptive error message when AGP can't bind memory.
Matthew Dillon [Thu, 29 Jul 2004 00:48:41 +0000 (00:48 +0000)]
Output a more descriptive error message when AGP can't bind memory.

14 years ago(From Alan):
Matthew Dillon [Wed, 28 Jul 2004 20:40:35 +0000 (20:40 +0000)]
(From Alan):
 Correct a very old error in both vm_object_madvise() (originating in
 vm/vm_object.c revision 1.88) and vm_object_sync() (originating in
 vm/vm_map.c revision 1.36): When descending a chain of backing objects,
 both use the wrong object's backing offset.  Consequently, both may
 operate on the wrong pages.

(From Matt):
 In DragonFly the code needing correction is in vm_object_madvise() and
 vm_map_clean() (that code in vm_map_clean() was moved to vm_object_sync()
 in FreebSD-5 hence the FreeBSD-5 correction made by Alan was slight
 different).

 The madvise case could produce corrupted user memory when MADV_FREE was
 used, primarily on server-forked processes (where shadow objects exist)
 PLUS a special set of additional circumstances:  (1) The deeper shadow
 layers had to no longer be shared, (2) Either the memory had been swapped
 out in deeper shadow layers (not just the first shadow layer), resulting
 in the wrong swap space being freed, or (2) the forked memory had not yet
 been COW'd (and the deeper shadow layer is no longer shared) AND also had
 not yet been collapsed backed into the parent (e.g.  the original parent
 and/or other forks had exited and/or the memory had been isolated from
 them already).

 This bug could be responsible for all of the sporatic madvise oddness
 that has been reported over the years, especially in earlier days when
 systems had less memory and paged to swap a lot more then they do today.
 These weird failure cases have led people to generally not use MADV_FREE
 (in particular the 'H' malloc.conf option) as much as they could.  Also
 note that I tightened up the VM object collapse code considerably in
 FreeBSD-4.x making the failure cases above even less likely to occur.

 The vm_map_clean() (vm_object_sync() in FreeBSD-5) case is not likely
 to produce failures and it might not even be possible for it to occur
 in the first place since it requires PROT_WRITE mapped vnodes to exist
 in a backing object, which either might not be possible or might only occur
 under extrodinary circumstances.  Plus the worst that happens is that the
 vnode's data doesn't get written out immediately (but always will later on).

 Kudos to Alan for finding this old bug!

Noticed and corrected by: Alan Cox <alc@cs.rice.edu>
See also: FreeBSD vm_object.c/1.329

14 years agoA cvsup file that pulls the "checked out" version of source. I'm referencing
Justin C. Sherrill [Wed, 28 Jul 2004 20:26:45 +0000 (20:26 +0000)]
A cvsup file that pulls the "checked out" version of source.  I'm referencing
this in documentation, as it's a simpler process than pulling CVS and checking
out a local copy as you have to do with 'DragonFly-supfile'.

Approved-by: Matthew Dillon
14 years agoChange the default syslogd flags from -s to -ss, which prevents a network
Matthew Dillon [Wed, 28 Jul 2004 17:55:46 +0000 (17:55 +0000)]
Change the default syslogd flags from -s to -ss, which prevents a network
socket from being opened at all.

Suggested-by: Ed <df@bsd.it>
14 years agoNTOHL / HTONL removal.
Joerg Sonnenberger [Wed, 28 Jul 2004 12:27:40 +0000 (12:27 +0000)]
NTOHL / HTONL removal.

14 years agoNTOHL(x) ==> x = ntohl(x)
Joerg Sonnenberger [Wed, 28 Jul 2004 12:07:49 +0000 (12:07 +0000)]
NTOHL(x) ==> x = ntohl(x)

14 years agoAdd IF_QLEN and the ALTQ macros. This are only the lock-free versions with
Joerg Sonnenberger [Wed, 28 Jul 2004 08:53:43 +0000 (08:53 +0000)]
Add IF_QLEN and the ALTQ macros. This are only the lock-free versions with
the underscore (_), since we want to protect the queues via normal splimp,
not via mutexes / tokens.

Obtained-from: FreeBSD

14 years agoAdd two more 802.11 media types.
Joerg Sonnenberger [Wed, 28 Jul 2004 08:47:55 +0000 (08:47 +0000)]
Add two more 802.11 media types.

Obtained-from: FreeBSD

14 years agoSync with FreeBSD CURRENT.
Joerg Sonnenberger [Wed, 28 Jul 2004 08:38:33 +0000 (08:38 +0000)]
Sync with FreeBSD CURRENT.
Important changes:
- Ignore EINVAL from wi_getval for optional values to increase support for
  different drivers.
- Generally improved error handling.
- Better output and support for the generic 802.11 layer.
- Warnings output deprecated options which are supported by ifconfig,
  this will be removed at some time.

Additional changes:
- print "No stations" instead of "0 stations:"
- Remove 'Z', the zeroing of the signal cache is not supported by the
  newer driver versions anyway.
- Add WARNS?= 6 to Makefile.

14 years agoudev2dev() can return NODEV now, make sure it doesn't crash autoconf's
Matthew Dillon [Wed, 28 Jul 2004 06:04:41 +0000 (06:04 +0000)]
udev2dev() can return NODEV now, make sure it doesn't crash autoconf's
attempt to mount the root filesystem.

Crash reported by: =?ISO-8859-1?Q?Stefan_Kr=FCger?= <skrueger@meinberlikomm.de>

14 years agoDragonFly-ize pgrep/pkill:
Chris Pressey [Wed, 28 Jul 2004 02:51:06 +0000 (02:51 +0000)]
DragonFly-ize pgrep/pkill:

- Bump date in pkill.1 and refine the history of these utilities.
- Tailor pkill.c to the specifics of DragonFly's libkvm.
  This makes pkill.c buildable, and makes the resulting utilities
  capable of producing reasonable and seemingly correct output.

Much-assistance-by: hmp
14 years agoReadd the $DragonFly$ Id tag which I removed by mistake in previous
Hiten Pandya [Wed, 28 Jul 2004 00:49:54 +0000 (00:49 +0000)]
Readd the $DragonFly$ Id tag which I removed by mistake in previous
revision.

14 years agoImport from NetBSD: `pgrep' and `pkill' utilities for finding and
Chris Pressey [Wed, 28 Jul 2004 00:41:47 +0000 (00:41 +0000)]
Import from NetBSD: `pgrep' and `pkill' utilities for finding and
signalling processes by name.

This initial commit brings in the following files directly from
NetBSD, unchanged except for the addition of $DragonFly$ ID tags:

$NetBSD: Makefile,v 1.1 2002/03/01 11:21:58 ad Exp $
$NetBSD: pkill.1,v 1.8 2003/02/14 15:59:18 grant Exp $
$NetBSD: pkill.c,v 1.7 2004/02/15 17:03:30 soren Exp $

The next few commits will DragonFly-ize these files and hook them up
to the build.

Initially-requested-by: Munish Chopra <chopra at soulwax dot net>
Approved-by: dillon
14 years agoMajor cleanup of the base IPFilter:
Hiten Pandya [Wed, 28 Jul 2004 00:22:37 +0000 (00:22 +0000)]
Major cleanup of the base IPFilter:

o Vendor's ChangeLog available in src/contrib/ipfilter/HISTORY.

o Update kernel and userland to version 3.4.35, major changes:

    * only allow non-fragmented packets to influence whether or
      not a logged packet is the same as the one logged before.

    * block packets that fail to create stable entries.

    * correct the ICMP packet checksum fixing up when processing
      ICMP errors for NAT.

    * implement a maximum for the number of entries in the NAT
      table (NAT_TABLE_MAX and ipf_nattable_max).

    * frsynclist() wasn't paying attention to all places where
      interface names are, like it should.

    * fix comparison of ICMP packets with established TCP state
      where only 8 bytes of header are returned in the ICMP
      error.

o Following files were removed from under src/contrib/ipfilter,
  because they were redundant:

      fil.c ip_auth.c ip_auth.h ip_compat.h ip_fil.c ip_fil.h
      ip_frag.c ip_frag.h ip_ftp_pxy.c ip_log.c ip_nat.c
      ip_nat.h ip_proxy.c ip_proxy.h ip_raudio_pxy.c ip_rcmd_pxy.c
      ip_state.c ip_state.h ipl.h mlfk_ipl.c

o Cast interface numbers to u_int instead of u_char, so that
  big numbered units don't get truncated. More information on
  this problem can be found at FreeBSD GNATS, PR kern/64584.

o Compile INET6 support into ipfilter unless NOINET6 is defined
  as Make variable.

o Update $FreeBSD$ CVS ID tags.

o Adjust minor style(9) changes, like prototypes, etc.

Tested by David Rhodus, Chris Beuchler and Chris Pressey.

Reviewed-by: Darren Reed <darrenr@freebsd.org> (earlier version)
             Matthew Dillon <dillon@apollo.backplane.com>

14 years agorename functions that clash with reserved math procedures to avoid gcc3.4
Matthew Dillon [Tue, 27 Jul 2004 21:42:48 +0000 (21:42 +0000)]
rename functions that clash with reserved math procedures to avoid gcc3.4
built-in function conflicts.

14 years agorename exp() to expx() to avoid conflict with gcc-3.4 built-in.
Matthew Dillon [Tue, 27 Jul 2004 21:03:51 +0000 (21:03 +0000)]
rename exp() to expx() to avoid conflict with gcc-3.4 built-in.

14 years agoPatch out tcsh's use of 'exp2', which is math-reserved in gcc-3.4.
Matthew Dillon [Tue, 27 Jul 2004 21:01:44 +0000 (21:01 +0000)]
Patch out tcsh's use of 'exp2', which is math-reserved in gcc-3.4.

14 years agoBoot1 tries to clear boot2's BSS. It makes several assumptions that are
Matthew Dillon [Tue, 27 Jul 2004 19:37:19 +0000 (19:37 +0000)]
Boot1 tries to clear boot2's BSS.  It makes several assumptions that are
incorrect (or incorrect now), and doesn't really know how much BSS to clear
anyway.  Remove the BSS clearing code from boot1 and add BSS clearing code
to the boot2 (in particular, /usr/src/sys/boot/i386/btx/lib/btxcsu.S).

This should solve numerous issues including boot2 getting confused about
the default boot device file path.

Collapse some boot2 code to make it fit again.

Move the BOOT2 virtual origin (relative to the BTX client address space)
into bootasm.h, replace an undocumented hardwired BOOT2 origin calculation
(that was SIZ_PAG*2) with BOOT2_VORIGIN.   Replace the hardwired ORG2
constant in boot2's Makefile with code to pull BOOT2_VORIGIN out of the
header file.

14 years agoWe will need more resource-limiting compliance work done before these
David Rhodus [Tue, 27 Jul 2004 19:18:50 +0000 (19:18 +0000)]
We will need more resource-limiting compliance work done before these
interfaces can become POSIX compliant. Change back to old prototype.

14 years agoCorrect getpriority() and setpriority() function definitions to
David Rhodus [Tue, 27 Jul 2004 18:02:07 +0000 (18:02 +0000)]
Correct getpriority() and setpriority() function definitions to
match POSIX standard.