Brian Feldman [Tue, 8 Oct 2002 12:09:16 +0000 (12:09 +0000)]
Reinstate rev 1.36 with an important line that got missed. Note this
also improves the "random undocumented offsets into various memory
spaces" a little bit.
Tim J. Robbins [Tue, 8 Oct 2002 11:22:49 +0000 (11:22 +0000)]
Do not strip CTL* escapes from redirection filenames in argstr(); they
are later stripped with rmescapes() in expandarg(). If the filename has
already been unescaped, doing it again in rmescapes() can walk off the
end of the string, leading to memory corruption and eventually SIGSEGV.
Bruce A. Mah [Tue, 8 Oct 2002 05:15:21 +0000 (05:15 +0000)]
Teach pkg_add -r how to find 4.7-RELEASE packages with an appropriate
osreldate.
(Actually, due to differences in package compression formats, I'm
not sure that a -CURRENT pkg_add -r will do the right thing in
this case, once it finds them.)
Dima Dorfman [Tue, 8 Oct 2002 04:15:55 +0000 (04:15 +0000)]
Import the libc fnmatch() into the kernel. This will be used by,
among other things, the DEVFS rule subsystem to match nodes against a
path pattern supplied by the user.
fnmatch.c was repo-copied from src/lib/libc/gen/fnmatch.c, and the
only changes to it are those necessary to make it compile in the
kernel. The relevant parts of fnmatch.h were imported into libkern.h.
Warner Losh [Tue, 8 Oct 2002 03:53:52 +0000 (03:53 +0000)]
Make kldunload cbb work:
o Implement the thread killing interlock as described by jhb in arch@
while talking to markm.
o Hold Giant around cbb_insert()/cbb_remove(). Deep in the belly of
the vm code we panic if we don't hold this when we activate the memory
for reading the CIS.
o If we had to do the kludge alloc, then do a kludge free.
Warner Losh [Mon, 7 Oct 2002 23:17:44 +0000 (23:17 +0000)]
Introducing /dev/devctl. This device reports events in the
configuration device hierarchy. Device arrival, departure and not
matched are presently reported. This will be the basis for devd, which
I still need to polish a little more before I commit it. If you don't
use /dev/devctl, it will be a noop.
Warner Losh [Mon, 7 Oct 2002 23:15:40 +0000 (23:15 +0000)]
Two minor bugfixes:
o Allow the bus_debug variable to be set via the bus.debug tunable.
o Return pnpinfo and location info via the devinfo interface to userland.
devinfo(8) needs to be updated to print it.
Warner Losh [Mon, 7 Oct 2002 23:11:29 +0000 (23:11 +0000)]
MFp4:
o Better resume code. Move the comments around. Force the socket state to
be querried. Ack the interrupts properly.
o Intercept the interrupt requests and keep a list of interrupts to service
ourselves. When the card attaches, set its OK bit. When we get a card
status change interrupt for that card, clear the OK bit. Don't call the
ISR if the OK bit is cleared. Iwasaki-san and yamamoto-san have both
sent me patches that fix the same problem this fixes, but at the pccard
level.
o Try to get the signalling of the thread to actually die. This might not be
100% right, but it is less wrong than before.
o Add a SIC next to a TI type that looks like it could be wrong, but isn't.
Warner Losh [Mon, 7 Oct 2002 23:05:33 +0000 (23:05 +0000)]
o Add a nomatch routine so we whine when we don't know what to attach to
the card.
o Add comments about how we're doing the CIS activation.
o Add location and pnp info functions.
o Add better code to hopefully deal with ata cards better (and other drivers
that allocate resources that we didn't preallocate from the CIS). OLDCARD
used to allow it, but NEWCARD was pickier. I'm not 100% sure this works,
but it doesn't break anything.
Warner Losh [Mon, 7 Oct 2002 23:03:17 +0000 (23:03 +0000)]
Merge changes from NetBSD through version 1.17 of this file. These
give us slightly better error checking than before and interpret what
default bits mean better. See the NetBSD CVS tree for the authors of
these changes (revs 1.10 .. 1.17).
Warner Losh [Mon, 7 Oct 2002 23:00:51 +0000 (23:00 +0000)]
o Add routines to return the location and pnpinfo for this card.
Note, we return the PCI pnp info, but in fact that's wrong to do
since that data is not defined for CardBus cards. CardBus says that
these registers are undefined and one should use the CIS to do
device matching. To date, all CardBus cards have had these
registered defined, no doubt because they are using common silicon
to produce both the PCI cards and the CardBus cards. However, it isn't
any worse than the rest of the system, so just note it in passing and
move on.
o Also sort prototypes while I'm here.
Warner Losh [Mon, 7 Oct 2002 22:58:24 +0000 (22:58 +0000)]
Don't abuse the fact that -a == ~a + 1. Signed vs unsigned checkers
complain when a is a unsigned type. So instead use the latter here
and be on our way.
Thomas Quinot [Mon, 7 Oct 2002 21:18:20 +0000 (21:18 +0000)]
Document behaviour change in reboot(8) introduced in reboot.c rev. 1.17:
when using '-p' with reboot, and the power down action failds, reboot
the system normally. The behaviour of 'halt -p' and of shutdown(8) is
unchanged.
Ian Dowse [Mon, 7 Oct 2002 20:49:22 +0000 (20:49 +0000)]
Add back a fdrop() call at the end of kern_open() that got lost in
revision 1.218. This bug caused a "struct file" reference to be
leaked if VOP_ADVLOCK(), vn_start_write(), or mac_check_vnode_write()
failed during the open operation.
PR: kern/43739
Reported by: Arne Woerner <woerner@mediabase-gmbh.de>
Sam Leffler [Mon, 7 Oct 2002 20:02:34 +0000 (20:02 +0000)]
Track openbsd changes that don't affect us yet (PK supoprt is
currently disabled):
o Don't use constants for the output parameter, use the iparam count as a
pointer to the first result location.
o Fix bits vs bytes counting problems.
o Split out the hardware and software normalization versions of modexp.
o Enable hardware normalization for chips that support it.
o On reset, disable hardware normalization for 582x and make sure the
chip is in little endian mode.
o Since sw normalization is now the only option, simplify normalization
handling.
Also fix RNG harvesting: disabling PK support (for the moment) had disabled
the MCR2 interrupt; consider both KEY support and RNG support when deciding
whether or not to enable it.
It seems that the existence of a "depend" target in src/sys/boot is not
to be taken as an indication that it actually does what one would expect,
at least it clearly threw my testing off.
Sam Leffler [Mon, 7 Oct 2002 18:46:38 +0000 (18:46 +0000)]
o split crypto_proc into two threads: one for processing requests and one
for processing callbacks. This closes race conditions caused by locking
too many things with a single mutex.
o reclaim crypto requests under certain (impossible) failure conditions
Warner Losh [Mon, 7 Oct 2002 06:50:35 +0000 (06:50 +0000)]
Minor string handling cleanup that I've had in my tree for a while:
Don't use snprintf where strlcpy() will do the job.
Also, a NUL is '\0' not 0 in our style (C doesn't care), so spell it like.
Remove useless {} and () in the general area of this change.
Copyin and copyout are only possible from a process-native thread,
and therefore we need a way for ioctl handlers to run in that thread
in GEOM. Rather than invent a complicated registration system to
recognize which ioctl handler to use for a given ioctl, we still
schedule all ioctls down the tree as bio transactions but add a
special return code that means "call me directly" and have the
geom_dev layer do that.
Use this for all ioctls that make it as far as a diskdriver to
avoid any backwards compatibility problems.
Requested by: scottl
Sponsored by: DARPA & NAI Labs
Warner Losh [Mon, 7 Oct 2002 05:26:35 +0000 (05:26 +0000)]
Dynamically configure the width of the srom. This code comes from
OpenBSD who got the code (or the idea) from the NetBSD tlp driver.
This gets some cardbus dc cards working (either completely or nearly
so). It also appears to get additional pci cards working, without
breaking working ones.
# Maybe some additional work is needed here. Also, the cardbus attachment
# might need to match on the CIS rather than on the vendor/device so we have
# a finer level of detail as to what the card is. Technically, the
# vendor/device fields are undefined for CardBus (even though most cards are
# using common silicon with pci models).
Warner Losh [Mon, 7 Oct 2002 05:15:05 +0000 (05:15 +0000)]
o go ahead and route the interupt, even if it is supposedly unique.
there are some strange machines that seem to need this.
o delete bogus comment.
o don't use the the bios for read/writing config space. They interact badly
with SMP and being called from ISR. This brings -current in line with
-stable.
# make the latter #ifdef on USE_PCI_BIOS_FOR_READ_WRITE in case we
# need to go back in a hurry.
Mike Barcroft [Sun, 6 Oct 2002 22:16:12 +0000 (22:16 +0000)]
o Move location of the fpos_t typedef to be closer to other typedefs.
o Add typedef for va_list.
o Add comment about missing restrict type-qualifiers.
o Move vscanf(), vsscanf() and vfscanf() to the C99-visible block.
o Add note about missing backing function for vfscanf().
o Restrict L_cuserid to only older versions of POSIX, and BSD
namespaces.
o Conditionalize some BSD-specific foo_unlock() macros.
Mike Barcroft [Sun, 6 Oct 2002 22:01:07 +0000 (22:01 +0000)]
o Add conditionals to allow va_list to be defined in other headers.
o Standardize on _MACHINE_STDARG_H_ to allow multiple header includes.
o Restrict the definition of va_copy() to C99 environments.
Mike Barcroft [Sun, 6 Oct 2002 21:54:08 +0000 (21:54 +0000)]
o Use relatively new visibility primitives from <sys/cdefs.h>.
o Add typedef for pid_t.
o Add comment about missing restrict type-qualifier.
o Remove unneeded includes (<sys/_posix.h> and <sys/time.h>).
Mike Barcroft [Sun, 6 Oct 2002 21:46:04 +0000 (21:46 +0000)]
Don't depend on <signal.h> to include <sys/time.h>, instead include
<sys/time.h> directly. This is mostly bogus since CLOCK_REALTIME
should be defined in <time.h>, which these files already include.
Joerg Wunsch [Sun, 6 Oct 2002 18:48:20 +0000 (18:48 +0000)]
When considering temporary files for deletion, don't examine the mtime
and atime only, but also the ctime. Otherwise, files extracted from
tar or zip archives will immediately be declared stale since they've
got their mtime reset to the original mtime.
Thomas Quinot [Sun, 6 Oct 2002 16:24:36 +0000 (16:24 +0000)]
Set only the RB_POWEROFF flag (not the RB_HALT flag) when
'-p' is used on the reboot(8) command line.
This is intended for use when you want to attempt a power down
action, but you want the system to reboot (not halt) if the
power down action fails.
This is typically useful when the power-off action performed by
the kernel consists in signalling an uninterrupted power supply
that it should shut down its inverter if mains power has not returned.
The behaviour of shutdown(8) and init(8) is not modified;
only the behaviour of invoking 'reboot -p' manually is
modified, and then only in the case when a power-down action
fails.
Sounded reasonable to: phk
Approved by: roberto (mentor)
Robert Watson [Sun, 6 Oct 2002 14:39:15 +0000 (14:39 +0000)]
Integrate mac_check_socket_send() and mac_check_socket_receive()
checks from the MAC tree: allow policies to perform access control
for the ability of a process to send and receive data via a socket.
At some point, we might also pass in additional address information
if an explicit address is requested on send.
Tim J. Robbins [Sun, 6 Oct 2002 10:15:38 +0000 (10:15 +0000)]
Add a note to the Compatiblity section suggesting that these functions
only be used for byte values. Add cross-references to the wide-char
counterparts.
While removing a memory leak, rev 1.32 introduced a
free-memory-and-reuse-it-after. Correct both problems and
make rcp -r work again under /etc/malloc.conf -> AJ.
Hajimu UMEMOTO [Sun, 6 Oct 2002 08:43:35 +0000 (08:43 +0000)]
Put giant locks due to make getaddrinfo(), getnameinfo()
and getipnodeby*() thread-safe.
Our res_*() is not thread-safe. So, we share lock between
getaddrinfo() and getipnodeby*(). Still, we cannot use
getaddrinfo() and getipnodeby*() in conjunction with other
functions which call res_*().
Tim J. Robbins [Sun, 6 Oct 2002 06:35:51 +0000 (06:35 +0000)]
Disallow empty condition parts of "if", "while" and "until" compound
commands. Commands like "if then ... fi" and "while do ... done" are no
longer accepted. Bodies of compound commands are still allowed to be
empty, because even though POSIX does not allow them, most shells do.