Commit Graph

37130 Commits

Author SHA1 Message Date
Robert Watson
07ca1fdb84 Use UID_ and GID_ constants for uid and gid arguments to make_dev()
for the raidctl device.

Select a more conservative default for the permissions for /dev/raidctl
since the operations are performed using ioctl() not read() and write().

Submitted by:	kris
Reviewed by:	scottl
2002-12-31 06:13:47 +00:00
Scott Long
1c75404899 Convert the use of MAXBSIZE in the dma tag to more appropriate values.
Use BUS_SPACE_MAXSIZE_32BIT for the parent dma tags, and
(NSEGS - 1) * PAGE_SIZE for the data buffer tags.  FreeBSD/sparc64 is
more strict about checking these values that other arches.
2002-12-31 04:22:36 +00:00
Mike Barcroft
b8f7521b54 Add complete struct timeval by including <sys/_timeval.h>. 2002-12-31 04:13:50 +00:00
Mike Barcroft
d97556954e Move struct timeval to its own header so that it can be shared between
multiple headers.
2002-12-31 04:08:41 +00:00
David E. O'Brien
f62a945f30 RIP liloldr.
It is not complete (the LILO root= specification isn't passed to our
loader for instance), it has not been touched in over 2 years.  Linux has
moved on to GRUB, so this is OBE now.  If someone creeps up to work on it,
it could become a port.
2002-12-31 02:29:03 +00:00
Sam Leffler
ac4f28eb7b MFS 1.6.2.3: fixup statistics; turn off batching by default; add max
aggregation tunable and set it to 1 to minimize latency

Sponsored by:	Vernier Networks
2002-12-30 22:16:45 +00:00
Jens Schweikhardt
d64ada501a Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +00:00
Sam Leffler
9967cafc49 Correct mbuf packet header propagation. Previously, packet headers
were sometimes propagated using M_COPY_PKTHDR which actually did
something between a "move" and a  "copy" operation.  This is replaced
by M_MOVE_PKTHDR (which copies the pkthdr contents and "removes" it
from the source mbuf) and m_dup_pkthdr which copies the packet
header contents including any m_tag chain.  This corrects numerous
problems whereby mbuf tags could be lost during packet manipulations.

These changes also introduce arguments to m_tag_copy and m_tag_copy_chain
to specify if the tag copy work should potentially block.  This
introduces an incompatibility with openbsd which we may want to revisit.

Note that move/dup of packet headers does not handle target mbufs
that have a cluster bound to them.  We may want to support this;
for now we watch for it with an assert.

Finally, M_COPYFLAGS was updated to include M_FIRSTFRAG|M_LASTFRAG.

Supported by:	Vernier Networks
Reviewed by:	Robert Watson <rwatson@FreeBSD.org>
2002-12-30 20:22:40 +00:00
Sam Leffler
28788ed563 fix build (make LINT) 2002-12-30 19:45:30 +00:00
Matthew Dillon
07fd333df3 Remove the PAWS ack-on-ack debugging printf().
Note that the original RFC 1323 (PAWS) says in 4.2.1 that the out of
order / reverse-time-indexed packet should be acknowledged as specified
in RFC-793 page 69 then dropped.  The original PAWS code in FreeBSD (1994)
simply acknowledged the segment unconditionally, which is incorrect, and
was fixed in 1.183 (2002).  At the moment we do not do checks for SYN or FIN
in addition to (tlen != 0), which may or may not be correct, but the
worst that ought to happen should be a retry by the sender.
2002-12-30 19:31:04 +00:00
Sam Leffler
069f35d328 correct style bogons 2002-12-30 18:45:31 +00:00
Jake Burkholder
591871e5cb Fix compiling without DDB and ALT_BREAK_TO_DEBUGGER.
Submitted by:	marius@alchemy.franken.de
2002-12-30 18:18:22 +00:00
Maxime Henrion
c9257029fd Leave only one of the two $FreeBSD$ tag, and use __FBSDID(). 2002-12-30 12:46:08 +00:00
David E. O'Brien
525d98afd8 Change the ident so people know a kernel built with this has SMP support. 2002-12-30 11:36:17 +00:00
David E. O'Brien
5fb4613b6b Sync with GENERIC rev 1.371. 2002-12-30 11:34:45 +00:00
David E. O'Brien
83d06d0529 Using our new wonderful include directive, save our x86 SMP users from
having to edit GENERIC to build a useful kernel.  This also opens the
possibility of including an SMP kernel in the release.
2002-12-30 11:31:58 +00:00
Hidetoshi Shimokawa
e238f68de5 - Add more CSR related definitions (IEEE-1212).
- Fix struct csrtext's spec fields.
- Add prototypes of upcoming configuration ROM related functions.
2002-12-30 09:41:32 +00:00
Alan Cox
c9267356b7 - Mark the kernel_map as a system map immediately after its creation.
- Correct a cast.
2002-12-30 05:55:41 +00:00
Sam Leffler
d47693eb7a o cannot use M_COPY_PKTHDR on an mbuf that has a cluster; if we need to
do this avoid m_getcl so we can copy the packet header to a clean mbuf
  before adding the cluster
o move an assert to the right place

Supported by:	Vernier Networks
2002-12-30 02:15:18 +00:00
Alan Cox
3a92e5d5e9 - Increment the vm_map's timestamp if _vm_map_trylock() succeeds.
- Introduce map_sleep_mtx and use it to replace Giant in
   vm_map_unlock_and_wait() and vm_map_wakeup().  (Original
   version by: tegge.)
2002-12-30 00:41:33 +00:00
Alan Cox
e3a9e1b2a8 - Remove vm_object_init2(). It is unused.
- Add a mtx_destroy() to vm_object_collapse().  (This allows a bzero()
   to migrate from _vm_object_allocate() to vm_object_zinit(), where it
   will be performed less often.)
2002-12-29 21:01:14 +00:00
Robert Watson
a95f262c6b Synchronize to kern/syscalls.master:1.139.
Obtained from:	TrustedBSD Project
2002-12-29 20:33:26 +00:00
Robert Watson
d5f34a784b Provide prototypes for new ACL system calls to manipulate ACLs "by
name" without following symbolic links, as well as library wrappers.

Obtained from:	TrustedBSD Project
2002-12-29 20:30:00 +00:00
Robert Watson
3c67c23bcf Implement new ACL system calls which do not follow symbolic links:
__acl_get_link(), __acl_set_link(), acl_delete_link(), and
__acl_aclcheck_link(), with almost identical implementations to
the existing __acl_*_file() variants on these calls.  Update
copyright.

Obtained from:	TrustedBSD Project
2002-12-29 20:28:44 +00:00
Robert Watson
6f123c35a0 Regen from syscalls.master:1.139 2002-12-29 20:26:41 +00:00
Robert Watson
b1f4acd8ac Add definitions for four new system calls:
__acl_get_link()	Retrieve an ACL by name without following
			symbolic links.
__acl_set_link()	Set an ACL by name without following
			symbolic links.
__acl_delete_link()	Delete an ACL by name without following
			symbolic links.
__acl_aclcheck_link()	Check an ACL against a file by name without
			following symbolic links.

These calls are similar in spirit to lstat(), lchown(), lchmod(), etc,
and will be used under similar circumstances.

Obtained from:	TrustedBSD Project
2002-12-29 20:25:54 +00:00
Mike Barcroft
38dbec4363 Fix drift of the comment about sa_sigaction away from its code.
Fix English in this comment.

Submitted by:	bde
2002-12-29 19:34:37 +00:00
Doug Ambrisko
6cafe2646a Add support for MPI-350 the mini-pci Cisco Aironet card. This needs more
work.  The interface was gleaned from the Linux driver.  Currently only
one RX & one TX buffer are used.  Firmware support is not tested so for the
MPI-350 so it is disabled.  Signal cache and monitor mode are not supported
yet.  Signal cache is not supported since in encapsulation mode ethernet
frames are returned by the chip.  LAN monitor mode support will be added
shortly.  Thanks to Warner for the MPI-350 card he sent me.

Add support for RSSI map from PR kern/32880 which was incomplete.  Enhanced
with the ability to select the cache mode of raw, dbm or per-cent.

Clean up Signal/Noise/Quality structures and units with help from
Marco Molteni.

Change flash to use a malloc'ed buffer when needed.

PR:		kern/32880
Submitted by:	Douglas S. J. De Couto decouto@pdos.lcs.mit.edu,
		Marco Molteni
MFC:		3 weeks
2002-12-29 19:22:07 +00:00
Ian Dowse
6a1b2a22ef Add a new vnode flag VI_DOINGINACT to indicate that a VOP_INACTIVE
call is in progress on the vnode. When vput() or vrele() sees a
1->0 reference count transition, it now return without any further
action if this flag is set. This flag is necessary to avoid recursion
into VOP_INACTIVE if the filesystem inactive routine causes the
reference count to increase and then drop back to zero. It is also
used to guarantee that an unlocked vnode will not be recycled while
blocked in VOP_INACTIVE().

There are at least two cases where the recursion can occur: one is
that the softupdates code called by ufs_inactive() via ffs_truncate()
can call vput() on the vnode. This has been reported by many people
as "lockmgr: draining against myself" panics. The other case is
that nfs_inactive() can call vget() and then vrele() on the vnode
to clean up a sillyrename file.

Reviewed by:	mckusick (an older version of the patch)
2002-12-29 18:30:49 +00:00
Poul-Henning Kamp
f8cfa0dbaf Implement ioctls for tampering with sector0. 2002-12-29 14:59:24 +00:00
Poul-Henning Kamp
4fe7f0f9c0 Add a couple of ioctls for modifying MBR's and the rest of sector0. 2002-12-29 14:56:04 +00:00
Poul-Henning Kamp
371400cf2e Use a timeout of one second while we wait for the vnode washer,
this prevents a potential race and makes the system a little bit
less jerky under extreme loads.
2002-12-29 11:18:25 +00:00
Poul-Henning Kamp
34dda7fac8 Save 16 bytes per mutex if MUTEX_PROFILING is not defined.
MUTEX_PROFILING is in opt_global.h, so this does not introduce a risk of
variant structure sizes unless foreign kernel modules are used.

This saved 16 bytes per vnode and 16 bytes per vm object for a total of
4MB on a 2GB machine.

Idea from:	alc
2002-12-29 11:14:41 +00:00
Poul-Henning Kamp
851a87ea1a Vnodes pull in 800-900 bytes these days, all things counted, so we need
to treat desiredvnodes much more like a limit than as a vague concept.

On a 2GB RAM machine where desired vnodes is 130k, we run out of
kmem_map space when we hit about 190k vnodes.

If we wake up the vnode washer in getnewvnode(), sleep until it is done,
so that it has a chance to offer us a washed vnode.  If we don't sleep
here we'll just race ahead and allocate yet a vnode which will never
get freed.

In the vnodewasher, instead of doing 10 vnodes per mountpoint per
rotation, do 10% of the vnodes distributed evenly across the
mountpoints.
2002-12-29 10:39:05 +00:00
Poul-Henning Kamp
402746a2d7 There is some sort of race/deadlock which I have not identified
here.  It manifests itself by sendmail hanging in "fifoow" during
boot on a diskless machine with sendmail disabled.

Giving the sleep a 1sec timout breaks the deadlock, but does not solve
the underlying problem.

XXX comment applied.
2002-12-29 10:32:16 +00:00
Jake Burkholder
07a312f6b6 Use memset instead of __builtin_memset. Apparently there's an inline
memset in libkern which causes problems; why that's there is beyond me.
2002-12-29 08:37:11 +00:00
Alan Cox
a28cc55e5b Reduce the number of times that we acquire and release the page queues
lock by making vm_page_rename()'s caller, rather than vm_page_rename(),
responsible for acquiring it.
2002-12-29 07:17:06 +00:00
Mike Barcroft
9d36cde4bf o Fix ordering of typedefs.
o Improve comment about namespace pollution.
o Improve CPP style.

Submitted by:	bde
2002-12-29 03:38:48 +00:00
Mike Barcroft
17d44bffff sa_handler is in the POSIX namespace (5.0-R candidate). 2002-12-29 01:50:22 +00:00
Jake Burkholder
bc4ede2030 Use the meaningful mnemonics for ancillary state registers now that gas
is invoked properly to understand them.

	%asr19 -> %gsr
	%asr20 -> %set_softint
	%asr21 -> %clear_softint
2002-12-29 00:23:48 +00:00
Jake Burkholder
418a8ca992 Forgot this file in previous commit. 2002-12-28 23:58:18 +00:00
Jake Burkholder
af13cb9f11 - Moved storing %g1-%g5 in the trapframe until after interrupts are enabled.
- Restore %g6 and %g7 for kernel traps if we are returning to prom code.
  This allows complex traps (ones that call into C code) to be handled from
  the prom.
2002-12-28 23:57:52 +00:00
Robert Watson
5bf93d2537 Map VAPPEND to VWRITE since the ugidfw rule syntax doesn't specifically
address the append access mode.

Reported by:	"Daniel C. Sobral" <dcs@newsguy.com>
Obtained from:	TrustedBSD Project
Sponosred by:	DARPA, Network Associates Laboratories

MFC Candidate.
2002-12-28 23:41:18 +00:00
Jake Burkholder
63100290f3 Pass 0 in %o1 to tl0_trap for all non-interrupt traps. This will be used
to pass the pil when tl0_trap also handles interrupts.
2002-12-28 23:34:21 +00:00
Jake Burkholder
24fbeaf9c3 Don't put a newline in KTR traces. 2002-12-28 23:22:22 +00:00
Jake Burkholder
dcc4093c7a Add a tunable kern.smp.disabled for disabling explicitly smp on an smp
kernel.
2002-12-28 23:21:13 +00:00
Alan Cox
2ee5fea7d3 Assert that the page queues lock rather than Giant is held in
vm_page_flag_clear().
2002-12-28 22:49:37 +00:00
Alan Cox
2cde7c14b4 - Use VM_ALLOC_WIRED.
- Hold the page queues lock around calls to vm_page_flag_clear() and
   vm_page_wakeup().
2002-12-28 22:47:45 +00:00
Poul-Henning Kamp
25ba12dfe4 Allow lint-like tools to override DROP_GIANT and friends.
Apply parens around macro arguments.
2002-12-28 22:29:10 +00:00
Poul-Henning Kamp
9f16282798 KASSERT that vop_revoke() gets a VCHR. 2002-12-28 22:27:14 +00:00
Poul-Henning Kamp
5c648baca8 It is bad style to define the same structure in multiple header
files which might be included together.

Things like debuggers and lint-like programs get their knickers in
a twist (rightly so one might add) when they find different locations
for the same named struct depending on which .h file were included
first.

This is a stellar example of Very Bad Thinking on the part of the
standards dudes who wrote that both sys/uio.h and sys/socket.h
should define struct iovec the same way.

Fix this by putting struct iovec into its own miniature sys/_iovec.h
file and #include that from sys/socket.h and sys/uio.h.

Sensible people could just put iovec into sys/_types.h but there
is probably some standard or other which will be violated if we
did something that horrible.
2002-12-28 22:17:29 +00:00
Poul-Henning Kamp
f53c6e5c9a Remove unused cdevsw_ALLOCSTART macro. 2002-12-28 21:47:43 +00:00
Poul-Henning Kamp
c5ec6754d5 Remove cdevw_add() calls, they are deprecated. 2002-12-28 21:40:20 +00:00
Poul-Henning Kamp
7068a01c6f Remove cdevsw_add calls, they are deprecated. 2002-12-28 21:39:46 +00:00
Poul-Henning Kamp
2b64426519 Remove calls to cdevsw_add(), they are dreprecated on this branch now. 2002-12-28 21:39:04 +00:00
Matthew Dillon
40bb4f4bcf vm_pager_put_pages() takes VM_PAGER_* flags, not OBJPC_* flags. It just
so happens that OBJPC_SYNC has the same value as VM_PAGER_PUT_SYNC so no
harm done.  But fix it :-)

No operational changes.

MFC after:	1 day
2002-12-28 21:15:39 +00:00
Alan Cox
472c3b6f4f Hold the page queues lock around calls to vm_page_flag_clear() and
vm_page_wakeup().
2002-12-28 21:14:44 +00:00
Jeffrey Hsu
decb81fec7 Indirectly pull in declaration for M_IFADDR. 2002-12-28 21:09:38 +00:00
Matthew Dillon
43b7990e30 Allow the VM object flushing code to cluster. When the filesystem syncer
comes along and flushes a file which has been mmap()'d SHARED/RW, with
dirty pages, it was flushing the underlying VM object asynchronously,
resulting in thousands of 8K writes.  With this change the VM Object flushing
code will cluster dirty pages in 64K blocks.

Note that until the low memory deadlock issue is reviewed, it is not safe
to allow the pageout daemon to use this feature.  Forced pageouts still
use fs block size'd ops for the moment.

MFC after:	3 days
2002-12-28 21:03:42 +00:00
Matthew Dillon
3a3d82ec0a Abstract-out the constants for the sequential heuristic.
No operational changes.

MFC after:	1 day
2002-12-28 20:37:50 +00:00
Matthew Dillon
45587e2514 Abstract-out the constants for the sequential heuristic.
No operational changes.

MFC after:	1 day
2002-12-28 20:28:10 +00:00
Alan Cox
a623fedef7 Two changes to kmem_malloc():
- Use VM_ALLOC_WIRED.
 - Perform vm_page_wakeup() after pmap_enter(), like we do everywhere else.
2002-12-28 19:03:54 +00:00
Maxim Sobolev
638d2f4fe8 Add support for IC Book Labs Dreadnought x16 Lite.
Approved by:	re
2002-12-28 15:45:38 +00:00
Robert Watson
2a4689e84a Change ACPI make_dev() calls to use UID_ and GID_ constants rather
than hard-coded uids and gids.

Switch the device to a group of wheel instead of operator.

Narrow down the permissions on the device to require root privilege
to manipulate the system power state.  It may be that we can broaden
access to the device after review of the access control in ACPI.

Submitted by:	kris
Reviewed by:	takawata
2002-12-28 14:58:50 +00:00
Alan Cox
fca5d6baba Use VM_ALLOC_WIRED in pmap_pinit(). 2002-12-28 08:10:29 +00:00
Scott Long
b4b9c52ca4 Add the if_bge driver. I can't find any reason why it's not here, and it's
pretty common on Dell servers and other high-end boxes.
2002-12-28 06:22:17 +00:00
Robert Watson
adfad1eb35 Trim left-over and unused vop_refreshlabel() bits from devfs.
Reported by:	bde
2002-12-28 05:39:25 +00:00
Kelly Yancey
e366b8c087 Remove useless local variable from raw_input().
Sponsored by:	NTT Multimedia Communications Labs
MFC after:	3 days
2002-12-28 02:29:19 +00:00
Julian Elischer
93a7aa79d6 Add code to ddb to allow backtracing an arbitrary thread.
(show thread {address})

Remove the IDLE kse state and replace it with a change in
the way threads sahre KSEs. Every KSE now has a thread, which is
considered its "owner" however a KSE may also be lent to other
threads in the same group to allow completion of in-kernel work.
n this case the owner remains the same and the KSE will revert to the
owner when the other work has been completed.

All creations of upcalls etc. is now done from
kse_reassign() which in turn is called from mi_switch or
thread_exit(). This means that special code can be removed from
msleep() and cv_wait().

kse_release() does not leave a KSE with no thread any more but
converts the existing thread into teh KSE's owner, and sets it up
for doing an upcall. It is just inhibitted from being scheduled until
there is some reason to do an upcall.

Remove all trace of the kse_idle queue since it is no-longer needed.
"Idle" KSEs are now on the loanable queue.
2002-12-28 01:23:07 +00:00
Alan Cox
84cdcd85a0 Assert that the page queues lock is held in pmap_testbit(). 2002-12-28 00:19:40 +00:00
Alan Cox
35c016315f - Change vm_object_page_collect_flush() to assert rather than
acquire the page queues lock.
 - Acquire the page queues lock in vm_object_page_clean().
2002-12-27 20:16:13 +00:00
Jake Burkholder
7b666b648f Define UMA_MD_SMALL_ALLOC so that uma_small_alloc and uma_small_free will
be used for zones that allocate objects of less 1 page.  The biggest advantage
of this is that all of a sudden the majority of kernel malloc-ed data doesn't
need kva allocated for it.  Besides microbenchmarks I haven't seen a measurable
performance improvement from doing this.
2002-12-27 19:31:26 +00:00
Jake Burkholder
66a6d547ec Teach /dev/kmem about direct mapped addresses.
Note that a better solution for how to make kernacc work for direct mapped
addresses is needed for all platforms that use them.
2002-12-27 19:18:04 +00:00
Robert Watson
5606ac9e89 Re-add MNT_ACLS to the list of "updateable" mount flags, per our
documentation.  Generally, you really shouldn't twiddle the flag,
but there are sensible scenarios where one might.

Obtained from:	TrustedBSD Project
2002-12-27 18:20:16 +00:00
Robert Watson
9e9466baf3 Use OPERATOR instead of WHEEL for make_dev(), use 0640 instead of 0644
for disk devices to be consistent with other storage devices.

Submitted by:	kris
Reviewed by:	scottl
2002-12-27 17:52:16 +00:00
Robert Watson
5083ed18af Use UID_ and GID_ constants instead of hard-coded numeric values
with make_dev().  Use OPERATOR instead of implicit WHEEL to match
other storage devices.  Use a mode of 0640 to be consistent
with other storage devices.

Submitted by:	kris
Reviewed by:	scottl
2002-12-27 17:50:39 +00:00
Ian Dowse
ed1a13b18f Bridged packets are supplied to the firewall with their IP header
in network byte order, but icmp_error() expects the IP header to
be in host order and the code here did not perform the necessary
swapping for the bridged case. This bug causes an "icmp_error: bad
length" panic when certain length IP packets (e.g. ip_len == 0x100)
are rejected by the firewall with an ICMP response.

MFC after:	3 days
2002-12-27 17:43:25 +00:00
Ian Dowse
03a585553a Oops, I misread the purpose of the NULL check in EH_RESTORE() in
revision 1.62. It was checking for M_PREPEND() failing, not for the
case of a NULL mbuf pointer being supplied to the macro. Back out
that revision, and fix the NULL dereference by not calling EH_RESTORE()
in the case where the mbuf pointer is NULL because the firewall
rejected the packet.
2002-12-27 17:15:16 +00:00
Robert Watson
f0bc12ee8d Improve consistency between devfs and MAKEDEV: use UID_ROOT and
GID_WHEEL instead of UID_BIN and GID_BIN for /dev/fd/* entries.

Submitted by:	kris
2002-12-27 16:54:44 +00:00
Robert Watson
0c5716be39 Use UID_ROOT and GID_WHEEL for uid/gid argments to make_dev().
Remove the setgid bit from the tga device (?).
Synchronize mode with modes used for related frame buffer devices
in MAKEDEV (tga doesn't appear in MAKEDEV).

Submitted by:	kris
2002-12-27 16:44:11 +00:00
Robert Watson
adbc548002 Make use of UID_ROOT, GID_WHEEL for make_dev() arguments.
Remove the setgid bit from the 3dfx device (?).
Synchronize permissions with the values in MAKEDEV for consistency.

Submitted by:	kris
2002-12-27 16:40:54 +00:00
Robert Watson
2066d8e707 Synchronize mode for ppsX devices to that found previously in MAKEDEV
for consistency.

Submitted by:	kris
2002-12-27 16:34:12 +00:00
Robert Watson
805229eb77 Synchronize make_dev() for pcfclock devices to the values in MAKEDEV
for consistency.

Submitted by:	kris
2002-12-27 16:32:10 +00:00
Robert Watson
3055da59a9 Remove S_IROTH from the make_dev() lines for iir-related devices. This
improves protection consistency with other storage devices (generally
root:operator,660).  This driver appears not to have an active
maintainer.

Submitted by:	kris
2002-12-27 16:28:31 +00:00
Ian Dowse
bf235b1710 Fix a bug introduced by revision 1.59 that would cause an immediate
NULL dereference if a bridged packet was rejected by ipfw.
2002-12-27 16:27:45 +00:00
Poul-Henning Kamp
aa4d7a8a4b Use three UMA zones for FFS/UFS inodes instead of malloc space.
Since inodes are currently 144 bytes, this will save 112 bytes per
inode.  This can amount to up to 10MByte on large systems.
2002-12-27 11:05:05 +00:00
Poul-Henning Kamp
de6ba7c016 Move the allocation of the inode contents into ffs_vfsops.c rather than
passing malloc types around.
2002-12-27 10:23:03 +00:00
Poul-Henning Kamp
975512a907 Make ffs_mountfs() static.
Remove the malloctype from the ufs mount structure, instead add a callback
to the storage method for freeing inodes: UFS_IFREE().

Add vfs_ifree() method function which frees an inode.

Unvariablelize the malloc type used for allocating inodes.
2002-12-27 10:06:37 +00:00
Alfred Perlstein
5590e7fdf0 Lock filedesc while performing a range check on the file descriptor.
Reviewed by: alc
2002-12-27 08:39:42 +00:00
Poul-Henning Kamp
9693da433c Remove the "ascii" attribute from the sysctls so that "sysctl -a" will
skip them.
2002-12-27 07:58:59 +00:00
Alan Cox
d746789347 Hold the page queues lock when calling vm_page_flag_clear(). 2002-12-27 06:52:32 +00:00
Alan Cox
969da54c3a Increase the scope of the page queues lock in phys_pager_getpages(). 2002-12-27 06:09:56 +00:00
Jake Burkholder
9ff9f0fb80 Implement uma_small_alloc and uma_small_free. Not yet used. 2002-12-27 03:11:29 +00:00
Jake Burkholder
885f001d98 - Use direct mapped addresses for the message buffer, for the crash dump
mappings, and for pmap_map which is used to map the vm_page structures.
- Don't allocate kva space for any of the above.
2002-12-27 01:50:29 +00:00
Jeffrey Hsu
c919b1e24b Long chain of calls starting with bridge_on(), going through IPv6, and
ending up at ifa_ifwithdstaddr() could lead to a recursive lock of
the ifnet list mutex.
2002-12-27 00:24:35 +00:00
Poul-Henning Kamp
5ab413bf6e white-space changes 2002-12-26 21:02:50 +00:00
Poul-Henning Kamp
3ff81a4ca8 Use a mutex assert to document our locking circumstances. 2002-12-26 20:48:22 +00:00
Poul-Henning Kamp
4fbfd368dd We should not need to hold Giant for sbuf operations any more. 2002-12-26 20:46:30 +00:00
Poul-Henning Kamp
cd4b1352fa Add an XXX comment to explain the predicament. 2002-12-26 20:45:37 +00:00
Ian Dowse
326b4d74c4 When resuming after a system suspend, re-issue the UHCI_CMD_MAXP
command in case this setting was not saved. Since bandwidth reclamation
(-current only) often results in bus activity continuing to the end
of every frame, most transfers would fail with IOERROR if this
setting is missed.

Reviewed by:	n_hibma
MFC after:	1 week
2002-12-26 13:25:57 +00:00
David Xu
4b2d2f604c Set %bx register instead of %di register, see vbe3.0, page 45. 2002-12-26 13:20:58 +00:00
Hidetoshi Shimokawa
ee126d67f7 Cosmetic change. s/Firewire/FireWire/. 2002-12-26 06:50:09 +00:00
Hidetoshi Shimokawa
f3abec2274 Replace ntohl() with ntohs() because orb_hi is u_int16_t. 2002-12-26 06:41:37 +00:00
Jeffrey Hsu
7701e15b6b Disable radix node locking for sysctl until we fix the sysctl infrastructure
to not sleep.
2002-12-26 03:35:57 +00:00
Hidetoshi Shimokawa
ac9f66922b firewire.c
- Fix permission of device node.

fwochi.c, fwohcireg.h
- Detect phy access failure correct way.
- Set root hold-off bit before initiating bus reset.
	This should fix the problem with VIA6306.

fwohcivar.h
- Fix over-allocation of array. (fwohcivar.h)

sbp.c
- Return CAM_DEV_NOT_THERE rather than CAM_TID_INVALID to prevent retry.
2002-12-26 03:17:59 +00:00
Ruslan Ermilov
d68189df30 Typo in function name. 2002-12-25 11:40:53 +00:00
Ruslan Ermilov
94e013f0e6 I'm not sure what was the problem at the time of revision 1.37
when julian@ added it, but the commented out code had at least
one bug -- not freeing the allocated mbuf.

Anyway, this comment no longer applies as of revision 1.67, so
remove it.
2002-12-25 10:55:44 +00:00
Jeffrey Hsu
b2aaf46eae Range-check the address family parameter passed in to the sysctl handler.
Submitted by:	ru
2002-12-25 10:51:20 +00:00
Ruslan Ermilov
42e9e16d2b Revision 1.67 changes correspond to CSRG revision 8.3.1.1 changes. 2002-12-25 10:50:08 +00:00
Ruslan Ermilov
71eba91593 If the caller of rtrequest*(RTM_DELETE, ...) asked for a copy of
the entry being removed (ret_nrt != NULL), increment the entry's
rt_refcnt like we do it for RTM_ADD and RTM_RESOLVE, rather than
messing around with 1->0 transitions for rtfree() all over.
2002-12-25 10:21:02 +00:00
Ruslan Ermilov
053e23428c A month after pst@ has committed his revision 1.8, it was
incorporated by UCB as revision 8.5.  Do a diff reduction.
2002-12-25 09:16:58 +00:00
Jeffrey Hsu
6f782c4636 Ensure that the made-up inode number for a Unix domain socket is persistent. 2002-12-25 07:59:39 +00:00
Jeffrey Hsu
abe239cfe2 Validate inp to prevent an use after free. 2002-12-24 21:00:31 +00:00
Robert Watson
79191eca57 Flush vop_refreshlabel() definition, since it is no longer used.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2002-12-24 19:47:13 +00:00
Alan Cox
82ea080d88 - Hold the page queues lock around calls to vm_page_flag_clear(). 2002-12-24 19:02:03 +00:00
Robert Watson
dcce7232ef Require privilege to flush the signal cache on if_an and if_wi 802.11
cards.

Reviewed by:	imp (if_wi)
2002-12-24 14:46:01 +00:00
Maxim Konovalov
f4ef616f98 o De-anonymity dummynet(4) and ipfw(4) messages, prepend them
by 'dummynet: ' and 'ipfw: ' prefixes.

PR:		kern/41609
2002-12-24 13:45:24 +00:00
Poul-Henning Kamp
a7010ee2f4 White-space changes. 2002-12-24 09:44:51 +00:00
Alan Cox
11a2911cec - Hold the page queues lock around calls to vm_page_wakeup() and
vm_page_flag_clear().
2002-12-24 07:32:38 +00:00
Alan Cox
dc907f6632 - Hold the page queues lock around vm_page_wakeup(). 2002-12-24 04:24:58 +00:00
Jeffrey Hsu
956b0b653c SMP locking for radix nodes. 2002-12-24 03:03:39 +00:00
Jake Burkholder
a106c6930a - Change the way the direct mapped region is implemented to be generally
useful for accessing more than 1 page of contiguous physical memory, and
  to use 4mb tlb entries instead of 8k.  This requires that the system only
  use the direct mapped addresses when they have the same virtual colour as
  all other mappings of the same page, instead of being able to choose the
  colour and cachability of the mapping.
- Adapt the physical page copying and zeroing functions to account for not
  being able to choose the colour or cachability of the direct mapped
  address.  This adds a lot more cases to handle.  Basically when a page has
  a different colour than its direct mapped address we have a choice between
  bypassing the data cache and using physical addresses directly, which
  requires a cache flush, or mapping it at the right colour, which requires
  a tlb flush.  For now we choose to map the page and do the tlb flush.

This will allows the direct mapped addresses to be used for more things
that don't require normal pmap handling, including mapping the vm_page
structures, the message buffer, temporary mappings for crash dumps, and will
provide greater benefit for implementing uma_small_alloc, due to the much
greater tlb coverage.
2002-12-23 23:39:57 +00:00
Poul-Henning Kamp
08c7670a8b Move the declaration of the socket fileops from socketvar.h to file.h.
This allows us to use the new typedefs and removes the needs for a number
of forward struct declarations in socketvar.h
2002-12-23 22:46:47 +00:00
Julian Elischer
4ea478a43f Make it work -current style. 2002-12-23 22:33:08 +00:00
Julian Elischer
6282381da2 Make ng_fec.c compile again since Sam's changes.
Submitted by:	Hiten Pandya (hiten@unixdaemons.com)
2002-12-23 22:31:24 +00:00
Poul-Henning Kamp
152e80d952 Outdent the string rather than use concatenation. 2002-12-23 22:12:17 +00:00
Poul-Henning Kamp
f3a682116c Detediousficate declaration of fileops array members by introducing
typedefs for them.
2002-12-23 21:53:20 +00:00
Poul-Henning Kamp
828463d085 Change the chip description from "DFE-550TX" to "DL10050".
The DL10050 chip is used on the 550TX and 580TX cards, probably
others as well.
2002-12-23 21:50:47 +00:00
Alan Cox
e7863f186a - Hold the page queues lock around vm_page_wakeup(). 2002-12-23 21:47:46 +00:00
Poul-Henning Kamp
6ce9c72c30 s/sokqfilter/soo_kqfilter/ for consistency with the naming of all
other socket/file operations.
2002-12-23 21:37:28 +00:00
Alan Cox
6e14fce9d9 - Hold the kernel_object's lock around vm_page_insert(..., kernel_object,
...).
2002-12-23 20:39:15 +00:00
Alan Cox
0cb6c00463 - Hold the kernel_object's lock around vm_page_alloc(kernel_object,...).
- Hold the page queues lock around vm_page_wakeup().
2002-12-23 20:10:47 +00:00
Prafulla Deuskar
a58e485d36 - Move to array based indexing for TX/RX descriptor/buffer management
- Added support for ITR (interrupt throttle register). This feature is available on
adapters based on 82545 and above
- Fixed problem with vlan support when traffic has priority bits set. (kern/45907)

PR:			kern/45907
MFC after:		1 week
2002-12-23 19:11:23 +00:00
Ruslan Ermilov
36fea5de60 rn_walktree*() compute the next leaf before applying a function
to current leaves because function may vanish the current node.

If parent RTA_GENMASK route has a clone (a "cloning clone"), an
rn_walktree_from() starting from parent will cause another walk
starting from clone.  If a function is either rt_fixdelete() or
rt_fixchange(), this recursive walk may vanish the leaf that is
remembered by an outer walk (the "next leaf" above), panicing a
system when it resumes with an outer walk.

The following script paniced my single-user mode booted system:

: sysctl net.inet.ip.forwarding=1
: ipfw add 1 allow ip from any to any
: ifconfig lo0 127.1
: route add -net 10 -genmask 255.255.255.0 127.1
: telnet 10.1			# rt_fixchange() panic
: telnet 10.2
: telnet 10.1
: route delete -net 10		# rt_fixdelete() panic

For the time being, avoid these races by disallowing recursive
walks in rt_fixchange() and rt_fixdelete().

Also, make a slight optimization in the rtrequest(RTM_RESOLVE)
case: there is no reason to call rt_fixchange() in this case.

PR:		kern/37606
MFC after:	5 days
2002-12-23 13:12:41 +00:00
Alan Cox
903caa598d Avoid holding the vnode interlock around malloc() or free() to prevent a
lock order reversal.

Reviewed by:	jeff
2002-12-23 06:20:41 +00:00
Alan Cox
7af7dd3c6f Eliminate some dead code. (Any possible use for this code died with
vm/vm_page.c revision 1.220.)

Submitted by:	bde
2002-12-23 04:35:38 +00:00
Marcel Moolenaar
991fcff585 Fix a De Morgan bug: If we only expect a memory range OR an
I/O port range, then we should ignore a resource if it's NOT
a memory range AND NOT an I/O port range.
The OR in the condition caused us to ignore perfectly valid
memory addresses.

While here, remove redundant parenthesis and reindent the
debug print to avoid long lines.
2002-12-23 03:48:59 +00:00
Jake Burkholder
dcedf26597 - Fix a bug where the faulting address for an mmu miss could sometimes be
clobbered due to some debug code.  This was harmless and just superfluous
  soft faults.
- Update some comments.
2002-12-23 02:18:45 +00:00
Jake Burkholder
950002bf92 - Rearrange pmap_bootstrap slightly to be more in dependency order.
- Put the kernel tsb before before the kernel load address, below
  VM_MIN_KERNEL_ADDRESS, instead of after the kernel where it consumes
  usable kva.  This is magic mapped so the virtual address is irrelevant,
  it just needs to be out of the way.
2002-12-22 23:01:14 +00:00
Mike Barcroft
089a3f75e9 Add suseconds_t and useconds_t for storing microseconds. 2002-12-22 22:02:41 +00:00
Jake Burkholder
c3c2862df4 - Add a spin lock to single thread cache invalidation and tlb flush ipis,
which allows ipis to be sent outside of Giant.
- Remove the ap boot mutex, which is unused.
2002-12-22 20:50:23 +00:00
Kris Kennaway
4ef3d7a27b Enforce correct ordering of the filedesc structure and pipe mutex, because
WITNESS can get the order wrong if it guesses based on first use.

Reviewed by:	jhb, alfred
2002-12-22 16:32:34 +00:00
Pierre Beyssac
1ba7727b9e Remove forgotten INP_UNLOCK(inp) in my previous commit.
Reported by: hsu
2002-12-22 13:04:08 +00:00
Tim J. Robbins
b30a7779d4 MB_LEN_MAX is not MD, move it to the MI limits.h. 2002-12-22 06:38:45 +00:00
Jeffrey Hsu
b30a244c34 SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
Matthew Dillon
9991ea7178 The UP -current was not properly counting the per-cpu VM stats in the
sysctl code.  This makes 'systat -vm 1's syscall count work again.

Submitted by:	Michal Mertl <mime@traveller.cz>
Note:		also slated for 5.0
2002-12-22 05:04:30 +00:00
Matthew Dillon
6c82636572 Revert part of the last commit. Do not fake-up the cylinders to make
the sectors fit (at least, don't fake them up any more then they are
already faked up).
2002-12-22 04:46:44 +00:00
Jake Burkholder
b8eb0267c0 - Add a pmap pointer to struct md_page, and use this to find the pmap that
a mapping belongs to by setting it in the vm_page_t structure that backs
  the tsb page that the tte for a mapping is in.  This allows the pmap that
  a mapping belongs to to be found without keeping a pointer to it in the
  tte itself.
- Remove the pmap pointer from struct tte and use the space to make the
  tte pv lists doubly linked (TAILQs), like on other architectures.  This
  makes entering or removing a mapping O(1) instead of O(n) where n is the
  number of pmaps a page is mapped by (including kernel_pmap).
- Use atomic ops for setting and clearing bits in the ttes, now that they
  return the old value and can be easily used for this purpose.
- Use __builtin_memset for zeroing ttes instead of bzero, so that gcc will
  inline it (4 inline stores using %g0 instead of a function call).
- Initially set the virtual colour for all the vm_page_ts to be equal to their
  physical colour.  This will be more useful once uma_small_alloc is
  implemented, but basically pages with virtual colour equal to phsyical
  colour are easier to handle at the pmap level because they can be safely
  accessed through cachable direct virtual to physical mappings with that
  colour, without fear of causing illegal dcache aliases.

In total these changes give a minor performance improvement, about 1%
reduction in system time during buildworld.
2002-12-21 22:43:19 +00:00
Warner Losh
d36644f2d9 Be nice. There are evidentally a number of different cards that
identify themselves as serial cards that it would be desirable to
attach a different driver than sio to.  Since we are claiming all
serial cards, this is not possible.  Instead, return -100 to indicate
that we're willing to take the card, but still allow other drivers to
attach.

Pointed out by: Maksim Yevmenkin
2002-12-21 22:37:54 +00:00
Matthew Dillon
a19f30d8c9 do not try to free a mountpoint that we did not allocate.
X-MFC after:	immediately
2002-12-21 20:55:34 +00:00
Pierre Beyssac
87cd4001b5 In syncache_timer(), don't attempt to lock the inpcb structure
associated with the syncache entry: in case tcp_close() has been
called on the corresponding listening socket, the lock has been
destroyed as a side effect of in_pcbdetach(), causing a panic when
we attempt to lock on it.

Reviewed by:	hsu
2002-12-21 19:59:47 +00:00
Jake Burkholder
e43e24711b Make pmap_qenter and pmap_qremove look more like the other pmaps. 2002-12-21 10:44:30 +00:00
Jake Burkholder
fabf7ce58c Removed unused pmap_qenter_flags. 2002-12-21 10:04:14 +00:00
Jake Burkholder
fe1998ec51 Make the atomic arithmetic functions return the old value, since they're
all implemented with cas anyway.
2002-12-21 08:53:26 +00:00
David E. O'Brien
cf47cae1f5 -mno-align-long-strings can make things smaller, so lets use it in hopes
that it does here.
2002-12-21 02:03:31 +00:00
Marcel Moolenaar
551d79e177 Fix multiple registration of the elf_legacy_coredump sysctl variable.
The duplication is caused by the fact that imgact_elf.c is included
by both imgact_elf32.c and imgact_elf64.c and both are compiled by
default on ia64. Consequently, we have two seperate copies of the
elf_legacy_coredump variable due to them being declared static, and
two entries for the same sysctl in the linker set, both referencing
the unique copy of the elf_legacy_coredump variable. Since the second
sysctl cannot be registered, one of the elf_legacy_coredump variables
can not be tuned (if ordering still holds, it's the ELF64 related one).

The only solution is to create two different sysctl variables, just
like the elf<32|64>_trace sysctl variables. This unfortunately is an
(user) interface change, but unavoidable. Thus, on ELF32 platforms
the sysctl variable is called elf32_legacy_coredump and on ELF64
platforms it is called elf64_legacy_coredump. Platforms that have
both ELF formats have both sysctl variables.

These variables should probably be retired sooner rather than later.
2002-12-21 01:15:39 +00:00
Sam Leffler
00f21882a0 replace the special-purpose rate-limiting code with the general facility
just added; this tries to maintain the same behaviour vis a vis printing
the rate-limiting messages but need tweaking
2002-12-21 00:08:20 +00:00
Sam Leffler
69f05a0761 define HAVE_PPSRATECHECK now that we have this stuff in the kernel
(probably belongs elsewhere; add it this way for now so the system
will build)
2002-12-20 23:57:22 +00:00
Sam Leffler
91974ce10b add generic rate limiting support from netbsd; ratelimit is purely time based,
ppsratecheck is for controlling packets/second

Obtained from:	netbsd
2002-12-20 23:54:47 +00:00
Jake Burkholder
9830739b64 Add page queue locking around functions that call vm_page_flag_set. This
fixes a failed assertion early in boot on sparc64.

Reported by:	Roderick van Domburg <r.s.a.vandomburg@student.utwente.nl>
2002-12-20 21:47:21 +00:00
Alan Cox
2952e1fb58 Extend the scope of the page queues lock in vm_pgmoveco(). 2002-12-20 21:18:29 +00:00
Alan Cox
671e427ce9 Increase the scope of the kmem_object locking in kmem_malloc(). 2002-12-20 18:59:23 +00:00
Matthew Dillon
cc7bab9032 Modify the fake cylinders calculation so it is >= the size of the device,
not < the size of the device.  This avoids geom complaints.

Fix a serious bug in the handling of the RS_NO_CLEAR_UA quirk.  When we
go and insert the test-unit-ready command the umass_cam_quirk_cb() function
sets the status as if the READ_CAPACITY command suceeded when, in fact, it
did not.  This leads to the CAM layer trying to use garbage in the return
buffer and panicing the system (or doing other bad things).

Add a quirk entry for MSYSTEMS DISK-ON-KEY, which is sold under the Sony
brand as a solid state disk-on-key usb device.  This device requires
several quirks to work properly.

Note that the disk-on-key device will not work properly until CAM also
gets a quirk entry for it, which has been submitted to the CAM maintainer,
and you may have to temporarily uncomment the DELAY() as well.  -current
does not properly wait for devices to power up so you may also have
to temporarily uncomment the DELAY(300000) to make your device work.
A solution must be found to that issue.

MFC after:	3 days
X-MFC note:	the quirk support must MFCd before this patch can be
2002-12-20 18:56:55 +00:00
Matthew Dillon
698df1f738 Fix two bugs in the DMA chaining code for OHCI. The first bug is that
the dataphysend calculation could only possibly work if the virtual buffer
is also physically contiguous.  Calculate dataphysend by calculating the
ending virtual address first, then converting to a physical address.

The second bug applies only to NetBSD and OpenBSD and involves the curlen
calculation in the two-contiguous-physical-pages case (which we don't support).

Also cleanup the use of the OHIC_PAGE() macro on dataphysend and add a panic
if len goes negative (meaning we lost the physical page translation
representing the end of the buffer).

IMHO the dataphysend is still bokered since it might be misrepresented
by shared userland page mappings.  The whole section needs to be rewritten
to use the virtual address range.

MFC after:	3 days
2002-12-20 18:47:39 +00:00
Maxime Henrion
894db7b01f Don't forget to destroy the mutex if an error occurs
in the jail() system call.

Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2002-12-20 14:32:20 +00:00
Søren Schmidt
01ed335875 Fxi support for the Promise SuperTrak 100, the PCI id was wrong. 2002-12-20 12:15:38 +00:00
Jeffrey Hsu
9a39fc9d73 Eliminate a goto.
Fix some line breaks.
2002-12-20 11:24:02 +00:00
Jeffrey Hsu
12e552d69f Swap the order of a free and a use of an ifaddr structure. 2002-12-20 11:21:07 +00:00
Jeffrey Hsu
540e8b7e31 Unravel a nested conditional.
Remove an unneeded local variable.
2002-12-20 11:16:52 +00:00
Warner Losh
1e315c9022 Put back the casts to unsigned. While no strictly necessary for its
current uses, the name strcmp has strong connotations that shouldn't
lightly be discarded.  This doesn't cost us anything.

Submitted by: bde
2002-12-20 05:49:40 +00:00
Alan Cox
4b420d501f Add a mutex to struct vm_object. Initialize and destroy that mutex
at appropriate times.  For the moment, the mutex is only used on
the kmem_object.
2002-12-20 05:10:32 +00:00
Jake Burkholder
83110b06f8 Fix breakage from earlier inadvertant changes. 2002-12-20 04:32:10 +00:00
Jeffrey Hsu
f320a1bfd2 Expand scope of TCP protocol lock to cover syncache data structures. 2002-12-20 00:24:19 +00:00
Bosko Milekic
86fea6be59 o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and
the mbuf allocator flags {M_TRYWAIT, M_DONTWAIT}.
o Fix a bpf_compat issue where malloc() was defined to just call
  bpf_alloc() and pass the 'canwait' flag(s) along.  It's been changed
  to call bpf_alloc() but pass the corresponding M_TRYWAIT or M_DONTWAIT
  flag (and only one of those two).

Submitted by: Hiten Pandya <hiten@unixdaemons.com> (hiten->commit_count++)
2002-12-19 22:58:27 +00:00
Alan Cox
cf3e6e4837 Remove the hash_rand field from struct vm_object. As of revision 1.215 of
vm/vm_page.c, it is unused.
2002-12-19 20:01:22 +00:00
Jake Burkholder
7c6c018c0c Renamed the loader's zipfs to gzipfs. zipfs.c was repo-copied to gzipfs.c. 2002-12-19 19:34:59 +00:00
Poul-Henning Kamp
cea573842c Don't forget our topology lock in the MBREXT case. 2002-12-19 12:01:19 +00:00
Alan Cox
24c9ad6bed - Remove vm_page_sleep_busy(). The transition to vm_page_sleep_if_busy(),
which incorporates page queue and field locking, is complete.
 - Assert that the page queue lock rather than Giant is held in
   vm_page_flag_set().
2002-12-19 07:23:46 +00:00
Garrett Wollman
06d7d664b3 Spell `unsigned short' in a way which does not depend on namespace pollution.
Note that this is still the wrong type, but we are not ready to break the
ABI; this change simply allows programs which specify a strict SUSv3
namespace to compile.  (They may still have semantic errors, since SUSv3
specifies correct types.)
2002-12-19 02:52:23 +00:00
Alan Cox
9a96b6382a - Hold the page queues lock when performing vm_page_busy() or
vm_page_flag_set().
 - Replace vm_page_sleep_busy() with proper page queues locking
   and vm_page_sleep_if_busy().
2002-12-19 01:20:24 +00:00
Maxime Henrion
71ffa67746 Fix bug with 3c90xB cards and newer. We weren't trying to
copy the mbuf chain into an mbuf cluster when there is
more than 63 mbufs in the chain.  We were trying with older
cards though.
2002-12-18 23:16:22 +00:00
Semen Ustimenko
83190e29d3 Do not return(foo()) in void function.
Submitted by:	marius@alchemy.franken.de
MFC after:	3 days
2002-12-18 22:53:24 +00:00
Semen Ustimenko
0f953c65d1 Fix the missspelt letter in DC_CTYPE_PUP_AUTOSENSe define.
Submitted by:	marius@alchemy.franken.de
MFC after:	3 days
2002-12-18 22:45:43 +00:00
Poul-Henning Kamp
1e90b74683 Solve another bug in the mapping code: correctly skip lock sectors.
Make sure sector zero is protected if it contains metadata.

Lower WARNS for gbde to 3 on non-i386 archs.  rijndael-fst is evil
but appearntly does the right thing and passes the test-vectors.

MFC Candidate.
2002-12-18 22:11:54 +00:00
Nate Lawson
6d82c6a622 Quirk for Memorybird pen drive
PR:		kern/34712
Submitted by:	Oliver Fromme <olli@lurza.secnetix.de>
MFC after:	3 days
2002-12-18 21:47:52 +00:00
Alan Cox
ee113343eb Hold the page queues lock when performing vm_page_busy(). 2002-12-18 20:16:22 +00:00
Poul-Henning Kamp
88806cc28c Fix two blunders in the mapping functions which can lead to corrupt data,
for request sizes larger than the sectorsize or for multi-key setups.

See warning mailed to current@ for details of recovery.

Found by:	Marcus Reid <marcus@blazingdot.com>
2002-12-18 19:57:27 +00:00
Poul-Henning Kamp
0ae8896ed2 Balk at unaligned requests.
MFC candidate.
2002-12-18 19:53:59 +00:00
Kirk McKusick
4c572f6222 Fix corruption introduced in previous delta.
Reported by:	Aurelien Nephtali <aurelien.nephtali@wanadoo.fr>
Sponsored by:   DARPA & NAI Labs.
2002-12-18 19:50:28 +00:00
Marcel Moolenaar
d8e7d462eb More MFp4: DIG64 structures. 2002-12-18 18:52:20 +00:00
Mike Barcroft
fd8f16a831 o Add new types: msgqnum_t and msglen_t.
o Add typedefs for pid_t, time_t, size_t and ssize_t.
o Hide struct mymsg and msgsys() in the standards case.
o Add some comments about conformance bugs.
o Sort prototypes.
2002-12-18 18:22:06 +00:00
Robert Watson
fe6fb873dc Under some circumstances, the loopback interface will allocate a new
mbuf for a packet looping back to provide alignment guarantees for
KAME.  Unfortunately, this code performs a direct copy of the header
rather than using a header copying primitive (largely because we have
sucky header copying primitives).  This results in a multiple free
of the MAC label in the header when the same label data is freed
twice when the two mbufs with that header are freed.  As a temporary
work-around, clear the initialized flag on the label to prevent the
duplicate free, which prevents panics on large unaligned loopback
IP and IPv6 data.  The real fix is to improve and make use of proper
packet header copying routines here.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2002-12-18 15:34:17 +00:00
Jeffrey Hsu
68eec1f80c Switch to the conventional reference counting scheme. 2002-12-18 12:41:03 +00:00
Jeffrey Hsu
19fc74fb60 Lock up ifaddr reference counts. 2002-12-18 11:46:59 +00:00
Marcel Moolenaar
91c71b46ed Export the physical address of the RSDP to userland by means
of the `machdep.acpi_root' sysctl. This is required on ia64
because the root pointer hardly ever, if at all, lives in the
first MB of memory and also because scanning the first MB of
memory can cause machine checks.
This provides a save and reliable way for ACPI tools to work
with the tables if ACPI support is present in the kernel. On
ia64 ACPI is non-optional.
2002-12-18 08:47:07 +00:00
Marcel Moolenaar
414c998fba Add command `hcdp'. This command dumps the DIG64 HCDP table if one
exists.
2002-12-18 08:13:03 +00:00
Kirk McKusick
6d967351b4 Keep comments consistent with the code. Minor optimization.
Sponsored by:   DARPA & NAI Labs.
2002-12-18 07:19:41 +00:00
Warner Losh
79cfd4b63b I didn't intend to delete this rm from the Makefile. It snuck in at
the last second before the commit.

# likely we can remove this hack now that gcc generates better aligned code
# in the align to word case.

Noticed by: bde
2002-12-18 07:13:53 +00:00
Alan Cox
bd82dc7460 - Hold the page queues lock when performing vm_page_busy().
- Replace vm_page_sleep_busy() with proper page queues locking
   and vm_page_sleep_if_busy().
2002-12-18 04:39:15 +00:00
Alan Cox
b365ea9e30 Hold the page queues lock when performing vm_page_flag_set(). 2002-12-18 04:02:02 +00:00
Kirk McKusick
c021e44776 Cosmetic cleanup of unsigned buglets.
Submitted by:	Bruce Evans <bde@zeta.org.au>
Sponsored by:   DARPA & NAI Labs.
2002-12-18 00:53:45 +00:00
Greg Lehey
c6990de670 Back out revision 1.38. disklabel now understands vinum volumes again. 2002-12-18 00:18:54 +00:00
Warner Losh
1c584b760c Reduce diffs with Peter's expanded diffs:
1) Put back the keyboard printing printf, at the cost of 58 bytes.
2) Minor tweak to getstr at no apparent cost.
2002-12-17 22:00:06 +00:00
Poul-Henning Kamp
9eebd265b9 Add a check for negative offset locations and return EINVAL for them. 2002-12-17 21:31:58 +00:00
Warner Losh
2db4f48c6a Make both UFS1 and UFS2 fit on the same boot blocks. These are a
subset of Peter's patchs that are believed to be safe.

Makefile tweaks:
o -fomit-frame-pointer
o Change default to building both UFS1 and UFS2 bootblocks.

Lots of boot2 tweaks:
o lookup is only ever called with kname, so use it directly.
o inline memsize
o getstr are only ever called with cmd, so hardware that.
o tweaks to the parsing code to test after the conversion rather than
  before since we tested after anyways.
o eliminate support for %x in printf.
o eliminate a few bytes in printfs.
o Tweak the boot banner.
o eliminate support for wd and "  " devices (I might add wd back to
  keep bde happy).
o eliminate support for a few arguments.

This takes us from -162 bytes free to 67 bytes free.

I've tested this only on a few systems, so be careful when updating to
this change.

Submitted by: peter, imp, ian
2002-12-17 21:10:34 +00:00
Poul-Henning Kamp
120a6d842a Remove unused lockcnt variable.
Approved by:	mckusick
2002-12-17 20:23:51 +00:00
Alan Cox
d8e7c54e1e Hold the page queues lock when performing vm_page_flag_set(). 2002-12-17 19:55:28 +00:00
Poul-Henning Kamp
4d99ef8d55 Indent properly. 2002-12-17 19:31:26 +00:00
Poul-Henning Kamp
126c7e29fe Remove unused variable cn_devfsdev. 2002-12-17 19:30:50 +00:00
Poul-Henning Kamp
11aee0b4b0 Remove unused and incorrectly maintained variable "in_interfaces" 2002-12-17 19:30:04 +00:00
Poul-Henning Kamp
d321df47c3 Don't cast a pointer to (intptr_t) and then on to (int) when we cannot
be sure that (int) is large enough.  Instead cast only to (intptr_t) and
cast the switch/case values to (intptr_t) as well.
2002-12-17 19:13:03 +00:00
Søren Schmidt
4d08a40b15 Try to fix the problem with burncd blank not seeing the end of
the blank operation.
2002-12-17 16:27:45 +00:00
Søren Schmidt
5dd009808a This should be the way PC98 ATA disks are seen geometry wise.
Should go into 5_0_RELEASE as well.
2002-12-17 16:26:22 +00:00
Poul-Henning Kamp
dd0879a966 Don't mangle geometry for pc98, this will happen in the ata driver. 2002-12-17 15:50:51 +00:00
Poul-Henning Kamp
31cf2a3636 Unspam some experimental changes which should not have been committed. 2002-12-17 13:37:08 +00:00
Poul-Henning Kamp
50bd488da3 Remember to hold topology lock when we change things.
Spotted by:	kuriyama
2002-12-17 09:44:10 +00:00
Poul-Henning Kamp
2cc40a38a8 Constify the dumpconf() function. 2002-12-17 07:22:48 +00:00
Nate Lawson
e38cfb14fe Back out 1.19 to rethink approach
Requested by:	julian@
2002-12-17 05:55:36 +00:00
Marcel Moolenaar
1aa83d38bc Check that the dump device is large enough. Otherwise we could
end up with a dump offset that's smaller than the start of the
dump device and either clobber data in preceding partitions or
try to write beyond the end of the medium (unsigned wrap).

Implement legacy behaviour to never write to the first 64KB as
that is where metadata (ie disklabels) may reside.
2002-12-17 02:51:56 +00:00
Nate Lawson
1df5f8294f Automatically issue a "continue" along with the "detach" command. This
fixes the problem of cleanly restarting a target after entering gdb mode.

Reviewed by:	archie@
2002-12-17 01:32:11 +00:00
Matthew Dillon
967adce8df Fix syntax in last commit. 2002-12-17 00:24:48 +00:00
Maxime Henrion
e7c30f884f Convert the xl(4) driver to the busdma API. This should make
it possible to use this driver under ia64, sparc64 (though
there may be endianness issues with this one) and other archs.

Tested on:	i386, alpha (gallatin)
2002-12-17 00:08:49 +00:00
Julian Elischer
4706b50a40 Reformat last change
Requested by: nate@
2002-12-16 23:25:12 +00:00
Poul-Henning Kamp
a1d5f791fa Get rid of g_slice_addslice() and use g_slice_config() instead.
Tested with:	i386 + src/tools/regression/geom
2002-12-16 23:08:48 +00:00
Julian Elischer
6b8fc51d28 Don't dump core into a partition that is too small for it.
If we do, we usually wrote backwareds into the proceeding partititon
which is usually the root partition.
2002-12-16 23:04:54 +00:00
Poul-Henning Kamp
0f9d3dba37 Constification and some s/int/u_int/ changes. 2002-12-16 22:33:27 +00:00
Matthew Dillon
fa7dd9c5bc Change the way ELF coredumps are handled. Instead of unconditionally
skipping read-only pages, which can result in valuable non-text-related
data not getting dumped, the ELF loader and the dynamic loader now mark
read-only text pages NOCORE and the coredump code only checks (primarily) for
complete inaccessibility of the page or NOCORE being set.

Certain applications which map large amounts of read-only data will
produce much larger cores.  A new sysctl has been added,
debug.elf_legacy_coredump, which will revert to the old behavior.

This commit represents collaborative work by all parties involved.
The PR contains a program demonstrating the problem.

PR:		kern/45994
Submitted by:	"Peter Edwards" <pmedwards@eircom.net>, Archie Cobbs <archie@dellroad.org>
Reviewed by:	jdp, dillon
MFC after:	7 days
2002-12-16 19:24:43 +00:00
Olivier Houchard
47770b6fd5 Add the trm(4) driver.
MFC after:	1 day
2002-12-16 18:47:37 +00:00
Tom Rhodes
5461a2d2d0 The HP DAT 40 tape drive should be able to handle variable block sizes.
But for some reason the block size is different when a different type of
tape is placed in the drive.  This commit fixes that.

PR:		46209
Submitted by:	Alex Wang <alex@alexwang.com>
Approved by:	mjacob
2002-12-16 17:40:17 +00:00
Robert Drehmel
0adb6d7a49 Remove the hto(be|le)[slq] and (be|le)toh[slq] macros defined in
_KERNEL scope from "src/sys/sys/mchain.h".

Replace each occurrence of the above in _KERNEL scope with the
appropriate macro from the set of hto(be|le)(16|32|64) and
(be|le)toh(16|32|64) from "src/sys/sys/endian.h".

Tested by:		tjr
Requested by:		comment marked with XXX
2002-12-16 16:20:06 +00:00
Dag-Erling Smørgrav
f0d91fb7ea Ignore IEEE1284 descriptors when looking for bidirectional mode. We don't
really know how to talk IEEE1284, so attaching to that interface makes the
printer unusable.

Approved by:	joe
2002-12-16 14:22:59 +00:00
Dag-Erling Smørgrav
6ed6884063 MFNetBSD: 1.52-1.55
Mostly OpenBSD-related changes.  Remove newline from panic string.  Remove
an unreachable break statement.
2002-12-16 14:20:26 +00:00
Olivier Houchard
1dbb2b5ac0 Fix the panic that occurs when kldunloading trm by using the correct
prototype for trm_detach and freeing all resources.
While I'm there, handle better errors in trm_attach and remove the
PCI_BASE_ADDR0 definition, since it's what PCIR_MAPS is used for.

MFC after:	3 days
2002-12-16 13:38:22 +00:00
SUZUKI Shinsuke
6645ef44ad fixed a bug that IPv6 multicast packet is not forwarded if its packet size is equal to the outgoing interface's MTU
Approved by: re
Obtained from: KAME
MFC after: 3 days
2002-12-16 01:41:07 +00:00
Marcel Moolenaar
722d8e49a9 Regen: swapoff 2002-12-16 00:49:36 +00:00
Marcel Moolenaar
3f60ecab4e Change swapoff from MNOPROTO to UNIMPL. The former doesn't work. 2002-12-16 00:48:52 +00:00
Poul-Henning Kamp
02995a9b72 unifdef -DPC98 -U__alpha__ 2002-12-15 22:15:20 +00:00
Alan Cox
4b36fe0cbd Perform vm_object_lock() and vm_object_unlock() on kmem_object
around vm_page_lookup() and vm_page_free().
2002-12-15 21:09:09 +00:00
Kirk McKusick
8efcd9a794 Update to previous change (1.54) to use an approperly wide inode field
so as to work correctly on 64-bit platforms.

Reported-by:	Jake Burkholder <jake@locore.ca>
Sponsored by:   DARPA & NAI Labs.
Approved by:	Ian Dowse <iedowse@maths.tcd.ie>
2002-12-15 19:25:59 +00:00
Matthew Dillon
72e7f3ddc2 Regenerate system calls (swapoff added) 2002-12-15 19:19:15 +00:00
Matthew Dillon
92da00bb24 This is David Schultz's swapoff code which I am finally able to commit.
This should be considered highly experimental for the moment.

Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
MFC after:	3 weeks
2002-12-15 19:17:57 +00:00
Matthew Dillon
389d2b6e21 Fix a refcount race with the vmspace structure. In order to prevent
resource starvation we clean-up as much of the vmspace structure as we
can when the last process using it exits.  The rest of the structure
is cleaned up when it is reaped.  But since exit1() decrements the ref
count it is possible for a double-free to occur if someone else, such as
the process swapout code, references and then dereferences the structure.
Additionally, the final cleanup of the structure should not occur until
the last process referencing it is reaped.

This commit solves the problem by introducing a secondary reference count,
calling 'vm_exitingcnt'.  The normal reference count is decremented on exit
and vm_exitingcnt is incremented.  vm_exitingcnt is decremented when the
process is reaped.  When both vm_exitingcnt and vm_refcnt are 0, the
structure is freed for real.

MFC after:	3 weeks
2002-12-15 18:50:04 +00:00
Maxim Konovalov
616fa7460c o Trim EOL whitespaces.
MFC after:	1 week
2002-12-15 10:24:36 +00:00
Maxim Konovalov
21ef23ab3f o s/if_name[16]/if_name[IFNAMSIZ]/
Reviewed by:	luigi
MFC after:	1 week
2002-12-15 10:23:02 +00:00
Maxim Konovalov
2713a5bebb o M_DONTWAIT is mbuf(9) flag: malloc(M_DONTWAIT) -> malloc(M_NOWAIT).
The bug does not affect anything because M_NOWAIT == M_DONTWAIT.

Reviewed by:	luigi
MFC after:	1 week
2002-12-15 10:21:30 +00:00
Maxim Konovalov
83b75b7621 o Fix byte order logging issue: sa.sin_port is already in host byte order.
PR:		kern/45964
Submitted by:	Sascha Blank <sblank@tiscali.de>
Reviewed by:	luigi
MFC after:	1 week
2002-12-15 09:44:02 +00:00
Maxim Konovalov
9f59c468f3 o Clear a high bit of ipc_perm.seq so msgget(3) never returns a
negative message queue id.

PR:		kern/46122
Submitted by:	Vladimir B.Grebenschikov <vova@sw.ru>
MFC after:	2 weeks
2002-12-15 09:41:46 +00:00
Alan Cox
2840cabe6a As per the comments, vm_object_page_remove() now expects its caller to lock
the object (i.e., acquire Giant).
2002-12-15 07:30:51 +00:00
Alan Cox
5e83956af5 Perform vm_object_lock() and vm_object_unlock() around
vm_object_page_remove().
2002-12-15 07:16:51 +00:00
Alan Cox
475e8011ab Perform vm_object_lock() and vm_object_unlock() around
vm_object_page_remove().
2002-12-15 05:41:56 +00:00