]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/log
FreeBSD/stable/9.git
11 years agoPull in OpenSSH 6.1 from head.
des [Thu, 28 Feb 2013 18:43:50 +0000 (18:43 +0000)]
Pull in OpenSSH 6.1 from head.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247485 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 241730: Correct the order of the MFU and MRU labels.
jhb [Thu, 28 Feb 2013 18:24:07 +0000 (18:24 +0000)]
MFC 241730: Correct the order of the MFU and MRU labels.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247483 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 241027:
jhb [Thu, 28 Feb 2013 18:22:41 +0000 (18:22 +0000)]
MFC 241027:
- Re-shuffle the <machine/pc/bios.h> headers to move all kernel-specific
  bits under #ifdef _KERNEL but leave definitions for various structures
  defined by standards ($PIR table, SMAP entries, etc.) available to
  userland.
- Consolidate duplicate SMBIOS table structure definitions in ipmi(4)
  and smbios(4) in <machine/pc/bios.h> and make them available to
  userland.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247481 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 241198:
jhb [Thu, 28 Feb 2013 18:12:56 +0000 (18:12 +0000)]
MFC 241198:
Display the matrix of inter-domain distances in the SLIT table.  This is
used to complement the SRAT table on NUMA machines.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247480 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 240968:
jhb [Thu, 28 Feb 2013 18:10:20 +0000 (18:10 +0000)]
MFC 240968:
Merge similar fixes from 223198 from igb to ixgbe:
- Use a dedicated task to handle deferred transmits from the if_transmit
  method instead of reusing the existing per-queue interrupt task.
  Reusing the per-queue interrupt task could result in both an interrupt
  thread and the taskqueue thread trying to handle received packets on a
  single queue resulting in out-of-order packet processing and lock
  contention.
- Don't define ixgbe_start() at all when if_transmit is used.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247478 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246789:
hselasky [Thu, 28 Feb 2013 16:56:08 +0000 (16:56 +0000)]
MFC r246789:
Add USB API to read power draw on USB devices.
Update usbconfig to print power draw on USB devices.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247475 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246753:
hselasky [Thu, 28 Feb 2013 16:43:41 +0000 (16:43 +0000)]
MFC r246753:
Add new USB ID to FTDI driver.

PR: kern/175893

git-svn-id: svn://svn.freebsd.org/base/stable/9@247474 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246944:
hselasky [Thu, 28 Feb 2013 16:39:44 +0000 (16:39 +0000)]
MFC r246944:
Fix bad EEPROM parsing code.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247473 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r247133 and associated fixes (r247151, r247152):
gallatin [Thu, 28 Feb 2013 16:38:28 +0000 (16:38 +0000)]
MFC r247133 and associated fixes (r247151, r247152):

r247133:
  Improve mxge's receive performance for IPv6:

  - Add support for IPv6 rx csum offload
  - Finally switch mxge from using its own driver lro, to
   using tcp_lro

r247151:
  Fix build.

r247152:
  Try harder to make mxge safe for all combinations of INET and INET6

  - Re-fix build by restoring local removed in r247151, but protected
    by #if defined(INET) || defined(INET6) so that the compile
    succeeds in the !(INET||INET6) case.

  - Protect call to in_pseudo() with an #ifdef INET, to allow
    a kernel to link with mxge when INET is not compiled in.

  - Also remove an errant (improperly commented) obsolete debugging printf

git-svn-id: svn://svn.freebsd.org/base/stable/9@247472 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r247104:
gallatin [Thu, 28 Feb 2013 16:32:36 +0000 (16:32 +0000)]
MFC r247104:
  Fix tcp_lro_rx_ipv4() for drivers that do not set CSUM_IP_CHECKED.
  Specifcially, in_cksum_hdr() returns 0 (not 0xffff) when the IPv4
  checksum is correct. Without this fix, the tcp_lro code will reject
  good IPv4 traffic from drivers that do not implement IPv4 header
  harder csum offload.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247470 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246809:
zeising [Thu, 28 Feb 2013 15:17:24 +0000 (15:17 +0000)]
MFC r246809:

Change examples to be consistent with what style(9) says.

Approved by: joel (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/9@247465 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFH (r240109): add a configtest command
des [Thu, 28 Feb 2013 12:03:17 +0000 (12:03 +0000)]
MFH (r240109): add a configtest command

git-svn-id: svn://svn.freebsd.org/base/stable/9@247461 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoWhen getting the MIB, remove largest suffix instead of smallest suffix of
delphij [Thu, 28 Feb 2013 08:06:43 +0000 (08:06 +0000)]
When getting the MIB, remove largest suffix instead of smallest suffix of
=.  This makes the following syntax work:

dev.hdaa.4.nid25_config=as=1,seq=15

This is a direct commit to RELENG_9 as this file have been replaced in
-HEAD.

Submitted by: Andreas Nilsson <andrnils gmail com>

git-svn-id: svn://svn.freebsd.org/base/stable/9@247449 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r245243, r245274, r245276, r245434, r245441, r245448, r245467,
np [Thu, 28 Feb 2013 00:44:54 +0000 (00:44 +0000)]
MFC r245243, r245274, r245276, r245434, r245441, r245448, r245467,
r245468, r245517, r245518, r245520, r245567, r245933, r245935, r245936,
r245937, r246093, r246385, r246575, r247062, r247122, r247289, r247291,
r247347, r247355, and r241733.

Note that TCP_OFFLOAD is not enabled in 9 yet and so some of these MFCs
don't really affect functionality.  But they do help future MFCs
(related to TCP_OFFLOAD or not) by minimizing diffs with the driver in
head.

r245243:
cxgbe(4): updates to the configuration file that controls how hardware
resources are partitioned.

- Reduce the number of virtual interfaces reserved for PF4.  This leaves
  spare room in the source MAC table and allows the driver to setup
  filters that rewrite the source MAC address.

- Reduce the number of filters and use the freed up space for the CLIP
  (Compressed Local IPv6 addresses) table.  This is a prerequisite for
  IPv6 TOE support which will follow separately in a series of commits.

r245274:
cxgbe(4): Add functions to help synchronize "slow" operations (those not
on the fast data path) and use them instead of frobbing the adapter lock
and busy flag directly.

Other changes made while reworking all slow operations:
- Wait for the reply to a filter request (add/delete).  This guarantees
  that the operation is complete by the time the ioctl returns.
- Tidy up the tid_info structure.
- Do not allow the tx queue size to be set to something that's not a
  power of 2.

r245276:
Overhaul the stid allocator so that it can be used for IPv6 servers
too.  The entry for an IPv6 server in the TCAM takes up the equivalent
of two ordinary stids and must be properly aligned too.

r245434:
cxgbe(4): Updates to the hardware L2 table management code.

- Add full support for IPv6 addresses.

- Read the size of the L2 table during attach.  Do not assume that PCIe
  physical function 4 of the card has all of the table to itself.

- Use FNV instead of Jenkins to hash L3 addresses and drop the private
  copy of jhash.h from the driver.

r245441:
cxgbe/tom: Miscellaneous updates for TOE+IPv6 support (more to follow).

- Teach find_best_mtu_idx() to deal with IPv6 endpoints.

- Install correct protosw in offloaded TCP/IPv6 sockets when DDP is
  enabled.

- Move set_tcp_ddp_ulp_mode to t4_tom.c so that t4_tom.h can be included
  without having to drag in t4_msg.h too.  This was bothering the iWARP
  driver for some reason.

r245448:
cxgbe/tom: Basic CLIP table management.

This is the Compressed Local IPv6 table on the chip.  To save space, the
chip uses an index into this table instead of a full IPv6 address in
some of its hardware data structures.

For now the driver fills this table with all the local IPv6 addresses
that it sees at the time the table is initialized.  I'll improve this
later so that the table is updated whenever new IPv6 addresses are
configured or existing ones deleted.

r245467:
cxgbe/tom: Add support for fully offloaded TCP/IPv6 connections (active open).

r245468:
cxgbe/tom: Add support for fully offloaded TCP/IPv6 connections (passive open).

r245517:
cxgbe: Fix the for_each_foo macros -- the last argument should not share
its name with any member of struct sge.

r245518:
cxgbe:  Do a more thorough job in the CLEAR_STATS ioctl.

r245520:
Allow "ivlan" (inner VLAN) to be used as an alias for "vlan" when
specifying match criteria.  "vlan" continues to be valid here, and it
continues to be valid when deleting, rewriting, inserting, or stacking
an 802.1q tag to a matching packet.

r245567:
cxgbe: Make the for_each macros safer to use by turning them
into a single statement each.

r245933:
cxgbe/tom: List IFCAP_TOE6 as supported now that all the required pieces
are in place.  You still have to enable it explicitly, after loading the
t4_tom KLD.

r245935:
Add a couple of missing error codes.  Treat CPL_ERR_KEEPALV_NEG_ADVICE as
negative advice and not a fatal error.

r245936:
Force the 404-BT card (4 x 1G) to use the "uwire" configuration file.

r245937:
Install an extra hold on the newly allocated synq entry so that it
cannot be freed while do_pass_accept_req is running.  This closes a race
where do_pass_establish on another CPU (the driver chose a different
queue for the new tid) expands the synq entry into a full PCB and then
releases the only hold on it, all while do_pass_accept_req is still
running.

r246093:
Provide a statistic to track the number of drops in each of the port's
txq's buf_ring.  The aggregate for all the queues of a port is already
provided in ifnet->if_snd.ifq_drops.

r246385:
Busy-wait when cold.

r246575:
Do not hold locks around hardware context reads.

r247062:
cxgbe(4): Assume that CSUM_TSO in the transmit path implies CSUM_IP and
CSUM_TCP too.  They are all set explicitly by the kernel usually.

r247122:
cxgbe(4): Add sysctls to extract debug information from the chip:

dev.t4nex.X.misc.cim_la         logic analyzer dump
dev.t4nex.X.misc.cim_qcfg       queue configuration
dev.t4nex.X.misc.cim_ibq_xxx    inbound queues
dev.t4nex.X.misc.cim_obq_xxx    outbound queues

r247289:
cxgbe(4): Update firmware to 1.8.4.0.

r247291:
cxgbe(4): Ask the card's firmware to pad up tiny CPLs by encapsulating
them in a firmware message if it is able to do so.  This works out
better for one of the FIFOs in the chip.

r247347:
cxgbe(4): Consider all the API versions of the interfaces exported by
the firmware (instead of just the main firmware version) when evaluating
firmware compatibility.  Document the new "hw.cxgbe.fw_install" knob
being introduced here.

This should fix kern/173584 too.  Setting hw.cxgbe.fw_install=2 will
mostly do what was requested in the PR but it's a bit more intelligent
in that it won't reinstall the same firmware repeatedly if the knob is
left set.

r247355:
cxgbe(4): Report unusual out of band errors from the firmware.

r241733 (by ed@):
Prefer __containerof() over __member2struct().

The former works better with qualifiers, but also properly type checks
the input pointer.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247434 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 241130:
jhb [Wed, 27 Feb 2013 22:08:18 +0000 (22:08 +0000)]
MFC 241130:
Rename the module for 'device enc' to "if_enc" to avoid conflicting with
the CAM "enc" peripheral (part of ses(4)).  Previously the two modules
used the same name, so only one was included in a linked kernel causing
enc0 to not be created if you added IPSEC to GENERIC.  The new module
name follows the pattern of other network interfaces (e.g. "if_loop").

git-svn-id: svn://svn.freebsd.org/base/stable/9@247424 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 240921:
jhb [Wed, 27 Feb 2013 22:02:40 +0000 (22:02 +0000)]
MFC 240921:
Add optional entropy harvesting for software interrupts in swi_sched()
as controlled by kern.random.sys.harvest.swi.  SWI harvesting feeds into
the interrupt FIFO and each event is estimated as providing a single bit of
entropy.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247423 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 240692,241228:
jhb [Wed, 27 Feb 2013 21:03:09 +0000 (21:03 +0000)]
MFC 240692,241228:
Adjust the ioctl workaround from r234501:
- Ensure the native ioctl path always allocates a 4kb buffer if a request
  uses a buffer size of 0.
- Rounding all small requests up to 32k swamped the controller causing
  firmware hangs.  Instead, round requests smaller than 64k up to the next
  power of 2 as a general rule.  To handle the one known special case of a
  command that accepts a 12k buffer returning a 24k-ish reply, round
  requests between 8k and 16k up to 32k rather than 16k.  The result is
  that commands less than 8k should now be rounded up to a smaller size
  (either 4k or 8k) rather than 32k.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247420 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 240474:
jhb [Wed, 27 Feb 2013 19:38:25 +0000 (19:38 +0000)]
MFC 240474:
- Denote PCI-e endpoints that support FLR.
- Make parsing of PCI-e extended capabilities assume that future version
  numbers are backwards compatible.
- Add new AER error descriptions.
- Add descriptions for more PCI-e extended capabilities.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247408 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246631,246651,246666,246675,246678,246688:
mm [Wed, 27 Feb 2013 19:20:50 +0000 (19:20 +0000)]
MFC r246631,246651,246666,246675,246678,246688:
Merge various ZFS bugfixes

MFC r246631:
Import vendor bugfixes

Illumos ZFS issues:
  3422 zpool create/syseventd race yield non-importable pool
  3425 first write to a new zvol can fail with EFBIG

MFC r246651:
Import minor type change in refcount.h header from vendor (illumos).

MFC r246666:
Import vendor ZFS bugfix fixing a problem in arc_read().

Illumos ZFS issues:
  3498 panic in arc_read(): !refcount_is_zero(&pbuf->b_hdr->b_refcnt)

MFC r246675:
Add tunable to allow block allocation on degraded vdevs.

Illumos ZFS issues:
  3507 Tunable to allow block allocation even on degraded vdevs

MFC r246678:
Import vendor bugfixes regarding SA rounding, header size and layout.
This was already partially fixed by avg.

Illumos ZFS issues:
  3512 rounding discrepancy in sa_find_sizes()
  3513 mismatch between SA header size and layout

MFC r246688 [1]:
Merge zfs_ioctl.c code that should have been merged together with ZFS v28.
Fixes several problems if working with read-only pools.

Changed code originaly introduced in onnv-gate 13061:bda0decf867b
Contains changes up to illumos-gate 13700:4bc0783f6064

PR: kern/175897 [1]
Suggested by: avg [1]

git-svn-id: svn://svn.freebsd.org/base/stable/9@247406 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r247034:
pluknet [Wed, 27 Feb 2013 08:55:26 +0000 (08:55 +0000)]
MFC r247034:
  Check if the -sec option is given without an argument.

PR: bin/170413
Submitted by: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>

git-svn-id: svn://svn.freebsd.org/base/stable/9@247394 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoFix the build.
gallatin [Wed, 27 Feb 2013 00:14:12 +0000 (00:14 +0000)]
Fix the build.

Back out mis-guided compat shim that should not have been MFC'ed

git-svn-id: svn://svn.freebsd.org/base/stable/9@247365 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 240473:
jhb [Tue, 26 Feb 2013 22:07:59 +0000 (22:07 +0000)]
MFC 240473:
Add some registers defined in PCI 3.0 including new AER bits.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247357 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 240467:
jhb [Tue, 26 Feb 2013 21:04:58 +0000 (21:04 +0000)]
MFC 240467:
Ignore stop and continue signals sent to an exiting process.  Stop signals
set p_xstat to the signal that triggered the stop, but p_xstat is also
used to hold the exit status of an exiting process.  Without this change,
a stop signal that arrived after a process was marked P_WEXIT but before
it was marked a zombie would overwrite the exit status with the stop signal
number.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247349 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 239512:
jhb [Tue, 26 Feb 2013 20:19:19 +0000 (20:19 +0000)]
MFC 239512:
Add a BUS_CHILD_DELETED() method that a bus can hook to allow it to cleanup
any bus-specific state (such as ivars) when a child device is deleted.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247344 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 239356,239564:
jhb [Tue, 26 Feb 2013 19:14:05 +0000 (19:14 +0000)]
MFC 239356,239564:
Teach dhclient to track changes in link state and to enter the reboot
state when the link on an interface goes up causing dhclient to attempt
to renew its existing lease.

PR: bin/166656

git-svn-id: svn://svn.freebsd.org/base/stable/9@247335 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246880:
dim [Tue, 26 Feb 2013 18:31:03 +0000 (18:31 +0000)]
MFC r246880:

Since clang 3.2 now has an option to suppress warnings about implicitly
promoted K&R parameters, remove the workarounds added for sendmail
components in r228558.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247333 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 239244,240137,240209:
jhb [Tue, 26 Feb 2013 18:19:51 +0000 (18:19 +0000)]
MFC 239244,240137,240209:
Add locking to the twe(4) driver and make it MPSAFE.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247331 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC 234927:
jhb [Tue, 26 Feb 2013 16:55:44 +0000 (16:55 +0000)]
MFC 234927:
- Don't log messages saying that accounting is being disabled and enabled
  if the accounting log file is atomically replaced with a new file
  (such as during log rotation).
- Simplify accounting log rotation a bit.  There is no need to re-run
  accton(8) after renaming the new log file to it's real name.

PR: kern/167321

git-svn-id: svn://svn.freebsd.org/base/stable/9@247321 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r247011:
gallatin [Tue, 26 Feb 2013 15:51:46 +0000 (15:51 +0000)]
MFC r247011:

Add support to mxge for IPv6 TX csum offload & IPv6 TSO.

Sponsored by: Myricom, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247320 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246586,246587,246619,246624,246768,246808:
delphij [Tue, 26 Feb 2013 05:58:05 +0000 (05:58 +0000)]
MFC r246586,246587,246619,246624,246768,246808:

LZ4 compression support in ZFS.

(Note: sys/conf/files change omitted from this changeset).

git-svn-id: svn://svn.freebsd.org/base/stable/9@247309 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoComplete MFC of r245362
bryanv [Tue, 26 Feb 2013 05:27:02 +0000 (05:27 +0000)]
Complete MFC of r245362

    Add VirtIO to i386 and amd64 GENERIC

This completes the MFC of r245362 not was not done
in r246885. 9-STABLE VirtIO should now match HEAD.

Approved by: grehan

git-svn-id: svn://svn.freebsd.org/base/stable/9@247306 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC part of r241470 missed in r246582
bryanv [Tue, 26 Feb 2013 05:12:25 +0000 (05:12 +0000)]
MFC part of r241470 missed in r246582

Add the VirtIO SCSI Makefile. I was in one directory too
deep when I did the previous commit.

Approved by: grehan

git-svn-id: svn://svn.freebsd.org/base/stable/9@247305 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246882:
marcel [Tue, 26 Feb 2013 03:46:35 +0000 (03:46 +0000)]
MFC r246882:
Return EFAULT when the address is not a kernel virtual address.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247303 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r239379:
marcel [Tue, 26 Feb 2013 03:39:15 +0000 (03:39 +0000)]
MFC r239379:
Use pmap_kextract(x) rather than pmap_extract(kernel_pmap, x).

git-svn-id: svn://svn.freebsd.org/base/stable/9@247302 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246917:
markj [Tue, 26 Feb 2013 00:44:54 +0000 (00:44 +0000)]
MFC r246917:
  Strengthen the check in IS_OUT_OF_BOUNDS to ensure that (j - 1) is a
  valid index into the input buffer.

Approved by: rstone (co-mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/9@247294 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFH r247014, r247050 and r247051.
keramida [Mon, 25 Feb 2013 19:08:46 +0000 (19:08 +0000)]
MFH r247014, r247050 and r247051.

Add a sample program that shows how a custom comparison function and
qsort(3) can work together to sort an array of integers.

PR:             docs/176197
Submitted by:   Fernando, fapesteguia at opensistemas.com
Christoph Mallon, christoph.mallon at gmx.de
Approved by:    gjb (mentor), remko (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/9@247275 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r241010: libc/fts: Use O_CLOEXEC for internal file descriptors.
jilles [Mon, 25 Feb 2013 18:07:20 +0000 (18:07 +0000)]
MFC r241010: libc/fts: Use O_CLOEXEC for internal file descriptors.

Because fts keeps internal file descriptors open across calls, making such
descriptors close-on-exec helps not only multi-threaded applications but
also single-threaded applications.

In particular, this prevents passing a temporary file descriptor for saving
the current directory to processes created via find -exec.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247273 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoOops, r55392 (over 13 years ago) forgot to classify the new HTTP Proxy for the
dteske [Mon, 25 Feb 2013 16:13:21 +0000 (16:13 +0000)]
Oops, r55392 (over 13 years ago) forgot to classify the new HTTP Proxy for the
options dialog (causing "<unknown>" to be displayed for the HTTP media type).
Direct commit to stable/9 (no sysinstall in head).

git-svn-id: svn://svn.freebsd.org/base/stable/9@247267 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246329:
delphij [Mon, 25 Feb 2013 08:14:07 +0000 (08:14 +0000)]
MFC r246329:

Use stripesize as smallest block size if it's available.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247254 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoOops, r215291 (over 2 years ago) forgot to remove mention of "medium" from the
dteske [Sun, 24 Feb 2013 21:42:39 +0000 (21:42 +0000)]
Oops, r215291 (over 2 years ago) forgot to remove mention of "medium" from the
F1 Help file.  Direct commit to stable/9 (no sysinstall in head).

git-svn-id: svn://svn.freebsd.org/base/stable/9@247242 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoOops, r186202 (over 4 years ago) forgot to remove Tape from the F1 Help file.
dteske [Sun, 24 Feb 2013 21:36:54 +0000 (21:36 +0000)]
Oops, r186202 (over 4 years ago) forgot to remove Tape from the F1 Help file.
Direct commit to stable/9 (no sysinstall in head).

git-svn-id: svn://svn.freebsd.org/base/stable/9@247241 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246617: sigqueue(2): Fix typo (EEPERM -> EPERM).
jilles [Sun, 24 Feb 2013 21:00:37 +0000 (21:00 +0000)]
MFC r246617: sigqueue(2): Fix typo (EEPERM -> EPERM).

git-svn-id: svn://svn.freebsd.org/base/stable/9@247237 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC some flags and minor things related to "transparent mode"
luigi [Sun, 24 Feb 2013 18:26:17 +0000 (18:26 +0000)]
MFC some flags and minor things related to "transparent mode"
that i forgot in previous commits.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247230 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246612:
kib [Sun, 24 Feb 2013 05:48:59 +0000 (05:48 +0000)]
MFC r246612:
Fix several unsafe pointer dereferences in the buffered_write() function.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247211 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246563, r246564, r246634:
pfg [Sun, 24 Feb 2013 02:47:19 +0000 (02:47 +0000)]
MFC r246563, r246564, r246634:

ext2fs: Miscellaneous cleanups and fixes.

make e2fs_maxcontig local and remove tautological check.
Replace redundant EXT2_MIN_BLOCK with EXT2_MIN_BLOCK_SIZE.
Use prototype declarations for function definitions

Submitted by: Christoph Mallon

git-svn-id: svn://svn.freebsd.org/base/stable/9@247209 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoWhitespace. Direct commit to stable/9 (no sysinstall in head).
dteske [Sat, 23 Feb 2013 08:05:04 +0000 (08:05 +0000)]
Whitespace. Direct commit to stable/9 (no sysinstall in head).

git-svn-id: svn://svn.freebsd.org/base/stable/9@247170 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC support for -print-file-name=include.
kientzle [Sat, 23 Feb 2013 04:51:20 +0000 (04:51 +0000)]
MFC support for -print-file-name=include.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247167 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246522: sh: Simplify mksyntax and make it fit for cross-compiling.
jilles [Fri, 22 Feb 2013 20:16:16 +0000 (20:16 +0000)]
MFC r246522: sh: Simplify mksyntax and make it fit for cross-compiling.

Now it outputs fixed files, which use constants provided by the C standard
library to determine appropriate values for the target machine.

Before, mksyntax inspected the host machine which resulted in subtle
breakage if e.g. char is signed on the host and unsigned on the target such
as when cross-compiling on x86 for ARM.

Submitted by: Christoph Mallon

git-svn-id: svn://svn.freebsd.org/base/stable/9@247163 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r247003:
dim [Fri, 22 Feb 2013 18:35:40 +0000 (18:35 +0000)]
MFC r247003:

Pull in r175360 from upstream llvm trunk:

  MCParser: Reject .balign with non-pow2 alignments.

  GNU as rejects them and there are configure scripts in the wild that
  check if the assembler rejects ".align 3" to determine whether the
  alignment is in bytes or powers of two.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247157 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246858:
dim [Fri, 22 Feb 2013 18:33:42 +0000 (18:33 +0000)]
MFC r246858:

Pull in r175057 from upstream llvm trunk:

  X86: Disable generation of rep;movsl when %esi is used as a base pointer.

  This happens when there is both stack realignment and a dynamic alloca in the
  function. If we overwrite %esi (rep;movsl uses fixed registers) we'll lose the
  base pointer and the next register spill will write into oblivion.

  Fixes PR15249 and unbreaks firefox on i386/freebsd. Mozilla uses dynamic allocas
  and freebsd a 4 byte stack alignment.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247156 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246857:
dim [Fri, 22 Feb 2013 18:30:41 +0000 (18:30 +0000)]
MFC r246857:

Regenerate libstdc++'s config.h, synchronizing it with our current
almost-C99 headers.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247155 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r242852, r243069:
mav [Fri, 22 Feb 2013 09:47:21 +0000 (09:47 +0000)]
MFC r242852, r243069:
Several optimizations to sched_idletd():
 - Do not try to steal load from other CPUs if there was no context switches
on this CPU (i.e. it was idle all the time and woke up just for bus mastering
or TLB shutdown). If current CPU was idle, then it is quite unlikely that some
other CPU has load to steal.  Under high I/O rate, when TLB shutdowns cause
numerous CPU wakeups, on 24-CPU system load stealing code may consume up to
25% of all CPU time without giving any benefits.
 - Change code that implements spinning for load to restart spin in case of
context switch.  Previous code periodically called cpu_idle() even under
high interrupt/context switch rate.
 - Rise spinning threshold to 10KHz, where it gives at least some effect
that may worth consumed power.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247150 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246832:
pluknet [Fri, 22 Feb 2013 08:56:48 +0000 (08:56 +0000)]
MFC r246832:
  vn_io_faults_cnt:
  - use u_long consistently
  - use SYSCTL_ULONG to match the type of variable

git-svn-id: svn://svn.freebsd.org/base/stable/9@247149 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC: Merge sendmail 8.14.6 errata issue
gshapiro [Thu, 21 Feb 2013 22:38:39 +0000 (22:38 +0000)]
MFC: Merge sendmail 8.14.6 errata issue

git-svn-id: svn://svn.freebsd.org/base/stable/9@247141 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r226064 (by wxs):
mav [Thu, 21 Feb 2013 20:28:42 +0000 (20:28 +0000)]
MFC r226064 (by wxs):
Fix a typo in a comment.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247124 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r238802:
pluknet [Thu, 21 Feb 2013 20:24:00 +0000 (20:24 +0000)]
MFC r238802:
   Update the 'C1x draft' reference to '.St -isoC-2011' mdoc macro.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247123 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r244980 (by jvf):
mav [Thu, 21 Feb 2013 19:40:46 +0000 (19:40 +0000)]
MFC r244980 (by jvf):
Add Intel Lynx Point PCH HD Audio Device IDs

git-svn-id: svn://svn.freebsd.org/base/stable/9@247120 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r244014 (by ken):
mav [Thu, 21 Feb 2013 19:02:29 +0000 (19:02 +0000)]
MFC r244014 (by ken):

Fix a device departure bug for the the pass(4), enc(4), sg(4) and ch(4)
drivers.

The bug occurrs when a userland process has the driver instance
open and the underlying device goes away.  We get the devfs
callback that the device node has been destroyed, but not all of
the closes necessary to fully decrement the reference count on the
CAM peripheral.

The reason is that once devfs calls back and says the device has
been destroyed, it is moved off to deadfs, and devfs guarantees
that there will be no more open or close calls.  So the solution
is to keep track of how many outstanding open calls there are on
the device, and just release that many references when we get the
callback from devfs.

scsi_pass.c,
scsi_enc.c,
scsi_enc_internal.h:    Add an open count to the softc in these
                        drivers.  Increment it on open and
                        decrement it on close.

                        When we get a devfs callback to say that
                        the device node has gone away, decrement
                        the peripheral reference count by the
                        number of still outstanding opens.

                        Make sure we don't access the peripheral
                        with cam_periph_unlock() after what might
                        be the final call to
                        cam_periph_release_locked().  The
                        peripheral might have been freed, and we
                        will be dereferencing freed memory.

scsi_ch.c,
scsi_sg.c:              For the ch(4) and sg(4) drivers, add the
                        same changes described above, and in
                        addition, fix another bug that was
                        previously fixed in the pass(4) and enc(4)
                        drivers.

                        These drivers were calling destroy_dev()
                        from their cleanup routine, but that could
                        cause a deadlock because the cleanup
                        routine could be indirectly called from
                        the driver's close routine.  This would
                        cause a deadlock, because the device node
                        is being held open by the active close
                        call, and can't be destroyed.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247115 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r237328 (by ken) for recently merged scsi_enc.c:
mav [Thu, 21 Feb 2013 18:56:09 +0000 (18:56 +0000)]
MFC r237328 (by ken) for recently merged scsi_enc.c:

Fix several reference counting and object lifetime issues between
the pass(4) and enc(4) drivers and devfs.

The pass(4) driver uses the destroy_dev_sched() routine to
schedule its device node for destruction in a separate thread
context.  It does this because the passcleanup() routine can get
called indirectly from the passclose() routine, and that would
cause a deadlock if the close routine tried to destroy its own
device node.

In any case, once a particular passthrough driver number, e.g.
pass3, is destroyed, CAM considers that unit number (3 in this
case) available for reuse.

The problem is that devfs may not be done cleaning up the previous
instance of pass3, and will panic if isn't done cleaning up the
previous instance.

The solution is to get a callback from devfs when the device node
is removed, and make sure we hold a reference to the peripheral
until that happens.

Testing exposed some other cases where we have reference counting
issues, and those were also fixed in the pass(4) driver.

cam_periph.c: In camperiphfree(), reorder some of the operations.

The peripheral destructor needs to be called before
the peripheral is removed from the peripheral is
removed from the list.  This is because once we
remove the peripheral from the list, and drop the
topology lock, the peripheral number may be reused.
But if the destructor hasn't been called yet, there
may still be resources hanging around (like devfs
nodes) that haven't been fully cleaned up.

cam_xpt.c: Add an argument to xpt_remove_periph() to indicate
whether the topology lock is already held.

scsi_enc.c: Acquire an extra reference to the peripheral during
registration, and release it once we get a callback
from devfs indicating that the device node is gone.

Call destroy_dev_sched_cb() in enc_oninvalidate()
instead of calling destroy_dev() in the cleanup
routine.

scsi_pass.c: Add reference counting to handle peripheral and
devfs object lifetime issues.

Add a reference to the peripheral and the devfs
node in the peripheral registration.

Don't attempt to add a physical path alias if the
peripheral has been marked invalid.

Release the devfs reference once the initial
physical path alias taskqueue run has completed.

Schedule devfs node destruction in the
passoninvalidate(), and release our peripheral
reference in a new routine, passdevgonecb() once
the devfs node is gone.  This allows the peripheral
to fully go away, and the peripheral destructor,
passcleanup(), will get called.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247114 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r236138 (by ken) for recently merged scsi_enc.c:
mav [Thu, 21 Feb 2013 18:49:05 +0000 (18:49 +0000)]
MFC r236138 (by ken) for recently merged scsi_enc.c:

Work around a race condition in devfs by changing the way closes
are handled in most CAM peripheral drivers that are not handled by
GEOM's disk class.

The usual character driver open and close semantics are that the
driver gets N open calls, but only one close, when the last caller
closes the device.

CAM peripheral drivers expect that behavior to be honored to the
letter, and the CAM peripheral driver code (specifically
cam_periph_release_locked_busses()) panics if it is done incorrectly.

Since devfs has to drop its locks while it calls a driver's close
routine, and it does not have a way to delay or prevent open calls
while it is calling the close routine, there is a race.

The sequence of events, simplified a bit, is:

- devfs acquires a lock
- devfs checks the reference count, and if it is 1, continues to close.
- devfs releases the lock

- 2nd process open call on the device happens here

- devfs calls the driver's close routine

- devfs acquires a lock
- devfs decrements the reference count
- devfs releases the lock

- 2nd process close call on the device happens here

At the second close, we get a panic in
cam_periph_release_locked_busses(), complaining that peripheral
has been released when the reference count is already 0.  This is
because we have gotten two closes in a row, which should not
happen.

The fix is to add the D_TRACKCLOSE flag to the driver's cdevsw, so
that we get a close() call for each open().  That does happen
reliably, so we can make sure that our reference counts are
correct.

Note that the sa(4) and pt(4) drivers only allow one context
through the open routine.  So these drivers aren't exposed to the
same race condition.

scsi_ch.c,
scsi_enc.c,
scsi_enc_internal.h,
scsi_pass.c,
scsi_sg.c:
For these drivers, change the open() routine to
increment the reference count for every open, and
just decrement the reference count in the close.

Call cam_periph_release_locked() in some scenarios
to avoid additional lock and unlock calls.

scsi_pt.c: Call cam_periph_release_locked() in some scenarios
to avoid additional lock and unlock calls.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247113 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r237574:
pfg [Thu, 21 Feb 2013 18:41:35 +0000 (18:41 +0000)]
MFC r237574:

Ensure crunchen uses the same make binary as the rest of the build.

I actually had already merged the crunchgen part of it as part
of the the enhanced ELF support.

Discussed with: Simon Gerraty

git-svn-id: svn://svn.freebsd.org/base/stable/9@247112 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r230590 (by ken) except parts changing ABI:
mav [Thu, 21 Feb 2013 18:15:41 +0000 (18:15 +0000)]
MFC r230590 (by ken) except parts changing ABI:
Add CAM infrastructure to allow reporting when a drive's long read capacity
data changes.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247111 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r238379, r238382 (by bruefer):
mav [Thu, 21 Feb 2013 16:59:28 +0000 (16:59 +0000)]
MFC r238379, r238382 (by bruefer):
Renamed the kern.cam.da.da_send_ordered sysctl and tunable to
kern.cam.da.send_ordered, more in line with the other da sysctls/tunables.
Renamed the kern.cam.ada.ada_send_ordered sysctl and tunable to
kern.cam.ada.send_ordered, more in line with the other da sysctls/tunables.

PR: 169765

git-svn-id: svn://svn.freebsd.org/base/stable/9@247103 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r244983 (by jfv):
mav [Thu, 21 Feb 2013 15:21:25 +0000 (15:21 +0000)]
MFC r244983 (by jfv):
Add Intel Lynx Point PCH SATA Controller Device IDs

git-svn-id: svn://svn.freebsd.org/base/stable/9@247098 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246616 and r246759:
hselasky [Thu, 21 Feb 2013 07:48:07 +0000 (07:48 +0000)]
MFC r246616 and r246759:

- Move scratch data from the USB bus structure to the USB device
structure so that simultaneous access cannot happen. Protect scratch
area using the enumeration lock.
- Reduce stack usage in usbd_transfer_setup() by moving some big stack
members to the scratch area. This saves around 200 bytes of stack.
- Fix a whitespace.
- Protect control requests using the USB device enumeration lock.
- Make sure all callers of usbd_enum_lock() check the return value.
- Remove the control transfer specific lock.
- Bump the FreeBSD version number, hence external USB modules may need
to be recompiled due to a USB device structure change.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247090 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246486:
kib [Thu, 21 Feb 2013 06:00:33 +0000 (06:00 +0000)]
MFC r246486:
Document P_PPTRACE.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247082 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246485:
kib [Thu, 21 Feb 2013 05:59:16 +0000 (05:59 +0000)]
MFC r246485:
Document the detail of interaction between vfork and PT_TRACEME.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247081 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246476:
kib [Thu, 21 Feb 2013 05:57:51 +0000 (05:57 +0000)]
MFC r246476:
Document the ERESTART translation to EINTR for devfs nodes.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247080 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246802:
kib [Thu, 21 Feb 2013 05:55:52 +0000 (05:55 +0000)]
MFC r246802:
Print slightly more useful information on the 'bad pte' panic.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247079 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246801:
kib [Thu, 21 Feb 2013 05:53:42 +0000 (05:53 +0000)]
MFC r246801:
Assert that user address is never qremoved.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247078 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246484:
kib [Thu, 21 Feb 2013 05:47:52 +0000 (05:47 +0000)]
MFC r246484:
Allow ptrace(2) operation on the child created by vfork(2), if the
debugger is not the parent.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247077 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246472:
kib [Thu, 21 Feb 2013 05:38:11 +0000 (05:38 +0000)]
MFC r246472:
Stop translating the ERESTART error from the open(2) into EINTR.
Posix requires that open(2) is restartable for SA_RESTART.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247076 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246371: sh: Do not test for digit_contig in mksyntax.
jilles [Wed, 20 Feb 2013 21:57:01 +0000 (21:57 +0000)]
MFC r246371: sh: Do not test for digit_contig in mksyntax.

ISO/IEC 9899:1999 (E) 5.2.1p3 guarantees that the values of the characters
0123456789 are contiguous.

The generated syntax.c and syntax.h remain the same.

Submitted by: Christoph Mallon

git-svn-id: svn://svn.freebsd.org/base/stable/9@247058 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246507: sh: Fix a comment.
jilles [Wed, 20 Feb 2013 21:49:52 +0000 (21:49 +0000)]
MFC r246507: sh: Fix a comment.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247057 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246347, r246348, r246349, r246350, r246351, r246352:
pfg [Wed, 20 Feb 2013 20:56:07 +0000 (20:56 +0000)]
MFC r246347, r246348, r246349, r246350, r246351, r246352:

ext2fs: Miscellaneous cleanups and fixes.

Use EXT2_LINK_MAX instead of LINK_MAX.
Use nitems().
Correct off-by-one errors in FFTODT() and DDTOFT().
Remove useless rootino local variable.
Remove unused em_e2fsb definition.
Move assignment where it is not dead.

Submitted by: Christoph Mallon

git-svn-id: svn://svn.freebsd.org/base/stable/9@247055 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r239359:
pfg [Wed, 20 Feb 2013 20:12:17 +0000 (20:12 +0000)]
MFC r239359:

Remove unused member of struct indir (in_exists) from UFS and EXT2 code.

Discussed with: mjg

git-svn-id: svn://svn.freebsd.org/base/stable/9@247053 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246804:
jamie [Wed, 20 Feb 2013 04:14:31 +0000 (04:14 +0000)]
MFC r246804:

  Handle (ignore) when a process disappears before it can be tracked.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247019 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246890:
marcel [Wed, 20 Feb 2013 03:59:45 +0000 (03:59 +0000)]
MFC r246890:
Close a race relating to setting the PCPU pointer (r13).

git-svn-id: svn://svn.freebsd.org/base/stable/9@247018 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r232977 and r233945:
ed [Tue, 19 Feb 2013 17:57:17 +0000 (17:57 +0000)]
MFC r232977 and r233945:

  Make init(8) slightly more robust when /dev/console is missing.

  If the environment doesn't offer a working /dev/console, the existing
  version of init(8) will simply refuse running rc(8) scripts. This means
  you'll only have a system running init(8) and nothing else.

  Change the code to do the following:

  - Open /dev/console like we used to do, but make it more robust to use
    O_NONBLOCK to prevent blocking on a carrier.
  - If this fails, use /dev/null as stdin and /var/log/init.log as stdout
    and stderr.
  - If even this fails, use /dev/null as stdin, stdout and stderr.

  So why us this useful? Well, if you remove the `getpid() == 1' check in
  main(), you can now use init(8) inside jails to properly execute rc(8).
  It still requires some polishing, as existing tools assume init(8) has
  PID 1.

  Also it is now possible to use use init(8) on `headless' devices that
  don't even have a serial boot console.

git-svn-id: svn://svn.freebsd.org/base/stable/9@247004 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r239672 (by rrs):
markj [Tue, 19 Feb 2013 16:39:53 +0000 (16:39 +0000)]
MFC r239672 (by rrs):
  This small change takes care of a race condition
  that can occur when both sides close at the same time.
  If that occurs, without this fix the connection enters
  FIN1 on both sides and they will forever send FIN|ACK at
  each other until the connection times out. This is because
  we stopped processing the FIN|ACK and thus did not advance
  the sequence and so never ACK'd each others FIN. This
  fix adjusts it so we *do* process the FIN properly and
  the race goes away ;-)

Approved by: rrs
Approved by: emaste (co-mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/9@246997 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246875:
dim [Tue, 19 Feb 2013 08:07:11 +0000 (08:07 +0000)]
MFC r246875:

Import change 40eebf235370b6fe6353784ccf01ab92eed062a5 from upstream wpa:

  From: Jouni Malinen <j@w1.fi>
  Date: Fri, 15 Jul 2011 13:42:06 +0300
  Subject: [PATCH] MD5: Fix clearing of temporary stack memory to use correct length

  sizeof of the structure instead of the pointer was supposed to be used
  here. Fix this to clear the full structure at the end of MD5Final().

Found by: clang ToT
Reviewed by: rpaulo

git-svn-id: svn://svn.freebsd.org/base/stable/9@246982 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246874:
dim [Tue, 19 Feb 2013 07:55:53 +0000 (07:55 +0000)]
MFC r246874:

Fix two instances of undefined behaviour in contrib/nvi.

Found by: clang ToT
Obtained from: NetBSD
Reviewed by: jh

git-svn-id: svn://svn.freebsd.org/base/stable/9@246981 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246873:
dim [Tue, 19 Feb 2013 07:50:10 +0000 (07:50 +0000)]
MFC r246873:

In contrib/opie/opiekey.c, use the correct length to zero the secret.

Found by: clang ToT
Reviewed by: delphij

git-svn-id: svn://svn.freebsd.org/base/stable/9@246980 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246860:
dim [Mon, 18 Feb 2013 22:03:04 +0000 (22:03 +0000)]
MFC r246860:

Fix undefined behaviour in usr.bin/mail/util.c.

Reported by: deeptech71@gmail.com

git-svn-id: svn://svn.freebsd.org/base/stable/9@246950 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246658: Cross-reference vfs_unbusy(9).
pluknet [Mon, 18 Feb 2013 16:02:17 +0000 (16:02 +0000)]
MFC r246658: Cross-reference vfs_unbusy(9).

git-svn-id: svn://svn.freebsd.org/base/stable/9@246941 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246630:
ae [Mon, 18 Feb 2013 08:24:39 +0000 (08:24 +0000)]
MFC r246630:
  Add bootcamp support to the loader.

git-svn-id: svn://svn.freebsd.org/base/stable/9@246938 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246715:
marcel [Mon, 18 Feb 2013 05:05:01 +0000 (05:05 +0000)]
MFC r246715:
Eliminate the PC_CURTHREAD symbol and load the current thread's
thread structure pointer atomically from r13 (the pcpu pointer)
for the current CPU/core.

git-svn-id: svn://svn.freebsd.org/base/stable/9@246937 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r245075:
markj [Sun, 17 Feb 2013 19:49:59 +0000 (19:49 +0000)]
MFC r245075:
  Fix a segfault when bsdgrep -i is given an empty pattern string.

Approved by: emaste (co-mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/9@246920 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r245961 r245962 r245963.
markj [Sun, 17 Feb 2013 19:49:18 +0000 (19:49 +0000)]
MFC r245961 r245962 r245963.

MFC r245961:
  When the 'R' flag is used with a newsyslog.conf entry, some fields of
  the corresponding struct sigwork_entry were left uninitialized,
  potentially causing an early return from do_sigwork(). Ensure that these
  fields are initialized, and handle the 'R' flag properly in
  do_sigwork().

MFC r245962:
  Ensure that newsyslog -n prints the correct message for a rotation rule
  that uses the 'R' flag.

MFC r245963:
  Rename the run_cmd field to sw_runcmd to make it consistent with the
  other fields in struct sigwork_entry.

Approved by: emaste (co-mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/9@246918 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r244734: test(1): Document == alias for =.
jilles [Sun, 17 Feb 2013 14:25:42 +0000 (14:25 +0000)]
MFC r244734: test(1): Document == alias for =.

git-svn-id: svn://svn.freebsd.org/base/stable/9@246914 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246636:
kib [Sun, 17 Feb 2013 06:06:11 +0000 (06:06 +0000)]
MFC r246636:
Remove the ia64-specific code fragment, which effect is more cleanly
done by the call to trans_prot() function a line before.

git-svn-id: svn://svn.freebsd.org/base/stable/9@246897 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246296, r246298, r246346;
pfg [Sun, 17 Feb 2013 03:33:13 +0000 (03:33 +0000)]
MFC r246296, r246298, r246346;

crunchide: support non-custom elf object layout.
crunchgen: Permit use of alternative linkers.
crunchide: Put e_shnum into a local variable. [1]

Submitted by: Pete Chou
Reviewed by: Christoph Mallon [1]

git-svn-id: svn://svn.freebsd.org/base/stable/9@246895 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r240355, r239372, r246258;
pfg [Sun, 17 Feb 2013 01:34:41 +0000 (01:34 +0000)]
MFC r240355, r239372, r246258;

ext2fs: general cleanups.

- Remove unused extern declarations in fs.h
- Correct comments in ext2_dir.h
- Several panic() messages showed wrong function names.
- Remove commented out stray line in ext2_alloc.c.
- Remove the unused macro EXT2_BLOCK_SIZE_BITS() and the then
  write-only member e2fs_blocksize_bits from struct m_ext2fs.
- Remove the unused macro EXT2_FIRST_INO() and the then write-only
  member e2fs_first_inode from struct m_ext2fs.
- Remove EXT2_DESC_PER_BLOCK() and the member e2fs_descpb from
  struct m_ext2fs.
- Remove the unused members e2fs_bmask, e2fs_dbpg and
  e2fs_mount_opt from struct m_ext2fs
- Correct harmless off-by-one error for fspath in ext2_vfsops.c.
- Remove the unused and broken macros EXT2_ADDR_PER_BLOCK_BITS()
  and EXT2_DESC_PER_BLOCK_BITS().
- Remove the !_KERNEL versions of the EXT2_* macros.

Submitted by: Christoph Mallon

To ease the ease bringing this change I also brought this changes:
- Fix typo.
- Fix style nit.

git-svn-id: svn://svn.freebsd.org/base/stable/9@246892 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agopartial MFC of rev=245362:
luigi [Sat, 16 Feb 2013 22:44:02 +0000 (22:44 +0000)]
partial MFC of rev=245362:
enable building virtio devices into static kernels.

I think the 'files.*' entries should be improved (also in HEAD) because
bringing up a vtnet device now requires 3 entries in your kernel config:
"device virtio, device virtio_pci, device vtnet"

but i'll leave the fix to a future commit.

This is also the reason not to enable the device in GENERIC kernels now.

git-svn-id: svn://svn.freebsd.org/base/stable/9@246885 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246557:
trasz [Fri, 15 Feb 2013 06:52:56 +0000 (06:52 +0000)]
MFC r246557:

In the setfacl(1) manual page, make it clear that for NFSv4 ACLs,
one should really use -a and -x instead of -m.

MFC r246558:

Improve description of the "-m" option to setfacl(1).

MFC r246559:

Fix NFSv4 permission description in setfacl(1) manual page: the 'D'
means delete_child, not delete.

git-svn-id: svn://svn.freebsd.org/base/stable/9@246819 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246421 and r246454:
hselasky [Thu, 14 Feb 2013 10:48:08 +0000 (10:48 +0000)]
MFC r246421 and r246454:
Add support for buttons on USB audio devices,
like Volume Up, Volume Down and Mute.

Reviewed by:  mav @

git-svn-id: svn://svn.freebsd.org/base/stable/9@246786 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246397:
hselasky [Thu, 14 Feb 2013 10:32:47 +0000 (10:32 +0000)]
MFC r246397:
Make sure that all mouse buttons are released when clients
using /dev/consolectl close. This fixes a problem where if
a USB mouse is detached while a button is pressed, that
button is never released.

git-svn-id: svn://svn.freebsd.org/base/stable/9@246785 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246117:
kib [Wed, 13 Feb 2013 23:25:11 +0000 (23:25 +0000)]
MFC r246117:
Rework the __vdso_* symbols attributes to only make the symbols weak,
but use normal references instead of weak. This makes the statically
linked binaries to use fast gettimeofday(2) by forcing the linker to
resolve references and providing the neccessary functions.

git-svn-id: svn://svn.freebsd.org/base/stable/9@246775 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246116:
kib [Wed, 13 Feb 2013 13:55:54 +0000 (13:55 +0000)]
MFC r246116:
Reduce default shift used to calculate the max frequency for the TSC
timecounter to 1, and correspondingly increase the precision of the
gettimeofday(2) and related functions in the default configuration.

MFC r246212:
Remove the (shift > 0) condition when selecting the get_timecount()
implementation.

git-svn-id: svn://svn.freebsd.org/base/stable/9@246760 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

11 years agoMFC r246412:
pluknet [Wed, 13 Feb 2013 10:16:58 +0000 (10:16 +0000)]
MFC r246412:
  Prezero the acl structure which is to be copied to usermode, to avoid
  leakage of the previous content of padding and unitialized fields.

git-svn-id: svn://svn.freebsd.org/base/stable/9@246757 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f