ed [Fri, 16 Dec 2011 08:22:23 +0000 (08:22 +0000)]
Process a lot of feedback from bde@ on <sys/cdefs.h>:
- Add __alignof() for non-GCC and GCC < 2.95.
- Simply implement the C1X keywords on top of the existing __macros.
- Add struct __hack to _Static_assert to require consumers to add a
semicolon.
- Add an extra underscore to __assert_ to allow it to be combined with
locally defined versions of CTASSERT in the tree.
- Add proper casts to __offsetof() to make it work for cases where
sizeof(size_t) != sizeof(uintptr_t).
- Globally replace size_t and uintptr_t by __size_t and __uintptr_t.
This removes the dependency on <sys/types.h> / <stdint.h>. Practically
any header file ends up including <machines/_types.h> somehow.
- Change argument names of macros to match with the rest of the file.
np [Fri, 16 Dec 2011 02:09:51 +0000 (02:09 +0000)]
Many updates to cxgbe(4)
- Device configuration via plain text config file. Also able to operate
when not attached to the chip as the master driver.
- Generic "work request" queue that serves as the base for both ctrl and
ofld tx queues.
- Generic interrupt handler routine that can process any event on any
kind of ingress queue (via a dispatch table).
- A couple of new driver ioctls. cxgbetool can now install a firmware
to the card ("loadfw" command) and can read the card's memory
("memdump" and "tcb" commands).
- Lots of assorted information within dev.t4nex.X.misc.* This is
primarily for debugging and won't show up in sysctl -a.
- Code to manage the L2 tables on the chip.
- Updates to cxgbe(4) man page to go with the tunables that have changed.
- Updates to the shared code in common/
- Updates to the driver-firmware interface (now at fw 1.4.16.0)
dim [Fri, 16 Dec 2011 00:39:44 +0000 (00:39 +0000)]
Unfortunately, clang gives a warning about sendmail code that cannot be
turned off yet. Since this is contrib code, and we don't really care
about the warnings, just turn make them non-fatal for now.
dim [Thu, 15 Dec 2011 23:28:17 +0000 (23:28 +0000)]
In contrib/file/softmagic.c, fix a potential format string security
problem. (This fix has already been applied upstream, but we do not
have the latest version of file in the tree at the moment.)
dim [Thu, 15 Dec 2011 23:06:46 +0000 (23:06 +0000)]
In cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c, the
dt_popc() function assumes that either _ILP32 or _LP64 is defined,
otherwise it has no suitable implementation.
However, the _ILP32 and _LP64 macros come from isa_defs.h, which is not
included in this file. Add the include now, to get the macros defined.
dim [Thu, 15 Dec 2011 22:10:27 +0000 (22:10 +0000)]
Cast away a clang alignment warning in drti.c's fixsymbol() function.
This code only runs on i386 and amd64, so there should be no problems if
buf + sec->dofs_offset is not aligned (which is unlikely anyway).
bapt [Thu, 15 Dec 2011 22:07:36 +0000 (22:07 +0000)]
Modify pw_copy:
- if pw is NULL and oldpw is not NULL then the oldpw is deleted
- if pw->pw_name != oldpw->pw_name but pw->pw_uid == oldpw->pw_uid
then it renames the user
add new gr_* functions so now gr_util API is similar to pw_util API,
this allow to manipulate groups in a safe way.
Reviewed by: des
Approved by: des
MFC after: 1 month
pjd [Thu, 15 Dec 2011 21:06:37 +0000 (21:06 +0000)]
- Put one file into one line. This makes keeping local changes and merging
with FreeBSD easier for vendors.
- For optional files use variables starting with underscore.
Both changes make rc.d/Makefile look similar to sys/modules/Makefile.
dim [Thu, 15 Dec 2011 20:40:11 +0000 (20:40 +0000)]
Since clang does not support the tls_model attribute used in malloc.c
yet (see LLVM PR 9788), and warns about it, rub it out for now. When
clang grows support for this attribute, I will revert this again.
pfg [Thu, 15 Dec 2011 20:31:18 +0000 (20:31 +0000)]
Bring in reallocblk to ext2fs.
The feature has been standard for a while in UFS as a means to reduce
fragmentation, therefore maintaining consistent performance with
filesystem aging. This is also very similar to what ext4 calls
"delayed allocation".
In his 2010 GSoC, Zheng Liu ported and benchmarked the missing
FANCY_REALLOC code to find more consistent performance improvements than
with the preallocation approach.
PR: 159233
Author: Zheng Liu <gnehzuil AT SPAMFREE gmail DOT com>
Sponsored by: Google Inc.
Approved by: jhb (mentor)
MFC after: 2 weeks
dim [Thu, 15 Dec 2011 20:27:36 +0000 (20:27 +0000)]
In lib/libc/rpc/crypt_client.c, fix a clang warning about an implicit
conversion between enum desdir/desmode from include/rpc/des.h, and enum
desdir/desmode from include/rpcsvc/crypt.x. These are actually
different enums, with different value names, but by accident the integer
representation of the enum values happened to be the same.
dim [Thu, 15 Dec 2011 20:10:12 +0000 (20:10 +0000)]
Remove meaningless self-assignment in res_send.c, otherwise clang will
warn about it. I guess this was originally done to silence a bogus
warning by an older version of gcc, but I could not reproduce it with
any version of gcc that I have access to.
dim [Thu, 15 Dec 2011 19:42:25 +0000 (19:42 +0000)]
The TCB_GET32() and TCB_GET64() macros in the i386 and amd64-specific
versions of pthread_md.h have a special case of dereferencing a null
pointer. Clang warns about this with:
In file included from lib/libthr/arch/i386/i386/pthread_md.c:36:
lib/libthr/arch/i386/include/pthread_md.h:96:10: error: indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]
return (TCB_GET32(tcb_self));
^~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:73:13: note: expanded from:
: "m" (*(u_int *)(__tcb_offset(name)))); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:96:10: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
Since this indirection is done relative to the fs or gs segment, to
retrieve thread-specific data, it is an exception to the rule.
Therefore, add a volatile qualifier to tell the compiler we really want
to dereference a zero address.
alc [Thu, 15 Dec 2011 17:54:23 +0000 (17:54 +0000)]
Simplify the implementation of the identity mapping in start_all_aps().
Since mpboot.s enables processor support for PG_PS before enabling
paging, there is no reason that the identity must use 4 KB page mappings.
fjoe [Thu, 15 Dec 2011 06:25:19 +0000 (06:25 +0000)]
Revert r228521: sometimes job output is lost
(see tools/regression/usr.bin/make/execution/joberr test).
openpty(fd + 0, fd + 1,...) version does not have this problem but
it sometimes enters an infinite sleep in "ttywait" state in tty_drain()
when make(1) closes slave pty.
delphij [Thu, 15 Dec 2011 02:26:53 +0000 (02:26 +0000)]
Honor NFSv3 commit call (RFC 1813, Section 3.3.21) where when count is 0,
the full length from offset is being flushed. Note that for now VOP_FSYNC
does not support offset and length parameters so we still do the same full
VOP_FSYNC. This issue was reported at FreeNAS support site as FreeNAS
ticket #1096.
adrian [Thu, 15 Dec 2011 01:05:38 +0000 (01:05 +0000)]
* Add in the gpio/gpioled drivers into AR91XX_BASE.
* Add in a default GPIO section for AR91XX_BASE.hints, which doesn't
define the GPIO function masks or any GPIO pines.
* Add in the GPIO line definitions for LEDs and GPIO pins for the
TP-WR1043nd.
adrian [Thu, 15 Dec 2011 01:03:49 +0000 (01:03 +0000)]
Re-jiggle the GPIO code a little to remove the hard-coded AR71xx GPIO
config and function mask setup.
* "gpiomask" now specifies which GPIO pins to enable, for devices to bind to.
* "function_set" allows bits in the function register to be set at GPIO setup.
* "function_clear" allows bits in the function register to be cleared at
GPIO setup.
The function_set/function_clear bits allow for individual GPIO pins to either
drive a GPIO line or an alternate function - eg USB, JTAG, etc. This allows
for things like CS1/CS2 be enabled for those boards w/ >1 SPI device connected,
or disabling JTAG for the AR7240 (which is apparently needed ..)
adrian [Thu, 15 Dec 2011 00:59:11 +0000 (00:59 +0000)]
Add the 11n chipset RF frontends to the linker set, even though they're not
attached this way.
The AR5212 based NICs have a variety of RF frontends, so there's a linker set
which the AR5212 attach routine calls. The same framework is used for the
AR5416 and later but as there's a fixed RF frontend for each 11n NIC, it
is just directly attached.
However in the case of compiling a cut down HAL (eg _just_ AR9130 WMAC support),
the linker set ends up being empty and this causes the compile to fail.
So this is just a workaround for that - it means those users who wish an 11n
only HAL can compile the 11n chipsets and RF frontend they need, and just
"ath_ar5212" for the AR5212/AR5416 common code, and it'll just work.
adrian [Thu, 15 Dec 2011 00:52:30 +0000 (00:52 +0000)]
Modify the ACL code slightly to support a few nifty things:
* Call it before sending probe responses, so the ACL code has the
chance to reject sending them.
* Pass the whole frame to the ACL code now, rather than just the
destination MAC - that way the ACL module can look at the frame
contents to determine what the response should be.
This is part of some uncommitted work to support band steering.
jilles [Wed, 14 Dec 2011 22:26:39 +0000 (22:26 +0000)]
Fix select/poll/kqueue for write on reverse direction before first write.
The reverse direction of a pipe is lazily allocated on the first write in
that direction (because pipes are usually used in one direction only). A
special case is needed to ensure the pipe appears writable before the first
write because there are 0 bytes of pending data in 0 bytes of buffer space
at that point, leaving 0 bytes of data that can be written with the normal
code.
Note that the first write returns [ENOMEM] if kern.ipc.maxpipekva is
exceeded and does not block or return [EAGAIN], so selecting true for write
is correct even in that case.
jhb [Wed, 14 Dec 2011 22:22:19 +0000 (22:22 +0000)]
Add a helper API to allow in-kernel code to map portions of shared memory
objects created by shm_open(2) into the kernel's address space. This
provides a convenient way for creating shared memory buffers between
userland and the kernel without requiring custom character devices.
raj [Wed, 14 Dec 2011 17:12:59 +0000 (17:12 +0000)]
Make *intr{cnt,names} on ARM reside in data section, similar to other arches.
sintrnames and sintrcnt are initialized with non-zero values, which were
discarded by the .bss directive, so consumers like "vmstat -i" were not
getting correct data.
kib [Wed, 14 Dec 2011 16:47:53 +0000 (16:47 +0000)]
_rtld_bind() read-locks the bind lock, and possible plt resolution
from the dispatcher would also acquire bind lock in read mode, which
is the supported operation. plt is explicitely designed to allow safe
multithreaded updates, so the shared lock do not cause problems.
The error in r228435 is that it allows read lock acquisition after the
write lock for the bind block. If we dlopened the shared object that
contains IRELATIVE or jump slot which target is STT_GNU_IFUNC, then
possible recursive plt resolve from the dispatcher would cause it.
Postpone the resolution for irelative/ifunc right before initializers
are called, and drop bind lock around calls to dispatcher. Use
initlist to iterate over the objects instead of the ->next, due to
drop of the bind lock in iteration.
For i386/reloc.c:reloc_iresolve(), fix calculation of the dispatch
function address for dso, by taking into account possible non-zero
relocbase.
jhb [Wed, 14 Dec 2011 12:34:02 +0000 (12:34 +0000)]
Implement BUS_ADD_CHILD() for the isab(4) driver. It already calls
bus_generic_probe() and bus_generic_attach() to handle drivers that add
new children via identify methods.
ed [Wed, 14 Dec 2011 09:09:37 +0000 (09:09 +0000)]
Slightly alter the C1X definitions in in cdefs.h:
- Add _Alignas(). Unfortunately this macro is only partially functional.
The C1X standard will allow both an integer and a type name to be
passed to this macro, while this macro only allows an integer. To be
portable, one must use _Alignas(_Alignof(double)) to use type names.
- Don't do _Static_assert() when __COUNTER__ is not supported. We'd
better keep this implementation robust and allow it to be used in
header files, without mysteriously breaking older compilers.
hselasky [Wed, 14 Dec 2011 00:48:20 +0000 (00:48 +0000)]
Stop USB audio transfers early so that any audio applications
will time out and close opened /dev/dspX.Y device(s), if
any. This is a workaround because we cannot unregister PCM
devices while the audio character device is in use.
yongari [Tue, 13 Dec 2011 20:26:46 +0000 (20:26 +0000)]
BCM5720 performance tweak from Broadcom.
o Allow multiple outstanding read requests from non-LSO read DMA engine.
o Allow 4KB burst length reads for non-LSO frames.
o Enable 512B burst length reads for buffer descriptors.
ed [Tue, 13 Dec 2011 19:37:27 +0000 (19:37 +0000)]
Make support for C1X keywords more complete.
- _Alignof(), which returns the aligment of a certain type.
- _Static_assert(), which can be used to check compile-time assertions.
- _Thread_local, which uses TLS on a variable.
yongari [Tue, 13 Dec 2011 18:11:25 +0000 (18:11 +0000)]
Rework link state tracking and remove superfluous link UP/DOWN
messages.
o Add check for actually resolved speed in miibus_statchg callback
instead of blindly reprogramming BCE_EMAC_MODE register. The
callback may be called multiple times(e.g. link UP, link
transition, auto-negotiate complete etc) while auto-negotiation
is in progress. All unresolved link state changes are ignored
now and setting BCE_EMAC_MODE after link establishment is done
once.
o bce(4) is careful enough not to drive MII_TICK if driver got a
valid link. To detect lost link, bce(4) relied on link state
change interrupt and if driver see the interrupt, it forced to
drive MII_TICK by calling bce_tick() in interrupt handler.
Because bce(4) generates multiple link state change interrupts
while auto-negotiation is in progress, bce_tick() would be
called multiple times and this resulted in generating multiple
link UP/DOWN messages.
With this change, bce_tick() is not called in interrupt handler
anymore such that miibus_statchg callback handles link state
changes with consistent manner.
ed [Tue, 13 Dec 2011 17:34:47 +0000 (17:34 +0000)]
Add support for __COUNTER__.
__COUNTER__ allows one to obtain incrementing (read: unique) numbers
from the C preprocesor. This is useful when implementing things like a
robust implementation of CTASSERT(), which currently fails when using
it more than once on a single line of code. Probably not likely to cause
any breakage, but still.
__COUNTER__ was also added to GCC 4.3, but since that implementation is
GPLv3 licensed, I took the liberty of implementing it without looking at
any upstream sources. Therefore, this version is licensed under the same
license as the rest of the code; GPLv2.
ed [Tue, 13 Dec 2011 14:06:01 +0000 (14:06 +0000)]
Replace `inline static' by `static inline'.
If I interpret the C standard correctly, the storage specifier should be
placed before the inline keyword. While at it, replace __inline by
inline in the files affected.
ed [Tue, 13 Dec 2011 13:32:56 +0000 (13:32 +0000)]
Replace __const by const in all non-contributed source code.
As C1X is close to being released, there is no need to wrap around a
feature that is already part of C90. Most of these files already use
`const' in different placed as well.
mav [Tue, 13 Dec 2011 09:58:05 +0000 (09:58 +0000)]
Fix few bugs in isp(4) target mode support:
- in destroy_lun_state() assert hold == 1 instead of 0, as it should
receive hold taken by the create_lun_state() or get_lun_statep() before;
- fix hold count leak inside rls_lun_statep() that also fired above assert;
- in destroy_lun_state() use SIM bus number instead of SIM path id for
ISP_GET_PC_ADDR(), as it was before r196008;
- make isp_disable_lun() to set status in CCB;
- make isp_target_mark_aborted() set status into the proper CCB.
ed [Tue, 13 Dec 2011 09:01:44 +0000 (09:01 +0000)]
Staticify dumpfs.
This tool only consists of a single C file, so we can simply mark
everything except main() static. This seems to shave off about 8% of the
binary size.