Commit Graph

45386 Commits

Author SHA1 Message Date
Maxim Konovalov
16c36bbe5d o Typo: Ternal -> Thermal. 2004-02-29 18:30:35 +00:00
Robert Watson
2bc87dcfbe Modify soalloc() API so that it accepts a malloc flags argument rather
than a "waitok" argument.  Callers now passing M_WAITOK or M_NOWAIT
rather than 0 or 1.  This simplifies the soalloc() logic, and also
makes the waiting behavior of soalloc() more clear in the calling
context.

Submitted by:	sam
2004-02-29 17:54:05 +00:00
Poul-Henning Kamp
2cf6bdac50 Loudly announce WITNESS and DIAGNOSTIC options and warn about reduced
performance.
2004-02-29 16:56:54 +00:00
Max Laier
01315efca3 Remove __inline keyword from functions that can't be inlined according to
LINT. This fixes LINT compliation for now, but needs to be revised.
Changes do not affect the objects.

Approved by:	bms(mentor)
2004-02-29 16:34:43 +00:00
Colin Percival
e07113d65c Use DEV_BSIZE byte sectors instead of PAGE_SIZE byte sectors for
swap-backed memory disks.  This reduces filesystem allocation overhead
and makes swap-backed memory disks compatible with broken code (dd,
for example) which expects to see 512 byte sectors.  The size of a
swap-backed memory disk must still be a multiple of the page size.

When performing page-aligned operations, this change has zero
performance impact.

Reviewed by:	phk
Approved by:	rwatson (mentor)
2004-02-29 15:58:54 +00:00
Robert Watson
e33d9f2929 Define BPFD_LOCK_ASSERT() to assert the BPF descriptor lock.
Assert the BPF descriptor lock in the MAC calls referencing live
BPF descriptors.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, McAfee Research
2004-02-29 15:33:56 +00:00
Robert Watson
f747d2dd90 Grab Giant after MAC processing on outgoing packets being sent via
BPF.  Grab the BPF descriptor lock before entering MAC since the MAC
Framework references BPF descriptor fields, including the BPF
descriptor label.

Submitted by:	sam
2004-02-29 15:32:33 +00:00
Poul-Henning Kamp
7314dafb6f Move boottime from <sys/kernel.h> to <sys/time.h> where it belongs. 2004-02-29 10:55:15 +00:00
Poul-Henning Kamp
db42ff97da Remove unused FDNUMTOUNIT() macro 2004-02-29 10:21:40 +00:00
Poul-Henning Kamp
74cc032b41 Give DDB a "watchdog" command which disables all watchdogs. 2004-02-29 09:55:32 +00:00
Søren Schmidt
9a19089d86 Rearrange sense_key and sense_data to get alignment right.
Submitted by: Marcel
2004-02-29 09:35:29 +00:00
Scott Long
474e30f0b1 All three of these drivers abused cv_waitq_empty in the same way by spinning
on it in hopes of making sure that the waitq was empty before going on.
This wasn't needed and probably never would have worked as intended.  Now
that cv_waitq_empty() and friends are gone, the code in these drivers that
spins on it can go away too.  This should unbreak LINT.

Discussed with:	kan
2004-02-29 09:26:01 +00:00
Peter Grehan
80bd99be33 Bring to working PIO state.
- use correct rid when allocating PCI mem resource
 - ATA taskfile registers are indeed spaced 0x10 apart just like
 the Macio ATA cell. Adjust offsets in ATA channel struct.

Tested by:  Suleiman Souhlal <ssouhlal@vt.edu>
2004-02-29 06:01:16 +00:00
Marcel Moolenaar
b55a929477 uteval.c gained a warning (cast discards qualifiers from pointer target
type) after vendor import of ACPICA 20040220. Add nowerror.
2004-02-28 23:04:45 +00:00
Nate Lawson
2881b39793 Call _INI on Thermal Zones as well as devices. 2004-02-28 22:43:18 +00:00
Poul-Henning Kamp
961af6677b Add support for the watchdog in Geode SC1100 which is used in embedded
systems like the Soekris NET4801
2004-02-28 22:33:28 +00:00
Poul-Henning Kamp
3d6e5ccb06 Make sure to disable the watchdog if we cannot honour the timeout. 2004-02-28 22:01:19 +00:00
Poul-Henning Kamp
4103b7652d Rename the WATCHDOG option to SW_WATCHDOG and make it use the
generic watchdoc(9) interface.

Make watchdogd(8) perform as watchdog(8) as well, and make it
possible to specify a check command to run, timeout and sleep
periods.

Update watchdog(4) to talk about the generic interface and add
new watchdog(8) page.
2004-02-28 20:56:35 +00:00
Nate Lawson
2676fbe88c Strip out new, unused file acnetbsd.h 2004-02-28 20:56:25 +00:00
Nate Lawson
fd73230997 This commit was generated by cvs2svn to compensate for changes in r126380,
which included commits to RCS files with non-trunk default branches.
2004-02-28 20:42:10 +00:00
Nate Lawson
0161891aa1 Fix an off-by-one in the compiler path. Originally from iwasaki-san's
patches for the pmtools port.  This change has been submitted to Intel.
2004-02-28 20:42:10 +00:00
Nate Lawson
4c80f45557 Local change: emulate a ReturnOp if the AML expects one but it isn't
present.  Some buggy BIOSs do not have a ReturnOp even though it is
required for a function to return a value.
2004-02-28 20:40:24 +00:00
Nate Lawson
e222f620d1 Local change: In the resume path, give up after waiting for a while
for WAK_STS to be set.  Some BIOSs never set it.
2004-02-28 20:39:50 +00:00
Nate Lawson
56491b7ba0 Local change: Allow access to the field if it is within the region
size rounded up to a multiple of the access byte width.  This overcomes
"off-by-one" programming errors in the AML often found in Toshiba
laptops.
2004-02-28 20:39:09 +00:00
Nate Lawson
7420bf68bb Local change: Put various debugging options under ACPI_DISASSEMBLER. 2004-02-28 20:38:40 +00:00
Nate Lawson
96f2784ee5 Unchanged files from ACPICA 20040220 that are off the vendor branch. 2004-02-28 20:35:57 +00:00
Nate Lawson
2a2a3f2735 Vendor import of ACPICA 20040220 2004-02-28 20:23:30 +00:00
Nate Lawson
6a5f0d2f49 This commit was generated by cvs2svn to compensate for changes in r126372,
which included commits to RCS files with non-trunk default branches.
2004-02-28 20:23:30 +00:00
Poul-Henning Kamp
3e2c971172 Add a generic watchdog facility which through a single device entry
in /dev controls all available watchdog implementations.
2004-02-28 20:06:59 +00:00
Nate Lawson
e8577ac876 Clean all the object files whether or not ACPI_DEBUG is specified. 2004-02-28 19:51:44 +00:00
Robert Watson
768bbd68cc Remove unneeded {} originally used to hold local variables for dummynet
in a code block, as the variable is now gone.

Submitted by:	sam
2004-02-28 19:50:43 +00:00
Don Lewis
a3193a9ca3 Create a new mutex type for virtual channels. This allows us to get
rid of the MTX_DUPOK flag on channel mutexes, which allows witness to
do a better job of lock order checking.  Nuke snd_chnmtxcreate() since
it is no longer needed.

Tested by:	matk
2004-02-28 19:47:02 +00:00
Don Lewis
466f31e55b Lock channels only as necessary in dsp_ioctl(), and only lock one
channel at a time unless it is actually necessary to lock both.
This avoids problems with lock order reversal and malloc() calls
with a mutex held when lower level code unlocks a channel, calls malloc(),
and relocks the channel.  This also avoids the cost of some  unnecessary
locking and unlocking.

Tested by:	matk
2004-02-28 19:42:48 +00:00
Scott Long
b234a120c8 Switch from using mutexes to using semaphores to protect against early
completion of synchronous commands.  Also switch to a per-array bioq as it
appears to improve performance.

Submitted by:	mbr, imp.ch (bioq change)
2004-02-28 19:14:41 +00:00
Søren Schmidt
dc7485d940 Issue a request sense command automagically when ATAPI commands fail
with a valid sense key.
2004-02-28 17:47:27 +00:00
Ken Smith
653700758e Previous commit mistakenly delayed cnadd() as well as make_dev().
Testing on cluster ref machine with just delaying make_dev() seems
to work, and results in printf() output appearing sooner in boot
cycle instead of going to /dev/null.

Caught by:	bde
Pointy hat:	kensmith
Approved by:	rwatson (mentor)
2004-02-28 16:36:14 +00:00
Robert Watson
a7b6a14aee Remove now unneeded arguments to tcp_twrespond() -- so and msrc. These
were needed by the MAC Framework until inpcbs gained labels.

Submitted by:	sam
2004-02-28 15:12:20 +00:00
Poul-Henning Kamp
1b4a8b8cfc Add support for /dev/led/error on Soekris Net4801. 2004-02-28 13:15:53 +00:00
Colin Percival
59e758846f Compare the *number* of patterns to zero, not the *pointer* to the
patterns.  (These lines are correct the other two times they appear.)

Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor), ken (scsi)
2004-02-28 12:59:56 +00:00
MIHIRA Sanpei Yoshiro
7f869e12d8 Sync to 1.163 of usbdevs 2004-02-28 00:15:08 +00:00
MIHIRA Sanpei Yoshiro
cdd40f3bd6 add support DM9601(DAVICOM USB to Ethernet MAC Controller with Integrated 10/100 PHY)
- Corega FEther USB-TXC

PR:		kern/62932
Submitted by:	HASHI Hiroaki <hashiz@tomba.cskk-sv.co.jp>
Obtained from:	NetBSD
2004-02-28 00:12:47 +00:00
Alexander Kabaev
c8daea132f Move the code dealing with vnode out of several functions into a single
helper function vm_mmap_vnode.

Discussed with:	jeffr,alc (a while ago)
2004-02-27 22:02:15 +00:00
Jim Rees
73c02c410e NFSv4 fixes from Connectathon 2004:
remove unused pid field of file context struct
map nfs4 error codes to errnos
eliminate redundant code from nfs4_request
use zero stateid on setattr that doesn't set file size
use same clientid on all mounts until reboot
invalidate dirty bufs in nfs4_close, to play it safe
open file for writing if truncating and it's not already open

Approved by:	alfred
2004-02-27 19:37:43 +00:00
Ken Smith
44bacdd9bc Fix -current builds on alpha. Recent changes in device handling caused
subtle problems with how alpha was handling the promcons device.  This
moves the call to make_dev() for the promcons device to a later point of
the boot-up sequence than where promcons initially gets attached, make_dev()
called during the first attach crashes due to kernel stack issues.

Reviewed by:	gallatin, marcel, phk
Discussed on:	-current@, -alpha@
Approved by:	rwatson (mentor)
2004-02-27 19:30:46 +00:00
John Baldwin
44f3b09204 Switch the sleep/wakeup and condition variable implementations to use the
sleep queue interface:
- Sleep queues attempt to merge some of the benefits of both sleep queues
  and condition variables.  Having sleep qeueus in a hash table avoids
  having to allocate a queue head for each wait channel.  Thus, struct cv
  has shrunk down to just a single char * pointer now.  However, the
  hash table does not hold threads directly, but queue heads.  This means
  that once you have located a queue in the hash bucket, you no longer have
  to walk the rest of the hash chain looking for threads.  Instead, you have
  a list of all the threads sleeping on that wait channel.
- Outside of the sleepq code and the sleep/cv code the kernel no longer
  differentiates between cv's and sleep/wakeup.  For example, calls to
  abortsleep() and cv_abort() are replaced with a call to sleepq_abort().
  Thus, the TDF_CVWAITQ flag is removed.  Also, calls to unsleep() and
  cv_waitq_remove() have been replaced with calls to sleepq_remove().
- The sched_sleep() function no longer accepts a priority argument as
  sleep's no longer inherently bump the priority.  Instead, this is soley
  a propery of msleep() which explicitly calls sched_prio() before
  blocking.
- The TDF_ONSLEEPQ flag has been dropped as it was never used.  The
  associated TDF_SET_ONSLEEPQ and TDF_CLR_ON_SLEEPQ macros have also been
  dropped and replaced with a single explicit clearing of td_wchan.
  TD_SET_ONSLEEPQ() would really have only made sense if it had taken
  the wait channel and message as arguments anyway.  Now that that only
  happens in one place, a macro would be overkill.
2004-02-27 18:52:44 +00:00
John Baldwin
e5bb601d87 Drop sched_lock around the wakeup of the parent process after setting
the process state to zombie when a process exits to avoid a lock order
reversal with the sleepqueue locks.  This appears to be the only place
that we call wakeup() with sched_lock held.
2004-02-27 18:39:09 +00:00
John Baldwin
dd75b0a90d Add an implementation of a generic sleep queue abstraction that is used
to queue threads sleeping on a wait channel similar to how turnstiles are
used to queue threads waiting for a lock.  This subsystem will be used as
the backend for sleep/wakeup and condition variables initially.  Eventually
it will also be used to replace the ithread-specific iwait thread
inhibitor.

Sleep queues are also not locked by sched_lock, so this splits sched_lock
up a bit further increasing concurrency within the scheduler.  Sleep queues
also natively support timeouts on sleeps and interruptible sleeps allowing
for the reduction of a lot of duplicated code between the sleep/wakeup and
condition variable implementations.  For more details on the sleep queue
implementation, check the comments in sys/sleepqueue.h and
kern/subr_sleepqueue.c.
2004-02-27 18:33:09 +00:00
Dag-Erling Smørgrav
21885af505 Add sysctl_move_oid() which reparents an existing OID. 2004-02-27 17:13:23 +00:00
John Baldwin
b7db4d0723 Fix a few style nits. do { } while(0) are only used for compound
statements and nowhere else in the kernel seems to use them for single
statements.  Also, all other users of do { } while(0) use multiple lines
rather than cramming it all onto one line.
2004-02-27 16:25:05 +00:00
John Baldwin
5b7de7e19e Clarify and tweak some comments. 2004-02-27 16:14:27 +00:00
John Baldwin
03129ba97f Fix _sx_assert() to panic() rather than printf() when an assertion fails
and ignore assertions if we have already paniced.
2004-02-27 16:13:44 +00:00
Pawel Jakub Dawidek
0e2ff2832c Even if we're sure that we can't be orphaned here, we have to define
orphan field - we're enforcing it in GEOM. This will reach KASSERT
in INVARIANTS case.

Add missing space.

Approved by:	scottl (mentor)
2004-02-27 15:34:21 +00:00
Pawel Jakub Dawidek
0787ce83b2 Remove unused field.
Approved by:	scottl (mentor)
2004-02-27 15:32:49 +00:00
Ruslan Ermilov
eec24f3275 For some reason crt0.o needs to be linked first for pxeboot(8) to
work.  This is odd because loader(8) doesn't suffer from this problem.
Perhaps pxeboot bootstrap can be fixed to handle this better.
Anyway, PXE booting should work again.
2004-02-27 14:10:09 +00:00
Robert Watson
f97e834b02 Forward declare struct proc, struct sockaddr, and struct thread, which
are employed in entry points later in the same include file.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Air Force Research Laboratory, McAfee Research
2004-02-26 20:44:50 +00:00
John Baldwin
f4114c3d7f Replace the ktrace queue's semaphore with a condition variable instead as
it is slightly more efficient since we already have a mutex to protect the
queue.  Ktrace originally used a semaphore more as a proof of concept.
2004-02-26 19:30:22 +00:00
Dag-Erling Smørgrav
7636405322 Bump CTL_MAXNAME from 12 to 24. 2004-02-26 16:18:22 +00:00
Robert Watson
f47cb88655 Forward declare struct bpf_d, struct ifnet, struct image_params, and
struct vattr in mac_policy.h.  This permits policies not
implementing entry points using these types to compile without
including include files with these types.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Air Force Research Laboratory
2004-02-26 16:15:14 +00:00
Yoshihiro Takahashi
6cab36d49d Merged from sys/isa/fd.c revision 1.266. 2004-02-26 14:59:10 +00:00
Max Laier
25a4adcec4 Bring eventhandler callbacks for pf.
This enables pf to track dynamic address changes on interfaces (dailup) with
the "on (<ifname>)"-syntax. This also brings hooks in anticipation of
tracking cloned interfaces, which will be in future versions of pf.

Approved by: bms(mentor)
2004-02-26 04:27:55 +00:00
Max Laier
cc5934f5af Tweak existing header and other build infrastructure to be able to build
pf/pflog/pfsync as modules. Do not list them in NOTES or modules/Makefile
(i.e. do not connect it to any (automatic) builds - yet).

Approved by: bms(mentor)
2004-02-26 03:53:54 +00:00
Robert Watson
c66b4d8d26 Move inet and inet6 related MAC Framework entry points from mac_net.c
to a new mac_inet.c.  This code is now conditionally compiled based
on inet support being compiled into the kernel.

Move socket related MAC Framework entry points from mac_net.c to a new
mac_socket.c.

To do this, some additional _enforce MIB variables are now non-static.
In addition, mbuf_to_label() is now mac_mbuf_to_label() and non-static.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, McAfee Research
2004-02-26 03:51:04 +00:00
Max Laier
2bbe8ffc9d Bring diff from the security/pf port. This has code been tested as a port
for a long time and is run in production use. This is the code present in
portversion 2.03 with some additional tweaks.

The rather extensive diff accounts for:
 - locking (to enable pf to work with a giant-free netstack)
 - byte order difference between OpenBSD and FreeBSD for ip_len/ip_off
 - conversion from pool(9) to zone(9)
 - api differences etc.

Approved by: bms(mentor) (in general)
2004-02-26 02:34:12 +00:00
Max Laier
3ef891af51 This commit was generated by cvs2svn to compensate for changes in r126258,
which included commits to RCS files with non-trunk default branches.
2004-02-26 02:04:28 +00:00
Max Laier
5c45a928b9 Vendor import of OpenBSD's packet filter (pf) as of OpenBSD 3.4
Approved by: bms(mentor), core (in general)
2004-02-26 02:04:28 +00:00
Don Lewis
47934cef8f Split the mlock() kernel code into two parts, mlock(), which unpacks
the syscall arguments and does the suser() permission check, and
kern_mlock(), which does the resource limit checking and calls
vm_map_wire().  Split munlock() in a similar way.

Enable the RLIMIT_MEMLOCK checking code in kern_mlock().

Replace calls to vslock() and vsunlock() in the sysctl code with
calls to kern_mlock() and kern_munlock() so that the sysctl code
will obey the wired memory limits.

Nuke the vslock() and vsunlock() implementations, which are no
longer used.

Add a member to struct sysctl_req to track the amount of memory
that is wired to handle the request.

Modify sysctl_wire_old_buffer() to return an error if its call to
kern_mlock() fails.  Only wire the minimum of the length specified
in the sysctl request and the length specified in its argument list.
It is recommended that sysctl handlers that use sysctl_wire_old_buffer()
should specify reasonable estimates for the amount of data they
want to return so that only the minimum amount of memory is wired
no matter what length has been specified by the request.

Modify the callers of sysctl_wire_old_buffer() to look for the
error return.

Modify sysctl_old_user to obey the wired buffer length and clean up
its implementation.

Reviewed by:	bms
2004-02-26 00:27:04 +00:00
Robert Watson
049ffe98a8 Assert pipe mutex in pipeselwakeup(), as we manipulate pipe_state
in a non-atomic manner.  It appears to always be called with the
mutex (good).
2004-02-26 00:18:22 +00:00
Robert Watson
094bdd260c Update comment regarding MAC labels: we no longer pass endpoints
into the MAC Framework, just the pipe pair.

GC 'hadpeer' used in pipedestroy(), which is no longer needed as
we check pipe_present flags on the pair.
2004-02-25 23:30:56 +00:00
Peter Wemm
937f5a8e02 Since we don't use PG_NX yet, don't turn on EFER_NXE quite yet. This needs
to be done based on the cpuid bits.  AMD says that we should test the cpuid
features bits for certain things, such as this.
2004-02-25 23:12:39 +00:00
Max Laier
ac9d7e2618 Re-remove MT_TAGs. The problems with dummynet have been fixed now.
Tested by: -current, bms(mentor), me
Approved by: bms(mentor), sam
2004-02-25 19:55:29 +00:00
Poul-Henning Kamp
503799ea5c Make mode setting with fdcontrol(8) stick.
Recognize when configured for "auto".
2004-02-25 13:44:58 +00:00
Johan Karlsson
ca9c567178 Fix style bug in last commit,
add a tab after WARNS?=.

While I'm here fix other style bugs.

Submitted by:	bde (libbdf/Makefile)
2004-02-25 13:12:51 +00:00
Bruce Evans
0613995bd0 Fixed namespace pollution in rev.1.74. Implementation of the syncache
increased <netinet/tcp_var>'s already large set of prerequisites, and
this was handled badly.  Just don't declare the complete syncache struct
unless <netinet/pcb.h> is included before <netinet/tcp_var.h>.

Approved by:	jlemon (years ago, for a more invasive fix)
2004-02-25 13:03:01 +00:00
Bruce Evans
a545b1dc4d Don't use the negatively-opaque type uma_zone_t or be chummy with
<vm/uma.h>'s idempotency indentifier or its misspelling.
2004-02-25 11:53:19 +00:00
Søren Schmidt
1c342d89ce Add support for the sii3512 SATA chip. 2004-02-25 09:55:49 +00:00
Bruce Evans
d01cde0480 Fixed some insertion sort errors. 2004-02-25 09:35:35 +00:00
Bruce Evans
bfdd261e68 Fixed some style bugs in previous commit (unsorting of the DDB_* options,
misofrmatting, and English usage errors).
2004-02-25 08:57:33 +00:00
Jeffrey Hsu
89c02376fc Relax a KASSERT condition to allow for a valid corner case where
the FIN on the last segment consumes an extra sequence number.

Spurious panic reported by Mike Silbersack <silby@silby.com>.
2004-02-25 08:53:17 +00:00
Scott Long
75fba44b93 Revert the last commit. I don't know what I was thinking, but this change
definitely doesn't help any thing.
2004-02-25 05:41:44 +00:00
Andrey A. Chernov
02f1d65c9d Bump FreeBSD_version for getopt_long_only() adding 2004-02-25 01:27:32 +00:00
Poul-Henning Kamp
9aece96fc0 Add DDB_NUMSYM option which in addition to the symbolic representation
also prints the actual numerical value of the symbol in question.

Users of addr2line(1) will be less proficient in hex arithmetic as a
consequence.

This amongst other things means that traceback lines change from:
   siointr1(c4016800,c073bda0,0,c06b699c,69f) at siointr1+0xc5
to
   siointr1(c4016800,c073bda0,0,c06b699c,69f) at 0xc062b0bd = siointr1+0xc5

I made this an option to avoid bikesheds.
~
~
~
2004-02-24 22:51:42 +00:00
Poul-Henning Kamp
917a7daac3 Unconst. Somebody didn't compile LINT. 2004-02-24 22:16:40 +00:00
Johan Karlsson
129d092a20 style.Makefile(5):
Use WARNS?= instead of WARNS=.

While I'm here,
	use INTERNALPROG, instead if overriding install
	remove emty lines
2004-02-24 20:51:20 +00:00
Dag-Erling Smørgrav
854a417d92 Whitespace cleanup 2004-02-24 19:31:30 +00:00
Colin Percival
3f54070bd2 Check that a pointer is non-NULL before dereferencing it, not after.
Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor)
2004-02-24 18:01:43 +00:00
Hajimu UMEMOTO
aaff9927f6 in icmp6_mtudisc_update(), use ND link mtu to detect if the path MTU
should be updated.

Helped by:	andre
2004-02-24 15:40:55 +00:00
Andre Oppermann
12e2e97051 Convert the tcp segment reassembly queue to UMA and limit the maximum
amount of segments it will hold.

The following tuneables and sysctls control the behaviour of the tcp
segment reassembly queue:

 net.inet.tcp.reass.maxsegments (loader tuneable)
  specifies the maximum number of segments all tcp reassemly queues can
  hold (defaults to 1/16 of nmbclusters).

 net.inet.tcp.reass.maxqlen
  specifies the maximum number of segments any individual tcp session queue
  can hold (defaults to 48).

 net.inet.tcp.reass.cursegments (readonly)
  counts the number of segments currently in all reassembly queues.

 net.inet.tcp.reass.overflows (readonly)
  counts how often either the global or local queue limit has been reached.

Tested by:	bms, silby
Reviewed by:	bms, silby
2004-02-24 15:27:41 +00:00
Poul-Henning Kamp
ad3917e8e6 Do not attempt to open NODEV 2004-02-24 09:59:35 +00:00
Bruce Evans
63a97efcbb Don't set d_flags twice. The second setting clobbered D_NOGIANT. 2004-02-24 04:35:44 +00:00
Bruce Evans
aa5191aa75 Fixed the latest unsortings of CPU_ENABLE_*. 2004-02-24 04:18:07 +00:00
Colin Percival
14135e2cfe Fix array overflow: If len=128, don't access [16] of a 16-byte IPv6
address, even if we subsequently ignore its value by applying a >>8
to it.

Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor), {ume, suz} (KAME)
2004-02-24 01:20:51 +00:00
Roman Kurakin
cee1270c1a Add support for Cronyx-Tau. For now I added only Tau-ISA files, system files
would be changed in next patches, after extra verifications.

Approved by: imp (mentor)
2004-02-23 20:19:00 +00:00
Pawel Jakub Dawidek
f5ebf83f3f Connect geom_concat.ko module to the build.
Approved by:	scottl (mentor)
2004-02-23 20:03:53 +00:00
Kirk McKusick
ecef42e1eb A more accurate test in the new ufs_lock than that in 1.235. 2004-02-23 19:05:05 +00:00
John Baldwin
1f220d57d6 Fix a problem with the USB keyboard driver not properly handling key
rollover resulting in duplicate keypress events.

PR:		57273
PR:		63171
Submitted by:	plasma <plasma at freebsd.sinica.edu.tw>
Submitted by:	Brian Candler <B.Candler at pobox.com>
MFC after:	1 week
2004-02-23 15:36:40 +00:00
Maxim Sobolev
fab1e69d80 Add missed CPU_ENABLE_LONGRON.
Submitted by:	Jon Noack <noackjr@alumni.rice.edu>
2004-02-23 14:49:15 +00:00
Poul-Henning Kamp
6fe9c1609f Fix vinums cdevsw{} to initialize d_version.
The nonstandard formatting made my mega-patch scripts miss it.

Retire the static major number while we're here anyway.

Reported by:	Niels Chr. Bank-Pedersen <ncbp@bank-pedersen.dk>
2004-02-23 08:55:13 +00:00
Poul-Henning Kamp
652d04726d Fix two oversights here: don't trash the freelist, and properly cleanup
the cdevsw{}.

Submitted by:	tegge
2004-02-23 08:42:55 +00:00
Kirk McKusick
546a1660f0 In the function clear_inodedeps(), a FREE_LOCK() should be called
AFTER the call to vn_start_write(), not before it. Otherwise, it is
possible to unlock it multiple times if the vn_start_write() fails.

Submitted by:	Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
2004-02-23 06:56:31 +00:00
Kirk McKusick
6c053cec34 Change UFS from using vop_stdlock to using its own ufs_lock.
In ufs_lock, check for attempts to acquire shared locks on
snapshot files and change them to be exclusive locks. This
change eliminates deadlocks and machine lockups reported in
-current since most read requests started using shared lock
requests.

Submitted by:	Jun Kuriyama <kuriyama@imgsrc.co.jp>
2004-02-23 06:40:17 +00:00
Robert Watson
033d9ae179 Limit the amount of memory userspace processes can cause the kernel to
allocate via DRI on r128 devices.

Obtained from:	Thomas Biege <thomas@suse.de>
Reviewed by:	scottl
2004-02-23 03:18:18 +00:00
Alan Cox
2c840b1f65 - Substitute bdone() and bwait() from vfs_bio.c for
swap_pager_putpages()'s buffer completion code.  Note: the only
   difference between swp_pager_sync_iodone() and bdone(), aside from
   the locking in the latter, was the unnecessary clearing of B_ASYNC.
 - Remove an unnecessary pmap_page_protect() from
   swp_pager_async_iodone().

Reviewed by:	tegge
2004-02-23 03:15:13 +00:00
Tim J. Robbins
f71cc8681b Fix comment containing vop_readdir_args contents: a_cookies is really
u_long ** not u_long *.
2004-02-23 01:43:00 +00:00
Tim J. Robbins
224f219b31 cookies is an array of u_long, not u_int, so MALLOC() it accordingly.
Allocating it with the wrong size could have caused corruption on
64-bit architectures.
2004-02-23 01:40:46 +00:00
Brian Feldman
240160d48b Correct some major SMP-harmful problems in the pipe implementation. First
of all, PIPE_EOF is not checked pervasively after everything that can drop
the pipe mutex and msleep(), so fix.  Additionally, though it might not
harm anything, pipelock() and pipeunlock() are not used consistently.
Third, the kqueue support functions do not use the pipe mutex correctly.
Last, but absolutely not least, is a race: if pipe_busy is not set on
the closing side of the pipe, the other side that is trying to write to
that will crash BECAUSE PIPE_EOF IS NOT SET!  Unconditionally set
PIPE_EOF, and get rid of all the lockups/crashes I have seen trying
to build ports.
2004-02-22 23:00:14 +00:00
Warner Losh
4689134363 Ye/PCI is supported by cy driver, so we don't need to assign a number to it. 2004-02-22 20:39:09 +00:00
Daniel Eischen
2648efa621 Add sysctls to allow showing threads for pgrp, tty, uid, ruid,
and pid.
2004-02-22 17:54:32 +00:00
Maxime Henrion
e77e9e1ba8 Unbreak after the change to use vm_paddr_t. Since vm_paddr_t is
an integer type and the a cast to (void *) was added in the
definition of NULL for the kernel, we need to use 0 here instead.

Partly submitted by:	cperciva
2004-02-22 16:27:28 +00:00
Pawel Jakub Dawidek
63dba32b76 Reimplement sysctls handling by MAC framework.
Now I believe it is done in the right way.

Removed some XXMAC cases, we now assume 'high' integrity level for all
sysctls, except those with CTLFLAG_ANYBODY flag set. No more magic.

Reviewed by:	rwatson
Approved by:	rwatson, scottl (mentor)
Tested with:	LINT (compilation), mac_biba(4) (functionality)
2004-02-22 12:31:44 +00:00
Colin Percival
9a6caa1afc Check that amrd_sc is non-NULL before dereferencing it, not after.
Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor)
2004-02-22 10:00:05 +00:00
Colin Percival
cd8aaf2121 Check that twed_sc is non-NULL before dereferencing it, not after.
Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor)
2004-02-22 09:58:34 +00:00
Colin Percival
1f0c8eae54 Don't free k_cfg until we're finished using it -- reverse the order of
two free commands.

Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor), scottl
2004-02-22 09:55:48 +00:00
Colin Percival
caa32ef5c2 Don't free meo until we're finished using it.
Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor), scottl
2004-02-22 09:52:46 +00:00
Jim Rees
3ea5b421eb protect new cdevsw entries with "#if (__FreeBSD_version > 502102)" 2004-02-22 05:49:38 +00:00
Alan Cox
85b8d6b45b Correct a long-standing race condition in vm_object_page_remove() that
could result in a dirty page being unintentionally freed.

Reviewed by:	tegge
MFC after:	7 days
2004-02-22 03:36:51 +00:00
Marcel Moolenaar
27e327fdaf Do not pre-map the I/O port space. On the Intel Tiger 4 this conflicts
with a memory mapped I/O range that's immediately before it and is
not 256MB aligned. As a result, when an address is accessed in the
memory mapped range and a direct mapping is added for it, it overlaps
with the pre-mapped I/O port space and causes a machine check.

Based on a patch from: arun@
2004-02-22 02:10:48 +00:00
Colin Percival
11233aabf8 If mountnfs returns an error, it will have already freed nam; no need to
free it again.

Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor)
2004-02-22 01:17:47 +00:00
Colin Percival
fa81466148 Check that periph is non-NULL before dereferencing it.
Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor), ken (scsi@)
2004-02-22 01:14:54 +00:00
Colin Percival
b17dd2bcc0 If we're going to panic(), do it before dereferencing a NULL pointer.
Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor)
2004-02-22 01:11:53 +00:00
Colin Percival
a333b323e1 Check that xfer != NULL before dereferencing it, not after.
Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor)
2004-02-22 01:10:11 +00:00
Colin Percival
bff4678e78 If we're going to assert that logData != NULL, do it before we
try to dereference logData.

Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor), scottl
2004-02-22 01:08:33 +00:00
Colin Percival
8d4fdfaf45 We want to allocate and zero sizeof(struct foo) bytes, not
sizeof(struct foo *) bytes.

Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor), scottl
2004-02-22 01:06:05 +00:00
Colin Percival
27021df2ff Fix off-by-one error: sc->twe_drive is an array of TWE_MAX_UNITS elements.
Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor)
2004-02-22 01:03:38 +00:00
Robert Watson
f6a4109212 Update my personal copyrights and NETA copyrights in the kernel
to use the "year1-year3" format, as opposed to "year1, year2, year3".
This seems to make lawyers more happy, but also prevents the
lines from getting excessively long as the years start to add up.

Suggested by:	imp
2004-02-22 00:33:12 +00:00
Poul-Henning Kamp
ded67d0f77 Check for NODEV return from udev2dev() 2004-02-21 23:52:03 +00:00
Peter Wemm
fffaaed41a Regen (FWIW) 2004-02-21 23:38:58 +00:00
Peter Wemm
cdee486c65 Try and make the compat sigreturn prototypes closer to reality. 2004-02-21 23:37:33 +00:00
Peter Wemm
61aeb6a14d Add a note about the landmine in the middle of struct ia32_sigframe. 2004-02-21 23:36:31 +00:00
Peter Wemm
666dfc3f37 DOH!!! Fix signals for freebsd-4.x/i386 binaries. The ucontext has
different alignments due to the sse fxsave dump area.
2004-02-21 23:35:56 +00:00
Peter Wemm
4fa84e0fb3 Catch up with some proc/procsig locking improvements that were made to the
i386 version and were not merged over.
2004-02-21 23:34:42 +00:00
Alan Cox
9ea8d1a67c Eliminate the second, unnecessary call to pmap_page_protect() near the end
of vm_pageout_flush().  Instead, assert that the page is still write
protected.

Discussed with:	tegge
2004-02-21 23:32:00 +00:00
Jim Rees
ed56328b92 in idmap_uid_to_name(), don't try to use the entry after freeing it, in the
idmap_add failure case (found by Ted Unangst via Colin Percival)

also convert idmap_hashf to return void, since it can't fail

also change some panics to error returns
2004-02-21 22:52:02 +00:00
Bruce Evans
0ef0dd6f85 Fixed a serious off by 1 error. The cluster-in-use bitmap was overrun
by 1 u_int if the number of clusters was 1 more than a multiple of
(8 * sizeof(u_int)).  The bitmap is malloced and large (often huge), so
fatal overrun probably only occurred if the number of clusters was 1
more than 1 multiple of PAGE_SIZE/8.
2004-02-21 22:47:19 +00:00
Jim Rees
3a7fa52e65 ask for rdattr_err in readdir, so we won't fail the readdir if we can't get
attrs on one or more entries
2004-02-21 22:10:35 +00:00
Poul-Henning Kamp
70883f1d2f Bump __FreeBSD_version to mark cdevsw megapatching. 2004-02-21 22:06:18 +00:00
Poul-Henning Kamp
cd690b60de Device megapatch 6/6:
This is what we came here for:  Hang dev_t's from their cdevsw,
refcount cdevsw and dev_t and generally keep track of things a lot
better than we used to:

Hold a cdevsw reference around all entrances into the device driver,
this will be necessary to safely determine when we can unload driver
code.

Hold a dev_t reference while the device is open.

KASSERT that we do not enter the driver on a non-referenced dev_t.

Remove old D_NAG code, anonymous dev_t's are not a problem now.

When destroy_dev() is called on a referenced dev_t, move it to
dead_cdevsw's list.  When the refcount drops, free it.

Check that cdevsw->d_version is correct.  If not, set all methods
to the dead_*() methods to prevent entrance into driver.  Print
warning on console to this effect.  The device driver may still
explode if it is also incompatible with newbus, but in that case
we probably didn't get this far in the first place.
2004-02-21 21:57:26 +00:00
Poul-Henning Kamp
816d62bbb9 Device megapatch 5/6:
Remove the unused second argument from udev2dev().

Convert all remaining users of makedev() to use udev2dev().  The
semantic difference is that udev2dev() will only locate a pre-existing
dev_t, it will not line makedev() create a new one.

Apart from the tiny well controlled windown in D_PSEUDO drivers,
there should no longer be any "anonymous" dev_t's in the system
now, only dev_t's created with make_dev() and make_dev_alias()
2004-02-21 21:32:15 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Poul-Henning Kamp
8e1f1df080 Device megapatch 3/6:
Add missing D_TTY flags to various drivers.

Complete asserts that dev_t's passed to ttyread(), ttywrite(),
ttypoll() and ttykqwrite() have (d_flags & D_TTY) and a struct tty
pointer.

Make ttyread(), ttywrite(), ttypoll() and ttykqwrite() the default
cdevsw methods for D_TTY drivers and remove the explicit initializations
in various drivers cdevsw structures.
2004-02-21 20:41:11 +00:00
Poul-Henning Kamp
b0b0334878 Device megapatch 2/6:
This commit adds a couple of functions for pseudodrivers to use for
implementing cloning in a manner we will be able to lock down (shortly).

Basically what happens is that pseudo drivers get a way to ask for
"give me the dev_t with this unit number" or alternatively "give
me a dev_t with the lowest guaranteed free unit number" (there is
unfortunately a lot of non-POLA in the exact numeric value of this
number, just live with it for now)

Managing the unit number space this way removes the need to use
rman(9) to do so in the drivers this greatly simplifies the code in
the drivers because even using rman(9) they still needed to manage
their dev_t's anyway.

I have taken the if_tun, if_tap, snp and nmdm drivers through the
mill, partly because they (ab)used makedev(), but mostly because
together they represent three different problems for device-cloning:

if_tun and snp is the plain case: just give me a device.

if_tap has two kinds of devices, with a flag for device type.

nmdm has paired devices (ala pty) can you can clone either of them.
2004-02-21 20:29:52 +00:00
Poul-Henning Kamp
c9c7976f7f Device megapatch 1/6:
Free approx 86 major numbers with a mostly automatically generated patch.

A number of strategic drivers have been left behind by caution, and a few
because they still (ab)use their major number.
2004-02-21 19:42:58 +00:00
Hartmut Brandt
7563a29b85 Use the more appropriate vm_paddr_t in places where a physical
address for DMA is handled instead of pointers.

Submitted by:	Joerg Sonneberger <joerg@britannica.bec.de>
2004-02-21 19:08:23 +00:00
Søren Schmidt
056b9907de Dont alloc size 0 buffers. 2004-02-21 18:30:03 +00:00
Søren Schmidt
73f8099662 Check both PORTEN and MEMEN for enabled HW. 2004-02-21 18:21:13 +00:00
Søren Schmidt
0c7ab1146f Only register interrupt as seen if it was a real HW interrupt. 2004-02-21 16:55:10 +00:00
Hartmut Brandt
bf30351bdc Make sure that the first mbuf in the chain passed to atm_intr
always contains a packet header.
2004-02-21 13:01:54 +00:00
Hartmut Brandt
962956583e The token for atm_intr is actually a void *, not an int. Clarify
what atm_intr expects in a comment and de-obfuscate the code a little
bit by replacing the portability macros with the native BSD names.
2004-02-21 12:59:14 +00:00
Yaroslav Tykhiy
913e410e29 Minor beautifications related to style(9) and code consistency.
No functional changes.
2004-02-21 12:56:09 +00:00
Hartmut Brandt
8f52a59171 Don't remove the first mbuf in the chain if it got empty.
This removes the packet header in certain cases which later on
will give panic. Clarify what the atm_intr expects in the comment
and de-obscurify the code a little bit by replacing the portability
macros with the BSD names. The code isn't maintained externally anymore
so there's no point in keeping the extra level of obscurity.
2004-02-21 12:55:07 +00:00
Yaroslav Tykhiy
efb4018be7 Improve the SIOCSIFCAP handler a bit:
- allow for ifp->if_ioctl being NULL, as the rest of ifioctl() does;
- give the interface driver a chance to report a error to the caller;
- don't forget to update ifp->if_lastchange upon successful modification
  of interface operation parameters.
2004-02-21 12:48:25 +00:00