]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
18 years agoWhen bus_alloc_resource_any() fails, dc_detach() is called and it
keramida [Thu, 15 Sep 2005 17:51:39 +0000 (17:51 +0000)]
When bus_alloc_resource_any() fails, dc_detach() is called and it
attempts to deallocate busdma tags and resources that haven't been
allocated yet, causing a panic every time a dc interface fails to
attach.  Fix by checking that we really have something to dealloc
before calling bus_dma*() functions.

Approved by: jhb
MFC after: 1 week

18 years agoExplicitly switch to the new TSS by updating the current CPU's TSS selector
jhb [Thu, 15 Sep 2005 17:30:08 +0000 (17:30 +0000)]
Explicitly switch to the new TSS by updating the current CPU's TSS selector
and reloading it in i386_extend_pcb() rather than trying to force a context
switch to reload the TSS via the TDF_NEEDRESCHED flag.  Optimizations to
avoid calling cpu_switch() when the new thread was identical to the old
thread defeated the attempt to force a TSS reload.  Explicitly loading the
new TSS is what we really want to do anyway.

PR: i386/84842
Reported by: Alexander Best arundel at h3c dot de
MFC after: 1 week
Reviewed by: bde (mostly)

18 years agoCosmetic fixes to prev. commit.
ache [Thu, 15 Sep 2005 17:25:52 +0000 (17:25 +0000)]
Cosmetic fixes to prev. commit.
Change first MAXPATHLEN to more standard PATH_MAX
Change second MAXPATHLEN to 1024 (it is temp buffer not related)
Change comment to reflect that.

Suggested by:   bde

18 years ago- Fixup locking and mark MPSAFE.
jhb [Thu, 15 Sep 2005 17:12:29 +0000 (17:12 +0000)]
- Fixup locking and mark MPSAFE.
- Use callout_init_mtx() and static callouts rather than timeout().
- m_getcl() in one place to simplify the code.

Tested by: Gavin Atkinson gavin dot atkinson at ury dot york dot ac dot uk
MFC after: 1 week

18 years agoAdd a memory barrier for PREWRITE operations to ensure all writes by the
jhb [Thu, 15 Sep 2005 17:09:42 +0000 (17:09 +0000)]
Add a memory barrier for PREWRITE operations to ensure all writes by the
CPU have drained before further writes to kick off the operation.

MFC after: 1 week

18 years agoUse sysctl -q when querying for kern.bootp_cookie in order to avoid
rwatson [Thu, 15 Sep 2005 16:09:28 +0000 (16:09 +0000)]
Use sysctl -q when querying for kern.bootp_cookie in order to avoid
printing boot-time errors that don't reflect true error conditions.

MFC after: 1 week

18 years agoUse is '-' to imply that the flag is not set, rather than '.'.
csjp [Thu, 15 Sep 2005 16:09:24 +0000 (16:09 +0000)]
Use is '-' to imply that the flag is not set, rather than '.'.

18 years agoAdd "-q" argument to sysctl(8), which suppresses a limited set of warnings/
rwatson [Thu, 15 Sep 2005 16:08:04 +0000 (16:08 +0000)]
Add "-q" argument to sysctl(8), which suppresses a limited set of warnings/
errors generated.  In particular, it suppresses "unknown oid" when
attempting to get or set a sysctl not present in the kernel.

MFC after: 1 week

18 years agoThe socket pointers in fifoinfo are not permitted to be NULL, so
rwatson [Thu, 15 Sep 2005 15:45:34 +0000 (15:45 +0000)]
The socket pointers in fifoinfo are not permitted to be NULL, so
don't check if they are, it just confuses the fifo code more.

MFC after: 3 days

18 years agoImprove the MP safeness associated with the creation of symbolic
csjp [Thu, 15 Sep 2005 15:03:48 +0000 (15:03 +0000)]
Improve the MP safeness associated with the creation of symbolic
links and the execution of ELF binaries. Two problems were found:

1) The link path wasn't tagged as being MP safe and thus was not properly
   protected.
2) The ELF interpreter vnode wasnt being locked in namei(9) and thus was
   insufficiently protected.

This commit makes the following changes:

-Sets the MPSAFE flag in NDINIT for symbolic link paths
-Sets the MPSAFE flag in NDINIT and introduce a vfslocked variable which
 will be used to instruct VFS_UNLOCK_GIANT to unlock Giant if it has been
 picked up.
-Drop in an assertion into vfs_lookup which ensures that if the MPSAFE
 flag is NOT set, that we have picked up giant. If not panic (if WITNESS
 compiled into the kernel). This should help us find conditions where vnode
 operations are in-sufficiently protected.

This is a RELENG_6 candidate.

Discussed with: jeff
MFC after: 4 days

18 years agoPortsnap uses host(1) to search for mirrors, but this is only available
cperciva [Thu, 15 Sep 2005 13:29:10 +0000 (13:29 +0000)]
Portsnap uses host(1) to search for mirrors, but this is only available
when the base system is not compiled with NO_BIND set.  Before we start
searching for mirrors, make sure that host(1) can be found, and if it
doesn't exist then fallback to the A record instead of the SRV records.

Submitted by: Luca Morettoni

18 years agoAdd tnt4882 driver to the build
phk [Thu, 15 Sep 2005 13:28:33 +0000 (13:28 +0000)]
Add tnt4882 driver to the build

18 years agoFirst cut at a driver for National Instruments PCI-GPIB hardware.
phk [Thu, 15 Sep 2005 13:27:16 +0000 (13:27 +0000)]
First cut at a driver for National Instruments PCI-GPIB hardware.

Hardware donated by: "Greg Maciejewski" <gregm@serverpit.com>

18 years agoRemove checks for shutdown(2) on non-connected socket.
maxim [Thu, 15 Sep 2005 13:20:39 +0000 (13:20 +0000)]
Remove checks for shutdown(2) on non-connected socket.

18 years agoBackout rev. 1.246, it breaks code uses shutdown(2) on non-connected
maxim [Thu, 15 Sep 2005 13:18:05 +0000 (13:18 +0000)]
Backout rev. 1.246, it breaks code uses shutdown(2) on non-connected
sockets.

Pointed out by: rwatson

18 years agoFix system shutdown timeout handling by again supporting longer running
rse [Thu, 15 Sep 2005 13:16:07 +0000 (13:16 +0000)]
Fix system shutdown timeout handling by again supporting longer running
shutdown procedures (which have a duration of more than 120 seconds).

We have two user-space affecting shutdown timeouts: a "soft" one in
/etc/rc.shutdown and a "hard" one in init(8). The first one can be
configured via /etc/rc.conf variable "rcshutdown_timeout" and defaults
to 30 seconds. The second one was originally (in 1998) intended to be
configured via sysctl(8) variable "kern.shutdown_timeout" and defaults
to 120 seconds.

Unfortunately, the "kern.shutdown_timeout" was declared "unused" in 1999
(as it obviously is actually not used within the kernel itself) and
hence was intentionally but misleadingly removed in revision 1.107 from
init_main.c. Kernel sysctl(8) variables are certainly a wrong way to
control user-space processes in general, but in this particular case the
sysctl(8) variable should have remained as it supports init(8), which
isn't passed command line flags (which in turn could have been set via
/etc/rc.conf), etc.

As there is already a similar "kern.init_path" sysctl(8) variable which
directly affects init(8), resurrect the init(8) shutdown timeout under
sysctl(8) variable "kern.init_shutdown_timeout". But this time document
it as being intentionally unused within the kernel and used by init(8).
Also document it in the manpages init(8) and rc.conf(5).

Reviewed by: phk
MFC after: 2 weeks

18 years agoAllocate unit numbers with unr, implement detach function.
phk [Thu, 15 Sep 2005 13:07:38 +0000 (13:07 +0000)]
Allocate unit numbers with unr, implement detach function.

18 years agoo Return ENOTCONN when shutdown(2) on non-connected socket.
maxim [Thu, 15 Sep 2005 11:45:36 +0000 (11:45 +0000)]
o Return ENOTCONN when shutdown(2) on non-connected socket.

PR: kern/84761
Submitted by: James Juran
R-test: tools/regression/sockets/shutdown
MFC after: 1 month

18 years agoVarious minor polishing.
phk [Thu, 15 Sep 2005 10:28:19 +0000 (10:28 +0000)]
Various minor polishing.

18 years agoProtect the devfs rule internal global lists with a sx lock, the per
phk [Thu, 15 Sep 2005 08:50:16 +0000 (08:50 +0000)]
Protect the devfs rule internal global lists with a sx lock, the per
mount locks are not enough.  Finer granularity (x)locking could be
implemented, but I prefer to keep it simple for now.

18 years agoAbsolve devfs_rule.c from locking responsibility and call it with
phk [Thu, 15 Sep 2005 08:36:37 +0000 (08:36 +0000)]
Absolve devfs_rule.c from locking responsibility and call it with
all necessary locking held.

18 years agoRetire unused dev_named() function.
phk [Thu, 15 Sep 2005 08:01:57 +0000 (08:01 +0000)]
Retire unused dev_named() function.

18 years agoClose a race which could result in unwarranted "ruleset %d already
phk [Thu, 15 Sep 2005 06:57:28 +0000 (06:57 +0000)]
Close a race which could result in unwarranted "ruleset %d already
running" panics.

Previously, recursion through the "include" feature was prevented by
marking each ruleset as "running" when applied.  This doesn't work for
the case where two DEVFS instances try to apply the same ruleset at
the same time.

Instead introduce the sysctl vfs.devfs.rule_depth (default == 1) which
limits how many levels of "include" we will traverse.

Be aware that traversal of "include" is recursive and kernel stack
size is limited.

MFC: after 3 days

18 years agoWhen stopping the card, and returning to page 0, it is best if you do
imp [Thu, 15 Sep 2005 04:05:09 +0000 (04:05 +0000)]
When stopping the card, and returning to page 0, it is best if you do
that with the NIC set of registers rather than the ASIC registers.  I
believe this was a harmless oversight, since we set ED_P0_CR to the
same value 5ms later, but just to be safe...

18 years agoFix so that when a slice or a partition is removed through g_slice_config(),
rodrigc [Wed, 14 Sep 2005 21:38:35 +0000 (21:38 +0000)]
Fix so that when a slice or a partition is removed through g_slice_config(),
it is destroyed in GEOM, in addition to being removed from /dev.
Before this patch, if you applied a new MBR which deleted a slice,
the deleted slice would not be in /dev, but it would still appear
in kern.geom.conftxt and kern.geom.confxml, which would confused
the diskPartitionEditor in sysinstall.

Submitted by:   pjd
Tested by:      pjd, rodrigc
MFC after: 1 week

18 years agoDetermine where the runtime loader got mapped to when a dynamically
jkoshy [Wed, 14 Sep 2005 21:15:50 +0000 (21:15 +0000)]
Determine where the runtime loader got mapped to when a dynamically
linked process was exec()'ed, and map samples in that address range
into the appropriate buckets in the runtime loader's profile.
Improve a few comments.

MFC after: 3 days

18 years agoRemove any hardcoded assumptions about malloc's way of allocating,
ache [Wed, 14 Sep 2005 20:35:46 +0000 (20:35 +0000)]
Remove any hardcoded assumptions about malloc's way of allocating,
just use MAXPATHLEN. It prevents potential buffer overflow with other
malloc implementations.
(this change based on submitted patch)

PR:             86135
Submitted by:   Trevor Blackwell <tlb@tlb.org>

18 years agoDon't reuse *pl to skip [], it is already used for {} parts in the loop above
ache [Wed, 14 Sep 2005 19:14:32 +0000 (19:14 +0000)]
Don't reuse *pl to skip [], it is already used for {} parts in the loop above
(submitted patch slightly modified)

PR:             86038
Submitted by:   Gerd Rausch <gerd@juniper.net>

18 years agoMake device_detach methods really work.
ru [Wed, 14 Sep 2005 19:03:14 +0000 (19:03 +0000)]
Make device_detach methods really work.

18 years agoUndo a tad little optimization to bpf_mtap() introduced in rev. 1.95
andre [Wed, 14 Sep 2005 16:37:05 +0000 (16:37 +0000)]
Undo a tad little optimization to bpf_mtap() introduced in rev. 1.95
which broke the correct handling of the BIOCGSEESENT flag in the bpf
listener.

PR: kern/56441
Submitted by: <vys at renet.ru>
MFC after: 3 days

18 years agoXref msdosfs(5)
joel [Wed, 14 Sep 2005 16:36:19 +0000 (16:36 +0000)]
Xref msdosfs(5)

Approved by: brueffer (mentor)

18 years agoRemove superfluous reference to the FreeBSD handbook.
joel [Wed, 14 Sep 2005 16:32:21 +0000 (16:32 +0000)]
Remove superfluous reference to the FreeBSD handbook.

Approved by: brueffer (mentor)

18 years agoIncrease boot-time DigiBIOS initialization timeout to allow
andre [Wed, 14 Sep 2005 15:18:12 +0000 (15:18 +0000)]
Increase boot-time DigiBIOS initialization timeout to allow
for a larger number of chained port modules.

PR: kern/55018
Submitted by: Cyrill Shevchuk <cyrill at cyrills.net>

18 years agoDo not ignore all other TCP options (eg. timestamp, window scaling)
andre [Wed, 14 Sep 2005 15:06:22 +0000 (15:06 +0000)]
Do not ignore all other TCP options (eg. timestamp, window scaling)
when responding to TCP SYN packets with TCP_MD5 enabled and set.

PR: kern/82963
Submitted by: <demizu at dd.iij4u.or.jp>
MFC after: 3 days

18 years agoRemove bogous semicolons at the end of the definitions of
andre [Wed, 14 Sep 2005 14:57:04 +0000 (14:57 +0000)]
Remove bogous semicolons at the end of the definitions of
'do { ... } while (0)' macros.

PR: kern/83088
Sumbitted by: <antoine.brodin at laposte.net>

18 years agoHarden the hotplug support for SATA devices.
sos [Wed, 14 Sep 2005 12:45:06 +0000 (12:45 +0000)]
Harden the hotplug support for SATA devices.
This also fixes a few races that was present in the timeout/detach code.

Sponsored by: pair.com

18 years agoAdd some defines for EPSON machines and use them.
nyan [Wed, 14 Sep 2005 12:42:39 +0000 (12:42 +0000)]
Add some defines for EPSON machines and use them.

18 years agoRemove EPSON PC-386 note A/W/AE/WR support.
nyan [Wed, 14 Sep 2005 12:39:06 +0000 (12:39 +0000)]
Remove EPSON PC-386 note A/W/AE/WR support.

18 years agoFixed "Memory modified after free" panic in rl_detach() due
ru [Wed, 14 Sep 2005 12:33:23 +0000 (12:33 +0000)]
Fixed "Memory modified after free" panic in rl_detach() due
to rl_stop() accessing already freed "struct ifnet".

Fixed LOR between rl mutex and some ACPI mutex in rl_detach().

18 years agoCorrect type.
pjd [Wed, 14 Sep 2005 10:42:51 +0000 (10:42 +0000)]
Correct type.

OK'ed by: cperciva

18 years agoFix "Memory modified after free" panic on detach, caused by accessing
ru [Wed, 14 Sep 2005 10:28:01 +0000 (10:28 +0000)]
Fix "Memory modified after free" panic on detach, caused by accessing
already freed struct ifnet.

18 years agoBack out 1.247. On ia64 <osreldate.h> is included from assembler source,
stefanf [Wed, 14 Sep 2005 09:01:06 +0000 (09:01 +0000)]
Back out 1.247.  On ia64 <osreldate.h> is included from assembler source,
the prototype broke buildword.

Noticed by: marcel

18 years agoFix panic when kernel compiled without INET6 by rejecting
bz [Wed, 14 Sep 2005 07:53:54 +0000 (07:53 +0000)]
Fix panic when kernel compiled without INET6 by rejecting
IPv6 opcodes which are behind #if(n)def INET6 now.

PR: kern/85826
MFC after: 3 days

18 years agoNote acpi_sony(4) manpage addition.
brueffer [Wed, 14 Sep 2005 05:50:09 +0000 (05:50 +0000)]
Note acpi_sony(4) manpage addition.

18 years agoBring aac_cam into line with using time_uptime instead of time_second.
scottl [Wed, 14 Sep 2005 05:49:34 +0000 (05:49 +0000)]
Bring aac_cam into line with using time_uptime instead of time_second.

18 years agoUse time_uptime for timing commands instead of time_second. This is a bit
scottl [Wed, 14 Sep 2005 05:46:28 +0000 (05:46 +0000)]
Use time_uptime for timing commands instead of time_second.  This is a bit
risky because the "current time" is supposed to be fed to the card during
initialization, and the current time is supposed to be put into each command
that is sent to the card.  Hopefully either the card doesn't actually care
about the timestamps, or it doesn't care about the absolute values so long
and the relative values are consistent.  Not an MFC candidate until more
thorough testing can be done.

18 years agoHook up acpi_sony.4
brueffer [Wed, 14 Sep 2005 05:09:33 +0000 (05:09 +0000)]
Hook up acpi_sony.4

18 years agoManpage for the acpi_sony(4) driver. This is more of a dummy page at the
brueffer [Wed, 14 Sep 2005 05:04:12 +0000 (05:04 +0000)]
Manpage for the acpi_sony(4) driver.  This is more of a dummy page at the
moment, but better than nothing.

MFC after: 3 days

18 years agoFix module unload panic which was caused by missing sx lock release.
yongari [Wed, 14 Sep 2005 01:34:13 +0000 (01:34 +0000)]
Fix module unload panic which was caused by missing sx lock release.
While I'm here add KASSERT(9) to notify failure of SYSUNINIT handler.

Reported by: Ben Kaduk < minimarmot AT gmail DOT com >
Tested by: Ben Kaduk < minimarmot AT gmail DOT com >

18 years agoPrint a warning if we fail to retrieve the process name for any reason.
csjp [Tue, 13 Sep 2005 23:11:16 +0000 (23:11 +0000)]
Print a warning if we fail to retrieve the process name for any reason.

18 years agoIf there are'nt any bpf descriptors to process than dont bother attempting to
csjp [Tue, 13 Sep 2005 22:13:01 +0000 (22:13 +0000)]
If there are'nt any bpf descriptors to process than dont bother attempting to
retrieve statistic information for them.

Pointed out by: Pawel Worach < pawel.worach at gmail.com >

18 years agoMFp4: Migrate from CARD_CIS_SCAN to pccard_cis_scan
imp [Tue, 13 Sep 2005 19:56:07 +0000 (19:56 +0000)]
MFp4: Migrate from CARD_CIS_SCAN to pccard_cis_scan

18 years agoMFp4:
imp [Tue, 13 Sep 2005 19:54:14 +0000 (19:54 +0000)]
MFp4:
o Use pccard_cis_scan
o use pccard_attr_write_1
o Update comments

18 years agoMFp4: Omnibus ed changes
imp [Tue, 13 Sep 2005 19:47:44 +0000 (19:47 +0000)]
MFp4: Omnibus ed changes

o Attach AX88x90's MII bus to system, and require its presence.
o Reorg the mii code a little, and move more of it into pccard attachment.
o Eliminate ed_pccard_{read,write}_attrmem in favor of a more appropriate
  function in the pccard layer.
o Update comments to reflect knowledge gained.
o Update how re recognize a NE-2000 ROM.  I found a couple of different
  datasheets that define the structure of the PROM data, so the code's
  old heuristics have been removed, and comments updated to reflect the
  structure.
o Eliminate work around for EC2T.  It is no longer needed, and was wrong
  headed since the EC2T has a Winbound 82C926C in it, not a AX88x90.
o Add copyright to if_ed_pccard.c, since I believe I've re-written more than
  3/4 of it.

# With these changes, all of my 20-odd ed based cards work, except for the
# NetGear FA-410, and I'm pretty sure that's a MII/PHY problem.

18 years agoMFp4:
imp [Tue, 13 Sep 2005 19:28:03 +0000 (19:28 +0000)]
MFp4:
o Move to new pccard_cis_scan convenience function.
o Remove compat layer goo.

18 years agoUse new convenience function to read CIS rather than the older, harder to
imp [Tue, 13 Sep 2005 19:25:30 +0000 (19:25 +0000)]
Use new convenience function to read CIS rather than the older, harder to
use version.

18 years agoDon't consider being unable to open the bounds file worthy of printing
rwatson [Tue, 13 Sep 2005 19:15:28 +0000 (19:15 +0000)]
Don't consider being unable to open the bounds file worthy of printing
at LOG_WARNING by default; instead, consider it something to be printed
to the tty when 'verbose' mode is set.  This avoids printing out extra
lines at every boot on a system with crash dumps enabled, but that has
not yet had to generate a crashdump.

MFC after: 1 week

18 years agoMFp4: Minor formatting nits in pccard table.
imp [Tue, 13 Sep 2005 19:09:57 +0000 (19:09 +0000)]
MFp4: Minor formatting nits in pccard table.

18 years agoUse kenv -q to extract dumpdev rather than kenv, in order to avoid
rwatson [Tue, 13 Sep 2005 19:07:02 +0000 (19:07 +0000)]
Use kenv -q to extract dumpdev rather than kenv, in order to avoid
spamming the console in the event that a loader tunable 'dumpdev'
isn't defined, which is not a relevant failure to report.

MFC after: 1 week

18 years agoUse smaller names. The "NE2000 PCI Ethernet" is largerly redundant
imp [Tue, 13 Sep 2005 19:07:00 +0000 (19:07 +0000)]
Use smaller names.  The "NE2000 PCI Ethernet" is largerly redundant
with edX at pciY.  This removes 8*22 bytes from the strings. Not a
huge win, but a cheap one.

18 years agoAdd a "-q" quiet flag to kenv so that warnings can be suppressed.
rwatson [Tue, 13 Sep 2005 19:01:53 +0000 (19:01 +0000)]
Add a "-q" quiet flag to kenv so that warnings can be suppressed.

MFC after: 1 week

18 years agoAdd the olicom OC2231 and OC2232 to the list of cards that we should
imp [Tue, 13 Sep 2005 18:55:28 +0000 (18:55 +0000)]
Add the olicom OC2231 and OC2232 to the list of cards that we should
attach to.  These cards are combo cards (in that they have a modem
inside of them), but not true MFC cards.  Full support of these cards
will have to wait until we can pick the config to use and for the PFC
support that I have brewing.

18 years agoAdd a few new functions interfaces to allow reading/writing attribute
imp [Tue, 13 Sep 2005 17:56:36 +0000 (17:56 +0000)]
Add a few new functions interfaces to allow reading/writing attribute
memory, the CCR and a tweak to cis_scan.

18 years agoDefine and use PCCARD_MEM_PAGE_SIZE.
imp [Tue, 13 Sep 2005 17:49:47 +0000 (17:49 +0000)]
Define and use PCCARD_MEM_PAGE_SIZE.

18 years agoTrim down now (believed to be) unused fifo_ioctl() and
rwatson [Tue, 13 Sep 2005 17:46:48 +0000 (17:46 +0000)]
Trim down now (believed to be) unused fifo_ioctl() and
fifo_kqfilter() VOP implementations, since they in theory are used
only on open file descriptors, in which case the ioctls are via
fifo_ioctl_f() and kqueue requests are via fifo_kqfilter_f().
Generate warnings if they are entered for now.  These printf()
calls should become panic() calls.

Annotate and re-implement fifo_ioctl_f(): don't arbitrarily
forward ioctls to the socket layer, only forward the ones we
explicitly support for fifos.  In the case of FIONREAD, don't
forward the request to the write socket on a read-write fifo, or
the read result is overwritten.  Annotate a nasty case for the
undefined POSIX O_RDWR on fifos, in which failure of the second
ioctl will result in the socket pair being in an inconsistent
state.

Assert copyright as I find myself rewriting non-trivial parts of
fifofs.

MFC after: 3 days

18 years agoMFp4: Remove stale functions.
imp [Tue, 13 Sep 2005 17:41:48 +0000 (17:41 +0000)]
MFp4: Remove stale functions.

18 years agoAdd two small tests to set and clear two file I/O flags using ioctl on
rwatson [Tue, 13 Sep 2005 17:25:35 +0000 (17:25 +0000)]
Add two small tests to set and clear two file I/O flags using ioctl on
a fifo: FIONBIO, FIOASYNC.

18 years agoRestructure fifo_io event-related tests in order to support test cases
rwatson [Tue, 13 Sep 2005 17:15:05 +0000 (17:15 +0000)]
Restructure fifo_io event-related tests in order to support test cases
relating to O_RDWR file descriptors, which while not defined in POSIX,
are in fact used:

(1) Revise assumption that we have two file descriptors when testing I/O
    operations on a fifo.  Provide cleanup routines that handle either
    two or three file descriptors (including a kqueue descriptor).

(2) Add an openfifo_rw() routine to supplement openfifo().

(3) kqueue_setup() now configures an existing kqueue to monitor a new
    file descriptor, rather than allocating a new kqueue to monitor two
    existing file descriptors.

(4) Wrap all direct poll/select/kqueue/FIONREAD interactions in a single
    function, assert_status(), which takes a file descriptor, kqueue
    descriptor, assertion of read/writable/exception states, and
    test description, then tests the assertion.  This reduces the bulk
    of calls in many of the tests, making them shorter, more readable,
    and easier to determine correct.

(5) Add a new test_events_rdwr() function, which performs a basic create/
    write/read event test on a O_RDWR fifo file descriptor.  This is
    currently failed by our fifo code in HEAD due to a bug in FIONREAD
    handling.  Fix to be merged shortly.

18 years agoGarbage collect bpfstat. This is handled by netstat now.
csjp [Tue, 13 Sep 2005 16:04:56 +0000 (16:04 +0000)]
Garbage collect bpfstat. This is handled by netstat now.

Requested by: rwatson

18 years agoTeach fifo_io how to use ioctl(FIONREAD) to determine if a fifo is
rwatson [Tue, 13 Sep 2005 15:49:12 +0000 (15:49 +0000)]
Teach fifo_io how to use ioctl(FIONREAD) to determine if a fifo is
readable, and use that in addition to poll+select+kqueue to verify
appropriate readability.

18 years agoVarious and sundry improvements:
jhb [Tue, 13 Sep 2005 15:16:50 +0000 (15:16 +0000)]
Various and sundry improvements:
- Replace 'process' with 'thread' everywhere.
- Update several places to note that that the fact that default mutexes
  may adaptively spin isn't necessarily MD, but is just part of the
  implementation as a whole.
- Clarify the text about MTX_SPIN mutexes only being appropriate for
  INTR_FAST interrupts or other low level scheduler code to make the
  jargon more FreeBSD-ish rather than BSD/OS-ish.
- Also, note that it is possible that interrupts aren't blocked but just
  deferred when a spin lock is held (the whole blocked vs. deferred bit is
  an MD implementation detail).
- Remove statements saying that spin locks must be released in the exact
  opposite order that they were acquired.  This stopped being true several
  years ago when we first added critical sections that stored their state
  in the current thread rather than in struct mtx.
- Note that a mutex must be initialized before it is passed to any other
  mutex function, not just mtx_lock.
- Clarify that mtx_trylock() only operates on MTX_DEF mutexes.
- Simplify the text about possible preemption during a mtx_unlock().
- Use complete English sentences in place of phrases in a few places.
- Clarify that it isn't ever safe to sleep with a mutex held.  The kernel
  tends to panic when you do that.

Requested by: scottl (7)
MFC after: 3 days

18 years agoRemove unused functions.
nyan [Tue, 13 Sep 2005 11:34:07 +0000 (11:34 +0000)]
Remove unused functions.

18 years agoRemove EPSON_NRDISK support.
nyan [Tue, 13 Sep 2005 11:33:25 +0000 (11:33 +0000)]
Remove EPSON_NRDISK support.

18 years agoAs a result of kqueue locking work, socket buffer locks will always
rwatson [Tue, 13 Sep 2005 10:39:24 +0000 (10:39 +0000)]
As a result of kqueue locking work, socket buffer locks will always
be held when entering a kqueue filter for fifos via a socket buffer
event: as such, assert the lock unconditionally rather than acquiring
it conditionall.

MFC after: 3 days

18 years agoRemove a debugging printf.
rwatson [Tue, 13 Sep 2005 10:33:32 +0000 (10:33 +0000)]
Remove a debugging printf.

18 years agoUnlock driver lock before calling resource_int_value(9).
yongari [Tue, 13 Sep 2005 10:12:28 +0000 (10:12 +0000)]
Unlock driver lock before calling resource_int_value(9).
This should fix LOR(in fact it's not LOR) in device attach.

18 years agoAnnotate two issues:
rwatson [Tue, 13 Sep 2005 09:23:22 +0000 (09:23 +0000)]
Annotate two issues:

1) fifo_kqfilter() is not actually ever used, it likely should be GC'd.

2) fifo_kqfilter_f() doesn't implement EVFILT_VNODE, so detecting events
   on the underlying vnode for a fifo no longer works (it did in 4.x).
   Likely, fifo_kqfilter_f() should forward the request to the VFS using
   fp->f_vnode, which would work once fifo_kqfilter() was detached from
   the vnode operation vector (removing the fifo override).

Discussed with: phk

18 years agoMFi386: revision 1.11.
nyan [Tue, 13 Sep 2005 08:29:03 +0000 (08:29 +0000)]
MFi386: revision 1.11.

18 years agoMFi386: revisions 1.10 and 1.11.
nyan [Tue, 13 Sep 2005 08:27:38 +0000 (08:27 +0000)]
MFi386: revisions 1.10 and 1.11.
  - Add '-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3' to CFLAGS.

18 years agoFix a bug that caused generated gmon.out profiles to be out of
jkoshy [Tue, 13 Sep 2005 02:23:25 +0000 (02:23 +0000)]
Fix a bug that caused generated gmon.out profiles to be out of
whack.  Use saturating arithmetic when incrementing a bucket.
Improve a few comments.

MFC after: 3 days

18 years agoAdd a missing ldexpf() alias for amd64.
das [Mon, 12 Sep 2005 20:54:00 +0000 (20:54 +0000)]
Add a missing ldexpf() alias for amd64.

Noticed by: bz@, tjr@

18 years agoIntroduce no-op nosup fifo kqueue filter and detach routine, which are
rwatson [Mon, 12 Sep 2005 19:59:12 +0000 (19:59 +0000)]
Introduce no-op nosup fifo kqueue filter and detach routine, which are
used when a read filter is requested on a write-only fifo descriptor, or
a write filter is requested on a read-only fifo descriptor.  This
permits the filters to be registered, but never raises the event, which
causes kqueue behavior for fifos to more closely match similar semantics
for poll and select, which permit testing for the condition even though
the condition will never be raised, and is consistent with POSIX's notion
that a fifo has identical semantics to a one-way IPC channel created
using pipe() on most operating systems.

The fifo regression test suite can now run to completion on HEAD without
errors.

MFC after: 3 days

18 years agoInclude a couple of headers to ensure consistency between the prototype and
stefanf [Mon, 12 Sep 2005 19:52:42 +0000 (19:52 +0000)]
Include a couple of headers to ensure consistency between the prototype and
the function definition.

18 years agoComment test_lseek().
rwatson [Mon, 12 Sep 2005 19:31:16 +0000 (19:31 +0000)]
Comment test_lseek().

Add test_kqueue(), which registers and unregisters various kqueue filter
types on a fifo in order to make sure that EVFILT_READ, EVFILT_WRITE can
be registered, and that EVFILT_NETDEV can't be registered.  For now, we
don't test that EVFILT_VNODE can be registered on fifos, as that has been
broken at some point.

18 years agoIn netkqfilter(), return EINVAL instead of 1 (EPERM) when a filter type
rwatson [Mon, 12 Sep 2005 19:26:03 +0000 (19:26 +0000)]
In netkqfilter(), return EINVAL instead of 1 (EPERM) when a filter type
is requested on a network interface file descriptor that is non-applicable.

MFC after: 3 days

18 years agoIn vfs_kqfilter(), return EINVAL instead of 1 (EPERM) when an unsupported
rwatson [Mon, 12 Sep 2005 19:22:37 +0000 (19:22 +0000)]
In vfs_kqfilter(), return EINVAL instead of 1 (EPERM) when an unsupported
kqueue filter type is requested on a vnode.

MFC after: 3 days

18 years ago- Fix the locking in dsp.c to prevent a LOR (AFAIK not on the LOR page).
netchild [Mon, 12 Sep 2005 18:33:33 +0000 (18:33 +0000)]
- Fix the locking in dsp.c to prevent a LOR (AFAIK not on the LOR page).

- Remove an assertion in sound.c, it's not needed (and causes a panic now).
  From the conversation via mail between glebius and Ariff:
  ---snip---
  > Well, but which mutex protects now? Do we own anything else
  > in pcm_chnalloc()? I see some queue(4) macros in pcm_chnalloc(),
  > they should be protected, shouldn't they?
  Queue insertion/removal occur during
     1) driver loading (which is pretty much single thread /
        sequential) or unloading (mutex protected, bail out if there is
        any channel with refcount > 0 or busy).
     2) vchan_create()/destroy(), (which is *sigh* quite complicated), but
        somehow protected by 'master'/parent channel mutex. Other
        thread cannot add/remove vchan (or even continue traversing
        that queue) unless it can acquire parent channel mutex.
---snip---

Fix the locking in dsp.c to prevent a LOR (AFAIK not on the LOR page).

Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my>
Tested with: INVARIANTS[1] and DIAGNOSTICS[2]
Tested by: netchild [1,2], David Reid <david@jetnet.co.uk> [1]

18 years agoWhen a request is made to register a filter on a fifo that doesn't
rwatson [Mon, 12 Sep 2005 18:07:49 +0000 (18:07 +0000)]
When a request is made to register a filter on a fifo that doesn't
apply to the fifo (i.e., not EVFILT_READ or EVFILT_WRITE), reject
it as EINVAL, not by returning 1 (EPERM).

MFC after: 3 days

18 years agoFurther updates to fifo_io regression test:
rwatson [Mon, 12 Sep 2005 17:05:48 +0000 (17:05 +0000)]
Further updates to fifo_io regression test:

- Teach fifo_io about kqueue monitoring of fifo file descriptor status,
  and add test cases for kqueue to match existing case for poll and
  select.  Add a new cleanup routine, cleanfifokq(), for use in tests that
  use kqueues.  kqueue_setup() sets up kqueue sessions, and kqueue_status()
  returns file descriptor status.

- Correct a bug in select handling relating to the nfds argument, which
  was incorrect so resulted in select occuring on the wrong file descriptor,
  and possible false positive/negative results.

- Clarify error reporting in one byte write+read tests to distinguish
  errors in the after case from the before case.

18 years ago- Add prototypes for __cmpdi2() and __ucmpdi2().
stefanf [Mon, 12 Sep 2005 16:16:12 +0000 (16:16 +0000)]
- Add prototypes for __cmpdi2() and __ucmpdi2().
- Remove GCC 1 stuff.

18 years agoPut a getosreldate() prototype into <osreldate.h>, getosreldate(3) implies
stefanf [Mon, 12 Sep 2005 16:11:48 +0000 (16:11 +0000)]
Put a getosreldate() prototype into <osreldate.h>, getosreldate(3) implies
there is one.

18 years agoInclude <osreldate.h> at the top of the file.
stefanf [Mon, 12 Sep 2005 16:06:15 +0000 (16:06 +0000)]
Include <osreldate.h> at the top of the file.

18 years agoUse prototypes for CHIN1() and CHIN().
stefanf [Mon, 12 Sep 2005 16:02:54 +0000 (16:02 +0000)]
Use prototypes for CHIN1() and CHIN().

18 years agoFix the prototypes for devname() and devname_r(), the first two argument
stefanf [Mon, 12 Sep 2005 15:58:15 +0000 (15:58 +0000)]
Fix the prototypes for devname() and devname_r(), the first two argument
types are supposed to be dev_t and mode_t (prefixed with __ due to
namespace reasons).

18 years agoProcess one NMI interrupt per handler invocation as the processor
jkoshy [Mon, 12 Sep 2005 15:55:44 +0000 (15:55 +0000)]
Process one NMI interrupt per handler invocation as the processor
'buffers' pending NMIs from multiple interrupting PMCs and delivers
them serially.

Reported by:  Olivier Crameri <olivier.crameri@epfl.ch>
MFC after: 3 days

18 years agoDon't declare ___res_ext() twice.
stefanf [Mon, 12 Sep 2005 15:53:28 +0000 (15:53 +0000)]
Don't declare ___res_ext() twice.

18 years agouse monotonic `time_uptime' instead of `time_second'
jkim [Mon, 12 Sep 2005 15:31:28 +0000 (15:31 +0000)]
use monotonic `time_uptime' instead of `time_second'

Approved by: anholt (mentor)
Discussed on: arch

18 years agoClean up.
le [Mon, 12 Sep 2005 14:31:49 +0000 (14:31 +0000)]
Clean up.

Remove unused functions.

Reduce indentation level by reverting the logic of the enclosing
conditional statement.

18 years agoo Add shutdown(2) regression tests. At the moment we cannot pass
maxim [Mon, 12 Sep 2005 14:12:09 +0000 (14:12 +0000)]
o Add shutdown(2) regression tests.  At the moment we cannot pass
shutdown-on-non connected socket test, kern/84761.

18 years agoWhen message can't fit into socket receive buffer return ENOBUFS
glebius [Mon, 12 Sep 2005 14:11:11 +0000 (14:11 +0000)]
When message can't fit into socket receive buffer return ENOBUFS
to userland program instead of letting it wait until end of days.

PR: kern/85907