Fix cut-n-paste bug: compare argument s against known aliases,
not the global optarg. This bug goes unnoticed because optarg
is so far always the actual argument for the formal argument s.
Fix checking of the "lock" file in the spool directory for a queue,
so that the checking will wind up with the correct mode-bits in
the case where the initial open() of that lock file will create it.
Due to this bug, the first job ever sent to a queue could leave
that queue in a "printing is disabled" state.
PR: 93469
Submitted by: Michael Szklarski of kco.com.pl
MFC after: 1 week
Robert Watson [Thu, 6 Jul 2006 23:37:39 +0000 (23:37 +0000)]
Move POSIX.1e-specific utility routines from kern_acl.c to
subr_acl_posix1e.c, leaving kern_acl.c containing only ACL system
calls and utility routines common across ACL types.
Robert Watson [Thu, 6 Jul 2006 23:22:34 +0000 (23:22 +0000)]
Forced commit to recognize repo-copy of kern_acl.c to subr_acl_posix1e.c,
which will hold POSIX.1e-specific ACL routines. kern_acl.c will conintue
to hold system calls and general purpose ACL routines common to both
POSIX.1e, NFSv4, and other types of ACLs we may support in the future.
Thanks to: simon
Obtained from: TrustedBSD Project
John Baldwin [Thu, 6 Jul 2006 21:42:36 +0000 (21:42 +0000)]
- Protect the list of linux ioctl handlers with an sx lock.
- Hold Giant while calling linux ioctl handlers for now as they aren't all
known to be MPSAFE yet.
- Mark linux_ioctl() MPSAFE.
John Baldwin [Thu, 6 Jul 2006 21:39:39 +0000 (21:39 +0000)]
- Explicitly acquire Giant around SYSINIT's and SYSUNINIT's since they are
not all known to be MPSAFE yet.
- Actually remove Giant from the kernel linker by taking it out of the
KLD_LOCK() and KLD_UNLOCK() macros.
John Baldwin [Thu, 6 Jul 2006 21:38:24 +0000 (21:38 +0000)]
Don't try to copyin extra data for IPC_RMID requests to msgctl() or
shmctl(). None of the other ABI's do this (including the native FreeBSD
ABI), and uselessly trying to do a copyin() can actually result in a
bogus EFAULT if the a process specifies NULL for the optional argument
(which is what they should do in this case).
John Baldwin [Thu, 6 Jul 2006 21:32:20 +0000 (21:32 +0000)]
Add kern_setgroups() and kern_getgroups() and use them to implement
ibcs2_[gs]etgroups() rather than using the stackgap. This also makes
ibcs2_[gs]etgroups() MPSAFE. Also, it cleans up one bit of weirdness in
the old setgroups() where it allocated an entire credential just so it had
a place to copy the group list into. Now setgroups just allocates a
NGROUPS_MAX array on the stack that it copies into and then passes to
kern_setgroups().
John Baldwin [Thu, 6 Jul 2006 21:29:05 +0000 (21:29 +0000)]
Use the regular poll(2) function to implement poll(2) for the IBCS2 compat
ABI as FreeBSD's poll(2) is ABI compatible. The ibcs2_poll() function
attempted to implement poll(2) using a wrapper around select(2). Besides
being somewhat ugly, it also had at least one bug in that instead of
allocating complete fdset's on the stack via the stackgap it just allocated
pointers to fdsets.
Jung-uk Kim [Thu, 6 Jul 2006 21:12:18 +0000 (21:12 +0000)]
Enhanced floppy controllers have Data Rate Select Register (DSR) at 0x3f4.
Use it to reset controller and to select data rate. According to Intel 80277AA datasheet, software reset behaves the same as DOR reset except
that it is self clearing. National Semiconductor PC8477B datasheet says
the same. As a side effect, we no longer use Configuration Control
Register (CCR) at 0x3f7 for these controllers, which is often missing
in modern hardware.
Bruce Evans [Wed, 5 Jul 2006 22:59:33 +0000 (22:59 +0000)]
Fixed tanh(-0.0) on ia64 and optimizeed tanh(x) for 2**-55 <= |x| <
2**-28 as a side effect, by merging with the float precision version
of tanh() and the double precision version of sinh().
For tiny x, tanh(x) ~= x, and we used the expression x*(one+x) to
return this value (x) and set the inexact flag iff x != 0. This
doesn't work on ia64 since gcc -O does the dubious optimization
x*(one+x) = x+x*x so as to use fma, so the sign of -0.0 was lost.
Instead, handle tiny x in the same as sinh(), although this is imperfect:
- return x directly and set the inexact flag in a less efficient way.
- increased the threshold for non-tinyness from 2**-55 to 2**-28 so that
many more cases are optimized than are pessimized.
Updated some comments and fixed bugs in others (ranges for half-open
intervals mostly had the open end backwards, and there were nearby style
bugs).
Bruce Evans [Wed, 5 Jul 2006 20:06:42 +0000 (20:06 +0000)]
Removed the optimized asm versions of scalb() and scalbf(). These
functions are only for compatibility with obsolete standards. They
shouldn't be used, so they shouldn't be optimized. Use the generic
versions instead.
This fixes scalbf() as a side effect. The optimized asm version left
garbage on the FP stack. I fixed the corresponding bug in the optimized
asm scalb() and scalbn() in 1996. NetBSD fixed it in scalb(), scalbn()
and scalbnf() in 1999 but missed fixing it in scalbf(). Then in 2005
the bug was reimplemented in FreeBSD by importing NetBSD's scalbf().
The generic versions have slightly different error handling:
- the asm versions blindly round the second parameter to a (floating
point) integer and proceed, while the generic versions return NaN
if this rounding changes the value. POSIX permits both behaviours
(these functions are XSI extensions and the behaviour for a bogus
non-integral second parameter is unspecified). Apart from this
and the bug in scalbf(), the behaviour of the generic versions seems
to be identical. (I only exhusatively tested
generic_scalbf(1.0F, anyfloat) == asm_scalb(1.0F, anyfloat). This
covers many representative corner cases involving NaNs and Infs but
doesn't test exception flags. The brokenness of scalbf() showed up
as weird behaviour after testing just 7 integer cases sequentially.)
Bruce Evans [Wed, 5 Jul 2006 17:34:57 +0000 (17:34 +0000)]
Forced commit to fix the log message for the previous commit: the C
files for the scalb() family are only not used for i386, due to only
i386 having bogus optimized asm versions for the scalb() family. Thus
on amd64, rev.1.10 had no effect in the same way as on all non-i386
arches (the strong reference is just implemented in asm on amd64).
Bruce Evans [Wed, 5 Jul 2006 02:16:29 +0000 (02:16 +0000)]
Backed out rev.1.10. It tried to implement ldexpf() as a weak reference
to scalbf(), but ldexpf() cannot be implemented in that way since the
types of the second parameter differ. ldexpf() can be implemented as
a weak or strong reference to scalbnf() (*) but that was already done
long before rev.1.10 was committed. The old implementation uses a
reference, so rev.1.10 had no effect on applications. The C files for
the scalb() family are not used for amd64 or i386, so rev.1.10 had even
less effect for these arches.
(*) scalbnf() raises the radix to the given exponent, while ldexpf()
raises 2 to the given exponent. Thus the functions are equivalent
except possibly for their error handling iff the radix is 2. Standards
more or less require identical error handling. Under FreeBSD, the
functions are equivalent except for more details being missing in
scalbnf()'s man page.
Andrew Thompson [Wed, 5 Jul 2006 00:49:26 +0000 (00:49 +0000)]
Change the multicast calculation to be the same as the other usb drivers and
avoid calling into the usb code with the lock held. This doenst fix the
fundamental usb sleeping problem but at least the adapter can be used.
Andrew Thompson [Tue, 4 Jul 2006 23:09:11 +0000 (23:09 +0000)]
Fix a braino in the last revision, enc_clone_destroy needs return void instead
of int. The clone system will ensure that our first interface is not destroyed
so we dont need the extra checking anyway.
Jung-uk Kim [Mon, 3 Jul 2006 22:05:38 +0000 (22:05 +0000)]
Send client identifier unconditionally. My ancient D-Link router response
with NACK if I don't set it. Setting 'option dhcp-client-identifier' is
alternative but it is inconvenient because I have to keep the list of
all MAC addresses. As bin/94743 pointed out, it is always sent from
Windows clients and I found Mac OS X does the same.
Adjust descriptor locking to tell the kqueue subsystem that our descriptor is
already locked. The reason to do this is to avoid two lock+unlock operations
in a row. We need the lock here to serialize access to bd_pid for stats
collection purposes.
Drop the locks all together on detach, as they will be picked up by
knlist_remove.
This should fix a failed locking assertion when kqueue is being used with bpf
descriptors.
Robert Watson [Mon, 3 Jul 2006 14:55:55 +0000 (14:55 +0000)]
Correct a number of problems that were previously commented on:
- Correct audit_arg_socketaddr() argument name from so to sa.
- Assert arguments are non-NULL to many argument capture functions
rather than testing them. This may trip some bugs.
- Assert the process lock is held when auditing process
information.
- Test currecord in several more places.
- Test validity of more arguments with kasserts, such as flag
values when auditing vnode information.
Matt Jacob [Mon, 3 Jul 2006 08:24:09 +0000 (08:24 +0000)]
Do various fixes to support firmware loading for the 2322
(and by extension, the 2422).
One peculiar thing I've found with the 2322 is that if you
don't force it to do Hard LoopID acquisition, the firmware
crashes. This took a while to figure out.
While we're at it, fix various bugs having to do with NVRAM
reading and option setting with respect to pieces of NVRAM.
Alan Cox [Sun, 2 Jul 2006 18:22:47 +0000 (18:22 +0000)]
Correct an error in the new pmap_collect(), thus only affecting HEAD.
Specifically, the pv entry was always being freed to the caller's pmap
instead of the pmap to which the pv entry belongs.
Warner Losh [Sun, 2 Jul 2006 03:45:33 +0000 (03:45 +0000)]
MFp4:
Make serial ports more robust and reliable. Make non-console ports
work. This might have broken skyeye stuff.
o Introduce ping-pong receive buffers.
o Use DMA to copy characters directly into memory.
o Support baud rates other than 115200
o Use 1 stop bit when 1 stop bit is requested (otherwise 2 were used,
which caused dropped characters when received in bursts).
o Use 1.5 stop bits for 5-bit bytes, and 2 stop bits otherwise when 2
stop bits were requested.
o Actually update line parameters.
o Fix comments
o Move init into attach
o Tweaks to TX interrupt registers to get them reliable and non-storming.
o harvest data in ipend since the latency between it and the callback
was too long. This likely is how it should be, I don't know why I deferred
things to the callback before.
o disable all interrupts in console init. We don't want interrupts until
we turn on an ISR.
o cosmetic tweaks
o Automatically detect of the TIMEOUT interrupt is supported. If so, use
it so we get better CPU utilization. Otherwise do a character at a time
RX. Good news here is that it seems we have enough CPU and low enough
fast interrupt latency to do this reliably.
o Don't read USART_CR. It is a write-only register.
o start to implement bus_ioctl. Do BAUD now...
Alan Cox [Sat, 1 Jul 2006 23:43:54 +0000 (23:43 +0000)]
Tidy up pmap_ts_referenced(): Eliminate excessive white space. Eliminate
an initialized but otherwise unused variable. Explicitly check a pointer
against NULL.
Jason Evans [Sat, 1 Jul 2006 16:51:10 +0000 (16:51 +0000)]
Use some math tricks in arena_run_reg_dalloc() to avoid actual division, as
well as avoiding a switch statement. This change has no significant impact
to performance when branch prediction is successful at predicting the sizes
of objects passed to free(), but in the case that the object sizes are
semi-random, this change has the potential to prevent many branch prediction
misses, thus improving performance substantially.
Take advantage of alignment guarantees in ipalloc(), and pad object sizes to
something less than a power of two when possible. This has the potential
to substantially reduce internal fragmentation for objects allocated via
posix_memalign().
Avoid an unnecessary pow2_ceil() call in arena_ralloc().
o Remove rev. 1.30 leftover. From Damien: However, this code path
is never taken since there aren't any 802.11a ural(4) sticks available
on the market.
Jason Evans [Fri, 30 Jun 2006 20:54:15 +0000 (20:54 +0000)]
Make the behavior of malloc(0) standards-compliant by getting rid of nil,
and instead creating a small allocation for each malloc(0) call. The
optional SysV compatibility behavior remains unchanged.
Yaroslav Tykhiy [Fri, 30 Jun 2006 18:25:07 +0000 (18:25 +0000)]
We needn't check "m" for NULL here because "off" should be within
the mbuf chain. If we ever get a buggy caller, a bogus "off" should
be caught by the sanity check at the function entry. Null "m" here
means a very unusual condition of a totally broken mbuf chain (wrong
m_pkthdr.len or whatever), so we can just page fault later.
Warner Losh [Fri, 30 Jun 2006 06:27:24 +0000 (06:27 +0000)]
Have sio return BIS_PROBE_DEFAULT like all the other drivers in the
tree... John Baldwin noted that sio might pass values between probe
and attach via softc. It appears that sio does leave the hardware in
a known state after probing, so other drivers that try to probe might
leave it in a worse state. It doesn't seem to pass any data in softc,
however, that I could find... I think we should not be probing for
anything but nonPnP isa, but that's a change for another day.
Yaroslav Tykhiy [Thu, 29 Jun 2006 19:22:05 +0000 (19:22 +0000)]
There is a consensus that ifaddr.ifa_addr should never be NULL,
except in places dealing with ifaddr creation or destruction; and
in such special places incomplete ifaddrs should never be linked
to system-wide data structures. Therefore we can eliminate all the
superfluous checks for "ifa->ifa_addr != NULL" and get ready
to the system crashing honestly instead of masking possible bugs.
John Baldwin [Thu, 29 Jun 2006 13:58:36 +0000 (13:58 +0000)]
Fix semctl(2) breakage from the previous commit. Previously __semctl() had
a local 'semid' variable which was the array index and used uap->semid
as the original IPC id. During the kern_semctl() conversion those two
variables were collapsed into a single 'semid' variable breaking the
places that needed the original IPC ID. To fix, add a new 'semidx'
variable to hold the array index and leave 'semid' unmolested as the IPC
id. While I'm here, explicitly document that the (undocumented, at least
in semctl(2)) SEM_STAT command curiously expects an array index in the
'semid' parameter rather than an IPC id.