Robert Watson [Thu, 28 Jul 2005 09:45:08 +0000 (09:45 +0000)]
Minor syntax tweaks:
- Remove some extra blank lines.
- Remove comments that don't contribute to understanding.
- Remove additional blank lines in output added to maximize compatibility
with older vmstat output, but that is actually somewhat gratuitous.
Submitted by: bde
MFC with: other vmstat libmemstat(3) changes
Warner Losh [Thu, 28 Jul 2005 03:51:54 +0000 (03:51 +0000)]
Add a couple of missing nic interfaces that have been added: iwi, ipw,
ral and ural. Add a comment about this regexp being lame, which
should shock no-one. Add a comment about why rescans are disabled on scsi
cards.
Brooks Davis [Thu, 28 Jul 2005 00:24:39 +0000 (00:24 +0000)]
Don't reject packets with server names containing characters that are
not allowed in domain names. RFC 2132 does not list valid or invalid
characters and the ISC client accepts anything here.
Fix the way how "InUse" column in 'vmstat -m' output works:
- increase number of allocations count only on successfull malloc(9),
so it doesn't confuse people;
- because we need to check if 'size > 0', hide 'mtsp->mts_memalloced += size;'
under the check as well, as for size=0 it is of course a no-op;
- avoid critical_enter()/critical_exit() in case of failure in
malloc_type_allocated() as there will be nothing to do.
Maksim Yevmenkin [Wed, 27 Jul 2005 21:03:35 +0000 (21:03 +0000)]
Reorganize an_detach() a bit. Make sure ether_ifdetach() and if_free()
are called outside of AN_LOCK()/AN_UNLOCK. This fixes the following
WITNESS warning (produced when an(4) PCMCIA card is detached).
taskqueue_drain with the following non-sleepable locks held:
exclusive sleep mutex an0 (network driver) r = 0 (0xc59af168) locked @ /usr/src/sys/dev/an/if_an.c:2836
John Baldwin [Wed, 27 Jul 2005 20:01:45 +0000 (20:01 +0000)]
Add extra constraints to tell the compiler that the memory be modified
in the arm __swp() and sparc64 casa() and casax() functions is actually
being used as an input and output and not just the value of the register
that points to the memory location. This was the underlying source of
the mbuf refcount problems on sparc64 a while back. For arm this should be
a nop because __swp() has a constraint to clobber all memory which can
probably be removed now.
Brooks Davis [Wed, 27 Jul 2005 19:25:46 +0000 (19:25 +0000)]
Fix a bug in the handling of cases where we got a short (or zero)
capture. Zero length captures caused an infinte loop and short captures
probably caused memory corruption and a crash.
Paul Saab [Wed, 27 Jul 2005 15:05:31 +0000 (15:05 +0000)]
In nfs_nget() if two threads race on the same filehandle, the loser should
cause the nfsnode to get freed. This fixes a potential vnode (and nfsnode)
leak in that path.
John Baldwin [Wed, 27 Jul 2005 13:51:01 +0000 (13:51 +0000)]
- Use callout_*() rather than timeout() to periodically poll the media.
- Add locking to protect the softc and mark this driver as MP safe. There
are still some edge cases with multiport cards that need more locking
work.
Use root_mount KPI for RAID3 to delay root file system mount.
Actually, one cannot setup root file system on RAID3 device, but when
other file system exist in /etc/fstab which are placed on RAID3 device,
boot process will be interrupted when these devices are missing.
MFC after: 3 days
X-MFC-note: MFC only to RELENG_6, as RELENG_5 doesn't have root_mount KPI.
Sam Leffler [Wed, 27 Jul 2005 02:53:09 +0000 (02:53 +0000)]
bandaid ni_fails handling so ap's with association failures are
reconsidered after a bit; a proper fix involves more changes to
the scanning infrastructure
Reviewed by: avatar, David Young
MFC after: 5 days
Introduce a bpfstat utility. This program can be used to retrieve
stats provided by bpf(4). This program will live in tools/ for now
until we figure out where it will live permanently. Based on some
discussions on developers@, it is likely that we will be adding
this functionality to netstat(1) at some point.
Add the first snapshot at rewriting the nanobsd build to be a shellscript.
The overall idea is to get a single build script which will not need
editing, but instead overrides and changes happen by config files passed
as arguments.
Robert Watson [Mon, 25 Jul 2005 22:35:10 +0000 (22:35 +0000)]
Teach vmstat -m and vmstat -z to use libmemstat(3). Certain
statistics from -z are now a bit different due to changes in the
way statistics are now measured. Reproduce with some amount of
accuracy the slightly obscure layouts adopted by the two kernel
sysctls. In the future, we might want to normalize them.
Maxime Henrion [Mon, 25 Jul 2005 22:21:11 +0000 (22:21 +0000)]
Remove an erroneous m_freem() call. If m_defrag() returns a non-NULL
pointer, it has already freed the original mbuf chain, so we shouldn't
do it again.
Brooks Davis [Mon, 25 Jul 2005 22:19:09 +0000 (22:19 +0000)]
Change host-name from type "X" to type "t". This allows the client to
accept NUL-terminated strings as required by RFC 2132.
This solution is not perfect as it removes the ability to send
NUL-terminated host-name options which may be required by some broken
servers. Given the current lack of an existance proof of such servers
and the fact that servers that send NUL-terminated domain names do
exist, this seems like an acceptable compromise. A discussion of these
issues can be found at:
By design I left a tiny race in updating the I/O statistics based on
the assumption that performance was more important that beancounter
quality statistics.
As it transpires the microoptimization is not measurable in the
real world and the inconsistent statistics confuse users, so revert
the decision.
Correct minor output bug. When the battery being queried is charging or
the overall discharge rate is 0, mark the battery remaining time as
"unknown", not 0.
Disable thread support in BIND. It appears to reduce performance rather
than increase it, and seems to be the cause of the memory leaks which some
users have reported.
scope cleanup. with this change
- most of the kernel code will not care about the actual encoding of
scope zone IDs and won't touch "s6_addr16[1]" directly.
- similarly, most of the kernel code will not care about link-local
scoped addresses as a special case.
- scope boundary check will be stricter. For example, the current
*BSD code allows a packet with src=::1 and dst=(some global IPv6
address) to be sent outside of the node, if the application do:
s = socket(AF_INET6);
bind(s, "::1");
sendto(s, some_global_IPv6_addr);
This is clearly wrong, since ::1 is only meaningful within a single
node, but the current implementation of the *BSD kernel cannot
reject this attempt.
Add a very simple and small GEOM class - ZERO.
It creates very huge provider (41PB) /dev/gzero.
On BIO_READ request it zero-fills bio_data and on BIO_WRITE it does nothing.
You can also set kern.geom.zero.clear sysctl to 0 to do nothing even for
BIO_READ.
I'm using it for performance testing where it is very helpful.
Robert Watson [Mon, 25 Jul 2005 09:52:59 +0000 (09:52 +0000)]
If a retrieved UMA zone is a secondary zone, don't report keg free items,
as they actually belong to the primary zone, and maye otherwise be
reported more than once.
Philip Paeps [Mon, 25 Jul 2005 09:15:12 +0000 (09:15 +0000)]
Add some more NO_FOO options. I'm not sure if they're correctly sorted in the
size-scheme. Also add commented NO_BIND_FOO options for people who want named
but not all of the bloat it likes to include by default.
While here, make a comment about BOOT_COMCONSOLE_SPEED.
Philip Paeps [Mon, 25 Jul 2005 08:40:13 +0000 (08:40 +0000)]
Add fstab entries for ALTROOTSLICE and CFGSLICE, allowing us to do away with
most of the hardcoding of device names in installed convenience scripts.
Provide a new script (root/updatep) to easily update the ALTROOTSLICE. It
does the same as updatep1/updatep2 without hardcoded device names. If noone
protests, I'd like to get rid of updatep1/updatep2 at some point.
As an extra bonus: turn on the error led while updating (on hardware with a
led).
Robert Watson [Mon, 25 Jul 2005 00:47:32 +0000 (00:47 +0000)]
Rename UMA_MAX_NAME to UTH_MAX_NAME, since it's a maximum in the
monitoring API, which might or might not be the same as the internal
maximum (currently none).
Export flag information on UMA zones -- in particular, whether or
not this is a secondary zone, and so the keg free count should be
considered in that light.
Marius Strobl [Sun, 24 Jul 2005 18:12:31 +0000 (18:12 +0000)]
- Wrap the handler and associated code for collecting completed RX
descriptors that are still marked owned in #ifdef GEM_RINT_TIMEOUT
instead of #if 0 for convenience.
- Remove stale code and comment about relying on the preset XIF config.
- In case of a watchdog timeout call the init function instead of just
the start function so the chip is properly reset.
Merge from hme(4):
- Convert to use bus_dmamap_load_mbuf_sg() for loading RX buffers.
- Protect from a duplicate mbuf free panic in case the DMA engine hangs.
Maxime Henrion [Sun, 24 Jul 2005 17:55:57 +0000 (17:55 +0000)]
Add back ed(4) in amd64 GENERIC. It now works nicely and since those
chips are commonly found, it makes sense to have it in GENERIC. This
is a candidate for a RELENG_6 MFC.
Approved by; peter
Requested by: pav
Tested by: pav
Introduce new sysctl variable: net.bpf.stats. This sysctl variable can
be used to pass statistics regarding dropped, matched and received
packet counts from the kernel to user-space. While we are here
introduce a new counter for filtered or matched packets. We currently
keep track of packets received or dropped by the bpf device, but not
how many packets actually matched the bpf filter.
-Introduce net.bpf.stats sysctl OID
-Move sysctl variables after the function prototypes so we can
reference bpf_stats_sysctl(9) without build errors.
-Introduce bpf descriptor counter which is used mainly for sizing
of the xbpf_d array.
-Introduce a xbpf_d structure which will act as an external
representation of the bpf_d structure.
-Add a the following members to the bpfd structure:
bd_fcount - Number of packets which matched bpf filter
bd_pid - PID which opened the bpf device
bd_pcomm - Process name which opened the device.
It should be noted that it's possible that the process which opened
the device could be long gone at the time of stats collection. An
example might be a process that opens the bpf device forks then exits
leaving the child process with the bpf fd.
Tim J. Robbins [Sun, 24 Jul 2005 12:12:44 +0000 (12:12 +0000)]
Speed up __wcsconv() (and hence the printf() %ls format):
- use wcsrtombs() instead of a wcrtomb() loop where possible.
- avoid wcrtomb() loop when output precision is small.
Sam Leffler [Sun, 24 Jul 2005 05:11:39 +0000 (05:11 +0000)]
o fix setup of sc_diversity; the hal does not give us reliable
status after attach, only after a reset
o when setting diversity via the sysctl don't update sc_diversity
until we know the hal requested worked
o while here eliminate sc_hasdiversity and sc_hastpc; just query
the hal each time since these are the only places we need to know
Robert Watson [Sun, 24 Jul 2005 01:42:42 +0000 (01:42 +0000)]
Since libmemstat(3) now supports its own error management mechanism,
use that instead of trying to use errno, in order to produce a
sensible error message.
Robert Watson [Sun, 24 Jul 2005 01:41:47 +0000 (01:41 +0000)]
Having decided not to provide a libmemstat(3) error number to text
conversion routine, now change my mind and add one, memstat_strerror(3),
which returns a const char * pointer to a string describing the error,
to be used on the results of memstat_mtl_geterror().
While here, also correct a minor typo in the HISTORY man page.
Pointers on improving ease of internationalization would be
appreciated.
Robert Watson [Sun, 24 Jul 2005 01:28:54 +0000 (01:28 +0000)]
Introduce more formal error handling for libmemstat(3):
- Define a set of libmemstat(3) error constants, which are used by all
libmemstat(3) methods except for memstat_mtl_alloc(), which allocates
a memory type list and may return ENOMEM via errno.
- Define a per-memory_type_list current error value, which is set when a
call associated with a memory list fails. This requires wrapping a
structure around the queue(9) list head data structure, but this change
is not visible to libmemstat(3) consumers due to using access methods.
- Add a new accessor method, memstat_mtl_geterror() to retrieve the error
number.
- Consistently set the error number in a number of failure modes where
previously some combination of setting errno and printf'ing error
descriptions was used. libmemstat(3) will now no longer print to stdio
under any circumstances. Returns of NULL/-1 for errors remain the
same.
This avoids use of stdio, misuse of error numbers, and should make it
easier to program a libmemstat(3) consumer able to print useful error
messages. Currently, no error-to-string function is provided, as I'm
unsure how to address internationalization concerns.
Rewrite the acpi_battery interface to allow for other battery types
(i.e., smart battery) and fix various bugs found during the cleanup.
API changes:
* kernel access:
Access to individual batteries is now via devclass_find("battery").
Introduce new methods ACPI_BATT_GET_STATUS (for _BST-formatted data) and
ACPI_BATT_GET_INFO (for _BIF-formatted data). The helper function
acpi_battery_get_battinfo() now takes a device_t instead of a unit #
argument. If dev is NULL, this signifies all batteries.
* ioctl access:
The ACPIIO_BATT_GET_TYPE and ACPIIO_BATT_GET_BATTDESC ioctls have been
removed. Since there is now no need for a mapping between "virtual" unit
and physical unit, usermode programs can just specify the unit directly and
skip the old translation steps. In fact, acpiconf(8) was actually already
doing this and virtual unit was the same as physical unit in all cases
since there was previously only one battery type (acpi_cmbat). Additionally,
we now map the ACPIIO_BATT_GET_BIF and ACPIIO_BATT_GET_BST ioctls for all
batteries, if they provide the associated methods.
* apm compatibility device/ioctls: no change
* sysctl: no change
Since most third-party applications use the apm(4) compat interface, there
should be very few affected applications (if any).
My change, namely srandomdev() addition, was backed out even without
discussing with me, and I obviously disagree seeing that afterwards
(srandomdev() back out not fix any thing, it can only mask the problem).
So, back out the back out and return srandomdev().
People who have problems with repeated quotes should use -D fortune
option for debugging to see is the problem in (1) /dev/random initialization
or in (2) fortune code itself.
I will be glad to help, but I can't reproduce repeated quote situation
on my machine.
In either case found, (1) or (2) should be fixed instead of removing
srandomdev().
R. Imura [Sat, 23 Jul 2005 16:52:57 +0000 (16:52 +0000)]
Temporary restore a part of rev 1.6.
We must not increase a capability of buffer size here,
because codes which call these functions expect that dst and src
are the same size.
This will cause problem when someone convert a character whose
length is different between charsets on smbfs which was changed
to use xlat16 converter.