Don Lewis [Mon, 16 Jun 2003 17:17:09 +0000 (17:17 +0000)]
Partially back out rev 1.87 by nuking fifo_inactive() and moving the
resource deallocation back to fifo_close(). This eliminates any
stale data that might be stuck in the socket buffers after all the
readers and writers have closed the fifo.
Hartmut Brandt [Mon, 16 Jun 2003 15:25:51 +0000 (15:25 +0000)]
Repo-copy of sys/pci/if_en_pci.c to the rest of the midway driver (sys/dev/en)
so that all of the driver sources are in one place. Adjust the configuration
files and the module build.
Hartmut Brandt [Mon, 16 Jun 2003 13:52:27 +0000 (13:52 +0000)]
Fix the breakage introduced by rev. 1.43 of sys/dev/midway.c (don't commit
on friday 13th and without making a universe). This adds struct and
constant definitions for ATM traffic parameters and re-enables the
build of the midway driver.
David Xu [Mon, 16 Jun 2003 13:14:52 +0000 (13:14 +0000)]
Reset ncpus to 1 for bound thread group since there is only one
thread in such group.
Change message text from kse_rel to kserel, it is better displayed
in top.
Yaroslav Tykhiy [Mon, 16 Jun 2003 11:30:23 +0000 (11:30 +0000)]
If ftpd is run with an -h option (hide host-specific info,)
don't reveal the info in reply to the SYST command.
Get rid of using the "unix" macro at the same time. It was a rather
poor way to check if the system was Unix since there were quite a
few Unix clones out there whose cc didn't define "unix" (e.g.,
NetBSD.) It was also sensitive to the C standard used, which caused
unnecessary trouble: With -std=c99, it should have been "__unix__",
and so on.
Yaroslav Tykhiy [Mon, 16 Jun 2003 08:42:20 +0000 (08:42 +0000)]
Force media autodetection if the device has lost its parameter table.
Previously, any normal I/O on an fdc(4) device would fail with ENXIO
if the device had been opened in non-blocking mode and then closed
prior to the conventional access; that would last until the floppy
disk was ejected and re-inserted to raise the unit attention condition.
Yaroslav Tykhiy [Mon, 16 Jun 2003 07:50:17 +0000 (07:50 +0000)]
If in non-blocking mode, return EAGAIN instead of ENXIO
on an I/O attempt. This is needed for consistency with
the concept of the half-opened state of fdc(4).
Mike Heffner [Mon, 16 Jun 2003 02:36:38 +0000 (02:36 +0000)]
Import the June 15, 2003 CVS version of NetBSD's ftp + patchset to fix
header file differences between FBSD and NBSD. Like lukemftpd, the
portable version of lukemftp lags too far behind CVS.
This import includes several big fixes plus a cleaned up manpage.
Bill Paul [Sun, 15 Jun 2003 21:45:43 +0000 (21:45 +0000)]
In the device attach routine, don't depend on uaa->iface being
populated. Apparently, if you use an ehci controller, it's not.
Use usbd_device2interface_handle() to retrieve the interface handle.
NOTE: uaa->iface is populated in the probe routine, so I suspect the
fact that it's NULL in the attach routine is a bug in the ehci driver.
Also, don't depend on the PHY addresses returned by the AXE_CMD_READ_PHYID
command. The address is correct for my LinkSys NIC, but a user has
reported that with a D-Link NIC, the PHYID command returns address 4
while the attached Broadcom PHY is in fact strapped for address 0.
Instead, latch onto the first PHY address that returns valid data
during a readreg operation.
Martin Blapp [Sun, 15 Jun 2003 21:24:45 +0000 (21:24 +0000)]
Fix yppasswdproc_update_master_1_svc() too.
Only call pw_mkdb if passfile == _PATH_MASTERPASSWD.
Otherwise, rename master.passwd to a temp filename, rename
the new passwd to master.passwd, and let yppwupdate update
passwd as it sees fit.
Jake Burkholder [Sun, 15 Jun 2003 21:06:49 +0000 (21:06 +0000)]
The page queue lock is already held in pmap_remove, change acquire/release
to assertion of ownership. Serves me right for not booting a witness
kernel.
I have not had any reports of trouble for a long time, so remove the
gentle versions of the vop_strategy()/vop_specstrategy() mismatch methods
and use vop_panic() instead.
Yaroslav Tykhiy [Sun, 15 Jun 2003 18:13:17 +0000 (18:13 +0000)]
Always set bio_resid properly in fdstrategy(),
as should every block device strategy routine.
There was at least one evil consequence of not doing so:
Some errors returned by fdstrategy() could be lost (EAGAIN,
in particular.)
PR: kern/52338 (in the audit-trail)
Discussed with: bde
Yaroslav Tykhiy [Sun, 15 Jun 2003 16:18:58 +0000 (16:18 +0000)]
Check whether the floppy type pointer has been set before trying
to access floppy parameters through it.
Note: The DIOCGSECTORSIZE and DIOCGMEDIASIZE handlers withing
fdioctl() couldn't be just moved to below the existing check
for blocking mode because fd->ft can be non-NULL while still
in non-blocking mode (fd->ft can be set with the FD_STYPE ioctl.)
Yaroslav Tykhiy [Sun, 15 Jun 2003 14:40:03 +0000 (14:40 +0000)]
Add missing descriptions of macros M_ALIGN and MH_ALIGN.
Remove a reference to the defunct macro M_COPY_PKTHDR;
document the new functions m_dup_pkthdr() and m_move_pkthdr(),
and the macro variant of the latter, M_MOVE_PKTHDR().
Yaroslav Tykhiy [Sun, 15 Jun 2003 14:14:11 +0000 (14:14 +0000)]
Add more markup to the mbuf(9) manpage. This includes:
- tagging plaintext "mbuf", "mbuf cluster", and "mbuf chain"
with .Vt (variable type) since all of them are ways of managing
data, i.e., they can be seen as data types;
- using .Vt/.Va instead of .Li (literal) where appropriate;
- tagging plaintext words that actually refer to function arguments
with .Fa.
David Xu [Sun, 15 Jun 2003 12:51:26 +0000 (12:51 +0000)]
1. Add code to support bound thread. when blocked, a bound thread never
schedules an upcall. Signal delivering to a bound thread is same as
non-threaded process. This is intended to be used by libpthread to
implement PTHREAD_SCOPE_SYSTEM thread.
2. Simplify kse_release() a bit, remove sleep loop.
Ian Dowse [Sun, 15 Jun 2003 11:55:50 +0000 (11:55 +0000)]
If the device goes away during ulpt_reset(), make sure not to call
ulpt_status() afterwards. This fixes a crash that can occur if a
USB printer is power-cycled when printing is just starting. The
problem is similar to that fixed in revision 1.33, but it is much
less likely to occur.
Ian Dowse [Sun, 15 Jun 2003 11:43:00 +0000 (11:43 +0000)]
Don't overwrite the static panicstr buffer for secondary and further
panics. Before revision 1.38, we used to just point panicstr at the
format string if panicstr was NULL, but since we now use a static
buffer for the formatted panic message, we have to be careful to
only write to it during the first panic.
Martin Blapp [Sun, 15 Jun 2003 10:37:22 +0000 (10:37 +0000)]
Fix the master yppasswd routines, so they really work
for root on ypmaster. yppasswd_local() did use YPPASSWDPROG
instead of MASTER_YPPASSWDPROG, and the domain was not set,
resulting in a coredump during xdr-encode.
Martin Blapp [Sun, 15 Jun 2003 10:34:11 +0000 (10:34 +0000)]
Only call pw_mkdb if passfile == _PATH_MASTERPASSWD.
Otherwise, rename master.passwd to a temp filename, rename
the new passwd to master.passwd, and let yppwupdate update
passwd as it sees fit.
PR: 52601, 7968
Reviewed by: des
Submitted by: Dan Nelson <dnelson@allantgroup.com>
Martin Blapp [Sun, 15 Jun 2003 10:32:01 +0000 (10:32 +0000)]
Replace the old SCM_CREDS cred procedures. They can now be
replaced just fine with getpeereid() and the whole code
gets a lot simpler. We don't break the ABI, since all server
programms use __rpc_get_local_uid(), and we just change library
internals.
err() on allocation failure. WARNS=9 compliant
use #if 0, #ifndef lint, #endif /* not lint */, #endif ordering
when a message is provided, use errx() instead of err().
Robert Watson [Sun, 15 Jun 2003 06:54:36 +0000 (06:54 +0000)]
Now that the kernel access control for quotactl(2) appears to work
properly, clean up quota(1). quota(1) has the ability to query
quotas either directly from the kernel, or if that fails, by reading
the quota.user or quota.group files specified for the file system
in /etc/fstab. The setuid bit existed solely (apparently) to let
non-operator users query their quotas and consumption when quotas
weren't enabled for the file system.
o Remove the setuid bit from quota(1).
o Remove the logic used by quota(1) when running setuid to prevent
users from querying the quotas of other users or groups. Note
that this papered over previously broken kernel access control;
if you queried directly using the system call, you could access
some of the data "restricted" by quota(1).
In the new world order, the ability to inspect the (live) quotas of
other uids and gids via the kernel is controlled by the privilege
requirement sysctl. The ability to query via the file is controlled
by the file permissions on the quota database backing files
(root:operator, group readable by default).
Robert Watson [Sun, 15 Jun 2003 06:46:24 +0000 (06:46 +0000)]
Now that the kernel access control for quotactl(2) appears to work
properly, clean up quota(1). quota(1) has the ability to query
quotas either directly from the kernel, or if that fails, by reading
the quota.user or quota.group files specified for the file system
in /etc/fstab. The setuid bit existed solely (apparently) to let
non-operator users query their quotas and consumption when quotas
weren't enabled for the file system.
o Remove the setuid bit from quota(1).
o Remove the logic used by quota(1) when running setuid to prevent
users from querying the quotas of other users or groups. Note
that this papered over previously broken kernel access control.
Robert Watson [Sun, 15 Jun 2003 06:36:19 +0000 (06:36 +0000)]
Re-implement kernel access control for quotactl() as found in the
UFS quota implementation. Push some quite broken access control
logic out of ufs_quotactl() into the individual command
implementations in ufs_quota.c; fix that logic. Pass in the thread
argument to any quotactl command that will need to perform access
control.
o quotaon() requires privilege (PRISON_ROOT).
o quotaoff() requires privilege (PRISON_ROOT).
o getquota() requires that:
If the type is USRQUOTA, either the effective uid match the
requested quota ID, that the unprivileged_get_quota flag be
set, or that the thread be privileged (PRISON_ROOT).
If the type is GRPQUOTA, require that either the thread be
a member of the group represented by the requested quota ID,
that the unprivileged_get_quota flag be set, or that the
thread be privileged (PRISON_ROOT).
o setquota() requires privilege (PRISON_ROOT).
o setuse() requires privilege (PRISON_ROOT).
o qsync() requires no special privilege (consistent with what
was present before, but probably not very useful).
Add a new sysctl, security.bsd.unprivileged_get_quota, which when
set to a non-zero value, will permit unprivileged users to query user
quotas with non-matching uids and gids. Set this to 0 by default
to be mostly consistent with the previous behavior (the same for
USRQUOTA, but not for GRPQUOTA).
Robert Watson [Sun, 15 Jun 2003 06:26:08 +0000 (06:26 +0000)]
Tighten up the string->integer conversion in sysctl(8):
(1) Reject zero-length strings for CTLTYPE_INT, _UINT, _LONG,
_ULONG. Do not silently convert to 0.
(2) When converting CTLTYPE_INT, _UINT, _LONG, and _ULONG, check the
end pointer generated by strtol() and strtoul() rather than
discarding it. Reject the string if either none of the string
was useful for conversion to an integer, or if there was
trailing garbage.
I.e., we will not allow you to set a numeric sysctl to a value unless
we can completely convert the string argument to a numeric value.
I tripped over this when I put the following in /etc/sysctl.conf:
Warner Losh [Sun, 15 Jun 2003 04:15:29 +0000 (04:15 +0000)]
The en module has been broken for the last 40 hours. Disconnect it
from the tree until it is fixed. Since it is an atm driver, it isn't
commonly used so this will not negatively impact too many people.
harti can reconnect it when he resurfaces and corrects the en module
problems. This should allow snapshots to start succeeding again.
Jeff Roberson [Sun, 15 Jun 2003 02:18:29 +0000 (02:18 +0000)]
- Fix the maximum slice value. I accidentally checked in a value of '2'
which meant no process would run for longer than 20ms.
- Slightly redo the interactivity scorer. It follows the same algorithm but
in a slightly more correct way. Previously values above half were
incorrect.
- Lower the interactivity threshold to 20. It seems that in testing non-
interactive tasks are hardly ever near there and expensive interactive
tasks can sometimes surpass it. This area needs more testing.
- Remove an unnecessary KTR.
- Fix a case where an idle thread that had an elevated priority due to
priority prop. would be placed back on the idle queue.
- Delay setting NEEDRESCHED until userret() for threads that haad their
priority elevated while in kernel. This gives us the same context switch
optimization as SCHED_4BSD.
- Limit the child's slice to 1 in sched_fork_kse() so we detect its behavior
more quickly.
- Inhert some of the run/slp time from the child in sched_exit_ksegrp().
- Redo some of the priority comparisons so they are more clear.
- Throttle the frequency of sched_pctcpu_update() so that rounding errors
do not make it invalid.
Greg Lehey [Sun, 15 Jun 2003 01:42:01 +0000 (01:42 +0000)]
check_drive: If the partition isn't a Vinum drive, release it again
and return NULL.
vinum_scandisk: Don't handle NULL device pointers.
Only look at compatibility partition for i386. This
is a kludge which should go away once I have adequate
documentation for the New World Order.
Together, these fixes remove occasional error messages about
non-existent drives. They may also fix a number of problems that have
been reported without a PR.
David Schultz [Sat, 14 Jun 2003 23:48:20 +0000 (23:48 +0000)]
Introduce malloc types M_UNDCACHE and M_UNPATH for important
unionfs-related data structures to aid in debugging memory leaks.
Use NULL and NULLVP instead of 0 as appropriate.
David Schultz [Sat, 14 Jun 2003 23:27:29 +0000 (23:27 +0000)]
Factor out the process of freeing ``directory caches'', which unionfs
directory vnodes use to refer to their constituent vnodes, into
union_dircache_free(). Also s/union_dircache/union_dircache_get/ and
tweak the structure of union_dircache_r().
Alan Cox [Sat, 14 Jun 2003 23:23:55 +0000 (23:23 +0000)]
Migrate the thread stack management functions from the machine-dependent
to the machine-independent parts of the VM. At the same time, this
introduces vm object locking for the non-i386 platforms.
Two details:
1. KSTACK_GUARD has been removed in favor of KSTACK_GUARD_PAGES. The
different machine-dependent implementations used various combinations
of KSTACK_GUARD and KSTACK_GUARD_PAGES. To disable guard page, set
KSTACK_GUARD_PAGES to 0.
2. Remove the (unnecessary) clearing of PG_ZERO in vm_thread_new. In
5.x, (but not 4.x,) PG_ZERO can only be set if VM_ALLOC_ZERO is passed
to vm_page_alloc() or vm_page_grab().
Nate Lawson [Sat, 14 Jun 2003 22:17:41 +0000 (22:17 +0000)]
Merge common XPT_CALC_GEOMETRY functions into a single convenience function.
Devices below may experience a change in geometry.
* Due to a bug, aic(4) never used extended geometry. Changes all drives
>1G to now use extended translation.
* sbp(4) drives exactly 1 GB in size now no longer use extended geometry.
* umass(4) drives exactly 1 GB in size now no longer use extended geometry.
For all other controllers in this commit, this should be a no-op.
Nate Lawson [Sat, 14 Jun 2003 22:17:38 +0000 (22:17 +0000)]
Merge common XPT_CALC_GEOMETRY functions into a single convenience function.
Devices below may experience a change in geometry.
* Due to a bug, aic(4) never used extended geometry. Changes all drives
>1G to now use extended translation.
* sbp(4) drives exactly 1 GB in size now no longer use extended geometry.
* umass(4) drives exactly 1 GB in size now no longer use extended geometry.
For all other controllers in this commit, this should be a no-op.