Compare commits

...
1592 Commits
Author SHA1 Message Date
Ken Smith 045f17e533 Ready for 8.2-RELEASE builds to start.
Approved by:	re (implcit)
2011-02-16 15:24:22 +00:00
Ken Smith 19365ab40c Guess when all the bits will be in place for announcing 8.2-RELEASE.
Approved by:	re (implicit)
2011-02-16 14:28:04 +00:00
Simon L. B. Nielsen 164d29bd31 MFS 218633:
Fix Incorrectly formatted ClientHello SSL/TLS handshake messages could
cause OpenSSL to parse past the end of the message.

Note: Applications are only affected if they act as a server and call
SSL_CTX_set_tlsext_status_cb on the server's SSL_CTX. This includes
Apache httpd >= 2.3.3, if configured with "SSLUseStapling On".

The very quick merge is done to get this fix into 7.4 / 8.2.

Approved by:	re (bz)
Obtained from:	OpenSSL CVS
Security:	http://www.openssl.org/news/secadv_20110208.txt
Security:	CVE-2011-0014
2011-02-13 11:09:39 +00:00
Hiroki Sato 3c11356fa4 s/9.6-ESV-R4/9.6-ESV-R3/.
Spotted by:	dougb
Approved by:	re (implicit)
2011-02-12 09:12:11 +00:00
Hiroki Sato c7b9e8581e - FreeBSD/mips Netlogic Microsystems XLR, XLS multicore support[1],
- kern_fpu_{enter,leave}() that allow to use XMM register in kernel[2],
- PT_LWPINFO request in ptrace(2) improved[2],
- rewording and s/pwc/pwcbsd/ in a video4linux entry[3],
- s//has been fixed/ in an alc(4) entry[4],
- bge(4) BCM6906 typo fix[5],
- bge(4) MAC statistics support[5],
- s/lead/lead to/ typo fix in a bge(4) entry[6],
- more NICs in the flow control improvement[7],
- rl(4) and re(4) typo fix[5],
- run(4) entry removal[8],
- s/altq/alq/ typo fix[9],
- s/now/new/ typo fix[10],
- ata(4) cable check rewording[10],
- ata(4) SATA power management with ATA_CAM[10],
- ata(4) ICH5 and ICH8+ in legacy mode improvement[10],
- s,/para>,</para>, typo fix[11],
- s/passphrease/passphrase/ typo fix[12],
- s/globing/globbing/ typo fix[12],
- s/-u nounset/-u/ rewording[13],
- tr(1) [=]=] equivalent class rewording[14].

Approved by:	re (implicit)
Reviewed and suggested by: kib[2], mav[10], hselasky, imp,
	jmallett, yongari[5], bcr[11], brix[11], manolis[3],
	brucec[3], Jayachandran C.[1], jilles[13], ohauer[4,14],
	pluknet[8,9], lme[3,4,6,11,12], marius[7], and
	swills[11]
2011-02-12 08:51:06 +00:00
Hiroki Sato 7ac7a8dc76 Add revision attribute handling. Links are now generated at the end
of the paragraph from revision="NNN".

Approved by:	re (implicit)
2011-02-12 08:29:16 +00:00
Hiroki Sato ec97bfc545 Add more relnotes items for 8.2R:
[mips] FreeBSD/mips merge,
	[sparc64] reservation-based physical memory allocation enabled,
	[amd64,i386] ACPI suspend/resume improvement,
	[amd64,i386,ia64] hw.acpi.*_interface added,
	[amd64] Xen HVM support improved,
	[powerpc] OF loader bugfixes,
	[amd64,i386] aesni(4) added,
	[powerpc] CPU temp sensors on PowerMac SMU supported,
	xhci(4) for Extensible Host Controller Interface added,
	uaudio(4) MIDI input buffer bug fixed,
	cdce(4) bugfix,
	ixgbe(4) version 2.3.8,
	miibus(4) improved,
	mxge(4) TSO bug fixed,
	nfe(4) WoL support,
	re(4) TX interrupt moderation supported,
	run(4) for Ralink RT2700U/RT2800U/RT3000U added,
	ipfw(4) net.inet.ip.fw.one_pass with in-kernel NAT fixed,
	ng_eiface(4) MTU handling fixed,
	arcmsr(4) version 1.20.00.19,
	fdisk(8) gjournal(8) and geli(8) GEOM class support,
	gpart(8) backup/restore support,
	newfs(8) 64KB blocksize UFS1 issue fixed,
	jn(3) and jnf(3) accuracy issue fixed,
	newsyslog(8) <include> support added,
	ACPI-CA 20101013,
	ISC BIND 9.6-ESV-R4,
	netcat 4.8,
	OpenSSL 0.9.8q,
	xz 5.0.0 release[1], and
	pkg_create(1) xz support.

Reword an entry for "sh(1) $@ and $* handling when -u nounset
is specified has been changed"[2].

Suggested by:	mm[1] and jilles[2]
Approved by:	re (implicit)
2011-02-11 16:02:12 +00:00
John Baldwin 87f88e28fa MFC 218271:
When turning off TCP_NOPUSH, only call tcp_output() to immediately flush
any pending data if the connection is established.

Approved by:	re (kib)
2011-02-11 15:14:51 +00:00
Hiroki Sato e9d43217df Add more relnotes items for 8.2R:
qpi(4) pseudo bus driver added,
	acpi(4) ACPI Reset Register handling changed,
	tpm(4) added,
	alc(4) freeze on boot with no cable fixed,
	bge(4) BCM5718 support added,
	re(4) 64-bit DMA addressing support,
	rl(4) statistics counter support,
	sk(4) station address bug fixed,
	net.link.ifqmaxlen replaced IFQ_MAXLEN,
	siftr(4) Statistical Information For TCP Research module added,
	ada(4) kern.cam.ada.spindown_shutdown added,
	dtrace(1) userland support added,
	dtruss(1) added,
	gpart(8) "recover" subcommand for GPT partition tables added,
	tar(1) -b now supports up to 8192 as the blocksize,
	sh(1) -u nounset option's $@, $*, and $! handling changed,
	periodic(8) script to find installed ports with mismatched chekcsum,
	ISC BIND 9.6-ESV-R2.

Approved by:	re (implicit)
Some spelling mistakes were spotted by:	pluknet
2011-02-11 10:50:33 +00:00
Hiroki Sato eec6010edb Add more relnotes items for 8.2R:
[amd64] VM_KMEM_SIZE_SCALE=1 by default,
	[amd64,i386] CPU topology detection for Intel CPUs improved,
	bge(4) TXCSUM/RXCSUM confusion fixed,
	bge(4) workaround for BCM5906/6906 added,
	fxp(4) TSO over VLAN on 82550 and 82551 added,
	ata(4) SiI chipsets on big endian systems fixed,
	b64decode(1) -r break handling fixed, and
	tzdata2010o.

Approved by:	re (implicit)
2011-02-08 20:39:03 +00:00
Hiroki Sato 0d24dc881d Add more relnotes items for 8.2R:
GENERIC now has KDB and KDB_TRACE by default,
	vfs.ncsizefactor and vfs.ncnegfactor added,
	opencrypto XTS-AES support,
	axe(4) TX packet rate improvement,
	rl(4) TX packet rate under high RX load improvement,
	gconcat(8) kernel crash dump support,
	geli(8) metadata version bump to 4,
	geli(8) kern.geom.eli.overwrites added,
	geli(8) key shift added,
	geli(8) XTS-AES support and enabled by default,
	geli(8) kern.geom.eli.debug=-1 support,
	geli(8) resize command added,
	geli(8) suspend/resume command added,
	geli(8) -f option added,
	geli(8) -J and -j options added,
	lpr(1) issue of files on ZFS fixed,
	watchdogd(8) MADV_PROTECTified, and
	ee(1) updated to 1.5.2.

Approved by:	re (implicit)
2011-02-08 17:04:52 +00:00
Martin Matuska 023ee41ce9 MFC r218166:
Reintroduce bugfix from r210103 and fix xz on strong-aligned architectures.
This fix was accidentially reverted with the 5.0.0 update in r215187.

PR:		bin/154310
Submitted by:	Michael Moll <[email protected]>
Approved by:	re (kensmith)
2011-02-08 15:05:47 +00:00
Hiroki Sato d31e15912f Add more relnotes items for 8.2R:
new sysctls: vm.kmem_map_size, vm.kmem_map_free,
	GPT support improved,
	ipfw0 interface panic due to multicast traffic injection fixed,
	lagg(4) net.link.lagg.failover_rx_all knob added,
	linprocfs(5) /proc/$$/environment support,
	ZFS now allows offlining log devices,
	gpart(8) -F option added,
	gaprt(8) more GPT attributes,
	mount(8) "rw" flags in -p option's output fixed,
	ncal(1) -A -B -C added,
	ntpd(8) SHM ref clock driver enabled,
	ruptime(1) hostname length extended, and
	tr(1) [=]=] regexp class fixed

Approved by:	re (implicit)
2011-02-08 15:03:13 +00:00
Hiroki Sato cbf6380a79 Add more relnotes items for 8.2R:
CTLFLAG_RDTUNize vm.kmem_size*,
		debug.{kdb.stop_cpus,trace_on_panic}, kern.sync_on_panic,
	pxeboot(8) NFSv3 by default,
	bge(4) UDP checksum offloading bug tunable,
	bge(4) DMA bounce buffer handling improvement,
	sis(4) works on all supported platforms, WoL on DP8315,
		padding bug tunable,
	xl(4) WoL support,
	ipfw(4) netgraph + one_pass issue fixed,
	ipfw(4) ngtee action changed,
	pf(4) + TSO issue fixed,
	ahci(4) device reset timeout 10->15 seconds,
	ata(4) serverworks K2 SATA detection fixed,
	kenv boot.nfsroot.nfshandlelen added,
	more ZFS changes,
	gpart(8) better /dev/ prefix handling in command line,
	hastd(8) SIGHUP/SIGINT/SIGTERM handling,
	libarchive LZMA support,
	pax(1) off-by-one in ustar filename fixed,
	tftp(1) and tfptd(8) overhaul, and
	tzdata2010m.

Approved by:	re (implicit)
2011-02-06 16:21:21 +00:00
Hiroki Sato d530b83590 Add relnotes entries for upcoming 8.2R (first round):
[ia64] DMA bounce buffer pool increased from 256 to 1024,
	[powerpc] kern.hz 100->1000,
	[powerpc] SMP support on MPC7400-based machines,
	[powerpc] DMA bounce buffer support,
	ddb(8) reset and reboot delay support,
	ddb(8) show cdev,
	memguard(9) improvement to use larger KVA,
	aibs(4) added in favor of acpi_aiboost(4),
	coretemp(4) Xeon 5500/5600 support,
	ichwd(4) Intel NM10 Express chipset support,
	video4linux API support in Linux emulation subsystem,
	alc(4) AR8151/8152 support,
	alc(4) poor UDP performance issue fixed,
	bge(4) TSO fixed,
	bce(4) flow control support,
	bwi(4) for BCM430x and BCM431x added (but not in GENERIC yet),
	bwn(4) padding issue fixed,
	cxgb(4) new sysctls: nfilters, pkt_timestamp, core_clock,
	em(4) 7.1.9,
	igb(4) 2.0.7,
	em(4) and igb(4) statistics counters as sysctl MIB objects,
	em(4) and igb(4) now supports led(4),
	epair(4) linkstate support,
	iwn(4) 6000 series support, firmware version 9.221.4.1,
	ixgbe(4) kernel module building, version 2.2.1,
	mwlfw(4) kernel module building,
	rl(4) WoL support, prefer_iomap knob added,
	sis(4) stability issue fixed,
	ste(4) prefer_iomap knob added,
	sk(4) TX checksum offloading disabled by default,
	altq(4) kernel module building,
	IPsec flow distribution improved,
	proxy ARP issue over Netgraph interfaces fixed,
	an issue with IPv6 use_defaultzone=1 fixed,
	ng_patch(4) added,
	ng_ether(4) issue when associated IF is moved to another vnet fixed,
	TCP BW*DELAY window limiting (inflight) disabled by default,
	TCP path MTU discovery when <256 octets of MTU fixed,
	TCP initial window increase algorithm in RFC 3390 improved,
	VNET now supports IPv4 multicast routing,
	ahci(4) NCQ and PMP disabled on VIA VT8251,
	arcmsr(4) updated to version 1.20.00.17,
	ata(4) device hints for initial ATA mode added,
	ata(4) now checks also on controller side when ata_dma_check_80pin=1,
	mpt(4) now reports max I/O size to the upper layer,
	twa(4) updated to version 3.8.06.003,
	ZFS version 15, metaslab code updated, various bug fixes,
	vfs.zfs.vdec.max_pending reduced from 35 to 10,
	arp(8) -an improvement,
	calendar(1) improved,
	dhclient(8) 10-second period changed,
	du(1) -t threshold added,
	gcore(1) -f added,
	get{host,net,proto}*() returns ERANGE and NS_RETURN for too small buf,
	gpart(8) resize command added,
	ifconfig(8) CIDR subnet width parsing improved,
	jot(1) bug fix,
	newsyslog(8) -S pidfile option added,
	pkill(8) -l option added,
	pmcstat(8) now supports file and network socket for the event source,
	pom(6) -p added,
	powerd(8) -m -M added,
	sh(1) SIGINT handling fixed,
	sh(1) supports "</dev/null &",
	sleep(1) SIGINFO support,
	uname(1) -o added,
	vi(1) bug fix,
	zfs(8) set sharenfs supports sec keyword,
	periodic(8) script for zfs scrub added,
	tzdata2010l,
	sysinstall(8) partition size changed, and
	sysinstall(8) enables getty on serial console when no VGA.

Approved by:	re (implicit)
2011-02-06 07:41:27 +00:00
Ken Smith 7e780f7b99 Adjust package set for 8.2-RELEASE. Packages keep being removed due
to a 2Gb file limit in the FTP mirroring system that we hope to remove
before 8.3-RELEASE so I'm not adjusting what's in stable/8 at this
point, just releng/8.2.

Approved by:	re (implicit)
2011-01-31 17:42:31 +00:00
Ken Smith 3f0c8da1f9 Ready for 8.2-RC3.
Approved by:	re (implicit)
2011-01-29 15:56:40 +00:00
Jung-uk Kim 82460477c3 MFC: r217587
Fix yet another fallout from r208833.  VM86 BIOS call may cause page fault
when FPU is in use.

Approved by:	re (kib)
2011-01-28 19:53:38 +00:00
Colin Percival 42b7d478af MFC r217872: Unbreak .Dd line.
Approved by:    re (kib)
2011-01-27 21:41:27 +00:00
Colin Percival 51cf658f21 MFC r217869,217870: Fix .Dd lines in re(4) and nfe(4).
Approved by:    re (kib)
2011-01-27 09:33:51 +00:00
Jack F Vogel 698bf4df39 MFC ixgbe cummulative patch from stable/8
217712  Fix a couple of incorrect variable names in the sysctl code.
217713  - Panic on the 82598 adapter due to reading FCOE registers that don't exit
        - Make phy detection dynamic so adapters that support multiple types of
          media can be properly identified by the interface layer
        - Performance patch to the flow director (ixgbe_atr) code
        - Fix intermittent data corruption on the 82599
        - Add missing support code for buffer size and descriptors when doing
          jumbo frames, also add 16K cluster support.
        - Release RX lock when calling stack, this removes LOR problems.
217795  Remove TX_UNLOCK from the error path in local_timer, there is no LOCK
217796  Add missing case for Direct Attach 82598 in the dynamic phy detection
217797  Performance: don't run flow control shared code if nothing has changed

Approved by:  re (bz)
2011-01-27 00:36:54 +00:00
Bernhard Schmidt f8d326748d MFC r217511:
Pull ieee80211_ratectl_node_init() calls from drivers into net80211.
This fixes hostap mode for at least ral(4) and run(4), because there is
no sufficient call into drivers which could be used initialize the node
related ratectl variables.

Approved by:	re (bz)
2011-01-26 17:20:34 +00:00
Jack F Vogel 17cbbe2bf7 MFC stable/8 r217711
Fix for kern/152853, pullup in the wrong
	place in em_xmit causes UDP failure. Thanks
	to Petr Lampa for the patch.

Approved by: re (bz)
2011-01-25 23:20:22 +00:00
Andrew Thompson 38ee85123c MFC r203134,r207990,r217289,r203135
Add manpages for run(4) and runfw(4).

Approved by:	re (kib)
2011-01-25 22:35:35 +00:00
Jack F Vogel 05707fd791 MFC stable/8 r217710
- Pieces of the failure path in em_xmit got deleted along
	  the way, correct this.
	- local_timer had a leftover TX_UNLOCK without matching
	  LOCK in the error path, remove it.

Approved by:  re (bz)
2011-01-25 22:25:50 +00:00
Andrew Thompson 994c40b46a MFC r217727
Revert the ndis part of r212122, windrv_stub.c already adds a MODULE_VERSION
 and this breaks loading miniport drivers from loader.conf

Approved by:	re (kib)
2011-01-25 20:29:57 +00:00
Pyun YongHyeon e50bb4c71e MFC r217548:
Rework RX filter programming by providing separate handler for
  DP8381[56] and SiS 900/7016 controllers.  After r212119, sis(4) no
  longer reinitializes controller if ALLMULTI/PROMISC was changed.
  However, RX filter handling code assumed some bits of the RX filter
  is programmed by driver initialization. This caused ALLMULTI/PROMISC
  configuration is ignored under certain conditions.
  Fix that issue by reprogramming all bits of RX filter register.
  While I'm here follow recommended RX filter programming steps
  recommended by National DP8381[56] data sheet(RX filter should be
  is disabled before programming).

  Reported by:	Paul Schenkeveld < freebsd () psconsult dot nl >
  Tested by:	Paul Schenkeveld < freebsd () psconsult dot nl >
  Approved by:	re (bz)
2011-01-24 21:03:22 +00:00
Konstantin Belousov 4ca127ea31 MFC r217383:
The (%esp & 0xf) == 0 should be true before the call instruction is
executed, for the properly aligned stack.

Approved by:	re (bz)
2011-01-22 17:49:37 +00:00
Marius Strobl 2f352b42de MFC: r217464, r217468, r217475
Add a manual page for rgephy(4) and reference it as appropriate. The
motivation for having rgephy.4 is to document the special media option
added in r217415 (MFC'ed to releng/8.2 in r217666).

Approved by:	re (kib)
2011-01-21 14:05:11 +00:00
Marius Strobl 22b5bd6143 MFC: r217415
- Allow IFM_FLAG0 to be set indicating that auto-negotiation with manual
  configuration, which is used to work around issues with certain setups
  (see r161237) by default, should not be triggered as it may in turn
  cause harm in some edge cases.
- Even after masking the media with IFM_GMASK the result may have bits
  besides the duplex ones set so just comparing it with IFM_FDX may lead
  to false negatives.
- Announce PAUSE support also for manually selected 1000BASE-T, but for
  all manually selected media types only in full-duplex mode. Announce
  asymmetric PAUSE support only for manually selected 1000BASE-T.
- Simplify setting the manual configuration bits to only once after we
  have figured them all out. This also means we no longer unnecessarily
  update the hardware along the road.
- Remove a stale comment.

Reviewed by:	yongari (plus additional testing)
Approved by:	re (bz)
2011-01-21 00:02:25 +00:00
Pyun YongHyeon 9eabd3a03a MFC r217296:
For re(4) controllers that uses new jumbo frame scheme(RTL8168C/D/E),
  limit maximum RX buffer size to RE_RX_DESC_BUFLEN instead of
  blindly configuring it to 16KB. Due to lack of documentation, re(4)
  didn't allow jumbo frame on these controllers. However it seems
  controller is confused with jumbo frame such that it can DMA the
  received frame to wrong address instead of splitting it into
  multiple RX buffers. Of course, this caused panic.

  Since re(4) does not support jumbo frames on these controllers,
  make controller drop frame that is longer than RE_RX_DESC_BUFLEN
  sized frame. Fortunately RTL810x controllers, which do not support
  jumbo frame, have no such issues but this change also limited
  maximum RX buffer size allowed to RTL810x controllers. Allowing
  16KB RX buffer for controllers that have no such capability is
  meaningless.

Approved by:	re (bz)
2011-01-20 17:41:24 +00:00
Warner Losh fcd31ae7a3 MF8 r217553:
The cxgb module wasn't being built.  Now it is built on all !arm and
!mips builds.  It always built in a kernel config file.

Approved by:    re (bz)
2011-01-20 15:56:03 +00:00
Rick Macklem b8f49f78cf MFC: r217242
Fix a bug in the client side krpc where it was, sometimes
erroneously, assumed that 4 bytes of data were in the first
mbuf of a list by replacing the bcopy() with m_copydata().
Also, replace the uses of m_pullup(), which can fail for
reasons other than not enough data, with m_copydata().
For the cases where it isn't known that there is enough
data in the mbuf list, check first via m_len and m_length().
This is believed to fix a problem reported by dpd at dpdtech.com
and george+freebsd at m5p.com.

Reviewed by:	jhb (for head)
Approved by:	re (kib)
2011-01-20 00:54:12 +00:00
Colin Percival 4d1edd49d4 MFS r217408: Don't use amdc1e on XEN && !XEN_PRIVILEGED. This fixes a
panic when booting FreeBSD/XEN on recent AMD CPUs.

Approved by:	re (bz)
2011-01-19 21:03:22 +00:00
Hiroki Sato cd13d68f16 Clean up old items.
Approved by:	re (implicit)
2011-01-18 15:46:04 +00:00
Daniel Eischen 0abe01cfd4 MFC: 217169
Make sure to always do source address selection on
an unbound socket, regardless of any multicast options.
If an address is specified via a multicast option, then
let it override normal the source address selection.

This fixes a bug where source address selection was
not being performed when multicast options were present
but without an interface being specified.

Approved by:	re
2011-01-11 19:43:35 +00:00
Ken Smith 4e5edfb630 Ready for 8.2-RC2.
Approved by:	re (implicit)
2011-01-11 04:20:18 +00:00
Pyun YongHyeon 91b4c841e3 MFC r217226:
Apply DMA address space restriction to controllers that have 4GB
  DMA boundary bug and runs with PCI-X mode.  watchdog timeout was
  observed on BCM5704 which lives behind certain PCI-X bridge(e.g.
  AMD 8131 PCI-X bridge).  It's still not clear whether the root
  cause came from that PCI-X bridge or not. The watchdog timeout
  indicates the issue is in TX path. If the bridge reorders TX
  mailbox write accesses it would generate all kinds of problems but
  I'm not sure.  This should be revisited.

  Early MFC requested by re@ for inclusion in 8.2-RC2/7.4-RC2.

  Tested by:	Michael L. Squires (mikes <> siralan dot org)
  Approved by:	re (kensmith)
2011-01-10 19:55:30 +00:00
Hiroki Sato 4e7506a231 - Bump version numbers for the upcoming release.
- Clean up old entries.

Approved by:	re (implicit)
2011-01-10 18:02:47 +00:00
Colin Percival 3fbd26f3c8 MFS r217050: Make minidumps work on i386/XEN.
Approved by:	re (rwatson)
2011-01-07 23:11:19 +00:00
Brian Somers 5b716003b5 MFC r216832: Make -S functional
Approved by:	re (kib)
2011-01-07 18:33:26 +00:00
Martin Matuska bbeef59281 MFC r216919:
MFp4 186485, 186859:
Fix a race by defining two tasks in the zio structure
as we can still be returning from issue task when interrupt task is used.

Reviewed by:	pjd
Approved by:	re (kib), pjd
2011-01-07 14:17:29 +00:00
Lawrence Stewart c97cb52697 MFC r210144 (originally committed by imp):
Put warnings out to stderr rather than stdout.

Approved by:	re (kib)
2011-01-07 01:46:27 +00:00
Colin Percival 734510f3bc MFS r217056: Make i386_set_ldt work (rather than panic) on i386/XEN.
Approved by:	re (rwatson)
2011-01-06 22:57:06 +00:00
Colin Percival 002fe711cc MFS r217055: Don't panic when a disk is detached on XEN.
Approved by:	re (rwatson)
2011-01-06 22:55:53 +00:00
Colin Percival af0dacb525 MFS r217053: Fix the Xen console to not spew \0 bytes when there is no
input available.

Approved by:	re (rwatson)
2011-01-06 22:54:48 +00:00
Colin Percival 826cbb729b MFS r217052: Fix a panic when gstat exits or when 'mdconfig -l' is run,
on i386/XEN.

PR:		kern/141328
Approved by:	re (rwatson)
2011-01-06 22:53:55 +00:00
Colin Percival d6c643a09c MFS r217051: Fix panic when mlock(2) is used on i386/XEN.
PR:		kern/140313
Approved by:	re (rwatson)
2011-01-06 22:52:52 +00:00
Jung-uk Kim 11f9046dcc MFC: r216940
Fix parameters for wakeup(9) and tsleep(9).

Approved by:	re (kib)
2011-01-06 18:00:34 +00:00
Gavin Atkinson 66fd28e391 MFC r216892 from head (Which is an MFi386 of r216012 by kib)
Calling fill_fpregs() for curthread is legitimate, and ELF coredump
does this.

Discussed with:	kib
Approved by:	re (kib)
2011-01-05 22:14:18 +00:00
Benedict Reuschling f3a6088906 MFC r211397:
Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages.  Minor corrections by me.

Submitted by:   Nobuyuki Koganemaru <n-kogane <at> syd.odn.ne.jp>

Approved by:    re (kib)
2011-01-05 17:10:10 +00:00
Marius Strobl bac8985170 MFC: r216891
Extend the section in which interrupts are disabled in the TLB demap
functions, otherwise if we get preempted after checking whether a certain
pmap is active on the current CPU but before disabling interrupts we might
operate on an outdated state as the pmap might have been deactivated in
the meantime. As the same issue may arises when the TLB demap function is
interrupted by a TLB demap IPI, just entering a critical section before
the check isn't sufficient so we have to fully disable interrupts instead.

Approved by:	re (kib)
2011-01-05 13:40:35 +00:00
John Baldwin 8443db222a MFC 216769:
Start sentences on a new line to ease life for translators.  Tweak the
wording in a few places.

Approved by:	re (kib)
2011-01-04 15:53:38 +00:00
John Baldwin 289325de99 MFC 216679:
Drop the icu_lock spinlock while pausing briefly after masking the
interrupt in the I/O APIC before moving it to a different CPU.

Approved by:	re (kib)
2011-01-03 18:22:22 +00:00
Bernhard Schmidt 19b9d36ce0 MFC r216824:
The RX path is missing a few bus_dmamap_*() calls, this results in
modification of memory which was already free'd and eventually in:
wpi0: could not map mbuf (error 12)
wpi0: wpi_rx_intr: bus_dmamap_load failed, error 12
and an usuable device.

PR:		kern/144898
Approved by:	re (kib)
2011-01-02 10:01:29 +00:00
Bjoern A. Zeeb 36fcec625c MFC r216848:
Happy New Year 2011.

  Approved by:	core (kib)

Approved by:	re (kib)
2010-12-31 18:32:13 +00:00
Rick Macklem 2a51e84ec7 MFC: r216691
Since VOP_READDIR() for ZFS does not return monotonically
increasing directory offset cookies, disable the UFS related
loop that skips over directory entries at the beginning of
the block for the experimental NFS server. This loop is
required for UFS since it always returns directory entries
starting at the beginning of the block that
the requested directory offset is in. In discussion with pjd@
and mckusick@ it seems that this behaviour of UFS should maybe
change, with this fix being an interim patch until then.
This patch only fixes the experimental server, since pjd@ is
working on a patch for the regular server.

Approved by:	re (kib)
2010-12-29 21:04:10 +00:00
Simon L. B. Nielsen 6a21347126 MFS r216725:
Fix deprecated warning about -L which said -i was deprecated.

Approved by:	re (kib)
2010-12-29 14:06:20 +00:00
Oleg Bulyzhin 73bbba41f4 MFC r213265:
Fix handling of initial credit for an idle pipe.  This fixes the bug where
setting bw > 1 MTU/tick resulted in infinite bandwidth if io_fast=1

PR:		kern/147245, kern/148429
Obtained from:	Riccardo Panicucci
Approved by:	re (bz)
2010-12-28 12:18:46 +00:00
Oleg Bulyzhin 127e3f3f48 MFC r203548:
Propagate the vlan events to the underlying interfaces/members so they
can do initialization of hw related features.

PR:		kern/141646
Approved by:	re (bz)
2010-12-27 18:55:16 +00:00
Hiroki Sato 83a7e8d5f1 - route(8) manual page update: no longer supports RTF_CLONING and
RTF_LLINFO (MFC from r196833)

- Remove -cloning flag from network.subr[*]

PR:		conf/144842 [*]
Approved by:	re (bz)
2010-12-27 16:02:14 +00:00
Andrew Thompson 561acb0880 MFC r216249
Re-add a status check which sneaked out during r214804.
 This change can fix some USB error messages showing up
 during bootup.

Approved by:	re (kib)
2010-12-26 18:15:57 +00:00
Michael Tuexen 0505165f61 MFC c216502:
Fix a flightsize bug related to the processing of PKTDRP reports.

Approved by: re
2010-12-26 17:29:26 +00:00
Konstantin Belousov e846cffa05 MFC r216572:
Restore the ABI of struct kinfo_proc32 after r213536.

Approved by:	re (bz)
2010-12-26 15:15:28 +00:00
Konstantin Belousov a316a73e5f MFC r216454:
VOP_ISLOCKED() should not be used to determine if the vnode is locked.
Explicitely track the locked status of the vnode.

Approved by:	re (bz)
2010-12-26 15:13:28 +00:00
Konstantin Belousov 0f8bab7507 MFC r216453:
Add the missed 'p' flag to getopt() optstring argument.

Approved by:	re (bz)
2010-12-26 15:00:14 +00:00
Bernhard Schmidt 60036d10ef MFC r216557:
Fix panic while trying to use monitor mode. The iwn_cmd() calls issued by
iwn_config() want to msleep() on the mutex.

PR:		kern/138427
Submitted by:	Henry Hu <henry.hu.sh at gmail.com>
Approved by:	re (kib)
2010-12-26 14:10:12 +00:00
Ken Smith 2cb77c4770 Ready for RC1 builds.
Approved by:	re (implicit)
2010-12-22 15:06:45 +00:00
Nathan Whitehorn 213d35c96a MFC r216469:
Fix the overflowing livefs ISO by removing man pages from the HFS part of
the hybrid disk. This is a stopgap until a better solution can be found,
but lets the powerpc release build complete for the time being.

Approved by:	re (kensmith)
2010-12-22 14:49:18 +00:00
Ken Smith 95577b8c3e Add packages-7.4-release and packages-8.2-release for the upcoming
releases.

Approved by:	re (implicit)
2010-12-22 04:56:55 +00:00
Ken Smith cbe5be9f3d Adjust __FreeBSD_version for the 8.2 release.
Approved by:	re (implicit)
2010-12-22 04:51:05 +00:00
Ken Smith 8db9e9b0d3 Adjust branch tag in example.
Approved by:	re (implicit)
2010-12-22 04:47:14 +00:00
Ken Smith 32b9734d04 Misc. 8.1 -> 8.2 adjustments for the 8.2 release.
Approved by:	re (implicit)
2010-12-22 04:44:38 +00:00
Ken Smith 25027f3b94 Adjust the FreeBSD version printed as part of manual pages.
Approved by:	re (implicit)
2010-12-22 04:40:58 +00:00
Ken Smith bec84832e7 Adjust branch tag for 'make update'.
Approved by:	re (implicit)
2010-12-22 04:37:44 +00:00
Michael Tuexen f6354cb776 MFC c216495:
Bugfix: Take also the nr-mapping array into account when detecting
       gaps.
Approved by: re@
2010-12-21 10:43:51 +00:00
Andrew Thompson ff8ea4d8a3 MFC r216371:
Fix race in devfs by using LIST_FIRST() instead of
 LIST_FOREACH_SAFE() when freeing the devfs private
 data entries.

Approved by:	re (kib)
2010-12-21 09:31:48 +00:00
Bernhard Schmidt b36a7fc70e Add 2 missing bus_dmamap_sync() calls. Those fix random 'scan timeout',
'could not set power mode', 'device config failed' and other errors due
reading invalid memory.

Approved by:	re (kib)
Obtained from:	OpenBSD
2010-12-21 09:16:42 +00:00
Bernhard Schmidt 5473116ec6 Fix association on 5GHz channels. The device is initially configured using
a 2GHz channel with appropriate flags set to sc->config. Due to not zeroing
sc->config for auth/assoc those flags are still set while trying to connect
on a 5GHz channel.

Approved by:	re (kib)
2010-12-21 09:14:59 +00:00
Bernhard Schmidt ff9a6e3826 Fix a panic while disabling the RF kill button, caller of the
wpi_rfkill_resume() function will take care of the lock.

PR:		kern/14489
Approved by:	re (kib)
2010-12-21 09:13:24 +00:00
Colin Percival cb943a98c2 MFC Xen-related commits r215470, r215472, r215525, r215663, r215813, r215819,
r215844, r216041, r216241, r216280, r216382, and r216385.

* Make blkfront not advertise a larger maximum I/O size than it can handle
  for unaligned data (r216241)
* Correctly reserve CPU #0's DPCPU pages (r216041)
* Make machdep.independent_wallclock do what it claims (r216382)
* Don't round xen timecounter to the nearest tick (r215663), but decrease
  its frequency to avoid wrapping at ~4.3s (r216385)
* Remove debugging code which caused a massing slowdown in fork-heavy
  workloads (r215813)
* Add a missing page table flush before invalidating TLBs in pmap_qremove
  (r215819+215844)
* In pmap_release, don't unpin pages which weren't pinned (r215525) and don't
  KASSERT page mappings which don't exist (r215470); but do pmap_qremove all
  the relevant pages (r215472)
* Don't unmask an event channel until after we register the interrupt handler
  for it (r216280)

Approved by:	re (rwatson)
2010-12-20 20:39:49 +00:00
John Baldwin a5ba914f27 MFC 216504:
Add back a bounds check on valid idle priorities that was lost in an
earlier commit.  While here, move the thread lock down in rtp_to_pri().
It is not needed for all of the priority value checks and the computation
of newpri.

Approved by:	re (kib)
2010-12-20 17:08:22 +00:00
Doug Barton e9e9c992e1 Pull svn:mergeinfo up from subdirectories and files onto etc/ where it
belongs.

Approved by:	re (kib)
2010-12-19 21:51:11 +00:00
Joerg Wunsch 21e3bc4e3b Fix __retval vs. retval confusion: retval is meant to store the (userland)
pointer where data is to be returned by ibask() (currently unimplemented),
while __retval holds the value returned by the libgpib ibfoo() functions.

The confusion resulted in the ibfoo() functions returning an uninitialized
value except in situations where the GPIB activity has been terminated
abnormally.

Implement more of __ibsta: END and SRQI status bits (taken out of the
uPD7210 IRQ status).

Approved by:	re (kib)
2010-12-19 21:33:28 +00:00
Doug Barton 3680ebfda9 MFC r216187:
Add MAKEDEV.8

Submitted by:	Alex Kozlov <[email protected]>

Approved by:	re (kib)
2010-12-19 20:12:17 +00:00
Doug Barton 267756367f MFC r215824:
Add a sync to the shutdown step. In the common case this will be
harmless at worst. On a heavily loaded server it will give the fs a
chance to do its business without the axe hanging over its head.

Submitted by:	ivoras

Approved by:	re (kib)
2010-12-19 20:10:48 +00:00
Max Laier a30cb0df09 MFC r216335:
Fix a long standing (from the original 4.4BSD lite sources) race between
  vmspace_fork and vm_map_wire that would lead to "vm_fault_copy_wired: page
  missing" panics.  While faulting in pages for a map entry that is being
  wired down, mark the containing map as busy.  In vmspace_fork wait until
  the map is unbusy, before we try to copy the entries.

  Sponsored by:	Isilon Systems, Inc.

Approved by:	re (kib)
2010-12-19 06:07:35 +00:00
Robert Watson a8bec26211 Merge xen.4 man page from head to stable/8; revs r216419, r216420, r216428,
r216429, r216497, r216500, r216501, r216509.

Approved by:	re (kib)
Sponsored by:	DARPA, AFRL
2010-12-18 23:03:01 +00:00
Michael Tuexen bb340a5bce MFC 216480:
Add a missing cast. Reported by blade_ly at yahoo.com.cn.

Approved by: re (kib)
2010-12-18 11:45:54 +00:00
Xin LI 7997db5e16 MFC r216130:
Decode IPC_CREAT and IPC_EXCL for semget(2).

PR:		bin/152781
Submitted by:	Anton Yuzhaninov <citrin citrin ru>
Approved by:	re (kib)
2010-12-17 19:48:54 +00:00
Rebecca Cran ca921e40b3 MFC r216407:
USB probing often takes a long time and finishes finding devices after init
has started. In the case of sysinstall, this means that it has already built
its list of devices before probing finishes. Add a hint for users who have
booted from a USB stick only to find that sysinstall can't find it.

Approved by:	re (kensmith)
2010-12-16 14:57:06 +00:00
Michael Tuexen 839afafa20 MFC r216397:
Bugfix: Do correct accounting using the MIB counters when an
        association is aborted via sctp_abort_association().

Approved by: re
2010-12-16 10:58:45 +00:00
Jack F Vogel 727998f369 MFC r216173
Remove the test for a minimum frame size from the IPV6 TX context
descriptor setup, when using VLANs and HW TAGGING the length of
an ICMP6 frame will fail this test and be discarded.

Approved by: re
2010-12-15 22:59:50 +00:00
Konstantin Belousov d94ce5c656 MFC r216255:
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.

Approved by:	re (bz)
2010-12-15 15:25:56 +00:00
Konstantin Belousov 7b0c064d09 MFC r216253:
Retire write-only PCB_FULLCTX pcb flag on amd64.

Approved by:	re (bz)
2010-12-15 15:23:25 +00:00
Martin Matuska 90667b0271 MFC r209230 (pjd):
Remove redundant assignment.

Approved by:	re (kib), pjd, delphij (mentor)
2010-12-15 15:19:17 +00:00
Konstantin Belousov 4de5c58890 MFC r216394:
In fpudna()/npxdna(), mark FPU context initialized and optionally
mark user FPU context initialized, if current context is user context.
It was reversed in r215865, by inadequate change of this code fragment
to a call to fpuuserinited()/npxuserinited().

Approved by:	re (bz)
2010-12-15 15:15:42 +00:00
Alexander Motin 40f60518a9 MFC r216309:
Add IDs of HighPoint RocketRAID 62x cards (Marvell 88SE9128 chips).

PR:             kern/152926
Submitted by:   Mike Tancsa <[email protected]>
Approved by:	re (kib)
2010-12-15 08:27:17 +00:00
Jung-uk Kim 5aaa196938 MFC: r210780
Rearrange struct pcb to make better use of cache lines.

Approved by:	re (kib)
2010-12-14 20:19:41 +00:00
Jack F Vogel 1ba7d2e383 MFC r216172, r216176:
Correct the RX discard and refresh_mbuf logic to match igb, the old
discard code could cause panics due to a bad pointer, now simply
have discard always free mbufs and depend on refresh. In the refresh
code, make sure the mbuf and soft buf struct are properly reset.

Approved by: re
2010-12-14 19:59:39 +00:00
Martin Matuska e3d59ad343 MFC r208683, r210999, r212385:
MFC r208683 (pjd):
Fix a bug where resilver is not started automatically on pool import or load.
If disk was missing on pool load or import and on next pool load or import
it was present, resilver wasn't started automatically and ZFS reported all
disks as ONLINE and healthy. Then, when another disk died, pool became
unaccessible, because if it was 2-way mirror or RAIDZ1 two vdevs were
out of sync.

To fix the problem, start resilver automatically on pool load or import.

Obtained from:	OpenSolaris

MFC r210999 (pjd):
In FreeBSD we use 'jailed' property.

MFC r212385 (pjd):
On FreeBSD we can log from pool that have multiple top-level vdevs or log
vdevs, so don't deny adding new vdevs if bootfs property is set.

Approved by:	re (kib), pjd, delphij (mentor)
2010-12-14 15:36:47 +00:00
Martin Matuska bd2682b870 MFC r210044, r214622:
MFC r210044 (pjd):
MFp4 180933:

Initialize rw_count properly so that zdb(8) doesn't trigger assertion in
rw_enter():

	ASSERT(rwlp->rw_count == 0);

While here, assert that rw_count is 0 when destroying the lock.

MFC r214622 (pjd):
1. Remove invalid assertion.
2. Properly recalculate delta in case pthread_cond_timedwait() is interrupted.
3. Style fix.

Reported by:	[1] App Deb <[email protected]>

Approved by:	re (kib), pjd, delphij (mentor)
2010-12-14 15:33:59 +00:00
Tijl Coosemans e90c016924 MFC r216351:
Add a .note.ABI-tag section to ia64 startup files by linking crtbrand.c
in crt1.o. On other architectures crtbrand.c is included from crt1.c,
but that's not a C source code file on ia64. Instead it is compiled
separately and included in crt1.o using incremental linking.

Approved by:	re (kensmith), kib (mentor)
2010-12-14 15:33:48 +00:00
Rick Macklem 5561edbf8f MFC: r216330
Disable attempts to establish a callback connection from the
experimental NFSv4 server to a NFSv4 client when delegations are not
being issued, even if the client advertises a callback path.
This avoids a problem where a Linux client advertises a
callback path that doesn't work, due to a firewall, and then
times out an Open attempt before the FreeBSD server gives up
its callback connection attempt. (Suggested by
drb at karlov.mff.cuni.cz.) The server should probably have
a 1sec timeout on callback connection attempts when there are
no delegations issued to the client, but that patch will require
changes to the krpc and this serves as a work around until then.

Tested by:	drb at karlov.mff.cuni.cz
Approved by:	re (kib)
2010-12-14 13:45:57 +00:00
Bernhard Schmidt 0944b76cb2 MFC r216237:
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.

Approved by:	re (kib)
2010-12-13 17:56:31 +00:00
Bernhard Schmidt 262a2423dc MFC r216238:
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.

Approved by:	re (kib)
2010-12-13 17:53:41 +00:00
Robert Watson 2c67f7bfca Merge r216365 from head to stable/8:
Derive the XENHVM kernel from GENERIC, adding only the options required
  to support PV drivers (such as xenpci), and non-adptive locking (along
  with a comment about why).

  This change eliminates the synchronisation problem between GENERIC and
  XENHVM, which had become severely rotted in HEAD, and in 8-STABLE
  included non-production kernel debugging features such as WITNESS.

  However, it comes at the cost of enabling devices and options that may
  not be present under Xen (such as random ethernet cards).  For now, opt
  for a simpler kernel configuration file rather than using nooptions/
  nodevice to enumerate and eliminate them.  This leads to a somewhat
  larger XENHVM kernel.

  This is an MFC candidate for 8-STABLE before 8.2, in order to provide
  a production-worthy XENHVM kernel configuration for amd64.

  Discussed with:       gibbs, cperciva
  Reported by:          Piete Brooks <Piete.Brooks at cl.cam.ac.uk>
  Sponsored by:         DARPA, AFRL

Approved by:	re (kib)
2010-12-13 12:34:35 +00:00
Konstantin Belousov 5d8370ef13 MFC r216231:
Do not leak %rdx value in the previous image to the new image after
execve(2).

Approved by:	re (bz)
2010-12-13 10:40:16 +00:00
Michael Tuexen 7e0a20994c MFC r216188:
Fix a bug where also the number of non-renegable gap reports
was considered to be potentially renegable.

Approved by: re
2010-12-13 10:27:35 +00:00
Bernhard Schmidt 609c1b63c1 MFC r216195:
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.

Approved by:	re (kib)
2010-12-12 10:27:11 +00:00
Martin Matuska b6641bc6e6 MFC r216291, r216293:
MFC r216291:
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.

MFC r216293:
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).

Reported by:	James R. Van Artsdalen (on [email protected])
Reviewed by:	pjd
Approved by:	re (kib), delphij (mentor)
2010-12-11 23:48:10 +00:00
Jack F Vogel bfcd155399 Remove bogus logic in the TX path, when using
VLANs and HW_TAGGING in IPv6 the tag is not yet
in the frame, and thus an ICMP6 packet fails this
condition and does not get sent.

Approved by: re
2010-12-10 22:59:09 +00:00
Bjoern A. Zeeb e1b8235ab4 MFC r216277:
Loosen the locking in nd6-free() again after r216022 (r216118 in stable/8)
  to avoid a LOR and a recursed lock.

  Reported by:	delphij
  Tested by:	delphij
PR:		kern/148857
Approved by:	re (kib)
2010-12-10 15:37:54 +00:00
Bjoern A. Zeeb 178242e599 MFC r216192:
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)

Approved by:	re (kib)
2010-12-10 14:06:50 +00:00
Konstantin Belousov 60e88cb2b7 MFC r216151:
Extend the unix gc regression test to cover the case of r216150.

Approved by:    re (bz)
2010-12-10 11:02:59 +00:00
Konstantin Belousov 5ef3b35244 MFC r216150, r216158:
If unix socket has a unix socket attached as the rights that has a
unix socket attached as the rights that has a unix socket attached as
the rights ... Kernel may overflow the stack on attempt to close such
socket.

Only close the rights file in the context of the current close if the
file is not unix domain socket. Otherwise, postpone the work to
taskqueue, preventing unlimited recursion.

Approved by:	re (bz)
2010-12-10 10:48:54 +00:00
Konstantin Belousov 8448e9c31f MFC r216149:
Add SLIST_SWAP() macro.

Approved by:	re (bz)
2010-12-10 10:37:53 +00:00
Andrey V. Elsukov 349ed44a42 MFC r213254 by luigi:
fix breakage in in-kernel NAT: the code did not honor
   net.inet.ip.fw.one_pass and always moved to the next rule
   in case of a successful nat.

   This should fix several related PR (waiting for feedback
   before closing them)

   PR:		145167 149572 150141

Approved by:	re (bz)
2010-12-10 05:18:37 +00:00
Andrey V. Elsukov 0b7983acb9 MFC r206494 by luigi:
fix a buffer overflow with large (100k+) number of input lines.

Approved by:	re (bz)
2010-12-10 05:15:47 +00:00
Xin LI 86239df87a MFC r216040:
Make German formal clause to be consistent with the keymap counterpart.

Submitted by:	arundel
Approved by:	re (kensmith, bz)
2010-12-10 00:52:54 +00:00
Simon L. B. Nielsen 069f2e4127 MFC r216166, r216167:
Merge in OpenSSL 0.9.8q.

Approved by:	re (kib)
Security:	CVE-2010-4180
Security:	http://www.openssl.org/news/secadv_20101202.txt
2010-12-09 22:03:53 +00:00
Rebecca Cran b5489c3fe1 MFC r216229:
Revert r209469: it causes the rest of the function to be bypassed.

Approved by:	re (kensmith)
2010-12-09 15:26:38 +00:00
Rebecca Cran 49141242b5 MFC r216243:
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.

Approved by:	re (kensmith)
2010-12-09 15:24:59 +00:00
Doug Barton 01d849e5f4 Update to version 9.6-ESV-R4, the latest from ISC, which addresses
the following security vulnerabilities.

For more information regarding these issues please see:
http://www.isc.org/announcement/guidance-regarding-dec-1st-2010-security-advisories

1. Cache incorrectly allows ncache and rrsig for the same type

   http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-3613

   Affects resolver operators whose servers are open to potential
   attackers. Triggering the bug will cause the server to crash.

   This bug applies even if you do not have DNSSEC enabled.

2. Key algorithm rollover

   http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-3614

   Affects resolver operators who are validating with DNSSEC, and
   querying zones which are in a key rollover period. The bug will
   cause answers to incorrectly be marked as insecure.

Approved by:	re (kensmith)
2010-12-08 19:59:53 +00:00
Colin Percival 4c66a20143 MFC r216194 / MFamd64 r206610: Enforce stronger alignment semantics in
order to unbreak the Xen blkfront driver.

Approved by:	re (kib)
2010-12-08 19:48:29 +00:00
Doug Barton 702f62f965 MFC r216065:
Update the description of green_saver.ko

Improvements to my suggested text from: jhb

Approved by:	re (kib)
2010-12-08 07:00:22 +00:00
Edward Tomasz Napierala a11f7ab1b8 MFC r216084:
Don't panic when we read an empty ACL from ZFS.  Apparently this may happen
with filesystems created under MacOS X ZFS port.  This is kind of filesystem
corruption (we don't allow for setting empty ACLs), so make acl_get_file(3)
and related syscalls fail with EINVAL in that case.  In theory, we could
return empty ACL to userland, but I'm afraid this would break some code.

Approved by:	re (kib)
2010-12-07 22:00:48 +00:00
Pyun YongHyeon e32b95d037 MFC r216111:
If RX lockup workaround is enabled, fxp(4) will periodically reset
  the controller to workaround silicon bug of i82557. Each reset will
  re-establish link which in turn triggers MII status change
  callback. The callback will try to reconfigure controller if the
  controller is not i82557 to enable flow-control. This caused
  endless link UP/DOWN when the workaround was enabled on non-i82557
  controller.

  To fix the issue, apply RX lockup workaround only for i82557.
  Previously it blindly checked undocumented EEPROM location such
  that it sometimes enabled the workaround for other controllers. At
  this time, only i82557 is known to have the silicon bug.
  This fixes a regression introduced in r215906 which enabled flow
  control support for all controllers except i82557.

  Reported by:	Karl Denninger (karl <> denninger dot net)
  Tested by:	Karl Denninger (karl <> denninger dot net)
  Approved by:	re (kensmith)
2010-12-07 19:14:18 +00:00
Jung-uk Kim 027173a099 MFC: r216159
Do not change CPU ticker frequency if TSC is P-state invariant.

Approved by:	re (kib)
2010-12-07 18:14:38 +00:00
Maksim Yevmenkin 62ee2d80dd MFC r215195
Add firmware downloader for Atheros AR3011 based USB Bluetooth devices.

Hardware donated by:	Rusty Nejdl rnejdl at ringofsaturn dot com
Tested by:		Rusty Nejdl rnejdl at ringofsaturn dot com
Tested by:		Andrzej Tobola ato at iem dot pw dot edu dot pl
Approved by:		re
2010-12-06 22:45:29 +00:00
Colin Percival 414aca6345 MFC r215105: Uninitialized buffers considered harmful.
Approved by:	re (bz)
2010-12-03 22:47:53 +00:00
Konstantin Belousov ce1680a85b MFC r209463:
Fix bugs on pc98, use npxgetuserregs() instead of npxgetregs() for
get_fpcontext(), and npxsetuserregs() for set_fpcontext). Also,
note that usercontext is not initialized anymore in fpstate_drop().

Systematically replace references to npxgetregs() and npxsetregs()
by npxgetuserregs() and npxsetuserregs() in comments.

MFC r215865:
Remove npxgetregs(), npxsetregs(), fpugetregs() and fpusetregs()
functions, they are unused. Remove 'user' from npxgetuserregs()
etc. names.

For {npx,fpu}{get,set}regs(), always use pcb->pcb_user_save for FPU
context storage.

MFC r216012:
Calling fill_fpregs() for curthread is legitimate, and ELF coredump
does this.

Approved by:	re (bz)
2010-12-03 22:07:07 +00:00
Konstantin Belousov 4589447531 MFC r216120:
For /proc/<pid>/{regs,fpregs} read access, require the thread to be in
stopped state. Otherwise, return EBUSY as is done for write case.

Approved by:	re (bz)
2010-12-03 21:52:01 +00:00
Konstantin Belousov c1e7a3bba6 MFC r215864:
MFaesni r215427:
Only save FPU context when not executing in the context of the crypto
thread.

Approved by:	re (bz)
2010-12-03 16:40:47 +00:00
Colin Percival 3582672c17 MFC r216077: Teach crashinfo(8) about the kern.bootfile sysctl.
Approved by:	re (bz)
2010-12-03 16:21:12 +00:00
John Baldwin 1c99e2e6b7 MFC 215820:
Add device IDs for two more ServerWorks Host-PCI bridges so that we can
read their starting PCI bus number for older systems that do not support
ACPI (or have a broken _BBN method).

Approved by:	re (kib)
2010-12-02 15:58:54 +00:00
Bjoern A. Zeeb 9e5f21cd5d MFC r216022:
Plug well observed races on la_hold entries with the callout handler.

  Call the handler function with the lock held, return unlocked as we
  might free the entry. Rework functions later in the call graph to be
  either called with the lock held or, only if needed, unlocked.

  Place asserts to document and tighten assumptions on various lle locking,
  which were not always true before.

  We call nd6_ns_output() unlocked and the assignment of ip6->ip6_src was
  decentralized to minimize possible complexity introduced with the formerly
  missing locking there. This also resulted in a push down of local
  variable scopes into smaller blocks.

  Reported by:	many
  Submitted by:	Dmitrij Tejblum (tejblum yandex-team.ru) (original version)
Tested by:	remko
PR:		kern/148857
Approved by:	re (kib)
2010-12-02 10:39:44 +00:00
Rebecca Cran fabf38386d MFC r216052:
Update the serial port device names. They changed in 8.0 because the
default driver is now uart(4).

PR:	bin/140887
Submitted by:	Joe Barbish <fbsd1 at a1poweruser.com>

MFC r216053:
If no floppy drive is installed kldBrowser() can generate an error
early on. Initialize menu and count so the cleanup code doesn't try
and use their uninitialized values.

PR:	bin/152270
Submitted by:	Remi LAURENT <cloud at madpowah.org>

Approved by:	re (kensmith)
2010-12-02 09:09:46 +00:00
Konstantin Belousov ac537c74a1 MFC r215838:
Account i/o done on cdevs.

Approved by:	re (bz)
2010-12-02 00:49:02 +00:00
Konstantin Belousov ff54e8af50 MFC r215798:
Remove the note about possible unlocking during vunref(9).

Approved by:	re (bz)
2010-12-01 15:31:31 +00:00
Konstantin Belousov 8b8aa75526 MFC r215797:
Allow shared-locked vnode to be passed to vunref(9).

Approved by:	re (bz)
2010-12-01 15:28:23 +00:00
Justin T. Gibbs 118980da1b Merge revision 211236 form current:
Allow interrupt driven config hooks to be registered from config hook callbacks.

Interrupt driven configuration hooks serve two purposes: they are a
mechanism for registering for a callback that is invoked once interrupt
services are available, and they hold off root device selection so long
as any configuration hooks are still active.  Before this change, it was
not possible to safely register additional hooks from the context of a
configuration hook callback.  The need for this feature arises when
interrupts are required to discover new devices (e.g. access to the XenStore
to find para-virtualized devices) which in turn also require the ability
to hold off root device selection until some lengthy, interrupt driven,
configuration task has completed (e.g. Xen front/back device driver
negotiation).

More specifically, the mutex protecting the list of active configuration
hooks is never held during a callback, and static information is used
to ensure proper ordering and only a single callback to each hook even
when faced with registration or removal of a hook during an active run.

Sponsored by:	Spectra Logic Corporation
Approved by:	re (kib)
2010-11-30 22:25:44 +00:00
Konstantin Belousov b2eda75f34 MFC r215942:
Remove DEBUG sections.

Approved by:	re (bz)
2010-11-30 08:39:05 +00:00
Andrew Gallatin 2c89e3f8d5 MFC 215686:
Fix a TSO checksum bug on mxge(4):

The Myri10GE NIC will assume all TSO frames contain partial checksum,
and will emit TSO segments with bad TCP checksums if a TSO frame
contains a full checksum.  The mxge driver takes care to make sure
that TSO is disabled when checksum offload is disabled for this
reason.  However, modules that modify packet contents (like pf) may
end up completing a checksum on a TSO frame, leading to the NIC emitting
TSO segments with bad checksums.

To workaround this, restore the partial checksum in the mxge driver
when we're fed a TSO frame with a full checksum.
2010-11-29 13:36:20 +00:00
Kevin Lo 58b5de998c Revert previous change since it's without proper MFC period.
Requested by kib
2010-11-29 10:22:45 +00:00
Kevin Lo d00f51ed9e MFC r216047:
Fix fd leak in get_font
2010-11-29 09:24:03 +00:00
Attilio Rao 37b326a99c MFC r215821:
Add a missing CTL description from CVS revision 1.147.

Sponsored by:	Sandvine Incorporated
2010-11-29 08:16:48 +00:00
Attilio Rao cf011b5d11 MFC r215758,215811:
Make this printf output more verbose.

Sponsored by:	Sandvine Incorporated
2010-11-29 08:12:21 +00:00
Attilio Rao 463a196ef8 MFC r215544,215683:
Scan the list in reverse order for the shutdown handlers of loaded modules.
This way, when there is a dependency between two modules, the handler of the
latter probed runs first.

Sponsored by:	Sandvine Incorporated
2010-11-29 08:04:10 +00:00
Garance A Drosehn b96021a9a4 = MFC of r211190:
- Improve the wait4data() routine so it behaves better when checking
  print-jobs which have last-modification times that are in the future.
  This shouldn't happen, of course, but it can.  And when it did happen,
  the previous check could cause completely-spooled jobs to sit in the
  queue for 20 minutes per job.  The new code waits until the last-modify
  time is not changing, instead of making decisions based on the specific
  value of last-modify.
2010-11-29 04:57:46 +00:00
Matt Jacob 3b2de37969 This is an MFC of 208548
Don't leak CCBs for every ABORT.
2010-11-29 04:31:25 +00:00
Matt Jacob 831647ae0f This is an MFC of 208542,208543
Treat PRLI the same as PLOGI and make a database entry for it (target mode).
2010-11-29 04:29:36 +00:00
Matt Jacob 1cf6a94f01 This is an MFC of 215951
Partially revert 208119. We were overwriting tunable settings.
2010-11-29 04:25:44 +00:00
Andrew Thompson a9e1216bdf MFC r214726,214852,215258,215734
Sync all u3g device ids from head.
2010-11-29 03:38:40 +00:00
Pyun YongHyeon a8acefa5b1 MFC r215328:
Add flow control for 3C905B and newer controllers. Note, these
  controllers support RX pause only.

  Reviewed by:	marius
2010-11-29 01:45:25 +00:00
Pyun YongHyeon b7761e868a MFC r215329:
Add flow control for all re(4) controllers. re(4) controllers do
  not provide any MAC configuration interface for resolved flow
  control parameters. There is even no register that configures water
  mark which will control generation of pause frames.
  However enabling flow control surely enhanced performance a lot.
2010-11-29 01:41:56 +00:00
Pyun YongHyeon d2ee6380f1 MFC r215849:
Enable ethernet flow-control on all jme(4) controllers.
2010-11-29 01:38:41 +00:00
Pyun YongHyeon 366e0ad315 MFC r215848:
Allocate 1 MSI/MSI-X vector. Originally jme(4) was designed to
  support multi-queue but the hardware limitation made it hard to
  implement supporting multi-queue. Allocating more than necessary
  vectors is resource waste and it can be added back when we
  implement multi-queue support.
2010-11-29 01:36:15 +00:00
Pyun YongHyeon d6202d6b7c MFC r215847:
Disable retrying RX descriptor loading. The counter is used to set
  number of retry to be performed whenever controller found RX
  descriptor was empty. RX empty interrupt is generated only when the
  retry counter is over. Experimentation shows retrying RX descriptor
  loading increased number of dropped frames under flow-control
  enabled environments so disable it and have controller generate RX
  empty interrupt as fast as it can.
  While I'm here fix RXCSR_DESC_RT_CNT macro.
2010-11-29 01:33:25 +00:00
Pyun YongHyeon 7f6a4105b9 MFC r215850:
Enable ethernet flow-control on all alc(4) controllers. This change
  should reduce a lot of dropped frames under high network load.
2010-11-29 01:28:12 +00:00
Nick Hibma 8abfd62849 MFC r215095,215104:
Add quirks for 3G MSC resets.
Add a man page for the usb_quirks module.
2010-11-28 22:07:08 +00:00
Pawel Jakub Dawidek 3e75377aad MFC r215799:
Add gptboot_enable rc variable, which allows to turn gptboot reporting off in
case user wants to implement his own actions and doesn't want the attributes to
vanish.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
2010-11-28 20:56:51 +00:00
Colin Percival ef77c3e961 MFC r215665,r215732: Don't lose seconds to integer overflow if we go more
than one second between calls to tc_windup.
2010-11-28 18:59:52 +00:00
Bjoern A. Zeeb bfc4201b76 MFC r215641:
Add a missing ';' and change the debugging sysctl from xint to int.

  Submitted by:	Mikolaj Golub (to.my.trociny gmail.com)
2010-11-28 17:23:28 +00:00
Bjoern A. Zeeb ee73204724 MFC r215559:
In case of an early return from the function there is no need to zero
  the route upfront, so defer as long as we can.
2010-11-28 17:02:02 +00:00
Bjoern A. Zeeb 7187796d38 MFC r215423:
Do not initialize flag variables before needed.
  Consistently use the LLE_ prefix for lla_lookup() and the ND6_ prefix
  for nd6_lookup() even though both are defined the same. Use the right
  flag variable when checking each.

  No real functional change.
2010-11-28 16:31:39 +00:00
Colin Percival 7a281ae795 MFC r204157: Remove atkbd and friends, since they cause the XEN kernel
to panic.

PR:		kern/148262, kern/149853
2010-11-28 16:25:16 +00:00
Marius Strobl 94e933bc42 MFC: r215923
Allow pause support advertisement to be turned off again.

Submitted by:	yongari (ip1000phy(4))
2010-11-28 16:09:36 +00:00
Marius Strobl 0a50ad3abd MFC: r215907
Remove the description of the dev.fxp.%d.noflow tunable as it was removed
in r215906 (MFC'ed to stable/8 in r216002) and the flowcontrol media option
now should be set as desired via ifconfig(8) instead.
2010-11-28 16:03:01 +00:00
Marius Strobl 84b040f469 MFC: r215906
Fix and implement missing parts of flow control support. This also removes
the dev.fxp.%d.noflow tunable as the same effect can now be achieved with
ifconfig(8) by setting the flowcontrol media option as desired (besides
the tunable never having a chance to actually enable flow control support
so far).
In joint forces with:	yongari
2010-11-28 15:59:39 +00:00
Marius Strobl e1b3480af1 MFC: r215905
Ensure Bay flow control is disabled as we're going to use IEEE 802.3 annex
31B full duplex flow control instead.
2010-11-28 15:57:22 +00:00
Bjoern A. Zeeb e610f71897 MFC r215418:
No need to re-initialize the callout.  We initially do it in in6_lltable_new()
  right after allocation.  Worse, we are losing the right flags here.
2010-11-28 14:57:37 +00:00
Andriy Gapon 40ded2a641 MFC r215401: zfs+sendfile: populate all requested pages, not just those
already cached
2010-11-28 12:26:15 +00:00
Martin Matuska a626b4c932 MFC r213634, r213673:
MFC r213634:
Change FAPPEND to IO_APPEND as this is a ioflag and not a fflag.
This corrects writing to append-only files on ZFS.

MFC r213673 (pjd):
Provide internal ioflags() function that converts ioflag provided by FreeBSD's
VFS to OpenSolaris-specific ioflag expected by ZFS. Use it for read and write
operations.

PR:		kern/149495 [1], kern/151082 [2]
Submitted by:	Daniel Zhelev <[email protected]> [1], Michael Naef <[email protected]> [2]
Reviewed by:	mm (r213673)
Approved by:	delphij (mentor)
2010-11-28 09:52:06 +00:00
Andrew Thompson 4424b61b75 MFC r213931 (mav)
Allow umass to use bigger transactions for USB 3.0 devices.
2010-11-28 07:29:56 +00:00
Andrew Thompson f85c2c331d MFC r213872
Fix forwarding of Line Register Status changes to TTY layer.

PR: usb/149675
2010-11-28 07:28:10 +00:00
Andrew Thompson f036e4c53f MFC r213431
Correct IOCTL return code.
2010-11-28 07:23:05 +00:00
Andrew Thompson dddebd28ad MFC r215450
Correct description of the return values of
 the LibUSB v1.0 libusb_control_transfer() function.

PR:		usb/151851
2010-11-28 07:19:11 +00:00
Andrew Thompson 0fa90825af MFC r215253
Fix LibUSB v1.0 compliancy.

 1) We need to allow the USB callback to free the USB transfer itself.
 2) The USB transfer buffer should only be automatically freed when
 freeing the USB transfer.
2010-11-28 07:18:14 +00:00
Andrew Thompson 517cf4b23f MFC r213848
- Add a new API function to check the connected
 status of the USB handle in the LibUSB v1.0 and
 LibUSB v0.1 interfaces.
2010-11-28 07:16:53 +00:00
Andrew Thompson bcc086d3a8 MFC r213809
USB network (NCM driver):
 - correct the ethernet payload remainder which
 must be post-offseted by -14 bytes instead of
 0 bytes. This is not very clearly defined in the
 NCM specification.
2010-11-28 07:04:28 +00:00
Andrew Thompson 7d5c32dc2c MFC r213804,213879,213880,214800
Add new device IDs.
2010-11-28 07:03:21 +00:00
Jayachandran C. 1695effbaf MFC r215973
The current implementation of vm_page_alloc_freelist() does not handle
order > 0 correctly. Remove order parameter to the function and use it
only for order 0 pages.
2010-11-28 06:43:39 +00:00
Jack F Vogel 1dfdd9f7c4 MFC: r215911, r215913, r215914 2010-11-28 03:41:32 +00:00
Oleksandr Tymoshenko 895ac34578 Remove options that are not available in 8 2010-11-28 01:18:11 +00:00
Oleksandr Tymoshenko 64c3979121 init_static_kenv is available only in 9-CURRENT, replace its
functionality with custom solution
2010-11-28 01:08:42 +00:00
Oleksandr Tymoshenko 0fb62f10ac MFC r211509:
add the PLL set functions to cpuops
2010-11-28 00:53:43 +00:00
Marko Zec 74a95d8964 MFC r215800:
Simplify ng_pipe locking model by relying on the netgraph framework
  to provide serialization of calls into the node, which is accomplished
  by markng the node as single-threaded (NGF_FORCE_WRITER).

  The price we pay is that each ng_pipe instance now has its own callout
  handler which polls for queued frames on each clock tick, as long as
  the pipe has any frames in its internal queues.  OTOH, we got rid of
  the global ng_pipe mutex, so from now on multiple ng_pipe instances
  can operate in parallel.  This change also fixes counting of forwarded
  frames when an ng_pipe node is not enforcing any packet impairments.

  While here, attempt to improve adherance to style(9) throughout
  otherwise mostly unreadable code.
2010-11-27 23:48:53 +00:00
Brian Somers 0739b01c0a MFC r215843:
Don't zero 'Info' after setting it up in the ASR_IOCTL_COMPAT case.
2010-11-27 21:18:08 +00:00
Andrew Thompson 224cfbfc31 MFC r213857,213861,213864,213869,213871
EHCI fixes for register and TD handling.
2010-11-27 19:47:58 +00:00
Andrew Thompson f5a2bc6766 MFC r213805
Add new driver for iPhone tethering, supports the iPhone 3G/3GS/4G ethernet
 protocol
2010-11-27 19:40:51 +00:00
Andrew Thompson 8f361ca441 MFC r213803
USB network (UHSO):
 - Correct network interface flags.

PR:	usb/149039
Submitted by:	Fredrik Lindberg
2010-11-27 19:39:29 +00:00
Andrew Thompson c4d99d95a4 MFC r213802
Correct some root HUB descriptor fields in multiple controller drivers.
 Remove an unused structure.
2010-11-27 19:38:40 +00:00
Andrew Thompson e90d2d1f5f MFC r213425
The root mount hold reference was not released on USB controller
 attach failures during boot.
2010-11-27 19:37:33 +00:00
Andrew Thompson 30d92bdbaf MFC r213379, r213426, r213426, r213427, r213432, r213435, r213437, r213439,
r214804

  Merge the XHCI usb controller and supporting code.
2010-11-27 19:35:12 +00:00
Andrey V. Elsukov b20d994674 MFC r215570:
Add to gpart(8) an ability to backup partition table and
  restore it from given backup.

MFC r215671:
  Always dump partition labels with `gpart backup`, but `gpart restore`
  does restore them only when -l option is specified [1]. Make number of
  entries field in backup format optional. Document -l and -r options of
  `gpart show` action.

MFC r215672:
  Add SIGINT handler to `gpart restore` action.
2010-11-27 13:53:21 +00:00
Andrey V. Elsukov 011bc53925 r214975 was not fully adapted to stable/8 and in-kernel version of
"destroy -F" does not work, because g_part_parm_uint assumes that
parameter is an asci string, but in head/ it is not.

Add gpart_destroy wrapper function to gpart(8). It changes "force"
parameter and does convert it to string.

This is direct commit to stable/8.
2010-11-27 13:38:17 +00:00
Jayachandran C. 43f6e368b0 Merge MIPS platform support to 8-STABLE.
This commit merges the MIPS platform changes that was now stable in
-CURRENT into 8-STABLE. The MIPS changesets are too many (~400) to list
here. But the changesets merged in this commit that affect other platforms
are summarized below:

r204635 : (changes to sys/dev/hwpmc, lib/libpmc, sys/sys/pmc.h)
Add support for hwpmc(4) on the MIPS 24K, 32 bit, embedded processor.

r205845: (changes to sys/modules/Makefile)
Fix for building modules on mips and arm.

r204031: (changes to sys/kern/link_elf_obj.c)
printf fix, as part of kernel module support for MIPS.

r206404: (changes to sys/arm/include/bus.h)
Add BUS_SPACE_UNRESTRICTED and define it to be ~0, just like all the
other platforms - for arm and mips.

r206819: (changes to sys/vm/)
Add VMFS_TLB_ALIGNED_SPACE option and kmem_alloc_nofault_space(), which
is used to allocate kernel stack address on MIPS.

r208165, r211087: (sys/kern/subr_smp.c, sys/kern/sched_ule.c)
Enable ULE scheduler for MIPS, Fix for an issue in SMP when 32 cpus are
enabled.

r208659: (sys/{ia64/ia64,mips/mips,sun4v/sun4v}/pmap.c)
Simplify the inner loop of get_pv_entry()

r208794: (changes to sys/vm/)
Make vm_contig_grow_cache() extern, and use it when vm_phys_alloc_contig()
fails to allocate MIPS page table pages.

r210327:  (changes to sys/vm/)
Support for MIPS page table page allocation.  Add a new function 'vm_page_t
vm_page_alloc_freelist(int flind, int order, int req)' to vm/vm_page.c to
allocate a page from a specified freelist, and other related changes.

Reviewed by:	alc(vm changes only)
Approved by:	kib(re), alc(vm), imp(mips), jmallett(mips), gnn(mips pmc)
2010-11-27 12:26:40 +00:00
Xin LI 30409a7564 MFC r215236:
Sync with OpenBSD, primarily better signal and terminal handling.

Obtained from:	OpenBSD
2010-11-27 06:33:53 +00:00
Matt Jacob 0f31efc351 This is an MFC of 205847
Change how multipath labels are created and managed. This makes it easier
to support various storage boxes which really aren't active-active.

We only write the label on the *first* provider. For all other providers
we just "add" the disk. This also allows for an "add" verb.

A usage implication is that you should specificy the currently active
storage path as the first provider.

Note that this does not add RDAC-like functionality, but better allows for
autovolumefailover configurations (additional checkins elsewhere will support
this).
2010-11-27 03:59:55 +00:00
Matt Jacob 23c1deac52 This is an MFC of 204071
- Style fixes.
- Prefer strlcpy() over strncpy().
2010-11-27 03:57:18 +00:00
Matt Jacob 94f502410a Roll out 209279, 200279 (which were unfortunate direct commits) and
merges 204071 and 205847. This is attempt to rectify errors made
in past merges.
2010-11-27 03:55:22 +00:00
Lawrence Stewart fa3b0628fe MFC r215553:
Fix a minor code redundancy nit.
2010-11-27 03:23:40 +00:00
Lawrence Stewart 904d22603a MFC r215552:
When enabling or disabling SIFTR with a VIMAGE kernel, ensure we add or remove
the SIFTR pfil(9) hook functions to or from all network stacks. This patch
allows packets inbound or outbound from a vnet to be "seen" by SIFTR.

Reported and tested by:	David Hayes <dahayes at swin edu au>
2010-11-27 03:19:59 +00:00
Lawrence Stewart afd6510b67 Partially MFC r215166:
Disable priming the congestion window from the host cache. The current method
interacts poorly with delayed ack and appropriate byte counting amongst other
things, resulting in undesired delay during a connection's opening slow start.
Even if we did fix the issues, the current method is still dubious at best and
needs to be thought through thoroughly.

Due to a mistake on my behalf, the change described above was committed to head
as part of a larger patch in revision 215166. Instead of waiting for the MFC of
215166, I'm merging just this small portion for the upcoming release without
bringing the mergeinfo for r215166 along. The mergeinfo will sort itself out
when r215166 is eventually merged.

This is an intentional direct commit to the 8-STABLE branch.

Reported by:	Maxim Dounin <mdounin at mdounin ru> and others
Submitted by:	andre
2010-11-27 02:18:55 +00:00
Nathan Whitehorn d9ec6e0a9a MFC r215752:
Properly use SCHAR_MAX instead of CHAR_MAX for 0x7f. This fixes operation
of locate(1) on systems on which char is unsigned by default (ARM and
PowerPC).

Reported by:	Paul Mather
2010-11-27 00:46:57 +00:00
Nathan Whitehorn 9861e8b501 MFC r214494:
Fix netboot on some Apple machines on which calling dma-free on the
network device can hang the machine. This causes the loss of 64 KB of
accessible memory on netbooted machines.
2010-11-27 00:37:13 +00:00
Nathan Whitehorn 58633a4949 MFC r214493,214495:
Fix some memory management issues discovered when trying to boot the PPC
OF loader on systems where address cells and size cells are both 2 (the
Mambo simulator) and fix an error where cons_probe() was called before
init_heap() but used malloc() to set environment variables.
2010-11-27 00:36:11 +00:00
Matt Jacob 427ae67d76 This is an MFC of 211282
Avoid a memory leak.
2010-11-27 00:26:08 +00:00
Matt Jacob 3275a600fe MFC of 209704.
Fix the clear function which has been broken for a bit.
2010-11-27 00:23:55 +00:00
Jack F Vogel 2d55767d4a MFC: r214646, r215781, 215789, 215808 2010-11-27 00:04:29 +00:00
Simon L. B. Nielsen 2441a7fbe8 Merge OpenSSL 0.9.8p into stable/8.
This merges up to and including head/crypto/openssl/ r215697; and
head/secure/lib/libcrypto/, head/secure/lib/libssl/,
head/secure/usr.bin/openssl/ r215698.

To make the merge simpler, a hack was added to set MACHINE_CPUARCH.

Security:	CVE-2010-2939, CVE-2010-3864
Security:	http://www.openssl.org/news/secadv_20101116.txt
Security:	FreeBSD-SA-10:10.openssl
Approved by:	re (implicitly - they did not object of the general idea
		of OpenSSL update)
2010-11-26 22:50:58 +00:00
Andriy Gapon 1464abf11c add UPDATING entry for amd64 minidump version 2
This is a direct commit.
2010-11-26 22:31:56 +00:00
Bernhard Schmidt c8547364d8 MFC r215779,215782:
Add a few functions used in newer drivers. Fix RtlCompareMemory() while
here.

Submitted by:	Paul B Mahol <onemda at gmail.com>
2010-11-26 22:23:52 +00:00
Jung-uk Kim 365253fdea MFC: r215753
Reinitialize PAT MSR via pmap_init_pat() while resuming.
2010-11-26 21:39:11 +00:00
Jung-uk Kim e383853d15 MFC: r211202, r211292
Reset switchtime and switchticks after resynchronizing the system clock.
2010-11-26 21:36:38 +00:00
Jung-uk Kim d858864074 MFC: r210942
Remove unnecessary casting and simplify code.
2010-11-26 21:33:26 +00:00
Jung-uk Kim 9ea530580b MFC: r210940
Correct argument order of acpi_restorecpu().
2010-11-26 21:30:14 +00:00
Marius Strobl 994184f3a4 MFC: r215780
Remove the description of the link0 link option, since r215297 (merged to
stable/8 in r215881) the master media option generally should be used
instead.

This is MFC'ed in order to discourage the use of the link0 link option,
although it's still available in stable/8).
2010-11-26 21:27:13 +00:00
Jung-uk Kim a895f8c1b3 MFC: r198422
Try hiding annoying text cursor after the video controller is reset.
2010-11-26 21:26:13 +00:00
Jung-uk Kim adf0d2292b MFC: r210810
Remove an unnecessary register load.
2010-11-26 21:22:49 +00:00
Jung-uk Kim 6365fd102f MFC: r196769, r196771, r211424, r215703, r215754
- Disable caches and flush caches/TLBs when we update PAT as we do for MTRR.
Flushing TLBs is required to ensure cache coherency according to the AMD64
architecture manual.  Flushing caches is only required when changing from a
cacheable memory type (WB, WP or WT) to an uncacheable type (WC, UC or UC-).
Since this function is only used once per processor during startup, there is
no need to take any shortcuts.
- Leave PAT indices 0-3 at the default of WB, WT, UC-, and UC.  Program 5 as
WP (from default WT) and 6 as WC (from default UC-).  Leave 4 and 7 at the
default of WB and UC.  This is to avoid transition from a cacheable memory
type to an uncacheable type to minimize possible cache incoherency.  Since
we perform flushing caches and TLBs now, this change may not be necessary
any more but we do not want to take any chances.
- Improve pmap_cache_bits() with an array to map PAT memory type to index.
This array is initialized early from pmap_init_pat(), so that we do not need
to handle special cases in the function any more.  Now this function is
identical on both amd64 and i386.
2010-11-26 21:16:21 +00:00
Marius Strobl 3646eae809 MFC: r215721
- Fix and enable support for flow control.
- Fix compilation with CAS_DEBUG defined.
2010-11-26 21:07:19 +00:00
Marius Strobl 6f864d38aa MFC: r215768
- Sprinkle const on tables.
- Remove an alpha remnant.
- Minor comment and style fixes.
2010-11-26 21:02:57 +00:00
Marius Strobl 424eb56210 MFC: r215722
- Fix and enable support for flow control.
- Partially revert r172334; as it turns out the DELAYs in gem_reset_{r,t}x()
  are actually necessary although bus space barriers and gem_bitwait() are
  used, otherwise the controller may trigger an IOMMU errors on at least
  sparc64. This is in line with what Linux and OpenSolaris do.
2010-11-26 21:01:19 +00:00
Marius Strobl 8f30dd6f4a MFC: r215720
- Also probe BCM5214 and BCM5222.
- Add some DSP init code for BCM5221. The values derived from Apple's GMAC
  driver and the same init code also exists in Linux's sungem_phy driver.
- Only read media status bits when they are valid.

Obtained from:	NetBSD, OpenBSD
2010-11-26 20:59:43 +00:00
Marius Strobl 27ca054836 MFC: r215711
Add missing newlines.
2010-11-26 20:57:45 +00:00
Marius Strobl baba144869 MFC: r215302
Move the limiting of the PHY to 10/100 modes of operation due to limitations
of certain MAC models from brgphy(4) to bge(4) where it belongs. While at it,
update the list of models having that restriction to what OpenBSD uses, which
in turn seems to have obtained that information from the Linux tg3 driver.
2010-11-26 20:55:58 +00:00
Marius Strobl 397b897327 MFC: r215298, r215459, r215714, r215716
- Change these drivers to take advantage and use the generic IEEE 802.3
  annex 31B full duplex flow control as well as the IFM_1000_T master
  support committed in r215297 (merged to stable/8 in r215881). For
  atphy(4) and jmphy(4) this includes changing these PHY drivers to no
  longer unconditionally advertise support for flow control but only if
  the selected media has IFM_FLOW set (or MIIF_FORCEPAUSE is set).
- Rename {atphy,jmphy}_auto() to {atphy,jmphy}_setmedia() as these handle
  other media types as well.

Reviewed by:	yongari (plus additional testing)
Obtained from:	NetBSD (partially), OpenBSD (partially)
2010-11-26 20:45:49 +00:00
Marius Strobl 7e46087446 MFC: r214608, r215297(partial), r215713
o Flesh out the generic IEEE 802.3 annex 31B full duplex flow control
  support in mii(4):
  - Merge generic flow control advertisement (which can be enabled by
    passing by MIIF_DOPAUSE to mii_attach(9)) and parsing support from
    NetBSD into mii_physubr.c and ukphy_subr.c. Unlike as in NetBSD,
    IFM_FLOW isn't implemented as a global option via the "don't care
    mask" but instead as a media specific option this. This has the
    following advantages:
    o allows flow control advertisement with autonegotiation to be
      turned on and off via ifconfig(8) with the default typically
      being off (though MIIF_FORCEPAUSE has been added causing flow
      control to be always advertised, allowing to easily MFC this
      changes for drivers that previously used home-grown support for
      flow control that behaved that way without breaking POLA)
    o allows to deal with PHY drivers where flow control advertisement
      with manual selection doesn't work or at least isn't implemented,
      like it's the case with brgphy(4), e1000phy(4) and ip1000phy(4),
      by setting MIIF_NOMANPAUSE
    o the available combinations of media options are readily available
      from the `ifconfig -m` output
  - Add IFM_FLOW to IFM_SHARED_OPTION_DESCRIPTIONS and IFM_ETH_RXPAUSE
    and IFM_ETH_TXPAUSE to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so
    these are understood by ifconfig(8).
o Make the master/slave support in mii(4) actually usable:
  - Change IFM_ETH_MASTER from being implemented as a global option via
    the "don't care mask" to a media specific one as it actually is only
    applicable to IFM_1000_T to date.
  - Let mii_phy_setmedia() set GTCR_MAN_MS in IFM_1000_T slave mode to
    actually configure manually selected slave mode (like we also do in
    the PHY specific implementations).
  - Add IFM_ETH_MASTER to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so it
    is understood by ifconfig(8).
o Switch bge(4), bce(4), msk(4), nfe(4) and stge(4) along with brgphy(4),
  e1000phy(4) and ip1000phy(4) to use the generic flow control support
  instead of home-grown solutions via IFM_FLAGs. This includes changing
  these PHY drivers and smcphy(4) to no longer unconditionally advertise
  support for flow control but only if the selected media has IFM_FLOW
  set (or MIIF_FORCEPAUSE is set) and implemented for these media variants,
  i.e. typically only for copper.
o Switch brgphy(4), ciphy(4), e1000phy(4) and ip1000phy(4) to report and
  set IFM_1000_T master mode via IFM_ETH_MASTER instead of via IFF_LINK0
  and some IFM_FLAGn.
o Switch brgphy(4) to add at least the the supported copper media based on
  the contents of the BMSR via mii_phy_add_media() instead of hardcoding
  them. The latter approach seems to have developed historically, besides
  causing unnecessary code duplication it was also undesirable because
  brgphy_mii_phy_auto() already based the capability advertisement on the
  contents of the BMSR though.
o Let brgphy(4) set IFM_1000_T master mode on all supported PHY and not
  just BCM5701. Apparently this was a misinterpretation of a workaround
  in the Linux tg3 driver; BCM5701 seem to require RGPHY_1000CTL_MSE and
  BRGPHY_1000CTL_MSC to be set when configuring autonegotiation but
  this doesn't mean we can't set these as well on other PHYs for manual
  media selection.
o Let ukphy_status() report IFM_1000_T master mode via IFM_ETH_MASTER so
  IFM_1000_T master mode support now is generally available with all PHY
  drivers.
o Don't let e1000phy(4) set master/slave bits for IFM_1000_SX as it's
  not applicable there.

Reviewed by:	yongari (plus additional testing)
Obtained from:	NetBSD (partially), OpenBSD (partially)

Unlike as in head, bge(4), bce(4), msk(4), nfe(4) and stge(4) are changed
to set MIIF_FORCEPAUSE in stable/8 so they continue to always advertise
support of flow control and brgphy(4), ciphy(4), e1000phy(4) as well as
ip1000phy(4) are changed to still also accept IFF_LINK0 in addition to
the master media option for setting master mode, both in order to not
violate POLA.
2010-11-26 20:37:19 +00:00
Marius Strobl 1e6b9c01fa MFC: r215259, r215272
- When printing media with more than one media option set aggregate these
  in a comma delimited list instead of repeating "mediaopt" for each one.
  This matches how the options of the active media are printed with
  print_media_word() and brings us in line what NetBSD does.
- When setting a media with no sub-type specified also reset the type
  specific options along with the global ones so these options don't
  stick when f.e. switching to IFM_AUTO.
2010-11-26 18:44:01 +00:00
Andriy Gapon 2b06648862 MFC r215398: hwpstate: use CPU_FOREACH when binding to all available
processors
2010-11-26 17:31:02 +00:00
Matt Jacob c984f84b36 Revert a completely fouled up merge. 2010-11-26 16:21:44 +00:00
Andriy Gapon 4db580f3b4 MFC r215133: amd64: introduce minidump version 2
This should reduce size of the minidump.
Compatibility with version 1 should be preserved in libkvm.
2010-11-26 16:09:08 +00:00
Marko Zec 0674d85859 MFC r215726:
Allow for vlan(4) ifnets to have overlapping unit numbers if they are
  created in separated vnets.  As a side-effect of having a separated
  if_cloner instance for each vnet, all vlan ifnets created in a vnet
  will be automatically destroyed when vnet teardown is initiated.

  Disallow SIOCSETVLAN and SIOCGETVLAN ioctls on vlan ifnets which are
  associated with physical ifnets residing in parent vnets.

  This is an interim vlan-specific solution which will be superseded by a
  more generic if_cloner V_irtualization change from p4.  For nooptions
  VIMAGE builds, this should be a no-op change.

  Discussed with:       bz
2010-11-26 15:46:49 +00:00
Marko Zec e0a15a3acb MFC r215677:
Remove an apparently redundant CURVNET_SET() / CURVNET_RESTORE() pair.
2010-11-26 15:45:34 +00:00
Marko Zec 7eb31c063d MFC r215673:
Allow for MTU sizes of up to ETHER_MAX_LEN_JUMBO (i.e. 9018) bytes to be
  configured on ng_eiface ifnets.  The default MTU remains unchanged at
  1500 bytes.

  Mark ng_eiface ifnets as IFCAP_VLAN_MTU capable, so that the associated
  vlan(4) ifnets may use full-sized Ethernet MTUs (1500 bytes).
2010-11-26 15:44:16 +00:00
Konstantin Belousov 9e36fc918f MFC r215469:
Only increment object generation count when inserting the page into
object page list.
2010-11-26 15:33:09 +00:00
Konstantin Belousov 95507db69b MFC r215471:
In vm_object_page_clean(), handle the pages that might be cached
or not written by vm_pageout_flush().

MFC r215574:
The runlen returned from vm_pageout_flush() might be zero legitimately

MCF r215610:
Eliminate the mab, maf arrays and related variables.
The change also fixes off-by-one error in the calculation of mreq.

MFC r215796:
After the sleep caused by encountering a busy page, relookup the page.
2010-11-26 15:30:02 +00:00
Bernhard Schmidt a384457589 MFC r215708:
Resurrect amd64 support.
- Many drivers on amd64 are picking system uptime, interrupt time and ticks
  via global data structure instead of calling functions for performance
  reasons. For now just patch such address so driver will not trigger page
  fault when trying to access such data. In future, additional callout may
  be added to update data in periodic intervals.
- On amd64 we need to allocate "shadow space" on stack before calling any
  function.

Submitted by:	Paul B Mahol <onemda at gmail.com>
2010-11-26 11:55:51 +00:00
Bernhard Schmidt cd07eb4e21 MFC r215707:
Prefer pmap_extract() over pmap_kextract() as done in MmIsAddressValid().
According to the comment for MmIsAddressValid() there are issues on PAE
kernels using pmap_kextract().

Submitted by:	Paul B Mahol <onemda at gmail.com>
2010-11-26 11:48:47 +00:00
Konstantin Belousov e3d0922bbf Partial MFC r215548:
Remove printf()s in the vop_inactive and vop_reclaim() methods related
to prtactive variable. The prtactive variable definition and declaration
are kept in the stable branch to preserve the KPI and KBI.
2010-11-26 11:37:35 +00:00
Konstantin Belousov cfc62ec446 MFC r215741:
Add include guards.
2010-11-26 11:11:48 +00:00
Konstantin Belousov a865f0bc3a MFC r215742:
Add PT_GNU_STACK definition.
2010-11-26 11:05:29 +00:00
Alexander Leidinger 3740d5a8c5 MFC r213471:
Fix a comparision of an uninitialised pointer.

  Submitted by:	arundel
  Found by:	clang analysis (automatic service by uqs@)
  Reviewed by:	rdivacky
2010-11-26 11:02:51 +00:00
Alexander Leidinger 236f06ccb0 MFC r215666:
Remove trailing dot from the unimplemented futex messages to make
  them consistent with the syscall and ipc messages.

  Submitted by:	arundel
2010-11-26 10:57:52 +00:00
Xin LI fda9a8ce4b MFC r214426: Add a short note about kernel modules in FIXIT mode. 2010-11-26 02:15:39 +00:00
Bernhard Schmidt 6238fc2e33 MFC r215135,215419,215420:
- According to specs for MmAllocateContiguousMemorySpecifyCache() physically
  contiguous memory with requested restrictions must be allocated.
- Use kmem_alloc_contig() to honour the cache_type variable.
- Fix a panic on i386 for drivers using MmAllocateContiguousMemory()
  and MmAllocateContiguousMemorySpecifyCache().

Submitted by:	Paul B Mahol <onemda at gmail.com>
2010-11-25 18:50:59 +00:00
Bernhard Schmidt 99703652c6 MFC r214798:
Remove 4.x, 5.x and 6.x compatibility bits.

Submitted by:	Paul B Mahol <onemda at gmail.com>
2010-11-25 18:43:18 +00:00
Bernhard Schmidt 2710b0c89b MFC r213461:
Use the printf-like capability from kproc_create().

Submitted by:	Paul B Mahol <onemda at gmail.com>
Committed by:	thompsa
2010-11-25 18:40:56 +00:00
Bernhard Schmidt 86d4725282 MFC r213778:
WPA_CSE_WEP104 was being incorrectly checked.

Committed by:	rpaulo
2010-11-25 18:37:04 +00:00
Bernhard Schmidt f47e3b8bc5 MFC r201620,201644:
Add net80211 media status reporting.

Submitted by:	Paul B Mahol <onemda at gmail.com>
Committed by:	rpaulo
2010-11-25 18:34:42 +00:00
Ryan Stone adf6b8d2f3 MFC 215474
When netstat was run with -i/-I and -w1 to produce running counters, the idrop
field printed an absolute value rather than the delta from the last value

Approved by:	emaste (mentor)
2010-11-25 18:32:02 +00:00
Bernhard Schmidt 1d3a4c9291 MFC r198786,198816,198819:
Big style cleanup. While there remove references to FreeBSD versions
older than 6.0.

Submitted by:	Paul B Mahol <onemda at gmail.com>
Committed by:	rpaulo
2010-11-25 18:27:59 +00:00
Xin LI 859cbbc319 MFC r215234:
Update to vendor release 1.20.00.19.

Bug fixes:
  * Fixed "inquiry data fails comparion at DV1 step"
  * Fixed bad range input in bus_alloc_resource for ADAPTER_TYPE_B
  * Fixed arcmsr driver prevent arcsas support for Areca SAS HBA ARC13x0

Many thanks to Areca for continuing to support FreeBSD.

MFC r215280:

Workaround build for PAE case for now - revert the PHYS
case to previous panic behavior.
2010-11-25 18:21:08 +00:00
Attilio Rao cc9e5103a4 MFC r215102:
Fix a typo.
2010-11-25 16:21:56 +00:00
Randall Stewart f1a3fbf1e8 MFC of 215110:
Fix so that a multicast packet can be sent
even if there is no route out to that mcast address. The code in
in_pcb inadvertantly would error (no route) even though
the user may have specified the address with the
proper socket option (to specify the egress interface).
Thanks bz for reminding me I forgot to commit this ;-)
2010-11-25 12:10:59 +00:00
Bernhard Schmidt 8763f963a9 MFC r215699:
The meshid element is memcpy()'ed into se_meshid if included in either
beacon or probe-response frames. Fix the condition by checking for the
the array's content instead of the always existing array itself.
2010-11-25 08:55:57 +00:00
David E. O'Brien a6486a913d MFC: r201217: ANSIfy ldconfig and the aout bits it still uses from rtld-aout 2010-11-25 07:02:36 +00:00
David E. O'Brien 60a0d00a46 MFC: r215705: hdr.elf.e_ident[EI_OSABI] is not a bitmask 2010-11-24 22:44:10 +00:00
Rebecca Cran 965a4eeb80 MFC r215637:
dispatch_add_command:
Modify the logic so there's only one exit point instead of two.
Only insert valid (non-NULL) values into the queue.

dispatch_free_command:
Ensure that item is not NULL before removing it from the queue and
dereferencing the pointer.
NULL out free'd pointers to catch any use-after-free bugs.

PR:	bin/146855
Submitted by:	gcooper
2010-11-24 21:54:45 +00:00
Nick Hibma c74b53f855 MFC 213876: Add more USB device IDs to supported list of devices. 2010-11-24 09:36:36 +00:00
David E. O'Brien 492f58ff8c MFC: r204329: Fixed dependencies (make checkdpadd). 2010-11-24 08:09:33 +00:00
Gleb Smirnoff da8fcbed58 MFhead r214508:
Revert a small part of the r198301, that is entirely unrelated to the
  r198301 itself. It also broke the logic of not sending more than one
  ARP request per second, that consequently lead to a potential problem
  of flooding network with broadcast packets.
2010-11-24 05:37:12 +00:00
Justin T. Gibbs ab33e624f6 Synchronize Xen support with current, excluding console API changes in
the PV Xen console driver.

Merged revisions
================
r199734 | kmacy | 2009-11-24 00:17:51 -0700 (Tue, 24 Nov 2009) | 2 lines

    fixup kernel core dumps on paravirtual guests

r199959 | kmacy | 2009-11-29 21:20:43 -0700 (Sun, 29 Nov 2009) | 3 lines

    Update license to reflect terms in xen 2.0 as of the time when the
    driver was ported to FreeBSD

r199960 | kmacy | 2009-11-29 21:32:34 -0700 (Sun, 29 Nov 2009) | 2 lines

    Merge Scott Long's latest blkfront now that the licensing issues are
    resolved

r201234 | gibbs | 2009-12-29 16:28:13 -0700 (Tue, 29 Dec 2009) | 5 lines

    Correct bug introduced while purging the -ERRNO Linuxism from the
    grant table API.  Valid grant refs are in the range of positive 32bit
    integers.  ENOSPACE, being 29, is also a positive integer.  Return
    GNTTAB_LIST_END (-1) instead when gnttab_claim_grant_reference() fails.

r201138 | gibbs | 2009-12-28 11:59:13 -0700 (Mon, 28 Dec 2009) | 8 lines

    Correct alignment and boundary constraints in blkfront's bus dma tag.  The
    blkif interface in Xen requires all I/O to be 512 byte aligned with each
    segment bounded by a 4k page.

    Note: This submission only documents the proper contraints for blkif I/O.
          The alignment code in busdma does not yet handle alignment constraints
          correctly in all cases.

r201236 | gibbs | 2009-12-29 16:31:21 -0700 (Tue, 29 Dec 2009) | 3 lines

    In blkif_queue_cb(), test the return value from
    gnttab_claim_grant_reference() for >= 0 instead of != ENOSPC.

r204159 | kmacy | 2010-02-20 18:12:18 -0700 (Sat, 20 Feb 2010) | 2 lines

    don't hold spin lock across free

r214077 | gibbs | 2010-10-19 14:53:30 -0600 (Tue, 19 Oct 2010) | 342 lines

    Improve the Xen para-virtualized device infrastructure of FreeBSD:

     o Add support for backend devices (e.g. blkback)
     o Implement extensions to the Xen para-virtualized block API to allow
       for larger and more outstanding I/Os.
     o Import a completely rewritten block back driver with support for
       fronting I/O to both raw devices and files.
     o General cleanup and documentation of the XenBus and XenStore support
       code.
     o Robustness and performance updates for the block front driver.
     o Fixes to the netfront driver.

    Sponsored by: Spectra Logic Corporation

    sys/xen/xenbus/init.txt:
            Deleted: This file explains the Linux method for XenBus device
            enumeration and thus does not apply to FreeBSD's NewBus approach.

    sys/xen/xenbus/xenbus_probe_backend.c:
           Deleted: Linux version of backend XenBus service routines.  It
           was never ported to FreeBSD.  See xenbusb.c, xenbusb_if.m,
           xenbusb_front.c xenbusb_back.c for details of FreeBSD's XenBus
           support.

    sys/xen/xenbus/xenbusvar.h:
    sys/xen/xenbus/xenbus_xs.c:
    sys/xen/xenbus/xenbus_comms.c:
    sys/xen/xenbus/xenbus_comms.h:
    sys/xen/xenstore/xenstorevar.h:
    sys/xen/xenstore/xenstore.c:
            Split XenStore into its own tree.  XenBus is a software layer
            built on top of XenStore.  The old arrangement and the naming of
            some structures and functions blurred these lines making it
            difficult to discern what services are provided by which layer
            and at what times these services are available (e.g. during
            system startup and shutdown).

    sys/xen/xenbus/xenbus_client.c:
    sys/xen/xenbus/xenbus.c:
    sys/xen/xenbus/xenbus_probe.c:
    sys/xen/xenbus/xenbusb.c:
    sys/xen/xenbus/xenbusb.h:
            Split up XenBus code into methods available for use by client
            drivers (xenbus.c) and code used by the XenBus "bus code" to
            enumerate, attach, detach, and service bus drivers.

    sys/xen/reboot.c:
    sys/dev/xen/control/control.c:
	    Add a XenBus front driver for handling shutdown, reboot,
	    suspend, and resume events published in the XenStore.
	    Move all PV suspend/reboot support from reboot.c into
	    this driver.

    sys/xen/blkif.h:
            New file from Xen vendor with macros and structures used by
            a block back driver to service requests from a VM running a
            different ABI (e.g. amd64 back with i386 front).

    sys/conf/files:
            Adjust kernel build spec for new XenBus/XenStore layout and added
            Xen functionality.

    sys/dev/xen/balloon/balloon.c:
    sys/dev/xen/netfront/netfront.c:
    sys/dev/xen/blkfront/blkfront.c:
    sys/xen/xenbus/...
    sys/xen/xenstore/...
            o Rename XenStore APIs and structures from xenbus_* to xs_*.
	    o Adjust to use of M_XENBUS and M_XENSTORE malloc types
	      for allocation of objects returned by these APIs.
	    o Adjust for changes in the bus interface for Xen
	    drivers.

    sys/xen/xenbus/...
    sys/xen/xenstore/...
            Add Doxygen comments for these interfaces and the code that
            implements them.

    sys/dev/xen/blkback/blkback.c:
            o Rewrite the Block Back driver to attach properly via newbus,
              operate correctly in both PV and HVM mode regardless of domain
              (e.g. can be in a DOM other than 0), and to deal with the latest
              metadata available in XenStore for block devices.

            o Allow users to specify a file as a backend to blkback, in addition
              to character devices.  Use the namei lookup of the backend path
              to automatically configure, based on file type, the appropriate
              backend method.

            The current implementation is limited to a single outstanding I/O
            at a time to file backed storage.

    sys/dev/xen/blkback/blkback.c:
    sys/xen/interface/io/blkif.h:
    sys/xen/blkif.h:
    sys/dev/xen/blkfront/blkfront.c:
    sys/dev/xen/blkfront/block.h:
            Extend the Xen blkif API: Negotiable request size and number of
            requests.

            This change extends the information recorded in the XenStore
            allowing block front/back devices to negotiate for optimal I/O
            parameters.  This has been achieved without sacrificing backward
            compatibility with drivers that are unaware of these protocol
            enhancements.  The extensions center around the connection protocol
            which now includes these additions:

            o The back-end device publishes its maximum supported values for,
              request I/O size, the number of page segments that can be
              associated with a request, the maximum number of requests that
              can be concurrently active, and the maximum number of pages that
              can be in the shared request ring.  These values are published
              before the back-end enters the XenbusStateInitWait state.

            o The front-end waits for the back-end to enter either the InitWait
              or Initialize state.  At this point, the front end limits it's
              own capabilities to the lesser of the values it finds published
              by the backend, it's own maximums, or, should any back-end data
              be missing in the store, the values supported by the original
              protocol.  It then initializes it's internal data structures
              including allocation of the shared ring, publishes its maximum
              capabilities to the XenStore and transitions to the Initialized
              state.

            o The back-end waits for the front-end to enter the Initalized
              state.  At this point, the back end limits it's own capabilities
              to the lesser of the values it finds published by the frontend,
              it's own maximums, or, should any front-end data be missing in
              the store, the values supported by the original protocol.  It
              then initializes it's internal data structures, attaches to the
              shared ring and transitions to the Connected state.

            o The front-end waits for the back-end to enter the Connnected
              state, transitions itself to the connected state, and can
              commence I/O.

            Although an updated front-end driver must be aware of the back-end's
            InitWait state, the back-end has been coded such that it can
            tolerate a front-end that skips this step and transitions directly
            to the Initialized state without waiting for the back-end.

    sys/xen/interface/io/blkif.h:
            o Increase BLKIF_MAX_SEGMENTS_PER_REQUEST to 255.  This is
              the maximum number possible without changing the blkif
              request header structure (nr_segs is a uint8_t).

            o Add two new constants:
              BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK, and
              BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK.  These respectively
              indicate the number of segments that can fit in the first
              ring-buffer entry of a request, and for each subsequent
              (sg element only) ring-buffer entry associated with the
              "header" ring-buffer entry of the request.

            o Add the blkif_request_segment_t typedef for segment
              elements.

            o Add the BLKRING_GET_SG_REQUEST() macro which wraps the
              RING_GET_REQUEST() macro and returns a properly cast
              pointer to an array of blkif_request_segment_ts.

            o Add the BLKIF_SEGS_TO_BLOCKS() macro which calculates the
              number of ring entries that will be consumed by a blkif
              request with the given number of segments.

    sys/xen/blkif.h:
            o Update for changes in interface/io/blkif.h macros.

            o Update the BLKIF_MAX_RING_REQUESTS() macro to take the
              ring size as an argument to allow this calculation on
              multi-page rings.

            o Add a companion macro to BLKIF_MAX_RING_REQUESTS(),
              BLKIF_RING_PAGES().  This macro determines the number of
              ring pages required in order to support a ring with the
              supplied number of request blocks.

    sys/dev/xen/blkback/blkback.c:
    sys/dev/xen/blkfront/blkfront.c:
    sys/dev/xen/blkfront/block.h:
            o Negotiate with the other-end with the following limits:
                  Reqeust Size:   MAXPHYS
                  Max Segments:   (MAXPHYS/PAGE_SIZE) + 1
                  Max Requests:   256
                  Max Ring Pages: Sufficient to support Max Requests with
                                  Max Segments.

            o Dynamically allocate request pools and segemnts-per-request.

            o Update ring allocation/attachment code to support a
              multi-page shared ring.

            o Update routines that access the shared ring to handle
              multi-block requests.

    sys/dev/xen/blkfront/blkfront.c:
            o Track blkfront allocations in a blkfront driver specific
              malloc pool.

            o Strip out XenStore transaction retry logic in the
              connection code.  Transactions only need to be used when
              the update to multiple XenStore nodes must be atomic.
              That is not the case here.

            o Fully disable blkif_resume() until it can be fixed
              properly (it didn't work before this change).

            o Destroy bus-dma objects during device instance tear-down.

            o Properly handle backend devices with powef-of-2 sector
              sizes larger than 512b.

    sys/dev/xen/blkback/blkback.c:
            Advertise support for and implement the BLKIF_OP_WRITE_BARRIER
            and BLKIF_OP_FLUSH_DISKCACHE blkif opcodes using BIO_FLUSH and
            the BIO_ORDERED attribute of bios.

    sys/dev/xen/blkfront/blkfront.c:
    sys/dev/xen/blkfront/block.h:
            Fix various bugs in blkfront.

           o gnttab_alloc_grant_references() returns 0 for success and
             non-zero for failure.  The check for < 0 is a leftover
             Linuxism.

           o When we negotiate with blkback and have to reduce some of our
             capabilities, print out the original and reduced capability before
             changing the local capability.  So the user now gets the correct
             information.

            o Fix blkif_restart_queue_callback() formatting.  Make sure we hold
              the mutex in that function before calling xb_startio().

            o Fix a couple of KASSERT()s.

            o Fix a check in the xb_remove_* macro to be a little more specific.

    sys/xen/gnttab.h:
    sys/xen/gnttab.c:
            Define GNTTAB_LIST_END publicly as GRANT_REF_INVALID.

    sys/dev/xen/netfront/netfront.c:
            Use GRANT_REF_INVALID instead of driver private definitions of the
            same constant.

    sys/xen/gnttab.h:
    sys/xen/gnttab.c:
            Add the gnttab_end_foreign_access_references() API.

	    This API allows a client to batch the release of an
	    array of grant references, instead of coding a private
	    for loop.  The implementation takes advantage of this
	    batching to reduce lock overhead to one acquisition and
	    release per-batch instead of per-freed grant reference.

	    While here, reduce the duration the gnttab_list_lock
	    is held during gnttab_free_grant_references() operations.
	    The search to find the tail of the incoming free list
	    does not rely on global state and so can be performed
	    without holding the lock.

    sys/dev/xen/xenpci/evtchn.c:
    sys/dev/xen/evtchn/evtchn.c:
    sys/xen/xen_intr.h:
	    o Implement the bind_interdomain_evtchn_to_irqhandler
	      API for HVM mode.  This allows an HVM domain to serve
	      back end devices to other domains.  This API is already
	      implemented for PV mode.

            o Synchronize the API between HVM and PV.

    sys/dev/xen/xenpci/xenpci.c:
	    o Scan the full region of CPUID space in which the Xen
	      VMM interface may be implemented.  On systems using
	      SuSE as a Dom0 where the Viridian API is also exported,
	      the VMM interface is above the region we used to
	      search.

            o Pass through bus_alloc_resource() calls so that XenBus drivers
              attaching on an HVM system can allocate unused physical address
              space from the nexus.  The block back driver makes use of this
              facility.

    sys/i386/xen/xen_machdep.c:
            Use the correct type for accessing the statically mapped xenstore
            metadata.

    sys/xen/interface/hvm/params.h:
    sys/xen/xenstore/xenstore.c:
            Move hvm_get_parameter() to the correct global header file instead
            of as a private method to the XenStore.

    sys/xen/interface/io/protocols.h:
            Sync with vendor.

    sys/xeninterface/io/ring.h:
            Add macro for calculating the number of ring pages needed for an N
            deep ring.

            To avoid duplication within the macros, create and use the new
            __RING_HEADER_SIZE() macro.  This macro calculates the size of the
            ring book keeping struct (producer/consumer indexes, etc.) that
            resides at the head of the ring.

            Add the __RING_PAGES() macro which calculates the number of shared
            ring pages required to support a ring with the given number of
            requests.

            These APIs are used to support the multi-page ring version of the
            Xen block API.

    sys/xeninterface/io/xenbus.h:
            Add Comments.

    sys/xen/xenbus/...
	    o Refactor the FreeBSD XenBus support code to allow for
	      both front and backend device attachments.

            o Make use of new config_intr_hook capabilities to allow
              front and back devices to be probed/attached in parallel.

	    o Fix bugs in probe/attach state machine that could
	      cause the system to hang when confronted with a failure
	      either in the local domain or in a remote domain to
	      which one of our driver instances is attaching.

	    o Publish all required state to the XenStore on device
	      detach and failure.  The majority of the missing
	      functionality was for serving as a back end since the
	      typical "hot-plug" scripts in Dom0 don't handle the
	      case of cleaning up for a "service domain" that is
	      not itself.

            o Add dynamic sysctl nodes exposing the generic ivars of
              XenBus devices.

            o Add doxygen style comments to the majority of the code.

            o Cleanup types, formatting, etc.

    sys/xen/xenbus/xenbusb.c:
            Common code used by both front and back XenBus busses.

    sys/xen/xenbus/xenbusb_if.m:
            Method definitions for a XenBus bus.

    sys/xen/xenbus/xenbusb_front.c:
    sys/xen/xenbus/xenbusb_back.c:
            XenBus bus specialization for front and back devices.

r214444 | gibbs | 2010-10-27 22:14:28 -0600 (Wed, 27 Oct 2010) | 9 lines

    sys/dev/xen/blkback/blkback.c:
            In xbb_detach() only perform cleanup of our taskqueue and
            device statistics structures if they have been initialized.
            This avoids a panic when xbb_detach() is called on a partially
            initialized device instance, due to an early failure in
            attach.

    Sponsored by:   Spectra Logic Corporation

r215681 | jhb | 2010-11-22 08:15:11 -0700 (Mon, 22 Nov 2010) | 2 lines

    Remove some bogus, self-referential mergeinfo.

r215682 | jhb | 2010-11-22 08:26:47 -0700 (Mon, 22 Nov 2010) | 5 lines

    Purge mergeinfo on sys/dev/xen/xenpci.  The only unique mergeinfo compared
    to head was not useful (it came in with the merge from /user/dfr/xenhvm/7
    and that mergeinfo is still present at sys/) and not worth keeping an extra
    set of mergeinfo around in the kernel.
2010-11-24 01:03:03 +00:00
Kirk McKusick 7cccfec24f MFC of 215576
Delete /sys/ufs/ffs/README.snapshot as it is no longer relevant.
Drop reference to it in mount(8).

Reported by: Bruce Cran <[email protected]>
PR: docs/128325
2010-11-23 23:13:58 +00:00
Alexander Motin 05dc6c0316 MFC r215468:
Make ATA_CAM wrapper to report SATA power management capabilities to CAM to
make it configure device to initiate transitions if controller configured
to accept them. This makes hint.ata.X.pm_level=1 mode working.
2010-11-23 21:42:26 +00:00
Alexander Motin 5b3120b9ac MFC r215453:
Even if we are skipping SATA hard reset - set power management bits in
SControl register. This should make things more consistent.
2010-11-23 21:40:21 +00:00
Alexander Motin 99cdb30e28 MFC r215454:
If HBA doesn't report user-enabled SATA capabilies (like ATA_CAM wrapper) -
handle all of them as disabled.
2010-11-23 21:36:56 +00:00
Ulrich Spörlein cd06bccd5b MFC r214237,214489:
Remove mention of non-existant -o flag for debugging options.

Fix CPU load reporting independent of scheduler used.
- Sample CPU usage data from kern.cp_times, this makes for a far more
  accurate and scheduler independent algorithm.
- Rip out the process list scraping that is no longer required.
- Don't update CPU usage sampling on every request, but every 15s
  instead. This makes it impossible for an attacker to hide the CPU load
  by triggering 4 samplings in short succession when the system is idle.
- After reaching the steady-state, the system will always report the
  average CPU load of the last 60 sampled seconds.
- Untangling of call graph.
2010-11-23 21:36:53 +00:00
Alexander Motin 1a3c7f6276 MFC r214288:
Make da driver to handle some probably broken Android devices, returning
zero media and sector size instead of "Medium not present" error,
until some confirmation button is tapped on device.
2010-11-23 21:35:13 +00:00
Alexander Motin 3976eb04cb MFC r215428, r215431, r215462:
Add support for VIA VX900 chipset SATA controller.
2010-11-23 21:29:40 +00:00
Alexander Motin 206faf167a MFC r214896:
Mark command submission timeouts as timeouts. This should trigger device
resets and increase chances of getting device back again.
2010-11-23 21:22:18 +00:00
Alexander Motin 078dd01a39 MFC r214880:
Add support for odd-sized PIO transfers, sometimes used by ATAPI.
2010-11-23 21:20:27 +00:00
Nick Hibma 2d573dda33 MFC r213856
- Add more USB devices to usbdevs and rename some previously unknown
  ones.
- Add more USB mass storage quirks.

Note: In this MFC the QUALCOMMINC E2000 entry is left intact as it is in
use.
2010-11-23 19:22:44 +00:00
Pyun YongHyeon 8efa7c1a77 MFC r215353,215355:
r215353:
  Plug memory leakage introduced in r204989.

  Reported by:	yongari
r215355:
  Restore the previous behaviour of substring match.
2010-11-23 19:21:44 +00:00
Pyun YongHyeon 4d05fe6c34 MFC r215327,215350:
r215327:
  P5N32-SLI PREMIUM from ASUSTeK is known to have MSI/MSI-X issue
  such that nfe(4) does not work with MSI-X. When MSI-X support was
  introduced, I remember MCP55 controller worked without problems so
  the issue could be either PCI bridge or BIOS issue. But I also
  noticed snd_hda(4) disabled MSI on all MCP55 chipset so I'm still
  not sure this is generic issue of MCP55 chipset. If this was PCI
  bridge issue we would have added it to a system wide black-list
  table but it's not clear to me at this moment whether it was caused
  by either broken BIOS or silicon bug of MCP55 chipset.

  To workaround the issue, maintain a MSI/MSI-X black-list table in
  driver and lookup base board manufacturer and product name from the
  table before attempting to use MSI-X. If driver find an matching
  entry, nfe(4) will not use MSI/MSI-X and fall back on traditional
  INTx mode. This approach should be the last resort since it relies
  on smbios and if another instance of MSI/MSI-X breakage is reported
  with different maker/product, we may have to get the PCI bridge
  black-listed instead of adding an new entry.

  PR:	kern/152150

r215350:
  Plug memory leakage introduced in r215327.

  Submitted by:	jkim
2010-11-23 19:11:27 +00:00
Ulrich Spörlein 3ff6305f4b MFC r215237: Fix bug in jn(3) and jnf(3) that led to -inf results 2010-11-23 18:48:57 +00:00
Attilio Rao b3b3789197 Revert r215755 as it was supposed to happen on -CURRENT and not STABLE_8.
Pointy hat to:	me
2010-11-23 18:47:43 +00:00
Attilio Rao 6ed49a1fac Make this printf output more verbose.
Sponsored by:	Sandvine Incorporated
Submitted by:	Sandvine Incorporated
MFC after:	3 days
2010-11-23 18:45:12 +00:00
Nathan Whitehorn 6584e49f78 MFC r208839,214999:
Add two new flags (IIC_M_NOSTOP and IIC_M_NOSTART) to struct iic_msg to
allow consumers of iicbus_transfer() to send messages with repeated starts.

Reviewed by:	imp, thompsa
2010-11-23 14:13:12 +00:00
Marko Zec 56ca1a6d9e MFC 212726:
Make the format of "Real Memory" and "Virtual Memory" lines more
  consistent with the rest of sysctl vm.vmtotal output.

  MFC after:    3 days
2010-11-23 13:37:42 +00:00
Marko Zec 92770a6cf5 MFC 209723:
Fix a double-free bug which can occur if both bit error rate and
   packet duplication probability are configured on a ng_pipe node.

   Submitted by:   Jeffrey Ahrenholtz
   MFC after:	   3 days
2010-11-23 13:28:45 +00:00
Marko Zec 1c7fc321ff MFC 207426:
Avoid undefined behaviour.
2010-11-23 13:26:59 +00:00
Marko Zec b303d5561c MFC 206360:
Start copyright notice with /*-
2010-11-23 13:25:27 +00:00
Sergey Kandaurov c3ba93a02e MFC r215176:
Stop documenting vgonel() after its converting to the static function:
  svn r147332 (by jeff): "Don't make vgonel() globally visible".
 While here, specify the vnode locking scheme for vgone().

Approved by:	avg (mentor), kib (mentor)
2010-11-23 11:39:11 +00:00
Martin Matuska 7b4ccea1dd MFC r213718:
- Add support for xz compression to pkg_create, bzip2 remains the default
compression algorithm.
- Bump PKG_INSTALL_VERSION to 20101012.

Submitted by:	mm
Approved by:	portmgr (flz)
2010-11-23 11:31:12 +00:00
Martin Matuska 4f1168a499 MFC r213700, r215187, r215515:
MFC r213700:
Upgrade xz to git snapshot as of 20101010

MFC r215187:
Update xz to release 5.0.0

MFC r215515
Remove obsoleted private symbol.

Approved by:	delphij (mentor)
2010-11-23 10:37:00 +00:00
Fabien Thomas bb762270ed MFC 200669:
Recognize Intel CPUs with Family 0x6, Models 0x1E and 0x1F.
2010-11-23 09:12:43 +00:00
Xin LI f6387b28bb MFC r204459 (antonie):
Add files to remove when MK_PKGTOOLS=no.

MFC r215045 [1]:

Hide 460.chkportsum in MK_PKGTOOLS != no case.

Submitted by:	Alex Kozlov <spam rm-rf kiev ua> [1]
2010-11-23 01:39:30 +00:00
Kirk McKusick 418c554609 MFC of 213119
Reported problem:
Large (60GB) filesystems created using "newfs -U -O 1 -b 65536 -f 8192"
show incorrect results from "df" for free and used space when mounted
immediately after creation. fsck on the new filesystem (before ever
mounting it once) gives a "SUMMARY INFORMATION BAD" error in phase 5.

This error hasn't occurred in any runs of fsck immediately after
"newfs -U -b 65536 -f 8192" (leaving out the "-O 1" option).

Solution:
The default UFS1 superblock is located at offset 8K in the filesystem
partition; the default UFS2 superblock is located at offset 64K in
the filesystem partition. For UFS1 filesystems with a blocksize of
64K, the first alternate superblock resides at 64K which is the the
location used for the default UFS2 superblock. By default, the
system first checks for a valid superblock at the default location
for a UFS2 filoesystem. For a UFS1 filesystem with a blocksize of
64K, there is a valid UFS1 superblock at this location. Thus, even
though it is expected to be a backup superblock, the system will
use it as its default superblock. So, we have to ensure that all the
statistcs on usage are correct in this first alternate superblock
as it is the superblock that will actually be used.

While tracking down this problem, another limitation of UFS1 became
evident. For UFS1, the number of inodes per cylinder group is stored
in an int16_t. Thus the maximum number of inodes per cylinder group
is limited to 2^15 - 1. This limit can easily be exceeded for block
sizes of 32K and above. Thus when building UFS1 filesystems, newfs
must limit the number of inodes per cylinder group to 2^15 - 1.

Reported by: Guy Helmer<[email protected]>
Followup by: Bruce Cran <[email protected]>
PR: 107692
2010-11-23 01:24:27 +00:00
Nick Hibma 07bb0fca36 MFC r214754:
Don't spam the console with 'Loading <alias module>' messages.

This cannot be hidden behind 'bootverbose' as this file is included from
userland.
2010-11-22 22:41:43 +00:00
Nick Hibma 1cb11f62af MFC -r212829: Bugfix: Reset the packet counters at the same time as the byte counts. 2010-11-22 21:43:45 +00:00
Jung-uk Kim f6f4708af7 Remove a stale file. It seems this file was mis-merged from current. 2010-11-22 21:12:20 +00:00
Max Laier e2da615190 MFH r215508:
Off by one page in vm_reserv_reclaim_contig(): reclaim reservations with
  only a single free page as well.

  Reviewed by:	alc
2010-11-22 20:50:40 +00:00
Dag-Erling Smørgrav 60528b6d21 MFC r209052, r210702, r211095, r211182, r212149: Fix a memory leak and
some potential deadlocks, increase the target limit from 4 to 64, and
numerous other scalability and stability improvements, including.

Submitted by:	Daniel Braniss <[email protected]>
Sponsored by:	Dansk Scanning A/S, Data Robotics Inc.
2010-11-22 19:02:30 +00:00
Nathan Whitehorn 6339775206 MFC r212054:
Restructure how reset and poweroff are handled on PowerPC systems, since
the existing code was very platform specific, and broken for SMP systems
trying to reboot from KDB.

- Add a new PLATFORM_RESET() method to the platform KOBJ interface, and
  migrate existing reset functions into platform modules.
- Modify the OF_reboot() routine to submit the request by hand to avoid
  the IPIs involved in the regular openfirmware() routine. This fixes
  reboot from KDB on SMP machines.
- Move non-KDB reset and poweroff functions on the Powermac platform
  into the relevant power control drivers (cuda, pmu, smu), instead of
  using them through the Open Firmware backdoor.
- Rename platform_chrp to platform_powermac since it has become
  increasingly Powermac specific. When we gain support for IBM systems,
  we will grow a new platform_chrp.
2010-11-22 17:39:18 +00:00
Nathan Whitehorn 02300921ad MFC r208842:
Add a driver for the CPU temperature sensors attached over I2C on the
PowerMac 11,2.
2010-11-22 17:15:41 +00:00
Nathan Whitehorn a9092ab84a MFC r208841:
Add support for the I2C busses hanging off Apple system management chips.
2010-11-22 17:14:29 +00:00
Nathan Whitehorn 6a37bcd6be MFC r205506:
Get nexus(4) out of the RTC business. The interface used by nexus(4)
in Open Firmware was Apple-specific, and we have complete coverage of Apple
system controllers, so move RTC responsibilities into the system controller
drivers. This avoids interesting problems from manipulating these devices
through Open Firmware behind the backs of their drivers.

Obtained from:	NetBSD
2010-11-22 17:13:04 +00:00
Nathan Whitehorn 0822b40955 MFC r215100:
Disabling CPU NAP modes during SMU commands is a hack needed only on U3
systems. Don't use it on non-U3 systems to allow cpu_idle() to work
correctly.
2010-11-22 17:09:42 +00:00
Nathan Whitehorn 32c196894b MFC r204127,215101:
Provide support for the DEEPNAP power-saving mode found on the 970MP.
2010-11-22 17:06:24 +00:00
Nathan Whitehorn 2b9db5ac5f MFC r214575:
Allow access to the HT I/O port space on the IBM CPC9X5 northbridge chips.
2010-11-22 17:03:09 +00:00
Nathan Whitehorn f39dc651fd MFC r214610:
Map userland copyin/copyout segment no-execute while it is mapped into the
kernel.
2010-11-22 17:01:40 +00:00
Nathan Whitehorn 0d8ccd6f90 MFC r213986:
Fix an XXX comment by answering 'no'. OS X does not set the day-of-week
counter on SMU-based systems, which causes FreeBSD to reject the RTC time
when used in a dual-boot environment. Since we don't use the day-of-week
counter anyway, solve this by just not checking that it matches.
2010-11-22 16:58:07 +00:00
Ken Smith f7b4d90778 We're a bit under a week from Code Freeze for the upcoming 8.2-RELEASE
cycle.  Warn people tracking stable/8 that the branch may be more
active than usual.
2010-11-22 16:09:57 +00:00
Brian Somers 7d5864695f MFC r212247 & r212724 from head:
Handle geli-encrypted root disk devices.
    Add support for identifying a journaled root filesystem.
    Fix support for identifying the given /dev/vinum/root example.
2010-11-22 09:32:54 +00:00
Alexander Leidinger d18979442f MFC r215339:
Some style(9) fixes.

  Submitted by:	arundel
2010-11-22 08:35:06 +00:00
Alexander Leidinger b7e3663375 MFC r215338:
- print out the PID and program name of the program trying to use an
    unsupported futex operation
  - for those futex operations which are known to be not supported,
    print out which futex operation it is
  - shortcut the error return of the unsupported FUTEX_CLOCK_REALTIME in
    some cases:
      FUTEX_CLOCK_REALTIME can be used to tell linux to use
      CLOCK_REALTIME instead of CLOCK_MONOTONIC. FUTEX_CLOCK_REALTIME
      however must only be set, if either FUTEX_WAIT_BITSET or
      FUTEX_WAIT_REQUEUE_PI are set too. If that's not the case
      we can die with ENOSYS right at the beginning.

  Submitted by:	arundel
  Reviewed by:	rdivacky (earlier iteration of the patch)
  MFC after:	1 week
2010-11-22 08:21:58 +00:00
Kevin Lo 420efd11e7 MFC r215607:
Fix missing closedir()
2010-11-22 06:41:05 +00:00
Kevin Lo 6b982f256e MFC r215519:
Fix fd leak
2010-11-22 06:38:52 +00:00
Kevin Lo 6b680cb3f5 MFC r215518:
Close file and directory descriptors
2010-11-22 06:37:21 +00:00
Kevin Lo 3309e7f624 MFC r215335:
Remove unused struct rue_type
2010-11-22 06:31:42 +00:00
Alan Cox 319906cd99 MFC r209669
Improve the comment and man page for vm_page_alloc().
2010-11-22 06:25:56 +00:00
Doug Barton 8c6a5b5b91 MFC 215334:
Remove references to MAKEDEV(8)
2010-11-22 00:31:52 +00:00
Doug Barton 87d64e29c4 MFC 215250:
Remove references to the long-gone ramdisk

Submitted by:	Garrett Cooper <[email protected]>
2010-11-22 00:10:14 +00:00
Rebecca Cran 62e804d5db MFC r203567 (by antoine):
Update files to remove when MK_KERBEROS=no.

MFC r203561 (by antoine):
Add files to remove when MK_GSSAPI=no.
2010-11-21 18:04:28 +00:00
Rebecca Cran 50f52ace67 MFC r215306:
libatm_p.a, libkeycap_p.a and libmytinfo_p.a are already in ObsoleteFiles.inc.
liblwres.so.10 has been replaced by liblwres.so.50.
usr/share/man/man8/nsupdate.8.gz was moved to usr/share/man/man1/nsupdate.1.gz
in bind 9.4.3.

Reported by: arundel
2010-11-21 13:41:04 +00:00
Konstantin Belousov 7a9aaa2bb2 MFC r212262:
Add aesni(4) manpage.

MFC r212268:
Grammar fixes.

MFC r212388 (by brueffer):
Some more grammar, wording and mdoc fixes.

MFC r212389 (by brueffer):
Xref aesni(4).
2010-11-21 13:25:10 +00:00
Konstantin Belousov a400b3c597 Bring aesni(4) driver from HEAD.
MFC r210409:
Crypto(4) driver for AESNI.

MFC r213064 (by pjd):
Simplify code a bit.

MFC r213066 (by pjd):
Add support for CRD_F_KEY_EXPLICIT flag.

MFC r213069 (by pjd):
Add support for CRYPTO_AES_XTS.

MFC r213166 (by pjd):
Fix two copy&paste bugs.

MFC r213797 (by dim):
Change two missed instances of 'retq' in aeskeys_i386.S to 'retl'.

MFC r215427:
Only save FPU context when not executing in the context of the crypto
thread.
2010-11-21 13:20:14 +00:00
Rebecca Cran deaa19b27d MFC r215286:
Connect to ftp2.tr.freebsd.org when the Turkey #2 mirror is selected.

PR:	bin/128587
Submitted by: 	Mehmet Kose <mehmet.kose at gmail.com>

MFC r215287:

"Web" should not be all upper-case because it's not an acronym.

PR:	bin/130366
Submitted by:	Royce Williams <royce at alaska.net>

MFC r215290:

ntpdate(8) hosts are now configured in rc.conf via ntpdate_hosts.

PR:	bin/148350
Submitted by: Joel FAEDI <joel.faedi at gmail.com>

MFC r215291:

Remove support for cpioVerbose=medium because bsdcpio doesn't support the
"-V" flag.

PR:	bin/151821
Submitted by: Devin Teske <dteske at vicor.com>

MFC r215296:

Fix use of CD_VERSION=any in cdrom.inf by calling strcmp instead of
variable_cmp.

PR:	bin/142960
Submitted by: G. Paul Ziemba <p-fbsd-bugs at ziemba.us>
2010-11-21 13:04:53 +00:00
Rebecca Cran bc759b9aef MFC r215284, r215285:
When rebooting the machine jump to 0xf000:0xfff0 instead of 0xffff:0x0.
This is the same change that was made in rev 1.33 of boot/i386/btx/btx.S.

PR:	i386/91871
Submitted by:	Bjorn Konig <bkoenig at cs.tu-berlin.de>
2010-11-21 12:52:33 +00:00
Rebecca Cran 01214fdb2c MFC r215281, r215282, r215283, r215304:
Add some descriptions to sys/kern sysctls.
Fix style(9) issues.

PR:	kern/148710
PR:	kern/148510
2010-11-21 12:47:54 +00:00
Xin LI ca6d09fdd0 MFC r214125:
In syscall_module_handler(): all switch branches return, remove
unreached code as pointed out in a Chinese forum [1].

[1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619

Pointed out by:		btw616 <btw s qq com>

MFC r214181:

Call chainevh callback when we are invoked with neither MOD_LOAD nor
MOD_UNLOAD.  This makes it possible to add custom hooks for other module
events.

Return EOPNOTSUPP when there is no callback available.

Pointed out by:	jhb
Reviewed by:	jhb
2010-11-21 12:40:16 +00:00
Bernhard Schmidt 1180648f34 Revert r215618, ABI breakage ahead.
Pointy hat to:	me
2010-11-21 12:32:35 +00:00
Simon L. B. Nielsen d3b19a60e3 MFC r210372:
Add support for creating the archived log filenames using a time-stamp
instead of the traditional simple counter.

Using the time-stamp based file-names, once a log file is archived, it
will not change name until it is deleted.  This means that many backup
systems will only perform one backup of the archived log file, instead
for performing a new backup of the logfile upon each logfile rotation.

This implementation is separate from the patches in the mentioned PR,
as I wasn't aware of the existence of the PR until after I had
implemented the same functionality as the patches in the PR provide.
Unlike the PR, this new code does honor the 'log count' in
newsyslog.conf so old logfiles are deleted.  This new code does not
currently support never deleting the archived logfiles.
2010-11-21 11:10:09 +00:00
Michael Tuexen 536e6bf6b5 MFC r215249:
Add for existing protocol entries the missing SCTP port allocations
and add protocol entries for protocols which have SCTP port allocations.
These entries are according to
http://www.iana.org/assignments/port-numbers
as of today. Also add SCTP port allocation entires for the
echo, daytime, and chargen service.
Discussed with rwatson@
2010-11-21 11:08:22 +00:00
Simon L. B. Nielsen dfefb535c6 MFC r208649 by gordon (needed for MFC of r210372):
Add file include processing for newsyslog.

Format for the include line in /etc/newsyslog.conf is:
<include> /etc/defaults/newsyslog.conf

Other notes of interest:
Globbing is supported in <include> statements.
Properly detect circular include loop dependencies.
2010-11-21 11:04:19 +00:00
Bernhard Schmidt d8ef9f4723 MFC r203422,r203556:
When taking the AMPDU reorder fastpath, need_tap wasn't being
initialized. Initialize on declaration to avoid this.

Found with:	clang static analyzer
Committed by:	rpaulo
2010-11-21 11:03:22 +00:00
Simon L. B. Nielsen 0e066db550 MFC r208648 by gordon (needed for MFC of r210372):
Convert newsyslog to using queue(3) macros instead of a home rolled version.
2010-11-21 11:01:56 +00:00
Bernhard Schmidt 4eb2ef109d MFC r199076:
The isr_intval in ieee80211req_scan_result structure should be 16 bit.
This makes ifconfig list scan display the correct beacon interval
(previously it would int overflow). As a side effect, this makes the
ieee80211req_scan_result word aligned.

Submitted by:	Paul B Mahol <onemda at gmail.com>
Committed by:	rpaulo
2010-11-21 10:58:18 +00:00
Bernhard Schmidt 0cb353e209 MFC r200242:
Fix typo in comment

Submitted by:	Paul B Mahol <onemda at gmail.com>
Committed by:	rpaulo
2010-11-21 10:55:43 +00:00
Bernhard Schmidt 32b1235117 MFC r207322:
Fix typo. No functional change.

Obtained from:	DragonFlyBSD
Committed by:	rpaulo
2010-11-21 10:52:18 +00:00
Bernhard Schmidt c07036b565 Compare the address of the array, not the array.
Committed by:	rpaulo
Found with:	Coverity Prevent(tm)
CID:		3690
2010-11-21 10:49:40 +00:00
Simon L. B. Nielsen d5c80c0aa9 MFC r208028 by uqs:
mdoc: move remaining sections into consistent order
2010-11-21 10:45:10 +00:00
Konstantin Belousov b1a821e82a MFC r215309:
Use symbolic names instead of hardcoding values for magic p_osrel constants.

MFC r215321:
Do not use __FreeBSD_version prefix for the special osrel version.
2010-11-21 10:00:43 +00:00
Konstantin Belousov 85cffc5511 MFC r215307:
Implement a (soft) stack guard page for auto-growing stack mappings.
2010-11-21 09:50:11 +00:00
Marius Strobl bf52259113 MFC: r215325
Use the correct variable for determining the verbosity level in mpt_lprtc().
While at it, fix the whitespace of that macro.

PR:		149502
Submitted by:	Andrew Boyer
2010-11-21 00:53:19 +00:00
Marius Strobl c08ef373f3 MFC: r215295
Let cryptosoft(4) add its pseudo-device with a specific unit number and its
probe method return BUS_PROBE_NOWILDCARD so it doesn't get attached to real
devices hanging off of nexus(4) with no specific devclass set. Actually, the
more desirable fix for this would be to get rid of the newbus interface of
cryptosoft(4) altogether but apparently crypto(9) was written with support
for cryptographic hardware in mind so that approach would require some KPI
breaking changes which don't seem worth it.
2010-11-21 00:50:29 +00:00
Marius Strobl 3d7fe2b587 MFC: r215093
Enable reservation-based physical memory allocation.  Even without the
creation of large page mappings in the pmap, it can provide modest
performance benefits.  In particular, for a "buildworld" on a 2x 1GHz
Ultrasparc IIIi it reduced the wall clock time by 2.2% and the system
time by 12.6%.

Tested by:	marius@
2010-11-21 00:45:18 +00:00
Michael Tuexen 515b7ea73f MFC r215410:
Add an SCTP socket option to retrieve the number of timeouts
of an association.
2010-11-20 21:44:18 +00:00
Michael Tuexen 46bf3c84e0 MFC r215305:
Take out special code for disable CRC computations on
the loopback interface for IPv6. It will be handled
by the loopback interface.
2010-11-20 21:41:07 +00:00
Michael Tuexen 751e38a9ea MFC r215301:
Simplify sctp_delayed_cksum() a bit.
2010-11-20 21:39:08 +00:00
Michael Tuexen 1e6eec437d MFC r215241:
Fix a locking issue reported by brucec@ affecting
1-to-1 style sockets which have not yet been
accepted.
2010-11-20 21:24:17 +00:00
Michael Tuexen 3f71078358 MFC r215199:
Don't print an empty line when printing mapping arrays.
2010-11-20 21:22:20 +00:00
Michael Tuexen c0f67572a8 MFC r215134,r215198:
Fix issues with the SACK/NR-SACK generation code.
2010-11-20 21:20:39 +00:00
Michael Tuexen a41488dcfb MFC r215039:
Improve the scalability by using the local and remote port when
putting inps in the tcpephash.
2010-11-20 21:15:44 +00:00
Rebecca Cran 930669267f MFC r215034:
Fix typos.

PR:	bin/148894
Submitted by:	olgeni
2010-11-20 20:34:13 +00:00
Jilles Tjoelker 4e42b0320c MFC r215211: echo(1): Clarify portability and mention literal "--" handling. 2010-11-20 19:39:12 +00:00
Michael Tuexen 2bd832755b MFC r215035:
Fix a bug which resulted in kevent() reporting an event twice on
1-to-1 style sockets when an ABORT was received.
2010-11-20 19:39:02 +00:00
Jilles Tjoelker cb94bc422e MFC r215184: sh: Remove unused man page for echo builtin.
The information in sh(1) about the echo builtin is equivalent, though less
extensive.

The echo(1) man page (bin/echo/echo.1) is different.

Unfortunately, sh's echo builtin and /bin/echo have gone out of sync and
this probably cannot be fixed any more.
2010-11-20 19:37:33 +00:00
Michael Tuexen 6dc7ae80d2 MFC r214939:
Do not have the MTU table twice in the code. Therefore move the
function from the timer code to util, rename it appropriately and
also fix a bug in sctp_get_prev_mtu(), where calling it with a
value existing in the MTU table did not return a smaller one.
2010-11-20 19:37:00 +00:00
Michael Tuexen 7c8a78a6ba MFC r214933:
Remove two functions which are not used.
2010-11-20 19:35:13 +00:00
Michael Tuexen cb28d93753 MFC r214928:
* Use exponential backoff for retransmission of SHUTDOWN and
   SHUTDOWN-ACK chunks.
 * While there, do some cleanups.
2010-11-20 19:33:42 +00:00
Michael Tuexen 42ab746295 MFC r214918:
Not only stop all timers when entering the SHUTDOWN_SENT state,
but also when entering the SHUTDOWN_ACK_SENT state.
2010-11-20 19:31:31 +00:00
Michael Tuexen 809a6cf821 MFC r214877:
Do not resend DATA chunks without delay when dropped by the peer and
the CRC was correct.
2010-11-20 19:29:18 +00:00
Michael Tuexen 6e230f8c2e MFC r214876
* Fix an accounting bug regarding SACK/NR-SACK chunks.
 * Fix the generation of the SACK/NR-SACK gap lists.
2010-11-20 19:26:35 +00:00
Attilio Rao 9122837dcc Add a second fix-up for the PC98 case.
PC98 cases might be explicit in presence of a difference with i386
because both are defined, leading to mishandling of code in
circumstances like this.

Reported by:	nyan
2010-11-20 18:24:09 +00:00
Jilles Tjoelker bd12f6effa MFC r215183: Make POLL_ERR and POLL_HUP different.
The kernel currently does not generate any of the POLL_* constants, but
some applications use them and break if they are not all distinct.

PR:		kern/126076
2010-11-20 16:46:16 +00:00
Andriy Gapon a0350ac01f fix a mismerge in r215521: MFC imports of ACPICA revisions 20100428
through 20101013

The mismerge resulted in ia64 build breakage.
This is a direct commit.

Pointyhat to:	avg
2010-11-20 16:42:19 +00:00
Bernhard Schmidt a3d853a3da MFC r201793:
Fix #ifdefs so that GCC 4.4 doesn't complain about it.

Committed by:	trasz
2010-11-20 13:28:32 +00:00
Bernhard Schmidt 8ffc02053e MFC r213321:
Fix background roaming to actually work in AUTO roaming mode.

IEEE80211_F_BGSCAN is a vap flag, not a channel flag. So although bgscan
occured, sta_roam_check() would never be called.

Committed by:	adrian
2010-11-20 13:26:09 +00:00
Bernhard Schmidt df8ca6fe5a MFC r209092:
Remove GNU-style struct initialization.

Committed by:	ed
2010-11-20 13:24:05 +00:00
Bernhard Schmidt 71f9552a59 MFC r212853-212855:
Rewrite parts of the calibration code which is run while bringing up
the device:
- Group functions used for initial calibration.
- Unobscure some of the code by moving it into its own functions.
- Get rid of some magic numbers.
- Create similar structure as the reference driver has, this should
  make further syncs easier.
2010-11-20 13:12:59 +00:00
Bernhard Schmidt 2f6f15bd56 MFC r199018 & r199037:
Turn off debug output by default.

Committed by:	dougb
2010-11-20 12:59:01 +00:00
Bernhard Schmidt 044d3ee5f6 MFC r215289:
The ni_rctls checks are used to verify that a ratectl algo has set up
its internal data. This has been used to bypass missing calls in drivers
which do not use the ratectl framework correctly. Issue is, not all algos
use that variable, or even have internal data, therefore valid calls are
not done. Fix this by removing the checks, all driver issues should be
resolved.
2010-11-20 12:28:24 +00:00
Bernhard Schmidt 80a534fa03 MFC r215244:
Some device drivers calculate various timing related things based on
the currently selected rate. The calculations of course need a valid
rate. To make that possible before any call to node_rate() is done,
initialize ni_txrate on none_node_init() calls.
2010-11-20 12:26:31 +00:00
Bernhard Schmidt a7c78ebe99 MFC r214894:
Instead of using the AMRR ratectl algo as default for drivers which have
the IEEE80211_C_RATECTL flag set, default to NONE for all drivers. Only if
a driver calls ieee80211_ratectl_init() check if the NONE algo is still
selected and try to use AMRR in that case. Drivers are still free to use
any other algo by calling ieee80211_ratectl_set() prior to the
ieee80211_ratectl_init() call.

After this change it is now safe to assume that a ratectl algo is always
available and selected, which renders the IEEE80211_C_RATECTL flag pretty
much useless. Therefore revert r211314 and 211546.
2010-11-20 12:24:26 +00:00
Bernhard Schmidt e0fb03767b MFC r207323:
When in the RUN -> AUTH -> RUN FSM transition happens, we'll call the
ratectl_node_init() functions and since ni_rtctls was already malloc'ed()
we will panic. Fix this by using the already malloc'ed pointer.
2010-11-20 12:22:02 +00:00
Konstantin Belousov 0847b0cf1d MFC r215248:
In printfile(), exit the process instead of only printing the warning.
Adjust style.
2010-11-20 11:14:06 +00:00
Martin Matuska 9643d5342f MFC r215260:
Disable VFS_HOLD placed on mnt_vnodecovered during the mount of a snapshot
and VFS_RELE on a non-existing hold on snapshot parent's z_vfs.

This disables the changes from OpenSolaris onnv-revision 9234:bffdc4fc05c4
(bug IDs: 6792139, 6794830) - not applicable to FreeBSD.

This fixes the process hang if umounting a manually mounted snapshot.

Reported by:	Alexander Zagrebin <[email protected]>
Approved by:	delphij (mentor)
2010-11-20 10:12:20 +00:00
Ryan Stone 105be27c60 MFC r212281 and 212282
In munmap() downgrade the vm_map_lock to a read lock before taking a read
lock on the pmc-sx lock.  This prevents a deadlock with
pmc_log_process_mappings, which has an exclusive lock on pmc-sx and tries
to get a read lock on a vm_map.  Downgrading the vm_map_lock in munmap
allows pmc_log_process_mappings to continue, preventing the deadlock.

Without this change I could cause a deadlock on a multicore 8.1-RELEASE
system by having one thread constantly mmap'ing and then munmap'ing a
PROT_EXEC mapping in a loop while I repeatedly invoked and stopped pmcstat
in system-wide sampling mode.

Approved by:	emaste (mentor)
2010-11-20 04:54:58 +00:00
Andrew Thompson 32b4eee246 MFC r213853
- Add missing LibUSB API functions:
   * libusb_strerror()
   * libusb_get_driver[_np]()
   * libusb_detach_kernel_driver[_np]()
 - Factor out setting of non-blocking flag inside libusb.
 - Add missing NULL check after libusb_get_device() call.
 - Correct some wrong error codes due to copy and paste error.

 PR:	usb/150546
 Submitted by:	Robert Jenssen, Alexander Leidinger
2010-11-19 21:04:18 +00:00
Attilio Rao d4137cec56 Fix-up r215539 by specifying correctly the ISA headers are they are not
shared on STABLE_8.

Reported by:	kib
2010-11-19 20:23:01 +00:00
Attilio Rao 432a199eb9 MFC r214457,214515,214584,214676,214681,214686 by jhb, nyan and me:
Move nexus in x86 and cleaning it up.

Sponsored by:	Sandvine Incorporated
2010-11-19 17:49:16 +00:00
Marius Strobl 75de3266bb MFC: r200874
Convert drivers somehow missed in r200874 (merged to stable/8 in r202225)
to multipass probing.
2010-11-19 17:11:12 +00:00
John Baldwin 9821c454ac MFC 204352, 208028, 209266, 209399, 210723, 213672, 215046:
- Fixed static linkage.
- Document that mptutil/mpt do not support RAID volumes in excess of 2TB.
- Report subcommand handler errors so that tools that invoke mptutil can
  robustly report errors.
- Save errno values before calling warn(3) so that errors are correctly
  reported.
- Check for malloc() failures.
2010-11-19 17:08:15 +00:00
Marius Strobl 00b85df504 MFC: r215300
Remove redundant cases and a style(9) bug.
2010-11-19 17:07:32 +00:00
Marius Strobl 4eb4fefd88 MFC: r214879
Implement pmap_is_prefaultable().

Reviewed by:	alc (with bugfix)
2010-11-19 17:04:55 +00:00
John Baldwin cd22545640 MFC 214782:
Update startup_alloc() to support multi-page allocations and allow internal
zones whose objects are larger than a page to use startup_alloc().  This
allows allocation of zone objects during early boot on machines with a large
number of CPUs since the resulting zone objects are larger than a page.
2010-11-19 16:52:18 +00:00
John Baldwin 85c7fe005a MFC 215001:
Only dump the values of the PMC and CMCI local vector table entries on a
local APIC if those LVT entries are valid.  This quiets spurious illegal
register local APIC errors during boot on a CPU that doesn't support those
vectors.
2010-11-19 16:24:12 +00:00
Andriy Gapon 18ff0589ea MFC imports of ACPICA revisions 20100428 through 20101013
Plus related changes and ehancements.

Full list of revisions:

o-----------------------------------------------------------------------
r207344 | jkim | 2010-04-29 01:25:27 +0300 (Thu, 29 Apr 2010) | 2 lines
Merge ACPICA 20100428.
o-----------------------------------------------------------------------
r209065 | jkim | 2010-06-11 22:58:41 +0300 (Fri, 11 Jun 2010) | 2 lines
Simplify a function for getting brightness levels.
o-----------------------------------------------------------------------
r209746 | jkim | 2010-07-06 23:57:28 +0300 (Tue, 06 Jul 2010) | 2 lines
Merge ACPICA 20100702.
o-----------------------------------------------------------------------
r209747 | jkim | 2010-07-07 00:41:08 +0300 (Wed, 07 Jul 2010) | 2 lines
Fix mis-merges in the previous commit.
o-----------------------------------------------------------------------
r210150 | jkim | 2010-07-16 02:24:06 +0300 (Fri, 16 Jul 2010) | 3 lines
If there is any pending sleep request, disallow entering S5 state.
Otherwise, bad things may happen. ;-)
o-----------------------------------------------------------------------
r210976 | jkim | 2010-08-07 02:11:19 +0300 (Sat, 07 Aug 2010) | 2 lines
Merge ACPICA 20100806.
o-----------------------------------------------------------------------
r211763 | mav | 2010-08-24 21:07:59 +0300 (Tue, 24 Aug 2010) | 4 lines
When ACPI reports current battery consumption rate in mAmps, print it also
in mWatts. Values in mAmps are not always suitable, because they depend on
battery voltage, which depends on battery type and charge level.
o-----------------------------------------------------------------------
r212761 | jkim | 2010-09-16 23:08:00 +0300 (Thu, 16 Sep 2010) | 2 lines
Merge ACPICA 20100915.
o-----------------------------------------------------------------------
r213772 | rpaulo | 2010-10-13 14:38:24 +0300 (Wed, 13 Oct 2010) | 3 lines
Mark acpi_bus_number() as __unused. This allows clang to this file
without any warnings.
o-----------------------------------------------------------------------
r213783 | jkim | 2010-10-13 19:30:41 +0300 (Wed, 13 Oct 2010) | 4 lines
Remove acpi_bus_number() completely.  It had to be removed in r212761.
Pointed out by:	jhb
o-----------------------------------------------------------------------
r213787 | jkim | 2010-10-13 20:06:25 +0300 (Wed, 13 Oct 2010) | 2 lines
Clean up unused headers.
o-----------------------------------------------------------------------
r213806 | jkim | 2010-10-14 00:37:02 +0300 (Thu, 14 Oct 2010) | 2 lines
Merge ACPICA 20101013.
o-----------------------------------------------------------------------
r214390 | jkim | 2010-10-26 21:59:50 +0300 (Tue, 26 Oct 2010) | 18 lines
Add two new loader tunables 'hw.acpi.install_interface' and
'hw.acpi.remove_interface'.  hw.acpi.install_interface lets you install new
interfaces.  Conversely, hw.acpi.remove_interface lets you remove OS
interfaces from the pre-defined list in ACPICA.  For example,
	hw.acpi.install_interface="FreeBSD"
lets _OSI("FreeBSD") method to return 0xffffffff (or success) and
	hw.acpi.remove_interface="Windows 2009"
lets _OSI("Windows 2009") method to return zero (or failure).  Both are
comma-separated lists and leading white spaces are ignored.  For example,
the following examples are valid:
	hw.acpi.install_interface="Linux, FreeBSD"
	hw.acpi.remove_interface="Windows 2006, Windows 2006.1"
o-----------------------------------------------------------------------
r214401 | jkim | 2010-10-27 00:22:55 +0300 (Wed, 27 Oct 2010) | 3 lines
Document newly added loader tunables "hw.acpi.install_interface" and
"hw.acpi.remove_interface".
o-----------------------------------------------------------------------
r214765 | jkim | 2010-11-04 01:16:35 +0200 (Thu, 04 Nov 2010) | 4 lines
Adjust a comment to clarify why \_SB_ and \_TZ_ are defined as device type
in ACPICA.  Reshuffle the code a bit to make sure this kludge only applies
to these two specical cases and to make it cleaner.
o-----------------------------------------------------------------------
r214848 | jkim | 2010-11-05 21:50:09 +0200 (Fri, 05 Nov 2010) | 13 lines
Fix a use-after-free bug for extended IRQ resource[1].  When _PRS buffer is
copied as a template for _SRS, a string pointer for descriptor name is also
copied and it becomes stale as soon as it gets de-allocated[2].  Now _CRS is
used as a template for _SRS as ACPI specification suggests if it is usable.
The template from _PRS is still utilized but only when _CRS is not available
or broken.  To avoid use-after-free the problem in this case, however, only
mandatory fields are copied, optional data is removed, and structure length
is adjusted accordingly.
Reported by:	hps[1]
Analyzed by:	avg[2]
Tested by:	hps
o-----------------------------------------------------------------------
r214849 | jkim | 2010-11-05 22:24:26 +0200 (Fri, 05 Nov 2010) | 2 lines
Add a forgotten change from the previous commit.
o-----------------------------------------------------------------------
r214998 | jkim | 2010-11-08 21:52:14 +0200 (Mon, 08 Nov 2010) | 2 lines
Consistently use padding `_' in the comment.
o-----------------------------------------------------------------------

Reviewed by:	jkim
Tested by:	Alexandre "Sunny" Kovalenko <[email protected]>
On behalf of:	jkim
2010-11-19 14:26:45 +00:00
Konstantin Belousov 174f5e8f9f MFC r209686,r209702:
Reimplement vm_object_page_clean(), using the fact that vm object memq
is ordered by page index.

Reviewed by:	alc
2010-11-19 10:14:07 +00:00
Andriy Gapon 30c9a0dab9 MFC r215397: fix misspelling in a comment 2010-11-19 10:01:30 +00:00
Konstantin Belousov e76053227f Merge the kern_fpu_enter/kern_fpu_leave KPI and followup fixes for the
amd64 suspend/resume support.

Tested by:	Mike Tancsa
Also tested by:	Dewayne Geraghty <dewayne.geraghty heuristicsystems com au>,
     Daryl Richards <daryl isletech net>

Below is the svn log of the merged revisions.
------------------------------------------------------------------------
r197455 | emaste | 2009-09-24 17:26:42 +0300 (Thu, 24 Sep 2009) | 5 lines

Add a backtrace to the "fpudna in kernel mode!" case, to help track down
where this comes from.

Reviewed by:	bde

------------------------------------------------------------------------
r197863 | jkim | 2009-10-08 20:41:53 +0300 (Thu, 08 Oct 2009) | 8 lines

Clean up amd64 suspend/resume code.

- Allocate memory for wakeup code after ACPI bus is attached.  The early
memory allocation hack was inherited from i386 but amd64 does not need it.
- Exclude real mode IVT and BDA explicitly.  Improve comments about memory
allocation and reason for the exclusions.  It is a no-op in reality, though.
- Remove an unnecessary CLD from wakeup code and re-align.

------------------------------------------------------------------------
r198931 | jkim | 2009-11-05 00:39:18 +0200 (Thu, 05 Nov 2009) | 2 lines

Tweak memory allocation for amd64 suspend/resume CPU context.

------------------------------------------------------------------------
r200280 | jkim | 2009-12-09 00:38:42 +0200 (Wed, 09 Dec 2009) | 2 lines

Simplify a macro not to generate unncessary symbols.

------------------------------------------------------------------------
r205444 | emaste | 2010-03-22 13:52:53 +0200 (Mon, 22 Mar 2010) | 7 lines

Merge r197455 from amd64:

  Add a backtrace to the "fpudna in kernel mode!" case, to help track down
  where this comes from.

  Reviewed by:	bde

------------------------------------------------------------------------
r208833 | kib | 2010-06-05 18:59:59 +0300 (Sat, 05 Jun 2010) | 15 lines

Introduce the x86 kernel interfaces to allow kernel code to use
FPU/SSE hardware. Caller should provide a save area that is chained
into the stack of the areas; pcb save_area for usermode FPU state is
on top. The pcb now contains a pointer to the current FPU saved area,
used during FPUDNA handling and context switches.  There is also a
facility to allow the kernel thread to use pcb save_area.

Change the dreaded warnings "npxdna in kernel mode!" into the panics
when FPU usage is not registered.

KPI discussed with:	fabient
Tested by:    pho, fabient
Hardware provided by:	Sentex Communications
MFC after:    1 month

------------------------------------------------------------------------
r208834 | kib | 2010-06-05 19:00:53 +0300 (Sat, 05 Jun 2010) | 13 lines

Use the fpu_kern_enter() interface to properly separate usermode FPU
context from in-kernel execution of padlock instructions and to handle
spurious FPUDNA exceptions that sometime are raised when doing padlock
calculations.

Globally mark crypto(9) kthread as using FPU.

Reviewed by:	pjd
Hardware provided by:	Sentex Communications
Tested by:	  pho
PR:    amd64/135014
MFC after:    1 month

------------------------------------------------------------------------
r208877 | kib | 2010-06-06 19:13:50 +0300 (Sun, 06 Jun 2010) | 5 lines

Style-compilant order of declarations.

Noted by:	bde
MFC after:	1 month

------------------------------------------------------------------------
r209174 | jkim | 2010-06-14 23:08:26 +0300 (Mon, 14 Jun 2010) | 3 lines

Fix ACPI suspend/resume on amd64, which was broken since r208833.
We need actual storage for FPU state to save and restore.

------------------------------------------------------------------------
r209198 | kib | 2010-06-15 12:19:33 +0300 (Tue, 15 Jun 2010) | 10 lines

Use critical sections instead of disabling local interrupts to ensure
the consistency between PCPU fpcurthread and the state of the FPU.

Explicitely assert that the calling conventions for fpudrop() are
adhered too. In cpu_thread_exit(), add missed critical section entrance.

Reviewed by:	bde
Tested by:	pho
MFC after:	1 month

------------------------------------------------------------------------
r209204 | kib | 2010-06-15 17:59:35 +0300 (Tue, 15 Jun 2010) | 5 lines

Rename CRITSECT_ASSERT to CRITICAL_ASSERT.

Suggested by:	jhb
MFC after:	1 month

------------------------------------------------------------------------
r209208 | kib | 2010-06-15 21:16:04 +0300 (Tue, 15 Jun 2010) | 4 lines

Remove two obsoleted comments, add a note about 32bit compatibility.

MFC after:	1 month

------------------------------------------------------------------------
r209252 | kib | 2010-06-17 15:35:17 +0300 (Thu, 17 Jun 2010) | 6 lines

In the ia32_{get,set}_fpcontext(), use fpu{get,set}userregs instead
of fpu{get,set}regs.

Noted by:	bde
MFC after:	1 month

------------------------------------------------------------------------
r209460 | kib | 2010-06-23 13:40:28 +0300 (Wed, 23 Jun 2010) | 8 lines

Remove unused i586 optimized bcopy/bzero/etc implementations that utilize
FPU registers for copying. Remove the switch table and jumps from
bcopy/bzero/... to the actual implementation.
As a side-effect, i486-optimized bzero is removed.

Reviewed by:	bde
Tested by:	pho (previous version)

------------------------------------------------------------------------
r209461 | kib | 2010-06-23 14:12:58 +0300 (Wed, 23 Jun 2010) | 8 lines

Remove the support for int13 FPU exception reporting on i386. It is
believed that all 486-class CPUs FreeBSD is capable to run on, either
have no FPU and cannot use external coprocessor, or have FPU on the
package and can use #MF.

Reviewed by:	bde
Tested by:	pho (previous version)

------------------------------------------------------------------------
r209462 | kib | 2010-06-23 14:21:19 +0300 (Wed, 23 Jun 2010) | 8 lines

After the FPU use requires #MF working due to INT13 FPU exception handling
removal, MFi386 r209198:
    Use critical sections instead of disabling local interrupts to ensure
    the consistency between PCPU fpcurthread and the state of FPU.

Reviewed by:	bde
Tested by:	pho

------------------------------------------------------------------------
r210514 | jkim | 2010-07-26 22:53:09 +0300 (Mon, 26 Jul 2010) | 6 lines

Re-implement FPU suspend/resume for amd64.  This removes superfluous uses
of critical_enter(9) and critical_exit(9) by fpugetregs() and fpusetregs().
Also, we do not touch PCB flags any more.

MFC after:	1 month

------------------------------------------------------------------------
r210517 | jkim | 2010-07-27 00:24:52 +0300 (Tue, 27 Jul 2010) | 4 lines

FNSTSW instruction can use AX register as an operand.

Obtained from:	fenv.h

------------------------------------------------------------------------
r210518 | jkim | 2010-07-27 01:16:36 +0300 (Tue, 27 Jul 2010) | 5 lines

Reduce diff against fenv.h:

Mark all inline asms as volatile for safety.  No object file change after
this commit (verified with md5).

------------------------------------------------------------------------
r210519 | jkim | 2010-07-27 01:55:14 +0300 (Tue, 27 Jul 2010) | 2 lines

Remove an unused macro since r189418.

------------------------------------------------------------------------
r210520 | jkim | 2010-07-27 02:02:18 +0300 (Tue, 27 Jul 2010) | 2 lines

Add missing ldmxcsr() prototype for lint case.

------------------------------------------------------------------------
r210521 | jkim | 2010-07-27 02:20:55 +0300 (Tue, 27 Jul 2010) | 3 lines

Simplify fldcw() macro.  There is no reason to use pointer here.  No object
file change after this commit (verified with md5).

------------------------------------------------------------------------
r210614 | jkim | 2010-07-29 19:41:21 +0300 (Thu, 29 Jul 2010) | 2 lines

Rename PCB_USER_FPU to PCB_USERFPU not to clash with a macro from fpu.h.

------------------------------------------------------------------------
r210615 | jkim | 2010-07-29 19:49:20 +0300 (Thu, 29 Jul 2010) | 5 lines

Fix another fallout from r208833.  savectx() is used to save CPU context
for crash dump (dumppcb) and kdb (stoppcbs).  For both cases, there cannot
have a valid pointer in pcb_save.  This should restore the previous
behaviour.

------------------------------------------------------------------------
r210777 | jkim | 2010-08-02 20:35:00 +0300 (Mon, 02 Aug 2010) | 13 lines

- Merge savectx2() with savectx() and struct xpcb with struct pcb. [1]
savectx() is only used for panic dump (dumppcb) and kdb (stoppcbs).  Thus,
saving additional information does not hurt and it may be even beneficial.
Unfortunately, struct pcb has grown larger to accommodate more data.
Move 512-byte long pcb_user_save to the end of struct pcb while I am here.
- savectx() now saves FPU state unconditionally and copy it to the PCB of
FPU thread if necessary.  This gives panic dump and kdb a chance to take
a look at the current FPU state even if the FPU is "supposedly" not used.
- Resuming CPU now unconditionally reinitializes FPU.  If the saved FPU
state was irrelevant, it could be in an unknown state.

Suggested by:	bde [1]

------------------------------------------------------------------------
r210804 | jkim | 2010-08-03 18:32:08 +0300 (Tue, 03 Aug 2010) | 6 lines

savectx() has not been used for fork(2) for about 15 years. [1]
Do not clobber FPU thread's PCB as it is more harmful.  When we resume CPU,
unconditionally reload FPU state.

Pointed out by:	bde [1]

------------------------------------------------------------------------
r212026 | jkim | 2010-08-31 00:19:42 +0300 (Tue, 31 Aug 2010) | 3 lines

Save MSR_FSBASE, MSR_GSBASE and MSR_KGSBASE directly to PCB as we do not use
these values in the function.

------------------------------------------------------------------------
r214347 | jhb | 2010-10-25 18:31:13 +0300 (Mon, 25 Oct 2010) | 5 lines

Use 'saveintr' instead of 'savecrit' or 'eflags' to hold the state returned
by intr_disable().

Requested by:	bde

------------------------------------------------------------------------
2010-11-19 09:49:14 +00:00
Alexander Motin 3a554c8889 MFC r214672:
Remove stale line, accidentally slipped into r214016.
2010-11-19 09:26:39 +00:00
Alexander Motin 2c48d20d8c MFC r209683 by imp:
Add a safety-belt.  If the identified disk has 0 blocks, don't attach
it.  This can happen in some cases when plugging in SD/SmartCard PC
Cards with empty slots.  It is better to detect this bogosity, and
refuse to attach rather than panic with a division by zero (in one of
many places) down stream.
2010-11-19 09:25:12 +00:00
Alexander Motin 44eb566eca MFC r209682 by imp:
Minor formatting nits.
2010-11-19 09:21:53 +00:00
Alexander Motin 67e6009474 MFC r214988:
Teach ahci(4), siis(4) and ATA_CAM ata(4) wrapper report to CAM residual
I/O length on underruns, that often happens for some SCSI commands.
2010-11-19 09:14:53 +00:00
Andrew Thompson d8aabbbb92 MFC r207768
Add dummy function for ic_update_mcast (a la if_urtw) to avoid console
 spam.
2010-11-19 01:58:11 +00:00
Andrew Thompson 762d9c6fb2 MFC r215330
Add the Sierra MC8700.
2010-11-19 01:52:34 +00:00
Andrew Thompson 1289c8a644 MFC r215326
Add a special INIT product ID used by some models of the HUAWEI
 K3765 datacard. After ejecting this device, it reappears using
 the normal K3765 ID. It does not switch automatically
2010-11-19 01:51:51 +00:00
Andrew Thompson 14d21e3116 MFC r212830
Cleanup white space and typos.
2010-11-19 01:50:56 +00:00
Andrew Thompson ba886e36ff MFC r212136
Reduce the need to accesss struct usb_device by providing functions to access
 the product, manufacturer and serial strings.
2010-11-19 01:50:22 +00:00
Andrew Thompson 4ae0e0dcaf MFC r212135
Add support for power mode filtering as some USB hardware does not support
 power saving.
2010-11-19 01:49:22 +00:00
Andrew Thompson 8dfd0c64ca MFC r212134
Change argument for usbd_get_dma_delay() from USB bus to USB device, some
 embedded hardware needs to know exactly which device is in question before it
 exactly can decide the required delay.
2010-11-19 01:48:47 +00:00
Andrew Thompson 476172bf3a MFC r212133
Fix setting of the rx_max and tx_max variables. If the expected buffer size is
 greater than 65535 bytes then the CDC driver might not work as expected, which
 is not likely with the existing USB speeds.
2010-11-19 01:47:46 +00:00
Andrew Thompson 654162c0e8 MFC r212132
Fix UMS_BUTTON_MAX define name
2010-11-19 01:47:09 +00:00
Andrew Thompson 377377a938 MFC r212131
Fix build breakage from r212127
2010-11-19 01:46:33 +00:00
Andrew Thompson 650c9e7236 MFC r212130
Add GPIO programming for more PHY hardware.

Submitted by:	yongari
2010-11-19 01:45:34 +00:00
Andrew Thompson c29b13e527 MFC r212129
Add support for extra buttons on the Kensington Slimblade Trackball.
2010-11-19 01:44:13 +00:00
Andrew Thompson b4f8059f1f MFC r212128
Silence debug error by default.

PR:		usb/141212
2010-11-19 01:43:08 +00:00
Andrew Thompson e77b82188e MFC r212127
We need to grab a node reference count to vap->iv_bss before using it as it is
 possible for the node to be replaced and freed at any time by
 ieee80211_sta_join1().
2010-11-19 01:42:13 +00:00
Andrew Thompson b0d9ec27bf MFC r212122
Add missing MODULE_VERSION() definitions, this resolves problems around
 duplicate module loads.

PR:		usb/125736
Submitted by:	danger, mm
2010-11-19 01:41:28 +00:00
Andrew Thompson 352b0c9bf8 MFC r211104
Add entries for some devices I have locally.
2010-11-19 01:40:34 +00:00
Andrew Thompson 9c1c787fad MFC r211021
Sort this file a little better: the vendors are supposed to be sorted by
 vendor ID in the vendor section, and by symbolic name in the product
 section.  Products are sorted by product ID.  While here, get rid of a
 duplicate Microsoft Mouse entry, revealed by sorting.
2010-11-19 01:39:29 +00:00
Andrew Thompson aabea84219 MFC r210553
Fix the entry for the Option ICON452 where an underscore was used instead of
 whitespace.
2010-11-19 01:36:40 +00:00
Andrew Thompson 60eb6b54d9 MFC r210469
Give a name to the HTC Wizard Smartphone

PR:		usb/135575
2010-11-19 01:35:57 +00:00
Andrew Thompson 388614c6dd MFC r210018
Add a 4 and 7 port USB hub from NEC.

PR:		148189
2010-11-19 01:35:14 +00:00
Andrew Thompson e63f3f327b MFC r209918
Use more compact deviceid table.
2010-11-19 01:34:18 +00:00
Andrew Thompson a4901b5c89 MFC r209917
Update for style(9).

Submitted by:	Akinori Furukoshi (author)
2010-11-19 01:32:23 +00:00
Andrew Thompson 38402b97c3 MFC r209452
- fix for USB audio devices which use the 7-byte endpoint descriptor instead of
   the 9-byte one.
 - remove sync-endpoint code, which is currently unused.

Reported by:	Antun Matanovi
Submitted by:	Hans Petter Selasky
2010-11-19 01:30:59 +00:00
Andrew Thompson 7ae23e3fc6 MFC r209450
Reduce MIDI input buffer size to one USB packet, hence some USB devices don't
 properly short terminate their transfers. This fixes a problem where input
 appears several seconds late.

Reported by:	Alexander Yerenkow
Submitted by:	Hans Petter Selasky
2010-11-19 01:30:23 +00:00
Andrew Thompson bc2045a986 MFC r209443
Add support for LOW speed BULK transfers.  This mode is not recommended by the
 USB 2.0 standard, though some USB devices use it anyway.
2010-11-19 01:29:20 +00:00
Andrew Thompson 05614ab4ae MFC r209144
- Because hostapd calls iv_key_set() before if_init(), make sure key_set
   callback function will be executed, and that the key won't be deleted during
   the init process.
 - txmic and rxmic are written into the chip the same place regardless of
   opmode.
 - Make the hardware generate 802.11 sequence numbers.

Submitted by:	Akinori Furukoshi
2010-11-19 01:28:22 +00:00
Andrew Thompson 12132b25de MFC r206369
Remove debugging code that snuck in.
2010-11-19 01:27:21 +00:00
Andrew Thompson 942afb628a MFC r210275
- Support for Globetrotter iCON 452.
 - Fixed the interface probe routine to only attach to USB interfaces the driver
   actually supports.  This allows other drivers to attach to things like
   MicroSD slots etc.
 - Fixed network interface enumeration to be globally sequential instead of
   relying on the USB interface numbers.  This make sure the first network
   interface always is at uhso0 and the second at usho1 and so on.
 - Added a radio kill switch; exposed through sysctl.
 - Updated the manual page to be verbose about the number of serial ports and
   include iCON 452 in the set of tested hardware.

Submitted by:	Fredrik Lindberg
2010-11-19 01:23:09 +00:00
Andrew Thompson ff47c204ec MFC r203815
Resort includes to match style(9) a bit more. No functional change
 is expected after this commit.
2010-11-19 01:20:53 +00:00
Andrew Thompson ec473d6927 MFC r203775
Remove redundand headers and use more standard ones where necessary.
2010-11-19 01:18:52 +00:00
Andrew Thompson 5614d8f17d MFC r203774
Use more standard way for setting nonblocking flag for a filedescriptor.
 This makes libusb porting a bit easier.
2010-11-19 01:17:49 +00:00
Jaakko Heinonen 09d0eea6f5 MFC r215235:
Set FD_CLOEXEC for the output file only when the file has been specified
with the -o option. Setting the flag for stderr (the default) could
cause the traced process to redirect stderr to a random file.

PR:		bin/152151
2010-11-18 19:06:56 +00:00
Marius Strobl e72e4ca910 MFC: r215348
Return from mii_attach() after calling bus_generic_attach(9) on the device_t
of the MAC driver in order to attach miibus(4) on the first pass instead of
falling through to also calling it on the device_t of miibus(4). The latter
code flow was intended to attach the PHY drivers the same way regardless of
whether it's the first or a repeated pass, modulo the bus_generic_attach()
call in miibus_attach() which shouldn't be there. However, it turned out
that these variants cause miibus(4) to be attached twice under certain
conditions when using MAC drivers as modules.

Submitted by:	yongari
2010-11-18 18:03:52 +00:00
Pyun YongHyeon 961f53c331 MFC r215132,215194:
r215132:
  Add basic WOL support for MCP ethernet controllers. It seems the
  controller does not perform automatic switching from 1000Mbps link
  to 10/100Mbps link when WOL is activated. Implement establishing
  10/100Mps link with auto-negotiation in driver. Link status change
  handler was modified to remove taskqueue based approach since driver
  now needs synchronous handling for link establishment.

  Submitted by:	Yamagi Burmeister (lists <> yamagi.org ) (initial version)
  Tested by:	Yamagi Burmeister (lists <> yamagi.org )

r215194:
  Fix regression introduced in r215132. Caller always holds a driver
  lock before accessing mii, so locking is not needed here.

  Reported by:	Rob Farmer (rfarmer <> predatorlabs dot net)
2010-11-18 17:44:02 +00:00
Xin LI fcd2328a43 MFC through r214047: nc from OpenBSD 4.8. 2010-11-18 01:14:18 +00:00
Jilles Tjoelker a9f3162198 MFC r215022: test: Move tests to tools/regression/bin/test.
Convert the tests to the perl prove format.
Remove obsolete TEST.README (results of an old TEST.sh for some old Unices)
and TEST.csh (old tests without correct values, far less complete than
TEST.sh).
2010-11-17 23:13:02 +00:00
Alan Cox 91a5a9b750 MFC r209407, r209648, r209650
Introduce and use vm_page_next() and vm_page_prev().  They provide both
  a simpler and faster interface for iterating over the pages of an object.
2010-11-17 17:29:22 +00:00
Mark Murray 2550025f96 MFC: Add /bin/rmail symlink to mailwrapper if sendmail is not being built
and mailwrapper is being built. Ensure that it is not removed by
"make delete-old". Add Exim example to man page.
2010-11-17 17:12:41 +00:00
Sergey Kandaurov 5be2aa5b3e MFC r215186:
Add 'jid' as a possible sort order to the help screen.

PR:		bin/150992
Submitted by:	Frederic Culot <frederic at culot dot org>
Approved by:	avg (mentor)
2010-11-17 09:48:18 +00:00
Pyun YongHyeon 90c8dfe394 MFC r215018-215020:
r215018:
  Consistently use tab character instead of using space character.
  No functional changes.

r215019:
  Remove trailing white spaces.

r215020:
  Remove standard PCI configuration space register definitions.
2010-11-16 20:36:52 +00:00
Pyun YongHyeon 6713b3e9ee MFC r215017,215025:
Follow the lead of vendor's interrupt moderation mechanism.
  It seems RTL8169/RTL8168/RTL810xE has a kind of interrupt
  moderation mechanism but it is not documented at all. The magic
  value dramatically reduced number of interrupts without noticeable
  performance drops so apply it to all RTL8169/RTL8169 controllers.
  Vendor's FreeBSD driver also applies it to RTL810xE controllers but
  their Linux driver explicitly cleared the register, so do not
  enable interrupt moderation for RTL810xE controllers.

  While I'm here sort 8169 specific registers.

  Obtained from:	RealTek FreeBSD driver

MFC r215025:
  Only moderate TX completion interrupts. Relying on taskqueue to
  suppress RX interrupts seems to give better RX performance than
  RX interrupt moderation.
2010-11-16 20:32:09 +00:00
Pyun YongHyeon 983e31e607 MFC r214992:
Reduce spin wait time consumed in GMII register access routine.
  There were a couple of attempts in the past to reduce it since it
  took more than 1ms. Because mii_tick() periodically polls link
  status, waiting more than 1ms for each GMII register access was
  overkill. Unfortunately all previous attempts were failed with
  various ways on different controllers.
  This time, add additional 20us dealy at the end of GMII register
  access which seems to requirement of all RealTek controllers to
  issue next GMII register access request. This is the same way what
  Linux does.
2010-11-16 20:21:53 +00:00
Luigi Rizzo a8bf4af320 sync with the version in HEAD -- use ${BINMAKE} built
by the toolchain and not the hosts's make
2010-11-16 17:44:09 +00:00
Alexander Leidinger 077f459569 MFC r206081:
Fix some bogus values in linprocfs.

	Submitted by: Petr Salinger <[email protected]>
	Verified on: GNU/kFreeBSD debian 8.0-1-686 (by submitter)
	PR: 144584

	Reviewed by / discussed with: kib, des, jhb, submitter

Requested by:	emaste
Tested by:	olli
2010-11-16 09:01:19 +00:00
Rebecca Cran cae93784b7 MFC r215136:
Bump .Dd due to additions in r214279.
2010-11-16 07:55:36 +00:00
Rebecca Cran a2d7b94d3c MFC r214395:
Fix formatting.
2010-11-16 07:53:14 +00:00
Rebecca Cran 8d49d2884d MFC r214073:
Stop disallowing device nodes to be passed to camcontrol(8) since libcam
already allows both device names and nodes to be specified.
2010-11-16 07:51:35 +00:00
Rebecca Cran c4fe494d1d MFC r214022:
Remove extra word, which looks like a left-over from a deleted sentence.
2010-11-16 07:47:43 +00:00
Rebecca Cran 1ea6482493 MFC r214021:
Fix grammar.
2010-11-16 07:38:26 +00:00
Rebecca Cran bce122d564 MFC r213763:
Use the RFC2606 domain example.com in examples.
2010-11-16 07:33:53 +00:00
Rebecca Cran 66b13b36e9 MFC r214381:
Add information about the values and default setting of the
kern.cam.ada.spindown_shutdown sysctl.
2010-11-16 07:30:51 +00:00
Rebecca Cran d988c47a0f MFC r215239:
Memory stats are reported in bytes, not pages.

PR:	docs/151283
Submitted by:	Bas Smeelen <b.smeelen at ose.nl>
2010-11-16 07:24:17 +00:00
Rebecca Cran d5a54a4489 MFC r215263:
Add ftp4.se.freebsd.org to the set of mirrors.

PR:	bin/150552
Submitted by:	Niclas Zeising <zeising at lysator.liu.se>
2010-11-16 07:16:40 +00:00
Alan Cox f9706ee1b3 MFC r213455
Initialize KPTmap in locore so that vm86.c can call vtophys() (or really
  pmap_kextract()) before pmap_bootstrap() is called.

  Document the set of pmap functions that may be called before
  pmap_bootstrap() is called.
2010-11-16 05:46:35 +00:00
Alan Cox b6103ffd1d MFC r214938
Eliminate a possible race between pmap_pinit() and pmap_kenter_pde() on
  superpage promotion or demotion.

  Micro-optimize pmap_kenter_pde().
2010-11-16 05:06:20 +00:00
Alan Cox 905c557732 MFC r214953
In case the stack size reaches its limit and its growth must be
  restricted, ensure that grow_amount is a multiple of the page size.
  Otherwise, the kernel may crash in swap_reserve_by_uid() on HEAD and
  FreeBSD 8.x, and produce a core file with a missing stack on FreeBSD
  7.x.
2010-11-16 04:40:27 +00:00
Pyun YongHyeon fdb94105d1 MFC r214968:
Use shorten model name instead of showing all controller model
  numbers. bge(4) supports too many models such that it's
  unreasonable to list all these controllers in one line description
  of name. While I'm here mention that BCM590x/BCM5779x is Fast
  Ethernet controller.
  bge(4) still lacks support for some controllers but supporting
  these controllers should be easy now and adding new controllers
  do not require touching .Nd any more.

  Obtained from:	OpenBSD
2010-11-16 00:32:17 +00:00
Lawrence Stewart add767e9a7 MFC r215154:
The first releases SIFTR will ship in will be 7.4 and 8.2.
2010-11-16 00:06:48 +00:00
Lawrence Stewart 0228fb35e5 MFC r215153:
Standardise all Swinburne related copyright/licence statements throughout the
tree in preparation for another large code import. Swinburne University is the
legal entity that owns copyright and the 2-clause BSD licence is acceptable.
2010-11-16 00:01:44 +00:00
Lawrence Stewart 7fc500198c MFC r215152:
The university does not require that its CRICOS number be included in source
code. Remove all references from the tree.
2010-11-15 23:51:11 +00:00
Maxim Sobolev f7662e479f MFC r207554:
Add new tunable 'net.link.ifqmaxlen' to set default send interface
  queue length. The default value for this parameter is 50, which is
  quite low for many of today's uses and the only way to modify this
  parameter right now is to edit if_var.h file. Also add read-only
  sysctl with the same name, so that it's possible to retrieve the
  current value.
2010-11-15 17:48:13 +00:00
Andriy Gapon 3cc5f9dd65 MFC r215131: make it possible to actually enable hwpstate_verbose 2010-11-15 09:41:46 +00:00
Jilles Tjoelker 2fa537a141 MFC r213925: sh: Use <stddef.h> rather than <sys/stddef.h>.
<sys/stddef.h> is only for the kernel and conflicts with <stddef.h>.

Note: there is no mergeinfo as r213925 was previously "blocked" by obrien.
2010-11-14 19:40:22 +00:00
Jilles Tjoelker 4a1c526e45 MFC r213775: sh: Make DEBUG traces 64-bit clean:
- Use %t to print ptrdiff_t values.
- Cast a ptrdiff_t value explicitly to int for a field width specifier.

While here, sort includes.

Original commit by jhb.
2010-11-14 19:36:55 +00:00
Norikatsu Shigemura db62abd666 Remove extra svn:mergeinfo.
Pointy hat to:	myself
Pointed out by:	hrs, ume, nyan, avg, jhb
Suggested by:	jhb
Reviewd by:	nyan, jhb
Approved by:	imp (mentor)
2010-11-14 13:06:34 +00:00
Marius Strobl 46fe2b2b10 MFC: r214940
Add gpart and glabel to the release CD mfsroot.
2010-11-13 13:46:31 +00:00
Tim Kientzle 161539b2b2 MFC archive_file_count() utility function. 2010-11-13 06:07:39 +00:00
Tim Kientzle 507757c20c MFC r203568: Refactor and simplify the SIGINFO/SIGUSR1
handling.  Switch to a custom function to format 64-bit
ints to avoid the headache of trying to guess printf
modifiers on different platforms.
2010-11-13 06:00:27 +00:00
Tim Kientzle db96dfd841 MFC: reverse an ill-advised experiment trying
to emulate a "root user" on Windows.
2010-11-13 05:55:56 +00:00
Tim Kientzle a276100441 MFC minor Makefile reformat. 2010-11-13 05:53:55 +00:00
Tim Kientzle 8268227749 MFC: Allow -b up to 8192. Folks working with
modern high-speed tape drives are routinely using
block sizes of 1MB (-b 2048), allowing up to 8192
should allow a little room for future growth.
2010-11-13 05:52:45 +00:00
Tim Kientzle 34d8faa990 MFC r203557: Move program name into a global, eliminate
an extra argument from the error-reporting routines.
2010-11-13 05:50:49 +00:00
Tim Kientzle 6eb771f007 MFC some Makefile tweaks. 2010-11-13 05:43:58 +00:00
Bjoern A. Zeeb 4078adbf1a MFC r214565:
Announce both IPsec and UDP Encap (NAT-T) if available for
  feature_present(3) checks.

  This will help to run-time detect and conditionally handle specific
  optionas of either feature in user space (i.e. in libipsec).

  Descriptions read by: rwatson
2010-11-13 01:28:56 +00:00
Pyun YongHyeon 322cc18753 MFC r214844:
Add simple MAC statistics counter reading support. Unfortunately
  useful counters like rl_missed_pkts is 16 bits quantity which is
  too small to hold meaningful information happened in a second. This
  means driver should frequently read these counters in order not to
  lose accuracy and that approach is too inefficient in driver's
  view. Moreover it seems there is no way to trigger an interrupt to
  detect counter near-full or wraparound event as well as lacking
  clearing the MAC counters. Another limitation of reading the
  counters from RealTek controllers is lack of interrupt firing at
  the end of DMA cycle of MAC counter read request such that driver
  have to poll the end of the DMA which is a time consuming process
  as well as inefficient. The more severe issue of the MAC counter
  read request is it takes too long to complete the DMA. All these
  limitation made maintaining MAC counters in driver impractical. For
  now, just provide simple sysctl interface to trigger reading the
  MAC counters. These counters could be used to track down driver
  issues. Users can read MAC counters maintained in controller with
  the following command.
  #sysctl dev.re.0.stats=1

  While I'm here add check for validity of dma map and allocated
  memory before unloading/freeing them.

  Tested by:	rmacklem
2010-11-13 01:09:44 +00:00
Pyun YongHyeon abffe25fb2 MFC r214841-214842:
r214841:
  Remove extra white spaces.

r214842:
  style(9).
2010-11-13 01:05:47 +00:00
Pyun YongHyeon 98de0f9884 MFC r214840:
Enable 64bit DMA addressing for RTL810xE/RTL8168/RTL8111 PCIe
  controllers. Some old PCI controllers may work with DAC but it was
  known to be buggy so 64bit DMA addressing is used only on PCIe
  controllers.
2010-11-13 01:02:09 +00:00
Pyun YongHyeon 0b90ae8162 MFC r214899:
Fix a long standing bug in programming station address for Yukon
  controllers. sk(4) never reprogrammed station address for Yukon
  controllers so overriding station address with ifconfig(8) was not
  possible.
  Fix the bug by reprogramming all registers that control station
  address, flow-control and virtual station address. Virtual station
  address has no use at this moment since driver does not make use of
  fail over feature.

  Tested by:	"Mikhail T." <mi+thun <> aldan.algebra.com>
2010-11-13 00:58:34 +00:00
Pyun YongHyeon 8b1b750e0e MFC r214898:
If we got an invalid station address, generate random address. This
  might be caused by broken BIOS.

  Reported by:	"Mikhail T." <mi+thun <> aldan.algebra.com>
2010-11-13 00:46:07 +00:00
Matthew D Fleming 5b0d5d748f MFC r213813. This is a direct commit because the diff is against
several non-MFC'd changes.

Use a safer mechanism for determining if a task is currently running,
that does not rely on the lifetime of pointers being the same. This
also restores the task KBI.
2010-11-12 18:09:06 +00:00
Sergey Kandaurov ceb1a564a1 MFC r214136:
Reshuffle SIOCGIFCONF32 handler.

Approved by:	kib (mentor)
2010-11-12 11:59:59 +00:00
Rebecca Cran cd16d5a83c MFC r214781, r214807:
Improve rounding of standby timer.
22-29 minutes can't be encoded so must be rounded up to 30.

PR:	bin/151871
2010-11-12 11:36:12 +00:00
Rebecca Cran 180fcbf96c MFC r214279:
Mostly revert r203420, and add similar functionality into ada(4) since the
existing code caused problems with some SCSI controllers.

A new sysctl kern.cam.ada.spindown_shutdown has been added that controls
whether or not to spin-down disks when shutting down.
Spinning down the disks unloads/parks the heads - this is much better than
removing power when the disk is still spinning because otherwise an
Emergency Unload occurs which may cause damage to the actuator.

The FLUSH_CACHE + STANDBY_IMMEDIATE commands are issued following the
procedure documented in Fujitsu's MHW series product documentation under
section 1.10.1, "Recommended power-off sequence".

PR:	kern/140752
Submitted by: olli
2010-11-12 11:22:59 +00:00
Xin LI 9f009a0eb1 MFC r214854:
Validate whether the zfs_cmd_t submitted from userland is not smaller than
what we have.  Without the check the kernel could accessing memory that
does not belong to the request struct.

Note that we do not test if the struct equals in size at this time, which
may faciliate forward compatibility with newer binaries.
2010-11-12 01:45:29 +00:00
John Baldwin 5af5e9479e MFC 211149,211151,211197,211518,215128:
Update various places that store or manipulate CPU masks to use cpumask_t
instead of int or u_int.  Since cpumask_t is currently u_int on all
platforms this should just be a cosmetic change.
2010-11-11 19:39:38 +00:00
Nathan Whitehorn db08aa24d4 MFC r198588:
Turn off Altivec data-stream prefetching before going into power-save
mode on those CPUs that need it.
2010-11-11 14:13:56 +00:00
Kevin Lo a650dfb465 MFC r214972,r215031:
- Intel IXP425 SoC is based on the ARMv5TE architecture
- Minor cosmetic changes
2010-11-11 02:37:50 +00:00
Alexander Motin 41c465d9a8 MFC r209639 by marcel:
Remove the unneeded header <machine/intr.h>.

Reviewed by:	marcel
2010-11-10 19:33:13 +00:00
John Baldwin e29156c8fc MFC 211117:
Simplify the logic for handling ipi_selected() and ipi_cpu() in the
amd64/i386 case.
2010-11-10 17:33:47 +00:00
Jaakko Heinonen f587360a7b MFC r214418: Add missing "readahead" to the nfs_opts list.
PR:		151321
2010-11-10 17:17:38 +00:00
Attilio Rao 9cdb71f119 Fix-up MFC r214446, r214516:
Use the appropriate SYSINIT() ordering between the arches.
This is intended as a fixup for r215059, so no further notes are merged.

Reported by:	jhb
Sponsored by:	Sandvine Incorporated
2010-11-10 14:59:13 +00:00
Konstantin Belousov 55bfe0e587 MFC r214728:
If dlopen() is called for the dso that has been already loaded as a
dependency, then the dso never has its DAG initialized. Empty DAG
makes ref_dag() call in dlopen() a nop, and the dso refcount is off
by one.

Initialize the DAG on the first dlopen() call, using a boolean flag
to prevent double initialization.

MFC r214776:
Fix style.

MFC r214777:
Change init_dag() to not increment DAG refcount. Unconditionally call
both init_dag() and ref_dag() in dlopen() for the case when the object
was already loaded.
2010-11-10 08:46:29 +00:00
Norikatsu Shigemura b67de6751a MFC 211249
This depends on ACPI, so only build on i386:i386, amd64:amd64 and
	ia64:ia64.  It can't possibly work on pc98, or any of the embedded
	platforms, since they lack ACPI.

Pointy hat:	myself
Pointed out:	nyan, releng_8 tinderbox
Approved by:	imp (mentor, implicitly)
2010-11-10 05:22:12 +00:00
Jilles Tjoelker eca89e6c34 MFC r198454: sh: Exempt $@ and $* from set -u
This seems more useful and will likely be in the next POSIX standard.

Also document more precisely in the man page what set -u does (note that
$@, $* and $! are the only special parameters that can ever be unset, all
the others are always set, although they may be empty).
2010-11-09 22:32:11 +00:00
Alexander Motin 651121bdee MFC r209154:
Virtualize pci_remap_msi_irq() call from general MSI code. It allows MSI
(FSB interrupts) to be used by non-PCI devices, such as HPET.
2010-11-09 22:18:20 +00:00
Jilles Tjoelker 4dbb48f5a9 MFC r214280,214853: New tests that also work with stable/8 sh. 2010-11-09 22:17:53 +00:00
Alexander Motin b49ed6f46a MFC r208922 by jhb:
Move the MD support for PCI message signalled interrupts to the x86 tree
as it is identical for i386 and amd64.
2010-11-09 22:03:39 +00:00
Attilio Rao 4c7baa016a MFC r214446, r214516:
Move mptable support to x86/ subtree.

Sponsored by:	Sandvine Incorporated
2010-11-09 21:18:32 +00:00
Attilio Rao a3fce19354 MFC r214373, r214380, r214386:
Move dump_machdep.c into x86/ for amd64, i386 and pc98.

Sponsored by:	Sandvine Incorporated
2010-11-09 21:06:26 +00:00
Marius Strobl 83f6dbefed MFC: r214873
- Move Sun Fire V240 to the list of known working machines.
- For the parallel stable/7 and stable/8 branches mention both releases that
  first supported a particular sparc64 machine and update the sparc64 hardware
  list regarding machines that will be supported beginning with 7.4-RELEASE.
2010-11-09 21:00:24 +00:00
Jean-Sébastien Pédron 1af23e1e06 MFC r214893:
Fix a segmentation fault in argument processing.

The crash was caused by a command line such as this one:
# fold -b1

PR:		bin/151592
Reporter by:	Marcus Reid <[email protected]>
Tested by:	Marcus Reid <[email protected]>
2010-11-09 20:44:55 +00:00
John Baldwin a26ed28729 MFC 210939:
Add a new ipi_cpu() function to the MI IPI API that can be used to send an
IPI to a specific CPU by its cpuid.  Replace calls to ipi_selected() that
constructed a mask for a single CPU with calls to ipi_cpu() instead.
2010-11-09 20:00:23 +00:00
Martin Matuska 3531751157 MFC r214378:
Bugfix merge from OpenSolaris:

OpenSolaris onnv-revision:	10209:91f47f0e7728
6830541	zfs_get_data_trips on a verify
6696242	multiple zfs_fillpage() zfs: accessing past end of object panics
6785914	zfs fails to drop dn_struct_rwlock in recovery code path

Approved by:	delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6830541, 6696242, 6785914)
2010-11-09 19:43:45 +00:00
Alexander Motin c2088ea002 MFC r208452, r208479:
Unify local_apic.c for x86 archs,
2010-11-09 19:29:29 +00:00
John Baldwin 8c10c71bf6 MFC 214682:
Tweak the waitchannel messages for the dead lock detection kthread.  Use
a shorter message (userland generally only sees the first 6 to 8
characters) when waiting for the allproc lock.  Use "-" when idle to match
the behavior of other kthreads.
2010-11-09 18:46:09 +00:00
John Baldwin cda15fda9e MFC 214346:
Use intr_disable() and intr_restore() instead of frobbing the flags register
directly to disable interrupts.
2010-11-09 18:43:59 +00:00
Attilio Rao 3a39846565 MFC r208921 by jhb:
Move mca.c under x86.

Sponsored by:	Sandvine Incorporated
Approved by:	jhb
2010-11-09 18:42:35 +00:00
Alexander Motin f0d4cf672b MFC r208436, r208438:
Make table-based HPET identification more clever. Before creating fake
device, make sure we have no real HPET device entry with same ID.
As side effect, it potentially allows several HPETs to be attached.
Use first of them for timecounting, rest (if ever present) could later
be used as event sources.
2010-11-09 15:14:10 +00:00
Alexander Motin 41ed3673e7 MFC r206900,r206901,r206922,r206993 by rpaulo:
Rename the cyclic global variable lapic_cyclic_clock_func to just
cyclic_clock_func.
2010-11-09 14:53:49 +00:00
Norikatsu Shigemura 31565a6ee8 MFC 211201
Add tpm(4) driver for Trusted Platform Module.
	You may want to look at http://bsssd.sourceforge.net/ .
	Submitted by: Hans-Joerg Hoexer <[email protected]>

MFC 211204
	Fix copyright information.

MFC 211270
	Cosmetic change for splitting bus frontend file and core file.

MFC 211271
	Hook tpm.4 manual to hook.

MFC 212861
	Add support 'device tpm' for amd64.
	Add tpm(4)'s default setting to /boot/defaults/loader.conf.
	Add 'device tpm' to NOTES for amd64 and i386.

Reviewed by:	takawata
Discussed with:	takawata
Approved by:	imp (mentor)
2010-11-09 13:39:17 +00:00
Alexander Motin c75bddfa4b MFC r205999:
ng_gif depends on gif.
2010-11-09 10:28:02 +00:00
Attilio Rao fa9c28b611 MFC r204309, r204313 and r204319 by nyan:
Introduce the x86 subtree for code shared between amd64, i386 and pc98.

Differently from the HEAD version, the headers are not moved around,
in order to avoid breaking the KPI but it can be eventually done once the
core mechanism of r214629 is MFCed.

MFCing this patch does allow for simpler MFCs handling on i386/amd64
specific code.

Sponsored by:   Sandvine Incorporated
2010-11-09 01:57:56 +00:00
Jung-uk Kim a176b4886d MFC: r213755
Use AcpiReset() from ACPICA instead of rolling our own, which is actually
incomplete.  If FADT says the register is available, enable the capability
by default.  Remove the previous default value from acpi(4).
2010-11-08 20:25:19 +00:00
Ulrich Spörlein 1bbf613923 MFC r173289,174783,175454,191681,191698,191834,195044,197304,198210,199858-199859,201348,205578,208327,208336,210871,214628:
Sync bsd-family-tree with head.
2010-11-08 20:21:24 +00:00
Pyun YongHyeon 36bf4f7fa0 MFC r214542:
Don't bother to enable ASPM L1 to save more power. Even though I am
  not able to trigger the issue with sample boards, some users seems
  to suffer from freeze/lockup when system is booted without UTP cable
  plugged in. I'm not sure whether this is BIOS issue or controller
  bug. This change fixes AR8132 lockup issue seen on EEE PC.

  Reported by:	kmoore
  Tested by:	kmoore
2010-11-08 20:14:38 +00:00
Pyun YongHyeon 36e0c97993 MFC r214428:
Add initial BCM5718 family support. The BCM5718 family includes
  the dual port BCM5717 and BCM5718 devices which are intended for
  mainstream workstation and entry-level server designs and
  represents the twelfth generation of NetXtreme Ethernet controllers.
  This family is the successor to the BCM5714/BCM5715 family and
  supports IPv4/IPv6 checksum offloading, TSO, VLAN hardware tagging,
  jumbo frames, MSI/MSIX, IOV, RSS and TSS.

  This change set supports all hardware features except IOV and
  RSS/TSS. Unlike its predecessors, only extended RX buffer
  descriptors can be posted to the jumbo producer ring. Single RX
  buffer descriptors for jumbo frame are not supported. RSS requires
  a more substantial set of changes and will apply to a larger set
  of NetXtreme devices so RSS/TSS multi-queue support will be
  implemented in a future releases.

  Special thanks to Broadcom who kindly sent a sample board to me
  and to davidch who gave provided the initial support code.

  Submitted by:	davidch (initial version)
  HW donated by:	Broadcom
2010-11-08 19:36:00 +00:00
Pyun YongHyeon 9b23e6bceb MFC r213486:
Remove bge_tx_buf_ratio, unused member of softc.
2010-11-08 19:31:41 +00:00
Pyun YongHyeon cb33d3f4d0 MFC r214427:
Add BCM5717C 10/100/1000TX PHY id.
2010-11-08 19:22:36 +00:00
Alexander Motin a9fe77d1b8 MFC r214321:
Do some whitespace and `identify` output cleanup.
2010-11-08 19:12:19 +00:00
Rui Paulo 7214519bce Don't use basename_r(). 2010-11-08 13:31:44 +00:00
Rui Paulo 13b142271f MFC r210688 r210689 r210694 r211184 r212831 r210682 r210683 r210690 r209539
r210199 r210237 r210692 r210695 r210767 r210775 r210776 r211545 r211554
    r211562 r212092 r212358 r212414 r212462 r212495 r210693 r211547 r211550
    r211554 r211561 r211577 r210691 r210697 r211563 r211564 r211841 r211842
    r211562 r212649 r211187 r211555:

Userland DTrace MFC. This only includes the userland side of userland DTrace.
2010-11-08 12:54:55 +00:00
Rui Paulo 7de9e73786 MFC r210682, r210683, r210690:
Build librtld_db.
 Simplify the Makefile. The i386 and amd64 sections are equal.
 libproc is going to be i386/amd64 only with the next update.
2010-11-08 11:22:55 +00:00
Rui Paulo 16622dcda0 MFC r210678, r210769:
librtld_db is an rtld debugging helper library used by userland
  DTrace.
2010-11-08 10:39:02 +00:00
Konstantin Belousov 7b4bec99f8 MFC r214026:
Do not synchronously start the nfsiod threads at all. The r212506
fixed the issues with file descriptor locks, but the same problems are
present for vnode lock/user map lock.
2010-11-08 10:23:39 +00:00
Konstantin Belousov 469a56b828 MFC r214851:
Fix a bug in r214049. The nvp == vp case shall be handled specially
only for !usevget case. If VFS_VGET is working, the vnode shared lock
is obtained recursively and vput() shall be done, not vunref().
2010-11-08 10:18:01 +00:00
Andrey V. Elsukov a30ad72f72 MFC r214352 adapted to stable/8:
Reimplemented "gpart destroy -F". Now it does all work in kernel.
  This was needed for recover implementation.

  Implement the recover command for GPT. Now GPT will marked as
  corrupt when any of three types of corruption will be detected:
  1. Damaged primary GPT header or table
  2. Damaged secondary GPT header or table
  3. Secondary header is not located in the last LBA
  Marked GPT becomes read-only. Any changes with corrupt table
  are prohibited. Only "destroy" and "recover" commands are allowed.

Approved by:	kib (mentor)
2010-11-08 10:08:30 +00:00
Brian Somers c345f5d382 MFC r212886 (by marcel): Unbreak the build on strong-aligned
architectures.
2010-11-07 22:33:55 +00:00
Brian Somers 0320ed8804 MFC r198236 for now. 2010-11-07 22:28:55 +00:00
Brian Somers b624afc9cb MFC r197763 and r212839: Handle extending a filesystem into unzeroed storage. 2010-11-07 22:24:17 +00:00
Jilles Tjoelker 0abea0059f MFC r214609: sh(1): Correct synopsis and make precise how $0 is set.
In particular, the extra argument to set $0 with -c was not documented.
2010-11-07 20:29:39 +00:00
Alan Cox a0d264ffcd MFC r214564
Correct some format strings used by sysctls.
2010-11-07 19:51:51 +00:00
Andriy Gapon d91e0428a1 Followup to r214936: zfs_getpages: account for differences from head
in page locking
2010-11-07 19:32:03 +00:00
Andriy Gapon e164cb68cb MFC r214774: x86 topo_probe: do not probe smp topology if only one cpu
is visible
2010-11-07 18:25:42 +00:00
Andriy Gapon 22711be5b5 MFC r213937: zfs: add vop_getpages method implementation 2010-11-07 18:21:42 +00:00
Marius Strobl 5c03c918d6 MFC: r214606
Try to make the style consistent (including regarding NetBSD bits not yet
merged) and adhere style(9).
2010-11-07 17:54:41 +00:00
Marius Strobl 27ec7b74ea MFC: r214528
- When resetting pm_active and pm_context of a pmap in pmap_pinit() we
  need locking as otherwise we may race against the other parts of the
  MD code which expects a consistent state of these. While at it move
  the resetting of the pmap before entering it in the TSB.
- Spell a 0 as TLB_CTX_KERNEL.
2010-11-07 17:50:54 +00:00
Marius Strobl 9c344ad513 MFC: r214264
- Add IFM_10_2 and IFM_10_5 media via tlphy(4) only in case the respective
  interface also has such connectors.
- In tl_attach() unify three different ways of obtaining the device and
  vendor IDs and remove the now obsolete tl_dinfo from tl_softc.
- Given that tlphy(4) only handles the integrated PHYs of NICs driven by
  tl(4) make it only probe on the latter.
- Switch mlphy(4) and tlphy(4) to use mii_phy_add_media()/mii_phy_setmedia().
- Simplify looking for the respective companion PHY in mlphy(4) and tlphy(4)
  by ignoring the native one by just comparing the device_t's directly rather
  than the device name.
2010-11-07 17:48:07 +00:00
Marius Strobl 2fbcd40066 MFC: r214263
Take advantage of mii_phy_add_media()/mii_phy_setmedia().
2010-11-07 17:40:58 +00:00
Marius Strobl 136378a036 MFC: r214262
- Take advantage of mii_phy_dev_probe().
- Use mii_phy_add_media() instead of mii_add_media(). I'm not sure how
  this driver actually managed to work before as mii_add_media() is
  intended to be used to gether with mii_anar() while mii_phy_add_media()
  is intended to be used with mii_phy_setmedia(), however this driver
  mii_add_media() along with mii_phy_setmedia().
2010-11-07 17:35:42 +00:00
Marius Strobl 555b21308a MFC: r213894, r213896, r214913
Converted the remainder of the NIC drivers to use the mii_attach()
introduced in r213878 (MFC'ed to stable/8 in r214685) instead of
mii_phy_probe(). Unlike r213893 (MFC'ed to stable/8 in r214909) these
are only straight forward conversions though.

Reviewed by:	yongari
2010-11-07 16:56:29 +00:00
Xin LI 7e2f80560e Redo r214897:
MFC r211141 (gabor)

- Fixes to the chkportsum script to handle better some special cases,
  like spaces in filename

Submitted by:   Alex Kozlov <[email protected]>

MFC r210254 (gabor)

- Add a periodic script, which can be used to find installed ports' files with
  mismatched checksum

PR:             conf/124641
Submitted by:   Alex Kozlov <[email protected]>
2010-11-07 11:51:57 +00:00
Xin LI 8b83b2ab6e Revert r214897 in order to finish the merge properly without stopping
svn2cvs.

Pointy hat to:	delphij
2010-11-07 11:39:48 +00:00
Marius Strobl 605d4f8b84 MFC: r213893, r213908, r214566, r214605, r214846
Convert the PHY drivers to honor the mii_flags passed down and convert
the NIC drivers as well as the PHY drivers to take advantage of the
mii_attach() introduced in r213878 (MFC'ed to stable/8 in r214684) to
get rid of certain hacks. For the most part these were:
- Artificially limiting miibus_{read,write}reg methods to certain PHY
  addresses; we now let mii_attach() only probe the PHY at the desired
  address(es) instead.
- PHY drivers setting MIIF_* flags based on the NIC driver they hang
  off from, partly even based on grabbing and using the softc of the
  parent; we now pass these flags down from the NIC to the PHY drivers
  via mii_attach(). This got us rid of all such hacks except those of
  brgphy() in combination with bce(4) and bge(4), which is way beyond
  what can be expressed with simple flags.

While at it, I took the opportunity to change the NIC drivers to pass
up the error returned by mii_attach() (previously by mii_phy_probe())
and unify the error message used in this case where and as appropriate
as mii_attach() actually can fail for a number of reasons, not just
because of no PHY(s) being present at the expected address(es).

Reviewed by:	jhb, yongari
2010-11-07 11:12:29 +00:00
Gabor Kovesdan 3d100f4fe9 MFC r210254:
- Add a periodic script, which can be used to find installed ports' files with
    mismatched checksum

MFC r211141

  - Fixes to the chkportsum script to handle better some special cases,
    like spaces in filename

Approved by:	delphij (mentor)
2010-11-06 21:04:01 +00:00
Marcel Moolenaar d145849824 MFC 213381:
Replace an obsolete flag -L in an mkisofs(1) command line with
-allow-leading-dots to fix "make release" for FreeBSD/powerpc.

Author: hrs
2010-11-06 16:09:25 +00:00
Bjoern A. Zeeb c241774266 MFC r214250:
Make the IPsec SADB embedded route cache a union to be able to hold both the
  legacy and IPv6 route destination address.
  Previously in case of IPv6, there was a memory overwrite due to not enough
  space for the IPv6 address.

PR:		kern/122565
2010-11-06 14:46:24 +00:00
Lawrence Stewart 583e182566 MFC r213913:
Retire the system-wide, per-reassembly queue segment limit. The mechanism is far
too coarse grained to be useful and the default value significantly degrades TCP
performance on moderate to high bandwidth-delay product paths with non-zero loss
(e.g. 5+Mbps connections across the public Internet often suffer).

Replace the outgoing mechanism with an individual per-queue limit based on the
number of MSS segments that fit into the socket's receive buffer.  This should
strike a good balance between performance and the potential for resource
exhaustion when FreeBSD is acting as a TCP receiver. With socket buffer
autotuning (which is enabled by default), the reassembly queue tracks the socket
buffer and benefits too.

As the XXX comment suggests, my testing uncovered some unexpected behaviour
which requires further investigation. By using so->so_rcv.sb_hiwat instead of
sbspace(&so->so_rcv), we allow more segments to be held across both the socket
receive buffer and reassembly queue than we probably should. The tradeoff is
better performance in at least one common scenario, versus a devious sender's
ability to consume more resources on a FreeBSD receiver.

Sponsored by:	FreeBSD Foundation
Reviewed by:	andre, gnn, rpaulo
2010-11-06 10:31:52 +00:00
Lawrence Stewart eceebc34be MFC r213912:
- Switch the "net.inet.tcp.reass.cursegments" and
  "net.inet.tcp.reass.maxsegments" sysctl variables to be based on UMA zone
  stats. The value returned by the cursegments sysctl is approximate owing to
  the way in which uma_zone_get_cur is implemented.

- Discontinue use of V_tcp_reass_qsize as a global reassembly segment count
  variable in the reassembly implementation. The variable was used without
  proper synchronisation and was duplicating accounting done by UMA already. The
  lack of synchronisation was particularly problematic on SMP systems
  terminating many TCP sessions, resulting in poor TCP performance for
  connections with non-zero packet loss.

Sponsored by:	FreeBSD Foundation
Reviewed by:	andre, gnn, rpaulo (as part of a larger patch)
2010-11-06 10:26:49 +00:00
Lawrence Stewart 8574205486 MFC r213162:
Log the number of segments currently in the reassembly queue.

Sponsored by:	FreeBSD Foundation
2010-11-06 10:21:46 +00:00
Lawrence Stewart fed9e14cd1 MFC r210203:
- Move common code from the hook functions that fills in a packet node struct to
  a separate inline function. This further reduces duplicate code that didn't
  have a good reason to stay as it was.

- Reorder the malloc of a pkt_node struct in the hook functions such that it
  only occurs if we managed to find a usable tcpcb associated with the packet.

- Make the inp_locally_locked variable's type consistent with the prototype of
  siftr_siftdata().

Sponsored by:	FreeBSD Foundation
2010-11-06 10:17:43 +00:00
Lawrence Stewart 33b874fb5f MFC r213910:
- Simplify implementation of uma_zone_get_max.
- Add uma_zone_get_cur which returns the current approximate occupancy of a
  zone. This is useful for providing stats via sysctl amongst other things.

Sponsored by:	FreeBSD Foundation
Reviewed by:	gnn, jhb
2010-11-06 10:06:58 +00:00
Lawrence Stewart 3f57590e57 MFC r211396 (originally committed by andre):
Add uma_zone_get_max() to obtain the effective limit after a call
to uma_zone_set_max().

The UMA zone limit is not exactly set to the value supplied but rounded up to
completely fill the backing store increment (a page normally).  This can lead to
surprising situations where the number of elements allocated from UMA is higher
than the supplied limit value.  The new get function reads back the effective
value so that the supplied limit value can be adjusted to the real limit.

Reviewed by:	jeffr
2010-11-06 09:56:14 +00:00
Lawrence Stewart 255cd4302a MFC r213158:
Internalise reassembly queue related functionality and variables which should
not be used outside of the reassembly queue implementation. Provide a new
function to flush all segments from a reassembly queue and call it from the
appropriate places instead of manipulating the queue directly.

Sponsored by:	FreeBSD Foundation
Reviewed by:	andre, gnn, rpaulo
2010-11-06 09:42:41 +00:00
Lawrence Stewart b5008969a4 MFC r209662,209665:
Import the Statistical Information For TCP Research (SIFTR) kernel module into
FreeBSD. SIFTR logs a range of statistics on active TCP connections to a log
file, providing the ability to make highly granular measurements of TCP
connection state. The tool is aimed at system administrators, developers and
researchers alike. Please take it for a spin and test it out - the man page
should have all the information required to get you going.

Many thanks go to the Cisco University Research Program Fund at Community
Foundation Silicon Valley and the FreeBSD Foundation. Their support of our work
at the Centre for Advanced Internet Architectures, Swinburne University of
Technology is greatly appreciated.

r209980:

Catch up with the rename of DPCPU_SUM to DPCPU_VARSUM.

r209982:

The SIFTR DPCPU statistics struct was not being zeroed between enable/disable
cycles so the values would accumulate rather than reset for each cycle.

Sponsored by:	Cisco URP (r209662), FreeBSD Foundation
Reviewed by:	dwmalone, gnn, rpaulo (r209662)
Tested by:	Many on freebsd-current@ and elsewhere over the years
2010-11-06 09:34:51 +00:00
Lawrence Stewart 32be958948 MFC r209050 (originally committed by jhb):
Add helper macros to iterate over available CPUs in the system.
CPU_FOREACH(i) iterates over the CPU IDs of all available CPUs.  The
CPU_FIRST() and CPU_NEXT(i) macros can also be used to iterate over
available CPU IDs.  CPU_NEXT(i) wraps around to CPU_FIRST() rather than
returning some sort of terminator.

Requested by:	rwatson
Reviewed by:	attilio
2010-11-06 09:23:49 +00:00
Marius Strobl ef7b5a69c8 Fix an instance missed in r212892:
MFC r212413: bus_add_child: change type of order parameter to u_int
2010-11-06 01:09:00 +00:00
Jaakko Heinonen 60f9233458 MFC r212505:
In backup_kernel(), support backing up subdirectories and handle files
with spaces correctly.
2010-11-05 16:04:10 +00:00
John Baldwin 54f41d0a52 MFC 214673: Fix a few typos and style nits in the example code. 2010-11-05 13:45:13 +00:00
Rick Macklem 0b472de649 MFC: r214513
Modify nfs_open() in the experimental NFS client to be compatible
with the regular NFS client. Also, fix a couple of mutex lock issues.
2010-11-05 02:45:13 +00:00
Rick Macklem f53ec45200 MFC: r214511
Add a call for nfsrpc_close() to ncl_reclaim() in the experimental
NFSv4 client, since the call in ncl_inactive() might be missed
because VOP_INACTIVE() is not guaranteed to be called before
VOP_RECLAIM().
2010-11-05 02:33:27 +00:00
Rick Macklem 4a51e3dafc MFC: r214406
Add a flag to the experimental NFSv4 client to indicate when
delegations are being returned for reasons other than a Recall.
Also, re-organize nfscl_recalldeleg() slightly, so that it leaves
clearing NMODIFIED to the ncl_flush() call and invalidates the
attribute cache after flushing. It is hoped that these changes
might fix the problem others have seen when using the NFSv4
client with delegations enabled, since I can't reliably reproduce
the problem. These changes only affect the client when doing NFSv4
mounts with delegations enabled.
2010-11-05 02:12:18 +00:00
Doug Barton 73043fc21b Update to 9.6-ESV-R2, the latest from ISC.
This version contains bug fixes that are relevant to any
caching/resolving name server; as well as DNSSEC-related
fixes.
2010-11-04 21:48:39 +00:00
Doug Barton 86efdc843c MFC 214585:
Prep for the 9.6-ESV-R2 update
2010-11-04 21:47:28 +00:00
John Baldwin ae0a145c7f MFC 214625: Correct the abbreviations for general I/O and signal traces. 2010-11-04 17:25:31 +00:00
John Baldwin 60a77eb23c MFC 214449:
Set bootverbose directly in mi_startup() rather than via a SYSINIT.  This
ensures 'bootverbose' is in a valid state for all SYSINITs.
2010-11-04 17:22:49 +00:00
John Baldwin f191701b4b MFC 214448:
Use 'PCPU_GET(apic_id)' to determine the BSP's APIC ID on a UP machine
when routing interrupts instead of cpu_apic_ids[0] since cpu_apic_ids[]
is only populated for multiple-CPU machines.  This also matches what the
code does when SMP is not enabled.
2010-11-04 17:19:16 +00:00
John Baldwin ac72537361 MFC 214203:
- Add a new PCI quirk to whitelist an old chipset that doesn't support
  PCI-express or PCI-X capabilities if we are running in a virtual machine.
- Whitelist the Intel 82440 chipset used by QEMU.
2010-11-04 17:12:29 +00:00
John Baldwin 104961a949 MFC 211820,211821,212292:
Intel QPI chipsets actually provide extra "non-core" PCI buses that
provide PCI devices for various hardware such as memory controllers,
etc.  for each socket.  These PCI buses are not enumerated via ACPI
however.  Add qpi(4) psuedo bus and Host-PCI bridge drivers to
enumerate these buses.  Currently the driver uses the CPU ID to
determine the bridges' presence.
2010-11-04 17:06:54 +00:00
Ulrich Spörlein 6c8a9eb12f MFC r208028,214491: Sync manpages to -CURRENT
r208028:
mdoc: move remaining sections into consistent order

r214491:
Fix another "string" typo.
2010-11-04 12:33:07 +00:00
Ulrich Spörlein f4c7f4a343 MFC r200626,201289,213764,214272, syncing yacc and flex to -CURRENT
r200626:
remove external reference to not (or at least no longer) existing variable 'myname'

r201289:
Let both yacc and lex generate code that passes -Wold-style-definition.

Both these tools emit code where several functions have no `void'
keyword placed in the arugment list when the function has no arguments.

r213764:
Don't define the input() function ifdef YY_NO_INPUT.
This was previously done for the input() function.

r214272:
flex: add missing ifdef magic to create/hide prototypes
This unbreaks build for some software with higher WARNS flags.
2010-11-04 10:53:50 +00:00
Rick Macklem 0c567aa7b5 MFC: r214255
Modify the experimental NFSv4 server's file handle hash function
to use the generic hash32_buf() function. Although adding the
bytes seemed sufficient for UFS and ZFS, since most of the bytes
are the same for file handles on the same volume, this might not
be sufficient for other file systems. Use of a generic function
also seems preferable to one specific to NFSv4.
2010-11-03 22:17:42 +00:00
Konstantin Belousov 0fac65bb15 Bump __FreeBSD_version for struct sysentvec changes in r214755. 2010-11-03 21:51:05 +00:00
Konstantin Belousov c944df2292 MFC r209690:
For "thread signal" command, print some information from siginfo when
available.
2010-11-03 21:40:57 +00:00
Konstantin Belousov 7115692021 MFC r209689:
Extend the td_thrinfo_t to include siginfo for the signal that stopped
the target.
2010-11-03 21:39:11 +00:00
Konstantin Belousov adc410f124 MFC r209873:
Document pl_siginfo and PT_FLAG_SI for PT_LWPINFO.
2010-11-03 21:32:31 +00:00
Konstantin Belousov af6f814ff9 MFC r208513:
Improve the documentation for PT_LWPINFO. Note that some features are
not implemented on MIPS and ARM.
2010-11-03 21:31:03 +00:00
Konstantin Belousov 362adfbff3 MFC r209688:
Extend ptrace(PT_LWPINFO) to report siginfo for the signal that caused
debugee stop.
2010-11-03 21:24:21 +00:00
Konstantin Belousov e974cac769 MFC r208453:
Reorganize syscall entry and leave handling.
Implement ptrace_lwpinfo pl_flags PL_FLAG_SCE, PL_FLAG_SCX and
PL_FLAG_EXEC.

The i386, amd64, sparc64, sun4v, powerpc and ia64 syscall()s are
changed to use syscallenter()/syscallret(). MIPS and arm are not
converted and use the mostly unchanged syscall() implementation.

MFC r208514:
Change ia64' struct syscall_args definition so that args is a pointer to
the arguments array instead of array itself.

MFC r208566:
Allow to use syscallname(9) outside subr_trap.c.

MFC r209258 (by rpaulo):
Make DTrace syscall provider work again by including opt_kdtrace.h here.

MFC r209313:
Only enable kdtrace hook in the LINT on the architectures that implement it.

MFC r209697:
Obey sv_syscallnames bounds in syscallname().

NOTE: The KBI of the struct sysentvec is changed, new required members
sv_set_syscall_retval, sv_fetch_syscall_args and sv_syscallnames are
added. The sv_prepsyscall field is now ignored. Third-party modules
using the struct sysentvec must be modified and recompiled, we believe
that only ABI emulators are affected. No such out-of-tree modules are
known. In-tree modules that are affected by the change were converted
to depend on exact version of the kernel, see r214421.
2010-11-03 21:21:12 +00:00
Jamie Gritton f1a436e932 MFC 214434:
Find a jail's type as part of jailparam_init rather than waiting until
  it's absolutely necessary.
2010-11-03 15:54:50 +00:00
Nathan Whitehorn 280a70c705 MFC r214349:
The EHCI_CAPLENGTH and EHCI_HCIVERSION registers are actually sub-registers
within the first 4 bytes of the EHCI memory space. For controllers that
use big-endian MMIO, reading them with 1- and 2-byte reads would then
return the wrong values. Instead, read the combined register with a
4-byte read and mask out the interesting quantities.

Requested by:	marius
2010-11-03 15:31:37 +00:00
John Baldwin cba0874105 Trim unneeded mergeinfo from a file. 2010-11-03 15:31:10 +00:00
John Baldwin 1d78ef725d MFC 213672,213674,214396:
- Report subcommand handler errors in mfiutil so that tools that
  invoke the utilities can robustly report errors.
- Fix compile with -DDEBUG by using the correct mfi_pd_ref union definition
  in mfireg.h.
- Save errno values before calling warn(3) so that errors are correctly
  reported.
- Use powerof2() from <sys/param.h> rather than a copy and paste version.
2010-11-03 15:25:30 +00:00
Nathan Whitehorn 69ddec6bd3 MFC r214601:
Add some missing parentheses so that moea_bat_mapped() actually works.

Submitted by:	alc
2010-11-03 15:24:25 +00:00
Ed Schouten 964e7585ba MFC r214105:
Remove setpgid() call before executing child process.

  Using a separate process group here is bad, since (for example) job
  control in the TTY layer prevents interaction with the TTY, causing the
  child process to hang.
2010-11-03 10:23:06 +00:00
Edwin Groothuis 8662b22c7d MFC of r214002, r214010
- Stylify of uudecode(1)
  Part of PR bin/124739.

- "b64decode -r" did not handle arbitary breaks in base64 encoded
  data. White space should be accepted anywhere in a base64 encoded
  stream, not just after every chunk (4 characters).

  Test-scenario:

  VmVsb2NpdHkgUmV3YXJkcw==

  and

  VmVsb2NpdHkgUmV3YXJkcw
  ==

  should both produce "Velocity Rewards"

PR:		bin/124739
Submitted by:	Mark Andrews <[email protected]>
2010-11-03 10:10:34 +00:00
Konstantin Belousov aa00732632 MFC r214049:
When readdirplus() is handled on the exported filesystem that does
not support VFS_VGET, like msdosfs, do not call VOP_LOOKUP() for
dotdot on the root directory. Our filesystems expect that VFS handles
dotdot lookups on root on its own.
2010-11-03 08:34:00 +00:00
Edwin Groothuis f1ada844d8 MFC of r214722, tzdata2010o:
- Fiji goes into DST three weeks earlier in 2011.
2010-11-03 01:32:39 +00:00
Pyun YongHyeon e0216bb2ed MFC r214432:
Use shorten model name and add RTL8168, RTL8111 to the list of
  supported device. re(4) had been supported all variants of RTL8168,
  RTL8111 and RTL810x. I think this change will cover all controllers
  supported by re(4).
2010-11-03 01:28:09 +00:00
Pyun YongHyeon 7e28b7c9f7 MFC r214302:
Add TSO support over VLAN for i82550/i82551. Controller requires
  VLAN hardware tagging to make TSO work over VLAN. So if VLAN
  hardware tagging is disabled explicitly clear TSO over VLAN. While
  I'm here allow disabling VLAN TX checksum offloading.

  Tested by:	Liudas < liudasb <> centras dot lt >
2010-11-03 01:24:33 +00:00
Pyun YongHyeon 81a880a6e8 MFC r214087,214219,214251,214292:
r214087:
  Add workaround for BCM5906 controller silicon bug. If device
  receive two back-to-back send BDs with less than or equal to 8
  total bytes then the device may hang. The two back-to-back send
  BDs must be in the same frame for this failure to occur.
  Thanks to davidch for detailed errata information.

  Reviewed by:	davidch

r214219:
  Add workaround for BCM5906 A1 controller silicon bug. When
  auto-negotiation results in half-duplex operation, excess collision
  on the ethernet link may cause internal chip delays that may result
  in subsequent valid frames being dropped due to insufficient
  receive buffer resources. The workaround is to choose de-pipeline
  method as a flow control decision for SDI. De-pipeline method
  allows only 1 data in TxMbuf at a time such that a request to RDMA
  from SDI is made only when TxMbuf is empty. Thanks for david for
  providing detailed errata information.

r214251:
  Apply the same workaround for SDI flow control used on BCM5906 A1
  to BCM6906 A0/A2. This should fix a long standing BCM5906 A2 lockup
  issues. Data sheet explicitly mentions BCM5906 A0, A1 and A2 use
  de-pipelined mode on these revisions.
  Special thanks to Buganini who tried all combinations of
  experimental patches for more than 10 days.

  Tested by:	Buganini <buganini <> gmail dot com >

r214292:
  Use bge_chipid to compare controller ids. r214251 incorrectly used
  bge_chiprev.

  Reported by:	Buganini <buganini <> gmail dot com >
2010-11-03 00:03:26 +00:00
Pyun YongHyeon 66e3128e68 MFC r213747,213808,214216:
r213747:
  Protect bge(4) from accessing invalid NIC internal memory regions
  on BCM5906.

  Tested by:	Buganini < buganini <> gmail dot com >

r213808:
  Add more checks for resolved link speed in bge_miibus_statchg().
  Link UP state could be reported first before actual completion of
  auto-negotiation. This change makes bge(4) reprogram BGE_MAC_MODE,
  BGE_TX_MODE and BGE_RX_MODE register only after controller got a
  valid link.

r214216:
  Enable TX MAC state machine lockup fix for both BCM5755 or higher
  and BCM5906. Publicly available data sheet just says it may happen
  due to corrupted TxMbuf.
2010-11-02 23:54:59 +00:00
Pyun YongHyeon 6c35b4ab5d MFC r213522,213587,213711:
r213522:
  Fix a long standing bug which regarded some revisions of controller
  as 5788. This caused BGE_MISC_LOCAL_CTL register is used to
  generate link state change interrupt for non-5788 controllers. The
  interrupt handler may or may not detect link state attention as
  status block wouldn't be updated when an interrupt was generated
  with BGE_MISC_LOCAL_CTL register. All controllers except 5700 and
  5788 should use host coalescing mode register to trigger an
  interrupt.

r213587:
  Do not blindly UP the interface when interface's MTU is changed. If
  driver is not running there is no need to up the interface. While
  I'm here hold driver lock before modifying MTU as it is referenced
  in RX handler.

r213711:
  The IFF_DRV_RUNNING flag is set at the end of bge_init_locked. But
  before setting the flag, interrupt was already enabled such that
  interrupt handler could be run before setting IFF_DRV_RUNNING flag.
  This can lose initial link state change interrupt which in turn
  make bge(4) think that it still does not have valid link. Fix this
  race by protecting the taskqueue with a driver lock.
  While I'm here move reenabling interrupt code after handling of link
  state chage.

  Reviewed by:	davidch
2010-11-02 23:48:08 +00:00
Pyun YongHyeon ae65f8977a MFC r213495,213742:
r213495:
  Add more comments to rings supported by the controller. Different
  versions of controller support different number of ring control
  blocks such that adjust code a bit to access known number of
  send/receive ring control blocks. Previously bge(4) blindly
  accessed 16 send/receive RCBs. Also move initializing standard
  receive producer ring producer index, jumbo receive producer ring
  producer index and mini receive producer ring producer index to
  the end of each receive producer ring initialization.

  Do not assume mini receive producer ring is available only when
  controller has jumbo frame capability, instead explicitly check
  ASIC version BCM5700 to disable mini receive producer ring.

  Additionally always enable send ring 0 regardless of controller
  versions. Previously bge(4) didn't enable send ring 0 if controller
  is BGE_IS_5705_PLUS. Becase bge(4) need 1 send ring to send frames
  at least, I have no idea how it would have worked so far.

  Submitted by:	davidch

r213742:
  Fix a regression introduced in r213495. r213495 disabled mini
  receive producer ring only for BCM5700. It was believed that
  BCM5700 with external SSRAM is the only controller that supports
  mini ring but it seems all BCM570[0-4] requires to disable mini
  receive producer ring. Otherwise, it caused unexpected RX DMA
  error or watchdog timeouts.

  Reported by:	marius, Steve Kargl <sgk <> troutmask dot apl dot washington dot edu>
  Tested by:	marius, Steve Kargl <sgk <> troutmask dot apl dot washington dot edu>
2010-11-02 23:41:43 +00:00
Pyun YongHyeon 07c84cd036 MFC r213485,213710,213812:
r213485:
  Overhaul MII register access routine and remove unnecessary
  BGE_MI_MODE register accesses. Previously bge(4) used to read
  BGE_MI_MODE register to detect whether it needs to disable
  autopolling feature or not. Because we don't touch autopolling in
  other part of driver there is no reason to read BGE_MI_MODE
  register given that we know default value in advance. In order to
  achieve the goal, check whether the controller has CPMU(Central
  Power Mangement Unit) capability. If controller has CPMU feature,
  use 500KHz MII management interface(mdio/mdc) frequency regardless
  core clock frequency. Otherwise use default MII clock. While I'm
  here, add CPMU register definition.

  In bge_miibus_readreg(), rearrange code a bit and remove goto
  statement. In bge_miibus_writereg(), make sure to restore
  autopolling even if MII write failed. The delay time inserted after
  accessing BGE_MI_MODE register increased from 40us to 80us.

  The default PHY address is now stored in softc. All PHYs supported
  by bge(4) currently uses PHY address 1 but it will be changed when
  we add newer controllers. This change will make it easier to change
  default PHY address depending on PHY models.

  Submitted by:	davidch

r213710:
  Remove one last reference of BGE_MI_MODE register for auto polling.
  Previously bge(4) always enabled auto polling for non-BGE_FLAG_TBI
  controllers. With this change, auto polling is not used anymore so
  polling through mii(4) was introduced.

  Reviewed by:	davidch

r213812:
  Fix a regression introduced in r213710. r213710 removed the use of
  auto polling such that it made all controllers obtain link status
  information from the state of the LNKRDY input signal. Broadcom
  recommends disabling auto polling such that driver should rely on
  PHY interrupts for link status change indications. Unfortunately it
  seems some controllers(BCM5703, BCM5704 and BCM5705) have PHY
  related issues so Linux took other approach to workaround it.
  bge(4) didn't follow that and it used to enable auto polling to
  workaround it. Restore this old behavior for BCM5700 family
  controllers and BCM5705 to use auto polling. For BCM5700 and
  BCM5701, it seems it does not need to enable auto polling but I
  restored it for safety.
  Special thanks to marius who tried lots of patches with patience.

  Reported by:	marius
  Tested by:	marius
2010-11-02 23:35:08 +00:00
Pyun YongHyeon 87bab5b163 MFC r213411,213464-213465,213468:
r213411:
  Enable fix for read DMA FIFO overruns on controllers that have this
  fix. Note, we still need workaround for controllers that lacks this
  fix and it needs more work in RX BD updating.

  Submitted by:	davidch

r213464:
  Separate common flags into controller specific and PHY related
  flags. There should be no functional changes. This change will make
  it easy to add more quirk/flags in future.

  Reviewed by:	davidch

r213465:
  Rearrange code a bit to correctly set PHY flags. This change make
  it easy to add more newer ASICs.

  Obtained from:	OpenBSD

r213468:
  Fix bge(4) build breakage when BGE_REGISTER_DEBUG is defined.
2010-11-02 23:23:48 +00:00
Pyun YongHyeon a50e1f4a7d MFC r213316,213333-213334:
r213316:
  Fix IFCAP_TXCSUM/IFCAP_RXCSUM handling. Previously bge(4) used
  IFCAP_HWCSUM to know which capability should be changed such that
  disabling RX checksun offloading resulted in disabling TX checksum
  offloading.

r213333:
  Allow write DMA to request larger DMA burst size to get better
  performance on BCM5785.

  Obtained from:	OpenBSD

r213334:
  Remove extra semicolon.
2010-11-02 23:04:23 +00:00
Pyun YongHyeon fb272f8e8c MFC r213283,213410:
r213283:
  Implement hardware MAC statistics for BCM5705 or newer Broadcom
  controllers. bge(4) exported MAC statistics on controllers that
  maintain the statistics in the NIC's internal memory. Newer
  controllers require register access to fetch these values. These
  counters provide useful information to diagnose driver issues.

r213410:
  Consistently use ifHCOutOctets/ifHCInOctets instead of Octets as
  these names are used in data sheet. Also use UnicastPkts,
  MulticastPkts and BroadcastPkts instead of UcastPkts, McastPkts
  and BcastPkts to clarify its meaning.

  Suggested by:	bde
2010-11-02 22:57:20 +00:00
Pawel Jakub Dawidek 6001d5f79c MFC r214119,r214273,r214274,r214275,r214276,r214282,r214283,r214284,r214692:
r214119:

Use closefrom(2) instead of close(2) in a loop.

r214273:

Load geom_gate.ko module after parsing arguments.

r214274:

Plug memory leaks.

Found with:	valgrind

r214275:

Plug memory leak.

r214276:

Simplify code a bit.

r214282:

Move all NV defines into nv.c, they are not used externally thus there is
no need to make then visible from outside.

r214283:

Implement nv_exists() function that returns true if argument of the given
name exists.

r214284:

Before this change on first connect between primary and secondary we
initialize all the data. This is huge waste of time and resources if
there were no writes yet, as there is no real data to synchronize.

Optimize this by sending "virgin" argument to secondary, which gives it a hint
that synchronization is not needed.

In the common case (where noth nodes are configured at the same time) instead
of synchronizing everything, we don't synchronize at all.

r214692:

Send packets to remote node only via the send thread to avoid possible
races - in this case a keepalive packet was send from wrong thread which
lead to connection dropping, because of corrupted packet.

Fix it by sending keepalive packets directly from the send thread.
As a bonus we now send keepalive packets only when connection is idle.

Submitted by:	Mikolaj Golub <[email protected]>
2010-11-02 22:49:20 +00:00
Pawel Jakub Dawidek 8f405a42e6 MFC r211855:
Update comment now that I finally committed r211854.
2010-11-02 22:48:18 +00:00
Pyun YongHyeon c7a87531ec MFC r213081,213225,213280:
r213081:
  Always show asic/chip revision in device attach phase. There are
  too many bge(4) controllers there and model name does not
  necessarily match asic/chip revision. Relying on VPD string made
  it hard to identify exact asic/chip revision so the first step to
  debug bge(4) was getting exact asic/chip information with verbose
  boot which may not be available on production server.

r213255:
  Set the number of RX frames to receive after RX MBUF low watermark
  has reached. This reduced number of dropped frames when
  flow-control is enabled. Previously it dropped incoming frames once
  RX MBUF low watermark has reached. The value used in MAC RX MBUF
  low watermark is greater than or equal to 4 so receiving two more
  RX frames should not be a problem.

  Obtained from:	OpenBSD

r213280:
  After r207391, brgphy(4) passes resolved flow-control settings to
  parent driver. Use that information to configure flow-control.
  One drawback is there is no way to disable flow-control as we still
  don't have proper way to not advertise RX/TX pause capability to
  link partner. But I don't think it would cause severe problems and
  users can selectively disable flow-control in switch port.
2010-11-02 22:44:51 +00:00
Pawel Jakub Dawidek d0a9a9cc3d MFC r211854:
- When VFS_VGET() is not supported, switch to VOP_LOOKUP().
- We are fine by only share-locking the vnode.
- Remove assertion that doesn't hold for ZFS where we cross mount points
  boundaries by going into .zfs/snapshot/<name>/.

Reviewed by:	rmacklem
Reminded by:	kib
2010-11-02 22:30:19 +00:00
Marius Strobl 2ba4e5dec8 MFC: r214526
Partially revert r203829 (MFC'ed to stable/7 in r205920); as it turns out
what the PowerPC OFW loader did was incorrect as further down the road
cons_probe() calls malloc() so the former can't be called before init_heap()
has succeed. Instead just exit to the firmware in case init_heap() fails
like OF_init() does when hitting a problem as we're then likely running in
a very broken environment where hardly anything can be trusted to work.
2010-11-02 22:12:06 +00:00
Marius Strobl 56f76e4775 MFC: r201430
Fix card/device names, no functional change

The ADMtek AN985 is the cardbus variant of ADMtek AN983
The Netgear FA511 is just a relabled ADMtek AN985

PR:		kern/50574
2010-11-02 21:01:15 +00:00
Marius Strobl 33aee2912f MFC: r213878
Add a NetBSD-compatible mii_attach(), which is intended to eventually
replace mii_phy_probe() altogether. Compared to the latter the advantages
of mii_attach() are:
- intended to be called multiple times in order to attach PHYs in multiple
  passes (f.e. in order to only use sub-ranges of the 0 to MII_NPHY - 1
  range)
- being able to pass along the capability mask from the NIC to the PHY
  drivers
- being able to specify at which address (phyloc) to probe for a PHY
  (instead of always probing at all addresses from 0 to MII_NPHY - 1)
- being able to specify which PHY instance (offloc) to attach
- being able to pass along MIIF_* flags from the NIC to the PHY drivers
  (f.e. as required to indicated to the PHY drivers that flow control is
  supported by the NIC driver, which actually is the motivation for this
  change).

While at it, I used the opportunity to get rid of some hacks in mii(4)
like miibus_probe() generally doing work besides sheer probing and the
"EVIL HACK" (which will vanish entirely along with mii_phy_probe()) by
passing the struct ifnet pointer via an argument of mii_attach() as well
as to fix some resource leaks in mii(4) in case something fails.
Commits which will update the PHY drivers to honor the MII flags passed
down from the NIC drivers and take advantage of mii_attach() to get rid
of certain types of hacks in NIC and PHY drivers as well as a conversion
of the remaining uses of mii_phy_probe() will follow shortly.

Reviewed by:	jhb, yongari
Obtained from:	NetBSD (partially)
2010-11-02 20:06:46 +00:00
Alexander Motin 5ed7281b6c MFC r214016:
Set of legacy mode SATA enchancements:
- Implement proper combined mode decoding for Intel controllers to properly
identify SATA and PATA channels and associate ATA channels with SATA ports.
This fixes wrong reporting and in some cases hard resets to wrong SATA ports.
- Improve SATA registers support to handle hot-plug events and potentially
interface errors. For ICH5/6300ESB chipsets these registers accessible via
PCI config space. For later ones they may be accessible via PCI BAR(5).
- For controllers not generating interrupts on hot-plug events, implement
periodic status polling. Use it to detect hot-plug on Intel and VIA
controllers. Same probably could also be used for Serverworks and SIS.
2010-11-02 09:26:12 +00:00
Alexander Motin 231bbdf084 MFC r213301:
Revert r132291.
Restore setting PIO/WDMA timings for VIA UDMA133 controllers.
Linux disables only AST register writing there, but no all timings.
2010-11-02 09:15:27 +00:00
Alexander Motin 802ad49e2c MFC r213092:
Add missing le32toh(), same as recently done in ata-siliconimage.c.
2010-11-02 09:14:04 +00:00
Alexander Motin 2d50ce53ae MFC r213047 by jchandra:
Add missing byteswap, works on big endian systems now (tested on Netlogic
XLS MIPS processor).
2010-11-02 09:13:13 +00:00
Alexander Motin 4e42082f9e MFC r214102:
Workaround strange situation when EDMA_RESQIP register returns zero instead
of proper value. It caused bunch of "EMPTY CRPB" messages and potentially
may cause premature requests completion, which could cause data corruption.
For most cases it seems enough to just reread register to get proper value.
To protect against worse cases - erase processed queue entries with
impossible values and ignore them if problem still happen.
2010-11-02 09:05:40 +00:00
Alexander Motin 2a7c692036 MFC r214099:
Some mvs(4) style cleanup:
- remove commented debugging code;
- wrap long lines.
2010-11-02 09:04:18 +00:00
Alexander Motin b2cc6dd3cc MFC r214325:
Add missing mtx_destroy() on channel attach failure.
2010-11-02 09:01:08 +00:00
Andriy Gapon 7bb8c01073 MFC r213737: acpi_ec: changes in communication with hardware 2010-11-02 07:56:20 +00:00
Bernhard Schmidt 955d4977c3 MFC r214160,214162,214236
r214236 & r214160:
The firmware does pad notifications to an even number of bytes (at least
the association notification), the included information though always
contains an elem block with an odd number of bytes. We handle the last
byte as if it might contain a whole elem block, this of course is not
true as one byte is not enough to hold a block, we therefore discard the
complete frame. The solution here is to subtract one from the actual
notification length, this is also what the Linux driver does. With this
change the frame ends exactly where the last elem block ends.

r214262:
The firmware always sets bit 14 and 15, to get the real associd we need
to clear those bits.
2010-11-01 19:05:38 +00:00
Edward Tomasz Napierala 47523a4e30 MFC r214245:
Remove workaround for ZFS bug; fix was committed to the //depot/user/pjd/zfs/...
branch some time ago.
2010-11-01 15:43:42 +00:00
Edward Tomasz Napierala efe568ebe9 MFC r212906:
First step at adopting FreeBSD to support PSARC/2010/029.  This makes
acl_is_trivial_np(3) properly recognize the new trivial ACLs.  From
the user point of view, that means "ls -l" no longer shows plus signs
for all the files when running ZFS v28.
2010-11-01 15:36:47 +00:00
Edward Tomasz Napierala 3b20909b31 MFC r212376:
Add minor optimization.  It's less strict than its kernel counterpart
due to upcoming ACL changes required by the new ZFS.

MFC r212379:

Fix previous commit.
2010-11-01 11:38:04 +00:00
Andriy Gapon 51e47385f3 MFC r213323: i386 and amd64 mp_machdep: improve topology detection for Intel CPUs 2010-11-01 08:20:14 +00:00
Andriy Gapon 964d553b2c MFC r212784: amd64: reduce VM_KMEM_SIZE_SCALE to 1 allowing kernel to use more memory 2010-11-01 08:12:28 +00:00
Jaakko Heinonen 1e138e1227 MFC r214419: Correct a typo.
PR:		151321
2010-11-01 06:19:44 +00:00
Jaakko Heinonen 56085e3341 MFC r213668:
- Print the nmount(2) provided error message only when it is set.
- Ensure that the error message is NUL-terminated before printing it.

PR:		bin/147482
2010-11-01 06:17:02 +00:00
Rick Macklem 57ad326e17 MFC: r214224
Modify the file handle hash function in the experimental NFS
server so that it will work better for non-UFS file systems.
The new function simply sums the bytes of the fh_fid field
of fhandle_t.
2010-11-01 02:21:35 +00:00
Rick Macklem 7cb21a4652 MFC: r214149
Modify the experimental NFS server in a manner analagous to
r214049 for the regular NFS server, so that it will not do
a VOP_LOOKUP() of ".." when at the root of a file system
when performing a ReaddirPlus RPC.
2010-11-01 01:55:15 +00:00
Rick Macklem e8949b903c MFC: r214048, r214053
Modify the NFS clients and the NLM so that the NLM can be used
by both clients. Since the NLM uses various fields of the
nfsmount structure, those fields were extracted and put in a
separate nfs_mountcommon structure stored in sys/nfs/nfs_mountcommon.h.
This structure also has a function pointer for a function that
extracts the required information from the mount point and nfs vnode
for that particular client. Also, fix the type of the 3rd argument for
this function.
2010-11-01 01:03:05 +00:00
Bjoern A. Zeeb 76b702c120 Correct a merge issue from r214554, where the field had been deprecated
and reserved in HEAD but is still there in 8.

Reported by:	dhw
2010-10-31 16:54:50 +00:00
Benedict Reuschling 0f005603b0 MFC r214387:
Add some missing documentation to the man page:

- FILES section ref: ~/nsmb.conf
- use of password in examples section
- use of simple encryption for password in examples section

PR:                 docs/132311
Submitted by:       David Horn (dhorn2000 at gmail dot com)
Patch corrected by: trhodes
Approved by:        trhodes
2010-10-31 12:05:37 +00:00
Yoshihiro Takahashi 83ebb70813 MFC: revision 207355
- Change printf() calls to uprintf() for sigreturn().
 - Normalize the messages to include both pid and thread name.
2010-10-31 09:05:04 +00:00
Yoshihiro Takahashi 26aba35f0f MFC: revision 214258
Rewrite the i386 memory probe:
  - Move the base memory setup into a new basemem_setup() routine.

The mergeinfo is already recorded accidentally in the previous commit.
2010-10-31 08:39:42 +00:00
Yoshihiro Takahashi e9e1e95a6f MFC: revision 208639
Use SEL_KPL macro.
2010-10-31 08:18:23 +00:00
Yoshihiro Takahashi c42a846719 MFC: revision 208638
- Add an integer argument to idle to indicate how likely we are to wake
    from idle over the next tick.
  - Add a new MD routine, cpu_wake_idle() to wakeup idle threads who are
    suspended in cpu specific states.  This function can fail and cause the
    scheduler to fall back to another mechanism (ipi).
  - Implement support for mwait in cpu_idle() on i386/amd64 machines that
    support it.  mwait is a higher performance way to synchronize cpus
    as compared to hlt & ipis.
  - Allow selecting the idle routine by name via sysctl machdep.idle.  This
    replaces machdep.cpu_idle_hlt.  Only idle routines supported by the
    current machine are permitted.
2010-10-31 08:14:52 +00:00
Yoshihiro Takahashi b9185bff97 MFC: revision 208634
Reduce diffs against i386.
2010-10-31 08:08:18 +00:00
Yoshihiro Takahashi 7461ab4dc0 MFC: revision 208632
Clarify a potential issue in get_fpcontext() use.
2010-10-31 08:02:47 +00:00
Yoshihiro Takahashi 2c382dd154 MFC: revision 208563
Reduce diffs against syscons_isa.c.  No functional changes.
2010-10-31 07:57:05 +00:00
Bjoern A. Zeeb de7f304e09 MFC r214333:
Factor out DDB commands from r204145, r204279 into if_debug.c for further
  enhancements (1).  Switch to a standard 2-clause BSD license for this (2).

  Unfortunately we have to un-static the ifindex_table for this but do not
  publicly export it.

  Suggested by: rwatson (1) a while back.
  Approved by:  thompsa (2) for the change from r204279.
2010-10-31 00:51:22 +00:00
Bjoern A. Zeeb 9569ce91a3 MFC r214447:
Correct a typo.
2010-10-31 00:37:00 +00:00
Bjoern A. Zeeb ca23deb1d5 MFC r214303:
Add initial inet DDB support for show in_ifaddr and show sin commands which
  proved to be useful while debugging address list problems.
2010-10-30 12:39:51 +00:00
Bjoern A. Zeeb 939ec395f1 MFC r213932:
MfP4 CH182763 (original version):

  Make it harder to exploit certain in_control() related races between the
  intiial lookup at the beginning and the time we will remove the entry
  from the lists by re-checking that entry is still in the list before
  trying to remove it.

  Reported by:  Nima Misaghian (nima_misa hotmail.com) on net@ 20100817
  Tested by:    Nima Misaghian (nima_misa hotmail.com) (original version)
  PR:           kern/146250
  Submitted by: Mikolaj Golub (to.my.trociny gmail.com) (different version)
2010-10-30 12:05:20 +00:00
Bjoern A. Zeeb b349f4c078 MFC r213930:
Close a race acquiring the IF_ADDR_LOCK() for each entry while iterating
  over all interfaces to make sure the address will neither change nor be
  freed while we are working on it.

  PR:		kern/146250
  Submitted by:	Mikolaj Golub (to.my.trociny gmail.com)
2010-10-30 11:54:55 +00:00
Hajimu UMEMOTO 9f0a69add8 MFC r213453: When no protocol entry is found, getproto*_r(3)
should return zero.
2010-10-30 10:30:49 +00:00
Hajimu UMEMOTO cbc62ff26d MFC r213403: Clear errno for each method dispatch. 2010-10-30 10:28:33 +00:00
Alan Cox d299527205 MFC r213408
If vm_map_find() is asked to allocate a superpage-aligned region of
  virtual addresses that is greater than a superpage in size but not a
  multiple of the superpage size, then vm_map_find() is not always
  expanding the kernel pmap to support the last few small pages being
  allocated.  Previously, we grew the kernel page table in
  vm_map_findspace() when we found the first available virtual address.
  Now, instead, we defer the call to pmap_growkernel() until we are
  committed to a range of virtual addresses in vm_map_insert().
2010-10-30 04:53:50 +00:00
Konstantin Belousov 3a58e5b4df MFC r213917:
Document vfs.ncsizefactor and vfs.ncnegfactor.
2010-10-30 01:24:26 +00:00
Konstantin Belousov e26d814c02 MFC r213916:
Provide vfs.ncsizefactor instead of hard-coding namecache ratio.
Move debug.ncnegfactor to vfs.ncnegfactor.
Provide some descriptions for the namecache related sysctls.
2010-10-30 01:19:15 +00:00
Michael Tuexen 73e52e6786 MFC r212897:
Fix a locking issue which resulted in aborted associations
due to a corrupted nr-mapping array.
2010-10-28 19:18:54 +00:00
Michael Tuexen a723a326e9 MFC r212851:
Allow the initial congestion window to be configure
to one MTU. Improve the description.
2010-10-28 19:17:18 +00:00
Michael Tuexen af08c0d795 MFC r212850:
Fix a locking issue which shows up when the code is used
on Mac OS X.
2010-10-28 19:15:30 +00:00
Michael Tuexen b1fef811d2 MFC r212801:
Fix a bug where the wrong PR-SCTP policy was considered.
While there, use always the same code for the check of
TTL expiration.
2010-10-28 19:13:46 +00:00
Michael Tuexen 1db79d4453 MFC r212800:
Make the initial congestion window configurable via sysctl.
2010-10-28 19:12:05 +00:00
Michael Tuexen 4dcd0629bc MFC r212799:
* Implement initial version of send buffer splitting.
* Make send/recv buffer splitting switchable via sysctl.
* While there: Fix some comments.
2010-10-28 19:10:31 +00:00
Michael Tuexen 85d696ee31 MFC r212714:
Remove old debug code.
2010-10-28 19:08:50 +00:00
Michael Tuexen c9559dd111 MFC r212713:
Remove unused variable/assignment.
2010-10-28 19:07:05 +00:00
Michael Tuexen 87aba1e374 MFC r212712:
Delay the assignment of a path for DATA chunk until they hit
the sent_queue. Honor a given path when the SCTP_ADDR_OVER
flag is set.
2010-10-28 19:05:21 +00:00
Michael Tuexen 63c042cd96 MFC r212711:
Use TAILQ_EMPTY() for testing if a tail queue is empty.
Set whoFrom to NULL after freeing whoFrom.
2010-10-28 19:03:26 +00:00
Michael Tuexen 057d46817e MFC r212707:
Remove unused variable/assignment.
2010-10-28 19:00:45 +00:00
Michael Tuexen 0d7f5e845c MFC r212704:
Remove assignment without effect.
2010-10-28 18:59:09 +00:00
Michael Tuexen d0aecdf3f1 MFC r212702:
* Use !TAILQ_EMPTY() for checking if a tail queue is not empty.
* Remove assignment without any effect.
2010-10-28 18:57:16 +00:00
Michael Tuexen 4236ff00ef MFC r212699:
Remove unused variables.
2010-10-28 18:55:29 +00:00
Michael Tuexen 91a67d8ccc MFC 212380:
* Remove code which has no effect.
* Clean up the handling in sctp_lower_sosend().
2010-10-28 18:52:48 +00:00
Michael Tuexen 7fc9daa120 MFC 212242:
Implement correct handling of address parameter and
sendinfo for SCTP send calls.
2010-10-28 18:50:35 +00:00
Michael Tuexen c25fe81cad MFC 209289:
Fix a rece condition in the shutdown handling.
The race condition resulted in a panic.
2010-10-28 17:50:50 +00:00
Randall Stewart c9f97087c2 MFC of 212225
Fix some CLANG warnings. One clang warning is left
due to the fact that its bogus.. nam->sa_family will
not change from AF_INET6 to AF_INET (but clang
thinks it does ;-D)
2010-10-28 17:17:45 +00:00
Michael Tuexen b35c8362f3 MFC 212099:
Fix the the SCTP_WITH_NO_CSUM option when used in combination with
interface supporting CRC offload. While at it, make use of the
feature that the loopback interface provides CRC offloading.
2010-10-28 17:04:32 +00:00
Michael Tuexen 9751622199 MFC 211969:
Fix the the SCTP_WITH_NO_CSUM option when used in combination with
interface supporting CRC offload. While at it, make use of the
feature that the loopback interface provides CRC offloading.
2010-10-28 17:02:36 +00:00
Michael Tuexen a7601581e7 MFC r211950:
Bugfix: Do not send a packet drop report in response to a received
        INIT-ACK with incorrect CRC.
2010-10-28 17:00:31 +00:00
Michael Tuexen 50ccf587c3 MFC 211944:
Fix the switching on/off of CMT using sysctl and socket option.
Fix the switching on/off of PF and NR-SACKs using sysctl.
Add minor improvement in handling malloc failures.
Improve the address checks when sending.
2010-10-28 16:58:12 +00:00
Michael Tuexen bd8bf3271f MFC r211030:
Fix a bug where MSG_TRUNC was not returned in all necessary cases for
SOCK_DGRAM socket. MSG_TRUNC was only returned when some mbufs could
not be copied to the application. If some data was left in the last
mbuf, it was correctly discarded, but MSG_TRUNC was not set.
2010-10-28 16:53:54 +00:00
Michael Tuexen 8200ea4625 MFC r210866:
Fix a bug where endpoints bound to wildcard addresses where
using addresses not announced to the peer due to address
scoping.
2010-10-28 16:51:57 +00:00
Michael Tuexen 87b5adaf04 MFC r210714:
Cleanup code.
2010-10-28 16:49:11 +00:00
Michael Tuexen f9e0083676 MFC r210495:
Fix a bug where the length of a FORWARD-TSN chunk was set incorrectly in
the chunk. This resulted in malformed frames.
Remove a duplicate assignment.
2010-10-28 16:46:27 +00:00
Sergey Kandaurov da4dd41cad MFC r214131.
Enable copyback and system PD states.

Approved by:	kib (mentor)
2010-10-28 15:41:28 +00:00
Sergey Kandaurov a50f408a04 MFC r214130.
Update PD state firmware definitions: add copyback, system.

Approved by:	kib (mentor)
2010-10-28 15:31:18 +00:00
Edwin Groothuis 1310d5e748 MFC of 214124
Fix printing of files located on ZFS filesystem with an st_dev or
st_ino larger than 2**31.

From the PR:

   Printing from a ZFS filesystem using 'lp' fails and returns an
   email reporting "Your printer job was not printed because it was
   not linked to the original file".

   In order to protect against files being switched when files
   are printed using 'lp' or 'lpr -s', the st_dev and st_ino
   values for the original file are saved by lpr and verified
   by lpd before the file is printed. Unfortunately, lpr prints
   both values using '%d' (although both fields are unsigned)
   and lpd(8) assumes a string of decimal digits.

   ZFS (at least) generates st_dev values greater than 2^31-1,
   resulting in negative values being printed - which lpd cannot
   parse, leading it to report that the file has been switched.

   A similar problem would occur with large inode numbers.

   How-To-Repeat:

   Find a file with either st_dev or st_ino greater than 2^31-1
   (stat(1) will report both numbers) and print it with 'lpq -s'.
   This should generate an email reporting that the file could
   not be printed because it was not linked to the original file

PR:           bin/151567
Submitted by: Peter Jeremy <[email protected]>
2010-10-28 00:54:18 +00:00
Konstantin Belousov dae61df6d4 MFC r213983:
Document vunref(9), add some important notes for vrele(9) and vput(9).
Merge all three manpages to one, removing separate file for vput(9).

MFC r214061 (by uqs):
mdoc: fix markup typo.
2010-10-27 16:01:57 +00:00
Konstantin Belousov dc944357d4 MFC r213716:
Add macro DECLARE_MODULE_TIED to denote a module as requiring the
kernel of exactly the same __FreeBSD_version as the headers module was
compiled against.

Mark our in-tree ABI emulators with DECLARE_MODULE_TIED. The modules
use kernel interfaces that the Release Engineering Team feel are not
stable enough to guarantee they will not change during the life cycle
of a STABLE branch. In particular, the layout of struct sysentvec is
declared to be not part of the STABLE KBI.
2010-10-27 15:57:17 +00:00
Konstantin Belousov 247e3c5414 MFC r213664:
The r184588 changed the layout of struct export_args, causing an ABI
breakage for old mount(2) syscall, since most struct <filesystem>_args
embed export_args. The mount(2) is supposed to provide ABI
compatibility for pre-nmount mount(8) binaries, so restore ABI to
pre-r184588.
2010-10-27 15:44:49 +00:00
Rick Macklem 6642b0803b MFC: r213756
Fix the krpc so that it can handle NFSv3,UDP mounts with a read/write
data size greater than 8192. Since soreserve(so, 256*1024, 256*1024)
would always fail for the default value of sb_max, modify clnt_dg.c
so that it uses the calculated values and checks for an error return
from soreserve(). Also, add a check for error return from soreserve()
to clnt_vc.c and change __rpc_get_t_size() to use sb_max_adj instead of
the bogus maxsize == 256*1024.
2010-10-27 13:10:08 +00:00
Pyun YongHyeon 8d68060ac6 MFC r213796:
Rewrite interrupt handler to give fairness for both RX and TX.
  Previously rl(4) continuously checked whether there are RX events
  or TX completions in forever loop. This caused TX starvation under
  high RX load as well as consuming too much CPU cycles in the
  interrupt handler. If interrupt was shared with other devices which
  may be always true due to USB devices in these days, rl(4) also
  tried to process the interrupt. This means polling(4) was the only
  way to mitigate the these issues.

  To address these issues, rl(4) now disables interrupts when it
  knows the interrupt is ours and limit the number of iteration of
  the loop to 16. The interrupt would be enabled again before exiting
  interrupt handler if the driver is still running. Because RX buffer
  is 64KB in size, the number of iterations in the loop has nothing
  to do with number of RX packets being processed. This change
  ensures sending TX frames under high RX load.

  RX handler drops a driver lock to pass received frames to upper
  stack such that there is a window that user can down the interface.
  So rl(4) now checks whether driver is still running before serving
  RX or TX completion in the loop.

  While I'm here, exit interrupt handler when driver initialized
  controller.

  With this change, now rl(4) can send frames under high RX load even
  though the TX performance is still not good(rl(4) controllers can't
  queue more than 4 frames at a time so low TX performance was one of
  design issue of rl(4) controllers). It's much better than previous
  TX starvation and you should not notice RX performance drop with
  this change. Controller still shows poor performance under high
  network load but for many cases it's now usable without resorting
  to polling(4).
2010-10-27 02:04:24 +00:00
Pawel Jakub Dawidek cc2a58b5af MFC r202976,r211927,r212845,r212846,r212934,r213055,r213056,r213057,r213058,
r213059,r213060,r213062,r213063,r213067,r213070,r213071,r213072,r213073,
    r213164,r213165,r213172,r214116,r214118,r214133,r214163,r214225,r214226,
    r214227,r214228,r214229,r214404:

r202976 (by trasz):

Remove pointless assignment.

Found with:	clang

r211927:

Correct offset conversion to little endian. It was implemented in version 2,
but because of a bug it was a no-op, so we were still using offsets in native
byte order for the host. Do it properly this time, bump version to 4 and set
the G_ELI_FLAG_NATIVE_BYTE_ORDER flag when version is under 4.

Reported by:	ivoras

r212845 (by brian):

Support attaching version 4 metadata

Reviewed by:	pjd

r212846:

Fix indent.

r212934 (by brian):

Add a geli resize subcommand to resize encrypted filesystems prior
to growing the filesystem.

Refuse to attach providers where the metadata provider size is
wrong.  This makes post-boot attaches behave consistently with
pre-boot attaches.  Also refuse to restore metadata to a provider
of the wrong size without the new -f switch.  The new -f switch
forces the metadata restoration despite the provider size, and
updates the provider size in the restored metadata to the correct
value.

Helped by:	pjd
Reviewed by:	pjd

r213055:

When trashing metadata, flush after each write.

r213056:

Simplify code a bit by using g_*() API from libgeom.

r213057:

- Make use of g_*() API.
- Flush cache after writing metadata.

r213058:

Because we first write metadata into new place and then trash old place we
don't want situation where old size is equal to new size, as we will trash
newly written metadata.

r213059:

- Use g_*() API when doing backups.
- fsync() created files.

r213060:

- When trashing metadata, repeat overwrite kern.geom.eli.overwrites times.
- Flush write cache after each write.

r213062:

Define default overwrite count, so that userland can use it.

r213063:

Make the code similar to the code in g_eli_integrity.c.

r213067:

Implement switching of data encryption key every 2^20 blocks.
This ensures the same encryption key won't be used for more than
2^20 blocks (sectors). This will be the default now.

r213070:

Add support for AES-XTS. This will be the default now.

r213071:

Document AES-XTS.

r213072:

Update copyright years.

r213073:

Update copyright years.

r213164:

Ignore errors from BIO_FLUSH. It might confuse users that provider wasn't
really killed. What we really care about are write errors only.

r213165:

Change g_eli_debug to int, so one can turn off any GELI output by setting
kern.geom.eli.debug sysctl to -1.

r213172:

- Add support for loading passphrase from a file (-J and -j options).
  This is especially useful for things like installers, where regular
  geli prompt can't be used.
- Add support for specifing multiple -K or -k options, so there is no
  need to cat all keyfiles and read them from standard input.

Requested by:	Kris Moore <[email protected]>, thompsa

r214116:

- Add missing comments.
- Make a comment consistent with others.

r214118:

Bring in geli suspend/resume functionality (finally).

Before this change if you wanted to suspend your laptop and be sure that your
encryption keys are safe, you had to stop all processes that use file system
stored on encrypted device, unmount the file system and detach geli provider.

This isn't very handy. If you are a lucky user of a laptop where suspend/resume
actually works with FreeBSD (I'm not!) you most likely want to suspend your
laptop, because you don't want to start everything over again when you turn
your laptop back on.

And this is where geli suspend/resume steps in. When you execute:

	# geli suspend -a

geli will wait for all in-flight I/O requests, suspend new I/O requests, remove
all geli sensitive data from the kernel memory (like encryption keys) and will
wait for either 'geli resume' or 'geli detach'.

Now with no keys in memory you can suspend your laptop without stopping any
processes or unmounting any file systems.

When you resume your laptop you have to resume geli devices using 'geli resume'
command. You need to provide your passphrase, etc. again so the keys can be
restored and suspended I/O requests released.

Of course you need to remember that 'geli suspend' won't clear file system
cache and other places where data from your geli-encrypted file system might be
present. But to get rid of those stopping processes and unmounting file system
won't help either - you have to turn your laptop off. Be warned.

Also note, that suspending geli device which contains file system with geli
utility (or anything used by 'geli resume') is not very good idea, as you won't
be able to resume it - when you execute geli(8), the kernel will try to read it
and this read I/O request will be suspended.

r214133:

Fix a bug introduced in r213067 where we use authentication key before
initializing it.

r214163:

Free opencrypto sessions on suspend, as they also might keep encryption keys.

r214225:

Move sc_akeyctx and sc_ivctx initialization to the g_eli_mkey_propagate()
function which eliminates code duplication and will ensure proper order
of operation.

r214226:

Encryption keys array might be NULL if device is suspended. Check for this, so
we don't panic when we detach suspended device.

r214227:

Add State tag, so 'geli status' will report active/suspended status, eg:

	# geli status
	   Name     Status  Components
	da0.eli  SUSPENDED  da0
	da1.eli     ACTIVE  da1

r214228:

Close a race between checking if device is already suspended and suspending it.

r214229:

- Improve error messages, so instead of 'Not fully done', the user will get
  information that device is already suspended or that device is using
  one-time key and suspend is not supported.
- 'geli suspend -a' silently skips devices that use one-time key, this is fine,
  but because we log which device were suspended on the console, log also which
  devices were skipped.

r214404:

Use fprintf(stderr) instead of gctl_error() to print a warning about too
big sector size. When gctl error is set gctl_has_param() always returns
'false', which prevents geli(8) from finding some arguments and also masks
an error, which is generates in such case.
2010-10-26 23:06:53 +00:00
Pawel Jakub Dawidek 5ccd716871 - Make it possible for default value to be const.
- Default number is now also a string.
2010-10-26 21:23:55 +00:00
Bernhard Schmidt 74ecd8cfa1 MFC r214069:
Fix an undefined behaviour if the desired ratectl algo is not available.
This can happen if the algos are built as modules but are not loaded. If
the selected ratectl algo is not available, try to load it (The load
module functions does nothing currently). Add a dummy ratectl algo which
always selects the first available rate. Use that one if the desired algo
is not available.
2010-10-26 20:23:29 +00:00
Rui Paulo b148f9b3cc MFC r214056:
Revert r206418
2010-10-26 19:56:53 +00:00
Randall Stewart f4221c0558 MFC:210600
Fix the comment block that has the nice
table to really have the nice table :-)
2010-10-26 19:12:37 +00:00
Randall Stewart 2f4369cdcc MFC:210599
PR SCTP Bugs. Basically a full sized frame of
 PR SCTP FWD-TSN's would not be sent and thus
 cause a stalled connection. Also the rwnd
 Calculation was also off on the receiver side for
 PR-SCTP.
2010-10-26 19:08:26 +00:00
Randall Stewart 99f2a0ca66 MFC:210494
Make sure that we report chunks if a socket
still exists that were not sent. In either
case carefully remove the data if it does not
get taken by the reporting routines.
2010-10-26 19:06:31 +00:00
Randall Stewart 81bb339b23 MFC:210493
When counting the number of chunks in the
retransmission queue to validate the retran count, we
need to include the chunks in the control send queue
too. Otherwise the count will not match and you will get
the invarient warning if invarients are on.
2010-10-26 19:04:05 +00:00
Randall Stewart 70c784401f MFC: 209760
If a user calls sctp_sendx() with a NULL
sinfo we will crash. Instead we should provide
our own temp structure to use internally.
2010-10-26 19:01:56 +00:00
Randall Stewart d9ebb1ad1b MFC of 209663
This fixes a crash in SCTP. It was possible to have a
large number of packets queued to a crashing process.
In a specific case you may get 2 ABORT's back (from
say two packets in flight). If the aborts happened to
be processed at the same time its possible to have
one free the association while the other is trying
to report all the outbound packets. When this occured
it could lead to a crash.
2010-10-26 18:59:36 +00:00
Randall Stewart 0701a86c80 MFC of 209644
Log is:
Fix a bug that will cause a panic. Basically
a read-lock is being called to check the vtag-timewait cache.
Then in two cases (where a vtag is bad i.e. in the time-wait
state) the write-unlokc is called NOT the read-unlock. Under
conditions where lots of associations are coming and going
this willc ause the system to panic with invariants on.
2010-10-26 18:56:55 +00:00
Bernhard Schmidt e93c1ed52b MFC r214070:
There is no reason to call rt_ifmsg(), remove it.

Submitted by:	Paul B Mahol <onemda at gmail.com>
2010-10-26 17:38:45 +00:00
Bernhard Schmidt f7d6948b54 MFC r213729:
Fix monitor mode which is implemented by doing a firmware scan. This
is a port from stable/6, seems like the code got lost during the
background scan changes in r170530.
2010-10-26 17:30:34 +00:00
Benedict Reuschling 1ddc525333 MFC r214147:
Sync with OpenBSD rev. 1.13:
strtonum does not require limits.h

Obtained from:  OpenBSD
Discussed with: ru@
2010-10-26 16:04:23 +00:00
Nathan Whitehorn 0417422795 MFC r212360:
On architectures with non-tree-based page tables like PowerPC, every page
in a range must be checked when calling pmap_remove(). Calling
pmap_remove() from vm_pageout_map_deactivate_pages() with the entire range
of the map could result in attempting to demap an extraordinary number
of pages (> 10^15), so iterate through each map entry and unmap each of
them individually.
2010-10-26 14:59:35 +00:00
Nathan Whitehorn 58f236028a MFC r213456:
Handle vector assist traps without a kernel panic, by setting denormalized
values to zero. A correct solution would involve emulating vector
operations on denormalized values, but this has little effect on accuracy
and is much less complicated for now.
2010-10-26 14:56:46 +00:00
David Xu b11e8ae679 MFC r213241, r213257:
In current code, statically initialized and destroyed object have
same null value, the code can not distinguish between them, to
fix the problem, now a destroyed object is assigned to a non-null
value, and it will be rejected by some pthread functions.
PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is changed to number 1, so that
adaptive mutex can be statically initialized correctly.
2010-10-26 09:25:29 +00:00
Attilio Rao 52754c7acb MFC part of r213103:
Introduce the new files that were left behind in actual merge.

Sponsored by:	Sandvine Incorporated
2010-10-26 08:50:09 +00:00
Attilio Rao b828c732fc MFC r213272 by emaste:
Previously, the aac driver did not handle enclosure management AIFs,
which were raised during hot-swap events. Now such events trigger cam
rescans.

Sponsored by:	Sandvine Incorporated
2010-10-26 01:20:30 +00:00
Attilio Rao 47de14cf00 MFC r212773 by emaste:
Use device_printf where possible, and otherwise at least include the
driver name in printf strings.

Sponsored by:	Sandvine Incorporated
2010-10-26 00:58:15 +00:00
Attilio Rao a1c4998c4d MFC r212628 by emaste:
Add some enums and constants from Adaptec's driver.

Sponsored by:	Sandvine Incorporated
2010-10-26 00:56:23 +00:00
Attilio Rao 04bcee0bf2 MFC r206540 by emaste:
Sync some minor items with the upstream driver.  Should have no functional
change.

Sponsored by:	Sandvine Incorporated
2010-10-26 00:46:02 +00:00
Attilio Rao f8517ab5c4 MFC r213536 by emaste:
Make a thread's address available via the kern proc sysctl, just like the
process address.
2010-10-26 00:21:31 +00:00
Attilio Rao 22c2072a2d MFC r213236 by emaste:
Style fix.

Sponsored by:	Sandvine Incorporated
2010-10-25 23:59:56 +00:00
Attilio Rao ac5b9dd470 MFC r213235 by emaste:
Increase maximum network timeout from 20s to 120s.

Sponsored by:	Sandvine Incorporated
2010-10-25 23:58:16 +00:00
Rick Macklem e95cd57da0 MFC: r213712
Try and make the nfsrv_localunlock() function in the experimental
NFSv4 server more readable. Mostly changes to comments, but a
case of >= is changed to >, since == can never happen. Also, I've
added a couple of KASSERT()s and a slight optimization, since
once the "else if" case happens, subsequent locks in the list can't
have any effect. None of these changes fixes a known bug.
2010-10-25 17:05:14 +00:00
Attilio Rao 87b4501fde MFC r213181 by emaste:
Protect the watchdog daemon against swap OOM killer.

Sponsored by:	Sandvine Incorporated
2010-10-25 15:17:31 +00:00
Attilio Rao 59f9428a69 MFC r213012 by emaste:
Correct sort order.

Sponsored by:	Sandvine Incorporated
2010-10-25 15:01:40 +00:00
Attilio Rao bcdc502fbf MFC r212148 by emaste:
Remove trailing whitespace.

Sponsored by:	Sandvine Incorporated
2010-10-25 14:04:21 +00:00
Attilio Rao 5c4d888019 MFC r212096 by emaste:
As long as we are going to panic anyway, there's no need to hide additional
information behind DIAGNOSTIC.

Sponsored by:	Sandvine Incorporated
2010-10-25 14:02:14 +00:00
Attilio Rao d533296017 MFC r213103:
Make the RPC specific __rpc_inet_ntop() and __rpc_inet_pton() general
in the kernel.

Sponsored by: Sandvine Incorporated
2010-10-25 13:34:55 +00:00
Attilio Rao b2ef25b75c IP_BINDANY is not correctly handled in getsockopt() case.
Fix it by specifying the correct bits.
2010-10-25 13:16:11 +00:00
Attilio Rao 7897a432d7 MFC r212661 and r212756:
Implement correct refcounting of cdevsw open/close pair and detach
stopping for it.

Sponsored by:	Sandvine Incorporated
2010-10-25 13:01:19 +00:00
Alexander Motin bfac4c4860 MFC r212754:
Add support for dumping kernel to gconcat.
Dumping goes to the component, where dump partition begins.
2010-10-25 08:18:29 +00:00
Andriy Gapon d50fbfed84 stable/8: add options KDB and KDB_TRACE to GENERIC kernels
Now that we have code for printing a stack trace on panic using stack(9)
facility without any debugger backend configured, use this ability
in GENERIC kernels to slightly increase amount of debugging information
available in default installations.

This change should not break anything for those who include GENERIC into
a custom kernel config file and have the above options already enabled.
They should only get a warning about duplicate options.

This commit should not change behavior of GENERIC kernels for panics and
traps with respect to core dumping and automatic reset.
As no debugger backend is configured, enter-to-debugger key combination
should still be ignored.

With this commit the sizes of GENERIC kernels increase by one to two KB.

This is a direct commit to the branch.

Approved by:	re
No objections:	core, secteam
2010-10-25 07:58:37 +00:00
Andriy Gapon 62de46c374 add dates along with revision numbers in UPDATING entry for 20101022
This is a direct commit.
2010-10-25 07:36:39 +00:00
Andriy Gapon 19b8ffc8b4 MFC r214097: catch up manual pages with rename of vm_page_sleep_busy to
vm_page_sleep_if_busy
2010-10-25 07:30:14 +00:00
Andriy Gapon 6e7ed0a13f MFC r214096: VOP_GETPAGES.9: clarify and correct description of parameters
and requirements
2010-10-25 07:11:37 +00:00
Andriy Gapon 0c55f05ae3 MFC r214095: PG_BUSY -> VPO_BUSY, PG_WANTED -> VPO_WANTED in manual
pages and comments
2010-10-25 07:06:24 +00:00
Julian Elischer 799bf6ba18 MFC of 196811
Slight cleanup to pcpu macros to better match amd64 and to improve readability
of the output.
2010-10-25 06:33:19 +00:00
Julian Elischer cb99cfcab3 MFC of 199812
allow tinybsd to abort of a step fails.
2010-10-25 06:28:19 +00:00
Kevin Lo 658c1d8cf4 MFC r214001:
Fix a possible, but very unlikely race where the directory dirent is
moved to the location that was used by ".." entry.
2010-10-25 06:16:27 +00:00
Julian Elischer f3887319ae MFC of 200614
make man page match the output of lock profiling.
2010-10-25 05:37:12 +00:00
Julian Elischer bb001618b6 MFC of 206632
If both ALQ and KTR are defined, allow KTR buffer to be used when
ALQ is disabled by sysctl.
2010-10-25 01:22:36 +00:00
Julian Elischer 6e46bcaf5b MFC of svn change 206639.
replace a couple of instances of the same definitions with one in
an include file
2010-10-25 01:02:34 +00:00
Pyun YongHyeon c877ed1e25 MFC r213696:
Do not setup interrupt endpoint for axe(4).
  It seems axe(4) controllers support interrupt endpoint such that
  enabling interrupt endpoint generates about 1000 interrupts/sec.
  Controllers transfer 8 bytes data through interrupt endpoint and
  the data include link UP/DOWN state as well as some PHY related
  information. Previously axe(4) didn't use the transferred data and
  didn't even try to read the data. Because axe(4) counts on mii(4)
  to detect link state changes there is no need to use interrupt
  endpoint here.

  This change fixes generation of unnecessary interrupts which was
  seen when interface is brought to UP.

  No objections from:	hselasky
2010-10-24 21:28:58 +00:00
Pyun YongHyeon 1fae8f077e MFC r213438:
RX buffer allocation failure is not an input error. Controller
  successfully received a frame but we failed to pass it to upper
  stack due to lack of resources. So update if_iqdrops counter
  instead of updating if_ierrors counter.
2010-10-24 21:26:41 +00:00
Pyun YongHyeon f914d487cc MFC r213436:
Don't count input error twice. uether_rxbuf() already updated that
  counter.
2010-10-24 21:25:15 +00:00
Pyun YongHyeon d30b9baeab MFC r213424:
Make upper stack know driver's output status. This change increased
  TX performance from 221kpps to 231kpps.
2010-10-24 21:23:27 +00:00
Pyun YongHyeon 219d4cd101 MFC r213423:
Move updating TX packet counter to the inside of send loop. axe(4)
  controllers combine multiple TX requests into single one if there
  is room in TX buffer of controller. Updating TX packet counter at
  the end of TX completion resulted in incorrect TX packet counter as
  axe(4) thought it sent 1 packet. There is no easy way to know how
  many combined TX were completed in the callback.
  Because this change updates TX packet counter before actual
  transmission, it may not be ideal one. But I believe it's better
  than showing fake 8kpps under high TX load. With this change, TX
  shows 221kpps on Linksus USB200M.
2010-10-24 21:22:00 +00:00
Pyun YongHyeon ca80e9cf3a MFC r213844:
Make sure to not use stale ip/tcp header pointers. The ip/tcp
  header parser uses m_pullup(9) to get access to mbuf chain.
  m_pullup(9) can allocate new mbuf chain and free old one if the
  space left in the mbuf chain is not enough to hold requested
  contiguous bytes. Previously drivers can use stale ip/tcp header
  pointer if m_pullup(9) returned new mbuf chain.

  Reported by:	Andrew Boyer (aboyer <> averesystems dot com)
2010-10-24 21:14:01 +00:00
Pyun YongHyeon 3227992b61 MFC r213842:
Backout r204230. TX mbuf parser for VLAN is still required to
  enable TX checksum offloading if VLAN hardware tagging is disabled.
2010-10-24 21:07:13 +00:00
Ed Schouten e3dbad18f3 MFC r213567:
Import ee 1.5.2 into HEAD.

PR:	bin/145921
2010-10-24 18:12:11 +00:00
Alexander Motin b52322bc75 MFC r213509:
Add ID for Vodafone (ZTE) Mobile Broadband K3565-Z modem.
2010-10-24 17:42:41 +00:00
Alexander Motin ac13fb0fa9 MFC r212991:
Decrease poll interval from 1000 to 100us. This significantly reduces
kernel dump time, especially with minidump.
2010-10-24 17:40:19 +00:00
Marius Strobl 1bb7366dbc MFC: r213385
Remove a header that apart from the license is empty.
2010-10-24 13:43:45 +00:00
Marius Strobl 6a7196daee MFC: r213384
Consistently always explicitly set IFM_HDX for half-duplex.

Obtained from:	OpenBSD (mostly)
2010-10-24 13:41:38 +00:00
Marius Strobl fa0b916a4b MFC: r213364
- In the spirit of previous simplifications factor out the checks for a
  different PHY instance being selected and isolation out into the wrappers
  around the service methods rather than duplicating them over and over
  again (besides, a PHY driver shouldn't need to care about which instance
  it actually is).
- Centralize the check for the need to isolate a non-zero PHY instance not
  supporting isolation in mii_mediachg() and just ignore it rather than
  panicing, which should sufficient given that a) things are likely to
  just work anyway if one doesn't plug in more than one port at a time and
  b) refusing to attach in this case just leaves us in a unknown but most
  likely also not exactly correct configuration (besides several drivers
  setting MIIF_NOISOLATE didn't care about these anyway, probably due to
  setting this flag for no real reason).
- Minor fixes like removing unnecessary setting of sc->mii_anegticks,
  using sc->mii_anegticks instead of hardcoded values etc.
2010-10-24 13:39:19 +00:00
Pawel Jakub Dawidek 15ba193266 MFC r213065,r213068:
r213065:

Remove redundant space.

r213068:

Add support for AES-XTS.

Obtained from:	OpenBSD
2010-10-23 22:11:30 +00:00
Pawel Jakub Dawidek 40e5ce11ae Constify go_val field.
(Should've been MFC of r212547.)
2010-10-23 22:04:37 +00:00
Pawel Jakub Dawidek a12cd6278a Implement G_TYPE_MULTI and G_VAL_OPTIONAL for stable/8.
This should have been MFC, but I've no green light from marcel to remove
G_TYPE_ASCNUM and gc_argname and to modify geom_part in stable/8, so this is
reimplementation that doesn't touch gpart and hopefully doesn't break anything.
2010-10-23 21:56:50 +00:00
Jilles Tjoelker 3745f50342 MFC r213926: sh(1): Clarify subshells/processes for pipelines.
For multi-command pipelines,
1. all commands are direct children of the shell (unlike the original
   Bourne shell)
2. all commands are executed in a subshell (unlike the real Korn shell)
2010-10-23 13:36:09 +00:00
Pyun YongHyeon e197445466 MFC r214089:
Correct handling of shared interrupt in sis_intr(). r212116 incorrectly
  released a drver lock for shared interrupt case such that it caused
  panic. While I'm here check whether driver is still running before
  serving TX/RX handler.

  Reported by:	Jerahmy Pocott < QUAKENET1 <> optusnet dot com dot au >
  Tested by:	Jerahmy Pocott < QUAKENET1 <> optusnet dot com dot au >
2010-10-23 00:41:26 +00:00
Matthew D Fleming 7c2377f189 MFC r214062:
uma_zfree(zone, NULL) should do nothing, to match free(9).

Noticed by:	Ron Steinke <rsteinke at isilon dot com>
2010-10-22 16:00:00 +00:00
Andriy Gapon 78e1f13205 MFC r213528: opensolaris_kmem kmem_size(): report lesser of vm_kmem_size
and available physical memory
2010-10-22 08:57:25 +00:00
Andriy Gapon 4bf0eefc7a add UPDATING entry for r214198: removed ld bug workaround
This is a direct commit to the branch.
2010-10-22 08:46:22 +00:00
Andriy Gapon fa66061fb2 MFC r212647: sys/pcpu.h: remove a workaround for a fixed ld bug 2010-10-22 08:42:44 +00:00
Andriy Gapon 60817e5824 MFC r204955,205885: Various and sundry style, whitespace, and comment
fixes.

On behalf of:	jhb
2010-10-22 08:36:26 +00:00
David E. O'Brien 99b9d38389 Reduce diff to 9-CURRENT. 2010-10-22 06:56:11 +00:00
David E. O'Brien 9ffa5c3fb0 MFC r213814: Do not assume in growstackstr() that a "precious" character
will be immediately written into the stack after the call.  Instead let
the caller manage the "space left".
2010-10-21 23:45:57 +00:00
Sergey Kandaurov 3432d26aa9 Fix typo: Offlaod -> Offload.
PR:		docs/150756
Approved by:	avg (mentor)
2010-10-21 10:11:39 +00:00
David E. O'Brien d7195bf3d3 MFC
r211281: don't shadow sigset
  r212243: improve comments in expand.c
  r213925: use <stddef.h> rather than <sys/stddef.h>
2010-10-21 01:13:41 +00:00
David E. O'Brien 706271a6d2 MFC r213811: c89 linkage and storage class (also covers r213744, r213760) 2010-10-20 18:25:00 +00:00
Xin LI c583b351c6 MFC r212100 (emaste),213632,214066:
Add a new syslog knob, net.link.lagg.failover_rx_all, to control
whether to accept input packets on any link in a failover lagg,
and add the corresponding documentation.
2010-10-20 17:42:10 +00:00
Maxim Konovalov 4d11110420 MFC r211992: some programs could send broadcast/multicast traffic to
ipfw pseudo-interface.  This leads to a panic due to uninitialized
if_broadcastaddr address.  Initialize it and implement ip_output()
method to prevent mbuf leak later.
2010-10-20 12:38:05 +00:00
David E. O'Brien e2c0ea324e MFC:
r213774: DEBUG_FLAGS should be used to enable extra debugging rather than
           frobbing CFLAGS directly.
  r213798: do not inline static functions if debugging
2010-10-20 07:54:43 +00:00
Maxim Konovalov bb8d791889 MFC r212138: csup(1) does not have -g flag. 2010-10-20 07:54:27 +00:00
Maxim Konovalov fb4c40efdf MFC r212094: sync the man page with the reality: nfs/ includes
are under include/ and include/fs/.
2010-10-20 07:40:23 +00:00
David E. O'Brien 22a31ee3d7 MFC r213815: only need to look as far as '..' to find 'test/' 2010-10-20 07:32:25 +00:00
Bjoern A. Zeeb 50f2ca1aeb MFC r213929:
lltable_drain() has never been used so far, thus #if 0 it for now.
  While touching it add the missing locking to the now disabled code
  for the time when we'll resurrect it.
2010-10-20 01:22:04 +00:00
David E. O'Brien 17d807baf3 MFC: r213903: default to 'sh' from PATH if 'SH' env is not set. 2010-10-20 00:24:30 +00:00
David E. O'Brien 6a0cb08c2f MFC r213738: allow one to regression test 'sh' changes without having to
install a potentially bad /bin/sh first.
2010-10-19 23:57:34 +00:00
Jilles Tjoelker 89aca56485 MFC r213326: libc: Remove the i386 assembler version of strlen(3).
On anything modern, the C version, which processes a word at a time, is much
faster. The Intel optimization manual explicitly warns against using REP
prefixes with SCAS or CMPS, which is exactly what the assembler version
does.

A simple test on a Phenom II showed the C version, compiled with -O2, to be
about twice as fast determining the length of 100000 strings between 0 and
255 bytes long.
2010-10-19 22:11:50 +00:00
Edwin Groothuis 9c551b93d6 MFC of r207830
strptime(3) confused July with June with the fr_FR locale.

When parsing the month "juillet" (abbr "jul"), %B recognized it as
"juin" (abbr "jui") because the full name of the month names is
checked at the same time as the abbrevation.

The new behaviour checks the full names first before checking the
abbrevation names.

PR:             kern/141939
Submitted by:   Denis Chatelain <[email protected]>
2010-10-19 21:04:45 +00:00
Sergey Kandaurov 4395f495d9 MFC r213574:
- tcpconnect incorrectly uses err() in usage() with errx() semantics [1]
- 64-bit aware fixes in printf() usage [2]
o   netrate/juggle: time_t has arch-dependent size
o   netrate/tcpconnect: don't assume %ll has always 64bit.

PR:		146088 [1], 146086 [2] (modified)
Approved by:	kib (mentor)
2010-10-19 14:09:17 +00:00
Ed Maste 15c76c7f07 MFC r213451:
Handle null return from XML_ParserCreate and fix a few memory leaks on
  error conditions.
2010-10-19 13:06:26 +00:00
Sergey Kandaurov 19693cfacc MFC r213514:
Wrap lines for SiS and Promise entries to 80 columns.

PR:		docs/146195
Approved by:	avg (mentor)
2010-10-19 10:51:18 +00:00
Konstantin Belousov 2d84fc8319 MFC r212723 (by des):
Implement proc/$$/environment.

MFC r213246:
Rework linprocfs_doprocenviron() and linprocfs_doproccmdline().
2010-10-19 09:25:58 +00:00
David E. O'Brien 3bb87b4ec1 MFC:
r199955: disable job control when running 'sh -i' in the testsuite
  r204801: make sure to popredir() even if a special builtin caused an error
  r204802: make sure to popredir() even if a function caused an error
  r211399: get rid of unnecessary non-standard empty lists.
  r211609: add a test for breaking from a loop outside the current function
  r211622: test that all bytes from 128 to 255 can be used in IFS
  r211973: weaken builtins/command4 test to only require a non-0 exit status
2010-10-18 23:10:32 +00:00
Pawel Jakub Dawidek a51ba6dc20 MFC r212407:
Forgot to commit this file. Add ZPOOL_CONFIG_IS_LOG.

Reported by:	keramida, dhw
2010-10-18 12:12:38 +00:00
Pawel Jakub Dawidek 7b24aacf02 MFC r212382,r212383,r212384,r212387:
r212382:

Remove duplicated code.

r212383:

Allow to boot from a pool within which replacing is in progress.
Before the change it wasn't possible and the following error was printed:

	ZFS: can only boot from disk, mirror or raidz vdevs

Now if the original vdev (the one we are replacing) is still present we will
read from it, but if it is not present we won't read from the new vdev, as it
might not have enough valid data yet.

r212384:

Ignore log vdevs.

r212387:

Remove empty lines committed by accident.
2010-10-18 09:26:39 +00:00
Martin Matuska f3c4ce7b19 MFC r213197, r213198:
MFC r213197:
Enable offlining of log devices.

OpenSolaris revision and Bug IDs:

9701:cc5b64682e64
6803605	should be able to offline log devices
6726045	vdev_deflate_ratio is not set when offlining a log device
6599442	zpool import has faults in the display

MFC r213198:
Properly handle IO with B_FAILFAST
Retry IO once with ZIO_FLAG_TRYHARD before declaring a pool faulted

OpenSolaris revision and Bug IDs:

9725:0bf7402e8022
6843014 ZFS B_FAILFAST handling is broken

As FreeBSD does not support B_FAILFAST and we don't use vdev_disk.c,
MFC of r213198 is a no-op with the purpose of diff reduction against
latest ZFS code and making future updates easier.

Approved by:	delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6803605, 6726045, 6599442, 6843014)
2010-10-18 08:54:33 +00:00
Pawel Jakub Dawidek 6e706df7d6 MFC r213133,r213135,r213136,r213137,r213245:
r213133:

Add three GPT attributes:

GPT_ENT_ATTR_BOOTME - this is bootable partition

GPT_ENT_ATTR_BOOTONCE - try to boot only once from this partition

GPT_ENT_ATTR_BOOTFAILED - set this flag if we cannot boot from partition
	containing GPT_ENT_ATTR_BOOTONCE flag; note that if we cannot
	boot from partition that contains only GPT_ENT_ATTR_BOOTME flag,
	the GPT_ENT_ATTR_BOOTFAILED flag won't be set

According to wikipedia Microsoft TechNet says that attributes are divided into
two halves: the lower 4 bytes representing partition independent attributes,
and the upper 4 bytes are partition type dependent. Microsoft is already using
bits 60 (read-only), 62 (hidden) and 63 (do not automount) and I'd like to not
collide with those, so we are using bit 59 (bootme), 58 (bootonce) and 57
(bootfailed).

Reviewed by:	arch (Message-ID: <[email protected]>)

r213135:

Allow to configure GPT attributes. It shouldn't be allowed to set bootfailed
attribute (it should be allowed only to unset it), but for test purposes it
might be useful, so the current code allows it.

Reviewed by:	arch@ (Message-ID: <[email protected]>)

r213136:

- Split code shared by almost any boot loader into separate files and
  clean up most layering violations:

	sys/boot/i386/common/rbx.h:

		RBX_* defines
		OPT_SET()
		OPT_CHECK()

	sys/boot/common/util.[ch]:

		memcpy()
		memset()
		memcmp()
		bcpy()
		bzero()
		bcmp()
		strcmp()
		strncmp() [new]
		strcpy()
		strcat()
		strchr()
		strlen()
		printf()

	sys/boot/i386/common/cons.[ch]:

		ioctrl
		putc()
		xputc()
		putchar()
		getc()
		xgetc()
		keyhit() [now takes number of seconds as an argument]
		getstr()

	sys/boot/i386/common/drv.[ch]:

		struct dsk
		drvread()
		drvwrite() [new]
		drvsize() [new]

	sys/boot/common/crc32.[ch] [new]

	sys/boot/common/gpt.[ch] [new]

- Teach gptboot and gptzfsboot about new files. I haven't touched the
  rest, but there is still a lot of code duplication to be removed.

- Implement full GPT support. Currently we just read primary header and
  partition table and don't care about checksums, etc. After this change we
  verify checksums of primary header and primary partition table and if
  there is a problem we fall back to backup header and backup partition
  table.

- Clean up most messages to use prefix of boot program, so in case of an
  error we know where the error comes from, eg.:

	gptboot: unable to read primary GPT header

- If we can't boot, print boot prompt only once and not every five
  seconds.

- Honour newly added GPT attributes:

	bootme - this is bootable partition
	bootonce - try to boot from this partition only once
	bootfailed - we failed to boot from this partition

- Change boot order of gptboot to the following:

	1. Try to boot from all the partitions that have both 'bootme'
	   and 'bootonce' attributes one by one.
	2. Try to boot from all the partitions that have only 'bootme'
	   attribute one by one.
	3. If there are no partitions with 'bootme' attribute, boot from
	   the first UFS partition.

- The 'bootonce' functionality is implemented in the following way:

	1. Walk through all the partitions and when 'bootonce'
	   attribute is found without 'bootme' attribute, remove
	   'bootonce' attribute and set 'bootfailed' attribute.
	   'bootonce' attribute alone means that we tried to boot from
	   this partition, but boot failed after leaving gptboot and
	   machine was restarted.
	2. Find partition with both 'bootme' and 'bootonce' attributes.
	3. Remove 'bootme' attribute.
	4. Try to execute /boot/loader or /boot/kernel/kernel from that
	   partition. If succeeded we stop here.
	5. If execution failed, remove 'bootonce' and set 'bootfailed'.
	6. Go to 2.

   If whole boot succeeded there is new /etc/rc.d/gptboot script coming
   that will log all partitions that we failed to boot from (the ones with
   'bootfailed' attribute) and will remove this attribute. It will also
   find partition with 'bootonce' attribute - this is the partition we
   booted from successfully. The script will log success and remove the
   attribute.

   All the GPT updates we do here goes to both primary and backup GPT if
   they are valid. We don't touch headers or partition tables when
   checksum doesn't match.

Reviewed by:	arch (Message-ID: <[email protected]>)
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r213137:

Add gptboot script that is responsible for:
- looking for partition with 'bootonce' attribute alone (without 'bootme'
  attribute), removing it and logging that we successfully booted from this
  partition.
- looking for partitions with 'bootfailed' attribute, removing it and
  logging that we failed to boot from this partition.

Reviewed by:	arch (Message-ID: <[email protected]>)
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r213245:

Document recently added GPT attributes (bootme, bootonce, bootfailed) and
list other schemes attributes.

Reviewed by:	simon, rpaulo
2010-10-17 20:10:00 +00:00
Gleb Smirnoff 8057610c34 Merge from head 213480,213481,213717:
Add support to Alcatel/TCTMobile X080S USB 3G modem. The device needs
  special eject command to reappear as modem. It also requires DIR_IN flag
  in the command message, so we supply some dummy data along with the command.
2010-10-17 17:39:54 +00:00
Pawel Jakub Dawidek ab8b8d8c32 MFC r213183,r213428,r213429,r213430,r213529,r213530,r213531,r213533,r213579,
r213580,r213938,r213939,r213981:

r213183:

Plug memory leak on fork(2) failure.

Submitted by:	Mikolaj Golub <[email protected]>

r213428:

We can't mask ignored signal, so install dummy signal hander for SIGCHLD before
masking it.

This fixes bogus reports about hooks running for too long and other problems
related to garbage-collecting child processes.

Reported by:	Mikolaj Golub <[email protected]>

r213429:

hook_check() is now only used to report about long-running hooks, so the
argument is redundant, remove it.

r213430:

Decrease report interval to 5 seconds, as this also means we will check for
signals every 5 seconds and not every 10 seconds as before.

r213529:

Don't close local component on exit as we can hang waiting on g_waitidle.
I'm unable to reproduce the race described in comment anymore and also the
comment is incorrect - localfd represents local component from configuration
file, eg. /dev/da0 and not HAST provider.

Reported by:	Mikolaj Golub <[email protected]>

r213530:

Start the guard thread first, so we can handle signals from the very begining.

Reported by:	Mikolaj Golub <[email protected]>

r213531:

Log error message when we fail to destroy ggate provider.

r213533:

Clear ggate structures before using them. We don't initialize all the field
and there can be some garbage from the stack.

r213579:

We close the event socketpair early in the mainloop to prevent spaming with
error messages, so when we clean up after child process, we have to check if
the event socketpair is still there.

Submitted by:	Mikolaj Golub <[email protected]>

r213580:

We can't zero out ggio request, as we have some fields in there we initialize
once during start-up.

Reported by:	Mikolaj Golub <[email protected]>

r213938:

Clear signal mask before executing a hook.

Submitted by:	Mikolaj Golub <[email protected]>

r213939:

Use one fprintf() instead of two.

r213981:

Log correct connection when canceling half-open connection.

Submitted by:	Mikolaj Golub <[email protected]>
2010-10-17 16:43:20 +00:00
Nathan Whitehorn 48fd313112 MFC r213360:
Missed some changes in the last commit required to build LINT.
2010-10-17 15:55:46 +00:00
Gleb Smirnoff 8cf66ef6af Merge 213831:
Enable the shared memory reference clock driver. The GPS devices are
  getting more and more popular, as source of precise time, and the gpsd
  daemon from ports is using the shared memory to synchronize with ntpd.

  Reviewed by:  roberto
2010-10-17 15:25:33 +00:00
Nathan Whitehorn 344cd4b097 MFC r213307,213335:
Add support for memory attributes (pmap_mapdev_attr() and friends) on
PowerPC/AIM. This is currently stubbed out on Book-E, since I have no
idea how to implement it there.
2010-10-17 15:22:59 +00:00
Jaakko Heinonen 058a466b56 MFC r213298:
Fix printing of the "rw" mount option in fstab(5) format (-p option).
fstab(5) format requires that one of "rw", "rq" or "ro" is always
specified.

PR:		bin/123021
2010-10-17 14:48:53 +00:00
Marius Strobl 8961a23890 MFC: r213868
- In the spirit of r212559 add a comment describing what will eventually
  lower the PIL.
- Just as with the AP ensure that the (S)TICK timer(s) are in a known
  state when starting BSPs.
2010-10-17 14:25:55 +00:00
Konstantin Belousov b3dc3a3bf7 MFC r213846:
Remove stale comment.
2010-10-17 13:47:03 +00:00
Marius Strobl 33fd95d1d1 MFC: r213578
In the replacement text of the __bswapN_const() macros cast the argument
to the expected type so they work like the corresponding __bswapN_var()
functions and the compiler doesn't complain when arguments of different
width are passed.
2010-10-17 13:41:09 +00:00
Marius Strobl 7ce3ef94c3 MFC: r213575
Just use the sparc64 version of this header rather than duplicating it.
2010-10-17 13:13:13 +00:00
Marius Strobl 76ef0b9843 MFC: r213361
Try to adhere to style(9) and be consistent within this file.
2010-10-17 12:33:15 +00:00
Marius Strobl 8eb37841e8 MFC: r213229
Use the mii_data provided via mii_attach_args and mii_pdata respectively
instead of reaching out for the softc of the parent.
2010-10-17 12:29:57 +00:00
Marius Strobl 8e8ffeacbd MFC: r213188
- Remove clause 3 and 4 from TNF licenses.
- Remove closes 3 & 4 from Manuel Bouyer's license.

Obtained from:	NetBSD
2010-10-17 12:16:36 +00:00
Marius Strobl 3f754f22ac MFC: r204646
The NetBSD Foundation has granted permission to remove clause 3 and 4 from
the software.

Obtained from:	NetBSD
2010-10-17 12:11:42 +00:00
Marius Strobl 4957e2433d MFC: r213104
minor simplifications and cosmetics
2010-10-17 12:05:37 +00:00
Marius Strobl 87b1c95a94 MFC: r213873
Explicitly lower the PIL to 0 as part of enabling interrupts, similar to
what is done on other platforms. Unlike as with the sched_throw(NULL)
called on BSPs during their startup apparently there's nothing which will
reliably lower it on APs. I'm unsure why this only came up on V215 though,
breaking these with r207248. My best guess is that these are the only
supported ones so far fast enough to lose some race.

PR:		151404
2010-10-17 11:51:55 +00:00
Jaakko Heinonen 3a8d1416b0 MFC r213835: Add FreeBSD 8.2. 2010-10-17 11:40:29 +00:00
Bjoern A. Zeeb da559fd3e7 MFC r213837:
Remove dead code:
  assignment to a local variable not used anywhere after that.
2010-10-17 09:13:47 +00:00
Bjoern A. Zeeb f4c40b7909 MFC r213836:
Style: make the asterisk go with the variable name, not the type.
2010-10-17 08:59:02 +00:00
Bjoern A. Zeeb ac218617f7 MFC r213832:
Use ifa_ifwithaddr_check() rather than ifa_ifwithaddr() as we are not
  interested in the result and would leak a reference otherwise.

PR:		kern/151435
Submitted by:	Andrew Boyer (aboyer averesystems.com)
2010-10-17 08:46:34 +00:00
Andriy Gapon fcfc86b465 Revert r213261 (MFC of r212652): vm_page_sleep change has not been MFCed yet 2010-10-16 20:13:15 +00:00
Andriy Gapon 24934d5c24 MFC r213648: panic_cpu variable should be volatile 2010-10-16 19:58:49 +00:00
Andriy Gapon 6e0967be37 MFC r213735: tmpfs + sendfile: do not produce partially valid pages for
vnode's tail
2010-10-16 19:56:46 +00:00
Andriy Gapon 9e33a8b97c MFC r213730: zfs + sendfile: do not produce partially valid pages for
vnode's tail
2010-10-16 11:52:43 +00:00
Andriy Gapon c036ed2455 MFC r213651: add kmem_map_free sysctl: query largest contiguous free range in kmem_map 2010-10-16 11:24:27 +00:00
Andriy Gapon 81e759142d MFC r213527: vm.kmem_map_size: a sysctl to query current kmem_map->size 2010-10-16 11:19:31 +00:00
Konstantin Belousov f03d375724 MFC r213359:
Release the vnode lock and close the linker file vnode earlier in the
linker_load_file methods. This prevents the LOR between kernel linker sx
xlock and vnode lock.
2010-10-16 08:43:23 +00:00
Konstantin Belousov 0796edacca MFC r213354:
Cosmetic: make it less confusing when displaying RAID 1 level, that might
be 1+0 as well.

PR:	kern/150936
2010-10-16 08:38:12 +00:00
Konstantin Belousov 5bb1ea8491 MFC r209866:
Fix spacing.
2010-10-15 18:07:45 +00:00
Konstantin Belousov 970f9d745c MFC r209862:
For both i386 and amd64 pmap,
- change the type of pm_active to cpumask_t, which it is;
- in pmap_remove_pages(), compare with PCPU(curpmap), instead of
  dereferencing the long chain of pointers [1].
For amd64 pmap, remove the unneeded checks for validity of curpmap
in pmap_activate(), since curpmap should be always valid after
r209789.
2010-10-15 17:56:51 +00:00
Jilles Tjoelker 58f55a6684 MFC r213284: tr: Fix '[=]=]' equivalence class.
A closing bracket immediately after '[=' should not be treated as special.

Different from the submitted patch, a string ending with '[=' does not cause
access beyond the terminating '\0'.

PR:		bin/150384
Submitted by:	Richard Lowe
2010-10-15 15:37:16 +00:00
Alan Cox 12fb7e06fa MFC r209605
Improve bufdone_finish()'s handling of the bogus page.  Specifically, if
  one or more mappings to the bogus page must be replaced, call pmap_qenter()
  just once.  Previously, pmap_qenter() was called for each mapping to the
  bogus page.

MFC r209902
  Change the implementation of vm_hold_free_pages() so that it performs at
  most one call to pmap_qremove(), and thus one TLB shootdown, instead of one
  call and TLB shootdown per page.

  Simplify the interface to vm_hold_free_pages().
2010-10-15 05:42:35 +00:00
Edwin Groothuis e9c3c98af1 MFC of r204697 r204706 r204849 r204908 r205071 r205427 r212032
r212032:

    Use basename(3) to determine the name of the program.

    Submitted by:   Alexander Best <arundel@>

r205427:

    Replace -b with -C and -B (as proposed by Alexander).
    Add -3, -A and -B to the usage.
    Update regression test for the new parameters.

r205071:

    - With the introduction of -A, -B and -3, not all combinations of
      arguments makes sense anymore. For example, what would a combination
      of -3 (show three months) and -y (show the whole year) do?
      We will abort on these cases.
    - Move the debug option -d to -H (from highlight), while -d is now
      used for setting the day of "today" so that -y and friends can
      be tested.

r204908:

    - Fix the highlighting for non-terminals when the last week is not
      7 days long.
    - "-m <N> <YYYY>" now prints only the month, not the whole year.

r204849:

    - document the -3, -A and -B properly in Synopsis.
    - add highlight of current date for non-terminals.
    - fix -J option.
    - code cleanup.

r204706:

Remove no-op of WARNS?=

    Submitted by:   Ulrich Sp??rlein <[email protected]>

r204697:

    - Implement -3 option (show previous, this and next month) option.
    - Add -A option (months after this month).
    - Add -B option (months before this month).
    - Fix highlighting of today in year overview.
    - Fix aligning of "foreign" characters.
2010-10-15 05:17:48 +00:00
Alan Cox c8e13d1bbb MFC r210124
Optimize pmap_remove()'s handling of PG_G mappings.
2010-10-15 04:02:07 +00:00
Alan Cox be1adce9fb MFC r209789
Correctly maintain the per-cpu field "curpmap" on amd64 just like we
  do on i386.  The consequences of not doing so on amd64 became apparent
  with the introduction of the COUNT_IPIS and COUNT_XINVLTLB_HITS
  options.  Specifically, single-threaded applications were generating
  unnecessary IPIs to shoot-down the TLB on other processors.

MFC r209887
  Reduce the number of global TLB shootdowns generated by pmap_qenter().
  Specifically, teach pmap_qenter() to recognize the case when it is being
  asked to replace a mapping with the very same mapping and not generate
  a shootdown.
2010-10-15 03:23:53 +00:00
Alan Cox d5cbeb8346 MFC r212873
Allow a POSIX shared memory object that is opened for read but not for
  write to nonetheless be mapped PROT_WRITE and MAP_PRIVATE, i.e.,
  copy-on-write.

PR:		150260
2010-10-15 02:58:49 +00:00
Edwin Groothuis c615717337 MFC of r213875
Update manual with regarding to the status of calendars/calendar.judaic.
2010-10-14 21:58:51 +00:00
Edwin Groothuis e20abf79ed MFC of r211517 r212035
r211517:
'\0' -> 0

Fix silly mistake by being overly zeaolous[sp] of applying the style rules.

r212035:
For calendars which don't match the solar-based Gregorian calendar,
be able to specify a year string in an entry.
2010-10-14 21:38:20 +00:00
Edwin Groothuis a0e2f6e2a3 MFC of r213032 r213033
Fix location and year of the Battle of the Plains of Abraham

PR:             150504
Submitted by:   Douglas Berry <[email protected]>
2010-10-14 21:16:14 +00:00
Nathan Whitehorn 50e2c9a009 MFC r213406:
Fix two subtle problems in PPC32 RTLD. The first is a concurrency issue
where long PLT calls in multi-threaded environments could end up with
incorrect jmptab values. The second is that, after the addition of extended
PLT support, I forgot to update the PLT icache synchronization code to cover
the extended PLT instead of just the basic PLT.
2010-10-14 13:56:26 +00:00
Konstantin Belousov bda47a9059 MFC r213508:
Explicitely call cache_purge(fvp) when msdosfs_rename() succeeded, to flush
aliases created due to msdosfs being case-insensitive.

MFC r213543:
Add a comment describing the reason for calling cache_purge(fvp).
2010-10-14 09:29:59 +00:00
David E. O'Brien 6c88e29a3e MFC r212832: update manpage 2010-10-14 03:11:41 +00:00
David E. O'Brien b0ff38cdb1 MFC r212771:
Increase the hostname display width to >12 characters.
2010-10-14 02:10:49 +00:00
David E. O'Brien ce4bdc460d MFC r212770 & r212832:
+ Add the SCRIPT environmental variable to the sub-shell.
  + Add the 'command' argument (if supplied on the command line)
    to the typescript file.
2010-10-14 01:21:44 +00:00
Ed Maste 615f7298ee MFC r212594:
Avoid repeatedly spamming the console while a timed out command is waiting
  to complete.  Instead, print one message after the timeout period expires,
  and one more when (if) the command eventually completes.
2010-10-14 00:46:33 +00:00
Jaakko Heinonen f92a60c4bd MFC r200036 by scottl:
Fix several cases where the periph lock was held over malloc.

PR:		kern/130735
2010-10-13 14:02:45 +00:00
Konstantin Belousov 761f558143 MFC r213476:
Add cross-references to lrand48(3) and arc4random(3) from rand(3)
and random(3).

MFC r213477:
Missed space.
2010-10-13 11:39:36 +00:00
George V. Neville-Neil a9ac8fc48e MFC 213691:
Add code to print the number and type of the CPU that is present in
the system as well has how many PMCs there are per CPU.  In this code
CPU and core are equivalent.
2010-10-12 22:10:07 +00:00
John Baldwin 7239a0d358 MFC 213226:
Rewrite the i386 memory probe:
- Check for SMAP data from the loader first.  If it exists, don't bother
  doing any VM86 calls at all.  This will be more friendly for non-BIOS
  boot environments such as EFI, etc.
- Move the base memory setup into a new basemem_setup() routine instead
  of duplicating it.
- Simplify the XEN case by removing all of the VM86/SMAP parsing code rather
  than just jumping over it.
- Adjust some comments to better explain the code flow.
2010-10-12 19:28:20 +00:00
George V. Neville-Neil 49d5fcfe05 MFC 204310:
Moved mcgrab(1) into a separate directory -- our .mk infrastructure
doesn't currently have support for building multiple programs in a
single makefile.

While here, fixed manpages and makefiles (missing dependencies).
2010-10-12 19:07:36 +00:00
John Baldwin dc7f0f1bb7 MFC 213300:
If an RCS file is truncated, rcsfile_getdelta() will return NULL.  Instead
of faulting, check for NULL.  However, returning an error would cause csup
to just abort the entire update.  Instead, break out of the loop and
return ok.  The attempts to update the file will trigger a MD5 failure which
will cause csup to download the entire file as a fixup.
2010-10-12 17:12:13 +00:00
John Baldwin e655e6b034 MFC 213268:
If rt2560_bbp_init() fails, don't drop the lock as the callers of
rt2560_init_locked() expect the lock to be held on return.
2010-10-12 16:23:50 +00:00
John Baldwin a97a2477f7 MFC 213028,213328:
- Expand scope of tun/tap softc locks to cover more softc fields and
  driver-maintained ifnet fields (such as if_drv_flags).
- Use soft locks as the mutex that protects each interface's knote list
  rather than using the global knote list lock.  Also, use the softc
  for kn_hook instead of the cdev.
- Use mtx_sleep() instead of tsleep() when blocking in the read routines.
  This fixes a lost wakeup race.
- Remove D_NEEDGIANT now that the cdevsw routines use the softc lock
  where locking is needed.
- Lock IFQ when calculating the result for FIONREAD in tap(4).  tun(4)
  already did this.
- Remove remaining spl calls.
2010-10-12 16:08:20 +00:00
John Baldwin e20b4eed05 MFC 213271:
Account for unlocking a spin mutex in the lock profiling code in the !SMP
case.
2010-10-12 15:48:14 +00:00
John Baldwin b02bd20400 MFC 212974:
Comment nit, set TDF_NEEDRESCHED after the comment describing why it is
done rather than before.
2010-10-12 15:26:13 +00:00
John Baldwin e4f7beda4d MFC 205021:
- Use an initializer macro to initialize fields in 'fake' FILE objects used
  by *sprintf(), etc.
- Explicitly initialize _fl_mutex to PTHREAD_MUTEX_INITIALIZER for all FILE
  objects.  This is currently a nop on FreeBSD, but is import for other
  platforms (or in the future) where PTHREAD_MUTEX_INITIALIZER is not simply
  zero.
2010-10-12 13:13:20 +00:00
Konstantin Belousov 79bd5dc1de MFC r213452:
Display PCID capability of CPU and add CPUID define for it.
2010-10-12 09:10:24 +00:00
Andriy Gapon 94970f2de8 MFC r210977:
When EC burst mode is activated and multiple bytes are accessed, do not
disable and enable repeatedly, just do it once per call.  It also reduces
code duplication.  Check all parameters early and fail immediately.

On behalf of:	jkim
2010-10-11 22:46:15 +00:00
Andriy Gapon b8b5ea8191 MFC r208722: Remove unnecessary pointer type castings, shift operations
and dead code.

On behalf of:	jkim
2010-10-11 22:41:01 +00:00
George V. Neville-Neil 3e3b723280 MFC 213409:
Fix two aliases that had the same name but were pointing to different
events.  These are now disamiguated.
2010-10-11 21:23:07 +00:00
George V. Neville-Neil 37fe74b62a MFC 213402:
Fix punctuation and grammar, mostly by ending sentences with a period.
2010-10-11 16:55:17 +00:00
Xin LI 0b5575ed4b MFC r213225:
Add a bandaid for a long-standing race condition during route entry
un-expiring.

The previous version of code have no locking when testing rt_refcnt.
The result of the lack of locking may result in a condition where
a routing entry have a reference count but at the same time have
RTPRF_OURS bit set and an expiration timer.  These would eventually
lead to a panic:

	panic: rtqkill route really not free

When the system have ICMP redirects accepted from local gateway
in a moderate frequency, for instance.

Commit this workaround for now until we have some better solution.

PR:		kern/149804
Reviewed by:	bz
Tested by:	Zhao Xin, Pete French
2010-10-11 11:25:37 +00:00
Konstantin Belousov 04ae02407d Regen. 2010-10-11 09:42:30 +00:00
Konstantin Belousov e61e673e96 MFC r213544:
Fix typo.
2010-10-11 09:41:24 +00:00
Andrey V. Elsukov d6c5b505eb GPART's control interface between kernel and user space has been
changed in r212614. Perform partial MFC of r213097 adapted to the
stable ABI:

  Implement "force" (-F) option for gpart destroy verb.
  This option doesn't passed to kernel and handled in user-space.
  With -F option gpart creates new "delete" request for each
  partition in table. Each request has flags="X" that disables
  auto-commit feature. Last request is the original "destroy" request.
  It has own flags and can have disabled or enabled auto-commit feature.
  If error is occurred when deleting partitions, then new "undo" request
  is created and all changes will be rolled back.

Approved by:	kib (mentor)
2010-10-11 09:39:32 +00:00
Martin Matuska 9ee289a6fc MFC r210470:
Import two changesets from OpenSolaris to make future updates easier.

The changes do not affect FreeBSD code because
zfs_znode_move(), cleanlocks() and cleanshares() are not used.

OpenSolaris onnv changeset:	9788:f660bc44f2e8, 9909:aa280f585a3e

Approved by:	pjd, delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6843700, 6790232)
2010-10-11 09:34:46 +00:00
Kai Wang bfbb0f356b MFC r212373:
libelf is overly strict about the type and alignment of Elf_Data
  objects inside one ELF section, which prevents the creation of a ELF
  section with mixed data types. For example, gcc LTO use libelf to
  create a .gnu_lto_XXX section that contains integers and a string
  table, which doesn't work with our libelf implementation.

  The changes made in this commit include:
  * Allow Elf_Data type to be different than section type.
  * Relax Elf_Data alignment check.
  * Align each Elf_Data by their own alignment instead of section alignment.
2010-10-10 12:20:04 +00:00
Martin Matuska 264b67368c Move HAVE_LIBLZMA from Makefile to config_freebsd.h
Approved by:	delphij (mentor)
2010-10-10 12:18:53 +00:00
Martin Matuska 5b2dca6315 - Add liblzma support to libarchive and usr.bin/tar
- Do not link usr.bin/ar to liblzma if building bootstrap-tools and
the local system doesn't include liblzma (fixes world build on FreeBSD 7.x)

This is a direct commit.

Approved by:	delphij (mentor)
2010-10-10 08:41:08 +00:00
Konstantin Belousov bfc03e2015 MFC r213382:
In makectx(), always use the tf_rsp from trap frame. %rsp is pushed
unconditionally by hardware on the trap.

PR:   amd64/151167
2010-10-10 07:07:21 +00:00
Andrey V. Elsukov 645d739c14 MFC r212608 (by pjd):
All gpart(8) subcommands apart from the 'bootcode' subcommand handle
  given geom/provider names with and without /dev/ prefix. Teach the
  'bootcode' subcommand to handle /dev/<foo> names as well.

Approved by:	kib (mentor)
2010-10-09 20:06:35 +00:00
Gavin Atkinson 272281a89f Merge r213061 from head:
Various changes from various sources:

  - Add "children" [1]
  - Add "acknowledgement", "acknowledgment", "Austria" and "haunted" [2]
  - Add "near", "antidisestablishmentarianism" and "Persephone" [2]
  - "Transvaal" should be capitalized [2]
  - Correct spelling of "structurelessness" and "Athena" [2]
  - Add missing atomic elements [3]
  - Add various words from "word of the day" lists [3]

PR:		conf/149756 [1]
Submitted by:	Nick Johnson <freebsd spatula.net> [1]
Obtained from:	NetBSD [2], OpenBSD [3]
2010-10-09 13:03:32 +00:00
Jilles Tjoelker 1a2c6ebb1a MFC r211980: Correct value for _POSIX_AIO_LISTIO_MAX in <limits.h>.
All the "Minimum Values" (POSIX.1-2008 XBD 13 Headers <limits.h>) are now
correct. These should all be exactly as they are in the specification; the
possibly higher values we support are announced differently.

PR:		standards/104743
2010-10-09 13:01:25 +00:00
Jilles Tjoelker c1f3ae5ae0 MFC r209653: sh: Use $PWD instead of getcwd() for \w \W prompt expansions.
This ensures that the logical working directory (which may include
symlinks) is shown and is similar to the default behaviour of the pwd
builtin.
2010-10-09 12:57:06 +00:00
Xin LI e44bebb2ac MFC r213488:
Use a defined FreeBSD version.
2010-10-09 00:36:32 +00:00
Xin LI dd65bcee3e MFC r213487:
Add definition for FreeBSD 7.4, which will be used in a manual page change.
2010-10-09 00:34:58 +00:00
Pyun YongHyeon 0261a309f7 MFC r212167:
Initial WOL support. NS DP8315 was tested but SiS900/SiS7016 was
  not tested.
  While I'm here, clean up SIOCSIFCAP handler.
2010-10-08 23:16:02 +00:00
Pyun YongHyeon c700b2a23a MFC r212166:
Implement initial device suspend/resume method.
2010-10-08 23:11:46 +00:00
Pyun YongHyeon c5a494ca54 MFC r212159,212161:
r212159:
  Document tunable dev.sis.%unit.manual_pad
  While I'm here Xref vlan(4) as sis(4) supports VLAN oversized
  frames.

r212161:
  Better wording.

  Submitted by:	jkim
2010-10-08 20:58:05 +00:00
Pyun YongHyeon dc4025eeb3 MFC r212158:
Enable sis(4). sis(4) should work on all architectures.
2010-10-08 20:54:09 +00:00
Pyun YongHyeon 195f983f8a MFC r212157:
Unlike most other controllers, NS DP83815/DP83816 controllers seem
  to pad with 0xFF when it encounter short frames.  According to RFC
  1042 the pad bytes should be 0x00.
  Because manual padding consumes extra CPU cycles, introduce a new
  tunable which controls the padding behavior. Turning this tunable
  on will have driver pad manually but it's disabled by default. Users
  can enable software padding by setting the following tunable to
  non-zero value.

  dev.sis.%d.manual_pad="1"

  PR:	kern/35422 (patch not used)
2010-10-08 20:51:33 +00:00
Pyun YongHyeon 0012db1fc2 MFC r212121,212156:
r212121:
  Move sis_reset() to sis_initl(). This ensures driver starts with
  known good state of controller.

r212156:
  Fix the last endianness issue on handling station address which
  prevented driver from working on big-endian machines. Also rewrite
  station address programming to make it work on strict-alignment
  architectures. With this change, sis(4) now works on sparc64 and
  performance number looks good even though sis(4) have to apply
  fixup code to align received frames on 2 bytes boundary on sparc64.
2010-10-08 20:48:09 +00:00
Pyun YongHyeon d88d360fb7 MFC r212120:
Avoid controller reinitialization which could be triggered by
  dhclient(8) or alias addresses are added.

  PR:	kern/87506
2010-10-08 20:42:59 +00:00
Pyun YongHyeon 65d41d6301 MFC r212117,212119:
rr212117:
  Report result of link state change to caller. Previously it always
  returned success.

r212119:
  Do not reinitialize controller whenever promiscuous mode or
  allmulti is toggled. Controller does not require reinitialization.
  This removes unnecessary controller reinitialization whenever
  tcpdump is used.
  While I'm here remove unnecessary variable reinitialization.
2010-10-08 20:39:45 +00:00
Pyun YongHyeon 1e1b0b2bac MFC r212116:
Overhaul link state change handling. Previously sis(4) blindly
  configured TX/RX MACs before getting a valid link. After that, when
  link state change callback is called, it called device
  initialization again to reconfigure TX/RX MACs depending on
  resolved link state. This hack created several bad side effects and
  it required more hacks to not collide with sis_tick callback as
  well as disabling switching to currently selected media in device
  initialization. Also it seems sis(4) was used to be a template
  driver for long time so other drivers which was modeled after
  sis(4) also should be changed.

  TX/RX MACs are now reconfigured after getting a valid link. Fix for
  short cable error is also applied after getting a link because it's
  only valid when the resolved speed is 100Mbps.

  While I'm here slightly reorganize interrupt handler such that
  sis(4) always read SIS_ISR register to see whether the interrupt is
  ours or not. This change removes another hack and make it possible
  to nuke sis_stopped variable in softc.
2010-10-08 20:33:43 +00:00
Pyun YongHyeon d33a8029a7 MFC r212113:
s/u_intXX_t/uintXX_t/g
2010-10-08 20:30:08 +00:00
Pyun YongHyeon 3c08cfaa40 MFC r212109,212124,212185:
r212109:
  bus_dma(9) cleanup.
   o Enforce TX/RX descriptor ring alignment. NS data sheet says the
     controller needs 4 bytes alignment but use 16 to cover both SiS
     and NS controllers. I don't have SiS data sheet so I'm not sure
     what is alignment restriction of SiS controller but 16 would be
     enough because it's larger than the size of a TX/RX descriptor.
     Previously sis(4) ignored the alignment restriction.
   o Enforce RX buffer alignment, 4.
     Previously sis(4) ignored RX buffer alignment restriction.
   o Limit number of TX DMA segment to be used to 16. It seems
     controller has no restriction on number of DMA segments but
     using more than 16 looks resource waste.
   o Collapse long mbuf chains with m_collapse(9) instead of calling
     expensive m_defrag(9).
   o TX/RX side bus_dmamap_load_mbuf_sg(9) support and remove
     unnecessary callbacks.
   o Initial endianness support.
   o Prefer local alignment fixup code to m_devget(9).
   o Pre-allocate TX/RX mbuf DMA maps instead of creating/destroying
     these maps in fast TX/RX path. On non-x86 architectures, this is
     very expensive operation and there is no need to do that.
   o Add missing bus_dmamap_sync(9) in TX/RX path.
   o watchdog is now unarmed only when there are no pending frames
     on controller. Previously sis(4) blindly unarmed watchdog
     without checking the number of queued frames.
   o For efficiency, loaded DMA map is reused for error frames.
   o DMA map loading failure is now gracefully handled. Previously
     sis(4) ignored any DMA map loading errors.
   o Nuke unused macros which are not appropriate for endianness
     operation.
   o Stop embedding driver maintained structures into descriptor
     rings. Because TX/RX descriptor structures are shared between
     host and controller, frequent bus_dmamap_sync(9) operations are
     required in fast path. Embedding driver structures will increase
     the size of DMA map which in turn will slow down performance.

r212124:
  Fix stupid error in r212109 which didn't swap DMA maps. This caused
  IOMMU panic on sparc64 under high TX load.

r212185:
  Fix another bug introduced in r212109. We should unload DMA maps
  only after sending the last fragment of a frame so the mbuf pointer
  also should be stored in the last descriptor index.
2010-10-08 20:18:44 +00:00
Pyun YongHyeon eac54648dd MFC r212103-212105:
r212103:
  Remove leading and trailing white spaces.
  No functional changes.

r212104:
  style(9) - space after keywords.

r212105:
  Nuke unnecessary return at the end of function.
2010-10-08 19:39:35 +00:00
Pyun YongHyeon 69e8da944e MFC r212972,21300:
r212972:
  Remove unnecessary controller reinitialization.

  PR:	kern/87506

r213000:
  Fix build breakage introduced in r212972.
2010-10-08 19:32:39 +00:00
Pyun YongHyeon c323e2ee21 MFC r212971:
Remove unnecessary controller reinitialization.
  StarFire controller does not require controller reinitialization to
  program perfect filters. While here, make driver immediately exit
  from interrupt/polling handler if driver reinitialized controller.

  PR:	kern/87506
2010-10-08 19:27:34 +00:00
Pyun YongHyeon d36d934b86 MFC r212969:
Make sure to clear IFF_DRV_RUNNING to reinitialize controller.
  While I'm here update if_oerrors counter when driver encounters
  watchdog timeout.
2010-10-08 19:24:38 +00:00
Pyun YongHyeon ebc2d64f68 MFC r212968:
Remove unnecessary controller reinitialization.

  PR:	kern/87506
2010-10-08 19:19:51 +00:00
Pyun YongHyeon 63a2b07625 MFC r212306-212307,212342:
r212306:
  Remove trailing CR at EOL.

r212307:
  Consistently use tab characters instead of tab + space characters.
  No functional changes.

r212342:
  Correct definition of T2 mode bit of MRBE Message Page 5 Next Page
  Control Register.
2010-10-08 18:58:01 +00:00
Pyun YongHyeon 030f68bbfd MFC r212069,212071:
r212069:
  bge_txeof() already checks whether it has to free transmitted mbufs
  or not by comparing reported TX consumer index with saved index. So
  remove unnecessary check done after freeing transmitted mbufs.
  While I'm here nuke unnecessary variable initializations.

r212071:
  Remove unnecessary atomic operation in bge_poll. bge(4) always
  holds a driver lock in the function entry and
  memory synchronization is handled by bus_dmamap_sync(9).
2010-10-08 18:49:59 +00:00
Pyun YongHyeon d2e5d4eb27 MFC r212061,212065,212302:
r212061:
  Split common parent DMA tag into ring DMA tag and TX/RX mbuf DMA
  tag. All controllers that are not BCM5755 or higher have 4GB
  boundary DMA bug. Previously bge(4) used 32bit DMA address to
  workaround the bug(r199670). However this caused the use of bounce
  buffers such that it resulted in poor performance for systems which
  have more than 4GB memory. Because bus_dma(9) honors boundary
  restriction requirement of DMA tag for dynamic buffers, having a
  separate TX/RX mbuf DMA tag will greatly reduce the possibility of
  using bounce buffers. For DMA buffers allocated with
  bus_dmamem_alloc(9), now bge(4) explicitly checks whether the
  requested memory region crossed the boundary or not.
  With this change, only the DMA buffer that crossed the boundary
  will use 32bit DMA address. Other DMA buffers are not affected as
  separate DMA tag is created for each DMA buffer.
  Even if 32bit DMA address space is used for a buffer, the chance to
  use bounce buffer is still very low as the size of buffer is small.
  This change should eliminate most usage of bounce buffers on
  systems that have more than 4GB memory.

  More correct fix would be teaching bus_dma(9) to honor boundary
  restriction for buffers created with bus_dmamem_alloc(9) but it
  seems that is not easy.

  While I'm here cleanup bge_dma_map_addr() and remove unnecessary
  member variables in bge_dmamap_arg structure.

  Tested by:	marcel

r212065:
  Handle PAE case correctly. You cannot effectively specify a 4GB
  boundary in PAE case so use a 2GB boundary for PAE as suggested by
  jhb.

  Pointed out by:	jhb
  Reviewed by:	jhb

r212302:
  Make sure to create DMA'able memory for statistics block. This was
  missed in r212061 and it caused crashes for 570x controllers as
  controller DMAed statistics to physical address 0.

  Reported by:	kan
2010-10-08 18:43:06 +00:00
Pyun YongHyeon 1447383886 MFC r213306:
Rename rl_setmulti() to rl_rxfilter() as rl_rxfilter() will handle
  IFF_ALLMULTI/IFF_PROMISC as well as multicast filter configuration.
  Rewrite RX filter logic to reduce number of register accesses and
  make it handle promiscuous/allmulti toggling without controller
  reinitialization.

  Previously rl(4) counted on controller reinitialization to reprogram
  promiscuous configuration but r211767 resulted in avoiding
  controller reinitialization whenever promiscuous mode is toggled.
  To address this, keep track of driver's view of interface state and
  handle IFF_ALLMULTI/IFF_PROMISC changes without reinitializing
  controller. This should fix a regression introduced in r211267.

  While I'm here remove unnecessary variable reassignment in ioctl
  handler.

  PR:	kern/151079
2010-10-08 18:19:05 +00:00
Matthew D Fleming 1260c2b406 MFC r212926:
Use destroy_dev_sched(9) instead of destroy_dev(9) in passcleanup() as
it is indirectly a d_close method.
2010-10-08 18:06:15 +00:00
Ed Maste f990d17600 MFC r213013:
Move test for zero bufp or size before rseq and wseq calculation.  This
  avoids spinning in an infinite loop for some (possibly corrupt?) core
  files at work.
2010-10-08 14:59:14 +00:00
Ed Maste 3137609e93 MFC r212570:
Allow a kernel config to specify a set but empty value via
  'makeoptions OPTION=' for consistency with the make commandline.

  Previously 'makeoptions WERROR=' would result in a syntax error; now
  it produces the same effect as 'makeoptions WERROR'.  Both forms now
  result in 'WERROR=' in the generated Makefile.
2010-10-08 14:56:39 +00:00
Andriy Gapon 70100de0a8 MFC r213322: sysctls in kern_shutdown: add twin tunables 2010-10-08 08:13:22 +00:00
Andriy Gapon eee691af5c MFC r213305: there must be only one SYSINIT with
SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY order
2010-10-08 08:01:36 +00:00
Andriy Gapon 4e524647dd MFC r213304: debug.kdb.stop_cpus sysctl: hint that this is also a
tunable
2010-10-08 07:57:19 +00:00
Andriy Gapon 989816c0ce MFC r213303: kmem_size* sysctls: hint that these are also tunables 2010-10-08 07:52:00 +00:00
Andriy Gapon cd5248c306 MFC r212994: kdb_backtrace: use stack_print_ddb instead of stack_print 2010-10-08 07:49:05 +00:00
Andriy Gapon 8ee24d94b3 MFC r212964: kdb_backtrace: stack(9)-based code to print backtrace
without any backend
2010-10-08 07:38:44 +00:00
Andriy Gapon 859347e161 MFC r212781: zfs arc_reclaim_needed: remove redundant checks for
arc_c_max and arc_c_max
2010-10-08 07:36:30 +00:00
Andriy Gapon bfd88d8cb6 MFC r212783: zfs arc_reclaim_needed: fix typo in mismerge in r212780 2010-10-08 07:34:32 +00:00
Andriy Gapon 83f19247ce MFC r212780: zfs arc_reclaim_needed: more reasonable threshold for
available pages
2010-10-08 07:33:22 +00:00
Andriy Gapon 42ebd3d3be MFC r212657: zfs vn_has_cached_data: take into account v_object->cache != NULL 2010-10-08 07:31:32 +00:00
Andriy Gapon e73ad66658 MFC r212951: zfs_map_page/zfs_unmap_page: do not use sched_pin() and
SFB_CPUPRIVATE
2010-10-08 07:29:26 +00:00
Andriy Gapon 5253025a14 MFC r212950: zfs_vnops: use zfs_map_page/zfs_unmap_page helper functions
in another place
2010-10-08 07:26:56 +00:00
David Xu 4da303d3af MFC r213258:
- kern_sched_rr_get_interval should return interval for thread 1 in
    target process.
- eliminate a goto.
2010-10-07 12:20:50 +00:00
Xin LI 90ac8c2a26 MFC r211059:
Address an edge condition that we found at work, where the carp(4)
interface goes to issue LINK_UP, then LINK_DOWN, then LINK_UP at
cold boot.  This behavior is not observed when carp(4) interface
is created slightly later, when the underlying interface is fully
up.

Before this change what happen at boot is roughly:

 - ifconfig creates em0 interface;
 - ifconfig clones a carp device using em0;
   (em0's link state is DOWN at this point)
 - carp state: INIT -> BACKUP [*]
 - carp state: BACKUP -> MASTER
 - [Some negotiate between em0 and switch]
 - em0 kicks up link state change event
   (em0's link state is now up DOWN at this point)
 - do_link_state_change() -> carp_carpdev_state()
 - carp state: MASTER -> INIT (via carp_set_state(sc, INIT)) [+]
 - carp state: INIT -> BACKUP
 - carp state: BACKUP -> MASTER

At the [*] stage, em0 did not received any broadcast message from other
node, and assume our node is the master, thus carp(4) sets the link
state to "UP" after becoming a master.  At [+], the master status
is forcely set to "INIT", then an election is casted, after which our
node would actually become a master.

We believe that at the [*] stage, the master status should remain as
"INIT" since the underlying parent interface's link state is not up.

Obtained from:  iXsystems, Inc.
Reported by:    jpaetzel
2010-10-07 00:36:58 +00:00
Xin LI e34e301a03 MFC r213044:
In the past gunzip(1) write()'s after each inflate return.  This is
not optimal from a performance standpoint since the write buffer is
not necessarily be filled up when the inflate rountine reached the
end of input buffer and it's not the end of file.

This problem gets uncovered by trying to pipe gunzip -c output to
a GEOM device directly, which enforces the writes be multiple of
sector size.

Sponsored by: iXsystems, Inc.
Reported by:  jpaetzel
2010-10-07 00:29:07 +00:00
Konstantin Belousov b0159414c7 MFC r212998:
For sparc64 relocations that directly put bits of the symbol value into
the location, apply elf_relocaddr to the symbol value to have right
values for the symbols from dpcpu segment.
2010-10-06 10:00:37 +00:00
Ruslan Ermilov 5162b7f420 MFC r203958: %U was macroized in mdoc(7), escape. 2010-10-06 08:05:53 +00:00
Xin LI 24fed98ab0 MFC r202454,202457,202458,202586,207842,207844,208099:
Expose stripesize and stripeoffset via kernel sysctl as well as userland
library and the geom(8) utility.
2010-10-06 00:13:55 +00:00
Marius Strobl 4cefac73e6 MFC: r213105, r213147
Improve r56796; the reply handler actually may remove the request from
the chain in which case it shouldn't be removed twice.
Reported by:	Staale Kristoffersen
2010-10-04 20:13:19 +00:00
Marius Strobl fd557403ee MFC: r213102
Remove the duplicate logging of failed read requests, whose error message
also was inappropriate as it triggered for every EACCESS and ENOTFOUND, not
just the case the -n option is intended to deal with and thus really spammed
us with ~20 messages in the default configuration when booting a diskless
FreeBSD client, introduced with r207608 (commited to stable/8 in 213038)
again.
2010-10-04 20:02:48 +00:00
Marius Strobl e062ebe757 MFC: r213099
Make WARNS=6 clean.
2010-10-04 19:59:08 +00:00
Marius Strobl 16c4496a1f MFC: 213075
Try to adhere to style.Makefile(5).
2010-10-04 19:51:15 +00:00
Marius Strobl 770513a659 MFC: r213053
Remove an explicit assignment of the CFLAGS variable intended for
debugging purposes only.
2010-10-04 19:39:51 +00:00
Bjoern A. Zeeb d836fee27a MFC r213325:
Proper bracketing.

  Submitted by:	SunMinghao (sunminghao hotmail.com)
PR:		kern/151100
2010-10-04 07:00:47 +00:00
Xin LI 340537e0e7 Revision 209601 should have merged this part of r203711 to make fmt(1)
build unconditional.

PR:		misc/151180
2010-10-04 06:49:12 +00:00
Jilles Tjoelker 723a22052b MFC r201053: sh: Various warning fixes (from WARNS=6 NO_WERROR=1):
- const
- initializations to silence -Wuninitialized (it was safe anyway)
- remove nested extern declarations
- rename "index" locals to "idx"
2010-10-03 21:56:20 +00:00
Konstantin Belousov b1b2ec6ef9 MFC r212506:
Do not fork nfsiod directly from the vop methods.
Schedule the task that performs fork to be executed in
the taskqueue context.
2010-10-03 08:57:02 +00:00
Andrey V. Elsukov 3e99e68baa MFC r213174:
Some schemes can allocate memory for internal purposes but when
  GEOM does withering this memory doesn't freed. Add G_PART_DESTROY
  call to g_part_wither. Also add missed g_free() call to G_PART_READ
  method for MBR and PC98 schemes.

  Submitted by:	jh (previous version)
  Reviewed by:	pjd

Approved by:	kib (mentor)
2010-10-02 22:21:01 +00:00
Andrey V. Elsukov f83b13a988 MFC r212706 (by pjd):
Change message when setting or unsetting attribute to be less confusing.
  Before:

  	ada0 has <attrib> set

  After:

  	<attrib> set on ada0

Approved by:	kib (mentor)
2010-10-02 22:18:36 +00:00
Andrey V. Elsukov 0eab552b8f MFC r212703 (by pjd):
Make the message that informs about bootcode being written to disk less
  confusing.

  Note there is still no information about 'partcode' being written to disk
  (gpart bootcode -p <partcode> <disk>).

  Maybe in the future all the messages printed by gpart(8) on success could
  be hidden under -v?

  PR:		bin/150239
  Reported by:	Roddi <[email protected]>
  Submitted by:	arundel

Approved by:	kib (mentor)
2010-10-02 22:15:57 +00:00
Andrey V. Elsukov 6ed1eb7a99 MFC r212609 (by pjd):
Simplify the code a bit.

Approved by:	kib (mentor)
2010-10-02 22:14:01 +00:00
Andrey V. Elsukov 1373f78052 MFC r209536 (by rpaulo):
Add NTFS partition type to GEOM_MBR.

Approved by:	kib (mentor)
2010-10-02 22:12:04 +00:00
Andrey V. Elsukov 6e9e2f1df9 MFC r203261 (by marcel):
Export the UUID of the partition in the XML. The partition UUID is used
  by EFI's device path to identify a partition. In order for FreeBSD to
  add EFI boot options, proper device paths need to be constructed.

Approved by:	kib (mentor)
2010-10-02 22:08:17 +00:00
Andrey V. Elsukov c09ed1b750 MFC r202977 (by trasz):
Remove unneeded variables.

Approved by:	kib (mentor)
2010-10-02 22:06:07 +00:00
Jilles Tjoelker 41eeb9e474 MFC r200967: sh: Add some __dead2 to indicate functions that do not return. 2010-10-02 20:55:11 +00:00
Jilles Tjoelker 41fe6076f4 MFC r200956: sh: Constify various strings.
Most of this is adding const keywords, but setvar() in var.c had to be
changed somewhat more.
2010-10-02 20:39:45 +00:00
Konstantin Belousov f7e332040f MFC r212824:
Adopt the deferring of object deallocation for the deleted map entries
on map unlock to the lock downgrade and later read unlock operation.

MFC r212868 (by alc) [1]:
Make refinements to r212824. Redo the implementation of
vm_map_unlock_and_wait().

Approved by:	alc [1]
2010-10-02 17:41:47 +00:00
Andriy Gapon f559db9f65 MFC r210782,210837: Update the "desiredvnodes" calculation.
On behalf of:	alc
2010-10-02 08:11:38 +00:00
Bernhard Schmidt 29d217c028 Create the var/run/wpa_supplicant directory where the wpa_supplicant
RC script wants to save a pidfile for each interface.
2010-10-01 17:20:13 +00:00
Edwin Groothuis e4c939b684 MFC of 213312, tzdata2010m
- Fix historical data for Hongkong
- Fix location description for Antarctica/Vostok
2010-09-30 22:03:43 +00:00
Doug Barton 76dc5d82a0 MFC r213005:
Remove confusing-though-technically-correct --disable-ipv6
from CONFIGARGS.
2010-09-30 21:54:25 +00:00
Alexander Motin ad2f37604a MFC r212732:
Fix panic, when due to some kind of congestion on FIS-based switching
port multiplier some command triggers false positive timeout, but then
completes normally.
2010-09-30 04:23:03 +00:00
Nathan Whitehorn a4a0539951 MFC r212165:
In the case of non-sequential mappings, ofw_mapmem() could ask Open
Firmware to map a memory region with negative length, causing crashes
and Undefined Behavior. Add the appropriate check to make the behavior
defined.
2010-09-30 04:06:16 +00:00
Nathan Whitehorn 37d498616f MFC r212359:
Fix a problem where device detection would work unreliably on Serverworks
K2 SATA controllers. The chip's status register must be read first, and
as a long, for other registers to be correctly updated after a command, and
this includes the command sequence in device detection as well as the
previously handled case after interrupts. While here, clean up some
previous hacks related to this controller.
2010-09-30 04:03:14 +00:00
Maksim Yevmenkin 466aed0e46 MFC Revision: 213042
Add the following Linux BlueZ compatibility macros: htobs(), htobl(),
btohs() and btohl()

PR:		kern/136386
Submitted by:	Monty Hall < kungfu_disciple at sbcglobal dot net >
2010-09-29 18:41:47 +00:00
Jaakko Heinonen d000f255a8 MFC r209168:
Update vfs_busy(9) and vfs_unbusy(9) manual pages to better match the
current behaviour of the functions.
2010-09-29 14:36:25 +00:00
MIHIRA Sanpei Yoshiro e9afb2bb7f MFC r212980 & r213160(man4/axe.4 only)
Add Planex UE-200TX-G2 to list of supported devices.
Add new device ids.
 Buffalo (Melco Inc.) LUA3-U2-AGT
 Logitec LAN-GTJ/U2A
2010-09-29 12:53:02 +00:00
Andriy Gapon cead50401b MFC r212993: acpi_attach: do not explicitly install default handlers for
default address spaces
2010-09-29 09:20:18 +00:00
Andriy Gapon dcd7454bd6 MFC r212655: zfs mappedread, update_pages: use int for offset and length
within a page
2010-09-29 09:18:34 +00:00
Andriy Gapon 890fb33e63 MFC r212654: zfs mappedread: use uiomove_fromphys where possible 2010-09-29 09:16:45 +00:00
Andriy Gapon 4a2cd75fc3 MFC r212652: zfs: catch up with vm_page_sleep_if_busy changes 2010-09-29 09:15:02 +00:00
Andriy Gapon 61d65d0c8a MFC r212650: tmpfs, zfs + sendfile: mark page bits as valid after
populating it with data
2010-09-29 09:11:34 +00:00
Andriy Gapon 3456548db7 MFC r212932,212949: tools/umastat: fix build on amd64 and more
PR:		misc/146119
2010-09-28 05:53:35 +00:00
Pyun YongHyeon 6b959929f0 MFC r211913:
Do not allocate multicast array memory in multicast filter
  configuration function. For failed memory allocations, em(4)/lem(4)
  called panic(9) which is not acceptable on production box.
  igb(4)/ixgb(4)/ix(4) allocated the required memory in stack which
  consumed 768 bytes of stack memory which looks too big.

  To address these issues, allocate multicast array memory in device
  attach time and make multicast configuration success under any
  conditions. This change also removes the excessive use of memory in
  stack.

  Reviewed by:	jfv
2010-09-27 17:54:04 +00:00
Pyun YongHyeon 41e76d4d13 MFC r211909:
If em(4) failed to allocate RX buffers, do not call panic(9).
  Just showing some buffer allocation error is more appropriate
  action for drivers. This should fix occasional panic reported on
  em(4) when driver encountered resource shortage.

  Reviewed by:	jfv
2010-09-27 17:50:56 +00:00
Pyun YongHyeon 504a807e2e MFC r211907:
Do not call voluntary panic(9) in case of if_alloc() failure.

  Reviewed by:	jfv
2010-09-27 17:49:05 +00:00
Pyun YongHyeon 3b4e8a0f6c MFC r211906:
Make sure not to access unallocated stats memory.

  Reviewed by:	jfv
2010-09-27 17:46:11 +00:00
Pyun YongHyeon 79369012a9 MFC r211400:
Remove unnecessary clean target in em(4), igb(4) and ixgbe(4).
  While here also remove man target in igb(4).

  Reviewed by:	jfv
2010-09-27 17:37:25 +00:00
Pyun YongHyeon e92d20743f MFC r212755:
Fix incorrect RX BD producer updates. The producer index was
  already updated after allocating mbuf so driver had to use the last
  index instead of using next producer index. This should fix driver
  hang which may happen under high network load.

  Reported by:	Igor Sysoev <is <> rambler-co dot ru>, Vlad Galu <dudu <> dudu dot ro>
  Tested by:	Igor Sysoev <is <> rambler-co dot ru>, Vlad Galu <dudu <> dudu dot ro>
2010-09-27 17:10:22 +00:00
John Baldwin 40e7fadb98 MFC 212902:
Tweak the stats exported by the e1000 drivers:
- Add a single sysctl procedure to all three drivers to read an arbitrary
  register (the register is passed as arg2).  Use it to replace existing
  routines in igb(4) that used a separate routine for each register, and
  to add support for missing stats in em(4) and lem(4).
- Move the 'rx_overruns' and 'watchdog_timeouts' stats out of the MAC stats
  section as they are driver stats, not MAC counters.
- Simplify the code that creates per-queue stats in igb(4) to use a single
  loop and remove duplicated code.
- Properly read all 64 bits of the 'good octets received/transmitted' in
  em(4) and lem(4).
- Actually read the interrupt count registers in em(4), and drop the
  'host to card' sysctl stats from em(4) as they are not implemented in
  any of the hardware this driver supports.
- Restore several stats to em(4) that were lost in the earlier stats
  conversion including per-queue stats.
- Export several MAC stats in em(4) that were exported in igb(4) but not
  in em(4).
- Export stats in lem(4) using individual sysctls as in em(4) and igb(4).
2010-09-27 16:29:25 +00:00
Andriy Gapon b06e6cc0ce MFC r212544: bus_add_child: add specialized default implementation that
calls panic
2010-09-27 06:02:12 +00:00
Andriy Gapon 5c40306333 MFC r212821: kern.sched.topology_spec sysctl: use step of 1 for group
levels numeration
2010-09-27 05:46:20 +00:00
Rick Macklem 4c164630e1 MFC: r212834
Fix nfsrv_freeallnfslocks() in the experimental NFSv4 server so that
it frees local locks correctly upon close. In order for
nfsrv_localunlock() to work correctly, the lock can no longer be in
the lockowner's stateid list. As such, nfsrv_freenfslock() has to
be called before nfsrv_localunlock(), to get rid of the lock structure
on the lockowner's stateid list. This only affected operation when
local locks (vfs.newnfs.enable_locallocks=1) are enabled, which is
not the default at this time.
2010-09-27 02:57:44 +00:00
Rick Macklem ff47fb22aa MFC: r212833
Fix the experimental NFSv4 server so that it performs local VOP_ADVLOCK()
unlock operations correctly. It was passing in F_SETLK instead of
F_UNLCK as the operation for the unlock case. This only affected
operation when local locking (vfs.newnfs.enable_locallocks=1) was enabled.
2010-09-27 02:44:30 +00:00
Rick Macklem e910f12f42 MFC: r212443
This patch applies one of the two fixes suggested by
zack.kirsch at isilon.com for a race between nfsrv_freeopen()
and nfsrv_getlockfile() in the experimental NFS server that
he found during testing. Although nfsrv_freeopen() holds a
sleep lock on the lock file structure when called with
cansleep != 0, nfsrv_getlockfile() could still search the
list, once it acquired the NFSLOCKSTATE() mutex. I believe
that acquiring the mutex in nfsrv_freeopen() fixes the race.
2010-09-27 02:30:56 +00:00
Rick Macklem cd53027b6d MFC: r212439
Fix the NFSVNO_CMPFH() macro in the experimental NFS server so
that it works correctly for ZFS file handles. It is possible to
have two ZFS file handles that differ only in the bytes in the
fid_reserved field of the generic "struct fid" and comparing the
bytes in fid_data didn't catch this case. This patch changes the
macro to compare all bytes of "struct fid".
2010-09-27 02:09:25 +00:00
Rick Macklem e5a59392f3 MFC: r212362
Fix the experimental NFS client so that it doesn't panic when
NFSv2,3 byte range locking is attempted. A fix that allows the
nlm_advlock() to work with both clients is in progress, but
may take a while. As such, I am doing this commit so that
the kernel doesn't panic in the meantime.
2010-09-27 01:41:39 +00:00
Jaakko Heinonen a2b426d358 MFC r211873:
Don't attempt to write label with GEOM_BSD based method if the class is
not available. This improves error reporting when bsdlabel(8) is unable
to open a device for writing. If GEOM_BSD was unavailable, only a rather
obscure error message "Class not found" was printed.

PR:		bin/58390
2010-09-26 16:52:05 +00:00
Rui Paulo 08a11c1f7c Revert r213002. 2010-09-26 12:52:23 +00:00
Xin LI 0adc931073 MFC r211393 (des):
In setusercontext(), do not apply user settings unless running as the
user in question (usually but not necessarily because we were called
with LOGIN_SETUSER).  This plugs a hole where users could raise their
resource limits and expand their CPU mask.

Approved by:	des
2010-09-24 23:47:42 +00:00
Pyun YongHyeon e563106dd8 MFC r211768:
Remove unnecessary controller reinitialization.

  PR:	kern/87506
2010-09-24 19:30:34 +00:00
Pyun YongHyeon c6f916d0ee MFC r211767:
Remove unnecessary controller reinitialization.

  PR:	kern/87506
2010-09-24 19:27:47 +00:00
Pyun YongHyeon 61c6359d74 MFC r211766:
vr_init_locked() will stop and reset the controller. Remove
  unnecessary vr_stop()/vr_reset() calls.
2010-09-24 19:24:45 +00:00
Pyun YongHyeon 105a9fb2f4 MFC r211765:
Remove unnecessary controller reinitialization.
  CAM filter handling was rewritten long time ago so it should not
  require controller reinitialization.

  PR:	kern/87506
2010-09-24 19:19:53 +00:00
Pyun YongHyeon 787405fd4c MFC r211764:
Add PNP id for Compex RL2000.
  I'm not sure whether adding this logical id is correct or not
  because Compex RL2000 is in the list of supported hardware list.
  I guess the Compex RL2000 could be PCI variant while the controller
  in question is ISA controller. It seems PNP compat id didn't match
  or it had multiple compat ids so isa_pnp_probe() seemed to return
  ENOENT.

  PR:	kern/80853
2010-09-24 19:16:42 +00:00
Pyun YongHyeon e99b454d37 MFC r211721:
Fix a possible unaligned access to savebyte array.

  PR:	kern/122195
2010-09-24 19:13:43 +00:00
Pyun YongHyeon 3f1eb6842b MFC r211717:
Implement basic WOL support. Note, not all xl(4) controllers
  support WOL. Some controllers require additional 3-wire auxiliary
  remote wakeup connector to draw power. More recent xl(4)
  controllers may not need the wakeup connector though.
2010-09-24 19:09:23 +00:00
Pyun YongHyeon 3e42a86a48 MFC r211716:
Move xl_reset() to xl_init_locked(). This will make driver
  initialize controller from a known good state. Previously driver
  used to issue controller reset while TX/RX DMA are in progress.
  I guess resetting controller in active TX/RX DMA cycle is to ensure
  stopping I/Os in xl_shutdown(). I remember some buggy controllers
  didn't respond with stop command if controller is under high
  network load at the time of shutdown so resetting controller was
  the only safe way to stop the I/Os. However, from my experiments,
  controller always responded with stop command under high network
  load so I think it's okay to remove the xl_reset() in
  device_shutdown handler.
  Resetting controller also will clear configured RX filter which
  in turn will make WOL support hard because driver have to reprogram
  RX filter in WOL handler as well as setting station address.
2010-09-24 19:04:17 +00:00
Pyun YongHyeon f4a5cdc3c6 MFC r211671:
Remove unnecessary controller reinitialization by checking
  IFF_DRV_RUNNING flag.
2010-09-24 18:58:04 +00:00
Pyun YongHyeon 9b1cf82001 MFC r211670:
Clean up SIOCSIFCAP handler and allow RX checksum offloading could
  be controlled by user.
2010-09-24 18:33:15 +00:00
Pyun YongHyeon 37f2ce5a73 MFC r211597:
Document newly introduced tunable dev.bge.%d.forced_udpcsum.
  While I'm here also mention tunable dev.bge.%d.forced_collapse.
2010-09-24 18:12:19 +00:00
Pyun YongHyeon 7aab54b3c7 MFC r211596:
It seems all Broadcom controllers have a bug that can generate UDP
  datagrams with checksum value 0 when TX UDP checksum offloading is
  enabled.  Generating UDP checksum value 0 is RFC 768 violation.
  Even though the probability of generating such UDP datagrams is
  low, I don't want to see FreeBSD boxes to inject such datagrams
  into network so disable UDP checksum offloading by default.  Users
  still override this behavior by setting a sysctl variable or loader
  tunable, dev.bge.%d.forced_udpcsum.

  I have no idea why this issue was not reported so far given that
  bge(4) is one of the most commonly used controller on high-end
  server class systems. Thanks to andre@ who passed the PR to me.

  PR:	kern/104826
2010-09-24 17:59:58 +00:00
Pyun YongHyeon e6dd17d506 MFC r211594:
Load tunable from loader.conf(5) instead of device.hints(5).
2010-09-24 17:53:32 +00:00
Xin LI 0caa853a42 MFC r197850:
Add a special workaround to handle UIO_NOCOPY case.  This fixes data
corruption observed when sendfile() is being used.

Requested by:	avg
PR:		kern/127213
Submitted by:	gk
2010-09-24 17:26:57 +00:00
Andriy Gapon f7789fd5c8 MFC r212789: nextboot: warn about limitations of /boot/nextboot.conf on ZFS 2010-09-24 07:27:53 +00:00
Andriy Gapon 604870e87f MFC r212782: zfs+sendfile: advance uio_offset upon reading as well 2010-09-24 07:23:48 +00:00
Ivan Voras 2cfa87e58e MFC r212305 : Avoid "Entry can disappear before we lock fdvp" panic. 2010-09-23 23:05:31 +00:00
Jilles Tjoelker 99ef859203 MFC r212339: sh: Fix 'read' if all chars before the first IFS char are
backslash-escaped.

Backslash-escaped characters did not set the flag for a non-IFS character.
2010-09-23 21:36:10 +00:00
Jilles Tjoelker 482a2334f6 MFC r212330: sh: Add simple tests for backslashes in the read builtin. 2010-09-23 20:49:33 +00:00
Jilles Tjoelker d54975c5ee MFC r212187: sh: Add a test that 'read' leaves the file pointer at the
correct place.

Naive buffering would break the common while read x... construct, which did
not appear to be tested yet.
2010-09-23 20:37:29 +00:00
Jilles Tjoelker 4125279827 MFC r212390: expr(1): Add sh(1) versions of examples, remove an incorrect
example.

The three examples are better done using sh(1) itself these days.

The example
  expr -- "$a" : ".*"
is incorrect in the general case, as "$a" may be an operator.
2010-09-23 17:37:57 +00:00
Gavin Atkinson 15d4b25400 Merge r211153 from head:
Now that the uplcom(4) driver can autodetect the chipset type, sync
  the list of devices supported by uplcom(4) with the following sources:

  NetBSD  src/sys/dev/usb/uplcom.c 1.70
  OpenBSD src/sys/dev/usb/uplcom.c 1.52
  Linux   drivers/usb/serial/pl2303.h from kernel 2.6.35
  BeOS    usb_serial/driver.c 1.32

  Give several devices better descriptions, and rename
  PROLIFIC2 -> NETINDEX while here to match everybody else.
2010-09-23 10:20:28 +00:00
Gavin Atkinson d3b9248b00 Merge r211111 from head:
Attempt to autodetect the cype of chipset, rather than storing this
  within the device table.  This code uses the same algorithm as used in
  the  Linux, NetBSD and DragonflyBSD driver.

  While investigating this, it became apparent that the Linux driver
  always initialises the device, and not just in the PL2303HX case.
  Change uplcom(4) to do the same.

  This change allows us to synchronize our device ID list with Linux and
  NetBSD, without requiring knowledge of the chipset in use.

Merge r209967, 209968 from head (by takawata):

  One more Prolific serial device ID.
2010-09-23 09:56:02 +00:00
Gavin Atkinson 6cc023b56b Merge r211083 from head:
The PL2302X can support any baud rate <= 6Mbps, allow any rate to be set.

PR:		usb/128324
Submitted by:	Mike Durian <durian shadetreesoftware.com> (original patch)
2010-09-23 09:52:27 +00:00
Pawel Jakub Dawidek 2c05394bba MFC r208028,r210628,r210909,r210912,r211397:
r208028:

mdoc: move remaining sections into consistent order

This pertains mostly to FILES, HISTORY, EXIT STATUS and AUTHORS sections.

Found by:	mdocml lint run
Reviewed by:	ru

r210628:

Fix typo.

PR:		docs/149033
Submitted by:	Kolar <[email protected]>

r210909:

Update the arguments to yy_config_parse() to match r210883.

Choose the more conservative option ('yes' to exit on error) to match
the equivalent code in hastd.

r210912:

Force commit to remind me about MFCing r210909.

r211397:

Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages.  Minor corrections by me.

Submitted by:	Nobuyuki Koganemaru <[email protected]>
2010-09-23 09:05:40 +00:00
Pawel Jakub Dawidek 8caa44aa07 MFC r208028,r210368,r210702,r210869,r210870,r210872,r210873,r210875,r210876,
r210879,r210880,r210881,r210882,r210883,r210886,r210892,r211397,r211407,
  r211452,r211875,r211876,r211877,r211878,r211879,r211880,r211881,r211882,
  r211883,r211884,r211885,r211886,r211887,r211895,r211896,r211897,r211898,
  r211899,r211975,r211976,r211977,r211978,r211979,r211981,r211982,r211983,
  r211984,r212033,r212034,r212036,r212037,r212038,r212046,r212049,r212051,
  r212052,r212899,r213003,r213004,r213006,r213007,r213008,r213009:

r208028:

mdoc: move remaining sections into consistent order

This pertains mostly to FILES, HISTORY, EXIT STATUS and AUTHORS sections.

Found by:	mdocml lint run
Reviewed by:	ru

r210368:

Actually, only the fullsync mode is implemented, not memsync mode.
Correct manual page.

r210702:

Spelling fixes.

r210869:

Add an argument to the proto_register() function which allows protocol to
declare it is the default and be placed at the end of the queue so it is
checked last.

r210870:

Now that TCP will be checked last we don't need any knowledge about other
protocols.

r210872:

Mark two more places that we won't reach.

r210873:

Keep $FreeBSD$ in __FBSDID() only for C files.

r210875:

Problem with assertion is that it logs on stderr. Add two macros:
PJDLOG_ASSERT() and PJDLOG_VERIFY() that will check the given condition
and log the problem where appropriate. The difference between those
two is that PJDLOG_VERIFY() always work and PJDLOG_ASSERT() can be
turned off by defining NDEBUG.

r210876:

Assert that various buffers we are large enough.

r210879:

- Use pjdlog_exitx() to log errors and exit instead of errx().
- Use 'unable to' (instead of 'cannot') consistently.

r210880:

Reset signal handlers after fork().

r210881:

Allow to use 'none' keywork as remote address in case second cluster node
is not setup yet.

r210882:

Make control_set_role() more public. We will need it soon.

r210883:

Prepare configuration parsing code to be called multiple times:
- Don't exit on errors if not requested.
- Don't keep configuration in global variable, but allocate memory for
  configuration.
- Call yyrestart() before yyparse() so that on error in configuration file
  we will start from the begining next time and not from the place we left of.

r210886:

Implement configuration reload on SIGHUP. This includes:
- Load added resources.
- Stop and forget removed resources.
- Update modified resources in least intrusive way, ie. don't touch
  /dev/hast/<name> unless path to local component or provider name were
  modified.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r210892:

Document 'none' value for remote.

Reviewed by:	dougb

r211397:

Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages.  Minor corrections by me.

Submitted by:	Nobuyuki Koganemaru <[email protected]>

r211407:

The 'size' variable is there to limit how many bytes we want to copy from
'addr'. It is very likely that size of 'addr' is larger than 'size', so checking
strlcpy() return value is bogus.

r211452:

For some setups sending data in 128kB chunks makes communication very slow. No
idea why. 32kB on the other hand seems to work properly everywhere.

Reported by:	Thomas Steen Rasmussen <[email protected]>

r211875:

Make comment more readable.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211876:

Add mtx_owned() implementation.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211877:

Add QUEUE_INSERT() and QUEUE_TAKE() macros that simplify the code a bit.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211878:

We have sync_start() function to start synchronization, introduce sync_stop()
function to stop it.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211879:

Log that synchronization was interrupted in a proper place.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211880:

Don't increase number synchronized bytes in case of an error.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211881:

- Remove redundant and incorrect 'old' word from debug message.
- Log disconnects as warnings.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211882:

Implement keepalive mechanism inside HAST protocol so we can detect secondary
node failures quickly for HAST resources that are rarely modified.

Remove XXX from a comment now that the guard thread never sleeps infinitely.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211883:

Reduce indent where possible.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211884:

When logging to stdout/stderr don't close those descriptors after fork().

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211885:

- Run hooks in background - don't block waiting for them to finish.
- Keep all hooks we're running in a global list, so we can report when
  they finish and also report when they are running for too long.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211886:

Allow to execute specified program on various HAST events.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211887:

Document new 'exec' parameter.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211895:

Add hooks execution.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211896:

Check if no signals were delivered just before going to sleep.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211897:

Correct when we log interrupted synchronization.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211898:

When logging to stdout/stderr, flush after each log.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211899:

When SIGTERM or SIGINT is received, terminate worker processes.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211975:

Implement mtx_destroy() and rw_destroy().

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211976:

- Add hook_fini() which should be called after fork() from the main hastd
  process, once it start to use hooks.
- Add hook_check_one() in case the caller expects different child processes
  and once it can recognize it, it will pass pid and status to hook_check_one().

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211977:

Allow to run hooks from the main hastd process.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211978:

- Call hook on role change.
- Document new event.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211979:

Disconnect after logging errors.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211981:

- Move functionality responsible for checking one connection to separate
  function to make code more readable.
- Be sure not to reconnect too often in case of signal delivery, etc.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211982:

Use sigtimedwait(2) for signals handling in primary process.
This fixes various races and eliminates use of pthread* API in signal handler.

Pointed out by:	kib
With help from:	jilles
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211983:

Execute hook when split-brain is detected.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r211984:

Execute hook when connection between the nodes is established or lost.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r212033:

Constify arguments we can constify.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r212034:

Use pjdlog_exit() before fork().

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r212036:

When someone gives NULL as data, assume this is because he want to declare
connection side only.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r212037:

We only want to know if descriptors are ready for reading.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r212038:

Because it is very hard to make fork(2) from threaded process safe (we are
limited to async-signal safe functions in the child process), move all hooks
execution to the main (non-threaded) process.

Do it by maintaining connection (socketpair) between child and parent
and sending events from the child to parent, so it can execute the hook.

This is step in right direction for others reasons too. For example there is
one less problem to drop privs in worker processes.

Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r212046:

Mask only those signals that we want to handle.

Suggested by:	jilles
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r212049:

Forgot to add event.c and event.h in r212038.

Pointed out by:	pluknet <[email protected]>
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r212051:

Correct error message.

Submitted by:	Mikolaj Golub <[email protected]>

r212052:

Include process PID in log messages.

Submitted by:	Mikolaj Golub <[email protected]>

r212899:

Add __dead2 to functions that we know they are going to exit.

r213003:

Sort includes.

r213004:

If we are unable to receive control message is most likely because the main
process died. Instead of entering infinite loop, terminate.

r213006:

Fix descriptor leaks: when child exits, we have to close control and event
socket pairs. We did that only in one case out of three.

r213007:

Fix possible deadlock where worker process sends an event to the main process
while the main process sends control message to the worker process, but worker
process hasn't started control thread yet, because it waits for reply from the
main process.

The fix is to start the control thread before sending any events.

Reported and fix suggested by:	Mikolaj Golub <[email protected]>

r213008:

Assert that descriptor numbers are sane.

r213009:

Switch to sigprocmask(2) API also in the main process and secondary process.
This way the primary process inherits signal mask from the main process,
which fixes a race where signal is delivered to the primary process before
configuring signal mask.

Reported by:	Mikolaj Golub <[email protected]>
2010-09-23 09:02:10 +00:00
Xin LI 79cdcab779 MFC r212764:
status bits should be &'ed against status to be really functional.

Reported by:	Jike Song
Reviewed by:	yongari
2010-09-23 01:30:50 +00:00
Jung-uk Kim 882cb5bfd1 MFC: r212806
Rework r210248.  Although it fixed most of problems, it did not fix one
particular edge case where X-axis resolution is not multiple of font width.
Now we just advance enough scan lines, then deduct a partial scan line.
It is more intuitive than the previous code.  Apply the same wisdom to EGA
and VGA planar renderers for consistency.
2010-09-22 22:16:48 +00:00
Marius Strobl 8c2ba3d324 MFC: r207608, r207614, r212651, r212665
Go ahead and merge the work edwin@ on tftpd into the tree.  It is a
lot better than what's in the tree now.  Edwin tested it at a prior
employer, but can't test it today.  I've found that it works a lot
better with the various uboot versions that I've used in my embedded
work.  Here's the pkg-descr from the port that describes the changes:

It all started when we got some new routers, which told me the
following when trying to upload configuration or download images
from it: The TFTP server doesn't support the blocksize option.

My curiousity was triggered, it took me some reading of RFCs and
other documentation to find out what was possible and what could
be done. Was plain TFTP very simple in its handshake, TFTP with
options was kind of messy because of its backwards capability: The
first packet returned could either be an acknowledgement of options,
or the first data packet.

Going through the source code of src/libexec/tftpd and going through
the code of src/usr.bin/tftp showed that there was a lot of duplicate
code, and the addition of options would only increase the amount
of duplicate code. After all, both the client and the server can
act as a sender and receiver.

At the end, it ended up with a nearly complete rewrite of the tftp
client and server. It has been tested against the following TFTP
clients and servers:

- Itself (yay!)
- The standard FreeBSD tftp client and server
- The Fedora Core 6 tftp client and server
- Cisco router tftp client
- Extreme Networks tftp client

It supports the following RFCs:

RFC1350 - THE TFTP PROTOCOL (REVISION 2)
RFC2347 - TFTP Option Extension
RFC2348 - TFTP Blocksize Option
RFC2349 - TFTP Timeout Interval and Transfer Size Options
RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability
          Statement for the Trivial File Transfer Protocol (TFTP)

It supports the following unofficial TFTP Options as described at
http://www.compuphase.com/tftp.htm:

blksize2 - Block size restricted to powers of 2, excluding protocol headers
rollover - Block counter roll-over (roll back to zero or to one)

From the tftp program point of view the following things are changed:

- New commands: "blocksize", "blocksize2", "rollover" and "options"
- Development features: "debug" and "packetdrop"

If you try this tftp/tftpd implementation, please let me know if
it works (or doesn't work) and against which implementaion so I can
get a list of confirmed working systems.

Author: Edwin Groothuis <[email protected]>
2010-09-22 21:54:30 +00:00
Marius Strobl 24c107ac1a MFC: r207607, r207621, r209112, r209550, r209551
Go ahead and merge the work edwin@ on tftpd into the tree.  It is a
lot better than what's in the tree now.  Edwin tested it at a prior
employer, but can't test it today.  I've found that it works a lot
better with the various uboot versions that I've used in my embedded
work.  Here's the pkg-descr from the port that describes the changes:

It all started when we got some new routers, which told me the
following when trying to upload configuration or download images
from it: The TFTP server doesn't support the blocksize option.

My curiousity was triggered, it took me some reading of RFCs and
other documentation to find out what was possible and what could
be done. Was plain TFTP very simple in its handshake, TFTP with
options was kind of messy because of its backwards capability: The
first packet returned could either be an acknowledgement of options,
or the first data packet.

Going through the source code of src/libexec/tftpd and going through
the code of src/usr.bin/tftp showed that there was a lot of duplicate
code, and the addition of options would only increase the amount
of duplicate code. After all, both the client and the server can
act as a sender and receiver.

At the end, it ended up with a nearly complete rewrite of the tftp
client and server. It has been tested against the following TFTP
clients and servers:

- Itself (yay!)
- The standard FreeBSD tftp client and server
- The Fedora Core 6 tftp client and server
- Cisco router tftp client
- Extreme Networks tftp client

It supports the following RFCs:

RFC1350 - THE TFTP PROTOCOL (REVISION 2)
RFC2347 - TFTP Option Extension
RFC2348 - TFTP Blocksize Option
RFC2349 - TFTP Timeout Interval and Transfer Size Options
RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability
          Statement for the Trivial File Transfer Protocol (TFTP)

It supports the following unofficial TFTP Options as described at
http://www.compuphase.com/tftp.htm:

blksize2 - Block size restricted to powers of 2, excluding protocol headers
rollover - Block counter roll-over (roll back to zero or to one)

From the tftp program point of view the following things are changed:

- New commands: "blocksize", "blocksize2", "rollover" and "options"
- Development features: "debug" and "packetdrop"

If you try this tftp/tftpd implementation, please let me know if
it works (or doesn't work) and against which implementaion so I can
get a list of confirmed working systems.

Author: Edwin Groothuis <[email protected]>
2010-09-22 21:54:13 +00:00
Marius Strobl a966d77d51 MFC: r205076 (partial)
Fix several typos in macros or macro misusage.

Found by:	make manlint
Reviewed by:	ru
Approved by:	philip (mentor)
2010-09-22 21:06:41 +00:00
Marius Strobl 027ce38ef3 MFC: r212729
Merge from powerpc:
- Change putc_func_t to use a char instead of an int for the character.
- Make functions and variables not used outside of this source file static.
- Remove unused prototypes and variables.
- The OFW read and seek methods take 3 and not 4 input arguments.
2010-09-22 20:17:33 +00:00
Marius Strobl 6bf6966d8c MFC: r212725
Merge r207585 (MFC'ed to stable/8 in r208086) from cas(4):
- Don't probe for PHYs if we already know to use a SERDES. Unlike as with
  cas(4) this only serves to speed up the the device attach though and can
  only be determined via the OFW device tree but not from the VPD.
- Don't touch the MIF when using a SERDES.
- Add some missing bus space barriers, mainly in the PCS code path.
2010-09-22 20:15:34 +00:00
Marius Strobl b36aec1b82 MFC: rr212709, r212730
Add a VIS-based block copy function for SPARC64 V and later, which
additionally takes advantage of the prefetch cache of these CPUs.
Unlike the uncommitted US-III version, which provide no measurable
speedup or even resulted in a slight slowdown on certain CPUs models
compared to using the US-I version with these, the SPARC64 version
actually results in a slight improvement.
2010-09-22 20:03:59 +00:00
Marius Strobl b1280c9d37 MFC: r212705
Add macros for alternate entry points.
2010-09-22 20:01:33 +00:00
Marius Strobl d28e6382ef MFC: r212676
Sync with other platforms:
- make dflt_lock() always panic,
- add kludge to use contigmalloc() when the alignment is larger than the size
  and print a diagnostic when we didn't satisfy the alignment.
2010-09-22 19:59:11 +00:00
Marius Strobl 65fd86f127 MFC: r212663
- Update the comment in swi_vm() regarding busdma bounce buffers; it's
  unlikely that support for these ever will be implemented on sparc64 as
  the IOMMUs are able to translate to up to the maximum physical address
  supported by the respective machine, bypassing the IOMMU is affected
  by hardware errata and being able to support DMA engines which cannot
  do at least 32-bit DMA does not justify the costs.
- The page zeroing in uma_small_alloc() may use the VIS-based block zero
  function so take advantage of it.
2010-09-22 19:55:37 +00:00
Rui Paulo 22de35abe7 MFC r197804 (rwatson):
Add basename_r(3) to complement basename(3).  basename_r(3) which accepts
  a caller-allocated buffer of at least MAXPATHLEN, rather than using a
  global buffer.

Note about semantics: while this interface is not POSIXy, there's
another major platform that uses it (Android) and the semantics between
the two platforms are pretty much the same.
2010-09-22 18:00:34 +00:00
Tijl Coosemans 8583991a91 MFC r212286:
GCC defines built-ins for atomic instructions found on i486 and higher.
Because FreeBSD no longer supports the 80386 cpu all code targeting
FreeBSD/i386 necessarily runs on i486 or higher so the compiler
built-ins can be used by default inside libstdc++ and in C++ headers.
This allows newly compiled C++ code to inline some atomic operations.
Old binaries continue to use libstdc++ functions.

PR:		148926
Tested by:	Yuri Karaban <tech askold net>
Approved by:	kib (mentor)
2010-09-21 12:55:20 +00:00
Konstantin Belousov 7ebf02e1d6 MFC r212618:
Rename the field to not confuse readers. The bytes are actually used.
2010-09-21 09:33:44 +00:00
Brian Somers a3ca30027b MFC r212253: Document how to use dhclient-{enter,exit}-hooks.
PR:		149351
2010-09-21 07:43:56 +00:00
Ed Schouten 694a6ab634 MFC r211598:
Add support for whiteouts on tmpfs.

  Right now unionfs only allows filesystems to be mounted on top of
  another if it supports whiteouts. Even though I have sent a patch to
  daichi@ to let unionfs work without it, we'd better also add support for
  whiteouts to tmpfs.

  This patch implements .vop_whiteout and makes necessary changes to
  lookup() and readdir() to take them into account. We must also make sure
  that when adding or removing a file, we honour the componentname's
  DOWHITEOUT and ISWHITEOUT, to prevent duplicate filenames.
2010-09-21 07:01:00 +00:00
Alexander Motin d2990801ce MFC r209625:
Correct explanation for idle and standby subcommands' -t argument.
2010-09-21 04:39:13 +00:00
Alexander Motin 92dbff798f MFC r212240:
Add support for the Sharp/Micron flash chips to powermac_mvram(4).
Tested on PowerMac G4 AGP.
2010-09-21 04:29:27 +00:00
Alexander Motin e230138238 MFC r212456:
Sparc64 uses dummy cpu_idle() method. It's CPUs never sleeping. Tell
scheduler that it doesn't need to use IPI to "wake up" CPU.
2010-09-21 04:23:27 +00:00
Justin T. Gibbs ce136a6d36 MFC 212160:
Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic.
Add the BIO_ORDERED flag for struct bio and update bio clients to use it.

The barrier semantics of bioq_insert_tail() were broken in two ways:

 o In bioq_disksort(), an added bio could be inserted at the head of
   the queue, even when a barrier was present, if the sort key for
   the new entry was less than that of the last queued barrier bio.

 o The last_offset used to generate the sort key for newly queued bios
   did not stay at the position of the barrier until either the
   barrier was de-queued, or a new barrier (which updates last_offset)
   was queued.  When a barrier is in effect, we know that the disk
   will pass through the barrier position just before the
   "blocked bios" are released, so using the barrier's offset for
   last_offset is the optimal choice.

sys/geom/sched/subr_disk.c:
sys/kern/subr_disk.c:
	o Update last_offset in bioq_insert_tail().

	o Only update last_offset in bioq_remove() if the removed bio is
	  at the head of the queue (typically due to a call via
	  bioq_takefirst()) and no barrier is active.

	o In bioq_disksort(), if we have a barrier (insert_point is non-NULL),
	  set prev to the barrier and cur to it's next element.  Now that
	  last_offset is kept at the barrier position, this change isn't
	  strictly necessary, but since we have to take a decision branch
	  anyway, it does avoid one, no-op, loop iteration in the while
	  loop that immediately follows.

	o In bioq_disksort(), bypass the normal sort for bios with the
	  BIO_ORDERED attribute and instead insert them into the queue
	  with bioq_insert_tail().  bioq_insert_tail() not only gives
	  the desired command order during insertion, but also provides
	  barrier semantics so that commands disksorted in the future
	  cannot pass the just enqueued transaction.

sys/sys/bio.h:
	Add BIO_ORDERED as bit 4 of the bio_flags field in struct bio.

sys/cam/ata/ata_da.c:
sys/cam/scsi/scsi_da.c
	Use an ordered command for SCSI/ATA-NCQ commands issued in
	response to bios with the BIO_ORDERED flag set.

sys/cam/scsi/scsi_da.c
	Use an ordered tag when issuing a synchronize cache command.

	Wrap some lines to 80 columns.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
sys/geom/geom_io.c
	Mark bios with the BIO_FLUSH command as BIO_ORDERED.

Sponsored by:	Spectra Logic Corporation
------------------------------------------------------------------------
2010-09-20 23:39:00 +00:00
John Baldwin a08351dc6b MFC 212293:
Store the full timestamp when caching timestamps of files and
directories for purposes of validating name cache entries.  This
closes races where two updates to a file or directory within the same
second could result in stale entries in the name cache.

To preserve the ABI of 'struct nfsnode', the existing timestamp fields
are left with 'n_unusedX' placeholders along with the unused 'n_expiry'
field.  The larger n_ctime and n_dmtime fields are added to the end of
the structure.
2010-09-20 19:58:50 +00:00
John Baldwin c8c7721f03 MFC 209907,212326,212368,212749:
- Provide more defines for PCI-Express device ctrl.
- Add register definitions related to extended capability IDs in
  PCI-express.  I used PCIZ_* for ID constants (plain capability IDs use
  PCIY_*).
- Add register definitions for the Advanced Error Reporting, Virtual
  Channels, and Device Serial Number extended capabilities.
- Teach pciconf -c to list extended as well as plain capabilities for
  PCI-express devices.   Adds more detailed parsing for AER, VC, and
  device serial numbers.
2010-09-20 19:29:48 +00:00
John Baldwin 8291754170 MFC 212369:
- Use 'sta' to hold the PCIR_STATUS register value instead of 'cmd' when
  walking the capability list.
- Use constants for PCI header types instead of magic numbers.
2010-09-20 19:25:15 +00:00
John Baldwin fcc8cc96d0 MFC 212329:
Simplify chkattached().  The PCIOCATTACHED ioctl only needs the pi_sel
field populated, it ignores the rest of the 'pci_io' structure.
2010-09-20 19:17:21 +00:00
John Baldwin 2e5002b85d MFC 212338:
If autoboot_delay is set to -1, boot immediately without checking for
a keypress to match the behavior of the loader.
2010-09-20 18:58:24 +00:00
John Baldwin 81cc6cd8ec MFC 211888: Simplify the tcp pcblist estimate logic slightly. 2010-09-20 18:40:54 +00:00
Alexander Motin 7e8b3719a0 MFC r196829:
Add missing ';'.
2010-09-20 18:20:35 +00:00
Alexander Motin b344611f10 MFC r201148:
Don't forget to use `void' for sched_balance(). It has no arguments.
2010-09-20 17:56:03 +00:00
Justin T. Gibbs 7decf142f6 MFC r210055:
Correct logic bug in aicasm's undefined register bit access detection code.

The code in question verifies that all register write operations only change
bits that are defined (in the register definition file) for that effected
register.  The bug effectively disabled this checking.

o Fix the check by testing the opcode against all supported read ("and" based)
  operands.

o Add missing bit definitions to the aic7xxx and aic79xx register definition
  files so that the warning (treated as a fatal error) does not spuriously
  fire.
2010-09-20 17:39:49 +00:00
Bjoern A. Zeeb ba7819531f MFC r212403:
When using pf routing options, properly handle IP fragmentation
  for interfaces with TSO enabled, otherwise one would see an extra
  ICMP unreach, frag needed pre matching packet on lo0.
  This syncs pf code to ip_output.c r162084.

  Submitted by: yongari via mlaier
  Reviewed by:  eri
  Tested by:    kib
PR:           kern/144311
2010-09-20 17:03:10 +00:00
Colin Percival 0ba444e2a5 Fix an integer overflow in RLE length parsing when decompressing
corrupt bzip2 data.

Approved by:	so (cperciva)
Security:	FreeBSD-SA-10:08.bzip2
2010-09-20 14:58:08 +00:00
Andriy Gapon be9d0ebe3a MFC r212325: subr_bus: use hexadecimal representation for bit flags 2010-09-20 11:15:23 +00:00
Andriy Gapon 7973433a5a MFC r212413: bus_add_child: change type of order parameter to u_int 2010-09-20 07:31:08 +00:00
Martin Matuska 8adcbc717d MFC r212791:
Remove duplicate include of <strings.h>

Approved by:	delphij (mentor)
2010-09-20 07:23:45 +00:00
Andriy Gapon ac01d875bd MFC r212213: struct device: widen type of flags and order fields to u_int 2010-09-20 05:56:09 +00:00
Andriy Gapon 853964dde1 MFC r212549: acpi_cpu: do not apply P_LVLx_LAT rules to latencies
returned by _CST
2010-09-20 05:39:50 +00:00
Jilles Tjoelker e1b0be5420 MFC r207831: sh(1): Fix "reserved word" vs "keyword" inconsistency.
Use "keyword" everywhere, like the output of the 'type' builtin, and only
mention "reserved word" once to say it is the same thing.
2010-09-19 21:56:41 +00:00
Jilles Tjoelker 00b0f52d99 MFC r211621: sh(1): Add a brief summary of arithmetic expressions. 2010-09-19 21:38:12 +00:00
Navdeep Parhar c36942ce6f MFC r212710
Fix t3_gate_rx_traffic and t3_open_rx_traffic. Parts of them always operated
on XGMAC0 instead of the specified XGMAC.
2010-09-19 20:22:48 +00:00
Jilles Tjoelker 22d7febea7 MFC r212419: test(1): Fix markup, ( and ) must be separate arguments
so leave spaces.
2010-09-19 16:15:42 +00:00
Jilles Tjoelker 1598944474 MFC r212418: test(1): Clarify grammar ambiguity and -a/-o vs shell &&/||. 2010-09-19 16:13:47 +00:00
Jilles Tjoelker 14b777da53 MFC r212417: sh(1): Remove xrefs for expr(1) and getopt(1).
expr(1) should usually not be used as various forms of parameter expansion
and arithmetic expansion replicate most of its functionality in an easier
way.

getopt(1) should not be used at all in new code. Instead, getopts(1) or
entirely manual parsing should be used.
2010-09-19 16:06:32 +00:00
Brian Somers edaf8f676b MFC r211864,211963,211964,211965, don't mis-handle path names of
101 characters beginning with '/'.
2010-09-19 11:16:49 +00:00
Rick Macklem 844bff7669 MFC: r212217
Change the code in ncl_bioread() in the experimental NFS
client to return an error when rabp is not set, so it
behaves the same way as the regular NFS client for this
case. It does not affect NFSv4, since nfs_getcacheblk()
only fails for "intr" mounts and NFSv4 can't use the
"intr" mount option.
2010-09-19 02:07:30 +00:00
Rick Macklem a9c5f5fdfc MFC: r212216
Disable use of the NLM in the experimental NFS client, since
it will crash the kernel because it uses the nfsmount and
nfsnode structures of the regular NFS client.
2010-09-19 01:41:49 +00:00
Benedict Reuschling 3da1efaf44 Belatedly MFC r210002, r210676, r210812, r210826:
r210002:
In the example for how to create a VLAN, also include an example of
setting the IP address.  While it is documented earlier in rc.conf(5)
that the '.' in the VLAN name becomes a '_' in rc.conf, this may not be
easy to find when just using rc.conf(5) as reference documentation.

r210676:
Fix a bunch of typos and spelling mistakes.

r210812:
Update references from nonexistent usbconfig(1) to usbconfig(8).

r210826:
Correctly sort usbconfig(8) within the SEE ALSO section.

PR:                         docs/149221
Submitted by:               Lars Hartmann (lars at chaotika dot org)
Help with mergeinfo from:   kib
Reviewed by:                kib, hrs (IPv6 parts that should not be
merged to stable/8)
2010-09-18 20:50:36 +00:00
Martin Matuska 0f0cf3140f MFC r212694:
Fix kernel panic when moving a file to .zfs/shares
Fix possible loss of correct error return code in ZFS mount

OpenSolaris revisions and Bug IDs:

11824:53128e5db7cf
6863610	ZFS mount can lose correct error return

12079:13822b941977
6939941	problem with moving files in zfs (142901-12)

Approved by:	delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6863610, 6939941)
2010-09-18 08:45:43 +00:00
Marius Strobl 6b73c43032 MFC: r212621
Use saner nsegments and maxsegsz parameters when creating certain DMA tags;
tags for 1-byte allocations cannot possibly be split across 2 segments and
maxsegsz must not exceed maxsize.

Reviewed by:	Hans Petter Selasky
2010-09-18 08:25:12 +00:00
Bernhard Schmidt 7a055551c4 MFC r212410:
Fix firmware module dependencies.

malo and mwl use the firmware framework to access firmware images.
Depending on the firmware modules itself is not required and in this
case even wrong because no modules with those names exist.

Pointed out by:	brucec
2010-09-18 08:23:45 +00:00
Marius Strobl 4fd674f506 MFC: r212620
Remove a KASSERT which will also trigger for perfectly valid combinations
of small maxsize and "large" (including BUS_SPACE_UNRESTRICTED) nsegments
parameters. Generally using a presz of 0 (which indeed might indicate the
use of bogus parameters for DMA tag creation) is not fatal, it just means
that no additional DVMA space will be preallocated.
2010-09-18 08:20:36 +00:00
Marius Strobl 9114c4e0f5 MFC: r212619
Remove redundant raising of the PIL to PIL_TICK as the respective locore
code already did that.
2010-09-18 08:18:53 +00:00
Andriy Gapon e64d6126f2 MFC r212251,212457: make acpi_hp device a child of acpi_wmi
PR:		kern/147858
2010-09-18 07:16:38 +00:00
Xin LI 4ab1a70ba9 MFC r211475:
Check return value of dup(), it could be -1 when the system is running
out of file descriptors for instance.

Found with:	Coverity Prevent(tm)
CID:		6084
2010-09-18 00:44:55 +00:00
Matthew D Fleming fdf073135c MFC r212153: Fix UP build. 2010-09-16 15:42:11 +00:00
Gleb Smirnoff 7acb801dd9 MFhead 212256:
in_delayed_cksum() requires host byte order.

  Reported by:  Alexander Levin <amindomao googlemail.com>
2010-09-16 15:22:33 +00:00
Fabien Thomas 1085ca10fa MFC r212176:
When an asm location cannot be resolved to a function the cost
will be spread as small value and then filtered by the threshold.
As a first step solution display the number of event that cannot
be resolved as a valid function location.
2010-09-16 15:21:15 +00:00
Gleb Smirnoff 39e6df996f MFhead r210539:
Document that the "ngtee" action no longer accepts packet, and
  thus don't depend on one_pass flag anymore.

  This is a POLA violation, but it is quite difficult to restore
  the old behavior with new code. Also, the new behavior matches
  behavior of the older "tee" action, and this is more intuitive.
2010-09-16 15:19:23 +00:00
Fabien Thomas cd238d746d MFC r212224:
Fix invalid class removal when IAF is not the last class.
 Keep IAF class with 0 PMC and change the alias in libpmc to IAP.
2010-09-16 15:15:34 +00:00
Fabien Thomas 04ef6ce881 MFC r212224:
Fix invalid class removal when IAF is not the last class.
 Keep IAF class with 0 PMC and change the alias in libpmc to IAP.
2010-09-16 15:14:05 +00:00
Gleb Smirnoff b827a92367 MFhead r210537:
Fix operation of "netgraph" action in conjunction with the
  net.inet.ip.fw.one_pass sysctl.

  PR:           kern/148885
  Submitted by: Nickolay Dudorov <nnd mail.nsk.ru>
2010-09-16 15:11:17 +00:00
Gleb Smirnoff 7a7b44b21a Although flexible BPF timestamping framework isn't yet merged to stable/8,
merge from head r209797,r209845 that fix a possible problem.
2010-09-16 15:07:12 +00:00
Gleb Smirnoff 0ef46530cd MFhead 210533:
Don't check malloc(M_WAITOK) result.
2010-09-16 15:00:43 +00:00
Gleb Smirnoff 87ade7c707 MFhead 210529:
When installing a new ARP entry via 'arp -S', lla_lookup() will
  either find an existing entry, or allocate a new one. In the latter
  case an entry would have flags, that were supplied as argument to
  lla_lookup(). In case of an existing entry, flags aren't modified.

  This lead to losing LLE_PUB and/or LLE_PROXY flags.

  We should apply these flags either in lla_rt_output() or in the
  in.c:in_lltable_lookup(). It seems to me that lla_rt_output() is
  a more correct choice.

  PR:           kern/148784, kern/146539
2010-09-16 14:55:22 +00:00
Gleb Smirnoff 23976bafe4 MFhead 210500:
Zero padding fields of netflow records. This helps to reduce
  size of compressed export logs.

  Requested by: Alexey Illarionov <littlesavage orionet.ru>
2010-09-16 14:30:32 +00:00
Alexander Motin 645892c84c MFC r212146:
Add workaround for SiI3114 and SiI3512 chips bug, which caused sending
R_ERR in response to DMA activate FIS under certain circumstances. This is
recommended fix from chip datasheet. If triggered, this bug most likely
caused write command timeout.
2010-09-16 02:47:09 +00:00
Alexander Motin a848350888 MFC r212145:
SATA1.x SiliconImage controllers on power-on reset TFD Status register into
value 0xff. On hot-plug this value confuses ata_generic_reset() device
presence detection logic. As soon as we already know drive presence from
SATA hard reset, hint ata_generic_reset() to wait for device signature
until success or full timeout.
2010-09-16 02:44:23 +00:00
Alexander Motin 75cc8b6422 MFC r212081:
Increase device reset timeout from 10 to 15 seconds, same as in ahci(4).
Some devices found need about 10-12 seconds to spinup.
2010-09-16 02:42:52 +00:00
Rick Macklem 20b8b9ea0c MFC: r212125, r212126
Modify lib/libstand/nfs.c to use NFSv3 instead of NFSv2.
This allows the nfs_getrootfh() function to return the
correct file handle size to pxe.c for pxeboot. It also
results in NFSv2 no longer being used by default anywhere
in FreeBSD. If built with OLD_NFSV2 defined, the old
code that predated this patch will be built and NFSv2
will be used. pxe.c is also modified to use this version
of nfs_getrootfh() so that pxeboot will use NFSv3 and
work for non-FreeBSD as well as FreeBSD NFS servers.
2010-09-16 01:38:13 +00:00
Rick Macklem fb39fd2bfd MFC: r212123
Modify nfs_diskless.c to recognize the environment variable
boot.nfsroot.nfshandlelen and set the diskless root fs to
use NFSv3 and this file handle length when it is set. If
this environment variable is not set, the diskless root fs
will use NFSv2 and the same defaults as before. This fixes
the problem where the diskless nfs root fs had to be on a
FreeBSD server for NFSv3 to work, because it did not know
the correct file handle length and assumed the size used
by FreeBSD.
2010-09-16 01:02:53 +00:00
Marius Strobl 5226764787 MFC: r208459
Use real atomic operations for sparc64.
2010-09-15 20:40:27 +00:00
Marius Strobl 0e84c7bddf MFC: r210601 (partial), r211071, r211073
- As it is not possible for sched_bind(9) to context switch with
  td_critnest > 1 when not already running on the desired CPU read the
  TICK counter of the BSP via a direct cross trap request in that case
  instead.
- Provide a STICK based timecounter.
2010-09-15 20:17:18 +00:00
Maksim Yevmenkin b1f28c4cc3 MFC r212335
Make sure to only pickup hid_input items when parsing input reports.
As it turns out, libusbhid(3) also picks up hic_collection items even
though we explicitly requested hid_input items only.

Tested by:	Buganini < buganini at gmail dot com >
2010-09-15 19:34:18 +00:00
Marius Strobl 0561638f08 MFC: r211050 (partial)
- Introduce a cpu_ipi_single() function pointer in order to send IPIs
  to single CPUs more efficiently with Cheetah(-class) and Jalapeno CPUs.
- Factor out the Jalapeno support from the Cheetah IPI send functions
  in order to be able to more easily and efficiently implement support
  for more than 32 target CPUs as well as a workaround for Cheetah+
  erratum 25 for the latter.
2010-09-15 19:27:30 +00:00
Martin Matuska 3b26b408a5 Add missing MFC to r212668 for cddl/compat/opensolaris from r209962. 2010-09-15 19:20:29 +00:00
Marius Strobl ec2e77aa86 MFC: r211049, r211568
For CPUs which ignore TD_CV and support hardware unaliasing don't
bother doing page coloring. This results in a small but measurable
performance improvement in buildworld times.
2010-09-15 18:51:14 +00:00
Marius Strobl 5a8044f893 MFC: r210176
Allocate proper amount of memory for interrupt names on sparc64 and
sun4v, same as done on other architectures. This removes garbage from
`vmstat -ia` output.
2010-09-15 18:09:16 +00:00
Marius Strobl c4c9144d6d MFC: r208515
Fix some whitespace nits.
2010-09-15 17:38:59 +00:00
Martin Matuska a63ae1d8bd MFC r211932, r211947, r211948:
MFC r211932:

Import changes from OpenSolaris that provide
- better ACL caching and speedup of ACL permission checks
- faster handling of stat()
- lowered mutex contention in the read/writer lock (rrwlock)
- several related bugfixes

Detailed information (OpenSolaris onnv changesets and Bug IDs):

9749:105f407a2680
6802734	Support for Access Based Enumeration (not used on FreeBSD)
6844861	inconsistent xattr readdir behavior with too-small buffer

9866:ddc5f1d8eb4e
6848431	zfs with rstchown=0 or file_chown_self privilege allows user to "take" ownership

9981:b4907297e740
6775100	stat() performance on files on zfs should be improved
6827779	rrwlock is overly protective of its counters

10143:d2d432dfe597
6857433	memory leaks found at: zfs_acl_alloc/zfs_acl_node_alloc
6860318	truncate() on zfsroot succeeds when file has a component of its path set without access permission

10232:f37b85f7e03e
6865875	zfs sometimes incorrectly giving search access to a dir

10250:b179ceb34b62
6867395	zpool_upgrade_007_pos testcase panic'd with BAD TRAP: type=e (#pf Page fault)

10269:2788675568fd
6868276	zfs_rezget() can be hazardous when znode has a cached ACL

10295:f7a18a1e9610
6870564	panic in zfs_getsecattr

MFC r211947:

Move ZUT_OBJS in the same place that is used in vendor code.

MFC r211948:

Return NULL pointer instead of B_FALSE as it is done in the vendor code.

Approved by:	delphij (mentor)
Obtained from:	OpenSolaris (multiple Bug IDs)
2010-09-15 16:20:24 +00:00
Martin Matuska f51cbf0a5d MFC r211931:
Update ZFS metaslab code from OpenSolaris.
This provides a noticeable write speedup, especially on pools with
less than 30% of free space.

Detailed information (OpenSolaris onnv changesets and Bug IDs):

11146:7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
6869229 zfs should switch to shiny new metaslabs more frequently

11728:59fdb3b856f6
6918420 zdb -m has issues printing metaslab statistics

12047:7c1fcc8419ca
6917066 zfs block picking can be improved

Approved by:	delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6826241, 6869229, 6918420, 6917066)
2010-09-15 16:14:38 +00:00
Martin Matuska 8b9b1b626c MFC r210398:
Enable fake resolving of SMB RIDs by using nulldomain and UID_NOBODY
- fixes panics when Solaris/OpenSolaris pools that contain files
uploaded with the SMB protocol are accessed

Enable seting/unsetting the sharesmb property (dummy action)
- allows users who import pools from Solaris/Opensolaris to unset
the sharesmb property and get rid of annoying messages

PR:		kern/145778, kern/148709
Approved by:	pjd, delphij (mentor))
2010-09-15 16:10:38 +00:00
Martin Matuska 582e9616ac MFC r209962, r211970-r211972, r212050, r212605, r212611
MFC r209962:

Merge ZFS version 15 and almost all OpenSolaris bugfixes referenced
in Solaris 10 updates 141445-09 and 142901-14.

Detailed information:
(OpenSolaris revisions and Bug IDs, Solaris 10 patch numbers)

7844:effed23820ae
6755435 zfs_open() and zfs_close() needs to use ZFS_ENTER/ZFS_VERIFY_ZP (141445-01)

7897:e520d8258820
6748436 inconsistent zpool.cache in boot_archive could panic a zfs root filesystem upon boot-up (141445-01)

7965:b795da521357
6740164 zpool attach can create an illegal root pool (141909-02)

8084:b811cc60d650
6769612 zpool_import() will continue to write to cachefile even if altroot is set (N/A)

8121:7fd09d4ebd9c
6757430 want an option for zdb to disable space map loading and leak tracking (141445-01)

8129:e4f45a0bfbb0
6542860 ASSERT: reason != VDEV_LABEL_REMOVE||vdev_inuse(vd, crtxg, reason, 0) (141445-01)

8188:fd00c0a81e80
6761100 want zdb option to select older uberblocks (141445-01)

8190:6eeea43ced42
6774886 zfs_setattr() won't allow ndmp to restore SUNWattr_rw (141445-01)

8225:59a9961c2aeb
6737463 panic while trying to write out config file if root pool import fails (141445-01)

8227:f7d7be9b1f56
6765294 Refactor replay (141445-01)

8228:51e9ca9ee3a5
6572357 libzfs should do more to avoid mnttab lookups (141909-01)
6572376 zfs_iter_filesystems and zfs_iter_snapshots get objset stats twice (141909-01)

8241:5a60f16123ba
6328632 zpool offline is a bit too conservative (141445-01)
6739487 ASSERT: txg <= spa_final_txg due to scrub/export race (141445-01)
6767129 ASSERT: cvd->vdev_isspare, in spa_vdev_detach() (141445-01)
6747698 checksum failures after offline -t / export / import / scrub (141445-01)
6745863 ZFS writes to disk after it has been offlined (141445-01)
6722540 50% slowdown on scrub/resilver with certain vdev configurations (141445-01)
6759999 resilver logic rewrites ditto blocks on both source and destination (141445-01)
6758107 I/O should never suspend during spa_load() (141445-01)
6776548 codereview(1) runs off the page when faced with multi-line comments (N/A)
6761406 AMD errata 91 workaround doesn't work on 64-bit systems (141445-01)

8242:e46e4b2f0a03
6770866 GRUB/ZFS should require physical path or devid, but not both (141445-01)

8269:03a7e9050cfd
6674216 "zfs share" doesn't work, but "zfs set sharenfs=on" does (141445-01)
6621164 $SRC/cmd/zfs/zfs_main.c seems to have a syntax error in the translation note (141445-01)
6635482 i18n problems in libzfs_dataset.c and zfs_main.c (141445-01)
6595194 "zfs get" VALUE column is as wide as NAME (141445-01)
6722991 vdev_disk.c: error checking for ddi_pathname_to_dev_t() must test for NODEV (141445-01)
6396518 ASSERT strings shouldn't be pre-processed (141445-01)

8274:846b39508aff
6713916 scrub/resilver needlessly decompress data (141445-01)

8343:655db2375fed
6739553 libzfs_status msgid table is out of sync (141445-01)
6784104 libzfs unfairly rejects numerical values greater than 2^63 (141445-01)
6784108 zfs_realloc() should not free original memory on failure (141445-01)

8525:e0e0e525d0f8
6788830 set large value to reservation cause core dump (141445-01)
6791064 want sysevents for ZFS scrub (141445-01)
6791066 need to be able to set cachefile on faulted pools (141445-01)
6791071 zpool_do_import() should not enable datasets on faulted pools (141445-01)
6792134 getting multiple properties on a faulted pool leads to confusion (141445-01)

8547:bcc7b46e5ff7
6792884 Vista clients cannot access .zfs (141445-01)

8632:36ef517870a3
6798384 It can take a village to raise a zio (141445-01)

8636:7e4ce9158df3
6551866 deadlock between zfs_write(), zfs_freesp(), and zfs_putapage() (141909-01)
6504953 zfs_getpage() misunderstands VOP_GETPAGE() interface (141909-01)
6702206 ZFS read/writer lock contention throttles sendfile() benchmark (141445-01)
6780491 Zone on a ZFS filesystem has poor fork/exec performance (141445-01)
6747596 assertion failed: DVA_EQUAL(BP_IDENTITY(&zio->io_bp_orig), BP_IDENTITY(zio->io_bp))); (141445-01)

8692:692d4668b40d
6801507 ZFS read aggregation should not mind the gap (141445-01)

8697:e62d2612c14d
6633095 creating a filesystem with many properties set is slow (141445-01)

8768:dfecfdbb27ed
6775697 oracle crashes when overwriting after hitting quota on zfs (141909-01)

8811:f8deccf701cf
6790687 libzfs mnttab caching ignores external changes (141445-01)
6791101 memory leak from libzfs_mnttab_init (141445-01)

8845:91af0d9c0790
6800942 smb_session_create() incorrectly stores IP addresses (N/A)
6582163 Access Control List (ACL) for shares (141445-01)
6804954 smb_search - shortname field should be space padded following the NULL terminator (N/A)
6800184 Panic at smb_oplock_conflict+0x35() (N/A)

8876:59d2e67b4b65
6803822 Reboot after replacement of system disk in a ZFS mirror drops to grub> prompt (141445-01)

8924:5af812f84759
6789318 coredump when issue zdb -uuuu poolname/ (141445-01)
6790345 zdb -dddd -e poolname coredump (141445-01)
6797109 zdb: 'zdb -dddddd pool_name/fs_name inode' coredump if the file with inode was deleted (141445-01)
6797118 zdb: 'zdb -dddddd poolname inum' coredump if I miss the fs name (141445-01)
6803343 shareiscsi=on failed, iscsitgtd failed request to share (141445-01)

9030:243fd360d81f
6815893 hang mounting a dataset after booting into a new boot environment (141445-01)

9056:826e1858a846
6809691 'zpool create -f' no longer overwrites ufs infomation (141445-01)

9179:d8fbd96b79b3
6790064 zfs needs to determine uid and gid earlier in create process (141445-01)

9214:8d350e5d04aa
6604992 forced unmount + being in .zfs/snapshot/<snap1> = not happy (141909-01)
6810367 assertion failed: dvp->v_flag & VROOT, file: ../../common/fs/gfs.c, line: 426 (141909-01)

9229:e3f8b41e5db4
6807765 ztest_dsl_dataset_promote_busy needs to clean up after ENOSPC (141445-01)

9230:e4561e3eb1ef
6821169 offlining a device results in checksum errors (141445-01)
6821170 ZFS should not increment error stats for unavailable devices (141445-01)
6824006 need to increase issue and interrupt taskqs threads in zfs (141445-01)

9234:bffdc4fc05c4
6792139 recovering from a suspended pool needs some work (141445-01)
6794830 reboot command hangs on a failed zfs pool (141445-01)

9246:67c03c93c071
6824062 System panicked in zfs_mount due to NULL pointer dereference when running btts and svvs tests (141909-01)

9276:a8a7fc849933
6816124 System crash running zpool destroy on broken zpool (141445-03)

9355:09928982c591
6818183 zfs snapshot -r is slow due to set_snap_props() doing txg_wait_synced() for each new snapshot (141445-03)

9391:413d0661ef33
6710376 log device can show incorrect status when other parts of pool are degraded (141445-03)

9396:f41cf682d0d3 (part already merged)
6501037 want user/group quotas on ZFS (141445-03)
6827260 assertion failed in arc_read(): hdr == pbuf->b_hdr (141445-03)
6815592 panic: No such hold X on refcount Y from zfs_znode_move (141445-03)
6759986 zfs list shows temporary %clone when doing online zfs recv (141445-03)

9404:319573cd93f8
6774713 zfs ignores canmount=noauto when sharenfs property != off (141445-03)

9412:4aefd8704ce0
6717022 ZFS DMU needs zero-copy support (141445-03)

9425:e7ffacaec3a8
6799895 spa_add_spares() needs to be protected by config lock (141445-03)
6826466 want to post sysevents on hot spare activation (141445-03)
6826468 spa 'allowfaulted' needs some work (141445-03)
6826469 kernel support for storing vdev FRU information (141445-03)
6826470 skip posting checksum errors from DTL regions of leaf vdevs (141445-03)
6826471 I/O errors after device remove probe can confuse FMA (141445-03)
6826472 spares should enjoy some of the benefits of cache devices (141445-03)

9443:2a96d8478e95
6833711 gang leaders shouldn't have to be logical (141445-03)

9463:d0bd231c7518
6764124 want zdb to be able to checksum metadata blocks only (141445-03)

9465:8372081b8019
6830237 zfs panic in zfs_groupmember() (141445-03)

9466:1fdfd1fed9c4
6833162 phantom log device in zpool status (141445-03)

9469:4f68f041ddcd
6824968 add ZFS userquota support to rquotad (141445-03)

9470:6d827468d7b5
6834217 godfather I/O should reexecute (141445-03)

9480:fcff33da767f
6596237 Stop looking and start ganging (141909-02)

9493:9933d599bc93
6623978 lwb->lwb_buf != NULL, file ../../../uts/common/fs/zfs/zil.c, line 787, function zil_lwb_commit (141445-06)

9512:64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads (N/A)

9515:d3b739d9d043
6586537 async zio taskqs can block out userland commands (142901-09)

9554:787363635b6a
6836768 zfs_userspace() callback has no way to indicate failure (N/A)

9574:1eb6a6ab2c57
6838062 zfs panics when an error is encountered in space_map_load() (141909-02)

9583:b0696cd037cc
6794136 Panic BAD TRAP: type=e when importing degraded zraid pool. (141909-03)

9630:e25a03f552e0
6776104 "zfs import" deadlock between spa_unload() and spa_async_thread() (141445-06)

9653:a70048a304d1
6664765 Unable to remove files when using fat-zap and quota exceeded on ZFS filesystem (141445-06)

9688:127be1845343
6841321 zfs userspace / zfs get userused@ doesn't work on mounted snapshot (N/A)
6843069 zfs get userused@S-1-... doesn't work (N/A)

9873:8ddc892eca6e
6847229 assertion failed: refcount_count(&tx->tx_space_written) + delta <= tx->tx_space_towrite in dmu_tx.c (141445-06)

9904:d260bd3fd47c
6838344 kernel heap corruption detected on zil while stress testing (141445-06)

9951:a4895b3dd543
6844900 zfs_ioc_userspace_upgrade leaks (N/A)

10040:38b25aeeaf7a
6857012 zfs panics on zpool import (141445-06)

10000:241a51d8720c
6848242 zdb -e no longer works as expected (N/A)

10100:4a6965f6bef8
6856634 snv_117 not booting: zfs_parse_bootfs: error2 (141445-07)

10160:a45b03783d44
6861983 zfs should use new name <-> SID interfaces (N/A)
6862984 userquota commands can hang (141445-06)

10299:80845694147f
6696858 zfs receive of incremental replication stream can dereference NULL pointer and crash (N/A)

10302:a9e3d1987706
6696858 zfs receive of incremental replication stream can dereference NULL pointer and crash (fix lint) (N/A)

10575:2a8816c5173b (partial merge)
6882227 spa_async_remove() shouldn't do a full clear (142901-14)

10800:469478b180d9
6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached (142901-09)
6793430 zdb -ivvvv assertion failure: bp->blk_cksum.zc_word[2] == dmu_objset_id(zilog->zl_os) (N/A)

10801:e0bf032e8673 (partial merge)
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT (142901-09)

10810:b6b161a6ae4a
6892298 buf->b_hdr->b_state != arc_anon, file: ../../common/fs/zfs/arc.c, line: 2849 (142901-09)

10890:499786962772
6807339 spurious checksum errors when replacing a vdev (142901-13)

11249:6c30f7dfc97b
6906110 bad trap panic in zil_replay_log_record (142901-13)
6906946 zfs replay isn't handling uid/gid correctly (142901-13)

11454:6e69bacc1a5a
6898245 suspended zpool should not cause rest of the zfs/zpool commands to hang (142901-10)

11546:42ea6be8961b (partial merge)
6833999 3-way deadlock in dsl_dataset_hold_ref() and dsl_sync_task_group_sync() (142901-09)

MFC r211970:

Fix 'zfs allow' (maybe not only) returning:

        cannot access dataset system/usr/home: Operation not supported

by including libzfs_impl.h. What libzfs_impl.h does is to redefine ioctl() to
be compatible with OpenSolaris. More specifically OpenSolaris returns ENOMEM
when buffer is too small and sets field zc_nvlist_dst_size to the size that
will be big enough for the data. In FreeBSD case ioctl() doesn't copy data
structure back in case of a failure. We work-around it in kernel and libzfs by
returning 0 from ioctl() and always checking if zc_nvlist_dst_size hasn't
changed. For this work-around to work in pyzfs we need this compatible ioctl()
which is implemented in libzfs_impl.h.

MFC r211971:

Print errors on stderr.

MFC r211972:

Give user a hint what to do when /usr/lib/zfs/pyzfs.py is missing.

MFC r212050:

When upgrading a pool which contain root file system, give user a hint that
he should update boot code.

MFC r212605:

Add missing vop_vector zfsctl_ops_shares
Add missing locks around VOP_READDIR and VOP_GETATTR with z_shares_dir

MFC r212611:

Remove duplicated VFS_HOLD due to a mismerge.

Approved by:	delphij (mentor)
Obtained from:	OpenSolaris (multiple Bug IDs), Perforce (pjd)
2010-09-15 16:05:40 +00:00
Matthew D Fleming c3257c9e1b MFC r212115:
Fix a bug with sched_affinity() where it checks td_pinned of another
thread in a racy manner, which can lead to attempting to migrate a
thread that is pinned to a CPU.  Instead, have sched_switch() determine
which CPU a thread should run on if the current one is not allowed.

KASSERT in sched_bind() that the thread is not yet pinned to a CPU.

KASSERT in sched_switch() that only migratable threads or those moving
due to a sched_bind() are changing CPUs.

Note that this is direct commit as ipi_cpu() only exists in CURRENT.
2010-09-15 15:53:05 +00:00
Nathan Whitehorn 91238ee954 MFC r212363:
Reorder statistics tracking and table lock acquisitions already in place
to avoid race conditions updating the PVO statistics.
2010-09-15 13:45:06 +00:00
Nathan Whitehorn 5cd36eac71 MFC r211967,212044,212278,212322,212331:
Fix a variety of race conditions and errors in VSID allocation in both
the 32 and 64-bit PMAP modules, some dating back to the original PMAP
import from NetBSD. This fixes a variety of potential crashes and memory
corruption bugs, especially on SMP systems under heavy load.
2010-09-15 13:43:43 +00:00
MIHIRA Sanpei Yoshiro 11307ef62b MFC r212317 & r212412
Add Buffalo (Melco Inc.) LUA3-U2-ATX
Add Planex UE-200TX-G
2010-09-15 11:04:02 +00:00
Andre Oppermann 1871d33240 MFC r211874:
Use timestamp modulo comparison macro for automatic receive buffer
  scaling to correctly handle wrapping of ticks value.
2010-09-15 09:38:01 +00:00
Andriy Gapon 38d28aeebe MFC r209064: Remove unused assignment.
Original commit by jkim.
2010-09-15 08:24:19 +00:00
Andriy Gapon 7387871493 MFC r209055: Fix a possible dereference of null pointer.
Original commit by jkim.
2010-09-15 08:18:20 +00:00
Andriy Gapon 45c8da7e52 MFC r211762: zfs arc_reclaim_thread: no need to call arc_reclaim_needed
when resetting needfree
2010-09-15 08:03:23 +00:00
Konstantin Belousov b06f073459 MFC r212501:
Add DF_1_LOADFLTR.
2010-09-15 07:30:27 +00:00
Konstantin Belousov 2df82dbe0f MFC r212499:
Fix typo.
2010-09-15 07:28:31 +00:00
Rick Macklem 2b0ea075e3 MFC: r212043
Add a null_remove() function to nullfs, so that the v_usecount
of the lower level vnode is incremented to greater than 1 when
the upper level vnode's v_usecount is greater than one. This
is necessary for the NFS clients, so that they will do a silly
rename of the file instead of actually removing it when the
file is still in use. It is "racy", since the v_usecount is
incremented in many places in the kernel with
minimal synchronization, but an extraneous silly rename is
preferred to not doing a silly rename when it is required.
The only other file systems that currently check the value
of v_usecount in their VOP_REMOVE() functions are nwfs and
smbfs. These file systems choose to fail a remove when the
v_usecount is greater than 1 and I believe will function
more correctly with this patch, as well.
2010-09-14 01:28:05 +00:00
Maksim Yevmenkin a8333599a5 MFC r212296
Do not request SDP attributes using ranges.
Apparently some devices do not like it.

Tested by:	Buganini < buganini at gmail dot com >
2010-09-14 00:32:29 +00:00
Konstantin Belousov dbb90c29eb MFC r211213:
The buffers b_vflags field is not always properly protected by
bufobj lock. If b_bufobj is not NULL, then bufobj lock should be
held when manipulating the flags. Not doing this sometimes leaves
BV_BKGRDINPROG to be erronously set, causing softdep' getdirtybuf() to
stuck indefinitely in "getbuf" sleep, waiting for background write to
finish which is not actually performed.

Add BO_LOCK() in the cases where it was missed.
2010-09-13 20:29:09 +00:00
Glen Barber bbfb121870 MFC 212263.
Fix typo in bsdcpio(1).

Approved by:	keramida (mentor)
2010-09-13 17:30:29 +00:00
Glen Barber 1949f77b82 MFC 212269.
Add ECONNRESET to connect(2).

Approved by:	keramida (mentor)
2010-09-13 17:27:43 +00:00
Matthew D Fleming e542881947 MFC r209053:
Add INVARIANTS checking that numfreebufs values are sane.  Also add a
per-buf flag to catch if a buf is double-counted in the free count.
This code was useful to debug an instance where a local patch at Isilon
was incorrectly managing numfreebufs for a new buf state.

Requested by:	Kostic Belousov
2010-09-13 17:18:49 +00:00
Konstantin Belousov 0b40c5a586 Regen 2010-09-13 08:49:51 +00:00
Konstantin Belousov 8c48759d96 MFC r211998:
Make the syscalls reserved for AFS usable by OpenAFS port.

The 'NOTSTATIC' flag is removed on merge, since corresponding functionality
is not implemented in the RELENG_8.
2010-09-13 08:49:08 +00:00
Jamie Gritton 8f43a83754 MFC r212436:
Don't exit kern_jail_set without freeing options when enforce_statfs
  has an illegal value.
2010-09-13 00:42:07 +00:00
Glen Barber 7b98ad8438 MFC 212241.
Note that jail_list should contain alphanumeric characters only.

PR:		150098
Approved by:	keramida (mentor)
2010-09-12 18:37:34 +00:00
Xin LI 94551bc132 MFC r212008, 212028, 212210: Vendor update to version 3.80.06.003 to
fix panic with ZFS under heavy I/O load.

PR:             kern/149968
Submitted by:   LSI (Tom Couch)
Reported by:    Kai Kockro <kkockro web de>
Tested by:      Kai Kockro, jpaetzel
2010-09-12 06:19:35 +00:00
Will Andrews 5d94ed39da MFC r211157, r211193, r212265, r212266: make it possible to load carp(4) as
a kld using function pointer hooks and {pf_,ip,ip6}proto_{un,}register().

Reviewed by:	bz
Approved by:	ken (mentor)
2010-09-11 22:02:36 +00:00
Rebecca Cran 64143838eb Remove unused variable 'idle' which mistakenly got merged in r212472.
Approved by:	rrs (mentor)
2010-09-11 21:52:40 +00:00
Gavin Atkinson 9189154885 Merge r212162 from head:
Correct spelling mistake, int -> into
2010-09-11 18:50:33 +00:00
Rebecca Cran b390652f4b MFC r211415:
Add -m and -M options to control the minimum and maximum frequency.

PR:		bin/145063
Submitted by:	Boris Kochergin <spawk at acm.poly.edu>
Approved by:	rrs (mentor)
2010-09-11 14:34:16 +00:00
Rebecca Cran 97d7040f6f MFC r211419:
Since top displays the uptime including seconds, there is no need to add 30
onto it, which may have been used for rounding purposes in other utilities.

PR:		bin/147934
Submitted by:	Janne Snabb <snabb at epipe.com>
Approved by:	rrs (mentor)
2010-09-11 14:26:18 +00:00
Rebecca Cran 9ca41abcff MFC r206909:
It's not necessary to reset the chip every time an input overflow event
occurs. In addition, the delay when programming the short cable fix
should be 100us, not 100ms.

PR:		kern/64556
Approved by:	rrs (mentor)
2010-09-11 14:18:30 +00:00
Jilles Tjoelker 3213e35ed5 MFC r212214: sh: Get rid of some magic numbers. 2010-09-11 12:51:01 +00:00
Konstantin Belousov 327e52c686 MFC r211940:
Test the poll(2) return value.
2010-09-11 06:38:34 +00:00
Rick Macklem 93ab03088a MFC: r211953
Add acquisition of a reference count on nfsv4root_lock in the
nfsd_recalldelegation() function, since this function is called
by nfsd threads when they are handling NFSv2 or NFSv3 RPCs, where
no reference count would have been acquired.
2010-09-11 02:00:27 +00:00
Rick Macklem 11ad45a729 MFC: r211951
The timer routine in the experimental NFS server did not acquire
the correct mutex when checking nfsv4root_lock. Although this
could be fixed by adding mutex lock/unlock calls, zack.kirsch at
isilon.com suggested a better fix that uses a non-blocking
acquisition of a reference count on nfsv4root_lock. This fix
allows the weird NFSLOCKSTATE(); NFSUNLOCKSTATE(); synchronization
to be deleted. This patch applies this fix.
2010-09-11 01:08:16 +00:00
Matthew D Fleming 7533a6014c MFC r211194, r211229, r212058, r212063: memguard(9) rewrite
r211194:

Rework memguard(9) to reserve significantly more KVA to detect
use-after-free over a longer time.  Also release the backing pages of
a guarded allocation at free(9) time to reduce the overhead of using
memguard(9).  Allow setting and varying the malloc type at run-time.
Add knobs to allow:

 - randomly guarding memory
 - adding un-backed KVA guard pages to detect underflow and overflow
 - a lower limit on the size of allocations that are guarded

r211229:

Fix compile.  It seemed better to have memguard.c include opt_vm.h in
case future compile-time knobs were added that it wants to use.
Also add include guards and forward declarations to vm/memguard.h.

r212058:

The realloc case for memguard(9) will copy too many bytes when
reallocating to a smaller-sized allocation.  Fix this issue.

r212063:

Have memguard(9) crash with an easier-to-debug message on double-free.
2010-09-10 17:26:41 +00:00
Nathan Whitehorn a0d2fe7fb1 MFC r211861:
pmap_mapdev() does not appear to actually need GIANT to be held here,
and asserting that is held breaks drm.
2010-09-10 15:33:26 +00:00
Konstantin Belousov b235ea59ae MFC r211941:
Recalcule the return value in pollout().

PR:	kern/143029
Tested by:	John Plevyak <jplevyak apache org>
2010-09-10 12:55:36 +00:00
Warner Losh d125587a35 MFC:
r212169: Allow / in the NANO_DEVICE
    r209225: Allow boot.config to have different values than just -h.
    r209210: Allow population of /cfg and /data.  Begin the move to
	making all slice creation overrideable too, but there's a few
	problems doing that for the duplicated partitions (s1 and s2), so
	just comment that it needs work.
    r209209: Create a make.conf.  not needed for runtime, but some ports
	want to spam it at compile or install time.
    r209207: make these convenience functions more convenient by accepting
	all args, not just the first.  makes mechanical conversion of old
	style more forgiving.
    r207436: Fix typo in usage message.  Add -n to the list of valid arguments.
    r206276: Fix comment about NANO_ARCH.  It can be set now.  Also add
	a warning about how it confuses TARGET and TARGET_ARCH and the need
	to separate the two out into independent variables.
2010-09-10 03:52:05 +00:00
Christian Brueffer a79670c9fd MFC: r207979
Build the ixgbe(4) and mwlfw(4) modules by default.
2010-09-09 21:26:55 +00:00
Bjoern A. Zeeb a2259c57d9 MFC r212155:
MFp4 CH=183052 183053 183258:

    In protosw we define pr_protocol as short, while on the wire
    it is an uint8_t.  That way we can have "internal" protocols
    like DIVERT, SEND or gaps for modules (PROTO_SPACER).
    Switch ipproto_{un,}register to accept a short protocol number(*)
    and do an upfront check for valid boundries. With this we
    also consistently report EPROTONOSUPPORT for out of bounds
    protocols, as we did for proto == 0.  This allows a caller
    to not error for this case, which is especially important
    if we want to automatically call these from domain handling.

    (*) the functions have been without any in-tree consumer
    since the initial introducation, so this is considered save.

    Implement ip6proto_{un,}register() similarly to their legacy IP
    counter parts to allow modules to hook up dynamically.

  Reviewed by:	philip, will
2010-09-09 06:43:18 +00:00
Marko Zec de551c04e6 MFC r211283:
When moving an ethernet ifnet from one vnet to another, destroy the
  associated ng_ether netgraph node in the current vnet, and create a
  new one in the target vnet.

  Reviewed by:  julian
2010-09-08 14:22:35 +00:00
Marko Zec 0fdac76937 MFC r208744:
Virtualize the IPv4 multicast routing code.

  Submitted by: iprebeg
  Reviewed by:  bms, bz, Pavlin Radoslavov
2010-09-08 14:21:12 +00:00
Marko Zec 38dea36077 MFC r208743:
Provide a macro for registering a virtualized sysctl handler for
  VNET opaque data.
2010-09-08 14:19:33 +00:00
Konstantin Belousov 9b3264e3da MFC r212234:
Document "show cdev" command.
2010-09-08 09:53:50 +00:00
Konstantin Belousov bfd7fe044d MFC r212233:
Document MAKEDEV_ETERNAL.
2010-09-08 09:51:03 +00:00
Ed Schouten ae5009cf11 MFC r212087:
Remove reference to device minor numbers in psm(4) man page.

  The number returned by stat(2) is generated automatically, so it is not
  possible to deduce whether the device is blocking or not.
2010-09-08 08:03:08 +00:00
David Xu 01f9867509 MFC: r212047
If a process is being debugged, skips job control caused by SIGSTOP/SIGCONT
  signals, because it is managed by debugger, however a normal signal sent to
  a interruptibly sleeping thread wakes up the thread so it will handle the
  signal when the process leaves the stopped state.
2010-09-08 01:55:03 +00:00
Rick Macklem f746769106 MFC: r211830
Add mutex locking for the call to replay_prune() in
replay_setsize(), since replay_prune() expects the
rc_lock to be held when it is called.
2010-09-08 01:41:22 +00:00
Rick Macklem 29384934ed MFC: r211789
If the first iteration of the do loop in replay_prune()
succeeded and a subsequent interation failed to find an
entry to prune, it could loop infinitely, since the
"freed" variable wasn't reset to FALSE. This patch moves
setting freed FALSE to inside the loop to fix the problem.
2010-09-08 01:18:09 +00:00
Xin LI b0fa6ae97d MFC r205662 + r212066 (except efi part):
Our boot loader is capable of booting both i386 and amd64 kernels so
call it "x86" instead of "i386".
2010-09-07 18:14:59 +00:00
Bjoern A. Zeeb cbc8677cfd MFC r212209:
In case of RADIX_MPATH do not leak the IN_IFADDR read lock on
  early return.
2010-09-07 13:10:46 +00:00
Konstantin Belousov 4fb6f53fab MFC r211748:
Move the __stack_chk_fail_local@FBSD_1.0 compat symbol definition into
the separate .o for libc_pic.a. This prevents rtld from making the
symbol global.
2010-09-07 12:06:41 +00:00
Konstantin Belousov f2ade43c87 MFC r211743:
Remove unused source.
2010-09-07 12:04:07 +00:00
Konstantin Belousov 3a92f01e69 MFC r211742:
The __hidden definition is provided by sys/cdefs.h.
2010-09-07 12:02:34 +00:00
Bjoern A. Zeeb e7469afe16 MFC r212152:
MFp4 CH=183259:

    No reason to use if_free_type() as we don't change our type.
    Just if_free() is fine.
2010-09-07 11:46:09 +00:00
Weongyo Jeong b0acb110a8 MFC r196636:
Connect bwi up to the build.  While there are some problems with this
  driver still, it generally works well for most people most of the
  time.  It is still too green for GENERIC, however.

  Submitted by:	many (latest being kwm@)
Approved by:	imp
Requested by:	Warren Block <wblock at wonkity dot com>
2010-09-06 22:47:52 +00:00
Weongyo Jeong 1d424c5eb7 MFC r209888:
Fixes a bug for LP PHY that some frames have 2 padding bytes at the
  start so we should adjust the mbuf if the driver is running in PIO
  mode.  Now it should work well with WPA authentication and association
  for LP PHY devices.

  Tested by:    Warren Block <wblock at wonkity.com>
2010-09-06 22:31:24 +00:00
Weongyo Jeong 400b015166 MFC r210393:
Fixes a mistake to calculate CALC_COEFF2() value that tmp[3] is
  used even if it's unreachable.

  PR:		kern/144505
  Submitted by:	Henning Petersen <henning.petersen at t-online dot de>
2010-09-06 22:28:46 +00:00
Andriy Gapon edd9892bc7 MFC r212172: acpi: update stale comments about order of cpu devices
probing
2010-09-06 07:24:43 +00:00
Konstantin Belousov 6a8bfaa2ad MFC r210926:
Mark /dev/zero and /dev/null as eternal.
2010-09-05 14:37:29 +00:00
Konstantin Belousov f60dfbc370 MFC r210925:
Enable shared lookups and externed shared ops for devfs.
2010-09-05 14:35:26 +00:00
Konstantin Belousov 1511bd98c0 MFC r210924:
Add "show cdev" ddb command.
2010-09-05 14:31:58 +00:00
Konstantin Belousov 75799934fa MFC r210923:
Add new make_dev_p(9) flag MAKEDEV_ETERNAL to inform devfs that created
cdev will never be destroyed. Propagate the flag to devfs vnodes as
VV_ETERNVALDEV. Use the flags to avoid acquiring devmtx and taking a
thread reference on such nodes.
2010-09-05 14:27:55 +00:00
Konstantin Belousov c6cdb4eb61 MFC r210921:
Enable shared locks for the devfs vnodes. Honor the locking mode
requested by lookup().
2010-09-05 14:20:34 +00:00
Konstantin Belousov 6d010cded1 MFC r210918:
Initialize VV_ISTTY vnode flag on the devfs vnode creation instead of
doing it on each open.
2010-09-05 14:16:35 +00:00
Konstantin Belousov 87ec177e69 MFC r196885 (by ed):
Remove unneeded minor numbers from /dev/null and /dev/zero.
2010-09-05 14:02:34 +00:00
Kai Wang 47b197ad15 MFC r210331-r210333,r210335,r210336,r210338,r210340,r210341,r210559.
r210331:
  Add a new ELF type denoting GNU style hash tables.

r210332:
  Changes for supporting GNU Hash sections.

r210333:
  Note that the *_fsize() functions are only defined for ELF types that
  have a fixed size.

r210335:
  - Return zero for file sizes of ELF types that have a variable size.
  - Neaten a few comments.

r210336:
  Reduce verbosity.

r210338:
  Perform additional checks when translating between file and memory
  representations of ELF types.

  The ELF(3) API allows applications to request a conversion that is
  `in-place', i.e., with source and destinations data buffers being
  the same.  However, the file and memory sizes of ELF sections that
  have additional internal structure, such as those of type `Elf_Note',
  or `Elf_GNU_Hash_Header', can be determined only known after the
  type-specific headers that comprise the first few words in these
  sections are read and translated.

  Pass in the size of destination buffer to type translation routines
  in "libelf_convert.m4" and have these routines return an error code
  if the translated data would not fit inside the destination buffer.

r210340:
  - Document that the *fsize() functions return a size of 1 for Elf
    types that don't have a fixed size.
  - The *fsize() functions should return a size of 1, for variable length
    types.
  - Redefine symbol ELF_T_LAST to match the current end of the list.

r210341:
  Add support for translating sections of type ELF_T_GNUHASH.

r210559:
  Protect GNUHASH translation functions with #ifdef; unbreak cross
  toolchain build.
2010-09-04 13:13:00 +00:00
Kai Wang 7e098de2e1 MFC r210351-r210353,r211192.
r210351:
  * Note that ar(1) archives may also be opened using `elf_memory(3)`.
  * Ignore the passed in value of the `fd` argument for ar(1) archives
    opened with elf_memory(3).

r210352:
  Add a cross-reference to `elf_rawfile(3)`.

r210353:
  * Remove a superfluous error description.
  * Document an additional error that may be returned: `ELF_E_ARCHIVE`.

r211192:
  Add translation support for section type SHT_SUNW_dof.
2010-09-04 13:00:22 +00:00
Kai Wang deb110f098 MFC r210344,r210345,r210348.
r210344:
  Avoid switching between "unsigned char" and "char" in the C code
  generated from "libelf_convert.m4".

r210345:
  * Deprecate `elf_getshnum()`, `elf_getphnum()` and `elf_getshstrndx()` in
    favour of `elf_getshdrnum()`, `elf_getphdrnum()` and `elf_getshdrstrndx()`
    respectively.
  * Add new manual pages for `elf_getshdrstrndx()`, `elf_getphdrnum()` and
    `elf_getshdrnum()`.
  * Add a deprecation warning for `elf_getshstrndx()`, `elf_getphnum()` and
    `elf_getshnum()`.

r210348:
  Move helper functions `_libelf_ar_get_{name,number,string}()` and
  `_libelf_ar_open()` to a new compilation unit "libelf_ar_util.c"
  to break the circular dependency between "elf_memory.o" and
  "libelf_ar.o".
2010-09-04 12:52:44 +00:00
Kai Wang 7af6c9deaa MFC r210329,r210330,r210347.
r210329:
  Use <unistd.h> to declare the prototype for ftruncate().

r210330:
  Allow an application that updates only the ELF Ehdr to work.

r210347:
  Fix a memory leak.
2010-09-04 12:40:06 +00:00
Kai Wang 0dadf6e184 MFC r210325,r210326,r210328,r210349
r210325:
  Bug fix: when updating headers using the gelf_update_*() functions,
  the appropriate `dirty' bit needs to be set for both the Elf32 and
  Elf64 case.

r210326:
  Improve compatibility with other implementations of the ELF(3) API:
  when an output file has no program headers, set the 'e_phentsize'
  field of the ELF executable header to zero.

r210328:
  Bug fix: permit the creation of zero-sized sections.

r210349:
  Remove a redundant word.
2010-09-04 12:19:19 +00:00
Kai Wang c38316f849 MFC r210324, r210438.
r210324:
  - Correctly handle sections of type SHT_NOBITS.  For these sections:
    - elf_getdata() and elf_rawdata() should return an "Elf_Data" structure
      that has its "d_buf" member set to NULL and "d_size" member set to
      the nominal 'size' of the section.
    - Update the manual page for these functions.
  - Fix a memory leak in an error handling path inside elf_getdata().
  - Use _libelf_allocate_data() in elf_newdata() for consistency.

r210438: (np)
  Catch up with r210324.  d_buf will be NULL for SHT_NOBITS sections, do not
  attempt to copy from it in that case.
2010-09-04 12:06:02 +00:00
Kai Wang 06e14adec3 MFC r210321:
Remove a superfluous comment.
2010-09-04 11:50:17 +00:00
Jaakko Heinonen 8cd4f26719 MFC r211513: Call dev_rel() in error paths. 2010-09-04 06:36:12 +00:00
Alexander Motin 51b3467afd MFC r211922:
Add Intel Cougar Point PCH SATA Controller DeviceIDs. Correct some existing
entries for Intel Ibex Peak (5 Series/3400 Series) PCH SATA controllers.
2010-09-04 06:09:08 +00:00
Alexander Motin f2d4870211 MFC r211920:
Add Intel Cougar Point PCH SATA Controller DeviceIDs. Correct some existing
entries for Intel Ibex Peak (5 Series/3400 Series) PCH SATA controllers.
2010-09-04 06:05:57 +00:00
Jilles Tjoelker c03068d6b5 MFC r209652: sh: Remove comment that the comma operator is missing
in arithmetic expansion.

The comma operator is not listed in POSIX.1-2008 XCU 1.1.2.1 Arithmetic
Precision and Operations (referenced by XCU 2.6.4 Arithmetic Expansion) and
is therefore not required.
2010-09-03 21:59:12 +00:00
Jilles Tjoelker a1fdfe542c MFC r208476,208629,210738,211080,211341,211467: New tests
that also work with stable/8 sh.
2010-09-03 21:51:38 +00:00
Jamie Gritton 2bfdd3d2c5 MFC 212073:
Don't over-allocate array values in jailparam_export.

MFC 212074:

  Whitespace and comment fixes.
2010-09-03 15:34:28 +00:00
Jamie Gritton cad37e592a MFC r212072:
Make it clear in the example that jailparam_export's return value
  should be freed.
2010-09-03 15:33:15 +00:00
Ulrich Spörlein f71651c93e MFC r211962: gsched(8): fix example usage, mdoc nits
- ad0 was referred to as da0
- wrong parameter -s instead of -a in example
- use double quotes consistently
2010-09-03 11:58:50 +00:00
Jaakko Heinonen dc75783119 MFC r209256, r209549, r209816, r209844:
- Fix compilation of the subr_unit.c user space test program.
- Use %zu for size_t in a few format strings.
- Correct a comment typo.
- Assert that low and high are >= 0 in new_unrhdr().
2010-09-03 06:30:11 +00:00
Edwin Groothuis 77b8b80a2b Add nameday for Monique
PR:		conf/150049
Submitted by:	Thierry Thomas <[email protected]>
2010-09-02 21:52:43 +00:00
Bjoern A. Zeeb 5b20cb020c MFC r211904:
MFp4 CH=182972:

  Add explicit linkstate UP/DOWN for the epair.  This is needed by carp(4)
  and other things to work.
2010-09-02 16:09:09 +00:00
Ed Maste ff6cdcc96f MFC r199972:
Use switch out (SWO) instead of switch in (SWI) debug log mask in
  csw_out.
2010-09-02 13:34:54 +00:00
Ed Schouten e19f787990 MFC r211633:
Add missing mlink for insmntque1().
2010-09-02 07:49:45 +00:00
Hajimu UMEMOTO 0f426de268 We don't have etc/rc.d/ip6fw anymore.
Since HEAD doesn't have etc/rc.d/network_ipv6,
this commit is directly into RELENG_8.

Spotted by:	takachan__at__running-dog.net
2010-09-02 06:49:27 +00:00
Maxim Konovalov 1da0f995e9 MFC r209970,209971,211990: add -q flag to usage() and
man page synopsys.
2010-09-02 06:07:03 +00:00
Brian Somers 2ac12722c1 MFC r211684 & r211818; return ENOENT if we fall off the end of the directory. 2010-09-02 04:56:01 +00:00
Ed Maste b9aa1c612d MFC r202289:
Reject invalid CIDR widths rather than silently stopping at the first
  non-digit character.

  Due to an issue with rc(8) in a test configuration, ifconfig was being
  invoked with the address used again as the width - for example,

    ifconfig vlan0 10.0.0.1/10.0.0.1

  Prior to this change, that address/width would be interpreted as
  10.0.0.1/10.
2010-09-01 20:25:36 +00:00
Jilles Tjoelker 2c7f73c8f6 MFC r210736: sh: Do not enter consecutive duplicates into the history.
This simply sets a flag in libedit. It has a shortcoming in that it does not
apply to multi-line commands.

Note that a configuration option for this is not going to happen, but always
having this seems better than not having it. NetBSD has done the same.

PR:		bin/54683
Obtained from:	NetBSD
2010-09-01 19:49:24 +00:00
Ed Maste 93030bc389 MFC r202988, r203022
Remove vestigial NetBSD compatibility shim.

  Convert to 2-clause license, from NetBSD rc.subr r1.70.
2010-09-01 19:36:06 +00:00
Alexander Leidinger e8e4bddb9f MFC r211800:
- Change the threshold from 'running next scrub the <value+1>th day after the
    last one' to 'running next scrub the <value>th day after the last one'.
  - Improve wording.

  Requested by:	jhell <[email protected]>
2010-09-01 11:11:20 +00:00
Konstantin Belousov 4d68e97353 MFC r211966:
Use NULL instead of 0 for pointer in example.
2010-09-01 06:51:42 +00:00
Maxim Konovalov 06f7768602 MFC r211801: fix typo. 2010-09-01 05:39:56 +00:00
Hajimu UMEMOTO a69c9778c7 MFC r211435, r211530: Make `ping6 -I' work with
net.inet6.ip6.use_defaultzone=1.
2010-08-31 15:52:12 +00:00
Pyun YongHyeon f028defeb5 MFC r211650,211667:
r211650:
  Document tunable dev.rl.%unit.prefer_iomap

r211667:
  Better wording and fix wrong explanation.

  Submitted by:	Ben Kaduk ( minimarmot <> gmail dot com )
2010-08-31 00:19:03 +00:00
Pyun YongHyeon d27a6b0e24 MFC r211648:
It seems some newer RTL8139 controllers provides only memory space
  register mapping. I'm not sure whether it comes from the fact that
  controllers live behind certain PCI brdge(PLX PCI 6152 33BC) and
  the bridge has some issues in handling I/O space register mapping.
  Unfortunately it's not possible to narrow down to an exact
  controller that shows this issue because RealTek used the same PCI
  device/revision id again. In theory, it's possible to check parent
  PCI bridge device and change rl(4) to use memory space register
  mapping if the parent PCI bridge is PLX PCI 6152. But I didn't try
  to do that and we wouldn't get much benefit with added complexity.

  Blindly switching to use memory space register mapping for rl(4)
  may make most old controllers not to work. At least, I don't want
  to take potential risk from such change. So use I/O space register
  mapping by default but give users chance to override it via a
  tunable. The tunable to use memory space register mapping would be
  given by adding the following line to /boot/loader.conf file.

  dev.rl.%d.prefer_iomap="0"

  This change makes P811B quad-port work with this tunable.
2010-08-31 00:15:20 +00:00
Pyun YongHyeon 295974e525 MFC r211106:
Document newly added controller AR8151 and AR8152.
2010-08-30 21:18:27 +00:00
Pyun YongHyeon dbbc8a9e78 MFC r211105:
Add support for Atheros AR8151/AR8152 PCIe gigabit/fast ethernet
  controller. These controllers are known as L1D(AR8151) and
  L2CB/B2(AR8152). This change adds supports for the following
  controllers.
   o AR8151 v1.0(L1D) gigabit ethernet controller
   o AR8151 v2.0(L1D) gigabit ethernet controller
   o AR8152 v1.1(L2CB) fast ethernet controller
   o AR8152 v2.0(L2CB2) fast ethernet controller
  These controllers have the same feature of AR8131/AR8132 and
  support improved power saving control. The user visible change at
  this moment is reduced jumbo frame size from 9KB to 6KB. Many
  thanks to Atheros for continuing to support FreeBSD.

  HW donated by:	Atheros Communications, Inc.
2010-08-30 21:15:40 +00:00
Pyun YongHyeon 668fab92ff MFC r211103:
Add F1 PHY found on Atheros AR8151 v2.0 PCIe gigabit ethernet
  controller.
2010-08-30 21:11:45 +00:00
Pyun YongHyeon 2ce56526e1 MFC r211047-211048,211051-211053,211285:
r211047:
  Controller does not seem to support more than 1024 bytes DMA burst.
  Limit DMA burst size to be less than or equal to 1024 bytes.

r211048:
  Do not touch CMB TX threshold register when CMB is not used.
  Note, alc(4) does not use CMB at all due to silicon bug.

r211051:
  Always disable ASPM L0s and enable L1 before entering into WOL
  suspend state.  Also disable master clock after PHY power down,
  this is supposed to save more power. The master clock should be
  enabled if WOL is active.

r211052:
  Remove unnecessary assignment.

r211053:
  Cache PCIY_PMG and PCIY_EXPRESS capability pointer to softc and use
  it instead of calling pci_find_extcap().

r211285:
  Make sure to disable RX MAC in alc_stop_mac(). Previously there
  was a logic error which it always enabled RX MAC.
2010-08-30 21:07:26 +00:00
Pyun YongHyeon 29e4bf0f87 MFC r211046:
Marvell model number 0x06 is 88E1101 PHY.
2010-08-30 20:59:13 +00:00
Pyun YongHyeon a4a9404816 MFC r210905:
Reflect default Tx interrupt moderation timer value change(50ms -> 1ms).
2010-08-30 20:56:12 +00:00
Pyun YongHyeon 4b0a859ea0 MFC r210904:
Reduce Tx interrupt moderation timer from 50ms to 1ms. The default
  value resulted in poor performance for UDP packets. With this
  change, UDP bulk transfer performance is more than 940Mbps.

  While I'm here fix a wrong register definition.
2010-08-30 20:49:51 +00:00
Xin LI e9c56db922 MFC r210665:
In rdmsr_safe, use zero extend (by doing a 32-bit movl over
eax to itself) instead of a sign extend.

Discussed with: stas
2010-08-30 18:23:48 +00:00
Jung-uk Kim 1f381087d3 MFC: r211823
Check opcode for short jump as well.  Some option ROMs do short jumps
(e.g., some NVIDIA video cards) and we were not able to do POST while
resuming because we only honored long jump.
2010-08-30 17:34:59 +00:00
Jaakko Heinonen 6e33f80321 MFC r211342:
- Check that strtoul(3) succeeds to convert the entire string in a few
  places.
- In getasciilabel(), set the disk type only when a valid type is given.

PR:		bin/86765
2010-08-30 14:44:22 +00:00
Attilio Rao 49d52f1235 MFC r208752, r209590:
Protect periph drivers list and rearrange things to minimize the chance of
stepping oneself during probing.
Don't blindly decrement a periph probe count.

Sponsored by:	Sandvine Incorporated
2010-08-30 10:30:35 +00:00
Maxim Konovalov e5cefe7599 MFC r210181: fix typo. 2010-08-30 07:11:13 +00:00
Maxim Konovalov 5480db3c1a MFC r210000: correct path to include file. 2010-08-30 07:09:40 +00:00
Maxim Konovalov d94e85fdc8 MFC r209972: restore missed flag in the synopsis. 2010-08-30 07:06:27 +00:00
Maxim Konovalov f59d4880ea MFC r209926: fix typo. 2010-08-30 07:04:19 +00:00
David Xu e959e51e35 MFC r211833: Decrease rdlock count only when thread unlocked
a reader lock.
2010-08-29 08:15:57 +00:00
Konstantin Belousov 6b164e5863 MFC r211335:
Add convenience defines for hidden and default/exported attributes.

MFC r211741:
Use preferred spelling for the __attribute__.

MFC r211868:
Use private namespace for visibility keyword.
2010-08-29 08:10:34 +00:00
Hajimu UMEMOTO 27b516d5e2 MFC r211340: Correct the return code from _dns_gethostby*()
to correspond with h_errno.
2010-08-29 03:53:17 +00:00
Hajimu UMEMOTO c93734c018 MFC r211276:
- When there is no room for returning the result, nss backend
  have to return ERANGE and terminate with NS_RETURN.
- When gethostbyname_r(3) and the friends end with an error,
  set errno to the value nss backend returns, and return errno
  value.

PR:		kern/131623
2010-08-28 17:06:22 +00:00
Bernhard Schmidt 7d6f2dcaf3 MFC r211295,211314,211546:
Introduce IEEE80211_C_RATECTL, drivers which use the ratectl framework
should set this capability. Initialize ni_txrate after txparams have
been setup. Some drivers calculate various things prior to association
based on ni_txrate and rely on it being nonzero.

PR:		kern/149185
2010-08-28 07:21:15 +00:00
Xin LI 10de253f70 MFC r210624 and r210833:
Improve cputemp(4) driver wrt newer Intel processors, especially
Xeon 5500/5600 series:

 - Utilize IA32_TEMPERATURE_TARGET, a.k.a. Tj(target) in place
   of Tj(max) when a sane value is available, as documented
   in Intel whitepaper "CPU Monitoring With DTS/PECI"; (By sane
   value we mean 70C - 100C for now);
 - Print the probe results when booting verbose;
 - Replace cpu_mask with cpu_stepping;
 - Use CPUID_* macros instead of rolling our own.

Catch known CPUs before using IA32_TEMPERATURE_TARGET.
This way we would have an opportunity to hide the
Tj(target) value doesn't seem right stuff if we know
it's not working there.

Add temperature value for Core2 Duo Extreme Mobile that
I have access to.
2010-08-28 00:48:40 +00:00
Kirk McKusick 98a9dc74f3 MFC of -r210382 to note that foreground fsck should be run after
a filesystem related panic. Also -r210933 by joel to fix typos
and spelling mistakes.
2010-08-28 00:30:57 +00:00
Kirk McKusick e22071f226 MFC of -r210382 to note that foreground fsck should be run after
a filesystem related panic. Also -r210933 and -r211397 by joel
to fix typos and spelling mistakes.
2010-08-28 00:27:47 +00:00
Bjoern A. Zeeb 54b7785168 MFC r211451:
When calculating the expected memory size for userspace, also take the
  number of syncache entries into account for the surplus we add to account
  for a possible increase of records in the re-entry window.

  Discussed with:		jhb, silby
2010-08-27 21:52:05 +00:00
John Baldwin 7c1b445214 MFC 210774,210935:
- Tweak the logic to disable CLFLUSH in virtual environments to work around
  problems with flushing the local APIC register range so that it checks
  vm_guest directly.
- Add Xen to the list of virtual vendors.  In the non PV (HVM) case this
  fixes the virtualization detection successfully disabling the CLFLUSH
  instruction.
2010-08-27 18:55:24 +00:00
John Baldwin f749e399cb MFC 211433:
Ensure a minimum "slop" of 10 extra pcb structures when providing a
memory size estimate to userland for pcb list sysctls.  The previous
behavior of a "slop" of n/8 does not work well for small values of n
(e.g. no slop at all if you have less than 8 open UDP connections).
2010-08-27 18:50:12 +00:00
Ulrich Spörlein 2b9d9e2d4b MFC r206622,207939,208593,208732,209031: mdoc cleanup
- order prologue by Dd/Dt/Os
- fix prologue
- remove empty lines and other garbage
- uppercase document title
2010-08-27 10:47:17 +00:00
Andre Oppermann fd9d659c10 MFC r211464:
If a TCP connection has been idle for one retransmit timeout or more
  it must reset its congestion window back to the initial window.

  RFC3390 has increased the initial window from 1 segment to up to
  4 segments.

  The initial window increase of RFC3390 wasn't reflected into the
  restart window which remained at its original defaults of 4 segments
  for local and 1 segment for all other connections.  Both values are
  controllable through sysctl net.inet.tcp.local_slowstart_flightsize
  and net.inet.tcp.slowstart_flightsize.

  The increase helps TCP's slow start algorithm to open up the congestion
  window much faster.

  Reviewed by:	lstewart
  MFC after:	1 week
2010-08-27 10:15:45 +00:00
Andre Oppermann 8e0725e624 MFC r211462:
Untangle the net.inet.tcp.log_in_vain and net.inet.tcp.log_debug
  sysctl's and remove any side effects.
2010-08-27 09:36:02 +00:00
Ulrich Spörlein 06caf0cbb0 MFC r206615: remove .Pp where not needed 2010-08-27 09:35:05 +00:00
Ulrich Spörlein dca2268166 MFC r205208:
- Use `Va' for variables instead of `Dv'.
- Correctly spell negative values.
- Also fixes make manlint.
2010-08-27 09:33:26 +00:00
Konstantin Belousov 5e33901b3d MFC r211750:
Remove extra FreeBSD tag.
2010-08-27 08:05:44 +00:00
Ulrich Spörlein ef7ccb5fc2 MFC r204111: Fix common misspelling of hierarchy 2010-08-26 20:44:12 +00:00
Navdeep Parhar ef97ff1d26 MFC r208887, r209115-209116, r209839-209841, r211345-211347
r208887
tunable to control mc5 partition

r209115
make format string a string literal.

r209116
Add knob to get packet timestamps from the hardware.

r209839
Fix bufsize calculation so that cxgbtool can display information for the
last I/O queue too.

r209840
Eliminate ext_intr_task.  The "slow" interrupt handler is already
running on the adapter's task queue.  Just do what the task does
instead of enqueueing it.

r209841
Improved link detection.

r211345
wakeup is required if the adapter lock is released anywhere during
init and not just for the may_sleep case.

r211346
Always reset the XGMAC's XAUI PCS on a link up.

r211347
Fix tx pause quanta and timer calculations.
2010-08-26 19:55:03 +00:00
Konstantin Belousov f3872d0380 MFC r211704:
Style.
2010-08-26 11:25:09 +00:00
Rick Macklem b2568d6da7 MFC: r210834
Add some mutex locking on the nfsnode to the regular NFS client.
2010-08-25 22:19:52 +00:00
Alexander Motin 18a8823f9e MFC r211455:
Remove bintime_cmp() function, unused since r200086.
2010-08-25 08:49:21 +00:00
Edward Tomasz Napierala 307e2c6a28 MFC r210447:
Add P_HASTHREADS flag description.
2010-08-24 17:47:52 +00:00
Edward Tomasz Napierala fd75f257d2 MFC r210448:
Fix alignment for the 'flags' label, and make more room for 'tdev'.
2010-08-24 17:46:43 +00:00
Edwin Groothuis 8f2024e9be For some reason, the new files which got merged from the head branch
didn't get automatically added to the repository.

MFC of r205821 r205827 r205828 r205862 r205872 r205937 r206568
MFC of r208825 r208826 r208827 r208828 r208829 r208943

r205821:
Long awaited update to the calendar system:

- Repeating events which span multiple years (because of -A, -B or
just the three days before the end of the year).
- Support for lunar events (full moon, new moon) and solar events
(equinox and solstice, chinese new year). Because of this, the
options -U (UTC offset) and -l (longitude) are available to
compensate if reality doesn't match the calculated values.

r205828:
Use local names for calendar.dutch

r205862:
Fix DST thingies in calendar.australia

r205872:
Make licenses 3 clause instead of 4 clause

r205937:
Make the dates in the Tasmanian part of calendar.australia properly
variable.

r206568:
Typo in Allerheiligen in calendar.dutch

r208825, r208826, r208827, r208828, r208829, r208943:
Coverity Prevent related fixes.
2010-08-24 07:59:39 +00:00
Edwin Groothuis c542a3f449 MFC of r205821 r205827 r205828 r205862 r205872 r205937 r206568
MFC of r208825 r208826 r208827 r208828 r208829 r208943

r205821:
Long awaited update to the calendar system:

- Repeating events which span multiple years (because of -A, -B or
  just the three days before the end of the year).
- Support for lunar events (full moon, new moon) and solar events
  (equinox and solstice, chinese new year). Because of this, the
  options -U (UTC offset) and -l (longitude) are available to
  compensate if reality doesn't match the calculated values.

r205828:
Use local names for calendar.dutch

r205862:
Fix DST thingies in calendar.australia

r205872:
Make licenses 3 clause instead of 4 clause

r205937:
Make the dates in the Tasmanian part of calendar.australia properly
variable.

r206568:
Typo in Allerheiligen in calendar.dutch

r208825, r208826, r208827, r208828, r208829, r208943:
Coverity Prevent related fixes.
2010-08-23 22:09:25 +00:00
John Baldwin 16baa5ca51 MFC 210936,210946:
Ethernet vlan(4) interfaces have valid Ethernet link layer addresses but
use a different interface type (IFT_L2VLAN vs IFT_ETHER).  Treat IFT_L2VLAN
interfaces like IFT_ETHER interfaces when handling link layer addresses.
2010-08-23 20:53:01 +00:00
Ulrich Spörlein 1728adede3 MFC r205078,208483,211401-211402,211404: mdoc cleanup
- Fix typo in macro name and macro usage.
- Consistently spell our email addresses <[email protected]>
- Wordsmithing of bsnmpd.1; bump .Dd
- Fix two minor typos.
2010-08-23 11:58:45 +00:00
Brian Somers 478ffea3db MFC r210407: Add a -S switch to override syslogd's pidfile. 2010-08-23 09:52:04 +00:00
Christian Brueffer f0bd60a1fa MFC: r148701
Fixed a typo.
2010-08-22 20:24:24 +00:00
Christian Brueffer ad2ae8e27c MFC: r211355
Fixed a typo and added a comma.
2010-08-22 20:17:28 +00:00
Konstantin Belousov aceea050db MFC r211339:
Add missed dependency.
2010-08-22 14:54:59 +00:00
Gavin Atkinson f0a6621170 Merge r211026 from head:
Add a keymap for the Swiss-German Macbook keyboard.

PR:		conf/139997
Submitted by:	Andreas Tobler <andreast fgznet.ch>
2010-08-22 12:03:31 +00:00
Gavin Atkinson b3122b9ecc Merge r211066 from head:
Add a termcap entry for rxvt-256color.

PR:		conf/147726
Submitted by:	Sterling (Chip) Camden <sterling camdensoftware.com>
2010-08-22 09:05:08 +00:00
Andre Oppermann d506a01b36 MFC r211333:
Fix the interaction between 'ICMP fragmentation needed' MTU updates,
  path MTU discovery and the tcp_minmss limiter for very small MTU's.
2010-08-22 09:01:58 +00:00
Andre Oppermann 4d1d1dde65 MFC r211327:
Add more logging points for failures in syncache_socket() to
  report when a new socket couldn't be created because one of
  in_pcbinshash(), in6_pcbconnect() or in_pcbconnect() failed.
2010-08-22 08:47:00 +00:00
Andriy Gapon 114ea7e77c Fix a mismerge in r211581, MFC of r210427
This is a direct commit.

Reported by:	many
Pointyhat to:	avg
2010-08-22 08:18:32 +00:00
Nathan Whitehorn 8ce48b5604 MFC r209950:
Unify ABI-related bits of the Book-E and AIM machdep routines
(exec_setregs, etc.) in order to simplify the addition of 64-bit support,
and possible future extension of the Book-E code to handle hard floating
point and Altivec.
2010-08-22 00:04:24 +00:00
Nathan Whitehorn f968f9a306 MFC r209812:
Replace the existing PowerPC busdma implementation with the one from
amd64 (with slight modifications). This provides support for bounce
buffers, which are required on systems with RAM above 4 GB.
2010-08-21 22:23:22 +00:00
Jilles Tjoelker 2c9733e0e5 MFC r211155: sh: Fix heap-based buffer overflow in pathname generation.
The buffer for generated pathnames could be too small in some cases. It
happened to be always at least PATH_MAX long, so there was never an overflow
if the resulting pathnames would be usable.

This bug may be abused if a script subjects input from an untrusted source
to pathname generation, which a bad idea anyhow. Most shell scripts do not
work on untrusted data. secteam@ says no advisory is necessary.

PR:		bin/148733
Reported by:	Changming Sun snnn119 at gmail com
2010-08-21 20:48:09 +00:00
Nathan Whitehorn 6aac563a06 MFC r209963:
Add a missing architecture declaration to the machine specification
for sun4v.
2010-08-21 19:31:58 +00:00
Andriy Gapon edbb029095 MFC r210425: dtrace: correctly map sections to addresses in elf object
modules (amd64)
2010-08-21 19:02:49 +00:00
Andriy Gapon 2f4cd00e00 MFC r210424: kgdb: correctly map sections to addresses in elf object
modules (amd64)
2010-08-21 18:54:13 +00:00
Andriy Gapon c68ec71bed MFC r210423: completely ignore zero-sized elf sections in modules of elf
object type (amd64)
2010-08-21 18:48:24 +00:00
Andriy Gapon e30b713927 MFC r210245: binutils/ld: fix incorrect placement of __start_SECNAME in
some cases
2010-08-21 18:38:56 +00:00
Andriy Gapon a56be3711f MFC r210427: zfs arc_memory_throttle: available memory is free + cache 2010-08-21 18:20:56 +00:00
Andriy Gapon 2bc549fb9a MFC r210422: cpufreq: allocate long-lived buffer for handling of sysctl
requests
2010-08-21 17:48:29 +00:00
Andriy Gapon 38e03be9de MFC r210454: ichwd: correct range check for timeout value 2010-08-21 16:40:04 +00:00
Andre Oppermann db63da93cf MFC r211317:
Reset the internal tso flag in tcp_output() on every iteration
  of sendalot.
2010-08-21 11:10:58 +00:00
Andre Oppermann ee485cff21 MFC r211316:
Change the messages of the ICMP bad port bandwidth limiter from
  a kernel printf to a log output with the priority of LOG_NOTICE.
2010-08-21 11:01:40 +00:00
Andre Oppermann eed7876823 MFC r211315:
Disable TCP inflight limiter by default.
2010-08-21 10:38:50 +00:00
Konstantin Belousov ac86626fa5 MFC r210679:
Report the time left for the sleep on SIGINFO.
Be stricter in the checking of interval specification.

MFC r210696:
Deal with proper format for printing time_t.

MFC r210749:
Simplify argument parser by using sscanf(); simplify usage() by not
refusing to use stdio.
Reduce nesting level in the sleep loop by returning earlier for negative
timeouts.
Limit the maximum timeout to INT_MAX seconds.

MFC r210750:
Document the new argument parser for sleep(1) and SIGINFO behaviour.
Remove higlight for the unportability notice.
2010-08-21 08:49:53 +00:00
Bjoern A. Zeeb 74d5adc0cd MFC r211115:
MFp4 CH180235:

  Add proto spacers to inet6sw like we have for legacy IP. This allows us
  to dynamically pf_proto_register() for INET6 from modules, needed by
  upcoming CARP changes and SeND.
  MC and SCTP could make use of it as well in theory in the future after
  upcoming VIMAGE vnet teardown work.

  Discussed with:	will, anchie
2010-08-20 15:26:09 +00:00
Jaakko Heinonen d16baa5516 MFC r208951:
Add a new function devfs_parent_dirent() for resolving devfs parent
directory entry. Use the new function in devfs_fqpn(), devfs_lookupx()
and devfs_vptocnp() instead of manually resolving the parent entry.
2010-08-19 15:33:43 +00:00
Alexander Leidinger 59def86549 sort of MFC: r211495 was supposed to add this script from HEAD, and while
the merge seems to have been successful, the script does not show up
in releng-8. This is a "svn copy head/.../800.zfs-scrub ." as retrying
the svn merge does not result in the file showing up. This may not be
the best way to fix the problem in svn, but it is the only way I'm aware of
to fix the stable branch (which is IMO more important than to use a potential
best way I'm not aware of).

Relevant commit log for this file (r209195):
  Add a periodic zfs scrub script.

  Features:
   - configurable amount of days between scrubs (default value or per pool)
   - do not scrub directly after pool creation (respects the configured
     number of days between scrubs)
   - do not scrub if a scrub is in progress
   - tells how to see the status of the scrub
   - tells how many days since the last scrub if it skips the scrubbing
   - warns if a non-existent pool is specified explicitely
     (default: no pools specified -> all currently imported pools are
     handled)
   - runs late in the periodic run to not slow down the other periodic daily
     scripts
2010-08-19 13:24:13 +00:00
Alexander Leidinger 7e9b7dcdc5 MFC
r209195:
  Add a periodic zfs scrub script.

  Features:
   - configurable amount of days between scrubs (default value or per pool)
   - do not scrub directly after pool creation (respects the configured
     number of days between scrubs)
   - do not scrub if a scrub is in progress
   - tells how to see the status of the scrub
   - tells how many days since the last scrub if it skips the scrubbing
   - warns if a non-existent pool is specified explicitely
     (default: no pools specified -> all currently imported pools are
     handled)
   - runs late in the periodic run to not slow down the other periodic daily
     scripts

r209250:
  - connect the zfs scrub script
  - move the zfs status script into the MK_ZFS conditional to respect
    WITHOUT_ZFS

r209253:
  Add the ZFS periodic daily scripts to the ZFS part. (make delete-old)

Requested by:	"J. Hellenthal" <[email protected]>
PR:		149271
2010-08-19 09:00:17 +00:00
Konstantin Belousov 8b2b854be0 MFC r210631:
Add compat32 shims for opencrypto(4).
2010-08-19 08:50:11 +00:00
Gavin Atkinson cb15e78ce7 Merge r210571 from head:
Add support for the Corega CG-USBRS232R to uplcom(4)

PR:		usb/129173
Submitted by:	SHIMAOKA Shunsuke <shimaoka.shunsuke gmail.com>
2010-08-18 21:44:50 +00:00
Gavin Atkinson 14c8ee2495 Merge r210556 from head:
Support the Pyramid KBS USB LCD under uftdi(4)

PR:		usb/129758
Submitted by:	joao lima <jlima visionware.pt>
2010-08-18 21:39:42 +00:00
Gavin Atkinson ce55e541c1 Merge r210524 from head:
- Support two devices made by West Mountain Radio in uslcom(4) [1]

  - Remove duplicate SILABS CP2102 define from usbdevs

Merge r211022 from head:

  Sync the list of devices supported by uslcom(4) with NetBSD, Linux, OpenBSD
  and BeOS.  The devices supported by uslcom(4) are now in sync with:

  NetBSD  src/sys/dev/usb/uslsa.c 1.11
  OpenBSD src/sys/dev/usb/uslcom.c 1.20
  Linux   source/drivers/usb/serial/cp210x.c from kernel 2.6.35
  BeOS    usb_serial/driver.c 1.32

  Two vendor/product IDs from Linux have not been added to uslcom(4):
    SILABS SAEL - This device has special code in u3g to support it
    SILABS GSM2228 - I suspect this should also be covered by u3g(4).

PR:		usb/131912 [1]
Submitted by:	Jack Twilley <mathuin gmail.com> [1]
2010-08-18 21:17:57 +00:00
Gavin Atkinson 6eb2d2ecb7 Merge r211077, r211079 from head:
Correct two error messages to match the failure they are reporting.

  Correct the login.conf variable name used for obtaining the login prompt.
2010-08-18 20:38:47 +00:00
Gavin Atkinson 30697fd134 Merge 210839 from head:
Do not free sc if attach failed, as it was allocated by the bus
  infrastructure, not us.  This appears to be a leftover from an older
  version of the driver.

Submitted by:	avg
Tested by:	Anton Shterenlikht <mexas bristol.ac.uk>
2010-08-18 20:23:55 +00:00
Alexander Motin 539c27ee05 MFC r208818:
Plug memory leak to silent Coverity. Error is still not really handled.

Found with:   Coverity Prevent(tm)
CID:          4137
2010-08-18 15:58:26 +00:00
Alexander Motin e468a816d5 MFC r208817:
Plug memory leak to silent Coverity. Error is still not really handled.

Found with:   Coverity Prevent(tm)
CID:          4196
2010-08-18 15:56:09 +00:00
Alexander Motin 82f3a55194 MFC r208816:
Fix attach errors handling.

Found with:   Coverity Prevent(tm)
CID:          3477
2010-08-18 15:55:20 +00:00
Alexander Motin b1d8056c7f MFC r208907:
Disable NCQ and PMP support for VIA VT8251 AHCI. It was reported to be
unreliable under load. Linux does the same.
2010-08-18 15:52:38 +00:00
Alexander Motin adf4043dae MFC r208814:
Plug memory leak to silent Coverity. Error is still not really handled.

Found with:   Coverity Prevent(tm)
CID:          4130
2010-08-18 15:51:32 +00:00
Alexander Motin c38091789e MFC r208813:
Fix attach errors handling.

Found with:   Coverity Prevent(tm)
CID:          3424
2010-08-18 15:49:44 +00:00
Ulrich Spörlein 1c7462039b MFC r203920,210755,210809,210827:
- WARNS?=6 cleanup
- fix timekeeping for user-supplied value n
- de-obfuscate the timekeeping of now/delay
2010-08-17 16:25:44 +00:00
Jaakko Heinonen 713f664ba1 MFC r200633:
Sync getline() with comm(1):

 - Prevent overflowing of the buffer length variable in getline() by
   limiting its maximum value.
 - Exit if reallocf(3) fails in getline(). Failure was silently
   considered as end-of-file.

MFC r204803 by ache:

1) Rewrite input processing to not exit with error on the first EILSEQ found
in the input data but fallback to "binary equal" check instead.

POSIX says: "The input file shall be a text file", nothing more,
so the text file with illegal sequence is valid input.
BTW, GNU sort does not fails on EILSEQ too.

2) Speedup input processing a bit in complex cases like skipping fields,
chars or ignore case.

3) Enforce the implied LINE_MAX limit (from POSIX definition of "text file"
and POSIX uniq(1) description).

MFC r204811 by ache:

Remove vestiges of old %-format which prevents build on amd64

MFC r204876 by ache:

1) Reimplement (differently) unlimited line length restricted in prev.
commit.

2) Honor missing the very last \n (if absent) on output.

MFC r204927 by ache:

Add SIZE_MAX overflow check
2010-08-17 15:07:23 +00:00
Jaakko Heinonen a4072b5936 MFC r200442:
Don't read the newline character to line buffer because lines are passed
to wcscoll(3). Newline characters could cause incorrect results when
comparing lines.

Also, if an input line didn't contain a newline character, it was
omitted from the output. According to my interpretation, SUSv3 requires
that the newline is always printed.

Add regression tests for the cases.

PR:		bin/140976

MFC r200604:

- Prevent overflowing of the buffer length variable in getline() by
  limiting its maximum value.
- Exit if reallocf(3) fails in getline(). Failure was silently
  considered as end-of-file.

MFC r204896 by ache:

Rewrite input processing to not exit with error on the first EILSEQ found
in the input data but fallback to "binary comparison" instead.

POSIX says: "The input files shall be text files", nothing more,
so the text file with illegal sequence is valid input.
BTW, GNU sort does not fails on EILSEQ too.

MFC r204928 by ache:

Add SIZE_MAX overflow check
2010-08-17 15:02:33 +00:00
Edwin Groothuis e1e7b64ed0 MFC of 211422, tzdata2010l
- Fix start times of DST for Egypt.
- clocks were set back one hour at 2010-08-11 00:00:00 local time
  in Gaza and the West Bank.

Obtained from:  ftp://elsie.nci.nih.gov/pub/
2010-08-17 12:16:06 +00:00
Bjoern A. Zeeb 40dfe108cb MFC r211301:
In rip6_input(), in case of multicast, we might skip the normal processing
  and go to the next iteration early if multicast filtering would decide that
  this socket shall not receive the data.
  Unlock the pcb in that case or we leak the read lock and next time trying
  to get a write lock, would hang forever.

PR:		kern/149608
Submitted by:	Chris Luke (chrisy flirble.org)
2010-08-17 07:58:10 +00:00
Andrey V. Elsukov 2ceb4b897f MFC r210747:
Forward ioctl requests to original geom.

  PR:		148540
Approved by:	kib (mentor)
2010-08-16 08:51:35 +00:00
Andrey V. Elsukov 5c0b148610 MFC r210746:
Release access for consumers that are opened, but will be destroyed
  indirectly by orphan method.

  PR:		148688

MFC r210792:
  Check that table is not NULL before access, it can be NULL
  for some cases.

Approved by: kib (mentor)
2010-08-16 08:48:39 +00:00
Pyun YongHyeon b7d4557b7b MFC r210271:
Specify BCE_RX_BUF_ALIGN alignment for RX buffers. All bce(4)
  controllers require RX buffers aligned on BCE_RX_BUF_ALIGN bytes.
2010-08-15 23:56:57 +00:00
Pyun YongHyeon af7714cb8a MFC r210263,210267,210269-210270:
r210263:
  Do not report current link state if interface is not UP.

r210267:
  Add KASSERT to check number of returned DMA segments.

r210269:
  Use bus_get_dma_tag() to get parent tag. Also use
  BUS_SPACE_MAXSIZE_32BIT to specify sum of all segment lengths.
  Previously it used MAXBSIZE which was wrong.

r210270:
  Specify BUS_DMA_ZERO flag to bus_dmamem_alloc(9) and remove bzero()
  calls. Also add BUS_DMA_COHERENT flag to bus_dmamem_alloc(9) to
  take advantage of efficient synchronization for architectures that
  support that feature.
2010-08-15 23:47:04 +00:00
Pyun YongHyeon 496ff3cf97 MFC r210257,210259-210261:
r210257:
  When we didn't find a matching flash device, do not touch flash
  config data. While I'm here, use return code of bce_init_nvram()
  to set error instead of directly setting ENODEV.

r210259:
  Have bce_init_ctx() return error code and make caller check the
  return code. If context was not setup correctly give up
  initialization. While I'm here move variable declarations to the
  beginning of the function.

r210260:
  Don't change current media in bce_stop(). There is no need to do
  this here.

r210261:
  Correctly check the result of media selection. Previously it always
  returned success.
2010-08-15 23:38:49 +00:00
Pyun YongHyeon 294bcd8ae4 MFC r207411:
- Enable flow control.
  - Print device details only when verbose boot is enabled.
  - Add debug output for shared memory access.
  - Add debug statistics (checksum offload & VLAN frame counters).
  - Modify TX path to update consumer index for each frame completed
    rather than updating the consumer index only once for a group of
    frames to improve small packet performance.
  - Print driver/firmware pulse messages only when verbose boot
    is enabled.
  - Add debug sysctl to clear statistics.
  - Fix more style(9) violations.
2010-08-15 23:30:53 +00:00
Pyun YongHyeon 42cb739ae0 MFC r207391:
- Pass flow control settings back to bce(4).
2010-08-15 23:26:46 +00:00
Pyun YongHyeon 4612d35948 MFC r210244:
Implement WOL. WOL is supported on RTL8139B or newer controllers.

  PR:	kern/148013
2010-08-15 23:11:38 +00:00
Pyun YongHyeon 07633a56cd MFC r205651:
Use pci_get_max_read_req() and pci_set_max_read_req() to set maximim
  read request size.
2010-08-15 23:02:41 +00:00
Pyun YongHyeon 93933a7b65 MFC r210083,210152:
r210083:
  Remove enabling Data FIFO protection with indirect memory access.
  r165114 added that code and that change ignored the same logic
  committed in r135772. In addition, data FIFO protection should be
  selectively enabled instead of applying to all PCIe devices.
  While I'm here add BCM5785 to devices that do not require this
  fix.

r210152:
  Use Miscellaneous Configuration Register bit definition instead of
  magic number.
2010-08-15 22:57:50 +00:00
Pyun YongHyeon 64f7df68af MFC r210011,210013-210015:
r210011:
  Make bge_stop_fw() static.
  While I'm here use ANSI function definitions.

r210013:
  style.

r210014:
  Fix error message for jumbo buffer allocation failure.

r210015:
  Prefer PCIR_BAR macro over BGE_PCI_BAR0.
2010-08-15 22:51:52 +00:00
Pyun YongHyeon e5e941c12d MFC r209741:
Zero entire status block and add missing bus_dmamap_sync(9).
2010-08-15 22:44:28 +00:00
Pyun YongHyeon fea9cdf33f MFC r209714:
It seems read DMA mode register requires both IPv4 TSO and IPv6 TSO
  configuration to get IPv4 TSO work on BCM57780. While I'm here
  apply the same fix to BCM5785 which shares similar hardware feature
  of BCM57780. This change makes TSO work on BCM57780.

  Tested by:	Tong Liu <nemoliu <> gmail dot com>
2010-08-15 22:40:47 +00:00
Pyun YongHyeon d4a5df938e MFC r208917:
Remove unused macros.
2010-08-15 22:36:12 +00:00
Pyun YongHyeon cb274fa1cd MFC r209818:
Remove enabling RX checksum offloading in RX filter setup. RX
  checksum is enabled in sge_init_locked().
  While I'm here do not set RX checksum bits in RX descriptor
  initialization. It is controller's job to set these bits.

  Tested by:	xclin <xclin <> cs dot nctu dot edu dot tw >
2010-08-15 21:56:45 +00:00
Pyun YongHyeon 25dfdb9684 MFC r209865:
Some revision of Yukon controller generates corrupted frame when TX
  checksum offloading is enabled.  The frame has a valid checksum
  value so payload might be modified during TX checksum calculation.
  Disable TX checksum offloading but give users chance to enable it
  when they know their controller works without problems with TX
  checksum offloading.

  Reported by:	Andrzej Tobola <ato <> iem dot pw dot edu dot pl>
2010-08-15 21:51:10 +00:00
Pyun YongHyeon 2b3e542a81 MFC r211089:
It seems some old Sundace(now IC Plus Corp.) controllers do not
  like memory mapped register access. Typical problem from the issue
  was MII access returned unreliable values. I'm not sure this comes
  from lack of register flushing in MII access after accessing
  STE_PHYCTL register though.
  To address the issue, read hints data that controls which type of
  memory mapping should be used in driver. ste(4) still prefers
  memory mapping to io mapping but honor hints entered by user except
  for controllers that have problems with memory mapping.
  The hint to use iomapping could be given by adding the following
  line to /boot/device.hints file.

  hint.ste.0.prefer_iomap="1"

  PR:	kern/149285
2010-08-15 21:43:51 +00:00
Warner Losh 16edda7a0e Add lame COMPAT_IA32 lines to all the options.* files until I fix config. 2010-08-15 08:38:48 +00:00
Warner Losh dad3adca2a Need to add COMPAT_IA32 to options.i386 too 2010-08-15 08:32:09 +00:00
Andre Oppermann 3364bd3c32 MFC r210666:
Fix a bug in syncache where the initial CWND for new incoming connections
  was limited to one segment under the faulty assumption of a retransmit.
  Due to this the opportunity to initialize the increased congestion window
  according to RFC3390 was missed.
2010-08-14 19:36:48 +00:00
Warner Losh 5bd8556eb4 Map COMPAT_IA32 to COMPAT_FREEBSD32 2010-08-14 18:40:05 +00:00
Konstantin Belousov 421c2bb9be MFC r211006:
Prefer struct sysentvec sv_psstrings to hardcoding FREEBSD32_PS_STRINGS
in the compat32 code. Use sv_usrstack instead of FREEBSD32_USRSTACK as well.
2010-08-14 14:13:58 +00:00
Konstantin Belousov 1da8bc4865 MFC r211005:
Add compat32 definition for (old) struct ostat.
2010-08-14 14:09:13 +00:00
Bjoern A. Zeeb bfd6c44b7f MFC r210686:
MFp4 @181628:

  Free the rtentry after we diconnected it from the FIB and are counting
  it as rttrash.  There might still be a chance we leak it from a different
  code path but there is nothing we can do about this here.
2010-08-14 13:44:24 +00:00
Yaroslav Tykhiy 9cfb908a49 MFC r211001:
Move the sentences telling the defaults for -c and -w
 to where they belong.  Previously they were misplaced,
 i.e., swapped.
2010-08-14 00:50:26 +00:00
Konstantin Belousov 96ed5667d9 MFC r210931:
Disable sync cache for the Transcend Jetflash V90.
2010-08-13 11:24:02 +00:00
Jack F Vogel 37f6093b57 MFC of e1000 changes
Many bug fixes, major new feature: the igb vf driver.
2010-08-12 20:18:06 +00:00
Martin Matuska c3ce30adc8 MFC r211091:
Return EIO if vdev->v_phys_read is NULL.

This fixes booting from a ZFS mirror with a unavailable primary device.

PR:		kern/148655
Reviewed by:	avg
Approved by:	delphij (mentor)
2010-08-12 05:59:55 +00:00
Konstantin Belousov 610f3f05b8 MFC r210848:
Copy inode birthtime to the struct stat32.
2010-08-11 09:04:36 +00:00
Konstantin Belousov 4b43c463b8 MFC r210847:
Fix style.
2010-08-11 08:58:27 +00:00
Bernhard Schmidt 6a701c1678 MFC r210947:
Fix whitespace nits.

PR:		conf/148989
Submitted by:	pluknet <pluknet at gmail.com>
2010-08-11 07:11:20 +00:00
Bernhard Schmidt 1acf561e93 MFC r210959:
Obviously the option is known as COMPAT_LINUX32 on amd64.

PR:		docs/149182
Pointed out by:	Fernando <fernando.apesteguia at gmail.com>
2010-08-11 07:02:08 +00:00
Bernhard Schmidt d24c40ea80 MFC r211063:
License ACK is not required for the wpifw module nor when building
it into the kernel.

PR:		conf/148758
Submitted by:	Joe Talbott <josepht at dragonflybsd.org
2010-08-11 06:29:40 +00:00
Rick Macklem 9961a90493 MFC: r210786
Modify the return value for nfscl_mustflush() from boolean_t,
which I mistakenly thought was correct w.r.t. style(9), back
to int and add the checks for != 0. This is just a stylistic
modification.
2010-08-11 03:08:03 +00:00
Gabor Kovesdan 6b482f0993 MFC r210255:
- Add Latinamerican keymaps to sysinstall's Makefile so that it can
    find them [1]
  - While here, also add a missing Spanish entry

PR:		bin/67365 [1]
Submitted by:	Pedro F. Giffuni <[email protected]> [1]
Approved by:	delphij (mentor)
2010-08-10 19:50:51 +00:00
Andrey V. Elsukov 063d60be66 MFC r210795:
Check that gsp is not NULL before access. It can be NULL
  for some cases.

Approved by:	kib (mentor)
2010-08-10 11:02:55 +00:00
Konstantin Belousov dc7d0eebfd MFC r210805:
Properly set ifi_datalen for compat32 struct if_data32.

PR:	kern/149240
2010-08-10 10:17:01 +00:00
Konstantin Belousov c90461fd6b MFC r210796:
When compat32 recvmsg(2) does not need to copy out control messages, set
msg_controllen to 0.

PR:	kern/149227
2010-08-10 10:15:34 +00:00
Fabien Thomas cf71921a9c MFC r210797:
- Do not use the runtime mask when logfile is specified.
- Revert the fix on rtld path that is not necessary.
2010-08-09 14:32:45 +00:00
Fabien Thomas ffc26382d7 MFC r210794:
Allow file as a top source, it works with socket now.
This will allow top monitoring using socket/ssh tunnelling
of system without local symbols.

client:
pmcstat -R <ip>:<port> -T -r <symbolspath>
monitored device:
pmcstat -Sinstructions -O <ip>:<port>

- Move the file read in the event loop
- Initialize and clean log in all cases
- Preserve global stats value during top refresh
- Fix the rtld/line resolver that ignore '-r' prefix
- Support socket for '-R' (server mode)
- Display the statistics when exiting top mode
2010-08-09 14:29:23 +00:00
Fabien Thomas 9246f5b4ba MFC r210766:
Fix the calltree top view that incorrectly filter out some nodes.
2010-08-09 14:25:58 +00:00
Ulrich Spörlein 40c485fc33 MFC r210930: Typo fixes
PR:		docs/149314
Submitted by:	olgeni

------------------------------------------------------------------------
2010-08-09 07:58:32 +00:00
Hajimu UMEMOTO 53cbc90342 MFC r210861: /etc/rc.d/ip6fw was deprecated. 2010-08-08 15:29:27 +00:00
Jilles Tjoelker aa97ab3372 MFC r210734: Allow starting ipmon if ipnat is enabled but ipfilter is not
(in /etc/rc.conf).

This fixes an apparent confusion between test(1) and sh(1) syntax for
AND/OR.

PR:		conf/149036
Submitted by:	pluknet
2010-08-08 13:43:20 +00:00
Jaakko Heinonen dbed3c4b37 MFC r208717:
Don't try to call cdevsw d_close() method when devfs_close() is called
because of insmntque1() failure.
2010-08-08 12:19:49 +00:00
Jaakko Heinonen 5a2d8c03eb MFC r207878:
- Don't return EAGAIN from gv_unload(). It was used to work around the
  deadlock fixed in r207671.
- Wait for worker process to exit at class unload. The worker process
  was not guaranteed to exit before the linker unloaded the module.
- Use 0 as the worker process exit status instead of ENXIO and style
  the NOTREACHED comment.
2010-08-08 09:12:30 +00:00
Jaakko Heinonen 06888d3a23 MFC r207877:
In g_zero_destroy_geom(), return 0 instead of EBUSY in the success case.
EBUSY was probably used as a workaround for the deadlock fixed in r207671.
2010-08-08 09:06:59 +00:00
Jaakko Heinonen 36092ef507 MFC r208612: Fixes from NetBSD for nvi visual mode
PR:		bin/21089, bin/136393
2010-08-08 07:34:37 +00:00
Gavin Atkinson 9c2dc0340c Merge r210534 from head:
Add support for the Longcheer WM66 USB HSDPA Modem to u3g(4)

PR:		usb/129945
Submitted by:	Antonio Hilario <avahilario gmail.com>
Committed from:	Bugathon #7
2010-08-07 19:08:39 +00:00
Gavin Atkinson 0a63a985d4 Merge r210575 from head:
Provide descriptions for three vendors and four devices in usbdevs.  Use
  the official vendor listed for 0x076b, rather than Omnikey, as in the PR.

PR:		usb/123351
Submitted by:	Marcin Cieslak <saper SYSTEM.PL>
2010-08-07 19:01:59 +00:00
Rebecca Cran b2af858d4b MFC r210175:
FreeBSD 8 doesn't support kernel PPP or SLIP; remove code for configuring
and installing via such devices from sysinstall.

Approved by: rrs (mentor)
2010-08-07 13:42:54 +00:00
Rebecca Cran 2e38937d31 MFC r209748:
Simplify the wording of the console configuration dialogs since we now
only have a single video console driver.

Approved by: rrs (mentor)
2010-08-07 13:39:59 +00:00
Rebecca Cran 35a0db1821 MFC r209709:
Increment 'sa' at the end of the loop; otherwise, only the first
address ever gets checked.

Approved by: rrs (mentor)
2010-08-07 13:36:55 +00:00
Rebecca Cran 2ef6fea8dd MFC r209684:
Use ISO C99 integer types instead of the BSD-specific u_int*_t.

Approved by: rrs (mentor)
2010-08-07 13:34:52 +00:00
Rebecca Cran a7c10f7aa5 MFC r209466:
Add some more modules to loader.conf. Remove if_awi since support for it
was removed 2 years ago.

PR: conf/147126
PR: conf/116071
Approved by: rrs (mentor)
2010-08-07 13:25:46 +00:00
Rebecca Cran 3b65a6ccc1 MFC r209469:
If a device can't be opened, don't keep going but display the error
returned from open() and quit.

PR: bin/81035
Submitted by: Peter Schuller <peter.schuller at infidyne.com>
Approved by: rrs (mentor)
2010-08-07 12:58:01 +00:00
Rebecca Cran 0d3b069a87 MFC r209468:
Make it easier to cancel a failing installation by only attempting to
extract distributions once. If a distribution fails to fetch/extract
and the user doesn't want to retry, abort the installation.

Approved by: rrs (mentor)
2010-08-07 12:51:44 +00:00
Rebecca Cran 89dc1abf71 MFC r209467:
When installing on a machine which doesn't have a VGA card installed, enable
a getty on the serial port so that it's possible to login when the system is
rebooted.

PR: bin/23098
Submitted by: Doug Ambrisko <ambrisko at whistle.com>
Approved by: rrs (mentor)
2010-08-07 12:41:12 +00:00
Rebecca Cran 1913129fad MFC r209764:
Increase the default and minimum partition sizes.
Bump / to 1GB, /var to 4GB and /tmp to 1GB.

A 512MB root partition is now too small to hold two kernels, so to
prevent installkernel failing 1GB is a better default. Likewise,
applications are storing more data in /var so 4GB is more reasonable
on a modern machine.

The previous minimum partition sizes were too small to hold a minimal
installation, and have been adjusted accordingly.

Approved by: rrs (mentor)
2010-08-07 12:18:36 +00:00
Rebecca Cran b9ad50f0c9 MFC r209235, r210381 (bug fix for r209235):
* Allow partial MB/GB values to be entered in the slice and label editors.
* Don't strdup the name when calling deviceRegister because the string is
copied within new_device.
* Use a subtype of 165, not 3, when creating a slice in noninteractive
mode.

PR: bin/135333
PR: bin/66350
Approved by:	rrs (mentor)
2010-08-07 10:51:01 +00:00
Rick Macklem 760a1abbd3 MFC: r210455, r210456
Move sys/nfsclient/nfs_lock.c into sys/nfs and build it as a separate
module that can be used by both the regular and experimental nfs
clients. This fixes the problem reported by jh@ where /dev/nfslock
would be registered twice when both nfs clients were used.
I also defined the size of the lm_fh field to be the correct value,
as it should be the maximum size of an NFSv3 file handle.
Also fix the include path for nfs_lock.h for usr.sbin/rpc.lockd/kern.c.
2010-08-07 01:05:02 +00:00
Maksim Yevmenkin 45b6829345 MFC r210783. Fix typo
PR:		kern/140590
2010-08-06 20:18:27 +00:00
Rebecca Cran 9a954a0f21 MFC r209058:
sctp_recvmsg returns the number of bytes received, not sent.

Approved by: rrs (mentor)
2010-08-06 18:55:49 +00:00
Bjoern A. Zeeb 859c0af964 MFC r210350:
Since r186119 IP6 input counters for octets and packets were not
  working anymore.  In addition more checks and operations were missing.

  In case lla_lookup results in a match, get the ifaddr to update the
  statistics counters, and check that the address is neither tentative,
  duplicate or otherwise invalid before accepting the packet.  If ok,
  record the address information in the mbuf.  [ as is done in case
  lla_lookup does not return a result and we go through the FIB ].

  Reported by:  remko
  Tested by:    remko
2010-08-06 11:58:27 +00:00
Bjoern A. Zeeb 0429cca0cc MFC r210703:
Document the mandatory argument to the arptimer() and
  nd6_llinfo_timer() functions with a KASSERT().
  Note: there is no need to return after panic.

  In the legacy IP case, only assign the arg after the check,
  in the IPv6 case, remove the extra checks for the table and
  interface as they have to be there unless we freed and forgot
  to cancel the timer.  It doesn't matter anyway as we would
  panic on the NULL pointer deref immediately and the bug is
  elsewhere.
  This unifies the code of both address families to some extend.

  Reviewed by:  rwatson
2010-08-06 11:49:52 +00:00
Ulrich Spörlein 5c35201ff3 MFC r210641: Fix a couple of typos.
PR:		docs/148891
Submitted by:	olgeni
2010-08-06 09:08:18 +00:00
Ulrich Spörlein 5953729b99 MFC r210637: Fix typo in pom(6) manpage
PR:		docs/148825
Submitted by:	Anatoly Borodin
2010-08-06 08:59:54 +00:00
Brian Somers 632b88899c MFC r209756:
Log dhclient's reason for exiting and change the 10 second
    ignore-routing-messages dhclient-script timeout to be effective
    from script completion rather than from script start time.

    Ignore RTM_DELADDR and RTM_NEWADDR messages when the message
    contains no interface address (which should not happen) rather than
    exiting.
2010-08-06 08:17:44 +00:00
John Baldwin d4b6c4d58a MFC 210623:
Mark the __curthread() functions as __pure2 and remove the volatile keyword
from the inline assembly.  This allows the compiler to cache invocations of
curthread since it's value does not change within a thread context.
2010-08-05 22:01:14 +00:00
John Baldwin 695e53939b MFC 210577: The corrected error count field is dependent on CMCI, not TES. 2010-08-05 21:01:15 +00:00
John Baldwin 8e2538edca MFC 210505:
- Change the warning about PCI-e links narrower than x8 to only apply to
  10G cards.  1G cards are x4 only.
- Use constants from pcireg.h for reading the current link width.
- Use pci_set_max_read_req() rather than implementing it by hand.
2010-08-05 20:39:52 +00:00
George V. Neville-Neil d33c3c4781 MFC: 210621
Make sure that we clear the correct bits when we turn off
a PMC.  It was possible that we could have turned a bit on but
never cleared it.

Extend the calls to rdmsr() to all necessary functions, not
just those which previously caused a panic.

Pointed out by: jhb@
2010-08-05 20:02:59 +00:00
John Baldwin e15d1e5c4a MFC 210604:
Fix test for double-nul characters that terminate the string table at
the end of each SMBIOS/DMI structure.
2010-08-05 19:43:19 +00:00
John Baldwin 5ac91ec90d MFC 210136:
Retire the NFS access cache timestamp structure.  It was used in VOP_OPEN()
to avoid sending multiple ACCESS/GETATTR RPCs during a single open()
between VOP_LOOKUP() and VOP_OPEN().  Now we always send the RPC in
VOP_LOOKUP() and not VOP_OPEN() in the cases that multiple RPCs could be
sent.

To preserve the ABI I have left the structure in place, but renamed it
to 'n_unused' and just removed the code that updates it.
2010-08-05 19:40:48 +00:00
John Baldwin b8a20c42ff MFC 210135:
Move attribute cache flushes from VOP_OPEN() to VOP_LOOKUP() to provide
more graceful recovery for stale filehandles and eliminate the need for
conditionally clearing the attribute cache in the !NMODIFIED case in
VOP_OPEN().
2010-08-05 19:11:13 +00:00
Edward Tomasz Napierala 2be4c1f070 MFC r209736:
Fix acl_from_text(3) - and, therefore, setfacl(1) - for user and group
names names starting with a digit.
2010-08-05 17:08:23 +00:00
Benedict Reuschling c08287f6c2 MFC r210779:
Fix two (very common) occurrences of s/sytem/system in comments.

Approved by:    mav
MFC after:      3 days
2010-08-05 10:45:27 +00:00
Konstantin Belousov 964decf619 MFC r210369:
When compat32 binary asks for the value of hw.machine_arch, report the
name of 32bit sibling architecture instead of the host one.
2010-08-05 08:57:53 +00:00
Tijl Coosemans 380db92986 MFC r210576:
Add quirk for Apacer HT202 USB 2.0 Flash Drive.

PR:		usb/107243
Approved by:	kib (mentor)
2010-08-04 10:24:37 +00:00
Xin LI 60f22b2145 MFC r210358:
Apply vendor version 1.20.00.17.

This version adds support for ARC1880; additionally this version fixed
an issue where all devices on a SAS port gets offlined when any device
failed on the port [1].

Many thanks to Areca for continuing to support FreeBSD.

PR:		kern/148502 [1]
Submitted by:	Ching-Lung Huang <ching2048 areca com tw>
Obtained from:	Areca
Tested by:	Rich Ercolani <rercola acm jhu edu> [1]
2010-08-04 01:36:48 +00:00
Gavin Atkinson 3eb0fd5c30 Merge r210515,210516,210543 from head:
Prevent ukbd(4) and uhid(4) from attaching when a WiSPY DBx Spectrum
  Analyzer is attached. [1]

  Prevent uhid(4) from attaching to the Gembird Silver Shield remote power
  plug. [2]

  Prevent uhid(4) from attaching to the Liebert PowerSure Personal XT UPS.
  [3]

PR:		usb/134631 [1], usb/132785 [2], usb/129251 [3]
Submitted by:	Jesse Kempf <jkempf davisvision.com> [1]
Submitted by:	Dirk-Willem van Gulik <dirkx webweaving.org> [2]
Submitted by:	Andrew D Wiles <adw+gnats avatastic.co.uk> [3]
2010-08-03 17:47:27 +00:00
Fabien Thomas f506d36142 MFC r209196:
Set the comment at the right place for PMC uncore classes.
2010-08-03 16:35:12 +00:00
Fabien Thomas df1fd2df48 MFC r208861:
Convert pm_runcount to int to correctly check for negative value.
Remove uncessary check for error.

Found with:	Coverity Prevent(tm)
2010-08-03 16:29:54 +00:00
Fabien Thomas 995423d6ee MFC r208860:
Fix memory leak on error.

Found with:	Coverity Prevent(tm)
2010-08-03 16:26:09 +00:00
Fabien Thomas 2136618e25 MFC r208858:
Fix warnings found by Coverity.

Found with:   Coverity Prevent(tm)
2010-08-03 16:21:49 +00:00
George V. Neville-Neil 0576af8f53 MFC: 209512
Make sure that all the exposed counters and variables are actually
being updated.

Pointed out by:	jfv
2010-08-03 15:06:31 +00:00
Rick Macklem 065083006b MFC: r210272
Fix handling of the "-l" argument for nfsdumpstate(8).
2010-08-03 03:19:57 +00:00
Rick Macklem 5887e37663 MFC: r210268
For the experimental NFSv4 server's dumplocks operation, add the
MPSAFE flag to cn_flags so that it doesn't panic. The panics weren't
seen since nfsdumpstate(8) is broken for the "-l" case, so this
was never done. I'll do a separate commit to fix nfsdumpstate(8).
2010-08-02 23:57:50 +00:00
George V. Neville-Neil 7ef6837498 MFC: 210428
Fix a bug in the statistics code for tracking the head and
tail pointers of the tx and rx queues.   We needed a SYSCTL_PROC
to correctly get the values at run time.

Submitted by: Andrew Boyer aboyer at averesystems.com
2010-08-02 19:56:07 +00:00
Benedict Reuschling 06764999f9 MFC r210511:
Use "printf" instead of "echo -n" in an example because it
should be more compatible for most shells that are out there.

I contacted Philip Guenther at OpenBSD about this PR and he
corrected the issue in their tree pretty fast.

PR:                 docs/142243
Submitted by:       Yasir (yasir27 at mail dot ru)
Obtained from:      OpenBSD
Discussed with:     delphij
2010-08-02 15:54:59 +00:00
Ulrich Spörlein 558482eb03 MFC r210662: Fix indention of attribution line for some recent additions. 2010-08-02 11:48:05 +00:00
Ulrich Spörlein dc0a321b61 MFC r209350, r210645: mdoc fixes, HISTORY fixes
- remove stray argument [1]
- remove stray whitespace
- use canonical wording for the HISTORY section
- gsched(8) was first released with FreeBSD 8.1
2010-08-02 10:31:39 +00:00
Jaakko Heinonen 85cf033c8c MFC r204636:
In reallocf(3), free the memory only when size != 0. Otherwise, when the
System V compatibility option (malloc "V" flag) is in effect a zero sized
reallocf() could cause a double free.

PR:		bin/141753
2010-08-02 09:13:09 +00:00
Jaakko Heinonen ffccb45f50 MFC r209614:
- Don't assign the return value from read(2) to a variable of type
  int.
- Use errx(3) instead of err(3) to print the error message on short
  reads in readlabel(). errno won't be set on short reads which can
  easily occur here due to the fixed size read request.

PR:		144307
2010-08-02 09:03:31 +00:00
Xin LI c0a932990b MFC r210661:
Change copyright holder to author.  We prefer using a real legal
entity for copyright holders.

Approved by:	sephe
2010-08-02 08:35:16 +00:00
Rick Macklem 0a7c92543a MFC: r210227
Add a call to nfscl_mustflush() in nfs_close() of the experimental
NFSv4 client, so that attributes are not acquired from the server
when a delegation for the file is held. This can reduce the number
of Getattr Ops significantly.
2010-08-02 00:37:33 +00:00
Rick Macklem 7036bd5caf MFC: r210201
Change the nfscl_mustflush() function in the experimental NFSv4
client to return a boolean_t in order to make it more compatible
with style(9).
2010-08-01 23:58:26 +00:00
Rick Macklem 21e32a08e8 MFC: r210178
Patch the experimental NFSv4 server so that it acquires a reference
count on nfsv4rootfs_lock when dumping state, since these functions
are not called by nfsd threads. Without this reference count, it
is possible for an nfsd thread to acquire an exclusive lock on
nfsv4rootfs_lock while the dump is in progress and then change the
lists, potentially causing a crash.
2010-08-01 23:36:39 +00:00
Rick Macklem b86b6bcfb1 MFC: r210154
Delete comments related to soft clock interrupts that don't apply
to the FreeBSD port of the experimental NFSv4 server.
2010-08-01 15:55:49 +00:00
Rick Macklem ee55955fa4 MFC: r210102
This patch fixes a bug in the experimental NFSv4 server where it
released a reference count on nfsv4rootfs_lock erroneously when
administrative revocation of state was done.
2010-08-01 15:34:29 +00:00
Jilles Tjoelker f3d244d3a1 MFC r210221: sh: Allow a bg command consisting solely of redirections.
Example:
  </dev/null &
2010-08-01 14:14:48 +00:00
Bernhard Schmidt 1856e1a1b5 MFC r206426:
Building wlan_amrr is now mandatory.
2010-08-01 12:05:27 +00:00
Benedict Reuschling 973f8de426 MFC r210482:
Add an example to encourage people to have a look at either
make(1) or /usr/ports/ports-mgmt/portconf for port-specific
variables/options to compile a port.

PR:                 docs/145655
Submitted by:       Armin Pirkovitsch (armin at frozen dash zone dot org)
Discussed with:     dougb
2010-08-01 11:12:42 +00:00
Benedict Reuschling a9c3c4335a MFC r210546:
Typo fix: s/ommited/omitted
2010-08-01 11:09:14 +00:00
Benedict Reuschling a424baf308 MFC r210544:
Small typo fix: s/ommited/omitted

PR:             docs/148977
Submitted by:   Warren Block (wblock at wonkity dot com)
2010-08-01 11:06:13 +00:00
Edwin Groothuis f20663f619 MFC of 210718, tzdata2010k:
- Daylight Saving Time will not be used in Egypt during Ramadan.
- Proper names for Pacific/Pohnpei and Pacific/Chuuk
- Fix historical information for Finland for 1981 and 1982
- No leap-second for December 2010.
- Fix historical information for Ontario (Canada)
2010-08-01 09:08:33 +00:00
Martin Matuska ddaeab674e MFC r210457:
Consider snapshots as descendants via zfs allow -d

OpenSolaris onnv changeset:	9847:2f3ba86e857a

Approved by:	pjd, delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6809340)
2010-08-01 08:47:33 +00:00
Rick Macklem 04ca022867 MFC: r210034
For the experimental NFSv4 client, make sure that attributes that
predate the issue of a delegation are not cached once the delegation
is held. This is necessary, since cached attributes remain valid
while the delegation is held.
2010-08-01 02:11:12 +00:00
Rick Macklem a266de90bf MFC: r210032
For the experimental NFSv4 client, do not use cached attributes
that were invalidated even when a delegation for the file is held.
2010-08-01 01:06:17 +00:00
Rick Macklem 3220aab438 MFC: r210030
Fix a bogus comment that mentions lru lists that don't exist.
2010-07-31 15:36:54 +00:00
Bernhard Schmidt a81a2c1f95 MFC r210289:
Update manpage to reflect changes regarding the 6050's firmware.
2010-07-31 10:24:10 +00:00
Bernhard Schmidt b2aea91bd8 MFC r210114:
Handle RUN->ASSOC->RUN transition correctly, as in not trigger a
firmware error. Convert if statements to a switch statement while
I'm here.
2010-07-31 10:20:09 +00:00
Bernhard Schmidt 593ecfe9e3 MFC r210113:
- Update 6000 firmware to 9.221.4.1
- Add 6050 firmware
2010-07-31 10:18:15 +00:00
Bernhard Schmidt a4ec587dad MFC r210111:
Add support for firmware images in "type-length-value" format.

Obtained from:	OpenBSD
2010-07-31 10:16:41 +00:00
Bernhard Schmidt 827c56f284 MFC r210110:
Detect active chains differently to work around a firmware bug which
would mark non-existing chains as active.

Obtained from:	OpenBSD
2010-07-31 10:15:18 +00:00
Bernhard Schmidt 921b8f64fc MFC r210209:
- Add new IDs for 6000 series devices.
- The 6000 series WiMAX devices need a separate firmware.
- The b-gen devices are not hooked because the hardware revision type
  is not know.

Obtained from:	OpenBSD
2010-07-31 10:12:53 +00:00
Bjoern A. Zeeb 48af88f32a MFC r210532:
Return NULL rather than 0 for a pointer.
2010-07-30 21:58:35 +00:00
Benedict Reuschling ee231049cc MFC r210468:
Apply a small grammar fix to {toupper,tolower}(3).

PR:             docs/140458
Submitted by:   Jeremy Huddleston (Jeremyhu at apple dot com)
2010-07-30 16:27:41 +00:00
Benedict Reuschling d0cc750066 MFC r210463:
Clarify that the "number of bytes per sector"-range in the
-S option is meant to be "inclusive".

The original issue of the PR was already fixed.

PR:                 docs/142418
Submitted by:       David Naylor (naylor dot b dot david at gmail dot com)
No objection from:  kib
2010-07-30 16:23:45 +00:00
Jaakko Heinonen 3e3f0d3754 MFC r207671:
Fix deadlock between GEOM class unloading and withering. Withering can't
proceed while g_unload_class() blocks the event thread. Fix this by not
running g_unload_class() as a GEOM event and dropping the topology lock
when withering needs to proceed.

PR:		kern/139847
2010-07-30 13:23:21 +00:00
Ulrich Spörlein a87f0b311c MFC r208730:
Zero struct before reading from it

PR:		140384
2010-07-30 12:36:40 +00:00
Jaakko Heinonen 3b7f57c13f MFC r204761:
- Use errx(3) instead of err(3) when checking if snprintf(3) succeeded.
  snprintf(3) doesn't set errno in the tested cases.
- If the same argument reference (for example %1) was specified more than
  once, the command didn't necessarily fit to the final command buffer. Fix
  this using a dynamic sbuf buffer. Add a few regression tests for the case.

PR:		bin/95079
2010-07-30 12:04:29 +00:00
Jaakko Heinonen 12daee8608 MFC r208611:
Fix misspelling of "substitution".

PR:		bin/130874
2010-07-30 11:55:52 +00:00
Andrey V. Elsukov 55ae448057 MFC r210408:
Document that SI unit suffixes are supported for -b and -s options
  of add verb. Mention about maximum size limit for "freebsd-boot"
  partition. It should be smaller than 545 KB (hardcoded in pmbr).
  Show usage of SI unit suffixes in example.

Approved by:	mav (mentor)
2010-07-30 07:31:50 +00:00
Andrey V. Elsukov b9a60b0f0c MFC r210401:
Prevent access after free to table entry in case when
  user deletes partition that not yet created (changes doesn't
  committed to disk).

  PR:		148687

Approved by:	mav (mentor)
2010-07-30 07:30:57 +00:00
Jilles Tjoelker d5f1a42d67 MFC r208881: sh: Pass through SIGINT if interactive and job control
is enabled.

This already worked if without job control.

In either case, this depends on it that a process that terminates due to
SIGINT exits on it (so not with status 1, or worse, 0).

Example:
  sleep 5; echo continued
This does not print "continued" any more if sleep is aborted via ctrl+c.
2010-07-29 16:55:27 +00:00
Alexander Leidinger e04363b7c5 MFC r200107,200109-200110,202364,202376,205678,207569:
Merge linux emulation parts for video4linux support (requires
a native v4l device, e.g. something which works with
ports://multimedia/webcamd).
2010-07-29 14:23:58 +00:00
Konstantin Belousov 77419aecc4 MFC r210370:
Verify return value of the sigset manipulation functions to catch
invalid signal numbers.
2010-07-29 09:20:08 +00:00
Attilio Rao e43826e14a MFC r210063, r210065:
Fix the way the segments are included in the gcore outputs (with the
default invokation):
- Right now if segments are not writable are not included. Remove this.
- Right now if a segment is mapped with NOCORE the check is not honoured.
   Change this by checking the newly added flag, from libutil,
   KVME_FLAG_NOCOREDUMP.

Besides that, add a new flag (-f) that forces a 'full' dump of all the
segments excluding just the malformed ones.

Sponsored by:	Sandvine Incorporated
2010-07-28 16:10:21 +00:00
Attilio Rao 520fdad852 MFC r203042, r203735:
Allow -o as a synonym for -s, for compatibility with other systems.

Sponsored by:	Sandvine Incorporated
2010-07-28 15:55:14 +00:00
Andriy Gapon 2761294a18 MFC r199969: add amdsbwd.4
This part of r199969 was left during original MFC, only merge to sys was
done at that time.

Reported by:	hrs
Pointyhat to:	avg
2010-07-28 09:12:20 +00:00
Martin Matuska 189accf9bf MFC r210282:
To improve latency, lower default vfs.zfs.vdev.max_pending from 35 to 10

OpenSolaris onnv changeset (partial):	10801:e0bf032e8673

Approved by:	pjd, delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6891731)
2010-07-27 14:35:17 +00:00
Jung-uk Kim b3382f6a33 MFC: r210383
Fix an obvious typo.  We were acquiring an exclusive writer lock regardless
of the given flags.
2010-07-27 14:32:51 +00:00
Tijl Coosemans dd10fe4813 MFC r210294:
Store fsbase and gsbase in the right fields of the mcontext. They were
switched.

PR:		i386/148344
Approved by:	kib (mentor)
2010-07-27 13:06:18 +00:00
Ollivier Robert 64dc5bff97 MFC r210296:
Week days are all lowercase in French.
cf.  http://www.academie-francaise.fr/langue/questions.html#jourdelasemaine (FR)

PR:           misc/148792
Submitted by: Mathieu <[email protected]>
2010-07-27 09:12:11 +00:00
Konstantin Belousov 8494b5209a MFC r210446:
Reword the comment, fixing typo.
2010-07-27 09:01:03 +00:00
Alexander Motin dfbdca8f19 MFC r210443:
Remove extra commas from KTR_EVENT4() macro to match number of CTR6() args.
Comparing to other macros there should be strings concatenation, not a
separate arguments.
2010-07-27 07:19:17 +00:00
John Baldwin acaaf3fd6d MFC 209948:
A previous change moved the GETATTR RPC for open() calls that hit in the
name cache up into nfs_lookup() instead of nfs_open().  Continue this
trend by flushing the attribute cache for leaf nodes in nfs_lookup() during
an open() if we do a LOOKUP RPC.  For NFSv3 this should generally be a NOP
as the attributes are flushed before fetching the post-op attributes from
the LOOKUP RPC which most (all?) NFSv3 servers provide, so the post-op
attributes should populate the cache.

Now all NFS open() calls will always clear the cached attributes during the
nfs_lookup() prior to nfs_open() in the !NMODIFIED case to provide CTOC.
As a result, we can remove the conditional flushing of the attribute
cache from nfs_open().
2010-07-26 18:54:56 +00:00
John Baldwin 2d9add1199 MFC 209212:
Restore the machine check register banks on resume.  For banks being
monitored via CMCI, reset the interrupt threshold to 1 on resume.
2010-07-26 18:22:46 +00:00
John Baldwin 21cff7b935 MFC 208633 (Missed in earlier CMCI MFC):
Defer initializing machine checks for the boot CPU until the local APIC is
fully configured.
2010-07-26 17:38:56 +00:00
Gavin Atkinson 7872a62766 Merge r209444 (by thompsa) from head:
Add new device ID.

PR:		usb/146907
Submitted by:	<candy-sendpr kgc.co.jp>
2010-07-26 12:47:39 +00:00
Doug Barton 5aba822660 MFC 209531:
Taken from actual police videos ...

MFC 210484:
Correct a Cecil Beaton quote
2010-07-26 01:31:47 +00:00
Gavin Atkinson 374ffbfdd0 Merge r209447 (by thompsa) from head:
Add new device id.

PR:		usb/147190
2010-07-25 21:38:22 +00:00
Gavin Atkinson e9bd68757b Merge r209445 from head (original commit by thompsa):
Add a mass storage quirk.

PR:		usb/147196
2010-07-25 21:32:46 +00:00
Christian Brueffer 2c48ccf103 MFC: r207829
Various wording, spelling and markup fixes.
2010-07-25 20:00:15 +00:00
Rui Paulo 50a934cd82 MFC r209523:
Import the acpi_aibs(4) driver written by Constantine A. Murenin.
 It has more features than acpi_aiboost(4) and it will eventually
 replace acpi_aiboost(4).

Submitted by:	Constantine A. Murenin <cnst at FreeBSD.org>
Reviewed by:	freebsd-acpi, imp
2010-07-25 17:48:16 +00:00
Rui Paulo 3d99ce8ee7 MFC r209016, r209022:
Some odd APs send beacons on the same TX queue as non-beacons. This breaks
 802.11 duplicate detection. Upon looking at the standard, we discover
 that 802.11-2007 says:
 "A receiving QoS STA is also required to keep only the most recent
 cache entry per<Address 2, TID, sequence-number>  triple, storing only
 the most recently received fragment number for that triple. A receiving
 STA may omit tuples obtained from broadcast/multicast or ATIM frames
 from the cache."

 To fix this, we just disable duplicate detection for multicast/broadcast
 frames.

Reviewed by:	sam
Obtained from:	DragonFly
2010-07-25 17:40:48 +00:00
Gavin Atkinson f070471d65 Merge r198005 (originally by markm) from head:
We haven't installed usbdevs for many moons now, and it doesn't work
  any more anyway. Add it to the "obsolete" list.

PR:		usb/146799
Reported by:	Warren Block <wblock wonkity.com>
2010-07-25 15:53:27 +00:00
Rong-En Fan ecd1656528 MFC r210465
- Fix wrong manpage title for keybound.3X

 PR:            docs/148864
 Obtained from: ncurses-5.7-20081213 snapshot
2010-07-25 11:52:09 +00:00
Jaakko Heinonen 7983699947 MFC r202783:
Truncate read request rather than returning EIO if the request is
larger than MAXPHYS + 1. This fixes a problem with cat(1) when it
uses a large I/O buffer.
2010-07-24 18:54:57 +00:00
Hiroki Sato a7f62c0fdf Trim SA list. 2010-07-24 18:05:10 +00:00
Hiroki Sato 07e828ec13 Fix typos. 2010-07-24 17:44:31 +00:00
Benedict Reuschling 49a2851153 MFC r210191:
s/an struct/a struct

PR:             docs/148660
Submitted by:   Warren Block (wblock at wonkity dot com)
Reviewed by:    Tim Kientzle
Mentored by:    jkois
2010-07-24 11:15:40 +00:00
Ken Smith 826878dfac Shift to -STABLE now that 8.1-RELEASE is done. 2010-07-24 01:52:26 +00:00
Hiroki Sato f3b36b9fa4 Add ale(4) to the IFCAP_VLAN_HWTSO-supported device list.
Spotted by:	yongari
2010-07-23 22:49:25 +00:00
Hiroki Sato cf71b66485 Fix a typo.
Spotted by:	np
2010-07-23 22:20:26 +00:00
Hiroki Sato d5701b18f4 Fix a typo. 2010-07-23 22:18:05 +00:00
Hiroki Sato 9988605ef2 Sort entries. Cosmetic changes only. 2010-07-23 22:00:19 +00:00
Hiroki Sato d3e69a91df - Spelling correction.
- Remove 64-bit quota entry; it was not merged[*].

Spotted by:	kib[*]
2010-07-23 21:51:41 +00:00
Hiroki Sato 1969833176 New relnotes item:
SPARC64 V support [sparc64],
        usb(4) attach->notify event change,
        uep(4) added,
        cxgb(4) hardware filtering,
        fxp(4) hardware MAC stats via sysctl,
        ixgbe(4) version 2.2.0,
        msk(4) 88E8059 support, shutdown issue fixed,
        Xen netfront driver improved,
        iflladdr_event for L2 addr change has been added,
        ng_bridge(4) and ng_hub(4) "presistent" flag,
        CAM ATA transport driver supports more SATA feature,
        mvs(4) added,
        siis(4) now enables MSI on SiI3124,
        twa(4) driver updated,
        UFS QUOTA64,
        ZFS improvements,
        camcontrol(8) -d/-f added,
        liblzma and xz(1) added,
        ln(1) bugfixes,
        newfs_msdosfs(8) default volume label changed,
        pam_krb5(8) no_user_check option added,
        pathchk(1) -P for POSIX compatibility,
        stat(1) %Sf added,
        unzip(1) rename query, -Ccfpv options added,
        ISC BIND 9.6.2-P2,
        OpenSSL 0.9.8n, and
        tzdata2010j.
2010-07-23 21:38:26 +00:00
John Baldwin ffbce5627f MFC 209956:
Remove a dead test.  We already exclude NMI traps from this code in an
earlier condition.
2010-07-23 15:32:22 +00:00
John Baldwin 17de8a192f MFC 209946:
- Add missing locking around flushing of an NFS node's attribute cache
  in the NMODIFIED case of nfs_open().
- Cosmetic tweak to simplify an expression in nfs_lookup().
2010-07-23 15:26:19 +00:00
John Baldwin 49af75121f MFC 210068:
- Sort list of trace points.
- Note that 'y' (sysctl requests) is in the default set of trace points.
2010-07-23 15:16:27 +00:00
John Baldwin 2be0ab4da0 MFC 210066:
Rework the SMBIOS table walker to make it operate like other table walkers
and remove a buffer overflow.
2010-07-23 14:30:14 +00:00
Hiroki Sato 929b9b6ea3 New relnotes item:
ddb(4) show ifnets/ifnet/lltables/lltable/llentry,
        ddb(4) show vnet_sysinit/vnet_sysuninit,
        UltraSPARC IV/IV+ support [sparc64],
        if_bridge(4) MTU handling fix,
        bwn(4) added,
        em(4) 7.0.0,
        igb(4) 1.9.3,
        ixgbe(4) 2.1.7,
        msk(4) interrupt moderation,
        mxge(4) 1.4.50 firmware,
        re(4) performance fix,
        run(4) added,
        sge(4) added,
        flowtable IPv6 support,
        LINKSTATE capability flag added to ifnet,
        ipfw(4) improvements: ipfw0, IPv6 support of "me", IPv6 keep-alive fix,
                lookup match option, ip.fw.one_pass fix,
        memory alignment issue in ng_ppp and ng_ksocket fixed,
        tap(4) now supports link state report,
        more drivers to IFCAP_VLAN_HWTSO support list,
        cam(3) ATA transport PUIS support,
        glabel(8) per-FS enable/disable knobs,
        gmultipath(8) destroy, rotate, getactive commands,
        gsched(8) added,
        msdosfs(5) MPSAFE,
        UFS NFSv4 ACL support,
        chgrp(1) and chown(8) -x flag support,
        fnmatch(3) bug fix,
        indent(1) -ta flag support,
        libz optimization on i386/amd64,
        netstat(1) -f netgraph bug fix,
        /tmp/.snap now in $daily_clean_tmps_ignore used in periodic(8) script,
        sed(1) -r flag (equivalent to -E) added,
        db(3) style database of /etc/services added,
        rc.d/ip6fw deprecated and integrated into rc.d/ipfw,
        rc.c/tmp now uses a unique dirname for /tmp/.diskless,
        rc.d/ubthidhci added,
        ACPI-CA 20100304,
        ISC BIND 9.6.2-P1,
        netcat 4.7,
        OpenSSH 5.4p1, and
        tzdata2010i.
2010-07-23 09:01:12 +00:00
Weongyo Jeong be6acfdcef MFC r209892:
Fixes a page fault in bwi_pci_probe() because the array isn't
  terminated with NULL.

  PR:           kern/148473
  Submitted by: Grzegorz Dabrowski <grzegorz.dabrowski at gmail dot com>
2010-07-22 19:22:32 +00:00
Jung-uk Kim 70e79c97a3 MFC: r210248
Fix two long-standing line wrapping bugs in VGA renderer for pixel mode.
Font size may be smaller than 16 and logical scan line may be larger than
the displayed scan line.
2010-07-22 17:02:11 +00:00
Kenneth D. Merry 614d9f5490 MFC 209599, 209960:
r209960 | marius

  - Make the maxsize parameter of the data buffer DMA tag match maxio, which
    was missed in r209599.
    Reported and tested by: Michael Moll
  - Declare mpt_dma_buf_alloc() static just like mpt_dma_buf_free(), both are
    used in mpt.c only.

  Reviewed by:    ken
  MFC after:      r209599

r209599 | ken

  Change the mpt driver to allow larger I/O sizes.

  The mpt driver previously didn't report a 'maxio' size to CAM, and so the
  da(4) driver limited I/O sizes to DFLTPHYS (64K) by default.  The number
  of scatter gather segments allowed, as reported to busdma, was
  (128K / PAGE_SIZE) + 1, or 33 on architectures with 4K pages.

  Change things around so that we wait until we've determined how many
  segments the adapter can support before creating the busdma tag used for
  buffers, so we can potentially support more S/G segments and therefore
  larger I/O sizes.

  Also, fix some things that were broken about the module unload path.  It
  still gets hung up inside CAM, though.

  mpt.c:	Move some busdma initialization calls in here, and call
		them just after we've gotten the IOCFacts, and know how
		many S/G segments this adapter can support.

  mpt.h:	Get rid of MPT_MAXPHYS, it is no longer used.

		Add max_cam_seg_cnt, which is used to report our maximum
		I/O size up to CAM.

  mpt_cam.c:	Use max_cam_seg_cnt to report our maximum I/O size to CAM.

		Fix the locking in mpt_cam_detach().

  mpt_pci.c:	Pull some busdma initialization and teardown out and put
		it in mpt.c.  We now delay it until we know many scatter
		gather segments the adapter can support, and therefore
		how to setup our busdma tags.

  mpt_raid.c:	Make sure we wake up the right wait channel to get the
		raid thread to wake up when we're trying to shut it down.

  Reviewed by:	gibbs, mjacob
  MFC after:	2 weeks
2010-07-22 15:38:36 +00:00
Martin Matuska 3cc494449c MFC r208684:
Allow to use 'jailed' property again.

Reported by:	Eugene Mitrofanov <[email protected]>
Approved by:	delphij (mentor)
2010-07-22 14:52:51 +00:00
Hiroki Sato f72deee1cc New relnotes item:
syscons(4) history handling improved,
        X86BIOS added on i386/amd64,
        loader(8) U-Boot storage support [powerpc],
        smu(4) thermal management and monitoring [powerpc],
        tnt4882(4) now supports TNT5004,
        acpi_video(4) LCD brightness control notify handler support,
        acpi_sony(4) now supports brightness, wired LAN power, bass gain,
        ath(4) supports AR9285,
        bge(4) ASF heartbeat sending fixed,
        vlan(4) IFCAP_VLAN_HWTSO,
        ciss(4) livelock fixed,
        find(1) -newerXB fixed,
        procstat(1) -i/-j added, and
        tzdata2010e.
2010-07-22 05:53:12 +00:00
Ed Maste 93bbe1fe2f MFC r210089:
Add -p option to have pom(6) print just the percentage, without extra
  text.

PR:           bin/51070
Submitted by: Matt Koivisto mkoivisto sandvine com
2010-07-22 01:23:39 +00:00
Hiroki Sato e6cde111b7 Document two possible errata. 2010-07-22 01:14:33 +00:00
Hiroki Sato 11979e1456 New release notes:
ddb(4) show vnetrcrs,
        sched_4bsd race fix,
        pfil(9) virtualization,
        ahci(4) Marvell 88SE912x support,
        ahci(4) FBS support in PM,
        ata(4) PUIS support,
        cam(3) kern.cam.boot_delay, error recovery improvement,
        gmultipath(8) destroy subcommand added,
        isp(4) improved,
        siis(4) Max Read Request Size increased,
        nfsiod(8) race fixed,
        ffs(7) inode number is now unsigned,
        cp(1) -x added,
        fsck_ffs(8) UFS1 last cylinder group issue fixed,
        ifconfig(8) description support added,
        netstat(1) -q option added,
        restore(8) -P shot read issue fixed,
        rtsold(8) -a improved,
        strsignal(3) thread-safe,
        sysctl(8) -i added,
        rc.d/rtsold added,
        firewall_coscripts in rc.conf added, and
        ISC BIND 9.6.1-P3.
2010-07-22 01:01:16 +00:00
Hiroki Sato 88cde98bca Fix missing words.
Spotted by:	pluknet at gmail.com
2010-07-21 20:38:45 +00:00
Hiroki Sato 06e9f6d825 New relnotes item:
DEADLKRES added,
        tty TIOCSTI fix,
        sched_4bsd timestamp fix,
        vimage source address selection knob added,
        EFI loader -dev currdev command-line option [ia64],
        epic(4) [sparc64],
        Fire JBus to PCIe bridge [sparc64],
        agp(4) improved,
        snd_hda(4) AD1981HD support,
        snd_hda(4) multichannel playback support,
        iwn(4) updated,
        u3g(4) improved,
        uhso(4) and uhsoctl(1) added,
        pf(4) "sloppy" merged,
        ada(4) BIO_DELETE support,
        gstripe(8) default blocksize increased to 64k,
        NFS negnametimeo option added,
        ZFS NFSv4 ACL support,
        camcontrol identify -v added,
        NFSv4 ACL support: cp(1), find(1), getfacl(1), mv(1), setfacl(1),
        fetch(1) HTTP digest authentication support,
        netstat(1) ARP statistics added,
        newsyslog(8) PID handling changed and -P flag added,
        scandir(3) and alphasort(3) improved for POSIX.1-2008,
        obsolete POSIX.1-2008 XSI functions sighold(), sigignore(),
                sigpause(), sigrelse(), sigset() added for easy porting,
        traceroute(8) now works in a VIMAGE jail,
        usbconfig(8) -d to specify a ugen(4) device to be used,
        usbconfig(8) add_quirk/remove_quirk subcommand added,
        whois(1) -d removed and IPv6 handling added,
        ACPI-CA updated to 20100121,
        netcat updated to OpenBSD 4.6,
        sendmail updated to 8.14.4, and
        tzdata2010b.
2010-07-21 20:32:22 +00:00
Hiroki Sato 20aa27686a New relnotes items:
devfs(5) default rule change for ptys,
        pselect(3) -> pselect(2),
        INCLUDE_CONFIG_FILE enabled by default,
        boot2 reimplemented for pc98,
        amdsbwd(4) added,
        ipmi(4) timer setting bug fixed,
        uftdi(4) zero length packet bug fixed,
        bge(4) TSO on BCM5755 supported,
        bge(4)/bce(4) DMA handling bug fixed,
        et(4) MSI and TX checksum offloading of IPv4/TCP/UDP added,
        mxge(4) updated to 1.4.48b,
        ste(4) improved,
        vge(4) improved,
        ipfw(4) IPv6 support of keep-alive rule fixed,
        proxy arp over P2P link fixed,
        vlan(4) now in GENERIC,
        vlan(4) now handles parent IF renaming,
        fdc(4) kmod unload issue fixed,
        geom provider now reports optimal block size to the upper layer,
        graid3(8) panic fixed,
        vfs.vlru_allow_cache_src added,
        zfs(8) bugs fixed,
        diskinfo(8) stripe size and offset reporting,
        gcore(1) improved,
        pwait(1) added,
        MADV_PROTECT for sshd, cron, inetd, syslogd,
        zfs(8) receive -u added,
        service(8) added,
        rc.conf(5) now supports vlans_IF for vlan(4) configuration,
        awk 26 November 2009 release,
        tzdata2009u, and
        filename of release ISO image changed.

An entry for IPV6_V6ONLY sockopt in Liunx is removed because
this was not a visible change.
2010-07-21 18:27:32 +00:00
Benedict Reuschling 5501f7c9a9 MFC r210061:
Update some release version numbers. The patch is based on the one
from the PR, but the version numbers reflect the newer ones from
http://security.freebsd.org/#sup

PR:             docs/145227
Submitted by:   Glen Barber (glen dot j dot barber at gmail dot com)
Reviewed by:    cperciva
Mentored by:    jkois
2010-07-21 17:16:12 +00:00
Benedict Reuschling 905afdc961 MFC r209772:
Fix an error in the EXAMPLES section of getopt(1), which is based on
the same fix present in NetBSD.

Note: the getopt man page contains more antique information like this.
An overhaul of the man page and/or sync with NetBSD would be the right
thing to do. But since this is out of the scope of the PR, I'll leave
it as it is for now.

PR:             docs/133118
Submitted by:   Oleg A. Mamontov (oleg at mamontov dot net)
Discussed with: jilles@
2010-07-21 17:11:26 +00:00
Hiroki Sato 6710380459 Fix missing words.
Spotted by:	mav
2010-07-21 11:01:40 +00:00
Hiroki Sato f16b5cfb3e IPV6_V6ONLY is unconditionally reset for Linux IPv6 sockets in Linux
emulation environment.

Spotted by:	ume
2010-07-21 10:57:55 +00:00
Hiroki Sato 215f67dd31 Add relnotes item for 8.1R (first round):
ddb(4) show mount improved,
        fcntl(2) F_READAHEAD and F_RDAHEAD added,
        lindev(4) added,
        more dtrace probes,
        SMP support in PowerPC G5,
        ULE %CPU fix,
        VIMAGE + SCTP build fix,
        vfs.root.mountfrom space-separated list support added,
        loader(8) memory range selection improved,
        zfsloader added,
        zfsboot and gptboot added,
        adb(4) supports taps on ADB touchpad,
        apt(4) added,
        uart(4) NetMos NM9865 support added,
        bge(4) 5761, 5784, 57780 support added,
        cxgb(4) updated to T3 firmware 7.8.0,
        msk(4) 88E8042, 88E8057 and DGE-560SX support added,
        re(4) unnecessary reinitialization eliminated,
        tsec(4) now supports ALTQ,
        urtw(4) now supports RTL8187B,
        net.inet.ipcomp.ipcomp_enable=1 by default,
        IPV6_V6ONLY by default for IPv6 sockets in Linux emulation,
        gmirror(8) priority change support,
        gmirror(8) "load" balancing algorithm improved and now used as default,
        "option ATA_CAM" added,
        ata(4) fix for interrupt storms/command timeouts added,
        ata(4) umass support removed,
        ahd(4) error counter improved,
        cam(3) SATA/PATA support improved,
        bsnmpd(1) high CPU load issue fixed,
        bzip2(1) multi-session bzip2 file handling fixed,
        ee(1) crach fixed,
        factor(6) performance issue fixed,
        fetch(1) NO_PROXY handling fixed,
        ifconfig(8) now supports NDP flag handling,
        ntpd(8) no longer attempts to bind IPv6 anycast addresses,
        unifdef(1) updated to 1.188,
        ENOTCAPABLE new errno,
        rc.d/static_arp added, and
        ISC BIND 9.6.1-P2.
2010-07-21 10:36:27 +00:00
Andrey V. Elsukov dfa0209a59 MFC r209388:
Remove G_TYPE_ASCLBA type and replace it with G_TYPE_STRING in gpart.
  Move code that converts params from humanized numbers to sectors count
  to subr.c and adjust comment.
  Add post-processing for "size" and "start offset" params in gpart,
  now they are properly converted to sectors count with known sector size
  that can be greater that 512 bytes.
  Also replace "unsigned long long" type to "off_t" for unify code since
  it used for medium size in libgeom(3) and DIOCGMEDIASIZE ioctl.

  PR:		bin/146277

MFC r209392:
  Check for overflow before it occurs. Also add check for
  negative numbers.

  Suggested by:	ache

Approved by:	mav (mentor)
2010-07-21 08:48:45 +00:00
Jung-uk Kim e922d3d00f MFC: r209189
Fix typos that broke duration calculations on protection frames.
2010-07-20 20:27:34 +00:00
Jung-uk Kim bf086aa2a8 MFC: r209957, r210003, r210005
- Move i386-inherited logic of building ACPI headers for acpi_wakeup.c into
better places and remove intermediate makefile and shell scripts.  This
makes parallel kernel build little bit safer for amd64.
- Make SMP code path in acpi.c conditional at run-time.
- Define SMP unconditionally for amd64 and remove opt_global.h from SRCS in
sys/modules/acpi/acpi/Makefile.  Note it is done just for correctness sake
because we do not build, ship, or support acpi.ko on amd64.
2010-07-20 20:15:32 +00:00
Jung-uk Kim 967c5b34b3 MFC: r209965, r209966, r210129, r210137, r210155, r210157
- According to ACPICA User Guide and Programmer Reference, the read data
must be zero extended to fill the 32-bit or 64-bit return value even if
the bit width of the port or location is less than 32 or 64.
- Use pmap_mapdev()/pmap_unmapdev() to map device memory instead of using
AcpiOsMapMemory()/AcpiOsUnmapMemory() (-> pmap_mapbios()/pmap_unmapbios())
for AcpiOsReadMemory() and AcpiOsWriteMemory().  Although they do not sound
too obvious, these functions are exclusively used to access memory mapped
IO in ACPICA.
- Remove 64-bit access from AcpiOsReadMemory() and AcpiOsWriteMemory().
These functions do not support 64-bit access.  Likewise, return error when
64-bit access is requested for PCI configuration space.
- Simplify AcpiOsReadPort() and AcpiOsWritePort() with iodev_read_*() and
iodev_write_*().  This removes unnecessary uses of temporary macros as well.
There is no functional change after this (verified with md5(1) on amd64).
2010-07-20 19:38:38 +00:00
Jung-uk Kim e345559071 MFC: r209837, r209842, r209949
Sync. printf() of libstand(3) with sys/kern/subr_prf.c.

CVS r1.94	jhb:
Cast the integer read as the first argument for %b to an unsigned integer
so it's value is not sign extended when assigned to the uintmax_t variable
used internally by printf.  For example, if bit 31 is set in the cpuid
feature word, then %b would print out the initial value as a 16 character
hexadecimal value.  Now it only prints out an 8 character value.

CVS r1.109	njl:
Add support for 'h' and 'hh' modifiers for printf(9).

CVS r1.117	phk:
If we ignore an unknown % sequence, we must stop interpreting the remaining
% arguments because the varargs are now out of sync and there is a risk that
we might for instance dereference an integer in a %s argument.

SVN r209836	jkim:
Implement optional 'precision' for numbers.  Previously, it was parsed but
ignored.  Some third-party modules (e.g., ACPICA) prefer this format over
zero padding flag '0'.
2010-07-20 18:59:10 +00:00
Jung-uk Kim 44a9ec3a08 MFC: r209836, r209949
Implement optional 'precision' for numbers.  Previously, it was parsed but
ignored.  Some third-party modules (e.g., ACPICA) prefer this format over
zero padding flag '0'.
2010-07-20 18:55:13 +00:00
Jung-uk Kim 3d92e76fef MFC: r209737, r209740
Fix a possible null pointer dereference and plug a possible memory leak.
2010-07-20 18:43:15 +00:00
Jung-uk Kim 529db2d244 MFC: r208411, r208412, r208413, r208564, r208567, r210149
- Suspend screen updates when the video controller is powered down.
- Let the first device suspend and the last device resume syscons(4).
- Do not attempt to switch to the same VTs between suspend and resume.
- When we are not switching VTs, just mark all buffer to be updated.
- Fix some style(9) nits.
2010-07-20 18:28:34 +00:00
George V. Neville-Neil ce92b4966e MFC r210012:
Fix a panic brought about by writing an MSR without a proper mask.
All of the necessary wrmsr calls are now preceded by a rdmsr
and we leave the reserved bits alone.
Document the bits in the relevant registers for future reference.

Tested by: mdf
2010-07-20 17:57:10 +00:00
Benedict Reuschling b4b5756eef MFC r209738:
Mention the radiolist option in the man page. It is being listed when
dialog(1) is run without arguments and works as expected. Therefore,
it should be part of the manual as well.

Note: dialog(1) has not been updated for many years and is not actively
maintained at the moment.

PR:             docs/139682
Submitted by:   manolis@
Discussed with: jkim@
2010-07-20 15:34:27 +00:00
Bernhard Schmidt a38f900019 MFC r203691:
- Update documentation for the iwn and iwnfw drivers: they support the
  1000, 5150, 6000 and 6050 devices too, with firmware modules for the
- 4965, 1000, 5000, 5150 and 6000.
- Add documentation for mwl and all the wireless firmware drivers.
2010-07-20 11:08:56 +00:00
Alexander Motin f07e412e20 MFC r210168:
Make legacy ATA emulation detection more strict. This should fix false
positive legacy detection and attach failure/panic for Marvell 88SX6141
controller and potentially some others.

PR:             kern/145064
2010-07-20 05:16:10 +00:00
Alexander Motin dfba4d7132 MFC r210165:
Improve interrupt setup errors handling.
2010-07-20 05:14:30 +00:00
Lawrence Stewart 97b9f117c8 MFC r209978,209981,209987,210184:
- Rename DPCPU_SUM to DPCPU_VARSUM to better reflect the fact it operates on
  member variables of a DPCPU struct (r209978).

- Add DPCPU_SUM which sums a DPCPU variable (r209978,209987,210184).

- Macro to simplify zeroing DPCPU variables (r209981,209987).

Sponsored by:	FreeBSD Foundation
2010-07-20 00:46:18 +00:00
Benedict Reuschling 2debd3dfb3 MFC r209954:
Fix spelling of "weirdo" in /etc/gettytab comment.

PR:             docs/148500
Submitted by:   Warren Block (wblock at wonkity dot com)
Approved by:    ed@
2010-07-19 19:54:37 +00:00
Jamie Gritton b99e0e31af MFC r210134:
Don't copy and return a potentially unset buffer when jail_get fails.
2010-07-19 19:52:02 +00:00
Jamie Gritton bc446bfcb6 MFC r210133:
Don't import parameter values in jail_getv, except for the search key.
  Remove the internal jailparam_vlist, in favor of using variants of its
   logic separately in jail_setv and jail_getv.
  Free the temporary parameter list and exported values in jail_setv
   and jail_getv.

Noted by:	Stanislav Uzunchev
2010-07-19 19:51:17 +00:00
Hiroki Sato 06dadbebac - Clean up old contents and bump version numbers.
- Add items for security advisories.
2010-07-19 15:26:42 +00:00
Konstantin Belousov 2e0a46a137 MFC r209197:
Add assert to check that the (current) thread is in critical section.

MFC r209204:
Rename CRITSECT_ASSERT to CRITICAL_ASSERT
2010-07-19 12:52:19 +00:00
Konstantin Belousov 9ea6d27829 MFC r209932:
For xsi_sigpause(3), remove the supplied signal from the process mask
during sigpause(2) call. It was backward.
Check that the signal number is valid.
2010-07-19 12:41:05 +00:00
Konstantin Belousov 7be00d5807 MFC r209933:
Use _SIG_VALID instead of expanded form of the macro.
2010-07-19 12:37:28 +00:00
Konstantin Belousov 9b53c95553 MFC r209934:
Use _SIG_VALID().
2010-07-19 12:32:24 +00:00
Konstantin Belousov 10e48c46f4 MFC r209955:
When switching the thread from the processor, store %dr7 content
into the pcb before disabling watchpoints. Otherwise, when the
thread is restored on a processor, watchpoints are still disabled.
2010-07-19 12:16:41 +00:00
Ruslan Ermilov abb8bfb0eb MFC r210046: Fixed cache size decoding read from a label.
PR:	  kern/144732
2010-07-19 10:55:44 +00:00
Benedict Reuschling 398ef24048 MFC r209703:
Let boot(8) refer to the uart(4) serial driver, which is the replacement
for the obsolete sio(4) driver.

PR:             docs/144498
Submitted by:   Bruce Cran (bruce at cran dot org dot uk)
Approved by:    marcel
2010-07-18 10:56:20 +00:00
Martin Matuska 0eb7d4802b MFC r209275:
Import latest ARC change from OpenSolaris:
- large ghost eviction causes high write latency
- arc_adjust might adjust MRU unnecessarily
- arc_adapt can lead to wild arc_p adjustment

OpenSolaris onnv-revision:	12636:13b5d698941e

Submitted by:	avg
Approved by:	pjd, delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6950219, 6953403, 6951024)
2010-07-18 07:59:55 +00:00
Alexander Motin b1b5ad75c9 MFC r209664:
Add ata(4) ability to limit initial ATA mode for devices via device hints.
After boot this mode can be changed with atacontrol/camcontrol as usual.
It works for both legacy and ATA_CAM wrapper mode.
2010-07-18 07:42:54 +00:00
Alexander Motin bcf374ac74 MFC r209744:
ATA device reset starts probe sequence from the beginning. If reset caused
by timeout/error of one of probe commands, process may continue infinitely.
Make CAM ATA more robust to faulty devices and false positive detections,
abort probe after two restarts on timeouts or ten on other errors.
2010-07-18 07:34:20 +00:00
Alexander Motin 62cb8bdb87 MFC r208823:
Add allocation error handling.
2010-07-18 07:31:25 +00:00
Alexander Motin 7e41be3325 MFC r208819:
Fix double free on error.
2010-07-18 07:29:37 +00:00
Alexander Motin a941bbe1ef MFC r209883, r209944:
Make interrupt handler check that CAM bus initialization completed before
touching it. It fixes possible panic during controller attach in ATA_CAM
mode.

While there, slightly improve attach errors handling.
2010-07-18 07:23:00 +00:00
Bernhard Schmidt b11de3966e MFC r210107,r210108:
- Remove duplicate vendor:device entry.
- Fix some small whitespace nits.
2010-07-18 07:19:23 +00:00
Alexander Motin 7694413903 MFC r209977:
Disable multi-sector PIO transfers if ATA_SET_MULTI command failed.
2010-07-18 07:15:37 +00:00
Alexander Motin 0a1d6edf71 MFC r209884:
If ata_sata_phy_reset() failed and ata_generic_reset() is not called, mark
channel as having no devices connected. This improves hot-unplug operation
on legacy-emulating SATA controllers.
2010-07-18 07:13:55 +00:00
Alexander Motin 9ea3e3f10e MFC r209872:
Make hw.ata.ata_dma_check_80pin tunable affect not only device side, but
also controller side cable checks. Make respective sysctl writable.

PR:             kern/143462
2010-07-18 07:11:03 +00:00
Marius Strobl 84e076f6ae MFC: r209961
Correct inverted parent DMA tag parameters.

Reviewed by:	ken
2010-07-17 15:47:23 +00:00
Giorgos Keramidas ed7f1fac38 MFC r209871 from /head
Fix reading of empty fifolog files.  When we don't have anything
  to inflate, skip the rest of the fifolog reader code to avoid
  hitting the assert about Z_OK a bit further down.
2010-07-17 07:56:01 +00:00
Ken Smith 63f1b93f2d Predict the date we'll be ready to announce 8.1-RELEASE. While here
add the entry for 8.0-RELEASE which was added to releng/8.0/UPDATING
during the 8.0-RELEASE cycle but not to stable/8/UPDATING at that time.
2010-07-17 04:35:02 +00:00
Ivan Voras d665e8e9db MFC r208982,r208983,r210117 : cosmetic changes to kern.sched.topology_spec XML 2010-07-16 14:31:24 +00:00
Alexander Motin 3f54a24482 MFC r209664:
Add ata(4) ability to limit initial ATA mode for devices via device hints.
After boot this mode can be changed with atacontrol/camcontrol as usual.
It works for both legacy and ATA_CAM wrapper mode.

PR:             kern/123980
2010-07-16 09:12:47 +00:00
Alexander Motin 943c4cc3cb MFC r208822:
Fix possible use after free.
2010-07-16 09:10:11 +00:00
Alexander Motin 5c7ff2f2ec MFC r208820:
Fix use after free on error.
2010-07-16 09:08:16 +00:00
Warner Losh 103bf0784f MFC: r209969
r209969 | nwhitehorn | 2010-07-12 22:08:08 -0600 (Mon, 12 Jul 2010) | 13 lines

Enhance config to handle MACHINEs with multiple architectures:

- Passing -m to config will now print the MACHINE and MACHINE_ARCH
  given in the passed kernel configuration file and then exit.
- If an option is defined in options.MACHINE with the same name as the
  architecture of the kernel being configured, that option will be
  considered set. This allows conditional compilation based on CPU
  architecture.

Config version is now 600010.

Reviewed by:    imp
2010-07-15 22:35:50 +00:00
Warner Losh ad571e322b MFC: r209135
r209135 | imp | 2010-06-13 10:54:11 -0600 (Sun, 13 Jun 2010) | 9 lines

style(9) fixes:

o make cmd scoped to the whole do_rules function, since it really is
  scoped to the whole fucnion.  Making it static was the wrong way to
  fix referencing it outside of the block in which it was declared
  (and conforms to the style of the rest of the file).
o remove a couple of meaningless blank lines
o properly wrap one line.
2010-07-15 22:34:30 +00:00
John Baldwin 7bbf670adc MFC part of 209483:
Clear DF bit in cmcint interrupt handler.

Submitted by:	kib
2010-07-15 12:17:17 +00:00
Brian Somers a58f416972 MFC r209924; Add -l to the synopsis
Submitted by:	jhell at dataix dot net
2010-07-15 07:14:57 +00:00
John Baldwin 0def5d1952 MFC 209595:
Send SIGPIPE to the thread that issued the offending system call
rather than to the entire process.
2010-07-14 21:52:02 +00:00
John Baldwin d8397b1fa1 Partially MFC 209592:
Add a tdksignal() routine that mirrors pksignal() except that it accepts a
thread instead of a process.  As an extension, if a NULL ksiginfo_t is
passed in, setup a ksiginfo_t on the stack similar to psignal().  This
provides semantics matching the new tdsignal() function in 9 while
preserving the existing ABI.
2010-07-14 21:48:16 +00:00
John Baldwin f2d982501b MFC 208507,208556,208621:
Add support for corrected machine check interrupts.  CMCI is a new local
APIC interrupt that fires when a threshold of corrected machine check
events is reached.  CMCI also includes a count of events when reporting
corrected errors in the bank's status register.  Note that individual
banks may or may not support CMCI.  If they do, each bank includes its own
threshold register that determines when the interrupt fires.  Currently
the code uses a very simple strategy where it doubles the threshold on
each interrupt until it succeeds in throttling the interrupt to occur
only once a minute (this interval can be tuned via sysctl).  The threshold
is also adjusted on each hourly poll which will lower the threshold once
events stop occurring.
2010-07-14 21:10:14 +00:00
John Baldwin 084f27b290 MFC 208787:
Assert that the thread lock is held in sched_pctcpu() instead of
recursively acquiring it.  All of the current callers already hold the
lock.
2010-07-14 19:00:44 +00:00
John Baldwin f9baddadb1 MFC 209588:
- The ETIMEDOUT error applies to pthread_timedjoin_np(), not pthread_join().
- Tweak wording in history section for pthread_timedjoin_np().
2010-07-14 18:55:34 +00:00
Ed Schouten 860470f608 MFC r209718:
Fix a race condition, where a TTY could be destroyed twice.

  There are special cases where tty_rel_free() can be called twice in a
  row, namely when closing and revoking the TTY at the same moment. Only
  call destroy_dev_sched_cb() once.

Reported by:  Jeremie Le Hen
2010-07-13 11:04:46 +00:00
Konstantin Belousov a013809324 MFC r209743:
Calculate nshift only once.
2010-07-13 08:45:50 +00:00
Konstantin Belousov 4f907b9810 MFC r209742:
In revoke(), verify that VCHR vnode indeed belongs to devfs.
2010-07-13 08:43:28 +00:00
Maxim Konovalov d943e1d95f MFC r209715: addr2ascii(3) was removed ages ago. Fix the comment. 2010-07-13 05:12:14 +00:00
Colin Percival f4e625c6f0 Correctly copy the M_RDONLY flag when duplicating a reference
to an mbuf external buffer.

Approved by:	so (cperciva)
Approved by:	re (kensmith)
Security:	FreeBSD-SA-10:07.mbuf
2010-07-13 02:45:17 +00:00
Remko Lodder 5db6d33dd8 MFC r202917
Add support for the NM10 chipset.

 PR:		kern/143118
 Submitted by:	Koshin sumitani <ksumitani at mui dot biglobe dot ne dot jp>
 Approved by:	imp (mentor, implicit)
 MFC after:	3 days
2010-07-12 17:46:19 +00:00
Nathan Whitehorn 611aac4328 MFC r209853:
The number after 2 is 3, not 4.
2010-07-12 14:24:20 +00:00
Attilio Rao 6c1a6469e5 MFC r209577, r209761:
- Fix a lock leak in case the ticks wrapped up
- Simplify the logic for handling ticks wrap-ups
- Fix a bug where a thread may be in sleepign state but not on a
  sleepqueue chain still.

Sponsored by:	Sandvine Incorporated
2010-07-12 10:11:10 +00:00
Brian Somers 7426bbafaf MFC r209364: Fix some (not all) style(9) and casting errors.
PR:		209364
Submitted by:	giffunip at tutopia dot com
Obtained from:	NetBSD
2010-07-11 22:00:40 +00:00
Brian Somers 637d6ef65d MFC r209363: Recognise the -l switch in pkill.
PR:		143558
Submitted by:	eitanadlerlist at gmail dot com
2010-07-11 21:50:05 +00:00
Brian Somers 37cbe0f6c9 MFC r209362: Add a -t switch for masking output based on size.
PR:		144192
Submitted by:	gk
2010-07-11 21:47:38 +00:00
Jamie Gritton e1cd981797 MFC r209820:
Properly recognize a number followed by non-digits as a jail name.
  Call "0" a name because zero is used to indicate no specified jid.
2010-07-11 15:32:20 +00:00
Alexander Motin ac77d52e74 MFC r209214:
When Emulate3Button is active, do not set select() timeout in states when
it is not needed. No need to kick CPU every 20ms without a purpose.
2010-07-11 12:06:42 +00:00
Alexander Motin 4c220d36b2 MFC r209328,r209330:
While we indeed can't precisely measure time spent in C1, we can consider
measured interval as upper bound. It should be more precise then just
assuming 1/(2*hz). For idle CPU it should be quite precise, for busy - not
worse then before.
2010-07-11 11:58:46 +00:00
Konstantin Belousov 91ea248357 MFC r209685:
Introduce a helper function vm_page_find_least(). Use it in several places,
which inline the function.
2010-07-11 09:37:34 +00:00
Konstantin Belousov 1044f7616a MFC r209793:
Do not mention VM_ALLOC_RETRY in comment, and normalize the terminology
(blocking -> sleeping).
2010-07-11 08:43:30 +00:00
Konstantin Belousov a745b760ab MFC r209687:
Constify source argument for siginfo_to_siginfo32().
2010-07-11 08:41:30 +00:00
Martin Matuska 4e063c6cb3 MFC r209757:
- Add support for the "sec" option to "zfs set sharenfs"

Submitted by:	Dmitry Morozovsky <[email protected]>
Approved by:	delphij (mentor)
2010-07-10 09:29:48 +00:00
Xin LI 5aaa7615b5 MFC r209860:
Don't use pack() for structures that is used purely for software state.
Otherwise the resulting, unaligned mutex structure would trigger panic.

Submitted by:		Tom Cough <tom.couch lsi.com>
Reported/Tested by:	jhb
2010-07-09 20:44:14 +00:00
Andrey V. Elsukov 97846bc4a7 MFC r208946:
New netgraph node ng_patch(4). It performs data modification of packets
  passing through. Modifications are restricted to a subset of C language
  operations on unsigned integers of 8, 16, 32 or 64 bit size.
  These are: set to new value (=), addition (+=), subtraction (-=),
  multiplication (*=), division (/=), negation (= -), bitwise AND (&=),
  bitwise OR (|=), bitwise eXclusive OR (^=), shift left (<<=),
  shift right (>>=). Several operations are all applied to a packet
  sequentially in order they were specified by user.

  Submitted by:	Maxim Ignatenko <gelraen.ua at gmail.com>
  		Vadim Goncharov <vadimnuclight at tpu.ru>
  Discussed with:	net@

MFC r208947:
  Fix typo.

MFC r208989:
  Style(9) fixes:
  * Sort includes
  * Replace #define<SPACE> to #define<TAB>
  * Split declarations and initializations
  * Split long lines

  Requested by:	kib

MFC r209194:
  * Include sys/systm.h for KASSERT()
  * Remove unneeded includes and comment
  * Replace home made OFFSETOF() macro with standard offsetof()

  Pointed out by:	bde

Approved by:	kib (mentor)
2010-07-09 08:48:51 +00:00
Attilio Rao fdca090366 MFC r208587:
Add the support for reporting the NOCOREDUMP flag from
sysctl_kern_proc_vmmap().

Sponsored by: Sandvine Incorporated
2010-07-08 23:25:33 +00:00
John Baldwin 3a54a9b0f1 MFC 208742:
MFamd64: Add a new macro PCPU_XEN_FIELDS to hold XEN-specific per-CPU
fields that is always included in PCPU_MD_FIELDS.  The macro is empty for
non-XEN kernels.  This avoids duplicating non-XEN per-CPU fields in two
places.  While here, remove several unused fields from the XEN-specific
structure.
2010-07-08 21:56:05 +00:00
Andriy Gapon 572c0b5b31 MFC r209413: readelf.1: remove duplicate -u/--unwind option description 2010-07-08 21:34:18 +00:00
Andriy Gapon 0a09207d48 MFC r209247: lock_profile_release_lock: do not compare unsigned with zero
Note: no MFC to stable/7
2010-07-08 21:02:31 +00:00
Andriy Gapon 9993580cd2 MFC r209228: device.hints: do install when WITHOUT_BOOT is set 2010-07-08 20:57:07 +00:00
Andriy Gapon 0d256dda6d MFC r209193: sound/pcm: use non-const string with SYSCTL_STRING 2010-07-08 20:46:55 +00:00
Andriy Gapon 39ec215e38 MFC r209425: udf_vnops: cosmetic followup to r208671 2010-07-08 20:40:57 +00:00
Andriy Gapon ba87e6b3b9 MFC r209062: fix a few cases where a string is passed via format
argument instead of via %s

Note:	no MFC to stable/7
2010-07-08 20:38:48 +00:00
Andriy Gapon d0e5b4c6bd MFC r209056: vnode.h: expand debug macros to non-empty void statements
when DEBUG_VFS_LOCKS is disabled
2010-07-08 20:17:56 +00:00
Weongyo Jeong 147d3a709b MFC r209598:
Initializes the ratectl for a node when the state is changed to RUN.
  This prevents a kernel fault by dividing with zero because the initial
  rate was 0 and didn't be initialized.

  Tested by:    Warren Block <wblock at wonkity.com>
2010-07-08 19:40:09 +00:00
Weongyo Jeong 6b7456acb7 MFC r209597:
Fixes NULL pointer reference that it's occurred when the state is
  changed to RUN because ic->ic_newassoc isn't set anywhere now.  In the
  previous bwi_newassoc() is used to initialize AMRR rate routines.

  Tested by:    Warren Block <wblock at wonkity.com>
2010-07-08 19:36:38 +00:00
Gleb Smirnoff afac825f9f Merge 209633, 209722 from head:
The struct ipfw_rule_ref follows the struct m_tag. Deal with this
  correctly. This fixes breakage of ng_ipfw(4) in r201527.

Submitted by:	Alexander Zagrebin <alexz visp.ru>

  Avoid double-free. In error cases ipfw(4) frees the mbuf(4), we don't
  need to.

PR:		kern/145462
2010-07-08 12:21:25 +00:00
Gleb Smirnoff cfdc252ff4 Merge 209589 from head:
After processing the O_SKIPTO opcode our cmd points to the next rule, and
  "match" processing at the end of inner loop would look ahead into the next
  rule, which is incorrect. Particularly, in the case when the next rule
  started with F_NOT opcode it was skipped blindly.

  To fix this, exit the inner loop with the continue operator forcibly and
  explicitly.

PR:		kern/147798
2010-07-08 12:20:15 +00:00
Lawrence Stewart 3172ef2357 MFC r209119,209325:
- Add a utility macro to simplify calculating an aggregate sum from a DPCPU
  counter variable.

- Rename the internal for loop iterator to "_i" to avoid potential shadowing of
  external variables named "i". The "_" prefix is reserved for infrastructure
  type code and is therefore not expected to be used by normal code likely to
  call DPCPU_SUM(). [1]

- Change DPCPU_SUM to return the sum rather than calculate and assign it
  internally. Usage is now: "sum = DPCPU_SUM(dpcpu_var, member_to_sum);" [2]

- Fix some style nits. [3]

Sponsored by:	FreeBSD Foundation
Suggested by:	bde [3], mdf [1], kib [1,2], pjd [1,3]
Reviewed by:	jhb, rpaulo, rwatson (old version of r209119), kib (r209325)
2010-07-08 03:41:57 +00:00
Lawrence Stewart 48533f62fd MFC r207223:
- Rework the underlying ALQ storage to be a circular buffer, which amongst other
  things allows variable length messages to be easily supported.

- Extend KPI with alq_writen() and alq_getn() to support variable length
  messages, which is enabled at ALQ creation time depending on the arguments
  passed to alq_open(). Also add variants of alq_open() and alq_post() that
  accept a flags argument. The KPI is still fully backwards compatible and
  shouldn't require any change in ALQ consumers unless they wish to utilise
  the new features.

- Introduce the ALQ_NOACTIVATE and ALQ_ORDERED flags to allow ALQ consumers
  to have more control over IO scheduling and resource acquisition
  respectively.

- Strengthen invariants checking.

- Document ALQ changes in ALQ(9) man page.

Sponsored by:	FreeBSD Foundation
Reviewed by:	gnn, jeff, rpaulo, rwatson
2010-07-08 03:28:25 +00:00
Lawrence Stewart 3365345867 MFC r206028:
The ALQ should not be considered drained until it has been made inactive.

Sponsored by:	FreeBSD Foundation
Reviewed by:	dwmalone, jeff, rpaulo, rwatson (as part of a larger patch)
2010-07-08 02:46:42 +00:00
Lawrence Stewart 70ad3d4e4d MFC r206027:
According to SLEEP(9), msleep() is deprecated in favour of mtx_sleep().

Sponsored by:	FreeBSD Foundation
Reviewed by:	dwmalone, jeff, rpaulo, rwatson (as part of a larger patch)
2010-07-08 02:43:52 +00:00
Lawrence Stewart 0701170741 MFC r206026:
- Factor code to destroy an ALQ out of alq_close() into a private alq_destroy().

- Use the new alq_destroy() to properly handle a failure case in alq_open().

Sponsored by:	FreeBSD Foundation
Reviewed by:	dwmalone, jeff, rpaulo, rwatson (as part of a larger patch)
2010-07-08 02:41:55 +00:00
Lawrence Stewart a44e042016 MFC r205959:
Add support for ALQ(9) to be compiled and loaded as a kernel module.

Sponsored by:	FreeBSD Foundation
Reviewed by:	dwmalone, jeff, rpaulo, rwatson
2010-07-08 02:35:37 +00:00
Marius Strobl 2ec175e2d5 MFC: r209695
- Pin the IPI cache and TLB demap functions in order to prevent migration
  between determining the other CPUs and calling cpu_ipi_selected(), which
  apart from generally doing the wrong thing can lead to a panic when a
  CPU is told to IPI itself (which sun4u doesn't support).
  Reported and tested by: Nathaniel W Filardo
- Add __unused where appropriate.
2010-07-07 19:52:50 +00:00
Ken Smith 173f3d6427 Package set for 8.1-RELEASE. We still have a 2Gb maximum file size
limit caused by cvsup still being used for some of our mirror system.
That is being worked on.

Reviewed by:	re@, portmgr@
2010-07-07 17:05:32 +00:00
Nathan Whitehorn 0d73b2e88e MFC r209114:
Make SMP work on MPC7400-based Apple desktops like the PowerMac3,3.
2010-07-07 14:21:40 +00:00
Nathan Whitehorn 415ca4077e MFC r209222:
Modify the console mouse pointer drawing routine to use single-byte writes
instead of 4-byte ones. Because the mouse pointer can start part way
through a character cell, 4-byte memory operations are not necessarily
aligned, triggering a fatal alignment exception when the console pointer
was moved on PowerPC G5 systems.
2010-07-07 14:19:58 +00:00
Nathan Whitehorn 9127f48cce MFC r209490,209492:
Move default HZ from 100 to 1000 on powerpc, and rearrange the logic
slightly, so that it is set to 100 on ARM and MIPS and defaults to 1000,
instead of defaulting to 100, and setting it to 1000 on everything but
ARM and MIPS.

Reviewed by:	marcel
2010-07-07 14:15:51 +00:00
Bjoern A. Zeeb 32dfb783c2 MFC r207303 (originally by kmacy):
need to initialize the lock before it is used

Reported on:	stable@ (MFC missing)
2010-07-06 16:58:24 +00:00
Christian Brueffer 8c098ef60e MFC: r207948
- Missing full stops
- Upper case the first character of an description
- Section headings do not need to be quoted. From OpenBSD's make.1, revision 1.81
- Plural of suffix is suffixes. From OpenBSD's make.1, revision 1.61
- s/seperating/separating/
2010-07-04 18:48:43 +00:00
Christian Brueffer 5845c60572 MFC: r207946
The previous revision actually removed the bug being hinted at, so
go ahead and remove the hint.
2010-07-04 18:41:00 +00:00
Bernhard Schmidt 0e19552475 MFC r209169:
Fix TX retry rate handling. tx->linkq is an index to a rate table
beginning with the highest available rate. Currently we always use
54m for the first retry no matter what AMRR has choosen. Fix this
by setting the index to the next lower rate.

Approved by:	rpaulo (mentor)
Tested by:	Brandon Gooch <jamesbrandongooch at gmail.com>
2010-07-04 12:30:55 +00:00
Bjoern A. Zeeb d59517691b MFC r208509:
MFp4 @178364:

  Implement an optional delay to the ddb reset/reboot command.

  This allows textdumps to be run automatically with unattended reboots
  after a resonable timeout, while still permitting an administrator to
  break into debugger if attached to the console at the time of the
  event for further debugging.  Cap the maximum delay at 1 week to avoid
  highly accidental results, and default to 15s in case of problems
  parsing the timeout value.

  Move hex2dec helper function from db_thread.c to db_command.c to make
  it generally available and prefix it with a "db_" to avoid namespace
  collisions.

  Reviewed by:  rwatson
2010-07-04 12:27:18 +00:00
Bjoern A. Zeeb 0cf161c648 MFC r208508:
MFp4 @178283:

  Improve IPsec flow distribution for better netisr parallelism.
  Instead of using the pointer that would have the last bits masked in a %
  statement in netisr_select_cpuid() to select the queue, use the SPI.

  Reviewed by:  rwatson
2010-07-04 12:22:17 +00:00
Jilles Tjoelker 59941b368f MFC r209337: sh: Fix compilation with -DNO_HISTORY.
The LINENO code uses snprintf() and relied on "myhistedit.h" to pull in the
necessary <stdio.h>.

Compiling with -DNO_HISTORY disables all editing and history support and
allows linking without -ledit -ltermcap. This may be useful for embedded
systems.
2010-07-03 21:31:05 +00:00
Konstantin Belousov 222259f645 MFC r209106:
Add another variation of make_dev(9), make_dev_p(9), that is allowed
to fail and can return useful error code.

MFC r209237 (by jh):
Correct the function name in a KASSERT.

MFC r209244 (by ed):
Remove the unit argument from the recently added make_dev_p().
2010-07-03 18:19:59 +00:00
Konstantin Belousov 2f4d8014ee MFC r209105:
When make_dev_credf(MAKEDEV_WAITOK) is called, use
devctl_notify_f(M_WAITOK) for devfs notifications.
2010-07-03 18:09:11 +00:00
Konstantin Belousov f506b909ef MFC r209104:
Add modifications of devctl_notify(9) functions that take flags. Use
flags to specify M_WAITOK/M_NOWAIT. M_WAITOK allows devctl to sleep for
the memory allocation.
2010-07-03 17:57:59 +00:00
Christian Brueffer cdf16e61a1 MFC: r207923
Document FIONREAD, FIONWRITE and FIONSPACE.
2010-07-03 12:14:01 +00:00
Christian Brueffer 679126f591 MFC: r207964
Casting size_t to uintmax_t is not necessary anymore. This also
removes the need for stdint.h inclusion.
2010-07-03 12:09:45 +00:00
Christian Brueffer e3b19559b9 MFC: r207975
IBM ServeRAID M5015 SAS/SATA works.
2010-07-03 09:53:35 +00:00
Christian Brueffer 63a46bae7c MFC: r207947
The -d flag is non-optional.
2010-07-03 09:50:48 +00:00
Christian Brueffer a0438fb2ba MFC: r207945
Comment in the BUGS section header. Matches what's in ipfilter 5.10.
2010-07-03 09:42:15 +00:00
Maxim Konovalov 279420f438 MFC r209360: add C message catalogue entries for newer errnos. 2010-07-02 09:23:06 +00:00
Konstantin Belousov 81bbf3f0d3 MFC r209295:
Add unwind annotations to the asm part of crt1 on i386. Terminate the
process with SIGTRAP if _start1() unexpectedly returns.
2010-07-02 09:19:27 +00:00
Konstantin Belousov 875bcf6ef7 MFC r209294:
Add -fno-asynchronous-unwind-tables to disable unwind table generation
for crtbegin/crtend. While there, disable omitting the frame pointer.
2010-07-02 09:17:18 +00:00
Michael Tuexen f085db316c MFC r209540
* Do not dereference a NULL pointer when calling an SCTP send syscall
   not providing a destination address and using ktrace.
 * Do not copy out kernel memory when providing sinfo for sctp_recvmsg().
 Both bug where reported by Valentin Nechayev.
 The first bug results in a kernel panic.
2010-07-01 12:55:34 +00:00
Konstantin Belousov a4f77a6a0e MFC r209483:
Clear DF bit in eflags/rflags on the kernel entry.
2010-06-30 11:47:03 +00:00
Xin LI a5a05a7029 MFC r203584,r203711,r203733,r204379:
Teach obsolete NO_MAIL* friends.
2010-06-29 23:08:33 +00:00
Xin LI 71358a36ef MFC r205942:
Merge OpenBSD revisions 1.4 through 1.9, mostly style cleanups.

Obtained from:	OpenBSD
2010-06-28 17:06:19 +00:00
Rui Paulo 9614d288e3 MFC r209013:
Add missing braces.
2010-06-28 12:20:36 +00:00
Rui Paulo eeacd07a5e MFC r209541, r209548:
Fix the AR_SREV_MERLIN_20_OR_LATER() check.
2010-06-28 11:53:22 +00:00
Michael Tuexen f53b7ef81b MFC r209470,r209499
* Implement sctp_does_stcb_own_this_addr() correclty. It was taking the
   wrong side into account.
 * sctp_findassociation_ep_addr() must check the local address if available.
 This fixes a bug where ABORT chunks were accepted even in the case where
 the local was not owned by the endpoint.
 Thanks to brucec for pointing out a bug in my first version of the fix.
2010-06-28 10:50:14 +00:00
Alexander Motin b108178b50 MFC r208729:
Recommend disabling LAPIC timer instead whole APIC for fixing C3 state.

PR:             docs/147180
Submitted by:   Tobias Rehbein
2010-06-28 08:10:55 +00:00
Alexander Motin a9f63d06f9 MFC r204918 (jkim):
Document a new sysctl variable and a loader tunable.
2010-06-28 08:09:33 +00:00
Brian Somers 055a169261 MFC r209361; Add a missing prototype
PR:		145232
Submitted by:	gcooper
2010-06-28 07:15:30 +00:00
Brian Somers 78d1abccac MFC r209332: Shoot a stray cat!
PR:		145447
Submitted by:	u at netbeisser dot de
2010-06-28 07:03:18 +00:00
Brian Somers b44ebc72eb MFC r209331 at stable/8/etc and stable/8/tools; Remove vestiges of 'slip'.
PR:		145648
Submitted by:	alexbestms at wwu dot de and spam at rm-rf dot kiev dot ua
2010-06-28 06:59:57 +00:00
Brian Somers 1e606e21b5 MFC r209329; add a missing linefeed
PR:		147337
Submitted by:	cyberleo at cyberleo dot net
2010-06-28 04:54:16 +00:00
Konstantin Belousov d9d4345ddd MFC r209367:
Ensure that VOP_ACCESSX is called with exclusively locked vnode for
the kernel compiled with QUOTA option.
2010-06-28 01:36:22 +00:00
Konstantin Belousov 9dd577d936 MFC r209120:
In NFS clients, instead of inconsistently using #ifdef
DIAGNOSTIC and #ifndef DIAGNOSTIC for debug assertions, prefer
KASSERT(). Also change one #ifdef DIAGNOSTIC in the new nfs server.
2010-06-28 01:16:34 +00:00
Xin LI 6927d737ed MFC 196750,196751,196818,196819 (ache@):
196750:

1) Use isprint() instead of hardcoded values to detect non-printable.
2) Use (unsigned char) cast in waddch() calls.
It fix highlighting bug: sign extension of 8bit to the attributes area.
3) Use setlocale() in any case.

196751:

Move <locale.h> out of NO_CATGETS define too (as setlocale() in prev.
commit)

196818:

1) Remove single occurance of HAS_CTYPE ifdef, ctype functions
used here for a long time and needs their header in anycase.
2) Add (unsigned char) casts to more ctype macros.
3) Simplify menu input handling using ctype instead of range unguarded
hardcoded tricks.

196819:
Remove single occurance of HAS_CTYPE ifdef, ctype functions
used here for a long time and needs their header in anycase.

Requested by:	Patrick Lamaiziere <patfbsd davenulle org>
Ok'ed by:	ache
2010-06-27 03:06:20 +00:00
Andrey V. Elsukov 1f0a77f08e MFC r200539 (by rpaulo):
Add Microsoft and NetBSD partition types handling.

Approved by:	kib (mentor)
2010-06-25 08:53:51 +00:00
John Baldwin a0713e354b MFC 208915,208991:
- Use a bit more care when moving I/O APIC interrupts between CPUs.  Mask
  the interrupt followed by a brief delay if it is not currently masked
  before moving the interrupt.
- Move the icu_lock out of ioapic_program_intpin() and into callers.  This
  closes a race where ioapic_program_intpin() could use a stale value of
  the masked state to compute the masked bit in the register.
2010-06-24 13:17:45 +00:00
John Baldwin cd0d1cf6f2 MFC 208392:
- Adjust the whitespace for the lines that output fields in 'show pcpu' in
  DDB so that all the fields line up.
- Print out the tid of the per-CPU idlethread instead of the pid since
  the idle process is now shared across all idle threads.
2010-06-24 13:11:12 +00:00
John Baldwin 34d2cc6775 MFC 208391:
Assert that the thread passed to sched_bind() and sched_unbind() is
curthread as those routines are only supported for curthread currently.
2010-06-24 12:08:50 +00:00
Andrey V. Elsukov 53c2a345ca MFC r207096 (by marcel):
Add and describe GEOM_PART_EBR.

Approved by:	mav (mentor)
2010-06-24 06:31:23 +00:00
Andrey V. Elsukov bed9751b67 MFC r207094 (by marcel):
Implement the resize verb and add support for resizing partitions
for all schemes but EBR.

MFC r207095 (by marcel):
Implement the resize command for resizing partitions. Without new
size, the partition in question is resized to fill all available
space.

Approved by:	kib (mentor)
2010-06-24 05:52:44 +00:00
Jilles Tjoelker 5c805bb293 MFC r208647,r208654: Clarify devfs manpages slightly.
mount(8): add xref to devfs(5)
devfs(5): change example to something more likely to be useful (it is not
necessary to mount a devfs on /dev manually, but for chroots/jails it is
often needed), mention since when devfs is preferred to device nodes on ufs
and when device nodes on ufs stopped working

PR:		146600
2010-06-23 20:59:00 +00:00
John Baldwin af2833f069 MFC 198988:
Take a step towards removing if_watchdog/if_timer.  Don't explicitly set
if_watchdog/if_timer to NULL/0 when initializing an ifnet.  if_alloc()
sets those members to NULL/0 already.
2010-06-23 18:46:10 +00:00
John Baldwin 5db63cb9bf MFC 208390:
Allow a const char * to be passed as the process name to kproc_kthread_add()
without generating a warning.
2010-06-23 18:00:19 +00:00
John Baldwin ab6078c387 MFC 208388:
- Set 'dmadat' earlier so that we properly setup the heap if we fail to
  locate a high memory area for the heap using the SMAP.
- Read the number of hard drive devices from the BIOS instead of hardcoding
  a limit of 128.  Some BIOSes duplicate disk devices once you get beyond
  the maximum drive number.
2010-06-23 17:56:20 +00:00
John Baldwin 94b53860cc MFC 209213:
When updating individual CPU's lowest Cx state to use, never set it to a
state lower than the lowest one supported by the current CPU.  This closes
some races with changes to the hw.acpi.cpu_cx_lowest sysctl while Cx
states for individual CPUs were changing (e.g. unplugging the AC adapter
of a laptop) that could result in panics.
2010-06-23 17:04:42 +00:00
Nathan Whitehorn c1d1cbdf32 MFC r209369:
Temporarily disable instruction relocation while setting up the kernel's
IBAT entry in early boot in order to prevent possible faults from races
between the instruction cache and the MMU.

PR:		powerpc/148003
2010-06-23 13:13:14 +00:00
Konstantin Belousov 47dbbc217f MFC r208920:
Reorganize the code in bdwrite() which handles move of dirtiness from
the buffer pages to buffer. Drain the VPO_BUSY bit of the buffer pages
before setting valid and clean bits.

Stable/8 version of vfs_page_set_validclean() requires page queue lock.

Tested by:	pho
2010-06-23 10:06:57 +00:00
Doug Barton a2f32cc945 MFC 209286:
Add the AAAA address for i.root-servers.net
2010-06-22 21:12:44 +00:00
Alexander Motin 0a95b7154d MFC r209341:
Report transport type in XPT_PATH_INQ.
2010-06-22 19:24:07 +00:00
Alexander Motin c906feaa17 MFC r209340:
Report transport type in XPT_PATH_INQ.

PR:		i386/147929
2010-06-22 19:22:34 +00:00
Andrey V. Elsukov a321ef1154 MFC r198478 (by lulf):
- Initialize variable in order to avoid GCC warning and enable WARNS=6.

PR:		bin/139970
Submitted by:	Ulrich Spörlein <uqs -at- spoerlein.net>
Approved by:	kib (mentor)
2010-06-22 18:24:26 +00:00
Dag-Erling Smørgrav e41e850bfb merge r196650 (check that tty != NULL, prevents segfault on session close) 2010-06-22 15:01:23 +00:00
Andrey V. Elsukov 202e8a8e41 MFC r198235:
Clean up markup (mainly).

Approved by:	kib (mentor)
2010-06-22 09:45:20 +00:00
Konstantin Belousov daa2d22d82 MFC r209199:
Fix the syscall module name after r205320.
2010-06-22 08:58:13 +00:00
Andriy Gapon cb2533f0f7 MFC r208672: g_label: fix possible NULL pointer dereference 2010-06-22 08:17:20 +00:00
Andriy Gapon 9a32190ee8 MFC r208670: amdsbwd: fix nonsensical timeout calculations 2010-06-22 07:55:30 +00:00
Andriy Gapon 6bd42b2b2e MFC r208669: zfs boot: fix error handling in zfs_readdir 2010-06-22 07:54:19 +00:00
Andrey V. Elsukov 0044c4e2c9 MFC r207178:
Fix undo for schemes that have internal partitions. Internal partitions
do not constitute user-visible or active partitions and as such should
not prevent undoing pending operations.

While here, initialize the last usable sector for the placeholder geom
based on the null scheme, created to allow undoing the destruction of
a scheme. This gives consistent output with "gpart show".

Approved by:	mav (mentor)
2010-06-22 07:38:30 +00:00
Matt Jacob 7e3a108e7a This is an MFC of 209188
For the target port groups structures, don't allocate the initial element.
This makes things easier for target implementations to calculate how many
elements they need to allocate.
2010-06-22 04:40:50 +00:00
Matt Jacob 7bc4f84003 This is an MFC of 208918
One byte off for scsi_target_group cdb.
2010-06-22 04:38:41 +00:00
Matt Jacob f76f26cacf This is an MFC of 208905
Make additional definitions up to and including SPC-4. Add in definitions
for REPORT and SET TARGET PORT GROUP commands (foundations for future work).

Regularize opcodes to be upper case hex.

Pick *one* of tab or space after #define (tab) and stick with that.
2010-06-22 04:37:05 +00:00
Rick Macklem 4cf8e51836 MFC: r209191
Add MODULE_DEPEND() macros to the experimental NFS client and
server so that the modules will load when kernels are built with
none of the NFS* configuration options specified. I believe this
resolves the problems reported by PR kern/144458 and the email on
freebsd-stable@ posted by Dmitry Pryanishnikov on June 13.
2010-06-22 01:30:46 +00:00
Xin LI dffb5dedf8 MFC r208969,209268:
Driver update of twa(4) from LSI.  Many thanks to LSI for continuing to
support FreeBSD.

  1) Timeout ioctl command timeouts.
       Do not reset the controller if ioctl command completed
       successfully.
  2) Remove G66_WORKAROUND code (this bug never shipped).
  3) Remove unnecessary interrupt lock (intr_lock).
  4) Timeout firmware handshake for PChip reset (don't wait forever).
  5) Handle interrupts inline.
  6) Unmask command interrupt ONLY when adding a command to the pending
     queue.
  7) Mask command interrupt ONLY after removing the last command from
     the pending queue.
  8) Remove TW_OSLI_DEFERRED_INTR_USED code.
  9) Replace controller "state" with separate data fields to avoid races:

       TW_CLI_CTLR_STATE_ACTIVE                     ctlr->active
       TW_CLI_CTLR_STATE_INTR_ENABLED               ctlr->interrupts_enabled
       TW_CLI_CTLR_STATE_INTERNAL_REQ_BUSY          ctlr->internal_req_busy
       TW_CLI_CTLR_STATE_GET_MORE_AENS              ctlr->get_more_aens
       TW_CLI_CTLR_STATE_RESET_IN_PROGRESS          ctlr->reset_in_progress
       TW_CLI_CTLR_STATE_RESET_PHASE1_IN_PROGRESS   ctlr->reset_phase1_in_progress

 10) Fix "req" leak in twa_action() when simq is frozen and req is NOT
     null.
 11) Replace softc "state" with separate data fields to avoid races:
       TW_OSLI_CTLR_STATE_OPEN                      sc->open
       TW_OSLI_CTLR_STATE_SIMQ_FROZEN               sc->simq_frozen
 12) Fix reference to TW_OSLI_REQ_FLAGS_IN_PROGRESS in
     tw_osl_complete_passthru()
 13) Use correct CAM status values.
       Change CAM_REQ_CMP_ERR to CAM_REQ_INVALID.
       Remove use of CAM_RELEASE_SIMQ for physical data addresses.
 14) Do not freeze/ release the simq with non I/O commands.
       When it is appropriate to temporarily freeze the simq with an I/O
       command use:
         xpt_freeze_simq(sim, 1);
         ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
       otherwise use:
         xpt_freeze_simq(sim, 1);
         xpt_release_simq(sim, 1);

Submitted by:	Tom Couch <tom.couch lsi.com>
PR:		kern/147695
2010-06-21 22:00:57 +00:00
Kai Wang ab209c9651 MFC r209122:
* Improve compatibility with existing application code by permitting the
    use of `elf_getbase()` on non-archive members. This change is needed
    for gcc LTO (-flto) to work properly.
  * Style fix: paranthesize returned values.
  * Document the current behaviour of `elf_getbase()`.
2010-06-21 13:47:29 +00:00
Andrey V. Elsukov d772297766 MFC r208886:
libgeom(3) does strdup of param name.
Don't leak memory when deleting param from gctl_req.

Approved by:	mav (mentor)
2010-06-21 05:42:36 +00:00
Matt Jacob e56335882a This is an MFC of 208895.
Fix XPT_GET_TRAN_SETTING for FC which has been broken for while so that
it will figure out the correct target to handle index and be able to find
things like WWPN, etc.
2010-06-21 04:37:39 +00:00
Alexander Motin e0e1f8038f MFC r209155:
Fix bug introduced in SVN rev 194985. When calling pic_assign_cpu()
for pre-bound IRQs during boot, submit there LAPIC ID, same as in other
places, not CPU ID.
2010-06-20 10:23:46 +00:00
Ulrich Spörlein e4432747af MFH r200600: Clarify what's meant by NUL for getline.3
PR:		docs/141125
Submitted by:	Jeremy Huddleston <[email protected]>
2010-06-19 18:38:03 +00:00
Marcel Moolenaar 18d019fb7c MFC revs 209026 and 209085:
o   Bump MAX_BPAGES from 256 to 1024.
o   Synchronize the kernel entry on all CPUs with the use of the ptc.g
    instruction on a single CPU by implementing a bare-bones readers-
    writer lock.
2010-06-19 04:57:58 +00:00
Matt Jacob e279a3bf13 This is an MFC of 208849
Be more specific about which CDB length we're going to use. Not really a likely
bug but we might as well be clearer.
2010-06-19 00:41:29 +00:00
Matt Jacob 515afe0af6 This is an MFC of 208809
Make the internal target > SPC2 (so REPORT LUNS can be tested).
Give the NIL inquiry data real values other than just plain 0x7f
in the first byte.
2010-06-19 00:39:19 +00:00
Matt Jacob b734602bd1 This is an MFC of 208808
I was getting panics in sleepq_add for the second sleep in isp_kthread.
I don't know why- but it occurred to me in looking at the second sleep
is that all I want is a pause- not an actual sleep. So do that instead.
2010-06-19 00:37:14 +00:00
Matt Jacob 941bac2572 This is an MFC of 208761
Various minor and not so minor fixes suggested by Coverity.
In at least one case, it's amazing that target mode worked at all.
2010-06-18 21:37:27 +00:00
Jack F Vogel 0e85040c98 MFC of E1000 drivers:
Stability fixes from M.Tuexen
  Cool stats changes from gnn
  Changes for POLL friendliness from John Baldwin

  Thanks everyone!

MFC to RELENG8.1 asap
2010-06-18 17:22:08 +00:00
Jack F Vogel f5707abfd3 MFC of ixgbe driver version 2.2.1
-mostly stability fixes

MFC to RELENG 8.1 asap
2010-06-18 16:36:57 +00:00
Alexander Kabaev 051beae690 MFC r207578:
Do not encode more than CTF_MAX_VLEN(1023) enum members.

CTF can not represent enums with more than CTF_MAX_VLEN members, but
ctfconvert will happily ignore that limitation and create CTF section no
other tool can interpret.

This change is different from similar change from upstream, which just
returns an error if big enum is encountered.  Doing that means that
every FreeBSD kernel with compiled in hwpmc will have no useable CTF
information due to pmc_event enum having 1236+ members.
2010-06-18 16:14:37 +00:00
Alexander Kabaev 28299670df MFC r208994:
Do not require pos parameter to be zero in MAP_ANONYMOUS mmap requests
in Linux emulation layer. Linux seems to only require that pos is
page-aligned, but otherwise ignores it. Default FreeBSD mmap parameter
checking is too strict to allow some Linux binaries to run. tsMuxeR is
one example of such a binary.

Discussed with:	jhb
2010-06-18 15:25:57 +00:00
Alexander Kabaev 4b7306ec23 MFC r208763:
Plug possible memory leak.

Found by:  Coverity Prevent
2010-06-18 15:17:38 +00:00
Konstantin Belousov 464bf49522 MFC r208773:
Sometimes vnodes share the lock despite being different vnodes on
different mount points, e.g. the nullfs vnode and the covered vnode
from the lower filesystem. In this case, existing assertion in
vop_rename_pre() may be triggered.

Check for vnode locks equiality instead of the vnodes itself to
not trip over the situation.
2010-06-18 09:40:01 +00:00
Konstantin Belousov 46cf4e84e9 MFC r208604:
Clarify a potential issue in get_fpcontext() use.
2010-06-18 09:34:31 +00:00
Konstantin Belousov 14bcc1c187 MFC r208565:
Remove a check that should be always true.
2010-06-18 09:29:08 +00:00
Konstantin Belousov 62af16dcea MFC r208340:
When waiting for the busy page, do not unlock the object unless unlock
cannot be avoided.
2010-06-18 09:25:00 +00:00
Brian Somers 04564ee517 MFC r208728 - Fix stuttering sequences and reverse ranges
PR:             123635
Submitted by:   Ulrich Spörlein, uqs at spoerlein dot net
2010-06-18 07:19:30 +00:00
Pawel Jakub Dawidek 0ac0d623b0 MFC r208770:
opensolaris_kmem.c is already part of opensolaris.ko which zfs.ko depends on.

Reported by:	avg
2010-06-18 06:24:40 +00:00
Matt Jacob 6d988fec0f This is an MFC of 207543
Print IR_RESYNC updates informatively.

Obtained from:	pluknet
2010-06-18 04:51:17 +00:00
Matt Jacob 0674749a26 This is an MFC of 207938
Pick up the right change, not it's close cousin. The one
previously submitted was wrong.
2010-06-18 04:45:06 +00:00
Matt Jacob e83722d759 This is an MFC of 207933
Deal sensibly with more than 26 sg devices. It isn't a complete
solution.
2010-06-18 04:43:22 +00:00
Matt Jacob 9d3661d8ae This is an MFC of 208101
Yet another potential dereference of a dead provider.
2010-06-18 04:01:59 +00:00
Matt Jacob cfe1177877 This is an MFC of 208082
Make sure to check that the active provider pointer points to something before
dereferencing the pointer.
2010-06-18 03:59:07 +00:00
Qing Li b912b17ae8 MFC r208553
This patch fixes the problem where proxy ARP entries cannot be added
over the if_ng interface.
2010-06-18 03:31:33 +00:00
Martin Matuska 786a7239e1 MFC r209093-r209101:
MFC r209093:
Fix unable to remove a file over NFS after hitting refquota limit
OpenSolaris onnv rev:	8890:8c2bd5f17bf2
OpenSolaris Bug ID:	6798878

MFC r209094:
Fix zfs destroy fails to free object in open context, stops up txg train
OpenSolaris onnv rev:	9409:9dc3f17354ed
OpenSolaris Bug ID:	6809683

MFC r209095:
Fix incomplete resilvering after disk replacement (raidz)
OpenSolaris onnv rev:	9434:3bebded7c76a
OpenSolaris Bug ID:	6794570

MFC r209096:
Fix vdev_probe() starvation brings txg train to a screeching halt
OpenSolaris onnv rev:	9722:e3866bad4e96
OpenSolaris Bug ID:	6844069

MFC r209097:
Fix ZFS panic deadlock: cycle in blocking chain via zfs_zget
OpenSolaris onnv rev:	9774:0bb234ab2287
OpenSolaris Bug ID:	6788152

MFC r209098:
Fix zpool resilver stalls with spa_scrub_thread in a 3 way deadlock
OpenSolaris onnv rev:	9997:174d75a29a1c
OpenSolaris Bug ID:	6843235

MFC r209099:
Fix possible zfs panic on zpool import
OpenSolaris onnv rev:	10040:38b25aeeaf7a
OpenSolaris Bug ID:	6857012

MFC r209100:
Fix panic in zfs_getsecattr
OpenSolaris onnv rev:	10295:f7a18a1e9610
OpenSolaris Bug ID:	6870564

MFC r209101:
Fix arc_read_done may try to byteswap undefined data (sparc related)
OpenSolaris onnv rev:	10839:cf83b553a2ab
OpenSolaris Bug ID:	6836714

Obtained from:	OpenSolaris (multiple Bug IDs)
Approved by:	pjd, delphij (mentor)
2010-06-17 22:38:23 +00:00
Randi Harper 0b1903d78c MFC r209004:
Fix uninitialized variables that cause a crash when the network is
  initialized and sysinstall is not running as init.

Submitted by:	Nick Mills
Approved by:	cperciva (mentor)
2010-06-17 21:17:35 +00:00
Marius Strobl e3c91bd30c MFC: r209138
Update a branch missed in r207537 (committed to stable/8 in r207890).
2010-06-17 20:10:39 +00:00
Max Laier 611f6bea7b MFC r209063:
Cache the last result from if_indextoname for printing.  This speeds up
  "arp -an" when using a lot of aliases (on a single interface).

  A better fix would include a better interface for if_indextoname than
  getting the whole address list from the kernel just to find the one
  index->name mapping.
2010-06-17 19:46:36 +00:00
Pawel Jakub Dawidek b6d424abe3 MFC r209260,r209261:
r209260:

Backout r207970 for now, it can lead to deadlocks.

Reported by:	kan

r209261:

Turn off UMA allocations on all archs by default. It isn't stable even on
amd64.

Reported by:	many
2010-06-17 19:25:05 +00:00
Michael Tuexen a06d36d87e MFC 209178
* Fix a bug where the length of the ASCONF-ACK was calculated wrong due
   to using an uninitialized variable.
 * Fix a bug where a NULL pointer was dereferenced when interfaces
   come and go at a high rate.
 * Fix a bug where inps where not deregistered from iterators.
 * Fix a race condition in freeing an association.
 * Fix a refcount problem related to the iterator.
 Each of the above bug results in a panic. It shows up when
 interfaces come and go at a high rate.
2010-06-17 19:17:50 +00:00
Pawel Jakub Dawidek 32c509755d MFC r209175,r209177,r209179,r209180,r209181,r209182,r209183,r209184,r209185:
r209175:

Eliminate dead code.

Found by:	Coverity Prevent
CID:		5158

r209177:

Remove macros that are not really needed. The idea was to have them in case
we grow more descriptors, but I'll reconsider readding them once we get there.

Passing (a = b) expression to FD_ISSET() is bad idea, as FD_ISSET() evaluates
its argument twice.

Found by:	Coverity Prevent
CID:		5243

r209179:

Plug memory leaks.

Found by:	Coverity Prevent
CID:		7052, 7053, 7054, 7055

r209180:

Plug memory leak.

Found by:	Coverity Prevent
CID:		7051

r209181:

Plug memory leak.

Found by:	Coverity Prevent
CID:		7056

r209182:

Plug memory leak.

Found by:	Coverity Prevent
CID:		7057

r209183:

Initialize gctl_seq for synchronization requests.

Reported by:	[email protected]
Analysed by:	Mikolaj Golub <[email protected]>
Tested by:	[email protected], Mikolaj Golub <[email protected]>

r209184:

Fix typos.

r209185:

Correct various log messages.

Submitted by:	Mikolaj Golub <[email protected]>
2010-06-17 19:17:31 +00:00
Pawel Jakub Dawidek deb2ce21bc MFC r209186,r209187:
r209186:

BIO_DELETE contains range we want to delete and doesn't provide any useful
data, so there is no need to copy it to userland.

r209187:

'unit' can be negative, so use signed type for it.

Found by:	Coverity Prevent
CID:		3731
2010-06-17 19:06:11 +00:00
Ken Smith e3785c67b7 Adjust __FreeBSD_version to reflect releng/8.1 has been created.
Approved by:	re (implicit)
2010-06-14 02:21:43 +00:00
4359 changed files with 478529 additions and 154767 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
The compilation of software known as FreeBSD is distributed under the
following terms:
Copyright (c) 1992-2010 The FreeBSD Project. All rights reserved.
Copyright (c) 1992-2011 The FreeBSD Project. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
+1 -1
View File
@@ -93,7 +93,7 @@ CLEANDIR= cleandir
.endif
CVS?= cvs
CVSFLAGS?= -r RELENG_8 -P -d -I!
CVSFLAGS?= -r RELENG_8_2 -P -d -I!
SVN?= svn
SVNFLAGS?= -r HEAD
SUP?= /usr/bin/csup
+10
View File
@@ -14,6 +14,14 @@
# The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
#
# 20101123: removed subblock.h from liblzma
OLD_FILES+=usr/include/lzma/subblock.h
# 20101114: Remove long-obsolete MAKEDEV.8
OLD_FILES+=usr/share/man/man8/MAKEDEV.8.gz
# 20101112: vgonel(9) has gone to private API a while ago
OLD_FILES+=usr/share/man/man9/vgonel.9.gz
# 20101025: catch up with vm_page_sleep_if_busy rename
OLD_FILES+=usr/share/man/man9/vm_page_sleep_busy.9.gz
# 20100327: fusword.9 and susword.9 removed
OLD_FILES+=usr/share/man/man9/fusword.9.gz
OLD_FILES+=usr/share/man/man9/susword.9.gz
@@ -596,6 +604,8 @@ OLD_FILES+=usr/include/dev/usb/usb_quirks.h
OLD_FILES+=usr/include/dev/usb/usbcdc.h
OLD_FILES+=usr/include/dev/usb/usbdivar.h
OLD_FILES+=usr/include/dev/usb/uxb360gp_rdesc.h
OLD_FILES+=usr/sbin/usbdevs
OLD_FILES+=usr/share/man/man8/usbdevs.8.gz
# 20090203: removal of pccard header files
OLD_FILES+=usr/include/pccard/cardinfo.h
OLD_FILES+=usr/include/pccard/cis.h
+47
View File
@@ -15,6 +15,34 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.x IS SLOW ON IA64 OR SUN4V:
debugging tools present in HEAD were left in place because
sun4v support still needs work to become production ready.
20110221:
8.2-RELEASE.
20101126:
New version of minidump format for amd64 architecture was
introduced in r215872. To analyze vmcore files produced by
kernels at or after this version you will need updated userland,
libkvm actually, that is able to handle the new version.
20101022:
A workaround for a fixed ld bug has been removed in kernel code,
so make sure that your system ld is built from sources after
revision 211583 from 2010-08-21 (r210245 from 2010-07-19 if
building stable/8 kernel on head, r211584 from 2010-08-21 for
stable/7). A symptom of incorrect ld version is
different addresses for set_pcpu section and __start_set_pcpu
symbol in kernel and/or modules.
20100915:
A new version of ZFS (version 15) has been merged.
This version uses a python library for the following subcommands:
zfs allow, zfs unallow, zfs groupspace, zfs userspace.
For full functionality of these commands the following port must
be installed: sysutils/py-zfs
20100720:
8.1-RELEASE.
20100502:
The config(8) command has been updated to maintain compatibility
with config files from 8.0-RELEASE. You will need a new version
@@ -56,6 +84,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.x IS SLOW ON IA64 OR SUN4V:
via the DEADLKRES option, see NOTES for more details) and the
sleepq_type() function for sleepqueues.
20091125:
8.0-RELEASE.
20090929:
802.11s D3.03 support was committed. This is incompatible with
the previous code, which was based on D3.0.
@@ -1552,6 +1583,22 @@ COMMON ITEMS:
Please try this approach before reporting problems with a major
version upgrade.
ZFS notes
---------
When upgrading the boot ZFS pool to a new version, always follow
these two steps:
1.) recompile and reinstall the ZFS boot loader and boot block
(this is part of "make buildworld" and "make installworld")
2.) update the ZFS boot block on your boot drive
The following example updates the ZFS boot block on the first
partition (freebsd-boot) of a GPT partitioned drive ad0:
"gpart bootcode -p /boot/gptzfsboot -i 1 ad0"
Non-boot pools do not need these updates.
To build a kernel
-----------------
If you are updating from a prior version of FreeBSD (even one just
+1
View File
@@ -1072,6 +1072,7 @@ find_element(char *voltag, uint16_t *et, uint16_t *eu)
/* Read in the changer slots */
if (cp.cp_nslots > 0) {
(void) memset(&cesr, 0, sizeof(cesr));
cesr.cesr_element_type = CHET_ST;
cesr.cesr_element_base = 0;
cesr.cesr_element_count = cp.cp_nslots;
+24 -11
View File
@@ -32,7 +32,7 @@
.\" @(#)echo.1 8.1 (Berkeley) 7/22/93
.\" $FreeBSD$
.\"
.Dd April 12, 2003
.Dd November 12, 2010
.Dt ECHO 1
.Os
.Sh NAME
@@ -56,24 +56,37 @@ The following option is available:
.Bl -tag -width flag
.It Fl n
Do not print the trailing newline character.
This may also be achieved by appending
.El
.Pp
The end-of-options marker
.Fl Fl
is not recognized and written literally.
.Pp
The newline may also be suppressed by appending
.Ql \ec
to the end of the string, as is done
by iBCS2 compatible systems.
Note that this option as well as the effect of
Note that the
.Fl n
option as well as the effect of
.Ql \ec
are implementation-defined in
.St -p1003.1-2001
as amended by Cor.\& 1-2002.
Applications aiming for maximum
portability are strongly encouraged to use
.Xr printf 1
to suppress the newline character.
.El
.Pp
Some shells may provide a builtin
For portability,
.Nm
command which is similar or identical to this utility.
should only be used if the first argument does not start with a hyphen
.Pq Ql "-"
and does not contain any backslashes
.Pq Ql "\e" .
If this is not sufficient,
.Xr printf 1
should be used.
.Pp
Most shells provide a builtin
.Nm
command which tends to differ from this utility
in the treatment of options and backslashes.
Consult the
.Xr builtin 1
manual page.
+21 -10
View File
@@ -30,7 +30,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 12, 2004
.Dd September 9, 2010
.Dt EXPR 1
.Os
.Sh NAME
@@ -217,6 +217,9 @@ command, one might rearrange the expression:
More generally, parenthesize possibly-negative values:
.Dl "a=$(expr \e( $a \e) + 1)"
.It
With shell arithmetic, no escaping is required:
.Dl "a=$((a + 1))"
.It
This example prints the filename portion of a pathname stored
in variable
.Va a .
@@ -229,6 +232,12 @@ The
.Li //
characters resolve this ambiguity.
.Dl "expr \*q//$a\*q \&: '.*/\e(.*\e)'"
.It
With modern
.Xr sh 1
syntax,
.Dl "\*q${a##*/}\*q"
expands to the same value.
.El
.Pp
The following examples output the number of characters in variable
@@ -237,19 +246,21 @@ Again, if
.Va a
might begin with a hyphen, it is necessary to prevent it from being
interpreted as an option to
.Nm .
.Nm ,
and
.Va a
might be interpreted as an operator.
.Bl -bullet
.It
If the
.Nm
command conforms to
.St -p1003.1-2001 ,
this is simple:
.Dl "expr -- \*q$a\*q \&: \*q.*\*q"
.It
For portability to older systems, however, a more complicated command
To deal with all of this, a complicated command
is required:
.Dl "expr \e( \*qX$a\*q \&: \*q.*\*q \e) - 1"
.It
With modern
.Xr sh 1
syntax, this can be done much more easily:
.Dl "${#a}"
expands to the required number.
.El
.Sh SEE ALSO
.Xr sh 1 ,
+9 -8
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: getoldopt.c,v 1.4 2000/01/22 20:24:51 deraadt Exp $ */
/* $OpenBSD: getoldopt.c,v 1.9 2009/10/27 23:59:22 deraadt Exp $ */
/* $NetBSD: getoldopt.c,v 1.3 1995/03/21 09:07:28 cgd Exp $ */
/*-
@@ -7,7 +7,7 @@
* otherwise, it uses the old rules used by tar, dump, and ps.
*
* Written 25 August 1985 by John Gilmore (ihnp4!hoptoad!gnu) and placed
* in the Pubic Domain for your edification and enjoyment.
* in the Public Domain for your edification and enjoyment.
*/
#include <sys/cdefs.h>
@@ -33,7 +33,8 @@ getoldopt(int argc, char **argv, const char *optstring)
optarg = NULL;
if (key == NULL) { /* First time */
if (argc < 2) return EOF;
if (argc < 2)
return (-1);
key = argv[1];
if (*key == '-')
use_getopt++;
@@ -42,18 +43,18 @@ getoldopt(int argc, char **argv, const char *optstring)
}
if (use_getopt)
return getopt(argc, argv, optstring);
return (getopt(argc, argv, optstring));
c = *key++;
if (c == '\0') {
key--;
return EOF;
return (-1);
}
place = strchr(optstring, c);
if (place == NULL || c == ':') {
fprintf(stderr, "%s: unknown option %c\n", argv[0], c);
return('?');
return ('?');
}
place++;
@@ -64,9 +65,9 @@ getoldopt(int argc, char **argv, const char *optstring)
} else {
fprintf(stderr, "%s: %c argument missing\n",
argv[0], c);
return('?');
return ('?');
}
}
return(c);
return (c);
}
+4 -2
View File
@@ -33,7 +33,7 @@
.\" @(#)pax.1 8.4 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
.Dd July 3, 2004
.Dd August 29, 2010
.Dt PAX 1
.Os
.Sh NAME
@@ -748,7 +748,9 @@ The extended tar interchange format specified in the
.St -p1003.2
standard.
The default blocksize for this format is 10240 bytes.
Pathnames stored by this format must be 250 characters or less in length.
Pathnames stored by this format must be 255 characters or less in length.
The directory part may be at most 155 characters and each path component
must be less than 100 characters.
.El
.Pp
The
+2 -2
View File
@@ -1086,7 +1086,7 @@ name_split(char *name, int len)
*/
if (len <= TNMSZ)
return(name);
if (len > (TPFSZ + TNMSZ + 1))
if (len > TPFSZ + TNMSZ)
return(NULL);
/*
@@ -1095,7 +1095,7 @@ name_split(char *name, int len)
* to find the biggest piece to fit in the name field (or the smallest
* prefix we can find)
*/
start = name + len - TNMSZ - 1;
start = name + len - TNMSZ;
while ((*start != '\0') && (*start != '/'))
++start;
+7 -5
View File
@@ -60,7 +60,7 @@
.Ar pattern ...
.Nm pkill
.Op Fl Ar signal
.Op Fl ILafinovx
.Op Fl ILafilnovx
.Op Fl F Ar pidfile
.Op Fl G Ar gid
.Op Fl M Ar core
@@ -163,14 +163,16 @@ The value
matches processes not in jail.
.It Fl l
Long output.
Print the process name in addition to the process ID for each matching
For
.Nm pgrep ,
print the process name in addition to the process ID for each matching
process.
If used in conjunction with
.Fl f ,
print the process ID and the full argument list for each matching process.
This option can only be used with the
.Nm pgrep
command.
For
.Nm pkill ,
display the kill command used for each process killed.
.It Fl n
Select only the newest (most recently started) of the matching processes.
.It Fl o
+10 -4
View File
@@ -133,7 +133,7 @@ main(int argc, char **argv)
{
char buf[_POSIX2_LINE_MAX], *mstr, **pargv, *p, *q, *pidfile;
const char *execf, *coref;
int ancestors, debug_opt;
int ancestors, debug_opt, did_action;
int i, ch, bestidx, rv, criteria, pidfromfile, pidfilelock;
size_t jsz;
int (*action)(const struct kinfo_proc *);
@@ -246,8 +246,6 @@ main(int argc, char **argv)
criteria = 1;
break;
case 'l':
if (!pgrep)
usage();
longfmt = 1;
break;
case 'n':
@@ -529,16 +527,24 @@ main(int argc, char **argv)
/*
* Take the appropriate action for each matched process, if any.
*/
did_action = 0;
for (i = 0, rv = 0, kp = plist; i < nproc; i++, kp++) {
if (PSKIP(kp))
continue;
if (selected[i]) {
if (longfmt && !pgrep) {
did_action = 1;
printf("kill -%d %d\n", signum, kp->ki_pid);
}
if (inverse)
continue;
} else if (!inverse)
continue;
rv |= (*action)(kp);
}
if (!did_action && !pgrep && longfmt)
fprintf(stderr,
"No matching processes belonging to you were found\n");
exit(rv ? STATUS_MATCH : STATUS_NOMATCH);
}
@@ -551,7 +557,7 @@ usage(void)
if (pgrep)
ustr = "[-LSfilnovx] [-d delim]";
else
ustr = "[-signal] [-ILfinovx]";
ustr = "[-signal] [-ILfilnovx]";
fprintf(stderr,
"usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n"
+1 -1
View File
@@ -79,8 +79,8 @@ int s_uname(KINFO *);
void showkey(void);
void started(KINFO *, VARENT *);
void state(KINFO *, VARENT *);
void tdnam(KINFO *, VARENT *);
void tdev(KINFO *, VARENT *);
void tdnam(KINFO *, VARENT *);
void tname(KINFO *, VARENT *);
void ucomm(KINFO *, VARENT *);
void uname(KINFO *, VARENT *);
+4 -2
View File
@@ -89,7 +89,7 @@ static VAR var[] = {
{"emul", "EMUL", NULL, LJUST, emulname, NULL, EMULLEN, 0, CHAR,
NULL, 0},
{"etime", "ELAPSED", NULL, USER, elapsed, NULL, 12, 0, CHAR, NULL, 0},
{"f", "F", NULL, 0, kvar, NULL, 7, KOFF(ki_flag), INT, "x", 0},
{"f", "F", NULL, 0, kvar, NULL, 8, KOFF(ki_flag), INT, "x", 0},
{"flags", "", "f", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"ignored", "", "sigignore", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"inblk", "INBLK", NULL, USER, rvar, NULL, 4, ROFF(ru_inblock), LONG,
@@ -186,7 +186,9 @@ static VAR var[] = {
UINT, UIDFMT, 0},
{"svuid", "SVUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_svuid),
UINT, UIDFMT, 0},
{"tdev", "TDEV", NULL, 0, tdev, NULL, 4, 0, CHAR, NULL, 0},
{"tdaddr", "TDADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2,
KOFF(ki_tdaddr), KPTR, "lx", 0},
{"tdev", "TDEV", NULL, 0, tdev, NULL, 5, 0, CHAR, NULL, 0},
{"tdnam", "TDNAM", NULL, LJUST, tdnam, NULL, COMMLEN, 0, CHAR, NULL, 0},
{"time", "TIME", NULL, USER, cputime, NULL, 9, 0, CHAR, NULL, 0},
{"tpgid", "TPGID", NULL, 0, kvar, NULL, 4, KOFF(ki_tpgid), UINT,
+4 -1
View File
@@ -29,7 +29,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
.Dd April 13, 2010
.Dd July 24, 2010
.Dt PS 1
.Os
.Sh NAME
@@ -291,6 +291,7 @@ the include file
.It Dv "P_PPWAIT" Ta No "0x00010 Parent is waiting for child to exec/exit"
.It Dv "P_PROFIL" Ta No "0x00020 Has started profiling"
.It Dv "P_STOPPROF" Ta No "0x00040 Has thread in requesting to stop prof"
.It Dv "P_HASTHREADS" Ta No "0x00080 Has had threads (no cleanup shortcuts)"
.It Dv "P_SUGID" Ta No "0x00100 Had set id privileges since last exec"
.It Dv "P_SYSTEM" Ta No "0x00200 System proc: no sigs, stats or swapping"
.It Dv "P_SINGLE_EXIT" Ta No "0x00400 Threads suspending should exit, not wait"
@@ -585,6 +586,8 @@ symbolic process state (alias
saved gid from a setgid executable
.It Cm svuid
saved UID from a setuid executable
.It Cm tdaddr
thread address
.It Cm tdev
control terminal device number
.It Cm time
+1 -1
View File
@@ -33,8 +33,8 @@
.\" $FreeBSD$
.\"
.Dd November 1, 2009
.Os
.Dt PWAIT 1
.Os
.Sh NAME
.Nm pwait
.Nd wait for processes to terminate
+2 -2
View File
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 13, 2010
.Dd July 27, 2010
.Dt SETFACL 1
.Os
.Sh NAME
@@ -299,7 +299,7 @@ one of
.Dq Li group@ ,
or
.Dq Li everyone@ ,
this field is ommited altogether, including the trailing comma.
this field is omitted altogether, including the trailing comma.
.It Ar "access permissions"
Access permissions may be specified in either short or long form.
Short and long forms may not be mixed.
+5 -2
View File
@@ -21,12 +21,12 @@ LDADD= -ll -ledit -ltermcap
LFLAGS= -8 # 8-bit lex scanner for arithmetic
CFLAGS+=-DSHELL -I. -I${.CURDIR}
# for debug:
# CFLAGS+= -g -DDEBUG=2
# DEBUG_FLAGS+= -g -DDEBUG=2 -fno-inline
WARNS?= 2
WFORMAT=0
.PATH: ${.CURDIR}/bltin \
${.CURDIR}/../../bin/test
${.CURDIR}/../test
CLEANFILES+= mkinit mkinit.o mknodes mknodes.o \
mksyntax mksyntax.o
@@ -62,4 +62,7 @@ syntax.c syntax.h: mksyntax
token.h: mktokens
sh ${.CURDIR}/mktokens
regress:
cd ${.CURDIR}/../../tools/regression/bin/sh && ${MAKE} SH=${.OBJDIR}/sh
.include <bsd.prog.mk>
+10 -10
View File
@@ -49,16 +49,16 @@ __FBSDID("$FreeBSD$");
#define ATABSIZE 39
STATIC struct alias *atab[ATABSIZE];
STATIC int aliases;
static struct alias *atab[ATABSIZE];
static int aliases;
STATIC void setalias(char *, char *);
STATIC int unalias(const char *);
STATIC struct alias **hashalias(const char *);
static void setalias(const char *, const char *);
static int unalias(const char *);
static struct alias **hashalias(const char *);
STATIC
static
void
setalias(char *name, char *val)
setalias(const char *name, const char *val)
{
struct alias *ap, **app;
@@ -111,7 +111,7 @@ setalias(char *name, char *val)
INTON;
}
STATIC int
static int
unalias(const char *name)
{
struct alias *ap, **app;
@@ -176,7 +176,7 @@ rmaliases(void)
}
struct alias *
lookupalias(char *name, int check)
lookupalias(const char *name, int check)
{
struct alias *ap = *hashalias(name);
@@ -276,7 +276,7 @@ unaliascmd(int argc __unused, char **argv __unused)
return (i);
}
STATIC struct alias **
static struct alias **
hashalias(const char *p)
{
unsigned int hashval;
+1 -1
View File
@@ -42,7 +42,7 @@ struct alias {
int flag;
};
struct alias *lookupalias(char *, int);
struct alias *lookupalias(const char *, int);
int aliascmd(int, char **);
int unaliascmd(int, char **);
void rmaliases(void);
+2 -2
View File
@@ -34,8 +34,8 @@
#define DIGITS(var) (3 + (2 + CHAR_BIT * sizeof((var))) / 3)
extern char *arith_buf, *arith_startbuf;
extern const char *arith_buf, *arith_startbuf;
arith_t arith(char *);
arith_t arith(const char *);
void arith_lex_reset(void);
int expcmd(int, char **);
+5 -5
View File
@@ -265,7 +265,7 @@ expr:
#define YYPARSE_PARAM_TYPE arith_t *
#define YYPARSE_PARAM result
char *arith_buf, *arith_startbuf;
const char *arith_buf, *arith_startbuf;
int yylex(void);
int yyparse(YYPARSE_PARAM_TYPE);
@@ -284,7 +284,7 @@ arith_assign(char *name, arith_t value)
}
arith_t
arith(char *s)
arith(const char *s)
{
arith_t result;
@@ -299,7 +299,7 @@ arith(char *s)
}
static void
yyerror(char *s)
yyerror(const char *s)
{
yyerrok;
@@ -314,7 +314,7 @@ yyerror(char *s)
int
expcmd(int argc, char **argv)
{
char *p;
const char *p;
char *concat;
char **ap;
arith_t i;
@@ -354,7 +354,7 @@ main(int argc, char *argv[])
printf("%d\n", exp(argv[1]));
}
error(char *s)
error(const char *s)
{
fprintf(stderr, "exp: %s\n", s);
exit(1);
-114
View File
@@ -1,114 +0,0 @@
.\"-
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Kenneth Almquist.
.\" Copyright 1989 by Kenneth Almquist
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)echo.1 8.2 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd May 4, 1995
.Dt ECHO 1
.Os
.Sh NAME
.Nm echo
.Nd produce message in a shell script
.Sh SYNOPSIS
.Nm
.Op Fl n | Fl e
.Ar args...
.Sh DESCRIPTION
The
.Nm
utility prints its arguments on the standard output, separated by spaces.
Unless the
.Fl n
option is present, a newline is output following the arguments.
The
.Fl e
option causes
.Nm
to treat the escape sequences specially, as described in the following
paragraph.
The
.Fl e
option is the default, and is provided solely for compatibility with
other systems.
Only one of the options
.Fl n
and
.Fl e
may be given.
.Pp
If any of the following sequences of characters is encountered during
output, the sequence is not output.
Instead, the specified action is
performed:
.Bl -tag -width indent
.It Li \eb
A backspace character is output.
.It Li \ec
Subsequent output is suppressed.
This is normally used at the end of the
last argument to suppress the trailing newline that
.Nm
would otherwise output.
.It Li \ef
Output a form feed.
.It Li \en
Output a newline character.
.It Li \er
Output a carriage return.
.It Li \et
Output a (horizontal) tab character.
.It Li \ev
Output a vertical tab.
.It Li \e0 Ns Ar digits
Output the character whose value is given by zero to three digits.
If there are zero digits, a
.Dv NUL
character is output.
.It Li \e\e
Output a backslash.
.El
.Sh HINTS
Remember that backslash is special to the shell and needs to be escaped.
To output a message to standard error, say
.Pp
.D1 echo message >&2
.Sh BUGS
The octal character escape mechanism
.Pq Li \e0 Ns Ar digits
differs from the
C language mechanism.
.Pp
There is no way to force
.Nm
to treat its arguments literally, rather than interpreting them as
options and escape sequences.
+19 -19
View File
@@ -64,23 +64,23 @@ __FBSDID("$FreeBSD$");
#include "show.h"
#include "cd.h"
STATIC int cdlogical(char *);
STATIC int cdphysical(char *);
STATIC int docd(char *, int, int);
STATIC char *getcomponent(void);
STATIC char *findcwd(char *);
STATIC void updatepwd(char *);
STATIC char *getpwd2(void);
static int cdlogical(char *);
static int cdphysical(char *);
static int docd(char *, int, int);
static char *getcomponent(void);
static char *findcwd(char *);
static void updatepwd(char *);
static char *getpwd2(void);
STATIC char *curdir = NULL; /* current working directory */
STATIC char *prevdir; /* previous working directory */
STATIC char *cdcomppath;
static char *curdir = NULL; /* current working directory */
static char *prevdir; /* previous working directory */
static char *cdcomppath;
int
cdcmd(int argc, char **argv)
{
char *dest;
char *path;
const char *dest;
const char *path;
char *p;
struct stat statb;
int ch, phys, print = 0;
@@ -144,7 +144,7 @@ cdcmd(int argc, char **argv)
* Actually change the directory. In an interactive shell, print the
* directory name if "print" is nonzero.
*/
STATIC int
static int
docd(char *dest, int print, int phys)
{
@@ -160,7 +160,7 @@ docd(char *dest, int print, int phys)
return 0;
}
STATIC int
static int
cdlogical(char *dest)
{
char *p;
@@ -212,7 +212,7 @@ cdlogical(char *dest)
return (0);
}
STATIC int
static int
cdphysical(char *dest)
{
char *p;
@@ -231,7 +231,7 @@ cdphysical(char *dest)
* Get the next component of the path name pointed to by cdcomppath.
* This routine overwrites the string pointed to by cdcomppath.
*/
STATIC char *
static char *
getcomponent(void)
{
char *p;
@@ -252,7 +252,7 @@ getcomponent(void)
}
STATIC char *
static char *
findcwd(char *dir)
{
char *new;
@@ -295,7 +295,7 @@ findcwd(char *dir)
* cd command. We also call hashcd to let the routines in exec.c know
* that the current directory has changed.
*/
STATIC void
static void
updatepwd(char *dir)
{
hashcd(); /* update command hash table */
@@ -371,7 +371,7 @@ getpwd(void)
/*
* Return the current directory.
*/
STATIC char *
static char *
getpwd2(void)
{
struct stat stdot, stpwd;
+4 -4
View File
@@ -67,7 +67,7 @@ volatile sig_atomic_t intpending;
char *commandname;
static void exverror(int, const char *, va_list) __printf0like(2, 0);
static void exverror(int, const char *, va_list) __printf0like(2, 0) __dead2;
/*
* Called to raise an exception. Since C doesn't include exceptions, we
@@ -98,7 +98,7 @@ exraise(int e)
void
onint(void)
{
sigset_t sigset;
sigset_t sigs;
/*
* The !in_dotrap here is safe. The only way we can arrive here
@@ -111,8 +111,8 @@ onint(void)
return;
}
intpending = 0;
sigemptyset(&sigset);
sigprocmask(SIG_SETMASK, &sigset, NULL);
sigemptyset(&sigs);
sigprocmask(SIG_SETMASK, &sigs, NULL);
/*
* This doesn't seem to be needed, since main() emits a newline.
+3 -3
View File
@@ -76,10 +76,10 @@ extern volatile sig_atomic_t intpending;
#define CLEAR_PENDING_INT intpending = 0
#define int_pending() intpending
void exraise(int);
void exraise(int) __dead2;
void onint(void);
void error(const char *, ...) __printf0like(1, 2);
void exerror(int, const char *, ...) __printf0like(2, 3);
void error(const char *, ...) __printf0like(1, 2) __dead2;
void exerror(int, const char *, ...) __printf0like(2, 3) __dead2;
/*
+23 -24
View File
@@ -74,11 +74,11 @@ __FBSDID("$FreeBSD$");
#endif
MKINIT int evalskip; /* set if we are skipping commands */
STATIC int skipcount; /* number of levels to skip */
int evalskip; /* set if we are skipping commands */
static int skipcount; /* number of levels to skip */
MKINIT int loopnest; /* current loop nesting level */
int funcnest; /* depth of function calls */
STATIC int builtin_flags; /* evalcommand flags for builtins */
static int builtin_flags; /* evalcommand flags for builtins */
char *commandname;
@@ -87,14 +87,14 @@ int exitstatus; /* exit status of last command */
int oexitstatus; /* saved exit status */
STATIC void evalloop(union node *, int);
STATIC void evalfor(union node *, int);
STATIC void evalcase(union node *, int);
STATIC void evalsubshell(union node *, int);
STATIC void expredir(union node *);
STATIC void evalpipe(union node *);
STATIC void evalcommand(union node *, int, struct backcmd *);
STATIC void prehash(union node *);
static void evalloop(union node *, int);
static void evalfor(union node *, int);
static void evalcase(union node *, int);
static void evalsubshell(union node *, int);
static void expredir(union node *);
static void evalpipe(union node *);
static void evalcommand(union node *, int, struct backcmd *);
static void prehash(union node *);
/*
@@ -285,7 +285,7 @@ out:
}
STATIC void
static void
evalloop(union node *n, int flags)
{
int status;
@@ -321,7 +321,7 @@ skipping: if (evalskip == SKIPCONT && --skipcount <= 0) {
STATIC void
static void
evalfor(union node *n, int flags)
{
struct arglist arglist;
@@ -361,7 +361,7 @@ out:
STATIC void
static void
evalcase(union node *n, int flags)
{
union node *cp;
@@ -394,7 +394,7 @@ out:
* Kick off a subshell to evaluate a tree.
*/
STATIC void
static void
evalsubshell(union node *n, int flags)
{
struct job *jp;
@@ -407,8 +407,7 @@ evalsubshell(union node *n, int flags)
flags &=~ EV_TESTED;
redirect(n->nredir.redirect, 0);
evaltree(n->nredir.n, flags | EV_EXIT); /* never returns */
}
if (! backgnd) {
} else if (! backgnd) {
INTOFF;
exitstatus = waitforjob(jp, (int *)NULL);
INTON;
@@ -421,7 +420,7 @@ evalsubshell(union node *n, int flags)
* Compute the names of the files in a redirection list.
*/
STATIC void
static void
expredir(union node *n)
{
union node *redir;
@@ -459,7 +458,7 @@ expredir(union node *n)
* of all the rest.)
*/
STATIC void
static void
evalpipe(union node *n)
{
struct job *jp;
@@ -572,7 +571,7 @@ out:
* Execute a simple command.
*/
STATIC void
static void
evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
{
struct stackmark smark;
@@ -852,7 +851,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
listsetvar(cmdenviron);
commandname = argv[0];
argptr = argv + 1;
optptr = NULL; /* initialize nextopt */
nextopt_optptr = NULL; /* initialize nextopt */
builtin_flags = flags;
exitstatus = (*builtinfunc[cmdentry.u.index])(argc, argv);
flushall();
@@ -896,7 +895,7 @@ cmddone:
goto out;
parent: /* parent process gets here (if we forked) */
if (mode == 0) { /* argument to fork */
if (mode == FORK_FG) { /* argument to fork */
INTOFF;
exitstatus = waitforjob(jp, &realstatus);
INTON;
@@ -904,7 +903,7 @@ parent: /* parent process gets here (if we forked) */
evalskip = SKIPBREAK;
skipcount = loopnest;
}
} else if (mode == 2) {
} else if (mode == FORK_NOJOB) {
backcmd->fd = pip[0];
close(pip[1]);
backcmd->jp = jp;
@@ -927,7 +926,7 @@ out:
* check that the name will not be subject to expansion.
*/
STATIC void
static void
prehash(union node *n)
{
struct cmdentry entry;
+1
View File
@@ -35,6 +35,7 @@
extern char *commandname; /* currently executing command */
extern int exitstatus; /* exit status of last command */
extern int oexitstatus; /* saved exit status */
extern struct strlist *cmdenviron; /* environment for builtin command */
+48 -47
View File
@@ -91,15 +91,15 @@ struct tblentry {
};
STATIC struct tblentry *cmdtable[CMDTABLESIZE];
STATIC int builtinloc = -1; /* index in path of %builtin, or -1 */
static struct tblentry *cmdtable[CMDTABLESIZE];
static int builtinloc = -1; /* index in path of %builtin, or -1 */
int exerrno = 0; /* Last exec error */
STATIC void tryexec(char *, char **, char **);
STATIC void printentry(struct tblentry *, int);
STATIC struct tblentry *cmdlookup(char *, int);
STATIC void delete_cmd_entry(void);
static void tryexec(char *, char **, char **);
static void printentry(struct tblentry *, int);
static struct tblentry *cmdlookup(const char *, int);
static void delete_cmd_entry(void);
@@ -109,7 +109,7 @@ STATIC void delete_cmd_entry(void);
*/
void
shellexec(char **argv, char **envp, char *path, int index)
shellexec(char **argv, char **envp, const char *path, int idx)
{
char *cmdname;
int e;
@@ -120,7 +120,7 @@ shellexec(char **argv, char **envp, char *path, int index)
} else {
e = ENOENT;
while ((cmdname = padvance(&path, argv[0])) != NULL) {
if (--index < 0 && pathopt == NULL) {
if (--idx < 0 && pathopt == NULL) {
tryexec(cmdname, argv, envp);
if (errno != ENOENT && errno != ENOTDIR)
e = errno;
@@ -147,7 +147,7 @@ shellexec(char **argv, char **envp, char *path, int index)
}
STATIC void
static void
tryexec(char *cmd, char **argv, char **envp)
{
int e;
@@ -175,13 +175,13 @@ tryexec(char *cmd, char **argv, char **envp)
* NULL.
*/
char *pathopt;
const char *pathopt;
char *
padvance(char **path, char *name)
padvance(const char **path, const char *name)
{
char *p, *q;
char *start;
const char *p, *start;
char *q;
int len;
if (*path == NULL)
@@ -265,20 +265,20 @@ hashcmd(int argc __unused, char **argv __unused)
}
STATIC void
static void
printentry(struct tblentry *cmdp, int verbose)
{
int index;
char *path;
int idx;
const char *path;
char *name;
if (cmdp->cmdtype == CMDNORMAL) {
index = cmdp->param.index;
idx = cmdp->param.index;
path = pathval();
do {
name = padvance(&path, cmdp->cmdname);
stunalloc(name);
} while (--index >= 0);
} while (--idx >= 0);
out1str(name);
} else if (cmdp->cmdtype == CMDBUILTIN) {
out1fmt("builtin %s", cmdp->cmdname);
@@ -310,10 +310,11 @@ printentry(struct tblentry *cmdp, int verbose)
*/
void
find_command(char *name, struct cmdentry *entry, int printerr, char *path)
find_command(const char *name, struct cmdentry *entry, int printerr,
const char *path)
{
struct tblentry *cmdp;
int index;
int idx;
int prev;
char *fullname;
struct stat statb;
@@ -353,11 +354,11 @@ find_command(char *name, struct cmdentry *entry, int printerr, char *path)
}
e = ENOENT;
index = -1;
idx = -1;
loop:
while ((fullname = padvance(&path, name)) != NULL) {
stunalloc(fullname);
index++;
idx++;
if (pathopt) {
if (prefix("builtin", pathopt)) {
if ((i = find_builtin(name, &spec)) < 0)
@@ -376,8 +377,8 @@ loop:
}
}
/* if rehash, don't redo absolute path names */
if (fullname[0] == '/' && index <= prev) {
if (index < prev)
if (fullname[0] == '/' && idx <= prev) {
if (idx < prev)
goto loop;
TRACE(("searchexec \"%s\": no change\n", name));
goto success;
@@ -414,7 +415,7 @@ loop:
INTOFF;
cmdp = cmdlookup(name, 1);
cmdp->cmdtype = CMDNORMAL;
cmdp->param.index = index;
cmdp->param.index = idx;
INTON;
goto success;
}
@@ -445,7 +446,7 @@ success:
*/
int
find_builtin(char *name, int *special)
find_builtin(const char *name, int *special)
{
const struct builtincmd *bp;
@@ -492,18 +493,18 @@ void
changepath(const char *newval)
{
const char *old, *new;
int index;
int idx;
int firstchange;
int bltin;
old = pathval();
new = newval;
firstchange = 9999; /* assume no change */
index = 0;
idx = 0;
bltin = -1;
for (;;) {
if (*old != *new) {
firstchange = index;
firstchange = idx;
if ((*old == '\0' && *new == ':')
|| (*old == ':' && *new == '\0'))
firstchange++;
@@ -512,9 +513,9 @@ changepath(const char *newval)
if (*new == '\0')
break;
if (*new == '%' && bltin < 0 && prefix("builtin", new + 1))
bltin = index;
bltin = idx;
if (*new == ':') {
index++;
idx++;
}
new++, old++;
}
@@ -603,14 +604,14 @@ deletefuncs(void)
* entry.
*/
STATIC struct tblentry **lastcmdentry;
static struct tblentry **lastcmdentry;
STATIC struct tblentry *
cmdlookup(char *name, int add)
static struct tblentry *
cmdlookup(const char *name, int add)
{
int hashval;
char *p;
const char *p;
struct tblentry *cmdp;
struct tblentry **pp;
@@ -643,7 +644,7 @@ cmdlookup(char *name, int add)
* Delete the command entry returned on the last lookup.
*/
STATIC void
static void
delete_cmd_entry(void)
{
struct tblentry *cmdp;
@@ -663,7 +664,7 @@ delete_cmd_entry(void)
*/
void
addcmdentry(char *name, struct cmdentry *entry)
addcmdentry(const char *name, struct cmdentry *entry)
{
struct tblentry *cmdp;
@@ -683,7 +684,7 @@ addcmdentry(char *name, struct cmdentry *entry)
*/
void
defun(char *name, union node *func)
defun(const char *name, union node *func)
{
struct cmdentry entry;
@@ -700,7 +701,7 @@ defun(char *name, union node *func)
*/
int
unsetfunc(char *name)
unsetfunc(const char *name)
{
struct tblentry *cmdp;
@@ -722,15 +723,14 @@ typecmd_impl(int argc, char **argv, int cmd)
{
struct cmdentry entry;
struct tblentry *cmdp;
char **pp;
const char *const *pp;
struct alias *ap;
int i;
int error = 0;
extern char *const parsekwd[];
int error1 = 0;
for (i = 1; i < argc; i++) {
/* First look at the keywords */
for (pp = (char **)parsekwd; *pp; pp++)
for (pp = parsekwd; *pp; pp++)
if (**pp == *argv[i] && equal(*pp, argv[i]))
break;
@@ -766,7 +766,8 @@ typecmd_impl(int argc, char **argv, int cmd)
switch (entry.cmdtype) {
case CMDNORMAL: {
if (strchr(argv[i], '/') == NULL) {
char *path = pathval(), *name;
const char *path = pathval();
char *name;
int j = entry.u.index;
do {
name = padvance(&path, argv[i]);
@@ -790,7 +791,7 @@ typecmd_impl(int argc, char **argv, int cmd)
if (cmd != TYPECMD_SMALLV)
outfmt(out2, "%s: %s\n",
argv[i], strerror(errno));
error |= 127;
error1 |= 127;
}
}
break;
@@ -815,11 +816,11 @@ typecmd_impl(int argc, char **argv, int cmd)
default:
if (cmd != TYPECMD_SMALLV)
outfmt(out2, "%s: not found\n", argv[i]);
error |= 127;
error1 |= 127;
break;
}
}
return error;
return error1;
}
/*
+8 -8
View File
@@ -57,20 +57,20 @@ struct cmdentry {
};
extern char *pathopt; /* set by padvance */
extern const char *pathopt; /* set by padvance */
extern int exerrno; /* last exec error */
void shellexec(char **, char **, char *, int);
char *padvance(char **, char *);
void shellexec(char **, char **, const char *, int) __dead2;
char *padvance(const char **, const char *);
int hashcmd(int, char **);
void find_command(char *, struct cmdentry *, int, char *);
int find_builtin(char *, int *);
void find_command(const char *, struct cmdentry *, int, const char *);
int find_builtin(const char *, int *);
void hashcd(void);
void changepath(const char *);
void deletefuncs(void);
void addcmdentry(char *, struct cmdentry *);
void defun(char *, union node *);
int unsetfunc(char *);
void addcmdentry(const char *, struct cmdentry *);
void defun(const char *, union node *);
int unsetfunc(const char *);
int typecmd_impl(int, char **, int);
int typecmd(int, char **);
void clearcmdentry(int);
+106 -91
View File
@@ -43,14 +43,15 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <errno.h>
#include <dirent.h>
#include <unistd.h>
#include <pwd.h>
#include <stdlib.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/*
* Routines to expand arguments to commands. We have to deal with
@@ -88,32 +89,32 @@ struct ifsregion {
};
STATIC char *expdest; /* output of current string */
STATIC struct nodelist *argbackq; /* list of back quote expressions */
STATIC struct ifsregion ifsfirst; /* first struct in list of ifs regions */
STATIC struct ifsregion *ifslastp; /* last struct in list */
STATIC struct arglist exparg; /* holds expanded arg list */
static char *expdest; /* output of current string */
static struct nodelist *argbackq; /* list of back quote expressions */
static struct ifsregion ifsfirst; /* first struct in list of ifs regions */
static struct ifsregion *ifslastp; /* last struct in list */
static struct arglist exparg; /* holds expanded arg list */
STATIC void argstr(char *, int);
STATIC char *exptilde(char *, int);
STATIC void expbackq(union node *, int, int);
STATIC int subevalvar(char *, char *, int, int, int, int);
STATIC char *evalvar(char *, int);
STATIC int varisset(char *, int);
STATIC void varvalue(char *, int, int, int);
STATIC void recordregion(int, int, int);
STATIC void removerecordregions(int);
STATIC void ifsbreakup(char *, struct arglist *);
STATIC void expandmeta(struct strlist *, int);
STATIC void expmeta(char *, char *);
STATIC void addfname(char *);
STATIC struct strlist *expsort(struct strlist *);
STATIC struct strlist *msort(struct strlist *, int);
STATIC int pmatch(char *, char *, int);
STATIC char *cvtnum(int, char *);
STATIC int collate_range_cmp(int, int);
static void argstr(char *, int);
static char *exptilde(char *, int);
static void expbackq(union node *, int, int);
static int subevalvar(char *, char *, int, int, int, int);
static char *evalvar(char *, int);
static int varisset(char *, int);
static void varvalue(char *, int, int, int);
static void recordregion(int, int, int);
static void removerecordregions(int);
static void ifsbreakup(char *, struct arglist *);
static void expandmeta(struct strlist *, int);
static void expmeta(char *, char *);
static void addfname(char *);
static struct strlist *expsort(struct strlist *);
static struct strlist *msort(struct strlist *, int);
static int pmatch(const char *, const char *, int);
static char *cvtnum(int, char *);
static int collate_range_cmp(int, int);
STATIC int
static int
collate_range_cmp(int c1, int c2)
{
static char s1[2], s2[2];
@@ -139,12 +140,18 @@ expandhere(union node *arg, int fd)
/*
* Perform variable substitution and command substitution on an argument,
* placing the resulting list of arguments in arglist. If EXP_FULL is true,
* perform splitting and file name expansion. When arglist is NULL, perform
* here document expansion.
* Perform expansions on an argument, placing the resulting list of arguments
* in arglist. Parameter expansion, command substitution and arithmetic
* expansion are always performed; additional expansions can be requested
* via flag (EXP_*).
* The result is left in the stack string.
* When arglist is NULL, perform here document expansion. A partial result
* may be written to herefd, which is then not included in the stack string.
*
* Caution: this function uses global state and is not reentrant.
* However, a new invocation after an interrupted invocation is safe
* and will reset the global state for the new call.
*/
void
expandarg(union node *arg, struct arglist *arglist, int flag)
{
@@ -196,12 +203,15 @@ expandarg(union node *arg, struct arglist *arglist, int flag)
/*
* Perform variable and command substitution. If EXP_FULL is set, output CTLESC
* characters to allow for further processing. Otherwise treat
* $@ like $* since no splitting will be performed.
* Perform parameter expansion, command substitution and arithmetic
* expansion, and tilde expansion if requested via EXP_TILDE/EXP_VARTILDE.
* Processing ends at a CTLENDVAR character as well as '\0'.
* This is used to expand word in ${var+word} etc.
* If EXP_FULL, EXP_CASE or EXP_REDIR are set, keep and/or generate CTLESC
* characters to allow for further processing.
* If EXP_FULL is set, also preserve CTLQUOTEMARK characters.
*/
STATIC void
static void
argstr(char *p, int flag)
{
char c;
@@ -213,7 +223,7 @@ argstr(char *p, int flag)
for (;;) {
switch (c = *p++) {
case '\0':
case CTLENDVAR: /* ??? */
case CTLENDVAR:
goto breakloop;
case CTLQUOTEMARK:
/* "$@" syntax adherence hack */
@@ -263,7 +273,11 @@ argstr(char *p, int flag)
breakloop:;
}
STATIC char *
/*
* Perform tilde expansion, placing the result in the stack string and
* returning the next position in the input string to process.
*/
static char *
exptilde(char *p, int flag)
{
char c, *startp = p;
@@ -311,7 +325,7 @@ lose:
}
STATIC void
static void
removerecordregions(int endoff)
{
if (ifslastp == NULL)
@@ -363,12 +377,11 @@ expari(int flag)
int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
int quoted;
/*
* This routine is slightly over-complicated for
* efficiency. First we make sure there is
* enough space for the result, which may be bigger
* than the expression if we add exponentiation. Next we
* than the expression. Next we
* scan backwards looking for the start of arithmetic. If the
* next previous character is a CTLESC character, then we
* have to rescan starting from the beginning since CTLESC
@@ -407,10 +420,9 @@ expari(int flag)
/*
* Expand stuff in backwards quotes.
* Perform command substitution.
*/
STATIC void
static void
expbackq(union node *cmd, int quoted, int flag)
{
struct backcmd in;
@@ -480,9 +492,9 @@ expbackq(union node *cmd, int quoted, int flag)
exitstatus = waitforjob(in.jp, (int *)NULL);
if (quoted == 0)
recordregion(startloc, dest - stackblock(), 0);
TRACE(("evalbackq: size=%d: \"%.*s\"\n",
(dest - stackblock()) - startloc,
(dest - stackblock()) - startloc,
TRACE(("expbackq: size=%td: \"%.*s\"\n",
((dest - stackblock()) - startloc),
(int)((dest - stackblock()) - startloc),
stackblock() + startloc));
expdest = dest;
INTON;
@@ -490,7 +502,7 @@ expbackq(union node *cmd, int quoted, int flag)
STATIC int
static int
subevalvar(char *p, char *str, int strloc, int subtype, int startloc,
int varflags)
{
@@ -616,7 +628,7 @@ recordleft:
* input string.
*/
STATIC char *
static char *
evalvar(char *p, int flag)
{
int subtype;
@@ -659,7 +671,7 @@ again: /* jump here after setting a variable with ${var=text} */
}
varlen = 0;
startloc = expdest - stackblock();
if (!set && uflag) {
if (!set && uflag && *var != '@' && *var != '*') {
switch (subtype) {
case VSNORMAL:
case VSTRIMLEFT:
@@ -804,7 +816,7 @@ record:
* Test whether a specialized variable is set.
*/
STATIC int
static int
varisset(char *name, int nulok)
{
@@ -846,13 +858,12 @@ varisset(char *name, int nulok)
* Add the value of a specialized variable to the stack string.
*/
STATIC void
static void
varvalue(char *name, int quoted, int subtype, int flag)
{
int num;
char *p;
int i;
extern int oexitstatus;
char sep;
char **ap;
char const *syntax;
@@ -937,7 +948,7 @@ numvar:
* string for IFS characters.
*/
STATIC void
static void
recordregion(int start, int end, int inquotes)
{
struct ifsregion *ifsp;
@@ -967,8 +978,14 @@ recordregion(int start, int end, int inquotes)
* Break the argument string into pieces based upon IFS and add the
* strings to the argument list. The regions of the string to be
* searched for IFS characters have been stored by recordregion.
* CTLESC characters are preserved but have little effect in this pass
* other than escaping CTL* characters. In particular, they do not escape
* IFS characters: that should be done with the ifsregion mechanism.
* CTLQUOTEMARK characters are used to preserve empty quoted strings.
* This pass treats them as a regular character, making the string non-empty.
* Later, they are removed along with the other CTL* characters.
*/
STATIC void
static void
ifsbreakup(char *string, struct arglist *arglist)
{
struct ifsregion *ifsp;
@@ -976,7 +993,7 @@ ifsbreakup(char *string, struct arglist *arglist)
char *start;
char *p;
char *q;
char *ifs;
const char *ifs;
const char *ifsspc;
int had_param_ch = 0;
@@ -1068,16 +1085,15 @@ ifsbreakup(char *string, struct arglist *arglist)
}
static char expdir[PATH_MAX];
#define expdir_end (expdir + sizeof(expdir))
/*
* Expand shell metacharacters. At this point, the only control characters
* should be escapes. The results are stored in the list exparg.
* Perform pathname generation and remove control characters.
* At this point, the only control characters should be CTLESC and CTLQUOTEMARK.
* The results are stored in the list exparg.
*/
STATIC char *expdir;
STATIC void
static void
expandmeta(struct strlist *str, int flag __unused)
{
char *p;
@@ -1098,14 +1114,7 @@ expandmeta(struct strlist *str, int flag __unused)
}
savelastp = exparg.lastp;
INTOFF;
if (expdir == NULL) {
int i = strlen(str->text);
expdir = ckmalloc(i < 2048 ? 2048 : i); /* XXX */
}
expmeta(expdir, str->text);
ckfree(expdir);
expdir = NULL;
INTON;
if (exparg.lastp == savelastp) {
/*
@@ -1131,7 +1140,7 @@ nometa:
* Do metacharacter (i.e. *, ?, [...]) expansion.
*/
STATIC void
static void
expmeta(char *enddir, char *name)
{
char *p;
@@ -1194,6 +1203,8 @@ expmeta(char *enddir, char *name)
*enddir++ = *p;
if (*p == '\0')
break;
if (enddir == expdir_end)
return;
}
if (metaflag == 0 || lstat(expdir, &statb) >= 0)
addfname(expdir);
@@ -1208,6 +1219,8 @@ expmeta(char *enddir, char *name)
if (*p == CTLESC)
p++;
*enddir++ = *p++;
if (enddir == expdir_end)
return;
}
}
if (enddir == expdir) {
@@ -1241,15 +1254,17 @@ expmeta(char *enddir, char *name)
if (dp->d_name[0] == '.' && ! matchdot)
continue;
if (patmatch(start, dp->d_name, 0)) {
if (atend) {
scopy(dp->d_name, enddir);
if (enddir + dp->d_namlen + 1 > expdir_end)
continue;
memcpy(enddir, dp->d_name, dp->d_namlen + 1);
if (atend)
addfname(expdir);
} else {
for (p = enddir, q = dp->d_name;
(*p++ = *q++) != '\0';)
else {
if (enddir + dp->d_namlen + 2 > expdir_end)
continue;
p[-1] = '/';
expmeta(p, endname);
enddir[dp->d_namlen] = '/';
enddir[dp->d_namlen + 1] = '\0';
expmeta(enddir + dp->d_namlen + 1, endname);
}
}
}
@@ -1263,7 +1278,7 @@ expmeta(char *enddir, char *name)
* Add a file name to the list.
*/
STATIC void
static void
addfname(char *name)
{
char *p;
@@ -1284,7 +1299,7 @@ addfname(char *name)
* work.
*/
STATIC struct strlist *
static struct strlist *
expsort(struct strlist *str)
{
int len;
@@ -1297,7 +1312,7 @@ expsort(struct strlist *str)
}
STATIC struct strlist *
static struct strlist *
msort(struct strlist *list, int len)
{
struct strlist *p, *q = NULL;
@@ -1344,7 +1359,7 @@ msort(struct strlist *list, int len)
*/
int
patmatch(char *pattern, char *string, int squoted)
patmatch(const char *pattern, const char *string, int squoted)
{
#ifdef notdef
if (pattern[0] == '!' && pattern[1] == '!')
@@ -1355,10 +1370,10 @@ patmatch(char *pattern, char *string, int squoted)
}
STATIC int
pmatch(char *pattern, char *string, int squoted)
static int
pmatch(const char *pattern, const char *string, int squoted)
{
char *p, *q;
const char *p, *q;
char c;
p = pattern;
@@ -1406,7 +1421,7 @@ pmatch(char *pattern, char *string, int squoted)
} while (*q++ != '\0');
return 0;
case '[': {
char *endp;
const char *endp;
int invert, found;
char chr;
@@ -1477,7 +1492,7 @@ breakloop:
/*
* Remove any CTLESC characters from a string.
* Remove any CTLESC and CTLQUOTEMARK characters from a string.
*/
void
@@ -1510,7 +1525,7 @@ rmescapes(char *str)
*/
int
casematch(union node *pattern, char *val)
casematch(union node *pattern, const char *val)
{
struct stackmark smark;
int result;
@@ -1532,7 +1547,7 @@ casematch(union node *pattern, char *val)
* Our own itoa().
*/
STATIC char *
static char *
cvtnum(int num, char *buf)
{
char temp[32];
+2 -2
View File
@@ -58,7 +58,7 @@ union node;
void expandhere(union node *, int);
void expandarg(union node *, struct arglist *, int);
void expari(int);
int patmatch(char *, char *, int);
int patmatch(const char *, const char *, int);
void rmescapes(char *);
int casematch(union node *, char *);
int casematch(union node *, const char *);
int wordexpcmd(int, char **);
+11 -10
View File
@@ -68,7 +68,7 @@ EditLine *el; /* editline cookie */
int displayhist;
static FILE *el_in, *el_out, *el_err;
STATIC char *fc_replace(const char *, char *, char *);
static char *fc_replace(const char *, char *, char *);
/*
* Set history and editing status. Called whenever the status may
@@ -157,6 +157,7 @@ sethistsize(hs)
(histsize = atoi(hs)) < 0)
histsize = 100;
history(hist, &he, H_SETSIZE, histsize);
history(hist, &he, H_SETUNIQUE, 1);
}
}
@@ -164,19 +165,19 @@ int
histcmd(int argc, char **argv)
{
int ch;
char *editor = NULL;
const char *editor = NULL;
HistEvent he;
int lflg = 0, nflg = 0, rflg = 0, sflg = 0;
int i, retval;
char *firststr, *laststr;
const char *firststr, *laststr;
int first, last, direction;
char *pat = NULL, *repl;
char *pat = NULL, *repl = NULL;
static int active = 0;
struct jmploc jmploc;
struct jmploc *savehandler;
char editfilestr[PATH_MAX];
char *volatile editfile;
FILE *efp;
FILE *efp = NULL;
int oldhistnum;
if (hist == NULL)
@@ -382,7 +383,7 @@ histcmd(int argc, char **argv)
return 0;
}
STATIC char *
static char *
fc_replace(const char *s, char *p, char *r)
{
char *dest;
@@ -398,14 +399,14 @@ fc_replace(const char *s, char *p, char *r)
} else
STPUTC(*s++, dest);
}
STACKSTRNUL(dest);
STPUTC('\0', dest);
dest = grabstackstr(dest);
return (dest);
}
int
not_fcnumber(char *s)
not_fcnumber(const char *s)
{
if (s == NULL)
return (0);
@@ -415,10 +416,10 @@ not_fcnumber(char *s)
}
int
str_to_event(char *str, int last)
str_to_event(const char *str, int last)
{
HistEvent he;
char *s = str;
const char *s = str;
int relative = 0;
int i, retval;
+7 -7
View File
@@ -93,27 +93,27 @@ struct parsefile {
int plinno = 1; /* input line number */
MKINIT int parsenleft; /* copy of parsefile->nleft */
int parsenleft; /* copy of parsefile->nleft */
MKINIT int parselleft; /* copy of parsefile->lleft */
char *parsenextc; /* copy of parsefile->nextc */
MKINIT struct parsefile basepf; /* top level input file */
char basebuf[BUFSIZ]; /* buffer for top level input file */
STATIC struct parsefile *parsefile = &basepf; /* current input file */
static struct parsefile *parsefile = &basepf; /* current input file */
int init_editline = 0; /* editline library initialized? */
int whichprompt; /* 1 == PS1, 2 == PS2 */
EditLine *el; /* cookie for editline package */
STATIC void pushfile(void);
static void pushfile(void);
static int preadfd(void);
#ifdef mkinit
INCLUDE "input.h"
INCLUDE "error.h"
INIT {
extern char basebuf[];
MKINIT char basebuf[];
INIT {
basepf.nextc = basepf.buf = basebuf;
}
@@ -401,7 +401,7 @@ popstring(void)
*/
void
setinputfile(char *fname, int push)
setinputfile(const char *fname, int push)
{
int fd;
int fd2;
@@ -468,7 +468,7 @@ setinputstring(char *string, int push)
* adds a new entry to the stack and popfile restores the previous level.
*/
STATIC void
static void
pushfile(void)
{
struct parsefile *pf;
+1 -1
View File
@@ -52,7 +52,7 @@ int preadateof(void);
void pungetc(void);
void pushstring(char *, int, void *);
void popstring(void);
void setinputfile(char *, int);
void setinputfile(const char *, int);
void setinputfd(int, int);
void setinputstring(char *, int);
void popfile(void);
+53 -46
View File
@@ -38,18 +38,18 @@ static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include <paths.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/param.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <paths.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
#include <signal.h>
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
#include "shell.h"
#if JOBS
@@ -72,12 +72,12 @@ __FBSDID("$FreeBSD$");
#include "mystring.h"
STATIC struct job *jobtab; /* array of jobs */
STATIC int njobs; /* size of array */
static struct job *jobtab; /* array of jobs */
static int njobs; /* size of array */
MKINIT pid_t backgndpid = -1; /* pid of last background process */
#if JOBS
STATIC struct job *jobmru; /* most recently used job list */
STATIC pid_t initialpgrp; /* pgrp of shell on invocation */
static struct job *jobmru; /* most recently used job list */
static pid_t initialpgrp; /* pgrp of shell on invocation */
#endif
int in_waitcmd = 0; /* are we in waitcmd()? */
int in_dowait = 0; /* are we in dowait()? */
@@ -85,20 +85,20 @@ volatile sig_atomic_t breakwaitcmd = 0; /* should wait be terminated? */
static int ttyfd = -1;
#if JOBS
STATIC void restartjob(struct job *);
static void restartjob(struct job *);
#endif
STATIC void freejob(struct job *);
STATIC struct job *getjob(char *);
STATIC pid_t dowait(int, struct job *);
STATIC pid_t waitproc(int, int *);
STATIC void cmdtxt(union node *);
STATIC void cmdputs(char *);
static void freejob(struct job *);
static struct job *getjob(char *);
static pid_t dowait(int, struct job *);
static pid_t waitproc(int, int *);
static void cmdtxt(union node *);
static void cmdputs(const char *);
#if JOBS
STATIC void setcurjob(struct job *);
STATIC void deljob(struct job *);
STATIC struct job *getcurjob(struct job *);
static void setcurjob(struct job *);
static void deljob(struct job *);
static struct job *getcurjob(struct job *);
#endif
STATIC void showjob(struct job *, pid_t, int);
static void showjob(struct job *, pid_t, int);
/*
@@ -239,7 +239,7 @@ bgcmd(int argc, char **argv)
}
STATIC void
static void
restartjob(struct job *jp)
{
struct procstat *ps;
@@ -298,7 +298,7 @@ jobscmd(int argc, char *argv[])
return (0);
}
STATIC void
static void
showjob(struct job *jp, pid_t pid, int mode)
{
char s[64];
@@ -423,7 +423,7 @@ showjobs(int change, int mode)
* Mark a job structure as unused.
*/
STATIC void
static void
freejob(struct job *jp)
{
struct procstat *ps;
@@ -519,7 +519,7 @@ jobidcmd(int argc __unused, char **argv)
* Convert a job name to a job structure.
*/
STATIC struct job *
static struct job *
getjob(char *name)
{
int jobno;
@@ -653,13 +653,13 @@ makejob(union node *node __unused, int nprocs)
jp->ps = &jp->ps0;
}
INTON;
TRACE(("makejob(%p, %d) returns %%%d\n", (void *)node, nprocs,
TRACE(("makejob(%p, %d) returns %%%td\n", (void *)node, nprocs,
jp - jobtab + 1));
return jp;
}
#if JOBS
STATIC void
static void
setcurjob(struct job *cj)
{
struct job *jp, *prev;
@@ -679,7 +679,7 @@ setcurjob(struct job *cj)
jobmru = cj;
}
STATIC void
static void
deljob(struct job *j)
{
struct job *jp, *prev;
@@ -699,7 +699,7 @@ deljob(struct job *j)
* Return the most recently used job that isn't `nj', and preferably one
* that is stopped.
*/
STATIC struct job *
static struct job *
getcurjob(struct job *nj)
{
struct job *jp;
@@ -739,7 +739,7 @@ forkshell(struct job *jp, union node *n, int mode)
pid_t pid;
pid_t pgrp;
TRACE(("forkshell(%%%d, %p, %d) called\n", jp - jobtab, (void *)n,
TRACE(("forkshell(%%%td, %p, %d) called\n", jp - jobtab, (void *)n,
mode));
INTOFF;
flushall();
@@ -862,12 +862,13 @@ waitforjob(struct job *jp, int *origstatus)
{
#if JOBS
pid_t mypgrp = getpgrp();
int propagate_int = jp->jobctl && jp->foreground;
#endif
int status;
int st;
INTOFF;
TRACE(("waitforjob(%%%d) called\n", jp - jobtab + 1));
TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1));
while (jp->state == 0)
if (dowait(1, jp) == -1)
dotrap();
@@ -899,6 +900,11 @@ waitforjob(struct job *jp, int *origstatus)
else
CLEAR_PENDING_INT;
}
#if JOBS
else if (rootshell && iflag && propagate_int &&
WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
kill(getpid(), SIGINT);
#endif
INTON;
return st;
}
@@ -909,7 +915,7 @@ waitforjob(struct job *jp, int *origstatus)
* Wait for a process to terminate.
*/
STATIC pid_t
static pid_t
dowait(int block, struct job *job)
{
pid_t pid;
@@ -963,7 +969,7 @@ dowait(int block, struct job *job)
if (stopped) { /* stopped or done */
int state = done? JOBDONE : JOBSTOPPED;
if (jp->state != state) {
TRACE(("Job %d: changing state from %d to %d\n", jp - jobtab + 1, jp->state, state));
TRACE(("Job %td: changing state from %d to %d\n", jp - jobtab + 1, jp->state, state));
jp->state = state;
#if JOBS
if (done)
@@ -1015,7 +1021,7 @@ dowait(int block, struct job *job)
* stopped processes. If block is zero, we return a value of zero
* rather than blocking.
*/
STATIC pid_t
static pid_t
waitproc(int block, int *status)
{
int flags;
@@ -1060,8 +1066,8 @@ stoppedjobs(void)
* jobs command.
*/
STATIC char *cmdnextc;
STATIC int cmdnleft;
static char *cmdnextc;
static int cmdnleft;
#define MAXCMDTEXT 200
char *
@@ -1077,12 +1083,12 @@ commandtext(union node *n)
}
STATIC void
static void
cmdtxt(union node *n)
{
union node *np;
struct nodelist *lp;
char *p;
const char *p;
int i;
char s[2];
@@ -1210,10 +1216,11 @@ redir:
STATIC void
cmdputs(char *s)
static void
cmdputs(const char *s)
{
char *p, *q;
const char *p;
char *q;
char c;
int subtype = 0;
+3 -3
View File
@@ -57,8 +57,8 @@ __FBSDID("$FreeBSD$");
#define MAXMBOXES 10
STATIC int nmboxes; /* number of mailboxes */
STATIC time_t mailtime[MAXMBOXES]; /* times of mailboxes */
static int nmboxes; /* number of mailboxes */
static time_t mailtime[MAXMBOXES]; /* times of mailboxes */
@@ -72,7 +72,7 @@ void
chkmail(int silent)
{
int i;
char *mpath;
const char *mpath;
char *p;
char *q;
struct stackmark smark;
+7 -9
View File
@@ -76,8 +76,8 @@ __FBSDID("$FreeBSD$");
int rootpid;
int rootshell;
STATIC void read_profile(char *);
STATIC char *find_dot_file(char *);
static void read_profile(const char *);
static char *find_dot_file(char *);
/*
* Main routine. We initialize things, parse the arguments, execute
@@ -249,8 +249,8 @@ cmdloop(int top)
* Read /etc/profile or .profile. Return on error.
*/
STATIC void
read_profile(char *name)
static void
read_profile(const char *name)
{
int fd;
@@ -271,7 +271,7 @@ read_profile(char *name)
*/
void
readcmdfile(char *name)
readcmdfile(const char *name)
{
int fd;
@@ -293,12 +293,12 @@ readcmdfile(char *name)
*/
STATIC char *
static char *
find_dot_file(char *basename)
{
static char localname[FILENAME_MAX+1];
char *fullname;
char *path = pathval();
const char *path = pathval();
struct stat statb;
/* don't try this for absolute or relative paths */
@@ -336,8 +336,6 @@ dotcmd(int argc, char **argv)
int
exitcmd(int argc, char **argv)
{
extern int oexitstatus;
if (stoppedjobs())
return 0;
if (argc > 1)
+1 -1
View File
@@ -36,7 +36,7 @@
extern int rootpid; /* pid of main shell */
extern int rootshell; /* true if we aren't a child of the main shell */
void readcmdfile(char *);
void readcmdfile(const char *);
void cmdloop(int);
int dotcmd(int, char **);
int exitcmd(int, char **);
+13 -10
View File
@@ -95,7 +95,7 @@ ckfree(pointer p)
*/
char *
savestr(char *s)
savestr(const char *s)
{
char *p;
@@ -123,8 +123,8 @@ struct stack_block {
};
#define SPACE(sp) ((char*)(sp) + ALIGN(sizeof(struct stack_block)))
STATIC struct stack_block *stackp;
STATIC struct stackmark *markp;
static struct stack_block *stackp;
static struct stackmark *markp;
char *stacknxt;
int stacknleft;
int sstrnleft;
@@ -295,6 +295,13 @@ grabstackblock(int len)
* is space for at least one character.
*/
static char *
growstrstackblock(int n)
{
growstackblock();
sstrnleft = stackblocksize() - n;
return stackblock() + n;
}
char *
growstackstr(void)
@@ -304,12 +311,10 @@ growstackstr(void)
len = stackblocksize();
if (herefd >= 0 && len >= 1024) {
xwrite(herefd, stackblock(), len);
sstrnleft = len - 1;
sstrnleft = len;
return stackblock();
}
growstackblock();
sstrnleft = stackblocksize() - len - 1;
return stackblock() + len;
return growstrstackblock(len);
}
@@ -323,9 +328,7 @@ makestrspace(void)
int len;
len = stackblocksize() - sstrnleft;
growstackblock();
sstrnleft = stackblocksize() - len;
return stackblock() + len;
return growstrstackblock(len);
}
+9 -2
View File
@@ -51,7 +51,7 @@ extern int herefd;
pointer ckmalloc(size_t);
pointer ckrealloc(pointer, int);
void ckfree(pointer);
char *savestr(char *);
char *savestr(const char *);
pointer stalloc(int);
void stunalloc(pointer);
void setstackmark(struct stackmark *);
@@ -67,9 +67,16 @@ void ungrabstackstr(char *, char *);
#define stackblock() stacknxt
#define stackblocksize() stacknleft
#define STARTSTACKSTR(p) p = stackblock(), sstrnleft = stackblocksize()
#define STPUTC(c, p) (--sstrnleft >= 0? (*p++ = (c)) : (p = growstackstr(), *p++ = (c)))
#define STPUTC(c, p) (--sstrnleft >= 0? (*p++ = (c)) : (p = growstackstr(), --sstrnleft, *p++ = (c)))
#define CHECKSTRSPACE(n, p) { if (sstrnleft < n) p = makestrspace(); }
#define USTPUTC(c, p) (--sstrnleft, *p++ = (c))
/*
* STACKSTRNUL's use is where we want to be able to turn a stack
* (non-sentinel, character counting string) into a C string,
* and later pretend the NUL is not there.
* Note: Because of STACKSTRNUL's semantics, STACKSTRNUL cannot be used
* on a stack that will grabstackstr()ed.
*/
#define STACKSTRNUL(p) (sstrnleft == 0? (p = growstackstr(), *p = '\0') : (*p = '\0'))
#define STUNPUTC(p) (++sstrnleft, --p)
#define STTOPC(p) p[-1]
+3 -2
View File
@@ -93,7 +93,7 @@ readcmd(int argc __unused, char **argv __unused)
char c;
int rflag;
char *prompt;
char *ifs;
const char *ifs;
char *p;
int startword;
int status;
@@ -174,6 +174,7 @@ readcmd(int argc __unused, char **argv __unused)
continue;
if (backslash) {
backslash = 0;
startword = 0;
if (c != '\n')
STPUTC(c, p);
continue;
@@ -254,7 +255,7 @@ readcmd(int argc __unused, char **argv __unused)
int
umaskcmd(int argc __unused, char **argv)
umaskcmd(int argc __unused, char **argv __unused)
{
char *ap;
int mask;
+1 -1
View File
@@ -88,7 +88,7 @@ tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ < $temp |
awk '{ printf "#define %s %d\n", $1, NR-1}'
echo '
struct builtincmd {
char *name;
const char *name;
int code;
int special;
};
+26 -26
View File
@@ -102,9 +102,9 @@ struct block {
*/
struct event {
char *name; /* name of event (e.g. INIT) */
char *routine; /* name of routine called on event */
char *comment; /* comment describing routine */
const char *name; /* name of event (e.g. INIT) */
const char *routine; /* name of routine called on event */
const char *comment; /* comment describing routine */
struct text code; /* code for handling event */
};
@@ -140,7 +140,7 @@ struct event event[] = {
};
char *curfile; /* current file */
const char *curfile; /* current file */
int linno; /* current line */
char *header_files[200]; /* list of header files */
struct text defines; /* #define statements */
@@ -148,20 +148,20 @@ struct text decls; /* declarations */
int amiddecls; /* for formatting */
void readfile(char *);
int match(char *, char *);
int gooddefine(char *);
void doevent(struct event *, FILE *, char *);
void readfile(const char *);
int match(const char *, const char *);
int gooddefine(const char *);
void doevent(struct event *, FILE *, const char *);
void doinclude(char *);
void dodecl(char *, FILE *);
void output(void);
void addstr(char *, struct text *);
void addstr(const char *, struct text *);
void addchar(int, struct text *);
void writetext(struct text *, FILE *);
FILE *ckfopen(char *, char *);
FILE *ckfopen(const char *, const char *);
void *ckmalloc(size_t);
char *savestr(char *);
void error(char *);
char *savestr(const char *);
void error(const char *);
#define equal(s1, s2) (strcmp(s1, s2) == 0)
@@ -170,9 +170,9 @@ main(int argc __unused, char *argv[])
{
char **ap;
header_files[0] = "\"shell.h\"";
header_files[1] = "\"mystring.h\"";
header_files[2] = "\"init.h\"";
header_files[0] = savestr("\"shell.h\"");
header_files[1] = savestr("\"mystring.h\"");
header_files[2] = savestr("\"init.h\"");
for (ap = argv + 1 ; *ap ; ap++)
readfile(*ap);
output();
@@ -186,7 +186,7 @@ main(int argc __unused, char *argv[])
*/
void
readfile(char *fname)
readfile(const char *fname)
{
FILE *fp;
char line[1024];
@@ -230,9 +230,9 @@ readfile(char *fname)
int
match(char *name, char *line)
match(const char *name, const char *line)
{
char *p, *q;
const char *p, *q;
p = name, q = line;
while (*p) {
@@ -246,9 +246,9 @@ match(char *name, char *line)
int
gooddefine(char *line)
gooddefine(const char *line)
{
char *p;
const char *p;
if (! match("#define", line))
return 0; /* not a define */
@@ -269,11 +269,11 @@ gooddefine(char *line)
void
doevent(struct event *ep, FILE *fp, char *fname)
doevent(struct event *ep, FILE *fp, const char *fname)
{
char line[1024];
int indent;
char *p;
const char *p;
sprintf(line, "\n /* from %s: */\n", fname);
addstr(line, &ep->code);
@@ -407,7 +407,7 @@ output(void)
*/
void
addstr(char *s, struct text *text)
addstr(const char *s, struct text *text)
{
while (*s) {
if (--text->nleft < 0)
@@ -452,7 +452,7 @@ writetext(struct text *text, FILE *fp)
}
FILE *
ckfopen(char *file, char *mode)
ckfopen(const char *file, const char *mode)
{
FILE *fp;
@@ -474,7 +474,7 @@ ckmalloc(size_t nbytes)
}
char *
savestr(char *s)
savestr(const char *s)
{
char *p;
@@ -484,7 +484,7 @@ savestr(char *s)
}
void
error(char *msg)
error(const char *msg)
{
if (curfile != NULL)
fprintf(stderr, "%s:%d: ", curfile, linno);
+11 -11
View File
@@ -55,8 +55,8 @@ __FBSDID("$FreeBSD$");
struct synclass {
char *name;
char *comment;
const char *name;
const char *comment;
};
/* Syntax classes */
@@ -101,16 +101,16 @@ static char writer[] = "\
static FILE *cfile;
static FILE *hfile;
static char *syntax[513];
static const char *syntax[513];
static int base;
static int size; /* number of values which a char variable can have */
static int nbits; /* number of bits in a character */
static int digit_contig;/* true if digits are contiguous */
static void filltable(char *);
static void filltable(const char *);
static void init(void);
static void add(char *, char *);
static void print(char *);
static void add(const char *, const char *);
static void print(const char *);
static void output_type_macros(void);
static void digit_convert(void);
@@ -259,7 +259,7 @@ main(int argc __unused, char **argv __unused)
*/
static void
filltable(char *dftval)
filltable(const char *dftval)
{
int i;
@@ -293,7 +293,7 @@ init(void)
*/
static void
add(char *p, char *type)
add(const char *p, const char *type)
{
while (*p)
syntax[*p++ + base] = type;
@@ -306,7 +306,7 @@ add(char *p, char *type)
*/
static void
print(char *name)
print(const char *name)
{
int i;
int col;
@@ -338,7 +338,7 @@ print(char *name)
* contiguous, we can test for them quickly.
*/
static char *macro[] = {
static const char *macro[] = {
"#define is_digit(c)\t((is_type+SYNBASE)[c] & ISDIGIT)",
"#define is_eof(c)\t((c) == PEOF)",
"#define is_alpha(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && isalpha((unsigned char) (c)))",
@@ -351,7 +351,7 @@ static char *macro[] = {
static void
output_type_macros(void)
{
char **pp;
const char **pp;
if (digit_contig)
macro[0] = "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)";
+2 -2
View File
@@ -39,7 +39,7 @@ extern int displayhist;
void histedit(void);
void sethistsize(const char *);
int histcmd(int, char **);
int not_fcnumber(char *);
int str_to_event(char *, int);
int not_fcnumber(const char *);
int str_to_event(const char *, int);
int bindcmd(int, char **);
+1 -1
View File
@@ -108,7 +108,7 @@ int
number(const char *s)
{
if (! is_number(s))
error("Illegal number: %s", (char *)s);
error("Illegal number: %s", s);
return atoi(s);
}
+14 -14
View File
@@ -46,19 +46,19 @@
#include "mystring.h"
STATIC int funcblocksize; /* size of structures in function */
STATIC int funcstringsize; /* size of strings in node */
STATIC pointer funcblock; /* block to allocate function from */
STATIC char *funcstring; /* block to allocate strings from */
static int funcblocksize; /* size of structures in function */
static int funcstringsize; /* size of strings in node */
static pointer funcblock; /* block to allocate function from */
static char *funcstring; /* block to allocate strings from */
%SIZES
STATIC void calcsize(union node *);
STATIC void sizenodelist(struct nodelist *);
STATIC union node *copynode(union node *);
STATIC struct nodelist *copynodelist(struct nodelist *);
STATIC char *nodesavestr(char *);
static void calcsize(union node *);
static void sizenodelist(struct nodelist *);
static union node *copynode(union node *);
static struct nodelist *copynodelist(struct nodelist *);
static char *nodesavestr(char *);
struct funcdef {
@@ -96,7 +96,7 @@ getfuncnode(struct funcdef *fn)
}
STATIC void
static void
calcsize(union node *n)
{
%CALCSIZE
@@ -104,7 +104,7 @@ calcsize(union node *n)
STATIC void
static void
sizenodelist(struct nodelist *lp)
{
while (lp) {
@@ -116,7 +116,7 @@ sizenodelist(struct nodelist *lp)
STATIC union node *
static union node *
copynode(union node *n)
{
union node *new;
@@ -126,7 +126,7 @@ copynode(union node *n)
}
STATIC struct nodelist *
static struct nodelist *
copynodelist(struct nodelist *lp)
{
struct nodelist *start;
@@ -146,7 +146,7 @@ copynodelist(struct nodelist *lp)
STATIC char *
static char *
nodesavestr(char *s)
{
char *p = s;
+14 -13
View File
@@ -64,15 +64,15 @@ char *arg0; /* value of $0 */
struct shparam shellparam; /* current positional parameters */
char **argptr; /* argument list for builtin commands */
char *shoptarg; /* set by nextopt (like getopt) */
char *optptr; /* used by nextopt */
char *nextopt_optptr; /* used by nextopt */
char *minusc; /* argument to -c option */
STATIC void options(int);
STATIC void minus_o(char *, int);
STATIC void setoption(int, int);
STATIC int getopts(char *, char *, char **, char ***, char **);
static void options(int);
static void minus_o(char *, int);
static void setoption(int, int);
static int getopts(char *, char *, char **, char ***, char **);
/*
@@ -135,7 +135,7 @@ optschanged(void)
* to the argument list; we advance it past the options.
*/
STATIC void
static void
options(int cmdline)
{
char *kp, *p;
@@ -244,7 +244,7 @@ end_options2:
}
}
STATIC void
static void
minus_o(char *name, int val)
{
int i;
@@ -281,7 +281,7 @@ minus_o(char *name, int val)
}
STATIC void
static void
setoption(int flag, int val)
{
int i;
@@ -448,7 +448,7 @@ getoptscmd(int argc, char **argv)
&shellparam.optptr);
}
STATIC int
static int
getopts(char *optstr, char *optvar, char **optfirst, char ***optnext,
char **optptr)
{
@@ -554,12 +554,13 @@ out:
*/
int
nextopt(char *optstring)
nextopt(const char *optstring)
{
char *p, *q;
char *p;
const char *q;
char c;
if ((p = optptr) == NULL || *p == '\0') {
if ((p = nextopt_optptr) == NULL || *p == '\0') {
p = *argptr;
if (p == NULL || *p != '-' || *++p == '\0')
return '\0';
@@ -580,6 +581,6 @@ nextopt(char *optstring)
shoptarg = p;
p = NULL;
}
optptr = p;
nextopt_optptr = p;
return c;
}
+2 -2
View File
@@ -102,7 +102,7 @@ extern char *arg0; /* $0 */
extern struct shparam shellparam; /* $@ */
extern char **argptr; /* argument list for builtin commands */
extern char *shoptarg; /* set by nextopt */
extern char *optptr; /* used by nextopt */
extern char *nextopt_optptr; /* used by nextopt */
void procargs(int, char **);
void optschanged(void);
@@ -111,5 +111,5 @@ void freeparam(struct shparam *);
int shiftcmd(int, char **);
int setcmd(int, char **);
int getoptscmd(int, char **);
int nextopt(char *);
int nextopt(const char *);
void getoptsreset(const char *);
+2 -2
View File
@@ -167,7 +167,7 @@ outqstr(const char *p, struct output *file)
outc('\'', file);
}
STATIC char out_junk[16];
static char out_junk[16];
void
emptyoutbuf(struct output *dest)
@@ -316,7 +316,7 @@ doformat(struct output *dest, const char *f, va_list ap)
*/
int
xwrite(int fd, char *buf, int nbytes)
xwrite(int fd, const char *buf, int nbytes)
{
int ntry;
int i;
+1 -1
View File
@@ -68,7 +68,7 @@ void out1fmt(const char *, ...) __printflike(1, 2);
void dprintf(const char *, ...) __printflike(1, 2);
void fmtstr(char *, int, const char *, ...) __printflike(3, 4);
void doformat(struct output *, const char *, va_list) __printflike(2, 0);
int xwrite(int, char *, int);
int xwrite(int, const char *, int);
#define outc(c, file) (--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
#define out1c(c) outc(c, out1);
+65 -62
View File
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include "shell.h"
#include "parser.h"
@@ -81,41 +82,41 @@ struct heredoc {
STATIC struct heredoc *heredoclist; /* list of here documents to read */
STATIC int parsebackquote; /* nonzero if we are inside backquotes */
STATIC int doprompt; /* if set, prompt the user */
STATIC int needprompt; /* true if interactive and at start of line */
STATIC int lasttoken; /* last token read */
static struct heredoc *heredoclist; /* list of here documents to read */
static int parsebackquote; /* nonzero if we are inside backquotes */
static int doprompt; /* if set, prompt the user */
static int needprompt; /* true if interactive and at start of line */
static int lasttoken; /* last token read */
MKINIT int tokpushback; /* last token pushed back */
STATIC char *wordtext; /* text of last word returned by readtoken */
static char *wordtext; /* text of last word returned by readtoken */
MKINIT int checkkwd; /* 1 == check for kwds, 2 == also eat newlines */
STATIC struct nodelist *backquotelist;
STATIC union node *redirnode;
STATIC struct heredoc *heredoc;
STATIC int quoteflag; /* set if (part of) last token was quoted */
STATIC int startlinno; /* line # where last token started */
STATIC int funclinno; /* line # where the current function started */
static struct nodelist *backquotelist;
static union node *redirnode;
static struct heredoc *heredoc;
static int quoteflag; /* set if (part of) last token was quoted */
static int startlinno; /* line # where last token started */
static int funclinno; /* line # where the current function started */
/* XXX When 'noaliases' is set to one, no alias expansion takes place. */
static int noaliases = 0;
STATIC union node *list(int);
STATIC union node *andor(void);
STATIC union node *pipeline(void);
STATIC union node *command(void);
STATIC union node *simplecmd(union node **, union node *);
STATIC union node *makename(void);
STATIC void parsefname(void);
STATIC void parseheredoc(void);
STATIC int peektoken(void);
STATIC int readtoken(void);
STATIC int xxreadtoken(void);
STATIC int readtoken1(int, char const *, char *, int);
STATIC int noexpand(char *);
STATIC void synexpect(int);
STATIC void synerror(char *);
STATIC void setprompt(int);
static union node *list(int);
static union node *andor(void);
static union node *pipeline(void);
static union node *command(void);
static union node *simplecmd(union node **, union node *);
static union node *makename(void);
static void parsefname(void);
static void parseheredoc(void);
static int peektoken(void);
static int readtoken(void);
static int xxreadtoken(void);
static int readtoken1(int, char const *, char *, int);
static int noexpand(char *);
static void synexpect(int);
static void synerror(const char *);
static void setprompt(int);
/*
@@ -145,7 +146,7 @@ parsecmd(int interact)
}
STATIC union node *
static union node *
list(int nlflag)
{
union node *n1, *n2, *n3;
@@ -215,7 +216,7 @@ list(int nlflag)
STATIC union node *
static union node *
andor(void)
{
union node *n1, *n2, *n3;
@@ -242,7 +243,7 @@ andor(void)
STATIC union node *
static union node *
pipeline(void)
{
union node *n1, *n2, *pipenode;
@@ -284,7 +285,7 @@ pipeline(void)
STATIC union node *
static union node *
command(void)
{
union node *n1, *n2;
@@ -476,6 +477,7 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
checkkwd = 1;
break;
/* Handle an empty command like other simple commands. */
case TBACKGND:
case TSEMI:
case TAND:
case TOR:
@@ -526,7 +528,7 @@ checkneg:
}
STATIC union node *
static union node *
simplecmd(union node **rpp, union node *redir)
{
union node *args, **app;
@@ -604,7 +606,7 @@ checkneg:
return n;
}
STATIC union node *
static union node *
makename(void)
{
union node *n;
@@ -617,7 +619,8 @@ makename(void)
return n;
}
void fixredir(union node *n, const char *text, int err)
void
fixredir(union node *n, const char *text, int err)
{
TRACE(("Fix redir %s %d\n", text, err));
if (!err)
@@ -637,7 +640,7 @@ void fixredir(union node *n, const char *text, int err)
}
STATIC void
static void
parsefname(void)
{
union node *n = redirnode;
@@ -679,7 +682,7 @@ parsefname(void)
* Input any here documents.
*/
STATIC void
static void
parseheredoc(void)
{
struct heredoc *here;
@@ -703,7 +706,7 @@ parseheredoc(void)
}
}
STATIC int
static int
peektoken(void)
{
int t;
@@ -713,7 +716,7 @@ peektoken(void)
return (t);
}
STATIC int
static int
readtoken(void)
{
int t;
@@ -793,7 +796,7 @@ out:
#define RETURN(token) return lasttoken = token
STATIC int
static int
xxreadtoken(void)
{
int c;
@@ -884,7 +887,7 @@ breakloop:
#define PARSEBACKQNEW() {oldstyle = 0; goto parsebackq; parsebackq_newreturn:;}
#define PARSEARITH() {goto parsearith; parsearith_return:;}
STATIC int
static int
readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
{
int c = firstc;
@@ -1491,7 +1494,7 @@ RESET {
* or backquotes).
*/
STATIC int
static int
noexpand(char *text)
{
char *p;
@@ -1516,9 +1519,9 @@ noexpand(char *text)
*/
int
goodname(char *name)
goodname(const char *name)
{
char *p;
const char *p;
p = name;
if (! is_name(*p))
@@ -1537,7 +1540,7 @@ goodname(char *name)
* occur at this point.
*/
STATIC void
static void
synexpect(int token)
{
char msg[64];
@@ -1552,8 +1555,8 @@ synexpect(int token)
}
STATIC void
synerror(char *msg)
static void
synerror(const char *msg)
{
if (commandname)
outfmt(&errout, "%s: %d: ", commandname, startlinno);
@@ -1561,7 +1564,7 @@ synerror(char *msg)
error((char *)NULL);
}
STATIC void
static void
setprompt(int which)
{
whichprompt = which;
@@ -1581,14 +1584,16 @@ getprompt(void *unused __unused)
{
static char ps[PROMPTLEN];
char *fmt;
int i, j, trim;
const char *pwd;
int i, trim;
static char internal_error[] = "<internal prompt error>";
/*
* Select prompt format.
*/
switch (whichprompt) {
case 0:
fmt = "";
fmt = nullstr;
break;
case 1:
fmt = ps1val();
@@ -1597,7 +1602,7 @@ getprompt(void *unused __unused)
fmt = ps2val();
break;
default:
return "<internal prompt error>";
return internal_error;
}
/*
@@ -1631,17 +1636,15 @@ getprompt(void *unused __unused)
*/
case 'W':
case 'w':
ps[i] = '\0';
getcwd(&ps[i], PROMPTLEN - i);
if (*fmt == 'W' && ps[i + 1] != '\0') {
/* Final path component only. */
trim = 1;
for (j = i; ps[j] != '\0'; j++)
if (ps[j] == '/')
trim = j + 1;
memmove(&ps[i], &ps[trim],
j - trim + 1);
}
pwd = lookupvar("PWD");
if (pwd == NULL)
pwd = "?";
if (*fmt == 'W' &&
*pwd == '/' && pwd[1] != '\0')
strlcpy(&ps[i], strrchr(pwd, '/') + 1,
PROMPTLEN - i);
else
strlcpy(&ps[i], pwd, PROMPTLEN - i);
/* Skip to end of path. */
while (ps[i + 1] != '\0')
i++;
+2 -1
View File
@@ -73,9 +73,10 @@
extern int tokpushback;
#define NEOF ((union node *)&tokpushback)
extern int whichprompt; /* 1 == PS1, 2 == PS2 */
extern const char *const parsekwd[];
union node *parsecmd(int);
void fixredir(union node *, const char *, int);
int goodname(char *);
int goodname(const char *);
char *getprompt(void *);
+5 -5
View File
@@ -80,10 +80,10 @@ MKINIT struct redirtab *redirlist;
* background commands, where we want to redirect fd0 to /dev/null only
* if it hasn't already been redirected.
*/
STATIC int fd0_redirected = 0;
static int fd0_redirected = 0;
STATIC void openredirect(union node *, char[10 ]);
STATIC int openhere(union node *);
static void openredirect(union node *, char[10 ]);
static int openhere(union node *);
/*
@@ -156,7 +156,7 @@ again:
}
STATIC void
static void
openredirect(union node *redir, char memory[10])
{
struct stat sb;
@@ -245,7 +245,7 @@ movefd:
* the pipe without forking.
*/
STATIC int
static int
openhere(union node *redir)
{
int pip[2];
+78 -28
View File
@@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd January 8, 2010
.Dd October 31, 2010
.Dt SH 1
.Os
.Sh NAME
@@ -40,9 +40,24 @@
.Nd command interpreter (shell)
.Sh SYNOPSIS
.Nm
.Op Fl /+abCEefIimnPpsTuVvx
.Op Fl /+abCEefIimnPpTuVvx
.Op Fl /+o Ar longname
.Op Fl c Ar string
.Oo
.Ar script
.Op Ar arg ...
.Oc
.Nm
.Op Fl /+abCEefIimnPpTuVvx
.Op Fl /+o Ar longname
.Fl c Ar string
.Oo
.Ar name
.Op Ar arg ...
.Oc
.Nm
.Op Fl /+abCEefIimnPpTuVvx
.Op Fl /+o Ar longname
.Fl s
.Op Ar arg ...
.Sh DESCRIPTION
The
@@ -296,7 +311,10 @@ sh -T -c "trap 'exit 1' 2 ; some-blocking-program"
.Ed
.It Fl u Li nounset
Write a message to standard error when attempting
to expand a variable that is not set, and if the
to expand a variable, a positional parameter or
the special parameter
.Va \&!
that is not set, and if the
shell is not interactive, exit immediately.
.It Fl V Li vi
Enable the built-in
@@ -411,11 +429,11 @@ character, with the exception of the newline character
.Pq Ql \en .
A backslash preceding a newline is treated as a line continuation.
.El
.Ss Reserved Words
Reserved words are words that have special meaning to the
.Ss Keywords
Keywords or reserved words are words that have special meaning to the
shell and are recognized at the beginning of a line and
after a control operator.
The following are reserved words:
The following are keywords:
.Bl -column "doneXX" "elifXX" "elseXX" "untilXX" "whileX" -offset center
.It Li \&! Ta { Ta } Ta Ic case Ta Ic do
.It Ic done Ta Ic elif Ta Ic else Ta Ic esac Ta Ic fi
@@ -425,8 +443,8 @@ The following are reserved words:
An alias is a name and corresponding value set using the
.Ic alias
built-in command.
Whenever a reserved word may occur (see above),
and after checking for reserved words, the shell
Whenever a keyword may occur (see above),
and after checking for keywords, the shell
checks the word to see if it matches an alias.
If it does, it replaces it in the input stream with its value.
For example, if there is an alias called
@@ -465,7 +483,7 @@ of this man page (refer to the BNF in the
document).
Essentially though, a line is read and if
the first word of the line (or after a control operator)
is not a reserved word, then the shell has recognized a
is not a keyword, then the shell has recognized a
simple command.
Otherwise, a complex command or some
other special construct may have been recognized.
@@ -691,7 +709,7 @@ Signal numbers are defined in the header file
.In sys/signal.h .
.Ss Complex Commands
Complex commands are combinations of simple commands
with control operators or reserved words, together creating a larger complex
with control operators or keywords, together creating a larger complex
command.
More generally, a command is one of the following:
.Bl -item -offset indent
@@ -732,10 +750,17 @@ both of a command is considered to be assigned by the
pipeline before any redirection specified by redirection
operators that are part of the command.
.Pp
Note that unlike some other shells,
.Nm
executes each process in a pipeline with more than one command
in a subshell environment and as a child of the
.Nm
process.
.Pp
If the pipeline is not in the background (discussed later),
the shell waits for all commands to complete.
.Pp
If the reserved word
If the keyword
.Ic !\&
does not precede the pipeline, the
exit status is the exit status of the last command specified
@@ -769,15 +794,6 @@ to be executed sequentially;
an
.Ql &
causes asynchronous execution of the preceding AND-OR-list.
.Pp
Note that unlike some other shells,
.Nm
executes each process in the pipeline as a child of the
.Nm
process.
Shell built-in commands are the exception to this rule.
They are executed in the current shell, although they do not affect its
environment when used in pipelines.
.Ss Background Commands (&)
If a command is terminated by the control operator ampersand
.Pq Ql & ,
@@ -1107,7 +1123,12 @@ For a
pipeline, the process ID is that of the last command in the
pipeline.
.It Li $0
(zero) Expands to the name of the shell or shell script.
(zero) Expands to the name of the shell script if passed on the command line,
the
.Ar name
operand if given (with
.Fl c )
or otherwise argument 0 passed to the shell.
.El
.Ss Word Expansions
This clause describes the various expansions that are
@@ -1148,7 +1169,7 @@ Quote Removal.
The
.Ql $
character is used to introduce parameter expansion, command
substitution, or arithmetic evaluation.
substitution, or arithmetic expansion.
.Ss Tilde Expansion (substituting a user's home directory)
A word beginning with an unquoted tilde character
.Pq Ql ~
@@ -1363,10 +1384,41 @@ The
shell expands all tokens in the
.Ar expression
for parameter expansion,
command substitution, and quote removal.
command substitution,
arithmetic expansion
and quote removal.
.Pp
Next, the shell treats this as an arithmetic expression and
substitutes the value of the expression.
The allowed expressions are a subset of C expressions,
summarized below.
.Bl -tag -width "Variables" -offset indent
.It Values
All values are of type
.Ft intmax_t .
.It Constants
Decimal, octal (starting with
.Li 0 )
and hexadecimal (starting with
.Li 0x )
integer constants.
.It Variables
Shell variables can be read and written
and contain integer constants.
.It Unary operators
.Li "! ~ + -"
.It Binary operators
.Li "* / % + - << >> < <= > >= == != & ^ | && ||"
.It Assignment operators
.Li "= += -= *= /= %= <<= >>= &= ^= |="
.It Short-circuit evaluation
The
.Li &&
and
.Li ||
operators always evaluate both sides.
This is a bug.
.El
.Pp
The result of the expression is substituted in decimal.
.Ss White Space Splitting (Field Splitting)
After parameter expansion, command substitution, and
arithmetic expansion the shell scans the results of
@@ -2369,8 +2421,6 @@ will return the argument.
.Xr echo 1 ,
.Xr ed 1 ,
.Xr emacs 1 ,
.Xr expr 1 ,
.Xr getopt 1 ,
.Xr pwd 1 ,
.Xr test 1 ,
.Xr vi 1 ,
+1 -2
View File
@@ -44,7 +44,7 @@
* define DEBUG=1 to compile in debugging (set global "debug" to turn on)
* define DEBUG=2 to compile in and turn on debugging.
*
* When debugging is on, debugging info will be written to $HOME/trace and
* When debugging is on, debugging info will be written to ./trace and
* a quit signal will generate a core dump.
*/
@@ -61,7 +61,6 @@ typedef intmax_t arith_t;
#define strtoarith_t(nptr, endptr, base) strtoimax(nptr, endptr, base)
typedef void *pointer;
#define STATIC static
#define MKINIT /* empty */
#include <sys/cdefs.h>
+2 -2
View File
@@ -274,7 +274,7 @@ indent(int amount, char *pfx, FILE *fp)
FILE *tracefile;
#if DEBUG == 2
#if DEBUG >= 2
int debug = 1;
#else
int debug = 0;
@@ -307,7 +307,7 @@ sh_trace(const char *fmt, ...)
void
trputs(char *s)
trputs(const char *s)
{
if (tracefile == NULL)
return;
+1 -1
View File
@@ -35,6 +35,6 @@ void showtree(union node *);
void sh_trace(const char *, ...) __printflike(1, 2);
void trargs(char **);
void trputc(int);
void trputs(char *);
void trputs(const char *);
void opentrace(void);
#endif
+1 -1
View File
@@ -45,4 +45,4 @@ void ignoresig(int);
void onsig(int);
void dotrap(void);
void setinteractive(int);
void exitshell(int);
void exitshell(int) __dead2;
+29 -30
View File
@@ -90,9 +90,9 @@ struct var vps1;
struct var vps2;
struct var vps4;
struct var vvers;
STATIC struct var voptind;
static struct var voptind;
STATIC const struct varinit varinit[] = {
static const struct varinit varinit[] = {
#ifndef NO_HISTORY
{ &vhistsize, VSTRFIXED|VTEXTFIXED|VUNSET, "HISTSIZE=",
sethistsize },
@@ -120,11 +120,11 @@ STATIC const struct varinit varinit[] = {
NULL }
};
STATIC struct var *vartab[VTABSIZE];
static struct var *vartab[VTABSIZE];
STATIC struct var **hashvar(char *);
STATIC int varequal(char *, char *);
STATIC int localevar(char *);
static struct var **hashvar(const char *);
static int varequal(const char *, const char *);
static int localevar(const char *);
/*
* Initialize the variable symbol tables and import the environment.
@@ -132,9 +132,9 @@ STATIC int localevar(char *);
#ifdef mkinit
INCLUDE "var.h"
MKINIT char **environ;
INIT {
char **envp;
extern char **environ;
initvar();
for (envp = environ ; *envp ; envp++) {
@@ -190,7 +190,7 @@ initvar(void)
*/
int
setvarsafe(char *name, char *val, int flags)
setvarsafe(const char *name, const char *val, int flags)
{
struct jmploc jmploc;
struct jmploc *const savehandler = handler;
@@ -212,9 +212,9 @@ setvarsafe(char *name, char *val, int flags)
*/
void
setvar(char *name, char *val, int flags)
setvar(const char *name, const char *val, int flags)
{
char *p, *q;
const char *p;
int len;
int namelen;
char *nameeq;
@@ -242,25 +242,24 @@ setvar(char *name, char *val, int flags)
} else {
len += strlen(val);
}
p = nameeq = ckmalloc(len);
q = name;
while (--namelen >= 0)
*p++ = *q++;
*p++ = '=';
*p = '\0';
nameeq = ckmalloc(len);
memcpy(nameeq, name, namelen);
nameeq[namelen] = '=';
if (val)
scopy(val, p);
scopy(val, nameeq + namelen + 1);
else
nameeq[namelen + 1] = '\0';
setvareq(nameeq, flags);
}
STATIC int
localevar(char *s)
static int
localevar(const char *s)
{
static char *lnames[7] = {
static const char *lnames[7] = {
"ALL", "COLLATE", "CTYPE", "MONETARY",
"NUMERIC", "TIME", NULL
};
char **ss;
const char **ss;
if (*s != 'L')
return 0;
@@ -280,7 +279,7 @@ localevar(char *s)
* pointer into environ where the string should not be manipulated.
*/
static void
change_env(char *s, int set)
change_env(const char *s, int set)
{
char *eqp;
char *ss;
@@ -391,7 +390,7 @@ listsetvar(struct strlist *list)
*/
char *
lookupvar(char *name)
lookupvar(const char *name)
{
struct var *v;
@@ -414,7 +413,7 @@ lookupvar(char *name)
*/
char *
bltinlookup(char *name, int doall)
bltinlookup(const char *name, int doall)
{
struct strlist *sp;
struct var *v;
@@ -472,9 +471,9 @@ environment(void)
* VSTACK set since these are currently allocated on the stack.
*/
#ifdef mkinit
MKINIT void shprocvar(void);
#ifdef mkinit
SHELLPROC {
shprocvar();
}
@@ -798,7 +797,7 @@ unsetcmd(int argc __unused, char **argv __unused)
*/
int
unsetvar(char *s)
unsetvar(const char *s)
{
struct var **vpp;
struct var *vp;
@@ -837,8 +836,8 @@ unsetvar(char *s)
* Find the appropriate entry in the hash table from the name.
*/
STATIC struct var **
hashvar(char *p)
static struct var **
hashvar(const char *p)
{
unsigned int hashval;
@@ -856,8 +855,8 @@ hashvar(char *p)
* either '=' or '\0'.
*/
STATIC int
varequal(char *p, char *q)
static int
varequal(const char *p, const char *q)
{
while (*p == *q++) {
if (*p++ == '=')
+5 -6
View File
@@ -101,14 +101,13 @@ extern struct var vhistsize;
#define mpathset() ((vmpath.flags & VUNSET) == 0)
void initvar(void);
void setvar(char *, char *, int);
void setvar(const char *, const char *, int);
void setvareq(char *, int);
struct strlist;
void listsetvar(struct strlist *);
char *lookupvar(char *);
char *bltinlookup(char *, int);
char *lookupvar(const char *);
char *bltinlookup(const char *, int);
char **environment(void);
void shprocvar(void);
int showvarscmd(int, char **);
int exportcmd(int, char **);
int localcmd(int, char **);
@@ -116,5 +115,5 @@ void mklocal(char *);
void poplocalvars(void);
int setvarcmd(int, char **);
int unsetcmd(int, char **);
int unsetvar(char *);
int setvarsafe(char *, char *, int);
int unsetvar(const char *);
int setvarsafe(const char *, const char *, int);
+7 -6
View File
@@ -51,6 +51,10 @@ suspends execution for a minimum of
If the
.Nm
command receives a signal, it takes the standard action.
When the
.Dv SIGINFO
signal is received, the estimate of the amount of seconds left to
sleep is printed on the standard output.
.Sh IMPLEMENTATION NOTES
The
.Dv SIGALRM
@@ -58,14 +62,11 @@ signal is not handled specially by this implementation.
.Pp
The
.Nm
command will accept and honor a non-integer number of specified seconds
(with a
.Ql .\&
character as a decimal point).
.Bf Sy
command allows and honors a non-integer number of seconds to sleep
in any form acceptable by
.Xr strtod 3 .
This is a non-portable extension, and its use will nearly guarantee that
a shell script will not execute properly on another system.
.Ef
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
+39 -62
View File
@@ -42,84 +42,61 @@ static char sccsid[] = "@(#)sleep.c 8.3 (Berkeley) 4/2/94";
__FBSDID("$FreeBSD$");
#include <ctype.h>
#include <err.h>
#include <limits.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
void usage(void);
static void usage(void);
static volatile sig_atomic_t report_requested;
static void
report_request(int signo __unused)
{
report_requested = 1;
}
int
main(int argc, char *argv[])
{
struct timespec time_to_sleep;
long l;
int neg;
char *p;
double d;
time_t original;
char buf[2];
if (argc != 2) {
if (argc != 2)
usage();
return(1);
if (sscanf(argv[1], "%lf%1s", &d, buf) != 1)
usage();
if (d > INT_MAX)
usage();
if (d <= 0)
return (0);
original = time_to_sleep.tv_sec = (time_t)d;
time_to_sleep.tv_nsec = 1e9 * (d - time_to_sleep.tv_sec);
signal(SIGINFO, report_request);
while (nanosleep(&time_to_sleep, &time_to_sleep) != 0) {
if (report_requested) {
/* Reporting does not bother with nanoseconds. */
warnx("about %d second(s) left out of the original %d",
(int)time_to_sleep.tv_sec, (int)original);
report_requested = 0;
} else
break;
}
p = argv[1];
/* Skip over leading whitespaces. */
while (isspace((unsigned char)*p))
++p;
/* Check for optional `+' or `-' sign. */
neg = 0;
if (*p == '-') {
neg = 1;
++p;
if (!isdigit((unsigned char)*p) && *p != '.') {
usage();
return(1);
}
}
else if (*p == '+')
++p;
/* Calculate seconds. */
if (isdigit((unsigned char)*p)) {
l = strtol(p, &p, 10);
if (l > INT_MAX) {
/*
* Avoid overflow when `seconds' is huge. This assumes
* that the maximum value for a time_t is <= INT_MAX.
*/
l = INT_MAX;
}
} else
l = 0;
time_to_sleep.tv_sec = (time_t)l;
/* Calculate nanoseconds. */
time_to_sleep.tv_nsec = 0;
if (*p == '.') { /* Decimal point. */
l = 100000000L;
do {
if (isdigit((unsigned char)*++p))
time_to_sleep.tv_nsec += (*p - '0') * l;
else
break;
l /= 10;
} while (l);
}
if (!neg && (time_to_sleep.tv_sec > 0 || time_to_sleep.tv_nsec > 0))
(void)nanosleep(&time_to_sleep, (struct timespec *)NULL);
return(0);
return (0);
}
void
static void
usage(void)
{
const char msg[] = "usage: sleep seconds\n";
write(STDERR_FILENO, msg, sizeof(msg) - 1);
fprintf(stderr, "usage: sleep seconds\n");
exit(1);
}
-24
View File
@@ -1,24 +0,0 @@
# $FreeBSD$
OS/shell syntax error failed
--------------------------------------------------------------------
bash 1.14.5 3 0
pdksh 5.2.5 7 0
zsh 2.6-beta17 6 4
FreeBSD 2.1 /bin/test 8 0
IRIX 5.3 ksh 3 0
IRIX 5.3 sh 3 0
IRIX 5.3 /usr/bin/test 11 3
SunOS 5.4 ksh 3 0
SunOS 5.4 sh 3 0
SunOS 5.4 /usr/ucb/test 3 0
SunOS 5.5 ksh 0 0
SunOS 5.5 sh 3 0
SunOS 5.5 /usr/ucb/test 3 0
SunOS 4.1.3_U1 sh 3 0
SunOS 4.1.3_U1 /usr/bin/test 3 0
ULTRIX 4.2 /bin/test 9 0
ULTRIX 4.2 ksh 1 0
ULTRIX 4.2 sh5 4 0
96/06/16
-152
View File
@@ -1,152 +0,0 @@
# @(#)TEST.csh 5.2 (Berkeley) 4/30/93
# $FreeBSD$
#alias t '/usr/src/bin/test/obj/test \!*; echo $status'
alias t '/bin/test \!*; echo $status'
echo 't -b /dev/ttyp2'
t -b /dev/ttyp2
echo 't -b /dev/jb1a'
t -b /dev/jb1a
echo 't -c test.c'
t -c test.c
echo 't -c /dev/tty'
t -c /dev/tty
echo 't -d test.c'
t -d test.c
echo 't -d /etc'
t -d /etc
echo 't -e noexist'
t -e noexist
echo 't -e test.c'
t -e test.c
echo 't -f noexist'
t -f noexist
echo 't -f /dev/tty'
t -f /dev/tty
echo 't -f test.c'
t -f test.c
echo 't -g test.c'
t -g test.c
echo 't -g /bin/ps'
t -g /bin/ps
echo 't -n ""'
t -n ""
echo 't -n "hello"'
t -n "hello"
echo 't -p test.c'
t -p test.c
echo 't -r noexist'
t -r noexist
echo 't -r /etc/master.passwd'
t -r /etc/master.passwd
echo 't -r test.c'
t -r test.c
echo 't -s noexist'
t -s noexist
echo 't -s /dev/null'
t -s /dev/null
echo 't -s test.c'
t -s test.c
echo 't -t 20'
t -t 20
echo 't -t 0'
t -t 0
echo 't -u test.c'
t -u test.c
echo 't -u /bin/rcp'
t -u /bin/rcp
echo 't -w noexist'
t -w noexist
echo 't -w /etc/master.passwd'
t -w /etc/master.passwd
echo 't -w /dev/null'
t -w /dev/null
echo 't -x noexist'
t -x noexist
echo 't -x /bin/ps'
t -x /bin/ps
echo 't -x /etc/motd'
t -x /etc/motd
echo 't -z ""'
t -z ""
echo 't -z "foo"'
t -z "foo"
echo 't "foo"'
t "foo"
echo 't ""'
t ""
echo 't "hello" = "hello"'
t "hello" = "hello"
echo 't "hello" = "goodbye"'
t "hello" = "goodbye"
echo 't "hello" != "hello"'
t "hello" != "hello"
echo 't "hello" != "goodbye"'
t "hello" != "goodbye"
echo 't 200 -eq 200'
t 200 -eq 200
echo 't 34 -eq 222'
t 34 -eq 222
echo 't 200 -ne 200'
t 200 -ne 200
echo 't 34 -ne 222'
t 34 -ne 222
echo 't 200 -gt 200'
t 200 -gt 200
echo 't 340 -gt 222'
t 340 -gt 222
echo 't 200 -ge 200'
t 200 -ge 200
echo 't 34 -ge 222'
t 34 -ge 222
echo 't 200 -lt 200'
t 200 -lt 200
echo 't 34 -lt 222'
t 34 -lt 222
echo 't 200 -le 200'
t 200 -le 200
echo 't 340 -le 222'
t 340 -le 222
echo 't 700 -le 1000 -a -n "1" -a "20" = "20"'
t 700 -le 1000 -a -n "1" -a "20" = "20"
echo 't ! \( 700 -le 1000 -a -n "1" -a "20" = "20" \)'
t ! \( 700 -le 1000 -a -n "1" -a "20" = "20" \)
echo 't -5 -eq 5'
t -5 -eq 5
echo 't foo -a ""'
t foo -a ""
echo 't "" -a foo'
t "" -a foo
echo 't "" -a ""'
t "" -a ""
echo 't "" -o ""'
t "" -o ""
+13 -6
View File
@@ -32,7 +32,7 @@
.\" @(#)test.1 8.1 (Berkeley) 5/31/93
.\" $FreeBSD$
.\"
.Dd July 31, 2006
.Dd September 10, 2010
.Dt TEST 1
.Os
.Sh NAME
@@ -282,7 +282,7 @@ True if either
or
.Ar expression2
are true.
.It Cm \&( Ns Ar expression Ns Cm \&)
.It Cm \&( Ar expression Cm \&)
True if expression is true.
.El
.Pp
@@ -310,6 +310,14 @@ are evaluated consistently according to the rules specified in the
standards document.
All other cases are subject to the ambiguity in the
command semantics.
.Pp
In particular, only expressions containing
.Fl a ,
.Fl o ,
.Cm \&(
or
.Cm \&)
can be ambiguous.
.Sh EXIT STATUS
The
.Nm
@@ -338,12 +346,11 @@ specification.
Both sides are always evaluated in
.Fl a
and
.Fl o ,
unlike in the logical operators of
.Xr sh 1 .
.Fl o .
For instance, the writable status of
.Pa file
will be tested by the following command even though the former expression
indicated false, which results in a gratuitous access to the file system:
.Pp
.Dl "[ -z abc -a -w file ]"
To avoid this, write
.Dl "[ -z abc ] && [ -w file ]"
+9 -1
View File
@@ -3,10 +3,13 @@
#ifndef _OPENSOLARIS_MNTTAB_H_
#define _OPENSOLARIS_MNTTAB_H_
#include <sys/param.h>
#include <sys/mount.h>
#include <stdio.h>
#include <paths.h>
#define MNTTAB _PATH_DEVNULL
#define MNTTAB _PATH_DEVZERO
#define MNT_LINE_MAX 1024
#define umount2(p, f) unmount(p, f)
@@ -17,7 +20,12 @@ struct mnttab {
char *mnt_fstype;
char *mnt_mntopts;
};
#define extmnttab mnttab
int getmntany(FILE *fd, struct mnttab *mgetp, struct mnttab *mrefp);
int getmntent(FILE *fp, struct mnttab *mp);
char *hasmntopt(struct mnttab *mnt, char *opt);
void statfs2mnttab(struct statfs *sfs, struct mnttab *mp);
#endif /* !_OPENSOLARIS_MNTTAB_H_ */
+2 -2
View File
@@ -110,11 +110,11 @@ getline(FILE *fd, const char *skip)
*
* Recognized keywords:
*
* ro, maproot, mapall, mask, network, alldirs, public, webnfs, index, quiet
* ro, maproot, mapall, mask, network, sec, alldirs, public, webnfs, index, quiet
*
*/
static const char *known_opts[] = { "ro", "maproot", "mapall", "mask",
"network", "alldirs", "public", "webnfs", "index", "quiet", NULL };
"network", "sec", "alldirs", "public", "webnfs", "index", "quiet", NULL };
static char *
translate_opts(const char *shareopts)
{
+108 -54
View File
@@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/mount.h>
#include <sys/mntent.h>
#include <sys/mnttab.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -88,75 +91,126 @@ optadd(char *mntopts, size_t size, const char *opt)
strlcat(mntopts, opt, size);
}
void
statfs2mnttab(struct statfs *sfs, struct mnttab *mp)
{
static char mntopts[MNTMAXSTR];
long flags;
mntopts[0] = '\0';
flags = sfs->f_flags;
#define OPTADD(opt) optadd(mntopts, sizeof(mntopts), (opt))
if (flags & MNT_RDONLY)
OPTADD(MNTOPT_RO);
else
OPTADD(MNTOPT_RW);
if (flags & MNT_NOSUID)
OPTADD(MNTOPT_NOSUID);
else
OPTADD(MNTOPT_SETUID);
if (flags & MNT_UPDATE)
OPTADD(MNTOPT_REMOUNT);
if (flags & MNT_NOATIME)
OPTADD(MNTOPT_NOATIME);
else
OPTADD(MNTOPT_ATIME);
OPTADD(MNTOPT_NOXATTR);
if (flags & MNT_NOEXEC)
OPTADD(MNTOPT_NOEXEC);
else
OPTADD(MNTOPT_EXEC);
#undef OPTADD
mp->mnt_special = sfs->f_mntfromname;
mp->mnt_mountp = sfs->f_mntonname;
mp->mnt_fstype = sfs->f_fstypename;
mp->mnt_mntopts = mntopts;
}
static struct statfs *gsfs = NULL;
static int allfs = 0;
static int
statfs_init(void)
{
struct statfs *sfs;
int error;
if (gsfs != NULL) {
free(gsfs);
gsfs = NULL;
}
allfs = getfsstat(NULL, 0, MNT_WAIT);
if (allfs == -1)
goto fail;
gsfs = malloc(sizeof(gsfs[0]) * allfs * 2);
if (gsfs == NULL)
goto fail;
allfs = getfsstat(gsfs, (long)(sizeof(gsfs[0]) * allfs * 2),
MNT_WAIT);
if (allfs == -1)
goto fail;
sfs = realloc(gsfs, allfs * sizeof(gsfs[0]));
if (sfs != NULL)
gsfs = sfs;
return (0);
fail:
error = errno;
if (gsfs != NULL)
free(gsfs);
gsfs = NULL;
allfs = 0;
return (error);
}
int
getmntany(FILE *fd __unused, struct mnttab *mgetp, struct mnttab *mrefp)
{
static struct statfs *sfs = NULL;
static char mntopts[MNTMAXSTR];
struct opt *o;
long i, n, flags;
struct statfs *sfs;
int i, error;
if (sfs != NULL) {
free(sfs);
sfs = NULL;
}
mntopts[0] = '\0';
error = statfs_init();
if (error != 0)
return (error);
n = getfsstat(NULL, 0, MNT_NOWAIT);
if (n == -1)
return (-1);
n = sizeof(*sfs) * (n + 8);
sfs = malloc(n);
if (sfs == NULL)
return (-1);
n = getfsstat(sfs, n, MNT_WAIT);
if (n == -1) {
free(sfs);
sfs = NULL;
return (-1);
}
for (i = 0; i < n; i++) {
for (i = 0; i < allfs; i++) {
if (mrefp->mnt_special != NULL &&
strcmp(mrefp->mnt_special, sfs[i].f_mntfromname) != 0) {
strcmp(mrefp->mnt_special, gsfs[i].f_mntfromname) != 0) {
continue;
}
if (mrefp->mnt_mountp != NULL &&
strcmp(mrefp->mnt_mountp, sfs[i].f_mntonname) != 0) {
strcmp(mrefp->mnt_mountp, gsfs[i].f_mntonname) != 0) {
continue;
}
if (mrefp->mnt_fstype != NULL &&
strcmp(mrefp->mnt_fstype, sfs[i].f_fstypename) != 0) {
strcmp(mrefp->mnt_fstype, gsfs[i].f_fstypename) != 0) {
continue;
}
flags = sfs[i].f_flags;
#define OPTADD(opt) optadd(mntopts, sizeof(mntopts), (opt))
if (flags & MNT_RDONLY)
OPTADD(MNTOPT_RO);
else
OPTADD(MNTOPT_RW);
if (flags & MNT_NOSUID)
OPTADD(MNTOPT_NOSUID);
else
OPTADD(MNTOPT_SETUID);
if (flags & MNT_UPDATE)
OPTADD(MNTOPT_REMOUNT);
if (flags & MNT_NOATIME)
OPTADD(MNTOPT_NOATIME);
else
OPTADD(MNTOPT_ATIME);
OPTADD(MNTOPT_NOXATTR);
if (flags & MNT_NOEXEC)
OPTADD(MNTOPT_NOEXEC);
else
OPTADD(MNTOPT_EXEC);
#undef OPTADD
mgetp->mnt_special = sfs[i].f_mntfromname;
mgetp->mnt_mountp = sfs[i].f_mntonname;
mgetp->mnt_fstype = sfs[i].f_fstypename;
mgetp->mnt_mntopts = mntopts;
statfs2mnttab(&gsfs[i], mgetp);
return (0);
}
free(sfs);
sfs = NULL;
return (-1);
}
int
getmntent(FILE *fp, struct mnttab *mp)
{
struct statfs *sfs;
int error, nfs;
nfs = (int)lseek(fileno(fp), 0, SEEK_CUR);
if (nfs == -1)
return (errno);
/* If nfs is 0, we want to refresh out cache. */
if (nfs == 0 || gsfs == NULL) {
error = statfs_init();
if (error != 0)
return (error);
}
if (nfs >= allfs)
return (-1);
statfs2mnttab(&gsfs[nfs], mp);
if (lseek(fileno(fp), 1, SEEK_CUR) == -1)
return (errno);
return (0);
}
+467
View File
@@ -0,0 +1,467 @@
#!/usr/bin/sh
#
# dtruss - print process system call time details.
# Written using DTrace (Solaris 10 3/05).
#
# $Id: dtruss 9 2007-08-07 10:21:07Z brendan $
#
# USAGE: dtruss [-acdeflhoLs] [-t syscall] { -p PID | -n name | command }
#
# -p PID # examine this PID
# -n name # examine this process name
# -t syscall # examine this syscall only
# -a # print all details
# -c # print system call counts
# -d # print relative timestamps (us)
# -e # print elapsed times (us)
# -f # follow children as they are forked
# -l # force printing of pid/lwpid per line
# -o # print on cpu times (us)
# -s # print stack backtraces
# -L # don't print pid/lwpid per line
# -b bufsize # dynamic variable buf size (default is "4m")
# eg,
# dtruss df -h # run and examine the "df -h" command
# dtruss -p 1871 # examine PID 1871
# dtruss -n tar # examine all processes called "tar"
# dtruss -f test.sh # run test.sh and follow children
#
# See the man page dtruss(1M) for further details.
#
# SEE ALSO: procsystime # DTraceToolkit
# dapptrace # DTraceToolkit
# truss
#
# COPYRIGHT: Copyright (c) 2005, 2006, 2007 Brendan Gregg.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at Docs/cddl1.txt
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# CDDL HEADER END
#
# TODO: Track signals, more output formatting.
#
# 29-Apr-2005 Brendan Gregg Created this.
# 09-May-2005 " " Fixed evaltime (thanks Adam L.)
# 16-May-2005 " " Added -t syscall tracing.
# 17-Jun-2005 " " Added -s stack backtraces.
# 17-Jun-2005 " " Last update.
# 29-Jun-2007 " " Used progenyof() (thanks Aaron Gutman).
# 06-Aug-2007 " " Various updates.
#
##############################
# --- Process Arguments ---
#
### Default variables
opt_pid=0; opt_name=0; pid=0; pname="."; opt_elapsed=0; opt_cpu=0
opt_counts=0; opt_relative=0; opt_printid=0; opt_follow=0; opt_command=0
command=""; opt_buf=0; buf="4m"; opt_trace=0; trace="."; opt_stack=0
### Process options
while getopts ab:cdefhln:op:st:L name
do
case $name in
b) opt_buf=1; buf=$OPTARG ;;
p) opt_pid=1; pid=$OPTARG ;;
n) opt_name=1; pname=$OPTARG ;;
t) opt_trace=1; trace=$OPTARG ;;
a) opt_counts=1; opt_relative=1; opt_elapsed=1; opt_follow=1
opt_printid=1; opt_cpu=1 ;;
c) opt_counts=1 ;;
d) opt_relative=1 ;;
e) opt_elapsed=1 ;;
f) opt_follow=1 ;;
l) opt_printid=1 ;;
o) opt_cpu=1 ;;
L) opt_printid=-1 ;;
s) opt_stack=-1 ;;
h|?) cat <<-END >&2
USAGE: dtruss [-acdefholLs] [-t syscall] { -p PID | -n name | command }
-p PID # examine this PID
-n name # examine this process name
-t syscall # examine this syscall only
-a # print all details
-c # print syscall counts
-d # print relative times (us)
-e # print elapsed times (us)
-f # follow children (-p or cmd only)
-l # force printing pid/lwpid
-o # print on cpu times
-s # print stack backtraces
-L # don't print pid/lwpid
-b bufsize # dynamic variable buf size
eg,
dtruss df -h # run and examine "df -h"
dtruss -p 1871 # examine PID 1871
dtruss -n tar # examine all processes called "tar"
dtruss -f test.sh # run test.sh and follow children
END
exit 1
esac
done
shift `expr $OPTIND - 1`
### Option logic
if [ $opt_pid -eq 0 -a $opt_name -eq 0 ]; then
opt_command=1
if [ "$*" = "" ]; then
$0 -h
exit
fi
command="$*" # yes, I meant $*!
fi
if [ $opt_follow -eq 1 -o $opt_name -eq 1 ]; then
if [ $opt_printid -ne -1 ]; then
opt_printid=1
else
opt_printid=0
fi
fi
if [ $opt_follow -eq 1 -a $opt_name -eq 1 ]; then
echo "ERROR: -f option cannot be used with -n (use -p or cmd instead)."
exit 1
fi
### Option translation
if [ "$trace" = "exec" ]; then trace="exece"; fi
if [ "$trace" = "time" ]; then trace="gtime"; fi
if [ "$trace" = "exit" ]; then trace="rexit"; fi
#################################
# --- Main Program, DTrace ---
#
### Define D Script
dtrace='
#pragma D option quiet
#pragma D option switchrate=10
/*
* Command line arguments
*/
inline int OPT_command = '$opt_command';
inline int OPT_follow = '$opt_follow';
inline int OPT_printid = '$opt_printid';
inline int OPT_relative = '$opt_relative';
inline int OPT_elapsed = '$opt_elapsed';
inline int OPT_cpu = '$opt_cpu';
inline int OPT_counts = '$opt_counts';
inline int OPT_pid = '$opt_pid';
inline int OPT_name = '$opt_name';
inline int OPT_trace = '$opt_trace';
inline int OPT_stack = '$opt_stack';
inline string NAME = "'$pname'";
inline string TRACE = "'$trace'";
dtrace:::BEGIN
{
/* print header */
OPT_printid ? printf("%-9s ", "PID/LWP") : 1;
OPT_relative ? printf("%8s ", "RELATIVE") : 1;
OPT_elapsed ? printf("%7s ", "ELAPSD") : 1;
OPT_cpu ? printf("%6s ", "CPU") : 1;
printf("SYSCALL(args) \t\t = return\n");
}
/*
* Save syscall entry info
*/
syscall:::entry
/((OPT_command || OPT_pid) && pid == $target) ||
(OPT_name && execname == NAME) ||
(OPT_follow && progenyof($target))/
{
/* set start details */
self->start = timestamp;
self->vstart = vtimestamp;
self->arg0 = arg0;
self->arg1 = arg1;
self->arg2 = arg2;
/* count occurances */
OPT_counts == 1 ? @Counts[probefunc] = count() : 1;
}
/*
* Follow children
*/
syscall::fork*:return
/(OPT_follow && progenyof($target)) && (!OPT_trace || (TRACE == probefunc))/
{
/* print output */
self->code = errno == 0 ? "" : "Err#";
OPT_printid ? printf("%6d/%d: ", pid, tid) : 1;
OPT_relative ? printf("%8d: ", vtimestamp/1000) : 1;
OPT_elapsed ? printf("%7d: ", 0) : 1;
OPT_cpu ? printf("%6d ", 0) : 1;
printf("%s(0x%X, 0x%X, 0x%X)\t\t = %d %s%d\n", probefunc,
self->arg0, self->arg1, self->arg2, (int)arg0, self->code,
(int)errno);
}
/*
* Check for syscall tracing
*/
syscall:::entry
/OPT_trace && probefunc != TRACE/
{
/* drop info */
self->start = 0;
self->vstart = 0;
self->arg0 = 0;
self->arg1 = 0;
self->arg2 = 0;
}
/*
* Print return data
*/
/*
* The following code is written in an intentionally repetative way.
* The first versions had no code redundancies, but performed badly during
* benchmarking. The priority here is speed, not cleverness. I know there
* are many obvious shortcuts to this code, I have tried them. This style has
* shown in benchmarks to be the fastest (fewest probes fired, fewest actions).
*/
/* print 3 args, return as hex */
syscall::lwp_sigmask:return
/self->start/
{
/* calculate elapsed time */
this->elapsed = timestamp - self->start;
self->start = 0;
this->cpu = vtimestamp - self->vstart;
self->vstart = 0;
self->code = errno == 0 ? "" : "Err#";
/* print optional fields */
OPT_printid ? printf("%6d/%d: ", pid, tid) : 1;
OPT_relative ? printf("%8d ", vtimestamp/1000) : 1;
OPT_elapsed ? printf("%7d ", this->elapsed/1000) : 1;
OPT_cpu ? printf("%6d ", this->cpu/1000) : 1;
/* print main data */
printf("%s(0x%X, 0x%X, 0x%X)\t\t = 0x%X %s%d\n", probefunc,
(int)self->arg0, self->arg1, self->arg2, (int)arg0,
self->code, (int)errno);
OPT_stack ? ustack() : 1;
OPT_stack ? trace("\n") : 1;
self->arg0 = 0;
self->arg1 = 0;
self->arg2 = 0;
}
/* print 3 args, arg0 as a string */
syscall::stat*:return,
syscall::lstat*:return,
syscall::open*:return,
syscall::resolvepath:return
/self->start/
{
/* calculate elapsed time */
this->elapsed = timestamp - self->start;
self->start = 0;
this->cpu = vtimestamp - self->vstart;
self->vstart = 0;
self->code = errno == 0 ? "" : "Err#";
/* print optional fields */
OPT_printid ? printf("%6d/%d: ", pid, tid) : 1;
OPT_relative ? printf("%8d ", vtimestamp/1000) : 1;
OPT_elapsed ? printf("%7d ", this->elapsed/1000) : 1;
OPT_cpu ? printf("%6d ", this->cpu/1000) : 1;
/* print main data */
printf("%s(\"%S\", 0x%X, 0x%X)\t\t = %d %s%d\n", probefunc,
copyinstr(self->arg0), self->arg1, self->arg2, (int)arg0,
self->code, (int)errno);
OPT_stack ? ustack() : 1;
OPT_stack ? trace("\n") : 1;
self->arg0 = 0;
self->arg1 = 0;
self->arg2 = 0;
}
/* print 3 args, arg1 as a string */
syscall::write:return,
syscall::pwrite:return,
syscall::*read*:return
/self->start/
{
/* calculate elapsed time */
this->elapsed = timestamp - self->start;
self->start = 0;
this->cpu = vtimestamp - self->vstart;
self->vstart = 0;
self->code = errno == 0 ? "" : "Err#";
/* print optional fields */
OPT_printid ? printf("%6d/%d: ", pid, tid) : 1;
OPT_relative ? printf("%8d ", vtimestamp/1000) : 1;
OPT_elapsed ? printf("%7d ", this->elapsed/1000) : 1;
OPT_cpu ? printf("%6d ", this->cpu/1000) : 1;
/* print main data */
printf("%s(0x%X, \"%S\", 0x%X)\t\t = %d %s%d\n", probefunc, self->arg0,
stringof(copyin(self->arg1, self->arg2)), self->arg2, (int)arg0,
self->code, (int)errno);
OPT_stack ? ustack() : 1;
OPT_stack ? trace("\n") : 1;
self->arg0 = 0;
self->arg1 = 0;
self->arg2 = 0;
}
/* print 0 arg output */
syscall::gtime:return,
syscall::*fork*:return
/self->start/
{
/* calculate elapsed time */
this->elapsed = timestamp - self->start;
self->start = 0;
this->cpu = vtimestamp - self->vstart;
self->vstart = 0;
self->code = errno == 0 ? "" : "Err#";
/* print optional fields */
OPT_printid ? printf("%6d/%d: ", pid, tid) : 1;
OPT_relative ? printf("%8d ", vtimestamp/1000) : 1;
OPT_elapsed ? printf("%7d ", this->elapsed/1000) : 1;
OPT_cpu ? printf("%6d ", this->cpu/1000) : 1;
/* print main data */
printf("%s()\t\t = %d %s%d\n", probefunc,
(int)arg0, self->code, (int)errno);
OPT_stack ? ustack() : 1;
OPT_stack ? trace("\n") : 1;
self->arg0 = 0;
self->arg1 = 0;
self->arg2 = 0;
}
/* print 1 arg output */
syscall::brk:return,
syscall::times:return,
syscall::stime:return,
syscall::close:return
/self->start/
{
/* calculate elapsed time */
this->elapsed = timestamp - self->start;
self->start = 0;
this->cpu = vtimestamp - self->vstart;
self->vstart = 0;
self->code = errno == 0 ? "" : "Err#";
/* print optional fields */
OPT_printid ? printf("%6d/%d: ", pid, tid) : 1;
OPT_relative ? printf("%8d ", vtimestamp/1000) : 1;
OPT_elapsed ? printf("%7d ", this->elapsed/1000) : 1;
OPT_cpu ? printf("%6d ", this->cpu/1000) : 1;
/* print main data */
printf("%s(0x%X)\t\t = %d %s%d\n", probefunc, self->arg0,
(int)arg0, self->code, (int)errno);
OPT_stack ? ustack() : 1;
OPT_stack ? trace("\n") : 1;
self->arg0 = 0;
self->arg1 = 0;
self->arg2 = 0;
}
/* print 2 arg output */
syscall::utime:return,
syscall::munmap:return
/self->start/
{
/* calculate elapsed time */
this->elapsed = timestamp - self->start;
self->start = 0;
this->cpu = vtimestamp - self->vstart;
self->vstart = 0;
self->code = errno == 0 ? "" : "Err#";
/* print optional fields */
OPT_printid ? printf("%6d/%d: ", pid, tid) : 1;
OPT_relative ? printf("%8d ", vtimestamp/1000) : 1;
OPT_elapsed ? printf("%7d ", this->elapsed/1000) : 1;
OPT_cpu ? printf("%6d ", this->cpu/1000) : 1;
/* print main data */
printf("%s(0x%X, 0x%X)\t\t = %d %s%d\n", probefunc, self->arg0,
self->arg1, (int)arg0, self->code, (int)errno);
OPT_stack ? ustack() : 1;
OPT_stack ? trace("\n") : 1;
self->arg0 = 0;
self->arg1 = 0;
self->arg2 = 0;
}
/* print 3 arg output - default */
syscall:::return
/self->start/
{
/* calculate elapsed time */
this->elapsed = timestamp - self->start;
self->start = 0;
this->cpu = vtimestamp - self->vstart;
self->vstart = 0;
self->code = errno == 0 ? "" : "Err#";
/* print optional fields */
OPT_printid ? printf("%6d/%d: ", pid, tid) : 1;
OPT_relative ? printf("%8d ", vtimestamp/1000) : 1;
OPT_elapsed ? printf("%7d ", this->elapsed/1000) : 1;
OPT_cpu ? printf("%6d ", this->cpu/1000) : 1;
/* print main data */
printf("%s(0x%X, 0x%X, 0x%X)\t\t = %d %s%d\n", probefunc, self->arg0,
self->arg1, self->arg2, (int)arg0, self->code, (int)errno);
OPT_stack ? ustack() : 1;
OPT_stack ? trace("\n") : 1;
self->arg0 = 0;
self->arg1 = 0;
self->arg2 = 0;
}
/* program exited */
proc:::exit
/(OPT_command || OPT_pid) && pid == $target/
{
exit(0);
}
/* print counts */
dtrace:::END
{
OPT_counts == 1 ? printf("\n%-32s %16s\n", "CALL", "COUNT") : 1;
OPT_counts == 1 ? printa("%-32s %@16d\n", @Counts) : 1;
}
'
### Run DTrace
if [ $opt_command -eq 1 ]; then
/usr/sbin/dtrace -x dynvarsize=$buf -x evaltime=exec -n "$dtrace" \
-c "$command" >&2
elif [ $opt_pid -eq 1 ]; then
/usr/sbin/dtrace -x dynvarsize=$buf -n "$dtrace" -p "$pid" >&2
else
/usr/sbin/dtrace -x dynvarsize=$buf -n "$dtrace" >&2
fi
+21 -3
View File
@@ -773,19 +773,27 @@ compile_str(dtrace_cmd_t *dcp)
static void
prochandler(struct ps_prochandle *P, const char *msg, void *arg)
{
fatal("DOODAD in function %s, file %s, line %d\n",__FUNCTION__,__FILE__,__LINE__);
#ifdef DOODAD
#if defined(sun)
const psinfo_t *prp = Ppsinfo(P);
int pid = Pstatus(P)->pr_pid;
char name[SIG2STR_MAX];
#else
int wstatus = proc_getwstat(P);
int pid = proc_getpid(P);
#endif
if (msg != NULL) {
notice("pid %d: %s\n", pid, msg);
return;
}
#if defined(sun)
switch (Pstate(P)) {
#else
switch (proc_state(P)) {
#endif
case PS_UNDEAD:
#if defined(sun)
/*
* Ideally we would like to always report pr_wstat here, but it
* isn't possible given current /proc semantics. If we grabbed
@@ -798,9 +806,20 @@ fatal("DOODAD in function %s, file %s, line %d\n",__FUNCTION__,__FILE__,__LINE__
notice("pid %d terminated by %s\n", pid,
proc_signame(WTERMSIG(prp->pr_wstat),
name, sizeof (name)));
#else
if (WIFSIGNALED(wstatus)) {
notice("pid %d terminated by %d\n", pid,
WTERMSIG(wstatus));
#endif
#if defined(sun)
} else if (prp != NULL && WEXITSTATUS(prp->pr_wstat) != 0) {
notice("pid %d exited with status %d\n",
pid, WEXITSTATUS(prp->pr_wstat));
#else
} else if (WEXITSTATUS(wstatus) != 0) {
notice("pid %d exited with status %d\n",
pid, WEXITSTATUS(wstatus));
#endif
} else {
notice("pid %d has exited\n", pid);
}
@@ -812,7 +831,6 @@ fatal("DOODAD in function %s, file %s, line %d\n",__FUNCTION__,__FILE__,__LINE__
g_pslive--;
break;
}
#endif
}
/*ARGSUSED*/
@@ -20,12 +20,10 @@
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
@@ -162,7 +160,7 @@ main(int argc, char **argv)
FILE *fp;
unsigned char *dof, *copy;
if (argc < 1)
if (argc < 2)
fatal("expected D script as argument\n");
if ((fp = fopen(filename, "r")) == NULL)
@@ -20,12 +20,10 @@
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <strings.h>
#include <unistd.h>
#include <dtrace.h>
@@ -35,6 +33,7 @@ static int g_errs;
static int g_fd;
static int g_verbose;
static int g_errexit;
static char *g_progname;
static int
probe(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, void *data)
@@ -91,9 +90,11 @@ main(int argc, char *argv[])
int err, c;
char *p;
g_progname = argv[0];
if ((dtp = dtrace_open(DTRACE_VERSION, 0, &err)) == NULL) {
(void) fprintf(stderr, "%s: failed to open dtrace: %s\n",
argv[0], dtrace_errmsg(dtp, err));
g_progname, dtrace_errmsg(dtp, err));
return (1);
}
@@ -111,7 +112,7 @@ main(int argc, char *argv[])
if (dtrace_setopt(dtp, optarg, p) != 0) {
(void) fprintf(stderr, "%s: failed to set "
"option -x %s: %s\n", argv[0], optarg,
"option -x %s: %s\n", g_progname, optarg,
dtrace_errmsg(dtp, dtrace_errno(dtp)));
return (2);
}
@@ -119,7 +120,7 @@ main(int argc, char *argv[])
default:
(void) fprintf(stderr, "Usage: %s [-ev] "
"[-x opt[=arg]] [probedesc]\n", argv[0]);
"[-x opt[=arg]] [probedesc]\n", g_progname);
return (2);
}
}
@@ -128,9 +129,9 @@ main(int argc, char *argv[])
argc -= optind;
if (argc > 0) {
if (dtrace_str2desc(dtp, DTRACE_PROBESPEC_NAME, argv[1], &pd)) {
if (dtrace_str2desc(dtp, DTRACE_PROBESPEC_NAME, argv[0], &pd)) {
(void) fprintf(stderr, "%s: invalid probe description "
"%s: %s\n", argv[0], argv[1],
"%s: %s\n", g_progname, argv[0],
dtrace_errmsg(dtp, dtrace_errno(dtp)));
return (2);
}
+2 -3
View File
@@ -21,12 +21,11 @@
#
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#pragma ident "%Z%%M% %I% %E% SMI"
require 5.6.1;
require 5.8.4;
$PNAME = $0;
$PNAME =~ s:.*/::;
+15 -14
View File
@@ -24,9 +24,8 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
require 5.6.1;
require 5.8.4;
use File::Find;
use File::Basename;
@@ -40,10 +39,11 @@ $OPTSTR = 'abd:fghi:jlnqsx:';
$USAGE = "Usage: $PNAME [-abfghjlnqs] [-d dir] [-i isa] "
. "[-x opt[=arg]] [file | dir ...]\n";
($MACH = `uname -p`) =~ s/\W*\n//;
($PLATFORM = `uname -i`) =~ s/\W*\n//;
@dtrace_argv = ();
$ksh_path = '/bin/sh';
$ksh_path = '/usr/local/bin/ksh';
@files = ();
%exceptions = ();
@@ -215,17 +215,17 @@ sub is_exception {
}
#
# Iterate over the set of test files specified on the command-line or by
# a find on "$defdir/common" and "$defdir/$MACH" and execute each one.
# If the test file is executable, we fork and exec it. If the test is a
# .ksh file, we run it with $ksh_path. Otherwise we run dtrace -s on it.
# If the file is named tst.* we assume it should return exit status 0.
# If the file is named err.* we assume it should return exit status 1.
# If the file is named err.D_[A-Z0-9]+[.*].d we use dtrace -xerrtags and
# examine stderr to ensure that a matching error tag was produced.
# If the file is named drp.[A-Z0-9]+[.*].d we use dtrace -xdroptags and
# examine stderr to ensure that a matching drop tag was produced.
# If any *.out or *.err files are found we perform output comparisons.
# Iterate over the set of test files specified on the command-line or by a find
# on "$defdir/common", "$defdir/$MACH" and "$defdir/$PLATFORM" and execute each
# one. If the test file is executable, we fork and exec it. If the test is a
# .ksh file, we run it with $ksh_path. Otherwise we run dtrace -s on it. If
# the file is named tst.* we assume it should return exit status 0. If the
# file is named err.* we assume it should return exit status 1. If the file is
# named err.D_[A-Z0-9]+[.*].d we use dtrace -xerrtags and examine stderr to
# ensure that a matching error tag was produced. If the file is named
# drp.[A-Z0-9]+[.*].d we use dtrace -xdroptags and examine stderr to ensure
# that a matching drop tag was produced. If any *.out or *.err files are found
# we perform output comparisons.
#
# run_tests takes two arguments: The first is the pathname of the dtrace
# command to invoke when running the tests. The second is the pathname
@@ -548,6 +548,7 @@ $bindir = -d $dt_bin ? $dt_bin : '.';
find(\&wanted, "$defdir/common") if (scalar(@ARGV) == 0);
find(\&wanted, "$defdir/$MACH") if (scalar(@ARGV) == 0);
find(\&wanted, "$defdir/$PLATFORM") if (scalar(@ARGV) == 0);
die $USAGE if (scalar(@files) == 0);
$dtrace_path = '/usr/sbin/dtrace';
@@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* ASSERTION:
* stddev() should not accept a non-scalar value
*
* SECTION: Aggregations/Aggregations
*
*/
#pragma D option quiet
BEGIN
{
@a[pid] = stddev(probefunc);
}
@@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* ASSERTION:
* stddev() should not accept a call with no arguments
*
* SECTION: Aggregations/Aggregations
*
*/
#pragma D option quiet
BEGIN
{
@a[1] = stddev();
}
@@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* ASSERTION:
* stddev() should not have more than one argument
*
* SECTION: Aggregations/Aggregations
*
*/
#pragma D option quiet
BEGIN
{
@a[1] = stddev(1, 2);
}
@@ -0,0 +1,57 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* ASSERTION:
* Positive stddev() test
*
* SECTION: Aggregations/Aggregations
*
* NOTES:
* Verifies that printing a clear()'d aggregation with an stddev()
* aggregation function doesn't cause problems.
*
*/
#pragma D option quiet
tick-10ms
/i++ < 5/
{
@a = stddev(timestamp);
}
tick-10ms
/i == 5/
{
exit(2);
}
END
{
clear(@a);
exit(0);
}
@@ -20,15 +20,13 @@
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Multiple aggregates can be used within the same D script.
* Multiple aggregates can be used within the same D script.
*
* SECTION: Aggregations/Aggregations
*
@@ -52,9 +50,11 @@ tick-10ms
@c[pid] = avg(new_time);
@d[pid] = sum(new_time);
@e[pid] = quantize(new_time);
@f[timestamp] = max(new_time);
@g[timestamp] = quantize(new_time);
@h[timestamp] = lquantize(new_time, 0, 10000, 1000);
@f[pid] = stddev(new_time);
@g[timestamp] = max(new_time);
@h[timestamp] = quantize(new_time);
@i[timestamp] = lquantize(new_time, 0, 10000, 1000);
time_1 = time_2;
i++;
}
@@ -20,18 +20,16 @@
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Test multiple aggregations and the default output order
* Test multiple aggregations and the default output order
*
* SECTION: Aggregations/Aggregations;
* Aggregations/Output
* Aggregations/Output
*
*/
@@ -51,6 +49,7 @@ tick-10ms
@d = max(i);
@e = quantize(i);
@f = lquantize(i, 0, 1000, 100);
@g = stddev(i);
i += 100;
}
@@ -34,3 +34,4 @@
900 |@@@@ 1
>= 1000 | 0
287
@@ -20,19 +20,17 @@
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Test multiple aggregations and overriding default order with
* printa() statements.
* Test multiple aggregations and overriding default order with
* printa() statements.
*
* SECTION: Aggregations/Aggregations;
* Aggregations/Output
* Aggregations/Output
*
* NOTES: This is a simple verifiable test.
*
@@ -55,6 +53,7 @@ tick-10ms
@e = max(i);
@f = quantize(i);
@g = lquantize(i, 0, 1000, 100);
@h = stddev(i);
i += 100;
}
@@ -62,6 +61,7 @@ tick-10ms
tick-10ms
/i == 1000/
{
printa("%@d\n", @h);
printa("%@d\n", @g);
printa("%@d\n", @f);
printa("%@d\n", @e);
@@ -1,3 +1,4 @@
287
value ------------- Distribution ------------- count
< 0 | 0
@@ -20,20 +20,19 @@
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Positive stddev() test
* Positive stddev() test
*
* SECTION: Aggregations/Aggregations
*
* NOTES: This is a simple verifiable positive test of the stddev() function.
* printa() for one aggregation, default printing behavior for the other
* so that we exercise both code paths.
*/
#pragma D option quiet
@@ -60,5 +59,6 @@ BEGIN
@b = stddev(-5000000700);
@b = stddev(-5000000800);
@b = stddev(-5000000900);
printa("%@d\n", @a);
exit(0);
}
@@ -1,3 +1,3 @@
287
287
287
@@ -26,7 +26,6 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/dtrace.h>
#define INTFUNC(x) \
BEGIN \
@@ -39,13 +39,13 @@ BEGIN
}
BEGIN
/b[curthread->t_did] == 0/
/b[curthread->td_flags] == 0/
{
exit(0);
}
BEGIN
{
printf("value should be 0; value is %x!", b[curthread->t_did]);
printf("value should be 0; value is %x!", b[curthread->td_flags]);
exit(1);
}
@@ -0,0 +1,45 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Test to check that attempting to enable a valid event with a frequency
* lower than the default platform limit will fail.
*
* This test will fail if:
* 1) The system under test does not define the 'PAPI_tot_ins' event.
* 2) The 'dcpc-min-overflow' variable in dcpc.conf has been modified.
*/
#pragma D option quiet
BEGIN
{
exit(0);
}
cpc:::PAPI_tot_ins-all-100
{
}
@@ -0,0 +1,40 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Tests that specifying an overflow value containing extraneous characters
* (only digits are allowed) will fail.
*/
BEGIN
{
exit(0);
}
cpc:::PAPI_tot_ins-all-10000bonehead
{
@[probename] = count();
}
@@ -0,0 +1,40 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Tests that attempting to enable a probe containing a non existent event
* will fail.
*/
BEGIN
{
exit(0);
}
cpc:::PAPI_cpc_bad-all-10000
{
@[probename] = count();
}
@@ -0,0 +1,78 @@
#!/bin/ksh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# This tests that cpustat(1) should fail to start if the cpc provider
# is already calling the shots.
#
# This script will fail if:
# 1) The system under test does not define the 'PAPI_tot_ins'
# generic event.
script()
{
$dtrace -o $dtraceout -s /dev/stdin <<EOF
#pragma D option bufsize=128k
cpc:::PAPI_tot_ins-all-10000
{
@[probename] = count();
}
EOF
}
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
dtraceout=/tmp/dtrace.out.$$
script 2>/dev/null &
timeout=15
#
# Sleep while the above script fires into life. To guard against dtrace dying
# and us sleeping forever we allow 15 secs for this to happen. This should be
# enough for even the slowest systems.
#
while [ ! -f $dtraceout ]; do
sleep 1
timeout=$(($timeout-1))
if [ $timeout -eq 0 ]; then
echo "dtrace failed to start. Exiting."
exit 1
fi
done
cpustat -c PAPI_tot_ins 1 5
status=$?
rm $dtraceout
exit $status
@@ -0,0 +1,70 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# This tests that enablings from the cpc provider will fail if cpustat(1) is
# already master of the universe.
#
# This script will fail if:
# 1) The system under test does not define the 'PAPI_tot_ins'
# generic event.
script()
{
$dtrace -s /dev/stdin <<EOF
#pragma D option bufsize=128k
BEGIN
{
exit(0);
}
cpc:::PAPI_tot_ins-all-10000
{
@[probename] = count();
}
EOF
}
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
dtraceout=/tmp/dtrace.out.$$
cpustat -c PAPI_tot_ins 1 20 &
pid=$!
sleep 5
script 2>/dev/null
status=$?
kill $pid
exit $status
@@ -0,0 +1,77 @@
#!/bin/ksh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# This script ensures that cputrack(1M) will fail to start when the cpc
# provider has active enablings.
#
# The script will fail if:
# 1) The system under test does not define the 'PAPI_tot_ins' event.
#
script()
{
$dtrace -o $dtraceout -s /dev/stdin <<EOF
#pragma D option bufsize=128k
cpc:::PAPI_tot_ins-all-10000
{
@[probename] = count();
}
EOF
}
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
dtraceout=/tmp/dtrace.out.$$
script 2>/dev/null &
timeout=15
#
# Sleep while the above script fires into life. To guard against dtrace dying
# and us sleeping forever we allow 15 secs for this to happen. This should be
# enough for even the slowest systems.
#
while [ ! -f $dtraceout ]; do
sleep 1
timeout=$(($timeout-1))
if [ $timeout -eq 0 ]; then
echo "dtrace failed to start. Exiting."
exit 1
fi
done
cputrack -c PAPI_tot_ins sleep 10
status=$?
rm $dtraceout
exit $status
@@ -0,0 +1,70 @@
#!/bin/ksh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# This script ensures that cputrack(1) will terminate when the cpc provider
# kicks into life.
#
# The script will fail if:
# 1) The system under test does not define the 'PAPI_tot_ins' event.
#
script()
{
$dtrace -s /dev/stdin <<EOF
#pragma D option bufsize=128k
cpc:::PAPI_tot_ins-all-10000
{
@[probename] = count();
}
tick-1s
/n++ > 10/
{
exit(0);
}
EOF
}
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
cputrack -c PAPI_tot_ins sleep 20 &
cputrack_pid=$!
sleep 5
script 2>/dev/null &
wait $cputrack_pid
status=$?
rm $dtraceout
exit $status
@@ -0,0 +1,55 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Test to check that attempting to enable too many probes will fail.
*
* This test will fail if:
* 1) We ever execute on a platform which is capable of programming 10
* 'PAPI_tot_ins' events simultaneously (which no current platforms are
* capable of doing).
* 2) The system under test does not define the 'PAPI_tot_ins' event.
*/
#pragma D option quiet
BEGIN
{
exit(0);
}
cpc:::PAPI_tot_ins-all-10000,
cpc:::PAPI_tot_ins-all-10001,
cpc:::PAPI_tot_ins-all-10002,
cpc:::PAPI_tot_ins-all-10003,
cpc:::PAPI_tot_ins-all-10004,
cpc:::PAPI_tot_ins-all-10005,
cpc:::PAPI_tot_ins-all-10006,
cpc:::PAPI_tot_ins-all-10007,
cpc:::PAPI_tot_ins-all-10008,
cpc:::PAPI_tot_ins-all-10009
{
}
@@ -0,0 +1,107 @@
#!/bin/ksh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# This script verifies that we can fire a probe on each CPU that is in
# an online state.
#
# The script will fail if:
# 1) The system under test does not define the 'PAPI_tot_ins' event.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
numproc=`psrinfo | tail -1 | cut -f1`
cpu=0
dtraceout=/var/tmp/dtrace.out.$$
scriptout=/var/tmp/script.out.$$
spin()
{
while [ 1 ]; do
:
done
}
script()
{
$dtrace -o $dtraceout -s /dev/stdin <<EOF
#pragma D option bufsize=128k
#pragma D option quiet
cpc:::PAPI_tot_ins-user-10000
/cpus[cpu] != 1/
{
cpus[cpu] = 1;
@a[cpu] = count();
}
tick-1s
/n++ > 10/
{
printa(@a);
exit(0);
}
EOF
}
echo "" > $scriptout
while [ $cpu -le $numproc ]
do
if [ "`psrinfo -s $cpu 2> /dev/null`" -eq 1 ]; then
printf "%9d %16d\n" $cpu 1 >> $scriptout
spin &
allpids[$cpu]=$!
pbind -b $cpu $!
fi
cpu=$(($cpu+1))
done
echo "" >> $scriptout
script
diff $dtraceout $scriptout >/dev/null 2>&1
status=$?
# kill off the spinner processes
cpu=0
while [ $cpu -le $numproc ]
do
if [ "`psrinfo -s $cpu 2> /dev/null`" -eq 1 ]; then
kill ${allpids[$cpu]}
fi
cpu=$(($cpu+1))
done
rm $dtraceout
rm $scriptout
exit $status
@@ -0,0 +1,48 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Test that we can successfully enable a probe using a generic event.
* Currently, all platforms implement 'PAPI_tot_ins' so we'll use that.
* Note that this test will fail if the system under test does not
* implement that event.
*
* This test will fail if:
* 1) The system under test does not define the 'PAPI_tot_ins' event.
*/
#pragma D option quiet
#pragma D option bufsize=128k
cpc:::PAPI_tot_ins-all-10000
{
@[probename] = count();
}
tick-1s
/n++ > 10/
{
exit(0);
}
Loaded 100 of 4359 files, more files were not shown because too many files have changed in this diff. Show more