]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
13 years agoUMA_MD_SMALL_ALLOC for mips.
jchandra [Thu, 9 Dec 2010 06:34:28 +0000 (06:34 +0000)]
UMA_MD_SMALL_ALLOC for mips.

Implement uma_small_alloc() and uma_small_free() for mips that allocates
pages from direct mapped memory. Uses the same mechanism as the page table
page allocator, so that we allocate from KSEG0 in 32 bit, and from XKPHYS
on 64 bit.

Reviewed by: alc, jmallett

13 years agoMFp4:
davidxu [Thu, 9 Dec 2010 05:16:20 +0000 (05:16 +0000)]
MFp4:
The unit number allocator reuses ID too fast, this may hide bugs in
other code, add a ring buffer to delay freeing a thread ID.

13 years agoMFp4:
davidxu [Thu, 9 Dec 2010 02:42:02 +0000 (02:42 +0000)]
MFp4:
It is possible a lower priority thread lending priority to higher priority
thread, in old code, it is ignored, however the lending should always be
recorded, add field td_lend_user_pri to fix the problem, if a thread does
not have borrowed priority, its value is PRI_MAX.

MFC after: 1 week

13 years agoDo not subtract 0.5% from estimated frequency if DELAY(9) is driven by TSC.
jkim [Wed, 8 Dec 2010 23:40:41 +0000 (23:40 +0000)]
Do not subtract 0.5% from estimated frequency if DELAY(9) is driven by TSC.
Remove a confusing comment about converting to MHz as we never did.

13 years agoprintf: Test that the "--" option terminator works.
jilles [Wed, 8 Dec 2010 22:54:18 +0000 (22:54 +0000)]
printf: Test that the "--" option terminator works.

13 years agoprintf: Remove support for building as a csh builtin.
jilles [Wed, 8 Dec 2010 22:13:27 +0000 (22:13 +0000)]
printf: Remove support for building as a csh builtin.

The #define BUILTIN was for building as a csh (not tcsh) builtin.
Given that csh was replaced by tcsh years ago there is no point in keeping
this.

The #define SHELL is for building as an sh builtin and is in active use.

This commit does not change the /bin/sh and /usr/bin/printf binaries.

13 years agoAdd IDs of HighPoint RocketRAID 62x cards (Marvell 88SE9128 chips).
mav [Wed, 8 Dec 2010 20:35:20 +0000 (20:35 +0000)]
Add IDs of HighPoint RocketRAID 62x cards (Marvell 88SE9128 chips).

PR: kern/152926
Submitted by: Mike Tancsa <mike@sentex.net>
MFC after: 1 week

13 years agoOn amd64, we have (since r1.72, in December 2005) MAX_BPAGES=8192,
cperciva [Wed, 8 Dec 2010 20:20:10 +0000 (20:20 +0000)]
On amd64, we have (since r1.72, in December 2005) MAX_BPAGES=8192,
while on i386 we have MAX_BPAGES=512.  Implement this difference via
'#ifdef __i386__'.

With this commit, the i386 and amd64 busdma_machdep.c files become
identical; they will soon be replaced by a single file under sys/x86.

13 years agoMFi386 r1.94: If XEN, make pmap_kextract = pmap_kextract_ma. This is a
cperciva [Wed, 8 Dec 2010 19:52:04 +0000 (19:52 +0000)]
MFi386 r1.94: If XEN, make pmap_kextract = pmap_kextract_ma.  This is a
no-op currently, since FreeBSD/amd64 doesn't have (paravirtualized) Xen
support, but if/when that support is ever added we'll want this, and
until then it's harmless.

13 years agoMFi386 r1.81, r1.82, r1.84: Reorganize code to reduce cache pressure and
cperciva [Wed, 8 Dec 2010 19:42:21 +0000 (19:42 +0000)]
MFi386 r1.81, r1.82, r1.84: Reorganize code to reduce cache pressure and
branch mispredictions.

No objections from: scottl

13 years agoFix typos.
syrinx [Wed, 8 Dec 2010 17:34:07 +0000 (17:34 +0000)]
Fix typos.

13 years agoAdd (disabled) sample configurations needed to enable the snmp_usm and
syrinx [Wed, 8 Dec 2010 17:27:59 +0000 (17:27 +0000)]
Add (disabled) sample configurations needed to enable the snmp_usm and
snmp_vacm modules and minimal user/view configurations needed to for
the modules to work properly.

Sponsored by:   The FreeBSD Foundation
Reviewed by:    philip@ (mostly)
Approved by:    philip@

13 years agoAdd a forgotten file from r216294 and unbreak the build.
syrinx [Wed, 8 Dec 2010 15:52:06 +0000 (15:52 +0000)]
Add a forgotten file from r216294 and unbreak the build.

Sponsored by: The FreeBSD Foundation
Reviewed by: philip@ (mostly)
Approved by: philip@

13 years agoUse convenience macro for minimum and maximum value capping when
attilio [Wed, 8 Dec 2010 15:32:54 +0000 (15:32 +0000)]
Use convenience macro for minimum and maximum value capping when
re-arming the watchdog timeout.

Sponsored by: Sandvine Incorporated
Submitted by: Mark Johnston <mjohnston at sandvine dot com>
Reviewed by: des
MFC after: 10 days

13 years ago- Fix array bounds checking. [1]
glebius [Wed, 8 Dec 2010 15:12:37 +0000 (15:12 +0000)]
- Fix array bounds checking. [1]
- Add message length checking.

PR: 151664 [1]
Submitted by: Alexey Illarionov <littlesavage rambler.ru> [1]
Reviewed by: yar

13 years agoAdd RTM_IEEE80211 to array of route message descriptions.
glebius [Wed, 8 Dec 2010 15:10:27 +0000 (15:10 +0000)]
Add RTM_IEEE80211 to array of route message descriptions.

PR: 151664
Submitted by: Alexey Illarionov <littlesavage rambler.ru>

13 years agoAdd bsnmpd(1)'s SNMP client tools (including SNMPv3 support) to the base system.
syrinx [Wed, 8 Dec 2010 14:30:25 +0000 (14:30 +0000)]
Add bsnmpd(1)'s SNMP client tools (including SNMPv3 support) to the base system.

Sponsored by:   The FreeBSD Foundation (the SNMPv3 bits), Google Summer of Code 2005
Reviewed by:    philip@ (mostly), bz@ (earlier version based on p4 ch124545)
Approved by:    philip@

13 years agoIn bsnmpd(1) add support for SNMPv3 message processing model, including message authe...
syrinx [Wed, 8 Dec 2010 13:51:38 +0000 (13:51 +0000)]
In bsnmpd(1) add support for SNMPv3 message processing model, including message authentication, packet encryption & view-based access control (RFC 3412, 3414, 3415).

Sponsored by: The FreeBSD Foundation
Reviewed by: philip@ (mostly)
Approved by: philip@

13 years agoPrint message with information about updating the boot code if a new
mm [Wed, 8 Dec 2010 13:51:25 +0000 (13:51 +0000)]
Print message with information about updating the boot code if a new
vdev is attached to a root pool (e.g. when creating a mirrored boot pool).

Reviewed by: pav
Approved by: delphij (mentor)
MFC after: 3 days

13 years agoClose fd in initattr() and showattr().
kevlo [Wed, 8 Dec 2010 10:27:07 +0000 (10:27 +0000)]
Close fd in initattr() and showattr().

Reviewed by: rwatson

13 years agoDo not print OpenSolaris hint to use (non-existing) installgrub(1) command
mm [Wed, 8 Dec 2010 08:57:37 +0000 (08:57 +0000)]
Do not print OpenSolaris hint to use (non-existing) installgrub(1) command
if creating a mirror by attaching a new vdev to a root pool.

Reported by: James R. Van Artsdalen (on freebsd-fs@freebsd.org)
Approved by: delphij (mentor)
MFC after: 3 days

13 years agoFix a typo.
hrs [Wed, 8 Dec 2010 07:10:25 +0000 (07:10 +0000)]
Fix a typo.

Submitted by: Garrett Cooper

13 years agoClosing file descriptors when it's done
kevlo [Wed, 8 Dec 2010 01:35:19 +0000 (01:35 +0000)]
Closing file descriptors when it's done

Reviewed by: np

13 years agor184610 changed the way how TX frames are handled on AX88178 and
yongari [Wed, 8 Dec 2010 01:24:05 +0000 (01:24 +0000)]
r184610 changed the way how TX frames are handled on AX88178 and
AX88772 controllers. ASIX added a new feature for AX88178/AX88772
controllers which allows combining multiple TX frames into a single
big frame. This was to overcome one of USB limitation where it
can't generate more than 8k interrupts/sec which in turn means USB
ethernet controllers can not send more than 8k packets per second.
Using ASIX's feature greatly enhanced TX performance(more than 3~4
times) compared to 7.x driver. However it seems r184610 removed
boundary checking for buffered frames which in turn caused
instability issues under certain conditions. In addition, using
ASIX's feature triggered another issue which made USB controller
hang under certain conditions. Restarting ethernet controller
didn't help under this hang condition and unplugging and replugging
the controller was the only solution. I believe there is a silicon
bug in TX frame combining feature on AX88178/AX88772 controllers.

To address these issues, reintroduce the boundary checking for both
AX88178 and AX88772 after copying a frame to USB buffer and do not
use ASIX's multiple frame combining feature. Instead, use USB
controller's multi-frame transmit capability to enhance TX
performance as suggested by Hans[1].
This should fix a long standing axe(4) instability issues reported
on AX88772 and AX88178 controllers. While I'm here remove
unnecessary TX frame length check since upper stack always
guarantee the size of a frame to be less than MCLBYTES.

Special thanks to Derrick Brashear who tried numerous patches
during last 4 months and waited real fix with patience. Without
this enthusiastic support, patience and H/W donation I couldn't fix
it since I was not able to trigger the issue on my box.

Suggested by: hselasky [1]
Tested by: Derrick Brashear (shadow <> gmail dot com>
H/W donated by: Derrick Brashear (shadow <> gmail dot com>
PR: usb/140883

13 years agoMerge sys/amd64/amd64/tsc.c and sys/i386/i386/tsc.c and move to sys/x86/x86.
jkim [Wed, 8 Dec 2010 00:09:24 +0000 (00:09 +0000)]
Merge sys/amd64/amd64/tsc.c and sys/i386/i386/tsc.c and move to sys/x86/x86.

Discussed with: avg

13 years agoAdd myself to calendar.freebsd and committers-ports.dot
flo [Tue, 7 Dec 2010 23:56:51 +0000 (23:56 +0000)]
Add myself to calendar.freebsd and committers-ports.dot

Approved by: fjoe (mentor)

13 years agoPostpone the unmasking of event channels (aka. interrupts) until after
cperciva [Tue, 7 Dec 2010 23:33:20 +0000 (23:33 +0000)]
Postpone the unmasking of event channels (aka. interrupts) until after
the interrupt handlers have been registered.  NULL isn't a very good
interrupt handler.

13 years agoUse int for 'tsc_present' instead of u_int. It is just a boolean.
jkim [Tue, 7 Dec 2010 23:19:49 +0000 (23:19 +0000)]
Use int for 'tsc_present' instead of u_int.  It is just a boolean.

13 years agoLoosen the locking in nd6-free() again after r216022 to avoid
bz [Tue, 7 Dec 2010 22:43:29 +0000 (22:43 +0000)]
Loosen the locking in nd6-free() again after r216022 to avoid
a LOR and a recursed lock.

Reported by: delphij
Tested by: delphij
PR: kern/148857
MFC After: 3 days

13 years agoRemove stale comments about P-state invariant TSC and fix style(9) nits.
jkim [Tue, 7 Dec 2010 22:43:25 +0000 (22:43 +0000)]
Remove stale comments about P-state invariant TSC and fix style(9) nits.

13 years agoDo not register a event handler for CPU freqency changes when it is found
jkim [Tue, 7 Dec 2010 22:34:51 +0000 (22:34 +0000)]
Do not register a event handler for CPU freqency changes when it is found
P-state invariant.  This is continuation of r216274.

13 years agoNow the P-state invariant TSC is probed early enough, do not register event
jkim [Tue, 7 Dec 2010 22:23:26 +0000 (22:23 +0000)]
Now the P-state invariant TSC is probed early enough, do not register event
handlers for CPU freqency changes when it is found P-state invariant.
Adjust a comment about non-existent tsc_freq_max() while I am here.

13 years agoProbe P-state invariant TSC from rightful place.
jkim [Tue, 7 Dec 2010 22:12:02 +0000 (22:12 +0000)]
Probe P-state invariant TSC from rightful place.

13 years agoDon't warn if a partition appears not to be aligned on a track boundary.
brucec [Tue, 7 Dec 2010 20:46:11 +0000 (20:46 +0000)]
Don't warn if a partition appears not to be aligned on a track boundary.
Modern disks use LBA and create a fake CHS geometry that doesn't have any
relation to the on-disk layout of data.

13 years agoAdds IFF_CANTCONFIG to IFF_CANTCHANGE that it shouldn't happen through
weongyo [Tue, 7 Dec 2010 20:31:04 +0000 (20:31 +0000)]
Adds IFF_CANTCONFIG to IFF_CANTCHANGE that it shouldn't happen through
ioctl(2).

13 years agoIntroduces IFF_CANTCONFIG interface flag to point that the interface
weongyo [Tue, 7 Dec 2010 20:23:47 +0000 (20:23 +0000)]
Introduces IFF_CANTCONFIG interface flag to point that the interface
isn't configurable in a meaningful way.  This is for ifconfig(8) or
other tools not to change code whenever IFT_USB-like interfaces are
registered at the interface list.

Reviewed by: brooks
No objections: gavin, jkim

13 years agoAdd a comment to clarify that some BIOSes may clear the hw watchdog
emaste [Tue, 7 Dec 2010 19:18:00 +0000 (19:18 +0000)]
Add a comment to clarify that some BIOSes may clear the hw watchdog
indicator bit, preventing us from reporting in that case.

X-MFC-with: r215868

13 years agoUse proper resource ID's for HPET IRQ resources. This mostly consists of
jhb [Tue, 7 Dec 2010 18:49:11 +0000 (18:49 +0000)]
Use proper resource ID's for HPET IRQ resources.  This mostly consists of
looking to see if there is an existing IRQ resource for a given IRQ
provided by the BIOS and using that RID if so.  Otherwise, allocate a new
RID for the new IRQ.

Reviewed by: mav (a while ago)

13 years agoDon't write data into an empty "file."
kientzle [Tue, 7 Dec 2010 16:48:01 +0000 (16:48 +0000)]
Don't write data into an empty "file."

In particular, this check avoids a warning when
extracting directory entries from certain GNU tar
archives that store directory contents.

MFC after: 3 days

13 years agoUse a "push" strategy to get data through libz, rather than a "pull" strategy.
phk [Tue, 7 Dec 2010 16:30:52 +0000 (16:30 +0000)]
Use a "push" strategy to get data through libz, rather than a "pull" strategy.

13 years agoUndo r216230: the interaction between saved ashift in metadata and
ivoras [Tue, 7 Dec 2010 15:24:08 +0000 (15:24 +0000)]
Undo r216230: the interaction between saved ashift in metadata and
detected ashift does not support this. With this change, pools
created while stripesize=512 could not be imported when stripesize
becomes larger (on the same drive).

Noticed by: pjd

13 years agoUpdate some comments related to use of amd64 full context switch.
kib [Tue, 7 Dec 2010 12:44:33 +0000 (12:44 +0000)]
Update some comments related to use of amd64 full context switch.
In exec_linux_setregs(), use locally cached pointer to pcb to set
pcb_full_iret.
In set_regs(), note that full return is needed when code that sets
segment registers is enabled.

MFC after: 1 week

13 years agoopensolaris cyclic: fix deadlock and make a little bit closer to upstream
avg [Tue, 7 Dec 2010 12:25:26 +0000 (12:25 +0000)]
opensolaris cyclic: fix deadlock and make a little bit closer to upstream

The dealock was caused in the following way:
- thread T1 on CPU C1 holds a spin mutex, IPIs CPU C2 and waits for the
  IPI to be handled
- C2 executes timer interrupt filter, thus has interrupts disabled, and
  gets blocked on the spin mutex held by T1
The problem seems to have been introduced by simplifications made to
OpenSolaris code during porting.
The problem is fixed by reorganizing the code to more closely resemble
the upstream version.  Interrupt filter (cyclic_fire) now doesn't
acquire any locks, all per-CPU data accesses are performed on a
target CPU with preemption and interrupts disabled thus precluding
concurrent access to the data.
cyp_mtx spin mutex is used to disable preemtion and interrupts; it's not
used for classical mutual exclusion, because xcall already serializes
calls to a CPU.  It's an emulation of OpenSolaris
cyb_set_level(CY_HIGH_LEVEL) call, the spin mutexes could probably be
reduced to just a spinlock_enter()/_exit() pair.

Diff with upstream version is now reduced by ~500 lines, however it still
remains quite large - many things that are not needed (at the moment) or
are irrelevant on FreeBSD were simply ripped out during porting.
Examples of such things:
- support for CPU onlining/offlining
- support for suspend/resume
- support for running callouts at soft interrupt levels
- support for callout rebinding from CPU to CPU
- support for CPU partitions

Tested by: Artem Belevich <fbsdlist@src.cx>
MFC after: 3 weeks
X-MFC with: r216252

13 years agoRetire write-only PCB_FULLCTX pcb flag on amd64.
kib [Tue, 7 Dec 2010 12:17:43 +0000 (12:17 +0000)]
Retire write-only PCB_FULLCTX pcb flag on amd64.

Reminded by: Petr Salinger <Petr.Salinger seznam cz>
Tested by: pho
MFC after: 1 week

13 years agoopensolaris cyclic xcall: no need for special handling of curcpu
avg [Tue, 7 Dec 2010 12:04:06 +0000 (12:04 +0000)]
opensolaris cyclic xcall: no need for special handling of curcpu

smp_rendezvous_cpus already properly handles current CPU case
and non-SMP case.

MFC after: 3 weeks

13 years agodtrace_xcall: no need for special handling of curcpu
avg [Tue, 7 Dec 2010 09:19:47 +0000 (09:19 +0000)]
dtrace_xcall: no need for special handling of curcpu

smp_rendezvous_cpus alreadt does the right thing in a very similar
fashion, so the code was kind of duplicating that.

MFC after: 3 weeks

13 years agodtrace_gethrtime_init: pin to master while examining other CPUs
avg [Tue, 7 Dec 2010 09:03:17 +0000 (09:03 +0000)]
dtrace_gethrtime_init: pin to master while examining other CPUs

Also use pc_cpumask to be future-friendly.

Reviewed by: jhb
MFC after: 2 weeks

13 years agoRe-add a status check which sneaked out during r214804.
hselasky [Tue, 7 Dec 2010 08:20:20 +0000 (08:20 +0000)]
Re-add a status check which sneaked out during r214804.
This change can fix some USB error messages showing up
during bootup.

MFC after: 3 days
Approved by: thompsa (mentor)

13 years agoAnother minor nit: Make sure the constant here is a float so the compiler
das [Tue, 7 Dec 2010 03:29:36 +0000 (03:29 +0000)]
Another minor nit: Make sure the constant here is a float so the compiler
doesn't promote the entire expression to double.

13 years agoFix various nits in style and comments that were pointed out by bde.
das [Tue, 7 Dec 2010 02:19:15 +0000 (02:19 +0000)]
Fix various nits in style and comments that were pointed out by bde.
Code changes verified with md5.

13 years agosh: Improve internal-representation-to-text code to avoid binary output.
jilles [Mon, 6 Dec 2010 23:49:27 +0000 (23:49 +0000)]
sh: Improve internal-representation-to-text code to avoid binary output.

The code to translate the internal representation to text did not know about
various additions to the internal representation since the original ash and
therefore wrote binary stuff to the terminal.

The code is used in the jobs command and similar output.

Note that the output is far from complete and mostly serves for recognition
purposes.

13 years agoIgnore any failures with the "local" distribution since it's not present
brucec [Mon, 6 Dec 2010 20:55:14 +0000 (20:55 +0000)]
Ignore any failures with the "local" distribution since it's not present
on release CDs and so will normally fail.
installCommit() returns a DITEM_ value, not a Boolean.
distExtractAll() returns a Boolean, not a DITEM_ value.

Reported by: kensmith
MFC after: 3 days

13 years agoImplement NdisGetRoutineAddress and MmGetSystemRoutineAddress used in
bschmidt [Mon, 6 Dec 2010 20:54:53 +0000 (20:54 +0000)]
Implement NdisGetRoutineAddress and MmGetSystemRoutineAddress used in
newer Ralink drivers.

Submitted by: Paul B Mahol <onemda at gmail.com>

13 years agoSet correct maximum I/O length. We can only handle I/O of up to
cperciva [Mon, 6 Dec 2010 20:40:15 +0000 (20:40 +0000)]
Set correct maximum I/O length.  We can only handle I/O of up to
max_request_segments * PAGE_SIZE if the I/O is page-aligned; the
largest I/O we can guarantee will work is PAGE_SIZE less than that.
This unbreaks 'diskinfo -t'.

13 years agoAdd a KASSERT to make it obvious when fork_norfproc() is to be called,
trasz [Mon, 6 Dec 2010 19:15:38 +0000 (19:15 +0000)]
Add a KASSERT to make it obvious when fork_norfproc() is to be called,
and set *procp to NULL in all cases.  Previously, it was not being set
in the ERESTART case.  This is effectively no-op, since its value is
ignored by callers in the error case.

Reviewed by: kib@

13 years agoDrop advertising clause in manpages. It was done a long time ago
uqs [Mon, 6 Dec 2010 19:12:51 +0000 (19:12 +0000)]
Drop advertising clause in manpages. It was done a long time ago
for the source code.

Discussed with: core

13 years agoFix scanning after loosing a connection. The firmware assumes that as long
bschmidt [Mon, 6 Dec 2010 19:05:44 +0000 (19:05 +0000)]
Fix scanning after loosing a connection. The firmware assumes that as long
as an association ID is set any scan is supposed to be a background scan.
This implies that the firmware will switch back to the associated channel
after a certain threshold, though, we are not notified about that. We
currently catch this case by a timer which will reset the firmware after
a 'scan timeout', though, upper layers are not notified about that and
will simply hang until manual intervention. Fix this by resetting the
firmware's knowledge about any association on RUN -> ASSOC and
!INIT -> SCAN transitions.

Tested by: Zhihao Yuan <lichray at gmail.com>
MFC after: 1 week

13 years agoFixes for monitor mode:
bschmidt [Mon, 6 Dec 2010 18:28:39 +0000 (18:28 +0000)]
Fixes for monitor mode:
- Do not call iwn_calib_reset() for monitor mode. We do not want to query
  information and do runtime calibration while in monitor mode. Poking the
  firmware with adjustments for calibration results in firmware asserts.
  This could happened on RUN -> RUN transition only.
- Adjust blink rate for monitor mode. It's supposed to not freak out and
  turn off after a while.
- While here, remove one useless assignment of calib.state, it gets
  overwritten later in the function.

Submitted by: Brandon Gooch <jamesbrandongooch at gmail.com>
MFC after: 1 week

13 years agoWhen masking direct and processor devices during an inquiry, properly
jhb [Mon, 6 Dec 2010 17:06:21 +0000 (17:06 +0000)]
When masking direct and processor devices during an inquiry, properly
preserve the upper bits of the first data byte.

Reviewed by: scottl
MFC after: 1 week

13 years agoWhen masking direct and processor devices during an inquiry, properly
jhb [Mon, 6 Dec 2010 17:02:56 +0000 (17:02 +0000)]
When masking direct and processor devices during an inquiry, properly
preserve the upper bits of the first data byte.

While here, shorten a few nearby lines.

PR: kern/152768
Reported by: Sascha Wildner  saw of online.de
Reviewed by: scottl
MFC after: 1 week

13 years agoFix style bug introduced by previous commit.
trasz [Mon, 6 Dec 2010 16:45:36 +0000 (16:45 +0000)]
Fix style bug introduced by previous commit.

13 years agoImprove readability by factoring out the !RFPROC case. While here,
trasz [Mon, 6 Dec 2010 16:39:18 +0000 (16:39 +0000)]
Improve readability by factoring out the !RFPROC case.  While here,
turn K&R function definitions into ANSI.  No functional changes.

Reviewed by: kib@

13 years agoAdd a manpage for SYSINIT() and SYSUNINIT().
jhb [Mon, 6 Dec 2010 15:19:03 +0000 (15:19 +0000)]
Add a manpage for SYSINIT() and SYSUNINIT().

PR: docs/132884
Submitted by: pluknet, hmp

13 years agoDo not leak %rdx value in the previous image to the new image after
kib [Mon, 6 Dec 2010 15:15:27 +0000 (15:15 +0000)]
Do not leak %rdx value in the previous image to the new image after
execve(2). Note that ia32 binaries already handle this properly,
since ia32_setregs() resets td_retval[1], but not exec_setregs().

We still do not conform to the amd64 ABI specification, since %rsp
on the image startup is not aligned to 16 bytes.

PR: amd64/124134
Discussed with: Petr Salinger <Petr.Salinger seznam cz>
(who convinced me that there is indeed several bugs)
MFC after: 1 week

13 years agoUse GEOM stripesize field when calculating ashift. This will enable correct
ivoras [Mon, 6 Dec 2010 12:18:02 +0000 (12:18 +0000)]
Use GEOM stripesize field when calculating ashift. This will enable correct
alignment on drives with large sector sizes (e.g. 4 KiB) but the
implementation might need to be revisited if devices with large stripesizes
appear (e.g. if RAID controllers or flash drives start using the field),
probably by introducing a physsectorsize field in GEOM providers.

Discussed with: mav, mostly silence on freebsd-geom@ and freebsd-fs@

13 years agoRevert r209469: it causes the rest of the function to be bypassed.
brucec [Mon, 6 Dec 2010 11:37:24 +0000 (11:37 +0000)]
Revert r209469: it causes the rest of the function to be bypassed.

Reported by: ae

13 years agoFix double ;;
kevlo [Mon, 6 Dec 2010 10:24:06 +0000 (10:24 +0000)]
Fix double ;;

13 years agoCatch up with kernel using time_uptime to drive ARP timeouts.
glebius [Mon, 6 Dec 2010 09:39:36 +0000 (09:39 +0000)]
Catch up with kernel using time_uptime to drive ARP timeouts.

Noticed by: jilles

13 years agoCatch up with kernel using time_uptime to drive ARP timeouts.
glebius [Mon, 6 Dec 2010 09:37:56 +0000 (09:37 +0000)]
Catch up with kernel using time_uptime to drive ARP timeouts.

Noticed by: jilles

13 years agoDon't write the terminating NUL past end of buffer.
jh [Mon, 6 Dec 2010 09:18:11 +0000 (09:18 +0000)]
Don't write the terminating NUL past end of buffer.

PR: bin/152345
Submitted by: Mateusz Guzik

13 years agoWork around gcc constant folding bugs.
das [Mon, 6 Dec 2010 00:19:56 +0000 (00:19 +0000)]
Work around gcc constant folding bugs.

13 years agosignbit() returns nonzero for negative arguments, but we shouldn't assume
das [Mon, 6 Dec 2010 00:02:49 +0000 (00:02 +0000)]
signbit() returns nonzero for negative arguments, but we shouldn't assume
that it always returns the same nonzero value.

13 years agoFix some warnings.
das [Sun, 5 Dec 2010 23:50:49 +0000 (23:50 +0000)]
Fix some warnings.

13 years agosh: POSIX says there should not be a space between Done and (exitstatus).
jilles [Sun, 5 Dec 2010 22:56:46 +0000 (22:56 +0000)]
sh: POSIX says there should not be a space between Done and (exitstatus).

(On the other hand, (core dumped) does need a space and so does [1] +.)

13 years agoBring in the change from NetBSD 1.28:
dougb [Sun, 5 Dec 2010 22:47:08 +0000 (22:47 +0000)]
Bring in the change from NetBSD 1.28:

"\\ -> \e"

Obtained from: joerg@NetBSD.org

Bump .Dd because we're now up to date with the latest NetBSD version

13 years agoBring in the following changes from NetBSD:
dougb [Sun, 5 Dec 2010 22:41:58 +0000 (22:41 +0000)]
Bring in the following changes from NetBSD:

1.21
"Document the flags displayed by the default format, and mention their short
names. From espie@openbsd via jmc@openbsd."

1.24
"Fix three variable names.
From Todd T. Fries via Jason McIntyre."

Obtained from: wiz@NetBSD.org (previous 2)

1.25
"Be consistent: document the birthtime field of struct stat for
the "B" field specifier."

Obtained from: reed@NetBSD.org

1.26
"Drop trailing space."

Obtained from: wiz@NetBSD.org

1.27
"Since we have st_birthtime in struct stat, it is in default display."

Obtained from: enami@NetBSD.org

Purposely skipping the following revisions:
1.22 NetBSD-specific change
1.23 Removal of license clauses 3 and 4, already handled by imp
in our r203971

13 years agosh: Improve jobs output of pipelines.
jilles [Sun, 5 Dec 2010 22:37:01 +0000 (22:37 +0000)]
sh: Improve jobs output of pipelines.

If describing the status of a pipeline, write all elements of the pipeline
and show the status of the last process (which would also end up in $?).
Only write one report per job, not one for every process that exits.

To keep some earlier behaviour, if any process started by the shell in a
foreground job terminates because of a signal, write a message about the
signal (at most one message per job, however).

Also, do not write messages about signals in the wait builtin in
non-interactive shells. Only true foreground jobs now write such messages
(for example, "Terminated").

13 years agoBring in the change from NetBSD 1.20:
dougb [Sun, 5 Dec 2010 22:24:34 +0000 (22:24 +0000)]
Bring in the change from NetBSD 1.20:

"Make sentence easier to parse. From jsing@openbsd via jmc@openbsd."

Obtained from: wiz@NetBSD.org

13 years agoBring in the changes from NetBSD 1.16 that we did not already have.
dougb [Sun, 5 Dec 2010 22:20:08 +0000 (22:20 +0000)]
Bring in the changes from NetBSD 1.16 that we did not already have.

"Some fixes from jmc@openbsd."

Obtained from: wiz@NetBSD.org

13 years agoAdd regression tests for logarithmic functions in the math library.
das [Sun, 5 Dec 2010 22:18:35 +0000 (22:18 +0000)]
Add regression tests for logarithmic functions in the math library.

13 years agoBring in the changes from NetBSD 1.13 that we did not already have, with
dougb [Sun, 5 Dec 2010 22:16:51 +0000 (22:16 +0000)]
Bring in the changes from NetBSD 1.13 that we did not already have, with
some differences.

"Sort options. Use more mdoc macros. Some nit fixes. Bump date."

Obtained from: wiz@NetBSD.org

13 years agoBump __FreeBSD_version for the addition of log2(). This is mainly for the
das [Sun, 5 Dec 2010 22:12:07 +0000 (22:12 +0000)]
Bump __FreeBSD_version for the addition of log2().  This is mainly for the
benefit of ports such as opencity and inkscape that have workarounds for
the lack of a log2() in the base system.

13 years agoAdd log2() and log2f().
das [Sun, 5 Dec 2010 22:11:22 +0000 (22:11 +0000)]
Add log2() and log2f().

13 years agoAdd a "kernel" log function, based on e_log.c, which is useful for
das [Sun, 5 Dec 2010 22:11:03 +0000 (22:11 +0000)]
Add a "kernel" log function, based on e_log.c, which is useful for
implementing accurate logarithms in different bases.  This is based
on an approach bde coded up years ago.

This function should always be inlined; it will be used in only a few
places, and rudimentary tests show a 40% performance improvement in
implementations of log2() and log10() on amd64.

The kernel takes a reduced argument x and returns the same polynomial
approximation as e_log.c, but omitting the low-order term. The low-order
term is much larger than the rest of the approximation, so the caller of
the kernel function can scale it to the appropriate base in extra precision
and obtain a much more accurate answer than by using log(x)/log(b).

13 years agoBring in the change from NetBSD 1.12:
dougb [Sun, 5 Dec 2010 22:01:01 +0000 (22:01 +0000)]
Bring in the change from NetBSD 1.12:

"document default format."

Obtained from: yamt@NetBSD.org

13 years agosh: Avoid marking a job as done before it is fully created.
jilles [Sun, 5 Dec 2010 21:53:29 +0000 (21:53 +0000)]
sh: Avoid marking a job as done before it is fully created.

In r208489, I added code to reap zombies when forking new processes, to
limit the amount of zombies. However, this can lead to marking a job as done
or stopped if it consists of multiple processes and the first process ends
very quickly. Fix this by only checking for zombies before forking the first
process of a job and not marking any jobs without processes as done or
stopped.

13 years agoBring in the following changes from NetBSD. See the discussion at:
dougb [Sun, 5 Dec 2010 21:53:12 +0000 (21:53 +0000)]
Bring in the following changes from NetBSD. See the discussion at:
http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=44128

1.29
"Don't printf time_t with %d; fixes PR 44128 from yamt. With this change it
successfully prints mtimes after 2038."

1.30
"Improve previous with comments."

Obtained from: dholland@NetBSD.org (both)

13 years agoFix an "unused variable" error that gets us all the way to WARNS=6
dougb [Sun, 5 Dec 2010 21:33:05 +0000 (21:33 +0000)]
Fix an "unused variable" error that gets us all the way to WARNS=6

13 years agoBring in the update from NetBSD 1.28:
dougb [Sun, 5 Dec 2010 21:29:20 +0000 (21:29 +0000)]
Bring in the update from NetBSD 1.28:

"Fix WARNS=4 issues (-Wcast-qual -Wsign-compare)"

Because of code differences I had to hand-apply parts of the patch,
so responsibility for errors goes to me.

Obtained from: lukem@NetBSD.org

13 years agoBring in the update from NetBSD 1.19, the documentation of readlink -f
dougb [Sun, 5 Dec 2010 21:17:02 +0000 (21:17 +0000)]
Bring in the update from NetBSD 1.19, the documentation of readlink -f

"PR/34662: martijnb at atlas dot ipv6 dot stack dot nl: readlink doesn't
grok -f, and there's no alternative (+fix)

Patch applied with minor tweak (%y -> %R, as it was already taken) plus
some nits from myself. Thanks!"

Obtained from: elad@NetBSD.org

13 years agoBring in a new feature, adding a -f option to readlink to print the path
dougb [Sun, 5 Dec 2010 21:11:45 +0000 (21:11 +0000)]
Bring in a new feature, adding a -f option to readlink to print the path
of the target, similar to realpath(1). See the discussion at:
http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=34662

This brings in the following changes:
1.24
"PR/34662: martijnb at atlas dot ipv6 dot stack dot nl: readlink doesn't
grok -f, and there's no alternative (+fix)

Patch applied with minor tweak (%y -> %R, as it was already taken) plus
some nits from myself. Thanks!"

Obtained from: elad@NetBSD.org

1.25
"Fix a segfault when doing 'stat -f %R' on the stdin file handle, instead
fake the filename '(stdin)' like the %N format."

Obtained from: mlelstv@NetBSD.org

1.27
"The ofmt variable is actually a bit mask (not the character that was
in the format string) so that we can "or" it with the bits in the
formats variable.  This fixes the missing " -> " in front of the real
path (when you use %SR).

Also, the ?: needs another space."

Obtained from: atatat@NetBSD.org

I am purposely omitting the following changes:
1.23 A humanize_number(3) clone that should better be implemented by
actually using humanize_number(3)
1.26 This is the removal of license clause 3 and 4, already handled
by imp in r203971

13 years agoBring in the change from NetBSD 1.22:
dougb [Sun, 5 Dec 2010 20:47:53 +0000 (20:47 +0000)]
Bring in the change from NetBSD 1.22:

"Fix a trivial truncation case, and eliminate a corner case that might
print a nul character."

I am purposely bypassing the following versions:
1.19 A build infrastructure change that does not apply to us
1.20 A feature I am not interested in, but don't object if someone else
wants to pick it up
1.21 A build infrastructure change that does not apply to us

Obtained from: atatat@NetBSD.org

13 years agosh: jobs -p: Do not ask the kernel for the pgid.
jilles [Sun, 5 Dec 2010 16:09:03 +0000 (16:09 +0000)]
sh: jobs -p: Do not ask the kernel for the pgid.

The getpgid() call will fail if the first process in the job has already
terminated, resulting in output of "-1".

The pgid of a job is always the pid of the first process in the job and
other code already relies on this.

13 years agoUse proper bounds checking on VPA.
ed [Sun, 5 Dec 2010 10:15:23 +0000 (10:15 +0000)]
Use proper bounds checking on VPA.

We must check against tp->t_cursor.tp_row, not row, to figure out
whether we must clamp the cursor position.

Submitted by: luigi
MFC after: 3 weeks

13 years agoAdd my own documentation for the change in our r216196, aka NetBSD's 1.18
dougb [Sun, 5 Dec 2010 09:35:07 +0000 (09:35 +0000)]
Add my own documentation for the change in our r216196, aka NetBSD's 1.18
For -L if stat(2) fails, fall back to lstat(2).

.Dd purposely not bumped because more changes are coming.

13 years agoBring in the change from NetBSD 1.18:
dougb [Sun, 5 Dec 2010 09:33:04 +0000 (09:33 +0000)]
Bring in the change from NetBSD 1.18:

"If using stat (the -L flag) and it fails, fall back to lstat().  It
may be the case that we're examining a broken symlink, and anything is
better than nothing."

The changes in 1.14 through 1.17 were not relevant to us.

Obtained from: atatat@NetBSD.org

13 years agoFor 6000 series and newer devices the DC calibration results are no
bschmidt [Sun, 5 Dec 2010 09:00:32 +0000 (09:00 +0000)]
For 6000 series and newer devices the DC calibration results are no
longer requested of the boot firmware. Instead of sending those results
to the runtime firmware the firmware is told to do the DC calibration
itself.

MFC after: 1 week

13 years agoMFamd64 r204214: Enforce stronger alignment semantics (require that the
cperciva [Sun, 5 Dec 2010 03:20:55 +0000 (03:20 +0000)]
MFamd64 r204214: Enforce stronger alignment semantics (require that the
end of segments be aligned, not just the start of segments) in order to
allow Xen's blkfront driver to operate correctly.

PR: kern/152818
MFC after: 3 days

13 years agoSwitch which software-reserved bit is used to designate a locked PTE
nwhitehorn [Sun, 5 Dec 2010 01:17:53 +0000 (01:17 +0000)]
Switch which software-reserved bit is used to designate a locked PTE
to correspond to the definition used by the PAPR spec so that its PTE
insertion algorithm will properly respect it.

13 years agoUse correct field to track statistics counting error as bad header length.
bz [Sun, 5 Dec 2010 01:09:48 +0000 (01:09 +0000)]
Use correct field to track statistics counting error as bad header length.
This assimilates the code to what ip_input has been doing since r1.1 in
this case.

Submitted by: Rozhuk Ivan (rozhuk.im gmail.com)
MFC after: 4 days