From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 00:59:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 649142C6; Sun, 14 Apr 2013 00:59:57 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 56CE01B15; Sun, 14 Apr 2013 00:59:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E0xvWm061495; Sun, 14 Apr 2013 00:59:57 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E0xvMr061494; Sun, 14 Apr 2013 00:59:57 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201304140059.r3E0xvMr061494@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Sun, 14 Apr 2013 00:59:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249457 - head/lib/libldns X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 00:59:57 -0000 Author: des Date: Sun Apr 14 00:59:56 2013 New Revision: 249457 URL: http://svnweb.freebsd.org/changeset/base/249457 Log: Clean up. Modified: head/lib/libldns/Makefile Modified: head/lib/libldns/Makefile ============================================================================== --- head/lib/libldns/Makefile Sun Apr 14 00:49:08 2013 (r249456) +++ head/lib/libldns/Makefile Sun Apr 14 00:59:56 2013 (r249457) @@ -5,45 +5,18 @@ LDNSDIR = ${.CURDIR}/../../contrib/ldns .PATH: ${LDNSDIR} ${LDNSDIR}/compat -LIB = ldns -INTERNALLIB = true +LIB= ldns +INTERNALLIB= true -CFLAGS += -I${LDNSDIR} +CFLAGS+= -I${LDNSDIR} -SRCS += buffer.c -SRCS += dane.c -SRCS += dname.c -SRCS += dnssec.c -SRCS += dnssec_sign.c -SRCS += dnssec_verify.c -SRCS += dnssec_zone.c -SRCS += duration.c -SRCS += error.c -SRCS += higher.c -SRCS += host2str.c -SRCS += host2wire.c -SRCS += keys.c -SRCS += net.c -SRCS += packet.c -SRCS += parse.c -SRCS += rbtree.c -SRCS += rdata.c -SRCS += resolver.c -SRCS += rr.c -SRCS += rr_functions.c -SRCS += sha1.c -SRCS += sha2.c -SRCS += str2host.c -SRCS += tsig.c -SRCS += update.c -SRCS += util.c -SRCS += wire2host.c -SRCS += zone.c - -SRCS += b32_ntop.c -SRCS += b32_pton.c -SRCS += b64_ntop.c -SRCS += b64_pton.c +SRCS= buffer.c dane.c dname.c dnssec.c dnssec_sign.c dnssec_verify.c \ + dnssec_zone.c duration.c error.c higher.c host2str.c host2wire.c \ + keys.c net.c packet.c parse.c rbtree.c rdata.c resolver.c rr.c \ + rr_functions.c sha1.c sha2.c str2host.c tsig.c update.c util.c \ + wire2host.c zone.c + +SRCS+= b32_ntop.c b32_pton.c b64_ntop.c b64_pton.c WARNS ?= 3 From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 02:26:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CD915C51; Sun, 14 Apr 2013 02:26:12 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BF33D1CFD; Sun, 14 Apr 2013 02:26:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E2QCRQ089043; Sun, 14 Apr 2013 02:26:12 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E2QC1w089041; Sun, 14 Apr 2013 02:26:12 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201304140226.r3E2QC1w089041@svn.freebsd.org> From: Hiren Panchasara Date: Sun, 14 Apr 2013 02:26:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249460 - head/sys/dev/hwpmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 02:26:12 -0000 Author: hiren Date: Sun Apr 14 02:26:12 2013 New Revision: 249460 URL: http://svnweb.freebsd.org/changeset/base/249460 Log: Improve/correct a comment. We now support a lot more cpu types. PR: kern/177496 Approved by: sbruno (mentor) Modified: head/sys/dev/hwpmc/hwpmc_core.c Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Sun Apr 14 01:22:39 2013 (r249459) +++ head/sys/dev/hwpmc/hwpmc_core.c Sun Apr 14 02:26:12 2013 (r249460) @@ -25,7 +25,7 @@ */ /* - * Intel Core, Core 2 and Atom PMCs. + * Intel Core PMCs. */ #include From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 02:42:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0ABFEF16; Sun, 14 Apr 2013 02:42:41 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EFD211D50; Sun, 14 Apr 2013 02:42:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E2gexq094404; Sun, 14 Apr 2013 02:42:40 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E2geSq094403; Sun, 14 Apr 2013 02:42:40 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201304140242.r3E2geSq094403@svn.freebsd.org> From: Hiren Panchasara Date: Sun, 14 Apr 2013 02:42:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249461 - head/sys/dev/ips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 02:42:41 -0000 Author: hiren Date: Sun Apr 14 02:42:40 2013 New Revision: 249461 URL: http://svnweb.freebsd.org/changeset/base/249461 Log: Fixing a clang warning indicating uninitialized variable usage. PR: kern/177164 Approved by: sbruno (mentor) Modified: head/sys/dev/ips/ips.c Modified: head/sys/dev/ips/ips.c ============================================================================== --- head/sys/dev/ips/ips.c Sun Apr 14 02:26:12 2013 (r249460) +++ head/sys/dev/ips/ips.c Sun Apr 14 02:42:40 2013 (r249461) @@ -578,7 +578,7 @@ static int ips_copperhead_queue_init(ips { int error; bus_dma_tag_t dmatag; - bus_dmamap_t dmamap; + bus_dmamap_t dmamap = NULL; if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, /* alignemnt */ 1, /* boundary */ 0, From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 08:40:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1576FC55; Sun, 14 Apr 2013 08:40:25 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 089316ED; Sun, 14 Apr 2013 08:40:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E8eOFP003624; Sun, 14 Apr 2013 08:40:24 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E8eO4n003623; Sun, 14 Apr 2013 08:40:24 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201304140840.r3E8eO4n003623@svn.freebsd.org> From: Joel Dahl Date: Sun, 14 Apr 2013 08:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249462 - head/usr.bin/calendar/calendars X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 08:40:25 -0000 Author: joel (doc committer) Date: Sun Apr 14 08:40:24 2013 New Revision: 249462 URL: http://svnweb.freebsd.org/changeset/base/249462 Log: Correct spelling is "Christiaan Huygens". Submitted by: James J. Lippard Obtained from: OpenBSD Modified: head/usr.bin/calendar/calendars/calendar.birthday Modified: head/usr.bin/calendar/calendars/calendar.birthday ============================================================================== --- head/usr.bin/calendar/calendars/calendar.birthday Sun Apr 14 02:42:40 2013 (r249461) +++ head/usr.bin/calendar/calendars/calendar.birthday Sun Apr 14 08:40:24 2013 (r249462) @@ -120,7 +120,7 @@ 04/10 William Booth born, 1829, founder of the Salvation Army 04/13 Thomas Jefferson, 3rd President of the United States, born Shadwell Plantation, Albemarle County, Virginia, 1743 -04/14 Christian Huygen born, 1629, physicist & astronomer; +04/14 Christiaan Huygen born, 1629, physicist & astronomer; discovered Saturn's rings 04/15 Leonardo da Vinci born, 1452 04/16 Charles (Charlie) Chaplin (Sir) born in London, 1889 From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 08:44:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DD9797A; Sun, 14 Apr 2013 08:44:12 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.78]) by mx1.freebsd.org (Postfix) with ESMTP id A0C8678C; Sun, 14 Apr 2013 08:44:12 +0000 (UTC) Received: from smtp.greenhost.nl ([213.108.104.138]) by smarthost1.greenhost.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1URIXh-0001zc-Ev; Sun, 14 Apr 2013 10:44:10 +0200 Received: from dhcp-077-251-158-153.chello.nl ([77.251.158.153] helo=pinky) by smtp.greenhost.nl with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1URIXg-00022m-Tm; Sun, 14 Apr 2013 10:44:09 +0200 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Joel Dahl" Subject: Re: svn commit: r249462 - head/usr.bin/calendar/calendars References: <201304140840.r3E8eO4n003623@svn.freebsd.org> Date: Sun, 14 Apr 2013 10:44:07 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Ronald Klop" Message-ID: In-Reply-To: <201304140840.r3E8eO4n003623@svn.freebsd.org> User-Agent: Opera Mail/12.15 (Win32) X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: / X-Spam-Score: 0.8 X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.1 X-Scan-Signature: 76f3589a93270604ea078d468a2051b3 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 08:44:12 -0000 Than you still miss a 's' at the end. Ronald. On Sun, 14 Apr 2013 10:40:24 +0200, Joel Dahl wrote: > Author: joel (doc committer) > Date: Sun Apr 14 08:40:24 2013 > New Revision: 249462 > URL: http://svnweb.freebsd.org/changeset/base/249462 > > Log: > Correct spelling is "Christiaan Huygens". > Submitted by: James J. Lippard > Obtained from: OpenBSD > > Modified: > head/usr.bin/calendar/calendars/calendar.birthday > > Modified: head/usr.bin/calendar/calendars/calendar.birthday > ============================================================================== > --- head/usr.bin/calendar/calendars/calendar.birthday Sun Apr 14 > 02:42:40 2013 (r249461) > +++ head/usr.bin/calendar/calendars/calendar.birthday Sun Apr 14 > 08:40:24 2013 (r249462) > @@ -120,7 +120,7 @@ > 04/10 William Booth born, 1829, founder of the Salvation Army > 04/13 Thomas Jefferson, 3rd President of the United States, born > Shadwell > Plantation, Albemarle County, Virginia, 1743 > -04/14 Christian Huygen born, 1629, physicist & astronomer; > +04/14 Christiaan Huygen born, 1629, physicist & astronomer; > discovered Saturn's rings > 04/15 Leonardo da Vinci born, 1452 > 04/16 Charles (Charlie) Chaplin (Sir) born in London, 1889 > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 08:47:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 77F8D224; Sun, 14 Apr 2013 08:47:02 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6B0B279E; Sun, 14 Apr 2013 08:47:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E8l2QW004691; Sun, 14 Apr 2013 08:47:02 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E8l2UM004690; Sun, 14 Apr 2013 08:47:02 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201304140847.r3E8l2UM004690@svn.freebsd.org> From: Joel Dahl Date: Sun, 14 Apr 2013 08:47:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249463 - head/usr.bin/calendar/calendars X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 08:47:02 -0000 Author: joel (doc committer) Date: Sun Apr 14 08:47:01 2013 New Revision: 249463 URL: http://svnweb.freebsd.org/changeset/base/249463 Log: LSD first synthesised 16/11/38, not 7/4/43. Submitted by: James J. Lippard Obtained from: OpenBSD Modified: head/usr.bin/calendar/calendars/calendar.history Modified: head/usr.bin/calendar/calendars/calendar.history ============================================================================== --- head/usr.bin/calendar/calendars/calendar.history Sun Apr 14 08:40:24 2013 (r249462) +++ head/usr.bin/calendar/calendars/calendar.history Sun Apr 14 08:47:01 2013 (r249463) @@ -99,7 +99,6 @@ 04/04 Martin Luther King assassinated in Memphis, Tennessee, 1968 04/04 NATO Established, 1949 04/06 Joseph Smith founds Mormon Church, 1830 -04/07 Albert Hofmann synthesizes LSD in Switzerland, 1943 04/07 Alewives run, Cape Cod 04/08 Matthew Flinders and Nicolas Baudin meet in Encounter Bay, 1802 04/09 Lee surrenders to Grant at Appomattox Courthouse, 1865 @@ -420,6 +419,7 @@ from McDonald's), 1971 11/15 Niagara Falls power plant startup, 1896 11/16 Opening of the Suez Canal, 1869 +11/16 Albert Hofmann synthesizes LSD in Switzerland, 1938 11/17 46,000 meteoroids fall over AZ in 20 minutes, 1966 11/17 Richard Nixon says "I am not a crook.", 1973 11/18 First hydrogen bomb blasts Enewetok, 1952 From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 08:49:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B078C3B8; Sun, 14 Apr 2013 08:49:35 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A36987B8; Sun, 14 Apr 2013 08:49:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E8nZZa005053; Sun, 14 Apr 2013 08:49:35 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E8nZZF005052; Sun, 14 Apr 2013 08:49:35 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201304140849.r3E8nZZF005052@svn.freebsd.org> From: Joel Dahl Date: Sun, 14 Apr 2013 08:49:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249464 - head/usr.bin/calendar/calendars X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 08:49:35 -0000 Author: joel (doc committer) Date: Sun Apr 14 08:49:35 2013 New Revision: 249464 URL: http://svnweb.freebsd.org/changeset/base/249464 Log: Fix typo from previous commit. Submitted by: Ronald Klop Modified: head/usr.bin/calendar/calendars/calendar.birthday Modified: head/usr.bin/calendar/calendars/calendar.birthday ============================================================================== --- head/usr.bin/calendar/calendars/calendar.birthday Sun Apr 14 08:47:01 2013 (r249463) +++ head/usr.bin/calendar/calendars/calendar.birthday Sun Apr 14 08:49:35 2013 (r249464) @@ -120,7 +120,7 @@ 04/10 William Booth born, 1829, founder of the Salvation Army 04/13 Thomas Jefferson, 3rd President of the United States, born Shadwell Plantation, Albemarle County, Virginia, 1743 -04/14 Christiaan Huygen born, 1629, physicist & astronomer; +04/14 Christiaan Huygens born, 1629, physicist & astronomer; discovered Saturn's rings 04/15 Leonardo da Vinci born, 1452 04/16 Charles (Charlie) Chaplin (Sir) born in London, 1889 From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 09:28:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 943767FA; Sun, 14 Apr 2013 09:28:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 842DF84C; Sun, 14 Apr 2013 09:28:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E9SG8t017194; Sun, 14 Apr 2013 09:28:16 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E9SE1G017182; Sun, 14 Apr 2013 09:28:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304140928.r3E9SE1G017182@svn.freebsd.org> From: Alexander Motin Date: Sun, 14 Apr 2013 09:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249466 - in head/sys/cam: . ata ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 09:28:16 -0000 Author: mav Date: Sun Apr 14 09:28:14 2013 New Revision: 249466 URL: http://svnweb.freebsd.org/changeset/base/249466 Log: MFprojects/camlock r248890, r248897, r248898, r248900, r248903, r248905, r248917, r248918, r248978, r249001, r249014, r249030: Remove multilevel freezing mechanism, implemented to handle specifics of the ATA/SATA error recovery, when post-reset recovery commands should be allocated when queues are already full of payload requests. Instead of removing frozen CCBs with specified range of priorities from the queue to provide free openings, use simple hack, allowing explicit CCBs over- allocation for requests with priority higher (numerically lower) then CAM_PRIORITY_OOB threshold. Simplify CCB allocation logic by removing SIM-level allocation queue. After that SIM-level queue manages only CCBs execution, while allocation logic is localized within each single device. Suggested by: gibbs Modified: head/sys/cam/ata/ata_da.c head/sys/cam/ata/ata_xpt.c head/sys/cam/cam.h head/sys/cam/cam_ccb.h head/sys/cam/cam_periph.c head/sys/cam/cam_periph.h head/sys/cam/cam_queue.c head/sys/cam/cam_queue.h head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt_internal.h head/sys/cam/cam_xpt_sim.h head/sys/cam/ctl/scsi_ctl.c head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_pass.c head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Sun Apr 14 09:05:40 2013 (r249465) +++ head/sys/cam/ata/ata_da.c Sun Apr 14 09:28:14 2013 (r249466) @@ -972,8 +972,6 @@ adaasync(void *callback_arg, u_int32_t c else break; cam_periph_acquire(periph); - cam_freeze_devq_arg(periph->path, - RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); xpt_schedule(periph, CAM_PRIORITY_DEV); } default: @@ -1297,15 +1295,11 @@ adaregister(struct cam_periph *periph, v cgd->ident_data.support.command1 & ATA_SUPPORT_LOOKAHEAD) { softc->state = ADA_STATE_RAHEAD; cam_periph_acquire(periph); - cam_freeze_devq_arg(periph->path, - RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); xpt_schedule(periph, CAM_PRIORITY_DEV); } else if (ADA_WC >= 0 && cgd->ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) { softc->state = ADA_STATE_WCACHE; cam_periph_acquire(periph); - cam_freeze_devq_arg(periph->path, - RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); xpt_schedule(periph, CAM_PRIORITY_DEV); } else softc->state = ADA_STATE_NORMAL; @@ -1587,8 +1581,6 @@ out: if (softc->flags & ADA_FLAG_PACK_INVALID) { softc->state = ADA_STATE_NORMAL; xpt_release_ccb(start_ccb); - cam_release_devq(periph->path, - RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); adaschedule(periph); cam_periph_release_locked(periph); return; @@ -1612,6 +1604,7 @@ out: ATA_SF_ENAB_WCACHE : ATA_SF_DIS_WCACHE, 0, 0); start_ccb->ccb_h.ccb_state = ADA_CCB_WCACHE; } + start_ccb->ccb_h.flags |= CAM_DEV_QFREEZE; xpt_action(start_ccb); break; } @@ -1624,11 +1617,13 @@ adadone(struct cam_periph *periph, union struct ada_softc *softc; struct ccb_ataio *ataio; struct ccb_getdev *cgd; + struct cam_path *path; softc = (struct ada_softc *)periph->softc; ataio = &done_ccb->ataio; + path = done_ccb->ccb_h.path; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adadone\n")); + CAM_DEBUG(path, CAM_DEBUG_TRACE, ("adadone\n")); switch (ataio->ccb_h.ccb_state & ADA_CCB_TYPE_MASK) { case ADA_CCB_BUFFER_IO: @@ -1656,8 +1651,7 @@ adadone(struct cam_periph *periph, union * XXX See if this is really a media * XXX change first? */ - xpt_print(periph->path, - "Invalidating pack\n"); + xpt_print(path, "Invalidating pack\n"); softc->flags |= ADA_FLAG_PACK_INVALID; } bp->bio_error = error; @@ -1670,7 +1664,7 @@ adadone(struct cam_periph *periph, union bp->bio_flags |= BIO_ERROR; } if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(done_ccb->ccb_h.path, + cam_release_devq(path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, @@ -1711,9 +1705,12 @@ adadone(struct cam_periph *periph, union { if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (adaerror(done_ccb, 0, 0) == ERESTART) { +out: + /* Drop freeze taken due to CAM_DEV_QFREEZE */ + cam_release_devq(path, 0, 0, 0, FALSE); return; } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { - cam_release_devq(done_ccb->ccb_h.path, + cam_release_devq(path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, @@ -1730,7 +1727,7 @@ adadone(struct cam_periph *periph, union * operation. */ cgd = (struct ccb_getdev *)done_ccb; - xpt_setup_ccb(&cgd->ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_ccb(&cgd->ccb_h, path, CAM_PRIORITY_NORMAL); cgd->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)cgd); if (ADA_WC >= 0 && @@ -1738,12 +1735,12 @@ adadone(struct cam_periph *periph, union softc->state = ADA_STATE_WCACHE; xpt_release_ccb(done_ccb); xpt_schedule(periph, CAM_PRIORITY_DEV); - return; + goto out; } softc->state = ADA_STATE_NORMAL; xpt_release_ccb(done_ccb); - cam_release_devq(periph->path, - RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); + /* Drop freeze taken due to CAM_DEV_QFREEZE */ + cam_release_devq(path, 0, 0, 0, FALSE); adaschedule(periph); cam_periph_release_locked(periph); return; @@ -1752,9 +1749,9 @@ adadone(struct cam_periph *periph, union { if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (adaerror(done_ccb, 0, 0) == ERESTART) { - return; + goto out; } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { - cam_release_devq(done_ccb->ccb_h.path, + cam_release_devq(path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, @@ -1772,8 +1769,8 @@ adadone(struct cam_periph *periph, union * operation. */ xpt_release_ccb(done_ccb); - cam_release_devq(periph->path, - RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); + /* Drop freeze taken due to CAM_DEV_QFREEZE */ + cam_release_devq(path, 0, 0, 0, FALSE); adaschedule(periph); cam_periph_release_locked(periph); return; Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Sun Apr 14 09:05:40 2013 (r249465) +++ head/sys/cam/ata/ata_xpt.c Sun Apr 14 09:28:14 2013 (r249466) @@ -249,12 +249,6 @@ proberegister(struct cam_periph *periph, return (status); } CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n")); - - /* - * Ensure nobody slip in until probe finish. - */ - cam_freeze_devq_arg(periph->path, - RELSIM_RELEASE_RUNLEVEL, CAM_RL_XPT + 1); probeschedule(periph); return(CAM_REQ_CMP); } @@ -661,6 +655,7 @@ negotiate: default: panic("probestart: invalid action state 0x%x\n", softc->action); } + start_ccb->ccb_h.flags |= CAM_DEV_QFREEZE; xpt_action(start_ccb); } @@ -708,12 +703,15 @@ probedone(struct cam_periph *periph, uni if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (cam_periph_error(done_ccb, 0, softc->restart ? (SF_NO_RECOVERY | SF_NO_RETRY) : 0, - NULL) == ERESTART) + NULL) == ERESTART) { +out: + /* Drop freeze taken due to CAM_DEV_QFREEZE flag set. */ + cam_release_devq(path, 0, 0, 0, FALSE); return; + } if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { /* Don't wedge the queue */ - xpt_release_devq(done_ccb->ccb_h.path, /*count*/1, - /*run_queue*/TRUE); + xpt_release_devq(path, /*count*/1, /*run_queue*/TRUE); } status = done_ccb->ccb_h.status & CAM_STATUS_MASK; if (softc->restart) { @@ -768,7 +766,7 @@ probedone(struct cam_periph *periph, uni PROBE_SET_ACTION(softc, PROBE_IDENTIFY_SAFTE); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } /* @@ -830,7 +828,7 @@ noerror: } xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } case PROBE_IDENTIFY: { @@ -864,7 +862,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SPINUP); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } ident_buf = &path->device->ident_data; if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) { @@ -954,7 +952,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SETMODE); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } case PROBE_SPINUP: if (bootverbose) @@ -963,7 +961,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_IDENTIFY); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; case PROBE_SETMODE: /* Set supported bits. */ bzero(&cts, sizeof(cts)); @@ -1034,7 +1032,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SETPM); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } /* FALLTHROUGH */ case PROBE_SETPM: @@ -1045,7 +1043,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SETAPST); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } /* FALLTHROUGH */ case PROBE_SETAPST: @@ -1055,7 +1053,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SETDMAAA); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } /* FALLTHROUGH */ case PROBE_SETDMAAA: @@ -1065,7 +1063,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SETAN); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } /* FALLTHROUGH */ case PROBE_SETAN: @@ -1077,15 +1075,14 @@ notsata: } xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; case PROBE_SET_MULTI: if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; xpt_acquire_device(path->device); done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); - xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, - done_ccb); + xpt_async(AC_FOUND_DEVICE, path, done_ccb); } PROBE_SET_ACTION(softc, PROBE_DONE); break; @@ -1118,7 +1115,7 @@ notsata: PROBE_SET_ACTION(softc, PROBE_FULL_INQUIRY); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } ata_device_transport(path); @@ -1127,7 +1124,7 @@ notsata: xpt_acquire_device(path->device); done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); - xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); + xpt_async(AC_FOUND_DEVICE, path, done_ccb); } PROBE_SET_ACTION(softc, PROBE_DONE); break; @@ -1145,7 +1142,7 @@ notsata: PROBE_SET_ACTION(softc, PROBE_PM_PRV); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; case PROBE_PM_PRV: softc->pm_prv = (done_ccb->ataio.res.lba_high << 24) + (done_ccb->ataio.res.lba_mid << 16) + @@ -1200,12 +1197,11 @@ notsata: xpt_acquire_device(path->device); done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); - xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, - done_ccb); + xpt_async(AC_FOUND_DEVICE, path, done_ccb); } else { done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); - xpt_async(AC_SCSI_AEN, done_ccb->ccb_h.path, done_ccb); + xpt_async(AC_SCSI_AEN, path, done_ccb); } PROBE_SET_ACTION(softc, PROBE_DONE); break; @@ -1250,8 +1246,7 @@ notsata: xpt_acquire_device(path->device); done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); - xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, - done_ccb); + xpt_async(AC_FOUND_DEVICE, path, done_ccb); } PROBE_SET_ACTION(softc, PROBE_DONE); break; @@ -1263,7 +1258,7 @@ done: softc->restart = 0; xpt_release_ccb(done_ccb); probeschedule(periph); - return; + goto out; } xpt_release_ccb(done_ccb); CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe completed\n")); @@ -1273,9 +1268,9 @@ done: done_ccb->ccb_h.status = found ? CAM_REQ_CMP : CAM_REQ_CMP_ERR; xpt_done(done_ccb); } + /* Drop freeze taken due to CAM_DEV_QFREEZE flag set. */ + cam_release_devq(path, 0, 0, 0, FALSE); cam_periph_invalidate(periph); - cam_release_devq(periph->path, - RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_XPT + 1, FALSE); cam_periph_release_locked(periph); } Modified: head/sys/cam/cam.h ============================================================================== --- head/sys/cam/cam.h Sun Apr 14 09:05:40 2013 (r249465) +++ head/sys/cam/cam.h Sun Apr 14 09:28:14 2013 (r249466) @@ -80,10 +80,9 @@ typedef struct { #define CAM_PRIORITY_BUS ((CAM_RL_BUS << 8) + 0x80) #define CAM_PRIORITY_XPT ((CAM_RL_XPT << 8) + 0x80) #define CAM_PRIORITY_DEV ((CAM_RL_DEV << 8) + 0x80) +#define CAM_PRIORITY_OOB (CAM_RL_DEV << 8) #define CAM_PRIORITY_NORMAL ((CAM_RL_NORMAL << 8) + 0x80) #define CAM_PRIORITY_NONE (u_int32_t)-1 -#define CAM_PRIORITY_TO_RL(x) ((x) >> 8) -#define CAM_RL_TO_PRIORITY(x) ((x) << 8) u_int32_t generation; int index; #define CAM_UNQUEUED_INDEX -1 Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Sun Apr 14 09:05:40 2013 (r249465) +++ head/sys/cam/cam_ccb.h Sun Apr 14 09:28:14 2013 (r249466) @@ -145,8 +145,6 @@ typedef enum { /* Path statistics (error counts, etc.) */ XPT_GDEV_STATS = 0x0c, /* Device statistics (error counts, etc.) */ - XPT_FREEZE_QUEUE = 0x0d, - /* Freeze device queue */ XPT_DEV_ADVINFO = 0x0e, /* Get/Set Device advanced information */ /* SCSI Control Functions: 0x10->0x1F */ @@ -749,7 +747,6 @@ struct ccb_relsim { #define RELSIM_RELEASE_AFTER_TIMEOUT 0x02 #define RELSIM_RELEASE_AFTER_CMDCMPLT 0x04 #define RELSIM_RELEASE_AFTER_QEMPTY 0x08 -#define RELSIM_RELEASE_RUNLEVEL 0x10 u_int32_t openings; u_int32_t release_timeout; /* Abstract argument. */ u_int32_t qfrozen_cnt; Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Sun Apr 14 09:05:40 2013 (r249465) +++ head/sys/cam/cam_periph.c Sun Apr 14 09:28:14 2013 (r249466) @@ -1117,21 +1117,12 @@ cam_periph_runccb(union ccb *ccb, void cam_freeze_devq(struct cam_path *path) { + struct ccb_hdr ccb_h; - cam_freeze_devq_arg(path, 0, 0); -} - -void -cam_freeze_devq_arg(struct cam_path *path, uint32_t flags, uint32_t arg) -{ - struct ccb_relsim crs; - - xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NONE); - crs.ccb_h.func_code = XPT_FREEZE_QUEUE; - crs.release_flags = flags; - crs.openings = arg; - crs.release_timeout = arg; - xpt_action((union ccb *)&crs); + xpt_setup_ccb(&ccb_h, path, /*priority*/1); + ccb_h.func_code = XPT_NOOP; + ccb_h.flags = CAM_DEV_QFREEZE; + xpt_action((union ccb *)&ccb_h); } u_int32_t Modified: head/sys/cam/cam_periph.h ============================================================================== --- head/sys/cam/cam_periph.h Sun Apr 14 09:05:40 2013 (r249465) +++ head/sys/cam/cam_periph.h Sun Apr 14 09:28:14 2013 (r249466) @@ -171,8 +171,6 @@ int cam_periph_ioctl(struct cam_periph cam_flags camflags, u_int32_t sense_flags)); void cam_freeze_devq(struct cam_path *path); -void cam_freeze_devq_arg(struct cam_path *path, u_int32_t flags, - uint32_t arg); u_int32_t cam_release_devq(struct cam_path *path, u_int32_t relsim_flags, u_int32_t opening_reduction, u_int32_t arg, int getcount_only); Modified: head/sys/cam/cam_queue.c ============================================================================== --- head/sys/cam/cam_queue.c Sun Apr 14 09:05:40 2013 (r249465) +++ head/sys/cam/cam_queue.c Sun Apr 14 09:28:14 2013 (r249466) @@ -230,15 +230,8 @@ int cam_devq_init(struct cam_devq *devq, int devices, int openings) { bzero(devq, sizeof(*devq)); - if (camq_init(&devq->alloc_queue, devices) != 0) { + if (camq_init(&devq->send_queue, devices) != 0) return (1); - } - if (camq_init(&devq->send_queue, devices) != 0) { - camq_fini(&devq->alloc_queue); - return (1); - } - devq->alloc_openings = openings; - devq->alloc_active = 0; devq->send_openings = openings; devq->send_active = 0; return (0); @@ -247,7 +240,6 @@ cam_devq_init(struct cam_devq *devq, int void cam_devq_free(struct cam_devq *devq) { - camq_fini(&devq->alloc_queue); camq_fini(&devq->send_queue); free(devq, M_CAMDEVQ); } @@ -257,11 +249,7 @@ cam_devq_resize(struct cam_devq *camq, i { u_int32_t retval; - retval = camq_resize(&camq->alloc_queue, devices); - - if (retval == CAM_REQ_CMP) - retval = camq_resize(&camq->send_queue, devices); - + retval = camq_resize(&camq->send_queue, devices); return (retval); } @@ -328,11 +316,10 @@ int cam_ccbq_init(struct cam_ccbq *ccbq, int openings) { bzero(ccbq, sizeof(*ccbq)); - if (camq_init(&ccbq->queue, openings + (CAM_RL_VALUES - 1)) != 0) { + if (camq_init(&ccbq->queue, openings + (CAM_RL_VALUES - 1)) != 0) return (1); - } ccbq->devq_openings = openings; - ccbq->dev_openings = openings; + ccbq->dev_openings = openings; return (0); } Modified: head/sys/cam/cam_queue.h ============================================================================== --- head/sys/cam/cam_queue.h Sun Apr 14 09:05:40 2013 (r249465) +++ head/sys/cam/cam_queue.h Sun Apr 14 09:28:14 2013 (r249466) @@ -48,7 +48,7 @@ struct camq { int array_size; int entries; u_int32_t generation; - u_int32_t qfrozen_cnt[CAM_RL_VALUES]; + u_int32_t qfrozen_cnt; }; TAILQ_HEAD(ccb_hdr_tailq, ccb_hdr); @@ -58,7 +58,8 @@ SLIST_HEAD(ccb_hdr_slist, ccb_hdr); struct cam_ccbq { struct camq queue; int devq_openings; - int dev_openings; + int devq_allocating; + int dev_openings; int dev_active; int held; }; @@ -66,11 +67,7 @@ struct cam_ccbq { struct cam_ed; struct cam_devq { - struct camq alloc_queue; struct camq send_queue; - struct cam_ed *active_dev; - int alloc_openings; - int alloc_active; int send_openings; int send_active; }; @@ -195,8 +192,7 @@ cam_ccbq_insert_ccb(struct cam_ccbq *ccb { ccbq->held--; camq_insert(&ccbq->queue, &new_ccb->ccb_h.pinfo); - if (ccbq->queue.qfrozen_cnt[CAM_PRIORITY_TO_RL( - new_ccb->ccb_h.pinfo.priority)] > 0) { + if (ccbq->queue.qfrozen_cnt > 0) { ccbq->devq_openings++; ccbq->held++; return (1); @@ -208,8 +204,7 @@ static __inline int cam_ccbq_remove_ccb(struct cam_ccbq *ccbq, union ccb *ccb) { camq_remove(&ccbq->queue, ccb->ccb_h.pinfo.index); - if (ccbq->queue.qfrozen_cnt[CAM_PRIORITY_TO_RL( - ccb->ccb_h.pinfo.priority)] > 0) { + if (ccbq->queue.qfrozen_cnt > 0) { ccbq->devq_openings--; ccbq->held--; return (1); @@ -248,81 +243,5 @@ cam_ccbq_release_opening(struct cam_ccbq ccbq->devq_openings++; } -static __inline int -cam_ccbq_freeze(struct cam_ccbq *ccbq, cam_rl rl, u_int32_t cnt) -{ - int i, frozen = 0; - cam_rl p, n; - - /* Find pevious run level. */ - for (p = 0; p < CAM_RL_VALUES && ccbq->queue.qfrozen_cnt[p] == 0; p++); - /* Find new run level. */ - n = min(rl, p); - /* Apply new run level. */ - for (i = rl; i < CAM_RL_VALUES; i++) - ccbq->queue.qfrozen_cnt[i] += cnt; - /* Update ccbq statistics. */ - if (n == p) - return (0); - for (i = CAMQ_HEAD; i <= ccbq->queue.entries; i++) { - cam_rl rrl = - CAM_PRIORITY_TO_RL(ccbq->queue.queue_array[i]->priority); - if (rrl < n) - continue; - if (rrl >= p) - break; - ccbq->devq_openings++; - ccbq->held++; - frozen++; - } - return (frozen); -} - -static __inline int -cam_ccbq_release(struct cam_ccbq *ccbq, cam_rl rl, u_int32_t cnt) -{ - int i, released = 0; - cam_rl p, n; - - /* Apply new run level. */ - for (i = rl; i < CAM_RL_VALUES; i++) - ccbq->queue.qfrozen_cnt[i] -= cnt; - /* Find new run level. */ - for (n = 0; n < CAM_RL_VALUES && ccbq->queue.qfrozen_cnt[n] == 0; n++); - /* Find previous run level. */ - p = min(rl, n); - /* Update ccbq statistics. */ - if (n == p) - return (0); - for (i = CAMQ_HEAD; i <= ccbq->queue.entries; i++) { - cam_rl rrl = - CAM_PRIORITY_TO_RL(ccbq->queue.queue_array[i]->priority); - if (rrl < p) - continue; - if (rrl >= n) - break; - ccbq->devq_openings--; - ccbq->held--; - released++; - } - return (released); -} - -static __inline u_int32_t -cam_ccbq_frozen(struct cam_ccbq *ccbq, cam_rl rl) -{ - - return (ccbq->queue.qfrozen_cnt[rl]); -} - -static __inline u_int32_t -cam_ccbq_frozen_top(struct cam_ccbq *ccbq) -{ - cam_rl rl; - - rl = CAM_PRIORITY_TO_RL(CAMQ_GET_PRIO(&ccbq->queue)); - return (ccbq->queue.qfrozen_cnt[rl]); -} - #endif /* _KERNEL */ #endif /* _CAM_CAM_QUEUE_H */ Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Apr 14 09:05:40 2013 (r249465) +++ head/sys/cam/cam_xpt.c Sun Apr 14 09:28:14 2013 (r249466) @@ -223,13 +223,13 @@ static void xpt_async_bcast(struct asyn static path_id_t xptnextfreepathid(void); static path_id_t xptpathid(const char *sim_name, int sim_unit, int sim_bus); static union ccb *xpt_get_ccb(struct cam_ed *device); -static void xpt_run_dev_allocq(struct cam_eb *bus); -static void xpt_run_dev_sendq(struct cam_eb *bus); +static void xpt_run_dev_allocq(struct cam_ed *device); +static void xpt_run_devq(struct cam_devq *devq); static timeout_t xpt_release_devq_timeout; static void xpt_release_simq_timeout(void *arg) __unused; static void xpt_release_bus(struct cam_eb *bus); -static void xpt_release_devq_device(struct cam_ed *dev, cam_rl rl, - u_int count, int run_queue); +static void xpt_release_devq_device(struct cam_ed *dev, u_int count, + int run_queue); static struct cam_et* xpt_alloc_target(struct cam_eb *bus, target_id_t target_id); static void xpt_release_target(struct cam_et *target); @@ -296,49 +296,24 @@ static xpt_busfunc_t xptsetasyncbusfunc; static cam_status xptregister(struct cam_periph *periph, void *arg); static __inline int periph_is_queued(struct cam_periph *periph); -static __inline int device_is_alloc_queued(struct cam_ed *device); -static __inline int device_is_send_queued(struct cam_ed *device); +static __inline int device_is_queued(struct cam_ed *device); static __inline int -xpt_schedule_dev_allocq(struct cam_eb *bus, struct cam_ed *dev) -{ - int retval; - - if ((dev->drvq.entries > 0) && - (dev->ccbq.devq_openings > 0) && - (cam_ccbq_frozen(&dev->ccbq, CAM_PRIORITY_TO_RL( - CAMQ_GET_PRIO(&dev->drvq))) == 0)) { - /* - * The priority of a device waiting for CCB resources - * is that of the highest priority peripheral driver - * enqueued. - */ - retval = xpt_schedule_dev(&bus->sim->devq->alloc_queue, - &dev->alloc_ccb_entry.pinfo, - CAMQ_GET_PRIO(&dev->drvq)); - } else { - retval = 0; - } - - return (retval); -} - -static __inline int -xpt_schedule_dev_sendq(struct cam_eb *bus, struct cam_ed *dev) +xpt_schedule_devq(struct cam_devq *devq, struct cam_ed *dev) { int retval; if ((dev->ccbq.queue.entries > 0) && (dev->ccbq.dev_openings > 0) && - (cam_ccbq_frozen_top(&dev->ccbq) == 0)) { + (dev->ccbq.queue.qfrozen_cnt == 0)) { /* * The priority of a device waiting for controller * resources is that of the highest priority CCB * enqueued. */ retval = - xpt_schedule_dev(&bus->sim->devq->send_queue, - &dev->send_ccb_entry.pinfo, + xpt_schedule_dev(&devq->send_queue, + &dev->devq_entry.pinfo, CAMQ_GET_PRIO(&dev->ccbq.queue)); } else { retval = 0; @@ -353,15 +328,9 @@ periph_is_queued(struct cam_periph *peri } static __inline int -device_is_alloc_queued(struct cam_ed *device) -{ - return (device->alloc_ccb_entry.pinfo.index != CAM_UNQUEUED_INDEX); -} - -static __inline int -device_is_send_queued(struct cam_ed *device) +device_is_queued(struct cam_ed *device) { - return (device->send_ccb_entry.pinfo.index != CAM_UNQUEUED_INDEX); + return (device->devq_entry.pinfo.index != CAM_UNQUEUED_INDEX); } static void @@ -2487,17 +2456,10 @@ xpt_action_default(union ccb *start_ccb) case XPT_RESET_DEV: case XPT_ENG_EXEC: case XPT_SMP_IO: - { - int frozen; - - frozen = cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); - path->device->sim->devq->alloc_openings += frozen; - if (frozen > 0) - xpt_run_dev_allocq(path->bus); - if (xpt_schedule_dev_sendq(path->bus, path->device)) - xpt_run_dev_sendq(path->bus); + cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); + if (xpt_schedule_devq(path->bus->sim->devq, path->device)) + xpt_run_devq(path->bus->sim->devq); break; - } case XPT_CALC_GEOMETRY: { struct cam_sim *sim; @@ -2546,8 +2508,7 @@ xpt_action_default(union ccb *start_ccb) device = abort_ccb->ccb_h.path->device; ccbq = &device->ccbq; - device->sim->devq->alloc_openings -= - cam_ccbq_remove_ccb(ccbq, abort_ccb); + cam_ccbq_remove_ccb(ccbq, abort_ccb); abort_ccb->ccb_h.status = CAM_REQ_ABORTED|CAM_DEV_QFRZN; xpt_freeze_devq(abort_ccb->ccb_h.path, 1); @@ -2928,13 +2889,9 @@ xpt_action_default(union ccb *start_ccb) } } - if ((start_ccb->ccb_h.flags & CAM_DEV_QFREEZE) == 0) { - xpt_release_devq_rl(path, /*runlevel*/ - (crs->release_flags & RELSIM_RELEASE_RUNLEVEL) ? - crs->release_timeout : 0, - /*count*/1, /*run_queue*/TRUE); - } - start_ccb->crs.qfrozen_cnt = dev->ccbq.queue.qfrozen_cnt[0]; + if ((start_ccb->ccb_h.flags & CAM_DEV_QFREEZE) == 0) + xpt_release_devq(path, /*count*/1, /*run_queue*/TRUE); + start_ccb->crs.qfrozen_cnt = dev->ccbq.queue.qfrozen_cnt; start_ccb->ccb_h.status = CAM_REQ_CMP; break; } @@ -2977,16 +2934,6 @@ xpt_action_default(union ccb *start_ccb) start_ccb->ccb_h.status = CAM_REQ_CMP; break; } - case XPT_FREEZE_QUEUE: - { - struct ccb_relsim *crs = &start_ccb->crs; - - xpt_freeze_devq_rl(path, /*runlevel*/ - (crs->release_flags & RELSIM_RELEASE_RUNLEVEL) ? - crs->release_timeout : 0, /*count*/1); - start_ccb->ccb_h.status = CAM_REQ_CMP; - break; - } case XPT_NOOP: if ((start_ccb->ccb_h.flags & CAM_DEV_QFREEZE) != 0) xpt_freeze_devq(path, 1); @@ -3092,7 +3039,7 @@ xpt_schedule(struct cam_periph *perph, u camq_change_priority(&device->drvq, perph->pinfo.index, new_priority); - runq = xpt_schedule_dev_allocq(perph->path->bus, device); + runq = 1; } } else { /* New entry on the queue */ @@ -3101,12 +3048,12 @@ xpt_schedule(struct cam_periph *perph, u perph->pinfo.priority = new_priority; perph->pinfo.generation = ++device->drvq.generation; camq_insert(&device->drvq, &perph->pinfo); - runq = xpt_schedule_dev_allocq(perph->path->bus, device); + runq = 1; } if (runq != 0) { CAM_DEBUG(perph->path, CAM_DEBUG_SUBTRACE, - (" calling xpt_run_devq\n")); - xpt_run_dev_allocq(perph->path->bus); + (" calling xpt_run_dev_allocq\n")); + xpt_run_dev_allocq(device); } } @@ -3159,43 +3106,25 @@ xpt_schedule_dev(struct camq *queue, cam } static void -xpt_run_dev_allocq(struct cam_eb *bus) +xpt_run_dev_allocq(struct cam_ed *device) { - struct cam_devq *devq; - - CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_dev_allocq\n")); - devq = bus->sim->devq; + struct camq *drvq; - CAM_DEBUG_PRINT(CAM_DEBUG_XPT, - (" qfrozen_cnt == 0x%x, entries == %d, " - "openings == %d, active == %d\n", - devq->alloc_queue.qfrozen_cnt[0], - devq->alloc_queue.entries, - devq->alloc_openings, - devq->alloc_active)); - - devq->alloc_queue.qfrozen_cnt[0]++; - while ((devq->alloc_queue.entries > 0) - && (devq->alloc_openings > 0) - && (devq->alloc_queue.qfrozen_cnt[0] <= 1)) { - struct cam_ed_qinfo *qinfo; - struct cam_ed *device; + if (device->ccbq.devq_allocating) + return; + device->ccbq.devq_allocating = 1; + CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_dev_allocq(%p)\n", device)); + drvq = &device->drvq; + while ((drvq->entries > 0) && + (device->ccbq.devq_openings > 0 || + CAMQ_GET_PRIO(drvq) <= CAM_PRIORITY_OOB) && + (device->ccbq.queue.qfrozen_cnt == 0)) { union ccb *work_ccb; struct cam_periph *drv; - struct camq *drvq; - qinfo = (struct cam_ed_qinfo *)camq_remove(&devq->alloc_queue, - CAMQ_HEAD); - device = qinfo->device; - CAM_DEBUG_PRINT(CAM_DEBUG_XPT, - ("running device %p\n", device)); - - drvq = &device->drvq; KASSERT(drvq->entries > 0, ("xpt_run_dev_allocq: " "Device on queue without any work to do")); if ((work_ccb = xpt_get_ccb(device)) != NULL) { - devq->alloc_openings--; - devq->alloc_active++; drv = (struct cam_periph*)camq_remove(drvq, CAMQ_HEAD); xpt_setup_ccb(&work_ccb->ccb_h, drv->path, drv->pinfo.priority); @@ -3214,27 +3143,21 @@ xpt_run_dev_allocq(struct cam_eb *bus) */ break; } - - /* We may have more work. Attempt to reschedule. */ - xpt_schedule_dev_allocq(bus, device); } - devq->alloc_queue.qfrozen_cnt[0]--; + device->ccbq.devq_allocating = 0; } static void -xpt_run_dev_sendq(struct cam_eb *bus) +xpt_run_devq(struct cam_devq *devq) { - struct cam_devq *devq; char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; - CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_dev_sendq\n")); - - devq = bus->sim->devq; + CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_devq\n")); - devq->send_queue.qfrozen_cnt[0]++; + devq->send_queue.qfrozen_cnt++; while ((devq->send_queue.entries > 0) && (devq->send_openings > 0) - && (devq->send_queue.qfrozen_cnt[0] <= 1)) { + && (devq->send_queue.qfrozen_cnt <= 1)) { struct cam_ed_qinfo *qinfo; struct cam_ed *device; union ccb *work_ccb; @@ -3284,9 +3207,9 @@ xpt_run_dev_sendq(struct cam_eb *bus) devq->send_openings--; devq->send_active++; - xpt_schedule_dev_sendq(bus, device); + xpt_schedule_devq(devq, device); - if (work_ccb && (work_ccb->ccb_h.flags & CAM_DEV_QFREEZE) != 0){ + if ((work_ccb->ccb_h.flags & CAM_DEV_QFREEZE) != 0) { /* * The client wants to freeze the queue * after this CCB is sent. @@ -3336,7 +3259,7 @@ xpt_run_dev_sendq(struct cam_eb *bus) sim = work_ccb->ccb_h.path->bus->sim; (*(sim->sim_action))(sim, work_ccb); } - devq->send_queue.qfrozen_cnt[0]--; + devq->send_queue.qfrozen_cnt--; } /* @@ -3799,14 +3722,7 @@ xpt_release_ccb(union ccb *free_ccb) SLIST_INSERT_HEAD(&sim->ccb_freeq, &free_ccb->ccb_h, xpt_links.sle); } - if (sim->devq == NULL) { - return; - } - sim->devq->alloc_openings++; - sim->devq->alloc_active--; - if (device_is_alloc_queued(device) == 0) - xpt_schedule_dev_allocq(bus, device); - xpt_run_dev_allocq(bus); + xpt_run_dev_allocq(device); } /* Functions accessed by SIM drivers */ @@ -4153,34 +4069,18 @@ xpt_dev_async_default(u_int32_t async_co } u_int32_t -xpt_freeze_devq_rl(struct cam_path *path, cam_rl rl, u_int count) +xpt_freeze_devq(struct cam_path *path, u_int count) { struct cam_ed *dev = path->device; mtx_assert(path->bus->sim->mtx, MA_OWNED); - dev->sim->devq->alloc_openings += - cam_ccbq_freeze(&dev->ccbq, rl, count); - /* Remove frozen device from allocq. */ - if (device_is_alloc_queued(dev) && - cam_ccbq_frozen(&dev->ccbq, CAM_PRIORITY_TO_RL( - CAMQ_GET_PRIO(&dev->drvq)))) { - camq_remove(&dev->sim->devq->alloc_queue, - dev->alloc_ccb_entry.pinfo.index); - } + dev->ccbq.queue.qfrozen_cnt += count; /* Remove frozen device from sendq. */ - if (device_is_send_queued(dev) && - cam_ccbq_frozen_top(&dev->ccbq)) { + if (device_is_queued(dev)) { camq_remove(&dev->sim->devq->send_queue, - dev->send_ccb_entry.pinfo.index); + dev->devq_entry.pinfo.index); } - return (dev->ccbq.queue.qfrozen_cnt[rl]); -} - -u_int32_t -xpt_freeze_devq(struct cam_path *path, u_int count) -{ - - return (xpt_freeze_devq_rl(path, 0, count)); + return (dev->ccbq.queue.qfrozen_cnt); } u_int32_t @@ -4188,8 +4088,8 @@ xpt_freeze_simq(struct cam_sim *sim, u_i { mtx_assert(sim->mtx, MA_OWNED); - sim->devq->send_queue.qfrozen_cnt[0] += count; - return (sim->devq->send_queue.qfrozen_cnt[0]); + sim->devq->send_queue.qfrozen_cnt += count; + return (sim->devq->send_queue.qfrozen_cnt); } static void @@ -4198,45 +4098,30 @@ xpt_release_devq_timeout(void *arg) struct cam_ed *device; device = (struct cam_ed *)arg; - - xpt_release_devq_device(device, /*rl*/0, /*count*/1, /*run_queue*/TRUE); + xpt_release_devq_device(device, /*count*/1, /*run_queue*/TRUE); } void xpt_release_devq(struct cam_path *path, u_int count, int run_queue) { - mtx_assert(path->bus->sim->mtx, MA_OWNED); - xpt_release_devq_device(path->device, /*rl*/0, count, run_queue); -} - -void -xpt_release_devq_rl(struct cam_path *path, cam_rl rl, u_int count, int run_queue) -{ mtx_assert(path->bus->sim->mtx, MA_OWNED); - - xpt_release_devq_device(path->device, rl, count, run_queue); + xpt_release_devq_device(path->device, count, run_queue); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 09:55:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DADB5DA3; Sun, 14 Apr 2013 09:55:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BDFD18FB; Sun, 14 Apr 2013 09:55:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E9trVe025781; Sun, 14 Apr 2013 09:55:53 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E9tmv4025746; Sun, 14 Apr 2013 09:55:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304140955.r3E9tmv4025746@svn.freebsd.org> From: Alexander Motin Date: Sun, 14 Apr 2013 09:55:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249468 - in head/sys: cam cam/ata cam/ctl cam/scsi dev/aac dev/arcmsr dev/ciss dev/firewire dev/hpt27xx dev/hptiop dev/hptrr dev/isci dev/iscsi/initiator dev/isp dev/mfi dev/mly dev/mp... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 09:55:53 -0000 Author: mav Date: Sun Apr 14 09:55:48 2013 New Revision: 249468 URL: http://svnweb.freebsd.org/changeset/base/249468 Log: MFprojects/camlock r248982: Stop abusing xpt_periph in random plases that really have no periph related to CCB, for example, bus scanning. NULL value is fine in such cases and it is correctly logged in debug messages as "noperiph". If at some point we need some real XPT periphs (alike to pmpX now), quite likely they will be per-bus, and not a single global instance as xpt_periph now. Modified: head/sys/cam/ata/ata_xpt.c head/sys/cam/cam_xpt.c head/sys/cam/ctl/ctl_frontend_cam_sim.c head/sys/cam/scsi/scsi_xpt.c head/sys/dev/aac/aac_cam.c head/sys/dev/arcmsr/arcmsr.c head/sys/dev/ciss/ciss.c head/sys/dev/firewire/sbp.c head/sys/dev/hpt27xx/osm_bsd.c head/sys/dev/hptiop/hptiop.c head/sys/dev/hptrr/hptrr_osm_bsd.c head/sys/dev/isci/isci_controller.c head/sys/dev/isci/isci_domain.c head/sys/dev/isci/isci_remote_device.c head/sys/dev/iscsi/initiator/isc_cam.c head/sys/dev/isp/isp_freebsd.c head/sys/dev/mfi/mfi_cam.c head/sys/dev/mly/mly.c head/sys/dev/mps/mps_sas.c head/sys/dev/mpt/mpt_cam.c head/sys/dev/mpt/mpt_raid.c head/sys/dev/twa/tw_osl_cam.c head/sys/dev/tws/tws_cam.c head/sys/dev/virtio/scsi/virtio_scsi.c Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/cam/ata/ata_xpt.c Sun Apr 14 09:55:48 2013 (r249468) @@ -1439,7 +1439,7 @@ done: scan_info->counter = (scan_info->counter + 1 ) % (scan_info->cpi->max_target + 1); scan_next: - status = xpt_create_path(&path, xpt_periph, + status = xpt_create_path(&path, NULL, scan_info->request_ccb->ccb_h.path_id, scan_info->counter, 0); if (status != CAM_REQ_CMP) { @@ -1497,7 +1497,7 @@ ata_scan_lun(struct cam_periph *periph, "can't continue\n"); return; } - status = xpt_create_path(&new_path, xpt_periph, + status = xpt_create_path(&new_path, NULL, path->bus->path_id, path->target->target_id, path->device->lun_id); Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/cam/cam_xpt.c Sun Apr 14 09:55:48 2013 (r249468) @@ -451,7 +451,7 @@ xptioctl(struct cdev *dev, u_long cmd, c * Create a path using the bus, target, and lun the * user passed in. */ - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + if (xpt_create_path(&ccb->ccb_h.path, NULL, inccb->ccb_h.path_id, inccb->ccb_h.target_id, inccb->ccb_h.target_lun) != @@ -487,7 +487,7 @@ xptioctl(struct cdev *dev, u_long cmd, c * Create a path using the bus, target, and lun the * user passed in. */ - if (xpt_create_path(&ccb.ccb_h.path, xpt_periph, + if (xpt_create_path(&ccb.ccb_h.path, NULL, inccb->ccb_h.path_id, inccb->ccb_h.target_id, inccb->ccb_h.target_lun) != @@ -2918,7 +2918,7 @@ xpt_action_default(union ccb *start_ccb) CAM_SIM_LOCK(xpt_path_sim(start_ccb->ccb_h.path)); } if (start_ccb->cdbg.flags != CAM_DEBUG_NONE) { - if (xpt_create_path(&cam_dpath, xpt_periph, + if (xpt_create_path(&cam_dpath, NULL, start_ccb->ccb_h.path_id, start_ccb->ccb_h.target_id, start_ccb->ccb_h.target_lun) != @@ -4640,7 +4640,7 @@ xpt_config(void *arg) /* Setup debugging path */ if (cam_dflags != CAM_DEBUG_NONE) { - if (xpt_create_path_unlocked(&cam_dpath, xpt_periph, + if (xpt_create_path_unlocked(&cam_dpath, NULL, CAM_DEBUG_BUS, CAM_DEBUG_TARGET, CAM_DEBUG_LUN) != CAM_REQ_CMP) { printf("xpt_config: xpt_create_path() failed for debug" Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Apr 14 09:55:48 2013 (r249468) @@ -311,7 +311,7 @@ cfcs_onoffline(void *arg, int online) goto bailout; } - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(softc->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { printf("%s: can't allocate path for rescan\n", __func__); Modified: head/sys/cam/scsi/scsi_xpt.c ============================================================================== --- head/sys/cam/scsi/scsi_xpt.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/cam/scsi/scsi_xpt.c Sun Apr 14 09:55:48 2013 (r249468) @@ -1953,7 +1953,7 @@ scsi_scan_bus(struct cam_periph *periph, if (i == initiator_id) continue; - status = xpt_create_path(&path, xpt_periph, + status = xpt_create_path(&path, NULL, request_ccb->ccb_h.path_id, i, 0); if (status != CAM_REQ_CMP) { @@ -2154,7 +2154,7 @@ scsi_scan_bus(struct cam_periph *periph, xpt_free_ccb(request_ccb); break; } - status = xpt_create_path(&path, xpt_periph, + status = xpt_create_path(&path, NULL, scan_info->request_ccb->ccb_h.path_id, scan_info->counter, 0); if (status != CAM_REQ_CMP) { @@ -2177,7 +2177,7 @@ scsi_scan_bus(struct cam_periph *periph, request_ccb->crcn.flags = scan_info->request_ccb->crcn.flags; } else { - status = xpt_create_path(&path, xpt_periph, + status = xpt_create_path(&path, NULL, path_id, target_id, lun_id); /* * Free the old request path- we're done with it. We @@ -2250,7 +2250,7 @@ scsi_scan_lun(struct cam_periph *periph, "can't continue\n"); return; } - status = xpt_create_path(&new_path, xpt_periph, + status = xpt_create_path(&new_path, NULL, path->bus->path_id, path->target->target_id, path->device->lun_id); Modified: head/sys/dev/aac/aac_cam.c ============================================================================== --- head/sys/dev/aac/aac_cam.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/aac/aac_cam.c Sun Apr 14 09:55:48 2013 (r249468) @@ -129,7 +129,7 @@ aac_cam_rescan(struct aac_softc *sc, uin return; } - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(camsc->sim), target_id, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_free_ccb(ccb); Modified: head/sys/dev/arcmsr/arcmsr.c ============================================================================== --- head/sys/dev/arcmsr/arcmsr.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/arcmsr/arcmsr.c Sun Apr 14 09:55:48 2013 (r249468) @@ -1599,7 +1599,8 @@ static void arcmsr_rescan_lun(struct Ada if ((ccb = (union ccb *)xpt_alloc_ccb_nowait()) == NULL) return; - if (xpt_create_path(&path, xpt_periph, cam_sim_path(acb->psim), target, lun) != CAM_REQ_CMP) + if (xpt_create_path(&path, NULL, cam_sim_path(acb->psim), target, lun) + != CAM_REQ_CMP) { xpt_free_ccb(ccb); return; Modified: head/sys/dev/ciss/ciss.c ============================================================================== --- head/sys/dev/ciss/ciss.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/ciss/ciss.c Sun Apr 14 09:55:48 2013 (r249468) @@ -2913,7 +2913,7 @@ ciss_cam_rescan_target(struct ciss_softc return; } - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sc->ciss_cam_sim[bus]), target, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { ciss_printf(sc, "rescan failed (can't create path)\n"); Modified: head/sys/dev/firewire/sbp.c ============================================================================== --- head/sys/dev/firewire/sbp.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/firewire/sbp.c Sun Apr 14 09:55:48 2013 (r249468) @@ -1086,7 +1086,7 @@ END_DEBUG sbp_xfer_free(xfer); if (sdev->path == NULL) - xpt_create_path(&sdev->path, xpt_periph, + xpt_create_path(&sdev->path, NULL, cam_sim_path(target->sbp->sim), target->target_id, sdev->lun_id); @@ -2039,7 +2039,7 @@ END_DEBUG if (xpt_bus_register(sbp->sim, dev, /*bus*/0) != CAM_SUCCESS) goto fail; - if (xpt_create_path(&sbp->path, xpt_periph, cam_sim_path(sbp->sim), + if (xpt_create_path(&sbp->path, NULL, cam_sim_path(sbp->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_bus_deregister(cam_sim_path(sbp->sim)); goto fail; Modified: head/sys/dev/hpt27xx/osm_bsd.c ============================================================================== --- head/sys/dev/hpt27xx/osm_bsd.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/hpt27xx/osm_bsd.c Sun Apr 14 09:55:48 2013 (r249468) @@ -1347,7 +1347,7 @@ static int hpt_rescan_bus(void) #endif ldm_for_each_vbus(vbus, vbus_ext) { - if (xpt_create_path(&path, xpt_periph, cam_sim_path(vbus_ext->sim), + if (xpt_create_path(&path, NULL, cam_sim_path(vbus_ext->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) return(EIO); if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK)) == NULL) Modified: head/sys/dev/hptiop/hptiop.c ============================================================================== --- head/sys/dev/hptiop/hptiop.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/hptiop/hptiop.c Sun Apr 14 09:55:48 2013 (r249468) @@ -1437,7 +1437,7 @@ static int hptiop_rescan_bus(struct hpt if ((ccb = xpt_alloc_ccb()) == NULL) return(ENOMEM); - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(hba->sim), + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(hba->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_free_ccb(ccb); return(EIO); Modified: head/sys/dev/hptrr/hptrr_osm_bsd.c ============================================================================== --- head/sys/dev/hptrr/hptrr_osm_bsd.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/hptrr/hptrr_osm_bsd.c Sun Apr 14 09:55:48 2013 (r249468) @@ -1355,7 +1355,7 @@ static int hpt_rescan_bus(void) ldm_for_each_vbus(vbus, vbus_ext) { if ((ccb = xpt_alloc_ccb()) == NULL) return(ENOMEM); - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(vbus_ext->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_free_ccb(ccb); Modified: head/sys/dev/isci/isci_controller.c ============================================================================== --- head/sys/dev/isci/isci_controller.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/isci/isci_controller.c Sun Apr 14 09:55:48 2013 (r249468) @@ -580,7 +580,7 @@ void isci_controller_domain_discovery_co */ union ccb *ccb = xpt_alloc_ccb_nowait(); - xpt_create_path(&ccb->ccb_h.path, xpt_periph, + xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(isci_controller->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); Modified: head/sys/dev/isci/isci_domain.c ============================================================================== --- head/sys/dev/isci/isci_domain.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/isci/isci_domain.c Sun Apr 14 09:55:48 2013 (r249468) @@ -300,7 +300,7 @@ scif_cb_domain_device_removed(SCI_CONTRO isci_controller->remote_device[isci_remote_device->index] = NULL; - xpt_create_path(&ccb->ccb_h.path, xpt_periph, path, + xpt_create_path(&ccb->ccb_h.path, NULL, path, isci_remote_device->index, CAM_LUN_WILDCARD); xpt_rescan(ccb); Modified: head/sys/dev/isci/isci_remote_device.c ============================================================================== --- head/sys/dev/isci/isci_remote_device.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/isci/isci_remote_device.c Sun Apr 14 09:55:48 2013 (r249468) @@ -83,7 +83,7 @@ scif_cb_remote_device_ready(SCI_CONTROLL */ union ccb *ccb = xpt_alloc_ccb_nowait(); - xpt_create_path(&ccb->ccb_h.path, xpt_periph, + xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(isci_controller->sim), isci_remote_device->index, CAM_LUN_WILDCARD); @@ -262,7 +262,7 @@ isci_remote_device_freeze_lun_queue(stru if (!(remote_device->frozen_lun_mask & (1 << lun))) { struct cam_path *path; - xpt_create_path(&path, xpt_periph, + xpt_create_path(&path, NULL, cam_sim_path(remote_device->domain->controller->sim), remote_device->index, lun); xpt_freeze_devq(path, 1); @@ -279,7 +279,7 @@ isci_remote_device_release_lun_queue(str struct cam_path *path; remote_device->frozen_lun_mask &= ~(1 << lun); - xpt_create_path(&path, xpt_periph, + xpt_create_path(&path, NULL, cam_sim_path(remote_device->domain->controller->sim), remote_device->index, lun); xpt_release_devq(path, 1, TRUE); Modified: head/sys/dev/iscsi/initiator/isc_cam.c ============================================================================== --- head/sys/dev/iscsi/initiator/isc_cam.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/iscsi/initiator/isc_cam.c Sun Apr 14 09:55:48 2013 (r249468) @@ -150,7 +150,7 @@ ic_scan(isc_session_t *sp) sp->flags |= ISC_SCANWAIT; CAM_LOCK(sp); - if(xpt_create_path(&sp->cam_path, xpt_periph, cam_sim_path(sp->cam_sim), + if(xpt_create_path(&sp->cam_path, NULL, cam_sim_path(sp->cam_sim), 0, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xdebug("can't create cam path"); CAM_UNLOCK(sp); Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/isp/isp_freebsd.c Sun Apr 14 09:55:48 2013 (r249468) @@ -4554,7 +4554,8 @@ isp_make_here(ispsoftc_t *isp, int chan, isp_prt(isp, ISP_LOGWARN, "Chan %d unable to alloc CCB for rescan", chan); return; } - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(fc->sim), tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(fc->sim), + tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { isp_prt(isp, ISP_LOGWARN, "unable to create path for rescan"); xpt_free_ccb(ccb); return; Modified: head/sys/dev/mfi/mfi_cam.c ============================================================================== --- head/sys/dev/mfi/mfi_cam.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/mfi/mfi_cam.c Sun Apr 14 09:55:48 2013 (r249468) @@ -318,7 +318,7 @@ mfip_cam_rescan(struct mfi_softc *sc, ui } sim = camsc->sim; - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sim), + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sim), tid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_free_ccb(ccb); device_printf(sc->mfi_dev, Modified: head/sys/dev/mly/mly.c ============================================================================== --- head/sys/dev/mly/mly.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/mly/mly.c Sun Apr 14 09:55:48 2013 (r249468) @@ -2025,7 +2025,7 @@ mly_cam_rescan_btl(struct mly_softc *sc, mly_printf(sc, "rescan failed (can't allocate CCB)\n"); return; } - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sc->mly_cam_sim[bus]), target, 0) != CAM_REQ_CMP) { mly_printf(sc, "rescan failed (can't create path)\n"); xpt_free_ccb(ccb); Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/mps/mps_sas.c Sun Apr 14 09:55:48 2013 (r249468) @@ -271,7 +271,7 @@ mpssas_rescan_target(struct mps_softc *s return; } - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, pathid, + if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid, targetid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { mps_dprint(sc, MPS_FAULT, "unable to create path for rescan\n"); xpt_free_ccb(ccb); @@ -3318,7 +3318,7 @@ mpssas_check_eedp(struct mpssas_softc *s return; } - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid, targetid, lunid) != CAM_REQ_CMP) { mps_dprint(sc, MPS_FAULT, "Unable to create " "path for EEDP support\n"); Modified: head/sys/dev/mpt/mpt_cam.c ============================================================================== --- head/sys/dev/mpt/mpt_cam.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/mpt/mpt_cam.c Sun Apr 14 09:55:48 2013 (r249468) @@ -2364,7 +2364,7 @@ mpt_cam_event(struct mpt_softc *mpt, req break; } - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, pathid, + if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid, CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { mpt_prt(mpt, "unable to create path for rescan\n"); xpt_free_ccb(ccb); @@ -2512,7 +2512,7 @@ mpt_cam_event(struct mpt_softc *mpt, req "unable to alloc CCB for rescan\n"); break; } - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sim), psdsc->TargetID, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { mpt_prt(mpt, Modified: head/sys/dev/mpt/mpt_raid.c ============================================================================== --- head/sys/dev/mpt/mpt_raid.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/mpt/mpt_raid.c Sun Apr 14 09:55:48 2013 (r249468) @@ -705,7 +705,7 @@ mpt_raid_thread(void *arg) ccb = xpt_alloc_ccb(); MPT_LOCK(mpt); - error = xpt_create_path(&ccb->ccb_h.path, xpt_periph, + error = xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(mpt->phydisk_sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); if (error != CAM_REQ_CMP) { @@ -1662,7 +1662,7 @@ mpt_raid_set_vol_queue_depth(struct mpt_ mpt->raid_rescan = 0; - error = xpt_create_path(&path, xpt_periph, + error = xpt_create_path(&path, NULL, cam_sim_path(mpt->sim), mpt_vol->config_page->VolumeID, /*lun*/0); Modified: head/sys/dev/twa/tw_osl_cam.c ============================================================================== --- head/sys/dev/twa/tw_osl_cam.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/twa/tw_osl_cam.c Sun Apr 14 09:55:48 2013 (r249468) @@ -488,7 +488,7 @@ tw_osli_request_bus_scan(struct twa_soft if ((ccb = xpt_alloc_ccb()) == NULL) return(ENOMEM); mtx_lock(sc->sim_lock); - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sc->sim), + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sc->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_free_ccb(ccb); mtx_unlock(sc->sim_lock); Modified: head/sys/dev/tws/tws_cam.c ============================================================================== --- head/sys/dev/tws/tws_cam.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/tws/tws_cam.c Sun Apr 14 09:55:48 2013 (r249468) @@ -219,7 +219,7 @@ tws_bus_scan(struct tws_softc *sc) return(ENXIO); ccb = xpt_alloc_ccb(); mtx_lock(&sc->sim_lock); - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sc->sim), + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sc->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { mtx_unlock(&sc->sim_lock); xpt_free_ccb(ccb); Modified: head/sys/dev/virtio/scsi/virtio_scsi.c ============================================================================== --- head/sys/dev/virtio/scsi/virtio_scsi.c Sun Apr 14 09:38:28 2013 (r249467) +++ head/sys/dev/virtio/scsi/virtio_scsi.c Sun Apr 14 09:55:48 2013 (r249468) @@ -1702,7 +1702,7 @@ vtscsi_execute_rescan(struct vtscsi_soft return; } - status = xpt_create_path(&ccb->ccb_h.path, xpt_periph, + status = xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sc->vtscsi_sim), target_id, lun_id); if (status != CAM_REQ_CMP) { xpt_free_ccb(ccb); From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 10:14:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6F07C280; Sun, 14 Apr 2013 10:14:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 620DA965; Sun, 14 Apr 2013 10:14:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EAERDv032102; Sun, 14 Apr 2013 10:14:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EAERjD032100; Sun, 14 Apr 2013 10:14:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304141014.r3EAERjD032100@svn.freebsd.org> From: Alexander Motin Date: Sun, 14 Apr 2013 10:14:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249470 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 10:14:27 -0000 Author: mav Date: Sun Apr 14 10:14:26 2013 New Revision: 249470 URL: http://svnweb.freebsd.org/changeset/base/249470 Log: Remove owner field from struct cam_ed, unused at least since FreeBSD 7. Modified: head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt_internal.h Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Apr 14 09:59:41 2013 (r249469) +++ head/sys/cam/cam_xpt.c Sun Apr 14 10:14:26 2013 (r249470) @@ -4428,7 +4428,6 @@ xpt_alloc_device(struct cam_eb *bus, str SLIST_INIT(&device->asyncs); SLIST_INIT(&device->periphs); device->generation = 0; - device->owner = NULL; device->flags = CAM_DEV_UNCONFIGURED; device->tag_delay_count = 0; device->tag_saved_openings = 0; Modified: head/sys/cam/cam_xpt_internal.h ============================================================================== --- head/sys/cam/cam_xpt_internal.h Sun Apr 14 09:59:41 2013 (r249469) +++ head/sys/cam/cam_xpt_internal.h Sun Apr 14 10:14:26 2013 (r249470) @@ -83,7 +83,6 @@ struct cam_ed { struct async_list asyncs; /* Async callback info for this B/T/L */ struct periph_list periphs; /* All attached devices */ u_int generation; /* Generation number */ - struct cam_periph *owner; /* Peripheral driver's ownership tag */ void *quirk; /* Oddities about this device */ u_int maxtags; u_int mintags; From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 11:44:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 541E9CD6; Sun, 14 Apr 2013 11:44:48 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 45240BE4; Sun, 14 Apr 2013 11:44:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EBimDW058907; Sun, 14 Apr 2013 11:44:48 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EBimN4058906; Sun, 14 Apr 2013 11:44:48 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201304141144.r3EBimN4058906@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 14 Apr 2013 11:44:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249471 - head/lib/libc/nls X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 11:44:48 -0000 Author: jilles Date: Sun Apr 14 11:44:47 2013 New Revision: 249471 URL: http://svnweb.freebsd.org/changeset/base/249471 Log: libc: Fix typo in French translation. PR: kern/177704 Submitted by: martymac MFC after: 1 week Modified: head/lib/libc/nls/fr_FR.ISO8859-1.msg Modified: head/lib/libc/nls/fr_FR.ISO8859-1.msg ============================================================================== --- head/lib/libc/nls/fr_FR.ISO8859-1.msg Sun Apr 14 10:14:26 2013 (r249470) +++ head/lib/libc/nls/fr_FR.ISO8859-1.msg Sun Apr 14 11:44:47 2013 (r249471) @@ -94,7 +94,7 @@ $ EPROTONOSUPPORT $ ESOCKTNOSUPPORT 44 Type de socket non supporté $ EOPNOTSUPP -45 Opération non supporté +45 Opération non supportée $ EPFNOSUPPORT 46 Famille de protocole non supportée $ EAFNOSUPPORT From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 12:20:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 56AB0728; Sun, 14 Apr 2013 12:20:14 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 48253DB2; Sun, 14 Apr 2013 12:20:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3ECKDMR069034; Sun, 14 Apr 2013 12:20:13 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3ECKDW5069033; Sun, 14 Apr 2013 12:20:13 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <201304141220.r3ECKDW5069033@svn.freebsd.org> From: Antoine Brodin Date: Sun, 14 Apr 2013 12:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249473 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 12:20:14 -0000 Author: antoine Date: Sun Apr 14 12:20:13 2013 New Revision: 249473 URL: http://svnweb.freebsd.org/changeset/base/249473 Log: Add one more obsolete file. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Apr 14 11:51:25 2013 (r249472) +++ head/ObsoleteFiles.inc Sun Apr 14 12:20:13 2013 (r249473) @@ -70,6 +70,7 @@ OLD_FILES+=usr/include/clang/3.2/xmmintr OLD_FILES+=usr/include/clang/3.2/xopintrin.h OLD_DIRS+=usr/include/clang/3.2 # 20130404: legacy ATA stack removed +OLD_FILES+=rescue/atacontrol OLD_FILES+=sbin/atacontrol OLD_FILES+=usr/share/man/man8/atacontrol.8.gz OLD_FILES+=usr/share/man/man4/atapicam.4.gz From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 13:06:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 19991E8B; Sun, 14 Apr 2013 13:06:08 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0AF02ECB; Sun, 14 Apr 2013 13:06:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3ED67YX083539; Sun, 14 Apr 2013 13:06:07 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3ED67Tn083538; Sun, 14 Apr 2013 13:06:07 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201304141306.r3ED67Tn083538@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Sun, 14 Apr 2013 13:06:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249475 - head/crypto/openssh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 13:06:08 -0000 Author: des Date: Sun Apr 14 13:06:07 2013 New Revision: 249475 URL: http://svnweb.freebsd.org/changeset/base/249475 Log: Silence "received disconnect" in the common case. Modified: head/crypto/openssh/packet.c Directory Properties: head/crypto/openssh/ (props changed) Modified: head/crypto/openssh/packet.c ============================================================================== --- head/crypto/openssh/packet.c Sun Apr 14 12:55:39 2013 (r249474) +++ head/crypto/openssh/packet.c Sun Apr 14 13:06:07 2013 (r249475) @@ -1465,7 +1465,11 @@ packet_read_poll_seqnr(u_int32_t *seqnr_ case SSH2_MSG_DISCONNECT: reason = packet_get_int(); msg = packet_get_string(NULL); - error("Received disconnect from %s: %u: %.400s", + /* Ignore normal client exit notifications */ + do_log2(active_state->server_side && + reason == SSH2_DISCONNECT_BY_APPLICATION ? + SYSLOG_LEVEL_DEBUG1 : SYSLOG_LEVEL_ERROR, + "Received disconnect from %s: %u: %.400s", get_remote_ipaddr(), reason, msg); xfree(msg); cleanup_exit(255); @@ -1490,7 +1494,7 @@ packet_read_poll_seqnr(u_int32_t *seqnr_ break; case SSH_MSG_DISCONNECT: msg = packet_get_string(NULL); - error("Received disconnect from %s: %.400s", + logit("Received disconnect from %s: %.400s", get_remote_ipaddr(), msg); cleanup_exit(255); break; From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 14:02:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5C4E6869; Sun, 14 Apr 2013 14:02:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3475B95; Sun, 14 Apr 2013 14:02:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EE2Zl0001361; Sun, 14 Apr 2013 14:02:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EE2YIi001357; Sun, 14 Apr 2013 14:02:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201304141402.r3EE2YIi001357@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 14 Apr 2013 14:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249476 - in head/sys/dev: ata pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 14:02:35 -0000 Author: kib Date: Sun Apr 14 14:02:34 2013 New Revision: 249476 URL: http://svnweb.freebsd.org/changeset/base/249476 Log: Usnure that PCI bus BIS_GET_DMA_TAG() method sees the actual PCI device which makes the request for dma tag, instead of some descendant of the PCI device, by creating a pass-through trampoline for vga_pci and ata_pci buses. Sponsored by: The FreeBSD Foundation Suggested by: jhb Discussed with: jhb, mav MFC after: 1 week Modified: head/sys/dev/ata/ata-pci.c head/sys/dev/pci/vga_pci.c Modified: head/sys/dev/ata/ata-pci.c ============================================================================== --- head/sys/dev/ata/ata-pci.c Sun Apr 14 13:06:07 2013 (r249475) +++ head/sys/dev/ata/ata-pci.c Sun Apr 14 14:02:34 2013 (r249476) @@ -571,6 +571,13 @@ ata_pci_child_location_str(device_t dev, return (0); } +static bus_dma_tag_t +ata_pci_get_dma_tag(device_t bus, device_t child) +{ + + return (bus_get_dma_tag(bus)); +} + static device_method_t ata_pci_methods[] = { /* device interface */ DEVMETHOD(device_probe, ata_pci_probe), @@ -593,6 +600,7 @@ static device_method_t ata_pci_methods[] DEVMETHOD(pci_write_config, ata_pci_write_config), DEVMETHOD(bus_print_child, ata_pci_print_child), DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), + DEVMETHOD(bus_get_dma_tag, ata_pci_get_dma_tag), DEVMETHOD_END }; Modified: head/sys/dev/pci/vga_pci.c ============================================================================== --- head/sys/dev/pci/vga_pci.c Sun Apr 14 13:06:07 2013 (r249475) +++ head/sys/dev/pci/vga_pci.c Sun Apr 14 14:02:34 2013 (r249476) @@ -419,6 +419,13 @@ vga_pci_msix_count(device_t dev, device_ return (pci_msix_count(dev)); } +static bus_dma_tag_t +vga_pci_get_dma_tag(device_t bus, device_t child) +{ + + return (bus_get_dma_tag(bus)); +} + static device_method_t vga_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, vga_pci_probe), @@ -436,6 +443,7 @@ static device_method_t vga_pci_methods[] DEVMETHOD(bus_release_resource, vga_pci_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_get_dma_tag, vga_pci_get_dma_tag), /* PCI interface */ DEVMETHOD(pci_read_config, vga_pci_read_config), From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 15:05:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AE3631FB; Sun, 14 Apr 2013 15:05:14 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 4A39623D; Sun, 14 Apr 2013 15:05:13 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.6/8.14.6/ALCHEMY.FRANKEN.DE) with ESMTP id r3EF57XW068065; Sun, 14 Apr 2013 17:05:07 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.6/8.14.6/Submit) id r3EF57NM068064; Sun, 14 Apr 2013 17:05:07 +0200 (CEST) (envelope-from marius) Date: Sun, 14 Apr 2013 17:05:07 +0200 From: Marius Strobl To: Konstantin Belousov Subject: Re: svn commit: r249476 - in head/sys/dev: ata pci Message-ID: <20130414150507.GA62578@alchemy.franken.de> References: <201304141402.r3EE2YIi001357@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201304141402.r3EE2YIi001357@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 15:05:14 -0000 On Sun, Apr 14, 2013 at 02:02:34PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Sun Apr 14 14:02:34 2013 > New Revision: 249476 > URL: http://svnweb.freebsd.org/changeset/base/249476 > > Log: > Usnure that PCI bus BIS_GET_DMA_TAG() method sees the actual PCI > device which makes the request for dma tag, instead of some descendant > of the PCI device, by creating a pass-through trampoline for vga_pci > and ata_pci buses. If you need to know the last PCI device requesting the DMA tag, wouldn't it make more sense to let the consumer of this walk up the tree as necessary instead of hacking N drivers? I.e.: foo_get_dma_tag(device_t bus, device_t child) { device_t device, parent; devclass_t pci_devclass; pci_devclass = devclass_find("pci"); for (device = child; child != bus; device = parent) { parent = device_get_parent(device); if (device_get_devclass(parent) != pci_devclass) continue; break; } /* use device */ } I suspect the problem you are hitting is also true for ISA devices behind a PCI-ISA-bridge, PCI device drivers attaching non-PCI sub- devices requesting DMA tags like sk(4) etc. Marius From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 16:20:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 53761895; Sun, 14 Apr 2013 16:20:26 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 45076788; Sun, 14 Apr 2013 16:20:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EGKPqa042289; Sun, 14 Apr 2013 16:20:25 GMT (envelope-from jmg@svn.freebsd.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EGKPHn042288; Sun, 14 Apr 2013 16:20:25 GMT (envelope-from jmg@svn.freebsd.org) Message-Id: <201304141620.r3EGKPHn042288@svn.freebsd.org> From: John-Mark Gurney Date: Sun, 14 Apr 2013 16:20:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249477 - head/sbin/geom/class/nop X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 16:20:26 -0000 Author: jmg Date: Sun Apr 14 16:20:25 2013 New Revision: 249477 URL: http://svnweb.freebsd.org/changeset/base/249477 Log: update information about debugging sysctl... MFC after: 1 week Modified: head/sbin/geom/class/nop/gnop.8 Modified: head/sbin/geom/class/nop/gnop.8 ============================================================================== --- head/sbin/geom/class/nop/gnop.8 Sun Apr 14 14:02:34 2013 (r249476) +++ head/sbin/geom/class/nop/gnop.8 Sun Apr 14 16:20:25 2013 (r249477) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2009 +.Dd April 14, 2013 .Dt GNOP 8 .Os .Sh NAME @@ -139,8 +139,11 @@ Debug level of the .Nm NOP GEOM class. This can be set to a number between 0 and 2 inclusive. -If set to 0 minimal debug information is printed, and if set to 2 the -maximum amount of debug information is printed. +If set to 0, minimal debug information is printed. +If set to 1, basic debug information is logged along with the I/O requests +that were returned as errors. +If set to 2, the maximum amount of debug information is printed including +all I/O requests. .El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 16:49:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3AE1E3FA; Sun, 14 Apr 2013 16:49:28 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2D73E8EA; Sun, 14 Apr 2013 16:49:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EGnS4G050808; Sun, 14 Apr 2013 16:49:28 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EGnR24050805; Sun, 14 Apr 2013 16:49:27 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201304141649.r3EGnR24050805@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Sun, 14 Apr 2013 16:49:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249479 - in head: contrib/openpam/lib lib/libpam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 16:49:28 -0000 Author: des Date: Sun Apr 14 16:49:27 2013 New Revision: 249479 URL: http://svnweb.freebsd.org/changeset/base/249479 Log: Backport upstream r684 (OPENPAM_DEBUG enables debugging macros but does not turn debugging on by default) and add OPENPAM_DEBUG to CFLAGS. Modified: head/contrib/openpam/lib/openpam_log.c head/lib/libpam/Makefile.inc Modified: head/contrib/openpam/lib/openpam_log.c ============================================================================== --- head/contrib/openpam/lib/openpam_log.c Sun Apr 14 16:25:37 2013 (r249478) +++ head/contrib/openpam/lib/openpam_log.c Sun Apr 14 16:49:27 2013 (r249479) @@ -49,11 +49,7 @@ #include "openpam_impl.h" -#ifdef OPENPAM_DEBUG -int openpam_debug = 1; -#else int openpam_debug = 0; -#endif #if !defined(openpam_log) Modified: head/lib/libpam/Makefile.inc ============================================================================== --- head/lib/libpam/Makefile.inc Sun Apr 14 16:25:37 2013 (r249478) +++ head/lib/libpam/Makefile.inc Sun Apr 14 16:49:27 2013 (r249479) @@ -24,9 +24,7 @@ # # $FreeBSD$ -.ifdef PAM_DEBUG -DEBUG_FLAGS+= -DDEBUG -.endif +CFLAGS+= -DOPENPAM_DEBUG SHLIB_MAJOR= 5 PAM_MOD_DIR= ${LIBDIR} From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 17:08:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 802C2973; Sun, 14 Apr 2013 17:08:35 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 72FD0982; Sun, 14 Apr 2013 17:08:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EH8Zp4057051; Sun, 14 Apr 2013 17:08:35 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EH8Y4A057048; Sun, 14 Apr 2013 17:08:34 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201304141708.r3EH8Y4A057048@svn.freebsd.org> From: Mateusz Guzik Date: Sun, 14 Apr 2013 17:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249480 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 17:08:35 -0000 Author: mjg Date: Sun Apr 14 17:08:34 2013 New Revision: 249480 URL: http://svnweb.freebsd.org/changeset/base/249480 Log: Add fdallocn function and use it when passing fds over unix socket. This gets rid of "unp_externalize fdalloc failed" panic. Reviewed by: pjd MFC after: 1 week Modified: head/sys/kern/kern_descrip.c head/sys/kern/uipc_usrreq.c head/sys/sys/filedesc.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Apr 14 16:49:27 2013 (r249479) +++ head/sys/kern/kern_descrip.c Sun Apr 14 17:08:34 2013 (r249480) @@ -1582,6 +1582,34 @@ fdalloc(struct thread *td, int minfd, in } /* + * Allocate n file descriptors for the process. + */ +int +fdallocn(struct thread *td, int minfd, int *fds, int n) +{ + struct proc *p = td->td_proc; + struct filedesc *fdp = p->p_fd; + int i; + + FILEDESC_XLOCK_ASSERT(fdp); + + if (!fdavail(td, n)) + return (EMFILE); + + for (i = 0; i < n; i++) + if (fdalloc(td, 0, &fds[i]) != 0) + break; + + if (i < n) { + for (i--; i >= 0; i--) + fdunused(fdp, fds[i]); + return (EMFILE); + } + + return (0); +} + +/* * Check to see whether n user file descriptors are available to the process * p. */ Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Sun Apr 14 16:49:27 2013 (r249479) +++ head/sys/kern/uipc_usrreq.c Sun Apr 14 17:08:34 2013 (r249480) @@ -1706,7 +1706,6 @@ unp_externalize(struct mbuf *control, st void *data; socklen_t clen = control->m_len, datalen; int error, newfds; - int f; u_int newlen; UNP_LINK_UNLOCK_ASSERT(); @@ -1732,13 +1731,6 @@ unp_externalize(struct mbuf *control, st goto next; } FILEDESC_XLOCK(fdesc); - /* if the new FD's will not fit free them. */ - if (!fdavail(td, newfds)) { - FILEDESC_XUNLOCK(fdesc); - error = EMSGSIZE; - unp_freerights(fdep, newfds); - goto next; - } /* * Now change each pointer to an fd in the global @@ -1758,17 +1750,22 @@ unp_externalize(struct mbuf *control, st fdp = (int *) CMSG_DATA(mtod(*controlp, struct cmsghdr *)); + if (fdallocn(td, 0, fdp, newfds) != 0) { + FILEDESC_XUNLOCK(td->td_proc->p_fd); + error = EMSGSIZE; + unp_freerights(fdep, newfds); + m_freem(*controlp); + *controlp = NULL; + goto next; + } for (i = 0; i < newfds; i++, fdp++) { - if (fdalloc(td, 0, &f)) - panic("unp_externalize fdalloc failed"); - fde = &fdesc->fd_ofiles[f]; + fde = &fdesc->fd_ofiles[*fdp]; fde->fde_file = fdep[0]->fde_file; filecaps_move(&fdep[0]->fde_caps, &fde->fde_caps); if ((flags & MSG_CMSG_CLOEXEC) != 0) fde->fde_flags |= UF_EXCLOSE; unp_externalize_fp(fde->fde_file); - *fdp = f; } FILEDESC_XUNLOCK(fdesc); free(fdep[0], M_FILECAPS); Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Sun Apr 14 16:49:27 2013 (r249479) +++ head/sys/sys/filedesc.h Sun Apr 14 17:08:34 2013 (r249480) @@ -150,6 +150,7 @@ int falloc_noinstall(struct thread *td, int finstall(struct thread *td, struct file *fp, int *resultfp, int flags, struct filecaps *fcaps); int fdalloc(struct thread *td, int minfd, int *result); +int fdallocn(struct thread *td, int minfd, int *fds, int n); int fdavail(struct thread *td, int n); int fdcheckstd(struct thread *td); void fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td); From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 18:09:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 49D03496; Sun, 14 Apr 2013 18:09:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3CD05B35; Sun, 14 Apr 2013 18:09:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EI98Lw075404; Sun, 14 Apr 2013 18:09:08 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EI986E075403; Sun, 14 Apr 2013 18:09:08 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304141809.r3EI986E075403@svn.freebsd.org> From: Alexander Motin Date: Sun, 14 Apr 2013 18:09:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249481 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 18:09:09 -0000 Author: mav Date: Sun Apr 14 18:09:08 2013 New Revision: 249481 URL: http://svnweb.freebsd.org/changeset/base/249481 Log: Remove some more pieces of multilevel freeze mechanism, missed in r249466. Modified: head/sys/cam/cam_queue.h Modified: head/sys/cam/cam_queue.h ============================================================================== --- head/sys/cam/cam_queue.h Sun Apr 14 17:08:34 2013 (r249480) +++ head/sys/cam/cam_queue.h Sun Apr 14 18:09:08 2013 (r249481) @@ -155,10 +155,10 @@ cam_ccbq_pending_ccb_count(struct cam_cc static __inline void cam_ccbq_take_opening(struct cam_ccbq *ccbq); -static __inline int +static __inline void cam_ccbq_insert_ccb(struct cam_ccbq *ccbq, union ccb *new_ccb); -static __inline int +static __inline void cam_ccbq_remove_ccb(struct cam_ccbq *ccbq, union ccb *ccb); static __inline union ccb * @@ -187,29 +187,17 @@ cam_ccbq_take_opening(struct cam_ccbq *c ccbq->held++; } -static __inline int +static __inline void cam_ccbq_insert_ccb(struct cam_ccbq *ccbq, union ccb *new_ccb) { ccbq->held--; camq_insert(&ccbq->queue, &new_ccb->ccb_h.pinfo); - if (ccbq->queue.qfrozen_cnt > 0) { - ccbq->devq_openings++; - ccbq->held++; - return (1); - } else - return (0); } -static __inline int +static __inline void cam_ccbq_remove_ccb(struct cam_ccbq *ccbq, union ccb *ccb) { camq_remove(&ccbq->queue, ccb->ccb_h.pinfo.index); - if (ccbq->queue.qfrozen_cnt > 0) { - ccbq->devq_openings--; - ccbq->held--; - return (1); - } else - return (0); } static __inline union ccb * From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 19:13:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C0AD34E0; Sun, 14 Apr 2013 19:13:52 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B1C91E41; Sun, 14 Apr 2013 19:13:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EJDqIY095966; Sun, 14 Apr 2013 19:13:52 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EJDqPI095965; Sun, 14 Apr 2013 19:13:52 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201304141913.r3EJDqPI095965@svn.freebsd.org> From: Tim Kientzle Date: Sun, 14 Apr 2013 19:13:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249484 - head/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 19:13:52 -0000 Author: kientzle Date: Sun Apr 14 19:13:51 2013 New Revision: 249484 URL: http://svnweb.freebsd.org/changeset/base/249484 Log: Install a symlink /usr/lib/include ==> /usr/include This fixes -print-file-name=include in clang (and is arguably a better way to fix the same issue in GCC than the change I made in r231336). MFC after: 1 week Modified: head/lib/Makefile Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Sun Apr 14 18:36:30 2013 (r249483) +++ head/lib/Makefile Sun Apr 14 19:13:51 2013 (r249484) @@ -252,4 +252,7 @@ _libusbhid= libusbhid _libusb= libusb .endif +afterinstall: + ln -fs ../include ${DESTDIR}/usr/lib/include + .include From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 19:21:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 399DE747; Sun, 14 Apr 2013 19:21:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1BDF3E7C; Sun, 14 Apr 2013 19:21:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EJLhot098643; Sun, 14 Apr 2013 19:21:43 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EJLhRD098642; Sun, 14 Apr 2013 19:21:43 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201304141921.r3EJLhRD098642@svn.freebsd.org> From: Warner Losh Date: Sun, 14 Apr 2013 19:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249485 - head/sys/dev/mmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 19:21:44 -0000 Author: imp Date: Sun Apr 14 19:21:43 2013 New Revision: 249485 URL: http://svnweb.freebsd.org/changeset/base/249485 Log: Print MB and GB instead of MiB and GiB mislabeled as MB and GB. SD cards are sold in GB not GiB, this will result in less confusion. Also, cache parent device pointer to save a few cycles for loops. Modified: head/sys/dev/mmc/mmcsd.c Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Sun Apr 14 19:13:51 2013 (r249484) +++ head/sys/dev/mmc/mmcsd.c Sun Apr 14 19:21:43 2013 (r249485) @@ -163,19 +163,20 @@ mmcsd_attach(device_t dev) d->d_unit = device_get_unit(dev); d->d_flags = DISKFLAG_CANDELETE; /* - * Display in most natural units. There's no cards < 1MB. - * The SD standard goes to 2GiB, but the data format supports - * up to 4GiB and some card makers push it up to this limit. - * The SDHC standard only goes to 32GiB (the data format in - * SDHC is good to 2TiB however, which isn't too ugly at - * 2048GiBm, so we note it in passing here and don't add the - * code to print TiB). + * Display in most natural units. There's no cards < 1MB. The SD + * standard goes to 2GiB due to its reliance on FAT, but the data + * format supports up to 4GiB and some card makers push it up to this + * limit. The SDHC standard only goes to 32GiB due to FAT32, but the + * data format supports up to 2TiB however. 2048GB isn't too ugly, so + * we note it in passing here and don't add the code to print + * TB). Since these cards are sold in terms of MB and GB not MiB and + * GiB, report them like that. */ - mb = d->d_mediasize >> 20; /* 1MiB == 1 << 20 */ + mb = d->d_mediasize / 1000000; unit = 'M'; - if (mb >= 10240) { /* 1GiB = 1024 MiB */ + if (mb >= 1000) { unit = 'G'; - mb /= 1024; + mb /= 1000; } /* * Report the clock speed of the underlying hardware, which might be @@ -312,6 +313,7 @@ mmcsd_rw(struct mmcsd_softc *sc, struct struct mmc_data data; device_t dev = sc->dev; int sz = sc->disk->d_sectorsize; + device_t mmcbr = device_get_parent(dev); block = bp->bio_pblkno; end = bp->bio_pblkno + (bp->bio_bcount / sz); @@ -355,8 +357,7 @@ mmcsd_rw(struct mmcsd_softc *sc, struct stop.mrq = &req; req.stop = &stop; } - MMCBUS_WAIT_FOR_REQUEST(device_get_parent(dev), dev, - &req); + MMCBUS_WAIT_FOR_REQUEST(mmcbr, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { device_printf(dev, "Error indicated: %d %s\n", req.cmd->error, mmcsd_errmsg(req.cmd->error)); @@ -376,6 +377,7 @@ mmcsd_delete(struct mmcsd_softc *sc, str device_t dev = sc->dev; int sz = sc->disk->d_sectorsize; int erase_sector; + device_t mmcbr = device_get_parent(dev); block = bp->bio_pblkno; end = bp->bio_pblkno + (bp->bio_bcount / sz); @@ -410,8 +412,7 @@ mmcsd_delete(struct mmcsd_softc *sc, str if (!mmc_get_high_cap(dev)) cmd.arg <<= 9; cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; - MMCBUS_WAIT_FOR_REQUEST(device_get_parent(dev), dev, - &req); + MMCBUS_WAIT_FOR_REQUEST(mmcbr, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { printf("erase err1: %d\n", req.cmd->error); return (block); @@ -429,8 +430,7 @@ mmcsd_delete(struct mmcsd_softc *sc, str cmd.arg <<= 9; cmd.arg--; cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; - MMCBUS_WAIT_FOR_REQUEST(device_get_parent(dev), dev, - &req); + MMCBUS_WAIT_FOR_REQUEST(mmcbr, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { printf("erase err2: %d\n", req.cmd->error); return (block); @@ -442,8 +442,7 @@ mmcsd_delete(struct mmcsd_softc *sc, str cmd.opcode = MMC_ERASE; cmd.arg = 0; cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; - MMCBUS_WAIT_FOR_REQUEST(device_get_parent(dev), dev, - &req); + MMCBUS_WAIT_FOR_REQUEST(mmcbr, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { printf("erase err3 %d\n", req.cmd->error); return (block); @@ -468,6 +467,7 @@ mmcsd_dump(void *arg, void *virtual, vm_ device_t dev = sc->dev; struct bio bp; daddr_t block, end; + device_t mmcbr = device_get_parent(dev); /* length zero is special and really means flush buffers to media */ if (!length) @@ -480,9 +480,9 @@ mmcsd_dump(void *arg, void *virtual, vm_ bp.bio_data = virtual; bp.bio_cmd = BIO_WRITE; end = bp.bio_pblkno + bp.bio_bcount / sc->disk->d_sectorsize; - MMCBUS_ACQUIRE_BUS(device_get_parent(dev), dev); + MMCBUS_ACQUIRE_BUS(mmcbr, dev); block = mmcsd_rw(sc, &bp); - MMCBUS_RELEASE_BUS(device_get_parent(dev), dev); + MMCBUS_RELEASE_BUS(mmcbr, dev); return ((end < block) ? EIO : 0); } @@ -493,9 +493,9 @@ mmcsd_task(void *arg) struct bio *bp; int sz; daddr_t block, end; - device_t dev; + device_t dev = sc->dev; + device_t mmcbr = device_get_parent(sc->dev); - dev = sc->dev; while (1) { MMCSD_LOCK(sc); do { @@ -513,7 +513,7 @@ mmcsd_task(void *arg) biodone(bp); continue; } - MMCBUS_ACQUIRE_BUS(device_get_parent(dev), dev); + MMCBUS_ACQUIRE_BUS(mmcbr, dev); sz = sc->disk->d_sectorsize; block = bp->bio_pblkno; end = bp->bio_pblkno + (bp->bio_bcount / sz); @@ -525,7 +525,7 @@ mmcsd_task(void *arg) } else if (bp->bio_cmd == BIO_DELETE) { block = mmcsd_delete(sc, bp); } - MMCBUS_RELEASE_BUS(device_get_parent(dev), dev); + MMCBUS_RELEASE_BUS(mmcbr, dev); if (block < end) { bp->bio_error = EIO; bp->bio_resid = (end - block) * sz; From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 19:59:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DB026DFF; Sun, 14 Apr 2013 19:59:38 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CCA73F9A; Sun, 14 Apr 2013 19:59:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EJxcrZ008563; Sun, 14 Apr 2013 19:59:38 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EJxcZ3008562; Sun, 14 Apr 2013 19:59:38 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304141959.r3EJxcZ3008562@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 14 Apr 2013 19:59:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249486 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 19:59:38 -0000 Author: trociny Date: Sun Apr 14 19:59:38 2013 New Revision: 249486 URL: http://svnweb.freebsd.org/changeset/base/249486 Log: Re-factor coredump routines. For each type of notes an output function is provided, which is used either to calculate the note size or output it to sbuf. On the first pass the notes are registered in a list and the resulting size is found, on the second pass the list is traversed outputing notes to sbuf. For the sbuf a drain routine is provided that writes data to a core file. The main goal of the change is to make coredump to write notes directly to the core file, without preliminary preparing them all in a memory buffer. Storing notes in memory is not a problem for the current, rather small, set of notes we write to the core, but it may becomes an issue when we start to store procstat notes. Reviewed by: jhb (initial version), kib Discussed with: jhb, kib MFC after: 3 weeks Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sun Apr 14 19:21:43 2013 (r249485) +++ head/sys/kern/imgact_elf.c Sun Apr 14 19:59:38 2013 (r249486) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -104,8 +105,8 @@ SYSCTL_NODE(_kern, OID_AUTO, __CONCAT(el #ifdef COMPRESS_USER_CORES static int compress_core(gzFile, char *, char *, unsigned int, struct thread * td); -#define CORE_BUF_SIZE (16 * 1024) #endif +#define CORE_BUF_SIZE (16 * 1024) int __elfN(fallback_brand) = -1; SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, @@ -1038,14 +1039,35 @@ struct sseg_closure { size_t size; /* Total size of all writable segments. */ }; +typedef void (*outfunc_t)(void *, struct sbuf *, size_t *); + +struct note_info { + int type; /* Note type. */ + outfunc_t outfunc; /* Output function. */ + void *outarg; /* Argument for the output function. */ + size_t outsize; /* Output size. */ + TAILQ_ENTRY(note_info) link; /* Link to the next note info. */ +}; + +TAILQ_HEAD(note_info_list, note_info); + static void cb_put_phdr(vm_map_entry_t, void *); static void cb_size_segment(vm_map_entry_t, void *); static void each_writable_segment(struct thread *, segment_callback, void *); static int __elfN(corehdr)(struct thread *, struct vnode *, struct ucred *, - int, void *, size_t, gzFile); -static void __elfN(puthdr)(struct thread *, void *, size_t *, int); -static void __elfN(putnote)(void *, size_t *, const char *, int, - const void *, size_t); + int, void *, size_t, struct note_info_list *, size_t, gzFile); +static void __elfN(prepare_notes)(struct thread *, struct note_info_list *, + size_t *); +static void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t); +static void __elfN(putnote)(struct note_info *, struct sbuf *); +static size_t register_note(struct note_info_list *, int, outfunc_t, void *); +static int sbuf_drain_core_output(void *, const char *, int); + +static void __elfN(note_fpregset)(void *, struct sbuf *, size_t *); +static void __elfN(note_prpsinfo)(void *, struct sbuf *, size_t *); +static void __elfN(note_prstatus)(void *, struct sbuf *, size_t *); +static void __elfN(note_threadmd)(void *, struct sbuf *, size_t *); +static void __elfN(note_thrmisc)(void *, struct sbuf *, size_t *); #ifdef COMPRESS_USER_CORES extern int compress_user_cores; @@ -1072,14 +1094,54 @@ core_output(struct vnode *vp, void *base return (error); } +/* Coredump output parameters for sbuf drain routine. */ +struct sbuf_drain_core_params { + off_t offset; + struct ucred *active_cred; + struct ucred *file_cred; + struct thread *td; + struct vnode *vp; +#ifdef COMPRESS_USER_CORES + gzFile gzfile; +#endif +}; + +/* + * Drain into a core file. + */ +static int +sbuf_drain_core_output(void *arg, const char *data, int len) +{ + struct sbuf_drain_core_params *p; + int error; + + p = (struct sbuf_drain_core_params *)arg; +#ifdef COMPRESS_USER_CORES + if (p->gzfile != Z_NULL) + error = compress_core(p->gzfile, NULL, __DECONST(char *, data), + len, p->td); + else +#endif + error = vn_rdwr_inchunks(UIO_WRITE, p->vp, + __DECONST(void *, data), len, p->offset, UIO_SYSSPACE, + IO_UNIT | IO_DIRECT, p->active_cred, p->file_cred, NULL, + p->td); + if (error != 0) + return (-error); + p->offset += len; + return (len); +} + int __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) { struct ucred *cred = td->td_ucred; int error = 0; struct sseg_closure seginfo; + struct note_info_list notelst; + struct note_info *ninfo; void *hdr; - size_t hdrsize; + size_t hdrsize, notesz, coresize; gzFile gzfile = Z_NULL; char *core_buf = NULL; @@ -1090,6 +1152,7 @@ __elfN(coredump)(struct thread *td, stru #endif hdr = NULL; + TAILQ_INIT(¬elst); #ifdef COMPRESS_USER_CORES if (doing_compress) { @@ -1118,30 +1181,29 @@ __elfN(coredump)(struct thread *td, stru each_writable_segment(td, cb_size_segment, &seginfo); /* - * Calculate the size of the core file header area by making - * a dry run of generating it. Nothing is written, but the - * size is calculated. + * Collect info about the core file header area. */ - hdrsize = 0; - __elfN(puthdr)(td, (void *)NULL, &hdrsize, seginfo.count); + hdrsize = sizeof(Elf_Ehdr) + sizeof(Elf_Phdr) * (1 + seginfo.count); + __elfN(prepare_notes)(td, ¬elst, ¬esz); + coresize = round_page(hdrsize + notesz) + seginfo.size; #ifdef RACCT PROC_LOCK(td->td_proc); - error = racct_add(td->td_proc, RACCT_CORE, hdrsize + seginfo.size); + error = racct_add(td->td_proc, RACCT_CORE, coresize); PROC_UNLOCK(td->td_proc); if (error != 0) { error = EFAULT; goto done; } #endif - if (hdrsize + seginfo.size >= limit) { + if (coresize >= limit) { error = EFAULT; goto done; } /* * Allocate memory for building the header, fill it up, - * and write it out. + * and write it out following the notes. */ hdr = malloc(hdrsize, M_TEMP, M_WAITOK); if (hdr == NULL) { @@ -1149,7 +1211,7 @@ __elfN(coredump)(struct thread *td, stru goto done; } error = __elfN(corehdr)(td, vp, cred, seginfo.count, hdr, hdrsize, - gzfile); + ¬elst, notesz, gzfile); /* Write the contents of all of the writable segments. */ if (error == 0) { @@ -1158,7 +1220,7 @@ __elfN(coredump)(struct thread *td, stru int i; php = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)) + 1; - offset = hdrsize; + offset = round_page(hdrsize + notesz); for (i = 0; i < seginfo.count; i++) { error = core_output(vp, (caddr_t)(uintptr_t)php->p_vaddr, php->p_filesz, offset, cred, NOCRED, curthread, core_buf, gzfile); @@ -1181,8 +1243,12 @@ done: if (gzfile) gzclose(gzfile); #endif - - free(hdr, M_TEMP); + while ((ninfo = TAILQ_FIRST(¬elst)) != NULL) { + TAILQ_REMOVE(¬elst, ninfo, link); + free(ninfo, M_TEMP); + } + if (hdr != NULL) + free(hdr, M_TEMP); return (error); } @@ -1299,44 +1365,194 @@ each_writable_segment(td, func, closure) * the page boundary. */ static int -__elfN(corehdr)(td, vp, cred, numsegs, hdr, hdrsize, gzfile) - struct thread *td; - struct vnode *vp; - struct ucred *cred; - int numsegs; - size_t hdrsize; - void *hdr; - gzFile gzfile; -{ - size_t off; +__elfN(corehdr)(struct thread *td, struct vnode *vp, struct ucred *cred, + int numsegs, void *hdr, size_t hdrsize, struct note_info_list *notelst, + size_t notesz, gzFile gzfile) +{ + struct sbuf_drain_core_params params; + struct note_info *ninfo; + struct sbuf *sb; + int error; /* Fill in the header. */ bzero(hdr, hdrsize); - off = 0; - __elfN(puthdr)(td, hdr, &off, numsegs); + __elfN(puthdr)(td, hdr, hdrsize, numsegs, notesz); - if (!gzfile) { - /* Write it to the core file. */ - return (vn_rdwr_inchunks(UIO_WRITE, vp, hdr, hdrsize, (off_t)0, - UIO_SYSSPACE, IO_UNIT | IO_DIRECT, cred, NOCRED, NULL, - td)); - } else { + params.offset = 0; + params.active_cred = cred; + params.file_cred = NOCRED; + params.td = td; + params.vp = vp; #ifdef COMPRESS_USER_CORES - if (gzwrite(gzfile, hdr, hdrsize) != hdrsize) { - log(LOG_WARNING, - "Failed to compress core file header for process" - " %s.\n", curproc->p_comm); - return (EFAULT); - } - else { - return (0); - } -#else - panic("shouldn't be here"); + params.gzfile = gzfile; #endif + sb = sbuf_new(NULL, NULL, CORE_BUF_SIZE, SBUF_FIXEDLEN); + sbuf_set_drain(sb, sbuf_drain_core_output, ¶ms); + sbuf_start_section(sb, NULL); + sbuf_bcat(sb, hdr, hdrsize); + TAILQ_FOREACH(ninfo, notelst, link) + __elfN(putnote)(ninfo, sb); + /* Align up to a page boundary for the program segments. */ + sbuf_end_section(sb, -1, PAGE_SIZE, 0); + error = sbuf_finish(sb); + sbuf_delete(sb); + + return (error); +} + +static void +__elfN(prepare_notes)(struct thread *td, struct note_info_list *list, + size_t *sizep) +{ + struct proc *p; + struct thread *thr; + size_t size; + + p = td->td_proc; + size = 0; + + size += register_note(list, NT_PRPSINFO, __elfN(note_prpsinfo), p); + + /* + * To have the debugger select the right thread (LWP) as the initial + * thread, we dump the state of the thread passed to us in td first. + * This is the thread that causes the core dump and thus likely to + * be the right thread one wants to have selected in the debugger. + */ + thr = td; + while (thr != NULL) { + size += register_note(list, NT_PRSTATUS, + __elfN(note_prstatus), thr); + size += register_note(list, NT_FPREGSET, + __elfN(note_fpregset), thr); + size += register_note(list, NT_THRMISC, + __elfN(note_thrmisc), thr); + size += register_note(list, -1, + __elfN(note_threadmd), thr); + + thr = (thr == td) ? TAILQ_FIRST(&p->p_threads) : + TAILQ_NEXT(thr, td_plist); + if (thr == td) + thr = TAILQ_NEXT(thr, td_plist); } + + *sizep = size; +} + +static void +__elfN(puthdr)(struct thread *td, void *hdr, size_t hdrsize, int numsegs, + size_t notesz) +{ + Elf_Ehdr *ehdr; + Elf_Phdr *phdr; + struct phdr_closure phc; + + ehdr = (Elf_Ehdr *)hdr; + phdr = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)); + + ehdr->e_ident[EI_MAG0] = ELFMAG0; + ehdr->e_ident[EI_MAG1] = ELFMAG1; + ehdr->e_ident[EI_MAG2] = ELFMAG2; + ehdr->e_ident[EI_MAG3] = ELFMAG3; + ehdr->e_ident[EI_CLASS] = ELF_CLASS; + ehdr->e_ident[EI_DATA] = ELF_DATA; + ehdr->e_ident[EI_VERSION] = EV_CURRENT; + ehdr->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; + ehdr->e_ident[EI_ABIVERSION] = 0; + ehdr->e_ident[EI_PAD] = 0; + ehdr->e_type = ET_CORE; +#if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32 + ehdr->e_machine = ELF_ARCH32; +#else + ehdr->e_machine = ELF_ARCH; +#endif + ehdr->e_version = EV_CURRENT; + ehdr->e_entry = 0; + ehdr->e_phoff = sizeof(Elf_Ehdr); + ehdr->e_flags = 0; + ehdr->e_ehsize = sizeof(Elf_Ehdr); + ehdr->e_phentsize = sizeof(Elf_Phdr); + ehdr->e_phnum = numsegs + 1; + ehdr->e_shentsize = sizeof(Elf_Shdr); + ehdr->e_shnum = 0; + ehdr->e_shstrndx = SHN_UNDEF; + + /* + * Fill in the program header entries. + */ + + /* The note segement. */ + phdr->p_type = PT_NOTE; + phdr->p_offset = hdrsize; + phdr->p_vaddr = 0; + phdr->p_paddr = 0; + phdr->p_filesz = notesz; + phdr->p_memsz = 0; + phdr->p_flags = PF_R; + phdr->p_align = sizeof(Elf32_Size); + phdr++; + + /* All the writable segments from the program. */ + phc.phdr = phdr; + phc.offset = round_page(hdrsize + notesz); + each_writable_segment(td, cb_put_phdr, &phc); +} + +static size_t +register_note(struct note_info_list *list, int type, outfunc_t out, void *arg) +{ + struct note_info *ninfo; + size_t size, notesize; + + size = 0; + out(arg, NULL, &size); + ninfo = malloc(sizeof(*ninfo), M_TEMP, M_ZERO | M_WAITOK); + ninfo->type = type; + ninfo->outfunc = out; + ninfo->outarg = arg; + ninfo->outsize = size; + TAILQ_INSERT_TAIL(list, ninfo, link); + + if (type == -1) + return (size); + + notesize = sizeof(Elf_Note) + /* note header */ + roundup2(8, sizeof(Elf32_Size)) + /* note name ("FreeBSD") */ + roundup2(size, sizeof(Elf32_Size)); /* note description */ + + return (notesize); +} + +static void +__elfN(putnote)(struct note_info *ninfo, struct sbuf *sb) +{ + Elf_Note note; + ssize_t old_len; + + if (ninfo->type == -1) { + ninfo->outfunc(ninfo->outarg, sb, &ninfo->outsize); + return; + } + + note.n_namesz = 8; /* strlen("FreeBSD") + 1 */ + note.n_descsz = ninfo->outsize; + note.n_type = ninfo->type; + + sbuf_bcat(sb, ¬e, sizeof(note)); + sbuf_start_section(sb, &old_len); + sbuf_bcat(sb, "FreeBSD", note.n_namesz); + sbuf_end_section(sb, old_len, sizeof(Elf32_Size), 0); + if (note.n_descsz == 0) + return; + sbuf_start_section(sb, &old_len); + ninfo->outfunc(ninfo->outarg, sb, &ninfo->outsize); + sbuf_end_section(sb, old_len, sizeof(Elf32_Size), 0); } +/* + * Miscellaneous note out functions. + */ + #if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32 #include @@ -1356,50 +1572,15 @@ typedef thrmisc_t elf_thrmisc_t; #endif static void -__elfN(puthdr)(struct thread *td, void *dst, size_t *off, int numsegs) +__elfN(note_prpsinfo)(void *arg, struct sbuf *sb, size_t *sizep) { - struct { - elf_prstatus_t status; - elf_prfpregset_t fpregset; - elf_prpsinfo_t psinfo; - elf_thrmisc_t thrmisc; - } *tempdata; - elf_prstatus_t *status; - elf_prfpregset_t *fpregset; - elf_prpsinfo_t *psinfo; - elf_thrmisc_t *thrmisc; struct proc *p; - struct thread *thr; - size_t ehoff, noteoff, notesz, phoff; - - p = td->td_proc; - - ehoff = *off; - *off += sizeof(Elf_Ehdr); - - phoff = *off; - *off += (numsegs + 1) * sizeof(Elf_Phdr); - - noteoff = *off; - /* - * Don't allocate space for the notes if we're just calculating - * the size of the header. We also don't collect the data. - */ - if (dst != NULL) { - tempdata = malloc(sizeof(*tempdata), M_TEMP, M_ZERO|M_WAITOK); - status = &tempdata->status; - fpregset = &tempdata->fpregset; - psinfo = &tempdata->psinfo; - thrmisc = &tempdata->thrmisc; - } else { - tempdata = NULL; - status = NULL; - fpregset = NULL; - psinfo = NULL; - thrmisc = NULL; - } + elf_prpsinfo_t *psinfo; - if (dst != NULL) { + p = (struct proc *)arg; + if (sb != NULL) { + KASSERT(*sizep == sizeof(*psinfo), ("invalid size")); + psinfo = malloc(sizeof(*psinfo), M_TEMP, M_ZERO | M_WAITOK); psinfo->pr_version = PRPSINFO_VERSION; psinfo->pr_psinfosz = sizeof(elf_prpsinfo_t); strlcpy(psinfo->pr_fname, p->p_comm, sizeof(psinfo->pr_fname)); @@ -1409,139 +1590,100 @@ __elfN(puthdr)(struct thread *td, void * */ strlcpy(psinfo->pr_psargs, p->p_comm, sizeof(psinfo->pr_psargs)); + + sbuf_bcat(sb, psinfo, sizeof(*psinfo)); + free(psinfo, M_TEMP); } - __elfN(putnote)(dst, off, "FreeBSD", NT_PRPSINFO, psinfo, - sizeof *psinfo); + *sizep = sizeof(*psinfo); +} - /* - * To have the debugger select the right thread (LWP) as the initial - * thread, we dump the state of the thread passed to us in td first. - * This is the thread that causes the core dump and thus likely to - * be the right thread one wants to have selected in the debugger. - */ - thr = td; - while (thr != NULL) { - if (dst != NULL) { - status->pr_version = PRSTATUS_VERSION; - status->pr_statussz = sizeof(elf_prstatus_t); - status->pr_gregsetsz = sizeof(elf_gregset_t); - status->pr_fpregsetsz = sizeof(elf_fpregset_t); - status->pr_osreldate = osreldate; - status->pr_cursig = p->p_sig; - status->pr_pid = thr->td_tid; +static void +__elfN(note_prstatus)(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct thread *td; + elf_prstatus_t *status; + + td = (struct thread *)arg; + if (sb != NULL) { + KASSERT(*sizep == sizeof(*status), ("invalid size")); + status = malloc(sizeof(*status), M_TEMP, M_ZERO | M_WAITOK); + status->pr_version = PRSTATUS_VERSION; + status->pr_statussz = sizeof(elf_prstatus_t); + status->pr_gregsetsz = sizeof(elf_gregset_t); + status->pr_fpregsetsz = sizeof(elf_fpregset_t); + status->pr_osreldate = osreldate; + status->pr_cursig = td->td_proc->p_sig; + status->pr_pid = td->td_tid; #if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32 - fill_regs32(thr, &status->pr_reg); - fill_fpregs32(thr, fpregset); + fill_regs32(td, &status->pr_reg); #else - fill_regs(thr, &status->pr_reg); - fill_fpregs(thr, fpregset); + fill_regs(td, &status->pr_reg); #endif - memset(&thrmisc->_pad, 0, sizeof (thrmisc->_pad)); - strcpy(thrmisc->pr_tname, thr->td_name); - } - __elfN(putnote)(dst, off, "FreeBSD", NT_PRSTATUS, status, - sizeof *status); - __elfN(putnote)(dst, off, "FreeBSD", NT_FPREGSET, fpregset, - sizeof *fpregset); - __elfN(putnote)(dst, off, "FreeBSD", NT_THRMISC, thrmisc, - sizeof *thrmisc); - /* - * Allow for MD specific notes, as well as any MD - * specific preparations for writing MI notes. - */ - __elfN(dump_thread)(thr, dst, off); - - thr = (thr == td) ? TAILQ_FIRST(&p->p_threads) : - TAILQ_NEXT(thr, td_plist); - if (thr == td) - thr = TAILQ_NEXT(thr, td_plist); + sbuf_bcat(sb, status, sizeof(*status)); + free(status, M_TEMP); } + *sizep = sizeof(*status); +} - notesz = *off - noteoff; - - if (dst != NULL) - free(tempdata, M_TEMP); - - /* Align up to a page boundary for the program segments. */ - *off = round_page(*off); - - if (dst != NULL) { - Elf_Ehdr *ehdr; - Elf_Phdr *phdr; - struct phdr_closure phc; +static void +__elfN(note_fpregset)(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct thread *td; + elf_prfpregset_t *fpregset; - /* - * Fill in the ELF header. - */ - ehdr = (Elf_Ehdr *)((char *)dst + ehoff); - ehdr->e_ident[EI_MAG0] = ELFMAG0; - ehdr->e_ident[EI_MAG1] = ELFMAG1; - ehdr->e_ident[EI_MAG2] = ELFMAG2; - ehdr->e_ident[EI_MAG3] = ELFMAG3; - ehdr->e_ident[EI_CLASS] = ELF_CLASS; - ehdr->e_ident[EI_DATA] = ELF_DATA; - ehdr->e_ident[EI_VERSION] = EV_CURRENT; - ehdr->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; - ehdr->e_ident[EI_ABIVERSION] = 0; - ehdr->e_ident[EI_PAD] = 0; - ehdr->e_type = ET_CORE; + td = (struct thread *)arg; + if (sb != NULL) { + KASSERT(*sizep == sizeof(*fpregset), ("invalid size")); + fpregset = malloc(sizeof(*fpregset), M_TEMP, M_ZERO | M_WAITOK); #if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32 - ehdr->e_machine = ELF_ARCH32; + fill_fpregs32(td, fpregset); #else - ehdr->e_machine = ELF_ARCH; + fill_fpregs(td, fpregset); #endif - ehdr->e_version = EV_CURRENT; - ehdr->e_entry = 0; - ehdr->e_phoff = phoff; - ehdr->e_flags = 0; - ehdr->e_ehsize = sizeof(Elf_Ehdr); - ehdr->e_phentsize = sizeof(Elf_Phdr); - ehdr->e_phnum = numsegs + 1; - ehdr->e_shentsize = sizeof(Elf_Shdr); - ehdr->e_shnum = 0; - ehdr->e_shstrndx = SHN_UNDEF; + sbuf_bcat(sb, fpregset, sizeof(*fpregset)); + free(fpregset, M_TEMP); + } + *sizep = sizeof(*fpregset); +} - /* - * Fill in the program header entries. - */ - phdr = (Elf_Phdr *)((char *)dst + phoff); +static void +__elfN(note_thrmisc)(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct thread *td; + elf_thrmisc_t thrmisc; - /* The note segement. */ - phdr->p_type = PT_NOTE; - phdr->p_offset = noteoff; - phdr->p_vaddr = 0; - phdr->p_paddr = 0; - phdr->p_filesz = notesz; - phdr->p_memsz = 0; - phdr->p_flags = PF_R; - phdr->p_align = sizeof(Elf32_Size); - phdr++; - - /* All the writable segments from the program. */ - phc.phdr = phdr; - phc.offset = *off; - each_writable_segment(td, cb_put_phdr, &phc); + td = (struct thread *)arg; + if (sb != NULL) { + KASSERT(*sizep == sizeof(thrmisc), ("invalid size")); + bzero(&thrmisc._pad, sizeof(thrmisc._pad)); + strcpy(thrmisc.pr_tname, td->td_name); + sbuf_bcat(sb, &thrmisc, sizeof(thrmisc)); } + *sizep = sizeof(thrmisc); } +/* + * Allow for MD specific notes, as well as any MD + * specific preparations for writing MI notes. + */ static void -__elfN(putnote)(void *dst, size_t *off, const char *name, int type, - const void *desc, size_t descsz) +__elfN(note_threadmd)(void *arg, struct sbuf *sb, size_t *sizep) { - Elf_Note note; + struct thread *td; + void *buf; + size_t size; - note.n_namesz = strlen(name) + 1; - note.n_descsz = descsz; - note.n_type = type; - if (dst != NULL) - bcopy(¬e, (char *)dst + *off, sizeof note); - *off += sizeof note; - if (dst != NULL) - bcopy(name, (char *)dst + *off, note.n_namesz); - *off += roundup2(note.n_namesz, sizeof(Elf32_Size)); - if (dst != NULL) - bcopy(desc, (char *)dst + *off, note.n_descsz); - *off += roundup2(note.n_descsz, sizeof(Elf32_Size)); + td = (struct thread *)arg; + size = *sizep; + buf = NULL; + if (size != 0 && sb != NULL) + buf = malloc(size, M_TEMP, M_ZERO | M_WAITOK); + size = 0; + __elfN(dump_thread)(td, buf, &size); + KASSERT(*sizep == size, ("invalid size")); + if (size != 0 && sb != NULL) + sbuf_bcat(sb, buf, size); + *sizep = size; } static boolean_t @@ -1636,6 +1778,8 @@ EXEC_SET(__CONCAT(elf, __ELF_WORD_SIZE), * routine gzwrite(). This copying is necessary because the content of the VM * segment may change between the compression pass and the crc-computation pass * in gzwrite(). This is because realtime threads may preempt the UNIX kernel. + * + * If inbuf is NULL it is assumed that data is already copied to 'dest_buf'. */ static int compress_core (gzFile file, char *inbuf, char *dest_buf, unsigned int len, @@ -1646,8 +1790,13 @@ compress_core (gzFile file, char *inbuf, unsigned int chunk_len; while (len) { - chunk_len = (len > CORE_BUF_SIZE) ? CORE_BUF_SIZE : len; - copyin(inbuf, dest_buf, chunk_len); + if (inbuf != NULL) { + chunk_len = (len > CORE_BUF_SIZE) ? CORE_BUF_SIZE : len; + copyin(inbuf, dest_buf, chunk_len); + inbuf += chunk_len; + } else { + chunk_len = len; + } len_compressed = gzwrite(file, dest_buf, chunk_len); EVENTHANDLER_INVOKE(app_coredump_progress, td, len_compressed); @@ -1662,7 +1811,6 @@ compress_core (gzFile file, char *inbuf, error = EFAULT; break; } - inbuf += chunk_len; len -= chunk_len; maybe_yield(); } From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 20:01:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AF4F9F96; Sun, 14 Apr 2013 20:01:37 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A120AFB0; Sun, 14 Apr 2013 20:01:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EK1bdN010737; Sun, 14 Apr 2013 20:01:37 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EK1b0v010733; Sun, 14 Apr 2013 20:01:37 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304142001.r3EK1b0v010733@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 14 Apr 2013 20:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249487 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 20:01:37 -0000 Author: trociny Date: Sun Apr 14 20:01:36 2013 New Revision: 249487 URL: http://svnweb.freebsd.org/changeset/base/249487 Log: Re-factor the code to provide kern_proc_filedesc_out(), kern_proc_out(), and kern_proc_vmmap_out() functions to output process kinfo structures to sbuf, to make the code reusable. The functions are going to be used in the coredump routine to store procstat info in the core program header notes. Reviewed by: kib MFC after: 3 weeks Modified: head/sys/kern/kern_descrip.c head/sys/kern/kern_proc.c head/sys/sys/user.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Apr 14 19:59:38 2013 (r249486) +++ head/sys/kern/kern_descrip.c Sun Apr 14 20:01:36 2013 (r249487) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -3168,9 +3169,9 @@ CTASSERT(sizeof(struct kinfo_file) == KI #endif static int -export_fd_for_sysctl(void *data, int type, int fd, int fflags, int refcnt, +export_fd_to_sb(void *data, int type, int fd, int fflags, int refcnt, int64_t offset, cap_rights_t fd_cap_rights, struct kinfo_file *kif, - struct sysctl_req *req) + struct sbuf *sb, ssize_t *remainder) { struct { int fflag; @@ -3197,6 +3198,8 @@ export_fd_for_sysctl(void *data, int typ int error; unsigned int i; + if (*remainder == 0) + return (0); bzero(kif, sizeof(*kif)); switch (type) { case KF_TYPE_FIFO: @@ -3241,32 +3244,40 @@ export_fd_for_sysctl(void *data, int typ kif->kf_structsize = offsetof(struct kinfo_file, kf_path) + strlen(kif->kf_path) + 1; kif->kf_structsize = roundup(kif->kf_structsize, sizeof(uint64_t)); - error = SYSCTL_OUT(req, kif, kif->kf_structsize); + if (*remainder != -1) { + if (*remainder < kif->kf_structsize) { + /* Terminate export. */ + *remainder = 0; + return (0); + } + *remainder -= kif->kf_structsize; + } + error = sbuf_bcat(sb, kif, kif->kf_structsize); return (error); } /* - * Get per-process file descriptors for use by procstat(1), et al. + * Store a process file descriptor information to sbuf. + * + * Takes a locked proc as argument, and returns with the proc unlocked. */ -static int -sysctl_kern_proc_filedesc(SYSCTL_HANDLER_ARGS) +int +kern_proc_filedesc_out(struct proc *p, struct sbuf *sb, ssize_t maxlen) { struct file *fp; struct filedesc *fdp; struct kinfo_file *kif; - struct proc *p; struct vnode *cttyvp, *textvp, *tracevp; - size_t oldidx; int64_t offset; void *data; - int error, i, *name; + ssize_t remainder; + int error, i; int type, refcnt, fflags; cap_rights_t fd_cap_rights; - name = (int *)arg1; - error = pget((pid_t)name[0], PGET_CANDEBUG, &p); - if (error != 0) - return (error); + PROC_LOCK_ASSERT(p, MA_OWNED); + + remainder = maxlen; /* ktrace vnode */ tracevp = p->p_tracevp; if (tracevp != NULL) @@ -3286,14 +3297,15 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER PROC_UNLOCK(p); kif = malloc(sizeof(*kif), M_TEMP, M_WAITOK); if (tracevp != NULL) - export_fd_for_sysctl(tracevp, KF_TYPE_VNODE, KF_FD_TYPE_TRACE, - FREAD | FWRITE, -1, -1, 0, kif, req); + export_fd_to_sb(tracevp, KF_TYPE_VNODE, KF_FD_TYPE_TRACE, + FREAD | FWRITE, -1, -1, 0, kif, sb, &remainder); if (textvp != NULL) - export_fd_for_sysctl(textvp, KF_TYPE_VNODE, KF_FD_TYPE_TEXT, - FREAD, -1, -1, 0, kif, req); + export_fd_to_sb(textvp, KF_TYPE_VNODE, KF_FD_TYPE_TEXT, + FREAD, -1, -1, 0, kif, sb, &remainder); if (cttyvp != NULL) - export_fd_for_sysctl(cttyvp, KF_TYPE_VNODE, KF_FD_TYPE_CTTY, - FREAD | FWRITE, -1, -1, 0, kif, req); + export_fd_to_sb(cttyvp, KF_TYPE_VNODE, KF_FD_TYPE_CTTY, + FREAD | FWRITE, -1, -1, 0, kif, sb, &remainder); + error = 0; if (fdp == NULL) goto fail; FILEDESC_SLOCK(fdp); @@ -3302,8 +3314,8 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER vref(fdp->fd_cdir); data = fdp->fd_cdir; FILEDESC_SUNLOCK(fdp); - export_fd_for_sysctl(data, KF_TYPE_VNODE, KF_FD_TYPE_CWD, - FREAD, -1, -1, 0, kif, req); + export_fd_to_sb(data, KF_TYPE_VNODE, KF_FD_TYPE_CWD, + FREAD, -1, -1, 0, kif, sb, &remainder); FILEDESC_SLOCK(fdp); } /* root directory */ @@ -3311,8 +3323,8 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER vref(fdp->fd_rdir); data = fdp->fd_rdir; FILEDESC_SUNLOCK(fdp); - export_fd_for_sysctl(data, KF_TYPE_VNODE, KF_FD_TYPE_ROOT, - FREAD, -1, -1, 0, kif, req); + export_fd_to_sb(data, KF_TYPE_VNODE, KF_FD_TYPE_ROOT, + FREAD, -1, -1, 0, kif, sb, &remainder); FILEDESC_SLOCK(fdp); } /* jail directory */ @@ -3320,8 +3332,8 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER vref(fdp->fd_jdir); data = fdp->fd_jdir; FILEDESC_SUNLOCK(fdp); - export_fd_for_sysctl(data, KF_TYPE_VNODE, KF_FD_TYPE_JAIL, - FREAD, -1, -1, 0, kif, req); + export_fd_to_sb(data, KF_TYPE_VNODE, KF_FD_TYPE_JAIL, + FREAD, -1, -1, 0, kif, sb, &remainder); FILEDESC_SLOCK(fdp); } for (i = 0; i < fdp->fd_nfiles; i++) { @@ -3403,26 +3415,14 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER * re-validate and re-evaluate its properties when * the loop continues. */ - oldidx = req->oldidx; if (type == KF_TYPE_VNODE || type == KF_TYPE_FIFO) FILEDESC_SUNLOCK(fdp); - error = export_fd_for_sysctl(data, type, i, fflags, refcnt, - offset, fd_cap_rights, kif, req); + error = export_fd_to_sb(data, type, i, fflags, refcnt, + offset, fd_cap_rights, kif, sb, &remainder); if (type == KF_TYPE_VNODE || type == KF_TYPE_FIFO) FILEDESC_SLOCK(fdp); - if (error) { - if (error == ENOMEM) { - /* - * The hack to keep the ABI of sysctl - * kern.proc.filedesc intact, but not - * to account a partially copied - * kinfo_file into the oldidx. - */ - req->oldidx = oldidx; - error = 0; - } + if (error) break; - } } FILEDESC_SUNLOCK(fdp); fail: @@ -3432,6 +3432,34 @@ fail: return (error); } +#define FILEDESC_SBUF_SIZE (sizeof(struct kinfo_file) * 5) + +/* + * Get per-process file descriptors for use by procstat(1), et al. + */ +static int +sysctl_kern_proc_filedesc(SYSCTL_HANDLER_ARGS) +{ + struct sbuf sb; + struct proc *p; + ssize_t maxlen; + int error, error2, *name; + + name = (int *)arg1; + + sbuf_new_for_sysctl(&sb, NULL, FILEDESC_SBUF_SIZE, req); + error = pget((pid_t)name[0], PGET_CANDEBUG, &p); + if (error != 0) { + sbuf_delete(&sb); + return (error); + } + maxlen = req->oldptr != NULL ? req->oldlen : -1; + error = kern_proc_filedesc_out(p, &sb, maxlen); + error2 = sbuf_finish(&sb); + sbuf_delete(&sb); + return (error != 0 ? error : error2); +} + int vntype_to_kinfo(int vtype) { Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sun Apr 14 19:59:38 2013 (r249486) +++ head/sys/kern/kern_proc.c Sun Apr 14 20:01:36 2013 (r249487) @@ -1089,9 +1089,6 @@ zpfind(pid_t pid) return (p); } -#define KERN_PROC_ZOMBMASK 0x3 -#define KERN_PROC_NOTHREADS 0x4 - #ifdef COMPAT_FREEBSD32 /* @@ -1191,59 +1188,69 @@ freebsd32_kinfo_proc_out(const struct ki CP(*ki, *ki32, ki_sflag); CP(*ki, *ki32, ki_tdflags); } - -static int -sysctl_out_proc_copyout(struct kinfo_proc *ki, struct sysctl_req *req) -{ - struct kinfo_proc32 ki32; - int error; - - if (req->flags & SCTL_MASK32) { - freebsd32_kinfo_proc_out(ki, &ki32); - error = SYSCTL_OUT(req, &ki32, sizeof(struct kinfo_proc32)); - } else - error = SYSCTL_OUT(req, ki, sizeof(struct kinfo_proc)); - return (error); -} -#else -static int -sysctl_out_proc_copyout(struct kinfo_proc *ki, struct sysctl_req *req) -{ - - return (SYSCTL_OUT(req, ki, sizeof(struct kinfo_proc))); -} #endif -/* - * Must be called with the process locked and will return with it unlocked. - */ -static int -sysctl_out_proc(struct proc *p, struct sysctl_req *req, int flags) +int +kern_proc_out(struct proc *p, struct sbuf *sb, int flags) { struct thread *td; - struct kinfo_proc kinfo_proc; - int error = 0; - struct proc *np; - pid_t pid = p->p_pid; + struct kinfo_proc ki; +#ifdef COMPAT_FREEBSD32 + struct kinfo_proc32 ki32; +#endif + int error; PROC_LOCK_ASSERT(p, MA_OWNED); MPASS(FIRST_THREAD_IN_PROC(p) != NULL); - fill_kinfo_proc(p, &kinfo_proc); - if (flags & KERN_PROC_NOTHREADS) - error = sysctl_out_proc_copyout(&kinfo_proc, req); - else { + error = 0; + fill_kinfo_proc(p, &ki); + if ((flags & KERN_PROC_NOTHREADS) != 0) { +#ifdef COMPAT_FREEBSD32 + if ((flags & KERN_PROC_MASK32) != 0) { + freebsd32_kinfo_proc_out(&ki, &ki32); + error = sbuf_bcat(sb, &ki32, sizeof(ki32)); + } else +#endif + error = sbuf_bcat(sb, &ki, sizeof(ki)); + } else { FOREACH_THREAD_IN_PROC(p, td) { - fill_kinfo_thread(td, &kinfo_proc, 1); - error = sysctl_out_proc_copyout(&kinfo_proc, req); + fill_kinfo_thread(td, &ki, 1); +#ifdef COMPAT_FREEBSD32 + if ((flags & KERN_PROC_MASK32) != 0) { + freebsd32_kinfo_proc_out(&ki, &ki32); + error = sbuf_bcat(sb, &ki32, sizeof(ki32)); + } else +#endif + error = sbuf_bcat(sb, &ki, sizeof(ki)); if (error) break; } } PROC_UNLOCK(p); - if (error) + return (error); +} + +static int +sysctl_out_proc(struct proc *p, struct sysctl_req *req, int flags, + int doingzomb) +{ + struct sbuf sb; + struct kinfo_proc ki; + struct proc *np; + int error, error2; + pid_t pid; + + pid = p->p_pid; + sbuf_new_for_sysctl(&sb, (char *)&ki, sizeof(ki), req); + error = kern_proc_out(p, &sb, flags); + error2 = sbuf_finish(&sb); + sbuf_delete(&sb); + if (error != 0) return (error); - if (flags & KERN_PROC_ZOMBMASK) + else if (error2 != 0) + return (error2); + if (doingzomb) np = zpfind(pid); else { if (pid == 0) @@ -1277,6 +1284,10 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) flags = 0; oid_number &= ~KERN_PROC_INC_THREAD; } +#ifdef COMPAT_FREEBSD32 + if (req->flags & SCTL_MASK32) + flags |= KERN_PROC_MASK32; +#endif if (oid_number == KERN_PROC_PID) { if (namelen != 1) return (EINVAL); @@ -1286,7 +1297,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) error = pget((pid_t)name[0], PGET_CANSEE, &p); if (error != 0) return (error); - error = sysctl_out_proc(p, req, flags); + error = sysctl_out_proc(p, req, flags, 0); return (error); } @@ -1415,7 +1426,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) } - error = sysctl_out_proc(p, req, flags | doingzomb); + error = sysctl_out_proc(p, req, flags, doingzomb); if (error) { sx_sunlock(&allproc_lock); return (error); @@ -2119,8 +2130,11 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A CTASSERT(sizeof(struct kinfo_vmentry) == KINFO_VMENTRY_SIZE); #endif -static int -sysctl_kern_proc_vmmap(SYSCTL_HANDLER_ARGS) +/* + * Must be called with the process locked and will return unlocked. + */ +int +kern_proc_vmmap_out(struct proc *p, struct sbuf *sb) { vm_map_entry_t entry, tmp_entry; unsigned int last_timestamp; @@ -2128,16 +2142,15 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR struct kinfo_vmentry *kve; struct vattr va; struct ucred *cred; - int error, *name; + int error; struct vnode *vp; - struct proc *p; struct vmspace *vm; vm_map_t map; - name = (int *)arg1; - error = pget((pid_t)name[0], PGET_WANTREAD, &p); - if (error != 0) - return (error); + PROC_LOCK_ASSERT(p, MA_OWNED); + + _PHOLD(p); + PROC_UNLOCK(p); vm = vmspace_acquire_ref(p); if (vm == NULL) { PRELE(p); @@ -2145,6 +2158,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR } kve = malloc(sizeof(*kve), M_TEMP, M_WAITOK); + error = 0; map = &vm->vm_map; vm_map_lock_read(map); for (entry = map->header.next; entry != &map->header; @@ -2284,7 +2298,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR strlen(kve->kve_path) + 1; kve->kve_structsize = roundup(kve->kve_structsize, sizeof(uint64_t)); - error = SYSCTL_OUT(req, kve, kve->kve_structsize); + error = sbuf_bcat(sb, kve, kve->kve_structsize); vm_map_lock_read(map); if (error) break; @@ -2300,6 +2314,26 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR return (error); } +static int +sysctl_kern_proc_vmmap(SYSCTL_HANDLER_ARGS) +{ + struct proc *p; + struct sbuf sb; + int error, error2, *name; + + name = (int *)arg1; + sbuf_new_for_sysctl(&sb, NULL, sizeof(struct kinfo_vmentry), req); + error = pget((pid_t)name[0], PGET_CANDEBUG | PGET_NOTWEXIT, &p); + if (error != 0) { + sbuf_delete(&sb); + return (error); + } + error = kern_proc_vmmap_out(p, &sb); + error2 = sbuf_finish(&sb); + sbuf_delete(&sb); + return (error != 0 ? error : error2); +} + #if defined(STACK) || defined(DDB) static int sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) Modified: head/sys/sys/user.h ============================================================================== --- head/sys/sys/user.h Sun Apr 14 19:59:38 2013 (r249486) +++ head/sys/sys/user.h Sun Apr 14 20:01:36 2013 (r249487) @@ -491,6 +491,25 @@ struct kinfo_kstack { }; #ifdef _KERNEL +/* Flags for kern_proc_out function. */ +#define KERN_PROC_NOTHREADS 0x1 +#define KERN_PROC_MASK32 0x2 + +struct sbuf; + +/* + * The kern_proc out functions are helper functions to dump process + * miscellaneous kinfo structures to sbuf. The main consumers are KERN_PROC + * sysctls but they may also be used by other kernel subsystems. + * + * The functions manipulate the process locking state and expect the process + * to be locked on enter. On return the process is unlocked. + */ + +int kern_proc_filedesc_out(struct proc *p, struct sbuf *sb, ssize_t maxlen); +int kern_proc_out(struct proc *p, struct sbuf *sb, int flags); +int kern_proc_vmmap_out(struct proc *p, struct sbuf *sb); + int vntype_to_kinfo(int vtype); #endif /* !_KERNEL */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 20:03:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3B6EF1A5; Sun, 14 Apr 2013 20:03:49 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 13A78FBE; Sun, 14 Apr 2013 20:03:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EK3m4D011163; Sun, 14 Apr 2013 20:03:48 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EK3meI011161; Sun, 14 Apr 2013 20:03:48 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304142003.r3EK3meI011161@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 14 Apr 2013 20:03:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249488 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 20:03:49 -0000 Author: trociny Date: Sun Apr 14 20:03:48 2013 New Revision: 249488 URL: http://svnweb.freebsd.org/changeset/base/249488 Log: Similarly to proc_getargv() and proc_getenvv(), export proc_getauxv() to be able to reuse the code. MFC after: 3 weeks Modified: head/sys/kern/kern_proc.c head/sys/sys/proc.h Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sun Apr 14 20:01:36 2013 (r249487) +++ head/sys/kern/kern_proc.c Sun Apr 14 20:03:48 2013 (r249488) @@ -1759,6 +1759,27 @@ proc_getenvv(struct thread *td, struct p return (get_ps_strings(curthread, p, sb, PROC_ENV)); } +int +proc_getauxv(struct thread *td, struct proc *p, struct sbuf *sb) +{ + size_t vsize, size; + char **auxv; + int error; + + error = get_proc_vector(td, p, &auxv, &vsize, PROC_AUX); + if (error == 0) { +#ifdef COMPAT_FREEBSD32 + if (SV_PROC_FLAG(p, SV_ILP32) != 0) + size = vsize * sizeof(Elf32_Auxinfo); + else +#endif + size = vsize * sizeof(Elf_Auxinfo); + error = sbuf_bcat(sb, auxv, size); + free(auxv, M_TEMP); + } + return (error); +} + /* * This sysctl allows a process to retrieve the argument list or process * title for another process without groping around in the address space @@ -1864,9 +1885,8 @@ sysctl_kern_proc_auxv(SYSCTL_HANDLER_ARG int *name = (int *)arg1; u_int namelen = arg2; struct proc *p; - size_t vsize, size; - char **auxv; - int error; + struct sbuf sb; + int error, error2; if (namelen != 1) return (EINVAL); @@ -1878,21 +1898,12 @@ sysctl_kern_proc_auxv(SYSCTL_HANDLER_ARG PRELE(p); return (0); } - error = get_proc_vector(curthread, p, &auxv, &vsize, PROC_AUX); - if (error == 0) { -#ifdef COMPAT_FREEBSD32 - if (SV_PROC_FLAG(p, SV_ILP32) != 0) - size = vsize * sizeof(Elf32_Auxinfo); - else -#endif - size = vsize * sizeof(Elf_Auxinfo); - PRELE(p); - error = SYSCTL_OUT(req, auxv, size); - free(auxv, M_TEMP); - } else { - PRELE(p); - } - return (error); + sbuf_new_for_sysctl(&sb, NULL, GET_PS_STRINGS_CHUNK_SZ, req); + error = proc_getauxv(curthread, p, &sb); + error2 = sbuf_finish(&sb); + PRELE(p); + sbuf_delete(&sb); + return (error != 0 ? error : error2); } /* Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sun Apr 14 20:01:36 2013 (r249487) +++ head/sys/sys/proc.h Sun Apr 14 20:03:48 2013 (r249488) @@ -873,6 +873,7 @@ struct pargs *pargs_alloc(int len); void pargs_drop(struct pargs *pa); void pargs_hold(struct pargs *pa); int proc_getargv(struct thread *td, struct proc *p, struct sbuf *sb); +int proc_getauxv(struct thread *td, struct proc *p, struct sbuf *sb); int proc_getenvv(struct thread *td, struct proc *p, struct sbuf *sb); void procinit(void); void proc_linkup0(struct proc *p, struct thread *td); From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 20:52:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4F22A9B1; Sun, 14 Apr 2013 20:52:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id BA4521BC; Sun, 14 Apr 2013 20:52:32 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r3EKqM6o060194; Sun, 14 Apr 2013 23:52:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.2 kib.kiev.ua r3EKqM6o060194 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r3EKqMmW060193; Sun, 14 Apr 2013 23:52:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 14 Apr 2013 23:52:22 +0300 From: Konstantin Belousov To: Marius Strobl Subject: Re: svn commit: r249476 - in head/sys/dev: ata pci Message-ID: <20130414205222.GG2930@kib.kiev.ua> References: <201304141402.r3EE2YIi001357@svn.freebsd.org> <20130414150507.GA62578@alchemy.franken.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Kra4tWuoVJHqwr45" Content-Disposition: inline In-Reply-To: <20130414150507.GA62578@alchemy.franken.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 20:52:33 -0000 --Kra4tWuoVJHqwr45 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Apr 14, 2013 at 05:05:07PM +0200, Marius Strobl wrote: > On Sun, Apr 14, 2013 at 02:02:34PM +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Sun Apr 14 14:02:34 2013 > > New Revision: 249476 > > URL: http://svnweb.freebsd.org/changeset/base/249476 > >=20 > > Log: > > Usnure that PCI bus BIS_GET_DMA_TAG() method sees the actual PCI > > device which makes the request for dma tag, instead of some descendant > > of the PCI device, by creating a pass-through trampoline for vga_pci > > and ata_pci buses. >=20 > If you need to know the last PCI device requesting the DMA tag, > wouldn't it make more sense to let the consumer of this walk up the > tree as necessary instead of hacking N drivers? I.e.: > foo_get_dma_tag(device_t bus, device_t child) > { > device_t device, parent; > devclass_t pci_devclass; >=20 > pci_devclass =3D devclass_find("pci"); > for (device =3D child; child !=3D bus; device =3D parent) { > parent =3D device_get_parent(device); > if (device_get_devclass(parent) !=3D pci_devclass) > continue; > break; > } > /* use device */ > } The similar approach was my first thought, and I discussed it with John. After the discussion, I agreed that this is a hack. My understanding is that this default behaviour is only correct for the simple cases like the one fixed in the commit. Forcing this on other buses would only make the bugs hidden and cause more efforts in trying to identify it. >=20 > I suspect the problem you are hitting is also true for ISA devices > behind a PCI-ISA-bridge, PCI device drivers attaching non-PCI sub- > devices requesting DMA tags like sk(4) etc. And ISA DMA is probably good example why bus by default should not do the walking up. ISA bridge would need to allocate its own root tag for the ISA, while ISA bus needs to provide the specific tags and, most likely, specific busdma functions implementation for the ISA DMA channels. Of course, this talk assumes that ISA DMA is going to be converted to busdma. Unfortunately for me, the conversion looks inevitable. --Kra4tWuoVJHqwr45 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRaxcGAAoJEJDCuSvBvK1B1ccP/2j6mIBYsX7We7930/45fS6Y USydw8SQWN4N9Oaq/SOqWukF3wMRz/7arX62wrl+JMVicMp+twf6rC2j0A5ax30B tlMdkw5qmC8yZy8WJNNa0Vn6G5uF9+X7WO0BmXymXJhg2/Kf1xYDkcN+cFKHPzAN oPb78obSSxDYq1qemexgQBcC9deOJBd9xsWM3fv8VMa8IExRhaANEUOoQ8hN3/M5 EoAe6kBYB+0XNrUOu9vBeW3qi1m24OradrfmM72tHKzQWdORekr803s5XcDVUZiw 4/bmuF1pk3HZPPi0s4w0Kshg5MzOJn6Gm5keyoQ5T0FQlLFLEJTaP0/tYfgeelcQ RePeWLTuY5kYoEKJkq7fONBWBwOcjrWEf3dyKYqEn+mcrdX/U029WnryqUZgyuX7 THGwt41vRVNwlejqVnxtDL/LoaPW46/HCb2wiS4Z0/0y9E/G/CvwZ98dcRutU6LA 9joWoNqRr3ZLedVvAT0g92KXG4SLoKEWUoEst7dckjgsUvRekd5azHZF6ELtKs56 Tke6HDPy7sX9urj6+AC/R/GFLCgee7YGVEnaDWmqMYosO063MB+zVa3zzAnUWv0r Gsy4s7v0ctul82TmrJL7CbKidv3wg1wdiWhzxotxi+2Vjzr5bZu2CU46z5MVGV+g Cz184944vair0Hth9lRS =E2IE -----END PGP SIGNATURE----- --Kra4tWuoVJHqwr45-- From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 21:11:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7ECDAC63; Sun, 14 Apr 2013 21:11:20 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 70BD2244; Sun, 14 Apr 2013 21:11:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3ELBKdJ032134; Sun, 14 Apr 2013 21:11:20 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3ELBKRG032133; Sun, 14 Apr 2013 21:11:20 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201304142111.r3ELBKRG032133@svn.freebsd.org> From: Bryan Drewery Date: Sun, 14 Apr 2013 21:11:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249489 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 21:11:20 -0000 Author: bdrewery (ports committer) Date: Sun Apr 14 21:11:19 2013 New Revision: 249489 URL: http://svnweb.freebsd.org/changeset/base/249489 Log: Run configtest before restarting so that the system is not left without a running sshd. Approved by: des MFC after: 1 week Modified: head/etc/rc.d/sshd Modified: head/etc/rc.d/sshd ============================================================================== --- head/etc/rc.d/sshd Sun Apr 14 20:03:48 2013 (r249488) +++ head/etc/rc.d/sshd Sun Apr 14 21:11:19 2013 (r249489) @@ -14,6 +14,7 @@ rcvar="sshd_enable" command="/usr/sbin/${name}" keygen_cmd="sshd_keygen" start_precmd="sshd_precmd" +restart_precmd="sshd_configtest" configtest_cmd="sshd_configtest" pidfile="/var/run/${name}.pid" extra_commands="configtest keygen reload" From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 21:18:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E04B2E83; Sun, 14 Apr 2013 21:18:46 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 7BDDF27E; Sun, 14 Apr 2013 21:18:46 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.6/8.14.6/ALCHEMY.FRANKEN.DE) with ESMTP id r3ELIjmX069077; Sun, 14 Apr 2013 23:18:45 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.6/8.14.6/Submit) id r3ELIimp069076; Sun, 14 Apr 2013 23:18:44 +0200 (CEST) (envelope-from marius) Date: Sun, 14 Apr 2013 23:18:44 +0200 From: Marius Strobl To: Konstantin Belousov Subject: Re: svn commit: r249476 - in head/sys/dev: ata pci Message-ID: <20130414211844.GB62578@alchemy.franken.de> References: <201304141402.r3EE2YIi001357@svn.freebsd.org> <20130414150507.GA62578@alchemy.franken.de> <20130414205222.GG2930@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130414205222.GG2930@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 21:18:47 -0000 On Sun, Apr 14, 2013 at 11:52:22PM +0300, Konstantin Belousov wrote: > On Sun, Apr 14, 2013 at 05:05:07PM +0200, Marius Strobl wrote: > > On Sun, Apr 14, 2013 at 02:02:34PM +0000, Konstantin Belousov wrote: > > > Author: kib > > > Date: Sun Apr 14 14:02:34 2013 > > > New Revision: 249476 > > > URL: http://svnweb.freebsd.org/changeset/base/249476 > > > > > > Log: > > > Usnure that PCI bus BIS_GET_DMA_TAG() method sees the actual PCI > > > device which makes the request for dma tag, instead of some descendant > > > of the PCI device, by creating a pass-through trampoline for vga_pci > > > and ata_pci buses. > > > > If you need to know the last PCI device requesting the DMA tag, > > wouldn't it make more sense to let the consumer of this walk up the > > tree as necessary instead of hacking N drivers? I.e.: > > foo_get_dma_tag(device_t bus, device_t child) > > { > > device_t device, parent; > > devclass_t pci_devclass; > > > > pci_devclass = devclass_find("pci"); > > for (device = child; child != bus; device = parent) { > > parent = device_get_parent(device); > > if (device_get_devclass(parent) != pci_devclass) > > continue; > > break; > > } > > /* use device */ > > } > The similar approach was my first thought, and I discussed it with John. > After the discussion, I agreed that this is a hack. > > My understanding is that this default behaviour is only correct for > the simple cases like the one fixed in the commit. Forcing this on > other buses would only make the bugs hidden and cause more efforts > in trying to identify it. Oh, I see that now. Thanks for the clarification. Marius From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 03:02:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D9DB8DAD; Mon, 15 Apr 2013 03:02:55 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CC5D4DE7; Mon, 15 Apr 2013 03:02:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3F32toR040909; Mon, 15 Apr 2013 03:02:55 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3F32tDK040908; Mon, 15 Apr 2013 03:02:55 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201304150302.r3F32tDK040908@svn.freebsd.org> From: Hiren Panchasara Date: Mon, 15 Apr 2013 03:02:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249491 - head/share/man/man3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 03:02:55 -0000 Author: hiren Date: Mon Apr 15 03:02:55 2013 New Revision: 249491 URL: http://svnweb.freebsd.org/changeset/base/249491 Log: Fixing a typo. Submitted by: Benedikt Steinbusch (benedikt.steinbusch@googlemail.com) Approved by: sbruno (mentor) Modified: head/share/man/man3/pthread_getconcurrency.3 Modified: head/share/man/man3/pthread_getconcurrency.3 ============================================================================== --- head/share/man/man3/pthread_getconcurrency.3 Sun Apr 14 22:38:28 2013 (r249490) +++ head/share/man/man3/pthread_getconcurrency.3 Mon Apr 15 03:02:55 2013 (r249491) @@ -40,7 +40,7 @@ .Fn pthread_setconcurrency "int new_level" .Sh DESCRIPTION The -.Fn pthread_getconcurrency +.Fn pthread_setconcurrency function allows an application to inform the threads implementation of its desired concurrency level, .Fa new_level . From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 05:32:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 90021CD4; Mon, 15 Apr 2013 05:32:00 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 72C2B2D6; Mon, 15 Apr 2013 05:32:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3F5W0wL086687; Mon, 15 Apr 2013 05:32:00 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3F5Vxin086676; Mon, 15 Apr 2013 05:31:59 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201304150531.r3F5Vxin086676@svn.freebsd.org> From: Xin LI Date: Mon, 15 Apr 2013 05:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249499 - head/contrib/netcat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 05:32:00 -0000 Author: delphij Date: Mon Apr 15 05:31:59 2013 New Revision: 249499 URL: http://svnweb.freebsd.org/changeset/base/249499 Log: MFV r249496,249498. The most visible change is that we no longer shuts down the connection when stdin closes, by default. This matches Hobbit's original netcat and GNU netcat. Old behavior can be restored with the new -N flag. MFC after: 2 weeks Modified: head/contrib/netcat/atomicio.c head/contrib/netcat/nc.1 head/contrib/netcat/netcat.c Directory Properties: head/contrib/netcat/ (props changed) Modified: head/contrib/netcat/atomicio.c ============================================================================== --- head/contrib/netcat/atomicio.c Mon Apr 15 05:24:43 2013 (r249498) +++ head/contrib/netcat/atomicio.c Mon Apr 15 05:31:59 2013 (r249499) @@ -1,4 +1,4 @@ -/* $OpenBSD: atomicio.c,v 1.10 2011/01/08 00:47:19 jeremy Exp $ */ +/* $OpenBSD: atomicio.c,v 1.11 2012/12/04 02:24:47 deraadt Exp $ */ /* * Copyright (c) 2006 Damien Miller. All rights reserved. * Copyright (c) 2005 Anil Madhavapeddy. All rights reserved. @@ -26,8 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include - #include #include #include Modified: head/contrib/netcat/nc.1 ============================================================================== --- head/contrib/netcat/nc.1 Mon Apr 15 05:24:43 2013 (r249498) +++ head/contrib/netcat/nc.1 Mon Apr 15 05:31:59 2013 (r249499) @@ -1,4 +1,4 @@ -.\" $OpenBSD: nc.1,v 1.61 2012/07/07 15:33:02 haesbaert Exp $ +.\" $OpenBSD: nc.1,v 1.62 2013/03/20 09:27:56 sthen Exp $ .\" .\" Copyright (c) 1996 David Sacerdote .\" All rights reserved. @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 7, 2012 +.Dd July 7, 2012 .Dt NC 1 .Os .Sh NAME @@ -36,7 +36,7 @@ .Sh SYNOPSIS .Nm nc .Bk -words -.Op Fl 46DdEhklnrStUuvz +.Op Fl 46DdEhklNnrStUuvz .Op Fl e Ar IPsec_policy .Op Fl I Ar length .Op Fl i Ar interval @@ -155,6 +155,10 @@ options. Additionally, any timeouts specified with the .Fl w option are ignored. +.It Fl N +.Xr shutdown 2 +the network socket after EOF on the input. +Some servers require this to finish their work. .It Fl n Do not do any DNS or service lookups on any specified addresses, hostnames or ports. Modified: head/contrib/netcat/netcat.c ============================================================================== --- head/contrib/netcat/netcat.c Mon Apr 15 05:24:43 2013 (r249498) +++ head/contrib/netcat/netcat.c Mon Apr 15 05:31:59 2013 (r249499) @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.109 2012/07/07 15:33:02 haesbaert Exp $ */ +/* $OpenBSD: netcat.c,v 1.111 2013/03/20 09:27:56 sthen Exp $ */ /* * Copyright (c) 2001 Eric Jackson * @@ -77,6 +77,7 @@ int dflag; /* detached, no stdin */ unsigned int iflag; /* Interval Flag */ int kflag; /* More than one connect */ int lflag; /* Bind to local port */ +int Nflag; /* shutdown() network socket */ int nflag; /* Don't do name look up */ int FreeBSD_Oflag; /* Do not use TCP options */ char *Pflag; /* Proxy username */ @@ -153,7 +154,7 @@ main(int argc, char *argv[]) sv = NULL; while ((ch = getopt_long(argc, argv, - "46DdEe:hI:i:klnoO:P:p:rSs:tT:UuV:vw:X:x:z", + "46DdEe:hI:i:klNnoO:P:p:rSs:tT:UuV:vw:X:x:z", longopts, NULL)) != -1) { switch (ch) { case '4': @@ -207,6 +208,9 @@ main(int argc, char *argv[]) case 'l': lflag = 1; break; + case 'N': + Nflag = 1; + break; case 'n': nflag = 1; break; @@ -424,9 +428,10 @@ main(int argc, char *argv[]) len = sizeof(cliaddr); connfd = accept(s, (struct sockaddr *)&cliaddr, &len); - if (connfd == -1) - err(1, "accept"); - + if (connfd == -1) { + /* For now, all errnos are fatal */ + err(1, "accept"); + } if (vflag) report_connect((struct sockaddr *)&cliaddr, len); @@ -833,7 +838,8 @@ readwrite(int nfd) if ((n = read(wfd, buf, plen)) < 0) return; else if (n == 0) { - shutdown(nfd, SHUT_WR); + if (Nflag) + shutdown(nfd, SHUT_WR); pfd[1].fd = -1; pfd[1].events = 0; } else { @@ -1087,6 +1093,7 @@ help(void) \t-i secs\t Delay interval for lines sent, ports scanned\n\ \t-k Keep inbound sockets open for multiple connects\n\ \t-l Listen mode, for inbound connects\n\ + \t-N Shutdown the network socket after EOF on stdin\n\ \t-n Suppress name/port resolutions\n\ \t--no-tcpopt Disable TCP options\n\ \t-O length TCP send buffer length\n\ @@ -1139,9 +1146,9 @@ usage(int ret) { fprintf(stderr, #ifdef IPSEC - "usage: nc [-46DdEhklnrStUuvz] [-e policy] [-I length] [-i interval] [-O length]\n" + "usage: nc [-46DdEhklNnrStUuvz] [-e policy] [-I length] [-i interval] [-O length]\n" #else - "usage: nc [-46DdhklnrStUuvz] [-I length] [-i interval] [-O length]\n" + "usage: nc [-46DdhklNnrStUuvz] [-I length] [-i interval] [-O length]\n" #endif "\t [-P proxy_username] [-p source_port] [-s source] [-T ToS]\n" "\t [-V rtable] [-w timeout] [-X proxy_protocol]\n" From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 05:39:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 54B8AEE0; Mon, 15 Apr 2013 05:39:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 464C5321; Mon, 15 Apr 2013 05:39:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3F5dMFj087725; Mon, 15 Apr 2013 05:39:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3F5dMgk087724; Mon, 15 Apr 2013 05:39:22 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201304150539.r3F5dMgk087724@svn.freebsd.org> From: Xin LI Date: Mon, 15 Apr 2013 05:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249500 - head/sbin/growfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 05:39:22 -0000 Author: delphij Date: Mon Apr 15 05:39:21 2013 New Revision: 249500 URL: http://svnweb.freebsd.org/changeset/base/249500 Log: Use arc4random() instead of random(). MFC after: 2 weeks Modified: head/sbin/growfs/growfs.c Modified: head/sbin/growfs/growfs.c ============================================================================== --- head/sbin/growfs/growfs.c Mon Apr 15 05:31:59 2013 (r249499) +++ head/sbin/growfs/growfs.c Mon Apr 15 05:39:21 2013 (r249500) @@ -141,14 +141,9 @@ growfs(int fsi, int fso, unsigned int Nf uint cylno; int i, j, width; char tmpbuf[100]; - static int randinit = 0; DBG_ENTER; - if (!randinit) { - randinit = 1; - srandomdev(); - } time(&modtime); /* @@ -407,7 +402,7 @@ initcg(int cylno, time_t modtime, int fs i += sblock.fs_frag) { dp1 = (struct ufs1_dinode *)(void *)iobuf; for (j = 0; j < INOPB(&sblock); j++) { - dp1->di_gen = random(); + dp1->di_gen = arc4random(); dp1++; } wtfs(fsbtodb(&sblock, cgimin(&sblock, cylno) + i), From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 06:12:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 11BFB5F4; Mon, 15 Apr 2013 06:12:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E8EE7642; Mon, 15 Apr 2013 06:12:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3F6C0kx099135; Mon, 15 Apr 2013 06:12:00 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3F6C0w1099134; Mon, 15 Apr 2013 06:12:00 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201304150612.r3F6C0w1099134@svn.freebsd.org> From: Alan Cox Date: Mon, 15 Apr 2013 06:12:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249502 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 06:12:01 -0000 Author: alc Date: Mon Apr 15 06:12:00 2013 New Revision: 249502 URL: http://svnweb.freebsd.org/changeset/base/249502 Log: Although we perform path compression to reduce the height of the trie and the number of interior nodes, we have previously created a level zero interior node at the root of every non-empty trie, even when that node is not strictly necessary, i.e., it has only one child. This change is the second (and final) step in eliminating those unnecessary level zero interior nodes. Specifically, it updates the deletion and insertion functions so that they do not require a level zero interior node at the root of the trie. For a "buildworld" workload, this change results in a 16.8% reduction in the number of interior nodes allocated and a similar reduction in the average execution time for lookup functions. For example, the average execution time for a call to vm_radix_lookup_ge() is reduced by 22.9%. Reviewed by: attilio, jeff (an earlier version) Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_radix.c Modified: head/sys/vm/vm_radix.c ============================================================================== --- head/sys/vm/vm_radix.c Mon Apr 15 05:50:09 2013 (r249501) +++ head/sys/vm/vm_radix.c Mon Apr 15 06:12:00 2013 (r249502) @@ -396,7 +396,8 @@ void vm_radix_insert(struct vm_radix *rtree, vm_page_t page) { vm_pindex_t index, newind; - struct vm_radix_node *parent, *rnode, *tmp; + void **parentp; + struct vm_radix_node *rnode, *tmp; vm_page_t m; int slot; uint16_t clev; @@ -409,34 +410,34 @@ vm_radix_insert(struct vm_radix *rtree, */ rnode = vm_radix_getroot(rtree); if (rnode == NULL) { - rnode = vm_radix_node_get(0, 1, 0); - vm_radix_setroot(rtree, rnode); - vm_radix_addpage(rnode, index, 0, page); + rtree->rt_root = (uintptr_t)page | VM_RADIX_ISLEAF; return; } - do { - slot = vm_radix_slot(index, rnode->rn_clev); - if (vm_radix_isleaf(rnode->rn_child[slot])) { - m = vm_radix_topage(rnode->rn_child[slot]); + parentp = (void **)&rtree->rt_root; + for (;;) { + if (vm_radix_isleaf(rnode)) { + m = vm_radix_topage(rnode); if (m->pindex == index) panic("%s: key %jx is already present", __func__, (uintmax_t)index); clev = vm_radix_keydiff(m->pindex, index); tmp = vm_radix_node_get(vm_radix_trimkey(index, clev - 1), 2, clev); - rnode->rn_child[slot] = tmp; + *parentp = tmp; vm_radix_addpage(tmp, index, clev, page); vm_radix_addpage(tmp, m->pindex, clev, m); return; - } + } else if (vm_radix_keybarr(rnode, index)) + break; + slot = vm_radix_slot(index, rnode->rn_clev); if (rnode->rn_child[slot] == NULL) { rnode->rn_count++; vm_radix_addpage(rnode, index, rnode->rn_clev, page); return; } - parent = rnode; + parentp = &rnode->rn_child[slot]; rnode = rnode->rn_child[slot]; - } while (!vm_radix_keybarr(rnode, index)); + } /* * A new node is needed because the right insertion level is reached. @@ -447,7 +448,7 @@ vm_radix_insert(struct vm_radix *rtree, clev = vm_radix_keydiff(newind, index); tmp = vm_radix_node_get(vm_radix_trimkey(index, clev - 1), 2, clev); - parent->rn_child[slot] = tmp; + *parentp = tmp; vm_radix_addpage(tmp, index, clev, page); slot = vm_radix_slot(newind, clev); tmp->rn_child[slot] = rnode; @@ -694,8 +695,15 @@ vm_radix_remove(struct vm_radix *rtree, vm_page_t m; int i, slot; - parent = NULL; rnode = vm_radix_getroot(rtree); + if (vm_radix_isleaf(rnode)) { + m = vm_radix_topage(rnode); + if (m->pindex != index) + panic("%s: invalid key found", __func__); + vm_radix_setroot(rtree, NULL); + return; + } + parent = NULL; for (;;) { if (rnode == NULL) panic("vm_radix_remove: impossible to locate the key"); @@ -708,22 +716,19 @@ vm_radix_remove(struct vm_radix *rtree, rnode->rn_count--; if (rnode->rn_count > 1) break; - if (parent == NULL) { - if (rnode->rn_count == 0) { - vm_radix_node_put(rnode); - vm_radix_setroot(rtree, NULL); - } - break; - } for (i = 0; i < VM_RADIX_COUNT; i++) if (rnode->rn_child[i] != NULL) break; KASSERT(i != VM_RADIX_COUNT, ("%s: invalid node configuration", __func__)); - slot = vm_radix_slot(index, parent->rn_clev); - KASSERT(parent->rn_child[slot] == rnode, - ("%s: invalid child value", __func__)); - parent->rn_child[slot] = rnode->rn_child[i]; + if (parent == NULL) + vm_radix_setroot(rtree, rnode->rn_child[i]); + else { + slot = vm_radix_slot(index, parent->rn_clev); + KASSERT(parent->rn_child[slot] == rnode, + ("%s: invalid child value", __func__)); + parent->rn_child[slot] = rnode->rn_child[i]; + } rnode->rn_count--; rnode->rn_child[i] = NULL; vm_radix_node_put(rnode); @@ -748,7 +753,8 @@ vm_radix_reclaim_allnodes(struct vm_radi if (root == NULL) return; vm_radix_setroot(rtree, NULL); - vm_radix_reclaim_allnodes_int(root); + if (!vm_radix_isleaf(root)) + vm_radix_reclaim_allnodes_int(root); } #ifdef DDB From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 11:49:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7AAEF829; Mon, 15 Apr 2013 11:49:17 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6DC0AAA9; Mon, 15 Apr 2013 11:49:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FBnHcw099021; Mon, 15 Apr 2013 11:49:17 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FBnHCO099020; Mon, 15 Apr 2013 11:49:17 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201304151149.r3FBnHCO099020@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 15 Apr 2013 11:49:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249504 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 11:49:17 -0000 Author: luigi Date: Mon Apr 15 11:49:16 2013 New Revision: 249504 URL: http://svnweb.freebsd.org/changeset/base/249504 Log: fix a bug in the computation of the userspace offset for a give netmap buffer. Submitted by: Hugh Nhan Modified: head/sys/dev/netmap/netmap_mem2.c Modified: head/sys/dev/netmap/netmap_mem2.c ============================================================================== --- head/sys/dev/netmap/netmap_mem2.c Mon Apr 15 07:01:20 2013 (r249503) +++ head/sys/dev/netmap/netmap_mem2.c Mon Apr 15 11:49:16 2013 (r249504) @@ -278,7 +278,7 @@ netmap_obj_offset(struct netmap_obj_pool const char *base = p->lut[i].vaddr; ssize_t relofs = (const char *) vaddr - base; - if (relofs < 0 || relofs > p->_clustsize) + if (relofs < 0 || relofs >= p->_clustsize) continue; ofs = ofs + relofs; From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 12:34:11 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D8102649; Mon, 15 Apr 2013 12:34:11 +0000 (UTC) (envelope-from gprspb@mail.ru) Received: from fallback4.mail.ru (fallback4.mail.ru [94.100.176.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5753DDCC; Mon, 15 Apr 2013 12:34:10 +0000 (UTC) Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [94.100.177.92]) by fallback4.mail.ru (mPOP.Fallback_MX) with ESMTP id C7B691DF1AA; Mon, 15 Apr 2013 16:34:06 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=jk6HMpUzNlaZmZyS/lbbOvDhQBerP+xgFqS4s8GJ2iQ=; b=tsALsNi985/KOmzkOA5ZzZIIfkGIjr/teTopA+WFe3ZMD6jUTmD6xxr4GJcoFhgidY18X9++Q+xet8dWBCSrvHnbDNLwFIpkZoaZoE2nUNEqVO/PevJRpj6k44KnrngHW6jR9+W4jy2EWjh2nTss2NL62hU4Y2JDNhK0LFWe1DE=; Received: from [93.185.182.46] (port=26122 helo=gpr.nnz-home.ru) by smtp32.i.mail.ru with esmtpa (envelope-from ) id 1URibe-0002eB-Pl; Mon, 15 Apr 2013 16:33:58 +0400 Received: from gpr by gpr.nnz-home.ru with local (Exim 4.80.1 (FreeBSD)) (envelope-from ) id 1URibW-0007J5-1H; Mon, 15 Apr 2013 16:33:50 +0400 Date: Mon, 15 Apr 2013 16:33:50 +0400 From: Gennady Proskurin To: Tim Kientzle Subject: Re: svn commit: r249484 - head/lib Message-ID: <20130415123349.GA27773@gpr.nnz-home.ru> References: <201304141913.r3EJDqPI095965@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201304141913.r3EJDqPI095965@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam: Not detected X-Mras: Ok Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 12:34:11 -0000 Here is the quote from r231336 commit message: === commit be984b719cbcb225dc4afaf9f52b38fb882a09d3 Author: kientzle Date: Fri Feb 10 05:05:42 2012 +0000 Implement -print-file-name=include (which is undocumented but used by some Linux boot loaders). This option prints out the directory holding the include files needed by a freestanding program. The default implementation of this doesn't work on FreeBSD because of the different include file layout. But it's easy to implement: just return /usr/include (or the cross-compiling equivalent). === It turns out, that now we create useless symlink /usr/lib/include just to ease support of "some Linux boot loaders"? I do not have full knowledge about the issue, so excuse me if I misunderstood something. On Sun, Apr 14, 2013 at 07:13:52PM +0000, Tim Kientzle wrote: > Author: kientzle > Date: Sun Apr 14 19:13:51 2013 > New Revision: 249484 > URL: http://svnweb.freebsd.org/changeset/base/249484 > > Log: > Install a symlink > /usr/lib/include ==> /usr/include > > This fixes -print-file-name=include in clang (and is > arguably a better way to fix the same issue in GCC than > the change I made in r231336). > > MFC after: 1 week > > Modified: > head/lib/Makefile > > Modified: head/lib/Makefile > ============================================================================== > --- head/lib/Makefile Sun Apr 14 18:36:30 2013 (r249483) > +++ head/lib/Makefile Sun Apr 14 19:13:51 2013 (r249484) > @@ -252,4 +252,7 @@ _libusbhid= libusbhid > _libusb= libusb > .endif > > +afterinstall: > + ln -fs ../include ${DESTDIR}/usr/lib/include > + > .include > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 13:00:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 64BBBCA7; Mon, 15 Apr 2013 13:00:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5797DEE9; Mon, 15 Apr 2013 13:00:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FD0g2v021143; Mon, 15 Apr 2013 13:00:42 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FD0gDV021140; Mon, 15 Apr 2013 13:00:42 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201304151300.r3FD0gDV021140@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 15 Apr 2013 13:00:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249506 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 13:00:43 -0000 Author: glebius Date: Mon Apr 15 13:00:42 2013 New Revision: 249506 URL: http://svnweb.freebsd.org/changeset/base/249506 Log: Switch lagg(4) statistics to counter(9). The lagg(4) is often used to bond high speed links, so basic per-packet += on statistics cause cache misses and statistics loss. Perfect solution would be to convert ifnet(9) to counters(9), but this requires much more work, and unfortunately ABI change, so temporarily patch lagg(4) manually. We store counters in the softc, and once per second push their values to legacy ifnet counters. Sponsored by: Nginx, Inc. Modified: head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Mon Apr 15 12:16:24 2013 (r249505) +++ head/sys/net/if_lagg.c Mon Apr 15 13:00:42 2013 (r249506) @@ -153,6 +153,8 @@ static struct mbuf *lagg_lacp_input(stru struct mbuf *); static void lagg_lacp_lladdr(struct lagg_softc *); +static void lagg_callout(void *); + /* lagg protocol table */ static const struct { int ti_proto; @@ -278,6 +280,11 @@ lagg_clone_create(struct if_clone *ifc, return (ENOSPC); } + sc->sc_ipackets = counter_u64_alloc(M_WAITOK); + sc->sc_opackets = counter_u64_alloc(M_WAITOK); + sc->sc_ibytes = counter_u64_alloc(M_WAITOK); + sc->sc_obytes = counter_u64_alloc(M_WAITOK); + sysctl_ctx_init(&sc->ctx); snprintf(num, sizeof(num), "%u", unit); sc->use_flowid = def_use_flowid; @@ -307,6 +314,7 @@ lagg_clone_create(struct if_clone *ifc, LAGG_LOCK_INIT(sc); SLIST_INIT(&sc->sc_ports); TASK_INIT(&sc->sc_lladdr_task, 0, lagg_port_setlladdr, sc); + callout_init_rw(&sc->sc_callout, &sc->sc_mtx, CALLOUT_SHAREDLOCK); /* Initialise pseudo media types */ ifmedia_init(&sc->sc_media, 0, lagg_media_change, @@ -338,6 +346,8 @@ lagg_clone_create(struct if_clone *ifc, SLIST_INSERT_HEAD(&lagg_list, sc, sc_entries); mtx_unlock(&lagg_list_mtx); + callout_reset(&sc->sc_callout, hz, lagg_callout, sc); + return (0); } @@ -369,6 +379,12 @@ lagg_clone_destroy(struct ifnet *ifp) ether_ifdetach(ifp); if_free(ifp); + callout_drain(&sc->sc_callout); + counter_u64_free(sc->sc_ipackets); + counter_u64_free(sc->sc_opackets); + counter_u64_free(sc->sc_ibytes); + counter_u64_free(sc->sc_obytes); + mtx_lock(&lagg_list_mtx); SLIST_REMOVE(&lagg_list, sc, lagg_softc, sc_entries); mtx_unlock(&lagg_list_mtx); @@ -1243,9 +1259,9 @@ lagg_transmit(struct ifnet *ifp, struct LAGG_RUNLOCK(sc); if (error == 0) { - ifp->if_opackets++; + counter_u64_add(sc->sc_opackets, 1); + counter_u64_add(sc->sc_obytes, len); ifp->if_omcasts += mcast; - ifp->if_obytes += len; } else ifp->if_oerrors++; @@ -1281,8 +1297,8 @@ lagg_input(struct ifnet *ifp, struct mbu m = (*sc->sc_input)(sc, lp, m); if (m != NULL) { - scifp->if_ipackets++; - scifp->if_ibytes += m->m_pkthdr.len; + counter_u64_add(sc->sc_ipackets, 1); + counter_u64_add(sc->sc_ibytes, m->m_pkthdr.len); if (scifp->if_flags & IFF_MONITOR) { m_freem(m); @@ -1892,3 +1908,17 @@ lagg_lacp_input(struct lagg_softc *sc, s m->m_pkthdr.rcvif = ifp; return (m); } + +static void +lagg_callout(void *arg) +{ + struct lagg_softc *sc = (struct lagg_softc *)arg; + struct ifnet *ifp = sc->sc_ifp; + + ifp->if_ipackets = counter_u64_fetch(sc->sc_ipackets); + ifp->if_opackets = counter_u64_fetch(sc->sc_opackets); + ifp->if_ibytes = counter_u64_fetch(sc->sc_ibytes); + ifp->if_obytes = counter_u64_fetch(sc->sc_obytes); + + callout_reset(&sc->sc_callout, hz, lagg_callout, sc); +} Modified: head/sys/net/if_lagg.h ============================================================================== --- head/sys/net/if_lagg.h Mon Apr 15 12:16:24 2013 (r249505) +++ head/sys/net/if_lagg.h Mon Apr 15 13:00:42 2013 (r249506) @@ -21,8 +21,6 @@ #ifndef _NET_LAGG_H #define _NET_LAGG_H -#include - /* * Global definitions */ @@ -137,6 +135,9 @@ struct lagg_reqflags { #define SIOCSLAGGHASH _IOW('i', 146, struct lagg_reqflags) #ifdef _KERNEL + +#include + /* * Internal kernel part */ @@ -195,6 +196,11 @@ struct lagg_softc { uint32_t sc_seq; /* sequence counter */ uint32_t sc_flags; + counter_u64_t sc_ipackets; + counter_u64_t sc_opackets; + counter_u64_t sc_ibytes; + counter_u64_t sc_obytes; + SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */ SLIST_ENTRY(lagg_softc) sc_entries; @@ -217,6 +223,7 @@ struct lagg_softc { void (*sc_portreq)(struct lagg_port *, caddr_t); eventhandler_tag vlan_attach; eventhandler_tag vlan_detach; + struct callout sc_callout; struct sysctl_ctx_list ctx; /* sysctl variables */ int use_flowid; /* use M_FLOWID */ }; From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 15:55:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 42ED2D90; Mon, 15 Apr 2013 15:55:41 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 359819D0; Mon, 15 Apr 2013 15:55:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FFtfFv075595; Mon, 15 Apr 2013 15:55:41 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FFtebI075592; Mon, 15 Apr 2013 15:55:40 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201304151555.r3FFtebI075592@svn.freebsd.org> From: Ivan Voras Date: Mon, 15 Apr 2013 15:55:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249507 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 15:55:41 -0000 Author: ivoras Date: Mon Apr 15 15:55:40 2013 New Revision: 249507 URL: http://svnweb.freebsd.org/changeset/base/249507 Log: Introduce a symbol for the GEOM class name instead of using the ad-hoc string constant. Modified: head/sys/geom/geom_disk.c head/sys/geom/geom_disk.h head/sys/geom/geom_dump.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Mon Apr 15 13:00:42 2013 (r249506) +++ head/sys/geom/geom_disk.c Mon Apr 15 15:55:40 2013 (r249507) @@ -75,7 +75,7 @@ static g_dumpconf_t g_disk_dumpconf; static g_provgone_t g_disk_providergone; static struct g_class g_disk_class = { - .name = "DISK", + .name = G_DISK_CLASS_NAME, .version = G_VERSION, .start = g_disk_start, .access = g_disk_access, Modified: head/sys/geom/geom_disk.h ============================================================================== --- head/sys/geom/geom_disk.h Mon Apr 15 13:00:42 2013 (r249506) +++ head/sys/geom/geom_disk.h Mon Apr 15 15:55:40 2013 (r249507) @@ -44,6 +44,8 @@ #include #include +#define G_DISK_CLASS_NAME "DISK" + struct disk; typedef int disk_open_t(struct disk *); Modified: head/sys/geom/geom_dump.c ============================================================================== --- head/sys/geom/geom_dump.c Mon Apr 15 13:00:42 2013 (r249506) +++ head/sys/geom/geom_dump.c Mon Apr 15 15:55:40 2013 (r249507) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include static void @@ -146,7 +147,7 @@ g_conftxt(void *p, int flag) sb = p; g_topology_assert(); LIST_FOREACH(mp, &g_classes, class) { - if (!strcmp(mp->name, "DISK") || !strcmp(mp->name, "MD")) + if (!strcmp(mp->name, G_DISK_CLASS_NAME) || !strcmp(mp->name, "MD")) g_conftxt_class(sb, mp); } sbuf_finish(sb); From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 16:09:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3503ECE; Mon, 15 Apr 2013 16:09:26 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 17696A6A; Mon, 15 Apr 2013 16:09:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FG9POn079486; Mon, 15 Apr 2013 16:09:25 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FG9Oga079482; Mon, 15 Apr 2013 16:09:24 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201304151609.r3FG9Oga079482@svn.freebsd.org> From: Ivan Voras Date: Mon, 15 Apr 2013 16:09:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249508 - in head/sys: conf geom/label X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 16:09:26 -0000 Author: ivoras Date: Mon Apr 15 16:09:24 2013 New Revision: 249508 URL: http://svnweb.freebsd.org/changeset/base/249508 Log: Introduce glabel labels based on GEOM ident attributes. In this initial implementation, error on the side of conservatism and only create labels for GEOMs of classes DISK and MULTIPATH. Discussed with: trasz Approved by: silence from freebsd-geom@ Added: head/sys/geom/label/g_label_disk_ident.c (contents, props changed) Modified: head/sys/conf/files head/sys/geom/label/g_label.c head/sys/geom/label/g_label.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Apr 15 15:55:40 2013 (r249507) +++ head/sys/conf/files Mon Apr 15 16:09:24 2013 (r249508) @@ -2495,6 +2495,7 @@ geom/label/g_label_ntfs.c optional geom_ geom/label/g_label_reiserfs.c optional geom_label geom/label/g_label_ufs.c optional geom_label geom/label/g_label_gpt.c optional geom_label +geom/label/g_label_disk_ident.c optional geom_label geom/linux_lvm/g_linux_lvm.c optional geom_linux_lvm geom/mirror/g_mirror.c optional geom_mirror geom/mirror/g_mirror_ctl.c optional geom_mirror Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Mon Apr 15 15:55:40 2013 (r249507) +++ head/sys/geom/label/g_label.c Mon Apr 15 16:09:24 2013 (r249508) @@ -89,6 +89,7 @@ const struct g_label_desc *g_labels[] = &g_label_ntfs, &g_label_gpt, &g_label_gpt_uuid, + &g_label_disk_ident, NULL }; @@ -339,7 +340,7 @@ g_label_taste(struct g_class *mp, struct pp->mediasize - pp->sectorsize); } while (0); for (i = 0; g_labels[i] != NULL; i++) { - char label[64]; + char label[128]; if (g_labels[i]->ld_enabled == 0) continue; Modified: head/sys/geom/label/g_label.h ============================================================================== --- head/sys/geom/label/g_label.h Mon Apr 15 15:55:40 2013 (r249507) +++ head/sys/geom/label/g_label.h Mon Apr 15 16:09:24 2013 (r249508) @@ -87,6 +87,7 @@ extern struct g_label_desc g_label_reise extern struct g_label_desc g_label_ntfs; extern struct g_label_desc g_label_gpt; extern struct g_label_desc g_label_gpt_uuid; +extern struct g_label_desc g_label_disk_ident; #endif /* _KERNEL */ struct g_label_metadata { Added: head/sys/geom/label/g_label_disk_ident.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/geom/label/g_label_disk_ident.c Mon Apr 15 16:09:24 2013 (r249508) @@ -0,0 +1,84 @@ +/*- + * Copyright (c) 2012 Ivan Voras + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include + + +#define G_LABEL_DISK_IDENT_DIR "diskid" + +static char* classes_pass[] = { G_DISK_CLASS_NAME, G_MULTIPATH_CLASS_NAME, NULL }; + +static void +g_label_disk_ident_taste(struct g_consumer *cp, char *label, size_t size) +{ + struct g_class *cls; + char ident[100]; + int ident_len = sizeof(ident); + + g_topology_assert_not(); + label[0] = '\0'; + + cls = cp->provider->geom->class; + + /* Get the GEOM::ident string and construct a label in the format CLASS_NAME-ident */ + if (g_io_getattr("GEOM::ident", cp, &ident_len, ident) == 0) { + int i, found = 0; + + if (ident_len == 0 || ident[0] == '\0') + return; + for (i = 0; classes_pass[i] != NULL; i++) + if (strcmp(classes_pass[i], cls->name) == 0) + found = 1; + if (!found) + return; + if (strlen(cls->name) + ident_len + 2 > size) + ident[ident_len - strlen(cls->name) - 2] = '\0'; + else + ident[ident_len] = '\0'; + strcpy(label, cls->name); + strcat(label, "-"); + strcat(label, ident); + } +} + +struct g_label_desc g_label_disk_ident = { + .ld_taste = g_label_disk_ident_taste, + .ld_dir = G_LABEL_DISK_IDENT_DIR, + .ld_enabled = 1 +}; + +G_LABEL_INIT(disk_ident, g_label_disk_ident, "Create device nodes for drives which export a disk identification string"); From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 16:11:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2F92528A; Mon, 15 Apr 2013 16:11:37 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mail.ipfw.ru (unknown [IPv6:2a01:4f8:120:6141::2]) by mx1.freebsd.org (Postfix) with ESMTP id 9D31BA8F; Mon, 15 Apr 2013 16:11:36 +0000 (UTC) Received: from dhcp170-36-red.yandex.net ([95.108.170.36]) by mail.ipfw.ru with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.76 (FreeBSD)) (envelope-from ) id 1URm3b-000Cy6-Uk; Mon, 15 Apr 2013 20:15:04 +0400 Message-ID: <516C2694.9090906@FreeBSD.org> Date: Mon, 15 Apr 2013 20:11:00 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Gleb Smirnoff Subject: Re: svn commit: r249506 - head/sys/net References: <201304151300.r3FD0gDV021140@svn.freebsd.org> In-Reply-To: <201304151300.r3FD0gDV021140@svn.freebsd.org> X-Enigmail-Version: 1.4.6 Content-Type: multipart/mixed; boundary="------------020404010101070001050708" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 16:11:37 -0000 This is a multi-part message in MIME format. --------------020404010101070001050708 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 15.04.2013 17:00, Gleb Smirnoff wrote: > Author: glebius > Date: Mon Apr 15 13:00:42 2013 > New Revision: 249506 > URL: http://svnweb.freebsd.org/changeset/base/249506 > > Log: > Switch lagg(4) statistics to counter(9). > > The lagg(4) is often used to bond high speed links, so basic per-packet += > on statistics cause cache misses and statistics loss. Lagg is probably the only interface where we really do not need to account (most) per-packet traffic. It is probably better to import statistics from underlying interfaces with callout. Additionally, this approach allows us not to use lagg RX path at all skipping lock (reference patch to ixgbe in the -net@ follows). > > Perfect solution would be to convert ifnet(9) to counters(9), but this > requires much more work, and unfortunately ABI change, so temporarily > patch lagg(4) manually. > > We store counters in the softc, and once per second push their values > to legacy ifnet counters. > > Sponsored by: Nginx, Inc. > > Modified: > head/sys/net/if_lagg.c > head/sys/net/if_lagg.h > > Modified: head/sys/net/if_lagg.c > ============================================================================== > --- head/sys/net/if_lagg.c Mon Apr 15 12:16:24 2013 (r249505) > +++ head/sys/net/if_lagg.c Mon Apr 15 13:00:42 2013 (r249506) > @@ -153,6 +153,8 @@ static struct mbuf *lagg_lacp_input(stru > struct mbuf *); > static void lagg_lacp_lladdr(struct lagg_softc *); > > +static void lagg_callout(void *); > + > /* lagg protocol table */ > static const struct { > int ti_proto; > @@ -278,6 +280,11 @@ lagg_clone_create(struct if_clone *ifc, > return (ENOSPC); > } > > + sc->sc_ipackets = counter_u64_alloc(M_WAITOK); > + sc->sc_opackets = counter_u64_alloc(M_WAITOK); > + sc->sc_ibytes = counter_u64_alloc(M_WAITOK); > + sc->sc_obytes = counter_u64_alloc(M_WAITOK); > + > sysctl_ctx_init(&sc->ctx); > snprintf(num, sizeof(num), "%u", unit); > sc->use_flowid = def_use_flowid; > @@ -307,6 +314,7 @@ lagg_clone_create(struct if_clone *ifc, > LAGG_LOCK_INIT(sc); > SLIST_INIT(&sc->sc_ports); > TASK_INIT(&sc->sc_lladdr_task, 0, lagg_port_setlladdr, sc); > + callout_init_rw(&sc->sc_callout, &sc->sc_mtx, CALLOUT_SHAREDLOCK); > > /* Initialise pseudo media types */ > ifmedia_init(&sc->sc_media, 0, lagg_media_change, > @@ -338,6 +346,8 @@ lagg_clone_create(struct if_clone *ifc, > SLIST_INSERT_HEAD(&lagg_list, sc, sc_entries); > mtx_unlock(&lagg_list_mtx); > > + callout_reset(&sc->sc_callout, hz, lagg_callout, sc); > + > return (0); > } > > @@ -369,6 +379,12 @@ lagg_clone_destroy(struct ifnet *ifp) > ether_ifdetach(ifp); > if_free(ifp); > > + callout_drain(&sc->sc_callout); > + counter_u64_free(sc->sc_ipackets); > + counter_u64_free(sc->sc_opackets); > + counter_u64_free(sc->sc_ibytes); > + counter_u64_free(sc->sc_obytes); > + > mtx_lock(&lagg_list_mtx); > SLIST_REMOVE(&lagg_list, sc, lagg_softc, sc_entries); > mtx_unlock(&lagg_list_mtx); > @@ -1243,9 +1259,9 @@ lagg_transmit(struct ifnet *ifp, struct > LAGG_RUNLOCK(sc); > > if (error == 0) { > - ifp->if_opackets++; > + counter_u64_add(sc->sc_opackets, 1); > + counter_u64_add(sc->sc_obytes, len); > ifp->if_omcasts += mcast; > - ifp->if_obytes += len; > } else > ifp->if_oerrors++; > > @@ -1281,8 +1297,8 @@ lagg_input(struct ifnet *ifp, struct mbu > m = (*sc->sc_input)(sc, lp, m); > > if (m != NULL) { > - scifp->if_ipackets++; > - scifp->if_ibytes += m->m_pkthdr.len; > + counter_u64_add(sc->sc_ipackets, 1); > + counter_u64_add(sc->sc_ibytes, m->m_pkthdr.len); > > if (scifp->if_flags & IFF_MONITOR) { > m_freem(m); > @@ -1892,3 +1908,17 @@ lagg_lacp_input(struct lagg_softc *sc, s > m->m_pkthdr.rcvif = ifp; > return (m); > } > + > +static void > +lagg_callout(void *arg) > +{ > + struct lagg_softc *sc = (struct lagg_softc *)arg; > + struct ifnet *ifp = sc->sc_ifp; > + > + ifp->if_ipackets = counter_u64_fetch(sc->sc_ipackets); > + ifp->if_opackets = counter_u64_fetch(sc->sc_opackets); > + ifp->if_ibytes = counter_u64_fetch(sc->sc_ibytes); > + ifp->if_obytes = counter_u64_fetch(sc->sc_obytes); > + > + callout_reset(&sc->sc_callout, hz, lagg_callout, sc); > +} > > Modified: head/sys/net/if_lagg.h > ============================================================================== > --- head/sys/net/if_lagg.h Mon Apr 15 12:16:24 2013 (r249505) > +++ head/sys/net/if_lagg.h Mon Apr 15 13:00:42 2013 (r249506) > @@ -21,8 +21,6 @@ > #ifndef _NET_LAGG_H > #define _NET_LAGG_H > > -#include > - > /* > * Global definitions > */ > @@ -137,6 +135,9 @@ struct lagg_reqflags { > #define SIOCSLAGGHASH _IOW('i', 146, struct lagg_reqflags) > > #ifdef _KERNEL > + > +#include > + > /* > * Internal kernel part > */ > @@ -195,6 +196,11 @@ struct lagg_softc { > uint32_t sc_seq; /* sequence counter */ > uint32_t sc_flags; > > + counter_u64_t sc_ipackets; > + counter_u64_t sc_opackets; > + counter_u64_t sc_ibytes; > + counter_u64_t sc_obytes; > + > SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */ > SLIST_ENTRY(lagg_softc) sc_entries; > > @@ -217,6 +223,7 @@ struct lagg_softc { > void (*sc_portreq)(struct lagg_port *, caddr_t); > eventhandler_tag vlan_attach; > eventhandler_tag vlan_detach; > + struct callout sc_callout; > struct sysctl_ctx_list ctx; /* sysctl variables */ > int use_flowid; /* use M_FLOWID */ > }; > -- WBR, Alexander --------------020404010101070001050708 Content-Type: text/plain; charset=UTF-8; name="if_lagg.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="if_lagg.diff" SW5kZXg6IHN5cy9uZXQvaWZfbGFnZy5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHN5cy9uZXQvaWZf bGFnZy5jCShyZXZpc2lvbiAyNDg3MDQpCisrKyBzeXMvbmV0L2lmX2xhZ2cuYwkod29ya2lu ZyBjb3B5KQpAQCAtMjYxLDYgKzI2MSw0MSBAQCBsYWdnX3VucmVnaXN0ZXJfdmxhbih2b2lk ICphcmcsIHN0cnVjdCBpZm5ldCAqaWZwLAogICAgICAgICBMQUdHX1JVTkxPQ0soc2MpOwog fQogCisjZGVmaW5lCUxBR0dfVVBEQVRFX0NPVU5URVIoX25hbWUpCWRvIHsJCVwKKwlpZiAo cF9pZnAtPmlmX2RhdGEuX25hbWUgPj0gbHAtPl9uYW1lKSB7CVwKKwkJaSA9IHBfaWZwLT5p Zl9kYXRhLl9uYW1lIC0gbHAtPl9uYW1lOwlcCisJCWxhZ2dfaWZwLT5pZl9kYXRhLl9uYW1l ICs9IGk7CQlcCisJCWxwLT5fbmFtZSArPSBpOwkJCQlcCisJfSBlbHNlIAkJCQkJCVwKKwkJ bHAtPl9uYW1lID0gcF9pZnAtPmlmX2RhdGEuX25hbWU7CVwKK30gd2hpbGUgKDApCisKK3N0 YXRpYyB2b2lkCitsYWdnX3VwZGF0ZV9jb3VudGVycyh2b2lkICphcmcpCit7CisJc3RydWN0 IGxhZ2dfc29mdGMJKnNjID0gYXJnOworICAgICAgICBzdHJ1Y3QgbGFnZ19wb3J0ICAgICAg ICAqbHA7CisJc3RydWN0IGlmbmV0CQkqbGFnZ19pZnAsICpwX2lmcDsKKwl1X2xvbmcgaTsK KworCWxhZ2dfaWZwID0gc2MtPnNjX2lmcDsKKworCUxBR0dfUkxPQ0soc2MpOworCisJU0xJ U1RfRk9SRUFDSChscCwgJnNjLT5zY19wb3J0cywgbHBfZW50cmllcykgeworCQlwX2lmcCA9 IGxwLT5scF9pZnA7CisKKwkJTEFHR19VUERBVEVfQ09VTlRFUihpZmlfaXBhY2tldHMpOwor CQlMQUdHX1VQREFURV9DT1VOVEVSKGlmaV9vcGFja2V0cyk7CisJCUxBR0dfVVBEQVRFX0NP VU5URVIoaWZpX2lieXRlcyk7CisJCUxBR0dfVVBEQVRFX0NPVU5URVIoaWZpX29ieXRlcyk7 CisJfQorCisJTEFHR19SVU5MT0NLKHNjKTsKKworCWNhbGxvdXRfcmVzZXQoJnNjLT5jb3Vu dGVyc19zeW5jLCBoeiwgbGFnZ191cGRhdGVfY291bnRlcnMsIHNjKTsKK30KKwogc3RhdGlj IGludAogbGFnZ19jbG9uZV9jcmVhdGUoc3RydWN0IGlmX2Nsb25lICppZmMsIGludCB1bml0 LCBjYWRkcl90IHBhcmFtcykKIHsKQEAgLTMwNyw2ICszNDIsNyBAQCBsYWdnX2Nsb25lX2Ny ZWF0ZShzdHJ1Y3QgaWZfY2xvbmUgKmlmYywgaW50IHVuaXQsCiAJTEFHR19MT0NLX0lOSVQo c2MpOwogCVNMSVNUX0lOSVQoJnNjLT5zY19wb3J0cyk7CiAJVEFTS19JTklUKCZzYy0+c2Nf bGxhZGRyX3Rhc2ssIDAsIGxhZ2dfcG9ydF9zZXRsbGFkZHIsIHNjKTsKKwljYWxsb3V0X2lu aXQoJnNjLT5jb3VudGVyc19zeW5jLCAwKTsKIAogCS8qIEluaXRpYWxpc2UgcHNldWRvIG1l ZGlhIHR5cGVzICovCiAJaWZtZWRpYV9pbml0KCZzYy0+c2NfbWVkaWEsIDAsIGxhZ2dfbWVk aWFfY2hhbmdlLApAQCAtMzM4LDYgKzM3NCw4IEBAIGxhZ2dfY2xvbmVfY3JlYXRlKHN0cnVj dCBpZl9jbG9uZSAqaWZjLCBpbnQgdW5pdCwKIAlTTElTVF9JTlNFUlRfSEVBRCgmbGFnZ19s aXN0LCBzYywgc2NfZW50cmllcyk7CiAJbXR4X3VubG9jaygmbGFnZ19saXN0X210eCk7CiAK KwljYWxsb3V0X3Jlc2V0KCZzYy0+Y291bnRlcnNfc3luYywgaHogLyAxMCwgbGFnZ191cGRh dGVfY291bnRlcnMsIHNjKTsKKwogCXJldHVybiAoMCk7CiB9CiAKQEAgLTM0Nyw2ICszODUs OSBAQCBsYWdnX2Nsb25lX2Rlc3Ryb3koc3RydWN0IGlmbmV0ICppZnApCiAJc3RydWN0IGxh Z2dfc29mdGMgKnNjID0gKHN0cnVjdCBsYWdnX3NvZnRjICopaWZwLT5pZl9zb2Z0YzsKIAlz dHJ1Y3QgbGFnZ19wb3J0ICpscDsKIAorCS8qIFN0b3AgY29sbGVjdGluZyBjb3VudGVycyAq LworCWNhbGxvdXRfZHJhaW4oJnNjLT5jb3VudGVyc19zeW5jKTsKKwogCUxBR0dfV0xPQ0so c2MpOwogCiAJbGFnZ19zdG9wKHNjKTsKQEAgLTU3MSw2ICs2MTIsMTIgQEAgbGFnZ19wb3J0 X2NyZWF0ZShzdHJ1Y3QgbGFnZ19zb2Z0YyAqc2MsIHN0cnVjdCBpZm4KIAlscC0+bHBfaWZw ID0gaWZwOwogCWxwLT5scF9zb2Z0YyA9IHNjOwogCisJLyogU2V0IGNvdW50ZXJzICovCisJ bHAtPmlmaV9pYnl0ZXMgPSBpZnAtPmlmX2lieXRlczsKKwlscC0+aWZpX29ieXRlcyA9IGlm cC0+aWZfb2J5dGVzOworCWxwLT5pZmlfaXBhY2tldHMgPSBpZnAtPmlmX2lwYWNrZXRzOwor CWxwLT5pZmlfb3BhY2tldHMgPSBpZnAtPmlmX29wYWNrZXRzOworCiAJLyogU2F2ZSBwb3J0 IGxpbmsgbGF5ZXIgYWRkcmVzcyAqLwogCWJjb3B5KElGX0xMQUREUihpZnApLCBscC0+bHBf bGxhZGRyLCBFVEhFUl9BRERSX0xFTik7CiAKQEAgLTEyNDMsOSArMTI5MCw3IEBAIGxhZ2df dHJhbnNtaXQoc3RydWN0IGlmbmV0ICppZnAsIHN0cnVjdCBtYnVmICptKQogCUxBR0dfUlVO TE9DSyhzYyk7CiAKIAlpZiAoZXJyb3IgPT0gMCkgewotCQlpZnAtPmlmX29wYWNrZXRzKys7 CiAJCWlmcC0+aWZfb21jYXN0cyArPSBtY2FzdDsKLQkJaWZwLT5pZl9vYnl0ZXMgKz0gbGVu OwogCX0gZWxzZQogCQlpZnAtPmlmX29lcnJvcnMrKzsKIApAQCAtMTI4MSw5ICsxMzI2LDYg QEAgbGFnZ19pbnB1dChzdHJ1Y3QgaWZuZXQgKmlmcCwgc3RydWN0IG1idWYgKm0pCiAJbSA9 ICgqc2MtPnNjX2lucHV0KShzYywgbHAsIG0pOwogCiAJaWYgKG0gIT0gTlVMTCkgewotCQlz Y2lmcC0+aWZfaXBhY2tldHMrKzsKLQkJc2NpZnAtPmlmX2lieXRlcyArPSBtLT5tX3BrdGhk ci5sZW47Ci0KIAkJaWYgKHNjaWZwLT5pZl9mbGFncyAmIElGRl9NT05JVE9SKSB7CiAJCQlt X2ZyZWVtKG0pOwogCQkJbSA9IE5VTEw7CkluZGV4OiBzeXMvbmV0L2lmX2xhZ2cuaAo9PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09Ci0tLSBzeXMvbmV0L2lmX2xhZ2cuaAkocmV2aXNpb24gMjQ4NzA0KQorKysg c3lzL25ldC9pZl9sYWdnLmgJKHdvcmtpbmcgY29weSkKQEAgLTIxOSw2ICsyMTksNyBAQCBz dHJ1Y3QgbGFnZ19zb2Z0YyB7CiAJZXZlbnRoYW5kbGVyX3RhZyB2bGFuX2RldGFjaDsKIAlz dHJ1Y3Qgc3lzY3RsX2N0eF9saXN0CQljdHg7CQkvKiBzeXNjdGwgdmFyaWFibGVzICovCiAJ aW50CQkJCXVzZV9mbG93aWQ7CS8qIHVzZSBNX0ZMT1dJRCAqLworCXN0cnVjdCBjYWxsb3V0 CQkJY291bnRlcnNfc3luYzsJLyogY291bnRlcnMgcGVyaW9kaWMgKi8KIH07CiAKIHN0cnVj dCBsYWdnX3BvcnQgewpAQCAtMjQxLDYgKzI0MiwxMSBAQCBzdHJ1Y3QgbGFnZ19wb3J0IHsK IAlpbnQJKCpscF9vdXRwdXQpKHN0cnVjdCBpZm5ldCAqLCBzdHJ1Y3QgbWJ1ZiAqLCBzdHJ1 Y3Qgc29ja2FkZHIgKiwKIAkJICAgICBzdHJ1Y3Qgcm91dGUgKik7CiAKKwl1X2xvbmcJCQkJ aWZpX2lwYWNrZXRzOwkvKiBwYWNrZXRzIHJlY2VpdmVkIG9uIGludGVyZmFjZSAqLworCXVf bG9uZwkJCQlpZmlfb3BhY2tldHM7CS8qIHBhY2tldHMgc2VudCBvbiBpbnRlcmZhY2UgKi8K Kwl1X2xvbmcJCQkJaWZpX2lieXRlczsJLyogdG90YWwgbnVtYmVyIG9mIG9jdGV0cyByZWNl aXZlZCAqLworCXVfbG9uZwkJCQlpZmlfb2J5dGVzOwkvKiB0b3RhbCBudW1iZXIgb2Ygb2N0 ZXRzIHNlbnQgKi8KKwogCVNMSVNUX0VOVFJZKGxhZ2dfcG9ydCkJCWxwX2VudHJpZXM7CiB9 OwogCkluZGV4OiBzeXMvbmV0L2lmX3ZsYW4uYwo9PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzeXMvbmV0 L2lmX3ZsYW4uYwkocmV2aXNpb24gMjQ4NzA0KQorKysgc3lzL25ldC9pZl92bGFuLmMJKHdv cmtpbmcgY29weSkKQEAgLTEzOCw2ICsxMzgsMTIgQEAgc3RhdGljIGludCBzb2Z0X3BhZCA9 IDA7CiBTWVNDVExfSU5UKF9uZXRfbGlua192bGFuLCBPSURfQVVUTywgc29mdF9wYWQsIENU TEZMQUdfUlcsICZzb2Z0X3BhZCwgMCwKIAkgICAicGFkIHNob3J0IGZyYW1lcyBiZWZvcmUg dGFnZ2luZyIpOwogCitzdGF0aWMgaW50IHN5c2N0bF9wcmlvcml0eV92YWwoU1lTQ1RMX0hB TkRMRVJfQVJHUyk7CitzdGF0aWMgaW50IHByaW9yaXR5ID0gaHRvbnMoMSA8PCAxMyk7CitT WVNDVExfVk5FVF9QUk9DKF9uZXRfbGlua192bGFuLCBPSURfQVVUTywgZG90MXBfcHJpb3Jp dHksCisgICAgQ1RMVFlQRV9VSU5UfENUTEZMQUdfUlcsIDAsIDAsIHN5c2N0bF9wcmlvcml0 eV92YWwsICJJVSIsCisJICAgInNldCBkb3QxcCBwcmlvcml0eSIpOworCiBzdGF0aWMgY29u c3QgY2hhciB2bGFubmFtZVtdID0gInZsYW4iOwogc3RhdGljIE1BTExPQ19ERUZJTkUoTV9W TEFOLCB2bGFubmFtZSwgIjgwMi4xUSBWaXJ0dWFsIExBTiBJbnRlcmZhY2UiKTsKIApAQCAt MjE3LDYgKzIyMywyNyBAQCBzdGF0aWMgVk5FVF9ERUZJTkUoc3RydWN0IGlmX2Nsb25lICos IHZsYW5fY2xvbmVyKQogI2lmbmRlZiBWTEFOX0FSUkFZCiAjZGVmaW5lIEhBU0gobiwgbSkJ KCgoKG4pID4+IDgpIF4gKChuKSA+PiA0KSBeIChuKSkgJiAobSkpCiAKKy8qCisgKiBTZXQg bWF4aW11bSBudW1iZXIgb2YgdGFibGVzIHRoYXQgY2FuIGJlIHVzZWQgaW4gZ2l2ZW4gVk5F VCBpcGZ3IGluc3RhbmNlLgorICovCitzdGF0aWMgaW50CitzeXNjdGxfcHJpb3JpdHlfdmFs KFNZU0NUTF9IQU5ETEVSX0FSR1MpCit7CisJaW50IGVycm9yOworCXVuc2lnbmVkIGludCBu cHJpbzsKKworCW5wcmlvID0gbnRvaHMocHJpb3JpdHkpID4+IDEzOworCisJZXJyb3IgPSBz eXNjdGxfaGFuZGxlX2ludChvaWRwLCAmbnByaW8sIDAsIHJlcSk7CisJLyogUmVhZCBvcGVy YXRpb24gb3Igc29tZSBlcnJvciAqLworCWlmICgoZXJyb3IgIT0gMCkgfHwgKHJlcS0+bmV3 cHRyID09IE5VTEwpKQorCQlyZXR1cm4gKGVycm9yKTsKKwkKKwlwcmlvcml0eSA9IGh0b25z KChucHJpbyAmIDB4NykgPDwgMTMpOworCisJcmV0dXJuICgwKTsKK30KKwogc3RhdGljIHZv aWQKIHZsYW5faW5pdGhhc2goc3RydWN0IGlmdmxhbnRydW5rICp0cnVuaykKIHsKQEAgLTEw NzYsNyArMTEwMyw3IEBAIHZsYW5fdHJhbnNtaXQoc3RydWN0IGlmbmV0ICppZnAsIHN0cnVj dCBtYnVmICptKQogCSAqIHBhY2tldCB0YWcgdGhhdCBob2xkcyBpdC4KIAkgKi8KIAlpZiAo cC0+aWZfY2FwZW5hYmxlICYgSUZDQVBfVkxBTl9IV1RBR0dJTkcpIHsKLQkJbS0+bV9wa3Ro ZHIuZXRoZXJfdnRhZyA9IGlmdi0+aWZ2X3ZpZDsKKwkJbS0+bV9wa3RoZHIuZXRoZXJfdnRh ZyA9IGlmdi0+aWZ2X3ZpZCB8IHByaW9yaXR5OwogCQltLT5tX2ZsYWdzIHw9IE1fVkxBTlRB RzsKIAl9IGVsc2UgewogCQltID0gZXRoZXJfdmxhbmVuY2FwKG0sIGlmdi0+aWZ2X3ZpZCk7 Cg== --------------020404010101070001050708-- From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 17:01:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F0484383; Mon, 15 Apr 2013 17:01:42 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C9A3BE7D; Mon, 15 Apr 2013 17:01:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FH1gEa096460; Mon, 15 Apr 2013 17:01:42 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FH1gV1096459; Mon, 15 Apr 2013 17:01:42 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201304151701.r3FH1gV1096459@svn.freebsd.org> From: Jack F Vogel Date: Mon, 15 Apr 2013 17:01:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249509 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 17:01:43 -0000 Author: jfv Date: Mon Apr 15 17:01:42 2013 New Revision: 249509 URL: http://svnweb.freebsd.org/changeset/base/249509 Log: Corrections to the RX checksum code, make sure its disabled as well as enabled when necessary. And simplify the checksum routine itself, adding UDP bit to the test. Thanks to Kevin Lo for pointing out the problems and code suggestions. Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Apr 15 16:09:24 2013 (r249508) +++ head/sys/dev/e1000/if_em.c Mon Apr 15 17:01:42 2013 (r249509) @@ -4322,11 +4322,12 @@ em_initialize_receive_unit(struct adapte E1000_WRITE_REG(hw, E1000_RFCTL, E1000_RFCTL_ACK_DIS); } - if (ifp->if_capenable & IFCAP_RXCSUM) { - rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); - rxcsum |= (E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL); - E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum); - } + rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); + if (ifp->if_capenable & IFCAP_RXCSUM) + rxcsum |= E1000_RXCSUM_TUOFL; + else + rxcsum &= ~E1000_RXCSUM_TUOFL; + E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum); /* ** XXX TEMPORARY WORKAROUND: on some systems with 82573 @@ -4644,31 +4645,23 @@ em_fixup_rx(struct rx_ring *rxr) static void em_receive_checksum(struct e1000_rx_desc *rx_desc, struct mbuf *mp) { + mp->m_pkthdr.csum_flags = 0; + /* Ignore Checksum bit is set */ - if (rx_desc->status & E1000_RXD_STAT_IXSM) { - mp->m_pkthdr.csum_flags = 0; + if (rx_desc->status & E1000_RXD_STAT_IXSM) return; - } - - if (rx_desc->status & E1000_RXD_STAT_IPCS) { - /* Did it pass? */ - if (!(rx_desc->errors & E1000_RXD_ERR_IPE)) { - /* IP Checksum Good */ - mp->m_pkthdr.csum_flags = CSUM_IP_CHECKED; - mp->m_pkthdr.csum_flags |= CSUM_IP_VALID; - } else { - mp->m_pkthdr.csum_flags = 0; - } - } + if (rx_desc->errors & (E1000_RXD_ERR_TCPE | E1000_RXD_ERR_IPE)) + return; - if (rx_desc->status & E1000_RXD_STAT_TCPCS) { - /* Did it pass? */ - if (!(rx_desc->errors & E1000_RXD_ERR_TCPE)) { - mp->m_pkthdr.csum_flags |= - (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); - mp->m_pkthdr.csum_data = htons(0xffff); - } + /* IP Checksum Good? */ + if (rx_desc->status & E1000_RXD_STAT_IPCS) + mp->m_pkthdr.csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID); + + /* TCP or UDP checksum */ + if (rx_desc->status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS)) { + mp->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); + mp->m_pkthdr.csum_data = htons(0xffff); } } From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 17:21:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C28ADF9E; Mon, 15 Apr 2013 17:21:02 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B59AFF98; Mon, 15 Apr 2013 17:21:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FHL20V003127; Mon, 15 Apr 2013 17:21:02 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FHL2rg003126; Mon, 15 Apr 2013 17:21:02 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201304151721.r3FHL2rg003126@svn.freebsd.org> From: "George V. Neville-Neil" Date: Mon, 15 Apr 2013 17:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249514 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 17:21:02 -0000 Author: gnn Date: Mon Apr 15 17:21:02 2013 New Revision: 249514 URL: http://svnweb.freebsd.org/changeset/base/249514 Log: Point args[0] not at the thread that is ending but at the one that is starting. This is in line with practice in OpenSolaris. Note that this change is only in ULE and not in the 4BSD scheduler. Once this change settles in (MFC timeout has expired) we'll try it out on 4BSD as well. PR: 177706 Submitted by: Tiwei Bie MFC after: 1 month Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Mon Apr 15 17:20:44 2013 (r249513) +++ head/sys/kern/sched_ule.c Mon Apr 15 17:21:02 2013 (r249514) @@ -1930,7 +1930,7 @@ sched_switch(struct thread *td, struct t if (PMC_PROC_IS_USING_PMCS(td->td_proc)) PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); #endif - SDT_PROBE2(sched, , , off_cpu, td, td->td_proc); + SDT_PROBE2(sched, , , off_cpu, newtd, newtd->td_proc); lock_profile_release_lock(&TDQ_LOCKPTR(tdq)->lock_object); TDQ_LOCKPTR(tdq)->mtx_lock = (uintptr_t)newtd; sched_pctcpu_update(newtd->td_sched, 0); From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 17:58:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1A5D3C59; Mon, 15 Apr 2013 17:58:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0CE801148; Mon, 15 Apr 2013 17:58:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FHwBWH013171; Mon, 15 Apr 2013 17:58:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FHwBFp013170; Mon, 15 Apr 2013 17:58:11 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304151758.r3FHwBFp013170@svn.freebsd.org> From: Adrian Chadd Date: Mon, 15 Apr 2013 17:58:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249516 - head/sys/dev/ath/ath_hal/ar5416 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 17:58:12 -0000 Author: adrian Date: Mon Apr 15 17:58:11 2013 New Revision: 249516 URL: http://svnweb.freebsd.org/changeset/base/249516 Log: Bring over some AR9271 register definitions from the QCA HAL. Obtained from: Qualcomm Atheros Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Mon Apr 15 17:35:14 2013 (r249515) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Mon Apr 15 17:58:11 2013 (r249516) @@ -603,6 +603,25 @@ #define AR_EEPROM_STATUS_DATA_PROT_ACCESS 0x00040000 #define AR_EEPROM_STATUS_DATA_ABSENT_ACCESS 0x00080000 +/* K2 (9271) */ +#define AR9271_CLOCK_CONTROL 0x50040 +#define AR9271_CLOCK_SELECTION_22 0x0 +#define AR9271_CLOCK_SELECTION_88 0x1 +#define AR9271_CLOCK_SELECTION_44 0x2 +#define AR9271_CLOCK_SELECTION_117 0x4 +#define AR9271_CLOCK_SELECTION_OSC_40 0x6 +#define AR9271_CLOCK_SELECTION_RTC 0x7 +#define AR9271_SPI_SEL 0x100 +#define AR9271_UART_SEL 0x200 + +#define AR9271_RESET_POWER_DOWN_CONTROL 0x50044 +#define AR9271_RADIO_RF_RST 0x20 +#define AR9271_GATE_MAC_CTL 0x4000 +#define AR9271_MAIN_PLL_PWD_CTL 0x40000 + +#define AR9271_CLKMISC 0x4090 +#define AR9271_OSC_to_10M_EN 0x00000001 + /* * AR5212 defines the MAC revision mask as 0xF, but both ath9k and * the Atheros HAL define it as 0x7. From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 17:59:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EE623DEA; Mon, 15 Apr 2013 17:59:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E13BD115B; Mon, 15 Apr 2013 17:59:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FHx6qr013332; Mon, 15 Apr 2013 17:59:06 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FHx6lh013331; Mon, 15 Apr 2013 17:59:06 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304151759.r3FHx6lh013331@svn.freebsd.org> From: Adrian Chadd Date: Mon, 15 Apr 2013 17:59:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249517 - head/sys/dev/ath/ath_hal/ar5416 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 17:59:07 -0000 Author: adrian Date: Mon Apr 15 17:59:06 2013 New Revision: 249517 URL: http://svnweb.freebsd.org/changeset/base/249517 Log: Now that the register definitions are in -HEAD, enable this. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c Mon Apr 15 17:58:11 2013 (r249516) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c Mon Apr 15 17:59:06 2013 (r249517) @@ -269,14 +269,14 @@ ar5416BTCoexEnable(struct ath_hal *ah) } OS_REG_WRITE(ah, AR_BT_COEX_MODE2, ahp->ah_btCoexMode2); -#if 0 - /* Added Select GPIO5~8 instaed SPI */ - if (AR_SREV_9271(ah)) { - val = OS_REG_READ(ah, AR9271_CLOCK_CONTROL); - val &= 0xFFFFFEFF; - OS_REG_WRITE(ah, AR9271_CLOCK_CONTROL, val); - } -#endif + /* Added Select GPIO5~8 instaed SPI */ + if (AR_SREV_9271(ah)) { + uint32_t val; + + val = OS_REG_READ(ah, AR9271_CLOCK_CONTROL); + val &= 0xFFFFFEFF; + OS_REG_WRITE(ah, AR9271_CLOCK_CONTROL, val); + } if (ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_LOW_ACK_PWR) OS_REG_WRITE(ah, AR_TPC, HAL_BT_COEX_LOW_ACK_POWER); From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 18:35:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A61F3756; Mon, 15 Apr 2013 18:35:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 98FCC12A6; Mon, 15 Apr 2013 18:35:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FIZ9s3025675; Mon, 15 Apr 2013 18:35:09 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FIZ9Oo025674; Mon, 15 Apr 2013 18:35:09 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201304151835.r3FIZ9Oo025674@svn.freebsd.org> From: Xin LI Date: Mon, 15 Apr 2013 18:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249520 - head/contrib/netcat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 18:35:09 -0000 Author: delphij Date: Mon Apr 15 18:35:09 2013 New Revision: 249520 URL: http://svnweb.freebsd.org/changeset/base/249520 Log: Reflect version update. MFC after: 13 days Modified: head/contrib/netcat/FREEBSD-vendor Modified: head/contrib/netcat/FREEBSD-vendor ============================================================================== --- head/contrib/netcat/FREEBSD-vendor Mon Apr 15 18:32:35 2013 (r249519) +++ head/contrib/netcat/FREEBSD-vendor Mon Apr 15 18:35:09 2013 (r249520) @@ -1,5 +1,5 @@ # $FreeBSD$ Project: netcat (aka src/usr.bin/nc in OpenBSD) ProjectURL: http://www.openbsd.org/ -Version: 5.2 +Version: 5.3 License: BSD From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 19:32:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7091FBE5; Mon, 15 Apr 2013 19:32:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 49677160D; Mon, 15 Apr 2013 19:32:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FJWEX1043460; Mon, 15 Apr 2013 19:32:14 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FJWEJB043459; Mon, 15 Apr 2013 19:32:14 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201304151932.r3FJWEJB043459@svn.freebsd.org> From: Warner Losh Date: Mon, 15 Apr 2013 19:32:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249523 - head/sys/mips/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 19:32:15 -0000 Author: imp Date: Mon Apr 15 19:32:14 2013 New Revision: 249523 URL: http://svnweb.freebsd.org/changeset/base/249523 Log: Fix N32/N64 register saving by ensuring that all registers resolve to unique values. There's some confusion about what the n32 assembler API really is (since on page 9 of the spec they say that t0-t3 don't exist, then turn around on page 22 and say that t4-t7 don't exist), and this doesn't touch that. NetBSD's version of this file follows the convention I used here, and is likely to be correct. This should fix gdb/ptrace. Modified: head/sys/mips/include/regnum.h Modified: head/sys/mips/include/regnum.h ============================================================================== --- head/sys/mips/include/regnum.h Mon Apr 15 18:56:03 2013 (r249522) +++ head/sys/mips/include/regnum.h Mon Apr 15 19:32:14 2013 (r249523) @@ -42,9 +42,8 @@ #ifndef _MACHINE_REGNUM_H_ #define _MACHINE_REGNUM_H_ -/* This must match the numbers - * in pcb.h and is used by - * swtch.S +/* + * This must match the numbers in pcb.h and is used by swtch.S */ #define PREG_S0 0 #define PREG_S1 1 @@ -64,6 +63,7 @@ /* * Location of the saved registers relative to ZERO. * This must match struct trapframe defined in frame.h exactly. + * This must also match regdef.h. */ #define ZERO 0 #define AST 1 @@ -73,6 +73,16 @@ #define A1 5 #define A2 6 #define A3 7 +#if defined(__mips_n32) || defined(__mips_n64) +#define A4 8 +#define A5 9 +#define A6 10 +#define A7 11 +#define T0 12 +#define T1 13 +#define T2 14 +#define T3 15 +#else #define T0 8 #define T1 9 #define T2 10 @@ -81,6 +91,7 @@ #define TA1 13 #define TA2 14 #define TA3 15 +#endif #define S0 16 #define S1 17 #define S2 18 @@ -113,6 +124,23 @@ #define NUMSAVEREGS 40 /* + * Pseudo registers so we save a complete set of registers regardless of + * the ABI + */ +#if defined(__mips_n32) || defined(__mips_n64) +#define TA0 8 +#define TA1 9 +#define TA2 10 +#define TA3 11 +#else +#define TA0 12 +#define TA1 13 +#define TA2 14 +#define TA3 15 +#endif + + +/* * Index of FP registers in 'struct frame', counting from the beginning * of the frame (i.e., including the general registers). */ From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 20:06:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3E672905; Mon, 15 Apr 2013 20:06:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 212D61779; Mon, 15 Apr 2013 20:06:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FK6vPm052271; Mon, 15 Apr 2013 20:06:57 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FK6uv4052270; Mon, 15 Apr 2013 20:06:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201304152006.r3FK6uv4052270@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 15 Apr 2013 20:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249525 - head/libexec/rtld-elf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 20:06:57 -0000 Author: kib Date: Mon Apr 15 20:06:56 2013 New Revision: 249525 URL: http://svnweb.freebsd.org/changeset/base/249525 Log: The origin_subst_one() function limits the length of the string to PATH_MAX after the token substitution. This is wrong, because origin_subst_one() performs the substitution on the whole rpath and similar strings, which contain several pathes separated by colon. As result, long (but correct) rpath consisting of many path elements is rejected by the function. Correct the problem by rewriting the origin_subst_one() to perform two passes, first pass to calculate the number of substitutions to be performed, and second pass to generate the resulting string. Second pass allocates the memory for the result based on the count from the first pass, without enforcing a limit. Reported and tested by: pgj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Mon Apr 15 19:45:09 2013 (r249524) +++ head/libexec/rtld-elf/rtld.c Mon Apr 15 20:06:56 2013 (r249525) @@ -145,9 +145,8 @@ static void unlink_object(Obj_Entry *); static void unload_object(Obj_Entry *); static void unref_dag(Obj_Entry *); static void ref_dag(Obj_Entry *); -static int origin_subst_one(char **, const char *, const char *, - const char *, char *); -static char *origin_subst(const char *, const char *); +static char *origin_subst_one(char *, const char *, const char *, bool); +static char *origin_subst(char *, const char *); static void preinit_main(void); static int rtld_verify_versions(const Objlist *); static int rtld_verify_object_versions(Obj_Entry *); @@ -748,79 +747,80 @@ basename(const char *name) static struct utsname uts; -static int -origin_subst_one(char **res, const char *real, const char *kw, const char *subst, - char *may_free) +static char * +origin_subst_one(char *real, const char *kw, const char *subst, + bool may_free) { - const char *p, *p1; - char *res1; - int subst_len; - int kw_len; - - res1 = *res = NULL; - p = real; - subst_len = kw_len = 0; - for (;;) { - p1 = strstr(p, kw); - if (p1 != NULL) { - if (subst_len == 0) { - subst_len = strlen(subst); - kw_len = strlen(kw); - } - if (*res == NULL) { - *res = xmalloc(PATH_MAX); - res1 = *res; - } - if ((res1 - *res) + subst_len + (p1 - p) >= PATH_MAX) { - _rtld_error("Substitution of %s in %s cannot be performed", - kw, real); - if (may_free != NULL) - free(may_free); - free(res); - return (false); - } - memcpy(res1, p, p1 - p); - res1 += p1 - p; - memcpy(res1, subst, subst_len); - res1 += subst_len; - p = p1 + kw_len; - } else { - if (*res == NULL) { - if (may_free != NULL) - *res = may_free; - else - *res = xstrdup(real); - return (true); - } - *res1 = '\0'; - if (may_free != NULL) - free(may_free); - if (strlcat(res1, p, PATH_MAX - (res1 - *res)) >= PATH_MAX) { - free(res); - return (false); - } - return (true); - } - } + char *p, *p1, *res, *resp; + int subst_len, kw_len, subst_count, old_len, new_len; + + kw_len = strlen(kw); + + /* + * First, count the number of the keyword occurences, to + * preallocate the final string. + */ + for (p = real, subst_count = 0;; p = p1 + kw_len, subst_count++) { + p1 = strstr(p, kw); + if (p1 == NULL) + break; + } + + /* + * If the keyword is not found, just return. + */ + if (subst_count == 0) + return (may_free ? real : xstrdup(real)); + + /* + * There is indeed something to substitute. Calculate the + * length of the resulting string, and allocate it. + */ + subst_len = strlen(subst); + old_len = strlen(real); + new_len = old_len + (subst_len - kw_len) * subst_count; + res = xmalloc(new_len + 1); + + /* + * Now, execute the substitution loop. + */ + for (p = real, resp = res;;) { + p1 = strstr(p, kw); + if (p1 != NULL) { + /* Copy the prefix before keyword. */ + memcpy(resp, p, p1 - p); + resp += p1 - p; + /* Keyword replacement. */ + memcpy(resp, subst, subst_len); + resp += subst_len; + p = p1 + kw_len; + } else + break; + } + + /* Copy to the end of string and finish. */ + strcat(resp, p); + if (may_free) + free(real); + return (res); } static char * -origin_subst(const char *real, const char *origin_path) +origin_subst(char *real, const char *origin_path) { - char *res1, *res2, *res3, *res4; + char *res1, *res2, *res3, *res4; - if (uts.sysname[0] == '\0') { - if (uname(&uts) != 0) { - _rtld_error("utsname failed: %d", errno); - return (NULL); + if (uts.sysname[0] == '\0') { + if (uname(&uts) != 0) { + _rtld_error("utsname failed: %d", errno); + return (NULL); + } } - } - if (!origin_subst_one(&res1, real, "$ORIGIN", origin_path, NULL) || - !origin_subst_one(&res2, res1, "$OSNAME", uts.sysname, res1) || - !origin_subst_one(&res3, res2, "$OSREL", uts.release, res2) || - !origin_subst_one(&res4, res3, "$PLATFORM", uts.machine, res3)) - return (NULL); - return (res4); + res1 = origin_subst_one(real, "$ORIGIN", origin_path, false); + res2 = origin_subst_one(res1, "$OSNAME", uts.sysname, true); + res3 = origin_subst_one(res2, "$OSREL", uts.release, true); + res4 = origin_subst_one(res3, "$PLATFORM", uts.machine, true); + return (res4); } static void @@ -1438,10 +1438,12 @@ find_library(const char *xname, const Ob xname); return NULL; } - if (objgiven && refobj->z_origin) - return origin_subst(xname, refobj->origin_path); - else - return xstrdup(xname); + if (objgiven && refobj->z_origin) { + return (origin_subst(__DECONST(char *, xname), + refobj->origin_path)); + } else { + return (xstrdup(xname)); + } } if (libmap_disable || !objgiven || From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 20:16:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 79CC4D90; Mon, 15 Apr 2013 20:16:32 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6C93517EB; Mon, 15 Apr 2013 20:16:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FKGWeO055192; Mon, 15 Apr 2013 20:16:32 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FKGW5f055190; Mon, 15 Apr 2013 20:16:32 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201304152016.r3FKGW5f055190@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 15 Apr 2013 20:16:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249526 - head/cddl/lib/libdtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 20:16:32 -0000 Author: pfg Date: Mon Apr 15 20:16:31 2013 New Revision: 249526 URL: http://svnweb.freebsd.org/changeset/base/249526 Log: DTrace: NFS translators should be split into client/server pieces Merge change from illumos: 1731 DTrace NFS translators should be split into client/server pieces Illumos Revision: 13523:6763769941d2 This code seems to be currently unused on FreeBSD. Reference: https://www.illumos.org/issues/1731 Obtained from: Illumos MFC after: 1 week Added: head/cddl/lib/libdtrace/nfssrv.d - copied, changed from r249521, head/cddl/lib/libdtrace/nfs.d Modified: head/cddl/lib/libdtrace/nfs.d Modified: head/cddl/lib/libdtrace/nfs.d ============================================================================== --- head/cddl/lib/libdtrace/nfs.d Mon Apr 15 20:06:56 2013 (r249525) +++ head/cddl/lib/libdtrace/nfs.d Mon Apr 15 20:16:31 2013 (r249526) @@ -32,7 +32,7 @@ #pragma D depends_on library ip.d #pragma D depends_on library net.d -#pragma D depends_on module genunix +#pragma D depends_on module nfs typedef struct nfsv4opinfo { uint64_t noi_xid; /* unique transation ID */ @@ -76,21 +76,3 @@ translator nfsv4opinfo_t < struct compou noi_cred = P->basecr; noi_curpath = (P->vp == NULL) ? "" : P->vp->v_path; }; - -#pragma D binding "1.5" translator -translator conninfo_t < rfs4_client_t *P > { - ci_protocol = (P->cl_addr.ss_family == AF_INET) ? "ipv4" : "ipv6"; - - ci_local = ""; - - ci_remote = (P->cl_addr.ss_family == AF_INET) ? - inet_ntoa((ipaddr_t *) - &((struct sockaddr_in *)&P->cl_addr)->sin_addr) : - inet_ntoa6(&((struct sockaddr_in6 *)&P->cl_addr)->sin6_addr); -}; - -#pragma D binding "1.5" translator -translator nfsv4cbinfo_t < rfs4_deleg_state_t *P > { - nci_curpath = (P->finfo->vp == NULL) ? "" : - P->finfo->vp->v_path; -}; Copied and modified: head/cddl/lib/libdtrace/nfssrv.d (from r249521, head/cddl/lib/libdtrace/nfs.d) ============================================================================== --- head/cddl/lib/libdtrace/nfs.d Mon Apr 15 18:38:21 2013 (r249521, copy source) +++ head/cddl/lib/libdtrace/nfssrv.d Mon Apr 15 20:16:31 2013 (r249526) @@ -32,50 +32,8 @@ #pragma D depends_on library ip.d #pragma D depends_on library net.d -#pragma D depends_on module genunix - -typedef struct nfsv4opinfo { - uint64_t noi_xid; /* unique transation ID */ - cred_t *noi_cred; /* credentials for operation */ - string noi_curpath; /* current file handle path (if any) */ -} nfsv4opinfo_t; - -typedef struct nfsv4cbinfo { - string nci_curpath; /* current file handle path (if any) */ -} nfsv4cbinfo_t; - -#pragma D binding "1.5" translator -translator conninfo_t < struct svc_req *P > { - ci_protocol = P->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" : - P->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" : - ""; - - ci_local = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc. - xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr); - - ci_remote = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc. - xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr); -}; - -#pragma D binding "1.5" translator -translator conninfo_t < struct compound_state *P > { - ci_protocol = P->req->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" : - P->req->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" : - ""; - - ci_local = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc. - xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr); - - ci_remote = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc. - xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr); -}; - -#pragma D binding "1.5" translator -translator nfsv4opinfo_t < struct compound_state *P > { - noi_xid = P->req->rq_xprt->xp_xid; - noi_cred = P->basecr; - noi_curpath = (P->vp == NULL) ? "" : P->vp->v_path; -}; +#pragma D depends_on module nfs.d +#pragma D depends_on module nfssrv #pragma D binding "1.5" translator translator conninfo_t < rfs4_client_t *P > { From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 21:02:40 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AF15F95; Mon, 15 Apr 2013 21:02:40 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 918501B41; Mon, 15 Apr 2013 21:02:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FL2eRB068170; Mon, 15 Apr 2013 21:02:40 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FL2eku068169; Mon, 15 Apr 2013 21:02:40 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201304152102.r3FL2eku068169@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 15 Apr 2013 21:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249528 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 21:02:40 -0000 Author: ae Date: Mon Apr 15 21:02:40 2013 New Revision: 249528 URL: http://svnweb.freebsd.org/changeset/base/249528 Log: The source address selection algorithm tries to apply several rules for the set of IPv6 addresses. Now each attempt goes into IPv6 statistics, even if given rule did not won. Change this and take into account only those rules, that won. Also add accounting for cases, when algorithm fails to select an address. Modified: head/sys/netinet6/in6_src.c Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Mon Apr 15 20:57:55 2013 (r249527) +++ head/sys/netinet6/in6_src.c Mon Apr 15 21:02:40 2013 (r249528) @@ -151,9 +151,7 @@ static struct in6_addrpolicy *match_addr * an entry to the caller for later use. */ #define REPLACE(r) do {\ - if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ - sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ - IP6STAT_INC(ip6s_sources_rule[(r)]); \ + rule = (r); \ /* { \ char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \ printf("in6_selectsrc: replace %s with %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \ @@ -161,9 +159,6 @@ static struct in6_addrpolicy *match_addr goto replace; \ } while(0) #define NEXT(r) do {\ - if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ - sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ - IP6STAT_INC(ip6s_sources_rule[(r)]); \ /* { \ char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \ printf("in6_selectsrc: keep %s against %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \ @@ -171,9 +166,7 @@ static struct in6_addrpolicy *match_addr goto next; /* XXX: we can't use 'continue' here */ \ } while(0) #define BREAK(r) do { \ - if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ - sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ - IP6STAT_INC(ip6s_sources_rule[(r)]); \ + rule = (r); \ goto out; /* XXX: we can't use 'break' here */ \ } while(0) @@ -190,7 +183,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso struct in6_addrpolicy *dst_policy = NULL, *best_policy = NULL; u_int32_t odstzone; int prefer_tempaddr; - int error; + int error, rule; struct ip6_moptions *mopts; KASSERT(srcp != NULL, ("%s: srcp is NULL", __func__)); @@ -306,6 +299,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso if (error) return (error); + rule = 0; IN6_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { int new_scope = -1, new_matchlen = -1; @@ -487,6 +481,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso if ((ia = ia_best) == NULL) { IN6_IFADDR_RUNLOCK(); + IP6STAT_INC(ip6s_sources_none); return (EADDRNOTAVAIL); } @@ -503,6 +498,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso if (cred != NULL && prison_local_ip6(cred, &tmp, (inp != NULL && (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0) { IN6_IFADDR_RUNLOCK(); + IP6STAT_INC(ip6s_sources_none); return (EADDRNOTAVAIL); } @@ -511,6 +507,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso bcopy(&tmp, srcp, sizeof(*srcp)); IN6_IFADDR_RUNLOCK(); + IP6STAT_INC(ip6s_sources_rule[rule]); return (0); } From owner-svn-src-head@FreeBSD.ORG Mon Apr 15 21:50:45 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B5E7CB4C; Mon, 15 Apr 2013 21:50:45 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vps.rulingia.com (host-122-100-2-194.octopus.com.au [122.100.2.194]) by mx1.freebsd.org (Postfix) with ESMTP id 4EA3B1D23; Mon, 15 Apr 2013 21:50:44 +0000 (UTC) Received: from server.rulingia.com (c220-239-237-213.belrs5.nsw.optusnet.com.au [220.239.237.213]) by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id r3FLoYLa090142 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 16 Apr 2013 07:50:35 +1000 (EST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.14.5/8.14.5) with ESMTP id r3FLoN0C081669 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Apr 2013 07:50:23 +1000 (EST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.5/8.14.5/Submit) id r3FLoMeD081667; Tue, 16 Apr 2013 07:50:22 +1000 (EST) (envelope-from peter) Date: Tue, 16 Apr 2013 07:50:22 +1000 From: Peter Jeremy To: Tim Kientzle Subject: Re: svn commit: r249484 - head/lib Message-ID: <20130415215022.GA80800@server.rulingia.com> References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <20130415123349.GA27773@gpr.nnz-home.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7JfCtLOvnd9MIVvH" Content-Disposition: inline In-Reply-To: <20130415123349.GA27773@gpr.nnz-home.ru> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 21:50:45 -0000 --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Apr 14, 2013 at 07:13:52PM +0000, Tim Kientzle wrote: > Install a symlink > /usr/lib/include =3D=3D> /usr/include April 1st was several weeks ago. =20 > This fixes -print-file-name=3Dinclude in clang (and is > arguably a better way to fix the same issue in GCC than > the change I made in r231336). I would disagree that this is a better solution. On 2013-Apr-15 16:33:50 +0400, Gennady Proskurin wrote: >Here is the quote from r231336 commit message: > Implement -print-file-name=3Dinclude (which is undocumented > but used by some Linux boot loaders). I don't see why base needs to grow an ugly symlink to support a couple of ports. Surely if ports rely on an undocumented features of the toolchain, the correct solution is to fix the ports. --=20 Peter Jeremy --7JfCtLOvnd9MIVvH Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlFsdh4ACgkQ/opHv/APuIcU/wCgm10wx4BCOn6BiUS/+RDxg5HY uOkAoLF+UfEXIXRN/sraEyrLumxW/arb =MHIT -----END PGP SIGNATURE----- --7JfCtLOvnd9MIVvH-- From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 04:20:05 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D6CC2E92; Tue, 16 Apr 2013 04:20:05 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from tux-cave.hellug.gr (tux-cave.hellug.gr [195.134.99.74]) by mx1.freebsd.org (Postfix) with ESMTP id 5350BB51; Tue, 16 Apr 2013 04:20:04 +0000 (UTC) X-Spam-Status: No X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-2.9, required 5, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90) X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-ID: r3G4JpGM001874 Received: from saturn.laptop (217-162-217-29.dynamic.hispeed.ch [217.162.217.29]) (authenticated bits=0) by tux-cave.hellug.gr (8.14.3/8.14.3/Debian-9.4) with ESMTP id r3G4JpGM001874 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 16 Apr 2013 07:19:59 +0300 Received: from saturn.laptop (localhost [127.0.0.1]) by saturn.laptop (8.14.4/8.14.4/Debian-2.1ubuntu1) with ESMTP id r3G4JiTk011526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 16 Apr 2013 06:19:44 +0200 Received: (from keramida@localhost) by saturn.laptop (8.14.4/8.14.4/Submit) id r3G4Jh3F011523; Tue, 16 Apr 2013 06:19:43 +0200 X-Authentication-Warning: saturn.laptop: keramida set sender to keramida@ceid.upatras.gr using -f From: keramida@ceid.upatras.gr (=?utf-8?B?zpPOuc+Oz4HOs86/z4IgzprOtc+BzrE=?= =?utf-8?B?zrzOr860zrHPgg==?=) To: Dimitry Andric , Gregory Shapiro Subject: Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail References: <201302162017.r1GKHVdY022667@svn.freebsd.org> Date: Tue, 16 Apr 2013 06:19:43 +0200 In-Reply-To: <201302162017.r1GKHVdY022667@svn.freebsd.org> (Dimitry Andric's message of "Sat, 16 Feb 2013 20:17:31 +0000 (UTC)") Message-ID: <87a9ozayzk.fsf@saturn.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 04:20:05 -0000 On Sat, 16 Feb 2013 20:17:31 +0000 (UTC), Dimitry Andric wrote: > Author: dim > Date: Sat Feb 16 20:17:31 2013 > New Revision: 246880 > URL: http://svnweb.freebsd.org/changeset/base/246880 > > Log: > Since clang 3.2 now has an option to suppress warnings about implicitly > promoted K&R parameters, remove the workarounds added for sendmail > components in r228558. > > MFC after: 1 week > Modified: head/usr.sbin/sendmail/Makefile > ============================================================================== > --- head/usr.sbin/sendmail/Makefile Sat Feb 16 19:11:57 2013 (r246879) > +++ head/usr.sbin/sendmail/Makefile Sat Feb 16 20:17:31 2013 (r246880) > @@ -45,11 +45,6 @@ CFLAGS+= -DNETINET6 > > WARNS?= 1 > > -# Unfortunately, clang gives warnings about sendmail code that cannot > -# be turned off yet. Since this is contrib code, and we don't really > -# care about the warnings, just make them non-fatal for now. > -NO_WERROR.clang= > - > DPADD= ${LIBUTIL} ${LIBWRAP} > LDADD= -lutil -lwrap The part of the commit that removes NO_WERROR.clang for usr.sbin/sendmail/ breaks the build of Sendmail with -DSASL. I just tried rebuilding Sendmail with the following in "/etc/make.conf": # Build Sendmail with SASL support. SENDMAIL_CFLAGS ?= -I/usr/local/include -DSASL=20126 SENDMAIL_LDFLAGS ?= -L/usr/local/lib SENDMAIL_LDADD ?= -lsasl2 The warnings that usersmtp.c still triggers when -DSASL is used are: : cc -O2 -pipe -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/src -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/include -I. -DNEWDB -DNIS -DTCPWRAPPERS -DMAP_REGEX -DDNSMAP -DNETINET6 -DSTARTTLS -D_FFR_TLS_1 -I/usr/local/include -DSASL=20126 -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-conversion -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -c /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c : /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:1797:50: warning: incompatible pointer types passing 'void ()' to parameter of type 'void (*)(char *, bool, MAILER *, struct : mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types] : smtpresult = reply(m, mci, e, TimeOuts.to_auth, getsasldata, NULL, : ^~~~~~~~~~~ : /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/sendmail.h:2519:67: note: passing argument to parameter here : extern int reply __P((MAILER *, MCI *, ENVELOPE *, time_t, void (*)__P((char *, bool, MAILER *, MCI *, ENVELOPE *)), char **, int)); : ^ : /usr/include/sys/cdefs.h:136:21: note: expanded from macro '__P' : #define __P(protos) protos /* full-blown ANSI C */ : ^ : /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:1842:9: warning: incompatible pointer types passing 'void ()' to parameter of type 'void (*)(char *, bool, MAILER *, struct : mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types] : getsasldata, NULL, XS_AUTH); : ^~~~~~~~~~~ : /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/sendmail.h:2519:67: note: passing argument to parameter here : extern int reply __P((MAILER *, MCI *, ENVELOPE *, time_t, void (*)__P((char *, bool, MAILER *, MCI *, ENVELOPE *)), char **, int)); : ^ : /usr/include/sys/cdefs.h:136:21: note: expanded from macro '__P' : #define __P(protos) protos /* full-blown ANSI C */ : ^ : /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:1864:8: warning: incompatible pointer types passing 'void ()' to parameter of type 'void (*)(char *, bool, MAILER *, struct : mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types] : getsasldata, NULL, XS_AUTH); : ^~~~~~~~~~~ : /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/sendmail.h:2519:67: note: passing argument to parameter here : extern int reply __P((MAILER *, MCI *, ENVELOPE *, time_t, void (*)__P((char *, bool, MAILER *, MCI *, ENVELOPE *)), char **, int)); : ^ : /usr/include/sys/cdefs.h:136:21: note: expanded from macro '__P' : #define __P(protos) protos /* full-blown ANSI C */ : ^ : 3 warnings generated. We have to either fix the warnings in the contrib/sendmail/src/usersmtp.c code or put back NO_WERROR.clang, at least for usr.sbin/sendmail/Makefile. From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 07:11:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 44DF2310; Tue, 16 Apr 2013 07:11:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3838E142; Tue, 16 Apr 2013 07:11:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3G7BrTg045002; Tue, 16 Apr 2013 07:11:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3G7Br1Z045001; Tue, 16 Apr 2013 07:11:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201304160711.r3G7Br1Z045001@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 16 Apr 2013 07:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249538 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 07:11:53 -0000 Author: kib Date: Tue Apr 16 07:11:52 2013 New Revision: 249538 URL: http://svnweb.freebsd.org/changeset/base/249538 Log: Some compilers issue a warning when wider integer is casted to narrow pointer. Supposedly shut down the warning by casting through uintptr_t. Reported by: ian Modified: head/sys/kern/subr_bus_dma.c Modified: head/sys/kern/subr_bus_dma.c ============================================================================== --- head/sys/kern/subr_bus_dma.c Tue Apr 16 07:02:13 2013 (r249537) +++ head/sys/kern/subr_bus_dma.c Tue Apr 16 07:11:52 2013 (r249538) @@ -66,8 +66,8 @@ _bus_dmamap_load_vlist(bus_dma_tag_t dma error = 0; for (; sglist_cnt > 0; sglist_cnt--, list++) { error = _bus_dmamap_load_buffer(dmat, map, - (void *)list->ds_addr, list->ds_len, pmap, flags, NULL, - nsegs); + (void *)(uintptr_t)list->ds_addr, list->ds_len, pmap, + flags, NULL, nsegs); if (error) break; } From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 09:03:09 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 18F22FC4; Tue, 16 Apr 2013 09:03:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) by mx1.freebsd.org (Postfix) with ESMTP id D43E7D19; Tue, 16 Apr 2013 09:03:08 +0000 (UTC) Received: from spaceball.andric.com (spaceball.andric.com [IPv6:2001:7b8:3a7:0:204:4bff:fe01:de8a]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 54AF55C44; Tue, 16 Apr 2013 11:03:06 +0200 (CEST) Message-ID: <516D13C5.70900@FreeBSD.org> Date: Tue, 16 Apr 2013 11:03:01 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Thunderbird/21.0 MIME-Version: 1.0 To: =?UTF-8?B?zpPOuc+Oz4HOs86/z4IgzprOtc+BzrHOvM6vzrTOsc+C?= , Gregory Shapiro Subject: Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail References: <201302162017.r1GKHVdY022667@svn.freebsd.org> <87a9ozayzk.fsf@saturn.laptop> In-Reply-To: <87a9ozayzk.fsf@saturn.laptop> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 09:03:09 -0000 On 2013-04-16 06:19, =CE=93=CE=B9=CF=8E=CF=81=CE=B3=CE=BF=CF=82 =CE=9A=CE= =B5=CF=81=CE=B1=CE=BC=CE=AF=CE=B4=CE=B1=CF=82 wrote: > On Sat, 16 Feb 2013 20:17:31 +0000 (UTC), Dimitry Andric wrote: =2E.. >> Since clang 3.2 now has an option to suppress warnings about implic= itly >> promoted K&R parameters, remove the workarounds added for sendmail >> components in r228558. =2E.. > The part of the commit that removes NO_WERROR.clang for usr.sbin/sendma= il/ > breaks the build of Sendmail with -DSASL. I just tried rebuilding Send= mail > with the following in "/etc/make.conf": > > # Build Sendmail with SASL support. > SENDMAIL_CFLAGS ?=3D -I/usr/local/include -DSASL=3D20126 > SENDMAIL_LDFLAGS ?=3D -L/usr/local/lib > SENDMAIL_LDADD ?=3D -lsasl2 > > The warnings that usersmtp.c still triggers when -DSASL is used are: > > : cc -O2 -pipe -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/src= -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/include -I. -DNEWDB = -DNIS -DTCPWRAPPERS -DMAP_REGEX -DDNSMAP -DNETINET6 -DSTARTTLS -D_FFR_TLS= _1 -I/usr/local/include -DSASL=3D20126 -std=3Dgnu99 -Qunused-arguments -f= stack-protector -Wsystem-headers -Wno-pointer-sign -Wno-empty-body -Wno-s= tring-plus-int -Wno-tautological-compare -Wno-unused-value -Wno-parenthes= es-equality -Wno-unused-function -Wno-conversion -Wno-switch -Wno-switch-= enum -Wno-knr-promoted-parameter -Wno-parentheses -c /usr/src/usr.sbin/se= ndmail/../../contrib/sendmail/src/usersmtp.c > : /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:1797= :50: warning: incompatible pointer types passing 'void ()' to parameter o= f type 'void (*)(char *, bool, MAILER *, struct > : mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types] > : smtpresult =3D reply(m, mci, e, TimeOuts.to_auth, getsasldata= , NULL, > : ^~~~~~~~~~~ Have you tried the patch I posted here? http://lists.freebsd.org/pipermail/freebsd-current/2013-March/040634.html= If people feel this is the right approach, I am happy to commit it. If people prefer to just shut up warnings, I am happy with that too. From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 09:40:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AD3C896E; Tue, 16 Apr 2013 09:40:02 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115]) by mx1.freebsd.org (Postfix) with ESMTP id 7000BEAF; Tue, 16 Apr 2013 09:40:02 +0000 (UTC) Received: from jh (a91-153-115-208.elisa-laajakaista.fi [91.153.115.208]) by gw01.mail.saunalahti.fi (Postfix) with SMTP id 669A71516B1; Tue, 16 Apr 2013 12:31:08 +0300 (EEST) Date: Tue, 16 Apr 2013 12:31:08 +0300 From: Jaakko Heinonen To: Ivan Voras Subject: Re: svn commit: r249508 - in head/sys: conf geom/label Message-ID: <20130416093108.GA26598@jh> References: <201304151609.r3FG9Oga079482@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201304151609.r3FG9Oga079482@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 09:40:02 -0000 On 2013-04-15, Ivan Voras wrote: > Introduce glabel labels based on GEOM ident attributes. In this initial > implementation, error on the side of conservatism and only create labels > for GEOMs of classes DISK and MULTIPATH. After this commit I get a panic on boot. My kernel has been compiled with gcc. panic: stack overflow detected; backtrace may be corrupted cpuid = 1 KDB: enter: panic [ thread pid 13 tid 100009 ] Stopped at kdb_enter+0x3a: movl $0,kdb_why db> bt Tracing pid 13 tid 100009 td 0xc7322000 kdb_enter(c0f374a2,c0f374a2,c0f3a31b,c6edbabc,1,...) at kdb_enter+0x3a/frame 0xc6edba7c vpanic(c6edbabc,c6edbabc,c0a3ee02,c0f3a31b,c6edbb50,...) at vpanic+0x12d/frame 0xc6edbaa4 panic(c0f3a31b,c6edbb50,c09a5d98,c6edbb90,c6edbadc,...) at panic+0x14/frame 0xc6edbab0 __stack_chk_fail(c6edbb90,c6edbadc,c6edbad8,c6edbadc,1,...) at __stack_chk_fail+0x12/frame 0xc6edbabc g_label_disk_ident_taste(c7511e40,c6edbb90,80,15e,0,...) at g_label_disk_ident_taste+0x138/frame 0xc6edbb50 g_label_taste(c105a5e0,c732be00,0,229,c732bd80,...) at g_label_taste+0x486/frame 0xc6edbc4c g_new_provider_event(c732be00,0,c0f29730,100,80246,...) at g_new_provider_event+0xe8/frame 0xc6edbc6c g_run_events(c10de890,0,c0f29f9d,79,c6edbcf4,...) at g_run_events+0x31c/frame 0xc6edbcb0 g_event_procbody(0,c6edbd08,c0f30630,3d7,c72b92e8,...) at g_event_procbody+0x93/frame 0xc6edbcc8 fork_exit(c099da20,0,c6edbd08) at fork_exit+0xc0/frame 0xc6edbcf4 fork_trampoline() at fork_trampoline+0x8/frame 0xc6edbcf4 --- trap 0, eip = 0, esp = 0xc6edbd40, ebp = 0 --- -- Jaakko From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 10:19:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8B810161; Tue, 16 Apr 2013 10:19:59 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx1.freebsd.org (Postfix) with ESMTP id 1363F9B; Tue, 16 Apr 2013 10:19:59 +0000 (UTC) Received: by mail-ve0-f172.google.com with SMTP id db10so261069veb.3 for ; Tue, 16 Apr 2013 03:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=vtzwtvanB9SIc37dOfhjuxcKlFk7A20jBobmRf5bHu0=; b=itjSebzL5nL+qM2hHB78U80eya5r7MDCI05yEdDFDDY90720YW7avmqhgV8aJRZWN0 ftflpD0ncfCd7OzylFl6iS9LNuOtNVuMCcTNxv6yJuNChpQp1lXTdVpOr+3v3S05+oU6 914Mhg8vazZJXXnaVc/fpwPtl4J7U4getI2hXCwxzQXYhoF+F4YMAZFNQdPmPEY08Hcs ogQlko+g4vxLn53ZrXHrx9BnUXO8XFD8WOsBShxLxWoZ/1ue2xlbSjG7CUgCggZeQWhg hvlNHCMQTp4gwxp5EzvUMBogGVe/m8x7LXAhqAxcsDNoyVxc39E8xTA9radQmHEwLPN2 mPWQ== X-Received: by 10.58.15.232 with SMTP id a8mr1018883ved.27.1366107598312; Tue, 16 Apr 2013 03:19:58 -0700 (PDT) MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.58.34.162 with HTTP; Tue, 16 Apr 2013 03:19:18 -0700 (PDT) In-Reply-To: <20130416093108.GA26598@jh> References: <201304151609.r3FG9Oga079482@svn.freebsd.org> <20130416093108.GA26598@jh> From: Ivan Voras Date: Tue, 16 Apr 2013 12:19:18 +0200 X-Google-Sender-Auth: SASsk2v9Z8Iwt4GCSK1D6L7dn8c Message-ID: Subject: Re: svn commit: r249508 - in head/sys: conf geom/label To: Jaakko Heinonen Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 10:19:59 -0000 On 16 April 2013 11:31, Jaakko Heinonen wrote: > On 2013-04-15, Ivan Voras wrote: >> Introduce glabel labels based on GEOM ident attributes. In this initial >> implementation, error on the side of conservatism and only create labels >> for GEOMs of classes DISK and MULTIPATH. > > After this commit I get a panic on boot. My kernel has been compiled > with gcc. Thanks for the report, I'm investigating it. From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 11:12:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 612DFABE; Tue, 16 Apr 2013 11:12:59 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 39C44259; Tue, 16 Apr 2013 11:12:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GBCxG9018726; Tue, 16 Apr 2013 11:12:59 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GBCx2n018725; Tue, 16 Apr 2013 11:12:59 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201304161112.r3GBCx2n018725@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 16 Apr 2013 11:12:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249543 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 11:12:59 -0000 Author: ae Date: Tue Apr 16 11:12:58 2013 New Revision: 249543 URL: http://svnweb.freebsd.org/changeset/base/249543 Log: Replace hardcoded numbers. Modified: head/sys/netinet6/ip6_var.h Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Tue Apr 16 08:54:50 2013 (r249542) +++ head/sys/netinet6/ip6_var.h Tue Apr 16 11:12:58 2013 (r249543) @@ -204,9 +204,11 @@ struct ip6stat { u_quad_t ip6s_rawout; /* total raw ip packets generated */ u_quad_t ip6s_badscope; /* scope error */ u_quad_t ip6s_notmember; /* don't join this multicast group */ - u_quad_t ip6s_nxthist[256]; /* next header history */ +#define IP6S_HDRCNT 256 /* headers count */ + u_quad_t ip6s_nxthist[IP6S_HDRCNT]; /* next header history */ u_quad_t ip6s_m1; /* one mbuf */ - u_quad_t ip6s_m2m[32]; /* two or more mbuf */ +#define IP6S_M2MMAX 32 + u_quad_t ip6s_m2m[IP6S_M2MMAX]; /* two or more mbuf */ u_quad_t ip6s_mext1; /* one ext mbuf */ u_quad_t ip6s_mext2m; /* two or more ext mbuf */ u_quad_t ip6s_exthdrtoolong; /* ext hdr are not contiguous */ @@ -218,27 +220,29 @@ struct ip6stat { * algorithm: * XXX: hardcoded 16 = # of ip6 multicast scope types + 1 */ +#define IP6S_RULESMAX 16 +#define IP6S_SCOPECNT 16 /* number of times that address selection fails */ u_quad_t ip6s_sources_none; /* number of times that an address on the outgoing I/F is chosen */ - u_quad_t ip6s_sources_sameif[16]; + u_quad_t ip6s_sources_sameif[IP6S_SCOPECNT]; /* number of times that an address on a non-outgoing I/F is chosen */ - u_quad_t ip6s_sources_otherif[16]; + u_quad_t ip6s_sources_otherif[IP6S_SCOPECNT]; /* * number of times that an address that has the same scope * from the destination is chosen. */ - u_quad_t ip6s_sources_samescope[16]; + u_quad_t ip6s_sources_samescope[IP6S_SCOPECNT]; /* * number of times that an address that has a different scope * from the destination is chosen. */ - u_quad_t ip6s_sources_otherscope[16]; + u_quad_t ip6s_sources_otherscope[IP6S_SCOPECNT]; /* number of times that a deprecated address is chosen */ - u_quad_t ip6s_sources_deprecated[16]; + u_quad_t ip6s_sources_deprecated[IP6S_SCOPECNT]; /* number of times that each rule of source selection is applied. */ - u_quad_t ip6s_sources_rule[16]; + u_quad_t ip6s_sources_rule[IP6S_MAXRULES]; }; #ifdef _KERNEL From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 11:19:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EAB96DDF; Tue, 16 Apr 2013 11:19:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DDB942B0; Tue, 16 Apr 2013 11:19:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GBJDA4019648; Tue, 16 Apr 2013 11:19:13 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GBJDVr019647; Tue, 16 Apr 2013 11:19:13 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201304161119.r3GBJDVr019647@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 16 Apr 2013 11:19:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249544 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 11:19:14 -0000 Author: ae Date: Tue Apr 16 11:19:13 2013 New Revision: 249544 URL: http://svnweb.freebsd.org/changeset/base/249544 Log: Use IP6S_M2MMAX macro. Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Tue Apr 16 11:12:58 2013 (r249543) +++ head/sys/netinet6/ip6_input.c Tue Apr 16 11:19:13 2013 (r249544) @@ -466,18 +466,16 @@ ip6_input(struct mbuf *m) else IP6STAT_INC(ip6s_mext1); } else { -#define M2MMAX (sizeof(V_ip6stat.ip6s_m2m)/sizeof(V_ip6stat.ip6s_m2m[0])) if (m->m_next) { if (m->m_flags & M_LOOP) { IP6STAT_INC(ip6s_m2m[V_loif->if_index]); - } else if (m->m_pkthdr.rcvif->if_index < M2MMAX) + } else if (m->m_pkthdr.rcvif->if_index < IP6S_M2MMAX) IP6STAT_INC( ip6s_m2m[m->m_pkthdr.rcvif->if_index]); else IP6STAT_INC(ip6s_m2m[0]); } else IP6STAT_INC(ip6s_m1); -#undef M2MMAX } /* drop the packet if IPv6 operation is disabled on the IF */ From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 11:25:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 847ED2E4; Tue, 16 Apr 2013 11:25:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 76CD8323; Tue, 16 Apr 2013 11:25:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GBPk2d022192; Tue, 16 Apr 2013 11:25:46 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GBPkAe022191; Tue, 16 Apr 2013 11:25:46 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201304161125.r3GBPkAe022191@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 16 Apr 2013 11:25:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249545 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 11:25:46 -0000 Author: ae Date: Tue Apr 16 11:25:45 2013 New Revision: 249545 URL: http://svnweb.freebsd.org/changeset/base/249545 Log: Replace hardcoded numbers. Also use interface-local scope name instead of node-local. Modified: head/usr.bin/netstat/inet6.c Modified: head/usr.bin/netstat/inet6.c ============================================================================== --- head/usr.bin/netstat/inet6.c Tue Apr 16 11:19:13 2013 (r249544) +++ head/usr.bin/netstat/inet6.c Tue Apr 16 11:25:45 2013 (r249545) @@ -408,7 +408,7 @@ ip6_stats(u_long off, const char *name, p(ip6s_cantfrag, "\t%ju datagram%s that can't be fragmented\n"); p(ip6s_badscope, "\t%ju packet%s that violated scope rules\n"); p(ip6s_notmember, "\t%ju multicast packet%s which we don't join\n"); - for (first = 1, i = 0; i < 256; i++) + for (first = 1, i = 0; i < IP6S_HDRCNT; i++) if (ip6stat.ip6s_nxthist[i] != 0) { if (first) { printf("\tInput histogram:\n"); @@ -419,7 +419,7 @@ ip6_stats(u_long off, const char *name, } printf("\tMbuf statistics:\n"); printf("\t\t%ju one mbuf\n", (uintmax_t)ip6stat.ip6s_m1); - for (first = 1, i = 0; i < 32; i++) { + for (first = 1, i = 0; i < IP6S_M2MMAX; i++) { char ifbuf[IFNAMSIZ]; if (ip6stat.ip6s_m2m[i] != 0) { if (first) { @@ -445,7 +445,7 @@ ip6_stats(u_long off, const char *name, #define PRINT_SCOPESTAT(s,i) do {\ switch(i) { /* XXX hardcoding in each case */\ case 1:\ - p(s, "\t\t%ju node-local%s\n");\ + p(s, "\t\t%ju interface-local%s\n");\ break;\ case 2:\ p(s,"\t\t%ju link-local%s\n");\ @@ -464,7 +464,7 @@ ip6_stats(u_long off, const char *name, p(ip6s_sources_none, "\t%ju failure%s of source address selection\n"); - for (first = 1, i = 0; i < 16; i++) { + for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_sameif[i]) { if (first) { printf("\tsource addresses on an outgoing I/F\n"); @@ -473,7 +473,7 @@ ip6_stats(u_long off, const char *name, PRINT_SCOPESTAT(ip6s_sources_sameif[i], i); } } - for (first = 1, i = 0; i < 16; i++) { + for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_otherif[i]) { if (first) { printf("\tsource addresses on a non-outgoing I/F\n"); @@ -482,7 +482,7 @@ ip6_stats(u_long off, const char *name, PRINT_SCOPESTAT(ip6s_sources_otherif[i], i); } } - for (first = 1, i = 0; i < 16; i++) { + for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_samescope[i]) { if (first) { printf("\tsource addresses of same scope\n"); @@ -491,7 +491,7 @@ ip6_stats(u_long off, const char *name, PRINT_SCOPESTAT(ip6s_sources_samescope[i], i); } } - for (first = 1, i = 0; i < 16; i++) { + for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_otherscope[i]) { if (first) { printf("\tsource addresses of a different scope\n"); @@ -500,7 +500,7 @@ ip6_stats(u_long off, const char *name, PRINT_SCOPESTAT(ip6s_sources_otherscope[i], i); } } - for (first = 1, i = 0; i < 16; i++) { + for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_deprecated[i]) { if (first) { printf("\tdeprecated source addresses\n"); @@ -511,7 +511,7 @@ ip6_stats(u_long off, const char *name, } printf("\tSource addresses selection rule applied:\n"); - for (i = 0; i < 16; i++) { + for (i = 0; i < IP6S_RULESMAX; i++) { if (ip6stat.ip6s_sources_rule[i]) printf("\t\t%ju %s\n", (uintmax_t)ip6stat.ip6s_sources_rule[i], From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 11:31:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1E5DA4C8; Tue, 16 Apr 2013 11:31:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 110E9350; Tue, 16 Apr 2013 11:31:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GBVQ5D024582; Tue, 16 Apr 2013 11:31:26 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GBVQNc024581; Tue, 16 Apr 2013 11:31:26 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201304161131.r3GBVQNc024581@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 16 Apr 2013 11:31:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249546 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 11:31:27 -0000 Author: ae Date: Tue Apr 16 11:31:26 2013 New Revision: 249546 URL: http://svnweb.freebsd.org/changeset/base/249546 Log: Fix accounting after the r249528, also add several another counters to the statistics. Modified: head/sys/netinet6/in6_src.c Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Tue Apr 16 11:25:45 2013 (r249545) +++ head/sys/netinet6/in6_src.c Tue Apr 16 11:31:26 2013 (r249546) @@ -151,6 +151,7 @@ static struct in6_addrpolicy *match_addr * an entry to the caller for later use. */ #define REPLACE(r) do {\ + IP6STAT_INC(ip6s_sources_rule[(r)]); \ rule = (r); \ /* { \ char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \ @@ -166,6 +167,7 @@ static struct in6_addrpolicy *match_addr goto next; /* XXX: we can't use 'continue' here */ \ } while(0) #define BREAK(r) do { \ + IP6STAT_INC(ip6s_sources_rule[(r)]); \ rule = (r); \ goto out; /* XXX: we can't use 'break' here */ \ } while(0) @@ -506,8 +508,17 @@ in6_selectsrc(struct sockaddr_in6 *dstso *ifpp = ifp; bcopy(&tmp, srcp, sizeof(*srcp)); + if (ia->ia_ifp == ifp) + IP6STAT_INC(ip6s_sources_sameif[best_scope]); + else + IP6STAT_INC(ip6s_sources_otherif[best_scope]); + if (dst_scope == best_scope) + IP6STAT_INC(ip6s_sources_samescope[best_scope]); + else + IP6STAT_INC(ip6s_sources_otherscope[best_scope]); + if (IFA6_IS_DEPRECATED(ia)) + IP6STAT_INC(ip6s_sources_deprecated[best_scope]); IN6_IFADDR_RUNLOCK(); - IP6STAT_INC(ip6s_sources_rule[rule]); return (0); } From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 11:50:52 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CDECD906; Tue, 16 Apr 2013 11:50:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 76465608; Tue, 16 Apr 2013 11:50:52 +0000 (UTC) Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 98662D41AC8; Tue, 16 Apr 2013 21:28:38 +1000 (EST) Date: Tue, 16 Apr 2013 21:28:36 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Dimitry Andric Subject: Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail In-Reply-To: <516D13C5.70900@FreeBSD.org> Message-ID: <20130416205349.W1783@besplex.bde.org> References: <201302162017.r1GKHVdY022667@svn.freebsd.org> <87a9ozayzk.fsf@saturn.laptop> <516D13C5.70900@FreeBSD.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-2082392551-1366111716=:1783" X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=HfxM1V48 c=1 sm=1 a=rG3yl5gHAqsA:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=mZmTMruuRn4A:10 a=6I5d2MoRAAAA:8 a=jqniBCV5i6nGcZ7JSMQA:9 a=45ClL6m2LaAA:10 a=7IFj921gttwA:10 a=TEtd8y5WR3g2ypngnwZWYw==:117 Cc: =?UTF-8?B?zpPOuc+Oz4HOs86/z4IgzprOtc+BzrHOvM6vzrTOsc+C?= , svn-src-head@FreeBSD.org, Gregory Shapiro , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 11:50:53 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-2082392551-1366111716=:1783 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 16 Apr 2013, Dimitry Andric wrote: > On 2013-04-16 06:19, =CE=93=CE=B9=CF=8E=CF=81=CE=B3=CE=BF=CF=82 =CE=9A=CE= =B5=CF=81=CE=B1=CE=BC=CE=AF=CE=B4=CE=B1=CF=82 wrote: >> ... >> The warnings that usersmtp.c still triggers when -DSASL is used are: >>=20 >> : cc -O2 -pipe -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/src= =20 >> -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/include -I. -DNEWDB= =20 >> -DNIS -DTCPWRAPPERS -DMAP_REGEX -DDNSMAP -DNETINET6 -DSTARTTLS -D_FFR_TL= S_1=20 >> -I/usr/local/include -DSASL=3D20126 -std=3Dgnu99 -Qunused-arguments=20 >> -fstack-protector -Wsystem-headers -Wno-pointer-sign -Wno-empty-body=20 >> -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value=20 >> -Wno-parentheses-equality -Wno-unused-function -Wno-conversion -Wno-swit= ch=20 >> -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -c=20 >> /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c >> : /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:1797:= 50:=20 >> warning: incompatible pointer types passing 'void ()' to parameter of ty= pe=20 >> 'void (*)(char *, bool, MAILER *, struct >> : mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types] >> : smtpresult =3D reply(m, mci, e, TimeOuts.to_auth, getsasldata,= =20 >> NULL, >> : ^~~~~~~~~~~ > > Have you tried the patch I posted here? > > http://lists.freebsd.org/pipermail/freebsd-current/2013-March/040634.html > > If people feel this is the right approach, I am happy to commit it. If > people prefer to just shut up warnings, I am happy with that too. stdbool is certainly incompatible with simple use of __P(()), but why does the error message say that the function type is 'void ()', and why doesn't it say that the prototype doesn't match the function? The function is declared as: @ static void getsasldata __P((char *, bool, MAILER *, MCI *, ENVELOPE *)); This says that the function type is the same as the parameter type. @ static void @ getsasldata(line, firstline, m, mci, e) @ =09char *line; @ =09bool firstline; @ =09MAILER *m; @ =09register MCI *mci; @ =09ENVELOPE *e; @ { This says that the function type is different from what the function's prototype is, at least if the bool is smaller than int or otherwise magic, which it is on at least amd64. clang prints a good error message in the following simplified example: @ #include @=20 @ void foo(bool first); @=20 @ void @ foo(first) @ =09bool first; @ { @ } @ z.c:7:7: warning: promoted type 'int' of K&R function parameter is not co= mpatible with the parameter type 'bool' declared in a previous prototype [-= Wknr-promoted-parameter] @ bool first; @ ^ @ z.c:3:15: note: previous declaration is here @ void foo(bool first); @ ^ @ 1 warning generated. This happens with plain cc -c. gcc of course turns the undefined behaviour from this into a portability problem by accepting the bad code. It takes gcc -pedantic to get a warning= =2E The correct prototype on amd64 is 'void foo(int first);'. This is MD. Unfortunately, the correct way to declare this is unsupported AFAIK. It is 'void foo(__promoteof(bool) first);'. __P(()) is really hard to use, since to use it you first have to modify compilers to support __promoteof(), then use it on the type of all integer args whose type is not int or larger, or do this using MD ifdefs. Extending the example a little gives the answer to my question: @ #include @=20 @ typedef void vb(bool first); @=20 @ vb foo; @ void bar(vb *p); @=20 @ void @ foo(first) @ =09bool first; @ { @ =09bar(foo); @ } @ z.c:10:7: warning: promoted type 'int' of K&R function parameter is not c= ompatible with the parameter type 'bool' declared in a previous prototype [= -Wknr-promoted-parameter] @ bool first; @ ^ @ z.c:5:4: note: previous declaration is here @ vb foo; @ ^ @ z.c:12:6: warning: incompatible pointer types passing 'void ()' to parame= ter of type 'vb *' (aka 'void (*)(bool)') [-Wincompatible-pointer-types] @ bar(foo); @ ^~~ @ z.c:6:14: note: passing argument to parameter 'p' here @ void bar(vb *p); @ ^ @ 2 warnings generated. Apparently clang ignores the mismatched prototype after printing a warning about it, and also throws away the type info that it learns by compiling the K&R function, so it is left with only 'void ()' for the type. Then the warnings for some reason emphasize the secondary warnings from this. The first warning should be an error. It is only a warning for gcc -pedant= ic too. Bruce --0-2082392551-1366111716=:1783-- From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 12:31:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1B9C552F; Tue, 16 Apr 2013 12:31:17 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CF7CF897; Tue, 16 Apr 2013 12:31:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GCVGZq042797; Tue, 16 Apr 2013 12:31:16 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GCVG3x042796; Tue, 16 Apr 2013 12:31:16 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201304161231.r3GCVG3x042796@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 16 Apr 2013 12:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249547 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 12:31:17 -0000 Author: pjd Date: Tue Apr 16 12:31:16 2013 New Revision: 249547 URL: http://svnweb.freebsd.org/changeset/base/249547 Log: Correct error message. Reported by: Dirk Engling Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Apr 16 11:31:26 2013 (r249546) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Apr 16 12:31:16 2013 (r249547) @@ -4590,7 +4590,7 @@ zfs_jail(zfs_handle_t *zhp, int jailid, dgettext(TEXT_DOMAIN, "cannot jail '%s'"), zhp->zfs_name); } else { (void) snprintf(errbuf, sizeof (errbuf), - dgettext(TEXT_DOMAIN, "cannot jail '%s'"), zhp->zfs_name); + dgettext(TEXT_DOMAIN, "cannot unjail '%s'"), zhp->zfs_name); } switch (zhp->zfs_type) { From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 12:52:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7E76A812; Tue, 16 Apr 2013 12:52:57 +0000 (UTC) (envelope-from tijl@coosemans.org) Received: from mailrelay011.isp.belgacom.be (mailrelay011.isp.belgacom.be [195.238.6.178]) by mx1.freebsd.org (Postfix) with ESMTP id 94442943; Tue, 16 Apr 2013 12:52:56 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoYGAJ9IbVFR8ZLu/2dsb2JhbABQgwY2gzG9VYELF3SCHwEBBSMzIxALFAQJIQICDwIoHgYNAQcBAYgUCKl/gkCQR45+EQeCL4ETA49UgSmHK49xgw06 Received: from 238.146-241-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.241.146.238]) by relay.skynet.be with ESMTP; 16 Apr 2013 14:52:49 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.6/8.14.6) with ESMTP id r3GCqldt005028; Tue, 16 Apr 2013 14:52:48 +0200 (CEST) (envelope-from tijl@coosemans.org) Message-ID: <516D4998.20905@coosemans.org> Date: Tue, 16 Apr 2013 14:52:40 +0200 From: Tijl Coosemans User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130408 Thunderbird/17.0.5 MIME-Version: 1.0 To: "Andrey V. Elsukov" Subject: Re: svn commit: r249543 - head/sys/netinet6 References: <201304161112.r3GBCx2n018725@svn.freebsd.org> In-Reply-To: <201304161112.r3GBCx2n018725@svn.freebsd.org> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2EJBPDPFSKQOOUETWFMRC" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 12:52:57 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2EJBPDPFSKQOOUETWFMRC Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2013-04-16 13:12, Andrey V. Elsukov wrote: > Author: ae > Date: Tue Apr 16 11:12:58 2013 > New Revision: 249543 > URL: http://svnweb.freebsd.org/changeset/base/249543 >=20 > Log: > Replace hardcoded numbers. >=20 > Modified: > head/sys/netinet6/ip6_var.h >=20 > Modified: head/sys/netinet6/ip6_var.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet6/ip6_var.h Tue Apr 16 08:54:50 2013 (r249542) > +++ head/sys/netinet6/ip6_var.h Tue Apr 16 11:12:58 2013 (r249543) > @@ -204,9 +204,11 @@ struct ip6stat { > u_quad_t ip6s_rawout; /* total raw ip packets generated */ > u_quad_t ip6s_badscope; /* scope error */ > u_quad_t ip6s_notmember; /* don't join this multicast group */ > - u_quad_t ip6s_nxthist[256]; /* next header history */ > +#define IP6S_HDRCNT 256 /* headers count */ > + u_quad_t ip6s_nxthist[IP6S_HDRCNT]; /* next header history */ > u_quad_t ip6s_m1; /* one mbuf */ > - u_quad_t ip6s_m2m[32]; /* two or more mbuf */ > +#define IP6S_M2MMAX 32 > + u_quad_t ip6s_m2m[IP6S_M2MMAX]; /* two or more mbuf */ > u_quad_t ip6s_mext1; /* one ext mbuf */ > u_quad_t ip6s_mext2m; /* two or more ext mbuf */ > u_quad_t ip6s_exthdrtoolong; /* ext hdr are not contiguous */ > @@ -218,27 +220,29 @@ struct ip6stat { > * algorithm: > * XXX: hardcoded 16 =3D # of ip6 multicast scope types + 1 > */ > +#define IP6S_RULESMAX 16 > +#define IP6S_SCOPECNT 16 > /* number of times that address selection fails */ > u_quad_t ip6s_sources_none; > /* number of times that an address on the outgoing I/F is chosen */ > - u_quad_t ip6s_sources_sameif[16]; > + u_quad_t ip6s_sources_sameif[IP6S_SCOPECNT]; > /* number of times that an address on a non-outgoing I/F is chosen */= > - u_quad_t ip6s_sources_otherif[16]; > + u_quad_t ip6s_sources_otherif[IP6S_SCOPECNT]; > /* > * number of times that an address that has the same scope > * from the destination is chosen. > */ > - u_quad_t ip6s_sources_samescope[16]; > + u_quad_t ip6s_sources_samescope[IP6S_SCOPECNT]; > /* > * number of times that an address that has a different scope > * from the destination is chosen. > */ > - u_quad_t ip6s_sources_otherscope[16]; > + u_quad_t ip6s_sources_otherscope[IP6S_SCOPECNT]; > /* number of times that a deprecated address is chosen */ > - u_quad_t ip6s_sources_deprecated[16]; > + u_quad_t ip6s_sources_deprecated[IP6S_SCOPECNT]; > =20 > /* number of times that each rule of source selection is applied. */ > - u_quad_t ip6s_sources_rule[16]; > + u_quad_t ip6s_sources_rule[IP6S_MAXRULES]; This breaks buildworld because IP6S_MAXRULES is undefined. It's called IP6S_RULESMAX above. ------enig2EJBPDPFSKQOOUETWFMRC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iF4EAREIAAYFAlFtSZ8ACgkQfoCS2CCgtit5RwD+I+RxLgMTUwVHdwlK2NnlC2pc QQ1pOuOtO5UeVDbKdEwA/iU6V1qMCLLRBqud7THISIol9yksUqjmDgKtnogvdKul =s47v -----END PGP SIGNATURE----- ------enig2EJBPDPFSKQOOUETWFMRC-- From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 13:14:19 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2971FCD9; Tue, 16 Apr 2013 13:14:19 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from tux-cave.hellug.gr (tux-cave.hellug.gr [195.134.99.74]) by mx1.freebsd.org (Postfix) with ESMTP id 9A33FA18; Tue, 16 Apr 2013 13:14:18 +0000 (UTC) X-Spam-Status: No X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-2.9, required 5, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90) X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-ID: r3GDE4Lj013142 Received: from saturn.laptop (217-162-217-29.dynamic.hispeed.ch [217.162.217.29]) (authenticated bits=0) by tux-cave.hellug.gr (8.14.3/8.14.3/Debian-9.4) with ESMTP id r3GDE4Lj013142 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 16 Apr 2013 16:14:13 +0300 Received: from saturn.laptop (localhost [127.0.0.1]) by saturn.laptop (8.14.4/8.14.4/Debian-2.1ubuntu1) with ESMTP id r3GDDvK3027102 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 16 Apr 2013 15:13:57 +0200 Received: (from keramida@localhost) by saturn.laptop (8.14.4/8.14.4/Submit) id r3GDDtne027095; Tue, 16 Apr 2013 15:13:55 +0200 X-Authentication-Warning: saturn.laptop: keramida set sender to keramida@ceid.upatras.gr using -f From: keramida@ceid.upatras.gr (Giorgos Keramidas) To: Bruce Evans Subject: Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail References: <201302162017.r1GKHVdY022667@svn.freebsd.org> <87a9ozayzk.fsf@saturn.laptop> <516D13C5.70900@FreeBSD.org> <20130416205349.W1783@besplex.bde.org> Date: Tue, 16 Apr 2013 15:13:55 +0200 In-Reply-To: <20130416205349.W1783@besplex.bde.org> (Bruce Evans's message of "Tue, 16 Apr 2013 21:28:36 +1000 (EST)") Message-ID: <87zjwy62jw.fsf@saturn.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@FreeBSD.org, Gregory Shapiro , src-committers@FreeBSD.org, Dimitry Andric , svn-src-all@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 13:14:19 -0000 On Tue, 16 Apr 2013 21:28:36 +1000 (EST), Bruce Evans wrote: >On Tue, 16 Apr 2013, Dimitry Andric wrote: >> Have you tried the patch I posted here? >> >> http://lists.freebsd.org/pipermail/freebsd-current/2013-March/040634.html >> >> If people feel this is the right approach, I am happy to commit it. If >> people prefer to just shut up warnings, I am happy with that too. Hi Dimitry, I haven't but I will right now. Thanks for pointing me to it :) Also Bruce, thanks for the very detailed explanation. I admit I was a bit confused when a similar small test program I wrote failed to trigger the warning in clang: #include void foo(int code, const char *text); void foo(code, text) int code; const char *text; { printf("error %d: %s", code, text); } int main(void) { foo(0, "unknown error"); return 0; } But now -- having read all the details you wrote -- using stdbool.h and changing the type of 'code' to bool, *does* trigger the promotion and the warning: #include #include void foo(bool code, const char *text); void foo(code, text) bool code; const char *text; { if (code != false) printf("error: %s", text); } int main(void) { foo(false, "unknown error"); return 0; } % cc -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -c proto.c proto.c:8:10: warning: promoted type 'int' of K&R function parameter is not compatible with the parameter type 'bool' declared in a previous prototype [-Wknr-promoted-parameter] bool code; ^ proto.c:4:15: note: previous declaration is here void foo(bool code, const char *text); ^ 1 warning generated. > stdbool is certainly incompatible with simple use of __P(()), but why does > the error message say that the function type is 'void ()', and why doesn't > it say that the prototype doesn't match the function? The function is > declared as: > > @ static void getsasldata __P((char *, bool, MAILER *, MCI *, ENVELOPE *)); > > This says that the function type is the same as the parameter type. > > @ static void > @ getsasldata(line, firstline, m, mci, e) > @ char *line; > @ bool firstline; > @ MAILER *m; > @ register MCI *mci; > @ ENVELOPE *e; > @ { > > This says that the function type is different from what the function's > prototype is, at least if the bool is smaller than int or otherwise > magic, which it is on at least amd64. > > clang prints a good error message in the following simplified example: > > @ #include > @ @ void foo(bool first); > @ @ void > @ foo(first) > @ bool first; > @ { > @ } > > @ z.c:7:7: warning: promoted type 'int' of K&R function parameter is not compatible with the parameter type 'bool' declared in a previous prototype [-Wknr-promoted-parameter] > @ bool first; > @ ^ > @ z.c:3:15: note: previous declaration is here > @ void foo(bool first); > @ ^ > @ 1 warning generated. > > This happens with plain cc -c. > > gcc of course turns the undefined behaviour from this into a portability > problem by accepting the bad code. It takes gcc -pedantic to get a warning. > > The correct prototype on amd64 is 'void foo(int first);'. This is MD. > Unfortunately, the correct way to declare this is unsupported AFAIK. It > is 'void foo(__promoteof(bool) first);'. __P(()) is really hard to use, > since to use it you first have to modify compilers to support > __promoteof(), then use it on the type of all integer args whose type is > not int or larger, or do this using MD ifdefs. > > Extending the example a little gives the answer to my question: > > @ #include > @ @ typedef void vb(bool first); > @ @ vb foo; > @ void bar(vb *p); > @ @ void > @ foo(first) > @ bool first; > @ { > @ bar(foo); > @ } > > @ z.c:10:7: warning: promoted type 'int' of K&R function parameter is not compatible with the parameter type 'bool' declared in a previous prototype [-Wknr-promoted-parameter] > @ bool first; > @ ^ > @ z.c:5:4: note: previous declaration is here > @ vb foo; > @ ^ > @ z.c:12:6: warning: incompatible pointer types passing 'void ()' to parameter of type 'vb *' (aka 'void (*)(bool)') [-Wincompatible-pointer-types] > @ bar(foo); > @ ^~~ > @ z.c:6:14: note: passing argument to parameter 'p' here > @ void bar(vb *p); > @ ^ > @ 2 warnings generated. > > Apparently clang ignores the mismatched prototype after printing a warning > about it, and also throws away the type info that it learns by compiling > the K&R function, so it is left with only 'void ()' for the type. Then > the warnings for some reason emphasize the secondary warnings from this. > > The first warning should be an error. It is only a warning for gcc -pedantic > too. > > Bruce -- Giorgos Keramidas; gkeramidas@gmail.com From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 13:20:20 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 663A2E9E; Tue, 16 Apr 2013 13:20:20 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from tux-cave.hellug.gr (tux-cave.hellug.gr [195.134.99.74]) by mx1.freebsd.org (Postfix) with ESMTP id D4321A40; Tue, 16 Apr 2013 13:20:19 +0000 (UTC) X-Spam-Status: No X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-2.9, required 5, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90) X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-ID: r3GDK9nL014108 Received: from saturn.laptop (217-162-217-29.dynamic.hispeed.ch [217.162.217.29]) (authenticated bits=0) by tux-cave.hellug.gr (8.14.3/8.14.3/Debian-9.4) with ESMTP id r3GDK9nL014108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 16 Apr 2013 16:20:17 +0300 Received: from saturn.laptop (localhost [127.0.0.1]) by saturn.laptop (8.14.4/8.14.4/Debian-2.1ubuntu1) with ESMTP id r3GDK4An027845 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 16 Apr 2013 15:20:04 +0200 Received: (from keramida@localhost) by saturn.laptop (8.14.4/8.14.4/Submit) id r3GDK3sI027837; Tue, 16 Apr 2013 15:20:03 +0200 X-Authentication-Warning: saturn.laptop: keramida set sender to keramida@ceid.upatras.gr using -f From: keramida@ceid.upatras.gr (Giorgos Keramidas) To: Dimitry Andric Subject: Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail References: <201302162017.r1GKHVdY022667@svn.freebsd.org> <87a9ozayzk.fsf@saturn.laptop> <516D13C5.70900@FreeBSD.org> Date: Tue, 16 Apr 2013 15:20:03 +0200 In-Reply-To: <516D13C5.70900@FreeBSD.org> (Dimitry Andric's message of "Tue, 16 Apr 2013 11:03:01 +0200") Message-ID: <87vc7m629o.fsf@saturn.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, Gregory Shapiro , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 13:20:20 -0000 On Tue, 16 Apr 2013 11:03:01 +0200, Dimitry Andric wrote: > On 2013-04-16 06:19, =CE=93=CE=B9=CF=8E=CF=81=CE=B3=CE=BF=CF=82 =CE=9A=CE= =B5=CF=81=CE=B1=CE=BC=CE=AF=CE=B4=CE=B1=CF=82 wrote: >> On Sat, 16 Feb 2013 20:17:31 +0000 (UTC), Dimitry Andric wrote: > ... >>> Since clang 3.2 now has an option to suppress warnings about implici= tly >>> promoted K&R parameters, remove the workarounds added for sendmail >>> components in r228558. > ... >> The part of the commit that removes NO_WERROR.clang for usr.sbin/sendmai= l/ >> breaks the build of Sendmail with -DSASL. I just tried rebuilding Sendm= ail >> with the following in "/etc/make.conf": >> >> # Build Sendmail with SASL support. >> SENDMAIL_CFLAGS ?=3D -I/usr/local/include -DSASL=3D20126 >> SENDMAIL_LDFLAGS ?=3D -L/usr/local/lib >> SENDMAIL_LDADD ?=3D -lsasl2 >> >> The warnings that usersmtp.c still triggers when -DSASL is used are: >> >> : cc -O2 -pipe -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/src >> -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/include >> -I. -DNEWDB -DNIS -DTCPWRAPPERS -DMAP_REGEX -DDNSMAP -DNETINET6 >> -DSTARTTLS -D_FFR_TLS_1 -I/usr/local/include -DSASL=3D20126 -std=3Dgnu99 >> -Qunused-arguments -fstack-protector -Wsystem-headers >> -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int >> -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality >> -Wno-unused-function -Wno-conversion -Wno-switch -Wno-switch-enum >> -Wno-knr-promoted-parameter -Wno-parentheses -c >> /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c >> : >> /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:1797:50: >> warning: incompatible pointer types passing 'void ()' to parameter of >> type 'void (*)(char *, bool, MAILER *, struct >> : mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types] >> : smtpresult =3D reply(m, mci, e, TimeOuts.to_auth, getsasldata,= NULL, >> : ^~~~~~~~~~~ > > Have you tried the patch I posted here? > > http://lists.freebsd.org/pipermail/freebsd-current/2013-March/040634.html > > If people feel this is the right approach, I am happy to commit it. If > people prefer to just shut up warnings, I am happy with that too. Confirmed. This fixes the build of usr.sbin/sendmail even without the NO_WERROR.clang=3D option. Thanks :-) From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 13:41:19 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D51BB43E; Tue, 16 Apr 2013 13:41:19 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay009.isp.belgacom.be (mailrelay009.isp.belgacom.be [195.238.6.176]) by mx1.freebsd.org (Postfix) with ESMTP id F1054B5B; Tue, 16 Apr 2013 13:41:18 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AocGANFTbVFR8ZLu/2dsb2JhbABQgwY2gzG9VYELF3SCHwEBBSMzIxALFAQJFgsCAgkDAgECASceBg0BBwEBiBQIqhKCQJBDjn4RBwmCJoETA49UgSmHK49xgw06 Received: from 238.146-241-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.241.146.238]) by relay.skynet.be with ESMTP; 16 Apr 2013 15:41:16 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.6/8.14.6) with ESMTP id r3GDfFYR021134; Tue, 16 Apr 2013 15:41:15 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Message-ID: <516D54F5.4010501@FreeBSD.org> Date: Tue, 16 Apr 2013 15:41:09 +0200 From: Tijl Coosemans User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130408 Thunderbird/17.0.5 MIME-Version: 1.0 To: Tim Kientzle Subject: Re: svn commit: r249484 - head/lib References: <201304141913.r3EJDqPI095965@svn.freebsd.org> In-Reply-To: <201304141913.r3EJDqPI095965@svn.freebsd.org> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2NLKUGFSIRFVEBONHBTKX" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 13:41:19 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2NLKUGFSIRFVEBONHBTKX Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2013-04-14 21:13, Tim Kientzle wrote: > Author: kientzle > Date: Sun Apr 14 19:13:51 2013 > New Revision: 249484 > URL: http://svnweb.freebsd.org/changeset/base/249484 >=20 > Log: > Install a symlink > /usr/lib/include =3D=3D> /usr/include > =20 > This fixes -print-file-name=3Dinclude in clang (and is > arguably a better way to fix the same issue in GCC than > the change I made in r231336). > =20 > MFC after: 1 week >=20 > Modified: > head/lib/Makefile >=20 > Modified: head/lib/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/Makefile Sun Apr 14 18:36:30 2013 (r249483) > +++ head/lib/Makefile Sun Apr 14 19:13:51 2013 (r249484) > @@ -252,4 +252,7 @@ _libusbhid=3D libusbhid > _libusb=3D libusb > .endif > =20 > +afterinstall: > + ln -fs ../include ${DESTDIR}/usr/lib/include > + > .include This breaks with -DNO_CLEAN defined, because then ${DESTDIR}/usr/lib/include/include is created. I'm not that fond of this patch by the way, but I don't fully understand the problem it's trying to solve so I won't object. It just looks too much like a hack to me. ------enig2NLKUGFSIRFVEBONHBTKX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iF4EAREIAAYFAlFtVPsACgkQfoCS2CCgtisXIAD/S3CqiTuMctYwQ10yBQ9nzdtZ KBdjA2SEatk1Bky9z/sA/2UUL4besuqrSrzMhidDevnS+/Qvap3XfPuLu23UZl0M =rC1m -----END PGP SIGNATURE----- ------enig2NLKUGFSIRFVEBONHBTKX-- From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 13:44:41 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E0DAD707; Tue, 16 Apr 2013 13:44:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id 6C767BE1; Tue, 16 Apr 2013 13:44:40 +0000 (UTC) Received: from spaceball.andric.com (spaceball.andric.com [IPv6:2001:7b8:3a7:0:204:4bff:fe01:de8a]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id F37FD5C44; Tue, 16 Apr 2013 15:44:37 +0200 (CEST) Message-ID: <516D55C4.1050102@FreeBSD.org> Date: Tue, 16 Apr 2013 15:44:36 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Thunderbird/21.0 MIME-Version: 1.0 To: Bruce Evans Subject: Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail References: <201302162017.r1GKHVdY022667@svn.freebsd.org> <87a9ozayzk.fsf@saturn.laptop> <516D13C5.70900@FreeBSD.org> <20130416205349.W1783@besplex.bde.org> In-Reply-To: <20130416205349.W1783@besplex.bde.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Cc: =?UTF-8?B?zpPOuc+Oz4HOs86/z4IgzprOtc+BzrHOvM6vzrTOsc+C?= , svn-src-head@FreeBSD.org, Gregory Shapiro , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 13:44:42 -0000 On 2013-04-16 13:28, Bruce Evans wrote: > On Tue, 16 Apr 2013, Dimitry Andric wrote: >> On 2013-04-16 06:19, =CE=93=CE=B9=CF=8E=CF=81=CE=B3=CE=BF=CF=82 =CE=9A= =CE=B5=CF=81=CE=B1=CE=BC=CE=AF=CE=B4=CE=B1=CF=82 wrote: =2E.. >>> : cc -O2 -pipe -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/s= rc >>> -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/include -I. -DNEW= DB >>> -DNIS -DTCPWRAPPERS -DMAP_REGEX -DDNSMAP -DNETINET6 -DSTARTTLS -D_FFR= _TLS_1 >>> -I/usr/local/include -DSASL=3D20126 -std=3Dgnu99 -Qunused-arguments >>> -fstack-protector -Wsystem-headers -Wno-pointer-sign -Wno-empty-body >>> -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value >>> -Wno-parentheses-equality -Wno-unused-function -Wno-conversion -Wno-s= witch >>> -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -c >>> /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c >>> : /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:17= 97:50: >>> warning: incompatible pointer types passing 'void ()' to parameter of= type >>> 'void (*)(char *, bool, MAILER *, struct >>> : mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types= ] >>> : smtpresult =3D reply(m, mci, e, TimeOuts.to_auth, getsaslda= ta, >>> NULL, >>> : ^~~~~~~~~~~= =2E.. > stdbool is certainly incompatible with simple use of __P(()), but why d= oes > the error message say that the function type is 'void ()', and why does= n't > it say that the prototype doesn't match the function? Because we pass -Wno-knr-promoted-parameter to suppress the warning. Before clang grew this flag, we had to set NO_WERROR to make it non-fatal. =2E.. > Extending the example a little gives the answer to my question: > > @ #include > @ > @ typedef void vb(bool first); > @ > @ vb foo; > @ void bar(vb *p); > @ > @ void > @ foo(first) > @ bool first; > @ { > @ bar(foo); > @ } > > @ z.c:10:7: warning: promoted type 'int' of K&R function parameter is n= ot compatible with the parameter type 'bool' declared in a previous proto= type [-Wknr-promoted-parameter] > @ bool first; > @ ^ > @ z.c:5:4: note: previous declaration is here > @ vb foo; > @ ^ > @ z.c:12:6: warning: incompatible pointer types passing 'void ()' to pa= rameter of type 'vb *' (aka 'void (*)(bool)') [-Wincompatible-pointer-typ= es] > @ bar(foo); > @ ^~~ > @ z.c:6:14: note: passing argument to parameter 'p' here > @ void bar(vb *p); > @ ^ > @ 2 warnings generated. > > Apparently clang ignores the mismatched prototype after printing a warn= ing > about it, and also throws away the type info that it learns by compilin= g > the K&R function, so it is left with only 'void ()' for the type. Yes, this is basically what happens. The actual definition of the function overrides the prototype, if it comes before the invocation. For example, in the original problem case, the warning could also be worked around by moving the getsasldata() definition to below attemptauth(), where it is invoked. This still counts as cheating, though. :-) From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 14:22:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 64D6426F; Tue, 16 Apr 2013 14:22:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 56793E92; Tue, 16 Apr 2013 14:22:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GEMHA2076532; Tue, 16 Apr 2013 14:22:17 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GEMH8F076531; Tue, 16 Apr 2013 14:22:17 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201304161422.r3GEMH8F076531@svn.freebsd.org> From: Rick Macklem Date: Tue, 16 Apr 2013 14:22:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249548 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 14:22:17 -0000 Author: rmacklem Date: Tue Apr 16 14:22:16 2013 New Revision: 249548 URL: http://svnweb.freebsd.org/changeset/base/249548 Log: Allow the vnode to be unlocked for the weird case of LK_EXCLOTHER. LK_EXCLOTHER is only used to acquire a usecount on a vnode during NFSv4 recovery from an expired lease. Reported and tested by: pho MFC after: 2 weeks Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Tue Apr 16 12:31:16 2013 (r249547) +++ head/sys/kern/vfs_subr.c Tue Apr 16 14:22:16 2013 (r249548) @@ -4123,7 +4123,7 @@ vop_lock_post(void *ap, int rc) struct vop_lock1_args *a = ap; ASSERT_VI_UNLOCKED(a->a_vp, "VOP_LOCK"); - if (rc == 0) + if (rc == 0 && (a->a_flags & LK_EXCLOTHER) == 0) ASSERT_VOP_LOCKED(a->a_vp, "VOP_LOCK"); #endif } From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 14:34:35 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B33D05DE; Tue, 16 Apr 2013 14:34:35 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from tux-cave.hellug.gr (tux-cave.hellug.gr [195.134.99.74]) by mx1.freebsd.org (Postfix) with ESMTP id 199DEF0C; Tue, 16 Apr 2013 14:34:34 +0000 (UTC) X-Spam-Status: No X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-2.9, required 5, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90) X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-ID: r3GEYLZR024559 Received: from saturn.laptop (217-162-217-29.dynamic.hispeed.ch [217.162.217.29]) (authenticated bits=0) by tux-cave.hellug.gr (8.14.3/8.14.3/Debian-9.4) with ESMTP id r3GEYLZR024559 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 16 Apr 2013 17:34:29 +0300 Received: from saturn.laptop (localhost [127.0.0.1]) by saturn.laptop (8.14.4/8.14.4/Debian-2.1ubuntu1) with ESMTP id r3GEYFQK003340 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 16 Apr 2013 16:34:15 +0200 Received: (from keramida@localhost) by saturn.laptop (8.14.4/8.14.4/Submit) id r3GEYEdU003337; Tue, 16 Apr 2013 16:34:14 +0200 X-Authentication-Warning: saturn.laptop: keramida set sender to keramida@ceid.upatras.gr using -f From: keramida@ceid.upatras.gr (Giorgos Keramidas) To: Dimitry Andric Subject: Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail References: <201302162017.r1GKHVdY022667@svn.freebsd.org> <87a9ozayzk.fsf@saturn.laptop> <516D13C5.70900@FreeBSD.org> <20130416205349.W1783@besplex.bde.org> <516D55C4.1050102@FreeBSD.org> Date: Tue, 16 Apr 2013 16:34:14 +0200 In-Reply-To: <516D55C4.1050102@FreeBSD.org> (Dimitry Andric's message of "Tue, 16 Apr 2013 15:44:36 +0200") Message-ID: <87r4iaa6jd.fsf@saturn.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@FreeBSD.org, Gregory Shapiro , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 14:34:35 -0000 On Tue, 16 Apr 2013 15:44:36 +0200, Dimitry Andric wrote: > On 2013-04-16 13:28, Bruce Evans wrote: >> Extending the example a little gives the answer to my question: >> >> @ #include >> @ >> @ typedef void vb(bool first); >> @ >> @ vb foo; >> @ void bar(vb *p); >> @ >> @ void >> @ foo(first) >> @ bool first; >> @ { >> @ bar(foo); >> @ } >> >> @ z.c:10:7: warning: promoted type 'int' of K&R function parameter is >> not compatible with the parameter type 'bool' declared in a previous >> prototype [-Wknr-promoted-parameter] >> @ bool first; >> @ ^ >> @ z.c:5:4: note: previous declaration is here >> @ vb foo; >> @ ^ >> @ z.c:12:6: warning: incompatible pointer types passing 'void ()' to parameter of type 'vb *' (aka 'void (*)(bool)') [-Wincompatible-pointer-types] >> @ bar(foo); >> @ ^~~ >> @ z.c:6:14: note: passing argument to parameter 'p' here >> @ void bar(vb *p); >> @ ^ >> @ 2 warnings generated. >> >> Apparently clang ignores the mismatched prototype after printing a warning >> about it, and also throws away the type info that it learns by compiling >> the K&R function, so it is left with only 'void ()' for the type. > > Yes, this is basically what happens. The actual definition of the > function overrides the prototype, if it comes before the invocation. > > For example, in the original problem case, the warning could also be > worked around by moving the getsasldata() definition to below > attemptauth(), where it is invoked. This still counts as cheating, > though. :-) And that's precisely why other functions, like esmtp_check() do not have the same problem, even though they have exactly the same signature and they are used in the same way! From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 16:39:02 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ACB82E0F; Tue, 16 Apr 2013 16:39:02 +0000 (UTC) (envelope-from gshapiro@freebsd.org) Received: from zim.gshapiro.net (zim.gshapiro.net [IPv6:2001:4f8:3:36::224]) by mx1.freebsd.org (Postfix) with ESMTP id 970DE7E6; Tue, 16 Apr 2013 16:39:02 +0000 (UTC) Received: from rugsucker.smi.sendmail.com (natted.sendmail.com [63.211.143.38]) (authenticated bits=0) by zim.gshapiro.net (8.14.7.Alpha0/8.14.6) with ESMTP id r3GGcoiB082945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Apr 2013 09:38:55 -0700 (PDT) (envelope-from gshapiro@freebsd.org) Date: Tue, 16 Apr 2013 09:38:49 -0700 From: Gregory Shapiro To: Giorgos Keramidas Subject: Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail Message-ID: <20130416163849.GZ681@rugsucker.smi.sendmail.com> References: <201302162017.r1GKHVdY022667@svn.freebsd.org> <87a9ozayzk.fsf@saturn.laptop> <516D13C5.70900@FreeBSD.org> <20130416205349.W1783@besplex.bde.org> <516D55C4.1050102@FreeBSD.org> <87r4iaa6jd.fsf@saturn.laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r4iaa6jd.fsf@saturn.laptop> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Dimitry Andric , Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 16:39:02 -0000 Just a quick comment that I will be committing a fix to the sendmail source tree on FreeBSD to avoid this issue. It will avoid loading stdbool.h when clang is in use, thereby turning all bools to ints. It will be checked in this weekend (currently being tested before release). /* ** SM_CONF_STDBOOL_H is 1 if exists ** ** Note, unlike gcc, clang doesn't apply full prototypes to K&R definitions. */ # ifndef SM_CONF_STDBOOL_H # if !defined(__clang__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L # define SM_CONF_STDBOOL_H 1 # else /* !defined(__clang__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */ # define SM_CONF_STDBOOL_H 0 # endif /* !defined(__clang__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */ # endif /* ! SM_CONF_STDBOOL_H */ From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 16:54:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CA38CB2C; Tue, 16 Apr 2013 16:54:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BCAE08CD; Tue, 16 Apr 2013 16:54:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GGsbPd025653; Tue, 16 Apr 2013 16:54:37 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GGsbi3025652; Tue, 16 Apr 2013 16:54:37 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201304161654.r3GGsbi3025652@svn.freebsd.org> From: Warner Losh Date: Tue, 16 Apr 2013 16:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249551 - head/sys/mips/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 16:54:37 -0000 Author: imp Date: Tue Apr 16 16:54:37 2013 New Revision: 249551 URL: http://svnweb.freebsd.org/changeset/base/249551 Log: Point to regdef.h. May need to dig up references to the N32 standard that support this usage (which may be a bit rough, since different parts of the standard say mutually contradictory things). Modified: head/sys/mips/include/regnum.h Modified: head/sys/mips/include/regnum.h ============================================================================== --- head/sys/mips/include/regnum.h Tue Apr 16 16:35:48 2013 (r249550) +++ head/sys/mips/include/regnum.h Tue Apr 16 16:54:37 2013 (r249551) @@ -125,7 +125,7 @@ /* * Pseudo registers so we save a complete set of registers regardless of - * the ABI + * the ABI. See regdef.h for a more complete explanation. */ #if defined(__mips_n32) || defined(__mips_n64) #define TA0 8 From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 16:59:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DB7E1F54; Tue, 16 Apr 2013 16:59:29 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CE43F8F2; Tue, 16 Apr 2013 16:59:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GGxTno026697; Tue, 16 Apr 2013 16:59:29 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GGxTgW026696; Tue, 16 Apr 2013 16:59:29 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201304161659.r3GGxTgW026696@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 16 Apr 2013 16:59:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249552 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 16:59:29 -0000 Author: tijl Date: Tue Apr 16 16:59:29 2013 New Revision: 249552 URL: http://svnweb.freebsd.org/changeset/base/249552 Log: Fix build after r249543. Modified: head/sys/netinet6/ip6_var.h Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Tue Apr 16 16:54:37 2013 (r249551) +++ head/sys/netinet6/ip6_var.h Tue Apr 16 16:59:29 2013 (r249552) @@ -242,7 +242,7 @@ struct ip6stat { u_quad_t ip6s_sources_deprecated[IP6S_SCOPECNT]; /* number of times that each rule of source selection is applied. */ - u_quad_t ip6s_sources_rule[IP6S_MAXRULES]; + u_quad_t ip6s_sources_rule[IP6S_RULESMAX]; }; #ifdef _KERNEL From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 17:03:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1967B2B4; Tue, 16 Apr 2013 17:03:36 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 09DBA92C; Tue, 16 Apr 2013 17:03:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GH3ZtC029198; Tue, 16 Apr 2013 17:03:35 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GH3Z7W029197; Tue, 16 Apr 2013 17:03:35 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201304161703.r3GH3Z7W029197@svn.freebsd.org> From: Robert Watson Date: Tue, 16 Apr 2013 17:03:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249553 - head/lib/libstand/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 17:03:36 -0000 Author: rwatson Date: Tue Apr 16 17:03:35 2013 New Revision: 249553 URL: http://svnweb.freebsd.org/changeset/base/249553 Log: Adapt libstand's setjmp/longjmp MIPS support to be portable across 32-bit and 64-bit MIPS. Don't use the floating-point coprocessor in the libstand context for MIPS. Reviewed by: imp MFC after: 3 days Sponsored by: DARPA, AFRL Modified: head/lib/libstand/mips/_setjmp.S Modified: head/lib/libstand/mips/_setjmp.S ============================================================================== --- head/lib/libstand/mips/_setjmp.S Tue Apr 16 16:59:29 2013 (r249552) +++ head/lib/libstand/mips/_setjmp.S Tue Apr 16 17:03:35 2013 (r249553) @@ -59,33 +59,20 @@ LEAF(_setjmp) .set noreorder - li v0, 0xACEDBADE # sigcontext magic number - sw ra, (2 * 4)(a0) # sc_pc = return address - sw v0, (3 * 4)(a0) # saved in sc_regs[0] - sw s0, ((S0 + 3) * 4)(a0) - sw s1, ((S1 + 3) * 4)(a0) - sw s2, ((S2 + 3) * 4)(a0) - sw s3, ((S3 + 3) * 4)(a0) - sw s4, ((S4 + 3) * 4)(a0) - sw s5, ((S5 + 3) * 4)(a0) - sw s6, ((S6 + 3) * 4)(a0) - sw s7, ((S7 + 3) * 4)(a0) - sw sp, ((SP + 3) * 4)(a0) - sw s8, ((S8 + 3) * 4)(a0) - cfc1 v0, $31 # too bad cant check if FP used - swc1 $f20, ((20 + 38) * 4)(a0) - swc1 $f21, ((21 + 38) * 4)(a0) - swc1 $f22, ((22 + 38) * 4)(a0) - swc1 $f23, ((23 + 38) * 4)(a0) - swc1 $f24, ((24 + 38) * 4)(a0) - swc1 $f25, ((25 + 38) * 4)(a0) - swc1 $f26, ((26 + 38) * 4)(a0) - swc1 $f27, ((27 + 38) * 4)(a0) - swc1 $f28, ((28 + 38) * 4)(a0) - swc1 $f29, ((29 + 38) * 4)(a0) - swc1 $f30, ((30 + 38) * 4)(a0) - swc1 $f31, ((31 + 38) * 4)(a0) - sw v0, ((32 + 38) * 4)(a0) + REG_LI v0, 0xACEDBADE # sigcontext magic number + REG_S ra, (2 * SZREG)(a0) # sc_pc = return address + REG_S v0, (3 * SZREG)(a0) # saved in sc_regs[0] + REG_S s0, ((S0 + 3) * SZREG)(a0) + REG_S s1, ((S1 + 3) * SZREG)(a0) + REG_S s2, ((S2 + 3) * SZREG)(a0) + REG_S s3, ((S3 + 3) * SZREG)(a0) + REG_S s4, ((S4 + 3) * SZREG)(a0) + REG_S s5, ((S5 + 3) * SZREG)(a0) + REG_S s6, ((S6 + 3) * SZREG)(a0) + REG_S s7, ((S7 + 3) * SZREG)(a0) + REG_S sp, ((SP + 3) * SZREG)(a0) + REG_S s8, ((S8 + 3) * SZREG)(a0) + REG_S v0, ((32 + 38) * SZREG)(a0) j ra move v0, zero END(_setjmp) @@ -96,38 +83,22 @@ LEAF(_longjmp) .cprestore 16 #endif .set noreorder - lw v0, (3 * 4)(a0) # get magic number - lw ra, (2 * 4)(a0) + REG_L v0, (3 * SZREG)(a0) # get magic number + REG_L ra, (2 * SZREG)(a0) bne v0, 0xACEDBADE, botch # jump if error addu sp, sp, 32 # does not matter, sanity - lw s0, ((S0 + 3) * 4)(a0) - lw s1, ((S1 + 3) * 4)(a0) - lw s2, ((S2 + 3) * 4)(a0) - lw s3, ((S3 + 3) * 4)(a0) - lw s4, ((S4 + 3) * 4)(a0) - lw s5, ((S5 + 3) * 4)(a0) - lw s6, ((S6 + 3) * 4)(a0) - lw s7, ((S7 + 3) * 4)(a0) - lw v0, ((32 + 38) * 4)(a0) # get fpu status - lw sp, ((SP + 3) * 4)(a0) - lw s8, ((S8 + 3) * 4)(a0) -/* Octeon does not have an FPU */ -#if !defined(_MIPS_ARCH_OCTEON) - ctc1 v0, $31 - lwc1 $f20, ((20 + 38) * 4)(a0) - lwc1 $f21, ((21 + 38) * 4)(a0) - lwc1 $f22, ((22 + 38) * 4)(a0) - lwc1 $f23, ((23 + 38) * 4)(a0) - lwc1 $f24, ((24 + 38) * 4)(a0) - lwc1 $f25, ((25 + 38) * 4)(a0) - lwc1 $f26, ((26 + 38) * 4)(a0) - lwc1 $f27, ((27 + 38) * 4)(a0) - lwc1 $f28, ((28 + 38) * 4)(a0) - lwc1 $f29, ((29 + 38) * 4)(a0) - lwc1 $f30, ((30 + 38) * 4)(a0) - lwc1 $f31, ((31 + 38) * 4)(a0) -#endif /* _MIPS_ARCH_OCTEON */ + REG_L s0, ((S0 + 3) * SZREG)(a0) + REG_L s1, ((S1 + 3) * SZREG)(a0) + REG_L s2, ((S2 + 3) * SZREG)(a0) + REG_L s3, ((S3 + 3) * SZREG)(a0) + REG_L s4, ((S4 + 3) * SZREG)(a0) + REG_L s5, ((S5 + 3) * SZREG)(a0) + REG_L s6, ((S6 + 3) * SZREG)(a0) + REG_L s7, ((S7 + 3) * SZREG)(a0) + REG_L v0, ((32 + 38) * SZREG)(a0) # get fpu status + REG_L sp, ((SP + 3) * SZREG)(a0) + REG_L s8, ((S8 + 3) * SZREG)(a0) j ra move v0, a1 From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 17:11:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D6C62D1C; Tue, 16 Apr 2013 17:11:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id B3A829C0; Tue, 16 Apr 2013 17:11:32 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 241BAB962; Tue, 16 Apr 2013 13:11:32 -0400 (EDT) From: John Baldwin To: Hiren Panchasara Subject: Re: svn commit: r249461 - head/sys/dev/ips Date: Tue, 16 Apr 2013 12:10:08 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <201304140242.r3E2geSq094403@svn.freebsd.org> In-Reply-To: <201304140242.r3E2geSq094403@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201304161210.09058.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 16 Apr 2013 13:11:32 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 17:11:32 -0000 On Saturday, April 13, 2013 10:42:40 pm Hiren Panchasara wrote: > Author: hiren > Date: Sun Apr 14 02:42:40 2013 > New Revision: 249461 > URL: http://svnweb.freebsd.org/changeset/base/249461 > > Log: > Fixing a clang warning indicating uninitialized variable usage. > > PR: kern/177164 > Approved by: sbruno (mentor) Hmm, I always thought that dmatags and maps were opaque types and not necessarily "known" in consumers to be pointers. (Some drivers do check tehm against NULL implicitly via 'if (map)' or 'if (tag)', but well-behaved drivers use other means (flags, etc.) to know if they are valid.) -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 17:11:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6813FD1E; Tue, 16 Apr 2013 17:11:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id 458C19C1; Tue, 16 Apr 2013 17:11:35 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 90470B976; Tue, 16 Apr 2013 13:11:34 -0400 (EDT) From: John Baldwin To: Bryan Drewery Subject: Re: svn commit: r249489 - head/etc/rc.d Date: Tue, 16 Apr 2013 12:20:45 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <201304142111.r3ELBKRG032133@svn.freebsd.org> In-Reply-To: <201304142111.r3ELBKRG032133@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201304161220.45956.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 16 Apr 2013 13:11:34 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 17:11:35 -0000 On Sunday, April 14, 2013 5:11:20 pm Bryan Drewery wrote: > Author: bdrewery (ports committer) > Date: Sun Apr 14 21:11:19 2013 > New Revision: 249489 > URL: http://svnweb.freebsd.org/changeset/base/249489 > > Log: > Run configtest before restarting so that the system is not > left without a running sshd. > > Approved by: des > MFC after: 1 week > > Modified: > head/etc/rc.d/sshd Maybe do the same for 'reload' as well? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 17:20:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 844F8465; Tue, 16 Apr 2013 17:20:52 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7756BA2B; Tue, 16 Apr 2013 17:20:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GHKqxe035451; Tue, 16 Apr 2013 17:20:52 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GHKq9m035450; Tue, 16 Apr 2013 17:20:52 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201304161720.r3GHKq9m035450@svn.freebsd.org> From: Robert Watson Date: Tue, 16 Apr 2013 17:20:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249554 - head/lib/libstand X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 17:20:52 -0000 Author: rwatson Date: Tue Apr 16 17:20:52 2013 New Revision: 249554 URL: http://svnweb.freebsd.org/changeset/base/249554 Log: Use a suitable code generation when building libstand for MIPS. Reviewed by: imp Sponsored by: DARPA, AFRL MFC after: 3 days Modified: head/lib/libstand/Makefile Modified: head/lib/libstand/Makefile ============================================================================== --- head/lib/libstand/Makefile Tue Apr 16 17:03:35 2013 (r249553) +++ head/lib/libstand/Makefile Tue Apr 16 17:20:52 2013 (r249554) @@ -36,6 +36,9 @@ CFLAGS+= -m32 -I. .if ${MACHINE_CPUARCH} == "arm" CFLAGS+= -msoft-float -D_STANDALONE .endif +.if ${MACHINE_CPUARCH} == "mips" +CFLAGS+= -G0 -fno-pic -mno-abicalls +.endif # standalone components and stuff we have modified locally SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \ From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 17:30:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E5F1792E; Tue, 16 Apr 2013 17:30:13 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D895DA91; Tue, 16 Apr 2013 17:30:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GHUDDO036995; Tue, 16 Apr 2013 17:30:13 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GHUDDt036994; Tue, 16 Apr 2013 17:30:13 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201304161730.r3GHUDDt036994@svn.freebsd.org> From: Bryan Drewery Date: Tue, 16 Apr 2013 17:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249555 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 17:30:14 -0000 Author: bdrewery (ports committer) Date: Tue Apr 16 17:30:13 2013 New Revision: 249555 URL: http://svnweb.freebsd.org/changeset/base/249555 Log: Also call configtest before reload to ensure working config. Approved by: jhb MFC after: 1 week X-MFC-With: r249489 Modified: head/etc/rc.d/sshd Modified: head/etc/rc.d/sshd ============================================================================== --- head/etc/rc.d/sshd Tue Apr 16 17:20:52 2013 (r249554) +++ head/etc/rc.d/sshd Tue Apr 16 17:30:13 2013 (r249555) @@ -14,6 +14,7 @@ rcvar="sshd_enable" command="/usr/sbin/${name}" keygen_cmd="sshd_keygen" start_precmd="sshd_precmd" +reload_precmd="sshd_configtest" restart_precmd="sshd_configtest" configtest_cmd="sshd_configtest" pidfile="/var/run/${name}.pid" From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 17:30:58 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1E0D5AB8 for ; Tue, 16 Apr 2013 17:30:58 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id DFDF7AA2 for ; Tue, 16 Apr 2013 17:30:57 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GHUv1F010747 for ; Tue, 16 Apr 2013 17:30:57 GMT (envelope-from bdrewery@freefall.freebsd.org) Received: (from bdrewery@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r3GHUv3Y010742 for svn-src-head@freebsd.org; Tue, 16 Apr 2013 17:30:57 GMT (envelope-from bdrewery) Received: (qmail 70038 invoked from network); 16 Apr 2013 12:30:56 -0500 Received: from unknown (HELO ?192.168.0.74?) (freebsd@shatow.net@74.94.87.209) by sweb.xzibition.com with ESMTPA; 16 Apr 2013 12:30:56 -0500 Message-ID: <516D8ACA.9080700@FreeBSD.org> Date: Tue, 16 Apr 2013 12:30:50 -0500 From: Bryan Drewery Organization: FreeBSD User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: John Baldwin Subject: Re: svn commit: r249489 - head/etc/rc.d References: <201304142111.r3ELBKRG032133@svn.freebsd.org> <201304161220.45956.jhb@freebsd.org> In-Reply-To: <201304161220.45956.jhb@freebsd.org> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2DQMRRLIKRTBIBGCGUJQC" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 17:30:58 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2DQMRRLIKRTBIBGCGUJQC Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 4/16/2013 11:20 AM, John Baldwin wrote: > On Sunday, April 14, 2013 5:11:20 pm Bryan Drewery wrote: >> Author: bdrewery (ports committer) >> Date: Sun Apr 14 21:11:19 2013 >> New Revision: 249489 >> URL: http://svnweb.freebsd.org/changeset/base/249489 >> >> Log: >> Run configtest before restarting so that the system is not >> left without a running sshd. >> =20 >> Approved by: des >> MFC after: 1 week >> >> Modified: >> head/etc/rc.d/sshd >=20 > Maybe do the same for 'reload' as well? >=20 Done. --=20 Regards, Bryan Drewery ------enig2DQMRRLIKRTBIBGCGUJQC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRbYrTAAoJEG54KsA8mwz5y00P/03qkBe25w6ac9QEs493iNFY a6vRMnkzcUwZpbQ+exWYDyCK+1eKU+J+gcfjrKjpiin5eYDpdJGZYFLf2Nl4EP8x ZB9h5UpWDATrfBErWHUFhOZ3V45JcivKI2gV5e/PmpqDiuecaCcRTqDWCeo7Ixg7 K7vF9kFiapa7P1IOYkupjZWJr3p+iHfEWbnwhf4UOqPk7e4umsxYyoqJoL8ghDYA 4aPrQ63RYHX9FkVn2U/OCLGt1kDSImlClyU8MNKkVj7zkIeY1vp97um5484DuJ1Y 7ydpdfMG78Apda0MUTZnwbZ/fYbStTBo28sZm5BJk+JPz9gB4tXoVeX88u3/5ihj LcJgqI+x6cSrnj/aCn7WYvBmMj4DZFvXaNHDw8fGmYTZnI/p4HB/6FTx22A0Rq4U IrDhqy0cC9R1pb7SLdt0zZdJ6kdkZEy1GZpcYN/G53blEVkF5w82yrMTvELMnLbT TerK2RDxTPRHfQyOB6xT+q/Oyg/7Nix35XH8ADn6BS5hqKexLsyj6BKba9vaSXqC pS5nHWUg4qPk2arJ30phxO+B3dmfEll7SpZJnLjmGS7SRicJOFAUZMiT9FSfu5kj Xicn3BpBITs2vFtT42rTbxRKEM6N461qO7RlqZvy3I1lBRwlJZo6nJbIwlcvtrzq h7V2puMeIvefDnXhldnY =tyZR -----END PGP SIGNATURE----- ------enig2DQMRRLIKRTBIBGCGUJQC-- From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 17:47:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D24E93D7; Tue, 16 Apr 2013 17:47:13 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C5210B3A; Tue, 16 Apr 2013 17:47:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GHlDYN043149; Tue, 16 Apr 2013 17:47:13 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GHlDI7043148; Tue, 16 Apr 2013 17:47:13 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201304161747.r3GHlDI7043148@svn.freebsd.org> From: Brooks Davis Date: Tue, 16 Apr 2013 17:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249556 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 17:47:13 -0000 Author: brooks Date: Tue Apr 16 17:47:13 2013 New Revision: 249556 URL: http://svnweb.freebsd.org/changeset/base/249556 Log: Partial MFP4 of 222836: Only look for FDT partitions if our potential parent is a DISK device. Excluding direct recursion on the flashmap geoms was insufficient because it did not prevent the underlying device from being retrieved if flashmap geoms were further partitioned. Reviewed by: imp Sponsored by: DARPA, AFRL Modified: head/sys/geom/geom_flashmap.c Modified: head/sys/geom/geom_flashmap.c ============================================================================== --- head/sys/geom/geom_flashmap.c Tue Apr 16 17:30:13 2013 (r249555) +++ head/sys/geom/geom_flashmap.c Tue Apr 16 17:47:13 2013 (r249556) @@ -174,7 +174,7 @@ g_flashmap_taste(struct g_class *mp, str g_topology_assert(); if (flags == G_TF_NORMAL && - !strcmp(pp->geom->class->name, FLASHMAP_CLASS_NAME)) + strcmp(pp->geom->class->name, G_DISK_CLASS_NAME) != 0) return (NULL); gp = g_slice_new(mp, FLASH_SLICES_MAX_NUM, pp, &cp, NULL, 0, From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 19:19:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7751F1C9; Tue, 16 Apr 2013 19:19:15 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 693E21108; Tue, 16 Apr 2013 19:19:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GJJFFD072273; Tue, 16 Apr 2013 19:19:15 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GJJF92072268; Tue, 16 Apr 2013 19:19:15 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304161919.r3GJJF92072268@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 16 Apr 2013 19:19:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249558 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 19:19:15 -0000 Author: trociny Date: Tue Apr 16 19:19:14 2013 New Revision: 249558 URL: http://svnweb.freebsd.org/changeset/base/249558 Log: Add a new set of notes to a process core dump to store procstat data. The notes format is a header of sizeof(int), which stores the size of the corresponding data structure to provide some versioning, and data in the format as it is returned by a related sysctl call. The userland tools (procstat(1)) will be taught to extract this data, providing additional info for postmortem analysis. PR: kern/173723 Suggested by: jhb Discussed with: jhb, kib Reviewed by: jhb (initial version), kib MFC after: 1 month Modified: head/sys/kern/imgact_elf.c head/sys/sys/elf_common.h Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Tue Apr 16 17:50:20 2013 (r249557) +++ head/sys/kern/imgact_elf.c Tue Apr 16 19:19:14 2013 (r249558) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -1062,12 +1063,22 @@ static void __elfN(puthdr)(struct thread static void __elfN(putnote)(struct note_info *, struct sbuf *); static size_t register_note(struct note_info_list *, int, outfunc_t, void *); static int sbuf_drain_core_output(void *, const char *, int); +static int sbuf_drain_count(void *arg, const char *data, int len); static void __elfN(note_fpregset)(void *, struct sbuf *, size_t *); static void __elfN(note_prpsinfo)(void *, struct sbuf *, size_t *); static void __elfN(note_prstatus)(void *, struct sbuf *, size_t *); static void __elfN(note_threadmd)(void *, struct sbuf *, size_t *); static void __elfN(note_thrmisc)(void *, struct sbuf *, size_t *); +static void __elfN(note_procstat_auxv)(void *, struct sbuf *, size_t *); +static void __elfN(note_procstat_proc)(void *, struct sbuf *, size_t *); +static void __elfN(note_procstat_psstrings)(void *, struct sbuf *, size_t *); +static void note_procstat_files(void *, struct sbuf *, size_t *); +static void note_procstat_groups(void *, struct sbuf *, size_t *); +static void note_procstat_osrel(void *, struct sbuf *, size_t *); +static void note_procstat_rlimit(void *, struct sbuf *, size_t *); +static void note_procstat_umask(void *, struct sbuf *, size_t *); +static void note_procstat_vmmap(void *, struct sbuf *, size_t *); #ifdef COMPRESS_USER_CORES extern int compress_user_cores; @@ -1113,9 +1124,21 @@ static int sbuf_drain_core_output(void *arg, const char *data, int len) { struct sbuf_drain_core_params *p; - int error; + int error, locked; p = (struct sbuf_drain_core_params *)arg; + + /* + * Some kern_proc out routines that print to this sbuf may + * call us with the process lock held. Draining with the + * non-sleepable lock held is unsafe. The lock is needed for + * those routines when dumping a live process. In our case we + * can safely release the lock before draining and acquire + * again after. + */ + locked = PROC_LOCKED(p->td->td_proc); + if (locked) + PROC_UNLOCK(p->td->td_proc); #ifdef COMPRESS_USER_CORES if (p->gzfile != Z_NULL) error = compress_core(p->gzfile, NULL, __DECONST(char *, data), @@ -1126,12 +1149,27 @@ sbuf_drain_core_output(void *arg, const __DECONST(void *, data), len, p->offset, UIO_SYSSPACE, IO_UNIT | IO_DIRECT, p->active_cred, p->file_cred, NULL, p->td); + if (locked) + PROC_LOCK(p->td->td_proc); if (error != 0) return (-error); p->offset += len; return (len); } +/* + * Drain into a counter. + */ +static int +sbuf_drain_count(void *arg, const char *data __unused, int len) +{ + size_t *sizep; + + sizep = (size_t *)arg; + *sizep += len; + return (len); +} + int __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) { @@ -1436,6 +1474,25 @@ __elfN(prepare_notes)(struct thread *td, thr = TAILQ_NEXT(thr, td_plist); } + size += register_note(list, NT_PROCSTAT_PROC, + __elfN(note_procstat_proc), p); + size += register_note(list, NT_PROCSTAT_FILES, + note_procstat_files, p); + size += register_note(list, NT_PROCSTAT_VMMAP, + note_procstat_vmmap, p); + size += register_note(list, NT_PROCSTAT_GROUPS, + note_procstat_groups, p); + size += register_note(list, NT_PROCSTAT_UMASK, + note_procstat_umask, p); + size += register_note(list, NT_PROCSTAT_RLIMIT, + note_procstat_rlimit, p); + size += register_note(list, NT_PROCSTAT_OSREL, + note_procstat_osrel, p); + size += register_note(list, NT_PROCSTAT_PSSTRINGS, + __elfN(note_procstat_psstrings), p); + size += register_note(list, NT_PROCSTAT_AUXV, + __elfN(note_procstat_auxv), p); + *sizep = size; } @@ -1562,6 +1619,9 @@ typedef struct fpreg32 elf_prfpregset_t; typedef struct fpreg32 elf_fpregset_t; typedef struct reg32 elf_gregset_t; typedef struct thrmisc32 elf_thrmisc_t; +#define ELF_KERN_PROC_MASK KERN_PROC_MASK32 +typedef struct kinfo_proc32 elf_kinfo_proc_t; +typedef uint32_t elf_ps_strings_t; #else typedef prstatus_t elf_prstatus_t; typedef prpsinfo_t elf_prpsinfo_t; @@ -1569,6 +1629,9 @@ typedef prfpregset_t elf_prfpregset_t; typedef prfpregset_t elf_fpregset_t; typedef gregset_t elf_gregset_t; typedef thrmisc_t elf_thrmisc_t; +#define ELF_KERN_PROC_MASK 0 +typedef struct kinfo_proc elf_kinfo_proc_t; +typedef vm_offset_t elf_ps_strings_t; #endif static void @@ -1686,6 +1749,221 @@ __elfN(note_threadmd)(void *arg, struct *sizep = size; } +#ifdef KINFO_PROC_SIZE +CTASSERT(sizeof(struct kinfo_proc) == KINFO_PROC_SIZE); +#endif + +static void +__elfN(note_procstat_proc)(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct proc *p; + size_t size; + int structsize; + + p = (struct proc *)arg; + size = sizeof(structsize) + p->p_numthreads * + sizeof(elf_kinfo_proc_t); + + if (sb != NULL) { + KASSERT(*sizep == size, ("invalid size")); + structsize = sizeof(elf_kinfo_proc_t); + sbuf_bcat(sb, &structsize, sizeof(structsize)); + PROC_LOCK(p); + kern_proc_out(p, sb, ELF_KERN_PROC_MASK); + } + *sizep = size; +} + +#ifdef KINFO_FILE_SIZE +CTASSERT(sizeof(struct kinfo_file) == KINFO_FILE_SIZE); +#endif + +static void +note_procstat_files(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct proc *p; + size_t size; + int structsize; + + p = (struct proc *)arg; + if (sb == NULL) { + size = 0; + sb = sbuf_new(NULL, NULL, 128, SBUF_FIXEDLEN); + sbuf_set_drain(sb, sbuf_drain_count, &size); + sbuf_bcat(sb, &structsize, sizeof(structsize)); + PROC_LOCK(p); + kern_proc_filedesc_out(p, sb, -1); + sbuf_finish(sb); + sbuf_delete(sb); + *sizep = size; + } else { + structsize = sizeof(struct kinfo_file); + sbuf_bcat(sb, &structsize, sizeof(structsize)); + PROC_LOCK(p); + kern_proc_filedesc_out(p, sb, -1); + } +} + +#ifdef KINFO_VMENTRY_SIZE +CTASSERT(sizeof(struct kinfo_vmentry) == KINFO_VMENTRY_SIZE); +#endif + +static void +note_procstat_vmmap(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct proc *p; + size_t size; + int structsize; + + p = (struct proc *)arg; + if (sb == NULL) { + size = 0; + sb = sbuf_new(NULL, NULL, 128, SBUF_FIXEDLEN); + sbuf_set_drain(sb, sbuf_drain_count, &size); + sbuf_bcat(sb, &structsize, sizeof(structsize)); + PROC_LOCK(p); + kern_proc_vmmap_out(p, sb); + sbuf_finish(sb); + sbuf_delete(sb); + *sizep = size; + } else { + structsize = sizeof(struct kinfo_vmentry); + sbuf_bcat(sb, &structsize, sizeof(structsize)); + PROC_LOCK(p); + kern_proc_vmmap_out(p, sb); + } +} + +static void +note_procstat_groups(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct proc *p; + size_t size; + int structsize; + + p = (struct proc *)arg; + size = sizeof(structsize) + p->p_ucred->cr_ngroups * sizeof(gid_t); + if (sb != NULL) { + KASSERT(*sizep == size, ("invalid size")); + structsize = sizeof(gid_t); + sbuf_bcat(sb, &structsize, sizeof(structsize)); + sbuf_bcat(sb, p->p_ucred->cr_groups, p->p_ucred->cr_ngroups * + sizeof(gid_t)); + } + *sizep = size; +} + +static void +note_procstat_umask(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct proc *p; + size_t size; + int structsize; + + p = (struct proc *)arg; + size = sizeof(structsize) + sizeof(p->p_fd->fd_cmask); + if (sb != NULL) { + KASSERT(*sizep == size, ("invalid size")); + structsize = sizeof(p->p_fd->fd_cmask); + sbuf_bcat(sb, &structsize, sizeof(structsize)); + sbuf_bcat(sb, &p->p_fd->fd_cmask, sizeof(p->p_fd->fd_cmask)); + } + *sizep = size; +} + +static void +note_procstat_rlimit(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct proc *p; + struct rlimit rlim[RLIM_NLIMITS]; + size_t size; + int structsize, i; + + p = (struct proc *)arg; + size = sizeof(structsize) + sizeof(rlim); + if (sb != NULL) { + KASSERT(*sizep == size, ("invalid size")); + structsize = sizeof(rlim); + sbuf_bcat(sb, &structsize, sizeof(structsize)); + PROC_LOCK(p); + for (i = 0; i < RLIM_NLIMITS; i++) + lim_rlimit(p, i, &rlim[i]); + PROC_UNLOCK(p); + sbuf_bcat(sb, rlim, sizeof(rlim)); + } + *sizep = size; +} + +static void +note_procstat_osrel(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct proc *p; + size_t size; + int structsize; + + p = (struct proc *)arg; + size = sizeof(structsize) + sizeof(p->p_osrel); + if (sb != NULL) { + KASSERT(*sizep == size, ("invalid size")); + structsize = sizeof(p->p_osrel); + sbuf_bcat(sb, &structsize, sizeof(structsize)); + sbuf_bcat(sb, &p->p_osrel, sizeof(p->p_osrel)); + } + *sizep = size; +} + +static void +__elfN(note_procstat_psstrings)(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct proc *p; + elf_ps_strings_t ps_strings; + size_t size; + int structsize; + + p = (struct proc *)arg; + size = sizeof(structsize) + sizeof(ps_strings); + if (sb != NULL) { + KASSERT(*sizep == size, ("invalid size")); + structsize = sizeof(ps_strings); +#if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32 + ps_strings = PTROUT(p->p_sysent->sv_psstrings); +#else + ps_strings = p->p_sysent->sv_psstrings; +#endif + sbuf_bcat(sb, &structsize, sizeof(structsize)); + sbuf_bcat(sb, &ps_strings, sizeof(ps_strings)); + } + *sizep = size; +} + +static void +__elfN(note_procstat_auxv)(void *arg, struct sbuf *sb, size_t *sizep) +{ + struct proc *p; + size_t size; + int structsize; + + p = (struct proc *)arg; + if (sb == NULL) { + size = 0; + sb = sbuf_new(NULL, NULL, 128, SBUF_FIXEDLEN); + sbuf_set_drain(sb, sbuf_drain_count, &size); + sbuf_bcat(sb, &structsize, sizeof(structsize)); + PHOLD(p); + proc_getauxv(curthread, p, sb); + PRELE(p); + sbuf_finish(sb); + sbuf_delete(sb); + *sizep = size; + } else { + structsize = sizeof(Elf_Auxinfo); + sbuf_bcat(sb, &structsize, sizeof(structsize)); + PHOLD(p); + proc_getauxv(curthread, p, sb); + PRELE(p); + } +} + static boolean_t __elfN(parse_notes)(struct image_params *imgp, Elf_Brandnote *checknote, int32_t *osrel, const Elf_Phdr *pnote) Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Tue Apr 16 17:50:20 2013 (r249557) +++ head/sys/sys/elf_common.h Tue Apr 16 19:19:14 2013 (r249558) @@ -487,6 +487,15 @@ typedef struct { #define NT_FPREGSET 2 /* Floating point registers. */ #define NT_PRPSINFO 3 /* Process state info. */ #define NT_THRMISC 7 /* Thread miscellaneous info. */ +#define NT_PROCSTAT_PROC 8 /* Procstat proc data. */ +#define NT_PROCSTAT_FILES 9 /* Procstat files data. */ +#define NT_PROCSTAT_VMMAP 10 /* Procstat vmmap data. */ +#define NT_PROCSTAT_GROUPS 11 /* Procstat groups data. */ +#define NT_PROCSTAT_UMASK 12 /* Procstat umask data. */ +#define NT_PROCSTAT_RLIMIT 13 /* Procstat rlimit data. */ +#define NT_PROCSTAT_OSREL 14 /* Procstat osreldate data. */ +#define NT_PROCSTAT_PSSTRINGS 15 /* Procstat ps_strings data. */ +#define NT_PROCSTAT_AUXV 16 /* Procstat auxv data. */ /* Symbol Binding - ELFNN_ST_BIND - st_info */ #define STB_LOCAL 0 /* Local symbol */ From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 19:25:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7186976A; Tue, 16 Apr 2013 19:25:42 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 65214119B; Tue, 16 Apr 2013 19:25:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GJPgUr074788; Tue, 16 Apr 2013 19:25:42 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GJPgmh074787; Tue, 16 Apr 2013 19:25:42 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201304161925.r3GJPgmh074787@svn.freebsd.org> From: Xin LI Date: Tue, 16 Apr 2013 19:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249559 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 19:25:42 -0000 Author: delphij Date: Tue Apr 16 19:25:41 2013 New Revision: 249559 URL: http://svnweb.freebsd.org/changeset/base/249559 Log: Don't leak lock when returning. PR: kern/177888 Submitted by: Sven-Thorsten Dietrich MFC after: 1 week Modified: head/sys/netinet/ip_mroute.c Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Tue Apr 16 19:19:14 2013 (r249558) +++ head/sys/netinet/ip_mroute.c Tue Apr 16 19:25:41 2013 (r249559) @@ -824,6 +824,7 @@ set_api_config(uint32_t *apival) for (i = 0; i < mfchashsize; i++) { if (LIST_FIRST(&V_mfchashtbl[i]) != NULL) { + MFC_UNLOCK(); *apival = 0; return EPERM; } From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 19:32:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 71138D1F; Tue, 16 Apr 2013 19:32:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6201C1205; Tue, 16 Apr 2013 19:32:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GJWDqD077441; Tue, 16 Apr 2013 19:32:13 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GJWDEr077440; Tue, 16 Apr 2013 19:32:13 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201304161932.r3GJWDEr077440@svn.freebsd.org> From: Xin LI Date: Tue, 16 Apr 2013 19:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249562 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 19:32:13 -0000 Author: delphij Date: Tue Apr 16 19:32:12 2013 New Revision: 249562 URL: http://svnweb.freebsd.org/changeset/base/249562 Log: Fix incomplete printf. PR: kern/177889 Submitted by: Sven-Thorsten Dietrich MFC after: 1 week Modified: head/sys/netinet/ip_mroute.c Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Tue Apr 16 19:28:00 2013 (r249561) +++ head/sys/netinet/ip_mroute.c Tue Apr 16 19:32:12 2013 (r249562) @@ -2846,7 +2846,8 @@ ip_mroute_modevent(module_t mod, int typ if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, if_detached_event, NULL, EVENTHANDLER_PRI_ANY); if (if_detach_event_tag == NULL) { - printf("ip_mroute: unable to ifnet_deperture_even handler\n"); + printf("ip_mroute: unable to register " + "ifnet_departure_event handler\n"); MROUTER_LOCK_DESTROY(); return (EINVAL); } From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 19:39:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 840DC392; Tue, 16 Apr 2013 19:39:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 668351290; Tue, 16 Apr 2013 19:39:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GJdSaP078550; Tue, 16 Apr 2013 19:39:28 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GJdRdA078548; Tue, 16 Apr 2013 19:39:27 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201304161939.r3GJdRdA078548@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 16 Apr 2013 19:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249563 - in head/cddl/contrib/opensolaris: cmd/dtrace/test/tst/common/print lib/libdtrace/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 19:39:28 -0000 Author: pfg Date: Tue Apr 16 19:39:27 2013 New Revision: 249563 URL: http://svnweb.freebsd.org/changeset/base/249563 Log: DTrace: print() should try to resolve function pointers Merge changes from illumos: 3675 DTrace print() should try to resolve function pointers 3676 dt_print_enum hardcodes a value of zero Illumos Revision: b1fa6326238973aeaf12c34fcda75985b6c06be1 Reference: https://www.illumos.org/issues/3675 https://www.illumos.org/issues/3676 Obtained from: Illumos MFC after: 1 month Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d - copied unchanged from r249443, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d.out - copied unchanged from r249443, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d.out Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d (from r249443, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d Tue Apr 16 19:39:27 2013 (r249563, copy of r249443, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d) @@ -0,0 +1,33 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ +/* + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ + +#pragma D option quiet + +enum simpson { + homer, + marge, + bart, + lisa, + maggie, + snowball_ii, + santas_little_helper +}; + +BEGIN +{ + print(bart); + print((enum simpson)4); + print(snowball_ii); + exit(0); +} Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d.out (from r249443, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d.out Tue Apr 16 19:39:27 2013 (r249563, copy of r249443, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d.out) @@ -0,0 +1,4 @@ +enum simpson bart +enum simpson maggie +enum simpson snowball_ii + Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c Tue Apr 16 19:32:12 2013 (r249562) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c Tue Apr 16 19:39:27 2013 (r249563) @@ -25,6 +25,9 @@ /* * Copyright (c) 2011 by Delphix. All rights reserved. */ +/* + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ /* * DTrace print() action @@ -93,6 +96,7 @@ * Print structure passed down recursively through printing algorithm. */ typedef struct dt_printarg { + dtrace_hdl_t *pa_dtp; /* libdtrace handle */ caddr_t pa_addr; /* base address of trace data */ ctf_file_t *pa_ctfp; /* CTF container */ int pa_depth; /* member depth */ @@ -303,8 +307,8 @@ dt_print_float(ctf_id_t base, ulong_t of } /* - * A pointer is printed as a fixed-size integer. This is used both for - * pointers and functions. + * A pointer is generally printed as a fixed-size integer. If we have a + * function pointer, we try to look up its name. */ static void dt_print_ptr(ctf_id_t base, ulong_t off, dt_printarg_t *pap) @@ -313,8 +317,23 @@ dt_print_ptr(ctf_id_t base, ulong_t off, ctf_file_t *ctfp = pap->pa_ctfp; caddr_t addr = pap->pa_addr + off / NBBY; size_t size = ctf_type_size(ctfp, base); - - dt_print_hex(fp, addr, size); + ctf_id_t bid = ctf_type_reference(ctfp, base); + uint64_t pc; + dtrace_syminfo_t dts; + GElf_Sym sym; + + if (bid == CTF_ERR || ctf_type_kind(ctfp, bid) != CTF_K_FUNCTION) { + dt_print_hex(fp, addr, size); + } else { + /* LINTED - alignment */ + pc = *((uint64_t *)addr); + if (dtrace_lookup_by_addr(pap->pa_dtp, pc, &sym, &dts) != 0) { + dt_print_hex(fp, addr, size); + } else { + (void) fprintf(fp, "%s`%s", dts.dts_object, + dts.dts_name); + } + } } /* @@ -459,8 +478,31 @@ dt_print_enum(ctf_id_t base, ulong_t off FILE *fp = pap->pa_file; ctf_file_t *ctfp = pap->pa_ctfp; const char *ename; + ssize_t size; + caddr_t addr = pap->pa_addr + off / NBBY; int value = 0; + /* + * The C standard says that an enum will be at most the sizeof (int). + * But if all the values are less than that, the compiler can use a + * smaller size. Thanks standards. + */ + size = ctf_type_size(ctfp, base); + switch (size) { + case sizeof (uint8_t): + value = *(uint8_t *)addr; + break; + case sizeof (uint16_t): + value = *(uint16_t *)addr; + break; + case sizeof (int32_t): + value = *(int32_t *)addr; + break; + default: + (void) fprintf(fp, "", (uint_t)size); + return; + } + if ((ename = ctf_enum_name(ctfp, base, value)) != NULL) (void) fprintf(fp, "%s", ename); else @@ -635,6 +677,7 @@ dtrace_print(dtrace_hdl_t *dtp, FILE *fp } /* setup the print structure and kick off the main print routine */ + pa.pa_dtp = dtp; pa.pa_addr = addr; pa.pa_ctfp = dt_module_getctf(dtp, dmp); pa.pa_nest = 0; From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 19:58:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E6E18C8; Tue, 16 Apr 2013 19:58:24 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BFCBC1397; Tue, 16 Apr 2013 19:58:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GJwOYF084816; Tue, 16 Apr 2013 19:58:24 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GJwO2h084815; Tue, 16 Apr 2013 19:58:24 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201304161958.r3GJwO2h084815@svn.freebsd.org> From: Ivan Voras Date: Tue, 16 Apr 2013 19:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249564 - head/sys/geom/label X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 19:58:25 -0000 Author: ivoras Date: Tue Apr 16 19:58:24 2013 New Revision: 249564 URL: http://svnweb.freebsd.org/changeset/base/249564 Log: Fix the buffer-overflow-fixing fixes. Pointy-hat to: me, for not realizing snprintf() is available in kernel. Thanks to: jh, for bringing me the good news of snprintf(), Pawel Worach, for noting that the panic can be provoked in i386 and not in amd64 Modified: head/sys/geom/label/g_label_disk_ident.c Modified: head/sys/geom/label/g_label_disk_ident.c ============================================================================== --- head/sys/geom/label/g_label_disk_ident.c Tue Apr 16 19:39:27 2013 (r249563) +++ head/sys/geom/label/g_label_disk_ident.c Tue Apr 16 19:58:24 2013 (r249564) @@ -40,38 +40,41 @@ __FBSDID("$FreeBSD$"); #define G_LABEL_DISK_IDENT_DIR "diskid" -static char* classes_pass[] = { G_DISK_CLASS_NAME, G_MULTIPATH_CLASS_NAME, NULL }; +static char* classes_pass[] = { G_DISK_CLASS_NAME, G_MULTIPATH_CLASS_NAME, + NULL }; static void g_label_disk_ident_taste(struct g_consumer *cp, char *label, size_t size) { struct g_class *cls; char ident[100]; - int ident_len = sizeof(ident); + int ident_len, found, i; g_topology_assert_not(); label[0] = '\0'; cls = cp->provider->geom->class; - /* Get the GEOM::ident string and construct a label in the format CLASS_NAME-ident */ + /* + * Get the GEOM::ident string, and construct a label in the format + * "CLASS_NAME-ident" + */ + ident_len = sizeof(ident); if (g_io_getattr("GEOM::ident", cp, &ident_len, ident) == 0) { - int i, found = 0; - if (ident_len == 0 || ident[0] == '\0') return; - for (i = 0; classes_pass[i] != NULL; i++) - if (strcmp(classes_pass[i], cls->name) == 0) + for (i = 0, found = 0; classes_pass[i] != NULL; i++) + if (strcmp(classes_pass[i], cls->name) == 0) { found = 1; + break; + } if (!found) return; - if (strlen(cls->name) + ident_len + 2 > size) - ident[ident_len - strlen(cls->name) - 2] = '\0'; - else - ident[ident_len] = '\0'; - strcpy(label, cls->name); - strcat(label, "-"); - strcat(label, ident); + /* + * We can safely ignore the result of strncpy; the label will + * simply be truncated, which at most is only annoying. + */ + (void)snprintf(label, size, "%s-%s", cls->name, ident); } } @@ -81,4 +84,5 @@ struct g_label_desc g_label_disk_ident = .ld_enabled = 1 }; -G_LABEL_INIT(disk_ident, g_label_disk_ident, "Create device nodes for drives which export a disk identification string"); +G_LABEL_INIT(disk_ident, g_label_disk_ident, "Create device nodes for drives " + "which export a disk identification string"); From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 20:01:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4346E377; Tue, 16 Apr 2013 20:01:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id 07D2213C5; Tue, 16 Apr 2013 20:01:30 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::b037:d3c5:d0df:2e6b] (unknown [IPv6:2001:7b8:3a7:0:b037:d3c5:d0df:2e6b]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 39C8E5C44; Tue, 16 Apr 2013 22:01:28 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: svn commit: r249564 - head/sys/geom/label From: Dimitry Andric In-Reply-To: <201304161958.r3GJwO2h084815@svn.freebsd.org> Date: Tue, 16 Apr 2013 22:01:21 +0200 Content-Transfer-Encoding: 7bit Message-Id: References: <201304161958.r3GJwO2h084815@svn.freebsd.org> To: Ivan Voras X-Mailer: Apple Mail (2.1503) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 20:01:31 -0000 On Apr 16, 2013, at 21:58, Ivan Voras wrote: > Author: ivoras > Date: Tue Apr 16 19:58:24 2013 > New Revision: 249564 > URL: http://svnweb.freebsd.org/changeset/base/249564 > > Log: > Fix the buffer-overflow-fixing fixes. ... > + /* > + * We can safely ignore the result of strncpy; the label will > + * simply be truncated, which at most is only annoying. > + */ > + (void)snprintf(label, size, "%s-%s", cls->name, ident); s/strncpy/snprintf/ ? :-) From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 20:21:03 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 238C911D; Tue, 16 Apr 2013 20:21:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 04B3D15AB; Tue, 16 Apr 2013 20:21:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GKL2Ow093087; Tue, 16 Apr 2013 20:21:02 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GKL2M4093082; Tue, 16 Apr 2013 20:21:02 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304162021.r3GKL2M4093082@svn.freebsd.org> From: Adrian Chadd Date: Tue, 16 Apr 2013 20:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249565 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 20:21:03 -0000 Author: adrian Date: Tue Apr 16 20:21:02 2013 New Revision: 249565 URL: http://svnweb.freebsd.org/changeset/base/249565 Log: Use a per-RX-queue deferred list, rather than a single deferred list for both queues. Since ath_rx_pkt() does multi-mbuf frame recombining based on the RX queue, this needs to occur. Tested: * AR9380 (XB112), hostap mode Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_rx_edma.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Apr 16 19:58:24 2013 (r249564) +++ head/sys/dev/ath/if_ath.c Tue Apr 16 20:21:02 2013 (r249565) @@ -842,7 +842,8 @@ ath_attach(u_int16_t devid, struct ath_s /* * Initialise the deferred completed RX buffer list. */ - TAILQ_INIT(&sc->sc_rx_rxlist); + TAILQ_INIT(&sc->sc_rx_rxlist[HAL_RX_QUEUE_HP]); + TAILQ_INIT(&sc->sc_rx_rxlist[HAL_RX_QUEUE_LP]); /* * Indicate we need the 802.11 header padded to a Modified: head/sys/dev/ath/if_ath_rx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_rx_edma.c Tue Apr 16 19:58:24 2013 (r249564) +++ head/sys/dev/ath/if_ath_rx_edma.c Tue Apr 16 20:21:02 2013 (r249565) @@ -398,7 +398,7 @@ ath_edma_recv_proc_queue(struct ath_soft * queue. */ re->m_fifo[re->m_fifo_head] = NULL; - TAILQ_INSERT_TAIL(&sc->sc_rx_rxlist, bf, bf_list); + TAILQ_INSERT_TAIL(&sc->sc_rx_rxlist[qtype], bf, bf_list); /* Bump the descriptor FIFO stats */ INCR(re->m_fifo_head, re->m_fifolen); @@ -451,8 +451,15 @@ ath_edma_flush_deferred_queue(struct ath struct ath_buf *bf, *next; ATH_RX_LOCK_ASSERT(sc); + /* Free in one set, inside the lock */ - TAILQ_FOREACH_SAFE(bf, &sc->sc_rx_rxlist, bf_list, next) { + TAILQ_FOREACH_SAFE(bf, + &sc->sc_rx_rxlist[HAL_RX_QUEUE_LP], bf_list, next) { + /* Free the buffer/mbuf */ + ath_edma_rxbuf_free(sc, bf); + } + TAILQ_FOREACH_SAFE(bf, + &sc->sc_rx_rxlist[HAL_RX_QUEUE_HP], bf_list, next) { /* Free the buffer/mbuf */ ath_edma_rxbuf_free(sc, bf); } @@ -482,7 +489,7 @@ ath_edma_recv_proc_deferred_queue(struct /* Copy the list over */ ATH_RX_LOCK(sc); - TAILQ_CONCAT(&rxlist, &sc->sc_rx_rxlist, bf_list); + TAILQ_CONCAT(&rxlist, &sc->sc_rx_rxlist[qtype], bf_list); ATH_RX_UNLOCK(sc); /* Handle the completed descriptors */ Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Tue Apr 16 19:58:24 2013 (r249564) +++ head/sys/dev/ath/if_athvar.h Tue Apr 16 20:21:02 2013 (r249565) @@ -542,6 +542,7 @@ struct ath_softc { struct ath_rx_methods sc_rx; struct ath_rx_edma sc_rxedma[HAL_NUM_RX_QUEUES]; /* HP/LP queues */ + ath_bufhead sc_rx_rxlist[HAL_NUM_RX_QUEUES]; /* deferred RX completion */ struct ath_tx_methods sc_tx; struct ath_tx_edma_fifo sc_txedma[HAL_NUM_TX_QUEUES]; @@ -700,7 +701,6 @@ struct ath_softc { struct ath_descdma sc_rxdma; /* RX descriptors */ ath_bufhead sc_rxbuf; /* receive buffer */ - ath_bufhead sc_rx_rxlist; /* deferred RX completion */ u_int32_t *sc_rxlink; /* link ptr in last RX desc */ struct task sc_rxtask; /* rx int processing */ u_int8_t sc_defant; /* current default antenna */ From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 20:26:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 05C422EB; Tue, 16 Apr 2013 20:26:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EC1DB15D1; Tue, 16 Apr 2013 20:26:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GKQV7J093878; Tue, 16 Apr 2013 20:26:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GKQVgs093874; Tue, 16 Apr 2013 20:26:31 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201304162026.r3GKQVgs093874@svn.freebsd.org> From: John Baldwin Date: Tue, 16 Apr 2013 20:26:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249566 - in head: lib/libc/gen sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 20:26:32 -0000 Author: jhb Date: Tue Apr 16 20:26:31 2013 New Revision: 249566 URL: http://svnweb.freebsd.org/changeset/base/249566 Log: - Document that sem_wait() can fail with EINTR if it is interrupted by a signal. - Fix the old ksem implementation for POSIX semaphores to not restart sem_wait() or sem_timedwait() if interrupted by a signal. MFC after: 1 week Modified: head/lib/libc/gen/sem_wait.3 head/sys/kern/uipc_sem.c Modified: head/lib/libc/gen/sem_wait.3 ============================================================================== --- head/lib/libc/gen/sem_wait.3 Tue Apr 16 20:21:02 2013 (r249565) +++ head/lib/libc/gen/sem_wait.3 Tue Apr 16 20:26:31 2013 (r249566) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2000 +.Dd April 16, 2013 .Dt SEM_WAIT 3 .Os .Sh NAME @@ -75,6 +75,14 @@ points to an invalid semaphore. .El .Pp Additionally, +.Fn sem_wait +will fail if: +.Bl -tag -width Er +.Pp +.It Bq Er EINTR +A signal interrupted this function. +.El +Additionally, .Fn sem_trywait will fail if: .Bl -tag -width Er Modified: head/sys/kern/uipc_sem.c ============================================================================== --- head/sys/kern/uipc_sem.c Tue Apr 16 20:21:02 2013 (r249565) +++ head/sys/kern/uipc_sem.c Tue Apr 16 20:26:31 2013 (r249566) @@ -846,6 +846,8 @@ kern_sem_wait(struct thread *td, semid_t err: mtx_unlock(&sem_lock); fdrop(fp, td); + if (error == ERESTART) + error = EINTR; DP(("<<< kern_sem_wait leaving, pid=%d, error = %d\n", (int)td->td_proc->p_pid, error)); return (error); From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 20:31:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A7AEC5B4; Tue, 16 Apr 2013 20:31:15 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8145515FA; Tue, 16 Apr 2013 20:31:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GKVFw1096224; Tue, 16 Apr 2013 20:31:15 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GKVFjN096223; Tue, 16 Apr 2013 20:31:15 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201304162031.r3GKVFjN096223@svn.freebsd.org> From: Joel Dahl Date: Tue, 16 Apr 2013 20:31:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249567 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 20:31:15 -0000 Author: joel (doc committer) Date: Tue Apr 16 20:31:15 2013 New Revision: 249567 URL: http://svnweb.freebsd.org/changeset/base/249567 Log: mdoc: remove superfluous paragraph macro. Modified: head/lib/libc/gen/sem_wait.3 Modified: head/lib/libc/gen/sem_wait.3 ============================================================================== --- head/lib/libc/gen/sem_wait.3 Tue Apr 16 20:26:31 2013 (r249566) +++ head/lib/libc/gen/sem_wait.3 Tue Apr 16 20:31:15 2013 (r249567) @@ -78,7 +78,6 @@ Additionally, .Fn sem_wait will fail if: .Bl -tag -width Er -.Pp .It Bq Er EINTR A signal interrupted this function. .El From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 20:36:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C0DFB89B; Tue, 16 Apr 2013 20:36:32 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B1331163B; Tue, 16 Apr 2013 20:36:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GKaWET096983; Tue, 16 Apr 2013 20:36:32 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GKaWqH096982; Tue, 16 Apr 2013 20:36:32 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304162036.r3GKaWqH096982@svn.freebsd.org> From: Adrian Chadd Date: Tue, 16 Apr 2013 20:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249568 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 20:36:32 -0000 Author: adrian Date: Tue Apr 16 20:36:32 2013 New Revision: 249568 URL: http://svnweb.freebsd.org/changeset/base/249568 Log: Implement a utility function to return the current TX power cap for the given node. This takes into account the per-node cap, the ic cap and the per-channel regulatory caps. This is designed to replace references to ni_txpower in various net80211 drivers - ni_txpower doesn't necessarily reflect the actual cap for the given node (eg if the node has the default value of 50dBm (100) and the administrator has manually configured a lower TX power.) Modified: head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Tue Apr 16 20:31:15 2013 (r249567) +++ head/sys/net80211/ieee80211_var.h Tue Apr 16 20:36:32 2013 (r249568) @@ -822,6 +822,28 @@ ieee80211_htchanflags(const struct ieee8 } /* + * Fetch the current TX power (cap) for the given node. + * + * This includes the node and ic/vap TX power limit as needed, + * but it doesn't take into account any per-rate limit. + */ +static __inline uint16_t +ieee80211_get_node_txpower(struct ieee80211_node *ni) +{ + struct ieee80211com *ic = ni->ni_ic; + uint16_t txpower; + + txpower = ni->ni_txpower; + txpower = MIN(txpower, ic->ic_txpowlimit); + if (ic->ic_curchan != NULL) { + txpower = MIN(txpower, 2 * ic->ic_curchan->ic_maxregpower); + txpower = MIN(txpower, ic->ic_curchan->ic_maxpower); + } + + return (txpower); +} + +/* * Debugging facilities compiled in when IEEE80211_DEBUG is defined. * * The intent is that any problem in the net80211 layer can be From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 21:15:07 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 95A12B01; Tue, 16 Apr 2013 21:15:07 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 1724217CB; Tue, 16 Apr 2013 21:15:07 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 2E0CC359319; Tue, 16 Apr 2013 23:15:04 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 150292848C; Tue, 16 Apr 2013 23:15:04 +0200 (CEST) Date: Tue, 16 Apr 2013 23:15:03 +0200 From: Jilles Tjoelker To: John Baldwin Subject: Re: svn commit: r249566 - in head: lib/libc/gen sys/kern Message-ID: <20130416211503.GA1025@stack.nl> References: <201304162026.r3GKQVgs093874@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201304162026.r3GKQVgs093874@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 21:15:07 -0000 On Tue, Apr 16, 2013 at 08:26:31PM +0000, John Baldwin wrote: > Author: jhb > Date: Tue Apr 16 20:26:31 2013 > New Revision: 249566 > URL: http://svnweb.freebsd.org/changeset/base/249566 > Log: > - Document that sem_wait() can fail with EINTR if it is interrupted by a > signal. > - Fix the old ksem implementation for POSIX semaphores to not restart > sem_wait() or sem_timedwait() if interrupted by a signal. > MFC after: 1 week > Modified: > head/lib/libc/gen/sem_wait.3 > head/sys/kern/uipc_sem.c > Modified: head/lib/libc/gen/sem_wait.3 > ============================================================================== > --- head/lib/libc/gen/sem_wait.3 Tue Apr 16 20:21:02 2013 (r249565) > +++ head/lib/libc/gen/sem_wait.3 Tue Apr 16 20:26:31 2013 (r249566) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd February 15, 2000 > +.Dd April 16, 2013 > .Dt SEM_WAIT 3 > .Os > .Sh NAME > @@ -75,6 +75,14 @@ points to an invalid semaphore. > .El > .Pp > Additionally, > +.Fn sem_wait > +will fail if: > +.Bl -tag -width Er > +.Pp > +.It Bq Er EINTR > +A signal interrupted this function. > +.El > +Additionally, > .Fn sem_trywait > will fail if: > .Bl -tag -width Er > > Modified: head/sys/kern/uipc_sem.c > ============================================================================== > --- head/sys/kern/uipc_sem.c Tue Apr 16 20:21:02 2013 (r249565) > +++ head/sys/kern/uipc_sem.c Tue Apr 16 20:26:31 2013 (r249566) > @@ -846,6 +846,8 @@ kern_sem_wait(struct thread *td, semid_t > err: > mtx_unlock(&sem_lock); > fdrop(fp, td); > + if (error == ERESTART) > + error = EINTR; > DP(("<<< kern_sem_wait leaving, pid=%d, error = %d\n", > (int)td->td_proc->p_pid, error)); > return (error); It would normally be expected (and required by POSIX) that a signal with SA_RESTART set does not cause a function to fail with [EINTR], so more rationale is needed here. Also, the timeouts passed to these functions are absolute and also are at the system call level except UMTX_OP_SEM_WAIT which can take a relative or an absolute timeout but libc passed it an absolute timeout. So there is no need for a caller to see [EINTR] to avoid overlong timeouts. Given the number of times people call sem_wait() without checking the return value, call sem_wait() and assume any error is fatal or call sem_timedwait() and assume any error is a timeout, I think it may be better to go the other way and never fail with [EINTR], just like the pthread functions. POSIX explicitly permits this: the [EINTR] error for sem_wait(), sem_trywait() and sem_timedwait() is "may fail" rather than the usual "shall fail" (note that SA_RESTART overrides such a "shall fail" unless there is a relative timeout or it is explicitly excluded with the function). I realize that this reduces functionality, but relying on [EINTR] here introduces a race condition anyway (because the signal handler may be called just before sem_wait() blocks). I suggest pthread cancellation, not returning from the signal handler or leaving the default action in place (if it is termination). The racy functionality can be kept by leaving [EINTR] and [ERESTART] from the sleep function as they are except for changing [ERESTART] to [EINTR] when UMTX_OP_SEM_WAIT was passed a relative timeout. Breakage in programs that check sem_wait()'s return value incorrectly will then be less frequent and only present when POSIX permits it. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 21:26:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 67D476F; Tue, 16 Apr 2013 21:26:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 408BB184C; Tue, 16 Apr 2013 21:26:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GLQj5f014321; Tue, 16 Apr 2013 21:26:45 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GLQixY014319; Tue, 16 Apr 2013 21:26:44 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304162126.r3GLQixY014319@svn.freebsd.org> From: Adrian Chadd Date: Tue, 16 Apr 2013 21:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249569 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 21:26:45 -0000 Author: adrian Date: Tue Apr 16 21:26:44 2013 New Revision: 249569 URL: http://svnweb.freebsd.org/changeset/base/249569 Log: Use the new net80211 method to fetch the node TX power, rather than directly referencing ni->ni_txpower. This provides the hardware with a slightly more accurate idea of the maximum TX power to be using. This is part of a series to get per-packet TPC to work (better). Tested: * AR5416, hostap mode Modified: head/sys/dev/ath/if_ath_beacon.c head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_beacon.c ============================================================================== --- head/sys/dev/ath/if_ath_beacon.c Tue Apr 16 20:36:32 2013 (r249568) +++ head/sys/dev/ath/if_ath_beacon.c Tue Apr 16 21:26:44 2013 (r249569) @@ -322,7 +322,7 @@ ath_beacon_setup(struct ath_softc *sc, s , m->m_len + IEEE80211_CRC_LEN /* frame length */ , sizeof(struct ieee80211_frame)/* header length */ , HAL_PKT_TYPE_BEACON /* Atheros packet type */ - , ni->ni_txpower /* txpower XXX */ + , ieee80211_get_node_txpower(ni) /* txpower XXX */ , rate, 1 /* series 0 rate/tries */ , HAL_TXKEYIX_INVALID /* no encryption */ , antenna /* antenna mode */ Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Tue Apr 16 20:36:32 2013 (r249568) +++ head/sys/dev/ath/if_ath_tx.c Tue Apr 16 21:26:44 2013 (r249569) @@ -1722,7 +1722,7 @@ ath_tx_normal_setup(struct ath_softc *sc if (isfrag) sc->sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_FRAG; sc->sc_tx_th.wt_rate = sc->sc_hwmap[rix].ieeerate; - sc->sc_tx_th.wt_txpower = ni->ni_txpower; + sc->sc_tx_th.wt_txpower = ieee80211_get_node_txpower(ni); sc->sc_tx_th.wt_antenna = sc->sc_txantenna; ieee80211_radiotap_tx(vap, m0); @@ -1743,7 +1743,7 @@ ath_tx_normal_setup(struct ath_softc *sc bf->bf_state.bfs_pktlen = pktlen; bf->bf_state.bfs_hdrlen = hdrlen; bf->bf_state.bfs_atype = atype; - bf->bf_state.bfs_txpower = ni->ni_txpower; + bf->bf_state.bfs_txpower = ieee80211_get_node_txpower(ni); bf->bf_state.bfs_txrate0 = txrate; bf->bf_state.bfs_try0 = try0; bf->bf_state.bfs_keyix = keyix; @@ -2088,7 +2088,8 @@ ath_tx_raw_start(struct ath_softc *sc, s if (m0->m_flags & M_FRAG) sc->sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_FRAG; sc->sc_tx_th.wt_rate = sc->sc_hwmap[rix].ieeerate; - sc->sc_tx_th.wt_txpower = ni->ni_txpower; + sc->sc_tx_th.wt_txpower = MIN(params->ibp_power, + ieee80211_get_node_txpower(ni)); sc->sc_tx_th.wt_antenna = sc->sc_txantenna; ieee80211_radiotap_tx(vap, m0); @@ -2104,7 +2105,8 @@ ath_tx_raw_start(struct ath_softc *sc, s bf->bf_state.bfs_pktlen = pktlen; bf->bf_state.bfs_hdrlen = hdrlen; bf->bf_state.bfs_atype = atype; - bf->bf_state.bfs_txpower = params->ibp_power; + bf->bf_state.bfs_txpower = MIN(params->ibp_power, + ieee80211_get_node_txpower(ni)); bf->bf_state.bfs_txrate0 = txrate; bf->bf_state.bfs_try0 = try0; bf->bf_state.bfs_keyix = keyix; From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 22:09:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F0A52C5B; Tue, 16 Apr 2013 22:09:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E3A2A1B38; Tue, 16 Apr 2013 22:09:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GM98BQ026880; Tue, 16 Apr 2013 22:09:08 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GM98RO026879; Tue, 16 Apr 2013 22:09:08 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201304162209.r3GM98RO026879@svn.freebsd.org> From: Warner Losh Date: Tue, 16 Apr 2013 22:09:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249570 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 22:09:09 -0000 Author: imp Date: Tue Apr 16 22:09:08 2013 New Revision: 249570 URL: http://svnweb.freebsd.org/changeset/base/249570 Log: r249408 and r249436 cause a NULL pointer dereference on the CUBIEBOARD since it doesn't set the kernel envrionment at all. Work around this by making sure kern_envp is non-NULL before dereferencing it. Modified: head/sys/kern/kern_environment.c Modified: head/sys/kern/kern_environment.c ============================================================================== --- head/sys/kern/kern_environment.c Tue Apr 16 21:26:44 2013 (r249569) +++ head/sys/kern/kern_environment.c Tue Apr 16 22:09:08 2013 (r249570) @@ -231,7 +231,7 @@ init_dynamic_kenv(void *data __unused) kenvp = malloc((KENV_SIZE + 1) * sizeof(char *), M_KENV, M_WAITOK | M_ZERO); i = 0; - if (*kern_envp != '\0') { + if (kern_envp && *kern_envp != '\0') { for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) { len = strlen(cp) + 1; if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) { From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 22:42:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 53F034EC; Tue, 16 Apr 2013 22:42:41 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 46C4E1C9E; Tue, 16 Apr 2013 22:42:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GMgfXj038152; Tue, 16 Apr 2013 22:42:41 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3GMgf8k038151; Tue, 16 Apr 2013 22:42:41 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201304162242.r3GMgf8k038151@svn.freebsd.org> From: Ivan Voras Date: Tue, 16 Apr 2013 22:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249571 - head/sys/geom/label X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 22:42:41 -0000 Author: ivoras Date: Tue Apr 16 22:42:40 2013 New Revision: 249571 URL: http://svnweb.freebsd.org/changeset/base/249571 Log: Comment typo fix. Is aware of the importance of comments: dim Modified: head/sys/geom/label/g_label_disk_ident.c Modified: head/sys/geom/label/g_label_disk_ident.c ============================================================================== --- head/sys/geom/label/g_label_disk_ident.c Tue Apr 16 22:09:08 2013 (r249570) +++ head/sys/geom/label/g_label_disk_ident.c Tue Apr 16 22:42:40 2013 (r249571) @@ -71,8 +71,8 @@ g_label_disk_ident_taste(struct g_consum if (!found) return; /* - * We can safely ignore the result of strncpy; the label will - * simply be truncated, which at most is only annoying. + * We can safely ignore the result of snprintf(): the label + * will simply be truncated, which at most is only annoying. */ (void)snprintf(label, size, "%s-%s", cls->name, ident); } From owner-svn-src-head@FreeBSD.ORG Tue Apr 16 22:44:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E9FFC6A6; Tue, 16 Apr 2013 22:44:01 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx1.freebsd.org (Postfix) with ESMTP id 72BB91CAE; Tue, 16 Apr 2013 22:44:00 +0000 (UTC) Received: by mail-ve0-f169.google.com with SMTP id d10so948174vea.0 for ; Tue, 16 Apr 2013 15:43:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=entza7VvV6xA/2cRae4rz7UqexxuZYr/C29yW0+lQLA=; b=dKRTUlK3um+EgqNK6Y8jIZoXBZQX+GThjHsaXFitHlB+mNoCq1QGR+3R4Mu3dmep2m z6psFlUzP0jQAPlAIKgpK5LnUb+YyQP06Z3C8KO9jyS7RRA8Rrtwu5M7dJFHBlF2PIKK pgwRtuQM2ioZr06sWjUQF+uRheyaEd15eg8bYOFYiSdYcbgDiOAGotkbVs4q73if0c9W 9dHGfO1UigIbSxqmRfUmzDpOqk77ciMn9NIrGcCa+Iy3u4Ht7Pg2cnjH+J4lMZITXpJZ EMRY+2RIrG1hvtQDmdnRqInn1xQq3aYTcOn2b1Xe4IckZO9WxxIvDWZjV1hPP3KRLxim 97wg== X-Received: by 10.52.99.67 with SMTP id eo3mr2676430vdb.21.1366152234115; Tue, 16 Apr 2013 15:43:54 -0700 (PDT) MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.58.34.162 with HTTP; Tue, 16 Apr 2013 15:43:13 -0700 (PDT) In-Reply-To: References: <201304161958.r3GJwO2h084815@svn.freebsd.org> From: Ivan Voras Date: Wed, 17 Apr 2013 00:43:13 +0200 X-Google-Sender-Auth: BlLAcfVy7RhbSoA8TUbR7ehZT8E Message-ID: Subject: Re: svn commit: r249564 - head/sys/geom/label To: Dimitry Andric Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 22:44:02 -0000 On 16 April 2013 22:01, Dimitry Andric wrote: > On Apr 16, 2013, at 21:58, Ivan Voras wrote: >> Author: ivoras >> Date: Tue Apr 16 19:58:24 2013 >> New Revision: 249564 >> URL: http://svnweb.freebsd.org/changeset/base/249564 >> >> Log: >> Fix the buffer-overflow-fixing fixes. > ... >> + /* >> + * We can safely ignore the result of strncpy; the label will >> + * simply be truncated, which at most is only annoying. >> + */ >> + (void)snprintf(label, size, "%s-%s", cls->name, ident); > > s/strncpy/snprintf/ ? :-) The typo fairy is strong this day :) Thanks! From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 02:03:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4E9E782E; Wed, 17 Apr 2013 02:03:13 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 27A2F2D3; Wed, 17 Apr 2013 02:03:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3H23DCj099294; Wed, 17 Apr 2013 02:03:13 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3H23D1r099293; Wed, 17 Apr 2013 02:03:13 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201304170203.r3H23D1r099293@svn.freebsd.org> From: Neel Natu Date: Wed, 17 Apr 2013 02:03:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249572 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 02:03:13 -0000 Author: neel Date: Wed Apr 17 02:03:12 2013 New Revision: 249572 URL: http://svnweb.freebsd.org/changeset/base/249572 Log: Setup accesses to the memory hole below 4GB to return all 1's on read and consume all writes without any side effects. Obtained from: NetApp Modified: head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Tue Apr 16 22:42:40 2013 (r249571) +++ head/usr.sbin/bhyve/pci_emul.c Wed Apr 17 02:03:12 2013 (r249572) @@ -88,8 +88,6 @@ static struct lirqinfo { SET_DECLARE(pci_devemu_set, struct pci_devemu); -static uint32_t pci_hole_startaddr; - static uint64_t pci_emul_iobase; static uint64_t pci_emul_membase32; static uint64_t pci_emul_membase64; @@ -977,13 +975,12 @@ init_pci(struct vmctx *ctx) struct mem_range memp; struct pci_devemu *pde; struct slotinfo *si; + size_t lowmem; int slot, func; int error; - pci_hole_startaddr = vm_get_lowmem_limit(ctx); - pci_emul_iobase = PCI_EMUL_IOBASE; - pci_emul_membase32 = pci_hole_startaddr; + pci_emul_membase32 = vm_get_lowmem_limit(ctx); pci_emul_membase64 = PCI_EMUL_MEMBASE64; for (slot = 0; slot < MAXSLOTS; slot++) { @@ -1010,14 +1007,23 @@ init_pci(struct vmctx *ctx) lirq[15].li_generic = 1; /* - * Setup the PCI hole to return 0xff's when accessed in a region - * with no devices + * The guest physical memory map looks like the following: + * [0, lowmem) guest system memory + * [lowmem, lowmem_limit) memory hole (may be absent) + * [lowmem_limit, 4GB) PCI hole (32-bit BAR allocation) + * [4GB, 4GB + highmem) + * + * Accesses to memory addresses that are not allocated to system + * memory or PCI devices return 0xff's. */ + error = vm_get_memory_seg(ctx, 0, &lowmem); + assert(error == 0); + memset(&memp, 0, sizeof(struct mem_range)); memp.name = "PCI hole"; memp.flags = MEM_F_RW; - memp.base = pci_hole_startaddr; - memp.size = (4ULL * 1024 * 1024 * 1024) - pci_hole_startaddr; + memp.base = lowmem; + memp.size = (4ULL * 1024 * 1024 * 1024) - lowmem; memp.handler = pci_emul_fallback_handler; error = register_mem_fallback(&memp); From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 02:20:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 76748A87; Wed, 17 Apr 2013 02:20:20 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6632B342; Wed, 17 Apr 2013 02:20:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3H2KK1k004970; Wed, 17 Apr 2013 02:20:20 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3H2KHIb004949; Wed, 17 Apr 2013 02:20:17 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201304170220.r3H2KHIb004949@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 17 Apr 2013 02:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249573 - in head: cddl/contrib/opensolaris/cmd/dtrace cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs cddl/contrib/opensol... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 02:20:20 -0000 Author: pfg Date: Wed Apr 17 02:20:17 2013 New Revision: 249573 URL: http://svnweb.freebsd.org/changeset/base/249573 Log: DTrace: Revert r249367 The following change from illumos brought caused DTrace to pause in an interactive environment: 3026 libdtrace should set LD_NOLAZYLOAD=1 to help the pid provider This was not detected during testing because it doesn't affect scripts. We shouldn't be changing the environment, especially since the LD_NOLAZYLOAD option doesn't apply to our (GNU) ld. Unfortunately the change from upstream was made in such a way that it is very difficult to separate this change from the others so, at least for now, it's better to just revert everything. Reference: https://www.illumos.org/issues/3026 Reported by: Navdeep Parhar and Mark Johnston Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d - copied unchanged from r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh - copied unchanged from r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d - copied unchanged from r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d - copied unchanged from r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d Deleted: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/cg/ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/tst.assigncast1.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/tst.assigncast2.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal2.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.dyn.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/tst.dyn.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh.out head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pq.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pq.h Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.ring3.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.h head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c head/cddl/lib/libdtrace/Makefile head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Wed Apr 17 02:03:12 2013 (r249572) +++ head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Wed Apr 17 02:20:17 2013 (r249573) @@ -23,9 +23,8 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ + +#pragma ident "%Z%%M% %I% %E% SMI" #include #include @@ -1410,7 +1409,6 @@ main(int argc, char *argv[]) (void) dtrace_setopt(g_dtp, "bufsize", "4m"); (void) dtrace_setopt(g_dtp, "aggsize", "4m"); #endif - (void) dtrace_setopt(g_dtp, "temporal", "yes"); /* * If -G is specified, enable -xlink=dynamic and -xunodefs to permit Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl Wed Apr 17 02:03:12 2013 (r249572) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl Wed Apr 17 02:20:17 2013 (r249573) @@ -583,8 +583,6 @@ if ($opt_x) { die "$PNAME: failed to open $PNAME.$$.log: $!\n" unless (!$opt_l || open(LOG, ">$PNAME.$$.log")); -$ENV{'DTRACE_DEBUG_REGSET'} = 'true'; - if ($opt_g) { $ENV{'UMEM_DEBUG'} = 'default,verbose'; $ENV{'UMEM_LOGGING'} = 'fail,contents'; Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d (from r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d Wed Apr 17 02:20:17 2013 (r249573, copy of r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d) @@ -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 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * ASSERTION: + * Complex expressions. + * Call complex expressions and make sure test succeeds. + * Match expected output in tst.complex.d.out + * + * SECTION: Types, Operators, and Expressions/Arithmetic Operators + * + */ + +#pragma D option quiet + +BEGIN +{ + i = 0; + i = i++ + ++i; + printf("The value of i is %d\n", i); + i = i-- - --i; + printf("The value of i is %d\n", i); + i = i-- + ++i; + printf("The value of i is %d\n", i); + i += i++ + -- i + ++i - ++i * i ; + printf("The value of i is %d\n", i); + i -= i++ * 3; + printf("The value of i is %d\n", i); + i = i++/i--+i++-++i-++i; + printf("The value of i is %d\n", i); + exit (0); +} Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d Wed Apr 17 02:03:12 2013 (r249572) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d Wed Apr 17 02:20:17 2013 (r249573) @@ -23,29 +23,26 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ + +#pragma ident "%Z%%M% %I% %E% SMI" /* * ASSERTION: * Positive test for fill buffer policy. * * SECTION: Buffers and Buffering/fill Policy; - * Buffers and Buffering/Buffer Sizes; + * Buffers and Buffering/Buffer Sizes; * Options and Tunables/bufsize; * Options and Tunables/bufpolicy; * Options and Tunables/statusrate */ /* - * This is a brute-force way of testing fill buffers. We assume that - * each printf() stores 16 bytes (4x 32-bit words for EPID, timestamp - * lo, timestamp hi, and the variable i). Because each fill buffer is - * per-CPU, we must fill up our buffer in one series of enablings on a - * single CPU. + * This is a brute-force way of testing fill buffers. We assume that each + * printf() stores 8 bytes. Because each fill buffer is per-CPU, we must + * fill up our buffer in one series of enablings on a single CPU. */ #pragma D option bufpolicy=fill -#pragma D option bufsize=128 +#pragma D option bufsize=64 #pragma D option statusrate=10ms #pragma D option quiet Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.ring3.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.ring3.d Wed Apr 17 02:03:12 2013 (r249572) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.ring3.d Wed Apr 17 02:20:17 2013 (r249573) @@ -23,9 +23,8 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ + +#pragma ident "%Z%%M% %I% %E% SMI" /* * ASSERTION: @@ -38,20 +37,19 @@ */ /* - * We make some regrettable assumptions about the implementation in this - * test. First, we assume that each entry for the printf() of an int - * takes _exactly_ 16 bytes (4 bytes for the EPID, 8 bytes for the - * timestamp, 4 bytes for the payload). Second, we assume that by - * allocating storage for n + 1 records, we will get exactly n. Here is - * why: the final predicate that evaluates to false will reserve space - * that it won't use. This act of reservation will advance the wrapped - * offset. That record won't be subsequently used, but the wrapped - * offset has advanced. (And in this case, that old record is clobbered - * by the exit() anyway.) Thirdly: we rely on t_cpu/cpu_id. Finally: - * we rely on being able to run on the CPU that we first ran on. + * We make some regrettable assumptions about the implementation in this test. + * First, we assume that each entry for the printf() of an int takes _exactly_ + * eight bytes (four bytes for the EPID, four bytes for the payload). Second, + * we assume that by allocating storage for n + 1 records, we will get exactly + * n. Here is why: the final predicate that evaluates to false will reserve + * space that it won't use. This act of reservation will advance the wrapped + * offset. That record won't be subsequently used, but the wrapped offset has + * advanced. (And in this case, that old record is clobbered by the exit() + * anyway.) Thirdly: we rely on t_cpu/cpu_id. Finally: we rely on being + * able to run on the CPU that we first ran on. */ #pragma D option bufpolicy=ring -#pragma D option bufsize=80 +#pragma D option bufsize=40 #pragma D option quiet int n; Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh Wed Apr 17 02:03:12 2013 (r249572) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh Wed Apr 17 02:20:17 2013 (r249573) @@ -24,9 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # - -# -# Copyright (c) 2012 by Delphix. All rights reserved. +# ident "%Z%%M% %I% %E% SMI" # if [ $# != 1 ]; then @@ -51,13 +49,13 @@ tick-1s tick-1s /(i % 2) == 0/ { - system("dtrace -c date -n 'pid\$target::main:entry' >/dev/null"); + system("dtrace -c date -ln 'pid\$target::main:entry' >/dev/null"); } tick-1s /(i % 2) == 1/ { - system("dtrace -c date -n 'pid\$target::main:return' >/dev/null"); + system("dtrace -c date -ln 'pid\$target::main:return' >/dev/null"); } EOF Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh (from r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh Wed Apr 17 02:20:17 2013 (r249573, copy of r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh) @@ -0,0 +1,197 @@ +# +# 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 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" + +unload() +{ + # + # Get the list of services whose processes have USDT probes. Ideally + # it would be possible to unload the fasttrap provider while USDT + # probes exist -- once that fix is integrated, this hack can go away + # We create two lists -- one of regular SMF services and one of legacy + # services -- since each must be enabled and disabled using a specific + # mechanism. + # + pids=$(dtrace -l | \ + perl -ne 'print "$1\n" if (/^\s*\S+\s+\S*\D(\d+)\s+/);' | \ + sort | uniq | tr '\n' ',') + + ctids=$(ps -p $pids -o ctid | tail +2 | sort | uniq) + svcs= + lrcs= + + for ct in $ctids + do + line=$(svcs -o fmri,ctid | grep " $ct\$") + svc=$(echo $line | cut -d' ' -f1) + + if [[ $(svcs -Ho STA $svc) == "LRC" ]]; then + lrc=$(svcs -Ho SVC $svc | tr _ '?') + lrcs="$lrcs $lrc" + else + svcs="$svcs $svc" + fi + done + + for svc in $svcs + do + svcadm disable -ts $svc + done + + for lrc in $lrcs + do + # + # Does it seem a little paternalistic that lsvcrun requires + # this environment variable to be set? I'd say so... + # + SMF_RESTARTER=svc:/system/svc/restarter:default \ + /lib/svc/bin/lsvcrun $lrc stop + done + + modunload -i 0 + modunload -i 0 + modunload -i 0 + modinfo | grep dtrace + success=$? + + for svc in $svcs + do + svcadm enable -ts $svc + done + + for lrc in $lrcs + do + SMF_RESTARTER=svc:/system/svc/restarter:default \ + /lib/svc/bin/lsvcrun $lrc start + done + + if [ ! $success ]; then + echo $tst: could not unload dtrace + exit 1 + fi +} + +script1() +{ + $dtrace -s /dev/stdin <' + exit 2 +fi + +ppid=$$ +dtrace=$1 + +unload +script1 & +child=$! + +let waited=0 + +while [ "$waited" -lt 5 ]; do + seconds=`date +%S` + + if [ "$seconds" -ne "$last" ]; then + last=$seconds + let waited=waited+1 + fi +done + +wait $child +status=$? + +if [ "$status" -ne 0 ]; then + echo $tst: first dtrace failed + exit $status +fi + +unload +script2 & +child=$! + +let waited=0 + +while [ "$waited" -lt 10 ]; do + seconds=`date +%S` + + if [ "$seconds" -ne "$last" ]; then + last=$seconds + let waited=waited+1 + fi +done + +wait $child +status=$? + +exit $status Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d (from r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d Wed Apr 17 02:20:17 2013 (r249573, copy of r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d) @@ -0,0 +1,29 @@ +/* + * 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 (c) 2011 by Delphix. All rights reserved. + */ + +BEGIN +{ + print(*curpsinfo); +} Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out Wed Apr 17 02:03:12 2013 (r249572) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out Wed Apr 17 02:20:17 2013 (r249573) @@ -1,6 +1,6 @@ --17 --12817 +239 +52719 -1867788817 1311768467294899695 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d Wed Apr 17 02:03:12 2013 (r249572) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d Wed Apr 17 02:20:17 2013 (r249573) @@ -24,10 +24,7 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ - +#pragma ident "%Z%%M% %I% %E% SMI" /* * ASSERTION: @@ -38,10 +35,17 @@ * * NOTES: This test behaves differently depending on the values * assigned to bufsize. + * 1. 0 > bufsize. + * 2. 0 == bufsize. + * 3. 0 < bufsize <= 7 + * 4. 8 <= bufsize <= 31 + * 5. 32 <= bufsize <= 47 + * 6. 48 <= bufsize <= 71 + * 7. 72 <= bufsize */ #pragma D option quiet -#pragma D option bufsize=49 +#pragma D option bufsize=41 BEGIN { Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d Wed Apr 17 02:03:12 2013 (r249572) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d Wed Apr 17 02:20:17 2013 (r249573) @@ -24,10 +24,7 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ - +#pragma ident "%Z%%M% %I% %E% SMI" /* * ASSERTION: * Verify the behavior of speculations with changes in specsize. @@ -38,7 +35,7 @@ */ #pragma D option quiet -#pragma D option specsize=48 +#pragma D option specsize=40 BEGIN { Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d (from r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d Wed Apr 17 02:20:17 2013 (r249573, copy of r249366, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d) @@ -0,0 +1,61 @@ +/* + * 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 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * ASSERTION: + * The D inline translation mechanism can be used to facilitate stable + * translations. + * + * SECTION: Translators/ Translator Declarations + * SECTION: Translators/ Translate Operator + * SECTION: Translators/Stable Translations + * + * NOTES: Uncomment the pragma that explicitly resets the attributes of + * myinfo identifier to Stable/Stable/Common from Private/Private/Unknown. + * Run the program with and without the comments as: + * /usr/sbin/dtrace -vs man.TestTransStability.d + */ + +#pragma D option quiet + +inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread); + +/* +#pragma D attributes Stable/Stable/Common myinfo +*/ + +BEGIN +{ + trace(myinfo->pr_flag); + exit(0); +} + +ERROR +{ + exit(1); +} Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c Wed Apr 17 02:03:12 2013 (r249572) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c Wed Apr 17 02:20:17 2013 (r249573) @@ -26,7 +26,6 @@ /* * Copyright (c) 2011, Joyent, Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -895,14 +894,33 @@ dt_aggregate_valcmp(const void *lhs, con caddr_t rdata = rh->dtahe_data.dtada_data; dtrace_recdesc_t *lrec, *rrec; int64_t *laddr, *raddr; - int rval; + int rval, i; + + if ((rval = dt_aggregate_hashcmp(lhs, rhs)) != 0) + return (rval); + + if (lagg->dtagd_nrecs > ragg->dtagd_nrecs) + return (DT_GREATERTHAN); + + if (lagg->dtagd_nrecs < ragg->dtagd_nrecs) + return (DT_LESSTHAN); - assert(lagg->dtagd_nrecs == ragg->dtagd_nrecs); + for (i = 0; i < lagg->dtagd_nrecs; i++) { + lrec = &lagg->dtagd_rec[i]; + rrec = &ragg->dtagd_rec[i]; - lrec = &lagg->dtagd_rec[lagg->dtagd_nrecs - 1]; - rrec = &ragg->dtagd_rec[ragg->dtagd_nrecs - 1]; + if (lrec->dtrd_offset < rrec->dtrd_offset) + return (DT_LESSTHAN); + + if (lrec->dtrd_offset > rrec->dtrd_offset) + return (DT_GREATERTHAN); - assert(lrec->dtrd_action == rrec->dtrd_action); + if (lrec->dtrd_action < rrec->dtrd_action) + return (DT_LESSTHAN); + + if (lrec->dtrd_action > rrec->dtrd_action) + return (DT_GREATERTHAN); + } laddr = (int64_t *)(uintptr_t)(ldata + lrec->dtrd_offset); raddr = (int64_t *)(uintptr_t)(rdata + rrec->dtrd_offset); Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Wed Apr 17 02:03:12 2013 (r249572) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Wed Apr 17 02:20:17 2013 (r249573) @@ -22,7 +22,7 @@ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, Joyent Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. */ /* @@ -664,17 +664,15 @@ static void dt_action_trace(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) { dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp); - boolean_t istrace = (dnp->dn_ident->di_id == DT_ACT_TRACE); - const char *act = istrace ? "trace" : "print"; if (dt_node_is_void(dnp->dn_args)) { - dnerror(dnp->dn_args, istrace ? D_TRACE_VOID : D_PRINT_VOID, - "%s( ) may not be applied to a void expression\n", act); + dnerror(dnp->dn_args, D_TRACE_VOID, + "trace( ) may not be applied to a void expression\n"); } - if (dt_node_resolve(dnp->dn_args, DT_IDENT_XLPTR) != NULL) { - dnerror(dnp->dn_args, istrace ? D_TRACE_DYN : D_PRINT_DYN, - "%s( ) may not be applied to a translated pointer\n", act); + if (dt_node_is_dynamic(dnp->dn_args)) { + dnerror(dnp->dn_args, D_TRACE_DYN, + "trace( ) may not be applied to a dynamic expression\n"); } if (dnp->dn_args->dn_kind == DT_NODE_AGG) { @@ -684,34 +682,51 @@ dt_action_trace(dtrace_hdl_t *dtp, dt_no } dt_cg(yypcb, dnp->dn_args); + ap->dtad_difo = dt_as(yypcb); + ap->dtad_kind = DTRACEACT_DIFEXPR; +} - /* - * The print() action behaves identically to trace(), except that it - * stores the CTF type of the argument (if present) within the DOF for - * the DIFEXPR action. To do this, we set the 'dtsd_strdata' to point - * to the fully-qualified CTF type ID for the result of the DIF - * action. We use the ID instead of the name to handles complex types - * like arrays and function pointers that can't be resolved by - * ctf_type_lookup(). This is later processed by dtrace_dof_create() - * and turned into a reference into the string table so that we can - * get the type information when we process the data after the fact. - */ - if (dnp->dn_ident->di_id == DT_ACT_PRINT) { - dt_node_t *dret; - size_t n; - dt_module_t *dmp; - - dret = yypcb->pcb_dret; - dmp = dt_module_lookup_by_ctf(dtp, dret->dn_ctfp); - - n = snprintf(NULL, 0, "%s`%ld", dmp->dm_name, dret->dn_type) + 1; - sdp->dtsd_strdata = dt_alloc(dtp, n); - if (sdp->dtsd_strdata == NULL) - longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); - (void) snprintf(sdp->dtsd_strdata, n, "%s`%ld", dmp->dm_name, - dret->dn_type); +/* + * The print() action behaves identically to trace(), except that it stores the + * CTF type of the argument (if present) within the DOF for the DIFEXPR action. + * To do this, we set the 'dtsd_strdata' to point to the fully-qualified CTF + * type ID for the result of the DIF action. We use the ID instead of the name + * to handles complex types like arrays and function pointers that can't be + * resolved by ctf_type_lookup(). This is later processed by + * dtrace_dof_create() and turned into a reference into the string table so + * that we can get the type information when we process the data after the + * fact. + */ +static void +dt_action_print(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) +{ + dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp); + dt_node_t *dret; + size_t len; + dt_module_t *dmp; + + if (dt_node_is_void(dnp->dn_args)) { + dnerror(dnp->dn_args, D_PRINT_VOID, + "print( ) may not be applied to a void expression\n"); } + if (dt_node_is_dynamic(dnp->dn_args)) { + dnerror(dnp->dn_args, D_PRINT_DYN, + "print( ) may not be applied to a dynamic expression\n"); + } + + dt_cg(yypcb, dnp->dn_args); + + dret = yypcb->pcb_dret; + dmp = dt_module_lookup_by_ctf(dtp, dret->dn_ctfp); + + len = snprintf(NULL, 0, "%s`%ld", dmp->dm_name, dret->dn_type) + 1; + sdp->dtsd_strdata = dt_alloc(dtp, len); + if (sdp->dtsd_strdata == NULL) + longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); + (void) snprintf(sdp->dtsd_strdata, len, "%s`%ld", dmp->dm_name, + dret->dn_type); + ap->dtad_difo = dt_as(yypcb); ap->dtad_kind = DTRACEACT_DIFEXPR; } @@ -1136,9 +1151,6 @@ dt_compile_fun(dtrace_hdl_t *dtp, dt_nod case DT_ACT_PANIC: dt_action_panic(dtp, dnp->dn_expr, sdp); break; - case DT_ACT_PRINT: - dt_action_trace(dtp, dnp->dn_expr, sdp); - break; case DT_ACT_PRINTA: dt_action_printa(dtp, dnp->dn_expr, sdp); break; @@ -1175,6 +1187,9 @@ dt_compile_fun(dtrace_hdl_t *dtp, dt_nod case DT_ACT_TRACE: dt_action_trace(dtp, dnp->dn_expr, sdp); break; + case DT_ACT_PRINT: + dt_action_print(dtp, dnp->dn_expr, sdp); + break; case DT_ACT_TRACEMEM: dt_action_tracemem(dtp, dnp->dn_expr, sdp); break; @@ -2550,8 +2565,7 @@ dt_compile(dtrace_hdl_t *dtp, int contex } out: - if (context != DT_CTX_DTYPE && yypcb->pcb_root != NULL && - DT_TREEDUMP_PASS(dtp, 3)) + if (context != DT_CTX_DTYPE && DT_TREEDUMP_PASS(dtp, 3)) dt_node_printr(yypcb->pcb_root, stderr, 0); if (dtp->dt_cdefs_fd != -1 && (ftruncate64(dtp->dt_cdefs_fd, 0) == -1 || Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c Wed Apr 17 02:03:12 2013 (r249572) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c Wed Apr 17 02:20:17 2013 (r249573) @@ -19,15 +19,12 @@ * * CDDL HEADER END */ - /* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ +#pragma ident "%Z%%M% %I% %E% SMI" #include #include @@ -196,6 +193,9 @@ dt_cg_ptrsize(dt_node_t *dnp, dt_irlist_ ssize_t size; int sreg; + if ((sreg = dt_regset_alloc(drp)) == -1) + longjmp(yypcb->pcb_jmpbuf, EDT_NOREG); + type = ctf_type_resolve(ctfp, dnp->dn_type); kind = ctf_type_kind(ctfp, type); assert(kind == CTF_K_POINTER || kind == CTF_K_ARRAY); @@ -212,7 +212,6 @@ dt_cg_ptrsize(dt_node_t *dnp, dt_irlist_ if ((size = ctf_type_size(ctfp, type)) == 1) return; /* multiply or divide by one can be omitted */ - sreg = dt_regset_alloc(drp); dt_cg_setx(dlp, sreg, size); instr = DIF_INSTR_FMT(op, dreg, sreg, dreg); dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr)); @@ -252,7 +251,9 @@ dt_cg_field_get(dt_node_t *dnp, dt_irlis assert(dnp->dn_op == DT_TOK_PTR || dnp->dn_op == DT_TOK_DOT); r1 = dnp->dn_left->dn_reg; - r2 = dt_regset_alloc(drp); + + if ((r2 = dt_regset_alloc(drp)) == -1) + longjmp(yypcb->pcb_jmpbuf, EDT_NOREG); /* * On little-endian architectures, ctm_offset counts from the right so @@ -355,9 +356,10 @@ dt_cg_field_set(dt_node_t *src, dt_irlis "bits %u\n", m.ctm_offset, m.ctm_type, e.cte_bits); } - r1 = dt_regset_alloc(drp); - r2 = dt_regset_alloc(drp); - r3 = dt_regset_alloc(drp); + if ((r1 = dt_regset_alloc(drp)) == -1 || + (r2 = dt_regset_alloc(drp)) == -1 || + (r3 = dt_regset_alloc(drp)) == -1) + longjmp(yypcb->pcb_jmpbuf, EDT_NOREG); /* * Compute shifts and masks. We need to compute "shift" as the amount @@ -421,7 +423,8 @@ dt_cg_store(dt_node_t *src, dt_irlist_t size = dt_node_type_size(src); if (src->dn_flags & DT_NF_REF) { - reg = dt_regset_alloc(drp); + if ((reg = dt_regset_alloc(drp)) == -1) + longjmp(yypcb->pcb_jmpbuf, EDT_NOREG); dt_cg_setx(dlp, reg, size); instr = DIF_INSTR_COPYS(src->dn_reg, reg, dst->dn_reg); dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr)); @@ -471,58 +474,30 @@ dt_cg_typecast(const dt_node_t *src, con size_t dstsize = dt_node_type_size(dst); dif_instr_t instr; - int rg; - - if (!dt_node_is_scalar(dst)) - return; /* not a scalar */ - if (dstsize == srcsize && - ((src->dn_flags ^ dst->dn_flags) & DT_NF_SIGNED) != 0) - return; /* not narrowing or changing signed-ness */ - if (dstsize > srcsize && (src->dn_flags & DT_NF_SIGNED) == 0) - return; /* nothing to do in this case */ - - rg = dt_regset_alloc(drp); - - if (dstsize > srcsize) { - int n = sizeof (uint64_t) * NBBY - srcsize * NBBY; - int s = (dstsize - srcsize) * NBBY; - - dt_cg_setx(dlp, rg, n); + int reg, n; - instr = DIF_INSTR_FMT(DIF_OP_SLL, src->dn_reg, rg, dst->dn_reg); - dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr)); + if (dt_node_is_scalar(dst) && (dstsize < srcsize || + (src->dn_flags & DT_NF_SIGNED) ^ (dst->dn_flags & DT_NF_SIGNED))) { + if ((reg = dt_regset_alloc(drp)) == -1) + longjmp(yypcb->pcb_jmpbuf, EDT_NOREG); - if ((dst->dn_flags & DT_NF_SIGNED) || n == s) { - instr = DIF_INSTR_FMT(DIF_OP_SRA, - dst->dn_reg, rg, dst->dn_reg); - dt_irlist_append(dlp, - dt_cg_node_alloc(DT_LBL_NONE, instr)); - } else { - dt_cg_setx(dlp, rg, s); - instr = DIF_INSTR_FMT(DIF_OP_SRA, - dst->dn_reg, rg, dst->dn_reg); - dt_irlist_append(dlp, - dt_cg_node_alloc(DT_LBL_NONE, instr)); - dt_cg_setx(dlp, rg, n - s); - instr = DIF_INSTR_FMT(DIF_OP_SRL, - dst->dn_reg, rg, dst->dn_reg); - dt_irlist_append(dlp, - dt_cg_node_alloc(DT_LBL_NONE, instr)); - } - } else if (dstsize != sizeof (uint64_t)) { - int n = sizeof (uint64_t) * NBBY - dstsize * NBBY; + if (dstsize < srcsize) + n = sizeof (uint64_t) * NBBY - dstsize * NBBY; + else + n = sizeof (uint64_t) * NBBY - srcsize * NBBY; - dt_cg_setx(dlp, rg, n); + dt_cg_setx(dlp, reg, n); - instr = DIF_INSTR_FMT(DIF_OP_SLL, src->dn_reg, rg, dst->dn_reg); + instr = DIF_INSTR_FMT(DIF_OP_SLL, + src->dn_reg, reg, dst->dn_reg); dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr)); instr = DIF_INSTR_FMT((dst->dn_flags & DT_NF_SIGNED) ? - DIF_OP_SRA : DIF_OP_SRL, dst->dn_reg, rg, dst->dn_reg); + DIF_OP_SRA : DIF_OP_SRL, dst->dn_reg, reg, dst->dn_reg); + dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr)); + dt_regset_free(drp, reg); } - - dt_regset_free(drp, rg); } /* @@ -548,7 +523,8 @@ dt_cg_arglist(dt_ident_t *idp, dt_node_t for (dnp = args; dnp != NULL; dnp = dnp->dn_list) dt_cg_node(dnp, dlp, drp); - dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, DIF_INSTR_FLUSHTS)); + dt_irlist_append(dlp, + dt_cg_node_alloc(DT_LBL_NONE, DIF_INSTR_FLUSHTS)); for (dnp = args; dnp != NULL; dnp = dnp->dn_list, i++) { dtrace_diftype_t t; @@ -562,18 +538,17 @@ dt_cg_arglist(dt_ident_t *idp, dt_node_t dt_cg_typecast(dnp, &isp->dis_args[i], dlp, drp); isp->dis_args[i].dn_reg = -1; - if (t.dtdt_flags & DIF_TF_BYREF) { + if (t.dtdt_flags & DIF_TF_BYREF) op = DIF_OP_PUSHTR; - if (t.dtdt_size != 0) { - reg = dt_regset_alloc(drp); - dt_cg_setx(dlp, reg, t.dtdt_size); - } else { - reg = DIF_REG_R0; - } - } else { + else op = DIF_OP_PUSHTV; + + if (t.dtdt_size != 0) { + if ((reg = dt_regset_alloc(drp)) == -1) + longjmp(yypcb->pcb_jmpbuf, EDT_NOREG); + dt_cg_setx(dlp, reg, t.dtdt_size); + } else reg = DIF_REG_R0; - } instr = DIF_INSTR_PUSHTS(op, t.dtdt_kind, reg, dnp->dn_reg); dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr)); @@ -654,7 +629,9 @@ dt_cg_prearith_op(dt_node_t *dnp, dt_irl dt_cg_node(dnp->dn_child, dlp, drp); dnp->dn_reg = dnp->dn_child->dn_reg; - reg = dt_regset_alloc(drp); + if ((reg = dt_regset_alloc(drp)) == -1) + longjmp(yypcb->pcb_jmpbuf, EDT_NOREG); + dt_cg_setx(dlp, reg, size); instr = DIF_INSTR_FMT(op, dnp->dn_reg, reg, dnp->dn_reg); @@ -711,7 +688,9 @@ dt_cg_postarith_op(dt_node_t *dnp, dt_ir dt_cg_node(dnp->dn_child, dlp, drp); dnp->dn_reg = dnp->dn_child->dn_reg; - nreg = dt_regset_alloc(drp); + if ((nreg = dt_regset_alloc(drp)) == -1) + longjmp(yypcb->pcb_jmpbuf, EDT_NOREG); + dt_cg_setx(dlp, nreg, size); instr = DIF_INSTR_FMT(op, dnp->dn_reg, nreg, nreg); dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr)); @@ -1029,7 +1008,9 @@ dt_cg_asgn_op(dt_node_t *dnp, dt_irlist_ * set it to the size of our data structure, and then replace * it with the result of an allocs of the specified size. */ - r1 = dt_regset_alloc(drp); + if ((r1 = dt_regset_alloc(drp)) == -1) + longjmp(yypcb->pcb_jmpbuf, EDT_NOREG); + dt_cg_setx(dlp, r1, ctf_type_size(dxp->dx_dst_ctfp, dxp->dx_dst_base)); @@ -1073,7 +1054,8 @@ dt_cg_asgn_op(dt_node_t *dnp, dt_irlist_ * and add r1 to it before storing the result. */ if (ctm.ctm_offset != 0) { - r2 = dt_regset_alloc(drp); + if ((r2 = dt_regset_alloc(drp)) == -1) + longjmp(yypcb->pcb_jmpbuf, EDT_NOREG); /* * Add the member offset rounded down to the @@ -1160,7 +1142,8 @@ dt_cg_assoc_op(dt_node_t *dnp, dt_irlist dt_cg_arglist(dnp->dn_ident, dnp->dn_args, dlp, drp); - dnp->dn_reg = dt_regset_alloc(drp); + if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1) + longjmp(yypcb->pcb_jmpbuf, EDT_NOREG); if (dnp->dn_ident->di_flags & DT_IDFLG_TLS) op = DIF_OP_LDTAA; @@ -1290,7 +1273,9 @@ dt_cg_array_op(dt_node_t *dnp, dt_irlist if ((size = dt_node_type_size(dnp)) == sizeof (uint64_t)) return; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 02:33:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 67CB4DDA; Wed, 17 Apr 2013 02:33:57 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5AD4E3D6; Wed, 17 Apr 2013 02:33:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3H2XvAi008473; Wed, 17 Apr 2013 02:33:57 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3H2XvI3008472; Wed, 17 Apr 2013 02:33:57 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201304170233.r3H2XvI3008472@svn.freebsd.org> From: Neel Natu Date: Wed, 17 Apr 2013 02:33:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249574 - head/sys/dev/aic7xxx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 02:33:57 -0000 Author: neel Date: Wed Apr 17 02:33:56 2013 New Revision: 249574 URL: http://svnweb.freebsd.org/changeset/base/249574 Log: Correct misleading bootverbose output: ahc_isa_probe -> ahc_isa_identify Modified: head/sys/dev/aic7xxx/ahc_isa.c Modified: head/sys/dev/aic7xxx/ahc_isa.c ============================================================================== --- head/sys/dev/aic7xxx/ahc_isa.c Wed Apr 17 02:20:17 2013 (r249573) +++ head/sys/dev/aic7xxx/ahc_isa.c Wed Apr 17 02:33:56 2013 (r249574) @@ -98,7 +98,7 @@ ahc_isa_identify(driver_t *driver, devic RF_ACTIVE); if (regs == NULL) { if (bootverbose) - printf("ahc_isa_probe %d: ioport 0x%x " + printf("ahc_isa_identify %d: ioport 0x%x " "alloc failed\n", slot, iobase); continue; } From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 02:40:11 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 12E0C80; Wed, 17 Apr 2013 02:40:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 02925400; Wed, 17 Apr 2013 02:40:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3H2eArX009403; Wed, 17 Apr 2013 02:40:10 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3H2e8T6009388; Wed, 17 Apr 2013 02:40:08 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201304170240.r3H2e8T6009388@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 17 Apr 2013 02:40:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249575 - in head/cddl/contrib/opensolaris: cmd/dtrace/test/tst/common/funcs cmd/dtrace/test/tst/common/pointers cmd/dtrace/test/tst/common/print cmd/dtrace/test/tst/common/safety cmd/d... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 02:40:11 -0000 Author: pfg Date: Wed Apr 17 02:40:07 2013 New Revision: 249575 URL: http://svnweb.freebsd.org/changeset/base/249575 Log: DTrace: Revert r249426 This change actually depends on r249367 which had to be reverted Pointy Hat: pfg Deleted: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_AGG.bad.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_TRACE_AGG.bad.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/types/tst.const.d Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PROTO_LEN.bad.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.copyin.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d Wed Apr 17 02:40:07 2013 (r249575) @@ -24,9 +24,7 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ +#pragma ident "%Z%%M% %I% %E% SMI" #pragma D option quiet @@ -38,8 +36,3 @@ BEGIN printf("%s\n", strjoin("", "")); exit(0); } - -BEGIN -{ - exit(1); -} Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d Wed Apr 17 02:40:07 2013 (r249575) @@ -24,9 +24,7 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ +#pragma ident "%Z%%M% %I% %E% SMI" /* * ASSERTION: This test reproduces the alignment error. @@ -41,10 +39,9 @@ BEGIN { - x = (int *)64; + x = (int *) 64; y = *x; trace(y); - exit(0); } ERROR Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d Wed Apr 17 02:40:07 2013 (r249575) @@ -24,9 +24,7 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ +#pragma ident "%Z%%M% %I% %E% SMI" /* * ASSERTION: D pointers do not allow invalid pointer accesses. @@ -46,7 +44,6 @@ BEGIN y = (int *) (x - 3300778156056); *y = 3; trace(*y); - exit(0); } ERROR Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d Wed Apr 17 02:40:07 2013 (r249575) @@ -24,9 +24,7 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ +#pragma ident "%Z%%M% %I% %E% SMI" /* * ASSERTION: D pointers do not allow invalid pointer accesses. @@ -41,10 +39,9 @@ BEGIN { - y = (int *)-33007; + y = (int *) (-33007); *y = 3; trace(*y); - exit(0); } ERROR Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d Wed Apr 17 02:40:07 2013 (r249575) @@ -24,9 +24,7 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ +#pragma ident "%Z%%M% %I% %E% SMI" /* * ASSERTION: Demonstrating valid memory access. @@ -42,11 +40,10 @@ BEGIN { x = (int *)alloca(sizeof (int)); - printf("Address x: %x\n", (int)x); - y = (int *)(x - 2); + printf("Address x: %x\n", (int) x); + y = (int *) (x - 2); *y = 3; - printf("Address y: %x\tValue: %d\n", (int)y, *y); - exit(0); + printf("Address y: %x\tValue: %d\n", (int) y, *y); } ERROR Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d Wed Apr 17 02:40:07 2013 (r249575) @@ -20,15 +20,10 @@ */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. */ BEGIN { print((void)`p0); } - -BEGIN -{ - exit(0); -} Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PROTO_LEN.bad.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PROTO_LEN.bad.d Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PROTO_LEN.bad.d Wed Apr 17 02:40:07 2013 (r249575) @@ -20,15 +20,10 @@ */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. */ BEGIN { print(); } - -BEGIN -{ - exit(0); -} Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.copyin.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.copyin.d Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.copyin.d Wed Apr 17 02:40:07 2013 (r249575) @@ -24,9 +24,7 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ +#pragma ident "%Z%%M% %I% %E% SMI" /* * ASSERTION: @@ -41,7 +39,7 @@ */ -#pragma D option bufsize=32 +#pragma D option bufsize=16 #pragma D option bufpolicy=ring #pragma D option statusrate=1nsec Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d Wed Apr 17 02:40:07 2013 (r249575) @@ -24,9 +24,7 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ +#pragma ident "%Z%%M% %I% %E% SMI" /* * ASSERTION: Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d Wed Apr 17 02:40:07 2013 (r249575) @@ -24,9 +24,8 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ +#pragma ident "%Z%%M% %I% %E% SMI" + /* * ASSERTION: @@ -40,8 +39,3 @@ BEGIN trace(); } - -BEGIN -{ - exit(0); -} Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d Wed Apr 17 02:40:07 2013 (r249575) @@ -24,9 +24,7 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2012 by Delphix. All rights reserved. - */ +#pragma ident "%Z%%M% %I% %E% SMI" /* * ASSERTION: @@ -39,8 +37,3 @@ BEGIN { trace((void)`kmem_flags); } - -BEGIN -{ - exit(0); -} Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Wed Apr 17 02:40:07 2013 (r249575) @@ -675,12 +675,6 @@ dt_action_trace(dtrace_hdl_t *dtp, dt_no "trace( ) may not be applied to a dynamic expression\n"); } - if (dnp->dn_args->dn_kind == DT_NODE_AGG) { - dnerror(dnp->dn_args, istrace ? D_TRACE_AGG : D_PRINT_AGG, - "%s( ) may not be applied to an aggregation%s\n", act, - istrace ? "" : " -- did you mean printa()?"); - } - dt_cg(yypcb, dnp->dn_args); ap->dtad_difo = dt_as(yypcb); ap->dtad_kind = DTRACEACT_DIFEXPR; Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.c Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.c Wed Apr 17 02:40:07 2013 (r249575) @@ -21,7 +21,6 @@ */ /* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. * Use is subject to license terms. */ @@ -255,6 +254,11 @@ dt_decl_spec(ushort_t kind, char *name) ddp->dd_kind = kind; ddp->dd_name = name; + if (name != NULL && strchr(name, '`') != NULL) { + xyerror(D_DECL_SCOPE, "D scoping operator may not be used " + "in a type name\n"); + } + return (dt_decl_check(ddp)); } Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h Wed Apr 17 02:33:56 2013 (r249574) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h Wed Apr 17 02:40:07 2013 (r249575) @@ -190,10 +190,8 @@ typedef enum { D_PRINTA_AGGPROTO, /* printa() aggregation mismatch */ D_TRACE_VOID, /* trace() argument has void type */ D_TRACE_DYN, /* trace() argument has dynamic type */ - D_TRACE_AGG, /* trace() argument is an aggregation */ D_PRINT_VOID, /* print() argument has void type */ D_PRINT_DYN, /* print() argument has dynamic type */ - D_PRINT_AGG, /* print() argument is an aggregation */ D_TRACEMEM_ADDR, /* tracemem() address bad type */ D_TRACEMEM_SIZE, /* tracemem() size bad type */ D_TRACEMEM_ARGS, /* tracemem() illegal number of args */ From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 06:00:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 291A6BB2; Wed, 17 Apr 2013 06:00:43 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id EF777CE0; Wed, 17 Apr 2013 06:00:42 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id r3H60aUa067760; Wed, 17 Apr 2013 06:00:36 GMT (envelope-from kientzle@freebsd.org) Received: from [192.168.2.123] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id e345h6zqhwgn4ugxjtkrgnkwaa; Wed, 17 Apr 2013 06:00:36 +0000 (UTC) (envelope-from kientzle@freebsd.org) Subject: Re: svn commit: r249484 - head/lib Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: multipart/signed; boundary="Apple-Mail=_C5B7AA32-82D9-4A21-A2B9-8A1EF782368B"; protocol="application/pgp-signature"; micalg=pgp-sha1 From: Tim Kientzle In-Reply-To: <516D54F5.4010501@FreeBSD.org> Date: Tue, 16 Apr 2013 23:00:34 -0700 Message-Id: <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <516D54F5.4010501@FreeBSD.org> To: Tijl Coosemans X-Mailer: Apple Mail (2.1283) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 06:00:43 -0000 --Apple-Mail=_C5B7AA32-82D9-4A21-A2B9-8A1EF782368B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Apr 16, 2013, at 6:41 AM, Tijl Coosemans wrote: > On 2013-04-14 21:13, Tim Kientzle wrote: >> Author: kientzle >> Date: Sun Apr 14 19:13:51 2013 >> New Revision: 249484 >> URL: http://svnweb.freebsd.org/changeset/base/249484 >>=20 >> Log: >> Install a symlink >> /usr/lib/include =3D=3D> /usr/include >>=20 >> This fixes -print-file-name=3Dinclude in clang (and is >> arguably a better way to fix the same issue in GCC than >> the change I made in r231336). >>=20 >> MFC after: 1 week >>=20 >> Modified: >> head/lib/Makefile >>=20 >> Modified: head/lib/Makefile >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/lib/Makefile Sun Apr 14 18:36:30 2013 = (r249483) >> +++ head/lib/Makefile Sun Apr 14 19:13:51 2013 = (r249484) >> @@ -252,4 +252,7 @@ _libusbhid=3D libusbhid >> _libusb=3D libusb >> .endif >>=20 >> +afterinstall: >> + ln -fs ../include ${DESTDIR}/usr/lib/include >> + >> .include >=20 > This breaks with -DNO_CLEAN defined, because then > ${DESTDIR}/usr/lib/include/include is created. That's a good point. Would this work better? afterinstall: if [ ! -e $(DESTDIR)/usr/lib/include ]; then ln -fs ../include $(DESTDIR)/usr/lib/include fi > I'm not that fond of this patch by the way, but I don't fully > understand the problem it's trying to solve so I won't object. > It just looks too much like a hack to me It's a subtle issue and I'm not surprised that it raised some eyebrows. I spent a long time looking for a better solution. In short, both GCC and Clang make some assumptions about the layout of headers used for freestanding compiles. (My earlier commit said these assumptions were "undocumented", but that's not quite true, they're just rather obscure.) This symlink is the simplest way I've found to reconcile those assumptions with the FreeBSD directory layout. I'm happy to consider alternatives. Tim --Apple-Mail=_C5B7AA32-82D9-4A21-A2B9-8A1EF782368B Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.18 (Darwin) iQEcBAEBAgAGBQJRbjqDAAoJEGMNyGo0rfFBegQIALW3pBzjml5NRyfd+pRjEePr H1xLELuQOFcNRMuNFuO1Kvky/p8QBrqqoa73GLcj15/3z1wWWv5wJQSHKp6WasbJ 8kByp2FYVb/GOaydBPGB3+ijlFh/rsUZBYIEsWg5WU2YhwdE2Oc5Y6+3jIAu2STJ yNy0uz9wN6GGlmPgf3GdTMEq00f0iOOGxflWPjJIblmDJm64YEN6pqnUVWwkJ5Wu MB77IdUNGq/bjOSeoXLtdy6kjShALuw25yAKibFL+NlAInHx0IE2Az/bGKqNM1d6 /ZW2ZFGjKFMxkFPQcMEbNB28PhlrANvrZ3G7aipYmenhRS//2IgFPJXvycwVHpc= =dgEC -----END PGP SIGNATURE----- --Apple-Mail=_C5B7AA32-82D9-4A21-A2B9-8A1EF782368B-- From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 06:06:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 29334F49 for ; Wed, 17 Apr 2013 06:06:57 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by mx1.freebsd.org (Postfix) with ESMTP id AE86ED19 for ; Wed, 17 Apr 2013 06:06:56 +0000 (UTC) Received: by mail-lb0-f178.google.com with SMTP id q13so1265132lbi.37 for ; Tue, 16 Apr 2013 23:06:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=uhqQe3Scbl8WoatEqsl/fKPVLF8UQAAzO+cRhyd3L/4=; b=Zcv7dsfZRS1zDZnQMIa/dY1w+Swln0/zqofnTkTnh8OvpNA52N8doQH2bxxOITgvED cTKjEWP6bwD9IdpreiESQ+pvix38Q7v2/gtIr/+fvYW97XQrAmxBB+fIGxwnTgO3B+B5 saNFEQ35HADxUKf14T321JGVfGtmyzZPPqwoO4xRuQXrQPcQlLOJLaZDMU3u+kLCwxqW hFZjaGgPd779cG8XK6fjYbUYv2TrJg9lBo3OQbaWt8DX0otHezaGdgQX3kssJ9Guo7JK KS9x9L0JLGK4KyBhqbZDtXKnoi9gf9Ffnz61yKvjljEUHxMZgGXElYQXG3fFi8M3K7Lj P/bg== X-Received: by 10.112.61.6 with SMTP id l6mr2827815lbr.57.1366178815229; Tue, 16 Apr 2013 23:06:55 -0700 (PDT) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.152.28.196 with HTTP; Tue, 16 Apr 2013 23:06:34 -0700 (PDT) In-Reply-To: <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <516D54F5.4010501@FreeBSD.org> <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> From: Juli Mallett Date: Tue, 16 Apr 2013 23:06:34 -0700 X-Google-Sender-Auth: P2_tWqfPNmFwukTQGb9eVulKWRU Message-ID: Subject: Re: svn commit: r249484 - head/lib To: Tim Kientzle Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQnpix6gdUuODHGw87I6iXn7zZcUMIUqhZEkanotINUHg65ZikXBuBxXvTq6Fg7ilvAf37Bw Cc: svn-src-head@freebsd.org, Tijl Coosemans , src-committers@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 06:06:57 -0000 On Tue, Apr 16, 2013 at 11:00 PM, Tim Kientzle wrote: > > On Apr 16, 2013, at 6:41 AM, Tijl Coosemans wrote: > >> On 2013-04-14 21:13, Tim Kientzle wrote: >>> Author: kientzle >>> Date: Sun Apr 14 19:13:51 2013 >>> New Revision: 249484 >>> URL: http://svnweb.freebsd.org/changeset/base/249484 >>> >>> Log: >>> Install a symlink >>> /usr/lib/include ==> /usr/include >>> >>> This fixes -print-file-name=include in clang (and is >>> arguably a better way to fix the same issue in GCC than >>> the change I made in r231336). >>> >>> MFC after: 1 week >>> >>> Modified: >>> head/lib/Makefile >>> >>> Modified: head/lib/Makefile >>> ============================================================================== >>> --- head/lib/Makefile Sun Apr 14 18:36:30 2013 (r249483) >>> +++ head/lib/Makefile Sun Apr 14 19:13:51 2013 (r249484) >>> @@ -252,4 +252,7 @@ _libusbhid= libusbhid >>> _libusb= libusb >>> .endif >>> >>> +afterinstall: >>> + ln -fs ../include ${DESTDIR}/usr/lib/include >>> + >>> .include >> >> This breaks with -DNO_CLEAN defined, because then >> ${DESTDIR}/usr/lib/include/include is created. > > That's a good point. Would this work better? > > afterinstall: > if [ ! -e $(DESTDIR)/usr/lib/include ]; then > ln -fs ../include $(DESTDIR)/usr/lib/include > fi > >> I'm not that fond of this patch by the way, but I don't fully >> understand the problem it's trying to solve so I won't object. >> It just looks too much like a hack to me > > It's a subtle issue and I'm not surprised that it raised some > eyebrows. I spent a long time looking for a better solution. > > In short, both GCC and Clang make some assumptions > about the layout of headers used for freestanding compiles. > (My earlier commit said these assumptions were "undocumented", > but that's not quite true, they're just rather obscure.) If you're doing a freestanding compile...shouldn't you also be specifying both include and library paths explicitly? I just feel more confused by this explanation. Why not just specify -I/usr/include? (Or even better, if you're doing a freestanding compile, but want the default include paths, get the compiler to dump the default include paths and process that.) /usr/lib/include is just badly and plainly wrong unless it's absolutely, absolutely necessary. > This symlink is the simplest way I've found to reconcile those > assumptions with the FreeBSD directory layout. I'm happy to > consider alternatives. > > Tim > From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 06:26:17 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2C09D398; Wed, 17 Apr 2013 06:26:17 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id F087BDCF; Wed, 17 Apr 2013 06:26:16 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id r3H6QGWi067875; Wed, 17 Apr 2013 06:26:16 GMT (envelope-from kientzle@FreeBSD.org) Received: from [192.168.2.123] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id mrthxfvvujxf3k4cgie7n4y9i2; Wed, 17 Apr 2013 06:26:16 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Subject: Re: svn commit: r249484 - head/lib Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii From: Tim Kientzle In-Reply-To: Date: Tue, 16 Apr 2013 23:26:15 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <516D54F5.4010501@FreeBSD.org> <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> To: Juli Mallett X-Mailer: Apple Mail (2.1283) Cc: svn-src-head@FreeBSD.org, Tijl Coosemans , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 06:26:17 -0000 On Apr 16, 2013, at 11:06 PM, Juli Mallett wrote: > On Tue, Apr 16, 2013 at 11:00 PM, Tim Kientzle = wrote: >>=20 >> On Apr 16, 2013, at 6:41 AM, Tijl Coosemans wrote: >>=20 >>> On 2013-04-14 21:13, Tim Kientzle wrote: >>>> Author: kientzle >>>> Date: Sun Apr 14 19:13:51 2013 >>>> New Revision: 249484 >>>> URL: http://svnweb.freebsd.org/changeset/base/249484 >>>>=20 >>>> Log: >>>> Install a symlink >>>> /usr/lib/include =3D=3D> /usr/include >>>>=20 >>>> This fixes -print-file-name=3Dinclude in clang (and is >>>> arguably a better way to fix the same issue in GCC than >>>> the change I made in r231336). >>>>=20 >>>> MFC after: 1 week >>>>=20 >>>> Modified: >>>> head/lib/Makefile >>>>=20 >>>> Modified: head/lib/Makefile >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/lib/Makefile Sun Apr 14 18:36:30 2013 = (r249483) >>>> +++ head/lib/Makefile Sun Apr 14 19:13:51 2013 = (r249484) >>>> @@ -252,4 +252,7 @@ _libusbhid=3D libusbhid >>>> _libusb=3D libusb >>>> .endif >>>>=20 >>>> +afterinstall: >>>> + ln -fs ../include ${DESTDIR}/usr/lib/include >>>> + >>>> .include >>>=20 >>> This breaks with -DNO_CLEAN defined, because then >>> ${DESTDIR}/usr/lib/include/include is created. >>=20 >> That's a good point. Would this work better? >>=20 >> afterinstall: >> if [ ! -e $(DESTDIR)/usr/lib/include ]; then >> ln -fs ../include $(DESTDIR)/usr/lib/include >> fi >>=20 >>> I'm not that fond of this patch by the way, but I don't fully >>> understand the problem it's trying to solve so I won't object. >>> It just looks too much like a hack to me >>=20 >> It's a subtle issue and I'm not surprised that it raised some >> eyebrows. I spent a long time looking for a better solution. >>=20 >> In short, both GCC and Clang make some assumptions >> about the layout of headers used for freestanding compiles. >> (My earlier commit said these assumptions were "undocumented", >> but that's not quite true, they're just rather obscure.) >=20 > If you're doing a freestanding compile...shouldn't you also be > specifying both include and library paths explicitly? Yes, of course. But the correct directories to use vary somewhat across platforms, so we would like to have some reasonably portable way to find the right directory to use for building on a particular system. Both gcc and clang support a -print-file-name=3Dinclude option which is supposed to print out the directory containing headers used for freestanding compiles. You can then take that path and use it as the explicit include directory path for freestanding builds. > I just feel more confused by this explanation. Why not just specify > -I/usr/include? That would be FreeBSD-specific. Not everyone lumps all header files together like we do. > (Or even better, if you're doing a freestanding > compile, but want the default include paths, get the compiler to dump > the default include paths and process that.) That's precisely what this is for. I've been working with U-Boot sources which compile on many systems and use -print-file-name=3Dinclude to identify the directory containing the basic freestanding header files. The -print-file-name=3Dinclude option works on Linux, works on MacOS, and --- with this one symlink --- can work on FreeBSD as well. I've been using it to cross-build U-Boot using the FreeBSD xdev toolchain with both GCC and Clang. Tim From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 06:51:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E8A46E34; Wed, 17 Apr 2013 06:51:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DB95DEDF; Wed, 17 Apr 2013 06:51:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3H6pHA6087393; Wed, 17 Apr 2013 06:51:17 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3H6pHYo087392; Wed, 17 Apr 2013 06:51:17 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201304170651.r3H6pHYo087392@svn.freebsd.org> From: Rui Paulo Date: Wed, 17 Apr 2013 06:51:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249577 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 06:51:18 -0000 Author: rpaulo Date: Wed Apr 17 06:51:17 2013 New Revision: 249577 URL: http://svnweb.freebsd.org/changeset/base/249577 Log: Print more bits from the standard extended features CPUID which will be available in the Haswell architecture (c.f. Intel Document #319433-012A). Modified: head/sys/amd64/amd64/identcpu.c Modified: head/sys/amd64/amd64/identcpu.c ============================================================================== --- head/sys/amd64/amd64/identcpu.c Wed Apr 17 05:56:59 2013 (r249576) +++ head/sys/amd64/amd64/identcpu.c Wed Apr 17 06:51:17 2013 (r249577) @@ -388,11 +388,24 @@ printcpuinfo(void) printf("\n Standard Extended Features=0x%b", cpu_stdext_feature, "\020" + /* RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE */ "\001GSFSBASE" "\002TSCADJ" + /* Bit Manipulation Instructions */ + "\004BMI1" + /* Hardware Lock Elision */ + "\005HLE" + /* Advanced Vector Instructions 2 */ + "\006AVX2" + /* Supervisor Mode Execution Prot. */ "\010SMEP" + /* Bit Manipulation Instructions */ + "\011BMI2" "\012ENHMOVSB" + /* Invalidate Processor Context ID */ "\013INVPCID" + /* Restricted Transactional Memory */ + "\014RTM" ); } From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 07:12:40 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2D1D2981 for ; Wed, 17 Apr 2013 07:12:38 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) by mx1.freebsd.org (Postfix) with ESMTP id 2957DFCF for ; Wed, 17 Apr 2013 07:12:37 +0000 (UTC) Received: by mail-lb0-f170.google.com with SMTP id x11so1310186lbi.15 for ; Wed, 17 Apr 2013 00:12:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=pCCpcaet8DJKgGEyxJNMRmvcu07Izj+cO0TIUHOljPM=; b=pCjO2Y+ESzp2CO9LMXrmUsgXfjSaMn74VuCbG0qj5gPg6bsmS81OWs58wcRN/bQ2XT PJE3WsfxjNzZyt6Y6iX18uuXbr+83bjq92E2tFnTMp9J0xTl8VJU/805Khf4z83XVIvY bv298vI6BSlxVMwJqgNCS+jBNuOOhqrdeSaernst97hRx28m4kXwQfhopVcRaTn+94Mm 8GUOOULR6cGABJkfN3Q3nG51unDmk62n+BJLNMFGxH4dwbft9xl4Eet1wZHgdcrMn2v4 f93J2DZbcFIbEDZ1MykM0Gwcimy6mjhcIOLxyNl7Gss32PPC/UwvOvS2spTjM/O/P2sY JDVQ== X-Received: by 10.112.61.6 with SMTP id l6mr2931088lbr.57.1366182750843; Wed, 17 Apr 2013 00:12:30 -0700 (PDT) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.152.28.196 with HTTP; Wed, 17 Apr 2013 00:12:09 -0700 (PDT) In-Reply-To: <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <516D54F5.4010501@FreeBSD.org> <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> From: Juli Mallett Date: Wed, 17 Apr 2013 00:12:09 -0700 X-Google-Sender-Auth: KmWgIraiG5fMn9H-95_DiqmEZNI Message-ID: Subject: Re: svn commit: r249484 - head/lib To: Tim Kientzle Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQkatcOzNSQWrp2idbE2130A97zUGO9WJAwvL9mCg+exWs7GG10tc7s1RkNhWve0PKC0DeMc Cc: svn-src-head@freebsd.org, Tijl Coosemans , src-committers@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 07:12:40 -0000 On Tue, Apr 16, 2013 at 11:26 PM, Tim Kientzle wrote: > > On Apr 16, 2013, at 11:06 PM, Juli Mallett wrote: >> If you're doing a freestanding compile...shouldn't you also be >> specifying both include and library paths explicitly? > > Yes, of course. But the correct directories to use vary somewhat > across platforms, so we would like to have some reasonably > portable way to find the right directory to use for building on > a particular system. > > Both gcc and clang support a -print-file-name=include option which > is supposed to print out the directory containing headers used > for freestanding compiles. You can then take that path and > use it as the explicit include directory path for freestanding builds. Right... >> (Or even better, if you're doing a freestanding >> compile, but want the default include paths, get the compiler to dump >> the default include paths and process that.) > > That's precisely what this is for. I've been working with U-Boot > sources which compile on many systems and use > -print-file-name=include to identify the directory containing > the basic freestanding header files. > > The -print-file-name=include option works on Linux, works > on MacOS, and --- with this one symlink --- can work on > FreeBSD as well. I've been using it to cross-build U-Boot > using the FreeBSD xdev toolchain with both GCC and Clang. I'm confused as to how it wasn't working, and am not convinced that it shouldn't be fixed otherwise. It seems like for clang the user ought to get /usr/include/clang/{version}, except for the problem that we don't put some headers there that some software might expect; so maybe we should just install copies of things like stddef.h into the compiler-specific directory as well? I'm not sure I'm fully understanding your needs, or what you're seeing in practice. Certainly none of those systems have a /usr/lib/include AFAIK; this seems like we're just not deploying our compilers configured in the way that some software (perhaps rightly) expects. And -print-file-name=include doesn't give you the full search path; shouldn't it just give the compiler-specific include directory? You really want something like: % clang -E -Xpreprocessor -v -x c /dev/null For C, and -x c++ for C++. What are the headers you are expecting to find? stddef.h, stdbool.h, stdarg.h? I think I'd rather just see those installed in the compiler-specific dirs, and if we're not spitting those out with our stock-built compilers, we should fix that to match behaviour on other systems. Other systems' -print-file-name=include doesn't expose all of /usr/include, as far as I can tell. That seem excessive and wrong for a freestanding build. From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 07:21:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7F8ECB13; Wed, 17 Apr 2013 07:21:31 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6231E9A; Wed, 17 Apr 2013 07:21:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3H7LVm4096700; Wed, 17 Apr 2013 07:21:31 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3H7LVYU096698; Wed, 17 Apr 2013 07:21:31 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304170721.r3H7LVYU096698@svn.freebsd.org> From: Adrian Chadd Date: Wed, 17 Apr 2013 07:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249578 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 07:21:31 -0000 Author: adrian Date: Wed Apr 17 07:21:30 2013 New Revision: 249578 URL: http://svnweb.freebsd.org/changeset/base/249578 Log: Update the rate series setup code to use the decisions already made in ath_tx_rate_fill_rcflags(). Include setting up the TX power cap in the rate scenario setup code being passed to the HAL. Other things: * add a tx power cap field in ath_rc. * Add a three-stream flag in ath_rc. * Delete the LDPC flag from ath_rc - it's not a per-rate flag, it's a global flag for the transmission. Modified: head/sys/dev/ath/if_ath_tx_ht.c head/sys/dev/ath/if_athrate.h Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Wed Apr 17 06:51:17 2013 (r249577) +++ head/sys/dev/ath/if_ath_tx_ht.c Wed Apr 17 07:21:30 2013 (r249578) @@ -280,10 +280,26 @@ ath_tx_rate_fill_rcflags(struct ath_soft rc[i].flags |= ATH_RC_STBC_FLAG; } - /* XXX dual stream? and 3-stream? */ + /* + * XXX TODO: LDPC + */ + + /* + * Dual / Triple stream rate? + */ + if (HT_RC_2_STREAMS(rate) == 2) + rc[i].flags |= ATH_RC_DS_FLAG; + else if (HT_RC_2_STREAMS(rate) == 3) + rc[i].flags |= ATH_RC_TS_FLAG; } /* + * Calculate the maximum TX power cap for the current + * node. + */ + rc[i].tx_power_cap = ieee80211_get_node_txpower(ni); + + /* * Calculate the maximum 4ms frame length based * on the MCS rate, SGI and channel width flags. */ @@ -470,11 +486,10 @@ ath_get_aggr_limit(struct ath_softc *sc, * * This should be called for both legacy and MCS rates. * + * This uses the rate series stuf from ath_tx_rate_fill_rcflags(). + * * It, along with ath_buf_set_rate, must be called -after- a burst * or aggregate is setup. - * - * XXX TODO: it should use the rate series information from the - * ath_buf, rather than recalculating it here! */ static void ath_rateseries_setup(struct ath_softc *sc, struct ieee80211_node *ni, @@ -486,7 +501,6 @@ ath_rateseries_setup(struct ath_softc *s const HAL_RATE_TABLE *rt = sc->sc_currates; int i; int pktlen; - int flags = bf->bf_state.bfs_txflags; struct ath_rc_series *rc = bf->bf_state.bfs_rc; if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) && @@ -528,63 +542,33 @@ ath_rateseries_setup(struct ath_softc *s */ series[i].Rate = rt->info[rc[i].rix].rateCode; series[i].RateIndex = rc[i].rix; - series[i].tx_power_cap = 0x3f; /* XXX for now */ + series[i].tx_power_cap = rc[i].tx_power_cap; /* * Enable RTS/CTS as appropriate. */ - if (flags & (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA)) + if (rc[i].flags & ATH_RC_RTSCTS_FLAG) series[i].RateFlags |= HAL_RATESERIES_RTS_CTS; - - if (IS_HT_RATE(rt->info[rc[i].rix].rateCode)) { - /* - * Transmit 40MHz frames only if the node has negotiated - * it rather than whether the node is capable of it or not. - * It's subtly different in the hostap case. - */ - if (ni->ni_chw == 40) + /* + * 11n rate? Update 11n flags. + */ + if (rc[i].flags & ATH_RC_HT_FLAG) { + if (rc[i].flags & ATH_RC_CW40_FLAG) series[i].RateFlags |= HAL_RATESERIES_2040; - /* - * Set short-GI only if the node has advertised it - * the channel width is suitable, and we support it. - * We don't currently have a "negotiated" set of bits - - * ni_htcap is what the remote end sends, not what this - * node is capable of. - */ - if (ni->ni_chw == 40 && - ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40 && - ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) - series[i].RateFlags |= HAL_RATESERIES_HALFGI; - - if (ni->ni_chw == 20 && - ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20 && - ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) + if (rc[i].flags & ATH_RC_SGI_FLAG) series[i].RateFlags |= HAL_RATESERIES_HALFGI; - /* - * If we have STBC TX enabled and the receiver - * can receive (at least) 1 stream STBC, AND it's - * MCS 0-7, AND we have at least two chains enabled, - * enable STBC. - */ - if (ic->ic_htcaps & IEEE80211_HTCAP_TXSTBC && - ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM && - (sc->sc_cur_txchainmask > 1) && - HT_RC_2_STREAMS(series[i].Rate) == 1) { + if (rc[i].flags & ATH_RC_STBC_FLAG) series[i].RateFlags |= HAL_RATESERIES_STBC; - } - /* - * XXX TODO: LDPC if it's possible - */ } /* * PktDuration doesn't include slot, ACK, RTS, etc timing - * it's just the packet duration */ - if (series[i].Rate & IEEE80211_RATE_MCS) { + if (rc[i].flags & ATH_RC_HT_FLAG) { series[i].PktDuration = ath_computedur_ht(pktlen , series[i].Rate Modified: head/sys/dev/ath/if_athrate.h ============================================================================== --- head/sys/dev/ath/if_athrate.h Wed Apr 17 06:51:17 2013 (r249577) +++ head/sys/dev/ath/if_athrate.h Wed Apr 17 07:21:30 2013 (r249578) @@ -85,14 +85,15 @@ void ath_rate_detach(struct ath_ratectrl #define ATH_RC_HT_FLAG 0x08 /* use HT */ #define ATH_RC_RTSCTS_FLAG 0x10 /* enable RTS/CTS protection */ #define ATH_RC_STBC_FLAG 0x20 /* enable STBC */ -#define ATH_RC_LDPC_FLAG 0x40 /* enable STBC */ +#define ATH_RC_TS_FLAG 0x40 /* triple-stream rate */ struct ath_rc_series { uint8_t rix; /* ratetable index, not rate code */ uint8_t ratecode; /* hardware rate code */ uint8_t tries; - uint8_t flags; - uint32_t max4msframelen; + uint8_t tx_power_cap; + uint16_t flags; + uint16_t max4msframelen; }; /* From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 07:22:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9C737C9B; Wed, 17 Apr 2013 07:22:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8F308AC; Wed, 17 Apr 2013 07:22:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3H7MNNj096898; Wed, 17 Apr 2013 07:22:23 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3H7MNEa096897; Wed, 17 Apr 2013 07:22:23 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304170722.r3H7MNEa096897@svn.freebsd.org> From: Adrian Chadd Date: Wed, 17 Apr 2013 07:22:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249579 - head/sys/dev/ath/ath_hal/ar9001 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 07:22:23 -0000 Author: adrian Date: Wed Apr 17 07:22:23 2013 New Revision: 249579 URL: http://svnweb.freebsd.org/changeset/base/249579 Log: Use the TPC bank by default for AR9160. Tested: * AR9160, hostap, verified TX power using (2GHz) spectrum analyser TODO: * 5GHz verification! Modified: head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c Modified: head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c Wed Apr 17 07:21:30 2013 (r249578) +++ head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c Wed Apr 17 07:22:23 2013 (r249579) @@ -183,7 +183,7 @@ ar9160Attach(uint16_t devid, HAL_SOFTC s HAL_INI_INIT(&AH5416(ah)->ah_ini_bank1, ar9160Bank1, 2); HAL_INI_INIT(&AH5416(ah)->ah_ini_bank2, ar9160Bank2, 2); HAL_INI_INIT(&AH5416(ah)->ah_ini_bank3, ar9160Bank3, 3); - HAL_INI_INIT(&AH5416(ah)->ah_ini_bank6, ar9160Bank6, 3); + HAL_INI_INIT(&AH5416(ah)->ah_ini_bank6, ar9160Bank6TPC, 3); HAL_INI_INIT(&AH5416(ah)->ah_ini_bank7, ar9160Bank7, 2); if (AR_SREV_SOWL_11(ah)) HAL_INI_INIT(&AH5416(ah)->ah_ini_addac, ar9160Addac_1_1, 2); From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 07:31:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 05362BF; Wed, 17 Apr 2013 07:31:55 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EBA38115; Wed, 17 Apr 2013 07:31:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3H7Vsah099894; Wed, 17 Apr 2013 07:31:54 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3H7VsmS099883; Wed, 17 Apr 2013 07:31:54 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304170731.r3H7VsmS099883@svn.freebsd.org> From: Adrian Chadd Date: Wed, 17 Apr 2013 07:31:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249580 - in head/sys/dev/ath/ath_hal: ar5416 ar9002 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 07:31:55 -0000 Author: adrian Date: Wed Apr 17 07:31:53 2013 New Revision: 249580 URL: http://svnweb.freebsd.org/changeset/base/249580 Log: Setup needed tables for TPC on AR5416->AR9287 chips. * Add ah_ratesArray[] to the ar5416 HAL state - this stores the maximum values permissable per rate. * Since different chip EEPROM formats store this value in a different place, store the HT40 power detector increment value in the ar5416 HAL state. * Modify the target power setup code to store the maximum values in the ar5416 HAL state rather than using a local variable. * Add ar5416RateToRateTable() - to convert a hardware rate code to the ratesArray enum / index. * Add ar5416GetTxRatePower() - which goes through the gymnastics required to correctly calculate the target TX power: + Add the power detector increment for ht40; + Take the power offset into account for AR9280 and later; + Offset the TX power correctly when doing open-loop TX power control; + Enforce the per-rate maximum value allowable. Note - setting a TPC value of 0x0 in the TX descriptor on (at least) the AR9160 resulted in the TX power being very high indeed. This didn't happen on the AR9220. I'm guessing it's a chip bug that was fixed at some point. So for now, just assume the AR5416/AR5418 and AR9130 are also suspect and clamp the minimum value here at 1. Tested: * AR5416, AR9160, AR9220 hostap, verified using (2GHz) spectrum analyser * Looked at target TX power in TX descriptor (using athalq) as well as TX power on the spectrum analyser. TODO: * The TX descriptor code sets the target TX power to 0 for AR9285 chips. I'm not yet sure why. Disable this for TPC and ensure that the TPC TX power is set. * AR9280, AR9285, AR9227, AR9287 testing! * 5GHz testing! Quirks: * The per-packet TPC code is only exercised when the tpc sysctl is set to 1. (dev.ath.X.tpc=1.) This needs to be done before you bring the interface up. * When TPC is enabled, setting the TX power doesn't end up with a call through to the HAL to update the maximum TX power. So ensure that you set the TPC sysctl before you bring the interface up and configure a lower TX power or the hardware will be clamped by the lower TX power (at least until the next channel change.) Thanks to Qualcomm Atheros for all the hardware, and Sam Leffler for use of his spectrum analyser to verify the TX channel power. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c head/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c head/sys/dev/ath/ath_hal/ar9002/ar9287_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Wed Apr 17 07:22:23 2013 (r249579) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Wed Apr 17 07:31:53 2013 (r249580) @@ -132,7 +132,12 @@ struct ath_hal_5416 { struct ar5416NfLimits nf_2g; struct ar5416NfLimits nf_5g; + /* + * TX power configuration related structures + */ int initPDADC; + int ah_ht40PowerIncForPdadc; + int16_t ah_ratesArray[Ar5416RateSize]; int ah_need_an_top2_fixup; /* merlin or later chips that may need this workaround */ Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Wed Apr 17 07:22:23 2013 (r249579) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Wed Apr 17 07:31:53 2013 (r249580) @@ -1005,6 +1005,14 @@ ar5416WriteTxPowerRateRegisters(struct a | POW_SM(ratesArray[rateDupCck], 0) ); } + + /* + * Set max power to 30 dBm and, optionally, + * enable TPC in tx descriptors. + */ + OS_REG_WRITE(ah, AR_PHY_POWER_TX_RATE_MAX, MAX_RATE_POWER | + (AH5212(ah)->ah_tpcEnabled ? AR_PHY_POWER_TX_RATE_MAX_TPC_ENABLE : 0)); +#undef POW_SM } @@ -1019,12 +1027,11 @@ ar5416SetTransmitPower(struct ath_hal *a const struct ieee80211_channel *chan, uint16_t *rfXpdGain) { #define N(a) (sizeof (a) / sizeof (a[0])) +#define POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) MODAL_EEP_HEADER *pModal; struct ath_hal_5212 *ahp = AH5212(ah); - int16_t ratesArray[Ar5416RateSize]; int16_t txPowerIndexOffset = 0; - uint8_t ht40PowerIncForPdadc = 2; int i; uint16_t cfgCtl; @@ -1037,8 +1044,13 @@ ar5416SetTransmitPower(struct ath_hal *a HALASSERT(AH_PRIVATE(ah)->ah_eeversion >= AR_EEPROM_VER14_1); + /* + * Default to 2, is overridden based on the EEPROM version / value. + */ + AH5416(ah)->ah_ht40PowerIncForPdadc = 2; + /* Setup info for the actual eeprom */ - OS_MEMZERO(ratesArray, sizeof(ratesArray)); + OS_MEMZERO(AH5416(ah)->ah_ratesArray, sizeof(AH5416(ah)->ah_ratesArray)); cfgCtl = ath_hal_getctl(ah, chan); powerLimit = chan->ic_maxregpower * 2; twiceAntennaReduction = chan->ic_maxantgain; @@ -1048,11 +1060,12 @@ ar5416SetTransmitPower(struct ath_hal *a __func__,chan->ic_freq, cfgCtl ); if (IS_EEP_MINOR_V2(ah)) { - ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc; + AH5416(ah)->ah_ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc; } if (!ar5416SetPowerPerRateTable(ah, pEepData, chan, - &ratesArray[0],cfgCtl, + &AH5416(ah)->ah_ratesArray[0], + cfgCtl, twiceAntennaReduction, twiceMaxRegulatoryPower, powerLimit)) { HALDEBUG(ah, HAL_DEBUG_ANY, @@ -1066,14 +1079,15 @@ ar5416SetTransmitPower(struct ath_hal *a return AH_FALSE; } - maxPower = AH_MAX(ratesArray[rate6mb], ratesArray[rateHt20_0]); + maxPower = AH_MAX(AH5416(ah)->ah_ratesArray[rate6mb], + AH5416(ah)->ah_ratesArray[rateHt20_0]); if (IEEE80211_IS_CHAN_2GHZ(chan)) { - maxPower = AH_MAX(maxPower, ratesArray[rate1l]); + maxPower = AH_MAX(maxPower, AH5416(ah)->ah_ratesArray[rate1l]); } if (IEEE80211_IS_CHAN_HT40(chan)) { - maxPower = AH_MAX(maxPower, ratesArray[rateHt40_0]); + maxPower = AH_MAX(maxPower, AH5416(ah)->ah_ratesArray[rateHt40_0]); } ahp->ah_tx6PowerInHalfDbm = maxPower; @@ -1084,10 +1098,11 @@ ar5416SetTransmitPower(struct ath_hal *a * txPowerIndexOffset is set by the SetPowerTable() call - * adjust the rate table (0 offset if rates EEPROM not loaded) */ - for (i = 0; i < N(ratesArray); i++) { - ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]); - if (ratesArray[i] > AR5416_MAX_RATE_POWER) - ratesArray[i] = AR5416_MAX_RATE_POWER; + for (i = 0; i < N(AH5416(ah)->ah_ratesArray); i++) { + AH5416(ah)->ah_ratesArray[i] = + (int16_t)(txPowerIndexOffset + AH5416(ah)->ah_ratesArray[i]); + if (AH5416(ah)->ah_ratesArray[i] > AR5416_MAX_RATE_POWER) + AH5416(ah)->ah_ratesArray[i] = AR5416_MAX_RATE_POWER; } #ifdef AH_EEPROM_DUMP @@ -1098,7 +1113,7 @@ ar5416SetTransmitPower(struct ath_hal *a * this debugging; the values won't necessarily be what's being * programmed into the hardware. */ - ar5416PrintPowerPerRate(ah, ratesArray); + ar5416PrintPowerPerRate(ah, AH5416(ah)->ah_ratesArray); #endif /* @@ -1114,16 +1129,16 @@ ar5416SetTransmitPower(struct ath_hal *a &pwr_table_offset); /* Underflow power gets clamped at raw value 0 */ /* Overflow power gets camped at AR5416_MAX_RATE_POWER */ - for (i = 0; i < N(ratesArray); i++) { + for (i = 0; i < N(AH5416(ah)->ah_ratesArray); i++) { /* * + pwr_table_offset is in dBm * + ratesArray is in 1/2 dBm */ - ratesArray[i] -= (pwr_table_offset * 2); - if (ratesArray[i] < 0) - ratesArray[i] = 0; - else if (ratesArray[i] > AR5416_MAX_RATE_POWER) - ratesArray[i] = AR5416_MAX_RATE_POWER; + AH5416(ah)->ah_ratesArray[i] -= (pwr_table_offset * 2); + if (AH5416(ah)->ah_ratesArray[i] < 0) + AH5416(ah)->ah_ratesArray[i] = 0; + else if (AH5416(ah)->ah_ratesArray[i] > AR5416_MAX_RATE_POWER) + AH5416(ah)->ah_ratesArray[i] = AR5416_MAX_RATE_POWER; } } @@ -1150,9 +1165,9 @@ ar5416SetTransmitPower(struct ath_hal *a int cck_ofdm_delta = 2; int i; for (i = 0; i < N(adj); i++) { - ratesArray[adj[i]] -= cck_ofdm_delta; - if (ratesArray[adj[i]] < 0) - ratesArray[adj[i]] = 0; + AH5416(ah)->ah_ratesArray[adj[i]] -= cck_ofdm_delta; + if (AH5416(ah)->ah_ratesArray[adj[i]] < 0) + AH5416(ah)->ah_ratesArray[adj[i]] = 0; } } @@ -1164,18 +1179,20 @@ ar5416SetTransmitPower(struct ath_hal *a * XXX handle overflow/too high power level? */ if (IEEE80211_IS_CHAN_HT40(chan)) { - ratesArray[rateHt40_0] += ht40PowerIncForPdadc; - ratesArray[rateHt40_1] += ht40PowerIncForPdadc; - ratesArray[rateHt40_2] += ht40PowerIncForPdadc; - ratesArray[rateHt40_3] += ht40PowerIncForPdadc; - ratesArray[rateHt40_4] += ht40PowerIncForPdadc; - ratesArray[rateHt40_5] += ht40PowerIncForPdadc; - ratesArray[rateHt40_6] += ht40PowerIncForPdadc; - ratesArray[rateHt40_7] += ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_0] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_1] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_2] += AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_3] += AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_4] += AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_5] += AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_6] += AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_7] += AH5416(ah)->ah_ht40PowerIncForPdadc; } /* Write the TX power rate registers */ - ar5416WriteTxPowerRateRegisters(ah, chan, ratesArray); + ar5416WriteTxPowerRateRegisters(ah, chan, AH5416(ah)->ah_ratesArray); /* Write the Power subtraction for dynamic chain changing, for per-packet powertx */ OS_REG_WRITE(ah, AR_PHY_POWER_TX_SUB, Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Wed Apr 17 07:22:23 2013 (r249579) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Wed Apr 17 07:31:53 2013 (r249580) @@ -155,6 +155,169 @@ ar5416StopTxDma(struct ath_hal *ah, u_in /* NB: accept HT rates */ #define isValidTxRate(_r) ((1<<((_r) & 0x7f)) & VALID_TX_RATES) +static inline int +ar5416RateToRateTable(struct ath_hal *ah, uint8_t rate, HAL_BOOL is_ht40) +{ + + /* + * Handle the non-MCS rates + */ + switch (rate) { + case /* 1 Mb */ 0x1b: + case /* 1 MbS*/ 0x1b | 0x4: + return (AH5416(ah)->ah_ratesArray[rate1l]); + case /* 2 Mb */ 0x1a: + return (AH5416(ah)->ah_ratesArray[rate2l]); + case /* 2 MbS*/ 0x1a | 0x4: + return (AH5416(ah)->ah_ratesArray[rate2s]); + case /* 5.5 Mb */ 0x19: + return (AH5416(ah)->ah_ratesArray[rate5_5l]); + case /* 5.5 MbS*/ 0x19 | 0x4: + return (AH5416(ah)->ah_ratesArray[rate5_5s]); + case /* 11 Mb */ 0x18: + return (AH5416(ah)->ah_ratesArray[rate11l]); + case /* 11 MbS*/ 0x18 | 0x4: + return (AH5416(ah)->ah_ratesArray[rate11s]); + } + + /* OFDM rates */ + switch (rate) { + case /* 6 Mb */ 0x0b: + return (AH5416(ah)->ah_ratesArray[rate6mb]); + case /* 9 Mb */ 0x0f: + return (AH5416(ah)->ah_ratesArray[rate9mb]); + case /* 12 Mb */ 0x0a: + return (AH5416(ah)->ah_ratesArray[rate12mb]); + case /* 18 Mb */ 0x0e: + return (AH5416(ah)->ah_ratesArray[rate18mb]); + case /* 24 Mb */ 0x09: + return (AH5416(ah)->ah_ratesArray[rate24mb]); + case /* 36 Mb */ 0x0d: + return (AH5416(ah)->ah_ratesArray[rate36mb]); + case /* 48 Mb */ 0x08: + return (AH5416(ah)->ah_ratesArray[rate48mb]); + case /* 54 Mb */ 0x0c: + return (AH5416(ah)->ah_ratesArray[rate54mb]); + } + + /* + * Handle HT20/HT40 - we only have to do MCS0-7; + * there's no stream differences. + */ + if ((rate & 0x80) && is_ht40) { + return (AH5416(ah)->ah_ratesArray[rateHt40_0 + (rate & 0x7)]); + } else if (rate & 0x80) { + return (AH5416(ah)->ah_ratesArray[rateHt20_0 + (rate & 0x7)]); + } + + /* XXX default (eg XR, bad bad person!) */ + return (AH5416(ah)->ah_ratesArray[rate6mb]); +} + +/* + * Return the TX power to be used for the given rate/chains/TX power. + * + * There are a bunch of tweaks to make to a given TX power based on + * the current configuration, so... + */ +static uint16_t +ar5416GetTxRatePower(struct ath_hal *ah, uint8_t rate, uint8_t tx_chainmask, + uint16_t txPower, HAL_BOOL is_ht40) +{ + int n_txpower, max_txpower; + const int cck_ofdm_delta = 2; +#define EEP_MINOR(_ah) \ + (AH_PRIVATE(_ah)->ah_eeversion & AR5416_EEP_VER_MINOR_MASK) +#define IS_EEP_MINOR_V2(_ah) (EEP_MINOR(_ah) >= AR5416_EEP_MINOR_VER_2) + + /* Take a copy ; we may underflow and thus need to clamp things */ + n_txpower = txPower; + + /* HT40? Need to adjust the TX power by this */ + if (is_ht40) + n_txpower += AH5416(ah)->ah_ht40PowerIncForPdadc; + + /* + * Merlin? Offset the target TX power offset - it defaults to + * starting at -5.0dBm, but that can change! + * + * Kiwi/Kite? Always -5.0dBm offset. + */ + if (AR_SREV_KIWI_10_OR_LATER(ah)) { + n_txpower -= (AR5416_PWR_TABLE_OFFSET_DB * 2); + } else if (AR_SREV_MERLIN_20_OR_LATER(ah)) { + int8_t pwr_table_offset = 0; + /* This is in dBm, convert to 1/2 dBm */ + (void) ath_hal_eepromGet(ah, AR_EEP_PWR_TABLE_OFFSET, + &pwr_table_offset); + n_txpower -= (pwr_table_offset * 2); + } + + /* + * If Open-loop TX power control is used, the CCK rates need + * to be offset by that. + * + * Rates: 2S, 2L, 1S, 1L, 5.5S, 5.5L + * + * XXX Odd, we don't have a PHY table entry for long preamble + * 1mbit CCK? + */ + if (AR_SREV_MERLIN_20_OR_LATER(ah) && + ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) { + + if (rate == 0x19 || rate == 0x1a || rate == 0x1b || + rate == (0x19 | 0x04) || rate == (0x1a | 0x04) || + rate == (0x1b | 0x04)) { + n_txpower -= cck_ofdm_delta; + } + } + + /* + * We're now offset by the same amount that the static maximum + * PHY power tables are. So, clamp the value based on that rate. + */ + max_txpower = ar5416RateToRateTable(ah, rate, is_ht40); +#if 0 + ath_hal_printf(ah, "%s: n_txpower = %d, max_txpower = %d, " + "rate = 0x%x , is_ht40 = %d\n", + __func__, + n_txpower, + max_txpower, + rate, + is_ht40); +#endif + n_txpower = MIN(max_txpower, n_txpower); + + /* + * We don't have to offset the TX power for two or three + * chain operation here - it's done by the AR_PHY_POWER_TX_SUB + * register setting via the EEPROM. + * + * So for vendors that programmed the maximum target power assuming + * that 2/3 chains are always on, things will just plain work. + * (They won't reach that target power if only one chain is on, but + * that's a different problem.) + */ + + /* Over/underflow? Adjust */ + if (n_txpower < 0) + n_txpower = 0; + else if (n_txpower > 63) + n_txpower = 63; + + /* + * For some odd reason the AR9160 with txpower=0 results in a + * much higher (max?) TX power. So, if it's a chipset before + * AR9220/AR9280, just clamp the minimum value at 1. + */ + if ((! AR_SREV_MERLIN_10_OR_LATER(ah)) && (n_txpower == 0)) + n_txpower = 1; + + return (n_txpower); +#undef EEP_MINOR +#undef IS_EEP_MINOR_V2 +} + HAL_BOOL ar5416SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds, u_int pktLen, @@ -187,6 +350,16 @@ ar5416SetupTxDesc(struct ath_hal *ah, st if (txPower > 63) txPower = 63; + /* + * XXX For now, just assume that this isn't a HT40 frame. + */ + if (AH5212(ah)->ah_tpcEnabled) { + txPower = ar5416GetTxRatePower(ah, txRate0, + ahp->ah_tx_chainmask, + txPower, + AH_FALSE); + } + ads->ds_ctl0 = (pktLen & AR_FrameLen) | (txPower << AR_XmitPower_S) | (flags & HAL_TXDESC_VEOL ? AR_VEOL : 0) @@ -238,6 +411,8 @@ ar5416SetupTxDesc(struct ath_hal *ah, st * Set the TX antenna to 0 for Kite * To preserve existing behaviour, also set the TPC bits to 0; * when TPC is enabled these should be filled in appropriately. + * + * XXX TODO: when doing TPC, set the TX power up appropriately? */ if (AR_SREV_KITE(ah)) { ads->ds_ctl8 = SM(0, AR_AntCtl0); @@ -744,6 +919,48 @@ ar5416Set11nRateScenario(struct ath_hal | set11nRateFlags(series, 2) | set11nRateFlags(series, 3) | SM(rtsctsRate, AR_RTSCTSRate); + + /* + * Doing per-packet TPC - update the TX power for the first + * field; program in the other series. + */ + if (AH5212(ah)->ah_tpcEnabled) { + uint32_t ds_ctl0; + uint16_t txPower; + + /* Modify the tx power field for rate 0 */ + txPower = ar5416GetTxRatePower(ah, series[0].Rate, + series[0].ChSel, + series[0].tx_power_cap, + !! (series[0].RateFlags & HAL_RATESERIES_2040)); + ds_ctl0 = ads->ds_ctl0 & ~AR_XmitPower; + ds_ctl0 |= (txPower << AR_XmitPower_S); + ads->ds_ctl0 = ds_ctl0; + + /* + * Override the whole descriptor field for each TX power. + * + * This will need changing if we ever support antenna control + * programming. + */ + txPower = ar5416GetTxRatePower(ah, series[1].Rate, + series[1].ChSel, + series[1].tx_power_cap, + !! (series[1].RateFlags & HAL_RATESERIES_2040)); + ads->ds_ctl9 = SM(0, AR_AntCtl1) | SM(txPower, AR_XmitPower1); + + txPower = ar5416GetTxRatePower(ah, series[2].Rate, + series[2].ChSel, + series[2].tx_power_cap, + !! (series[2].RateFlags & HAL_RATESERIES_2040)); + ads->ds_ctl10 = SM(0, AR_AntCtl2) | SM(txPower, AR_XmitPower2); + + txPower = ar5416GetTxRatePower(ah, series[3].Rate, + series[3].ChSel, + series[3].tx_power_cap, + !! (series[3].RateFlags & HAL_RATESERIES_2040)); + ads->ds_ctl11 = SM(0, AR_AntCtl3) | SM(txPower, AR_XmitPower3); + } } /* Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c Wed Apr 17 07:22:23 2013 (r249579) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c Wed Apr 17 07:31:53 2013 (r249580) @@ -76,9 +76,7 @@ ar9285SetTransmitPower(struct ath_hal *a MODAL_EEP4K_HEADER *pModal; struct ath_hal_5212 *ahp = AH5212(ah); - int16_t ratesArray[Ar5416RateSize]; int16_t txPowerIndexOffset = 0; - uint8_t ht40PowerIncForPdadc = 2; int i; uint16_t cfgCtl; @@ -91,8 +89,10 @@ ar9285SetTransmitPower(struct ath_hal *a HALASSERT(AH_PRIVATE(ah)->ah_eeversion >= AR_EEPROM_VER14_1); + AH5416(ah)->ah_ht40PowerIncForPdadc = 2; + /* Setup info for the actual eeprom */ - OS_MEMZERO(ratesArray, sizeof(ratesArray)); + OS_MEMZERO(AH5416(ah)->ah_ratesArray, sizeof(AH5416(ah)->ah_ratesArray)); cfgCtl = ath_hal_getctl(ah, chan); powerLimit = chan->ic_maxregpower * 2; twiceAntennaReduction = chan->ic_maxantgain; @@ -102,11 +102,11 @@ ar9285SetTransmitPower(struct ath_hal *a __func__,chan->ic_freq, cfgCtl ); if (IS_EEP_MINOR_V2(ah)) { - ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc; + AH5416(ah)->ah_ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc; } if (!ar9285SetPowerPerRateTable(ah, pEepData, chan, - &ratesArray[0],cfgCtl, + &AH5416(ah)->ah_ratesArray[0],cfgCtl, twiceAntennaReduction, twiceMaxRegulatoryPower, powerLimit)) { HALDEBUG(ah, HAL_DEBUG_ANY, @@ -120,11 +120,12 @@ ar9285SetTransmitPower(struct ath_hal *a return AH_FALSE; } - maxPower = AH_MAX(ratesArray[rate6mb], ratesArray[rateHt20_0]); - maxPower = AH_MAX(maxPower, ratesArray[rate1l]); + maxPower = AH_MAX(AH5416(ah)->ah_ratesArray[rate6mb], + AH5416(ah)->ah_ratesArray[rateHt20_0]); + maxPower = AH_MAX(maxPower, AH5416(ah)->ah_ratesArray[rate1l]); if (IEEE80211_IS_CHAN_HT40(chan)) { - maxPower = AH_MAX(maxPower, ratesArray[rateHt40_0]); + maxPower = AH_MAX(maxPower, AH5416(ah)->ah_ratesArray[rateHt40_0]); } ahp->ah_tx6PowerInHalfDbm = maxPower; @@ -135,18 +136,18 @@ ar9285SetTransmitPower(struct ath_hal *a * txPowerIndexOffset is set by the SetPowerTable() call - * adjust the rate table (0 offset if rates EEPROM not loaded) */ - for (i = 0; i < N(ratesArray); i++) { - ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]); + for (i = 0; i < N(AH5416(ah)->ah_ratesArray); i++) { + AH5416(ah)->ah_ratesArray[i] = (int16_t)(txPowerIndexOffset + AH5416(ah)->ah_ratesArray[i]); /* -5 dBm offset for Merlin and later; this includes Kite */ - ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2; - if (ratesArray[i] > AR5416_MAX_RATE_POWER) - ratesArray[i] = AR5416_MAX_RATE_POWER; - if (ratesArray[i] < 0) - ratesArray[i] = 0; + AH5416(ah)->ah_ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2; + if (AH5416(ah)->ah_ratesArray[i] > AR5416_MAX_RATE_POWER) + AH5416(ah)->ah_ratesArray[i] = AR5416_MAX_RATE_POWER; + if (AH5416(ah)->ah_ratesArray[i] < 0) + AH5416(ah)->ah_ratesArray[i] = 0; } #ifdef AH_EEPROM_DUMP - ar5416PrintPowerPerRate(ah, ratesArray); + ar5416PrintPowerPerRate(ah, AH5416(ah)->ah_ratesArray); #endif /* @@ -157,18 +158,26 @@ ar9285SetTransmitPower(struct ath_hal *a * XXX handle overflow/too high power level? */ if (IEEE80211_IS_CHAN_HT40(chan)) { - ratesArray[rateHt40_0] += ht40PowerIncForPdadc; - ratesArray[rateHt40_1] += ht40PowerIncForPdadc; - ratesArray[rateHt40_2] += ht40PowerIncForPdadc; - ratesArray[rateHt40_3] += ht40PowerIncForPdadc; - ratesArray[rateHt40_4] += ht40PowerIncForPdadc; - ratesArray[rateHt40_5] += ht40PowerIncForPdadc; - ratesArray[rateHt40_6] += ht40PowerIncForPdadc; - ratesArray[rateHt40_7] += ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_0] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_1] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_2] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_3] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_4] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_5] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_6] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_7] += + AH5416(ah)->ah_ht40PowerIncForPdadc; } /* Write the TX power rate registers */ - ar5416WriteTxPowerRateRegisters(ah, chan, ratesArray); + ar5416WriteTxPowerRateRegisters(ah, chan, AH5416(ah)->ah_ratesArray); return AH_TRUE; #undef POW_SM Modified: head/sys/dev/ath/ath_hal/ar9002/ar9287_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9287_reset.c Wed Apr 17 07:22:23 2013 (r249579) +++ head/sys/dev/ath/ath_hal/ar9002/ar9287_reset.c Wed Apr 17 07:31:53 2013 (r249580) @@ -333,9 +333,7 @@ ar9287SetTransmitPower(struct ath_hal *a const struct modal_eep_ar9287_header *pModal; struct ath_hal_5212 *ahp = AH5212(ah); - int16_t ratesArray[Ar5416RateSize]; int16_t txPowerIndexOffset = 0; - uint8_t ht40PowerIncForPdadc = 2; int i; uint16_t cfgCtl; @@ -346,8 +344,11 @@ ar9287SetTransmitPower(struct ath_hal *a HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; struct ar9287_eeprom *pEepData = &ee->ee_base; + AH5416(ah)->ah_ht40PowerIncForPdadc = 2; + /* Setup info for the actual eeprom */ - OS_MEMZERO(ratesArray, sizeof(ratesArray)); + OS_MEMZERO(AH5416(ah)->ah_ratesArray, + sizeof(AH5416(ah)->ah_ratesArray)); cfgCtl = ath_hal_getctl(ah, chan); powerLimit = chan->ic_maxregpower * 2; twiceAntennaReduction = chan->ic_maxantgain; @@ -358,11 +359,12 @@ ar9287SetTransmitPower(struct ath_hal *a __func__,chan->ic_freq, cfgCtl ); /* XXX Assume Minor is v2 or later */ - ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc; + AH5416(ah)->ah_ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc; /* Fetch per-rate power table for the given channel */ if (! ar9287SetPowerPerRateTable(ah, pEepData, chan, - &ratesArray[0],cfgCtl, + &AH5416(ah)->ah_ratesArray[0], + cfgCtl, twiceAntennaReduction, twiceMaxRegulatoryPower, powerLimit)) { HALDEBUG(ah, HAL_DEBUG_ANY, @@ -374,11 +376,14 @@ ar9287SetTransmitPower(struct ath_hal *a ar9287SetPowerCalTable(ah, chan, &txPowerIndexOffset); /* Calculate maximum power level */ - maxPower = AH_MAX(ratesArray[rate6mb], ratesArray[rateHt20_0]); - maxPower = AH_MAX(maxPower, ratesArray[rate1l]); + maxPower = AH_MAX(AH5416(ah)->ah_ratesArray[rate6mb], + AH5416(ah)->ah_ratesArray[rateHt20_0]); + maxPower = AH_MAX(maxPower, + AH5416(ah)->ah_ratesArray[rate1l]); if (IEEE80211_IS_CHAN_HT40(chan)) - maxPower = AH_MAX(maxPower, ratesArray[rateHt40_0]); + maxPower = AH_MAX(maxPower, + AH5416(ah)->ah_ratesArray[rateHt40_0]); ahp->ah_tx6PowerInHalfDbm = maxPower; AH_PRIVATE(ah)->ah_maxPowerLevel = maxPower; @@ -389,18 +394,20 @@ ar9287SetTransmitPower(struct ath_hal *a * adjust the rate table (0 offset if rates EEPROM not loaded) */ /* XXX what about the pwrTableOffset? */ - for (i = 0; i < N(ratesArray); i++) { - ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]); + for (i = 0; i < N(AH5416(ah)->ah_ratesArray); i++) { + AH5416(ah)->ah_ratesArray[i] = + (int16_t)(txPowerIndexOffset + + AH5416(ah)->ah_ratesArray[i]); /* -5 dBm offset for Merlin and later; this includes Kiwi */ - ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2; - if (ratesArray[i] > AR5416_MAX_RATE_POWER) - ratesArray[i] = AR5416_MAX_RATE_POWER; - if (ratesArray[i] < 0) - ratesArray[i] = 0; + AH5416(ah)->ah_ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2; + if (AH5416(ah)->ah_ratesArray[i] > AR5416_MAX_RATE_POWER) + AH5416(ah)->ah_ratesArray[i] = AR5416_MAX_RATE_POWER; + if (AH5416(ah)->ah_ratesArray[i] < 0) + AH5416(ah)->ah_ratesArray[i] = 0; } #ifdef AH_EEPROM_DUMP - ar5416PrintPowerPerRate(ah, ratesArray); + ar5416PrintPowerPerRate(ah, AH5416(ah)->ah_ratesArray); #endif /* @@ -411,18 +418,26 @@ ar9287SetTransmitPower(struct ath_hal *a * XXX handle overflow/too high power level? */ if (IEEE80211_IS_CHAN_HT40(chan)) { - ratesArray[rateHt40_0] += ht40PowerIncForPdadc; - ratesArray[rateHt40_1] += ht40PowerIncForPdadc; - ratesArray[rateHt40_2] += ht40PowerIncForPdadc; - ratesArray[rateHt40_3] += ht40PowerIncForPdadc; - ratesArray[rateHt40_4] += ht40PowerIncForPdadc; - ratesArray[rateHt40_5] += ht40PowerIncForPdadc; - ratesArray[rateHt40_6] += ht40PowerIncForPdadc; - ratesArray[rateHt40_7] += ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_0] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_1] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_2] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_3] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_4] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_5] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_6] += + AH5416(ah)->ah_ht40PowerIncForPdadc; + AH5416(ah)->ah_ratesArray[rateHt40_7] += + AH5416(ah)->ah_ht40PowerIncForPdadc; } /* Write the TX power rate registers */ - ar5416WriteTxPowerRateRegisters(ah, chan, ratesArray); + ar5416WriteTxPowerRateRegisters(ah, chan, AH5416(ah)->ah_ratesArray); return AH_TRUE; #undef POW_SM From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 08:34:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B1E414F8; Wed, 17 Apr 2013 08:34:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 298CD395; Wed, 17 Apr 2013 08:34:38 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r3H8YZCp009497; Wed, 17 Apr 2013 11:34:35 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.2 kib.kiev.ua r3H8YZCp009497 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r3H8YZwE009496; Wed, 17 Apr 2013 11:34:35 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 17 Apr 2013 11:34:35 +0300 From: Konstantin Belousov To: Rui Paulo Subject: Re: svn commit: r249577 - head/sys/amd64/amd64 Message-ID: <20130417083435.GY2930@kib.kiev.ua> References: <201304170651.r3H6pHYo087392@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CaDA/LpMQ9SI3HwJ" Content-Disposition: inline In-Reply-To: <201304170651.r3H6pHYo087392@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 08:34:39 -0000 --CaDA/LpMQ9SI3HwJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 17, 2013 at 06:51:17AM +0000, Rui Paulo wrote: > Author: rpaulo > Date: Wed Apr 17 06:51:17 2013 > New Revision: 249577 > URL: http://svnweb.freebsd.org/changeset/base/249577 >=20 > Log: > Print more bits from the standard extended features CPUID which will be > available in the Haswell architecture (c.f. Intel Document #319433-012A= ). Rev. 14 of the same document declares the meaning of the bits 18 (RDSEED), 19 (ADX) and 20 (SMAP) as well. --CaDA/LpMQ9SI3HwJ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRbl6aAAoJEJDCuSvBvK1B4k4P/2xaXsi3U/GkaAAg+fWloTgE byI+DUnAFreaC+kaPVhBMT+axBfGnvkwf08W09khqEiDITy3vdlzQ885Jnjooj+u d6ozwkpGx/JX6yZSiJlvqv/+JeBUi+j2mN3EI/lNg1ajvj5pQYsCUVpAYvRP6rAl Yo2/rwvjrduGIkQN/EAzPN2o+ckjbWuewg31nkf2ct/IX9Qcp5Yk1PE37ZsPAxUh wRTe+qz7ysu0vi2CxKO8ZzzWJHrfE2N3/CrmNN7wRVB/sirQVUcg3/ZxudMRdtk4 tiN28LymH796xWwjtrW+/ur7Z62alhqn/ub80CNQXmsNfNCsIuPL+w91HJXaA7nm 85FsGqEKa4WtZ5Zihqdiia9Z45MJRx2/kQlgJ2eQpMttlxXcQxC9Aox7sYHuO7hf 2pjGSZbE6kMQIFlwIQ/LxLO8qDwdMjJ5JxiVrvzSIz5BmQQOyjxNX83E5QcHU3jG 9ULHRpRH7GD2JxAMX5KVVrdmiXVqDUcZPlsFAgdq9linqQq8HI62Tk0OU3yUZQHF Dy5yCVVHkKlVQIB9IWWal6p9XcdLwfhOK8T1omPLRyyRCTvr+repsfA1STgagu/N mog4x+gKNpDkwaIENTbfzWR+1HNqUETxZvBqci3kF9Wr20gynYykMyIYBS+UThu5 X2qBHyJUy9cux/kiU+Cp =XI6W -----END PGP SIGNATURE----- --CaDA/LpMQ9SI3HwJ-- From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 09:19:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 94616FD; Wed, 17 Apr 2013 09:19:29 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 87AB6795; Wed, 17 Apr 2013 09:19:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3H9JTEL032834; Wed, 17 Apr 2013 09:19:29 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3H9JT34032833; Wed, 17 Apr 2013 09:19:29 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201304170919.r3H9JT34032833@svn.freebsd.org> From: Ivan Voras Date: Wed, 17 Apr 2013 09:19:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249581 - head/sys/modules/geom/geom_label X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 09:19:29 -0000 Author: ivoras Date: Wed Apr 17 09:19:29 2013 New Revision: 249581 URL: http://svnweb.freebsd.org/changeset/base/249581 Log: Link g_label_disk_ident when building geom_label as a module Modified: head/sys/modules/geom/geom_label/Makefile Modified: head/sys/modules/geom/geom_label/Makefile ============================================================================== --- head/sys/modules/geom/geom_label/Makefile Wed Apr 17 07:31:53 2013 (r249580) +++ head/sys/modules/geom/geom_label/Makefile Wed Apr 17 09:19:29 2013 (r249581) @@ -4,6 +4,7 @@ KMOD= geom_label SRCS= g_label.c +SRCS+= g_label_disk_ident.c SRCS+= g_label_ext2fs.c SRCS+= g_label_gpt.c SRCS+= g_label_iso9660.c From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 11:00:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9B95F6C3; Wed, 17 Apr 2013 11:00:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id 7850EC37; Wed, 17 Apr 2013 11:00:29 +0000 (UTC) Received: from ralph.baldwin.cx (c-68-39-198-164.hsd1.de.comcast.net [68.39.198.164]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 34B65B9AC; Wed, 17 Apr 2013 07:00:28 -0400 (EDT) From: John Baldwin To: Rui Paulo Subject: Re: svn commit: r249577 - head/sys/amd64/amd64 Date: Wed, 17 Apr 2013 06:47:05 -0400 User-Agent: KMail/1.13.7 (FreeBSD/9.1-STABLE; KDE/4.8.4; amd64; ; ) References: <201304170651.r3H6pHYo087392@svn.freebsd.org> In-Reply-To: <201304170651.r3H6pHYo087392@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201304170647.05488.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 17 Apr 2013 07:00:28 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 11:00:29 -0000 On Wednesday, April 17, 2013 02:51:17 AM Rui Paulo wrote: > Author: rpaulo > Date: Wed Apr 17 06:51:17 2013 > New Revision: 249577 > URL: http://svnweb.freebsd.org/changeset/base/249577 > > Log: > Print more bits from the standard extended features CPUID which will be > available in the Haswell architecture (c.f. Intel Document #319433-012A). Can you add appropriate constants with comments to x86/include/specialreg.h and remove the comments from here? (That is how we have documented all the other feature bits.) -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 11:00:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C820C6C6; Wed, 17 Apr 2013 11:00:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id 760EAC35; Wed, 17 Apr 2013 11:00:29 +0000 (UTC) Received: from ralph.baldwin.cx (c-68-39-198-164.hsd1.de.comcast.net [68.39.198.164]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B5809B9B9; Wed, 17 Apr 2013 07:00:28 -0400 (EDT) From: John Baldwin To: Jilles Tjoelker Subject: Re: svn commit: r249566 - in head: lib/libc/gen sys/kern Date: Wed, 17 Apr 2013 06:59:58 -0400 User-Agent: KMail/1.13.7 (FreeBSD/9.1-STABLE; KDE/4.8.4; amd64; ; ) References: <201304162026.r3GKQVgs093874@svn.freebsd.org> <20130416211503.GA1025@stack.nl> In-Reply-To: <20130416211503.GA1025@stack.nl> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201304170659.58569.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 17 Apr 2013 07:00:28 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 11:00:29 -0000 On Tuesday, April 16, 2013 05:15:03 PM Jilles Tjoelker wrote: > On Tue, Apr 16, 2013 at 08:26:31PM +0000, John Baldwin wrote: > > Author: jhb > > Date: Tue Apr 16 20:26:31 2013 > > New Revision: 249566 > > URL: http://svnweb.freebsd.org/changeset/base/249566 > > > > Log: > > - Document that sem_wait() can fail with EINTR if it is interrupted by > > a > > > > signal. > > > > - Fix the old ksem implementation for POSIX semaphores to not restart > > > > sem_wait() or sem_timedwait() if interrupted by a signal. > > > > MFC after: 1 week > > > > Modified: > > head/lib/libc/gen/sem_wait.3 > > head/sys/kern/uipc_sem.c > > > > Modified: head/lib/libc/gen/sem_wait.3 > > ========================================================================= > > ===== --- head/lib/libc/gen/sem_wait.3 Tue Apr 16 20:21:02 2013 (r249565) > > +++ head/lib/libc/gen/sem_wait.3 Tue Apr 16 20:26:31 2013 (r249566) @@ > > -27,7 +27,7 @@ > > > > .\" > > .\" $FreeBSD$ > > .\" > > > > -.Dd February 15, 2000 > > +.Dd April 16, 2013 > > > > .Dt SEM_WAIT 3 > > .Os > > .Sh NAME > > > > @@ -75,6 +75,14 @@ points to an invalid semaphore. > > > > .El > > .Pp > > Additionally, > > > > +.Fn sem_wait > > +will fail if: > > +.Bl -tag -width Er > > +.Pp > > +.It Bq Er EINTR > > +A signal interrupted this function. > > +.El > > +Additionally, > > > > .Fn sem_trywait > > will fail if: > > .Bl -tag -width Er > > > > Modified: head/sys/kern/uipc_sem.c > > ========================================================================= > > ===== --- head/sys/kern/uipc_sem.c Tue Apr 16 20:21:02 2013 (r249565) > > +++ head/sys/kern/uipc_sem.c Tue Apr 16 20:26:31 2013 (r249566) > > @@ -846,6 +846,8 @@ kern_sem_wait(struct thread *td, semid_t > > > > err: > > mtx_unlock(&sem_lock); > > fdrop(fp, td); > > > > + if (error == ERESTART) > > + error = EINTR; > > > > DP(("<<< kern_sem_wait leaving, pid=%d, error = %d\n", > > > > (int)td->td_proc->p_pid, error)); > > > > return (error); > > It would normally be expected (and required by POSIX) that a signal with > SA_RESTART set does not cause a function to fail with [EINTR], so more > rationale is needed here. > > Also, the timeouts passed to these functions are absolute and also are > at the system call level except UMTX_OP_SEM_WAIT which can take a > relative or an absolute timeout but libc passed it an absolute timeout. > So there is no need for a caller to see [EINTR] to avoid overlong > timeouts. > > Given the number of times people call sem_wait() without checking the > return value, call sem_wait() and assume any error is fatal or call > sem_timedwait() and assume any error is a timeout, I think it may be > better to go the other way and never fail with [EINTR], just like the > pthread functions. POSIX explicitly permits this: the [EINTR] error for > sem_wait(), sem_trywait() and sem_timedwait() is "may fail" rather than > the usual "shall fail" (note that SA_RESTART overrides such a "shall > fail" unless there is a relative timeout or it is explicitly excluded > with the function). > > I realize that this reduces functionality, but relying on [EINTR] here > introduces a race condition anyway (because the signal handler may be > called just before sem_wait() blocks). I suggest pthread cancellation, > not returning from the signal handler or leaving the default > action in place (if it is termination). The racy functionality can be > kept by leaving [EINTR] and [ERESTART] from the sleep function as they > are except for changing [ERESTART] to [EINTR] when UMTX_OP_SEM_WAIT was > passed a relative timeout. Breakage in programs that check sem_wait()'s > return value incorrectly will then be less frequent and only present > when POSIX permits it. Hmm, this merely documents how our current semaphores in 9.x and later behave and adjusts the semaphores in 8.x to behave the same way. For mutexes it seems we restart non-timed lock attempts and do not restart timed lock attempts in the umtx code (whereas all arbitrary waits in do_wait() are not restarted). If you want to fix the current semaphores to not fail with EINTR that would be fine with me, but our two implementations should be consistent (as should the manpages: sem_timedwait() documented EINTR but sem_wait() did not). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 11:40:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B8DB678B; Wed, 17 Apr 2013 11:40:14 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A917018D; Wed, 17 Apr 2013 11:40:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HBeExW077857; Wed, 17 Apr 2013 11:40:14 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HBeB5h076282; Wed, 17 Apr 2013 11:40:11 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201304171140.r3HBeB5h076282@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 17 Apr 2013 11:40:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249582 - in head: lib/libc/i386/string lib/libc/stdlib lib/libz sys/arm/include sys/arm/xscale/ixp425 sys/cam/scsi sys/dev/cxgb/common sys/dev/msk sys/dev/ppbus sys/dev/rndtest sys/ker... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 11:40:14 -0000 Author: gabor Date: Wed Apr 17 11:40:10 2013 New Revision: 249582 URL: http://svnweb.freebsd.org/changeset/base/249582 Log: - Correct mispellings of the word occurrence Submitted by: Christoph Mallon (via private mail) Modified: head/lib/libc/i386/string/memchr.S head/lib/libc/i386/string/strchr.S head/lib/libc/i386/string/strrchr.S head/lib/libc/stdlib/realpath.c head/lib/libz/zlib.h head/sys/arm/include/sysarch.h head/sys/arm/xscale/ixp425/ixp425_npe.c head/sys/cam/scsi/scsi_pass.c head/sys/cam/scsi/scsi_target.c head/sys/dev/cxgb/common/cxgb_t3_hw.c head/sys/dev/msk/if_msk.c head/sys/dev/ppbus/ppbconf.c head/sys/dev/rndtest/rndtest.c head/sys/kern/vfs_mount.c head/sys/ufs/ffs/ffs_balloc.c head/tools/regression/usr.bin/yacc/grammar.y head/tools/regression/usr.bin/yacc/regress.08.out head/usr.sbin/ppp/command.c Modified: head/lib/libc/i386/string/memchr.S ============================================================================== --- head/lib/libc/i386/string/memchr.S Wed Apr 17 09:19:29 2013 (r249581) +++ head/lib/libc/i386/string/memchr.S Wed Apr 17 11:40:10 2013 (r249582) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); /* * memchr (b, c, len) - * locates the first occurance of c in string b. + * locates the first occurrence of c in string b. * * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. Modified: head/lib/libc/i386/string/strchr.S ============================================================================== --- head/lib/libc/i386/string/strchr.S Wed Apr 17 09:19:29 2013 (r249581) +++ head/lib/libc/i386/string/strchr.S Wed Apr 17 11:40:10 2013 (r249582) @@ -33,11 +33,11 @@ __FBSDID("$FreeBSD$"); /* * strchr(s, c) - * return a pointer to the first occurance of the character c in + * return a pointer to the first occurrence of the character c in * string s, or NULL if c does not occur in the string. * * %edx - pointer iterating through string - * %eax - pointer to first occurance of 'c' + * %eax - pointer to first occurrence of 'c' * %cl - character we're comparing against * %bl - character at %edx * Modified: head/lib/libc/i386/string/strrchr.S ============================================================================== --- head/lib/libc/i386/string/strrchr.S Wed Apr 17 09:19:29 2013 (r249581) +++ head/lib/libc/i386/string/strrchr.S Wed Apr 17 11:40:10 2013 (r249582) @@ -33,11 +33,11 @@ __FBSDID("$FreeBSD$"); /* * strrchr(s, c) - * return a pointer to the last occurance of the character c in + * return a pointer to the last occurrence of the character c in * string s, or NULL if c does not occur in the string. * * %edx - pointer iterating through string - * %eax - pointer to last occurance of 'c' + * %eax - pointer to last occurrence of 'c' * %cl - character we're comparing against * %bl - character at %edx * Modified: head/lib/libc/stdlib/realpath.c ============================================================================== --- head/lib/libc/stdlib/realpath.c Wed Apr 17 09:19:29 2013 (r249581) +++ head/lib/libc/stdlib/realpath.c Wed Apr 17 11:40:10 2013 (r249582) @@ -139,7 +139,7 @@ realpath(const char * __restrict path, c * Only the trailing slashes are not covered * by other checks in the loop, but we verify * the prefix for any (rare) "//" or "/\0" - * occurence to not implement lookahead. + * occurrence to not implement lookahead. */ if (lstat(resolved, &sb) != 0) { if (m) Modified: head/lib/libz/zlib.h ============================================================================== --- head/lib/libz/zlib.h Wed Apr 17 09:19:29 2013 (r249581) +++ head/lib/libz/zlib.h Wed Apr 17 11:40:10 2013 (r249582) @@ -846,7 +846,7 @@ ZEXTERN int ZEXPORT inflateSync OF((z_st available input is skipped. No output is provided. inflateSync searches for a 00 00 FF FF pattern in the compressed data. - All full flush points have this pattern, but not all occurences of this + All full flush points have this pattern, but not all occurrences of this pattern are full flush points. inflateSync returns Z_OK if a possible full flush point has been found, Modified: head/sys/arm/include/sysarch.h ============================================================================== --- head/sys/arm/include/sysarch.h Wed Apr 17 09:19:29 2013 (r249581) +++ head/sys/arm/include/sysarch.h Wed Apr 17 11:40:10 2013 (r249582) @@ -47,7 +47,7 @@ * update the cpu_switch() (and cpu_throw()) code as well. * In addition, code in arm/include/atomic.h and arm/include/asmacros.h * assumes that ARM_RAS_END is at ARM_RAS_START+4, so be sure to update those - * if ARM_RAS_END moves in relation to ARM_RAS_START (look for occurrances + * if ARM_RAS_END moves in relation to ARM_RAS_START (look for occurrences * of ldr/str rm,[rn, #4]). */ Modified: head/sys/arm/xscale/ixp425/ixp425_npe.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425_npe.c Wed Apr 17 09:19:29 2013 (r249581) +++ head/sys/arm/xscale/ixp425/ixp425_npe.c Wed Apr 17 11:40:10 2013 (r249582) @@ -419,7 +419,7 @@ ixpnpe_stop(struct ixpnpe_softc *sc) /* * Indicates the start of an NPE Image, in new NPE Image Library format. - * 2 consecutive occurances indicates the end of the NPE Image Library + * 2 consecutive occurrences indicates the end of the NPE Image Library */ #define NPE_IMAGE_MARKER 0xfeedf00d Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Wed Apr 17 09:19:29 2013 (r249581) +++ head/sys/cam/scsi/scsi_pass.c Wed Apr 17 11:40:10 2013 (r249582) @@ -694,7 +694,7 @@ passsendccb(struct cam_periph *periph, u * match CCBs. For the SCSI, ATA and ADVINFO CCBs, we only pass the * CCB in if there's actually data to map. cam_periph_mapmem() will * do the right thing, even if there isn't data to map, but since CCBs - * without data are a reasonably common occurance (e.g. test unit + * without data are a reasonably common occurrence (e.g. test unit * ready), it will save a few cycles if we check for it here. * * XXX What happens if a sg list is supplied? We don't filter that Modified: head/sys/cam/scsi/scsi_target.c ============================================================================== --- head/sys/cam/scsi/scsi_target.c Wed Apr 17 09:19:29 2013 (r249581) +++ head/sys/cam/scsi/scsi_target.c Wed Apr 17 11:40:10 2013 (r249582) @@ -734,7 +734,7 @@ targsendccb(struct targ_softc *softc, un * match CCBs. For the SCSI CCBs, we only pass the CCB in if * there's actually data to map. cam_periph_mapmem() will do the * right thing, even if there isn't data to map, but since CCBs - * without data are a reasonably common occurance (e.g. test unit + * without data are a reasonably common occurrence (e.g. test unit * ready), it will save a few cycles if we check for it here. */ if (((ccb_h->flags & CAM_DATA_MASK) == CAM_DATA_VADDR) Modified: head/sys/dev/cxgb/common/cxgb_t3_hw.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_t3_hw.c Wed Apr 17 09:19:29 2013 (r249581) +++ head/sys/dev/cxgb/common/cxgb_t3_hw.c Wed Apr 17 11:40:10 2013 (r249582) @@ -1727,7 +1727,7 @@ struct intr_info { * @reg: the interrupt status register to process * @mask: a mask to apply to the interrupt status * @acts: table of interrupt actions - * @stats: statistics counters tracking interrupt occurences + * @stats: statistics counters tracking interrupt occurrences * * A table driven interrupt handler that applies a set of masks to an * interrupt status word and performs the corresponding actions if the Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Wed Apr 17 09:19:29 2013 (r249581) +++ head/sys/dev/msk/if_msk.c Wed Apr 17 11:40:10 2013 (r249582) @@ -3526,7 +3526,7 @@ msk_intr_hwerr(struct msk_softc *sc) * On PCI Express bus bridges are called root complexes (RC). * PCI Express errors are recognized by the root complex too, * which requests the system to handle the problem. After - * error occurence it may be that no access to the adapter + * error occurrence it may be that no access to the adapter * may be performed any longer. */ Modified: head/sys/dev/ppbus/ppbconf.c ============================================================================== --- head/sys/dev/ppbus/ppbconf.c Wed Apr 17 09:19:29 2013 (r249581) +++ head/sys/dev/ppbus/ppbconf.c Wed Apr 17 11:40:10 2013 (r249582) @@ -172,7 +172,7 @@ static char *pnp_classes[] = { /* * search_token() * - * Search the first occurence of a token within a string + * Search the first occurrence of a token within a string */ static char * search_token(char *str, int slen, char *token) Modified: head/sys/dev/rndtest/rndtest.c ============================================================================== --- head/sys/dev/rndtest/rndtest.c Wed Apr 17 09:19:29 2013 (r249581) +++ head/sys/dev/rndtest/rndtest.c Wed Apr 17 11:40:10 2013 (r249582) @@ -360,7 +360,7 @@ rndtest_chi_4(struct rndtest_state *rsp) for (i = 0; i < RNDTEST_CHI4_K; i++) freq[i] = 0; - /* Get number of occurances of each 4 bit pattern */ + /* Get number of occurrences of each 4 bit pattern */ for (i = 0; i < RNDTEST_NBYTES; i++) { freq[(rsp->rs_buf[i] >> 4) & RNDTEST_CHI4_K_MASK]++; freq[(rsp->rs_buf[i] >> 0) & RNDTEST_CHI4_K_MASK]++; Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Wed Apr 17 09:19:29 2013 (r249581) +++ head/sys/kern/vfs_mount.c Wed Apr 17 11:40:10 2013 (r249582) @@ -232,7 +232,7 @@ vfs_equalopts(const char *opt1, const ch /* * If a mount option is specified several times, * (with or without the "no" prefix) only keep - * the last occurence of it. + * the last occurrence of it. */ static void vfs_sanitizeopts(struct vfsoptlist *opts) Modified: head/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_balloc.c Wed Apr 17 09:19:29 2013 (r249581) +++ head/sys/ufs/ffs/ffs_balloc.c Wed Apr 17 11:40:10 2013 (r249582) @@ -453,7 +453,7 @@ fail: * We have to sync it at the end so that the soft updates code * does not find any untracked changes. Although this is really * slow, running out of disk space is not expected to be a common - * occurence. The error return from fsync is ignored as we already + * occurrence. The error return from fsync is ignored as we already * have an error to return to the user. * * XXX Still have to journal the free below Modified: head/tools/regression/usr.bin/yacc/grammar.y ============================================================================== --- head/tools/regression/usr.bin/yacc/grammar.y Wed Apr 17 09:19:29 2013 (r249581) +++ head/tools/regression/usr.bin/yacc/grammar.y Wed Apr 17 11:40:10 2013 (r249582) @@ -1027,7 +1027,7 @@ extern char *yytext; extern FILE *yyin, *yyout; static int curly; /* number of curly brace nesting levels */ -static int ly_count; /* number of occurances of %% */ +static int ly_count; /* number of occurrences of %% */ static int inc_depth; /* include nesting level */ static SymbolTable *included_files; /* files already included */ static int yy_start = 0; /* start state number */ Modified: head/tools/regression/usr.bin/yacc/regress.08.out ============================================================================== --- head/tools/regression/usr.bin/yacc/regress.08.out Wed Apr 17 09:19:29 2013 (r249581) +++ head/tools/regression/usr.bin/yacc/regress.08.out Wed Apr 17 11:40:10 2013 (r249582) @@ -847,7 +847,7 @@ extern char *yytext; extern FILE *yyin, *yyout; static int curly; /* number of curly brace nesting levels */ -static int ly_count; /* number of occurances of %% */ +static int ly_count; /* number of occurrences of %% */ static int inc_depth; /* include nesting level */ static SymbolTable *included_files; /* files already included */ static int yy_start = 0; /* start state number */ Modified: head/usr.sbin/ppp/command.c ============================================================================== --- head/usr.sbin/ppp/command.c Wed Apr 17 09:19:29 2013 (r249581) +++ head/usr.sbin/ppp/command.c Wed Apr 17 11:40:10 2013 (r249582) @@ -416,7 +416,7 @@ DialCommand(struct cmdargs const *arg) static char * strstrword(char *big, const char *little) { - /* Get the first occurrance of the word ``little'' in ``big'' */ + /* Get the first occurrence of the word ``little'' in ``big'' */ char *pos; int len; From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 11:42:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1FD8B910; Wed, 17 Apr 2013 11:42:42 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0313D19D; Wed, 17 Apr 2013 11:42:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HBgfEd078232; Wed, 17 Apr 2013 11:42:41 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HBgeq7078221; Wed, 17 Apr 2013 11:42:40 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201304171142.r3HBgeq7078221@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 17 Apr 2013 11:42:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249583 - in head: include/rpcsvc sys/dev/cas sys/dev/xen/netback sys/fs/devfs sys/fs/msdosfs sys/kern sys/netgraph usr.sbin/nandsim X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 11:42:42 -0000 Author: gabor Date: Wed Apr 17 11:42:40 2013 New Revision: 249583 URL: http://svnweb.freebsd.org/changeset/base/249583 Log: - Correct mispellings of the word necessary Submitted by: Christoph Mallon (via private mail) Modified: head/include/rpcsvc/ypxfrd.x head/sys/dev/cas/if_casvar.h head/sys/dev/xen/netback/netback.c head/sys/fs/devfs/devfs_devs.c head/sys/fs/msdosfs/msdosfs_conv.c head/sys/kern/imgact_gzip.c head/sys/netgraph/ng_base.c head/usr.sbin/nandsim/nandsim_cfgparse.c Modified: head/include/rpcsvc/ypxfrd.x ============================================================================== --- head/include/rpcsvc/ypxfrd.x Wed Apr 17 11:40:10 2013 (r249582) +++ head/include/rpcsvc/ypxfrd.x Wed Apr 17 11:42:40 2013 (r249583) @@ -75,7 +75,7 @@ const _YPMAXDOMAIN = 64; const _YPMAXMAP = 64; const _YPMAXPEER = 64; -/* Suggested default -- not necesarrily the one used. */ +/* Suggested default -- not necessarily the one used. */ const YPXFRBLOCK = 32767; /* Modified: head/sys/dev/cas/if_casvar.h ============================================================================== --- head/sys/dev/cas/if_casvar.h Wed Apr 17 11:40:10 2013 (r249582) +++ head/sys/dev/cas/if_casvar.h Wed Apr 17 11:42:40 2013 (r249583) @@ -56,7 +56,7 @@ /* * Receive completion ring size - we have one completion per - * incoming packet (though the opposite isn't necesarrily true), + * incoming packet (though the opposite isn't necessarily true), * so this logic is a little simpler. */ #define CAS_NRXCOMP 4096 Modified: head/sys/dev/xen/netback/netback.c ============================================================================== --- head/sys/dev/xen/netback/netback.c Wed Apr 17 11:40:10 2013 (r249582) +++ head/sys/dev/xen/netback/netback.c Wed Apr 17 11:42:40 2013 (r249583) @@ -1816,7 +1816,7 @@ xnb_recv(netif_tx_back_ring_t *txb, domi /* * if we got here, then 1 or more requests was consumed, but the packet - * is not necesarily valid. + * is not necessarily valid. */ if (xnb_pkt_is_valid(&pkt) == 0) { /* got a garbage packet, respond and drop it */ Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Wed Apr 17 11:40:10 2013 (r249582) +++ head/sys/fs/devfs/devfs_devs.c Wed Apr 17 11:42:40 2013 (r249583) @@ -655,7 +655,7 @@ devfs_cleanup(struct devfs_mount *dm) /* * devfs_create() and devfs_destroy() are called from kern_conf.c and * in both cases the devlock() mutex is held, so no further locking - * is necesary and no sleeping allowed. + * is necessary and no sleeping allowed. */ void Modified: head/sys/fs/msdosfs/msdosfs_conv.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_conv.c Wed Apr 17 11:40:10 2013 (r249582) +++ head/sys/fs/msdosfs/msdosfs_conv.c Wed Apr 17 11:42:40 2013 (r249583) @@ -774,7 +774,7 @@ winSlotCnt(un, unlen, pmp) } /* - * Determine the number of bytes neccesary for Win95 names + * Determine the number of bytes neccessary for Win95 names */ size_t winLenFixup(un, unlen) Modified: head/sys/kern/imgact_gzip.c ============================================================================== --- head/sys/kern/imgact_gzip.c Wed Apr 17 11:40:10 2013 (r249582) +++ head/sys/kern/imgact_gzip.c Wed Apr 17 11:42:40 2013 (r249583) @@ -18,7 +18,7 @@ * inflate isn't quite reentrant yet... * error-handling is a mess... * so is the rest... - * tidy up unnecesary includes + * tidy up unnecessary includes */ #include Modified: head/sys/netgraph/ng_base.c ============================================================================== --- head/sys/netgraph/ng_base.c Wed Apr 17 11:40:10 2013 (r249582) +++ head/sys/netgraph/ng_base.c Wed Apr 17 11:42:40 2013 (r249583) @@ -92,7 +92,7 @@ static void ng_dumphooks(void); #endif /* NETGRAPH_DEBUG */ /* * DEAD versions of the structures. - * In order to avoid races, it is sometimes neccesary to point + * In order to avoid races, it is sometimes necessary to point * at SOMETHING even though theoretically, the current entity is * INVALID. Use these to avoid these races. */ Modified: head/usr.sbin/nandsim/nandsim_cfgparse.c ============================================================================== --- head/usr.sbin/nandsim/nandsim_cfgparse.c Wed Apr 17 11:40:10 2013 (r249582) +++ head/usr.sbin/nandsim/nandsim_cfgparse.c Wed Apr 17 11:42:40 2013 (r249583) @@ -575,7 +575,7 @@ parse_config(char *cfgfname, const char /* * Function tries to get appropriate value for given key, convert it to - * array of ints (of given size), and perform all the neccesary checks and + * array of ints (of given size), and perform all the necessary checks and * conversions. */ static int From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 11:43:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 69034A9C; Wed, 17 Apr 2013 11:43:47 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5B9B31AC; Wed, 17 Apr 2013 11:43:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HBhlQW078418; Wed, 17 Apr 2013 11:43:47 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HBhlBu078415; Wed, 17 Apr 2013 11:43:47 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201304171143.r3HBhlBu078415@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 17 Apr 2013 11:43:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249584 - in head/sys: dev/usb/wlan i386/isa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 11:43:47 -0000 Author: gabor Date: Wed Apr 17 11:43:46 2013 New Revision: 249584 URL: http://svnweb.freebsd.org/changeset/base/249584 Log: - Correct mispellings of word miscellaneous Submitted by: Christoph Mallon (via private mail) Modified: head/sys/dev/usb/wlan/if_zydreg.h head/sys/i386/isa/spic.c Modified: head/sys/dev/usb/wlan/if_zydreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_zydreg.h Wed Apr 17 11:42:40 2013 (r249583) +++ head/sys/dev/usb/wlan/if_zydreg.h Wed Apr 17 11:43:46 2013 (r249584) @@ -112,7 +112,7 @@ #define ZYD_MACB_MAX_RETRY 0x9b28 /* - * Miscellanous registers. + * Miscellaneous registers. */ #define ZYD_FIRMWARE_START_ADDR 0xee00 #define ZYD_FIRMWARE_BASE_ADDR 0xee1d /* Firmware base address */ Modified: head/sys/i386/isa/spic.c ============================================================================== --- head/sys/i386/isa/spic.c Wed Apr 17 11:42:40 2013 (r249583) +++ head/sys/i386/isa/spic.c Wed Apr 17 11:43:46 2013 (r249584) @@ -34,7 +34,7 @@ * and mouse button out of the jog dial. I suspect that this device will * end up having to support at least 2 different minor devices: One to be * the jog wheel device for moused to camp out on and the other to perform - * all of the other miscelaneous functions of this device. But for now, + * all of the other miscellaneous functions of this device. But for now, * the jog wheel is all you get. * * At the moment, the data sent back by the device is rather primitive. From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 11:45:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 449ADC42; Wed, 17 Apr 2013 11:45:17 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 275631BE; Wed, 17 Apr 2013 11:45:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HBjHq8078750; Wed, 17 Apr 2013 11:45:17 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HBjFLC078737; Wed, 17 Apr 2013 11:45:15 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201304171145.r3HBjFLC078737@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 17 Apr 2013 11:45:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249585 - in head/sys: cam dev/bktr dev/ppbus dev/sound/pcm netinet pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 11:45:17 -0000 Author: gabor Date: Wed Apr 17 11:45:15 2013 New Revision: 249585 URL: http://svnweb.freebsd.org/changeset/base/249585 Log: - Corrrect mispellings of word useful Submitted by: Christoph Mallon (via private mail) Modified: head/sys/cam/cam_periph.h head/sys/dev/bktr/CHANGELOG.TXT head/sys/dev/bktr/bktr_os.c head/sys/dev/ppbus/ppbconf.c head/sys/dev/sound/pcm/dsp.c head/sys/netinet/tcp_subr.c head/sys/pci/ncr.c Modified: head/sys/cam/cam_periph.h ============================================================================== --- head/sys/cam/cam_periph.h Wed Apr 17 11:43:46 2013 (r249584) +++ head/sys/cam/cam_periph.h Wed Apr 17 11:45:15 2013 (r249585) @@ -90,7 +90,7 @@ typedef enum { CAM_PERIPH_BIO } cam_periph_type; -/* Generically usefull offsets into the peripheral private area */ +/* Generically useful offsets into the peripheral private area */ #define ppriv_ptr0 periph_priv.entries[0].ptr #define ppriv_ptr1 periph_priv.entries[1].ptr #define ppriv_field0 periph_priv.entries[0].field Modified: head/sys/dev/bktr/CHANGELOG.TXT ============================================================================== --- head/sys/dev/bktr/CHANGELOG.TXT Wed Apr 17 11:43:46 2013 (r249584) +++ head/sys/dev/bktr/CHANGELOG.TXT Wed Apr 17 11:45:15 2013 (r249585) @@ -285,7 +285,7 @@ Fix row=0/columns=0 bug. From Randal Hopper Add option to block the reset of the MSP34xx audio chip by adding options BKTR_NO_MSP_RESET to the kernel config file. - This is usefull if you run another operating system + This is useful if you run another operating system first to initialise the audio chip, then do a soft reboot. Added for Yuri Gindin Modified: head/sys/dev/bktr/bktr_os.c ============================================================================== --- head/sys/dev/bktr/bktr_os.c Wed Apr 17 11:43:46 2013 (r249584) +++ head/sys/dev/bktr/bktr_os.c Wed Apr 17 11:45:15 2013 (r249585) @@ -404,7 +404,7 @@ bktr_attach( device_t dev ) #if defined( BKTR_SIS_VIA_MODE ) if (bootverbose) printf("Using SiS/VIA chipset compatibilty mode\n"); - fun = fun | 4; /* Enable SiS/VIA compatibility mode (usefull for + fun = fun | 4; /* Enable SiS/VIA compatibility mode (useful for OPTi chipset motherboards too */ #endif pci_write_config(dev, 0x40, fun, 2); Modified: head/sys/dev/ppbus/ppbconf.c ============================================================================== --- head/sys/dev/ppbus/ppbconf.c Wed Apr 17 11:43:46 2013 (r249584) +++ head/sys/dev/ppbus/ppbconf.c Wed Apr 17 11:45:15 2013 (r249585) @@ -531,7 +531,7 @@ ppb_request_bus(device_t bus, device_t d /* restore the context of the device * The first time, ctx.valid is certainly false - * then do not change anything. This is usefull for + * then do not change anything. This is useful for * drivers that do not set there operating mode * during attachement */ Modified: head/sys/dev/sound/pcm/dsp.c ============================================================================== --- head/sys/dev/sound/pcm/dsp.c Wed Apr 17 11:43:46 2013 (r249584) +++ head/sys/dev/sound/pcm/dsp.c Wed Apr 17 11:45:15 2013 (r249585) @@ -2011,7 +2011,7 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd * OSSv4 docs: "All errors and counters will automatically be * cleared to zeroes after the call so each call will return only * the errors that occurred after the previous invocation. ... The - * play_underruns and rec_overrun fields are the only usefull fields + * play_underruns and rec_overrun fields are the only useful fields * returned by OSS 4.0." */ { Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Wed Apr 17 11:43:46 2013 (r249584) +++ head/sys/netinet/tcp_subr.c Wed Apr 17 11:45:15 2013 (r249585) @@ -1060,7 +1060,7 @@ tcp_drain(void) * XXX: The "Net/3" implementation doesn't imply that the TCP * reassembly queue should be flushed, but in a situation * where we're really low on mbufs, this is potentially - * usefull. + * useful. */ INP_INFO_RLOCK(&V_tcbinfo); LIST_FOREACH(inpb, V_tcbinfo.ipi_listhead, inp_list) { Modified: head/sys/pci/ncr.c ============================================================================== --- head/sys/pci/ncr.c Wed Apr 17 11:43:46 2013 (r249584) +++ head/sys/pci/ncr.c Wed Apr 17 11:45:15 2013 (r249585) @@ -4857,7 +4857,7 @@ static void ncr_getsync(ncb_p np, u_char */ fak = (kpc - 1) / div_10M[div] + 1; -#if 0 /* You can #if 1 if you think this optimization is usefull */ +#if 0 /* You can #if 1 if you think this optimization is useful */ per = (fak * div_10M[div]) / clk; From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 11:47:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A0F51DD6; Wed, 17 Apr 2013 11:47:33 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 833351CF; Wed, 17 Apr 2013 11:47:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HBlXgc079087; Wed, 17 Apr 2013 11:47:33 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HBlWbP079078; Wed, 17 Apr 2013 11:47:32 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201304171147.r3HBlWbP079078@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 17 Apr 2013 11:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249586 - in head/sys: arm/ti/omap4 dev/isci/scil dev/mxge pc98/pc98 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 11:47:33 -0000 Author: gabor Date: Wed Apr 17 11:47:32 2013 New Revision: 249586 URL: http://svnweb.freebsd.org/changeset/base/249586 Log: - Correct mispellings of word resource Submitted by: Christoph Mallon Modified: head/sys/arm/ti/omap4/omap4_prcm_clks.c head/sys/dev/isci/scil/scic_sds_phy.c head/sys/dev/isci/scil/scic_sds_port.c head/sys/dev/isci/scil/scic_sds_port_configuration_agent.c head/sys/dev/mxge/if_mxge.c head/sys/pc98/pc98/canbus.c Modified: head/sys/arm/ti/omap4/omap4_prcm_clks.c ============================================================================== --- head/sys/arm/ti/omap4/omap4_prcm_clks.c Wed Apr 17 11:45:15 2013 (r249585) +++ head/sys/arm/ti/omap4/omap4_prcm_clks.c Wed Apr 17 11:47:32 2013 (r249586) @@ -1003,7 +1003,7 @@ omap4_clk_get_arm_fclk_freq(struct ti_cl /** * omap4_clk_hsusbhost_activate - activates the USB clocks for the given module * @clkdev: pointer to the clock device structure. - * @mem_res: array of memory resouces allocated by the top level PRCM driver. + * @mem_res: array of memory resources allocated by the top level PRCM driver. * * The USB clocking setup seems to be a bit more tricky than the other modules, * to start with the clocking diagram for the HS host module shows 13 different @@ -1153,7 +1153,7 @@ omap4_clk_hsusbhost_activate(struct ti_c /** * omap4_clk_generic_deactivate - checks if a module is accessible * @clkdev: pointer to the clock device structure. - * @mem_res: array of memory resouces allocated by the top level PRCM driver. + * @mem_res: array of memory resources allocated by the top level PRCM driver. * * * @@ -1242,7 +1242,7 @@ omap4_clk_hsusbhost_deactivate(struct ti /** * omap4_clk_hsusbhost_accessible - checks if a module is accessible * @clkdev: pointer to the clock device structure. - * @mem_res: array of memory resouces allocated by the top level PRCM driver. + * @mem_res: array of memory resources allocated by the top level PRCM driver. * * * @@ -1291,7 +1291,7 @@ omap4_clk_hsusbhost_accessible(struct ti * omap4_clk_hsusbhost_set_source - sets the source clocks * @clkdev: pointer to the clock device structure. * @clksrc: the clock source ID for the given clock. - * @mem_res: array of memory resouces allocated by the top level PRCM driver. + * @mem_res: array of memory resources allocated by the top level PRCM driver. * * * Modified: head/sys/dev/isci/scil/scic_sds_phy.c ============================================================================== --- head/sys/dev/isci/scil/scic_sds_phy.c Wed Apr 17 11:45:15 2013 (r249585) +++ head/sys/dev/isci/scil/scic_sds_phy.c Wed Apr 17 11:47:32 2013 (r249586) @@ -975,7 +975,7 @@ void scic_sds_phy_get_attached_phy_proto * * @param[in] controller This parameter specifies the core controller, one of * its phy's resources are to be released. - * @param[in] this_phy This parameter specifies the phy whose resourse is to + * @param[in] this_phy This parameter specifies the phy whose resource is to * be released. */ void scic_sds_phy_release_resource( Modified: head/sys/dev/isci/scil/scic_sds_port.c ============================================================================== --- head/sys/dev/isci/scil/scic_sds_port.c Wed Apr 17 11:45:15 2013 (r249585) +++ head/sys/dev/isci/scil/scic_sds_port.c Wed Apr 17 11:47:32 2013 (r249586) @@ -1537,7 +1537,7 @@ void scic_port_enable_broadcast_change_n * * @param[in] controller This parameter specifies the core controller, one of * its phy's resources are to be released. - * @param[in] this_port This parameter specifies the port whose resourse is to + * @param[in] this_port This parameter specifies the port whose resource is to * be released. */ void scic_sds_port_release_resource( Modified: head/sys/dev/isci/scil/scic_sds_port_configuration_agent.c ============================================================================== --- head/sys/dev/isci/scil/scic_sds_port_configuration_agent.c Wed Apr 17 11:45:15 2013 (r249585) +++ head/sys/dev/isci/scil/scic_sds_port_configuration_agent.c Wed Apr 17 11:47:32 2013 (r249586) @@ -1109,7 +1109,7 @@ void scic_sds_port_configuration_agent_d * * @param[in] controller This parameter specifies the core controller, one of * its phy's resources are to be released. - * @param[in] this_phy This parameter specifies the phy whose resourse is to + * @param[in] this_phy This parameter specifies the phy whose resource is to * be released. */ void scic_sds_port_configuration_agent_release_resource( Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Wed Apr 17 11:45:15 2013 (r249585) +++ head/sys/dev/mxge/if_mxge.c Wed Apr 17 11:47:32 2013 (r249586) @@ -3418,7 +3418,7 @@ mxge_alloc_slice_rings(struct mxge_slice return err; } - /* now allocate TX resouces */ + /* now allocate TX resources */ #ifndef IFNET_BUF_RING /* only use a single TX ring for now */ Modified: head/sys/pc98/pc98/canbus.c ============================================================================== --- head/sys/pc98/pc98/canbus.c Wed Apr 17 11:45:15 2013 (r249585) +++ head/sys/pc98/pc98/canbus.c Wed Apr 17 11:47:32 2013 (r249586) @@ -62,13 +62,13 @@ struct canbus_softc { /* index register */ int index_id; /* index ID */ - struct resource *index_res; /* index resouce */ + struct resource *index_res; /* index resource */ bus_space_tag_t index_tag; /* index tag */ bus_space_handle_t index_handle; /* index handle */ /* data register */ int data_id; /* data ID */ - struct resource *data_res; /* data resouce */ + struct resource *data_res; /* data resource */ bus_space_tag_t data_tag; /* data tag */ bus_space_handle_t data_handle; /* data handle */ }; From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 11:48:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D07A2E9; Wed, 17 Apr 2013 11:48:47 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B33E61EF; Wed, 17 Apr 2013 11:48:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HBml6x079291; Wed, 17 Apr 2013 11:48:47 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HBmkwt079287; Wed, 17 Apr 2013 11:48:46 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201304171148.r3HBmkwt079287@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 17 Apr 2013 11:48:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249587 - in head: share/i18n/csmapper/KAZAKH sys/dev/sound/pci tools/tools/notescheck X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 11:48:48 -0000 Author: gabor Date: Wed Apr 17 11:48:46 2013 New Revision: 249587 URL: http://svnweb.freebsd.org/changeset/base/249587 Log: - Correct mispellings of word and Submitted by: Christoph Mallon (via private mail) Modified: head/share/i18n/csmapper/KAZAKH/KZ1048%UCS.src head/share/i18n/csmapper/KAZAKH/UCS%KZ1048.src head/sys/dev/sound/pci/emu10kx.c head/tools/tools/notescheck/notescheck.py Modified: head/share/i18n/csmapper/KAZAKH/KZ1048%UCS.src ============================================================================== --- head/share/i18n/csmapper/KAZAKH/KZ1048%UCS.src Wed Apr 17 11:47:32 2013 (r249586) +++ head/share/i18n/csmapper/KAZAKH/KZ1048%UCS.src Wed Apr 17 11:48:46 2013 (r249587) @@ -23,7 +23,7 @@ BEGIN_MAP # Yes # Published specification(s): # The official Standard STRK1048-2002 was created by the Committee of standartization of -# Ministry of economy and trade of Kazakhstan Republic ans was published in print by the +# Ministry of economy and trade of Kazakhstan Republic and was published in print by the # Kazakhstan Standard Committee, Astana, February 7, 2002 # # Mapping data are available online at http://www.sci.kz/~sairan/kazcode/TableA.html Modified: head/share/i18n/csmapper/KAZAKH/UCS%KZ1048.src ============================================================================== --- head/share/i18n/csmapper/KAZAKH/UCS%KZ1048.src Wed Apr 17 11:47:32 2013 (r249586) +++ head/share/i18n/csmapper/KAZAKH/UCS%KZ1048.src Wed Apr 17 11:48:46 2013 (r249587) @@ -23,7 +23,7 @@ BEGIN_MAP # Yes # Published specification(s): # The official Standard STRK1048-2002 was created by the Committee of standartization of -# Ministry of economy and trade of Kazakhstan Republic ans was published in print by the +# Ministry of economy and trade of Kazakhstan Republic and was published in print by the # Kazakhstan Standard Committee, Astana, February 7, 2002 # # Mapping data are available online at http://www.sci.kz/~sairan/kazcode/TableA.html Modified: head/sys/dev/sound/pci/emu10kx.c ============================================================================== --- head/sys/dev/sound/pci/emu10kx.c Wed Apr 17 11:47:32 2013 (r249586) +++ head/sys/dev/sound/pci/emu10kx.c Wed Apr 17 11:48:46 2013 (r249587) @@ -1928,7 +1928,7 @@ emu_initefx(struct emu_sc_info *sc) /* * Substream map (in byte offsets, each substream is 2 bytes): * 0x00..0x1E - outputs - * 0x20..0x3E - FX, inputs ans sync stream + * 0x20..0x3E - FX, inputs and sync stream */ /* First 2 channels (offset 0x20,0x22) are empty */ Modified: head/tools/tools/notescheck/notescheck.py ============================================================================== --- head/tools/tools/notescheck/notescheck.py Wed Apr 17 11:47:32 2013 (r249586) +++ head/tools/tools/notescheck/notescheck.py Wed Apr 17 11:48:46 2013 (r249587) @@ -93,7 +93,7 @@ class Option: return if global_platform in self.defines: - # If the device is defined globally ans is never tested, whine. + # If the device is defined globally and is never tested, whine. if len(self.tests) == 0: print('WARN: %s is defined globally but never tested' % \ (self.title())) From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 11:56:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E6D41464; Wed, 17 Apr 2013 11:56:12 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D83D324B; Wed, 17 Apr 2013 11:56:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HBuC6O082057; Wed, 17 Apr 2013 11:56:12 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HBuB6F082046; Wed, 17 Apr 2013 11:56:11 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201304171156.r3HBuB6F082046@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 17 Apr 2013 11:56:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249588 - in head: share/i18n/csmapper/KAZAKH sys/amd64/include/xen sys/dev/xen/netback sys/fs/msdosfs sys/i386/isa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 11:56:13 -0000 Author: gabor Date: Wed Apr 17 11:56:11 2013 New Revision: 249588 URL: http://svnweb.freebsd.org/changeset/base/249588 Log: - Correct spelling in comments Submitted by: Christoph Mallon (via private mail) Modified: head/share/i18n/csmapper/KAZAKH/KZ1048%UCS.src head/share/i18n/csmapper/KAZAKH/UCS%KZ1048.src head/sys/amd64/include/xen/xen-os.h head/sys/dev/xen/netback/netback.c head/sys/fs/msdosfs/msdosfs_conv.c head/sys/i386/isa/spic.c Modified: head/share/i18n/csmapper/KAZAKH/KZ1048%UCS.src ============================================================================== --- head/share/i18n/csmapper/KAZAKH/KZ1048%UCS.src Wed Apr 17 11:48:46 2013 (r249587) +++ head/share/i18n/csmapper/KAZAKH/KZ1048%UCS.src Wed Apr 17 11:56:11 2013 (r249588) @@ -22,7 +22,7 @@ BEGIN_MAP # Suitability for use in MIME text: # Yes # Published specification(s): -# The official Standard STRK1048-2002 was created by the Committee of standartization of +# The official Standard STRK1048-2002 was created by the Committee of standardization of # Ministry of economy and trade of Kazakhstan Republic and was published in print by the # Kazakhstan Standard Committee, Astana, February 7, 2002 # Modified: head/share/i18n/csmapper/KAZAKH/UCS%KZ1048.src ============================================================================== --- head/share/i18n/csmapper/KAZAKH/UCS%KZ1048.src Wed Apr 17 11:48:46 2013 (r249587) +++ head/share/i18n/csmapper/KAZAKH/UCS%KZ1048.src Wed Apr 17 11:56:11 2013 (r249588) @@ -22,7 +22,7 @@ BEGIN_MAP # Suitability for use in MIME text: # Yes # Published specification(s): -# The official Standard STRK1048-2002 was created by the Committee of standartization of +# The official Standard STRK1048-2002 was created by the Committee of standardization of # Ministry of economy and trade of Kazakhstan Republic and was published in print by the # Kazakhstan Standard Committee, Astana, February 7, 2002 # Modified: head/sys/amd64/include/xen/xen-os.h ============================================================================== --- head/sys/amd64/include/xen/xen-os.h Wed Apr 17 11:48:46 2013 (r249587) +++ head/sys/amd64/include/xen/xen-os.h Wed Apr 17 11:56:11 2013 (r249588) @@ -2,6 +2,8 @@ * os.h * * random collection of macros and definition + * + * $FreeBSD$ */ #ifndef _XEN_OS_H_ @@ -57,7 +59,7 @@ void trap_init(void); /* * STI/CLI equivalents. These basically set and clear the virtual - * event_enable flag in teh shared_info structure. Note that when + * event_enable flag in the shared_info structure. Note that when * the enable bit is set, there may be pending events to be handled. * We may therefore call into do_hypervisor_callback() directly. */ Modified: head/sys/dev/xen/netback/netback.c ============================================================================== --- head/sys/dev/xen/netback/netback.c Wed Apr 17 11:48:46 2013 (r249587) +++ head/sys/dev/xen/netback/netback.c Wed Apr 17 11:56:11 2013 (r249588) @@ -1811,7 +1811,7 @@ xnb_recv(netif_tx_back_ring_t *txb, domi if (num_consumed == 0) return 0; /* Nothing to receive */ - /* update statistics indepdent of errors */ + /* update statistics independent of errors */ ifnet->if_ipackets++; /* Modified: head/sys/fs/msdosfs/msdosfs_conv.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_conv.c Wed Apr 17 11:48:46 2013 (r249587) +++ head/sys/fs/msdosfs/msdosfs_conv.c Wed Apr 17 11:56:11 2013 (r249588) @@ -788,7 +788,7 @@ winLenFixup(un, unlen) } /* - * Store an area with multi byte string instr, and reterns left + * Store an area with multi byte string instr, and returns left * byte of instr and moves pointer forward. The area's size is * inlen or outlen. */ Modified: head/sys/i386/isa/spic.c ============================================================================== --- head/sys/i386/isa/spic.c Wed Apr 17 11:48:46 2013 (r249587) +++ head/sys/i386/isa/spic.c Wed Apr 17 11:56:11 2013 (r249588) @@ -41,7 +41,7 @@ * It sends a single character per event: * u = up, d = down -- that's the jog button * l = left, r = right -- that's the dial. - * "left" and "right" are rather caprecious. They actually represent + * "left" and "right" are rather capricious. They actually represent * ccw and cw, respectively * * What documentation exists is thanks to Andrew Tridge, and his page at From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 12:05:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CDD4F8FC; Wed, 17 Apr 2013 12:05:45 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay008.isp.belgacom.be (mailrelay008.isp.belgacom.be [195.238.6.174]) by mx1.freebsd.org (Postfix) with ESMTP id 552632F8; Wed, 17 Apr 2013 12:05:43 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmwGABuPblFR8npE/2dsb2JhbABGCoMGNsEMgQQXdIIfAQEEAVYeBQULCxgJFg8JAwIBAgEnHgYNAQcBAReHcwq9P41egTwHCYM9A49VgSmXHIMNOg Received: from 68.122-242-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.242.122.68]) by relay.skynet.be with ESMTP; 17 Apr 2013 14:05:36 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.6/8.14.6) with ESMTP id r3HC5ZZ1044288; Wed, 17 Apr 2013 14:05:35 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Message-ID: <516E900B.9090300@FreeBSD.org> Date: Wed, 17 Apr 2013 14:05:31 +0200 From: Tijl Coosemans User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130408 Thunderbird/17.0.5 MIME-Version: 1.0 To: Tim Kientzle Subject: Re: svn commit: r249484 - head/lib References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <516D54F5.4010501@FreeBSD.org> <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> In-Reply-To: <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2MJRKOHIWUDIFGFPCMTRT" Cc: src-committers@FreeBSD.org, Juli Mallett , svn-src-all@FreeBSD.org, Dimitry Andric , Brooks Davis , svn-src-head@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 12:05:45 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2MJRKOHIWUDIFGFPCMTRT Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2013-04-17 08:26, Tim Kientzle wrote: > On Apr 16, 2013, at 11:06 PM, Juli Mallett wrote: >> On Tue, Apr 16, 2013 at 11:00 PM, Tim Kientzle wrote: >>> On Apr 16, 2013, at 6:41 AM, Tijl Coosemans wrote: >>>> On 2013-04-14 21:13, Tim Kientzle wrote: >>>>> Modified: head/lib/Makefile >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/lib/Makefile Sun Apr 14 18:36:30 2013 (r2494= 83) >>>>> +++ head/lib/Makefile Sun Apr 14 19:13:51 2013 (r2494= 84) >>>>> @@ -252,4 +252,7 @@ _libusbhid=3D libusbhid >>>>> _libusb=3D libusb >>>>> .endif >>>>> >>>>> +afterinstall: >>>>> + ln -fs ../include ${DESTDIR}/usr/lib/include >>>>> + >>>>> .include >>>> >>>> This breaks with -DNO_CLEAN defined, because then >>>> ${DESTDIR}/usr/lib/include/include is created. >>> >>> That's a good point. Would this work better? >>> >>> afterinstall: >>> if [ ! -e $(DESTDIR)/usr/lib/include ]; then >>> ln -fs ../include $(DESTDIR)/usr/lib/include >>> fi Maybe just: ln -fs ../include $(DESTDIR)/usr/lib/ >>>> I'm not that fond of this patch by the way, but I don't fully >>>> understand the problem it's trying to solve so I won't object. >>>> It just looks too much like a hack to me >>> >>> It's a subtle issue and I'm not surprised that it raised some >>> eyebrows. I spent a long time looking for a better solution. >>> >>> In short, both GCC and Clang make some assumptions >>> about the layout of headers used for freestanding compiles. >>> (My earlier commit said these assumptions were "undocumented", >>> but that's not quite true, they're just rather obscure.) >> >> If you're doing a freestanding compile...shouldn't you also be >> specifying both include and library paths explicitly? >=20 > Yes, of course. But the correct directories to use vary somewhat > across platforms, so we would like to have some reasonably > portable way to find the right directory to use for building on > a particular system. >=20 > Both gcc and clang support a -print-file-name=3Dinclude option which > is supposed to print out the directory containing headers used > for freestanding compiles. You can then take that path and > use it as the explicit include directory path for freestanding builds. > >> (Or even better, if you're doing a freestanding >> compile, but want the default include paths, get the compiler to dump >> the default include paths and process that.) >=20 > That's precisely what this is for. I've been working with U-Boot > sources which compile on many systems and use > -print-file-name=3Dinclude to identify the directory containing > the basic freestanding header files. So you compile with -ffreestanding -nostdinc? And then add the include path returned by -print-file-name=3Dinclude? > The -print-file-name=3Dinclude option works on Linux, works > on MacOS, and --- with this one symlink --- can work on > FreeBSD as well. I've been using it to cross-build U-Boot > using the FreeBSD xdev toolchain with both GCC and Clang. "clang -E -v - ) # include_next #else =2E.. #endif In the lang/clang port files/patch-tools_clang_lib_Headers_Makefile should be removed I think. It prevents too many useful headers from being installed (e.g. avxintrin.h) ------enig2MJRKOHIWUDIFGFPCMTRT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iF4EAREIAAYFAlFukA8ACgkQfoCS2CCgtivnDwEAhwB1rOo6vWCU19JorragUE4f l6JggnJGtDZWi5TAccoA/ioO41XLsdwEHl/E5gCrSFA26rrqWjXAcwpkkjbGjtdz =L+uL -----END PGP SIGNATURE----- ------enig2MJRKOHIWUDIFGFPCMTRT-- From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 13:53:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D009255C; Wed, 17 Apr 2013 13:53:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id A8658A4E; Wed, 17 Apr 2013 13:53:23 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DACA1B94A; Wed, 17 Apr 2013 09:53:21 -0400 (EDT) From: John Baldwin To: Tijl Coosemans Subject: Re: svn commit: r249484 - head/lib Date: Wed, 17 Apr 2013 08:24:28 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> <516E900B.9090300@FreeBSD.org> In-Reply-To: <516E900B.9090300@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201304170824.29210.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 17 Apr 2013 09:53:22 -0400 (EDT) Cc: src-committers@freebsd.org, Brooks Davis , Juli Mallett , svn-src-all@freebsd.org, Dimitry Andric , Tim Kientzle , svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 13:53:23 -0000 On Wednesday, April 17, 2013 8:05:31 am Tijl Coosemans wrote: > In the lang/clang port files/patch-tools_clang_lib_Headers_Makefile > should be removed I think. It prevents too many useful headers from > being installed (e.g. avxintrin.h) I have a local patch to that that I've sent to brooks@ previously to let it install all the intrinsic headers as I needed this for using clang on 8.x. --- tools/clang/lib/Headers/Makefile.orig +++ tools/clang/lib/Headers/Makefile @@ -13,7 +13,7 @@ # FIXME: Get version from a common place. HeaderDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/clang/1.0/include -HEADERS := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.h)) +HEADERS := $(notdir $(wildcard $(PROJ_SRC_DIR)/*mm*.h $(PROJ_SRC_DIR)/*intrin*.h $(PROJ_SRC_DIR)/altivec.h $(PROJ_SRC_DIR)/cpuid.h)) OBJHEADERS := $(addprefix $(HeaderDir)/, $(HEADERS)) And then updates to pkg-plist: --- ports/lang/clang/pkg-plist 2013-03-14 02:43:15.953661102 -0400 +++ ports/lang/clang/pkg-plist 2013-03-04 16:35:57.632039413 -0500 @@ -390,19 +390,33 @@ lib/clang/%%PORTVERSION%%/include/__wmmintrin_aes.h lib/clang/%%PORTVERSION%%/include/__wmmintrin_pclmul.h lib/clang/%%PORTVERSION%%/include/ammintrin.h +lib/clang/%%PORTVERSION%%/include/altivec.h lib/clang/%%PORTVERSION%%/include/arm_neon.h +lib/clang/%%PORTVERSION%%/include/avx2intrin.h +lib/clang/%%PORTVERSION%%/include/avxintrin.h +lib/clang/%%PORTVERSION%%/include/bmi2intrin.h +lib/clang/%%PORTVERSION%%/include/bmiintrin.h +lib/clang/%%PORTVERSION%%/include/cpuid.h lib/clang/%%PORTVERSION%%/include/emmintrin.h +lib/clang/%%PORTVERSION%%/include/f16cintrin.h +lib/clang/%%PORTVERSION%%/include/fmaintrin.h +lib/clang/%%PORTVERSION%%/include/fma4intrin.h lib/clang/%%PORTVERSION%%/include/immintrin.h +lib/clang/%%PORTVERSION%%/include/lzcntintrin.h lib/clang/%%PORTVERSION%%/include/mm3dnow.h lib/clang/%%PORTVERSION%%/include/mm_malloc.h lib/clang/%%PORTVERSION%%/include/mmintrin.h lib/clang/%%PORTVERSION%%/include/module.map lib/clang/%%PORTVERSION%%/include/nmmintrin.h lib/clang/%%PORTVERSION%%/include/pmmintrin.h +lib/clang/%%PORTVERSION%%/include/popcntintrin.h +lib/clang/%%PORTVERSION%%/include/rtmintrin.h lib/clang/%%PORTVERSION%%/include/smmintrin.h lib/clang/%%PORTVERSION%%/include/tmmintrin.h lib/clang/%%PORTVERSION%%/include/wmmintrin.h +lib/clang/%%PORTVERSION%%/include/x86intrin.h lib/clang/%%PORTVERSION%%/include/xmmintrin.h +lib/clang/%%PORTVERSION%%/include/xopintrin.h lib/libclang.a lib/libclang.so lib/libclangARCMigrate.a -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 15:58:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1D2B3809; Wed, 17 Apr 2013 15:58:39 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id D8163214; Wed, 17 Apr 2013 15:58:38 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id r3HFwbbu070858; Wed, 17 Apr 2013 15:58:37 GMT (envelope-from kientzle@freebsd.org) Received: from [192.168.2.123] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id iiv5sbx8nfhcmmcp3vrgpt38me; Wed, 17 Apr 2013 15:58:37 +0000 (UTC) (envelope-from kientzle@freebsd.org) Subject: Re: svn commit: r249484 - head/lib Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: multipart/signed; boundary="Apple-Mail=_3EE0F6AD-4CE8-4E89-BD09-01FEB7BC606B"; protocol="application/pgp-signature"; micalg=pgp-sha1 From: Tim Kientzle In-Reply-To: <516E900B.9090300@FreeBSD.org> Date: Wed, 17 Apr 2013 08:58:36 -0700 Message-Id: References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <516D54F5.4010501@FreeBSD.org> <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> <516E900B.9090300@FreeBSD.org> To: Tijl Coosemans X-Mailer: Apple Mail (2.1283) Cc: src-committers@freebsd.org, Juli Mallett , svn-src-all@freebsd.org, Dimitry Andric , Brooks Davis , svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 15:58:39 -0000 --Apple-Mail=_3EE0F6AD-4CE8-4E89-BD09-01FEB7BC606B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 On Apr 17, 2013, at 5:05 AM, Tijl Coosemans wrote: > On 2013-04-17 08:26, Tim Kientzle wrote: >> On Apr 16, 2013, at 11:06 PM, Juli Mallett wrote: >>> On Tue, Apr 16, 2013 at 11:00 PM, Tim Kientzle wrote: >>>> On Apr 16, 2013, at 6:41 AM, Tijl Coosemans wrote: >>>>> On 2013-04-14 21:13, Tim Kientzle wrote: >>>>>> Modified: head/lib/Makefile >>>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>>> --- head/lib/Makefile Sun Apr 14 18:36:30 2013 = (r249483) >>>>>> +++ head/lib/Makefile Sun Apr 14 19:13:51 2013 = (r249484) >>>>>> @@ -252,4 +252,7 @@ _libusbhid=3D libusbhid >>>>>> _libusb=3D libusb >>>>>> .endif >>>>>>=20 >>>>>> +afterinstall: >>>>>> + ln -fs ../include ${DESTDIR}/usr/lib/include >>>>>> + >>>>>> .include >>>>>=20 >>>>> This breaks with -DNO_CLEAN defined, because then >>>>> ${DESTDIR}/usr/lib/include/include is created. >>>>=20 >>>> That's a good point. Would this work better? >>>>=20 >>>> afterinstall: >>>> if [ ! -e $(DESTDIR)/usr/lib/include ]; then >>>> ln -fs ../include $(DESTDIR)/usr/lib/include >>>> fi >=20 > Maybe just: ln -fs ../include $(DESTDIR)/usr/lib/ Ah, yes. That is the obvious answer. I'll change it to that for now. I'm happy to remove it once we have a better answer in place. >>>>> I'm not that fond of this patch by the way, but I don't fully >>>>> understand the problem it's trying to solve so I won't object. >>>>> It just looks too much like a hack to me >>>>=20 >>>> It's a subtle issue and I'm not surprised that it raised some >>>> eyebrows. I spent a long time looking for a better solution. >>>>=20 >>>> In short, both GCC and Clang make some assumptions >>>> about the layout of headers used for freestanding compiles. >>>> (My earlier commit said these assumptions were "undocumented", >>>> but that's not quite true, they're just rather obscure.) >>>=20 >>> If you're doing a freestanding compile...shouldn't you also be >>> specifying both include and library paths explicitly? >>=20 >> Yes, of course. But the correct directories to use vary somewhat >> across platforms, so we would like to have some reasonably >> portable way to find the right directory to use for building on >> a particular system. >>=20 >> Both gcc and clang support a -print-file-name=3Dinclude option which >> is supposed to print out the directory containing headers used >> for freestanding compiles. You can then take that path and >> use it as the explicit include directory path for freestanding = builds. >>=20 >>> (Or even better, if you're doing a freestanding >>> compile, but want the default include paths, get the compiler to = dump >>> the default include paths and process that.) >>=20 >> That's precisely what this is for. I've been working with U-Boot >> sources which compile on many systems and use >> -print-file-name=3Dinclude to identify the directory containing >> the basic freestanding header files. >=20 > So you compile with -ffreestanding -nostdinc? > And then add the include path returned by -print-file-name=3Dinclude? That's what the U-Boot sources do, yes. >> The -print-file-name=3Dinclude option works on Linux, works >> on MacOS, and --- with this one symlink --- can work on >> FreeBSD as well. I've been using it to cross-build U-Boot >> using the FreeBSD xdev toolchain with both GCC and Clang. >=20 > "clang -E -v - /usr/bin/../lib/clang/3.3" to cc1 stage which then complains about > nonexistent directory "/usr/bin/../lib/clang/3.3/include". >=20 > So how about moving /usr/include/clang/3.3 to > /usr/lib/clang/3.3/include? That seems to be the location clang > expects and what lang/clang port uses (in /usr/local). I would certainly like to see that. I presumed that there was some reason this wasn't done in the initial import. > The path from -resource-dir is also searched by -print-file-name. >=20 > All headers from contrib/llvm/tools/clang/lib/Headers would have > to be installed there to have a complete freestanding environment, > but some of those headers would have to be patched to use the base > system header in the hosted case like the stdint.h header does: >=20 > #if __STDC_HOSTED__ && \ > defined(__has_include_next) && __has_include_next() > # include_next > #else > ... > #endif >=20 > In the lang/clang port files/patch-tools_clang_lib_Headers_Makefile > should be removed I think. It prevents too many useful headers from > being installed (e.g. avxintrin.h) That would be great! I can certainly help with some of this but my time is a little tight. While we're talking about freestanding brokenness, is anyone interested in fixing the fact that FreeBSD/ARM requires freestanding programs to be linked against libc? Tim --Apple-Mail=_3EE0F6AD-4CE8-4E89-BD09-01FEB7BC606B Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.18 (Darwin) iQEcBAEBAgAGBQJRbsatAAoJEGMNyGo0rfFBIecH/izjnxPHMXmS6SXkC3hTU4Aq 2rLkGOZY5WvraF/VIiGG/hqamQ7RR+YAqzAIyhcnKFeXMU/U4zd7ac1UbbdGZCNV su8pLzUOtL80iu9dCBtZMhuqJ+/ztr/IL8InrDONjdh1rm7v78/ic0F+NIhsI+/H VUR5udRcKc5C/8niiYQjp/l4gNQCNFPjBwDMc9HCfq7LUVnPBq7Gc+K91EJTZSVY eMBAk8gaFAf6fb4oKOQJsTYmVenBqI9WL9KKsTcafU1WeZ9deAnkjxSZlKGLnF/Y 0EPV6ktP0AyHj9PpD/Dbkfi+mvDU/5ofD9csFpRFFcHm4siBhoTw+FOyySfEVY4= =DJkS -----END PGP SIGNATURE----- --Apple-Mail=_3EE0F6AD-4CE8-4E89-BD09-01FEB7BC606B-- From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 16:00:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5C0079CA; Wed, 17 Apr 2013 16:00:04 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from felyko.com (felyko.com [IPv6:2607:f2f8:a528::3:1337:ca7]) by mx1.freebsd.org (Postfix) with ESMTP id 4A723238; Wed, 17 Apr 2013 16:00:04 +0000 (UTC) Received: from [IPv6:2601:9:4d00:3c:a1cf:7ae3:1aa6:8195] (unknown [IPv6:2601:9:4d00:3c:a1cf:7ae3:1aa6:8195]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by felyko.com (Postfix) with ESMTPSA id 5D28E39821; Wed, 17 Apr 2013 09:00:03 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: svn commit: r249577 - head/sys/amd64/amd64 From: Rui Paulo In-Reply-To: <201304170647.05488.jhb@freebsd.org> Date: Wed, 17 Apr 2013 09:00:03 -0700 Content-Transfer-Encoding: 7bit Message-Id: References: <201304170651.r3H6pHYo087392@svn.freebsd.org> <201304170647.05488.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1503) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 16:00:04 -0000 On 2013/04/17, at 3:47, John Baldwin wrote: > On Wednesday, April 17, 2013 02:51:17 AM Rui Paulo wrote: >> Author: rpaulo >> Date: Wed Apr 17 06:51:17 2013 >> New Revision: 249577 >> URL: http://svnweb.freebsd.org/changeset/base/249577 >> >> Log: >> Print more bits from the standard extended features CPUID which will be >> available in the Haswell architecture (c.f. Intel Document #319433-012A). > > Can you add appropriate constants with comments to x86/include/specialreg.h > and remove the comments from here? (That is how we have documented all the > other feature bits.) Yes, it's in my TODO list. Regards, -- Rui Paulo From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 17:15:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0E6EFDFB; Wed, 17 Apr 2013 17:15:13 +0000 (UTC) (envelope-from hiren.panchasara@gmail.com) Received: from mail-ea0-x22b.google.com (mail-ea0-x22b.google.com [IPv6:2a00:1450:4013:c01::22b]) by mx1.freebsd.org (Postfix) with ESMTP id 365DA786; Wed, 17 Apr 2013 17:15:12 +0000 (UTC) Received: by mail-ea0-f171.google.com with SMTP id b15so839824eae.30 for ; Wed, 17 Apr 2013 10:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=ie1J0O3M68qFRoT1eCeEZwIgDPwin/Nv8SzXLX6r+HQ=; b=ecgSWLEdWrmqiU03wR81nslHJRUs3xdHdBU2jRlhFlsMDsDNwLWbqY+xiVWiw/QIb/ /8AjaBPLRr5JYEHioAmJSyU8oDMBJkpwXfPvTxQMU/bdXGIx5/6RhPMEgd1fgVYl/jiG 8ToozNY7mkBbqaMHpOgpAkZk9EOJkGnAF3HRhsQA5RQTt2qwG9NW7FXeiVI8+c1PCHjO 3NHA2DWTA9Nr6e6Kmut3Lwf/hhe7N30QkfqUPol14blApQMlTEwsDDe1fQ1Gk/A71Siq km1rl9ie8OuJXLrdcEB5T92c3CzJ0dN6x46ng3ipBND3k+f1IWSVdM+L170iOhv2WSrB mEPQ== MIME-Version: 1.0 X-Received: by 10.14.219.8 with SMTP id l8mr20135311eep.40.1366218911331; Wed, 17 Apr 2013 10:15:11 -0700 (PDT) Sender: hiren.panchasara@gmail.com Received: by 10.15.91.72 with HTTP; Wed, 17 Apr 2013 10:15:11 -0700 (PDT) In-Reply-To: <201304161210.09058.jhb@freebsd.org> References: <201304140242.r3E2geSq094403@svn.freebsd.org> <201304161210.09058.jhb@freebsd.org> Date: Wed, 17 Apr 2013 10:15:11 -0700 X-Google-Sender-Auth: KEc0hZRjDAmECyFQvcvznp_5_Yk Message-ID: Subject: Re: svn commit: r249461 - head/sys/dev/ips From: hiren panchasara To: John Baldwin Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 17:15:13 -0000 On Tue, Apr 16, 2013 at 9:10 AM, John Baldwin wrote: > On Saturday, April 13, 2013 10:42:40 pm Hiren Panchasara wrote: >> Author: hiren >> Date: Sun Apr 14 02:42:40 2013 >> New Revision: 249461 >> URL: http://svnweb.freebsd.org/changeset/base/249461 >> >> Log: >> Fixing a clang warning indicating uninitialized variable usage. >> >> PR: kern/177164 >> Approved by: sbruno (mentor) > > Hmm, I always thought that dmatags and maps were opaque types and not > necessarily "known" in consumers to be pointers. (Some drivers do check tehm > against NULL implicitly via 'if (map)' or 'if (tag)', but well-behaved drivers > use other means (flags, etc.) to know if they are valid.) Hi John, Would this be a better fix? We do not need to do any clean up if we fail to create the tag: Index: ips.c =================================================================== --- ips.c (revision 249588) +++ ips.c (working copy) @@ -578,7 +578,7 @@ { int error; bus_dma_tag_t dmatag; - bus_dmamap_t dmamap = NULL; + bus_dmamap_t dmamap; if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, /* alignemnt */ 1, /* boundary */ 0, @@ -595,7 +595,7 @@ &dmatag) != 0) { device_printf(sc->dev, "can't alloc dma tag for statue queue\n"); error = ENOMEM; - goto exit; + return error; } if(bus_dmamem_alloc(dmatag, (void *)&(sc->copper_queue), BUS_DMA_NOWAIT, &dmamap)){ Thanks, Hiren > > -- > John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 17:34:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5D113725; Wed, 17 Apr 2013 17:34:01 +0000 (UTC) (envelope-from dim@freebsd.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) by mx1.freebsd.org (Postfix) with ESMTP id 1CF22871; Wed, 17 Apr 2013 17:34:01 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::dc79:2881:589:7d77] (unknown [IPv6:2001:7b8:3a7:0:dc79:2881:589:7d77]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 5B0165C45; Wed, 17 Apr 2013 19:33:59 +0200 (CEST) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: svn commit: r249484 - head/lib From: Dimitry Andric In-Reply-To: Date: Wed, 17 Apr 2013 19:33:45 +0200 Content-Transfer-Encoding: 7bit Message-Id: <1FEABB1B-ADDE-412A-9D40-F9FB2822B654@freebsd.org> References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <516D54F5.4010501@FreeBSD.org> <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> <516E900B.9090300@FreeBSD.org> To: Tim Kientzle X-Mailer: Apple Mail (2.1503) Cc: Ed Schouten , src-committers@freebsd.org, Juli Mallett , svn-src-all@freebsd.org, Brooks Davis , svn-src-head@freebsd.org, Tijl Coosemans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 17:34:01 -0000 On Apr 17, 2013, at 17:58, Tim Kientzle wrote: > On Apr 17, 2013, at 5:05 AM, Tijl Coosemans wrote: ... >> So you compile with -ffreestanding -nostdinc? >> And then add the include path returned by -print-file-name=include? > > That's what the U-Boot sources do, yes. Why would U-Boot want to build for a freestanding environment, then include standard headers? Isn't that a bit backwards? :-) >>> The -print-file-name=include option works on Linux, works >>> on MacOS, and --- with this one symlink --- can work on >>> FreeBSD as well. I've been using it to cross-build U-Boot >>> using the FreeBSD xdev toolchain with both GCC and Clang. >> >> "clang -E -v - > /usr/bin/../lib/clang/3.3" to cc1 stage which then complains about >> nonexistent directory "/usr/bin/../lib/clang/3.3/include". >> >> So how about moving /usr/include/clang/3.3 to >> /usr/lib/clang/3.3/include? That seems to be the location clang >> expects and what lang/clang port uses (in /usr/local). > > I would certainly like to see that. I presumed that there > was some reason this wasn't done in the initial import. Probably because headers belong under /usr/include, not in a library directory? I do not really agree with upstream's decision to place their internal headers in that location. Third-party software depending on their exact location is just a little braindead IMHO. In any case, the layout has been like this since the initial clangbsd import, and I never saw any reason to change it. Maybe Ed can tell a bit more, since he seems to have done the initial infrastructure setup. >> The path from -resource-dir is also searched by -print-file-name. >> >> All headers from contrib/llvm/tools/clang/lib/Headers would have >> to be installed there to have a complete freestanding environment, >> but some of those headers would have to be patched to use the base >> system header in the hosted case like the stdint.h header does: >> >> #if __STDC_HOSTED__ && \ >> defined(__has_include_next) && __has_include_next() >> # include_next >> #else >> ... >> #endif Indeed, some of clang's internal headers currently conflict with our own, due to several declarations and definitions, and therefore we do not install them at this time. Again, this could be changed, but not without good reason. One specific third-party project is not enough, I think. (Especially since our kernel is also freestanding, and does not depend on these internals.) From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 18:11:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0A1CF937; Wed, 17 Apr 2013 18:11:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id 4C896B0C; Wed, 17 Apr 2013 18:11:17 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3CADBB977; Wed, 17 Apr 2013 14:11:16 -0400 (EDT) From: John Baldwin To: hiren panchasara Subject: Re: svn commit: r249461 - head/sys/dev/ips Date: Wed, 17 Apr 2013 13:19:26 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <201304140242.r3E2geSq094403@svn.freebsd.org> <201304161210.09058.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201304171319.26560.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 17 Apr 2013 14:11:16 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 18:11:18 -0000 On Wednesday, April 17, 2013 1:15:11 pm hiren panchasara wrote: > On Tue, Apr 16, 2013 at 9:10 AM, John Baldwin wrote: > > On Saturday, April 13, 2013 10:42:40 pm Hiren Panchasara wrote: > >> Author: hiren > >> Date: Sun Apr 14 02:42:40 2013 > >> New Revision: 249461 > >> URL: http://svnweb.freebsd.org/changeset/base/249461 > >> > >> Log: > >> Fixing a clang warning indicating uninitialized variable usage. > >> > >> PR: kern/177164 > >> Approved by: sbruno (mentor) > > > > Hmm, I always thought that dmatags and maps were opaque types and not > > necessarily "known" in consumers to be pointers. (Some drivers do check tehm > > against NULL implicitly via 'if (map)' or 'if (tag)', but well-behaved drivers > > use other means (flags, etc.) to know if they are valid.) > > Hi John, > > Would this be a better fix? We do not need to do any clean up if we > fail to create the tag: > > Index: ips.c > =================================================================== > --- ips.c (revision 249588) > +++ ips.c (working copy) > @@ -578,7 +578,7 @@ > { > int error; > bus_dma_tag_t dmatag; > - bus_dmamap_t dmamap = NULL; > + bus_dmamap_t dmamap; > if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, > /* alignemnt */ 1, > /* boundary */ 0, > @@ -595,7 +595,7 @@ > &dmatag) != 0) { > device_printf(sc->dev, "can't alloc dma tag for > statue queue\n"); > error = ENOMEM; > - goto exit; > + return error; > } > if(bus_dmamem_alloc(dmatag, (void *)&(sc->copper_queue), > BUS_DMA_NOWAIT, &dmamap)){ That would be fine. I would actually prefer though that this only call bus_dmamem_free() if the alloc succeeds, so in addition I would make the call to bus_dmammem_free() conditional on sc->copper_queue != NULL. Thanks. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 18:26:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 758387D9; Wed, 17 Apr 2013 18:26:02 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 67C34D48; Wed, 17 Apr 2013 18:26:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HIQ2HN006001; Wed, 17 Apr 2013 18:26:02 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HIQ2AZ006000; Wed, 17 Apr 2013 18:26:02 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304171826.r3HIQ2AZ006000@svn.freebsd.org> From: Adrian Chadd Date: Wed, 17 Apr 2013 18:26:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249589 - head/sys/mips/malta X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 18:26:02 -0000 Author: adrian Date: Wed Apr 17 18:26:01 2013 New Revision: 249589 URL: http://svnweb.freebsd.org/changeset/base/249589 Log: Add the static kernel boot environment, needed to actually boot this thing. (Wasting 4k just as a temporary placeholder for a boot environment seems a bit ridiculous, but hey.) Tested: gxemul: $ gxemul -e malta -d i:/home/adrian/work/freebsd/svn/mfsroot-rspro.img -C 4Kc /tftpboot/kernel.MALTA Modified: head/sys/mips/malta/malta_machdep.c Modified: head/sys/mips/malta/malta_machdep.c ============================================================================== --- head/sys/mips/malta/malta_machdep.c Wed Apr 17 11:56:11 2013 (r249588) +++ head/sys/mips/malta/malta_machdep.c Wed Apr 17 18:26:01 2013 (r249589) @@ -83,6 +83,11 @@ void lcd_puts(char *); void malta_reset(void); /* + * Temporary boot environment used at startup. + */ +static char boot1_env[4096]; + +/* * Offsets to MALTA LCD characters. */ static int malta_lcd_offs[] = { @@ -278,6 +283,7 @@ platform_start(__register_t a0, __regist mips_pcpu0_init(); platform_counter_freq = malta_cpu_freq(); mips_timer_early_init(platform_counter_freq); + init_static_kenv(boot1_env, sizeof(boot1_env)); cninit(); printf("entry: platform_start()\n"); From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 18:30:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C9362A2B for ; Wed, 17 Apr 2013 18:30:25 +0000 (UTC) (envelope-from andy@fud.org.nz) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by mx1.freebsd.org (Postfix) with ESMTP id A6CB3D7C for ; Wed, 17 Apr 2013 18:30:25 +0000 (UTC) Received: by mail-pa0-f49.google.com with SMTP id kp14so1061970pab.36 for ; Wed, 17 Apr 2013 11:30:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=baNdXZd6dzrvuCerNkYI10xh7+npb9/IFlHg1NpMtRE=; b=kYn83Qjl6Q0DKxww97ZsQ8jKTiN1Sro7CrdHt10SGTrtbeOecDI8YNvSZFBQFhEiFu h7+JYTLILvt3mASx3BKuLnx1wyAlGCZEm4deJAFvU13FtbsE7jDturXWggC2kXqEL2N0 5EyLbRx5spTe4kctW6IfoyKQzhCPWw4vjN0yfO9P+I/XWLyrR6zYLK3Yh9lPH69MsHPv 0nr0jhnTVC0W5NhwmEQXR3lctMBGPXivE1YHUOPZUp4FVtAmPiLYMLmqwG7FRmSyPHvM 6sDU+X1+A35RnnrAi2YBs2T5EE0wCN3QeQzfHpDUwB+z7jyOpMwNXZZBvlTBy7xZpsFz eKDg== MIME-Version: 1.0 X-Received: by 10.68.78.68 with SMTP id z4mr10229966pbw.161.1366223425281; Wed, 17 Apr 2013 11:30:25 -0700 (PDT) Sender: andy@fud.org.nz Received: by 10.70.94.197 with HTTP; Wed, 17 Apr 2013 11:30:25 -0700 (PDT) In-Reply-To: <201304171826.r3HIQ2AZ006000@svn.freebsd.org> References: <201304171826.r3HIQ2AZ006000@svn.freebsd.org> Date: Thu, 18 Apr 2013 06:30:25 +1200 X-Google-Sender-Auth: z-aCVC8cgtRPDJ6GxBBZxdBuK68 Message-ID: Subject: Re: svn commit: r249589 - head/sys/mips/malta From: Andrew Thompson To: Adrian Chadd X-Gm-Message-State: ALoCoQkNRrbizaMaltVJsZSyx0d1Qr3KjHY34zpVfuDC1ISK5SlJYvtXf+/wN1grviArDIQgKJ6Y Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 18:30:25 -0000 On 18 April 2013 06:26, Adrian Chadd wrote: > Author: adrian > Date: Wed Apr 17 18:26:01 2013 > New Revision: 249589 > URL: http://svnweb.freebsd.org/changeset/base/249589 > > Log: > Add the static kernel boot environment, needed to actually boot this > thing. > > (Wasting 4k just as a temporary placeholder for a boot environment seems > a bit ridiculous, but hey.) > This isnt needed anymore, see r249570. From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 18:36:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7E95ECC2; Wed, 17 Apr 2013 18:36:50 +0000 (UTC) (envelope-from hiren.panchasara@gmail.com) Received: from mail-ea0-x236.google.com (mail-ea0-x236.google.com [IPv6:2a00:1450:4013:c01::236]) by mx1.freebsd.org (Postfix) with ESMTP id A30E7DD4; Wed, 17 Apr 2013 18:36:49 +0000 (UTC) Received: by mail-ea0-f182.google.com with SMTP id q15so872263ead.27 for ; Wed, 17 Apr 2013 11:36:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=FJREa9EEbVlhnoh/wIdDh4O1a3ysehMZxwBlptVvbuQ=; b=UvN6uUpe360j/1cc9lynjUYz/DfN2XW6tTxSedH2A/WvCWU8TFpeWQ9h5tBodTicRR ZTEEQbzU5AZhxwn+THT/9XWHJRcEafG65/ywp826UrvtKS4BvrEDxcGEKG69H2ylWHFy CCHv7ddbK6fA086Tmdg/bpPPxNB4B8jtVB7snBL3IgWbxj5BLtNntedsw2jO0FvLTU8P qjPNx7qJrn5yhKHWWfZEEDiie5FK7NpHb6zY5JZd0K85O27o+IfP5gBo/zosb79DO0dS OtIMc1MNCGbomAL4TWKXfdZbkwPMkJaDziggiCCnrpZehSYgCZYrK8vu8d5z+VKYJUmN XDkw== MIME-Version: 1.0 X-Received: by 10.14.5.137 with SMTP id 9mr20945212eel.30.1366223808825; Wed, 17 Apr 2013 11:36:48 -0700 (PDT) Sender: hiren.panchasara@gmail.com Received: by 10.15.91.72 with HTTP; Wed, 17 Apr 2013 11:36:48 -0700 (PDT) In-Reply-To: <201304171319.26560.jhb@freebsd.org> References: <201304140242.r3E2geSq094403@svn.freebsd.org> <201304161210.09058.jhb@freebsd.org> <201304171319.26560.jhb@freebsd.org> Date: Wed, 17 Apr 2013 11:36:48 -0700 X-Google-Sender-Auth: WhbUwXSFpCMhHoPaNqk2WPGExeU Message-ID: Subject: Re: svn commit: r249461 - head/sys/dev/ips From: hiren panchasara To: John Baldwin Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 18:36:50 -0000 On Wed, Apr 17, 2013 at 10:19 AM, John Baldwin wrote: > On Wednesday, April 17, 2013 1:15:11 pm hiren panchasara wrote: >> On Tue, Apr 16, 2013 at 9:10 AM, John Baldwin wrote: >> > On Saturday, April 13, 2013 10:42:40 pm Hiren Panchasara wrote: >> >> Author: hiren >> >> Date: Sun Apr 14 02:42:40 2013 >> >> New Revision: 249461 >> >> URL: http://svnweb.freebsd.org/changeset/base/249461 >> >> >> >> Log: >> >> Fixing a clang warning indicating uninitialized variable usage. >> >> >> >> PR: kern/177164 >> >> Approved by: sbruno (mentor) >> > >> > Hmm, I always thought that dmatags and maps were opaque types and not >> > necessarily "known" in consumers to be pointers. (Some drivers do check tehm >> > against NULL implicitly via 'if (map)' or 'if (tag)', but well-behaved drivers >> > use other means (flags, etc.) to know if they are valid.) >> >> Hi John, >> >> Would this be a better fix? We do not need to do any clean up if we >> fail to create the tag: >> >> Index: ips.c >> =================================================================== >> --- ips.c (revision 249588) >> +++ ips.c (working copy) >> @@ -578,7 +578,7 @@ >> { >> int error; >> bus_dma_tag_t dmatag; >> - bus_dmamap_t dmamap = NULL; >> + bus_dmamap_t dmamap; >> if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, >> /* alignemnt */ 1, >> /* boundary */ 0, >> @@ -595,7 +595,7 @@ >> &dmatag) != 0) { >> device_printf(sc->dev, "can't alloc dma tag for >> statue queue\n"); >> error = ENOMEM; >> - goto exit; >> + return error; >> } >> if(bus_dmamem_alloc(dmatag, (void *)&(sc->copper_queue), >> BUS_DMA_NOWAIT, &dmamap)){ > > That would be fine. I would actually prefer though that this only > call bus_dmamem_free() if the alloc succeeds, so in addition I would > make the call to bus_dmammem_free() conditional on sc->copper_queue != NULL. > Makes sense, final patch looks like this: Index: ips.c =================================================================== --- ips.c (revision 249588) +++ ips.c (working copy) @@ -578,7 +578,7 @@ { int error; bus_dma_tag_t dmatag; - bus_dmamap_t dmamap = NULL; + bus_dmamap_t dmamap; if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, /* alignemnt */ 1, /* boundary */ 0, @@ -595,7 +595,7 @@ &dmatag) != 0) { device_printf(sc->dev, "can't alloc dma tag for statue queue\n"); error = ENOMEM; - goto exit; + return error; } if(bus_dmamem_alloc(dmatag, (void *)&(sc->copper_queue), BUS_DMA_NOWAIT, &dmamap)){ @@ -623,7 +623,8 @@ return 0; exit: - bus_dmamem_free(dmatag, sc->copper_queue, dmamap); + if (sc->copper_queue != NULL) + bus_dmamem_free(dmatag, sc->copper_queue, dmamap); bus_dma_tag_destroy(dmatag); return error; } Thanks, Hiren > Thanks. > > -- > John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 18:43:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 58D93141; Wed, 17 Apr 2013 18:43:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4B4FAE61; Wed, 17 Apr 2013 18:43:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HIhYGQ011608; Wed, 17 Apr 2013 18:43:34 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HIhYjJ011607; Wed, 17 Apr 2013 18:43:34 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201304171843.r3HIhYjJ011607@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 17 Apr 2013 18:43:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249590 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 18:43:34 -0000 Author: glebius Date: Wed Apr 17 18:43:33 2013 New Revision: 249590 URL: http://svnweb.freebsd.org/changeset/base/249590 Log: On non-ACPI i386 mp_ncpus is initialized at SI_SUB_CPU, and this prevents us from creating UMA_ZONE_PCPU zones earlier. As bandaid shift initialization of counter(9) zone later. Reviewed by: kib Reported & tested by: Lytochkin Boris Modified: head/sys/kern/subr_counter.c Modified: head/sys/kern/subr_counter.c ============================================================================== --- head/sys/kern/subr_counter.c Wed Apr 17 18:26:01 2013 (r249589) +++ head/sys/kern/subr_counter.c Wed Apr 17 18:43:33 2013 (r249590) @@ -106,4 +106,4 @@ counter_startup(void) uint64_pcpu_zone = uma_zcreate("uint64 pcpu", sizeof(uint64_t), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); } -SYSINIT(counter, SI_SUB_KMEM, SI_ORDER_ANY, counter_startup, NULL); +SYSINIT(counter, SI_SUB_CPU, SI_ORDER_FOURTH, counter_startup, NULL); From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 19:02:21 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E57E1B1B; Wed, 17 Apr 2013 19:02:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id BA9B2F57; Wed, 17 Apr 2013 19:02:21 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3AAE3B918; Wed, 17 Apr 2013 15:02:21 -0400 (EDT) From: John Baldwin To: hiren panchasara Subject: Re: svn commit: r249461 - head/sys/dev/ips Date: Wed, 17 Apr 2013 14:51:45 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <201304140242.r3E2geSq094403@svn.freebsd.org> <201304171319.26560.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201304171451.45400.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 17 Apr 2013 15:02:21 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 19:02:22 -0000 On Wednesday, April 17, 2013 2:36:48 pm hiren panchasara wrote: > On Wed, Apr 17, 2013 at 10:19 AM, John Baldwin wrote: > > On Wednesday, April 17, 2013 1:15:11 pm hiren panchasara wrote: > >> On Tue, Apr 16, 2013 at 9:10 AM, John Baldwin wrote: > >> > On Saturday, April 13, 2013 10:42:40 pm Hiren Panchasara wrote: > >> >> Author: hiren > >> >> Date: Sun Apr 14 02:42:40 2013 > >> >> New Revision: 249461 > >> >> URL: http://svnweb.freebsd.org/changeset/base/249461 > >> >> > >> >> Log: > >> >> Fixing a clang warning indicating uninitialized variable usage. > >> >> > >> >> PR: kern/177164 > >> >> Approved by: sbruno (mentor) > >> > > >> > Hmm, I always thought that dmatags and maps were opaque types and not > >> > necessarily "known" in consumers to be pointers. (Some drivers do check tehm > >> > against NULL implicitly via 'if (map)' or 'if (tag)', but well-behaved drivers > >> > use other means (flags, etc.) to know if they are valid.) > >> > >> Hi John, > >> > >> Would this be a better fix? We do not need to do any clean up if we > >> fail to create the tag: > >> > >> Index: ips.c > >> =================================================================== > >> --- ips.c (revision 249588) > >> +++ ips.c (working copy) > >> @@ -578,7 +578,7 @@ > >> { > >> int error; > >> bus_dma_tag_t dmatag; > >> - bus_dmamap_t dmamap = NULL; > >> + bus_dmamap_t dmamap; > >> if (bus_dma_tag_create( /* parent */ sc- >adapter_dmatag, > >> /* alignemnt */ 1, > >> /* boundary */ 0, > >> @@ -595,7 +595,7 @@ > >> &dmatag) != 0) { > >> device_printf(sc->dev, "can't alloc dma tag for > >> statue queue\n"); > >> error = ENOMEM; > >> - goto exit; > >> + return error; > >> } > >> if(bus_dmamem_alloc(dmatag, (void *)&(sc->copper_queue), > >> BUS_DMA_NOWAIT, &dmamap)){ > > > > That would be fine. I would actually prefer though that this only > > call bus_dmamem_free() if the alloc succeeds, so in addition I would > > make the call to bus_dmammem_free() conditional on sc->copper_queue != NULL. > > > > Makes sense, final patch looks like this: > > Index: ips.c > =================================================================== > --- ips.c (revision 249588) > +++ ips.c (working copy) > @@ -578,7 +578,7 @@ > { > int error; > bus_dma_tag_t dmatag; > - bus_dmamap_t dmamap = NULL; > + bus_dmamap_t dmamap; > if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, > /* alignemnt */ 1, > /* boundary */ 0, > @@ -595,7 +595,7 @@ > &dmatag) != 0) { > device_printf(sc->dev, "can't alloc dma tag for > statue queue\n"); > error = ENOMEM; > - goto exit; > + return error; One more suggestion: just use 'return (ENOMEM)' directly perhaps. > } > if(bus_dmamem_alloc(dmatag, (void *)&(sc->copper_queue), > BUS_DMA_NOWAIT, &dmamap)){ > @@ -623,7 +623,8 @@ > > return 0; > exit: > - bus_dmamem_free(dmatag, sc->copper_queue, dmamap); > + if (sc->copper_queue != NULL) > + bus_dmamem_free(dmatag, sc->copper_queue, dmamap); > bus_dma_tag_destroy(dmatag); > return error; > } > > Thanks, > Hiren Looks ok to me with or without the suggestion above. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 19:39:07 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A6C3FCFB; Wed, 17 Apr 2013 19:39:07 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay009.isp.belgacom.be (mailrelay009.isp.belgacom.be [195.238.6.176]) by mx1.freebsd.org (Postfix) with ESMTP id 338721B9; Wed, 17 Apr 2013 19:39:06 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8GAO/5blFR8npE/2dsb2JhbABQgwbAe4EDF3SCHwEBBVYeBRALDgoJFg8JAwIBAgEnHgYNAQUCAQGIFL1UjxoHg0YDj1WBKZccgw06 Received: from 68.122-242-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.242.122.68]) by relay.skynet.be with ESMTP; 17 Apr 2013 21:39:04 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.6/8.14.6) with ESMTP id r3HJd32w027779; Wed, 17 Apr 2013 21:39:03 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Message-ID: <516EFA52.1020509@FreeBSD.org> Date: Wed, 17 Apr 2013 21:38:58 +0200 From: Tijl Coosemans User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130408 Thunderbird/17.0.5 MIME-Version: 1.0 To: Dimitry Andric Subject: Re: svn commit: r249484 - head/lib References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <516D54F5.4010501@FreeBSD.org> <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> <516E900B.9090300@FreeBSD.org> <1FEABB1B-ADDE-412A-9D40-F9FB2822B654@freebsd.org> In-Reply-To: <1FEABB1B-ADDE-412A-9D40-F9FB2822B654@freebsd.org> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2PVDBTXUOHUXKPNDTHPTS" Cc: Ed Schouten , src-committers@freebsd.org, Juli Mallett , svn-src-all@freebsd.org, Tim Kientzle , svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 19:39:07 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2PVDBTXUOHUXKPNDTHPTS Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2013-04-17 19:33, Dimitry Andric wrote: > On Apr 17, 2013, at 17:58, Tim Kientzle wrote: >> On Apr 17, 2013, at 5:05 AM, Tijl Coosemans wrote: >>> So you compile with -ffreestanding -nostdinc? >>> And then add the include path returned by -print-file-name=3Dinclude?= >> >> That's what the U-Boot sources do, yes. >=20 > Why would U-Boot want to build for a freestanding environment, then > include standard headers? Isn't that a bit backwards? :-) There's a list of headers in the standard that freestanding programs are allowed to include. If they drop -nostdinc it should build on FreeBSD. I suppose they use it to prevent accidental use of non-freestanding stuff in the headers. >>>> The -print-file-name=3Dinclude option works on Linux, works >>>> on MacOS, and --- with this one symlink --- can work on >>>> FreeBSD as well. I've been using it to cross-build U-Boot >>>> using the FreeBSD xdev toolchain with both GCC and Clang. >>> >>> "clang -E -v - >> /usr/bin/../lib/clang/3.3" to cc1 stage which then complains about >>> nonexistent directory "/usr/bin/../lib/clang/3.3/include". >>> >>> So how about moving /usr/include/clang/3.3 to >>> /usr/lib/clang/3.3/include? That seems to be the location clang >>> expects and what lang/clang port uses (in /usr/local). >> >> I would certainly like to see that. I presumed that there >> was some reason this wasn't done in the initial import. >=20 > Probably because headers belong under /usr/include, not in a library > directory? I do not really agree with upstream's decision to place > their internal headers in that location. Third-party software dependin= g > on their exact location is just a little braindead IMHO. It doesn't really depend on the exact location. It relies on -print-file-name=3Dinclude to return the location which our clang doesn't. I agree that headers don't belong under lib/, but that's something to discuss upstream. FreeBSD doing little things like this differently than everybody else just makes it harder to use imho. ------enig2PVDBTXUOHUXKPNDTHPTS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iF4EAREIAAYFAlFu+lcACgkQfoCS2CCgtit3zAD/euMtxrfGhBft/9CTyimsbPEq 7v4SescnPjGXg+FujOwA/0Qw8QwIQTiHJ3L0lAufJRZfCtXBclyjXspKJbJARafI =3sLp -----END PGP SIGNATURE----- ------enig2PVDBTXUOHUXKPNDTHPTS-- From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 20:19:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B1DE38A2; Wed, 17 Apr 2013 20:19:32 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A4D92362; Wed, 17 Apr 2013 20:19:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HKJWVB040805; Wed, 17 Apr 2013 20:19:32 GMT (envelope-from jlh@svn.freebsd.org) Received: (from jlh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HKJWRr040804; Wed, 17 Apr 2013 20:19:32 GMT (envelope-from jlh@svn.freebsd.org) Message-Id: <201304172019.r3HKJWRr040804@svn.freebsd.org> From: Jeremie Le Hen Date: Wed, 17 Apr 2013 20:19:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249591 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 20:19:32 -0000 Author: jlh Date: Wed Apr 17 20:19:32 2013 New Revision: 249591 URL: http://svnweb.freebsd.org/changeset/base/249591 Log: Document jail__parameters option. The description explains why we should not configure "path", "host.hostname", "command", "ip4.addr" and ip6.addr" parameters with this, but rather use the historical rc.conf(5) options. MFC after: 3 days Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Wed Apr 17 18:43:33 2013 (r249590) +++ head/share/man/man5/rc.conf.5 Wed Apr 17 20:19:32 2013 (r249591) @@ -3982,6 +3982,42 @@ Set to the root directory used by jail Unset by default. Set to the fully qualified domain name (FQDN) assigned to jail .Va jname . +.It Va jail_ Ns Ao Ar jname Ac Ns Va _parameters +.Pq Vt str +Unset by default. +Set extra parameters for jail +.Va jname , +such as +.Dq Li allow.chflags +or +.Dq Li children.max . +See +.Xr jail 8 +for a list of available parameters. +Note that the following parameters are already defined by +.Pa rc.d/jail +script out of their corresponding +.Nm +variables: +.Bl -tag -width "host.hostname" -offset indent +.It Li path +set from +.Va jail_ Ns Ao Ar jname Ac Ns Va _rootdir +.It Li host.hostname +set from +.Va jail_ Ns Ao Ar jname Ac Ns Va _hostname +.It Li command +set from +.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_start +.It Li ip4.addr +set if +.Va jail_ Ns Ao Ar jname Ac Ns Va _ip +contains IPv4 addresses +.It Li ip6.addr +set if +.Va jail_ Ns Ao Ar jname Ac Ns Va _ip6 +contains IPv6 addresses +.El .It Va jail_ Ns Ao Ar jname Ac Ns Va _ip .Pq Vt str Unset by default. From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 20:41:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F1850F09; Wed, 17 Apr 2013 20:41:26 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-we0-x22d.google.com (mail-we0-x22d.google.com [IPv6:2a00:1450:400c:c03::22d]) by mx1.freebsd.org (Postfix) with ESMTP id 26B36653; Wed, 17 Apr 2013 20:41:26 +0000 (UTC) Received: by mail-we0-f173.google.com with SMTP id t57so1519369wey.4 for ; Wed, 17 Apr 2013 13:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=pDs4F1J2x9GtMlqNxdXPsLrRHz9PJ/Kp7DNbxTRDjLY=; b=UpO0qW8rzCj+hj/hZf0oZark3SQCbVBBAHW6aPH/3PqsZ/WwZGDA2rmVDEYkvhC/K2 y7mc4OAdVq25n6iuUbcduEKiASP7V7QS6c3ctPk2VZTScJTjr/rohzGV6wAM3iH716hA lzWdni8RhjkEcC7lWKgUcBJJ/bv5vyYocW6a/kRNukeoXFGlaA4yYBNfSA8d9zL6xQxe jzzfUySVoiJfnSduKbmOqGPHPYodKC5ynzcYGeGm89OLImecoWmfdJfPHJLr8S+GvnQ7 hVCd4Se8+E8Kqyy7q7BQbMpGtnhfVxBclL5buGgMU9D+lbL+0xP1RCXHfpsfw7JXRslh DDbQ== MIME-Version: 1.0 X-Received: by 10.180.85.103 with SMTP id g7mr28889832wiz.23.1366231285331; Wed, 17 Apr 2013 13:41:25 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.217.88.129 with HTTP; Wed, 17 Apr 2013 13:41:25 -0700 (PDT) In-Reply-To: References: <201304171826.r3HIQ2AZ006000@svn.freebsd.org> Date: Wed, 17 Apr 2013 13:41:25 -0700 X-Google-Sender-Auth: TR757z_fx5DpQYPCqv1pgRQL4Cs Message-ID: Subject: Re: svn commit: r249589 - head/sys/mips/malta From: Adrian Chadd To: Andrew Thompson Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 20:41:27 -0000 On 17 April 2013 11:30, Andrew Thompson wrote: > > This isnt needed anymore, see r249570. Ah, cool! adrian From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 21:00:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D03DE6A2; Wed, 17 Apr 2013 21:00:25 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C17F7772; Wed, 17 Apr 2013 21:00:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HL0PLN054969; Wed, 17 Apr 2013 21:00:25 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HL0Mrv054939; Wed, 17 Apr 2013 21:00:22 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201304172100.r3HL0Mrv054939@svn.freebsd.org> From: "Kenneth D. Merry" Date: Wed, 17 Apr 2013 21:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249592 - in head/sys: conf fs/nfs fs/nfsclient fs/nfsserver modules/nfsd modules/nfsserver nfsserver X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 21:00:25 -0000 Author: ken Date: Wed Apr 17 21:00:22 2013 New Revision: 249592 URL: http://svnweb.freebsd.org/changeset/base/249592 Log: Revamp the old NFS server's File Handle Affinity (FHA) code so that it will work with either the old or new server. The FHA code keeps a cache of currently active file handles for NFSv2 and v3 requests, so that read and write requests for the same file are directed to the same group of threads (reads) or thread (writes). It does not currently work for NFSv4 requests. They are more complex, and will take more work to support. This improves read-ahead performance, especially with ZFS, if the FHA tuning parameters are configured appropriately. Without the FHA code, concurrent reads that are part of a sequential read from a file will be directed to separate NFS threads. This has the effect of confusing the ZFS zfetch (prefetch) code and makes sequential reads significantly slower with clients like Linux that do a lot of prefetching. The FHA code has also been updated to direct write requests to nearby file offsets to the same thread in the same way it batches reads, and the FHA code will now also send writes to multiple threads when needed. This improves sequential write performance in ZFS, because writes to a file are now more ordered. Since NFS writes (generally less than 64K) are smaller than the typical ZFS record size (usually 128K), out of order NFS writes to the same block can trigger a read in ZFS. Sending them down the same thread increases the odds of their being in order. In order for multiple write threads per file in the FHA code to be useful, writes in the NFS server have been changed to use a LK_SHARED vnode lock, and upgrade that to LK_EXCLUSIVE if the filesystem doesn't allow multiple writers to a file at once. ZFS is currently the only filesystem that allows multiple writers to a file, because it has internal file range locking. This change does not affect the NFSv4 code. This improves random write performance to a single file in ZFS, since we can now have multiple writers inside ZFS at one time. I have changed the default tuning parameters to a 22 bit (4MB) window size (from 256K) and unlimited commands per thread as a result of my benchmarking with ZFS. The FHA code has been updated to allow configuring the tuning parameters from loader tunable variables in addition to sysctl variables. The read offset window calculation has been slightly modified as well. Instead of having separate bins, each file handle has a rolling window of bin_shift size. This minimizes glitches in throughput when shifting from one bin to another. sys/conf/files: Add nfs_fha_new.c and nfs_fha_old.c. Compile nfs_fha.c when either the old or the new NFS server is built. sys/fs/nfs/nfsport.h, sys/fs/nfs/nfs_commonport.c: Bring in changes from Rick Macklem to newnfs_realign that allow it to operate in blocking (M_WAITOK) or non-blocking (M_NOWAIT) mode. sys/fs/nfs/nfs_commonsubs.c, sys/fs/nfs/nfs_var.h: Bring in a change from Rick Macklem to allow telling nfsm_dissect() whether or not to wait for mallocs. sys/fs/nfs/nfsm_subs.h: Bring in changes from Rick Macklem to create a new nfsm_dissect_nonblock() inline function and NFSM_DISSECT_NONBLOCK() macro. sys/fs/nfs/nfs_commonkrpc.c, sys/fs/nfsclient/nfs_clkrpc.c: Add the malloc wait flag to a newnfs_realign() call. sys/fs/nfsserver/nfs_nfsdkrpc.c: Setup the new NFS server's RPC thread pool so that it will call the FHA code. Add the malloc flag argument to newnfs_realign(). Unstaticize newnfs_nfsv3_procid[] so that we can use it in the FHA code. sys/fs/nfsserver/nfs_nfsdsocket.c: In nfsrvd_dorpc(), add NFSPROC_WRITE to the list of RPC types that use the LK_SHARED lock type. sys/fs/nfsserver/nfs_nfsdport.c: In nfsd_fhtovp(), if we're starting a write, check to see whether the underlying filesystem supports shared writes. If not, upgrade the lock type from LK_SHARED to LK_EXCLUSIVE. sys/nfsserver/nfs_fha.c: Remove all code that is specific to the NFS server implementation. Anything that is server-specific is now accessed through a callback supplied by that server's FHA shim in the new softc. There are now separate sysctls and tunables for the FHA implementations for the old and new NFS servers. The new NFS server has its tunables under vfs.nfsd.fha, the old NFS server's tunables are under vfs.nfsrv.fha as before. In fha_extract_info(), use callouts for all server-specific code. Getting file handles and offsets is now done in the individual server's shim module. In fha_hash_entry_choose_thread(), change the way we decide whether two reads are in proximity to each other. Previously, the calculation was a simple shift operation to see whether the offsets were in the same power of 2 bucket. The issue was that there would be a bucket (and therefore thread) transition, even if the reads were in close proximity. When there is a thread transition, reads wind up going somewhat out of order, and ZFS gets confused. The new calculation simply tries to see whether the offsets are within 1 << bin_shift of each other. If they are, the reads will be sent to the same thread. The effect of this change is that for sequential reads, if the client doesn't exceed the max_reqs_per_nfsd parameter and the bin_shift is set to a reasonable value (22, or 4MB works well in my tests), the reads in any sequential stream will largely be confined to a single thread. Change fha_assign() so that it takes a softc argument. It is now called from the individual server's shim code, which will pass in the softc. Change fhe_stats_sysctl() so that it takes a softc parameter. It is now called from the individual server's shim code. Add the current offset to the list of things printed out about each active thread. Change the num_reads and num_writes counters in the fha_hash_entry structure to 32-bit values, and rename them num_rw and num_exclusive, respectively, to reflect their changed usage. Add an enable sysctl and tunable that allows the user to disable the FHA code (when vfs.XXX.fha.enable = 0). This is useful for before/after performance comparisons. nfs_fha.h: Move most structure definitions out of nfs_fha.c and into the header file, so that the individual server shims can see them. Change the default bin_shift to 22 (4MB) instead of 18 (256K). Allow unlimited commands per thread. sys/nfsserver/nfs_fha_old.c, sys/nfsserver/nfs_fha_old.h, sys/fs/nfsserver/nfs_fha_new.c, sys/fs/nfsserver/nfs_fha_new.h: Add shims for the old and new NFS servers to interface with the FHA code, and callbacks for the The shims contain all of the code and definitions that are specific to the NFS servers. They setup the server-specific callbacks and set the server name for the sysctl and loader tunable variables. sys/nfsserver/nfs_srvkrpc.c: Configure the RPC code to call fhaold_assign() instead of fha_assign(). sys/modules/nfsd/Makefile: Add nfs_fha.c and nfs_fha_new.c. sys/modules/nfsserver/Makefile: Add nfs_fha_old.c. Reviewed by: rmacklem Sponsored by: Spectra Logic MFC after: 2 weeks Added: head/sys/fs/nfsserver/nfs_fha_new.c (contents, props changed) head/sys/fs/nfsserver/nfs_fha_new.h (contents, props changed) head/sys/nfsserver/nfs_fha_old.c (contents, props changed) head/sys/nfsserver/nfs_fha_old.h (contents, props changed) Modified: head/sys/conf/files head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfs/nfs_commonport.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h head/sys/fs/nfs/nfsm_subs.h head/sys/fs/nfs/nfsport.h head/sys/fs/nfsclient/nfs_clkrpc.c head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdsocket.c head/sys/modules/nfsd/Makefile head/sys/modules/nfsserver/Makefile head/sys/nfsserver/nfs_fha.c head/sys/nfsserver/nfs_fha.h head/sys/nfsserver/nfs_srvkrpc.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/conf/files Wed Apr 17 21:00:22 2013 (r249592) @@ -2404,6 +2404,7 @@ fs/nfsclient/nfs_clvfsops.c optional nfs fs/nfsclient/nfs_clport.c optional nfscl fs/nfsclient/nfs_clbio.c optional nfscl fs/nfsclient/nfs_clnfsiod.c optional nfscl +fs/nfsserver/nfs_fha_new.c optional nfsd inet fs/nfsserver/nfs_nfsdsocket.c optional nfsd inet fs/nfsserver/nfs_nfsdsubs.c optional nfsd inet fs/nfsserver/nfs_nfsdstate.c optional nfsd inet @@ -3210,7 +3211,8 @@ nfsclient/nfs_subs.c optional nfsclient nfsclient/nfs_nfsiod.c optional nfsclient nfsclient/nfs_vfsops.c optional nfsclient nfsclient/nfs_vnops.c optional nfsclient -nfsserver/nfs_fha.c optional nfsserver +nfsserver/nfs_fha.c optional nfsserver | nfsd +nfsserver/nfs_fha_old.c optional nfsserver nfsserver/nfs_serv.c optional nfsserver nfsserver/nfs_srvkrpc.c optional nfsserver nfsserver/nfs_srvsubs.c optional nfsserver Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/fs/nfs/nfs_commonkrpc.c Wed Apr 17 21:00:22 2013 (r249592) @@ -797,7 +797,7 @@ tryagain: * These could cause pointer alignment problems, so copy them to * well aligned mbufs. */ - newnfs_realign(&nd->nd_mrep); + newnfs_realign(&nd->nd_mrep, M_WAITOK); nd->nd_md = nd->nd_mrep; nd->nd_dpos = NFSMTOD(nd->nd_md, caddr_t); nd->nd_repstat = 0; Modified: head/sys/fs/nfs/nfs_commonport.c ============================================================================== --- head/sys/fs/nfs/nfs_commonport.c Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/fs/nfs/nfs_commonport.c Wed Apr 17 21:00:22 2013 (r249592) @@ -132,11 +132,11 @@ static int nfssvc_call(struct thread *, /* * These architectures don't need re-alignment, so just return. */ -void -newnfs_realign(struct mbuf **pm) +int +newnfs_realign(struct mbuf **pm, int how) { - return; + return (0); } #else /* !__NO_STRICT_ALIGNMENT */ /* @@ -155,8 +155,8 @@ newnfs_realign(struct mbuf **pm) * with TCP. Use vfs.nfs.realign_count and realign_test to check this. * */ -void -newnfs_realign(struct mbuf **pm) +int +newnfs_realign(struct mbuf **pm, int how) { struct mbuf *m, *n; int off, space; @@ -173,11 +173,11 @@ newnfs_realign(struct mbuf **pm) space = m_length(m, NULL); if (space >= MINCLSIZE) { /* NB: m_copyback handles space > MCLBYTES */ - n = m_getcl(M_WAITOK, MT_DATA, 0); + n = m_getcl(how, MT_DATA, 0); } else - n = m_get(M_WAITOK, MT_DATA); + n = m_get(how, MT_DATA); if (n == NULL) - return; + return (ENOMEM); /* * Align the remainder of the mbuf chain. */ @@ -195,6 +195,8 @@ newnfs_realign(struct mbuf **pm) } pm = &m->m_next; } + + return (0); } #endif /* __NO_STRICT_ALIGNMENT */ Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/fs/nfs/nfs_commonsubs.c Wed Apr 17 21:00:22 2013 (r249592) @@ -271,7 +271,7 @@ out: * cases. */ APPLESTATIC void * -nfsm_dissct(struct nfsrv_descript *nd, int siz) +nfsm_dissct(struct nfsrv_descript *nd, int siz, int how) { mbuf_t mp2; int siz2, xfer; @@ -296,7 +296,9 @@ nfsm_dissct(struct nfsrv_descript *nd, i } else if (siz > ncl_mbuf_mhlen) { panic("nfs S too big"); } else { - NFSMGET(mp2); + MGET(mp2, MT_DATA, how); + if (mp2 == NULL) + return (NULL); mbuf_setnext(mp2, mbuf_next(nd->nd_md)); mbuf_setnext(nd->nd_md, mp2); mbuf_setlen(nd->nd_md, mbuf_len(nd->nd_md) - left); Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/fs/nfs/nfs_var.h Wed Apr 17 21:00:22 2013 (r249592) @@ -235,7 +235,7 @@ int nfsm_strtom(struct nfsrv_descript *, int nfsm_mbufuio(struct nfsrv_descript *, struct uio *, int); int nfsm_fhtom(struct nfsrv_descript *, u_int8_t *, int, int); int nfsm_advance(struct nfsrv_descript *, int, int); -void *nfsm_dissct(struct nfsrv_descript *, int); +void *nfsm_dissct(struct nfsrv_descript *, int, int); void newnfs_trimleading(struct nfsrv_descript *); void newnfs_trimtrailing(struct nfsrv_descript *, mbuf_t, caddr_t); Modified: head/sys/fs/nfs/nfsm_subs.h ============================================================================== --- head/sys/fs/nfs/nfsm_subs.h Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/fs/nfs/nfsm_subs.h Wed Apr 17 21:00:22 2013 (r249592) @@ -100,7 +100,23 @@ nfsm_dissect(struct nfsrv_descript *nd, retp = (void *)nd->nd_dpos; nd->nd_dpos += siz; } else { - retp = nfsm_dissct(nd, siz); + retp = nfsm_dissct(nd, siz, M_WAITOK); + } + return (retp); +} + +static __inline void * +nfsm_dissect_nonblock(struct nfsrv_descript *nd, int siz) +{ + int tt1; + void *retp; + + tt1 = NFSMTOD(nd->nd_md, caddr_t) + nd->nd_md->m_len - nd->nd_dpos; + if (tt1 >= siz) { + retp = (void *)nd->nd_dpos; + nd->nd_dpos += siz; + } else { + retp = nfsm_dissct(nd, siz, M_NOWAIT); } return (retp); } @@ -113,6 +129,15 @@ nfsm_dissect(struct nfsrv_descript *nd, goto nfsmout; \ } \ } while (0) + +#define NFSM_DISSECT_NONBLOCK(a, c, s) \ + do { \ + (a) = (c)nfsm_dissect_nonblock(nd, (s)); \ + if ((a) == NULL) { \ + error = EBADRPC; \ + goto nfsmout; \ + } \ + } while (0) #endif /* !APPLE */ #define NFSM_STRSIZ(s, m) \ Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/fs/nfs/nfsport.h Wed Apr 17 21:00:22 2013 (r249592) @@ -806,7 +806,7 @@ MALLOC_DECLARE(M_NEWNFSLAYRECALL); */ int nfscl_loadattrcache(struct vnode **, struct nfsvattr *, void *, void *, int, int); -void newnfs_realign(struct mbuf **); +int newnfs_realign(struct mbuf **, int); /* * If the port runs on an SMP box that can enforce Atomic ops with low Modified: head/sys/fs/nfsclient/nfs_clkrpc.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clkrpc.c Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/fs/nfsclient/nfs_clkrpc.c Wed Apr 17 21:00:22 2013 (r249592) @@ -83,7 +83,7 @@ nfscb_program(struct svc_req *rqst, SVCX */ nd.nd_mrep = rqst->rq_args; rqst->rq_args = NULL; - newnfs_realign(&nd.nd_mrep); + newnfs_realign(&nd.nd_mrep, M_WAITOK); nd.nd_md = nd.nd_mrep; nd.nd_dpos = mtod(nd.nd_md, caddr_t); nd.nd_nam = svc_getrpccaller(rqst); Added: head/sys/fs/nfsserver/nfs_fha_new.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/fs/nfsserver/nfs_fha_new.c Wed Apr 17 21:00:22 2013 (r249592) @@ -0,0 +1,272 @@ +/*- + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * Copyright (c) 2013 Spectra Logic Corporation + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include +#include +#include + +static void fhanew_init(void *foo); +static void fhanew_uninit(void *foo); +rpcproc_t fhanew_get_procnum(rpcproc_t procnum); +int fhanew_realign(struct mbuf **mb, int malloc_flags); +int fhanew_get_fh(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos); +int fhanew_is_read(rpcproc_t procnum); +int fhanew_is_write(rpcproc_t procnum); +int fhanew_get_offset(struct mbuf **md, caddr_t *dpos, int v3, + struct fha_info *info); +int fhanew_no_offset(rpcproc_t procnum); +void fhanew_set_locktype(rpcproc_t procnum, struct fha_info *info); +static int fhenew_stats_sysctl(SYSCTL_HANDLER_ARGS); + +static struct fha_params fhanew_softc; + +SYSCTL_DECL(_vfs_nfsd); + +extern int newnfs_nfsv3_procid[]; +extern SVCPOOL *nfsrvd_pool; + +SYSINIT(nfs_fhanew, SI_SUB_ROOT_CONF, SI_ORDER_ANY, fhanew_init, NULL); +SYSUNINIT(nfs_fhanew, SI_SUB_ROOT_CONF, SI_ORDER_ANY, fhanew_uninit, NULL); + +static void +fhanew_init(void *foo) +{ + struct fha_params *softc; + + softc = &fhanew_softc; + + bzero(softc, sizeof(*softc)); + + /* + * Setup the callbacks for this FHA personality. + */ + softc->callbacks.get_procnum = fhanew_get_procnum; + softc->callbacks.realign = fhanew_realign; + softc->callbacks.get_fh = fhanew_get_fh; + softc->callbacks.is_read = fhanew_is_read; + softc->callbacks.is_write = fhanew_is_write; + softc->callbacks.get_offset = fhanew_get_offset; + softc->callbacks.no_offset = fhanew_no_offset; + softc->callbacks.set_locktype = fhanew_set_locktype; + softc->callbacks.fhe_stats_sysctl = fhenew_stats_sysctl; + + snprintf(softc->server_name, sizeof(softc->server_name), + FHANEW_SERVER_NAME); + + softc->pool = &nfsrvd_pool; + + /* + * Initialize the sysctl context list for the fha module. + */ + sysctl_ctx_init(&softc->sysctl_ctx); + softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx, + SYSCTL_STATIC_CHILDREN(_vfs_nfsd), OID_AUTO, "fha", CTLFLAG_RD, + 0, "fha node"); + if (softc->sysctl_tree == NULL) { + printf("%s: unable to allocate sysctl tree\n", __func__); + return; + } + + fha_init(softc); +} + +static void +fhanew_uninit(void *foo) +{ + struct fha_params *softc; + + softc = &fhanew_softc; + + fha_uninit(softc); +} + +rpcproc_t +fhanew_get_procnum(rpcproc_t procnum) +{ + if (procnum > NFSV2PROC_STATFS) + return (-1); + + return (newnfs_nfsv3_procid[procnum]); +} + +int +fhanew_realign(struct mbuf **mb, int malloc_flags) +{ + return (newnfs_realign(mb, malloc_flags)); +} + +int +fhanew_get_fh(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos) +{ + struct nfsrv_descript lnd, *nd; + uint32_t *tl; + int error, len; + + error = 0; + len = 0; + nd = &lnd; + + nd->nd_md = *md; + nd->nd_dpos = *dpos; + + if (v3) { + NFSM_DISSECT_NONBLOCK(tl, uint32_t *, NFSX_UNSIGNED); + if ((len = fxdr_unsigned(int, *tl)) <= 0 || len > NFSX_FHMAX) { + error = EBADRPC; + goto nfsmout; + } + } else { + len = NFSX_V2FH; + } + + if (len != 0) { + NFSM_DISSECT_NONBLOCK(tl, uint32_t *, len); + bcopy(tl, fh, len); + } else + bzero(fh, sizeof(*fh)); + +nfsmout: + *md = nd->nd_md; + *dpos = nd->nd_dpos; + + return (error); +} + +int +fhanew_is_read(rpcproc_t procnum) +{ + if (procnum == NFSPROC_READ) + return (1); + else + return (0); +} + +int +fhanew_is_write(rpcproc_t procnum) +{ + if (procnum == NFSPROC_WRITE) + return (1); + else + return (0); +} + +int +fhanew_get_offset(struct mbuf **md, caddr_t *dpos, int v3, + struct fha_info *info) +{ + struct nfsrv_descript lnd, *nd; + uint32_t *tl; + int error; + + error = 0; + + nd = &lnd; + nd->nd_md = *md; + nd->nd_dpos = *dpos; + + if (v3) { + NFSM_DISSECT_NONBLOCK(tl, uint32_t *, 2 * NFSX_UNSIGNED); + info->offset = fxdr_hyper(tl); + } else { + NFSM_DISSECT_NONBLOCK(tl, uint32_t *, NFSX_UNSIGNED); + info->offset = fxdr_unsigned(uint32_t, *tl); + } + +nfsmout: + *md = nd->nd_md; + *dpos = nd->nd_dpos; + + return (error); +} + +int +fhanew_no_offset(rpcproc_t procnum) +{ + if (procnum == NFSPROC_FSSTAT || + procnum == NFSPROC_FSINFO || + procnum == NFSPROC_PATHCONF || + procnum == NFSPROC_NOOP || + procnum == NFSPROC_NULL) + return (1); + else + return (0); +} + +void +fhanew_set_locktype(rpcproc_t procnum, struct fha_info *info) +{ + switch (procnum) { + case NFSPROC_NULL: + case NFSPROC_GETATTR: + case NFSPROC_LOOKUP: + case NFSPROC_ACCESS: + case NFSPROC_READLINK: + case NFSPROC_READ: + case NFSPROC_READDIR: + case NFSPROC_READDIRPLUS: + case NFSPROC_WRITE: + info->locktype = LK_SHARED; + break; + case NFSPROC_SETATTR: + case NFSPROC_CREATE: + case NFSPROC_MKDIR: + case NFSPROC_SYMLINK: + case NFSPROC_MKNOD: + case NFSPROC_REMOVE: + case NFSPROC_RMDIR: + case NFSPROC_RENAME: + case NFSPROC_LINK: + case NFSPROC_FSSTAT: + case NFSPROC_FSINFO: + case NFSPROC_PATHCONF: + case NFSPROC_COMMIT: + case NFSPROC_NOOP: + info->locktype = LK_EXCLUSIVE; + break; + } +} + +static int +fhenew_stats_sysctl(SYSCTL_HANDLER_ARGS) +{ + return (fhe_stats_sysctl(oidp, arg1, arg2, req, &fhanew_softc)); +} + + +SVCTHREAD * +fhanew_assign(SVCTHREAD *this_thread, struct svc_req *req) +{ + return (fha_assign(this_thread, req, &fhanew_softc)); +} Added: head/sys/fs/nfsserver/nfs_fha_new.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/fs/nfsserver/nfs_fha_new.h Wed Apr 17 21:00:22 2013 (r249592) @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * Copyright (c) 2013 Spectra Logic Corporation + * + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + */ +/* $FreeBSD$ */ + +#ifndef _NFS_FHA_NEW_H +#define _NFS_FHA_NEW_H 1 + +#ifdef _KERNEL + +#define FHANEW_SERVER_NAME "nfsd" + +SVCTHREAD *fhanew_assign(SVCTHREAD *this_thread, struct svc_req *req); +#endif /* _KERNEL */ + +#endif /* _NFS_FHA_NEW_H */ Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Wed Apr 17 21:00:22 2013 (r249592) @@ -42,6 +42,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include NFSDLOCKMUTEX; @@ -51,7 +54,7 @@ struct nfsv4lock nfsd_suspend_lock; /* * Mapping of old NFS Version 2 RPC numbers to generic numbers. */ -static int newnfs_nfsv3_procid[NFS_V3NPROCS] = { +int newnfs_nfsv3_procid[NFS_V3NPROCS] = { NFSPROC_NULL, NFSPROC_GETATTR, NFSPROC_SETATTR, @@ -147,7 +150,7 @@ nfssvc_program(struct svc_req *rqst, SVC */ nd.nd_mrep = rqst->rq_args; rqst->rq_args = NULL; - newnfs_realign(&nd.nd_mrep); + newnfs_realign(&nd.nd_mrep, M_WAITOK); nd.nd_md = nd.nd_mrep; nd.nd_dpos = mtod(nd.nd_md, caddr_t); nd.nd_nam = svc_getrpccaller(rqst); @@ -491,8 +494,8 @@ nfsrvd_init(int terminating) nfsrvd_pool = svcpool_create("nfsd", SYSCTL_STATIC_CHILDREN(_vfs_nfsd)); nfsrvd_pool->sp_rcache = NULL; - nfsrvd_pool->sp_assign = NULL; - nfsrvd_pool->sp_done = NULL; + nfsrvd_pool->sp_assign = fhanew_assign; + nfsrvd_pool->sp_done = fha_nd_complete; NFSD_LOCK(); } Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Wed Apr 17 21:00:22 2013 (r249592) @@ -2692,9 +2692,11 @@ nfsd_fhtovp(struct nfsrv_descript *nd, s goto out; } - if (startwrite) + if (startwrite) { vn_start_write(NULL, mpp, V_WAIT); - + if (lktype == LK_SHARED && !(MNT_SHARED_WRITES(mp))) + lktype = LK_EXCLUSIVE; + } nd->nd_repstat = nfsvno_fhtovp(mp, fhp, nd->nd_nam, lktype, vpp, exp, &credanon); vfs_unbusy(mp); Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdsocket.c Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.c Wed Apr 17 21:00:22 2013 (r249592) @@ -379,6 +379,7 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, goto out; } if (nd->nd_procnum == NFSPROC_READ || + nd->nd_procnum == NFSPROC_WRITE || nd->nd_procnum == NFSPROC_READDIR || nd->nd_procnum == NFSPROC_READLINK || nd->nd_procnum == NFSPROC_GETATTR || Modified: head/sys/modules/nfsd/Makefile ============================================================================== --- head/sys/modules/nfsd/Makefile Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/modules/nfsd/Makefile Wed Apr 17 21:00:22 2013 (r249592) @@ -1,8 +1,10 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../fs/nfsserver +.PATH: ${.CURDIR}/../../fs/nfsserver ${.CURDIR}/../../nfsserver KMOD= nfsd SRCS= vnode_if.h \ + nfs_fha.c \ + nfs_fha_new.c \ nfs_nfsdserv.c \ nfs_nfsdcache.c \ nfs_nfsdkrpc.c \ Modified: head/sys/modules/nfsserver/Makefile ============================================================================== --- head/sys/modules/nfsserver/Makefile Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/modules/nfsserver/Makefile Wed Apr 17 21:00:22 2013 (r249592) @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../../nfsserver KMOD= nfsserver SRCS= vnode_if.h \ - nfs_fha.c nfs_serv.c nfs_srvkrpc.c nfs_srvsubs.c \ + nfs_fha.c nfs_fha_old.c nfs_serv.c nfs_srvkrpc.c nfs_srvsubs.c \ opt_mac.h \ opt_kgssapi.h \ opt_nfs.h Modified: head/sys/nfsserver/nfs_fha.c ============================================================================== --- head/sys/nfsserver/nfs_fha.c Wed Apr 17 20:19:32 2013 (r249591) +++ head/sys/nfsserver/nfs_fha.c Wed Apr 17 21:00:22 2013 (r249592) @@ -38,134 +38,103 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include #include static MALLOC_DEFINE(M_NFS_FHA, "NFS FHA", "NFS FHA"); -/* Sysctl defaults. */ -#define DEF_BIN_SHIFT 18 /* 256k */ -#define DEF_MAX_NFSDS_PER_FH 8 -#define DEF_MAX_REQS_PER_NFSD 4 - -struct fha_ctls { - u_int32_t bin_shift; - u_int32_t max_nfsds_per_fh; - u_int32_t max_reqs_per_nfsd; -} fha_ctls; - -struct sysctl_ctx_list fha_clist; - -SYSCTL_DECL(_vfs_nfsrv); -SYSCTL_DECL(_vfs_nfsrv_fha); - -/* Static sysctl node for the fha from the top-level vfs_nfsrv node. */ -SYSCTL_NODE(_vfs_nfsrv, OID_AUTO, fha, CTLFLAG_RD, 0, "fha node"); - -/* This is the global structure that represents the state of the fha system. */ -static struct fha_global { - struct fha_hash_entry_list *hashtable; - u_long hashmask; -} g_fha; - /* - * These are the entries in the filehandle hash. They talk about a specific - * file, requests against which are being handled by one or more nfsds. We - * keep a chain of nfsds against the file. We only have more than one if reads - * are ongoing, and then only if the reads affect disparate regions of the - * file. - * - * In general, we want to assign a new request to an existing nfsd if it is - * going to contend with work happening already on that nfsd, or if the - * operation is a read and the nfsd is already handling a proximate read. We - * do this to avoid jumping around in the read stream unnecessarily, and to - * avoid contention between threads over single files. + * XXX need to commonize definitions between old and new NFS code. Define + * this here so we don't include one nfsproto.h over the other. */ -struct fha_hash_entry { - LIST_ENTRY(fha_hash_entry) link; - u_int64_t fh; - u_int16_t num_reads; - u_int16_t num_writes; - u_int8_t num_threads; - struct svcthread_list threads; -}; -LIST_HEAD(fha_hash_entry_list, fha_hash_entry); - -/* A structure used for passing around data internally. */ -struct fha_info { - u_int64_t fh; - off_t offset; - int locktype; -}; - -static int fhe_stats_sysctl(SYSCTL_HANDLER_ARGS); +#define NFS_PROG 100003 -static void -nfs_fha_init(void *foo) +void +fha_init(struct fha_params *softc) { + char tmpstr[128]; /* * A small hash table to map filehandles to fha_hash_entry * structures. */ - g_fha.hashtable = hashinit(256, M_NFS_FHA, &g_fha.hashmask); + softc->g_fha.hashtable = hashinit(256, M_NFS_FHA, + &softc->g_fha.hashmask); /* - * Initialize the sysctl context list for the fha module. + * Set the default tuning parameters. */ - sysctl_ctx_init(&fha_clist); + softc->ctls.enable = FHA_DEF_ENABLE; + softc->ctls.bin_shift = FHA_DEF_BIN_SHIFT; + softc->ctls.max_nfsds_per_fh = FHA_DEF_MAX_NFSDS_PER_FH; + softc->ctls.max_reqs_per_nfsd = FHA_DEF_MAX_REQS_PER_NFSD; - fha_ctls.bin_shift = DEF_BIN_SHIFT; - fha_ctls.max_nfsds_per_fh = DEF_MAX_NFSDS_PER_FH; - fha_ctls.max_reqs_per_nfsd = DEF_MAX_REQS_PER_NFSD; + /* + * Allow the user to override the defaults at boot time with + * tunables. + */ + snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.enable", + softc->server_name); + TUNABLE_INT_FETCH(tmpstr, &softc->ctls.enable); + snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.bin_shift", + softc->server_name); + TUNABLE_INT_FETCH(tmpstr, &softc->ctls.bin_shift); + snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.max_nfsds_per_fh", + softc->server_name); + TUNABLE_INT_FETCH(tmpstr, &softc->ctls.max_nfsds_per_fh); + snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.max_reqs_per_nfsd", + softc->server_name); + TUNABLE_INT_FETCH(tmpstr, &softc->ctls.max_reqs_per_nfsd); + + /* + * Add sysctls so the user can change the tuning parameters at + * runtime. + */ + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "enable", CTLFLAG_RW, + &softc->ctls.enable, 0, "Enable NFS File Handle Affinity (FHA)"); - SYSCTL_ADD_UINT(&fha_clist, SYSCTL_STATIC_CHILDREN(_vfs_nfsrv_fha), + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "bin_shift", CTLFLAG_RW, - &fha_ctls.bin_shift, 0, "For FHA reads, no two requests will " + &softc->ctls.bin_shift, 0, "For FHA reads, no two requests will " "contend if they're 2^(bin_shift) bytes apart"); - SYSCTL_ADD_UINT(&fha_clist, SYSCTL_STATIC_CHILDREN(_vfs_nfsrv_fha), + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "max_nfsds_per_fh", CTLFLAG_RW, - &fha_ctls.max_nfsds_per_fh, 0, "Maximum nfsd threads that " + &softc->ctls.max_nfsds_per_fh, 0, "Maximum nfsd threads that " "should be working on requests for the same file handle"); - SYSCTL_ADD_UINT(&fha_clist, SYSCTL_STATIC_CHILDREN(_vfs_nfsrv_fha), + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "max_reqs_per_nfsd", CTLFLAG_RW, - &fha_ctls.max_reqs_per_nfsd, 0, "Maximum requests that " + &softc->ctls.max_reqs_per_nfsd, 0, "Maximum requests that " "single nfsd thread should be working on at any time"); - SYSCTL_ADD_OID(&fha_clist, SYSCTL_STATIC_CHILDREN(_vfs_nfsrv_fha), + SYSCTL_ADD_OID(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "fhe_stats", CTLTYPE_STRING | CTLFLAG_RD, 0, 0, - fhe_stats_sysctl, "A", ""); + softc->callbacks.fhe_stats_sysctl, "A", ""); + } -static void -nfs_fha_uninit(void *foo) +void +fha_uninit(struct fha_params *softc) { - - hashdestroy(g_fha.hashtable, M_NFS_FHA, g_fha.hashmask); + sysctl_ctx_free(&softc->sysctl_ctx); + hashdestroy(softc->g_fha.hashtable, M_NFS_FHA, softc->g_fha.hashmask); } -SYSINIT(nfs_fha, SI_SUB_ROOT_CONF, SI_ORDER_ANY, nfs_fha_init, NULL); -SYSUNINIT(nfs_fha, SI_SUB_ROOT_CONF, SI_ORDER_ANY, nfs_fha_uninit, NULL); - /* * This just specifies that offsets should obey affinity when within * the same 1Mbyte (1<<20) chunk for the file (reads only for now). */ static void -fha_extract_info(struct svc_req *req, struct fha_info *i) +fha_extract_info(struct svc_req *req, struct fha_info *i, + struct fha_callbacks *cb) { struct mbuf *md; - nfsfh_t fh; + fhandle_t fh; caddr_t dpos; static u_int64_t random_fh = 0; int error; int v3 = (req->rq_vers == 3); - u_int32_t *tl; rpcproc_t procnum; /* @@ -184,9 +153,12 @@ fha_extract_info(struct svc_req *req, st */ procnum = req->rq_proc; if (!v3) { - if (procnum > NFSV2PROC_STATFS) + rpcproc_t tmp_procnum; + + tmp_procnum = cb->get_procnum(procnum); + if (tmp_procnum == -1) goto out; - procnum = nfsrv_nfsv3_procid[procnum]; + procnum = tmp_procnum; } /* @@ -195,71 +167,28 @@ fha_extract_info(struct svc_req *req, st * only do this for reads today, but this may change when IFS supports * efficient concurrent writes. */ - if (procnum == NFSPROC_FSSTAT || - procnum == NFSPROC_FSINFO || - procnum == NFSPROC_PATHCONF || - procnum == NFSPROC_NOOP || - procnum == NFSPROC_NULL) + if (cb->no_offset(procnum)) goto out; - error = nfs_realign(&req->rq_args, M_NOWAIT); + error = cb->realign(&req->rq_args, M_NOWAIT); if (error) goto out; md = req->rq_args; dpos = mtod(md, caddr_t); /* Grab the filehandle. */ - error = nfsm_srvmtofh_xx(&fh.fh_generic, v3, &md, &dpos); + error = cb->get_fh(&fh, v3, &md, &dpos); if (error) goto out; - bcopy(fh.fh_generic.fh_fid.fid_data, &i->fh, sizeof(i->fh)); + bcopy(fh.fh_fid.fid_data, &i->fh, sizeof(i->fh)); /* Content ourselves with zero offset for all but reads. */ - if (procnum != NFSPROC_READ) - goto out; + if (cb->is_read(procnum) || cb->is_write(procnum)) + cb->get_offset(&md, &dpos, v3, i); - if (v3) { - tl = nfsm_dissect_xx_nonblock(2 * NFSX_UNSIGNED, &md, &dpos); - if (tl == NULL) - goto out; - i->offset = fxdr_hyper(tl); - } else { - tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, &md, &dpos); - if (tl == NULL) - goto out; - i->offset = fxdr_unsigned(u_int32_t, *tl); - } - out: - switch (procnum) { - case NFSPROC_NULL: - case NFSPROC_GETATTR: - case NFSPROC_LOOKUP: - case NFSPROC_ACCESS: - case NFSPROC_READLINK: - case NFSPROC_READ: - case NFSPROC_READDIR: - case NFSPROC_READDIRPLUS: - i->locktype = LK_SHARED; - break; - case NFSPROC_SETATTR: - case NFSPROC_WRITE: - case NFSPROC_CREATE: - case NFSPROC_MKDIR: - case NFSPROC_SYMLINK: - case NFSPROC_MKNOD: - case NFSPROC_REMOVE: - case NFSPROC_RMDIR: - case NFSPROC_RENAME: - case NFSPROC_LINK: - case NFSPROC_FSSTAT: - case NFSPROC_FSINFO: - case NFSPROC_PATHCONF: - case NFSPROC_COMMIT: - case NFSPROC_NOOP: - i->locktype = LK_EXCLUSIVE; - break; - } +out: + cb->set_locktype(procnum, i); } static struct fha_hash_entry * @@ -269,8 +198,8 @@ fha_hash_entry_new(u_int64_t fh) e = malloc(sizeof(*e), M_NFS_FHA, M_WAITOK); e->fh = fh; - e->num_reads = 0; - e->num_writes = 0; + e->num_rw = 0; + e->num_exclusive = 0; e->num_threads = 0; LIST_INIT(&e->threads); @@ -281,7 +210,7 @@ static void fha_hash_entry_destroy(struct fha_hash_entry *e) { - if (e->num_reads + e->num_writes) + if (e->num_rw + e->num_exclusive) panic("nonempty fhe"); free(e, M_NFS_FHA); } @@ -295,11 +224,16 @@ fha_hash_entry_remove(struct fha_hash_en } static struct fha_hash_entry * -fha_hash_entry_lookup(SVCPOOL *pool, u_int64_t fh) +fha_hash_entry_lookup(struct fha_params *softc, u_int64_t fh) { + SVCPOOL *pool; + + pool = *softc->pool; + struct fha_hash_entry *fhe, *new_fhe; - LIST_FOREACH(fhe, &g_fha.hashtable[fh % g_fha.hashmask], link) + LIST_FOREACH(fhe, &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], + link) if (fhe->fh == fh) break; @@ -310,12 +244,14 @@ fha_hash_entry_lookup(SVCPOOL *pool, u_i mtx_lock(&pool->sp_lock); /* Double-check to make sure we still need the new entry. */ - LIST_FOREACH(fhe, &g_fha.hashtable[fh % g_fha.hashmask], link) + LIST_FOREACH(fhe, + &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], link) if (fhe->fh == fh) break; if (!fhe) { fhe = new_fhe; - LIST_INSERT_HEAD(&g_fha.hashtable[fh % g_fha.hashmask], + LIST_INSERT_HEAD( + &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], fhe, link); } else fha_hash_entry_destroy(new_fhe); @@ -348,9 +284,9 @@ fha_hash_entry_add_op(struct fha_hash_en { if (LK_EXCLUSIVE == locktype) - fhe->num_writes += count; + fhe->num_exclusive += count; else - fhe->num_reads += count; + fhe->num_rw += count; } static SVCTHREAD * @@ -371,22 +307,25 @@ get_idle_thread(SVCPOOL *pool) * appropriate to handle this operation. */ SVCTHREAD * -fha_hash_entry_choose_thread(SVCPOOL *pool, struct fha_hash_entry *fhe, - struct fha_info *i, SVCTHREAD *this_thread); +fha_hash_entry_choose_thread(struct fha_params *softc, + struct fha_hash_entry *fhe, struct fha_info *i, SVCTHREAD *this_thread); SVCTHREAD * -fha_hash_entry_choose_thread(SVCPOOL *pool, struct fha_hash_entry *fhe, - struct fha_info *i, SVCTHREAD *this_thread) +fha_hash_entry_choose_thread(struct fha_params *softc, + struct fha_hash_entry *fhe, struct fha_info *i, SVCTHREAD *this_thread) { SVCTHREAD *thread, *min_thread = NULL; + SVCPOOL *pool; int req_count, min_count = 0; off_t offset1, offset2; + pool = *softc->pool; + LIST_FOREACH(thread, &fhe->threads, st_alink) { req_count = thread->st_reqcount; /* If there are any writes in progress, use the first thread. */ - if (fhe->num_writes) { + if (fhe->num_exclusive) { #if 0 ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, "fha: %p(%d)w", thread, req_count); @@ -398,12 +337,15 @@ fha_hash_entry_choose_thread(SVCPOOL *po * Check for read locality, making sure that we won't * exceed our per-thread load limit in the process. */ - offset1 = i->offset >> fha_ctls.bin_shift; - offset2 = STAILQ_FIRST(&thread->st_reqs)->rq_p3 - >> fha_ctls.bin_shift; - if (offset1 == offset2) { - if ((fha_ctls.max_reqs_per_nfsd == 0) || - (req_count < fha_ctls.max_reqs_per_nfsd)) { + offset1 = i->offset; + offset2 = STAILQ_FIRST(&thread->st_reqs)->rq_p3; + + if (((offset1 >= offset2) + && ((offset1 - offset2) < (1 << softc->ctls.bin_shift))) + || ((offset2 > offset1) + && ((offset2 - offset1) < (1 << softc->ctls.bin_shift)))) { + if ((softc->ctls.max_reqs_per_nfsd == 0) || + (req_count < softc->ctls.max_reqs_per_nfsd)) { #if 0 ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, "fha: %p(%d)r", thread, req_count); @@ -432,8 +374,8 @@ fha_hash_entry_choose_thread(SVCPOOL *po * We didn't find a good match yet. See if we can add * a new thread to this file handle entry's thread list. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 21:08:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7B9BD97A; Wed, 17 Apr 2013 21:08:16 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6E7757CA; Wed, 17 Apr 2013 21:08:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HL8GnZ056576; Wed, 17 Apr 2013 21:08:16 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HL8Gwx056575; Wed, 17 Apr 2013 21:08:16 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201304172108.r3HL8Gwx056575@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 17 Apr 2013 21:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249593 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 21:08:16 -0000 Author: jilles Date: Wed Apr 17 21:08:15 2013 New Revision: 249593 URL: http://svnweb.freebsd.org/changeset/base/249593 Log: pututxline: Don't set errno=0 in subfunctions. The functions utx_active_add(), utx_active_remove(), utx_lastlogin_add() and utx_log_add() set errno to 0 if they are successful. This not only violates POSIX if pututxline() is successful, but may also overwrite a valid error with 0 if, for example, utx_lastlogin_add() fails while utx_log_add() succeeds. Reviewed by: ed Modified: head/lib/libc/gen/pututxline.c Modified: head/lib/libc/gen/pututxline.c ============================================================================== --- head/lib/libc/gen/pututxline.c Wed Apr 17 21:00:22 2013 (r249592) +++ head/lib/libc/gen/pututxline.c Wed Apr 17 21:08:15 2013 (r249593) @@ -131,7 +131,8 @@ exact: else error = 0; fclose(fp); - errno = error; + if (error != 0) + errno = error; return (error == 0 ? 0 : 1); } @@ -169,7 +170,8 @@ utx_active_remove(struct futx *fu) } fclose(fp); - errno = error; + if (ret != 0) + errno = error; return (ret); } @@ -225,7 +227,8 @@ utx_lastlogin_add(const struct futx *fu) ret = -1; } fclose(fp); - errno = error; + if (ret == -1) + errno = error; return (ret); } @@ -277,7 +280,8 @@ utx_log_add(const struct futx *fu) else error = 0; _close(fd); - errno = error; + if (error != 0) + errno = error; return (error == 0 ? 0 : 1); } From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 21:08:19 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2204197B; Wed, 17 Apr 2013 21:08:19 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 143697CB; Wed, 17 Apr 2013 21:08:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HL8IU2056619; Wed, 17 Apr 2013 21:08:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HL8Ir3056618; Wed, 17 Apr 2013 21:08:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201304172108.r3HL8Ir3056618@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 17 Apr 2013 21:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249594 - head/tools/regression/pjdfstest X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 21:08:19 -0000 Author: pjd Date: Wed Apr 17 21:08:18 2013 New Revision: 249594 URL: http://svnweb.freebsd.org/changeset/base/249594 Log: Style cleanups. Modified: head/tools/regression/pjdfstest/pjdfstest.c Modified: head/tools/regression/pjdfstest/pjdfstest.c ============================================================================== --- head/tools/regression/pjdfstest/pjdfstest.c Wed Apr 17 21:08:15 2013 (r249593) +++ head/tools/regression/pjdfstest/pjdfstest.c Wed Apr 17 21:08:18 2013 (r249594) @@ -581,13 +581,18 @@ call_syscall(struct syscall_desc *scall, args[i].str = (void *)0xdeadc0de; else args[i].str = argv[i]; - } else if ((scall->sd_args[i] & TYPE_MASK) == TYPE_NUMBER) { + } else if ((scall->sd_args[i] & TYPE_MASK) == + TYPE_NUMBER) { args[i].num = strtoll(argv[i], &endp, 0); - if (*endp != '\0' && !isspace((unsigned char)*endp)) { - fprintf(stderr, "invalid argument %u, number expected [%s]\n", i, endp); + if (*endp != '\0' && + !isspace((unsigned char)*endp)) { + fprintf(stderr, + "invalid argument %u, number expected [%s]\n", + i, endp); exit(1); } - } else if ((scall->sd_args[i] & TYPE_MASK) == TYPE_DESCRIPTOR) { + } else if ((scall->sd_args[i] & TYPE_MASK) == + TYPE_DESCRIPTOR) { if (strcmp(argv[i], "AT_FDCWD") == 0) { args[i].num = AT_FDCWD; } else if (strcmp(argv[i], "BADFD") == 0) { @@ -600,8 +605,11 @@ call_syscall(struct syscall_desc *scall, int pos; pos = strtoll(argv[i], &endp, 0); - if (*endp != '\0' && !isspace((unsigned char)*endp)) { - fprintf(stderr, "invalid argument %u, number expected [%s]\n", i, endp); + if (*endp != '\0' && + !isspace((unsigned char)*endp)) { + fprintf(stderr, + "invalid argument %u, number expected [%s]\n", + i, endp); exit(1); } args[i].num = descriptor_get(pos); @@ -640,7 +648,8 @@ call_syscall(struct syscall_desc *scall, fprintf(stderr, "too few arguments\n"); exit(1); } - rval = openat(NUM(0), STR(1), (int)flags, (mode_t)NUM(3)); + rval = openat(NUM(0), STR(1), (int)flags, + (mode_t)NUM(3)); } else { if (i == 4) { fprintf(stderr, "too many arguments\n"); @@ -716,7 +725,7 @@ call_syscall(struct syscall_desc *scall, } dev = makedev(NUM(fa + 3), NUM(fa + 4)); - if (strcmp(STR(fa + 1), "c") == 0) /* character device */ + if (strcmp(STR(fa + 1), "c") == 0) /* character device */ ntype = S_IFCHR; else if (strcmp(STR(fa + 1), "b") == 0) /* block device */ ntype = S_IFBLK; @@ -988,7 +997,8 @@ set_gids(char *gids) assert(ngroups > 0); gidset = malloc(sizeof(*gidset) * ngroups); assert(gidset != NULL); - for (i = 0, g = strtok(gids, ","); g != NULL; g = strtok(NULL, ","), i++) { + for (i = 0, g = strtok(gids, ","); g != NULL; + g = strtok(NULL, ","), i++) { if (i >= ngroups) { fprintf(stderr, "too many gids\n"); exit(1); @@ -1005,7 +1015,8 @@ set_gids(char *gids) exit(1); } if (setegid(gidset[0]) < 0) { - fprintf(stderr, "cannot change effective gid: %s\n", strerror(errno)); + fprintf(stderr, "cannot change effective gid: %s\n", + strerror(errno)); exit(1); } free(gidset); @@ -1075,7 +1086,8 @@ main(int argc, char *argv[]) for (;;) { scall = find_syscall(argv[0]); if (scall == NULL) { - fprintf(stderr, "syscall '%s' not supported\n", argv[0]); + fprintf(stderr, "syscall '%s' not supported\n", + argv[0]); exit(1); } argc++; From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 21:21:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 987B2CA; Wed, 17 Apr 2013 21:21:28 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8AC8485F; Wed, 17 Apr 2013 21:21:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HLLRvo061954; Wed, 17 Apr 2013 21:21:27 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HLLRWq061952; Wed, 17 Apr 2013 21:21:27 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201304172121.r3HLLRWq061952@svn.freebsd.org> From: Hiren Panchasara Date: Wed, 17 Apr 2013 21:21:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249595 - head/sys/dev/ips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 21:21:28 -0000 Author: hiren Date: Wed Apr 17 21:21:27 2013 New Revision: 249595 URL: http://svnweb.freebsd.org/changeset/base/249595 Log: Improving r249461 by providing a better way to handle the clang warning. PR: kern/177164 Reviewed by: jhb Approved by: sbruno (mentor) Modified: head/sys/dev/ips/ips.c Modified: head/sys/dev/ips/ips.c ============================================================================== --- head/sys/dev/ips/ips.c Wed Apr 17 21:08:18 2013 (r249594) +++ head/sys/dev/ips/ips.c Wed Apr 17 21:21:27 2013 (r249595) @@ -578,7 +578,7 @@ static int ips_copperhead_queue_init(ips { int error; bus_dma_tag_t dmatag; - bus_dmamap_t dmamap = NULL; + bus_dmamap_t dmamap; if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, /* alignemnt */ 1, /* boundary */ 0, @@ -595,7 +595,7 @@ static int ips_copperhead_queue_init(ips &dmatag) != 0) { device_printf(sc->dev, "can't alloc dma tag for statue queue\n"); error = ENOMEM; - goto exit; + return error; } if(bus_dmamem_alloc(dmatag, (void *)&(sc->copper_queue), BUS_DMA_NOWAIT, &dmamap)){ @@ -623,7 +623,8 @@ static int ips_copperhead_queue_init(ips return 0; exit: - bus_dmamem_free(dmatag, sc->copper_queue, dmamap); + if (sc->copper_queue != NULL) + bus_dmamem_free(dmatag, sc->copper_queue, dmamap); bus_dma_tag_destroy(dmatag); return error; } From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 21:26:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0C6FC35F; Wed, 17 Apr 2013 21:26:46 +0000 (UTC) (envelope-from hiren.panchasara@gmail.com) Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by mx1.freebsd.org (Postfix) with ESMTP id 32802889; Wed, 17 Apr 2013 21:26:44 +0000 (UTC) Received: by mail-ee0-f43.google.com with SMTP id e50so992100eek.16 for ; Wed, 17 Apr 2013 14:26:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=loM0lOWaTXndQ7PWxK+vHBavbGNqnA9ceDE8qaWzjKU=; b=ZDofhuBi0d6goWBqYHc/aR4SO8XP3/3BlE9ValX7ePK8ujoAkSnU+RM6/R0pPNpZMs YT6y2sgCZjtOr90fpMyBeKlvk0yWbPjUc8+O7nzwjrOkqY+z8oOZnKw7d1wLy4qxbFKk yEFZ7Vy9jiMSalxRWDeZNOC/YbLGvDpAytozp6GdQDQ+sDXSw80hnpHqVwSS2BxbN2xz VKu7713dL5OV4GbeX4pfo6yoceGDhRscfWOF0KIP1DiN4YV9eHNe2NBlh3Bp7v0WTM4o X6rzkLcFXns3LuY/I6iDHnn4WtHtrdGr+BEgafToo4eJBV/ijUoF8MqUimadx/iF57Ga VSkw== MIME-Version: 1.0 X-Received: by 10.14.5.137 with SMTP id 9mr22327293eel.30.1366233997155; Wed, 17 Apr 2013 14:26:37 -0700 (PDT) Sender: hiren.panchasara@gmail.com Received: by 10.15.91.72 with HTTP; Wed, 17 Apr 2013 14:26:37 -0700 (PDT) In-Reply-To: <201304171451.45400.jhb@freebsd.org> References: <201304140242.r3E2geSq094403@svn.freebsd.org> <201304171319.26560.jhb@freebsd.org> <201304171451.45400.jhb@freebsd.org> Date: Wed, 17 Apr 2013 14:26:37 -0700 X-Google-Sender-Auth: 7cmsF--Rx3H7IQK1lglWMFWsm8g Message-ID: Subject: Re: svn commit: r249461 - head/sys/dev/ips From: hiren panchasara To: John Baldwin Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head , svn-src-all , src-committers X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 21:26:46 -0000 On Wed, Apr 17, 2013 at 11:51 AM, John Baldwin wrote: > On Wednesday, April 17, 2013 2:36:48 pm hiren panchasara wrote: >> On Wed, Apr 17, 2013 at 10:19 AM, John Baldwin wrote: >> > On Wednesday, April 17, 2013 1:15:11 pm hiren panchasara wrote: >> >> On Tue, Apr 16, 2013 at 9:10 AM, John Baldwin wrote: >> >> > On Saturday, April 13, 2013 10:42:40 pm Hiren Panchasara wrote: >> >> >> Author: hiren >> >> >> Date: Sun Apr 14 02:42:40 2013 >> >> >> New Revision: 249461 >> >> >> URL: http://svnweb.freebsd.org/changeset/base/249461 >> >> >> >> >> >> Log: >> >> >> Fixing a clang warning indicating uninitialized variable usage. >> >> >> >> >> >> PR: kern/177164 >> >> >> Approved by: sbruno (mentor) >> >> > >> >> > Hmm, I always thought that dmatags and maps were opaque types and not >> >> > necessarily "known" in consumers to be pointers. (Some drivers do > check tehm >> >> > against NULL implicitly via 'if (map)' or 'if (tag)', but well-behaved > drivers >> >> > use other means (flags, etc.) to know if they are valid.) >> >> >> >> Hi John, >> >> >> >> Would this be a better fix? We do not need to do any clean up if we >> >> fail to create the tag: >> >> >> >> Index: ips.c >> >> =================================================================== >> >> --- ips.c (revision 249588) >> >> +++ ips.c (working copy) >> >> @@ -578,7 +578,7 @@ >> >> { >> >> int error; >> >> bus_dma_tag_t dmatag; >> >> - bus_dmamap_t dmamap = NULL; >> >> + bus_dmamap_t dmamap; >> >> if (bus_dma_tag_create( /* parent */ sc- >>adapter_dmatag, >> >> /* alignemnt */ 1, >> >> /* boundary */ 0, >> >> @@ -595,7 +595,7 @@ >> >> &dmatag) != 0) { >> >> device_printf(sc->dev, "can't alloc dma tag for >> >> statue queue\n"); >> >> error = ENOMEM; >> >> - goto exit; >> >> + return error; >> >> } >> >> if(bus_dmamem_alloc(dmatag, (void *)&(sc->copper_queue), >> >> BUS_DMA_NOWAIT, &dmamap)){ >> > >> > That would be fine. I would actually prefer though that this only >> > call bus_dmamem_free() if the alloc succeeds, so in addition I would >> > make the call to bus_dmammem_free() conditional on sc->copper_queue != > NULL. >> > >> >> Makes sense, final patch looks like this: >> >> Index: ips.c >> =================================================================== >> --- ips.c (revision 249588) >> +++ ips.c (working copy) >> @@ -578,7 +578,7 @@ >> { >> int error; >> bus_dma_tag_t dmatag; >> - bus_dmamap_t dmamap = NULL; >> + bus_dmamap_t dmamap; >> if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, >> /* alignemnt */ 1, >> /* boundary */ 0, >> @@ -595,7 +595,7 @@ >> &dmatag) != 0) { >> device_printf(sc->dev, "can't alloc dma tag for >> statue queue\n"); >> error = ENOMEM; >> - goto exit; >> + return error; > > One more suggestion: just use 'return (ENOMEM)' directly perhaps. > >> } >> if(bus_dmamem_alloc(dmatag, (void *)&(sc->copper_queue), >> BUS_DMA_NOWAIT, &dmamap)){ >> @@ -623,7 +623,8 @@ >> >> return 0; >> exit: >> - bus_dmamem_free(dmatag, sc->copper_queue, dmamap); >> + if (sc->copper_queue != NULL) >> + bus_dmamem_free(dmatag, sc->copper_queue, dmamap); >> bus_dma_tag_destroy(dmatag); >> return error; >> } >> >> Thanks, >> Hiren > > Looks ok to me with or without the suggestion above. Committed in r249595. Thanks for all the help. Hiren > > -- > John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Apr 17 22:42:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E5650519; Wed, 17 Apr 2013 22:42:45 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D68FEB31; Wed, 17 Apr 2013 22:42:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HMgj9T087001; Wed, 17 Apr 2013 22:42:45 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3HMgipH086988; Wed, 17 Apr 2013 22:42:44 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201304172242.r3HMgipH086988@svn.freebsd.org> From: "Kenneth D. Merry" Date: Wed, 17 Apr 2013 22:42:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249596 - in head/sys: conf fs/nfsserver modules/nfsd modules/nfsserver nfs nfsserver X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 22:42:46 -0000 Author: ken Date: Wed Apr 17 22:42:43 2013 New Revision: 249596 URL: http://svnweb.freebsd.org/changeset/base/249596 Log: Move the NFS FHA (File Handle Affinity) code from sys/nfsserver to sys/nfs, since it is now shared by the two NFS servers. Suggested by: rmacklem Sponsored by: Spectra Logic MFC after: 2 weeks Added: head/sys/nfs/nfs_fha.c - copied, changed from r249595, head/sys/nfsserver/nfs_fha.c head/sys/nfs/nfs_fha.h - copied unchanged from r249595, head/sys/nfsserver/nfs_fha.h Deleted: head/sys/nfsserver/nfs_fha.c head/sys/nfsserver/nfs_fha.h Modified: head/sys/conf/files head/sys/fs/nfsserver/nfs_fha_new.c head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/modules/nfsd/Makefile head/sys/modules/nfsserver/Makefile head/sys/nfsserver/nfs_fha_old.c head/sys/nfsserver/nfs_srvkrpc.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Apr 17 21:21:27 2013 (r249595) +++ head/sys/conf/files Wed Apr 17 22:42:43 2013 (r249596) @@ -3203,6 +3203,7 @@ nfs/bootp_subr.c optional bootp nfsclie nfs/krpc_subr.c optional bootp nfsclient | bootp nfscl nfs/nfs_common.c optional nfsclient | nfsserver nfs/nfs_diskless.c optional nfsclient nfs_root | nfscl nfs_root +nfs/nfs_fha.c optional nfsserver | nfsd nfs/nfs_lock.c optional nfsclient | nfscl | nfslockd | nfsd nfsclient/nfs_bio.c optional nfsclient nfsclient/nfs_node.c optional nfsclient @@ -3211,7 +3212,6 @@ nfsclient/nfs_subs.c optional nfsclient nfsclient/nfs_nfsiod.c optional nfsclient nfsclient/nfs_vfsops.c optional nfsclient nfsclient/nfs_vnops.c optional nfsclient -nfsserver/nfs_fha.c optional nfsserver | nfsd nfsserver/nfs_fha_old.c optional nfsserver nfsserver/nfs_serv.c optional nfsserver nfsserver/nfs_srvkrpc.c optional nfsserver Modified: head/sys/fs/nfsserver/nfs_fha_new.c ============================================================================== --- head/sys/fs/nfsserver/nfs_fha_new.c Wed Apr 17 21:21:27 2013 (r249595) +++ head/sys/fs/nfsserver/nfs_fha_new.c Wed Apr 17 22:42:43 2013 (r249596) @@ -30,11 +30,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include -#include #include static void fhanew_init(void *foo); Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Wed Apr 17 21:21:27 2013 (r249595) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Wed Apr 17 22:42:43 2013 (r249596) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include Modified: head/sys/modules/nfsd/Makefile ============================================================================== --- head/sys/modules/nfsd/Makefile Wed Apr 17 21:21:27 2013 (r249595) +++ head/sys/modules/nfsd/Makefile Wed Apr 17 22:42:43 2013 (r249596) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../fs/nfsserver ${.CURDIR}/../../nfsserver +.PATH: ${.CURDIR}/../../fs/nfsserver ${.CURDIR}/../../nfs KMOD= nfsd SRCS= vnode_if.h \ nfs_fha.c \ Modified: head/sys/modules/nfsserver/Makefile ============================================================================== --- head/sys/modules/nfsserver/Makefile Wed Apr 17 21:21:27 2013 (r249595) +++ head/sys/modules/nfsserver/Makefile Wed Apr 17 22:42:43 2013 (r249596) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../nfsserver +.PATH: ${.CURDIR}/../../nfsserver ${.CURDIR}/../../nfs KMOD= nfsserver SRCS= vnode_if.h \ nfs_fha.c nfs_fha_old.c nfs_serv.c nfs_srvkrpc.c nfs_srvsubs.c \ Copied and modified: head/sys/nfs/nfs_fha.c (from r249595, head/sys/nfsserver/nfs_fha.c) ============================================================================== --- head/sys/nfsserver/nfs_fha.c Wed Apr 17 21:21:27 2013 (r249595, copy source) +++ head/sys/nfs/nfs_fha.c Wed Apr 17 22:42:43 2013 (r249596) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include static MALLOC_DEFINE(M_NFS_FHA, "NFS FHA", "NFS FHA"); Copied: head/sys/nfs/nfs_fha.h (from r249595, head/sys/nfsserver/nfs_fha.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/nfs/nfs_fha.h Wed Apr 17 22:42:43 2013 (r249596, copy of r249595, head/sys/nfsserver/nfs_fha.h) @@ -0,0 +1,112 @@ +/*- + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + */ +/* $FreeBSD$ */ + +#ifndef _NFS_FHA_H +#define _NFS_FHA_H 1 + +#ifdef _KERNEL + +/* Sysctl defaults. */ +#define FHA_DEF_ENABLE 1 +#define FHA_DEF_BIN_SHIFT 22 /* 4MB */ +#define FHA_DEF_MAX_NFSDS_PER_FH 8 +#define FHA_DEF_MAX_REQS_PER_NFSD 0 /* Unlimited */ + +/* This is the global structure that represents the state of the fha system. */ +struct fha_global { + struct fha_hash_entry_list *hashtable; + u_long hashmask; +}; + +struct fha_ctls { + int enable; + uint32_t bin_shift; + uint32_t max_nfsds_per_fh; + uint32_t max_reqs_per_nfsd; +}; + +/* + * These are the entries in the filehandle hash. They talk about a specific + * file, requests against which are being handled by one or more nfsds. We + * keep a chain of nfsds against the file. We only have more than one if reads + * are ongoing, and then only if the reads affect disparate regions of the + * file. + * + * In general, we want to assign a new request to an existing nfsd if it is + * going to contend with work happening already on that nfsd, or if the + * operation is a read and the nfsd is already handling a proximate read. We + * do this to avoid jumping around in the read stream unnecessarily, and to + * avoid contention between threads over single files. + */ +struct fha_hash_entry { + LIST_ENTRY(fha_hash_entry) link; + u_int64_t fh; + u_int32_t num_rw; + u_int32_t num_exclusive; + u_int8_t num_threads; + struct svcthread_list threads; +}; + +LIST_HEAD(fha_hash_entry_list, fha_hash_entry); + +/* A structure used for passing around data internally. */ +struct fha_info { + u_int64_t fh; + off_t offset; + int locktype; +}; + +struct fha_callbacks { + rpcproc_t (*get_procnum)(rpcproc_t procnum); + int (*realign)(struct mbuf **mb, int malloc_flags); + int (*get_fh)(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos); + int (*is_read)(rpcproc_t procnum); + int (*is_write)(rpcproc_t procnum); + int (*get_offset)(struct mbuf **md, caddr_t *dpos, int v3, struct + fha_info *info); + int (*no_offset)(rpcproc_t procnum); + void (*set_locktype)(rpcproc_t procnum, struct fha_info *info); + int (*fhe_stats_sysctl)(SYSCTL_HANDLER_ARGS); +}; + +struct fha_params { + struct fha_global g_fha; + struct sysctl_ctx_list sysctl_ctx; + struct sysctl_oid *sysctl_tree; + struct fha_ctls ctls; + struct fha_callbacks callbacks; + char server_name[32]; + SVCPOOL **pool; +}; + +void fha_nd_complete(SVCTHREAD *, struct svc_req *); +SVCTHREAD *fha_assign(SVCTHREAD *, struct svc_req *, struct fha_params *); +void fha_init(struct fha_params *softc); +void fha_uninit(struct fha_params *softc); +int fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, struct fha_params *softc); + +#endif /* _KERNEL */ +#endif /* _NFS_FHA_H_ */ Modified: head/sys/nfsserver/nfs_fha_old.c ============================================================================== --- head/sys/nfsserver/nfs_fha_old.c Wed Apr 17 21:21:27 2013 (r249595) +++ head/sys/nfsserver/nfs_fha_old.c Wed Apr 17 22:42:43 2013 (r249596) @@ -40,9 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include -#include #include static void fhaold_init(void *foo); Modified: head/sys/nfsserver/nfs_srvkrpc.c ============================================================================== --- head/sys/nfsserver/nfs_srvkrpc.c Wed Apr 17 21:21:27 2013 (r249595) +++ head/sys/nfsserver/nfs_srvkrpc.c Wed Apr 17 22:42:43 2013 (r249596) @@ -77,10 +77,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include -#include #include #include From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 01:20:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1E7DD22C; Thu, 18 Apr 2013 01:20:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F3D7814F; Thu, 18 Apr 2013 01:20:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3I1K8Qf035476; Thu, 18 Apr 2013 01:20:08 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3I1K8fF035473; Thu, 18 Apr 2013 01:20:08 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201304180120.r3I1K8fF035473@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 18 Apr 2013 01:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249600 - head/cddl/lib/libdtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 01:20:09 -0000 Author: pfg Date: Thu Apr 18 01:20:08 2013 New Revision: 249600 URL: http://svnweb.freebsd.org/changeset/base/249600 Log: DTrace: NFS translators should be split into client/server pieces Belatedly update the provider with changes from OpenSolaris: PSARC 2008/050 DTrace NFS v3 Provider 6696397 NFS v3 provider reports all UDP clients as 0.0.0.0 6711844 assert: vp->v_shrlocks Obtained from: Illumos Modified: head/cddl/lib/libdtrace/nfs.d head/cddl/lib/libdtrace/nfssrv.d Modified: head/cddl/lib/libdtrace/nfs.d ============================================================================== --- head/cddl/lib/libdtrace/nfs.d Thu Apr 18 00:53:47 2013 (r249599) +++ head/cddl/lib/libdtrace/nfs.d Thu Apr 18 01:20:08 2013 (r249600) @@ -28,8 +28,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #pragma D depends_on library ip.d #pragma D depends_on library net.d #pragma D depends_on module nfs @@ -47,32 +45,62 @@ typedef struct nfsv4cbinfo { #pragma D binding "1.5" translator translator conninfo_t < struct svc_req *P > { ci_protocol = P->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" : + P->rq_xprt->xp_master->xp_netid == "udp" ? "ipv4" : P->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" : + P->rq_xprt->xp_master->xp_netid == "udp6" ? "ipv6" : ""; - ci_local = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc. - xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr); - - ci_remote = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc. - xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr); + ci_local = (P->rq_xprt->xp_master->xp_netid == "tcp" || + P->rq_xprt->xp_master->xp_netid == "udp") ? + inet_ntoa(&((struct sockaddr_in *) + P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin_addr.S_un.S_addr) : + (P->rq_xprt->xp_master->xp_netid == "tcp6" || + P->rq_xprt->xp_master->xp_netid == "udp6") ? + inet_ntoa6(&((struct sockaddr_in6 *) + P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin6_addr) : + "unknown"; + + ci_remote = (P->rq_xprt->xp_master->xp_netid == "tcp" || + P->rq_xprt->xp_master->xp_netid == "udp") ? + inet_ntoa(&((struct sockaddr_in *) + P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin_addr.S_un.S_addr) : + (P->rq_xprt->xp_master->xp_netid == "tcp6" || + P->rq_xprt->xp_master->xp_netid == "udp6") ? + inet_ntoa6(&((struct sockaddr_in6 *) + P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin6_addr) : + "unknown"; }; #pragma D binding "1.5" translator -translator conninfo_t < struct compound_state *P > { - ci_protocol = P->req->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" : - P->req->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" : - ""; +translator conninfo_t < rfs4_client_t *P > { + ci_protocol = (P->rc_addr.ss_family == AF_INET) ? "ipv4" : "ipv6"; - ci_local = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc. - xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr); + ci_local = ""; - ci_remote = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc. - xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr); + ci_remote = (P->rc_addr.ss_family == AF_INET) ? + inet_ntoa((ipaddr_t *) + &((struct sockaddr_in *)&P->rc_addr)->sin_addr) : + inet_ntoa6(&((struct sockaddr_in6 *)&P->rc_addr)->sin6_addr); +}; + +#pragma D binding "1.5" translator +translator nfsv4cbinfo_t < rfs4_deleg_state_t *P > { + nci_curpath = (P->rds_finfo->rf_vp == NULL) ? "" : + P->rds_finfo->rf_vp->v_path; }; +typedef struct nfsv3opinfo { + uint64_t noi_xid; /* unique transation ID */ + cred_t *noi_cred; /* credentials for operation */ + string noi_curpath; /* current file handle path (if any) */ +} nfsv3opinfo_t; + +typedef struct nfsv3oparg nfsv3oparg_t; + #pragma D binding "1.5" translator -translator nfsv4opinfo_t < struct compound_state *P > { - noi_xid = P->req->rq_xprt->xp_xid; - noi_cred = P->basecr; - noi_curpath = (P->vp == NULL) ? "" : P->vp->v_path; +translator nfsv3opinfo_t < nfsv3oparg_t *P > { + noi_xid = ((struct svc_req *)arg0)->rq_xprt->xp_xid; + noi_cred = (cred_t *)arg1; + noi_curpath = (arg2 == 0 || ((vnode_t *)arg2)->v_path == NULL) ? + "" : ((vnode_t *)arg2)->v_path; }; Modified: head/cddl/lib/libdtrace/nfssrv.d ============================================================================== --- head/cddl/lib/libdtrace/nfssrv.d Thu Apr 18 00:53:47 2013 (r249599) +++ head/cddl/lib/libdtrace/nfssrv.d Thu Apr 18 01:20:08 2013 (r249600) @@ -24,31 +24,31 @@ */ /* - * 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" - #pragma D depends_on library ip.d #pragma D depends_on library net.d #pragma D depends_on module nfs.d #pragma D depends_on module nfssrv #pragma D binding "1.5" translator -translator conninfo_t < rfs4_client_t *P > { - ci_protocol = (P->cl_addr.ss_family == AF_INET) ? "ipv4" : "ipv6"; +translator conninfo_t < struct compound_state *P > { + ci_protocol = P->req->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" : + P->req->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" : + ""; - ci_local = ""; + ci_local = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc. + xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr); - ci_remote = (P->cl_addr.ss_family == AF_INET) ? - inet_ntoa((ipaddr_t *) - &((struct sockaddr_in *)&P->cl_addr)->sin_addr) : - inet_ntoa6(&((struct sockaddr_in6 *)&P->cl_addr)->sin6_addr); + ci_remote = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc. + xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr); }; #pragma D binding "1.5" translator -translator nfsv4cbinfo_t < rfs4_deleg_state_t *P > { - nci_curpath = (P->finfo->vp == NULL) ? "" : - P->finfo->vp->v_path; +translator nfsv4opinfo_t < struct compound_state *P > { + noi_xid = P->req->rq_xprt->xp_xid; + noi_cred = P->basecr; + noi_curpath = (P->vp == NULL) ? "" : P->vp->v_path; }; From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 01:21:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9BD7B3AC; Thu, 18 Apr 2013 01:21:44 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8F0AB15E; Thu, 18 Apr 2013 01:21:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3I1LiWf037291; Thu, 18 Apr 2013 01:21:44 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3I1LiJw037289; Thu, 18 Apr 2013 01:21:44 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201304180121.r3I1LiJw037289@svn.freebsd.org> From: Rui Paulo Date: Thu, 18 Apr 2013 01:21:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249601 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 01:21:44 -0000 Author: rpaulo Date: Thu Apr 18 01:21:44 2013 New Revision: 249601 URL: http://svnweb.freebsd.org/changeset/base/249601 Log: Print RDSEED, ADX, and SMAP. Pointed out by: kib Modified: head/sys/amd64/amd64/identcpu.c Modified: head/sys/amd64/amd64/identcpu.c ============================================================================== --- head/sys/amd64/amd64/identcpu.c Thu Apr 18 01:20:08 2013 (r249600) +++ head/sys/amd64/amd64/identcpu.c Thu Apr 18 01:21:44 2013 (r249601) @@ -406,6 +406,12 @@ printcpuinfo(void) "\013INVPCID" /* Restricted Transactional Memory */ "\014RTM" + /* Enhanced NRBG */ + "\022RDSEED" + /* ADCX + ADOX */ + "\023ADX" + /* Supervisor Mode Access Prevention */ + "\024SMAP" ); } From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 01:30:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1CF74786; Thu, 18 Apr 2013 01:30:09 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 102471A1; Thu, 18 Apr 2013 01:30:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3I1U8Ls038835; Thu, 18 Apr 2013 01:30:08 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3I1U89k038834; Thu, 18 Apr 2013 01:30:08 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201304180130.r3I1U89k038834@svn.freebsd.org> From: Rui Paulo Date: Thu, 18 Apr 2013 01:30:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249602 - head/sys/x86/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 01:30:09 -0000 Author: rpaulo Date: Thu Apr 18 01:30:08 2013 New Revision: 249602 URL: http://svnweb.freebsd.org/changeset/base/249602 Log: Add the most current CPUID7_* definitions. Modified: head/sys/x86/include/specialreg.h Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Thu Apr 18 01:21:44 2013 (r249601) +++ head/sys/x86/include/specialreg.h Thu Apr 18 01:30:08 2013 (r249602) @@ -172,6 +172,23 @@ #define CPUTPM2_EFFREQ 0x00000001 /* + * Structured Extended Features + */ +#define CPUID7_GSFSBASE 0x00000001 +#define CPUID7_TSCADJ 0x00000002 +#define CPUID7_BMI1 0x00000008 +#define CPUID7_HLE 0x00000010 +#define CPUID7_AVX2 0x00000020 +#define CPUID7_SMEP 0x00000080 +#define CPUID7_BMI2 0x00000100 +#define CPUID7_ENHMOVSB 0x00000200 +#define CPUID7_INVPCID 0x00000400 +#define CPUID7_RTM 0x00000800 +#define CPUID7_RDSEED 0x00040000 +#define CPUID7_ADX 0x00080000 +#define CPUID7_SMAP 0x00100000 + +/* * Important bits in the AMD extended cpuid flags */ #define AMDID_SYSCALL 0x00000800 From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 02:20:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8B5B0C31; Thu, 18 Apr 2013 02:20:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7DFEB2B4; Thu, 18 Apr 2013 02:20:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3I2Kx31054681; Thu, 18 Apr 2013 02:20:59 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3I2KwoE054659; Thu, 18 Apr 2013 02:20:58 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201304180220.r3I2KwoE054659@svn.freebsd.org> From: Andrew Turner Date: Thu, 18 Apr 2013 02:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249603 - in head/contrib: binutils/include/elf gdb/gdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 02:20:59 -0000 Author: andrew Date: Thu Apr 18 02:20:58 2013 New Revision: 249603 URL: http://svnweb.freebsd.org/changeset/base/249603 Log: Fix the value of NT_FREEBSD_TAG to be the same as ABI_NOTRTYPE in lib/csu. Add NT_FREEBSD_NOINIT_TAG for the value of CRT_NOINIT_NOTETYPE. Check for both of these when detecting a FreeBSD binary in gdb. Modified: head/contrib/binutils/include/elf/common.h head/contrib/gdb/gdb/osabi.c Modified: head/contrib/binutils/include/elf/common.h ============================================================================== --- head/contrib/binutils/include/elf/common.h Thu Apr 18 01:30:08 2013 (r249602) +++ head/contrib/binutils/include/elf/common.h Thu Apr 18 02:20:58 2013 (r249603) @@ -437,7 +437,8 @@ /* Values for FreeBSD .note.tag notes. Note name is "FreeBSD". */ -#define NT_FREEBSD_TAG 2 +#define NT_FREEBSD_TAG 1 +#define NT_FREEBSD_NOINIT_TAG 2 /* These three macros disassemble and assemble a symbol table st_info field, which contains the symbol binding and symbol type. The STB_ and STT_ Modified: head/contrib/gdb/gdb/osabi.c ============================================================================== --- head/contrib/gdb/gdb/osabi.c Thu Apr 18 01:30:08 2013 (r249602) +++ head/contrib/gdb/gdb/osabi.c Thu Apr 18 02:20:58 2013 (r249603) @@ -474,6 +474,12 @@ generic_elf_osabi_sniff_abi_tag_sections *osabi = GDB_OSABI_FREEBSD_ELF; return; } + if (check_note (abfd, sect, note, "FreeBSD", 4, NT_FREEBSD_NOINIT_TAG)) + { + /* There is no need to check the version yet. */ + *osabi = GDB_OSABI_FREEBSD_ELF; + return; + } return; } From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 05:12:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4D37E7A3; Thu, 18 Apr 2013 05:12:12 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 404D3AF3; Thu, 18 Apr 2013 05:12:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3I5CBdg009228; Thu, 18 Apr 2013 05:12:11 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3I5CBBn009227; Thu, 18 Apr 2013 05:12:11 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201304180512.r3I5CBBn009227@svn.freebsd.org> From: David Xu Date: Thu, 18 Apr 2013 05:12:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249604 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 05:12:12 -0000 Author: davidxu Date: Thu Apr 18 05:12:11 2013 New Revision: 249604 URL: http://svnweb.freebsd.org/changeset/base/249604 Log: Revert revision 249323, the PR/177624 is confusing, that bug is caused by using buggy getcontext/setcontext on same stack, while swapcontext normally works on different stack, there is no such a problem. Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Thu Apr 18 02:20:58 2013 (r249603) +++ head/lib/libthr/thread/thr_sig.c Thu Apr 18 05:12:11 2013 (r249604) @@ -737,4 +737,13 @@ _setcontext(const ucontext_t *ucp) return __sys_setcontext(&uc); } -__weak_reference(__sys_swapcontext, swapcontext); +__weak_reference(_swapcontext, swapcontext); +int +_swapcontext(ucontext_t *oucp, const ucontext_t *ucp) +{ + ucontext_t uc; + + (void) memcpy(&uc, ucp, sizeof(uc)); + remove_thr_signals(&uc.uc_sigmask); + return __sys_swapcontext(oucp, &uc); +} From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 05:34:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BFE71A9A; Thu, 18 Apr 2013 05:34:33 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B3530BD5; Thu, 18 Apr 2013 05:34:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3I5YXO0015578; Thu, 18 Apr 2013 05:34:33 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3I5YXK4015577; Thu, 18 Apr 2013 05:34:33 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201304180534.r3I5YXK4015577@svn.freebsd.org> From: Alan Cox Date: Thu, 18 Apr 2013 05:34:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249605 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 05:34:33 -0000 Author: alc Date: Thu Apr 18 05:34:33 2013 New Revision: 249605 URL: http://svnweb.freebsd.org/changeset/base/249605 Log: When calculating the number of reserved nodes, discount the pages that will be used to store the nodes. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_radix.c Modified: head/sys/vm/vm_radix.c ============================================================================== --- head/sys/vm/vm_radix.c Thu Apr 18 05:12:11 2013 (r249604) +++ head/sys/vm/vm_radix.c Thu Apr 18 05:34:33 2013 (r249605) @@ -360,10 +360,17 @@ vm_radix_node_zone_init(void *mem, int s static void vm_radix_prealloc(void *arg __unused) { + int nodes; - if (!uma_zone_reserve_kva(vm_radix_node_zone, cnt.v_page_count)) + /* + * Calculate the number of reserved nodes, discounting the pages that + * are needed to store them. + */ + nodes = ((vm_paddr_t)cnt.v_page_count * PAGE_SIZE) / (PAGE_SIZE + + sizeof(struct vm_radix_node)); + if (!uma_zone_reserve_kva(vm_radix_node_zone, nodes)) panic("%s: unable to create new zone", __func__); - uma_prealloc(vm_radix_node_zone, cnt.v_page_count); + uma_prealloc(vm_radix_node_zone, nodes); } SYSINIT(vm_radix_prealloc, SI_SUB_KMEM, SI_ORDER_SECOND, vm_radix_prealloc, NULL); From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 05:46:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 47815D96; Thu, 18 Apr 2013 05:46:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id DF959C2F; Thu, 18 Apr 2013 05:46:16 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r3I5kDgq058968; Thu, 18 Apr 2013 08:46:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.2 kib.kiev.ua r3I5kDgq058968 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r3I5kDgh058967; Thu, 18 Apr 2013 08:46:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 18 Apr 2013 08:46:13 +0300 From: Konstantin Belousov To: Rui Paulo Subject: Re: svn commit: r249602 - head/sys/x86/include Message-ID: <20130418054613.GG85148@kib.kiev.ua> References: <201304180130.r3I1U89k038834@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MiFvc8Vo6wRSORdP" Content-Disposition: inline In-Reply-To: <201304180130.r3I1U89k038834@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 05:46:17 -0000 --MiFvc8Vo6wRSORdP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 18, 2013 at 01:30:08AM +0000, Rui Paulo wrote: > Author: rpaulo > Date: Thu Apr 18 01:30:08 2013 > New Revision: 249602 > URL: http://svnweb.freebsd.org/changeset/base/249602 >=20 > Log: > Add the most current CPUID7_* definitions. >=20 > Modified: > head/sys/x86/include/specialreg.h >=20 > Modified: head/sys/x86/include/specialreg.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/x86/include/specialreg.h Thu Apr 18 01:21:44 2013 (r249601) > +++ head/sys/x86/include/specialreg.h Thu Apr 18 01:30:08 2013 (r249602) > @@ -172,6 +172,23 @@ > #define CPUTPM2_EFFREQ 0x00000001 > =20 > /* > + * Structured Extended Features > + */ > +#define CPUID7_GSFSBASE 0x00000001 > +#define CPUID7_TSCADJ 0x00000002 > +#define CPUID7_BMI1 0x00000008 > +#define CPUID7_HLE 0x00000010 > +#define CPUID7_AVX2 0x00000020 > +#define CPUID7_SMEP 0x00000080 > +#define CPUID7_BMI2 0x00000100 > +#define CPUID7_ENHMOVSB 0x00000200 > +#define CPUID7_INVPCID 0x00000400 > +#define CPUID7_RTM 0x00000800 > +#define CPUID7_RDSEED 0x00040000 > +#define CPUID7_ADX 0x00080000 > +#define CPUID7_SMAP 0x00100000 > + > +/* The set of the bits already exists as CPUID_STDEXT_* in the same file, and they are already utilized by the kernel. Please move new definitions to CPUID_STDEXT namespace and block, and remove CPUID7*. --MiFvc8Vo6wRSORdP Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRb4ikAAoJEJDCuSvBvK1BZ4wP/Rokq1EjJz2iZt4FEIu5G+B2 ScFQS4gy+qcsDCp8I1GdzaHyO4Kq049K8QIsafvcgUSAD80QyXKgl4M5WzzXp1eM 53Wye+PpvBAF7yYF7hPJn03hcYGS+sILqqUmlKwWZgSD3f7c2LYSe9Oaw+p/J54v 9Q3iJBhv5htYFUA7T/o9/D4xTrH1BsoGjzXs0rTH/ofzp0OXChZqR3IKSgsz4OZj Ps3wbhFWszk6bTH89y9Ns4S0aQsLYZPcPUbVYkufmUGbfUVpvLfnTwCTaOWOX1Dv Le2kFjD8jW7llxNepB12b5iQAbTa8soCvYgLkjKJl/XHfnQCd7AiUUVgcX6OsgBJ 4+BtiUQDla4W1H81UMMf6BugNpNYpSF5Xy1IPg4MvGaQFuQsD6UakxA3Se7LVSfG AsSREapPmJnwAyxQFBEB14XU9vhu2RYQRHTJteOeiq4iCWDOYD1YRnzNy8XxeU6s sCPOAts80XFG5YxEqHNS02PeaANa8amWMv2bGYaDSEf6uY+PIusyvp/HAB17C7SP CYqqAFsUpDBJr1or+T/Gm7F7ClTkfgPcg0wyr+DhMaODuChgtQt/1/cuio/yDtEV NE0ksScwHFbL8KCU2j4oQtL2W9VYJhvEZ9kI0bae9WFxQoliL8prcUd3L1eXVT/W h2Ip+kS9BQAJgWnbhrRc =2vyo -----END PGP SIGNATURE----- --MiFvc8Vo6wRSORdP-- From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 05:56:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 44CA19B; Thu, 18 Apr 2013 05:56:01 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 37F56CDF; Thu, 18 Apr 2013 05:56:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3I5u1IJ021810; Thu, 18 Apr 2013 05:56:01 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3I5u1Yd021809; Thu, 18 Apr 2013 05:56:01 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201304180556.r3I5u1Yd021809@svn.freebsd.org> From: David Xu Date: Thu, 18 Apr 2013 05:56:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249606 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 05:56:01 -0000 Author: davidxu Date: Thu Apr 18 05:56:00 2013 New Revision: 249606 URL: http://svnweb.freebsd.org/changeset/base/249606 Log: Avoid copying memory if SIGCANCEL is not masked. Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Thu Apr 18 05:34:33 2013 (r249605) +++ head/lib/libthr/thread/thr_sig.c Thu Apr 18 05:56:00 2013 (r249606) @@ -732,8 +732,12 @@ _setcontext(const ucontext_t *ucp) { ucontext_t uc; + if (ucp == NULL) + return (EINVAL); + if (!SIGISMEMBER(uc.uc_sigmask, SIGCANCEL)) + return __sys_setcontext(ucp); (void) memcpy(&uc, ucp, sizeof(uc)); - remove_thr_signals(&uc.uc_sigmask); + SIGDELSET(uc.uc_sigmask, SIGCANCEL); return __sys_setcontext(&uc); } @@ -743,7 +747,13 @@ _swapcontext(ucontext_t *oucp, const uco { ucontext_t uc; - (void) memcpy(&uc, ucp, sizeof(uc)); - remove_thr_signals(&uc.uc_sigmask); - return __sys_swapcontext(oucp, &uc); + if (oucp == NULL || ucp == NULL) + return (EINVAL); + if (SIGISMEMBER(ucp->uc_sigmask, SIGCANCEL)) { + stdout_debug("remove SIGCANCEL\n"); + (void) memcpy(&uc, ucp, sizeof(uc)); + SIGDELSET(uc.uc_sigmask, SIGCANCEL); + ucp = &uc; + } + return __sys_swapcontext(oucp, ucp); } From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 05:58:07 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B3FDC239; Thu, 18 Apr 2013 05:58:07 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A6D7CCEC; Thu, 18 Apr 2013 05:58:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3I5w7le022122; Thu, 18 Apr 2013 05:58:07 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3I5w7W8022121; Thu, 18 Apr 2013 05:58:07 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201304180558.r3I5w7W8022121@svn.freebsd.org> From: David Xu Date: Thu, 18 Apr 2013 05:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249607 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 05:58:07 -0000 Author: davidxu Date: Thu Apr 18 05:58:07 2013 New Revision: 249607 URL: http://svnweb.freebsd.org/changeset/base/249607 Log: Remove debug code. Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Thu Apr 18 05:56:00 2013 (r249606) +++ head/lib/libthr/thread/thr_sig.c Thu Apr 18 05:58:07 2013 (r249607) @@ -750,7 +750,6 @@ _swapcontext(ucontext_t *oucp, const uco if (oucp == NULL || ucp == NULL) return (EINVAL); if (SIGISMEMBER(ucp->uc_sigmask, SIGCANCEL)) { - stdout_debug("remove SIGCANCEL\n"); (void) memcpy(&uc, ucp, sizeof(uc)); SIGDELSET(uc.uc_sigmask, SIGCANCEL); ucp = &uc; From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 07:09:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 28DDC3F1; Thu, 18 Apr 2013 07:09:28 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1C081F33; Thu, 18 Apr 2013 07:09:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3I79RCQ044699; Thu, 18 Apr 2013 07:09:27 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3I79RiW044698; Thu, 18 Apr 2013 07:09:27 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201304180709.r3I79RiW044698@svn.freebsd.org> From: Rui Paulo Date: Thu, 18 Apr 2013 07:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249608 - head/sys/x86/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 07:09:28 -0000 Author: rpaulo Date: Thu Apr 18 07:09:27 2013 New Revision: 249608 URL: http://svnweb.freebsd.org/changeset/base/249608 Log: Move the previously added CPUID7 macros to CPUID_STDEXT. Modified: head/sys/x86/include/specialreg.h Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Thu Apr 18 05:58:07 2013 (r249607) +++ head/sys/x86/include/specialreg.h Thu Apr 18 07:09:27 2013 (r249608) @@ -172,23 +172,6 @@ #define CPUTPM2_EFFREQ 0x00000001 /* - * Structured Extended Features - */ -#define CPUID7_GSFSBASE 0x00000001 -#define CPUID7_TSCADJ 0x00000002 -#define CPUID7_BMI1 0x00000008 -#define CPUID7_HLE 0x00000010 -#define CPUID7_AVX2 0x00000020 -#define CPUID7_SMEP 0x00000080 -#define CPUID7_BMI2 0x00000100 -#define CPUID7_ENHMOVSB 0x00000200 -#define CPUID7_INVPCID 0x00000400 -#define CPUID7_RTM 0x00000800 -#define CPUID7_RDSEED 0x00040000 -#define CPUID7_ADX 0x00080000 -#define CPUID7_SMAP 0x00100000 - -/* * Important bits in the AMD extended cpuid flags */ #define AMDID_SYSCALL 0x00000800 @@ -295,11 +278,22 @@ #define AMDID_COREID_SIZE 0x0000f000 #define AMDID_COREID_SIZE_SHIFT 12 +/* + * Structured Extended Features + */ #define CPUID_STDEXT_FSGSBASE 0x00000001 #define CPUID_STDEXT_TSC_ADJUST 0x00000002 +#define CPUID_STDEXT_BMI1 0x00000008 +#define CPUID_STDEXT_HLE 0x00000010 +#define CPUID_STDEXT_AVX2 0x00000020 #define CPUID_STDEXT_SMEP 0x00000080 +#define CPUID_STDEXT_BMI2 0x00000100 #define CPUID_STDEXT_ENH_MOVSB 0x00000200 +#define CPUID_STDEXT_RTM 0x00000800 #define CPUID_STDEXT_INVPCID 0x00000400 +#define CPUID_STDEXT_RDSEED 0x00040000 +#define CPUID_STDEXT_ADX 0x00080000 +#define CPUID_STDEXT_SMAP 0x00100000 /* * CPUID manufacturers identifiers From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 10:08:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8EAE076F; Thu, 18 Apr 2013 10:08:27 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 819CF9E9; Thu, 18 Apr 2013 10:08:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3IA8Rrc001552; Thu, 18 Apr 2013 10:08:27 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3IA8RUT001551; Thu, 18 Apr 2013 10:08:27 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201304181008.r3IA8RUT001551@svn.freebsd.org> From: Joel Dahl Date: Thu, 18 Apr 2013 10:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249616 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 10:08:27 -0000 Author: joel (doc committer) Date: Thu Apr 18 10:08:27 2013 New Revision: 249616 URL: http://svnweb.freebsd.org/changeset/base/249616 Log: Remove EOL whitespace. Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Thu Apr 18 10:06:52 2013 (r249615) +++ head/share/man/man5/rc.conf.5 Thu Apr 18 10:08:27 2013 (r249616) @@ -3987,7 +3987,7 @@ Set to the fully qualified domain name ( Unset by default. Set extra parameters for jail .Va jname , -such as +such as .Dq Li allow.chflags or .Dq Li children.max . @@ -4001,7 +4001,7 @@ script out of their corresponding variables: .Bl -tag -width "host.hostname" -offset indent .It Li path -set from +set from .Va jail_ Ns Ao Ar jname Ac Ns Va _rootdir .It Li host.hostname set from From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 12:43:07 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E86E5DDC; Thu, 18 Apr 2013 12:43:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CA285A5D; Thu, 18 Apr 2013 12:43:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3ICh7HQ050875; Thu, 18 Apr 2013 12:43:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3ICh78x050872; Thu, 18 Apr 2013 12:43:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304181243.r3ICh78x050872@svn.freebsd.org> From: Alexander Motin Date: Thu, 18 Apr 2013 12:43:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249622 - in head/sys/dev: mvs siis X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 12:43:08 -0000 Author: mav Date: Thu Apr 18 12:43:06 2013 New Revision: 249622 URL: http://svnweb.freebsd.org/changeset/base/249622 Log: Make siis(4) and mvs(4) send bus_get_dma_tag() requests to parent buses passing real bus' child pointers instead of grandchilds. Requested by: kib Modified: head/sys/dev/mvs/mvs_pci.c head/sys/dev/mvs/mvs_soc.c head/sys/dev/siis/siis.c Modified: head/sys/dev/mvs/mvs_pci.c ============================================================================== --- head/sys/dev/mvs/mvs_pci.c Thu Apr 18 11:13:48 2013 (r249621) +++ head/sys/dev/mvs/mvs_pci.c Thu Apr 18 12:43:06 2013 (r249622) @@ -488,6 +488,13 @@ mvs_child_location_str(device_t dev, dev return (0); } +static bus_dma_tag_t +mvs_get_dma_tag(device_t bus, device_t child) +{ + + return (bus_get_dma_tag(bus)); +} + static device_method_t mvs_methods[] = { DEVMETHOD(device_probe, mvs_probe), DEVMETHOD(device_attach, mvs_attach), @@ -500,6 +507,7 @@ static device_method_t mvs_methods[] = { DEVMETHOD(bus_setup_intr, mvs_setup_intr), DEVMETHOD(bus_teardown_intr,mvs_teardown_intr), DEVMETHOD(bus_child_location_str, mvs_child_location_str), + DEVMETHOD(bus_get_dma_tag, mvs_get_dma_tag), DEVMETHOD(mvs_edma, mvs_edma), { 0, 0 } }; Modified: head/sys/dev/mvs/mvs_soc.c ============================================================================== --- head/sys/dev/mvs/mvs_soc.c Thu Apr 18 11:13:48 2013 (r249621) +++ head/sys/dev/mvs/mvs_soc.c Thu Apr 18 12:43:06 2013 (r249622) @@ -430,6 +430,13 @@ mvs_child_location_str(device_t dev, dev return (0); } +static bus_dma_tag_t +mvs_get_dma_tag(device_t bus, device_t child) +{ + + return (bus_get_dma_tag(bus)); +} + static device_method_t mvs_methods[] = { DEVMETHOD(device_probe, mvs_probe), DEVMETHOD(device_attach, mvs_attach), @@ -441,8 +448,9 @@ static device_method_t mvs_methods[] = { DEVMETHOD(bus_release_resource, mvs_release_resource), DEVMETHOD(bus_setup_intr, mvs_setup_intr), DEVMETHOD(bus_teardown_intr,mvs_teardown_intr), - DEVMETHOD(mvs_edma, mvs_edma), DEVMETHOD(bus_child_location_str, mvs_child_location_str), + DEVMETHOD(bus_get_dma_tag, mvs_get_dma_tag), + DEVMETHOD(mvs_edma, mvs_edma), { 0, 0 } }; static driver_t mvs_driver = { Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Thu Apr 18 11:13:48 2013 (r249621) +++ head/sys/dev/siis/siis.c Thu Apr 18 12:43:06 2013 (r249622) @@ -414,6 +414,13 @@ siis_child_location_str(device_t dev, de return (0); } +static bus_dma_tag_t +siis_get_dma_tag(device_t bus, device_t child) +{ + + return (bus_get_dma_tag(bus)); +} + devclass_t siis_devclass; static device_method_t siis_methods[] = { DEVMETHOD(device_probe, siis_probe), @@ -427,6 +434,7 @@ static device_method_t siis_methods[] = DEVMETHOD(bus_setup_intr, siis_setup_intr), DEVMETHOD(bus_teardown_intr,siis_teardown_intr), DEVMETHOD(bus_child_location_str, siis_child_location_str), + DEVMETHOD(bus_get_dma_tag, siis_get_dma_tag), { 0, 0 } }; static driver_t siis_driver = { From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 13:09:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 180C78CB; Thu, 18 Apr 2013 13:09:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0B618CF9; Thu, 18 Apr 2013 13:09:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3ID94Ef058143; Thu, 18 Apr 2013 13:09:04 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3ID947b058138; Thu, 18 Apr 2013 13:09:04 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201304181309.r3ID947b058138@svn.freebsd.org> From: Rick Macklem Date: Thu, 18 Apr 2013 13:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249623 - in head/sys: fs/nfsclient nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 13:09:05 -0000 Author: rmacklem Date: Thu Apr 18 13:09:04 2013 New Revision: 249623 URL: http://svnweb.freebsd.org/changeset/base/249623 Log: Both NFS clients can deadlock when using the "rdirplus" mount option. This can occur when an nfsiod thread that already holds a buffer lock attempts to acquire a vnode lock on an entry in the directory (a LOR) when another thread holding the vnode lock is waiting on an nfsiod thread. This patch avoids the deadlock by disabling readahead for this case, so the nfsiod threads never do readdirplus. Since readaheads for directories need the directory offset cookie from the previous read, they cannot normally happen in parallel. As such, testing by jhb@ and myself didn't find any performance degredation when this patch is applied. If there is a case where this results in a significant performance degradation, mounting without the "rdirplus" option can be done to re-enable readahead for directories. Reported and tested by: jhb Reviewed by: jhb MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/nfsclient/nfs_bio.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Thu Apr 18 12:43:06 2013 (r249622) +++ head/sys/fs/nfsclient/nfs_clbio.c Thu Apr 18 13:09:04 2013 (r249623) @@ -1404,10 +1404,18 @@ ncl_asyncio(struct nfsmount *nmp, struct * Commits are usually short and sweet so lets save some cpu and * leave the async daemons for more important rpc's (such as reads * and writes). + * + * Readdirplus RPCs do vget()s to acquire the vnodes for entries + * in the directory in order to update attributes. This can deadlock + * with another thread that is waiting for async I/O to be done by + * an nfsiod thread while holding a lock on one of these vnodes. + * To avoid this deadlock, don't allow the async nfsiod threads to + * perform Readdirplus RPCs. */ mtx_lock(&ncl_iod_mutex); - if (bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && - (nmp->nm_bufqiods > ncl_numasync / 2)) { + if ((bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && + (nmp->nm_bufqiods > ncl_numasync / 2)) || + (bp->b_vp->v_type == VDIR && (nmp->nm_flag & NFSMNT_RDIRPLUS))) { mtx_unlock(&ncl_iod_mutex); return(EIO); } Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Thu Apr 18 12:43:06 2013 (r249622) +++ head/sys/nfsclient/nfs_bio.c Thu Apr 18 13:09:04 2013 (r249623) @@ -1345,10 +1345,18 @@ nfs_asyncio(struct nfsmount *nmp, struct * Commits are usually short and sweet so lets save some cpu and * leave the async daemons for more important rpc's (such as reads * and writes). + * + * Readdirplus RPCs do vget()s to acquire the vnodes for entries + * in the directory in order to update attributes. This can deadlock + * with another thread that is waiting for async I/O to be done by + * an nfsiod thread while holding a lock on one of these vnodes. + * To avoid this deadlock, don't allow the async nfsiod threads to + * perform Readdirplus RPCs. */ mtx_lock(&nfs_iod_mtx); - if (bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && - (nmp->nm_bufqiods > nfs_numasync / 2)) { + if ((bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && + (nmp->nm_bufqiods > nfs_numasync / 2)) || + (bp->b_vp->v_type == VDIR && (nmp->nm_flag & NFSMNT_RDIRPLUS))) { mtx_unlock(&nfs_iod_mtx); return(EIO); } From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 17:07:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 548ECE02; Thu, 18 Apr 2013 17:07:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 36D7FD32; Thu, 18 Apr 2013 17:07:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3IH75si032785; Thu, 18 Apr 2013 17:07:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3IH756J032784; Thu, 18 Apr 2013 17:07:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304181707.r3IH756J032784@svn.freebsd.org> From: Alexander Motin Date: Thu, 18 Apr 2013 17:07:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249625 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 17:07:05 -0000 Author: mav Date: Thu Apr 18 17:07:04 2013 New Revision: 249625 URL: http://svnweb.freebsd.org/changeset/base/249625 Log: Introduce kern.timecounter.smp_tsc_adjust tunable (disabled by default) and respective functionality, allowing to synchronize TSC on APs to match BSP's during boot. It may be unsafe in general case due to theoretical chance of later drift if CPUs are using different clock rate or source, but it allows to use TSC in some cases when difference caused by some initialization bug, while TSCs are known to increment synchronously. Reviewed by: jimharris, kib MFC after: 1 month Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Thu Apr 18 13:19:41 2013 (r249624) +++ head/sys/x86/x86/tsc.c Thu Apr 18 17:07:04 2013 (r249625) @@ -65,6 +65,11 @@ int smp_tsc; SYSCTL_INT(_kern_timecounter, OID_AUTO, smp_tsc, CTLFLAG_RDTUN, &smp_tsc, 0, "Indicates whether the TSC is safe to use in SMP mode"); TUNABLE_INT("kern.timecounter.smp_tsc", &smp_tsc); + +int smp_tsc_adjust = 0; +SYSCTL_INT(_kern_timecounter, OID_AUTO, smp_tsc_adjust, CTLFLAG_RDTUN, + &smp_tsc_adjust, 0, "Try to adjust TSC on APs to match BSP"); +TUNABLE_INT("kern.timecounter.smp_tsc_adjust", &smp_tsc_adjust); #endif static int tsc_shift = 1; @@ -403,25 +408,77 @@ comp_smp_tsc(void *arg) } } +static void +adj_smp_tsc(void *arg) +{ + uint64_t *tsc; + int64_t d, min, max; + u_int cpu = PCPU_GET(cpuid); + u_int first, i, size; + + first = CPU_FIRST(); + if (cpu == first) + return; + min = INT64_MIN; + max = INT64_MAX; + size = (mp_maxid + 1) * 3; + for (i = 0, tsc = arg; i < N; i++, tsc += size) { + d = tsc[first * 3] - tsc[cpu * 3 + 1]; + if (d > min) + min = d; + d = tsc[first * 3 + 1] - tsc[cpu * 3 + 2]; + if (d > min) + min = d; + d = tsc[first * 3 + 1] - tsc[cpu * 3]; + if (d < max) + max = d; + d = tsc[first * 3 + 2] - tsc[cpu * 3 + 1]; + if (d < max) + max = d; + } + if (min > max) + return; + d = min / 2 + max / 2; + __asm __volatile ( + "movl $0x10, %%ecx\n\t" + "rdmsr\n\t" + "addl %%edi, %%eax\n\t" + "adcl %%esi, %%edx\n\t" + "wrmsr\n" + : /* No output */ + : "D" ((uint32_t)d), "S" ((uint32_t)(d >> 32)) + : "ax", "cx", "dx", "cc" + ); +} + static int test_tsc(void) { uint64_t *data, *tsc; - u_int i, size; + u_int i, size, adj; if ((!smp_tsc && !tsc_is_invariant) || vm_guest) return (-100); size = (mp_maxid + 1) * 3; data = malloc(sizeof(*data) * size * N, M_TEMP, M_WAITOK); + adj = 0; +retry: for (i = 0, tsc = data; i < N; i++, tsc += size) smp_rendezvous(tsc_read_0, tsc_read_1, tsc_read_2, tsc); smp_tsc = 1; /* XXX */ smp_rendezvous(smp_no_rendevous_barrier, comp_smp_tsc, smp_no_rendevous_barrier, data); + if (!smp_tsc && adj < smp_tsc_adjust) { + adj++; + smp_rendezvous(smp_no_rendevous_barrier, adj_smp_tsc, + smp_no_rendevous_barrier, data); + goto retry; + } free(data, M_TEMP); if (bootverbose) - printf("SMP: %sed TSC synchronization test\n", - smp_tsc ? "pass" : "fail"); + printf("SMP: %sed TSC synchronization test%s\n", + smp_tsc ? "pass" : "fail", + adj > 0 ? " after adjustment" : ""); if (smp_tsc && tsc_is_invariant) { switch (cpu_vendor_id) { case CPU_VENDOR_AMD: From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 19:52:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 64C7D128; Thu, 18 Apr 2013 19:52:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 569A318B4; Thu, 18 Apr 2013 19:52:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3IJqC1a085470; Thu, 18 Apr 2013 19:52:12 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3IJqCr6085467; Thu, 18 Apr 2013 19:52:12 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201304181952.r3IJqCr6085467@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 18 Apr 2013 19:52:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249627 - head/sys/dev/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 19:52:12 -0000 Author: np Date: Thu Apr 18 19:52:11 2013 New Revision: 249627 URL: http://svnweb.freebsd.org/changeset/base/249627 Log: cxgbe/tom: Update the CLIP table on the chip when there are changes to the list of IPv6 addresses on the system. The table is used for TOE+IPv6 only. Modified: head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Thu Apr 18 18:11:30 2013 (r249626) +++ head/sys/dev/cxgbe/tom/t4_tom.c Thu Apr 18 19:52:11 2013 (r249627) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -89,9 +90,16 @@ static int add_lip(struct adapter *, str static int delete_lip(struct adapter *, struct in6_addr *); static struct clip_entry *search_lip(struct tom_data *, struct in6_addr *); static void init_clip_table(struct adapter *, struct tom_data *); +static void update_clip(struct adapter *, void *); +static void t4_clip_task(void *, int); +static void update_clip_table(struct adapter *, struct tom_data *); static void destroy_clip_table(struct adapter *, struct tom_data *); static void free_tom_data(struct adapter *, struct tom_data *); +static int in6_ifaddr_gen; +static eventhandler_tag ifaddr_evhandler; +static struct timeout_task clip_task; + struct toepcb * alloc_toepcb(struct port_info *pi, int txqid, int rxqid, int flags) { @@ -626,7 +634,7 @@ add_lip(struct adapter *sc, struct in6_a c.ip_hi = *(uint64_t *)&lip->s6_addr[0]; c.ip_lo = *(uint64_t *)&lip->s6_addr[8]; - return (t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c)); + return (-t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c)); } static int @@ -644,7 +652,7 @@ delete_lip(struct adapter *sc, struct in c.ip_hi = *(uint64_t *)&lip->s6_addr[0]; c.ip_lo = *(uint64_t *)&lip->s6_addr[8]; - return (t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c)); + return (-t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c)); } static struct clip_entry * @@ -692,16 +700,56 @@ release_lip(struct tom_data *td, struct static void init_clip_table(struct adapter *sc, struct tom_data *td) { - struct in6_ifaddr *ia; - struct in6_addr *lip, tlip; - struct clip_entry *ce; ASSERT_SYNCHRONIZED_OP(sc); mtx_init(&td->clip_table_lock, "CLIP table lock", NULL, MTX_DEF); TAILQ_INIT(&td->clip_table); + td->clip_gen = -1; + + update_clip_table(sc, td); +} + +static void +update_clip(struct adapter *sc, void *arg __unused) +{ + + if (begin_synchronized_op(sc, NULL, HOLD_LOCK, "t4tomuc")) + return; + + if (sc->flags & TOM_INIT_DONE) + update_clip_table(sc, sc->tom_softc); + + end_synchronized_op(sc, LOCK_HELD); +} + +static void +t4_clip_task(void *arg, int count) +{ + + t4_iterate(update_clip, NULL); +} + +static void +update_clip_table(struct adapter *sc, struct tom_data *td) +{ + struct in6_ifaddr *ia; + struct in6_addr *lip, tlip; + struct clip_head stale; + struct clip_entry *ce, *ce_temp; + int rc, gen = atomic_load_acq_int(&in6_ifaddr_gen); + + ASSERT_SYNCHRONIZED_OP(sc); IN6_IFADDR_RLOCK(); + mtx_lock(&td->clip_table_lock); + + if (gen == td->clip_gen) + goto done; + + TAILQ_INIT(&stale); + TAILQ_CONCAT(&stale, &td->clip_table, link); + TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { lip = &ia->ia_addr.sin6_addr; @@ -721,18 +769,70 @@ init_clip_table(struct adapter *sc, stru * interface? It's fe80::1 usually (always?). */ - mtx_lock(&td->clip_table_lock); - if (search_lip(td, lip) == NULL) { - ce = malloc(sizeof(*ce), M_CXGBE, M_NOWAIT); - memcpy(&ce->lip, lip, sizeof(ce->lip)); - ce->refcount = 0; - if (add_lip(sc, lip) == 0) + /* + * If it's in the main list then we already know it's not stale. + */ + TAILQ_FOREACH(ce, &td->clip_table, link) { + if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) + goto next; + } + + /* + * If it's in the stale list we should move it to the main list. + */ + TAILQ_FOREACH(ce, &stale, link) { + if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) { + TAILQ_REMOVE(&stale, ce, link); TAILQ_INSERT_TAIL(&td->clip_table, ce, link); - else + goto next; + } + } + + /* A new IP6 address; add it to the CLIP table */ + ce = malloc(sizeof(*ce), M_CXGBE, M_NOWAIT); + memcpy(&ce->lip, lip, sizeof(ce->lip)); + ce->refcount = 0; + rc = add_lip(sc, lip); + if (rc == 0) + TAILQ_INSERT_TAIL(&td->clip_table, ce, link); + else { + char ip[INET6_ADDRSTRLEN]; + + inet_ntop(AF_INET6, &ce->lip, &ip[0], sizeof(ip)); + log(LOG_ERR, "%s: could not add %s (%d)\n", + __func__, ip, rc); + free(ce, M_CXGBE); + } +next: + continue; + } + + /* + * Remove stale addresses (those no longer in V_in6_ifaddrhead) that are + * no longer referenced by the driver. + */ + TAILQ_FOREACH_SAFE(ce, &stale, link, ce_temp) { + if (ce->refcount == 0) { + rc = delete_lip(sc, &ce->lip); + if (rc == 0) { + TAILQ_REMOVE(&stale, ce, link); free(ce, M_CXGBE); + } else { + char ip[INET6_ADDRSTRLEN]; + + inet_ntop(AF_INET6, &ce->lip, &ip[0], + sizeof(ip)); + log(LOG_ERR, "%s: could not delete %s (%d)\n", + __func__, ip, rc); + } } - mtx_unlock(&td->clip_table_lock); } + /* The ones that are still referenced need to stay in the CLIP table */ + TAILQ_CONCAT(&td->clip_table, &stale, link); + + td->clip_gen = gen; +done: + mtx_unlock(&td->clip_table_lock); IN6_IFADDR_RUNLOCK(); } @@ -893,6 +993,14 @@ t4_tom_deactivate(struct adapter *sc) return (rc); } +static void +t4_tom_ifaddr_event(void *arg __unused, struct ifnet *ifp) +{ + + atomic_add_rel_int(&in6_ifaddr_gen, 1); + taskqueue_enqueue_timeout(taskqueue_thread, &clip_task, -hz / 4); +} + static int t4_tom_mod_load(void) { @@ -915,6 +1023,10 @@ t4_tom_mod_load(void) ddp6_usrreqs.pru_soreceive = t4_soreceive_ddp; ddp6_protosw.pr_usrreqs = &ddp6_usrreqs; + TIMEOUT_TASK_INIT(taskqueue_thread, &clip_task, 0, t4_clip_task, NULL); + ifaddr_evhandler = EVENTHANDLER_REGISTER(ifaddr_event, + t4_tom_ifaddr_event, NULL, EVENTHANDLER_PRI_ANY); + rc = t4_register_uld(&tom_uld_info); if (rc != 0) t4_tom_mod_unload(); @@ -943,6 +1055,11 @@ t4_tom_mod_unload(void) if (t4_unregister_uld(&tom_uld_info) == EBUSY) return (EBUSY); + if (ifaddr_evhandler) { + EVENTHANDLER_DEREGISTER(ifaddr_event, ifaddr_evhandler); + taskqueue_cancel_timeout(taskqueue_thread, &clip_task, NULL); + } + return (0); } #endif /* TCP_OFFLOAD */ Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Thu Apr 18 18:11:30 2013 (r249626) +++ head/sys/dev/cxgbe/tom/t4_tom.h Thu Apr 18 19:52:11 2013 (r249627) @@ -182,6 +182,7 @@ struct clip_entry { u_int refcount; }; +TAILQ_HEAD(clip_head, clip_entry); struct tom_data { struct toedev tod; @@ -201,7 +202,8 @@ struct tom_data { struct ppod_head ppods; struct mtx clip_table_lock; - TAILQ_HEAD(, clip_entry) clip_table; + struct clip_head clip_table; + int clip_gen; }; static inline struct tom_data * From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 20:13:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D4482723; Thu, 18 Apr 2013 20:13:33 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C68371B46; Thu, 18 Apr 2013 20:13:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3IKDXiR092400; Thu, 18 Apr 2013 20:13:33 GMT (envelope-from oleg@svn.freebsd.org) Received: (from oleg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3IKDX6E092399; Thu, 18 Apr 2013 20:13:33 GMT (envelope-from oleg@svn.freebsd.org) Message-Id: <201304182013.r3IKDX6E092399@svn.freebsd.org> From: Oleg Bulyzhin Date: Thu, 18 Apr 2013 20:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249628 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 20:13:33 -0000 Author: oleg Date: Thu Apr 18 20:13:33 2013 New Revision: 249628 URL: http://svnweb.freebsd.org/changeset/base/249628 Log: Recover missing arp_ifinit() call. MFC after: 2 weeks Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Thu Apr 18 19:52:11 2013 (r249627) +++ head/sys/net/if_vlan.c Thu Apr 18 20:13:33 2013 (r249628) @@ -41,6 +41,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet.h" #include "opt_vlan.h" #include @@ -66,6 +67,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef INET +#include +#include +#endif + #define VLAN_DEF_HWIDTH 4 #define VLAN_IFFLAGS (IFF_BROADCAST | IFF_MULTICAST) From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 22:54:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 65CB5DC3; Thu, 18 Apr 2013 22:54:42 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 58AAC893; Thu, 18 Apr 2013 22:54:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3IMsgpI041610; Thu, 18 Apr 2013 22:54:42 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3IMsgHt041609; Thu, 18 Apr 2013 22:54:42 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201304182254.r3IMsgHt041609@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 18 Apr 2013 22:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249629 - head/sys/dev/cxgbe/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 22:54:42 -0000 Author: np Date: Thu Apr 18 22:54:41 2013 New Revision: 249629 URL: http://svnweb.freebsd.org/changeset/base/249629 Log: cxgbe(4): Refuse to install T5 firmwares on a T4 card (and vice versa). MFC after: 1 week Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Thu Apr 18 20:13:33 2013 (r249628) +++ head/sys/dev/cxgbe/common/t4_hw.c Thu Apr 18 22:54:41 2013 (r249629) @@ -1136,6 +1136,13 @@ int t4_load_fw(struct adapter *adap, con FLASH_FW_MAX_SIZE); return -EFBIG; } + if ((is_t4(adap) && hdr->chip != FW_HDR_CHIP_T4) || + (is_t5(adap) && hdr->chip != FW_HDR_CHIP_T5)) { + CH_ERR(adap, + "FW image (%d) is not suitable for this adapter (%d)\n", + hdr->chip, chip_id(adap)); + return -EINVAL; + } for (csum = 0, i = 0; i < size / sizeof(csum); i++) csum += ntohl(p[i]); From owner-svn-src-head@FreeBSD.ORG Thu Apr 18 23:20:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F25EB490; Thu, 18 Apr 2013 23:20:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D3B93996; Thu, 18 Apr 2013 23:20:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3INKHhu049045; Thu, 18 Apr 2013 23:20:17 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3INKGG6049041; Thu, 18 Apr 2013 23:20:16 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201304182320.r3INKGG6049041@svn.freebsd.org> From: Rick Macklem Date: Thu, 18 Apr 2013 23:20:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249630 - in head/sys: fs/nfsclient nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 23:20:18 -0000 Author: rmacklem Date: Thu Apr 18 23:20:16 2013 New Revision: 249630 URL: http://svnweb.freebsd.org/changeset/base/249630 Log: When an NFS unmount occurs, once vflush() writes the last dirty buffer for the last vnode on the mount back to the server, it returns. At that point, the code continues with the unmount, including freeing up the nfs specific part of the mount structure. It is possible that an nfsiod thread will try to check for an empty I/O queue in the nfs specific part of the mount structure after it has been free'd by the unmount. This patch avoids this problem by setting the iodmount entries for the mount back to NULL while holding the mutex in the unmount and checking the appropriate entry is non-NULL after acquiring the mutex in the nfsiod thread. Reported and tested by: pho Reviewed by: kib MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clnfsiod.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/nfsclient/nfs_nfsiod.c head/sys/nfsclient/nfs_vfsops.c Modified: head/sys/fs/nfsclient/nfs_clnfsiod.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnfsiod.c Thu Apr 18 22:54:41 2013 (r249629) +++ head/sys/fs/nfsclient/nfs_clnfsiod.c Thu Apr 18 23:20:16 2013 (r249630) @@ -304,6 +304,14 @@ nfssvc_iod(void *instance) } mtx_lock(&ncl_iod_mutex); /* + * Make sure the nmp hasn't been dismounted as soon as + * ncl_doio() completes for the last buffer. + */ + nmp = ncl_iodmount[myiod]; + if (nmp == NULL) + break; + + /* * If there are more than one iod on this mount, then defect * so that the iods can be shared out fairly between the mounts */ Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Thu Apr 18 22:54:41 2013 (r249629) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Thu Apr 18 23:20:16 2013 (r249630) @@ -81,6 +81,9 @@ extern struct timeval nfsboottime; extern struct nfsstats newnfsstats; extern int nfsrv_useacl; extern int nfscl_debuglevel; +extern enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON]; +extern struct nfsmount *ncl_iodmount[NFS_MAXASYNCDAEMON]; +extern struct mtx ncl_iod_mutex; NFSCLSTATEMUTEX; MALLOC_DEFINE(M_NEWNFSREQ, "newnfsclient_req", "New NFS request header"); @@ -1472,7 +1475,7 @@ nfs_unmount(struct mount *mp, int mntfla { struct thread *td; struct nfsmount *nmp; - int error, flags = 0, trycnt = 0; + int error, flags = 0, i, trycnt = 0; struct nfsclds *dsp, *tdsp; td = curthread; @@ -1508,6 +1511,14 @@ nfs_unmount(struct mount *mp, int mntfla */ if ((mntflags & MNT_FORCE) == 0) nfscl_umount(nmp, td); + /* Make sure no nfsiods are assigned to this mount. */ + mtx_lock(&ncl_iod_mutex); + for (i = 0; i < NFS_MAXASYNCDAEMON; i++) + if (ncl_iodmount[i] == nmp) { + ncl_iodwant[i] = NFSIOD_AVAILABLE; + ncl_iodmount[i] = NULL; + } + mtx_unlock(&ncl_iod_mutex); newnfs_disconnect(&nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); FREE(nmp->nm_nam, M_SONAME); Modified: head/sys/nfsclient/nfs_nfsiod.c ============================================================================== --- head/sys/nfsclient/nfs_nfsiod.c Thu Apr 18 22:54:41 2013 (r249629) +++ head/sys/nfsclient/nfs_nfsiod.c Thu Apr 18 23:20:16 2013 (r249630) @@ -308,6 +308,14 @@ nfssvc_iod(void *instance) mtx_unlock(&Giant); mtx_lock(&nfs_iod_mtx); /* + * Make sure the nmp hasn't been dismounted as soon as + * nfs_doio() completes for the last buffer. + */ + nmp = nfs_iodmount[myiod]; + if (nmp == NULL) + break; + + /* * If there are more than one iod on this mount, then defect * so that the iods can be shared out fairly between the mounts */ Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Thu Apr 18 22:54:41 2013 (r249629) +++ head/sys/nfsclient/nfs_vfsops.c Thu Apr 18 23:20:16 2013 (r249630) @@ -1362,7 +1362,7 @@ static int nfs_unmount(struct mount *mp, int mntflags) { struct nfsmount *nmp; - int error, flags = 0; + int error, flags = 0, i; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; @@ -1387,6 +1387,14 @@ nfs_unmount(struct mount *mp, int mntfla /* * We are now committed to the unmount. */ + /* Make sure no nfsiods are assigned to this mount. */ + mtx_lock(&nfs_iod_mtx); + for (i = 0; i < NFS_MAXASYNCDAEMON; i++) + if (nfs_iodmount[i] == nmp) { + nfs_iodwant[i] = NFSIOD_AVAILABLE; + nfs_iodmount[i] = NULL; + } + mtx_unlock(&nfs_iod_mtx); nfs_disconnect(nmp); free(nmp->nm_nam, M_SONAME); From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 00:30:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D00FD24D; Fri, 19 Apr 2013 00:30:53 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A81E1D44; Fri, 19 Apr 2013 00:30:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3J0Ur0j070950; Fri, 19 Apr 2013 00:30:53 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3J0Uq5Z070946; Fri, 19 Apr 2013 00:30:52 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <201304190030.r3J0Uq5Z070946@svn.freebsd.org> From: "Andrey A. Chernov" Date: Fri, 19 Apr 2013 00:30:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249631 - in head/sys: dev/random libkern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 00:30:53 -0000 Author: ache Date: Fri Apr 19 00:30:52 2013 New Revision: 249631 URL: http://svnweb.freebsd.org/changeset/base/249631 Log: Attempt to mitigate poor initialization of arc4 by one-shot reinitialization from yarrow right after good entropy is harvested. Approved by: secteam (delphij) MFC after: 1 week Modified: head/sys/dev/random/randomdev_soft.c head/sys/libkern/arc4random.c head/sys/sys/libkern.h Modified: head/sys/dev/random/randomdev_soft.c ============================================================================== --- head/sys/dev/random/randomdev_soft.c Thu Apr 18 23:20:16 2013 (r249630) +++ head/sys/dev/random/randomdev_soft.c Fri Apr 19 00:30:52 2013 (r249631) @@ -367,6 +367,8 @@ random_yarrow_unblock(void) selwakeuppri(&random_systat.rsel, PUSER); wakeup(&random_systat); } + (void)atomic_cmpset_int(&arc4rand_iniseed_state, ARC4_ENTR_NONE, + ARC4_ENTR_HAVE); } static int Modified: head/sys/libkern/arc4random.c ============================================================================== --- head/sys/libkern/arc4random.c Thu Apr 18 23:20:16 2013 (r249630) +++ head/sys/libkern/arc4random.c Fri Apr 19 00:30:52 2013 (r249631) @@ -24,6 +24,8 @@ __FBSDID("$FreeBSD$"); #define ARC4_RESEED_SECONDS 300 #define ARC4_KEYBYTES (256 / 8) +int arc4rand_iniseed_state = ARC4_ENTR_NONE; + static u_int8_t arc4_i, arc4_j; static int arc4_numruns = 0; static u_int8_t arc4_sbox[256]; @@ -130,7 +132,8 @@ arc4rand(void *ptr, u_int len, int resee struct timeval tv; getmicrouptime(&tv); - if (reseed || + if (atomic_cmpset_int(&arc4rand_iniseed_state, ARC4_ENTR_HAVE, + ARC4_ENTR_SEED) || reseed || (arc4_numruns > ARC4_RESEED_BYTES) || (tv.tv_sec > arc4_t_reseed)) arc4_randomstir(); Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Thu Apr 18 23:20:16 2013 (r249630) +++ head/sys/sys/libkern.h Fri Apr 19 00:30:52 2013 (r249631) @@ -70,6 +70,11 @@ static __inline int abs(int a) { return static __inline long labs(long a) { return (a < 0 ? -a : a); } static __inline quad_t qabs(quad_t a) { return (a < 0 ? -a : a); } +#define ARC4_ENTR_NONE 0 /* Don't have entropy yet. */ +#define ARC4_ENTR_HAVE 1 /* Have entropy. */ +#define ARC4_ENTR_SEED 2 /* Reseeding. */ +extern int arc4rand_iniseed_state; + /* Prototypes for non-quad routines. */ struct malloc_type; uint32_t arc4random(void); From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 05:01:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 87C66B47; Fri, 19 Apr 2013 05:01:15 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7AEA68C4; Fri, 19 Apr 2013 05:01:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3J51EiY056808; Fri, 19 Apr 2013 05:01:14 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3J51Eo5056807; Fri, 19 Apr 2013 05:01:14 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201304190501.r3J51Eo5056807@svn.freebsd.org> From: Tim Kientzle Date: Fri, 19 Apr 2013 05:01:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249633 - head/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 05:01:15 -0000 Author: kientzle Date: Fri Apr 19 05:01:14 2013 New Revision: 249633 URL: http://svnweb.freebsd.org/changeset/base/249633 Log: Fix the symlink creation from r249484 so that repeated installs work correctly. Suggested by Tijl Coosemans. Modified: head/lib/Makefile Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Fri Apr 19 03:55:54 2013 (r249632) +++ head/lib/Makefile Fri Apr 19 05:01:14 2013 (r249633) @@ -253,6 +253,6 @@ _libusb= libusb .endif afterinstall: - ln -fs ../include ${DESTDIR}/usr/lib/include + ln -fs ../include ${DESTDIR}/usr/lib/ .include From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 05:13:58 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5B76FD6D; Fri, 19 Apr 2013 05:13:58 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4D648905; Fri, 19 Apr 2013 05:13:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3J5DwrI060632; Fri, 19 Apr 2013 05:13:58 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3J5DwFc060631; Fri, 19 Apr 2013 05:13:58 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201304190513.r3J5DwFc060631@svn.freebsd.org> From: Tim Kientzle Date: Fri, 19 Apr 2013 05:13:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249634 - head/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 05:13:58 -0000 Author: kientzle Date: Fri Apr 19 05:13:57 2013 New Revision: 249634 URL: http://svnweb.freebsd.org/changeset/base/249634 Log: An even more refined version of r249484, until we can come up with a good fix for the -print-file-name=include breakage. As suggested by Andrey Chernov. Modified: head/lib/Makefile Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Fri Apr 19 05:01:14 2013 (r249633) +++ head/lib/Makefile Fri Apr 19 05:13:57 2013 (r249634) @@ -253,6 +253,6 @@ _libusb= libusb .endif afterinstall: - ln -fs ../include ${DESTDIR}/usr/lib/ + ln -hfs ../include ${DESTDIR}/usr/lib/include .include From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 05:46:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 82208416; Fri, 19 Apr 2013 05:46:17 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 73B259B8; Fri, 19 Apr 2013 05:46:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3J5kHFm070050; Fri, 19 Apr 2013 05:46:17 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3J5kH7O070049; Fri, 19 Apr 2013 05:46:17 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201304190546.r3J5kH7O070049@svn.freebsd.org> From: Justin Hibbits Date: Fri, 19 Apr 2013 05:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249636 - head/sys/modules/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 05:46:17 -0000 Author: jhibbits Date: Fri Apr 19 05:46:16 2013 New Revision: 249636 URL: http://svnweb.freebsd.org/changeset/base/249636 Log: Fix the uart(4) module build. Without uart_dev_lpc the module cannot be loaded. Modified: head/sys/modules/uart/Makefile Modified: head/sys/modules/uart/Makefile ============================================================================== --- head/sys/modules/uart/Makefile Fri Apr 19 05:28:08 2013 (r249635) +++ head/sys/modules/uart/Makefile Fri Apr 19 05:46:16 2013 (r249636) @@ -23,7 +23,7 @@ KMOD= uart SRCS= uart_bus_acpi.c ${uart_bus_ebus} uart_bus_isa.c uart_bus_pccard.c \ uart_bus_pci.c uart_bus_puc.c uart_bus_scc.c \ uart_core.c ${uart_cpu_machine} uart_dbg.c \ - uart_dev_ns8250.c uart_dev_quicc.c uart_dev_sab82532.c \ + uart_dev_lpc.c uart_dev_ns8250.c uart_dev_quicc.c uart_dev_sab82532.c \ uart_dev_z8530.c \ uart_if.c uart_if.h uart_subr.c uart_tty.c From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 06:59:11 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3AF4648D; Fri, 19 Apr 2013 06:59:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2C8D8C3C; Fri, 19 Apr 2013 06:59:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3J6xBHO091782; Fri, 19 Apr 2013 06:59:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3J6xABE091780; Fri, 19 Apr 2013 06:59:10 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304190659.r3J6xABE091780@svn.freebsd.org> From: Adrian Chadd Date: Fri, 19 Apr 2013 06:59:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249639 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 06:59:11 -0000 Author: adrian Date: Fri Apr 19 06:59:10 2013 New Revision: 249639 URL: http://svnweb.freebsd.org/changeset/base/249639 Log: Use uint32_t for fields that are fetched via ath_hal_getcapability(). Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Apr 19 05:50:57 2013 (r249638) +++ head/sys/dev/ath/if_ath.c Fri Apr 19 06:59:10 2013 (r249639) @@ -739,7 +739,7 @@ ath_attach(u_int16_t devid, struct ath_s */ if (ath_hal_getcapability(ah, HAL_CAP_HT, 0, NULL) == HAL_OK && (wmodes & (HAL_MODE_HT20 | HAL_MODE_HT40))) { - int rxs, txs; + uint32_t rxs, txs; device_printf(sc->sc_dev, "[HT] enabling HT modes\n"); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Fri Apr 19 05:50:57 2013 (r249638) +++ head/sys/dev/ath/if_athvar.h Fri Apr 19 06:59:10 2013 (r249639) @@ -772,11 +772,11 @@ struct ath_softc { u_int32_t sc_avgtsfdeltap;/* TDMA slot adjust (+) */ u_int32_t sc_avgtsfdeltam;/* TDMA slot adjust (-) */ uint16_t *sc_eepromdata; /* Local eeprom data, if AR9100 */ - int sc_txchainmask; /* hardware TX chainmask */ - int sc_rxchainmask; /* hardware RX chainmask */ - int sc_cur_txchainmask; /* currently configured TX chainmask */ - int sc_cur_rxchainmask; /* currently configured RX chainmask */ - int sc_rts_aggr_limit; /* TX limit on RTS aggregates */ + uint32_t sc_txchainmask; /* hardware TX chainmask */ + uint32_t sc_rxchainmask; /* hardware RX chainmask */ + uint32_t sc_cur_txchainmask; /* currently configured TX chainmask */ + uint32_t sc_cur_rxchainmask; /* currently configured RX chainmask */ + uint32_t sc_rts_aggr_limit; /* TX limit on RTS aggregates */ int sc_aggr_limit; /* TX limit on all aggregates */ int sc_delim_min_pad; /* Minimum delimiter count */ From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 07:56:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 50A34113; Fri, 19 Apr 2013 07:56:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 43409F97; Fri, 19 Apr 2013 07:56:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3J7uN4Z010148; Fri, 19 Apr 2013 07:56:23 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3J7uNXd010147; Fri, 19 Apr 2013 07:56:23 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304190756.r3J7uNXd010147@svn.freebsd.org> From: Adrian Chadd Date: Fri, 19 Apr 2013 07:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249640 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 07:56:23 -0000 Author: adrian Date: Fri Apr 19 07:56:22 2013 New Revision: 249640 URL: http://svnweb.freebsd.org/changeset/base/249640 Log: Print out the chainmask configuration. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Apr 19 06:59:10 2013 (r249639) +++ head/sys/dev/ath/if_ath.c Fri Apr 19 07:56:22 2013 (r249640) @@ -781,6 +781,11 @@ ath_attach(u_int16_t devid, struct ath_s ath_hal_getrxchainmask(ah, &sc->sc_rxchainmask); ath_hal_gettxchainmask(ah, &sc->sc_txchainmask); + device_printf(sc->sc_dev, "Chainmasks: TX=0x%x; RX=0x%x\n", + __func__, + sc->sc_txchainmask, + sc->sc_rxchainmask); + ic->ic_txstream = txs; ic->ic_rxstream = rxs; From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 08:01:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 57B2D546; Fri, 19 Apr 2013 08:01:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4B123FF7; Fri, 19 Apr 2013 08:01:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3J81ZJl012741; Fri, 19 Apr 2013 08:01:35 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3J81Zhm012740; Fri, 19 Apr 2013 08:01:35 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304190801.r3J81Zhm012740@svn.freebsd.org> From: Adrian Chadd Date: Fri, 19 Apr 2013 08:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249641 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 08:01:35 -0000 Author: adrian Date: Fri Apr 19 08:01:34 2013 New Revision: 249641 URL: http://svnweb.freebsd.org/changeset/base/249641 Log: .. don't know how this snuck into this commit. Sorry. Fix compile build before anyone notices. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Apr 19 07:56:22 2013 (r249640) +++ head/sys/dev/ath/if_ath.c Fri Apr 19 08:01:34 2013 (r249641) @@ -782,7 +782,6 @@ ath_attach(u_int16_t devid, struct ath_s ath_hal_gettxchainmask(ah, &sc->sc_txchainmask); device_printf(sc->sc_dev, "Chainmasks: TX=0x%x; RX=0x%x\n", - __func__, sc->sc_txchainmask, sc->sc_rxchainmask); From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 08:06:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ADA9F780; Fri, 19 Apr 2013 08:06:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A0B9DB0; Fri, 19 Apr 2013 08:06:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3J86joQ013668; Fri, 19 Apr 2013 08:06:45 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3J86jOa013667; Fri, 19 Apr 2013 08:06:45 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304190806.r3J86jOa013667@svn.freebsd.org> From: Adrian Chadd Date: Fri, 19 Apr 2013 08:06:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249642 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 08:06:45 -0000 Author: adrian Date: Fri Apr 19 08:06:45 2013 New Revision: 249642 URL: http://svnweb.freebsd.org/changeset/base/249642 Log: Add a debug statement to log the currently chosen chainmask configuration. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Apr 19 08:01:34 2013 (r249641) +++ head/sys/dev/ath/if_ath.c Fri Apr 19 08:06:45 2013 (r249642) @@ -1529,6 +1529,12 @@ ath_update_chainmasks(struct ath_softc * } else { sc->sc_cur_txchainmask = 1; } + + DPRINTF(sc, ATH_DEBUG_RESET, + "%s: TX chainmask is now 0x%x, RX is now 0x%x\n", + __func__, + sc->sc_cur_txchainmask, + sc->sc_cur_rxchainmask); } void From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 10:16:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 154156CC; Fri, 19 Apr 2013 10:16:01 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E29849F3; Fri, 19 Apr 2013 10:16:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3JAG0HZ097655; Fri, 19 Apr 2013 10:16:00 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3JAG0wI097651; Fri, 19 Apr 2013 10:16:00 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201304191016.r3JAG0wI097651@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 19 Apr 2013 10:16:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249644 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 10:16:01 -0000 Author: jilles Date: Fri Apr 19 10:16:00 2013 New Revision: 249644 URL: http://svnweb.freebsd.org/changeset/base/249644 Log: sem: Restart the POSIX sem_* calls after signals with SA_RESTART set. Programs often do not expect an [EINTR] return from sem_wait() and POSIX only allows it if the signal was installed without SA_RESTART. The timeout in sem_timedwait() is absolute so it can be restarted normally. The umtx call can be invoked with a relative timeout and in that case [ERESTART] must be changed to [EINTR]. However, libc does not do this. The old POSIX semaphore implementation did this correctly (before r249566), unlike the new umtx one. It may be desirable to avoid [EINTR] completely, which matches the pthread functions and is explicitly permitted by POSIX. However, the kernel must return [EINTR] at least for signals with SA_RESTART clear, otherwise pthread cancellation will not abort a semaphore wait. In this commit, only restore the 8.x behaviour which is also permitted by POSIX. Discussed with: jhb MFC after: 1 week Modified: head/sys/kern/kern_umtx.c head/sys/kern/uipc_sem.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Fri Apr 19 09:19:10 2013 (r249643) +++ head/sys/kern/kern_umtx.c Fri Apr 19 10:16:00 2013 (r249644) @@ -2980,7 +2980,9 @@ do_sem_wait(struct thread *td, struct _u error = 0; else { umtxq_remove(uq); - if (error == ERESTART) + /* A relative timeout cannot be restarted. */ + if (error == ERESTART && timeout != NULL && + (timeout->_flags & UMTX_ABSTIME) == 0) error = EINTR; } umtxq_unlock(&uq->uq_key); Modified: head/sys/kern/uipc_sem.c ============================================================================== --- head/sys/kern/uipc_sem.c Fri Apr 19 09:19:10 2013 (r249643) +++ head/sys/kern/uipc_sem.c Fri Apr 19 10:16:00 2013 (r249644) @@ -846,8 +846,6 @@ kern_sem_wait(struct thread *td, semid_t err: mtx_unlock(&sem_lock); fdrop(fp, td); - if (error == ERESTART) - error = EINTR; DP(("<<< kern_sem_wait leaving, pid=%d, error = %d\n", (int)td->td_proc->p_pid, error)); return (error); From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 13:40:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D5DA77D1; Fri, 19 Apr 2013 13:40:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C9440330; Fri, 19 Apr 2013 13:40:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3JDeDdD043470; Fri, 19 Apr 2013 13:40:13 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3JDeD9h043466; Fri, 19 Apr 2013 13:40:13 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201304191340.r3JDeD9h043466@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 19 Apr 2013 13:40:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249649 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 13:40:13 -0000 Author: glebius Date: Fri Apr 19 13:40:13 2013 New Revision: 249649 URL: http://svnweb.freebsd.org/changeset/base/249649 Log: Don't compare unsigned socklen_t against < 0. Reviewed by: jhb Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Fri Apr 19 11:56:25 2013 (r249648) +++ head/sys/kern/uipc_syscalls.c Fri Apr 19 13:40:13 2013 (r249649) @@ -382,11 +382,8 @@ kern_accept(struct thread *td, int s, st pid_t pgid; int tmp; - if (name) { + if (name) *name = NULL; - if (*namelen < 0) - return (EINVAL); - } AUDIT_ARG_FD(s); fdp = td->td_proc->p_fd; @@ -1565,9 +1562,6 @@ kern_getsockname(struct thread *td, int socklen_t len; int error; - if (*alen < 0) - return (EINVAL); - AUDIT_ARG_FD(fd); error = getsock_cap(td->td_proc->p_fd, fd, CAP_GETSOCKNAME, &fp, NULL); if (error) @@ -1665,9 +1659,6 @@ kern_getpeername(struct thread *td, int socklen_t len; int error; - if (*alen < 0) - return (EINVAL); - AUDIT_ARG_FD(fd); error = getsock_cap(td->td_proc->p_fd, fd, CAP_GETPEERNAME, &fp, NULL); if (error) From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 14:04:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 85475D29; Fri, 19 Apr 2013 14:04:02 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) by mx1.freebsd.org (Postfix) with ESMTP id A18363A7; Fri, 19 Apr 2013 14:04:01 +0000 (UTC) Received: by mail-wi0-f171.google.com with SMTP id l13so863425wie.16 for ; Fri, 19 Apr 2013 07:04:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=H3Qk7cPOlsogNg+FEQX7Qc2rZ6xEjTKPEMs1kfdRkr4=; b=EnJ0XRbxnGTHgWO4szsYNWX4ukMU9BawAamT0P26xcUI5nPfGhmOovsJTFUQ+UuMoq iftcAhkWsJ8vlgziSBkDRL338PY2+jBq7sk/25uKjintxchGkOJ5Rs1wNTHZfz/2r2Db X6JMHq/AxVGZ0OJL5AUg5HCtBw6kkNAuTJLxp5uczFVJNRiKNzIXBgDoZvj7cqdxL/fQ xgMiWWUx45fiHfHA/6PLTVT0MjPk4Nf5GpGkLqyqPlLgtwcpcIy1kVy2oCQyasQKyvkI EnkDI1s/XtWqOfa9/IRMjkLd3s39INiCTLpd9TEQd0uiR2EaoCfFNldOkhrbG2fS8v5m YLJA== MIME-Version: 1.0 X-Received: by 10.180.103.65 with SMTP id fu1mr25606261wib.4.1366380240783; Fri, 19 Apr 2013 07:04:00 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.194.86.167 with HTTP; Fri, 19 Apr 2013 07:04:00 -0700 (PDT) In-Reply-To: <201304191340.r3JDeD9h043466@svn.freebsd.org> References: <201304191340.r3JDeD9h043466@svn.freebsd.org> Date: Fri, 19 Apr 2013 18:04:00 +0400 X-Google-Sender-Auth: R5HPs_uNXf1gZZ_4OJYNT75p7qc Message-ID: Subject: Re: svn commit: r249649 - head/sys/kern From: Sergey Kandaurov To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 14:04:02 -0000 On 19 April 2013 17:40, Gleb Smirnoff wrote: > Author: glebius > Date: Fri Apr 19 13:40:13 2013 > New Revision: 249649 > URL: http://svnweb.freebsd.org/changeset/base/249649 > > Log: > Don't compare unsigned socklen_t against < 0. > > Reviewed by: jhb > Thank you. This is long overdue since socklen_t. You may also want to update man page. Index: lib/libc/sys/accept.2 =================================================================== --- lib/libc/sys/accept.2 (revision 245745) +++ lib/libc/sys/accept.2 (working copy) @@ -28,7 +28,7 @@ .\" @(#)accept.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd December 11, 1993 +.Dd February 20, 2013 .Dt ACCEPT 2 .Os .Sh NAME @@ -154,10 +154,6 @@ The descriptor references a file, not a socket. .It Bq Er EINVAL .Xr listen 2 has not been called on the socket descriptor. -.It Bq Er EINVAL -The -.Fa addrlen -argument is negative. .It Bq Er EFAULT The .Fa addr -- wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 15:19:30 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 09B119B7; Fri, 19 Apr 2013 15:19:30 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F0F2F78D; Fri, 19 Apr 2013 15:19:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3JFJTvP076104; Fri, 19 Apr 2013 15:19:29 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3JFJTXi076103; Fri, 19 Apr 2013 15:19:29 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201304191519.r3JFJTXi076103@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 19 Apr 2013 15:19:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249650 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 15:19:30 -0000 Author: jh Date: Fri Apr 19 15:19:29 2013 New Revision: 249650 URL: http://svnweb.freebsd.org/changeset/base/249650 Log: Include PID in the error message which is printed when the maxproc limit is exceeded. Improve formatting of the message while here. PR: kern/60550 Submitted by: Lowell Gilbert, bde Modified: head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Fri Apr 19 13:40:13 2013 (r249649) +++ head/sys/kern/kern_fork.c Fri Apr 19 15:19:29 2013 (r249650) @@ -930,8 +930,8 @@ fork1(struct thread *td, int flags, int fail: sx_sunlock(&proctree_lock); if (ppsratecheck(&lastfail, &curfail, 1)) - printf("maxproc limit exceeded by uid %i, please see tuning(7) and login.conf(5).\n", - td->td_ucred->cr_ruid); + printf("maxproc limit exceeded by uid %u (pid %d); see tuning(7) and login.conf(5)\n", + td->td_ucred->cr_ruid, p1->p_pid); sx_xunlock(&allproc_lock); #ifdef MAC mac_proc_destroy(newproc); From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 15:42:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B3ADB5B8; Fri, 19 Apr 2013 15:42:23 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id 8D79DABD; Fri, 19 Apr 2013 15:42:23 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id r3J4oZmS084018; Fri, 19 Apr 2013 04:50:35 GMT (envelope-from kientzle@freebsd.org) Received: from [192.168.2.123] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id xdzbter7edbb8atavpcv2f8ygi; Fri, 19 Apr 2013 04:50:35 +0000 (UTC) (envelope-from kientzle@freebsd.org) Subject: Re: svn commit: r249484 - head/lib Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-1 From: Tim Kientzle In-Reply-To: <1FEABB1B-ADDE-412A-9D40-F9FB2822B654@freebsd.org> Date: Thu, 18 Apr 2013 21:50:33 -0700 Content-Transfer-Encoding: 7bit Message-Id: <647B67E8-152A-47A8-89E4-E15075D20992@freebsd.org> References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <516D54F5.4010501@FreeBSD.org> <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> <516E900B.9090300@FreeBSD.org> <1FEABB1B-ADDE-412A-9D40-F9FB2822B654@freebsd.org> To: Dimitry Andric X-Mailer: Apple Mail (2.1283) Cc: Ed Schouten , src-committers@freebsd.org, Juli Mallett , svn-src-all@freebsd.org, Brooks Davis , svn-src-head@freebsd.org, Tijl Coosemans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 15:42:23 -0000 On Apr 17, 2013, at 10:33 AM, Dimitry Andric wrote: > In any case, the layout has been like this since the initial clangbsd > import, and I never saw any reason to change it. Maybe Ed can tell a > bit more, since he seems to have done the initial infrastructure setup. FreeBSD/ARM just switched from GCC to Clang, which is why this just got noticed. U-Boot is used quite heavily for FreeBSD/ARM (and MIPS and PowerPC as well, I believe). Here are the options I see for getting cc -print-file-name=include to work again: * Hack clang to handle -print-file-name=include specially. I did this for GCC already, but I'm not thrilled about it. * Configure clang differently so that this option works. * Symlink /usr/include to appear somewhere that clang expects. * Rearrange our directory layout slightly to match clang's expectations. Tim From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 17:43:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 79593ECB; Fri, 19 Apr 2013 17:43:53 +0000 (UTC) (envelope-from dim@freebsd.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) by mx1.freebsd.org (Postfix) with ESMTP id 235305EB; Fri, 19 Apr 2013 15:57:37 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::a412:6300:63d9:cff8] (unknown [IPv6:2001:7b8:3a7:0:a412:6300:63d9:cff8]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id A48015C44; Fri, 19 Apr 2013 17:57:34 +0200 (CEST) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: svn commit: r249484 - head/lib From: Dimitry Andric In-Reply-To: <647B67E8-152A-47A8-89E4-E15075D20992@freebsd.org> Date: Fri, 19 Apr 2013 17:57:11 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201304141913.r3EJDqPI095965@svn.freebsd.org> <516D54F5.4010501@FreeBSD.org> <2A0FC59F-E043-4B4E-BABE-E16C6A1FBF5C@freebsd.org> <475555FA-DF6A-42FA-990D-4224ECAEAE52@FreeBSD.org> <516E900B.9090300@FreeBSD.org> <1FEABB1B-ADDE-412A-9D40-F9FB2822B654@freebsd.org> <647B67E8-152A-47A8-89E4-E15075D20992@freebsd.org> To: Tim Kientzle X-Mailer: Apple Mail (2.1503) Cc: Ed Schouten , src-committers@freebsd.org, Juli Mallett , svn-src-all@freebsd.org, Brooks Davis , svn-src-head@freebsd.org, Tijl Coosemans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 17:43:53 -0000 On Apr 19, 2013, at 06:50, Tim Kientzle wrote: > On Apr 17, 2013, at 10:33 AM, Dimitry Andric wrote: >=20 >> In any case, the layout has been like this since the initial clangbsd >> import, and I never saw any reason to change it. Maybe Ed can tell a >> bit more, since he seems to have done the initial infrastructure = setup. >=20 > FreeBSD/ARM just switched from GCC to Clang, which is > why this just got noticed. U-Boot is used quite heavily for > FreeBSD/ARM (and MIPS and PowerPC as well, I believe). >=20 > Here are the options I see for getting > cc -print-file-name=3Dinclude > to work again: >=20 > * Hack clang to handle -print-file-name=3Dinclude specially. > I did this for GCC already, but I'm not thrilled about it. >=20 > * Configure clang differently so that this option works. >=20 > * Symlink /usr/include to appear somewhere that clang expects. >=20 > * Rearrange our directory layout slightly to match clang's = expectations. You seem to have left out the most obvious one: * Fixing U-Boot's configuration script(s) so they don't depend on = undocumented compiler options. I don't understand why we would want to go through all this trouble, = just for telling U-Boot where a bunch of headers are located? What = happened to configure scripts with options, they did not disappear = overnight, I hope? From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 17:50:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9810FDAE; Fri, 19 Apr 2013 17:50:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 868E5967; Fri, 19 Apr 2013 17:50:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3JHodKp079541; Fri, 19 Apr 2013 17:50:39 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3JHodn4079533; Fri, 19 Apr 2013 17:50:39 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304191750.r3JHodn4079533@svn.freebsd.org> From: Adrian Chadd Date: Fri, 19 Apr 2013 17:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249651 - in head/sys: conf dev/etherswitch/ukswitch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 17:50:39 -0000 Author: adrian Date: Fri Apr 19 17:50:38 2013 New Revision: 249651 URL: http://svnweb.freebsd.org/changeset/base/249651 Log: Implement a very basic multi-PHY aware switch device. This is intended to be used as a stop-gap for switch devices which expose multiple ethernet PHYs but we don't have a driver for - here, etherswitchcfg and the general switch configuration API can be used to interface to said PHYs. Submitted by: Luiz Otavio O Souza Added: head/sys/dev/etherswitch/ukswitch/ head/sys/dev/etherswitch/ukswitch/ukswitch.c (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Apr 19 15:19:29 2013 (r249650) +++ head/sys/conf/files Fri Apr 19 17:50:38 2013 (r249651) @@ -1284,6 +1284,7 @@ dev/etherswitch/mdio_if.m optional miip dev/etherswitch/mdio.c optional miiproxy dev/etherswitch/miiproxy.c optional miiproxy dev/etherswitch/rtl8366/rtl8366rb.c optional rtl8366rb +dev/etherswitch/ukswitch/ukswitch.c optional ukswitch dev/ex/if_ex.c optional ex dev/ex/if_ex_isa.c optional ex isa dev/ex/if_ex_pccard.c optional ex pccard Added: head/sys/dev/etherswitch/ukswitch/ukswitch.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/etherswitch/ukswitch/ukswitch.c Fri Apr 19 17:50:38 2013 (r249651) @@ -0,0 +1,570 @@ +/*- + * Copyright (c) 2013 Luiz Otavio O Souza. + * Copyright (c) 2011-2012 Stefan Bethke. + * Copyright (c) 2012 Adrian Chadd. + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "mdio_if.h" +#include "miibus_if.h" +#include "etherswitch_if.h" + +MALLOC_DECLARE(M_UKSWITCH); +MALLOC_DEFINE(M_UKSWITCH, "ukswitch", "ukswitch data structures"); + +struct ukswitch_softc { + struct mtx sc_mtx; /* serialize access to softc */ + device_t sc_dev; + int media; /* cpu port media */ + int cpuport; /* which PHY is connected to the CPU */ + int phymask; /* PHYs we manage */ + int numports; /* number of ports */ + int ifpport[MII_NPHY]; + int *portphy; + char **ifname; + device_t **miibus; + struct ifnet **ifp; + struct callout callout_tick; + etherswitch_info_t info; +}; + +#define UKSWITCH_LOCK(_sc) \ + mtx_lock(&(_sc)->sc_mtx) +#define UKSWITCH_UNLOCK(_sc) \ + mtx_unlock(&(_sc)->sc_mtx) +#define UKSWITCH_LOCK_ASSERT(_sc, _what) \ + mtx_assert(&(_sc)->sc_mtx, (_what)) +#define UKSWITCH_TRYLOCK(_sc) \ + mtx_trylock(&(_sc)->sc_mtx) + +#if defined(DEBUG) +#define DPRINTF(dev, args...) device_printf(dev, args) +#else +#define DPRINTF(dev, args...) +#endif + +static inline int ukswitch_portforphy(struct ukswitch_softc *, int); +static void ukswitch_tick(void *); +static int ukswitch_ifmedia_upd(struct ifnet *); +static void ukswitch_ifmedia_sts(struct ifnet *, struct ifmediareq *); + +static int +ukswitch_probe(device_t dev) +{ + struct ukswitch_softc *sc; + + sc = device_get_softc(dev); + bzero(sc, sizeof(*sc)); + + device_set_desc_copy(dev, "Generic MDIO switch driver"); + return (BUS_PROBE_DEFAULT); +} + +static int +ukswitch_attach_phys(struct ukswitch_softc *sc) +{ + int phy, port = 0, err = 0; + char name[IFNAMSIZ]; + + /* PHYs need an interface, so we generate a dummy one */ + snprintf(name, IFNAMSIZ, "%sport", device_get_nameunit(sc->sc_dev)); + for (phy = 0; phy < MII_NPHY; phy++) { + if (((1 << phy) & sc->phymask) == 0) + continue; + sc->ifpport[phy] = port; + sc->portphy[port] = phy; +// if (phy == sc->cpuport) +// sc->info.es_cpuport = port; + sc->ifp[port] = if_alloc(IFT_ETHER); + sc->ifp[port]->if_softc = sc; + sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | + IFF_DRV_RUNNING | IFF_SIMPLEX; + sc->ifname[port] = malloc(strlen(name)+1, M_UKSWITCH, M_WAITOK); + bcopy(name, sc->ifname[port], strlen(name)+1); + if_initname(sc->ifp[port], sc->ifname[port], port); + sc->miibus[port] = malloc(sizeof(device_t), M_UKSWITCH, + M_WAITOK | M_ZERO); + err = mii_attach(sc->sc_dev, sc->miibus[port], sc->ifp[port], + ukswitch_ifmedia_upd, ukswitch_ifmedia_sts, \ + BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); + DPRINTF(sc->sc_dev, "%s attached to pseudo interface %s\n", + device_get_nameunit(*sc->miibus[port]), + sc->ifp[port]->if_xname); + if (err != 0) { + device_printf(sc->sc_dev, + "attaching PHY %d failed\n", + phy); + break; + } + sc->info.es_nports = port + 1; + if (++port >= sc->numports) + break; + } + return (err); +} + +static int +ukswitch_attach(device_t dev) +{ + struct ukswitch_softc *sc; + int err = 0; + + sc = device_get_softc(dev); + + sc->sc_dev = dev; + mtx_init(&sc->sc_mtx, "ukswitch", NULL, MTX_DEF); + strlcpy(sc->info.es_name, device_get_desc(dev), + sizeof(sc->info.es_name)); + + /* XXX Defaults */ + sc->numports = 6; + sc->phymask = 0x0f; + sc->cpuport = 5; + sc->media = 100; + + (void) resource_int_value(device_get_name(dev), device_get_unit(dev), + "numports", &sc->numports); + (void) resource_int_value(device_get_name(dev), device_get_unit(dev), + "phymask", &sc->phymask); + (void) resource_int_value(device_get_name(dev), device_get_unit(dev), + "cpuport", &sc->cpuport); + (void) resource_int_value(device_get_name(dev), device_get_unit(dev), + "media", &sc->media); + + /* Support only fast and giga ethernet. */ + if (sc->media != 100 && sc->media != 1000) + sc->media = 100; + + /* Always attach the cpu port. */ + sc->phymask |= (1 << sc->cpuport); +// sc->info.es_cpuport = sc->cpuport; + + /* We do not support any vlan groups. */ + sc->info.es_nvlangroups = 0; + + sc->ifp = malloc(sizeof(struct ifnet *) * sc->numports, M_UKSWITCH, + M_WAITOK | M_ZERO); + sc->ifname = malloc(sizeof(char *) * sc->numports, M_UKSWITCH, + M_WAITOK | M_ZERO); + sc->miibus = malloc(sizeof(device_t *) * sc->numports, M_UKSWITCH, + M_WAITOK | M_ZERO); + sc->portphy = malloc(sizeof(int) * sc->numports, M_UKSWITCH, + M_WAITOK | M_ZERO); + + /* + * Attach the PHYs and complete the bus enumeration. + */ + err = ukswitch_attach_phys(sc); + if (err != 0) + return (err); + + bus_generic_probe(dev); + bus_enumerate_hinted_children(dev); + err = bus_generic_attach(dev); + if (err != 0) + return (err); + + callout_init(&sc->callout_tick, 0); + + ukswitch_tick(sc); + + return (err); +} + +static int +ukswitch_detach(device_t dev) +{ + struct ukswitch_softc *sc = device_get_softc(dev); + int i, port; + + callout_drain(&sc->callout_tick); + + for (i=0; i < MII_NPHY; i++) { + if (((1 << i) & sc->phymask) == 0) + continue; + port = ukswitch_portforphy(sc, i); + if (sc->miibus[port] != NULL) + device_delete_child(dev, (*sc->miibus[port])); + if (sc->ifp[port] != NULL) + if_free(sc->ifp[port]); + free(sc->ifname[port], M_UKSWITCH); + free(sc->miibus[port], M_UKSWITCH); + } + + free(sc->portphy, M_UKSWITCH); + free(sc->miibus, M_UKSWITCH); + free(sc->ifname, M_UKSWITCH); + free(sc->ifp, M_UKSWITCH); + + bus_generic_detach(dev); + mtx_destroy(&sc->sc_mtx); + + return (0); +} + +/* + * Convert PHY number to port number. + */ +static inline int +ukswitch_portforphy(struct ukswitch_softc *sc, int phy) +{ + + return (sc->ifpport[phy]); +} + +static inline struct mii_data * +ukswitch_miiforport(struct ukswitch_softc *sc, int port) +{ + + if (port < 0 || port > sc->numports) + return (NULL); + return (device_get_softc(*sc->miibus[port])); +} + +static inline struct ifnet * +ukswitch_ifpforport(struct ukswitch_softc *sc, int port) +{ + + if (port < 0 || port > sc->numports) + return (NULL); + return (sc->ifp[port]); +} + +/* + * Poll the status for all PHYs. + */ +static void +ukswitch_miipollstat(struct ukswitch_softc *sc) +{ + int i, port; + struct mii_data *mii; + struct mii_softc *miisc; + + UKSWITCH_LOCK_ASSERT(sc, MA_NOTOWNED); + + for (i = 0; i < MII_NPHY; i++) { + if (((1 << i) & sc->phymask) == 0) + continue; + port = ukswitch_portforphy(sc, i); + if ((*sc->miibus[port]) == NULL) + continue; + mii = device_get_softc(*sc->miibus[port]); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) { + if (IFM_INST(mii->mii_media.ifm_cur->ifm_media) != + miisc->mii_inst) + continue; + ukphy_status(miisc); + mii_phy_update(miisc, MII_POLLSTAT); + } + } +} + +static void +ukswitch_tick(void *arg) +{ + struct ukswitch_softc *sc = arg; + + ukswitch_miipollstat(sc); + callout_reset(&sc->callout_tick, hz, ukswitch_tick, sc); +} + +static void +ukswitch_lock(device_t dev) +{ + struct ukswitch_softc *sc = device_get_softc(dev); + + UKSWITCH_LOCK_ASSERT(sc, MA_NOTOWNED); + UKSWITCH_LOCK(sc); +} + +static void +ukswitch_unlock(device_t dev) +{ + struct ukswitch_softc *sc = device_get_softc(dev); + + UKSWITCH_LOCK_ASSERT(sc, MA_OWNED); + UKSWITCH_UNLOCK(sc); +} + +static etherswitch_info_t * +ukswitch_getinfo(device_t dev) +{ + struct ukswitch_softc *sc = device_get_softc(dev); + + return (&sc->info); +} + +static int +ukswitch_getport(device_t dev, etherswitch_port_t *p) +{ + struct ukswitch_softc *sc = device_get_softc(dev); + struct mii_data *mii; + struct ifmediareq *ifmr = &p->es_ifmr; + int err; + + if (p->es_port < 0 || p->es_port >= sc->numports) + return (ENXIO); + p->es_vlangroup = 0; + + mii = ukswitch_miiforport(sc, p->es_port); + if (sc->portphy[p->es_port] == sc->cpuport) { + /* fill in fixed values for CPU port */ + ifmr->ifm_count = 0; + if (sc->media == 100) + ifmr->ifm_current = ifmr->ifm_active = + IFM_ETHER | IFM_100_TX | IFM_FDX; + else + ifmr->ifm_current = ifmr->ifm_active = + IFM_ETHER | IFM_1000_T | IFM_FDX; + ifmr->ifm_mask = 0; + ifmr->ifm_status = IFM_ACTIVE | IFM_AVALID; + } else if (mii != NULL) { + err = ifmedia_ioctl(mii->mii_ifp, &p->es_ifr, + &mii->mii_media, SIOCGIFMEDIA); + if (err) + return (err); + } else { + return (ENXIO); + } + return (0); +} + +static int +ukswitch_setport(device_t dev, etherswitch_port_t *p) +{ + struct ukswitch_softc *sc = device_get_softc(dev); + struct ifmedia *ifm; + struct mii_data *mii; + struct ifnet *ifp; + int err; + + if (p->es_port < 0 || p->es_port >= sc->numports) + return (ENXIO); + + if (sc->portphy[p->es_port] == sc->cpuport) + return (ENXIO); + + mii = ukswitch_miiforport(sc, p->es_port); + if (mii == NULL) + return (ENXIO); + + ifp = ukswitch_ifpforport(sc, p->es_port); + + ifm = &mii->mii_media; + err = ifmedia_ioctl(ifp, &p->es_ifr, ifm, SIOCSIFMEDIA); + return (err); +} + +static int +ukswitch_getvgroup(device_t dev, etherswitch_vlangroup_t *vg) +{ + + /* Not supported. */ + vg->es_vid = 0; + vg->es_member_ports = 0; + vg->es_untagged_ports = 0; + vg->es_fid = 0; + return (0); +} + +static int +ukswitch_setvgroup(device_t dev, etherswitch_vlangroup_t *vg) +{ + + /* Not supported. */ + return (0); +} + +static void +ukswitch_statchg(device_t dev) +{ + + DPRINTF(dev, "%s\n", __func__); +} + +static int +ukswitch_ifmedia_upd(struct ifnet *ifp) +{ + struct ukswitch_softc *sc = ifp->if_softc; + struct mii_data *mii = ukswitch_miiforport(sc, ifp->if_dunit); + + DPRINTF(sc->sc_dev, "%s\n", __func__); + if (mii == NULL) + return (ENXIO); + mii_mediachg(mii); + return (0); +} + +static void +ukswitch_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + struct ukswitch_softc *sc = ifp->if_softc; + struct mii_data *mii = ukswitch_miiforport(sc, ifp->if_dunit); + + DPRINTF(sc->sc_dev, "%s\n", __func__); + + if (mii == NULL) + return; + mii_pollstat(mii); + ifmr->ifm_active = mii->mii_media_active; + ifmr->ifm_status = mii->mii_media_status; +} + +static int +ukswitch_readphy(device_t dev, int phy, int reg) +{ + struct ukswitch_softc *sc; + int data; + + sc = device_get_softc(dev); + UKSWITCH_LOCK_ASSERT(sc, MA_NOTOWNED); + + if (phy < 0 || phy >= 32) + return (ENXIO); + if (reg < 0 || reg >= 32) + return (ENXIO); + + UKSWITCH_LOCK(sc); + data = MDIO_READREG(device_get_parent(dev), phy, reg); + UKSWITCH_UNLOCK(sc); + + return (data); +} + +static int +ukswitch_writephy(device_t dev, int phy, int reg, int data) +{ + struct ukswitch_softc *sc; + int err; + + sc = device_get_softc(dev); + UKSWITCH_LOCK_ASSERT(sc, MA_NOTOWNED); + + if (phy < 0 || phy >= 32) + return (ENXIO); + if (reg < 0 || reg >= 32) + return (ENXIO); + + UKSWITCH_LOCK(sc); + err = MDIO_WRITEREG(device_get_parent(dev), phy, reg, data); + UKSWITCH_UNLOCK(sc); + + return (err); +} + +static int +ukswitch_readreg(device_t dev, int addr) +{ + struct ukswitch_softc *sc; + + sc = device_get_softc(dev); + UKSWITCH_LOCK_ASSERT(sc, MA_OWNED); + + /* Not supported. */ + return (0); +} + +static int +ukswitch_writereg(device_t dev, int addr, int value) +{ + struct ukswitch_softc *sc; + + sc = device_get_softc(dev); + UKSWITCH_LOCK_ASSERT(sc, MA_OWNED); + + /* Not supported. */ + return (0); +} + +static device_method_t ukswitch_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ukswitch_probe), + DEVMETHOD(device_attach, ukswitch_attach), + DEVMETHOD(device_detach, ukswitch_detach), + + /* bus interface */ + DEVMETHOD(bus_add_child, device_add_child_ordered), + + /* MII interface */ + DEVMETHOD(miibus_readreg, ukswitch_readphy), + DEVMETHOD(miibus_writereg, ukswitch_writephy), + DEVMETHOD(miibus_statchg, ukswitch_statchg), + + /* MDIO interface */ + DEVMETHOD(mdio_readreg, ukswitch_readphy), + DEVMETHOD(mdio_writereg, ukswitch_writephy), + + /* etherswitch interface */ + DEVMETHOD(etherswitch_lock, ukswitch_lock), + DEVMETHOD(etherswitch_unlock, ukswitch_unlock), + DEVMETHOD(etherswitch_getinfo, ukswitch_getinfo), + DEVMETHOD(etherswitch_readreg, ukswitch_readreg), + DEVMETHOD(etherswitch_writereg, ukswitch_writereg), + DEVMETHOD(etherswitch_readphyreg, ukswitch_readphy), + DEVMETHOD(etherswitch_writephyreg, ukswitch_writephy), + DEVMETHOD(etherswitch_getport, ukswitch_getport), + DEVMETHOD(etherswitch_setport, ukswitch_setport), + DEVMETHOD(etherswitch_getvgroup, ukswitch_getvgroup), + DEVMETHOD(etherswitch_setvgroup, ukswitch_setvgroup), + + DEVMETHOD_END +}; + +DEFINE_CLASS_0(ukswitch, ukswitch_driver, ukswitch_methods, + sizeof(struct ukswitch_softc)); +static devclass_t ukswitch_devclass; + +DRIVER_MODULE(ukswitch, mdio, ukswitch_driver, ukswitch_devclass, 0, 0); +DRIVER_MODULE(miibus, ukswitch, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE(mdio, ukswitch, mdio_driver, mdio_devclass, 0, 0); +DRIVER_MODULE(etherswitch, ukswitch, etherswitch_driver, etherswitch_devclass, 0, 0); +MODULE_VERSION(ukswitch, 1); +MODULE_DEPEND(ukswitch, miibus, 1, 1, 1); /* XXX which versions? */ +MODULE_DEPEND(ukswitch, etherswitch, 1, 1, 1); /* XXX which versions? */ From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 19:38:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 031644A5; Fri, 19 Apr 2013 19:38:41 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D8AB61A5C; Fri, 19 Apr 2013 19:38:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3JJceBC070550; Fri, 19 Apr 2013 19:38:40 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3JJcekZ070531; Fri, 19 Apr 2013 19:38:40 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201304191938.r3JJcekZ070531@svn.freebsd.org> From: Ed Schouten Date: Fri, 19 Apr 2013 19:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249656 - head/cddl/contrib/opensolaris/tools/ctf/cvt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 19:38:41 -0000 Author: ed Date: Fri Apr 19 19:38:39 2013 New Revision: 249656 URL: http://svnweb.freebsd.org/changeset/base/249656 Log: Fix -Wmissing-variable-declarations compiler warnings. References: https://www.illumos.org/issues/3700 Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c head/cddl/contrib/opensolaris/tools/ctf/cvt/st_parse.c head/cddl/contrib/opensolaris/tools/ctf/cvt/traverse.c head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c Fri Apr 19 19:28:48 2013 (r249655) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c Fri Apr 19 19:38:39 2013 (r249656) @@ -47,7 +47,7 @@ * * The value is only valid during a call to ctf_load. */ -char *curfile; +static char *curfile; #define CTF_BUF_CHUNK_SIZE (64 * 1024) #define RES_BUF_CHUNK_SIZE (64 * 1024) Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/st_parse.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/st_parse.c Fri Apr 19 19:28:48 2013 (r249655) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/st_parse.c Fri Apr 19 19:38:39 2013 (r249656) @@ -54,7 +54,7 @@ static int faketypenumber = 100000000; static tdesc_t *hash_table[BUCKETS]; static tdesc_t *name_table[BUCKETS]; -list_t *typedbitfldmems; +static list_t *typedbitfldmems; static void reset(void); static jmp_buf resetbuf; Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/traverse.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/traverse.c Fri Apr 19 19:28:48 2013 (r249655) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/traverse.c Fri Apr 19 19:38:39 2013 (r249656) @@ -37,8 +37,8 @@ #include "traverse.h" #include "memory.h" -int (*tddescenders[])(tdesc_t *, tdtrav_data_t *); -tdtrav_cb_f tdnops[]; +static int (*tddescenders[])(tdesc_t *, tdtrav_data_t *); +static tdtrav_cb_f tdnops[]; void tdtrav_init(tdtrav_data_t *tdtd, int *vgenp, tdtrav_cb_f *firstops, @@ -111,7 +111,7 @@ tdtrav_assert(tdesc_t *node __unused, td return (-1); } -tdtrav_cb_f tdnops[] = { +static tdtrav_cb_f tdnops[] = { NULL, NULL, /* intrinsic */ NULL, /* pointer */ @@ -128,7 +128,7 @@ tdtrav_cb_f tdnops[] = { NULL /* restrict */ }; -int (*tddescenders[])(tdesc_t *, tdtrav_data_t *) = { +static int (*tddescenders[])(tdesc_t *, tdtrav_data_t *) = { NULL, NULL, /* intrinsic */ tdtrav_plain, /* pointer */ Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c Fri Apr 19 19:28:48 2013 (r249655) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c Fri Apr 19 19:38:39 2013 (r249656) @@ -249,8 +249,8 @@ tdesc_name(tdesc_t *tdp) return (tdp->t_name == NULL ? "(anon)" : tdp->t_name); } -char *watch_address = NULL; -int watch_length = 0; +static char *watch_address = NULL; +static int watch_length = 0; void watch_set(void *addr, int len) From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 19:45:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 08CC48D5; Fri, 19 Apr 2013 19:45:05 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E03001ACF; Fri, 19 Apr 2013 19:45:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3JJj4xd081850; Fri, 19 Apr 2013 19:45:04 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3JJj0Cv081691; Fri, 19 Apr 2013 19:45:00 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201304191945.r3JJj0Cv081691@svn.freebsd.org> From: Ed Schouten Date: Fri, 19 Apr 2013 19:45:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249657 - in head: bin/expr lib/csu sbin/gbde sbin/geom/class sbin/hastctl sbin/hastd sbin/md5 share/mk usr.bin/ar usr.bin/bc usr.bin/bzip2recover usr.bin/find usr.bin/indent usr.bin/m4... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 19:45:05 -0000 Author: ed Date: Fri Apr 19 19:45:00 2013 New Revision: 249657 URL: http://svnweb.freebsd.org/changeset/base/249657 Log: Add the Clang specific -Wmissing-variable-declarations to WARNS=6. This compiler flag enforces that that people either mark variables static or use an external declarations for the variable, similar to how -Wmissing-prototypes works for functions. Due to the fact that Yacc/Lex generate code that cannot trivially be changed to not warn because of this (lots of yy* variables), add a NO_WMISSING_VARIABLE_DECLARATIONS that can be used to turn off this specific compiler warning. Announced on: toolchain@ Modified: head/bin/expr/Makefile head/lib/csu/Makefile.inc head/sbin/gbde/Makefile head/sbin/geom/class/Makefile.inc head/sbin/hastctl/Makefile head/sbin/hastd/Makefile head/sbin/md5/Makefile head/share/mk/bsd.sys.mk head/usr.bin/ar/Makefile head/usr.bin/bc/Makefile head/usr.bin/bzip2recover/Makefile head/usr.bin/find/Makefile head/usr.bin/indent/Makefile head/usr.bin/m4/Makefile head/usr.bin/mklocale/Makefile head/usr.sbin/auditdistd/Makefile head/usr.sbin/bluetooth/bthidd/Makefile head/usr.sbin/bsnmpd/modules/Makefile.inc head/usr.sbin/config/Makefile head/usr.sbin/fifolog/lib/Makefile head/usr.sbin/jail/Makefile Modified: head/bin/expr/Makefile ============================================================================== --- head/bin/expr/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/bin/expr/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -4,4 +4,6 @@ PROG= expr SRCS= expr.y YFLAGS= +NO_WMISSING_VARIABLE_DECLARATIONS= + .include Modified: head/lib/csu/Makefile.inc ============================================================================== --- head/lib/csu/Makefile.inc Fri Apr 19 19:38:39 2013 (r249656) +++ head/lib/csu/Makefile.inc Fri Apr 19 19:45:00 2013 (r249657) @@ -4,4 +4,6 @@ SSP_CFLAGS= SED_FIX_NOTE = -i "" -e '/\.note\.tag/s/progbits/note/' +NO_WMISSING_VARIABLE_DECLARATIONS= + .include "../Makefile.inc" Modified: head/sbin/gbde/Makefile ============================================================================== --- head/sbin/gbde/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/sbin/gbde/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -10,6 +10,7 @@ SRCS+= g_bde_lock.c # rijndael-fst.c does evil casting things which can results in warnings, # the test-vectors check out however, so it works right. NO_WCAST_ALIGN= +NO_WMISSING_VARIABLE_DECLARATIONS= CFLAGS+= -I${.CURDIR}/../../sys .PATH: ${.CURDIR}/../../sys/geom/bde \ Modified: head/sbin/geom/class/Makefile.inc ============================================================================== --- head/sbin/geom/class/Makefile.inc Fri Apr 19 19:38:39 2013 (r249656) +++ head/sbin/geom/class/Makefile.inc Fri Apr 19 19:45:00 2013 (r249657) @@ -6,6 +6,8 @@ LINKS= ${BINDIR}/geom ${BINDIR}/g${GEOM_ MAN= g${GEOM_CLASS}.8 SRCS+= geom_${GEOM_CLASS}.c subr.c +NO_WMISSING_VARIABLE_DECLARATIONS= + CFLAGS+= -I${.CURDIR}/../.. .include "../Makefile.inc" Modified: head/sbin/hastctl/Makefile ============================================================================== --- head/sbin/hastctl/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/sbin/hastctl/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -21,6 +21,7 @@ MAN= hastctl.8 NO_WFORMAT= NO_WCAST_ALIGN= +NO_WMISSING_VARIABLE_DECLARATIONS= CFLAGS+=-I${.CURDIR}/../hastd CFLAGS+=-DHAVE_CAPSICUM CFLAGS+=-DINET Modified: head/sbin/hastd/Makefile ============================================================================== --- head/sbin/hastd/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/sbin/hastd/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -21,6 +21,7 @@ MAN= hastd.8 hast.conf.5 NO_WFORMAT= NO_WCAST_ALIGN= +NO_WMISSING_VARIABLE_DECLARATIONS= CFLAGS+=-I${.CURDIR} CFLAGS+=-DHAVE_CAPSICUM CFLAGS+=-DPROTO_TCP_DEFAULT_PORT=8457 Modified: head/sbin/md5/Makefile ============================================================================== --- head/sbin/md5/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/sbin/md5/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -13,6 +13,7 @@ MLINKS= md5.1 rmd160.1 \ md5.1 sha256.1 \ md5.1 sha512.1 +NO_WMISSING_VARIABLE_DECLARATIONS= WFORMAT?= 1 DPADD= ${LIBMD} Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Fri Apr 19 19:38:39 2013 (r249656) +++ head/share/mk/bsd.sys.mk Fri Apr 19 19:45:00 2013 (r249657) @@ -54,6 +54,10 @@ CWARNFLAGS+= -Wcast-align .if ${WARNS} >= 6 CWARNFLAGS+= -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls\ -Wold-style-definition +.if ${COMPILER_TYPE} == "clang" && !defined(EARLY_BUILD) && \ + !defined(NO_WMISSING_VARIABLE_DECLARATIONS) +CWARNFLAGS+= -Wmissing-variable-declarations +.endif .endif # WARNS >= 6 .if ${WARNS} >= 2 && ${WARNS} <= 4 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't Modified: head/usr.bin/ar/Makefile ============================================================================== --- head/usr.bin/ar/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.bin/ar/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -8,6 +8,8 @@ SRCS= ar.c acplex.l acpyacc.y read.c uti DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBZ} LDADD= -larchive -lelf -lz +NO_WMISSING_VARIABLE_DECLARATIONS= + CFLAGS+=-I. -I${.CURDIR} .if ${MK_SHARED_TOOLCHAIN} == "no" Modified: head/usr.bin/bc/Makefile ============================================================================== --- head/usr.bin/bc/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.bin/bc/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -8,6 +8,8 @@ CFLAGS+= -I. -I${.CURDIR} DPADD= ${LIBEDIT} ${LIBTERMCAP} LDADD= -ledit -ltermcap +NO_WMISSING_VARIABLE_DECLARATIONS= + FILES+= bc.library FILESDIR=${SHAREDIR}/misc Modified: head/usr.bin/bzip2recover/Makefile ============================================================================== --- head/usr.bin/bzip2recover/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.bin/bzip2recover/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -6,4 +6,6 @@ BZ2DIR= ${.CURDIR}/../../contrib/bzip2 PROG= bzip2recover NO_MAN= +NO_WMISSING_VARIABLE_DECLARATIONS= + .include Modified: head/usr.bin/find/Makefile ============================================================================== --- head/usr.bin/find/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.bin/find/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -6,4 +6,6 @@ SRCS= find.c function.c ls.c main.c misc getdate.y YFLAGS= +NO_WMISSING_VARIABLE_DECLARATIONS= + .include Modified: head/usr.bin/indent/Makefile ============================================================================== --- head/usr.bin/indent/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.bin/indent/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -1,6 +1,9 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 +# $FreeBSD$ PROG= indent SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c +NO_WMISSING_VARIABLE_DECLARATIONS= + .include Modified: head/usr.bin/m4/Makefile ============================================================================== --- head/usr.bin/m4/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.bin/m4/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -8,8 +8,8 @@ PROG= m4 CFLAGS+=-DEXTENDED -I${.CURDIR} -I${.CURDIR}/lib DPADD= ${LIBY} ${LIBL} ${LIBM} LDADD= -ly -ll -lm -# clang needs 1 while with gcc we can use 2 -#WARNS= 1 + +NO_WMISSING_VARIABLE_DECLARATIONS= SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c parser.y tokenizer.l .PATH: ${.CURDIR}/lib Modified: head/usr.bin/mklocale/Makefile ============================================================================== --- head/usr.bin/mklocale/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.bin/mklocale/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -5,4 +5,6 @@ PROG= mklocale SRCS= yacc.y lex.l y.tab.h CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../../lib/libc/locale +NO_WMISSING_VARIABLE_DECLARATIONS= + .include Modified: head/usr.sbin/auditdistd/Makefile ============================================================================== --- head/usr.sbin/auditdistd/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.sbin/auditdistd/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -10,6 +10,7 @@ OPENBSMDIR=${.CURDIR}/../../contrib/open CFLAGS+=-I${OPENBSMDIR} -I${OPENBSMDIR}/bin/auditdistd NO_WFORMAT= +NO_WMISSING_VARIABLE_DECLARATIONS= PROG= auditdistd SRCS= auditdistd.c Modified: head/usr.sbin/bluetooth/bthidd/Makefile ============================================================================== --- head/usr.sbin/bluetooth/bthidd/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.sbin/bluetooth/bthidd/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -13,4 +13,6 @@ DEBUG_FLAGS= -g DPADD= ${LIBBLUETOOTH} ${LIBUSBHID} LDADD= -lbluetooth -lusbhid +NO_WMISSING_VARIABLE_DECLARATIONS= + .include Modified: head/usr.sbin/bsnmpd/modules/Makefile.inc ============================================================================== --- head/usr.sbin/bsnmpd/modules/Makefile.inc Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.sbin/bsnmpd/modules/Makefile.inc Fri Apr 19 19:45:00 2013 (r249657) @@ -6,4 +6,6 @@ MANFILTER= sed -e 's%@MODPATH@%${LIBDIR} -e 's%@DEFPATH@%${DEFSDIR}/%g' \ -e 's%@MIBSPATH@%${BMIBSDIR}/%g' +NO_WMISSING_VARIABLE_DECLARATIONS= + .include "../Makefile.inc" Modified: head/usr.sbin/config/Makefile ============================================================================== --- head/usr.sbin/config/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.sbin/config/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -11,6 +11,8 @@ kernconf.c: kernconf.tmpl CFLAGS+= -I. -I${.CURDIR} +NO_WMISSING_VARIABLE_DECLARATIONS= + DPADD= ${LIBL} ${LIBSBUF} LDADD= -ll -lsbuf Modified: head/usr.sbin/fifolog/lib/Makefile ============================================================================== --- head/usr.sbin/fifolog/lib/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.sbin/fifolog/lib/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -8,4 +8,6 @@ SRCS+= getdate.y CFLAGS+= -I${.CURDIR} +NO_WMISSING_VARIABLE_DECLARATIONS= + .include Modified: head/usr.sbin/jail/Makefile ============================================================================== --- head/usr.sbin/jail/Makefile Fri Apr 19 19:38:39 2013 (r249656) +++ head/usr.sbin/jail/Makefile Fri Apr 19 19:45:00 2013 (r249657) @@ -9,6 +9,8 @@ SRCS= jail.c command.c config.c state.c DPADD= ${LIBJAIL} ${LIBKVM} ${LIBUTIL} ${LIBL} LDADD= -ljail -lkvm -lutil -ll +NO_WMISSING_VARIABLE_DECLARATIONS= + YFLAGS+=-v CFLAGS+=-I. -I${.CURDIR} From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 19:47:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3F5F4A92; Fri, 19 Apr 2013 19:47:44 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by mx1.freebsd.org (Postfix) with ESMTP id CB20A1AEF; Fri, 19 Apr 2013 19:47:43 +0000 (UTC) Received: from localhost (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by acme.spoerlein.net (8.14.6/8.14.6) with ESMTP id r3JJldft041472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 19 Apr 2013 21:47:40 +0200 (CEST) (envelope-from uqs@FreeBSD.org) Date: Fri, 19 Apr 2013 21:47:39 +0200 From: Ulrich =?utf-8?B?U3DDtnJsZWlu?= To: Eitan Adler Subject: Re: svn commit: r247960 - head/cddl/contrib/opensolaris/tools/ctf/cvt Message-ID: <20130419194739.GB11149@acme.spoerlein.net> Mail-Followup-To: Ulrich =?utf-8?B?U3DDtnJsZWlu?= , Eitan Adler , Dimitry Andric , svn-src-head@freebsd.org References: <201303072216.r27MGZ1b031061@svn.freebsd.org> <513914C4.4010001@FreeBSD.org> <51391C1E.5030905@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, Dimitry Andric X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 19:47:44 -0000 On Thu, 2013-03-07 at 20:45:20 -0500, Eitan Adler wrote: > On 7 March 2013 18:00, Dimitry Andric wrote: > > On 2013-03-07 23:29, Andriy Gapon wrote: > > ... > > > >> I was not really kidding when I said that this change, as is, is a nop: > > > > ... > > > >>> + bname = strrchr(match.iim_name, '/'); > >>> + bname = bname == NULL ? match.iim_name : bname + > >>> 1; > >> > >> > >> It would probably make sense to make use of bname after going to through > >> all the > >> trouble of calculating it: > >> > >>> match.iim_file = match.iim_name; > >> > >> > >> Should be match.iim_file = bname ? > > > > > > Yes, I actually had this in my test code, and committed the wrong diff > > by accident. :( Fixed in r247962, in any case. > > > > > > > >> Surprised that clang hasn't warned you about this one :-) > > > > > > Clang currently does not have the -Wunused-but-set-variable warning; it > > is apparently available in the static analyzer. On the other hand, that > > warning is one of the most annoying ones that newer gcc's have. :-) > > I have found real bugs in FreeBSD's code base as a result of this > warning, but the vast majority were more annoying than useful. > That's why I've disabled them on http://scan.freebsd.your.org/freebsd-head/ :) Uli From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 20:03:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 13750E83; Fri, 19 Apr 2013 20:03:53 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E82BC1BBE; Fri, 19 Apr 2013 20:03:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3JK3qwY013484; Fri, 19 Apr 2013 20:03:52 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3JK3qFB013463; Fri, 19 Apr 2013 20:03:52 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201304192003.r3JK3qFB013463@svn.freebsd.org> From: "Kenneth D. Merry" Date: Fri, 19 Apr 2013 20:03:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249658 - in head: bin/chio sys/cam/scsi sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 20:03:53 -0000 Author: ken Date: Fri Apr 19 20:03:51 2013 New Revision: 249658 URL: http://svnweb.freebsd.org/changeset/base/249658 Log: Update chio(1) and ch(4) to support reporting element designators. This allows mapping a tape drive in a changer (as reported by 'chio status') to a sa(4) driver instance by comparing the serial numbers. The designators can be ASCII (which is printed out directly), binary (which is printed in hex format) or UTF-8, which is printed in either native UTF-8 format if the terminal can support it, or in %XX notation for non-ASCII characters. Thanks to Hiroki Sato for the explaining UTF-8 printing and example UTF-8 printing code. chio.h: Modify the changer_element_status structure to add new fields and definitions from the SMC3r16 spec. Rename the original CHIOGSTATUS ioctl to OCHIOGTATUS and define a new CHIOGSTATUS ioctl. Clean up some tab/space issues. chio.c: For the 'status' subcommand, print the designator field if it is supplied by a device. scsi_ch.h: Add new flags for DVCID and CURDATA to the READ ELEMENT STATUS command structure. Add a read_element_status_device_id structure for the data fields in the new standard. Add new unions, dt_or_obsolete and voltage_devid, to hold and address data from either SCSI-2 or newer devices. scsi_ch.c: Implement support for fetching device IDs with READ ELEMENT STATUS data. Add new arguments to scsi_read_element_status() to allow the user to request the DVCID and CURDATA bits. This isn't compiled into libcam (it's only an internal kernel interface), so we don't need any special handling for the API change. If the user issues the new CHIOGSTATUS ioctl, copy all of the available element status data out. If he issues the OCHIOGSTATUS ioctl, we don't copy the new fields in the structure. Fix a bug in chopen() that would result in the peripheral never getting unheld if chgetparams() failed. Sponsored by: Spectra Logic Submitted by: Po-Li Soong MFC After: 1 week Modified: head/bin/chio/chio.c head/sys/cam/scsi/scsi_ch.c head/sys/cam/scsi/scsi_ch.h head/sys/sys/chio.h Modified: head/bin/chio/chio.c ============================================================================== --- head/bin/chio/chio.c Fri Apr 19 19:45:00 2013 (r249657) +++ head/bin/chio/chio.c Fri Apr 19 20:03:51 2013 (r249658) @@ -54,6 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "defs.h" #include "pathnames.h" @@ -81,6 +83,7 @@ static int do_status(const char *, int, static int do_ielem(const char *, int, char **); static int do_return(const char *, int, char **); static int do_voltag(const char *, int, char **); +static void print_designator(const char *, u_int8_t, u_int8_t); #ifndef CHET_VT #define CHET_VT 10 /* Completely Arbitrary */ @@ -723,6 +726,10 @@ do_status(const char *cname, int argc, c putchar('?'); putchar('>'); } + if (ces->ces_designator_length > 0) + print_designator(ces->ces_designator, + ces->ces_code_set, + ces->ces_designator_length); putchar('\n'); } @@ -1177,3 +1184,66 @@ usage(void) "arg1 arg2 [arg3 [...]]\n", getprogname()); exit(1); } + +#define UTF8CODESET "UTF-8" + +static void +print_designator(const char *designator, u_int8_t code_set, + u_int8_t designator_length) +{ + printf(" serial number: <"); + switch (code_set) { + case CES_CODE_SET_ASCII: { + /* + * The driver insures that the string is always NUL terminated. + */ + printf("%s", designator); + break; + } + case CES_CODE_SET_UTF_8: { + char *cs_native; + + setlocale(LC_ALL, ""); + cs_native = nl_langinfo(CODESET); + + /* See if we can natively print UTF-8 */ + if (strcmp(cs_native, UTF8CODESET) == 0) + cs_native = NULL; + + if (cs_native == NULL) { + /* We can natively print UTF-8, so use printf. */ + printf("%s", designator); + } else { + int i; + + /* + * We can't natively print UTF-8. We should + * convert it to the terminal's codeset, but that + * requires iconv(3) and FreeBSD doesn't have + * iconv(3) in the base system yet. So we use %XX + * notation for non US-ASCII characters instead. + */ + for (i = 0; i < designator_length && + designator[i] != '\0'; i++) { + if ((unsigned char)designator[i] < 0x80) + printf("%c", designator[i]); + else + printf("%%%02x", + (unsigned char)designator[i]); + } + } + break; + } + case CES_CODE_SET_BINARY: { + int i; + + for (i = 0; i < designator_length; i++) + printf("%02X%s", designator[i], + (i == designator_length - 1) ? "" : " "); + break; + } + default: + break; + } + printf(">"); +} Modified: head/sys/cam/scsi/scsi_ch.c ============================================================================== --- head/sys/cam/scsi/scsi_ch.c Fri Apr 19 19:45:00 2013 (r249657) +++ head/sys/cam/scsi/scsi_ch.c Fri Apr 19 20:03:51 2013 (r249658) @@ -194,12 +194,14 @@ static int chexchange(struct cam_periph static int chposition(struct cam_periph *periph, struct changer_position *cp); static int chgetelemstatus(struct cam_periph *periph, + int scsi_version, u_long cmd, struct changer_element_status_request *csr); static int chsetvoltag(struct cam_periph *periph, struct changer_set_voltag_request *csvr); static int chielem(struct cam_periph *periph, unsigned int timeout); static int chgetparams(struct cam_periph *periph); +static int chscsiversion(struct cam_periph *periph); static struct periph_driver chdriver = { @@ -474,6 +476,7 @@ chopen(struct cdev *dev, int flags, int * Load information about this changer device into the softc. */ if ((error = chgetparams(periph)) != 0) { + cam_periph_unhold(periph); cam_periph_release_locked(periph); cam_periph_unlock(periph); return(error); @@ -772,6 +775,7 @@ chioctl(struct cdev *dev, u_long cmd, ca switch (cmd) { case CHIOGPICKER: case CHIOGPARAMS: + case OCHIOGSTATUS: case CHIOGSTATUS: break; @@ -824,10 +828,26 @@ chioctl(struct cdev *dev, u_long cmd, ca error = chielem(periph, *(unsigned int *)addr); break; + case OCHIOGSTATUS: + { + error = chgetelemstatus(periph, SCSI_REV_2, cmd, + (struct changer_element_status_request *)addr); + break; + } + case CHIOGSTATUS: { - error = chgetelemstatus(periph, - (struct changer_element_status_request *) addr); + int scsi_version; + + scsi_version = chscsiversion(periph); + if (scsi_version >= SCSI_REV_0) { + error = chgetelemstatus(periph, scsi_version, cmd, + (struct changer_element_status_request *)addr); + } + else { /* unable to determine the SCSI version */ + cam_periph_unlock(periph); + return (ENXIO); + } break; } @@ -1034,18 +1054,20 @@ copy_voltag(struct changer_voltag *uvolt } /* - * Copy an an element status descriptor to a user-mode + * Copy an element status descriptor to a user-mode * changer_element_status structure. */ - -static void +static void copy_element_status(struct ch_softc *softc, u_int16_t flags, struct read_element_status_descriptor *desc, - struct changer_element_status *ces) + struct changer_element_status *ces, + int scsi_version) { u_int16_t eaddr = scsi_2btoul(desc->eaddr); u_int16_t et; + struct volume_tag *pvol_tag = NULL, *avol_tag = NULL; + struct read_element_status_device_id *devid = NULL; ces->ces_int_addr = eaddr; /* set up logical address in element status */ @@ -1076,7 +1098,7 @@ copy_element_status(struct ch_softc *sof if ((softc->sc_firsts[et] <= eaddr) && ((softc->sc_firsts[et] + softc->sc_counts[et]) > eaddr)) { - ces->ces_source_addr = + ces->ces_source_addr = eaddr - softc->sc_firsts[et]; ces->ces_source_type = et; ces->ces_flags |= CES_SOURCE_VALID; @@ -1089,27 +1111,92 @@ copy_element_status(struct ch_softc *sof "address %ud to a valid element type\n", eaddr); } - + /* + * pvoltag and avoltag are common between SCSI-2 and later versions + */ if (flags & READ_ELEMENT_STATUS_PVOLTAG) - copy_voltag(&(ces->ces_pvoltag), &(desc->pvoltag)); + pvol_tag = &desc->voltag_devid.pvoltag; if (flags & READ_ELEMENT_STATUS_AVOLTAG) - copy_voltag(&(ces->ces_avoltag), &(desc->avoltag)); - - if (desc->dt_scsi_flags & READ_ELEMENT_STATUS_DT_IDVALID) { - ces->ces_flags |= CES_SCSIID_VALID; - ces->ces_scsi_id = desc->dt_scsi_addr; - } + avol_tag = (flags & READ_ELEMENT_STATUS_PVOLTAG) ? + &desc->voltag_devid.voltag[1] :&desc->voltag_devid.pvoltag; + /* + * For SCSI-3 and later, element status can carry designator and + * other information. + */ + if (scsi_version >= SCSI_REV_SPC) { + if ((flags & READ_ELEMENT_STATUS_PVOLTAG) ^ + (flags & READ_ELEMENT_STATUS_AVOLTAG)) + devid = &desc->voltag_devid.pvol_and_devid.devid; + else if (!(flags & READ_ELEMENT_STATUS_PVOLTAG) && + !(flags & READ_ELEMENT_STATUS_AVOLTAG)) + devid = &desc->voltag_devid.devid; + else /* Have both PVOLTAG and AVOLTAG */ + devid = &desc->voltag_devid.vol_tags_and_devid.devid; + } + + if (pvol_tag) + copy_voltag(&(ces->ces_pvoltag), pvol_tag); + if (avol_tag) + copy_voltag(&(ces->ces_pvoltag), avol_tag); + if (devid != NULL) { + if (devid->designator_length > 0) { + bcopy((void *)devid->designator, + (void *)ces->ces_designator, + devid->designator_length); + ces->ces_designator_length = devid->designator_length; + /* + * Make sure we are always NUL terminated. The + * buffer should be sized for the maximum + * designator length plus 1, but this will make sure + * there is always a NUL at the end. This won't + * matter for the binary code set, since the user + * will only pay attention to the length field. + */ + ces->ces_designator[ + MIN(sizeof(ces->ces_designator) - 1, + devid->designator_length)]= '\0'; + } + if (devid->piv_assoc_designator_type & + READ_ELEMENT_STATUS_PIV_SET) { + ces->ces_flags |= CES_PIV; + ces->ces_protocol_id = + READ_ELEMENT_STATUS_PROTOCOL_ID( + devid->prot_code_set); + } + ces->ces_code_set = + READ_ELEMENT_STATUS_CODE_SET(devid->prot_code_set); + ces->ces_assoc = READ_ELEMENT_STATUS_ASSOCIATION( + devid->piv_assoc_designator_type); + ces->ces_designator_type = READ_ELEMENT_STATUS_DESIGNATOR_TYPE( + devid->piv_assoc_designator_type); + } else if (scsi_version > SCSI_REV_2) { + /* SCSI-SPC and No devid, no designator */ + ces->ces_designator_length = 0; + ces->ces_designator[0] = '\0'; + ces->ces_protocol_id = CES_PROTOCOL_ID_FCP_4; + } + + if (scsi_version <= SCSI_REV_2) { + if (desc->dt_or_obsolete.scsi_2.dt_scsi_flags & + READ_ELEMENT_STATUS_DT_IDVALID) { + ces->ces_flags |= CES_SCSIID_VALID; + ces->ces_scsi_id = + desc->dt_or_obsolete.scsi_2.dt_scsi_addr; + } - if (desc->dt_scsi_addr & READ_ELEMENT_STATUS_DT_LUVALID) { - ces->ces_flags |= CES_LUN_VALID; - ces->ces_scsi_lun = - desc->dt_scsi_flags & READ_ELEMENT_STATUS_DT_LUNMASK; + if (desc->dt_or_obsolete.scsi_2.dt_scsi_addr & + READ_ELEMENT_STATUS_DT_LUVALID) { + ces->ces_flags |= CES_LUN_VALID; + ces->ces_scsi_lun = + desc->dt_or_obsolete.scsi_2.dt_scsi_flags & + READ_ELEMENT_STATUS_DT_LUNMASK; + } } } static int -chgetelemstatus(struct cam_periph *periph, +chgetelemstatus(struct cam_periph *periph, int scsi_version, u_long cmd, struct changer_element_status_request *cesr) { struct read_element_status_header *st_hdr; @@ -1155,6 +1242,8 @@ chgetelemstatus(struct cam_periph *perip /* tag_action */ MSG_SIMPLE_Q_TAG, /* voltag */ want_voltags, /* sea */ softc->sc_firsts[chet], + /* dvcid */ 1, + /* curdata */ 1, /* count */ 1, /* data_ptr */ data, /* dxfer_len */ 1024, @@ -1177,7 +1266,6 @@ chgetelemstatus(struct cam_periph *perip size = sizeof(struct read_element_status_header) + sizeof(struct read_element_status_page_header) + (desclen * cesr->cesr_element_count); - /* * Reallocate storage for descriptors and get them from the * device. @@ -1193,12 +1281,14 @@ chgetelemstatus(struct cam_periph *perip /* voltag */ want_voltags, /* sea */ softc->sc_firsts[chet] + cesr->cesr_element_base, + /* dvcid */ 1, + /* curdata */ 1, /* count */ cesr->cesr_element_count, /* data_ptr */ data, /* dxfer_len */ size, /* sense_len */ SSD_FULL_SIZE, /* timeout */ CH_TIMEOUT_READ_ELEMENT_STATUS); - + error = cam_periph_runccb(ccb, cherror, /*cam_flags*/ CAM_RETRY_SELTO, /*sense_flags*/ SF_RETRY_UA, softc->device_stats); @@ -1231,18 +1321,41 @@ chgetelemstatus(struct cam_periph *perip * Set up the individual element status structures */ for (i = 0; i < avail; ++i) { - struct changer_element_status *ces = &(user_data[i]); + struct changer_element_status *ces; - copy_element_status(softc, pg_hdr->flags, desc, ces); + /* + * In the changer_element_status structure, fields from + * the beginning to the field of ces_scsi_lun are common + * between SCSI-2 and SCSI-3, while all the rest are new + * from SCSI-3. In order to maintain backward compatibility + * of the chio command, the ces pointer, below, is computed + * such that it lines up with the structure boundary + * corresponding to the SCSI version. + */ + ces = cmd == OCHIOGSTATUS ? + (struct changer_element_status *) + ((unsigned char *)user_data + i * + (offsetof(struct changer_element_status,ces_scsi_lun)+1)): + &user_data[i]; + + copy_element_status(softc, pg_hdr->flags, desc, + ces, scsi_version); desc = (struct read_element_status_descriptor *) - ((uintptr_t)desc + desclen); + ((unsigned char *)desc + desclen); } /* Copy element status structures out to userspace. */ - error = copyout(user_data, - cesr->cesr_element_status, - avail * sizeof(struct changer_element_status)); + if (cmd == OCHIOGSTATUS) + error = copyout(user_data, + cesr->cesr_element_status, + avail* (offsetof(struct changer_element_status, + ces_scsi_lun) + 1)); + else + error = copyout(user_data, + cesr->cesr_element_status, + avail * sizeof(struct changer_element_status)); + cam_periph_lock(periph); done: @@ -1549,6 +1662,39 @@ chgetparams(struct cam_periph *periph) return(error); } +static int +chscsiversion(struct cam_periph *periph) +{ + struct scsi_inquiry_data *inq_data; + struct ccb_getdev *cgd; + int dev_scsi_version; + struct cam_sim *sim; + + sim = xpt_path_sim(periph->path); + mtx_assert(sim->mtx, MA_OWNED); + if ((cgd = (struct ccb_getdev *)xpt_alloc_ccb_nowait()) == NULL) + return (-1); + /* + * Get the device information. + */ + xpt_setup_ccb(&cgd->ccb_h, + periph->path, + CAM_PRIORITY_NORMAL); + cgd->ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)cgd); + + if (cgd->ccb_h.status != CAM_REQ_CMP) { + xpt_free_ccb((union ccb *)cgd); + return -1; + } + + inq_data = &cgd->inq_data; + dev_scsi_version = inq_data->version; + xpt_free_ccb((union ccb *)cgd); + + return dev_scsi_version; +} + void scsi_move_medium(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), @@ -1654,6 +1800,7 @@ void scsi_read_element_status(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int voltag, u_int32_t sea, + int curdata, int dvcid, u_int32_t count, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout) @@ -1668,6 +1815,10 @@ scsi_read_element_status(struct ccb_scsi scsi_ulto2b(sea, scsi_cmd->sea); scsi_ulto2b(count, scsi_cmd->count); scsi_ulto3b(dxfer_len, scsi_cmd->len); + if (dvcid) + scsi_cmd->flags |= READ_ELEMENT_STATUS_DVCID; + if (curdata) + scsi_cmd->flags |= READ_ELEMENT_STATUS_CURDATA; if (voltag) scsi_cmd->byte2 |= READ_ELEMENT_STATUS_VOLTAG; Modified: head/sys/cam/scsi/scsi_ch.h ============================================================================== --- head/sys/cam/scsi/scsi_ch.h Fri Apr 19 19:45:00 2013 (r249657) +++ head/sys/cam/scsi/scsi_ch.h Fri Apr 19 20:03:51 2013 (r249658) @@ -136,11 +136,14 @@ struct scsi_position_to_element { struct scsi_read_element_status { u_int8_t opcode; u_int8_t byte2; -#define READ_ELEMENT_STATUS_VOLTAG 0x10 /* report volume tag info */ +#define READ_ELEMENT_STATUS_VOLTAG 0x10 /* report volume tag info */ /* ...next 4 bits are an element type code... */ u_int8_t sea[2]; /* starting element address */ u_int8_t count[2]; /* number of elements */ - u_int8_t reserved0; + u_int8_t flags; +#define READ_ELEMENT_STATUS_DVCID 0x01 /* report device serial number */ +#define READ_ELEMENT_STATUS_CURDATA 0x02 /* allow motion during command */ + u_int8_t len[3]; /* length of data buffer */ u_int8_t reserved1; u_int8_t control; @@ -149,7 +152,7 @@ struct scsi_read_element_status { struct scsi_request_volume_element_address { u_int8_t opcode; u_int8_t byte2; -#define REQUEST_VOLUME_ELEMENT_ADDRESS_VOLTAG 0x10 +#define REQUEST_VOLUME_ELEMENT_ADDRESS_VOLTAG 0x10 /* ...next 4 bits are an element type code... */ u_int8_t eaddr[2]; /* element address */ u_int8_t count[2]; /* number of elements */ @@ -182,8 +185,8 @@ struct read_element_status_header { struct read_element_status_page_header { u_int8_t type; /* element type code; see type codes below */ u_int8_t flags; -#define READ_ELEMENT_STATUS_AVOLTAG 0x40 -#define READ_ELEMENT_STATUS_PVOLTAG 0x80 +#define READ_ELEMENT_STATUS_AVOLTAG 0x40 +#define READ_ELEMENT_STATUS_PVOLTAG 0x80 u_int8_t edl[2]; /* element descriptor length */ u_int8_t reserved; u_int8_t nbytes[3]; /* byte count of all descriptors */ @@ -199,50 +202,79 @@ struct volume_tag { u_int8_t vsn[2]; /* volume sequence number */ }; +struct read_element_status_device_id { + u_int8_t prot_code_set; +#define READ_ELEMENT_STATUS_CODE_SET(p) ((p) & 0x0F) +#define READ_ELEMENT_STATUS_PROTOCOL_ID(p) ((p) >> 4) + + u_int8_t piv_assoc_designator_type; +#define READ_ELEMENT_STATUS_PIV_SET 0x80 +#define READ_ELEMENT_STATUS_ASSOCIATION(p) ((p) >> 4) +#define READ_ELEMENT_STATUS_DESIGNATOR_TYPE(p) ((p) & 0x0F) + + u_int8_t reserved2; + u_int8_t designator_length; + u_int8_t designator[256]; /* Allocate max length */ +}; + struct read_element_status_descriptor { u_int8_t eaddr[2]; /* element address */ u_int8_t flags1; -#define READ_ELEMENT_STATUS_FULL 0x01 -#define READ_ELEMENT_STATUS_IMPEXP 0x02 -#define READ_ELEMENT_STATUS_EXCEPT 0x04 -#define READ_ELEMENT_STATUS_ACCESS 0x08 -#define READ_ELEMENT_STATUS_EXENAB 0x10 -#define READ_ELEMENT_STATUS_INENAB 0x20 - -#define READ_ELEMENT_STATUS_MT_MASK1 0x05 -#define READ_ELEMENT_STATUS_ST_MASK1 0x0c -#define READ_ELEMENT_STATUS_IE_MASK1 0x3f -#define READ_ELEMENT_STATUS_DT_MASK1 0x0c +#define READ_ELEMENT_STATUS_FULL 0x01 +#define READ_ELEMENT_STATUS_IMPEXP 0x02 +#define READ_ELEMENT_STATUS_EXCEPT 0x04 +#define READ_ELEMENT_STATUS_ACCESS 0x08 +#define READ_ELEMENT_STATUS_EXENAB 0x10 +#define READ_ELEMENT_STATUS_INENAB 0x20 + +#define READ_ELEMENT_STATUS_MT_MASK1 0x05 +#define READ_ELEMENT_STATUS_ST_MASK1 0x0c +#define READ_ELEMENT_STATUS_IE_MASK1 0x3f +#define READ_ELEMENT_STATUS_DT_MASK1 0x0c u_int8_t reserved0; u_int8_t sense_code; u_int8_t sense_qual; - /* - * dt_scsi_flags and dt_scsi_addr are valid only on data transport - * elements. These bytes are undefined for all other element types. - */ - u_int8_t dt_scsi_flags; - -#define READ_ELEMENT_STATUS_DT_LUNMASK 0x07 -#define READ_ELEMENT_STATUS_DT_LUVALID 0x10 -#define READ_ELEMENT_STATUS_DT_IDVALID 0x20 -#define READ_ELEMENT_STATUS_DT_NOTBUS 0x80 - - u_int8_t dt_scsi_addr; - - u_int8_t reserved1; + union { + struct { + u_int8_t dt_scsi_flags; + +#define READ_ELEMENT_STATUS_DT_LUNMASK 0x07 +#define READ_ELEMENT_STATUS_DT_LUVALID 0x10 +#define READ_ELEMENT_STATUS_DT_IDVALID 0x20 +#define READ_ELEMENT_STATUS_DT_NOTBUS 0x80 + + u_int8_t dt_scsi_addr; + u_int8_t reserved1; + } scsi_2; + + /* reserved and obsolete (as of SCSI-3) fields */ + u_int8_t reserved_or_obsolete[3]; + } dt_or_obsolete; u_int8_t flags2; -#define READ_ELEMENT_STATUS_INVERT 0x40 -#define READ_ELEMENT_STATUS_SVALID 0x80 - u_int8_t ssea[2]; /* source storage element address */ +#define READ_ELEMENT_STATUS_INVERT 0x40 +#define READ_ELEMENT_STATUS_SVALID 0x80 +#define READ_ELEMENT_STATUS_ED 0x80 +#define READ_ELEMENT_STATUS_MEDIA_TYPE_MASK 0x07 - struct volume_tag pvoltag; /* omitted if PVOLTAG == 0 */ - struct volume_tag avoltag; /* omitted if AVOLTAG == 0 */ + u_int8_t ssea[2]; /* source storage element address */ - /* Other data may follow */ + union { + struct volume_tag pvoltag; + struct volume_tag voltag[2]; + struct read_element_status_device_id devid; + struct { + struct volume_tag pvoltag; + struct read_element_status_device_id devid; + } pvol_and_devid; + struct { + struct volume_tag voltag[2]; + struct read_element_status_device_id devid; + } vol_tags_and_devid; + } voltag_devid; }; /* XXX add data returned by REQUEST VOLUME ELEMENT ADDRESS */ @@ -457,6 +489,7 @@ void scsi_position_to_element(struct ccb void scsi_read_element_status(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int voltag, u_int32_t sea, + int curdata, int dvcid, u_int32_t count, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); Modified: head/sys/sys/chio.h ============================================================================== --- head/sys/sys/chio.h Fri Apr 19 19:45:00 2013 (r249657) +++ head/sys/sys/chio.h Fri Apr 19 20:03:51 2013 (r249658) @@ -152,7 +152,8 @@ typedef enum { CES_INVERT = 0x040, /* invert bit */ CES_SOURCE_VALID = 0x080, /* source address (ces_source) valid */ CES_SCSIID_VALID = 0x100, /* ces_scsi_id is valid */ - CES_LUN_VALID = 0x200 /* ces_scsi_lun is valid */ + CES_LUN_VALID = 0x200, /* ces_scsi_lun is valid */ + CES_PIV = 0x400 /* ces_protocol_id is valid */ } ces_status_flags; struct changer_element_status { @@ -181,6 +182,55 @@ struct changer_element_status { changer_voltag_t ces_avoltag; /* alternate volume tag */ u_int8_t ces_scsi_id; /* SCSI id of element */ u_int8_t ces_scsi_lun; /* SCSI lun of element */ + + /* + * Data members for SMC3 and later versions + */ + u_int8_t ces_medium_type; +#define CES_MEDIUM_TYPE_UNKNOWN 0 /* Medium type unspecified */ +#define CES_MEDIUM_TYPE_DATA 1 /* Data medium */ +#define CES_MEDIUM_TYPE_CLEANING 2 /* Cleaning medium */ +#define CES_MEDIUM_TYPE_DIAGNOSTIC 3 /* Diagnostic medium */ +#define CES_MEDIUM_TYPE_WORM 4 /* WORM medium */ +#define CES_MEDIUM_TYPE_MICROCODE 5 /* Microcode image medium */ + + u_int8_t ces_protocol_id; +#define CES_PROTOCOL_ID_FCP_4 0 /* Fiber channel */ +#define CES_PROTOCOL_ID_SPI_5 1 /* Parallel SCSI */ +#define CES_PROTOCOL_ID_SSA_S3P 2 /* SSA */ +#define CES_PROTOCOL_ID_SBP_3 3 /* IEEE 1394 */ +#define CES_PROTOCOL_ID_SRP 4 /* SCSI Remote DMA */ +#define CES_PROTOCOL_ID_ISCSI 5 /* iSCSI */ +#define CES_PROTOCOL_ID_SPL 6 /* SAS */ +#define CES_PROTOCOL_ID_ADT_2 7 /* Automation/Drive Interface */ +#define CES_PROTOCOL_ID_ACS_2 8 /* ATA */ + + u_int8_t ces_assoc; +#define CES_ASSOC_LOGICAL_UNIT 0 +#define CES_ASSOC_TARGET_PORT 1 +#define CES_ASSOC_TARGET_DEVICE 2 + + u_int8_t ces_designator_type; +#define CES_DESIGNATOR_TYPE_VENDOR_SPECIFIC 0 +#define CES_DESIGNATOR_TYPE_T10_VENDOR_ID 1 +#define CES_DESIGNATOR_TYPE_EUI_64 2 +#define CES_DESIGNATOR_TYPE_NAA 3 +#define CES_DESIGNATOR_TYPE_TARGET_PORT_ID 4 +#define CES_DESIGNATOR_TYPE_TARGET_PORT_GRP 5 +#define CES_DESIGNATOR_TYPE_LOGICAL_UNIT_GRP 6 +#define CES_DESIGNATOR_TYPE_MD5_LOGICAL_UNIT_ID 7 +#define CES_DESIGNATOR_TYPE_SCSI_NAME_STRING 8 + + u_int8_t ces_code_set; +#define CES_CODE_SET_RESERVED 0 +#define CES_CODE_SET_BINARY 1 +#define CES_CODE_SET_ASCII 2 +#define CES_CODE_SET_UTF_8 3 + + u_int8_t ces_designator_length; + +#define CES_MAX_DESIGNATOR_LENGTH (1 << 8) + u_int8_t ces_designator[CES_MAX_DESIGNATOR_LENGTH + 1]; }; struct changer_element_status_request { @@ -189,7 +239,7 @@ struct changer_element_status_request { u_int16_t cesr_element_count; u_int16_t cesr_flags; -#define CESR_VOLTAGS 0x01 +#define CESR_VOLTAGS 0x01 struct changer_element_status *cesr_element_status; }; @@ -200,28 +250,29 @@ struct changer_set_voltag_request { u_int16_t csvr_addr; u_int16_t csvr_flags; -#define CSVR_MODE_MASK 0x0f /* mode mask, acceptable modes below: */ +#define CSVR_MODE_MASK 0x0f /* mode mask, acceptable modes below: */ #define CSVR_MODE_SET 0x00 /* set volume tag if not set */ -#define CSVR_MODE_REPLACE 0x01 /* unconditionally replace volume tag */ -#define CSVR_MODE_CLEAR 0x02 /* clear volume tag */ +#define CSVR_MODE_REPLACE 0x01 /* unconditionally replace volume tag */ +#define CSVR_MODE_CLEAR 0x02 /* clear volume tag */ -#define CSVR_ALTERNATE 0x10 /* set to work with alternate voltag */ +#define CSVR_ALTERNATE 0x10 /* set to work with alternate voltag */ changer_voltag_t csvr_voltag; }; -#define CESTATUS_BITS \ +#define CESTATUS_BITS \ "\20\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL" -#define CHIOMOVE _IOW('c', 0x01, struct changer_move) -#define CHIOEXCHANGE _IOW('c', 0x02, struct changer_exchange) -#define CHIOPOSITION _IOW('c', 0x03, struct changer_position) -#define CHIOGPICKER _IOR('c', 0x04, int) -#define CHIOSPICKER _IOW('c', 0x05, int) -#define CHIOGPARAMS _IOR('c', 0x06, struct changer_params) -#define CHIOIELEM _IOW('c', 0x07, u_int32_t) -#define CHIOGSTATUS _IOW('c', 0x08, struct changer_element_status_request) -#define CHIOSETVOLTAG _IOW('c', 0x09, struct changer_set_voltag_request) +#define CHIOMOVE _IOW('c', 0x01, struct changer_move) +#define CHIOEXCHANGE _IOW('c', 0x02, struct changer_exchange) +#define CHIOPOSITION _IOW('c', 0x03, struct changer_position) +#define CHIOGPICKER _IOR('c', 0x04, int) +#define CHIOSPICKER _IOW('c', 0x05, int) +#define CHIOGPARAMS _IOR('c', 0x06, struct changer_params) +#define CHIOIELEM _IOW('c', 0x07, u_int32_t) +#define OCHIOGSTATUS _IOW('c', 0x08, struct changer_element_status_request) +#define CHIOSETVOLTAG _IOW('c', 0x09, struct changer_set_voltag_request) +#define CHIOGSTATUS _IOW('c', 0x0A, struct changer_element_status_request) #endif /* !_SYS_CHIO_H_ */ From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 21:08:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CD580A49; Fri, 19 Apr 2013 21:08:22 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BF5221EB0; Fri, 19 Apr 2013 21:08:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3JL8Mqc017668; Fri, 19 Apr 2013 21:08:22 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3JL8LW8017654; Fri, 19 Apr 2013 21:08:21 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201304192108.r3JL8LW8017654@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 19 Apr 2013 21:08:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249659 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 21:08:22 -0000 Author: luigi Date: Fri Apr 19 21:08:21 2013 New Revision: 249659 URL: http://svnweb.freebsd.org/changeset/base/249659 Log: mostly whitespace changes: - remove vestiges of the old memory allocator - clean up some comments Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_mem2.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Fri Apr 19 20:03:51 2013 (r249658) +++ head/sys/dev/netmap/netmap.c Fri Apr 19 21:08:21 2013 (r249659) @@ -324,11 +324,7 @@ netmap_update_config(struct netmap_adapt } /*------------- memory allocator -----------------*/ -#ifdef NETMAP_MEM2 #include "netmap_mem2.c" -#else /* !NETMAP_MEM2 */ -#include "netmap_mem1.c" -#endif /* !NETMAP_MEM2 */ /*------------ end of memory allocator ----------*/ @@ -498,16 +494,16 @@ netmap_dtor(void *data) { struct netmap_priv_d *priv = data; struct ifnet *ifp = priv->np_ifp; - struct netmap_adapter *na; NMA_LOCK(); if (ifp) { - na = NA(ifp); + struct netmap_adapter *na = NA(ifp); + na->nm_lock(ifp, NETMAP_REG_LOCK, 0); netmap_dtor_locked(data); na->nm_lock(ifp, NETMAP_REG_UNLOCK, 0); - nm_if_rele(ifp); + nm_if_rele(ifp); /* might also destroy *na */ } if (priv->ref_done) { netmap_memory_deref(); Modified: head/sys/dev/netmap/netmap_kern.h ============================================================================== --- head/sys/dev/netmap/netmap_kern.h Fri Apr 19 20:03:51 2013 (r249658) +++ head/sys/dev/netmap/netmap_kern.h Fri Apr 19 21:08:21 2013 (r249659) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2012 Matteo Landi, Luigi Rizzo. All rights reserved. + * Copyright (C) 2011-2013 Matteo Landi, Luigi Rizzo. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,8 +34,6 @@ #ifndef _NET_NETMAP_KERN_H_ #define _NET_NETMAP_KERN_H_ -#define NETMAP_MEM2 // use the new memory allocator - #if defined(__FreeBSD__) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) @@ -45,7 +43,7 @@ #define MBUF_LEN(m) ((m)->m_pkthdr.len) #define NM_SEND_UP(ifp, m) ((ifp)->if_input)(ifp, m) #elif defined (linux) -#define NM_LOCK_T spinlock_t +#define NM_LOCK_T safe_spinlock_t // see bsd_glue.h #define NM_SELINFO_T wait_queue_head_t #define MBUF_LEN(m) ((m)->len) #define NM_SEND_UP(ifp, m) netif_rx(m) @@ -431,7 +429,6 @@ netmap_idx_k2n(struct netmap_kring *kr, } -#ifdef NETMAP_MEM2 /* Entries of the look-up table. */ struct lut_entry { void *vaddr; /* virtual address. */ @@ -442,9 +439,6 @@ struct netmap_obj_pool; extern struct lut_entry *netmap_buffer_lut; #define NMB_VA(i) (netmap_buffer_lut[i].vaddr) #define NMB_PA(i) (netmap_buffer_lut[i].paddr) -#else /* NETMAP_MEM1 */ -#define NMB_VA(i) (netmap_buffer_base + (i * NETMAP_BUF_SIZE) ) -#endif /* NETMAP_MEM2 */ /* * NMB return the virtual address of a buffer (buffer 0 on bad index) @@ -462,11 +456,8 @@ PNMB(struct netmap_slot *slot, uint64_t { uint32_t i = slot->buf_idx; void *ret = (i >= netmap_total_buffers) ? NMB_VA(0) : NMB_VA(i); -#ifdef NETMAP_MEM2 + *pp = (i >= netmap_total_buffers) ? NMB_PA(0) : NMB_PA(i); -#else - *pp = vtophys(ret); -#endif return ret; } @@ -474,5 +465,6 @@ PNMB(struct netmap_slot *slot, uint64_t int netmap_rx_irq(struct ifnet *, int, int *); #define netmap_tx_irq(_n, _q) netmap_rx_irq(_n, _q, NULL) + extern int netmap_copy; #endif /* _NET_NETMAP_KERN_H_ */ Modified: head/sys/dev/netmap/netmap_mem2.c ============================================================================== --- head/sys/dev/netmap/netmap_mem2.c Fri Apr 19 20:03:51 2013 (r249658) +++ head/sys/dev/netmap/netmap_mem2.c Fri Apr 19 21:08:21 2013 (r249659) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Matteo Landi, Luigi Rizzo, Giuseppe Lettieri. All rights reserved. + * Copyright (C) 2012-2013 Matteo Landi, Luigi Rizzo, Giuseppe Lettieri. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,16 +31,18 @@ */ /* - * This allocator creates three memory regions: + * This allocator creates three memory pools: * nm_if_pool for the struct netmap_if * nm_ring_pool for the struct netmap_ring * nm_buf_pool for the packet buffers. * - * All regions need to be multiple of a page size as we export them to - * userspace through mmap. Only the latter needs to be dma-able, + * that contain netmap objects. Each pool is made of a number of clusters, + * multiple of a page size, each containing an integer number of objects. + * The clusters are contiguous in user space but not in the kernel. + * Only nm_buf_pool needs to be dma-able, * but for convenience use the same type of allocator for all. * - * Once mapped, the three regions are exported to userspace + * Once mapped, the three pools are exported to userspace * as a contiguous block, starting from nm_if_pool. Each * cluster (and pool) is an integral number of pages. * [ . . . ][ . . . . . .][ . . . . . . . . . .] @@ -56,7 +58,7 @@ * The pool is split into smaller clusters, whose size is a * multiple of the page size. The cluster size is chosen * to minimize the waste for a given max cluster size - * (we do it by brute force, as we have relatively few object + * (we do it by brute force, as we have relatively few objects * per cluster). * * Objects are aligned to the cache line (64 bytes) rounding up object @@ -80,7 +82,7 @@ * In the worst case we have one netmap_if per ring in the system. * * struct netmap_ring - * variable too, 8 byte per slot plus some fixed amount. + * variable size, 8 byte per slot plus some fixed amount. * Rings can be large (e.g. 4k slots, or >32Kbytes). * We default to 36 KB (9 pages), and a few hundred rings. * @@ -93,11 +95,7 @@ * the size to multiple of 1K or so. Default to 2K */ -#ifndef CONSERVATIVE #define NETMAP_BUF_MAX_NUM 20*4096*2 /* large machine */ -#else /* CONSERVATIVE */ -#define NETMAP_BUF_MAX_NUM 20000 /* 40MB */ -#endif #ifdef linux #define NMA_LOCK_T struct semaphore @@ -178,7 +176,11 @@ struct netmap_mem_d { struct netmap_obj_pool pools[NETMAP_POOLS_NR]; }; - +/* + * nm_mem is the memory allocator used for all physical interfaces + * running in netmap mode. + * Virtual (VALE) ports will have each its own allocator. + */ static struct netmap_mem_d nm_mem = { /* Our memory allocator. */ .pools = { [NETMAP_IF_POOL] = { @@ -205,6 +207,7 @@ static struct netmap_mem_d nm_mem = { /* }, }; +// XXX logically belongs to nm_mem struct lut_entry *netmap_buffer_lut; /* exported */ /* memory allocator related sysctls */ @@ -212,12 +215,10 @@ struct lut_entry *netmap_buffer_lut; /* #define STRINGIFY(x) #x #define DECLARE_SYSCTLS(id, name) \ - /* TUNABLE_INT("hw.netmap." STRINGIFY(name) "_size", &netmap_params[id].size); */ \ SYSCTL_INT(_dev_netmap, OID_AUTO, name##_size, \ CTLFLAG_RW, &netmap_params[id].size, 0, "Requested size of netmap " STRINGIFY(name) "s"); \ SYSCTL_INT(_dev_netmap, OID_AUTO, name##_curr_size, \ CTLFLAG_RD, &nm_mem.pools[id]._objsize, 0, "Current size of netmap " STRINGIFY(name) "s"); \ - /* TUNABLE_INT("hw.netmap." STRINGIFY(name) "_num", &netmap_params[id].num); */ \ SYSCTL_INT(_dev_netmap, OID_AUTO, name##_num, \ CTLFLAG_RW, &netmap_params[id].num, 0, "Requested number of netmap " STRINGIFY(name) "s"); \ SYSCTL_INT(_dev_netmap, OID_AUTO, name##_curr_num, \ @@ -228,14 +229,12 @@ DECLARE_SYSCTLS(NETMAP_RING_POOL, ring); DECLARE_SYSCTLS(NETMAP_BUF_POOL, buf); /* - * Convert a userspace offset to a phisical address. - * XXX re-do in a simpler way. + * Convert a userspace offset to a physical address. + * XXX only called in the FreeBSD's netmap_mmap() + * because in linux we map everything at once. * - * The idea here is to hide userspace applications the fact that pre-allocated - * memory is not contiguous, but fragmented across different clusters and - * smaller memory allocators. Consequently, first of all we need to find which - * allocator is owning provided offset, then we need to find out the physical - * address associated to target page (this is done using the look-up table. + * First, find the allocator that contains the requested offset, + * then locate the cluster through a lookup table. */ static inline vm_paddr_t netmap_ofstophys(vm_offset_t offset) @@ -247,7 +246,7 @@ netmap_ofstophys(vm_offset_t offset) for (i = 0; i < NETMAP_POOLS_NR; offset -= p[i]._memtotal, i++) { if (offset >= p[i]._memtotal) continue; - // XXX now scan the clusters + // now lookup the cluster's address return p[i].lut[offset / p[i]._objsize].paddr + offset % p[i]._objsize; } @@ -296,12 +295,12 @@ netmap_obj_offset(struct netmap_obj_pool netmap_obj_offset(&nm_mem.pools[NETMAP_IF_POOL], (v)) #define netmap_ring_offset(v) \ - (nm_mem.pools[NETMAP_IF_POOL]._memtotal + \ + (nm_mem.pools[NETMAP_IF_POOL]._memtotal + \ netmap_obj_offset(&nm_mem.pools[NETMAP_RING_POOL], (v))) #define netmap_buf_offset(v) \ - (nm_mem.pools[NETMAP_IF_POOL]._memtotal + \ - nm_mem.pools[NETMAP_RING_POOL]._memtotal + \ + (nm_mem.pools[NETMAP_IF_POOL]._memtotal + \ + nm_mem.pools[NETMAP_RING_POOL]._memtotal + \ netmap_obj_offset(&nm_mem.pools[NETMAP_BUF_POOL], (v))) @@ -356,7 +355,8 @@ netmap_obj_malloc(struct netmap_obj_pool /* - * free by index, not by address + * free by index, not by address. This is slow, but is only used + * for a small number of objects (rings, nifp) */ static void netmap_obj_free(struct netmap_obj_pool *p, uint32_t j) @@ -428,7 +428,7 @@ netmap_new_bufs(struct netmap_if *nifp, * in the NIC ring. This is a hack that hides missing * initializations in the drivers, and should go away. */ - slot[i].flags = NS_BUF_CHANGED; + // slot[i].flags = NS_BUF_CHANGED; } ND("allocated %d buffers, %d available, first at %d", n, p->objfree, pos); @@ -683,7 +683,6 @@ netmap_memory_config(void) { int i; - if (!netmap_memory_config_changed()) goto out; From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 21:49:11 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B0AA5703; Fri, 19 Apr 2013 21:49:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A28EBE6; Fri, 19 Apr 2013 21:49:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3JLnBRM081140; Fri, 19 Apr 2013 21:49:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3JLnBMV081139; Fri, 19 Apr 2013 21:49:11 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304192149.r3JLnBMV081139@svn.freebsd.org> From: Adrian Chadd Date: Fri, 19 Apr 2013 21:49:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249662 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 21:49:11 -0000 Author: adrian Date: Fri Apr 19 21:49:11 2013 New Revision: 249662 URL: http://svnweb.freebsd.org/changeset/base/249662 Log: Initialise the chainmask fields regardless of whether 11n support is compiled in or not. This fixes issues with people running -HEAD but who build modules without doing a "make buildkernel KERNCONF=XXX", thus picking up opt_*.h. The resulting module wouldn't have 11n enabled and the chainmask configuration would just be plain wrong. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Apr 19 21:09:27 2013 (r249661) +++ head/sys/dev/ath/if_ath.c Fri Apr 19 21:49:11 2013 (r249662) @@ -721,6 +721,14 @@ ath_attach(u_int16_t devid, struct ath_s } /* + * Query the TX/RX chainmask configuration. + * + * This is only relevant for 11n devices. + */ + ath_hal_getrxchainmask(ah, &sc->sc_rxchainmask); + ath_hal_gettxchainmask(ah, &sc->sc_txchainmask); + + /* * Disable MRR with protected frames by default. * Only 802.11n series NICs can handle this. */ @@ -777,14 +785,6 @@ ath_attach(u_int16_t devid, struct ath_s */ (void) ath_hal_getcapability(ah, HAL_CAP_STREAMS, 0, &txs); (void) ath_hal_getcapability(ah, HAL_CAP_STREAMS, 1, &rxs); - - ath_hal_getrxchainmask(ah, &sc->sc_rxchainmask); - ath_hal_gettxchainmask(ah, &sc->sc_txchainmask); - - device_printf(sc->sc_dev, "Chainmasks: TX=0x%x; RX=0x%x\n", - sc->sc_txchainmask, - sc->sc_rxchainmask); - ic->ic_txstream = txs; ic->ic_rxstream = rxs; From owner-svn-src-head@FreeBSD.ORG Fri Apr 19 23:49:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1961FDC6; Fri, 19 Apr 2013 23:49:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0954866C; Fri, 19 Apr 2013 23:49:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3JNncWC061135; Fri, 19 Apr 2013 23:49:38 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3JNnYgB061052; Fri, 19 Apr 2013 23:49:34 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201304192349.r3JNnYgB061052@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 19 Apr 2013 23:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249663 - in head: sys/conf sys/contrib/dev/acpica sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/events sys/contrib/dev/ac... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 23:49:38 -0000 Author: jkim Date: Fri Apr 19 23:49:34 2013 New Revision: 249663 URL: http://svnweb.freebsd.org/changeset/base/249663 Log: Merge ACPICA 20130418. Added: head/sys/contrib/dev/acpica/components/namespace/nsarguments.c - copied, changed from r249661, vendor-sys/acpica/dist/source/components/namespace/nsarguments.c Modified: head/sys/conf/files head/sys/contrib/dev/acpica/changes.txt (contents, props changed) head/sys/contrib/dev/acpica/compiler/aslpredef.c head/sys/contrib/dev/acpica/compiler/aslprepkg.c head/sys/contrib/dev/acpica/components/debugger/dbdisply.c head/sys/contrib/dev/acpica/components/debugger/dbexec.c head/sys/contrib/dev/acpica/components/debugger/dbmethod.c head/sys/contrib/dev/acpica/components/debugger/dbnames.c head/sys/contrib/dev/acpica/components/events/evgpe.c head/sys/contrib/dev/acpica/components/events/evregion.c head/sys/contrib/dev/acpica/components/executer/exconfig.c head/sys/contrib/dev/acpica/components/executer/exfldio.c head/sys/contrib/dev/acpica/components/hardware/hwxface.c head/sys/contrib/dev/acpica/components/namespace/nseval.c head/sys/contrib/dev/acpica/components/namespace/nsinit.c head/sys/contrib/dev/acpica/components/namespace/nspredef.c head/sys/contrib/dev/acpica/components/namespace/nsprepkg.c head/sys/contrib/dev/acpica/components/namespace/nsrepair.c head/sys/contrib/dev/acpica/components/namespace/nsrepair2.c head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c head/sys/contrib/dev/acpica/components/parser/psxface.c head/sys/contrib/dev/acpica/components/resources/rsutils.c head/sys/contrib/dev/acpica/components/utilities/uteval.c head/sys/contrib/dev/acpica/components/utilities/utosi.c head/sys/contrib/dev/acpica/components/utilities/utpredef.c head/sys/contrib/dev/acpica/components/utilities/utxferror.c head/sys/contrib/dev/acpica/include/acconfig.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acmacros.h head/sys/contrib/dev/acpica/include/acnamesp.h head/sys/contrib/dev/acpica/include/acoutput.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/acpredef.h head/sys/contrib/dev/acpica/include/acstruct.h head/sys/contrib/dev/acpica/include/acutils.h head/sys/modules/acpi/acpi/Makefile head/usr.sbin/acpi/acpidb/Makefile Directory Properties: head/sys/contrib/dev/acpica/ (props changed) head/sys/contrib/dev/acpica/compiler/ (props changed) head/sys/contrib/dev/acpica/components/debugger/ (props changed) head/sys/contrib/dev/acpica/components/events/ (props changed) head/sys/contrib/dev/acpica/components/executer/ (props changed) head/sys/contrib/dev/acpica/components/hardware/ (props changed) head/sys/contrib/dev/acpica/components/namespace/ (props changed) head/sys/contrib/dev/acpica/components/parser/ (props changed) head/sys/contrib/dev/acpica/components/resources/ (props changed) head/sys/contrib/dev/acpica/components/utilities/ (props changed) head/sys/contrib/dev/acpica/include/ (props changed) head/sys/contrib/dev/acpica/os_specific/ (props changed) Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/conf/files Fri Apr 19 23:49:34 2013 (r249663) @@ -374,6 +374,7 @@ contrib/dev/acpica/components/hardware/h contrib/dev/acpica/components/hardware/hwxfsleep.c optional acpi contrib/dev/acpica/components/namespace/nsaccess.c optional acpi contrib/dev/acpica/components/namespace/nsalloc.c optional acpi +contrib/dev/acpica/components/namespace/nsarguments.c optional acpi contrib/dev/acpica/components/namespace/nsconvert.c optional acpi contrib/dev/acpica/components/namespace/nsdump.c optional acpi contrib/dev/acpica/components/namespace/nseval.c optional acpi Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/changes.txt Fri Apr 19 23:49:34 2013 (r249663) @@ -1,4 +1,91 @@ ---------------------------------------- +18 April 2013. Summary of changes for version 20130418: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Fixed a possible buffer overrun during some rare but specific field unit +read operations. This overrun can only happen if the DSDT version is 1 -- +meaning that all AML integers are 32 bits -- and the field length is +between 33 and 55 bits long. During the read, an internal buffer object is +created for the field unit because the field is larger than an integer (32 +bits). However, in this case, the buffer will be incorrectly written +beyond the end because the buffer length is less than the internal minimum +of 64 bits (8 bytes) long. The buffer will be either 5, 6, or 7 bytes +long, but a full 8 bytes will be written. + +Updated the Embedded Controller "orphan" _REG method support. This refers +to _REG methods under the EC device that have no corresponding operation +region. This is allowed by the ACPI specification. This update removes a +dependency on the existence an ECDT table. It will execute an orphan _REG +method as long as the operation region handler for the EC is installed at +the EC device node and not the namespace root. Rui Zhang (original +update), Bob Moore (update/integrate). + +Implemented run-time argument typechecking for all predefined ACPI names +(_STA, _BIF, etc.) This change performs object typechecking on all +incoming arguments for all predefined names executed via +AcpiEvaluateObject. This ensures that ACPI-related device drivers are +passing correct object types as well as the correct number of arguments +(therefore identifying any issues immediately). Also, the ASL/namespace +definition of the predefined name is checked against the ACPI +specification for the proper argument count. Adds one new file, +nsarguments.c + +Changed an exception code for the ASL UnLoad() operator. Changed the +exception code for the case where the input DdbHandle is invalid, from +AE_BAD_PARAMETER to the more appropriate AE_AML_OPERAND_TYPE. + +Unix/Linux makefiles: Removed the use of the -O2 optimization flag in the +global makefile. The use of this flag causes compiler errors on earlier +versions of GCC, so it has been removed for compatibility. + +Miscellaneous cleanup: +1) Removed some unused/obsolete macros +2) Fixed a possible memory leak in the _OSI support +3) Removed an unused variable in the predefined name support +4) Windows OSL: remove obsolete reference to a memory list field + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 95.2K Code, 26.4K Data, 121.6K Total + Debug Version: 183.0K Code, 76.0K Data, 259.0K Total + Previous Release: + Non-Debug Version: 95.6K Code, 26.8K Data, 122.4K Total + Debug Version: 183.5K Code, 76.6K Data, 260.1K Total + + +2) iASL Compiler/Disassembler and Tools: + +AcpiExec: Added installation of a handler for the SystemCMOS address +space. This prevents control method abort if a method accesses this space. + +AcpiExec: Added support for multiple EC devices, and now install EC +operation region handler(s) at the actual EC device instead of the +namespace root. This reflects the typical behavior of host operating +systems. + +AcpiExec: Updated to ensure that all operation region handlers are +installed before the _REG methods are executed. This prevents a _REG +method from aborting if it accesses an address space has no handler. +AcpiExec installs a handler for every possible address space. + +Debugger: Enhanced the "handlers" command to display non-root handlers. +This change enhances the handlers command to display handlers associated +with individual devices throughout the namespace, in addition to the +currently supported display of handlers associated with the root namespace +node. + +ASL Test Suite: Several test suite errors have been identified and +resolved, reducing the total error count during execution. Chao Guan. + +---------------------------------------- 28 March 2013. Summary of changes for version 20130328: 1) ACPICA kernel-resident subsystem: Modified: head/sys/contrib/dev/acpica/compiler/aslpredef.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslpredef.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/compiler/aslpredef.c Fri Apr 19 23:49:34 2013 (r249663) @@ -124,29 +124,30 @@ ApCheckForPredefinedMethod ( default: /* - * Matched a predefined method name + * Matched a predefined method name - validate the ASL-defined + * argument count against the ACPI specification. * - * Validate the ASL-defined argument count. Allow two different legal - * arg counts. + * Some methods are allowed to have a "minimum" number of args + * (_SCP) because their definition in ACPI has changed over time. */ Gbl_ReservedMethods++; ThisName = &AcpiGbl_PredefinedMethods[Index]; - RequiredArgCount = ThisName->Info.ArgumentList & METHOD_ARG_MASK; + RequiredArgCount = METHOD_GET_ARG_COUNT (ThisName->Info.ArgumentList); if (MethodInfo->NumArguments != RequiredArgCount) { sprintf (MsgBuffer, "%4.4s requires %u", ThisName->Info.Name, RequiredArgCount); - if ((MethodInfo->NumArguments > RequiredArgCount) && - !(ThisName->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) + if (MethodInfo->NumArguments < RequiredArgCount) { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, + AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, MsgBuffer); } - else + else if ((MethodInfo->NumArguments > RequiredArgCount) && + !(ThisName->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, + AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer); } } @@ -388,7 +389,7 @@ ApCheckForPredefinedObject ( * it must be implemented as a control method */ ThisName = &AcpiGbl_PredefinedMethods[Index]; - if ((ThisName->Info.ArgumentList & METHOD_ARG_MASK) > 0) + if (METHOD_GET_ARG_COUNT (ThisName->Info.ArgumentList) > 0) { AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, "with arguments"); Modified: head/sys/contrib/dev/acpica/compiler/aslprepkg.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslprepkg.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/compiler/aslprepkg.c Fri Apr 19 23:49:34 2013 (r249663) @@ -54,12 +54,12 @@ static void ApCheckPackageElements ( - const char *PredefinedName, - ACPI_PARSE_OBJECT *Op, - UINT8 Type1, - UINT32 Count1, - UINT8 Type2, - UINT32 Count2); + const char *PredefinedName, + ACPI_PARSE_OBJECT *Op, + UINT8 Type1, + UINT32 Count1, + UINT8 Type2, + UINT32 Count2); static void ApCheckPackageList ( @@ -93,8 +93,9 @@ ApPackageTooLarge ( * * FUNCTION: ApCheckPackage * - * PARAMETERS: ParentOp - Parser op for the package - * Predefined - Pointer to package-specific info for method + * PARAMETERS: ParentOp - Parser op for the package + * Predefined - Pointer to package-specific info for + * the method * * RETURN: None * @@ -193,8 +194,8 @@ ApCheckPackage ( case ACPI_PTYPE1_VAR: /* - * The package count is variable, there are no sub-packages, and all - * elements must be of the same type + * The package count is variable, there are no sub-packages, + * and all elements must be of the same type */ for (i = 0; i < Count; i++) { @@ -206,9 +207,9 @@ ApCheckPackage ( case ACPI_PTYPE1_OPTION: /* - * The package count is variable, there are no sub-packages. There are - * a fixed number of required elements, and a variable number of - * optional elements. + * The package count is variable, there are no sub-packages. + * There are a fixed number of required elements, and a variable + * number of optional elements. * * Check if package is at least as large as the minimum required */ @@ -268,8 +269,8 @@ ApCheckPackage ( if (ACPI_SUCCESS (Status)) { /* - * Count cannot be larger than the parent package length, but allow it - * to be smaller. The >= accounts for the Integer above. + * Count cannot be larger than the parent package length, but + * allow it to be smaller. The >= accounts for the Integer above. */ ExpectedCount = (UINT32) Op->Asl.Value.Integer; if (ExpectedCount >= Count) @@ -320,12 +321,12 @@ PackageTooSmall: * * FUNCTION: ApCheckPackageElements * - * PARAMETERS: PredefinedName - Pointer to validation data structure - * Op - Parser op for the package - * Type1 - Object type for first group - * Count1 - Count for first group - * Type2 - Object type for second group - * Count2 - Count for second group + * PARAMETERS: PredefinedName - Name of the predefined object + * Op - Parser op for the package + * Type1 - Object type for first group + * Count1 - Count for first group + * Type2 - Object type for second group + * Count2 - Count for second group * * RETURN: None * Modified: head/sys/contrib/dev/acpica/components/debugger/dbdisply.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbdisply.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/components/debugger/dbdisply.c Fri Apr 19 23:49:34 2013 (r249663) @@ -68,6 +68,12 @@ static void * AcpiDbGetPointer ( void *Target); +static ACPI_STATUS +AcpiDbDisplayNonRootHandlers ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); /* * System handler information. @@ -76,6 +82,7 @@ AcpiDbGetPointer ( #define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : " #define ACPI_HANDLER_NAME_STRING "%30s : " #define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n" +#define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)" #define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n" /* All predefined Address Space IDs */ @@ -984,7 +991,7 @@ AcpiDbDisplayHandlers ( /* Operation region handlers */ - AcpiOsPrintf ("\nOperation Region Handlers:\n"); + AcpiOsPrintf ("\nOperation Region Handlers at the namespace root:\n"); ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); if (ObjDesc) @@ -1076,6 +1083,77 @@ AcpiDbDisplayHandlers ( AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } } + + + /* Other handlers that are installed throughout the namespace */ + + AcpiOsPrintf ("\nOperation Region Handlers for specific devices:\n"); + + (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, AcpiDbDisplayNonRootHandlers, + NULL, NULL, NULL); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDisplayNonRootHandlers + * + * PARAMETERS: ACPI_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Display information about all handlers installed for a + * device object. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbDisplayNonRootHandlers ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *HandlerObj; + char *Pathname; + + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + return (AE_OK); + } + + Pathname = AcpiNsGetExternalPathname (Node); + if (!Pathname) + { + return (AE_OK); + } + + /* Display all handlers associated with this device */ + + HandlerObj = ObjDesc->Device.Handler; + while (HandlerObj) + { + AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, + AcpiUtGetRegionName ((UINT8) HandlerObj->AddressSpace.SpaceId), + HandlerObj->AddressSpace.SpaceId); + + AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING2, + (HandlerObj->AddressSpace.HandlerFlags & + ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", + HandlerObj->AddressSpace.Handler); + + AcpiOsPrintf (" Device Name: %s (%p)\n", Pathname, Node); + + HandlerObj = HandlerObj->AddressSpace.Next; + } + + ACPI_FREE (Pathname); + return (AE_OK); } #endif /* ACPI_DEBUGGER */ Modified: head/sys/contrib/dev/acpica/components/debugger/dbexec.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbexec.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/components/debugger/dbexec.c Fri Apr 19 23:49:34 2013 (r249663) @@ -151,8 +151,7 @@ AcpiDbExecuteMethod ( { ACPI_STATUS Status; ACPI_OBJECT_LIST ParamObjects; - ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; - ACPI_DEVICE_INFO *ObjInfo; + ACPI_OBJECT Params[ACPI_DEBUGGER_MAX_ARGS + 1]; UINT32 i; @@ -164,78 +163,30 @@ AcpiDbExecuteMethod ( AcpiOsPrintf ("Warning: debug output is not enabled!\n"); } - /* Get the object info for number of method parameters */ - - Status = AcpiGetObjectInfo (Info->Method, &ObjInfo); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - + ParamObjects.Count = 0; ParamObjects.Pointer = NULL; - ParamObjects.Count = 0; - - if (ObjInfo->Type == ACPI_TYPE_METHOD) - { - /* Are there arguments to the method? */ - i = 0; - if (Info->Args && Info->Args[0]) - { - /* Get arguments passed on the command line */ + /* Pass through any command-line arguments */ - for (; Info->Args[i] && - (i < ACPI_METHOD_NUM_ARGS) && - (i < ObjInfo->ParamCount); - i++) - { - /* Convert input string (token) to an actual ACPI_OBJECT */ - - Status = AcpiDbConvertToObject (Info->Types[i], - Info->Args[i], &Params[i]); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While parsing method arguments")); - goto Cleanup; - } - } - } - - /* Create additional "default" parameters as needed */ + if (Info->Args && Info->Args[0]) + { + /* Get arguments passed on the command line */ - if (i < ObjInfo->ParamCount) + for (i = 0; (Info->Args[i] && *(Info->Args[i])); i++) { - AcpiOsPrintf ("Adding %u arguments containing default values\n", - ObjInfo->ParamCount - i); + /* Convert input string (token) to an actual ACPI_OBJECT */ - for (; i < ObjInfo->ParamCount; i++) + Status = AcpiDbConvertToObject (Info->Types[i], + Info->Args[i], &Params[i]); + if (ACPI_FAILURE (Status)) { - switch (i) - { - case 0: - - Params[0].Type = ACPI_TYPE_INTEGER; - Params[0].Integer.Value = 0x01020304; - break; - - case 1: - - Params[1].Type = ACPI_TYPE_STRING; - Params[1].String.Length = 12; - Params[1].String.Pointer = "AML Debugger"; - break; - - default: - - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = i * (UINT64) 0x1000; - break; - } + ACPI_EXCEPTION ((AE_INFO, Status, + "While parsing method arguments")); + goto Cleanup; } } - ParamObjects.Count = ObjInfo->ParamCount; + ParamObjects.Count = i; ParamObjects.Pointer = Params; } @@ -247,8 +198,8 @@ AcpiDbExecuteMethod ( /* Do the actual method execution */ AcpiGbl_MethodExecuting = TRUE; - Status = AcpiEvaluateObject (NULL, - Info->Pathname, &ParamObjects, ReturnObj); + Status = AcpiEvaluateObject (NULL, Info->Pathname, + &ParamObjects, ReturnObj); AcpiGbl_CmSingleStep = FALSE; AcpiGbl_MethodExecuting = FALSE; @@ -267,9 +218,7 @@ AcpiDbExecuteMethod ( } Cleanup: - AcpiDbDeleteObjects (ObjInfo->ParamCount, Params); - ACPI_FREE (ObjInfo); - + AcpiDbDeleteObjects (ParamObjects.Count, Params); return_ACPI_STATUS (Status); } Modified: head/sys/contrib/dev/acpica/components/debugger/dbmethod.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbmethod.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/components/debugger/dbmethod.c Fri Apr 19 23:49:34 2013 (r249663) @@ -49,6 +49,7 @@ #include #include #include +#include #ifdef ACPI_DEBUGGER @@ -437,17 +438,23 @@ AcpiDbWalkForExecute ( void *Context, void **ReturnValue) { - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; - ACPI_BUFFER ReturnObj; - ACPI_STATUS Status; - char *Pathname; - UINT32 i; - ACPI_DEVICE_INFO *ObjInfo; - ACPI_OBJECT_LIST ParamObjects; - ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; - const ACPI_PREDEFINED_INFO *Predefined; + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; + char *Pathname; + const ACPI_PREDEFINED_INFO *Predefined; + ACPI_DEVICE_INFO *ObjInfo; + ACPI_OBJECT_LIST ParamObjects; + ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; + ACPI_OBJECT *ThisParam; + ACPI_BUFFER ReturnObj; + ACPI_STATUS Status; + UINT16 ArgTypeList; + UINT8 ArgCount; + UINT8 ArgType; + UINT32 i; + + /* The name must be a predefined ACPI name */ Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); if (!Predefined) @@ -474,21 +481,59 @@ AcpiDbWalkForExecute ( return (Status); } + ParamObjects.Count = 0; ParamObjects.Pointer = NULL; - ParamObjects.Count = 0; if (ObjInfo->Type == ACPI_TYPE_METHOD) { - /* Setup default parameters */ + /* Setup default parameters (with proper types) */ + + ArgTypeList = Predefined->Info.ArgumentList; + ArgCount = METHOD_GET_ARG_COUNT (ArgTypeList); - for (i = 0; i < ObjInfo->ParamCount; i++) + /* + * Setup the ACPI-required number of arguments, regardless of what + * the actual method defines. If there is a difference, then the + * method is wrong and a warning will be issued during execution. + */ + ThisParam = Params; + for (i = 0; i < ArgCount; i++) { - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = 1; + ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList); + ThisParam->Type = ArgType; + + switch (ArgType) + { + case ACPI_TYPE_INTEGER: + ThisParam->Integer.Value = 1; + break; + + case ACPI_TYPE_STRING: + ThisParam->String.Pointer = "This is the default argument string"; + ThisParam->String.Length = ACPI_STRLEN (ThisParam->String.Pointer); + break; + + case ACPI_TYPE_BUFFER: + ThisParam->Buffer.Pointer = (UINT8 *) Params; /* just a garbage buffer */ + ThisParam->Buffer.Length = 48; + break; + + case ACPI_TYPE_PACKAGE: + ThisParam->Package.Elements = NULL; + ThisParam->Package.Count = 0; + break; + + default: + AcpiOsPrintf ("%s: Unsupported argument type: %u\n", + Pathname, ArgType); + break; + } + + ThisParam++; } - ParamObjects.Pointer = Params; - ParamObjects.Count = ObjInfo->ParamCount; + ParamObjects.Count = ArgCount; + ParamObjects.Pointer = Params; } ACPI_FREE (ObjInfo); Modified: head/sys/contrib/dev/acpica/components/debugger/dbnames.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbnames.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/components/debugger/dbnames.c Fri Apr 19 23:49:34 2013 (r249663) @@ -435,6 +435,7 @@ AcpiDbWalkForPredefinedNames ( const ACPI_PREDEFINED_INFO *Predefined; const ACPI_PREDEFINED_INFO *Package = NULL; char *Pathname; + char StringBuffer[48]; Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); @@ -456,23 +457,28 @@ AcpiDbWalkForPredefinedNames ( Package = Predefined + 1; } - AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname, - (Predefined->Info.ArgumentList & METHOD_ARG_MASK), + AcpiUtGetExpectedReturnTypes (StringBuffer, Predefined->Info.ExpectedBtypes); + AcpiOsPrintf ("%-32s Arguments %X, Return Types: %s", Pathname, + METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList), + StringBuffer); + if (Package) { - AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X", + AcpiOsPrintf (" (PkgType %2.2X, ObjType %2.2X, Count %2.2X)", Package->RetInfo.Type, Package->RetInfo.ObjectType1, Package->RetInfo.Count1); } AcpiOsPrintf("\n"); - AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined); + /* Check that the declared argument count matches the ACPI spec */ + + AcpiNsCheckAcpiCompliance (Pathname, Node, Predefined); + ACPI_FREE (Pathname); (*Count)++; - return (AE_OK); } Modified: head/sys/contrib/dev/acpica/components/events/evgpe.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evgpe.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/components/events/evgpe.c Fri Apr 19 23:49:34 2013 (r249663) @@ -628,7 +628,6 @@ AcpiEvAsynchExecuteGpeMethod ( "while evaluating GPE method [%4.4s]", AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode))); } - break; default: Modified: head/sys/contrib/dev/acpica/components/events/evregion.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evregion.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/components/events/evregion.c Fri Apr 19 23:49:34 2013 (r249663) @@ -60,7 +60,7 @@ extern UINT8 AcpiGbl_DefaultAddre static void AcpiEvOrphanEcRegMethod ( - void); + ACPI_NAMESPACE_NODE *EcDeviceNode); static ACPI_STATUS AcpiEvRegRun ( @@ -564,7 +564,7 @@ AcpiEvExecuteRegMethod ( } Info->PrefixNode = RegionObj2->Extra.Method_REG; - Info->Pathname = NULL; + Info->RelativePathname = NULL; Info->Parameters = Args; Info->Flags = ACPI_IGNORE_RETURN_VALUE; @@ -650,7 +650,7 @@ AcpiEvExecuteRegMethods ( if (SpaceId == ACPI_ADR_SPACE_EC) { - AcpiEvOrphanEcRegMethod (); + AcpiEvOrphanEcRegMethod (Node); } return_ACPI_STATUS (Status); @@ -728,7 +728,7 @@ AcpiEvRegRun ( * * FUNCTION: AcpiEvOrphanEcRegMethod * - * PARAMETERS: None + * PARAMETERS: EcDeviceNode - Namespace node for an EC device * * RETURN: None * @@ -740,41 +740,30 @@ AcpiEvRegRun ( * detected by providing a _REG method object underneath the * Embedded Controller device." * - * To quickly access the EC device, we use the EC_ID that appears - * within the ECDT. Otherwise, we would need to perform a time- - * consuming namespace walk, executing _HID methods to find the - * EC device. + * To quickly access the EC device, we use the EcDeviceNode used + * during EC handler installation. Otherwise, we would need to + * perform a time consuming namespace walk, executing _HID + * methods to find the EC device. + * + * MUTEX: Assumes the namespace is locked * ******************************************************************************/ static void AcpiEvOrphanEcRegMethod ( - void) + ACPI_NAMESPACE_NODE *EcDeviceNode) { - ACPI_TABLE_ECDT *Table; + ACPI_HANDLE RegMethod; + ACPI_NAMESPACE_NODE *NextNode; ACPI_STATUS Status; ACPI_OBJECT_LIST Args; ACPI_OBJECT Objects[2]; - ACPI_NAMESPACE_NODE *EcDeviceNode; - ACPI_NAMESPACE_NODE *RegMethod; - ACPI_NAMESPACE_NODE *NextNode; ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod); - /* Get the ECDT (if present in system) */ - - Status = AcpiGetTable (ACPI_SIG_ECDT, 0, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Table)); - if (ACPI_FAILURE (Status)) - { - return_VOID; - } - - /* We need a valid EC_ID string */ - - if (!(*Table->Id)) + if (!EcDeviceNode) { return_VOID; } @@ -783,23 +772,12 @@ AcpiEvOrphanEcRegMethod ( (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - /* Get a handle to the EC device referenced in the ECDT */ - - Status = AcpiGetHandle (NULL, - ACPI_CAST_PTR (char, Table->Id), - ACPI_CAST_PTR (ACPI_HANDLE, &EcDeviceNode)); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - /* Get a handle to a _REG method immediately under the EC device */ - Status = AcpiGetHandle (EcDeviceNode, - METHOD_NAME__REG, ACPI_CAST_PTR (ACPI_HANDLE, &RegMethod)); + Status = AcpiGetHandle (EcDeviceNode, METHOD_NAME__REG, &RegMethod); if (ACPI_FAILURE (Status)) { - goto Exit; + goto Exit; /* There is no _REG method present */ } /* @@ -807,7 +785,7 @@ AcpiEvOrphanEcRegMethod ( * this scope with the Embedded Controller space ID. Otherwise, it * will already have been executed. Note, this allows for Regions * with other space IDs to be present; but the code below will then - * execute the _REG method with the EC space ID argument. + * execute the _REG method with the EmbeddedControl SpaceID argument. */ NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL); while (NextNode) @@ -816,12 +794,13 @@ AcpiEvOrphanEcRegMethod ( (NextNode->Object) && (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC)) { - goto Exit; /* Do not execute _REG */ + goto Exit; /* Do not execute the _REG */ } + NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode); } - /* Evaluate the _REG(EC,Connect) method */ + /* Evaluate the _REG(EmbeddedControl,Connect) method */ Args.Count = 2; Args.Pointer = Objects; Modified: head/sys/contrib/dev/acpica/components/executer/exconfig.c ============================================================================== --- head/sys/contrib/dev/acpica/components/executer/exconfig.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/components/executer/exconfig.c Fri Apr 19 23:49:34 2013 (r249663) @@ -643,7 +643,7 @@ AcpiExUnloadTable ( (DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) || (!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID))) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } /* Get the table index from the DdbHandle */ Modified: head/sys/contrib/dev/acpica/components/executer/exfldio.c ============================================================================== --- head/sys/contrib/dev/acpica/components/executer/exfldio.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/components/executer/exfldio.c Fri Apr 19 23:49:34 2013 (r249663) @@ -766,7 +766,18 @@ AcpiExExtractFromField ( if ((ObjDesc->CommonField.StartFieldBitOffset == 0) && (ObjDesc->CommonField.BitLength == AccessBitWidth)) { - Status = AcpiExFieldDatumIo (ObjDesc, 0, Buffer, ACPI_READ); + if (BufferLength >= sizeof (UINT64)) + { + Status = AcpiExFieldDatumIo (ObjDesc, 0, Buffer, ACPI_READ); + } + else + { + /* Use RawDatum (UINT64) to handle buffers < 64 bits */ + + Status = AcpiExFieldDatumIo (ObjDesc, 0, &RawDatum, ACPI_READ); + ACPI_MEMCPY (Buffer, &RawDatum, BufferLength); + } + return_ACPI_STATUS (Status); } Modified: head/sys/contrib/dev/acpica/components/hardware/hwxface.c ============================================================================== --- head/sys/contrib/dev/acpica/components/hardware/hwxface.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/components/hardware/hwxface.c Fri Apr 19 23:49:34 2013 (r249663) @@ -556,7 +556,8 @@ AcpiGetSleepTypeData ( * Evaluate the \_Sx namespace object containing the register values * for this state */ - Info->Pathname = ACPI_CAST_PTR (char, AcpiGbl_SleepStateNames[SleepState]); + Info->RelativePathname = ACPI_CAST_PTR ( + char, AcpiGbl_SleepStateNames[SleepState]); Status = AcpiNsEvaluate (Info); if (ACPI_FAILURE (Status)) { @@ -568,7 +569,7 @@ AcpiGetSleepTypeData ( if (!Info->ReturnObject) { ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]", - Info->Pathname)); + Info->RelativePathname)); Status = AE_AML_NO_RETURN_VALUE; goto Cleanup; } @@ -630,7 +631,7 @@ Cleanup: if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "While evaluating Sleep State [%s]", Info->Pathname)); + "While evaluating Sleep State [%s]", Info->RelativePathname)); } ACPI_FREE (Info); Copied and modified: head/sys/contrib/dev/acpica/components/namespace/nsarguments.c (from r249661, vendor-sys/acpica/dist/source/components/namespace/nsarguments.c) ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsarguments.c Fri Apr 19 21:09:27 2013 (r249661, copy source) +++ head/sys/contrib/dev/acpica/components/namespace/nsarguments.c Fri Apr 19 23:49:34 2013 (r249663) @@ -41,10 +41,10 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acpredef.h" +#include +#include +#include +#include #define _COMPONENT ACPI_NAMESPACE Modified: head/sys/contrib/dev/acpica/components/namespace/nseval.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nseval.c Fri Apr 19 21:49:11 2013 (r249662) +++ head/sys/contrib/dev/acpica/components/namespace/nseval.c Fri Apr 19 23:49:34 2013 (r249663) @@ -67,7 +67,7 @@ AcpiNsExecModuleCode ( * * PARAMETERS: Info - Evaluation info block, contains: * PrefixNode - Prefix or Method/Object Node to execute - * Pathname - Name of method to execute, If NULL, the + * RelativePath - Name of method to execute, If NULL, the * Node is the object to execute * Parameters - List of parameters to pass to the method, * terminated by NULL. Params itself may be @@ -93,7 +93,6 @@ AcpiNsEvaluate ( ACPI_EVALUATE_INFO *Info) { ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; ACPI_FUNCTION_TRACE (NsEvaluate); @@ -104,23 +103,18 @@ AcpiNsEvaluate ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Initialize the return value to an invalid object */ - - Info->ReturnObject = NULL; - Info->ParamCount = 0; - - if (!Info->ResolvedNode) + if (!Info->Node) { /* - * Get the actual namespace node for the target object if we need to. - * Handles these cases: + * Get the actual namespace node for the target object if we + * need to. Handles these cases: * - * 1) Null node, Pathname (absolute path) - * 2) Node, Pathname (path relative to Node) - * 3) Node, Null Pathname + * 1) Null node, valid pathname from root (absolute path) + * 2) Node and valid pathname (path relative to Node) + * 3) Node, Null pathname */ - Status = AcpiNsGetNode (Info->PrefixNode, Info->Pathname, - ACPI_NS_NO_UPSEARCH, &Info->ResolvedNode); + Status = AcpiNsGetNode (Info->PrefixNode, Info->RelativePathname, + ACPI_NS_NO_UPSEARCH, &Info->Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -128,60 +122,122 @@ AcpiNsEvaluate ( } /* - * For a method alias, we must grab the actual method node so that proper - * scoping context will be established before execution. + * For a method alias, we must grab the actual method node so that + * proper scoping context will be established before execution. */ - if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_LOCAL_METHOD_ALIAS) + if (AcpiNsGetType (Info->Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) + { + Info->Node = ACPI_CAST_PTR ( + ACPI_NAMESPACE_NODE, Info->Node->Object); + } + + /* Complete the info block initialization */ + + Info->ReturnObject = NULL; + Info->NodeFlags = Info->Node->Flags; + Info->ObjDesc = AcpiNsGetAttachedObject (Info->Node); + + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", + Info->RelativePathname, Info->Node, + AcpiNsGetAttachedObject (Info->Node))); + + /* Get info if we have a predefined name (_HID, etc.) */ + + Info->Predefined = AcpiUtMatchPredefinedMethod (Info->Node->Name.Ascii); + + /* Get the full pathname to the object, for use in warning messages */ + + Info->FullPathname = AcpiNsGetExternalPathname (Info->Node); + if (!Info->FullPathname) { - Info->ResolvedNode = - ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Info->ResolvedNode->Object); + return_ACPI_STATUS (AE_NO_MEMORY); } - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", Info->Pathname, - Info->ResolvedNode, AcpiNsGetAttachedObject (Info->ResolvedNode))); + /* Count the number of arguments being passed in */ + + Info->ParamCount = 0; + if (Info->Parameters) + { + while (Info->Parameters[Info->ParamCount]) + { + Info->ParamCount++; + } + + /* Warn on impossible argument count */ + + if (Info->ParamCount > ACPI_METHOD_NUM_ARGS) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS, + "Excess arguments (%u) - using only %u", + Info->ParamCount, ACPI_METHOD_NUM_ARGS)); + + Info->ParamCount = ACPI_METHOD_NUM_ARGS; + } + } + + /* + * For predefined names: Check that the declared argument count + * matches the ACPI spec -- otherwise this is a BIOS error. + */ + AcpiNsCheckAcpiCompliance (Info->FullPathname, Info->Node, + Info->Predefined); + + /* + * For all names: Check that the incoming argument count for + * this method/object matches the actual ASL/AML definition. + */ + AcpiNsCheckArgumentCount (Info->FullPathname, Info->Node, + Info->ParamCount, Info->Predefined); + + /* For predefined names: Typecheck all incoming arguments */ - Node = Info->ResolvedNode; + AcpiNsCheckArgumentTypes (Info); /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 00:33:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 656C1537; Sat, 20 Apr 2013 00:33:38 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 570A97CF; Sat, 20 Apr 2013 00:33:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K0Xb2M025898; Sat, 20 Apr 2013 00:33:37 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K0XbG1025892; Sat, 20 Apr 2013 00:33:37 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201304200033.r3K0XbG1025892@svn.freebsd.org> From: Sean Bruno Date: Sat, 20 Apr 2013 00:33:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249664 - in head/sys: cam conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 00:33:38 -0000 Author: sbruno Date: Sat Apr 20 00:33:37 2013 New Revision: 249664 URL: http://svnweb.freebsd.org/changeset/base/249664 Log: Expose CAM_BOOT_DELAY as a kernel conf item now. This allows users who boot without loader to adjust their environments around slightly buggy or slow hardware. PR: kern/161809 Submitted by: rozhuk.im@gmail.com MFC after: 2 weeks Modified: head/sys/cam/cam_xpt.c head/sys/conf/options Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Fri Apr 19 23:49:34 2013 (r249663) +++ head/sys/cam/cam_xpt.c Sat Apr 20 00:33:37 2013 (r249664) @@ -878,6 +878,13 @@ xpt_init(void *dummy) mtx_init(&xsoftc.xpt_lock, "XPT lock", NULL, MTX_DEF); mtx_init(&xsoftc.xpt_topo_lock, "XPT topology lock", NULL, MTX_DEF); +#ifdef CAM_BOOT_DELAY + /* + * Override this value at compile time to assist our users + * who don't use loader to boot a kernel. + */ + xsoftc.boot_delay = CAM_BOOT_DELAY; +#endif /* * The xpt layer is, itself, the equivelent of a SIM. * Allow 16 ccbs in the ccb pool for it. This should Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Fri Apr 19 23:49:34 2013 (r249663) +++ head/sys/conf/options Sat Apr 20 00:33:37 2013 (r249664) @@ -307,6 +307,7 @@ CAM_DEBUG_BUS opt_cam.h CAM_DEBUG_TARGET opt_cam.h CAM_DEBUG_LUN opt_cam.h CAM_DEBUG_FLAGS opt_cam.h +CAM_BOOT_DELAY opt_cam.h SCSI_DELAY opt_scsi.h SCSI_NO_SENSE_STRINGS opt_scsi.h SCSI_NO_OP_STRINGS opt_scsi.h From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 01:12:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E5842872; Sat, 20 Apr 2013 01:12:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D78E888E; Sat, 20 Apr 2013 01:12:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K1CNDC081183; Sat, 20 Apr 2013 01:12:23 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K1CNqN081181; Sat, 20 Apr 2013 01:12:23 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201304200112.r3K1CNqN081181@svn.freebsd.org> From: Warner Losh Date: Sat, 20 Apr 2013 01:12:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249665 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 01:12:24 -0000 Author: imp Date: Sat Apr 20 01:12:23 2013 New Revision: 249665 URL: http://svnweb.freebsd.org/changeset/base/249665 Log: Add note about fagility of the clang upgrade process. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Apr 20 00:33:37 2013 (r249664) +++ head/UPDATING Sat Apr 20 01:12:23 2013 (r249665) @@ -11,6 +11,11 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +NOTE: FreeBSD has switched from gcc to clang. If you have trouble bootstrapping +from older versions of FreeBSD, try WITHOUT_CLANG and WITHOUT_CLANG_IS_CC to +bootstrap to tip of head, and then rebuild without those options. The bootstrap +process from older version of current is a bit fragile. + NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW: FreeBSD 10.x has many debugging features turned on, in both the kernel and userland. These features attempt to detect incorrect use of From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 07:47:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 811316C6; Sat, 20 Apr 2013 07:47:28 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 64063118F; Sat, 20 Apr 2013 07:47:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K7lSxe084624; Sat, 20 Apr 2013 07:47:28 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K7lQov084588; Sat, 20 Apr 2013 07:47:26 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200747.r3K7lQov084588@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 07:47:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249666 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 07:47:28 -0000 Author: trociny Date: Sat Apr 20 07:47:26 2013 New Revision: 249666 URL: http://svnweb.freebsd.org/changeset/base/249666 Log: Make libprocstat(3) extract procstat notes from a process core file. PR: kern/173723 Suggested by: jhb Glanced by: kib MFC after: 1 month Added: head/lib/libprocstat/core.c (contents, props changed) head/lib/libprocstat/core.h (contents, props changed) Modified: head/lib/libprocstat/Makefile head/lib/libprocstat/Symbol.map head/lib/libprocstat/libprocstat.3 head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h head/lib/libprocstat/libprocstat_internal.h Modified: head/lib/libprocstat/Makefile ============================================================================== --- head/lib/libprocstat/Makefile Sat Apr 20 01:12:23 2013 (r249665) +++ head/lib/libprocstat/Makefile Sat Apr 20 07:47:26 2013 (r249666) @@ -6,6 +6,7 @@ LIB= procstat SRCS= cd9660.c \ common_kvm.c \ + core.c \ libprocstat.c \ msdosfs.c \ udf.c @@ -17,8 +18,8 @@ INCS= libprocstat.h CFLAGS+= -I. -I${.CURDIR} -D_KVM_VNODE SHLIB_MAJOR= 1 -DPADD= ${LIBKVM} ${LIBUTIL} -LDADD= -lkvm -lutil +DPADD= ${LIBELF} ${LIBKVM} ${LIBUTIL} +LDADD= -lelf -lkvm -lutil MAN= libprocstat.3 Modified: head/lib/libprocstat/Symbol.map ============================================================================== --- head/lib/libprocstat/Symbol.map Sat Apr 20 01:12:23 2013 (r249665) +++ head/lib/libprocstat/Symbol.map Sat Apr 20 07:47:26 2013 (r249666) @@ -17,4 +17,5 @@ FBSD_1.2 { FBSD_1.3 { procstat_get_shm_info; + procstat_open_core; }; Added: head/lib/libprocstat/core.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libprocstat/core.c Sat Apr 20 07:47:26 2013 (r249666) @@ -0,0 +1,262 @@ +/*- + * Copyright (c) 2013 Mikolaj Golub + * All rights reserved. + * + * 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. + * + * 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. + * + * $FreeBSD$ + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "core.h" + +#define PROCSTAT_CORE_MAGIC 0x012DADB8 +struct procstat_core +{ + int pc_magic; + int pc_fd; + Elf *pc_elf; + GElf_Ehdr pc_ehdr; + GElf_Phdr pc_phdr; +}; + +static bool core_offset(struct procstat_core *core, off_t offset); +static bool core_read(struct procstat_core *core, void *buf, size_t len); + +struct procstat_core * +procstat_core_open(const char *filename) +{ + struct procstat_core *core; + Elf *e; + GElf_Ehdr ehdr; + GElf_Phdr phdr; + size_t nph; + int fd, i; + + if (elf_version(EV_CURRENT) == EV_NONE) { + warnx("ELF library too old"); + return (NULL); + } + fd = open(filename, O_RDONLY, 0); + if (fd == -1) { + warn("open(%s)", filename); + return (NULL); + } + e = elf_begin(fd, ELF_C_READ, NULL); + if (e == NULL) { + warnx("elf_begin: %s", elf_errmsg(-1)); + goto fail; + } + if (elf_kind(e) != ELF_K_ELF) { + warnx("%s is not an ELF object", filename); + goto fail; + } + if (gelf_getehdr(e, &ehdr) == NULL) { + warnx("gelf_getehdr: %s", elf_errmsg(-1)); + goto fail; + } + if (ehdr.e_type != ET_CORE) { + warnx("%s is not a CORE file", filename); + goto fail; + } + if (elf_getphnum(e, &nph) == 0) { + warnx("program headers not found"); + goto fail; + } + for (i = 0; i < ehdr.e_phnum; i++) { + if (gelf_getphdr(e, i, &phdr) != &phdr) { + warnx("gelf_getphdr: %s", elf_errmsg(-1)); + goto fail; + } + if (phdr.p_type == PT_NOTE) + break; + } + if (i == ehdr.e_phnum) { + warnx("NOTE program header not found"); + goto fail; + } + core = malloc(sizeof(struct procstat_core)); + if (core == NULL) { + warn("malloc(%zu)", sizeof(struct procstat_core)); + goto fail; + } + core->pc_magic = PROCSTAT_CORE_MAGIC; + core->pc_fd = fd; + core->pc_elf = e; + core->pc_ehdr = ehdr; + core->pc_phdr = phdr; + + return (core); +fail: + if (e != NULL) + elf_end(e); + close(fd); + + return (NULL); +} + +void +procstat_core_close(struct procstat_core *core) +{ + + assert(core->pc_magic == PROCSTAT_CORE_MAGIC); + + elf_end(core->pc_elf); + close(core->pc_fd); + free(core); +} + +void * +procstat_core_get(struct procstat_core *core, enum psc_type type, void *buf, + size_t *lenp) +{ + Elf_Note nhdr; + off_t offset, eoffset; + void *freebuf; + size_t len; + u_int32_t n_type; + int cstructsize, structsize; + char nbuf[8]; + + assert(core->pc_magic == PROCSTAT_CORE_MAGIC); + + switch(type) { + case PSC_TYPE_PROC: + n_type = NT_PROCSTAT_PROC; + structsize = sizeof(struct kinfo_proc); + break; + case PSC_TYPE_FILES: + n_type = NT_PROCSTAT_FILES; + structsize = sizeof(struct kinfo_file); + break; + case PSC_TYPE_VMMAP: + n_type = NT_PROCSTAT_VMMAP; + structsize = sizeof(struct kinfo_vmentry); + break; + default: + warnx("unknown core stat type: %d", type); + return (NULL); + } + + offset = core->pc_phdr.p_offset; + eoffset = offset + core->pc_phdr.p_filesz; + + while (offset < eoffset) { + if (!core_offset(core, offset)) + return (NULL); + if (!core_read(core, &nhdr, sizeof(nhdr))) + return (NULL); + + offset += sizeof(nhdr) + + roundup2(nhdr.n_namesz, sizeof(Elf32_Size)) + + roundup2(nhdr.n_descsz, sizeof(Elf32_Size)); + + if (nhdr.n_namesz == 0 && nhdr.n_descsz == 0) + break; + if (nhdr.n_type != n_type) + continue; + if (nhdr.n_namesz != 8) + continue; + if (!core_read(core, nbuf, sizeof(nbuf))) + return (NULL); + if (strcmp(nbuf, "FreeBSD") != 0) + continue; + if (nhdr.n_descsz < sizeof(cstructsize)) { + warnx("corrupted core file"); + return (NULL); + } + if (!core_read(core, &cstructsize, sizeof(cstructsize))) + return (NULL); + if (cstructsize != structsize) { + warnx("version mismatch"); + return (NULL); + } + len = nhdr.n_descsz - sizeof(cstructsize); + if (len == 0) + return (NULL); + if (buf != NULL) { + len = MIN(len, *lenp); + freebuf = NULL; + } else { + freebuf = buf = malloc(len); + if (buf == NULL) { + warn("malloc(%zu)", len); + return (NULL); + } + } + if (!core_read(core, buf, len)) { + free(freebuf); + return (NULL); + } + *lenp = len; + return (buf); + } + + return (NULL); +} + +static bool +core_offset(struct procstat_core *core, off_t offset) +{ + + assert(core->pc_magic == PROCSTAT_CORE_MAGIC); + + if (lseek(core->pc_fd, offset, SEEK_SET) == -1) { + warn("core: lseek(%jd)", (intmax_t)offset); + return (false); + } + return (true); +} + +static bool +core_read(struct procstat_core *core, void *buf, size_t len) +{ + ssize_t n; + + assert(core->pc_magic == PROCSTAT_CORE_MAGIC); + + n = read(core->pc_fd, buf, len); + if (n == -1) { + warn("core: read"); + return (false); + } + if (n < (ssize_t)len) { + warnx("core: short read"); + return (false); + } + return (true); +} Added: head/lib/libprocstat/core.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libprocstat/core.h Sat Apr 20 07:47:26 2013 (r249666) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2013 Mikolaj Golub + * All rights reserved. + * + * 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. + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _CORE_H +#define _CORE_H + +enum psc_type { + PSC_TYPE_PROC, + PSC_TYPE_FILES, + PSC_TYPE_VMMAP, +}; + +struct procstat_core; + +void procstat_core_close(struct procstat_core *core); +void *procstat_core_get(struct procstat_core *core, enum psc_type type, + void * buf, size_t *lenp); +struct procstat_core *procstat_core_open(const char *filename); + +#endif /* !_CORE_H_ */ Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 01:12:23 2013 (r249665) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 07:47:26 2013 (r249666) @@ -28,6 +28,7 @@ .Dt LIBPROCSTAT 3 .Os .Sh NAME +.Nm procstat_open_core , .Nm procstat_open_kvm , .Nm procstat_open_sysctl , .Nm procstat_close , @@ -105,6 +106,8 @@ .Fa "unsigned int *count" .Fc .Ft "struct procstat *" +.Fn procstat_open_core "const char *filename" +.Ft "struct procstat *" .Fn procstat_open_kvm "const char *nlistf" "const char *memf" .Ft "struct procstat *" .Fn procstat_open_sysctl void @@ -116,7 +119,11 @@ retrieval from the running kernel via th .Xr sysctl 3 library backend, and for post-mortem analysis via the .Xr kvm 3 -library backend. +library backend, or from the process +.Xr core 5 +file, searching for statistics in special +.Xr elf 3 +note sections. .Pp The .Fn procstat_open_kvm @@ -129,6 +136,16 @@ or library routines, respectively, to access kernel state information used to retrieve processes and files states. The +.Fn procstat_open_core +uses +.Xr elf 3 +routines to access statistics stored as a set of notes in a process +.Xr core 5 +file, written by the kernel at the moment of the process abnormal termination. +The +.Fa filename +argument is the process core file name. +The .Fa nlistf argument is the executable image of the kernel being examined. If this argument is @@ -145,7 +162,7 @@ is assumed. See .Xr kvm_open 3 for more details. -Both functions dynamically allocate and return a +The functions dynamically allocate and return a .Vt procstat structure pointer used in the rest of the .Nm libprocstat @@ -250,10 +267,12 @@ argument indicates an actual error messa .Xr pipe 2 , .Xr shm_open 2 , .Xr socket 2 , +.Xr elf 3 , .Xr kvm 3 , .Xr queue 3 , .Xr sysctl 3 , .Xr pts 4 , +.Xr core 5 , .Xr vnode 9 .Sh HISTORY The Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Apr 20 01:12:23 2013 (r249665) +++ head/lib/libprocstat/libprocstat.c Sat Apr 20 07:47:26 2013 (r249666) @@ -96,11 +96,13 @@ __FBSDID("$FreeBSD$"); #include #include "libprocstat_internal.h" #include "common_kvm.h" +#include "core.h" int statfs(const char *, struct statfs *); /* XXX */ #define PROCSTAT_KVM 1 #define PROCSTAT_SYSCTL 2 +#define PROCSTAT_CORE 3 static char *getmnton(kvm_t *kd, struct mount *m); static struct filestat_list *procstat_getfiles_kvm( @@ -137,6 +139,8 @@ procstat_close(struct procstat *procstat assert(procstat); if (procstat->type == PROCSTAT_KVM) kvm_close(procstat->kd); + else if (procstat->type == PROCSTAT_CORE) + procstat_core_close(procstat->core); free(procstat); } @@ -177,6 +181,27 @@ procstat_open_kvm(const char *nlistf, co return (procstat); } +struct procstat * +procstat_open_core(const char *filename) +{ + struct procstat *procstat; + struct procstat_core *core; + + procstat = calloc(1, sizeof(*procstat)); + if (procstat == NULL) { + warn("malloc()"); + return (NULL); + } + core = procstat_core_open(filename); + if (core == NULL) { + free(procstat); + return (NULL); + } + procstat->type = PROCSTAT_CORE; + procstat->core = core; + return (procstat); +} + struct kinfo_proc * procstat_getprocs(struct procstat *procstat, int what, int arg, unsigned int *count) @@ -231,6 +256,15 @@ procstat_getprocs(struct procstat *procs } /* Perform simple consistency checks. */ if ((len % sizeof(*p)) != 0 || p->ki_structsize != sizeof(*p)) { + warnx("kinfo_proc structure size mismatch (len = %zu)", len); + goto fail; + } + *count = len / sizeof(*p); + return (p); + } else if (procstat->type == PROCSTAT_CORE) { + p = procstat_core_get(procstat->core, PSC_TYPE_PROC, NULL, + &len); + if ((len % sizeof(*p)) != 0 || p->ki_structsize != sizeof(*p)) { warnx("kinfo_proc structure size mismatch"); goto fail; } @@ -258,13 +292,17 @@ procstat_freeprocs(struct procstat *proc struct filestat_list * procstat_getfiles(struct procstat *procstat, struct kinfo_proc *kp, int mmapped) { - - if (procstat->type == PROCSTAT_SYSCTL) - return (procstat_getfiles_sysctl(procstat, kp, mmapped)); - else if (procstat->type == PROCSTAT_KVM) + + switch(procstat->type) { + case PROCSTAT_KVM: return (procstat_getfiles_kvm(procstat, kp, mmapped)); - else + case PROCSTAT_SYSCTL: + case PROCSTAT_CORE: + return (procstat_getfiles_sysctl(procstat, kp, mmapped)); + default: + warnx("unknown access method: %d", procstat->type); return (NULL); + } } void @@ -646,8 +684,62 @@ kinfo_uflags2fst(int fd) return (0); } +static struct kinfo_file * +kinfo_getfile_core(struct procstat_core *core, int *cntp) +{ + int cnt; + size_t len; + char *buf, *bp, *eb; + struct kinfo_file *kif, *kp, *kf; + + buf = procstat_core_get(core, PSC_TYPE_FILES, NULL, &len); + if (buf == NULL) + return (NULL); + /* + * XXXMG: The code below is just copy&past from libutil. + * The code duplication can be avoided if libutil + * is extended to provide something like: + * struct kinfo_file *kinfo_getfile_from_buf(const char *buf, + * size_t len, int *cntp); + */ + + /* Pass 1: count items */ + cnt = 0; + bp = buf; + eb = buf + len; + while (bp < eb) { + kf = (struct kinfo_file *)(uintptr_t)bp; + bp += kf->kf_structsize; + cnt++; + } + + kif = calloc(cnt, sizeof(*kif)); + if (kif == NULL) { + free(buf); + return (NULL); + } + bp = buf; + eb = buf + len; + kp = kif; + /* Pass 2: unpack */ + while (bp < eb) { + kf = (struct kinfo_file *)(uintptr_t)bp; + /* Copy/expand into pre-zeroed buffer */ + memcpy(kp, kf, kf->kf_structsize); + /* Advance to next packed record */ + bp += kf->kf_structsize; + /* Set field size to fixed length, advance */ + kp->kf_structsize = sizeof(*kp); + kp++; + } + free(buf); + *cntp = cnt; + return (kif); /* Caller must free() return value */ +} + static struct filestat_list * -procstat_getfiles_sysctl(struct procstat *procstat, struct kinfo_proc *kp, int mmapped) +procstat_getfiles_sysctl(struct procstat *procstat, struct kinfo_proc *kp, + int mmapped) { struct kinfo_file *kif, *files; struct kinfo_vmentry *kve, *vmentries; @@ -663,8 +755,16 @@ procstat_getfiles_sysctl(struct procstat assert(kp); if (kp->ki_fd == NULL) return (NULL); - - files = kinfo_getfile(kp->ki_pid, &cnt); + switch(procstat->type) { + case PROCSTAT_SYSCTL: + files = kinfo_getfile(kp->ki_pid, &cnt); + break; + case PROCSTAT_CORE: + files = kinfo_getfile_core(procstat->core, &cnt); + break; + default: + assert(!"invalid type"); + } if (files == NULL && errno != EPERM) { warn("kinfo_getfile()"); return (NULL); @@ -742,7 +842,8 @@ procstat_get_pipe_info(struct procstat * if (procstat->type == PROCSTAT_KVM) { return (procstat_get_pipe_info_kvm(procstat->kd, fst, ps, errbuf)); - } else if (procstat->type == PROCSTAT_SYSCTL) { + } else if (procstat->type == PROCSTAT_SYSCTL || + procstat->type == PROCSTAT_CORE) { return (procstat_get_pipe_info_sysctl(fst, ps, errbuf)); } else { warnx("unknown access method: %d", procstat->type); @@ -806,7 +907,8 @@ procstat_get_pts_info(struct procstat *p if (procstat->type == PROCSTAT_KVM) { return (procstat_get_pts_info_kvm(procstat->kd, fst, pts, errbuf)); - } else if (procstat->type == PROCSTAT_SYSCTL) { + } else if (procstat->type == PROCSTAT_SYSCTL || + procstat->type == PROCSTAT_CORE) { return (procstat_get_pts_info_sysctl(fst, pts, errbuf)); } else { warnx("unknown access method: %d", procstat->type); @@ -868,7 +970,8 @@ procstat_get_shm_info(struct procstat *p if (procstat->type == PROCSTAT_KVM) { return (procstat_get_shm_info_kvm(procstat->kd, fst, shm, errbuf)); - } else if (procstat->type == PROCSTAT_SYSCTL) { + } else if (procstat->type == PROCSTAT_SYSCTL || + procstat->type == PROCSTAT_CORE) { return (procstat_get_shm_info_sysctl(fst, shm, errbuf)); } else { warnx("unknown access method: %d", procstat->type); @@ -948,7 +1051,8 @@ procstat_get_vnode_info(struct procstat if (procstat->type == PROCSTAT_KVM) { return (procstat_get_vnode_info_kvm(procstat->kd, fst, vn, errbuf)); - } else if (procstat->type == PROCSTAT_SYSCTL) { + } else if (procstat->type == PROCSTAT_SYSCTL || + procstat->type == PROCSTAT_CORE) { return (procstat_get_vnode_info_sysctl(fst, vn, errbuf)); } else { warnx("unknown access method: %d", procstat->type); @@ -1150,7 +1254,8 @@ procstat_get_socket_info(struct procstat if (procstat->type == PROCSTAT_KVM) { return (procstat_get_socket_info_kvm(procstat->kd, fst, sock, errbuf)); - } else if (procstat->type == PROCSTAT_SYSCTL) { + } else if (procstat->type == PROCSTAT_SYSCTL || + procstat->type == PROCSTAT_CORE) { return (procstat_get_socket_info_sysctl(fst, sock, errbuf)); } else { warnx("unknown access method: %d", procstat->type); @@ -1401,3 +1506,4 @@ getmnton(kvm_t *kd, struct mount *m) mhead = mt; return (mt->mntonname); } + Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Sat Apr 20 01:12:23 2013 (r249665) +++ head/lib/libprocstat/libprocstat.h Sat Apr 20 07:47:26 2013 (r249666) @@ -162,6 +162,7 @@ int procstat_get_socket_info(struct proc struct sockstat *sock, char *errbuf); int procstat_get_vnode_info(struct procstat *procstat, struct filestat *fst, struct vnstat *vn, char *errbuf); +struct procstat *procstat_open_core(const char *filename); struct procstat *procstat_open_sysctl(void); struct procstat *procstat_open_kvm(const char *nlistf, const char *memf); __END_DECLS Modified: head/lib/libprocstat/libprocstat_internal.h ============================================================================== --- head/lib/libprocstat/libprocstat_internal.h Sat Apr 20 01:12:23 2013 (r249665) +++ head/lib/libprocstat/libprocstat_internal.h Sat Apr 20 07:47:26 2013 (r249666) @@ -34,6 +34,7 @@ struct procstat { kvm_t *kd; void *vmentries; void *files; + struct procstat_core *core; }; #endif /* !_LIBPROCSTAT_INTERNAL_H_ */ From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 07:49:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2427C84F; Sat, 20 Apr 2013 07:49:37 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 16746119E; Sat, 20 Apr 2013 07:49:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K7naIG086864; Sat, 20 Apr 2013 07:49:36 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K7nacZ086850; Sat, 20 Apr 2013 07:49:36 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200749.r3K7nacZ086850@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 07:49:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249667 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 07:49:37 -0000 Author: trociny Date: Sat Apr 20 07:49:35 2013 New Revision: 249667 URL: http://svnweb.freebsd.org/changeset/base/249667 Log: Add procstat_getvmmap function to get VM layout of a process. MFC after: 1 month Modified: head/lib/libprocstat/Symbol.map head/lib/libprocstat/libprocstat.3 head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h Modified: head/lib/libprocstat/Symbol.map ============================================================================== --- head/lib/libprocstat/Symbol.map Sat Apr 20 07:47:26 2013 (r249666) +++ head/lib/libprocstat/Symbol.map Sat Apr 20 07:49:35 2013 (r249667) @@ -16,6 +16,8 @@ FBSD_1.2 { }; FBSD_1.3 { + procstat_freevmmap; procstat_get_shm_info; + procstat_getvmmap; procstat_open_core; }; Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 07:47:26 2013 (r249666) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 07:49:35 2013 (r249667) @@ -34,8 +34,10 @@ .Nm procstat_close , .Nm procstat_getfiles , .Nm procstat_getprocs , +.Nm procstat_getvmmap , .Nm procstat_freefiles , .Nm procstat_freeprocs , +.Nm procstat_freevmmap , .Nm procstat_get_pipe_info , .Nm procstat_get_pts_info , .Nm procstat_get_shm_info , @@ -57,6 +59,11 @@ .Fc .Ft void .Fn procstat_freeprocs "struct procstat *procstat" "struct kinfo_proc *p" +.Ft void +.Fo procstat_freevmmap +.Fa "struct procstat *procstat" +.Fa "struct kinfo_vmentry *vmmap" +.Fc .Ft int .Fo procstat_get_pipe_info .Fa "struct procstat *procstat" @@ -105,6 +112,12 @@ .Fa "int arg" .Fa "unsigned int *count" .Fc +.Ft "struct kinfo_vmentry *" +.Fo procstat_getvmmap +.Fa "struct procstat *procstat" +.Fa "struct kinfo_proc *kp" +.Fa "unsigned int *count" +.Fc .Ft "struct procstat *" .Fn procstat_open_core "const char *filename" .Ft "struct procstat *" @@ -214,6 +227,22 @@ The caller is responsible to free the al function call. .Pp The +.Fn procstat_getvmmap +function gets a pointer to the +.Vt procstat +structure initialized with one of the +.Fn procstat_open_* +functions, a pointer to +.Vt kinfo_proc +structure, and returns VM layout of the process as a dynamically allocated +array of +.Vt kinfo_vmentry +structures. +The caller is responsible to free the allocated memory with a subsequent +.Fn procstat_freevmmap +function call. +.Pp +The .Fn procstat_get_pipe_info , .Fn procstat_get_pts_info , .Fn procstat_get_shm_info , Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Apr 20 07:47:26 2013 (r249666) +++ head/lib/libprocstat/libprocstat.c Sat Apr 20 07:49:35 2013 (r249667) @@ -105,6 +105,8 @@ int statfs(const char *, struct stat #define PROCSTAT_CORE 3 static char *getmnton(kvm_t *kd, struct mount *m); +static struct kinfo_vmentry * kinfo_getvmmap_core(struct procstat_core *core, + int *cntp); static struct filestat_list *procstat_getfiles_kvm( struct procstat *procstat, struct kinfo_proc *kp, int mmapped); static struct filestat_list *procstat_getfiles_sysctl( @@ -802,7 +804,7 @@ procstat_getfiles_sysctl(struct procstat STAILQ_INSERT_TAIL(head, entry, next); } if (mmapped != 0) { - vmentries = kinfo_getvmmap(kp->ki_pid, &cnt); + vmentries = procstat_getvmmap(procstat, kp, &cnt); procstat->vmentries = vmentries; if (vmentries == NULL || cnt == 0) goto fail; @@ -1507,3 +1509,82 @@ getmnton(kvm_t *kd, struct mount *m) return (mt->mntonname); } +static struct kinfo_vmentry * +kinfo_getvmmap_core(struct procstat_core *core, int *cntp) +{ + int cnt; + size_t len; + char *buf, *bp, *eb; + struct kinfo_vmentry *kiv, *kp, *kv; + + buf = procstat_core_get(core, PSC_TYPE_VMMAP, NULL, &len); + if (buf == NULL) + return (NULL); + + /* + * XXXMG: The code below is just copy&past from libutil. + * The code duplication can be avoided if libutil + * is extended to provide something like: + * struct kinfo_vmentry *kinfo_getvmmap_from_buf(const char *buf, + * size_t len, int *cntp); + */ + + /* Pass 1: count items */ + cnt = 0; + bp = buf; + eb = buf + len; + while (bp < eb) { + kv = (struct kinfo_vmentry *)(uintptr_t)bp; + bp += kv->kve_structsize; + cnt++; + } + + kiv = calloc(cnt, sizeof(*kiv)); + if (kiv == NULL) { + free(buf); + return (NULL); + } + bp = buf; + eb = buf + len; + kp = kiv; + /* Pass 2: unpack */ + while (bp < eb) { + kv = (struct kinfo_vmentry *)(uintptr_t)bp; + /* Copy/expand into pre-zeroed buffer */ + memcpy(kp, kv, kv->kve_structsize); + /* Advance to next packed record */ + bp += kv->kve_structsize; + /* Set field size to fixed length, advance */ + kp->kve_structsize = sizeof(*kp); + kp++; + } + free(buf); + *cntp = cnt; + return (kiv); /* Caller must free() return value */ +} + +struct kinfo_vmentry * +procstat_getvmmap(struct procstat *procstat, struct kinfo_proc *kp, + unsigned int *cntp) +{ + switch(procstat->type) { + case PROCSTAT_KVM: + warnx("kvm method is not supported"); + return (NULL); + case PROCSTAT_SYSCTL: + return (kinfo_getvmmap(kp->ki_pid, cntp)); + case PROCSTAT_CORE: + return (kinfo_getvmmap_core(procstat->core, cntp)); + default: + warnx("unknown access method: %d", procstat->type); + return (NULL); + } +} + +void +procstat_freevmmap(struct procstat *procstat __unused, + struct kinfo_vmentry *vmmap) +{ + + free(vmmap); +} Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Sat Apr 20 07:47:26 2013 (r249666) +++ head/lib/libprocstat/libprocstat.h Sat Apr 20 07:49:35 2013 (r249667) @@ -89,6 +89,7 @@ #define PS_FST_FFLAG_EXEC 0x2000 #define PS_FST_FFLAG_HASLOCK 0x4000 +struct kinfo_vmentry; struct procstat; struct filestat { int fs_type; /* Descriptor type. */ @@ -148,6 +149,8 @@ void procstat_close(struct procstat *pro void procstat_freeprocs(struct procstat *procstat, struct kinfo_proc *p); void procstat_freefiles(struct procstat *procstat, struct filestat_list *head); +void procstat_freevmmap(struct procstat *procstat, + struct kinfo_vmentry *vmmap); struct filestat_list *procstat_getfiles(struct procstat *procstat, struct kinfo_proc *kp, int mmapped); struct kinfo_proc *procstat_getprocs(struct procstat *procstat, @@ -162,6 +165,8 @@ int procstat_get_socket_info(struct proc struct sockstat *sock, char *errbuf); int procstat_get_vnode_info(struct procstat *procstat, struct filestat *fst, struct vnstat *vn, char *errbuf); +struct kinfo_vmentry *procstat_getvmmap(struct procstat *procstat, + struct kinfo_proc *kp, unsigned int *count); struct procstat *procstat_open_core(const char *filename); struct procstat *procstat_open_sysctl(void); struct procstat *procstat_open_kvm(const char *nlistf, const char *memf); From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 07:51:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7740EABE; Sat, 20 Apr 2013 07:51:01 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 59E3E11A9; Sat, 20 Apr 2013 07:51:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K7p1Aq090061; Sat, 20 Apr 2013 07:51:01 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K7p08m090039; Sat, 20 Apr 2013 07:51:00 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200751.r3K7p08m090039@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 07:51:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249668 - head/usr.bin/procstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 07:51:01 -0000 Author: trociny Date: Sat Apr 20 07:50:59 2013 New Revision: 249668 URL: http://svnweb.freebsd.org/changeset/base/249668 Log: Use procstat_getprocs(3) for retrieving thread information instead of direct sysctl calls. MFC after: 1 month Modified: head/usr.bin/procstat/procstat.c head/usr.bin/procstat/procstat.h head/usr.bin/procstat/procstat_sigs.c head/usr.bin/procstat/procstat_threads.c Modified: head/usr.bin/procstat/procstat.c ============================================================================== --- head/usr.bin/procstat/procstat.c Sat Apr 20 07:49:35 2013 (r249667) +++ head/usr.bin/procstat/procstat.c Sat Apr 20 07:50:59 2013 (r249668) @@ -77,7 +77,7 @@ procstat(struct procstat *prstat, struct else if (sflag) procstat_cred(kipp); else if (tflag) - procstat_threads(kipp); + procstat_threads(prstat, kipp); else if (vflag) procstat_vm(kipp); else if (xflag) Modified: head/usr.bin/procstat/procstat.h ============================================================================== --- head/usr.bin/procstat/procstat.h Sat Apr 20 07:49:35 2013 (r249667) +++ head/usr.bin/procstat/procstat.h Sat Apr 20 07:50:59 2013 (r249668) @@ -44,7 +44,7 @@ void procstat_files(struct procstat *prs void procstat_kstack(struct kinfo_proc *kipp, int kflag); void procstat_rlimit(struct kinfo_proc *kipp); void procstat_sigs(struct procstat *prstat, struct kinfo_proc *kipp); -void procstat_threads(struct kinfo_proc *kipp); +void procstat_threads(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_threads_sigs(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_vm(struct kinfo_proc *kipp); Modified: head/usr.bin/procstat/procstat_sigs.c ============================================================================== --- head/usr.bin/procstat/procstat_sigs.c Sat Apr 20 07:49:35 2013 (r249667) +++ head/usr.bin/procstat/procstat_sigs.c Sat Apr 20 07:50:59 2013 (r249668) @@ -86,48 +86,24 @@ procstat_sigs(struct procstat *prstat __ } void -procstat_threads_sigs(struct procstat *prstat __unused, struct kinfo_proc *kipp) +procstat_threads_sigs(struct procstat *procstat, struct kinfo_proc *kipp) { struct kinfo_proc *kip; pid_t pid; - int error, name[4], j; - unsigned int i; - size_t len; + int j; + unsigned int count, i; pid = kipp->ki_pid; if (!hflag) printf("%5s %6s %-16s %-7s %4s\n", "PID", "TID", "COMM", "SIG", "FLAGS"); - /* - * We need to re-query for thread information, so don't use *kipp. - */ - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_PID | KERN_PROC_INC_THREAD; - name[3] = pid; - - len = 0; - error = sysctl(name, 4, NULL, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { - warn("sysctl: kern.proc.pid: %d", pid); - return; - } - if (error < 0) - return; - - kip = malloc(len); + kip = procstat_getprocs(procstat, KERN_PROC_PID | KERN_PROC_INC_THREAD, + pid, &count); if (kip == NULL) - err(-1, "malloc"); - - if (sysctl(name, 4, kip, &len, NULL, 0) < 0) { - warn("sysctl: kern.proc.pid: %d", pid); - free(kip); return; - } - - kinfo_proc_sort(kip, len / sizeof(*kipp)); - for (i = 0; i < len / sizeof(*kipp); i++) { + kinfo_proc_sort(kip, count); + for (i = 0; i < count; i++) { kipp = &kip[i]; for (j = 1; j <= _SIG_MAXSIG; j++) { printf("%5d ", pid); @@ -140,5 +116,5 @@ procstat_threads_sigs(struct procstat *p printf("\n"); } } - free(kip); + procstat_freeprocs(procstat, kip); } Modified: head/usr.bin/procstat/procstat_threads.c ============================================================================== --- head/usr.bin/procstat/procstat_threads.c Sat Apr 20 07:49:35 2013 (r249667) +++ head/usr.bin/procstat/procstat_threads.c Sat Apr 20 07:50:59 2013 (r249668) @@ -40,47 +40,22 @@ #include "procstat.h" void -procstat_threads(struct kinfo_proc *kipp) +procstat_threads(struct procstat *procstat, struct kinfo_proc *kipp) { struct kinfo_proc *kip; - int error, name[4]; - unsigned int i; + unsigned int count, i; const char *str; - size_t len; if (!hflag) printf("%5s %6s %-16s %-16s %2s %4s %-7s %-9s\n", "PID", "TID", "COMM", "TDNAME", "CPU", "PRI", "STATE", "WCHAN"); - /* - * We need to re-query for thread information, so don't use *kipp. - */ - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_PID | KERN_PROC_INC_THREAD; - name[3] = kipp->ki_pid; - - len = 0; - error = sysctl(name, 4, NULL, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { - warn("sysctl: kern.proc.pid: %d", kipp->ki_pid); - return; - } - if (error < 0) - return; - - kip = malloc(len); + kip = procstat_getprocs(procstat, KERN_PROC_PID | KERN_PROC_INC_THREAD, + kipp->ki_pid, &count); if (kip == NULL) - err(-1, "malloc"); - - if (sysctl(name, 4, kip, &len, NULL, 0) < 0) { - warn("sysctl: kern.proc.pid: %d", kipp->ki_pid); - free(kip); return; - } - - kinfo_proc_sort(kip, len / sizeof(*kipp)); - for (i = 0; i < len / sizeof(*kipp); i++) { + kinfo_proc_sort(kip, count); + for (i = 0; i < count; i++) { kipp = &kip[i]; printf("%5d ", kipp->ki_pid); printf("%6d ", kipp->ki_tid); @@ -139,5 +114,5 @@ procstat_threads(struct kinfo_proc *kipp } printf("\n"); } - free(kip); + procstat_freeprocs(procstat, kip); } From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 07:52:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 26E76C39; Sat, 20 Apr 2013 07:52:24 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F268111B2; Sat, 20 Apr 2013 07:52:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K7qN3l091531; Sat, 20 Apr 2013 07:52:23 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K7qN21091522; Sat, 20 Apr 2013 07:52:23 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200752.r3K7qN21091522@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 07:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249669 - head/usr.bin/procstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 07:52:24 -0000 Author: trociny Date: Sat Apr 20 07:52:23 2013 New Revision: 249669 URL: http://svnweb.freebsd.org/changeset/base/249669 Log: Use more generic procstat_getvmmap(3) for retrieving VM layout of a process. MFC after: 1 month Modified: head/usr.bin/procstat/procstat.c head/usr.bin/procstat/procstat.h head/usr.bin/procstat/procstat_vm.c Modified: head/usr.bin/procstat/procstat.c ============================================================================== --- head/usr.bin/procstat/procstat.c Sat Apr 20 07:50:59 2013 (r249668) +++ head/usr.bin/procstat/procstat.c Sat Apr 20 07:52:23 2013 (r249669) @@ -79,7 +79,7 @@ procstat(struct procstat *prstat, struct else if (tflag) procstat_threads(prstat, kipp); else if (vflag) - procstat_vm(kipp); + procstat_vm(prstat, kipp); else if (xflag) procstat_auxv(kipp); else Modified: head/usr.bin/procstat/procstat.h ============================================================================== --- head/usr.bin/procstat/procstat.h Sat Apr 20 07:50:59 2013 (r249668) +++ head/usr.bin/procstat/procstat.h Sat Apr 20 07:52:23 2013 (r249669) @@ -46,6 +46,6 @@ void procstat_rlimit(struct kinfo_proc * void procstat_sigs(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_threads(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_threads_sigs(struct procstat *prstat, struct kinfo_proc *kipp); -void procstat_vm(struct kinfo_proc *kipp); +void procstat_vm(struct procstat *prstat, struct kinfo_proc *kipp); #endif /* !PROCSTAT_H */ Modified: head/usr.bin/procstat/procstat_vm.c ============================================================================== --- head/usr.bin/procstat/procstat_vm.c Sat Apr 20 07:50:59 2013 (r249668) +++ head/usr.bin/procstat/procstat_vm.c Sat Apr 20 07:52:23 2013 (r249669) @@ -41,7 +41,7 @@ #include "procstat.h" void -procstat_vm(struct kinfo_proc *kipp) +procstat_vm(struct procstat *procstat, struct kinfo_proc *kipp) { struct kinfo_vmentry *freep, *kve; int ptrwidth; @@ -54,7 +54,7 @@ procstat_vm(struct kinfo_proc *kipp) "PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES", "PRES", "REF", "SHD", "FL", "TP", "PATH"); - freep = kinfo_getvmmap(kipp->ki_pid, &cnt); + freep = procstat_getvmmap(procstat, kipp, &cnt); if (freep == NULL) return; for (i = 0; i < cnt; i++) { From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 07:54:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1836EE96; Sat, 20 Apr 2013 07:54:09 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 07DC911C3; Sat, 20 Apr 2013 07:54:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K7s8nM093420; Sat, 20 Apr 2013 07:54:08 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K7s79v093399; Sat, 20 Apr 2013 07:54:07 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200754.r3K7s79v093399@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 07:54:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249670 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 07:54:09 -0000 Author: trociny Date: Sat Apr 20 07:54:07 2013 New Revision: 249670 URL: http://svnweb.freebsd.org/changeset/base/249670 Log: Add procstat_getgroups function to retrieve process groups. MFC after: 1 month Modified: head/lib/libprocstat/Symbol.map head/lib/libprocstat/core.c head/lib/libprocstat/core.h head/lib/libprocstat/libprocstat.3 head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h Modified: head/lib/libprocstat/Symbol.map ============================================================================== --- head/lib/libprocstat/Symbol.map Sat Apr 20 07:52:23 2013 (r249669) +++ head/lib/libprocstat/Symbol.map Sat Apr 20 07:54:07 2013 (r249670) @@ -16,8 +16,10 @@ FBSD_1.2 { }; FBSD_1.3 { + procstat_freegroups; procstat_freevmmap; procstat_get_shm_info; + procstat_getgroups; procstat_getvmmap; procstat_open_core; }; Modified: head/lib/libprocstat/core.c ============================================================================== --- head/lib/libprocstat/core.c Sat Apr 20 07:52:23 2013 (r249669) +++ head/lib/libprocstat/core.c Sat Apr 20 07:54:07 2013 (r249670) @@ -167,6 +167,10 @@ procstat_core_get(struct procstat_core * n_type = NT_PROCSTAT_VMMAP; structsize = sizeof(struct kinfo_vmentry); break; + case PSC_TYPE_GROUPS: + n_type = NT_PROCSTAT_GROUPS; + structsize = sizeof(gid_t); + break; default: warnx("unknown core stat type: %d", type); return (NULL); Modified: head/lib/libprocstat/core.h ============================================================================== --- head/lib/libprocstat/core.h Sat Apr 20 07:52:23 2013 (r249669) +++ head/lib/libprocstat/core.h Sat Apr 20 07:54:07 2013 (r249670) @@ -33,6 +33,7 @@ enum psc_type { PSC_TYPE_PROC, PSC_TYPE_FILES, PSC_TYPE_VMMAP, + PSC_TYPE_GROUPS, }; struct procstat_core; Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 07:52:23 2013 (r249669) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 07:54:07 2013 (r249670) @@ -33,9 +33,11 @@ .Nm procstat_open_sysctl , .Nm procstat_close , .Nm procstat_getfiles , +.Nm procstat_getgroups , .Nm procstat_getprocs , .Nm procstat_getvmmap , .Nm procstat_freefiles , +.Nm procstat_freegroups , .Nm procstat_freeprocs , .Nm procstat_freevmmap , .Nm procstat_get_pipe_info , @@ -52,12 +54,18 @@ .In libprocstat.h .Ft void .Fn procstat_close "struct procstat *procstat" +.Fc .Ft void .Fo procstat_freefiles .Fa "struct procstat *procstat" .Fa "struct filestat_list *head" .Fc .Ft void +.Fo procstat_freegroups +.Fa "struct procstat *procstat" +.Fa "gid_t *groups" +.Fc +.Ft void .Fn procstat_freeprocs "struct procstat *procstat" "struct kinfo_proc *p" .Ft void .Fo procstat_freevmmap @@ -105,6 +113,12 @@ .Fa "struct kinfo_proc *kp" .Fa "int mmapped" .Fc +.Ft "gid_t *" +.Fo procstat_getgroups +.Fa "struct procstat *procstat" +.Fa "struct kinfo_proc *kp" +.Fa "unsigned int *count" +.Fc .Ft "struct kinfo_proc *" .Fo procstat_getprocs .Fa "struct procstat *procstat" @@ -227,6 +241,19 @@ The caller is responsible to free the al function call. .Pp The +.Fn procstat_getgroups +function gets a pointer to the +.Vt procstat +structure, a pointer to +.Vt kinfo_proc +structure, and returns the process groups as a dynamically allocated array of +.Vt gid_t +elements. +The caller is responsible to free the allocated memory with a subsequent +.Fn procstat_freegroups +function call. +.Pp +The .Fn procstat_getvmmap function gets a pointer to the .Vt procstat Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Apr 20 07:52:23 2013 (r249669) +++ head/lib/libprocstat/libprocstat.c Sat Apr 20 07:54:07 2013 (r249670) @@ -132,6 +132,9 @@ static int procstat_get_vnode_info_kvm(k struct vnstat *vn, char *errbuf); static int procstat_get_vnode_info_sysctl(struct filestat *fst, struct vnstat *vn, char *errbuf); +static gid_t *procstat_getgroups_core(struct procstat_core *core, + unsigned int *count); +static gid_t *procstat_getgroups_sysctl(pid_t pid, unsigned int *count); static int vntype2psfsttype(int type); void @@ -1588,3 +1591,67 @@ procstat_freevmmap(struct procstat *proc free(vmmap); } + +static gid_t * +procstat_getgroups_sysctl(pid_t pid, unsigned int *cntp) +{ + int mib[4]; + size_t len; + gid_t *groups; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_GROUPS; + mib[3] = pid; + len = (sysconf(_SC_NGROUPS_MAX) + 1) * sizeof(gid_t); + groups = malloc(len); + if (groups == NULL) { + warn("malloc(%zu)", len); + return (NULL); + } + if (sysctl(mib, 4, groups, &len, NULL, 0) == -1) { + warn("sysctl: kern.proc.groups: %d", pid); + free(groups); + return (NULL); + } + *cntp = len / sizeof(gid_t); + return (groups); +} + +static gid_t * +procstat_getgroups_core(struct procstat_core *core, unsigned int *cntp) +{ + size_t len; + gid_t *groups; + + groups = procstat_core_get(core, PSC_TYPE_GROUPS, NULL, &len); + if (groups == NULL) + return (NULL); + *cntp = len / sizeof(gid_t); + return (groups); +} + +gid_t * +procstat_getgroups(struct procstat *procstat, struct kinfo_proc *kp, + unsigned int *cntp) +{ + switch(procstat->type) { + case PROCSTAT_KVM: + warnx("kvm method is not supported"); + return (NULL); + case PROCSTAT_SYSCTL: + return (procstat_getgroups_sysctl(kp->ki_pid, cntp)); + case PROCSTAT_CORE: + return (procstat_getgroups_core(procstat->core, cntp)); + default: + warnx("unknown access method: %d", procstat->type); + return (NULL); + } +} + +void +procstat_freegroups(struct procstat *procstat __unused, gid_t *groups) +{ + + free(groups); +} Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Sat Apr 20 07:52:23 2013 (r249669) +++ head/lib/libprocstat/libprocstat.h Sat Apr 20 07:54:07 2013 (r249670) @@ -146,6 +146,7 @@ STAILQ_HEAD(filestat_list, filestat); __BEGIN_DECLS void procstat_close(struct procstat *procstat); +void procstat_freegroups(struct procstat *procstat, gid_t *groups); void procstat_freeprocs(struct procstat *procstat, struct kinfo_proc *p); void procstat_freefiles(struct procstat *procstat, struct filestat_list *head); @@ -165,6 +166,8 @@ int procstat_get_socket_info(struct proc struct sockstat *sock, char *errbuf); int procstat_get_vnode_info(struct procstat *procstat, struct filestat *fst, struct vnstat *vn, char *errbuf); +gid_t *procstat_getgroups(struct procstat *procstat, struct kinfo_proc *kp, + unsigned int *count); struct kinfo_vmentry *procstat_getvmmap(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); struct procstat *procstat_open_core(const char *filename); From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 07:55:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B27FA9C; Sat, 20 Apr 2013 07:55:32 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A4EFE11CF; Sat, 20 Apr 2013 07:55:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K7tW9T094964; Sat, 20 Apr 2013 07:55:32 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K7tW6J094952; Sat, 20 Apr 2013 07:55:32 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200755.r3K7tW6J094952@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 07:55:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249671 - head/usr.bin/procstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 07:55:32 -0000 Author: trociny Date: Sat Apr 20 07:55:31 2013 New Revision: 249671 URL: http://svnweb.freebsd.org/changeset/base/249671 Log: Use procstat_getgroups(3) for retrieving groups information instead of direct sysctl. MFC after: 1 month Modified: head/usr.bin/procstat/procstat.c head/usr.bin/procstat/procstat.h head/usr.bin/procstat/procstat_cred.c Modified: head/usr.bin/procstat/procstat.c ============================================================================== --- head/usr.bin/procstat/procstat.c Sat Apr 20 07:54:07 2013 (r249670) +++ head/usr.bin/procstat/procstat.c Sat Apr 20 07:55:31 2013 (r249671) @@ -75,7 +75,7 @@ procstat(struct procstat *prstat, struct else if (lflag) procstat_rlimit(kipp); else if (sflag) - procstat_cred(kipp); + procstat_cred(prstat, kipp); else if (tflag) procstat_threads(prstat, kipp); else if (vflag) Modified: head/usr.bin/procstat/procstat.h ============================================================================== --- head/usr.bin/procstat/procstat.h Sat Apr 20 07:54:07 2013 (r249670) +++ head/usr.bin/procstat/procstat.h Sat Apr 20 07:55:31 2013 (r249671) @@ -38,7 +38,7 @@ void procstat_args(struct kinfo_proc *ki void procstat_auxv(struct kinfo_proc *kipp); void procstat_basic(struct kinfo_proc *kipp); void procstat_bin(struct kinfo_proc *kipp); -void procstat_cred(struct kinfo_proc *kipp); +void procstat_cred(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_env(struct kinfo_proc *kipp); void procstat_files(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_kstack(struct kinfo_proc *kipp, int kflag); Modified: head/usr.bin/procstat/procstat_cred.c ============================================================================== --- head/usr.bin/procstat/procstat_cred.c Sat Apr 20 07:54:07 2013 (r249670) +++ head/usr.bin/procstat/procstat_cred.c Sat Apr 20 07:55:31 2013 (r249671) @@ -41,13 +41,10 @@ static const char *get_umask(struct kinfo_proc *kipp); void -procstat_cred(struct kinfo_proc *kipp) +procstat_cred(struct procstat *procstat, struct kinfo_proc *kipp) { - int i; - int mib[4]; - int ngroups; - size_t len; - gid_t *groups = NULL; + unsigned int i, ngroups; + gid_t *groups; if (!hflag) printf("%5s %-16s %5s %5s %5s %5s %5s %5s %5s %5s %-15s\n", @@ -66,30 +63,14 @@ procstat_cred(struct kinfo_proc *kipp) printf("%s", kipp->ki_cr_flags & CRED_FLAG_CAPMODE ? "C" : "-"); printf(" "); + groups = NULL; /* * We may have too many groups to fit in kinfo_proc's statically - * sized storage. If that occurs, attempt to retrieve them via - * sysctl. + * sized storage. If that occurs, attempt to retrieve them using + * libprocstat. */ - if (kipp->ki_cr_flags & KI_CRF_GRP_OVERFLOW) { - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_GROUPS; - mib[3] = kipp->ki_pid; - - ngroups = sysconf(_SC_NGROUPS_MAX) + 1; - len = ngroups * sizeof(gid_t); - if((groups = malloc(len)) == NULL) - err(-1, "malloc"); - - if (sysctl(mib, 4, groups, &len, NULL, 0) == -1) { - warn("sysctl: kern.proc.groups: %d " - "group list truncated", kipp->ki_pid); - free(groups); - groups = NULL; - } - ngroups = len / sizeof(gid_t); - } + if (kipp->ki_cr_flags & KI_CRF_GRP_OVERFLOW) + groups = procstat_getgroups(procstat, kipp, &ngroups); if (groups == NULL) { ngroups = kipp->ki_ngroups; groups = kipp->ki_groups; @@ -97,7 +78,7 @@ procstat_cred(struct kinfo_proc *kipp) for (i = 0; i < ngroups; i++) printf("%s%d", (i > 0) ? "," : "", groups[i]); if (groups != kipp->ki_groups) - free(groups); + procstat_freegroups(procstat, groups); printf("\n"); } From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 07:57:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D0034225; Sat, 20 Apr 2013 07:57:09 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B3E0311DC; Sat, 20 Apr 2013 07:57:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K7v9WQ096714; Sat, 20 Apr 2013 07:57:09 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K7v84N096689; Sat, 20 Apr 2013 07:57:08 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200757.r3K7v84N096689@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 07:57:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249672 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 07:57:09 -0000 Author: trociny Date: Sat Apr 20 07:57:08 2013 New Revision: 249672 URL: http://svnweb.freebsd.org/changeset/base/249672 Log: Add procstat_getumask function to retrieve a process umask. MFC after: 1 month Modified: head/lib/libprocstat/Symbol.map head/lib/libprocstat/core.c head/lib/libprocstat/core.h head/lib/libprocstat/libprocstat.3 head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h Modified: head/lib/libprocstat/Symbol.map ============================================================================== --- head/lib/libprocstat/Symbol.map Sat Apr 20 07:55:31 2013 (r249671) +++ head/lib/libprocstat/Symbol.map Sat Apr 20 07:57:08 2013 (r249672) @@ -20,6 +20,7 @@ FBSD_1.3 { procstat_freevmmap; procstat_get_shm_info; procstat_getgroups; + procstat_getumask; procstat_getvmmap; procstat_open_core; }; Modified: head/lib/libprocstat/core.c ============================================================================== --- head/lib/libprocstat/core.c Sat Apr 20 07:55:31 2013 (r249671) +++ head/lib/libprocstat/core.c Sat Apr 20 07:57:08 2013 (r249672) @@ -171,6 +171,10 @@ procstat_core_get(struct procstat_core * n_type = NT_PROCSTAT_GROUPS; structsize = sizeof(gid_t); break; + case PSC_TYPE_UMASK: + n_type = NT_PROCSTAT_UMASK; + structsize = sizeof(u_short); + break; default: warnx("unknown core stat type: %d", type); return (NULL); Modified: head/lib/libprocstat/core.h ============================================================================== --- head/lib/libprocstat/core.h Sat Apr 20 07:55:31 2013 (r249671) +++ head/lib/libprocstat/core.h Sat Apr 20 07:57:08 2013 (r249672) @@ -34,6 +34,7 @@ enum psc_type { PSC_TYPE_FILES, PSC_TYPE_VMMAP, PSC_TYPE_GROUPS, + PSC_TYPE_UMASK, }; struct procstat_core; Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 07:55:31 2013 (r249671) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 07:57:08 2013 (r249672) @@ -35,6 +35,7 @@ .Nm procstat_getfiles , .Nm procstat_getgroups , .Nm procstat_getprocs , +.Nm procstat_getumask , .Nm procstat_getvmmap , .Nm procstat_freefiles , .Nm procstat_freegroups , @@ -126,6 +127,12 @@ .Fa "int arg" .Fa "unsigned int *count" .Fc +.Ft "int" +.Fo procstat_getumask +.Fa "struct procstat *procstat" +.Fa "struct kinfo_proc *kp" +.Fa "unsigned short *maskp" +.Fc .Ft "struct kinfo_vmentry *" .Fo procstat_getvmmap .Fa "struct procstat *procstat" @@ -254,6 +261,14 @@ The caller is responsible to free the al function call. .Pp The +.Fn procstat_getumask +function gets a pointer to the +.Vt procstat +structure, a pointer to +.Vt kinfo_proc +structure, and returns the process umask in the 3rd reference parameter. +.Pp +The .Fn procstat_getvmmap function gets a pointer to the .Vt procstat Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Apr 20 07:55:31 2013 (r249671) +++ head/lib/libprocstat/libprocstat.c Sat Apr 20 07:57:08 2013 (r249672) @@ -135,6 +135,9 @@ static int procstat_get_vnode_info_sysct static gid_t *procstat_getgroups_core(struct procstat_core *core, unsigned int *count); static gid_t *procstat_getgroups_sysctl(pid_t pid, unsigned int *count); +static int procstat_getumask_core(struct procstat_core *core, + unsigned short *maskp); +static int procstat_getumask_sysctl(pid_t pid, unsigned short *maskp); static int vntype2psfsttype(int type); void @@ -1655,3 +1658,57 @@ procstat_freegroups(struct procstat *pro free(groups); } + +static int +procstat_getumask_sysctl(pid_t pid, unsigned short *maskp) +{ + int error; + int mib[4]; + size_t len; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_UMASK; + mib[3] = pid; + len = sizeof(*maskp); + error = sysctl(mib, 4, maskp, &len, NULL, 0); + if (error != 0 && errno != ESRCH) + warn("sysctl: kern.proc.umask: %d", pid); + return (error); +} + +static int +procstat_getumask_core(struct procstat_core *core, unsigned short *maskp) +{ + size_t len; + unsigned short *buf; + + buf = procstat_core_get(core, PSC_TYPE_UMASK, NULL, &len); + if (buf == NULL) + return (-1); + if (len < sizeof(*maskp)) { + free(buf); + return (-1); + } + *maskp = *buf; + free(buf); + return (0); +} + +int +procstat_getumask(struct procstat *procstat, struct kinfo_proc *kp, + unsigned short *maskp) +{ + switch(procstat->type) { + case PROCSTAT_KVM: + warnx("kvm method is not supported"); + return (-1); + case PROCSTAT_SYSCTL: + return (procstat_getumask_sysctl(kp->ki_pid, maskp)); + case PROCSTAT_CORE: + return (procstat_getumask_core(procstat->core, maskp)); + default: + warnx("unknown access method: %d", procstat->type); + return (-1); + } +} Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Sat Apr 20 07:55:31 2013 (r249671) +++ head/lib/libprocstat/libprocstat.h Sat Apr 20 07:57:08 2013 (r249672) @@ -168,6 +168,8 @@ int procstat_get_vnode_info(struct procs struct vnstat *vn, char *errbuf); gid_t *procstat_getgroups(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); +int procstat_getumask(struct procstat *procstat, struct kinfo_proc *kp, + unsigned short* umask); struct kinfo_vmentry *procstat_getvmmap(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); struct procstat *procstat_open_core(const char *filename); From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 07:58:21 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5BE0839A; Sat, 20 Apr 2013 07:58:21 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4EAA311E4; Sat, 20 Apr 2013 07:58:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K7wL2a097963; Sat, 20 Apr 2013 07:58:21 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K7wLia097962; Sat, 20 Apr 2013 07:58:21 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200758.r3K7wLia097962@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 07:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249673 - head/usr.bin/procstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 07:58:21 -0000 Author: trociny Date: Sat Apr 20 07:58:20 2013 New Revision: 249673 URL: http://svnweb.freebsd.org/changeset/base/249673 Log: Use procstat_getumask(3) for retrieving umaks information instead of direct sysctl. MFC after: 1 month Modified: head/usr.bin/procstat/procstat_cred.c Modified: head/usr.bin/procstat/procstat_cred.c ============================================================================== --- head/usr.bin/procstat/procstat_cred.c Sat Apr 20 07:57:08 2013 (r249672) +++ head/usr.bin/procstat/procstat_cred.c Sat Apr 20 07:58:20 2013 (r249673) @@ -38,7 +38,8 @@ #include "procstat.h" -static const char *get_umask(struct kinfo_proc *kipp); +static const char *get_umask(struct procstat *procstat, + struct kinfo_proc *kipp); void procstat_cred(struct procstat *procstat, struct kinfo_proc *kipp) @@ -59,7 +60,7 @@ procstat_cred(struct procstat *procstat, printf("%5d ", kipp->ki_groups[0]); printf("%5d ", kipp->ki_rgid); printf("%5d ", kipp->ki_svgid); - printf("%5s ", get_umask(kipp)); + printf("%5s ", get_umask(procstat, kipp)); printf("%s", kipp->ki_cr_flags & CRED_FLAG_CAPMODE ? "C" : "-"); printf(" "); @@ -84,21 +85,12 @@ procstat_cred(struct procstat *procstat, } static const char * -get_umask(struct kinfo_proc *kipp) +get_umask(struct procstat *procstat, struct kinfo_proc *kipp) { - int error; - int mib[4]; - size_t len; u_short fd_cmask; static char umask[4]; - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_UMASK; - mib[3] = kipp->ki_pid; - len = sizeof(fd_cmask); - error = sysctl(mib, 4, &fd_cmask, &len, NULL, 0); - if (error == 0) { + if (procstat_getumask(procstat, kipp, &fd_cmask) == 0) { snprintf(umask, 4, "%03o", fd_cmask); return (umask); } else { From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 07:59:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 72C32514; Sat, 20 Apr 2013 07:59:46 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 654B611EA; Sat, 20 Apr 2013 07:59:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K7xkD3099425; Sat, 20 Apr 2013 07:59:46 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K7xjLc099398; Sat, 20 Apr 2013 07:59:45 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200759.r3K7xjLc099398@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 07:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249674 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 07:59:46 -0000 Author: trociny Date: Sat Apr 20 07:59:44 2013 New Revision: 249674 URL: http://svnweb.freebsd.org/changeset/base/249674 Log: Add procstat_getrlimit function to retrieve a process resource limits info. MFC after: 1 month Modified: head/lib/libprocstat/Symbol.map head/lib/libprocstat/core.c head/lib/libprocstat/core.h head/lib/libprocstat/libprocstat.3 head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h Modified: head/lib/libprocstat/Symbol.map ============================================================================== --- head/lib/libprocstat/Symbol.map Sat Apr 20 07:58:20 2013 (r249673) +++ head/lib/libprocstat/Symbol.map Sat Apr 20 07:59:44 2013 (r249674) @@ -20,6 +20,7 @@ FBSD_1.3 { procstat_freevmmap; procstat_get_shm_info; procstat_getgroups; + procstat_getrlimit; procstat_getumask; procstat_getvmmap; procstat_open_core; Modified: head/lib/libprocstat/core.c ============================================================================== --- head/lib/libprocstat/core.c Sat Apr 20 07:58:20 2013 (r249673) +++ head/lib/libprocstat/core.c Sat Apr 20 07:59:44 2013 (r249674) @@ -175,6 +175,10 @@ procstat_core_get(struct procstat_core * n_type = NT_PROCSTAT_UMASK; structsize = sizeof(u_short); break; + case PSC_TYPE_RLIMIT: + n_type = NT_PROCSTAT_RLIMIT; + structsize = sizeof(struct rlimit) * RLIM_NLIMITS; + break; default: warnx("unknown core stat type: %d", type); return (NULL); Modified: head/lib/libprocstat/core.h ============================================================================== --- head/lib/libprocstat/core.h Sat Apr 20 07:58:20 2013 (r249673) +++ head/lib/libprocstat/core.h Sat Apr 20 07:59:44 2013 (r249674) @@ -35,6 +35,7 @@ enum psc_type { PSC_TYPE_VMMAP, PSC_TYPE_GROUPS, PSC_TYPE_UMASK, + PSC_TYPE_RLIMIT, }; struct procstat_core; Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 07:58:20 2013 (r249673) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 07:59:44 2013 (r249674) @@ -128,6 +128,13 @@ .Fa "unsigned int *count" .Fc .Ft "int" +.Fo procstat_getrlimit +.Fa "struct procstat *procstat" +.Fa "struct kinfo_proc *kp" +.Fa "int which" +.Fa "struct rlimit* rlimit" +.Fc +.Ft "int" .Fo procstat_getumask .Fa "struct procstat *procstat" .Fa "struct kinfo_proc *kp" @@ -261,6 +268,16 @@ The caller is responsible to free the al function call. .Pp The +.Fn procstat_getrlimit +function gets a pointer to the +.Vt procstat +structure, a pointer to +.Vt kinfo_proc +structure, resource index +.Fa which , +and returns the actual resource limit in the 4th reference parameter. +.Pp +The .Fn procstat_getumask function gets a pointer to the .Vt procstat Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Apr 20 07:58:20 2013 (r249673) +++ head/lib/libprocstat/libprocstat.c Sat Apr 20 07:59:44 2013 (r249674) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -135,6 +136,10 @@ static int procstat_get_vnode_info_sysct static gid_t *procstat_getgroups_core(struct procstat_core *core, unsigned int *count); static gid_t *procstat_getgroups_sysctl(pid_t pid, unsigned int *count); +static int procstat_getrlimit_core(struct procstat_core *core, int which, + struct rlimit* rlimit); +static int procstat_getrlimit_sysctl(pid_t pid, int which, + struct rlimit* rlimit); static int procstat_getumask_core(struct procstat_core *core, unsigned short *maskp); static int procstat_getumask_sysctl(pid_t pid, unsigned short *maskp); @@ -1712,3 +1717,66 @@ procstat_getumask(struct procstat *procs return (-1); } } + +static int +procstat_getrlimit_sysctl(pid_t pid, int which, struct rlimit* rlimit) +{ + int error, name[5]; + size_t len; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_RLIMIT; + name[3] = pid; + name[4] = which; + len = sizeof(struct rlimit); + error = sysctl(name, 5, rlimit, &len, NULL, 0); + if (error < 0 && errno != ESRCH) { + warn("sysctl: kern.proc.rlimit: %d", pid); + return (-1); + } + if (error < 0 || len != sizeof(struct rlimit)) + return (-1); + return (0); +} + +static int +procstat_getrlimit_core(struct procstat_core *core, int which, + struct rlimit* rlimit) +{ + size_t len; + struct rlimit* rlimits; + + if (which < 0 || which >= RLIM_NLIMITS) { + errno = EINVAL; + warn("getrlimit: which"); + return (-1); + } + rlimits = procstat_core_get(core, PSC_TYPE_RLIMIT, NULL, &len); + if (rlimits == NULL) + return (-1); + if (len < sizeof(struct rlimit) * RLIM_NLIMITS) { + free(rlimits); + return (-1); + } + *rlimit = rlimits[which]; + return (0); +} + +int +procstat_getrlimit(struct procstat *procstat, struct kinfo_proc *kp, int which, + struct rlimit* rlimit) +{ + switch(procstat->type) { + case PROCSTAT_KVM: + warnx("kvm method is not supported"); + return (-1); + case PROCSTAT_SYSCTL: + return (procstat_getrlimit_sysctl(kp->ki_pid, which, rlimit)); + case PROCSTAT_CORE: + return (procstat_getrlimit_core(procstat->core, which, rlimit)); + default: + warnx("unknown access method: %d", procstat->type); + return (-1); + } +} Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Sat Apr 20 07:58:20 2013 (r249673) +++ head/lib/libprocstat/libprocstat.h Sat Apr 20 07:59:44 2013 (r249674) @@ -91,6 +91,7 @@ struct kinfo_vmentry; struct procstat; +struct rlimit; struct filestat { int fs_type; /* Descriptor type. */ int fs_flags; /* filestat specific flags. */ @@ -170,6 +171,8 @@ gid_t *procstat_getgroups(struct procsta unsigned int *count); int procstat_getumask(struct procstat *procstat, struct kinfo_proc *kp, unsigned short* umask); +int procstat_getrlimit(struct procstat *procstat, struct kinfo_proc *kp, + int which, struct rlimit* rlimit); struct kinfo_vmentry *procstat_getvmmap(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); struct procstat *procstat_open_core(const char *filename); From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:01:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3EEFD6EC; Sat, 20 Apr 2013 08:01:01 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 17E2D11FC; Sat, 20 Apr 2013 08:01:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K810ge002651; Sat, 20 Apr 2013 08:01:00 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K810f1002635; Sat, 20 Apr 2013 08:01:00 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200801.r3K810f1002635@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:01:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249675 - head/usr.bin/procstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:01:01 -0000 Author: trociny Date: Sat Apr 20 08:01:00 2013 New Revision: 249675 URL: http://svnweb.freebsd.org/changeset/base/249675 Log: Use procstat_getrlimit(3) for retrieving rlimit information instead of direct sysctl calls. MFC after: 1 month Modified: head/usr.bin/procstat/procstat.c head/usr.bin/procstat/procstat.h head/usr.bin/procstat/procstat_rlimit.c Modified: head/usr.bin/procstat/procstat.c ============================================================================== --- head/usr.bin/procstat/procstat.c Sat Apr 20 07:59:44 2013 (r249674) +++ head/usr.bin/procstat/procstat.c Sat Apr 20 08:01:00 2013 (r249675) @@ -73,7 +73,7 @@ procstat(struct procstat *prstat, struct else if (kflag) procstat_kstack(kipp, kflag); else if (lflag) - procstat_rlimit(kipp); + procstat_rlimit(prstat, kipp); else if (sflag) procstat_cred(prstat, kipp); else if (tflag) Modified: head/usr.bin/procstat/procstat.h ============================================================================== --- head/usr.bin/procstat/procstat.h Sat Apr 20 07:59:44 2013 (r249674) +++ head/usr.bin/procstat/procstat.h Sat Apr 20 08:01:00 2013 (r249675) @@ -42,7 +42,7 @@ void procstat_cred(struct procstat *prst void procstat_env(struct kinfo_proc *kipp); void procstat_files(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_kstack(struct kinfo_proc *kipp, int kflag); -void procstat_rlimit(struct kinfo_proc *kipp); +void procstat_rlimit(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_sigs(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_threads(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_threads_sigs(struct procstat *prstat, struct kinfo_proc *kipp); Modified: head/usr.bin/procstat/procstat_rlimit.c ============================================================================== --- head/usr.bin/procstat/procstat_rlimit.c Sat Apr 20 07:59:44 2013 (r249674) +++ head/usr.bin/procstat/procstat_rlimit.c Sat Apr 20 08:01:00 2013 (r249675) @@ -86,31 +86,18 @@ humanize_rlimit(int indx, rlim_t limit) } void -procstat_rlimit(struct kinfo_proc *kipp) +procstat_rlimit(struct procstat *prstat, struct kinfo_proc *kipp) { struct rlimit rlimit; - int error, i, name[5]; - size_t len; + int i; if (!hflag) { printf("%5s %-16s %-16s %16s %16s\n", "PID", "COMM", "RLIMIT", "SOFT ", "HARD "); } - len = sizeof(struct rlimit); - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_RLIMIT; - name[3] = kipp->ki_pid; for (i = 0; i < RLIM_NLIMITS; i++) { - name[4] = i; - error = sysctl(name, 5, &rlimit, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { - warn("sysctl: kern.proc.rlimit: %d", kipp->ki_pid); + if (procstat_getrlimit(prstat, kipp, i, &rlimit) == -1) return; - } - if (error < 0 || len != sizeof(struct rlimit)) - return; - printf("%5d %-16s %-16s ", kipp->ki_pid, kipp->ki_comm, rlimit_param[i].name); printf("%16s ", humanize_rlimit(i, rlimit.rlim_cur)); From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:02:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 133A0864; Sat, 20 Apr 2013 08:02:45 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EB5971203; Sat, 20 Apr 2013 08:02:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K82iqE004531; Sat, 20 Apr 2013 08:02:44 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K82iPO004517; Sat, 20 Apr 2013 08:02:44 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200802.r3K82iPO004517@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249676 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:02:45 -0000 Author: trociny Date: Sat Apr 20 08:02:43 2013 New Revision: 249676 URL: http://svnweb.freebsd.org/changeset/base/249676 Log: Add procstat_getpathname function to retrieve a process executable. MFC after: 1 month Modified: head/lib/libprocstat/Symbol.map head/lib/libprocstat/libprocstat.3 head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h Modified: head/lib/libprocstat/Symbol.map ============================================================================== --- head/lib/libprocstat/Symbol.map Sat Apr 20 08:01:00 2013 (r249675) +++ head/lib/libprocstat/Symbol.map Sat Apr 20 08:02:43 2013 (r249676) @@ -20,6 +20,7 @@ FBSD_1.3 { procstat_freevmmap; procstat_get_shm_info; procstat_getgroups; + procstat_getpathname; procstat_getrlimit; procstat_getumask; procstat_getvmmap; Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:01:00 2013 (r249675) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:02:43 2013 (r249676) @@ -34,6 +34,7 @@ .Nm procstat_close , .Nm procstat_getfiles , .Nm procstat_getgroups , +.Nm procstat_getpathname , .Nm procstat_getprocs , .Nm procstat_getumask , .Nm procstat_getvmmap , @@ -128,6 +129,13 @@ .Fa "unsigned int *count" .Fc .Ft "int" +.Fo procstat_getpathname +.Fa "struct procstat *procstat" +.Fa "struct kinfo_proc *kp" +.Fa "char *pathname" +.Fa "size_t maxlen" +.Fc +.Ft "int" .Fo procstat_getrlimit .Fa "struct procstat *procstat" .Fa "struct kinfo_proc *kp" @@ -268,6 +276,18 @@ The caller is responsible to free the al function call. .Pp The +.Fn procstat_getpathname +function gets a pointer to the +.Vt procstat +structure, a pointer to +.Vt kinfo_proc +structure, and copies the path of the process executable to +.Fa pathname +buffer, limiting to +.Fa maxlen +characters. +.Pp +The .Fn procstat_getrlimit function gets a pointer to the .Vt procstat Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Apr 20 08:01:00 2013 (r249675) +++ head/lib/libprocstat/libprocstat.c Sat Apr 20 08:02:43 2013 (r249676) @@ -136,6 +136,10 @@ static int procstat_get_vnode_info_sysct static gid_t *procstat_getgroups_core(struct procstat_core *core, unsigned int *count); static gid_t *procstat_getgroups_sysctl(pid_t pid, unsigned int *count); +static int procstat_getpathname_core(struct procstat_core *core, + char *pathname, size_t maxlen); +static int procstat_getpathname_sysctl(pid_t pid, char *pathname, + size_t maxlen); static int procstat_getrlimit_core(struct procstat_core *core, int which, struct rlimit* rlimit); static int procstat_getrlimit_sysctl(pid_t pid, int which, @@ -1780,3 +1784,64 @@ procstat_getrlimit(struct procstat *proc return (-1); } } + +static int +procstat_getpathname_sysctl(pid_t pid, char *pathname, size_t maxlen) +{ + int error, name[4]; + size_t len; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_PATHNAME; + name[3] = pid; + len = maxlen; + error = sysctl(name, 4, pathname, &len, NULL, 0); + if (error != 0 && errno != ESRCH) + warn("sysctl: kern.proc.pathname: %d", pid); + if (len == 0) + pathname[0] = '\0'; + return (error); +} + +static int +procstat_getpathname_core(struct procstat_core *core, char *pathname, + size_t maxlen) +{ + struct kinfo_file *files; + int cnt, i, result; + + files = kinfo_getfile_core(core, &cnt); + if (files == NULL) + return (-1); + result = -1; + for (i = 0; i < cnt; i++) { + if (files[i].kf_fd != KF_FD_TYPE_TEXT) + continue; + strncpy(pathname, files[i].kf_path, maxlen); + result = 0; + break; + } + free(files); + return (result); +} + +int +procstat_getpathname(struct procstat *procstat, struct kinfo_proc *kp, + char *pathname, size_t maxlen) +{ + switch(procstat->type) { + case PROCSTAT_KVM: + warnx("kvm method is not supported"); + return (-1); + case PROCSTAT_SYSCTL: + return (procstat_getpathname_sysctl(kp->ki_pid, pathname, + maxlen)); + case PROCSTAT_CORE: + return (procstat_getpathname_core(procstat->core, pathname, + maxlen)); + default: + warnx("unknown access method: %d", procstat->type); + return (-1); + } +} Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Sat Apr 20 08:01:00 2013 (r249675) +++ head/lib/libprocstat/libprocstat.h Sat Apr 20 08:02:43 2013 (r249676) @@ -169,10 +169,12 @@ int procstat_get_vnode_info(struct procs struct vnstat *vn, char *errbuf); gid_t *procstat_getgroups(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); -int procstat_getumask(struct procstat *procstat, struct kinfo_proc *kp, - unsigned short* umask); +int procstat_getpathname(struct procstat *procstat, struct kinfo_proc *kp, + char *pathname, size_t maxlen); int procstat_getrlimit(struct procstat *procstat, struct kinfo_proc *kp, int which, struct rlimit* rlimit); +int procstat_getumask(struct procstat *procstat, struct kinfo_proc *kp, + unsigned short* umask); struct kinfo_vmentry *procstat_getvmmap(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); struct procstat *procstat_open_core(const char *filename); From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:03:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EC398BAD; Sat, 20 Apr 2013 08:03:57 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CF1C5120C; Sat, 20 Apr 2013 08:03:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K83vfg005779; Sat, 20 Apr 2013 08:03:57 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K83ugM005761; Sat, 20 Apr 2013 08:03:56 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200803.r3K83ugM005761@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:03:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249677 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:03:58 -0000 Author: trociny Date: Sat Apr 20 08:03:56 2013 New Revision: 249677 URL: http://svnweb.freebsd.org/changeset/base/249677 Log: Add procstat_getosrel function to retrieve a process osrel info. MFC after: 1 month Modified: head/lib/libprocstat/Symbol.map head/lib/libprocstat/core.c head/lib/libprocstat/core.h head/lib/libprocstat/libprocstat.3 head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h Modified: head/lib/libprocstat/Symbol.map ============================================================================== --- head/lib/libprocstat/Symbol.map Sat Apr 20 08:02:43 2013 (r249676) +++ head/lib/libprocstat/Symbol.map Sat Apr 20 08:03:56 2013 (r249677) @@ -20,6 +20,7 @@ FBSD_1.3 { procstat_freevmmap; procstat_get_shm_info; procstat_getgroups; + procstat_getosrel; procstat_getpathname; procstat_getrlimit; procstat_getumask; Modified: head/lib/libprocstat/core.c ============================================================================== --- head/lib/libprocstat/core.c Sat Apr 20 08:02:43 2013 (r249676) +++ head/lib/libprocstat/core.c Sat Apr 20 08:03:56 2013 (r249677) @@ -179,6 +179,10 @@ procstat_core_get(struct procstat_core * n_type = NT_PROCSTAT_RLIMIT; structsize = sizeof(struct rlimit) * RLIM_NLIMITS; break; + case PSC_TYPE_OSREL: + n_type = NT_PROCSTAT_OSREL; + structsize = sizeof(int); + break; default: warnx("unknown core stat type: %d", type); return (NULL); Modified: head/lib/libprocstat/core.h ============================================================================== --- head/lib/libprocstat/core.h Sat Apr 20 08:02:43 2013 (r249676) +++ head/lib/libprocstat/core.h Sat Apr 20 08:03:56 2013 (r249677) @@ -36,6 +36,7 @@ enum psc_type { PSC_TYPE_GROUPS, PSC_TYPE_UMASK, PSC_TYPE_RLIMIT, + PSC_TYPE_OSREL, }; struct procstat_core; Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:02:43 2013 (r249676) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:03:56 2013 (r249677) @@ -34,6 +34,7 @@ .Nm procstat_close , .Nm procstat_getfiles , .Nm procstat_getgroups , +.Nm procstat_getosrel , .Nm procstat_getpathname , .Nm procstat_getprocs , .Nm procstat_getumask , @@ -120,6 +121,11 @@ .Fa "struct procstat *procstat" .Fa "struct kinfo_proc *kp" .Fa "unsigned int *count" +.Ft int +.Fo procstat_getosrel +.Fa "struct procstat *procstat" +.Fa "struct kinfo_proc *kp" +.Fa "int *osrelp" .Fc .Ft "struct kinfo_proc *" .Fo procstat_getprocs @@ -276,6 +282,14 @@ The caller is responsible to free the al function call. .Pp The +.Fn procstat_getosrel +function gets a pointer to the +.Vt procstat +structure, a pointer to +.Vt kinfo_proc +structure, and returns osrel date in the 3rd reference parameter. +.Pp +The .Fn procstat_getpathname function gets a pointer to the .Vt procstat Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Apr 20 08:02:43 2013 (r249676) +++ head/lib/libprocstat/libprocstat.c Sat Apr 20 08:03:56 2013 (r249677) @@ -1845,3 +1845,55 @@ procstat_getpathname(struct procstat *pr return (-1); } } + +static int +procstat_getosrel_sysctl(pid_t pid, int *osrelp) +{ + int error, name[4]; + size_t len; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_OSREL; + name[3] = pid; + len = sizeof(*osrelp); + error = sysctl(name, 4, osrelp, &len, NULL, 0); + if (error != 0 && errno != ESRCH) + warn("sysctl: kern.proc.osrel: %d", pid); + return (error); +} + +static int +procstat_getosrel_core(struct procstat_core *core, int *osrelp) +{ + size_t len; + int *buf; + + buf = procstat_core_get(core, PSC_TYPE_OSREL, NULL, &len); + if (buf == NULL) + return (-1); + if (len < sizeof(*osrelp)) { + free(buf); + return (-1); + } + *osrelp = *buf; + free(buf); + return (0); +} + +int +procstat_getosrel(struct procstat *procstat, struct kinfo_proc *kp, int *osrelp) +{ + switch(procstat->type) { + case PROCSTAT_KVM: + warnx("kvm method is not supported"); + return (-1); + case PROCSTAT_SYSCTL: + return (procstat_getosrel_sysctl(kp->ki_pid, osrelp)); + case PROCSTAT_CORE: + return (procstat_getosrel_core(procstat->core, osrelp)); + default: + warnx("unknown access method: %d", procstat->type); + return (-1); + } +} Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Sat Apr 20 08:02:43 2013 (r249676) +++ head/lib/libprocstat/libprocstat.h Sat Apr 20 08:03:56 2013 (r249677) @@ -169,6 +169,8 @@ int procstat_get_vnode_info(struct procs struct vnstat *vn, char *errbuf); gid_t *procstat_getgroups(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); +int procstat_getosrel(struct procstat *procstat, struct kinfo_proc *kp, + int *osrelp); int procstat_getpathname(struct procstat *procstat, struct kinfo_proc *kp, char *pathname, size_t maxlen); int procstat_getrlimit(struct procstat *procstat, struct kinfo_proc *kp, From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:05:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B882BD36; Sat, 20 Apr 2013 08:05:05 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 918A0121D; Sat, 20 Apr 2013 08:05:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K855HM006821; Sat, 20 Apr 2013 08:05:05 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K855l4006811; Sat, 20 Apr 2013 08:05:05 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200805.r3K855l4006811@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:05:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249678 - head/usr.bin/procstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:05:05 -0000 Author: trociny Date: Sat Apr 20 08:05:04 2013 New Revision: 249678 URL: http://svnweb.freebsd.org/changeset/base/249678 Log: Use libprocstat(3) when retrieving binary information for a process. MFC after: 1 month Modified: head/usr.bin/procstat/procstat.c head/usr.bin/procstat/procstat.h head/usr.bin/procstat/procstat_bin.c Modified: head/usr.bin/procstat/procstat.c ============================================================================== --- head/usr.bin/procstat/procstat.c Sat Apr 20 08:03:56 2013 (r249677) +++ head/usr.bin/procstat/procstat.c Sat Apr 20 08:05:04 2013 (r249678) @@ -59,7 +59,7 @@ procstat(struct procstat *prstat, struct { if (bflag) - procstat_bin(kipp); + procstat_bin(prstat, kipp); else if (cflag) procstat_args(kipp); else if (eflag) Modified: head/usr.bin/procstat/procstat.h ============================================================================== --- head/usr.bin/procstat/procstat.h Sat Apr 20 08:03:56 2013 (r249677) +++ head/usr.bin/procstat/procstat.h Sat Apr 20 08:05:04 2013 (r249678) @@ -37,7 +37,7 @@ void kinfo_proc_sort(struct kinfo_proc * void procstat_args(struct kinfo_proc *kipp); void procstat_auxv(struct kinfo_proc *kipp); void procstat_basic(struct kinfo_proc *kipp); -void procstat_bin(struct kinfo_proc *kipp); +void procstat_bin(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_cred(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_env(struct kinfo_proc *kipp); void procstat_files(struct procstat *prstat, struct kinfo_proc *kipp); Modified: head/usr.bin/procstat/procstat_bin.c ============================================================================== --- head/usr.bin/procstat/procstat_bin.c Sat Apr 20 08:03:56 2013 (r249677) +++ head/usr.bin/procstat/procstat_bin.c Sat Apr 20 08:05:04 2013 (r249678) @@ -40,40 +40,19 @@ #include "procstat.h" void -procstat_bin(struct kinfo_proc *kipp) +procstat_bin(struct procstat *prstat, struct kinfo_proc *kipp) { - char pathname[PATH_MAX]; - int error, osrel, name[4]; - size_t len; + int osrel; + static char pathname[PATH_MAX]; if (!hflag) printf("%5s %-16s %8s %s\n", "PID", "COMM", "OSREL", "PATH"); - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_PATHNAME; - name[3] = kipp->ki_pid; - - len = sizeof(pathname); - error = sysctl(name, 4, pathname, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { - warn("sysctl: kern.proc.pathname: %d", kipp->ki_pid); - return; - } - if (error < 0) + if (procstat_getpathname(prstat, kipp, pathname, sizeof(pathname)) != 0) return; - if (len == 0 || strlen(pathname) == 0) + if (strlen(pathname) == 0) strcpy(pathname, "-"); - - name[2] = KERN_PROC_OSREL; - - len = sizeof(osrel); - error = sysctl(name, 4, &osrel, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { - warn("sysctl: kern.proc.osrel: %d", kipp->ki_pid); - return; - } - if (error < 0) + if (procstat_getosrel(prstat, kipp, &osrel) != 0) return; printf("%5d ", kipp->ki_pid); From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:07:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2E94EEC6; Sat, 20 Apr 2013 08:07:06 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1F3391232; Sat, 20 Apr 2013 08:07:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K876Ze008923; Sat, 20 Apr 2013 08:07:06 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K874GB008895; Sat, 20 Apr 2013 08:07:04 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200807.r3K874GB008895@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:07:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249679 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:07:06 -0000 Author: trociny Date: Sat Apr 20 08:07:04 2013 New Revision: 249679 URL: http://svnweb.freebsd.org/changeset/base/249679 Log: Extend libprocstat with functions to retrieve process command line arguments and environment variables. Suggested by: stas Reviewed by: jhb and stas (initial version) MFC after: 1 month Modified: head/lib/libprocstat/Symbol.map head/lib/libprocstat/core.c head/lib/libprocstat/core.h head/lib/libprocstat/libprocstat.3 head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h head/lib/libprocstat/libprocstat_internal.h Modified: head/lib/libprocstat/Symbol.map ============================================================================== --- head/lib/libprocstat/Symbol.map Sat Apr 20 08:05:04 2013 (r249678) +++ head/lib/libprocstat/Symbol.map Sat Apr 20 08:07:04 2013 (r249679) @@ -16,9 +16,13 @@ FBSD_1.2 { }; FBSD_1.3 { + procstat_freeargv; + procstat_freeenvv; procstat_freegroups; procstat_freevmmap; procstat_get_shm_info; + procstat_getargv; + procstat_getenvv; procstat_getgroups; procstat_getosrel; procstat_getpathname; Modified: head/lib/libprocstat/core.c ============================================================================== --- head/lib/libprocstat/core.c Sat Apr 20 08:05:04 2013 (r249678) +++ head/lib/libprocstat/core.c Sat Apr 20 08:07:04 2013 (r249679) @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -56,6 +57,10 @@ struct procstat_core static bool core_offset(struct procstat_core *core, off_t offset); static bool core_read(struct procstat_core *core, void *buf, size_t len); +static ssize_t core_read_mem(struct procstat_core *core, void *buf, + size_t len, vm_offset_t addr, bool readall); +static void *get_args(struct procstat_core *core, vm_offset_t psstrings, + enum psc_type type, void *buf, size_t *lenp); struct procstat_core * procstat_core_open(const char *filename) @@ -146,6 +151,7 @@ procstat_core_get(struct procstat_core * { Elf_Note nhdr; off_t offset, eoffset; + vm_offset_t psstrings; void *freebuf; size_t len; u_int32_t n_type; @@ -183,6 +189,12 @@ procstat_core_get(struct procstat_core * n_type = NT_PROCSTAT_OSREL; structsize = sizeof(int); break; + case PSC_TYPE_PSSTRINGS: + case PSC_TYPE_ARGV: + case PSC_TYPE_ENVV: + n_type = NT_PROCSTAT_PSSTRINGS; + structsize = sizeof(vm_offset_t); + break; default: warnx("unknown core stat type: %d", type); return (NULL); @@ -238,6 +250,19 @@ procstat_core_get(struct procstat_core * free(freebuf); return (NULL); } + if (type == PSC_TYPE_ARGV || type == PSC_TYPE_ENVV) { + if (len < sizeof(psstrings)) { + free(freebuf); + return (NULL); + } + psstrings = *(vm_offset_t *)buf; + if (freebuf == NULL) + len = *lenp; + else + buf = NULL; + free(freebuf); + buf = get_args(core, psstrings, type, buf, &len); + } *lenp = len; return (buf); } @@ -276,3 +301,128 @@ core_read(struct procstat_core *core, vo } return (true); } + +static ssize_t +core_read_mem(struct procstat_core *core, void *buf, size_t len, + vm_offset_t addr, bool readall) +{ + GElf_Phdr phdr; + off_t offset; + int i; + + assert(core->pc_magic == PROCSTAT_CORE_MAGIC); + + for (i = 0; i < core->pc_ehdr.e_phnum; i++) { + if (gelf_getphdr(core->pc_elf, i, &phdr) != &phdr) { + warnx("gelf_getphdr: %s", elf_errmsg(-1)); + return (-1); + } + if (phdr.p_type != PT_LOAD) + continue; + if (addr < phdr.p_vaddr || addr > phdr.p_vaddr + phdr.p_memsz) + continue; + offset = phdr.p_offset + (addr - phdr.p_vaddr); + if ((phdr.p_vaddr + phdr.p_memsz) - addr < len) { + if (readall) { + warnx("format error: " + "attempt to read out of segment"); + return (-1); + } + len = (phdr.p_vaddr + phdr.p_memsz) - addr; + } + if (!core_offset(core, offset)) + return (-1); + if (!core_read(core, buf, len)) + return (-1); + return (len); + } + warnx("format error: address %ju not found", (uintmax_t)addr); + return (-1); +} + +#define ARGS_CHUNK_SZ 256 /* Chunk size (bytes) for get_args operations. */ + +static void * +get_args(struct procstat_core *core, vm_offset_t psstrings, enum psc_type type, + void *args, size_t *lenp) +{ + struct ps_strings pss; + void *freeargs; + vm_offset_t addr; + char **argv, *p; + size_t chunksz, done, len, nchr, size; + ssize_t n; + u_int i, nstr; + + assert(type == PSC_TYPE_ARGV || type == PSC_TYPE_ENVV); + + if (core_read_mem(core, &pss, sizeof(pss), psstrings, true) == -1) + return (NULL); + if (type == PSC_TYPE_ARGV) { + addr = (vm_offset_t)pss.ps_argvstr; + nstr = pss.ps_nargvstr; + } else /* type == PSC_TYPE_ENVV */ { + addr = (vm_offset_t)pss.ps_envstr; + nstr = pss.ps_nenvstr; + } + if (addr == 0 || nstr == 0) + return (NULL); + if (nstr > ARG_MAX) { + warnx("format error"); + return (NULL); + } + size = nstr * sizeof(char *); + argv = malloc(size); + if (argv == NULL) { + warn("malloc(%zu)", size); + return (NULL); + } + done = 0; + freeargs = NULL; + if (core_read_mem(core, argv, size, addr, true) == -1) + goto fail; + if (args != NULL) { + nchr = MIN(ARG_MAX, *lenp); + } else { + nchr = ARG_MAX; + freeargs = args = malloc(nchr); + if (args == NULL) { + warn("malloc(%zu)", nchr); + goto fail; + } + } + p = args; + for (i = 0; ; i++) { + if (i == nstr) + goto done; + /* + * The program may have scribbled into its argv array, e.g. to + * remove some arguments. If that has happened, break out + * before trying to read from NULL. + */ + if (argv[i] == NULL) + goto done; + for (addr = (vm_offset_t)argv[i]; ; addr += chunksz) { + chunksz = MIN(ARGS_CHUNK_SZ, nchr - 1 - done); + if (chunksz <= 0) + goto done; + n = core_read_mem(core, p, chunksz, addr, false); + if (n == -1) + goto fail; + len = strnlen(p, chunksz); + p += len; + done += len; + if (len != chunksz) + break; + } + *p++ = '\0'; + done++; + } +fail: + free(freeargs); + args = NULL; +done: + *lenp = done; + free(argv); + return (args); +} Modified: head/lib/libprocstat/core.h ============================================================================== --- head/lib/libprocstat/core.h Sat Apr 20 08:05:04 2013 (r249678) +++ head/lib/libprocstat/core.h Sat Apr 20 08:07:04 2013 (r249679) @@ -37,6 +37,9 @@ enum psc_type { PSC_TYPE_UMASK, PSC_TYPE_RLIMIT, PSC_TYPE_OSREL, + PSC_TYPE_PSSTRINGS, + PSC_TYPE_ARGV, + PSC_TYPE_ENVV, }; struct procstat_core; Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:05:04 2013 (r249678) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:07:04 2013 (r249679) @@ -32,6 +32,8 @@ .Nm procstat_open_kvm , .Nm procstat_open_sysctl , .Nm procstat_close , +.Nm procstat_getargv , +.Nm procstat_getenvv , .Nm procstat_getfiles , .Nm procstat_getgroups , .Nm procstat_getosrel , @@ -39,6 +41,8 @@ .Nm procstat_getprocs , .Nm procstat_getumask , .Nm procstat_getvmmap , +.Nm procstat_freeargv , +.Nm procstat_freeenvv , .Nm procstat_freefiles , .Nm procstat_freegroups , .Nm procstat_freeprocs , @@ -59,6 +63,14 @@ .Fn procstat_close "struct procstat *procstat" .Fc .Ft void +.Fo procstat_freeargv +.Fa "struct procstat *procstat" +.Fc +.Ft void +.Fo procstat_freeenvv +.Fa "struct procstat *procstat" +.Fc +.Ft void .Fo procstat_freefiles .Fa "struct procstat *procstat" .Fa "struct filestat_list *head" @@ -110,6 +122,20 @@ .Fa "struct vnstat *vn" .Fa "char *errbuf" .Fc +.Ft "char **" +.Fo procstat_getargv +.Fa "struct procstat *procstat" +.Fa "const struct kinfo_proc *kp" +.Fa "size_t nchr" +.Fa "char *errbuf" +.Fc +.Ft "char **" +.Fo procstat_getenvv +.Fa "struct procstat *procstat" +.Fa "const struct kinfo_proc *kp" +.Fa "size_t nchr" +.Fa "char *errbuf" +.Fc .Ft "struct filestat_list *" .Fo procstat_getfiles .Fa "struct procstat *procstat" @@ -251,6 +277,50 @@ The caller is responsible to free the al function call. .Pp The +.Fn procstat_getargv +function gets a pointer to the +.Vt procstat +structure from one of the +.Fn procstat_open_* +functions, a pointer to +.Vt kinfo_proc +structure from the array obtained from the +.Fn kvm_getprocs +function, and returns a null-terminated argument vector that corresponds to +the command line arguments passed to the process. +The +.Fa nchr +argument indicates the maximum number of characters, including null bytes, +to use in building the strings. +If this amount is exceeded, the string causing the overflow is truncated and +the partial result is returned. +This is handy for programs that print only a one line summary of a +command and should not copy out large amounts of text only to ignore it. +If +.Fa nchr +is zero, no limit is imposed and all argument strings are returned. +The values of the returned argument vector refer the strings stored +in the +.Vt procstat +internal buffer. +A subsequent call of the function with the same +.Vt procstat +argument will reuse the buffer. +To free the allocated memory +.Fn procstat_freeargv +function call can be used, or it will be released on +.Fn procstat_close . +.Pp +The +.Fn procstat_getenvv +function is similar to +.Fn procstat_getargv +but returns the vector of environment strings. +The caller may free the allocated memory with a subsequent +.Fn procstat_freeenv +function call. +.Pp +The .Fn procstat_getfiles function gets a pointer to the .Vt procstat Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Apr 20 08:05:04 2013 (r249678) +++ head/lib/libprocstat/libprocstat.c Sat Apr 20 08:07:04 2013 (r249679) @@ -105,6 +105,8 @@ int statfs(const char *, struct stat #define PROCSTAT_SYSCTL 2 #define PROCSTAT_CORE 3 +static char **getargv(struct procstat *procstat, struct kinfo_proc *kp, + size_t nchr, int env); static char *getmnton(kvm_t *kd, struct mount *m); static struct kinfo_vmentry * kinfo_getvmmap_core(struct procstat_core *core, int *cntp); @@ -158,6 +160,8 @@ procstat_close(struct procstat *procstat kvm_close(procstat->kd); else if (procstat->type == PROCSTAT_CORE) procstat_core_close(procstat->core); + procstat_freeargv(procstat); + procstat_freeenvv(procstat); free(procstat); } @@ -1524,6 +1528,180 @@ getmnton(kvm_t *kd, struct mount *m) return (mt->mntonname); } +/* + * Auxiliary structures and functions to get process environment or + * command line arguments. + */ +struct argvec { + char *buf; + size_t bufsize; + char **argv; + size_t argc; +}; + +static struct argvec * +argvec_alloc(size_t bufsize) +{ + struct argvec *av; + + av = malloc(sizeof(*av)); + if (av == NULL) + return (NULL); + av->bufsize = bufsize; + av->buf = malloc(av->bufsize); + if (av->buf == NULL) { + free(av); + return (NULL); + } + av->argc = 32; + av->argv = malloc(sizeof(char *) * av->argc); + if (av->argv == NULL) { + free(av->buf); + free(av); + return (NULL); + } + return av; +} + +static void +argvec_free(struct argvec * av) +{ + + free(av->argv); + free(av->buf); + free(av); +} + +static char ** +getargv(struct procstat *procstat, struct kinfo_proc *kp, size_t nchr, int env) +{ + int error, name[4], argc, i; + struct argvec *av, **avp; + enum psc_type type; + size_t len; + char *p, **argv; + + assert(procstat); + assert(kp); + if (procstat->type == PROCSTAT_KVM) { + warnx("can't use kvm access method"); + return (NULL); + } + if (procstat->type != PROCSTAT_SYSCTL && + procstat->type != PROCSTAT_CORE) { + warnx("unknown access method: %d", procstat->type); + return (NULL); + } + + if (nchr == 0 || nchr > ARG_MAX) + nchr = ARG_MAX; + + avp = (struct argvec **)(env ? &procstat->argv : &procstat->envv); + av = *avp; + + if (av == NULL) + { + av = argvec_alloc(nchr); + if (av == NULL) + { + warn("malloc(%zu)", nchr); + return (NULL); + } + *avp = av; + } else if (av->bufsize < nchr) { + av->buf = reallocf(av->buf, nchr); + if (av->buf == NULL) { + warn("malloc(%zu)", nchr); + return (NULL); + } + } + if (procstat->type == PROCSTAT_SYSCTL) { + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = env ? KERN_PROC_ENV : KERN_PROC_ARGS; + name[3] = kp->ki_pid; + len = nchr; + error = sysctl(name, 4, av->buf, &len, NULL, 0); + if (error != 0 && errno != ESRCH && errno != EPERM) + warn("sysctl(kern.proc.%s)", env ? "env" : "args"); + if (error != 0 || len == 0) + return (NULL); + } else /* procstat->type == PROCSTAT_CORE */ { + type = env ? PSC_TYPE_ENVV : PSC_TYPE_ARGV; + len = nchr; + if (procstat_core_get(procstat->core, type, av->buf, &len) + == NULL) { + return (NULL); + } + } + + argv = av->argv; + argc = av->argc; + i = 0; + for (p = av->buf; p < av->buf + len; p += strlen(p) + 1) { + argv[i++] = p; + if (i < argc) + continue; + /* Grow argv. */ + argc += argc; + argv = realloc(argv, sizeof(char *) * argc); + if (argv == NULL) { + warn("malloc(%zu)", sizeof(char *) * argc); + return (NULL); + } + av->argv = argv; + av->argc = argc; + } + argv[i] = NULL; + + return (argv); +} + +/* + * Return process command line arguments. + */ +char ** +procstat_getargv(struct procstat *procstat, struct kinfo_proc *p, size_t nchr) +{ + + return (getargv(procstat, p, nchr, 0)); +} + +/* + * Free the buffer allocated by procstat_getargv(). + */ +void +procstat_freeargv(struct procstat *procstat) +{ + + if (procstat->argv != NULL) { + argvec_free(procstat->argv); + procstat->argv = NULL; + } +} + +/* + * Return process environment. + */ +char ** +procstat_getenvv(struct procstat *procstat, struct kinfo_proc *p, size_t nchr) +{ + + return (getargv(procstat, p, nchr, 1)); +} + +/* + * Free the buffer allocated by procstat_getenvv(). + */ +void +procstat_freeenvv(struct procstat *procstat) +{ + if (procstat->envv != NULL) { + argvec_free(procstat->envv); + procstat->envv = NULL; + } +} + static struct kinfo_vmentry * kinfo_getvmmap_core(struct procstat_core *core, int *cntp) { Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Sat Apr 20 08:05:04 2013 (r249678) +++ head/lib/libprocstat/libprocstat.h Sat Apr 20 08:07:04 2013 (r249679) @@ -147,6 +147,8 @@ STAILQ_HEAD(filestat_list, filestat); __BEGIN_DECLS void procstat_close(struct procstat *procstat); +void procstat_freeargv(struct procstat *procstat); +void procstat_freeenvv(struct procstat *procstat); void procstat_freegroups(struct procstat *procstat, gid_t *groups); void procstat_freeprocs(struct procstat *procstat, struct kinfo_proc *p); void procstat_freefiles(struct procstat *procstat, @@ -167,6 +169,10 @@ int procstat_get_socket_info(struct proc struct sockstat *sock, char *errbuf); int procstat_get_vnode_info(struct procstat *procstat, struct filestat *fst, struct vnstat *vn, char *errbuf); +char **procstat_getargv(struct procstat *procstat, struct kinfo_proc *p, + size_t nchr); +char **procstat_getenvv(struct procstat *procstat, struct kinfo_proc *p, + size_t nchr); gid_t *procstat_getgroups(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); int procstat_getosrel(struct procstat *procstat, struct kinfo_proc *kp, Modified: head/lib/libprocstat/libprocstat_internal.h ============================================================================== --- head/lib/libprocstat/libprocstat_internal.h Sat Apr 20 08:05:04 2013 (r249678) +++ head/lib/libprocstat/libprocstat_internal.h Sat Apr 20 08:07:04 2013 (r249679) @@ -34,6 +34,8 @@ struct procstat { kvm_t *kd; void *vmentries; void *files; + void *argv; + void *envv; struct procstat_core *core; }; From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:08:30 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2106DD6; Sat, 20 Apr 2013 08:08:30 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 13A561248; Sat, 20 Apr 2013 08:08:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K88TGT010457; Sat, 20 Apr 2013 08:08:29 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K88TX8010447; Sat, 20 Apr 2013 08:08:29 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200808.r3K88TX8010447@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:08:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249680 - head/usr.bin/procstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:08:30 -0000 Author: trociny Date: Sat Apr 20 08:08:29 2013 New Revision: 249680 URL: http://svnweb.freebsd.org/changeset/base/249680 Log: Use libprocstat(3) to retrieve process command line arguments and environment variables. MFC after: 1 month Modified: head/usr.bin/procstat/procstat.c head/usr.bin/procstat/procstat.h head/usr.bin/procstat/procstat_args.c Modified: head/usr.bin/procstat/procstat.c ============================================================================== --- head/usr.bin/procstat/procstat.c Sat Apr 20 08:07:04 2013 (r249679) +++ head/usr.bin/procstat/procstat.c Sat Apr 20 08:08:29 2013 (r249680) @@ -61,9 +61,9 @@ procstat(struct procstat *prstat, struct if (bflag) procstat_bin(prstat, kipp); else if (cflag) - procstat_args(kipp); + procstat_args(prstat, kipp); else if (eflag) - procstat_env(kipp); + procstat_env(prstat, kipp); else if (fflag) procstat_files(prstat, kipp); else if (iflag) Modified: head/usr.bin/procstat/procstat.h ============================================================================== --- head/usr.bin/procstat/procstat.h Sat Apr 20 08:07:04 2013 (r249679) +++ head/usr.bin/procstat/procstat.h Sat Apr 20 08:08:29 2013 (r249680) @@ -34,12 +34,12 @@ extern int hflag, nflag, Cflag; struct kinfo_proc; void kinfo_proc_sort(struct kinfo_proc *kipp, int count); -void procstat_args(struct kinfo_proc *kipp); +void procstat_args(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_auxv(struct kinfo_proc *kipp); void procstat_basic(struct kinfo_proc *kipp); void procstat_bin(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_cred(struct procstat *prstat, struct kinfo_proc *kipp); -void procstat_env(struct kinfo_proc *kipp); +void procstat_env(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_files(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_kstack(struct kinfo_proc *kipp, int kflag); void procstat_rlimit(struct procstat *prstat, struct kinfo_proc *kipp); Modified: head/usr.bin/procstat/procstat_args.c ============================================================================== --- head/usr.bin/procstat/procstat_args.c Sat Apr 20 08:07:04 2013 (r249679) +++ head/usr.bin/procstat/procstat_args.c Sat Apr 20 08:08:29 2013 (r249680) @@ -40,52 +40,40 @@ #include "procstat.h" -static char args[ARG_MAX]; - static void -do_args(struct kinfo_proc *kipp, int env) +do_args(struct procstat *procstat, struct kinfo_proc *kipp, int env) { - int error, name[4]; - size_t len; - char *cp; + int i; + char **args; - if (!hflag) + if (!hflag) { printf("%5s %-16s %-53s\n", "PID", "COMM", env ? "ENVIRONMENT" : "ARGS"); - - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = env ? KERN_PROC_ENV : KERN_PROC_ARGS; - name[3] = kipp->ki_pid; - len = sizeof(args); - error = sysctl(name, 4, args, &len, NULL, 0); - if (error < 0 && errno != ESRCH && errno != EPERM) { - warn("sysctl: kern.proc.%s: %d: %d", env ? "env" : "args", - kipp->ki_pid, errno); - return; } - if (error < 0) + + args = env ? procstat_getenvv(procstat, kipp, 0) : + procstat_getargv(procstat, kipp, 0); + + printf("%5d %-16s", kipp->ki_pid, kipp->ki_comm); + + if (args == NULL) { + printf(" -\n"); return; - if (len == 0 || strlen(args) == 0) { - strcpy(args, "-"); - len = strlen(args) + 1; } - printf("%5d ", kipp->ki_pid); - printf("%-16s ", kipp->ki_comm); - for (cp = args; cp < args + len; cp += strlen(cp) + 1) - printf("%s%s", cp != args ? " " : "", cp); + for (i = 0; args[i] != NULL; i++) + printf(" %s", args[i]); printf("\n"); } void -procstat_args(struct kinfo_proc *kipp) +procstat_args(struct procstat *procstat, struct kinfo_proc *kipp) { - do_args(kipp, 0); + do_args(procstat, kipp, 0); } void -procstat_env(struct kinfo_proc *kipp) +procstat_env(struct procstat *procstat, struct kinfo_proc *kipp) { - do_args(kipp, 1); + do_args(procstat, kipp, 1); } From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:10:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A8D0F33C; Sat, 20 Apr 2013 08:10:48 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9B9931259; Sat, 20 Apr 2013 08:10:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K8Am3L014394; Sat, 20 Apr 2013 08:10:48 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K8Alom014369; Sat, 20 Apr 2013 08:10:47 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200810.r3K8Alom014369@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:10:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249681 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:10:48 -0000 Author: trociny Date: Sat Apr 20 08:10:47 2013 New Revision: 249681 URL: http://svnweb.freebsd.org/changeset/base/249681 Log: Add procstat_getauxv function to retrieve a process auxiliary vector. MFC after: 1 month Modified: head/lib/libprocstat/Symbol.map head/lib/libprocstat/core.c head/lib/libprocstat/core.h head/lib/libprocstat/libprocstat.3 head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h Modified: head/lib/libprocstat/Symbol.map ============================================================================== --- head/lib/libprocstat/Symbol.map Sat Apr 20 08:08:29 2013 (r249680) +++ head/lib/libprocstat/Symbol.map Sat Apr 20 08:10:47 2013 (r249681) @@ -17,11 +17,13 @@ FBSD_1.2 { FBSD_1.3 { procstat_freeargv; + procstat_freeauxv; procstat_freeenvv; procstat_freegroups; procstat_freevmmap; procstat_get_shm_info; procstat_getargv; + procstat_getauxv; procstat_getenvv; procstat_getgroups; procstat_getosrel; Modified: head/lib/libprocstat/core.c ============================================================================== --- head/lib/libprocstat/core.c Sat Apr 20 08:08:29 2013 (r249680) +++ head/lib/libprocstat/core.c Sat Apr 20 08:10:47 2013 (r249681) @@ -195,6 +195,10 @@ procstat_core_get(struct procstat_core * n_type = NT_PROCSTAT_PSSTRINGS; structsize = sizeof(vm_offset_t); break; + case PSC_TYPE_AUXV: + n_type = NT_PROCSTAT_AUXV; + structsize = sizeof(Elf_Auxinfo); + break; default: warnx("unknown core stat type: %d", type); return (NULL); Modified: head/lib/libprocstat/core.h ============================================================================== --- head/lib/libprocstat/core.h Sat Apr 20 08:08:29 2013 (r249680) +++ head/lib/libprocstat/core.h Sat Apr 20 08:10:47 2013 (r249681) @@ -40,6 +40,7 @@ enum psc_type { PSC_TYPE_PSSTRINGS, PSC_TYPE_ARGV, PSC_TYPE_ENVV, + PSC_TYPE_AUXV, }; struct procstat_core; Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:08:29 2013 (r249680) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:10:47 2013 (r249681) @@ -33,6 +33,7 @@ .Nm procstat_open_sysctl , .Nm procstat_close , .Nm procstat_getargv , +.Nm procstat_getauxv , .Nm procstat_getenvv , .Nm procstat_getfiles , .Nm procstat_getgroups , @@ -42,6 +43,7 @@ .Nm procstat_getumask , .Nm procstat_getvmmap , .Nm procstat_freeargv , +.Nm procstat_freeauxv , .Nm procstat_freeenvv , .Nm procstat_freefiles , .Nm procstat_freegroups , @@ -67,6 +69,11 @@ .Fa "struct procstat *procstat" .Fc .Ft void +.Fo procstat_freeauxv +.Fa "struct procstat *procstat" +.Fa "Elf_Auxinfo *auxv" +.Fc +.Ft void .Fo procstat_freeenvv .Fa "struct procstat *procstat" .Fc @@ -129,6 +136,12 @@ .Fa "size_t nchr" .Fa "char *errbuf" .Fc +.Ft "Elf_Auxinfo *" +.Fo procstat_getauxv +.Fa "struct procstat *procstat" +.Fa "struct kinfo_proc *kp" +.Fa "unsigned int *count" +.Fc .Ft "char **" .Fo procstat_getenvv .Fa "struct procstat *procstat" @@ -321,6 +334,19 @@ The caller may free the allocated memory function call. .Pp The +.Fn procstat_getauxv +function gets a pointer to the +.Vt procstat +structure, a pointer to +.Vt kinfo_proc +structure, and returns the auxiliary vector as a dynamically allocated array of +.Vt Elf_Auxinfo +elements. +The caller is responsible to free the allocated memory with a subsequent +.Fn procstat_freeauxv +function call. +.Pp +The .Fn procstat_getfiles function gets a pointer to the .Vt procstat Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Apr 20 08:08:29 2013 (r249680) +++ head/lib/libprocstat/libprocstat.c Sat Apr 20 08:10:47 2013 (r249681) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -110,6 +111,9 @@ static char **getargv(struct procstat *p static char *getmnton(kvm_t *kd, struct mount *m); static struct kinfo_vmentry * kinfo_getvmmap_core(struct procstat_core *core, int *cntp); +static Elf_Auxinfo *procstat_getauxv_core(struct procstat_core *core, + unsigned int *cntp); +static Elf_Auxinfo *procstat_getauxv_sysctl(pid_t pid, unsigned int *cntp); static struct filestat_list *procstat_getfiles_kvm( struct procstat *procstat, struct kinfo_proc *kp, int mmapped); static struct filestat_list *procstat_getfiles_sysctl( @@ -2075,3 +2079,151 @@ procstat_getosrel(struct procstat *procs return (-1); } } + +#define PROC_AUXV_MAX 256 + +#if __ELF_WORD_SIZE == 64 +static const char *elf32_sv_names[] = { + "Linux ELF32", + "FreeBSD ELF32", +}; + +static int +is_elf32_sysctl(pid_t pid) +{ + int error, name[4]; + size_t len, i; + static char sv_name[256]; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_SV_NAME; + name[3] = pid; + len = sizeof(sv_name); + error = sysctl(name, 4, sv_name, &len, NULL, 0); + if (error != 0 || len == 0) + return (0); + for (i = 0; i < sizeof(elf32_sv_names) / sizeof(*elf32_sv_names); i++) { + if (strncmp(sv_name, elf32_sv_names[i], sizeof(sv_name)) == 0) + return (1); + } + return (0); +} + +static Elf_Auxinfo * +procstat_getauxv32_sysctl(pid_t pid, unsigned int *cntp) +{ + Elf_Auxinfo *auxv; + Elf32_Auxinfo *auxv32; + void *ptr; + size_t len; + unsigned int i, count; + int name[4]; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_AUXV; + name[3] = pid; + len = PROC_AUXV_MAX * sizeof(Elf32_Auxinfo); + auxv = NULL; + auxv32 = malloc(len); + if (auxv32 == NULL) { + warn("malloc(%zu)", len); + goto out; + } + if (sysctl(name, 4, auxv32, &len, NULL, 0) == -1) { + if (errno != ESRCH && errno != EPERM) + warn("sysctl: kern.proc.auxv: %d: %d", pid, errno); + goto out; + } + count = len / sizeof(Elf_Auxinfo); + auxv = malloc(count * sizeof(Elf_Auxinfo)); + if (auxv == NULL) { + warn("malloc(%zu)", count * sizeof(Elf_Auxinfo)); + goto out; + } + for (i = 0; i < count; i++) { + /* + * XXX: We expect that values for a_type on a 32-bit platform + * are directly mapped to values on 64-bit one, which is not + * necessarily true. + */ + auxv[i].a_type = auxv32[i].a_type; + ptr = &auxv32[i].a_un; + auxv[i].a_un.a_val = *((uint32_t *)ptr); + } + *cntp = count; +out: + free(auxv32); + return (auxv); +} +#endif /* __ELF_WORD_SIZE == 64 */ + +static Elf_Auxinfo * +procstat_getauxv_sysctl(pid_t pid, unsigned int *cntp) +{ + Elf_Auxinfo *auxv; + int name[4]; + size_t len; + +#if __ELF_WORD_SIZE == 64 + if (is_elf32_sysctl(pid)) + return (procstat_getauxv32_sysctl(pid, cntp)); +#endif + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_AUXV; + name[3] = pid; + len = PROC_AUXV_MAX * sizeof(Elf_Auxinfo); + auxv = malloc(len); + if (auxv == NULL) { + warn("malloc(%zu)", len); + return (NULL); + } + if (sysctl(name, 4, auxv, &len, NULL, 0) == -1) { + if (errno != ESRCH && errno != EPERM) + warn("sysctl: kern.proc.auxv: %d: %d", pid, errno); + free(auxv); + return (NULL); + } + *cntp = len / sizeof(Elf_Auxinfo); + return (auxv); +} + +static Elf_Auxinfo * +procstat_getauxv_core(struct procstat_core *core, unsigned int *cntp) +{ + Elf_Auxinfo *auxv; + size_t len; + + auxv = procstat_core_get(core, PSC_TYPE_AUXV, NULL, &len); + if (auxv == NULL) + return (NULL); + *cntp = len / sizeof(Elf_Auxinfo); + return (auxv); +} + +Elf_Auxinfo * +procstat_getauxv(struct procstat *procstat, struct kinfo_proc *kp, + unsigned int *cntp) +{ + switch(procstat->type) { + case PROCSTAT_KVM: + warnx("kvm method is not supported"); + return (NULL); + case PROCSTAT_SYSCTL: + return (procstat_getauxv_sysctl(kp->ki_pid, cntp)); + case PROCSTAT_CORE: + return (procstat_getauxv_core(procstat->core, cntp)); + default: + warnx("unknown access method: %d", procstat->type); + return (NULL); + } +} + +void +procstat_freeauxv(struct procstat *procstat __unused, Elf_Auxinfo *auxv) +{ + + free(auxv); +} Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Sat Apr 20 08:08:29 2013 (r249680) +++ head/lib/libprocstat/libprocstat.h Sat Apr 20 08:10:47 2013 (r249681) @@ -30,6 +30,14 @@ #define _LIBPROCSTAT_H_ /* + * XXX: sys/elf.h conflicts with zfs_context.h. Workaround this by not + * including conflicting parts when building zfs code. + */ +#ifndef ZFS +#include +#endif + +/* * Vnode types. */ #define PS_FST_VTYPE_VNON 1 @@ -148,6 +156,9 @@ STAILQ_HEAD(filestat_list, filestat); __BEGIN_DECLS void procstat_close(struct procstat *procstat); void procstat_freeargv(struct procstat *procstat); +#ifndef ZFS +void procstat_freeauxv(struct procstat *procstat, Elf_Auxinfo *auxv); +#endif void procstat_freeenvv(struct procstat *procstat); void procstat_freegroups(struct procstat *procstat, gid_t *groups); void procstat_freeprocs(struct procstat *procstat, struct kinfo_proc *p); @@ -171,6 +182,10 @@ int procstat_get_vnode_info(struct procs struct vnstat *vn, char *errbuf); char **procstat_getargv(struct procstat *procstat, struct kinfo_proc *p, size_t nchr); +#ifndef ZFS +Elf_Auxinfo *procstat_getauxv(struct procstat *procstat, + struct kinfo_proc *kp, unsigned int *cntp); +#endif char **procstat_getenvv(struct procstat *procstat, struct kinfo_proc *p, size_t nchr); gid_t *procstat_getgroups(struct procstat *procstat, struct kinfo_proc *kp, From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:13:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5C7844F0; Sat, 20 Apr 2013 08:13:36 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4DB281279; Sat, 20 Apr 2013 08:13:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K8Damf017320; Sat, 20 Apr 2013 08:13:36 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K8DaUT017318; Sat, 20 Apr 2013 08:13:36 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200813.r3K8DaUT017318@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:13:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249682 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:13:36 -0000 Author: trociny Date: Sat Apr 20 08:13:35 2013 New Revision: 249682 URL: http://svnweb.freebsd.org/changeset/base/249682 Log: This should have been committed in r249666. MFC after: 1 month Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sat Apr 20 08:10:47 2013 (r249681) +++ head/Makefile.inc1 Sat Apr 20 08:13:35 2013 (r249682) @@ -1382,7 +1382,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 ${_kerberos5_lib_libwind} \ ${_lib_atf_libatf_c} \ lib/libbz2 ${_libcom_err} lib/libcrypt \ - lib/libexpat \ + lib/libelf lib/libexpat \ ${_lib_libgssapi} ${_lib_libipx} \ lib/libkiconv lib/libkvm lib/liblzma lib/libmd \ lib/ncurses/ncurses lib/ncurses/ncursesw \ From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:15:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3465667C; Sat, 20 Apr 2013 08:15:44 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 16C391289; Sat, 20 Apr 2013 08:15:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K8FhUV019583; Sat, 20 Apr 2013 08:15:43 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K8Fhja019574; Sat, 20 Apr 2013 08:15:43 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200815.r3K8Fhja019574@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:15:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249683 - head/usr.bin/procstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:15:44 -0000 Author: trociny Date: Sat Apr 20 08:15:43 2013 New Revision: 249683 URL: http://svnweb.freebsd.org/changeset/base/249683 Log: Use libprocstat(3) to retrieve ELF auxiliary vector. MFC after: 1 month Modified: head/usr.bin/procstat/procstat.c head/usr.bin/procstat/procstat.h head/usr.bin/procstat/procstat_auxv.c Modified: head/usr.bin/procstat/procstat.c ============================================================================== --- head/usr.bin/procstat/procstat.c Sat Apr 20 08:13:35 2013 (r249682) +++ head/usr.bin/procstat/procstat.c Sat Apr 20 08:15:43 2013 (r249683) @@ -81,7 +81,7 @@ procstat(struct procstat *prstat, struct else if (vflag) procstat_vm(prstat, kipp); else if (xflag) - procstat_auxv(kipp); + procstat_auxv(prstat, kipp); else procstat_basic(kipp); } Modified: head/usr.bin/procstat/procstat.h ============================================================================== --- head/usr.bin/procstat/procstat.h Sat Apr 20 08:13:35 2013 (r249682) +++ head/usr.bin/procstat/procstat.h Sat Apr 20 08:15:43 2013 (r249683) @@ -35,7 +35,7 @@ struct kinfo_proc; void kinfo_proc_sort(struct kinfo_proc *kipp, int count); void procstat_args(struct procstat *prstat, struct kinfo_proc *kipp); -void procstat_auxv(struct kinfo_proc *kipp); +void procstat_auxv(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_basic(struct kinfo_proc *kipp); void procstat_bin(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_cred(struct procstat *prstat, struct kinfo_proc *kipp); Modified: head/usr.bin/procstat/procstat_auxv.c ============================================================================== --- head/usr.bin/procstat/procstat_auxv.c Sat Apr 20 08:13:35 2013 (r249682) +++ head/usr.bin/procstat/procstat_auxv.c Sat Apr 20 08:15:43 2013 (r249683) @@ -43,113 +43,26 @@ #include "procstat.h" -#define PROC_AUXV_MAX 256 - -static Elf_Auxinfo auxv[PROC_AUXV_MAX]; -static char prefix[256]; - -#if __ELF_WORD_SIZE == 64 -static Elf32_Auxinfo auxv32[PROC_AUXV_MAX]; - -static const char *elf32_sv_names[] = { - "Linux ELF32", - "FreeBSD ELF32", -}; - -static int -is_elf32(pid_t pid) -{ - int error, name[4]; - size_t len, i; - static char sv_name[256]; - - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_SV_NAME; - name[3] = pid; - len = sizeof(sv_name); - error = sysctl(name, 4, sv_name, &len, NULL, 0); - if (error != 0 || len == 0) - return (0); - for (i = 0; i < sizeof(elf32_sv_names) / sizeof(*elf32_sv_names); i++) { - if (strncmp(sv_name, elf32_sv_names[i], sizeof(sv_name)) == 0) - return (1); - } - return (0); -} - -static size_t -retrieve_auxv32(pid_t pid) -{ - int name[4]; - size_t len, i; - void *ptr; - - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_AUXV; - name[3] = pid; - len = sizeof(auxv32); - if (sysctl(name, 4, auxv32, &len, NULL, 0) == -1) { - if (errno != ESRCH && errno != EPERM) - warn("sysctl: kern.proc.auxv: %d: %d", pid, errno); - return (0); - } - for (i = 0; i < len; i++) { - /* - * XXX: We expect that values for a_type on a 32-bit platform - * are directly mapped to those on 64-bit one, which is not - * necessarily true. - */ - auxv[i].a_type = auxv32[i].a_type; - ptr = &auxv32[i].a_un; - auxv[i].a_un.a_val = *((uint32_t *)ptr); - } - return (len); -} -#endif /* __ELF_WORD_SIZE == 64 */ - #define PRINT(name, spec, val) \ printf("%s %-16s " #spec "\n", prefix, #name, (val)) #define PRINT_UNKNOWN(type, val) \ printf("%s %16ld %#lx\n", prefix, (long)type, (u_long)(val)) -static size_t -retrieve_auxv(pid_t pid) -{ - int name[4]; - size_t len; - -#if __ELF_WORD_SIZE == 64 - if (is_elf32(pid)) - return (retrieve_auxv32(pid)); -#endif - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_AUXV; - name[3] = pid; - len = sizeof(auxv); - if (sysctl(name, 4, auxv, &len, NULL, 0) == -1) { - if (errno != ESRCH && errno != EPERM) - warn("sysctl: kern.proc.auxv: %d: %d", pid, errno); - return (0); - } - return (len); -} - void -procstat_auxv(struct kinfo_proc *kipp) +procstat_auxv(struct procstat *procstat, struct kinfo_proc *kipp) { - size_t len, i; + Elf_Auxinfo *auxv; + u_int count, i; + static char prefix[256]; if (!hflag) printf("%5s %-16s %-16s %-16s\n", "PID", "COMM", "AUXV", "VALUE"); - len = retrieve_auxv(kipp->ki_pid); - if (len == 0) + auxv = procstat_getauxv(procstat, kipp, &count); + if (auxv == NULL) return; snprintf(prefix, sizeof(prefix), "%5d %-16s", kipp->ki_pid, kipp->ki_comm); - for (i = 0; i < len; i++) { + for (i = 0; i < count; i++) { switch(auxv[i].a_type) { case AT_NULL: return; @@ -242,5 +155,6 @@ procstat_auxv(struct kinfo_proc *kipp) } } printf("\n"); + procstat_freeauxv(procstat, auxv); } From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:17:21 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BC9AF7F8; Sat, 20 Apr 2013 08:17:21 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AEC151292; Sat, 20 Apr 2013 08:17:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K8HL5h021057; Sat, 20 Apr 2013 08:17:21 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K8HKWI021043; Sat, 20 Apr 2013 08:17:20 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200817.r3K8HKWI021043@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:17:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249684 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:17:21 -0000 Author: trociny Date: Sat Apr 20 08:17:20 2013 New Revision: 249684 URL: http://svnweb.freebsd.org/changeset/base/249684 Log: Add procstat_getkstack function to dump kernel stacks of a process. MFC after: 1 month Modified: head/lib/libprocstat/Symbol.map head/lib/libprocstat/libprocstat.3 head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h Modified: head/lib/libprocstat/Symbol.map ============================================================================== --- head/lib/libprocstat/Symbol.map Sat Apr 20 08:15:43 2013 (r249683) +++ head/lib/libprocstat/Symbol.map Sat Apr 20 08:17:20 2013 (r249684) @@ -20,12 +20,14 @@ FBSD_1.3 { procstat_freeauxv; procstat_freeenvv; procstat_freegroups; + procstat_freekstack; procstat_freevmmap; procstat_get_shm_info; procstat_getargv; procstat_getauxv; procstat_getenvv; procstat_getgroups; + procstat_getkstack; procstat_getosrel; procstat_getpathname; procstat_getrlimit; Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:15:43 2013 (r249683) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:17:20 2013 (r249684) @@ -37,6 +37,7 @@ .Nm procstat_getenvv , .Nm procstat_getfiles , .Nm procstat_getgroups , +.Nm procstat_getkstack , .Nm procstat_getosrel , .Nm procstat_getpathname , .Nm procstat_getprocs , @@ -47,6 +48,7 @@ .Nm procstat_freeenvv , .Nm procstat_freefiles , .Nm procstat_freegroups , +.Nm procstat_freekstack , .Nm procstat_freeprocs , .Nm procstat_freevmmap , .Nm procstat_get_pipe_info , @@ -88,6 +90,11 @@ .Fa "gid_t *groups" .Fc .Ft void +.Fo procstat_freekstack +.Fa "struct procstat *procstat" +.Fa "struct kinfo_kstack *kkstp" +.Fc +.Ft void .Fn procstat_freeprocs "struct procstat *procstat" "struct kinfo_proc *p" .Ft void .Fo procstat_freevmmap @@ -166,6 +173,12 @@ .Fa "struct kinfo_proc *kp" .Fa "int *osrelp" .Fc +.Ft "struct kinfo_kstack *" +.Fo procstat_getkstack +.Fa "struct procstat *procstat" +.Fa "struct kinfo_proc *kp" +.Fa "unsigned int *count" +.Fc .Ft "struct kinfo_proc *" .Fo procstat_getprocs .Fa "struct procstat *procstat" @@ -378,6 +391,22 @@ The caller is responsible to free the al function call. .Pp The +.Fn procstat_getkstack +function gets a pointer to the +.Vt procstat +structure initialized with one of the +.Fn procstat_open_* +functions, a pointer to +.Vt kinfo_proc +structure, and returns kernel stacks of the process as a dynamically allocated +array of +.Vt kinfo_kstack +structures. +The caller is responsible to free the allocated memory with a subsequent +.Fn procstat_freekstack +function call. +.Pp +The .Fn procstat_getosrel function gets a pointer to the .Vt procstat Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Apr 20 08:15:43 2013 (r249683) +++ head/lib/libprocstat/libprocstat.c Sat Apr 20 08:17:20 2013 (r249684) @@ -142,6 +142,8 @@ static int procstat_get_vnode_info_sysct static gid_t *procstat_getgroups_core(struct procstat_core *core, unsigned int *count); static gid_t *procstat_getgroups_sysctl(pid_t pid, unsigned int *count); +static struct kinfo_kstack *procstat_getkstack_sysctl(pid_t pid, + int *cntp); static int procstat_getpathname_core(struct procstat_core *core, char *pathname, size_t maxlen); static int procstat_getpathname_sysctl(pid_t pid, char *pathname, @@ -1764,6 +1766,7 @@ struct kinfo_vmentry * procstat_getvmmap(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *cntp) { + switch(procstat->type) { case PROCSTAT_KVM: warnx("kvm method is not supported"); @@ -2227,3 +2230,70 @@ procstat_freeauxv(struct procstat *procs free(auxv); } + +static struct kinfo_kstack * +procstat_getkstack_sysctl(pid_t pid, int *cntp) +{ + struct kinfo_kstack *kkstp; + int error, name[4]; + size_t len; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_KSTACK; + name[3] = pid; + + len = 0; + error = sysctl(name, 4, NULL, &len, NULL, 0); + if (error < 0 && errno != ESRCH && errno != EPERM && errno != ENOENT) { + warn("sysctl: kern.proc.kstack: %d", pid); + return (NULL); + } + if (error == -1 && errno == ENOENT) { + warnx("sysctl: kern.proc.kstack unavailable" + " (options DDB or options STACK required in kernel)"); + return (NULL); + } + if (error == -1) + return (NULL); + kkstp = malloc(len); + if (kkstp == NULL) { + warn("malloc(%zu)", len); + return (NULL); + } + if (sysctl(name, 4, kkstp, &len, NULL, 0) == -1) { + warn("sysctl: kern.proc.pid: %d", pid); + free(kkstp); + return (NULL); + } + *cntp = len / sizeof(*kkstp); + + return (kkstp); +} + +struct kinfo_kstack * +procstat_getkstack(struct procstat *procstat, struct kinfo_proc *kp, + unsigned int *cntp) +{ + switch(procstat->type) { + case PROCSTAT_KVM: + warnx("kvm method is not supported"); + return (NULL); + case PROCSTAT_SYSCTL: + return (procstat_getkstack_sysctl(kp->ki_pid, cntp)); + case PROCSTAT_CORE: + warnx("core method is not supported"); + return (NULL); + default: + warnx("unknown access method: %d", procstat->type); + return (NULL); + } +} + +void +procstat_freekstack(struct procstat *procstat __unused, + struct kinfo_kstack *kkstp) +{ + + free(kkstp); +} Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Sat Apr 20 08:15:43 2013 (r249683) +++ head/lib/libprocstat/libprocstat.h Sat Apr 20 08:17:20 2013 (r249684) @@ -97,6 +97,7 @@ #define PS_FST_FFLAG_EXEC 0x2000 #define PS_FST_FFLAG_HASLOCK 0x4000 +struct kinfo_kstack; struct kinfo_vmentry; struct procstat; struct rlimit; @@ -161,6 +162,8 @@ void procstat_freeauxv(struct procstat * #endif void procstat_freeenvv(struct procstat *procstat); void procstat_freegroups(struct procstat *procstat, gid_t *groups); +void procstat_freekstack(struct procstat *procstat, + struct kinfo_kstack *kkstp); void procstat_freeprocs(struct procstat *procstat, struct kinfo_proc *p); void procstat_freefiles(struct procstat *procstat, struct filestat_list *head); @@ -190,6 +193,8 @@ char **procstat_getenvv(struct procstat size_t nchr); gid_t *procstat_getgroups(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); +struct kinfo_kstack *procstat_getkstack(struct procstat *procstat, + struct kinfo_proc *kp, unsigned int *count); int procstat_getosrel(struct procstat *procstat, struct kinfo_proc *kp, int *osrelp); int procstat_getpathname(struct procstat *procstat, struct kinfo_proc *kp, From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:19:07 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 79B26979; Sat, 20 Apr 2013 08:19:07 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5CB05129D; Sat, 20 Apr 2013 08:19:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K8J71r022803; Sat, 20 Apr 2013 08:19:07 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K8J67M022794; Sat, 20 Apr 2013 08:19:06 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200819.r3K8J67M022794@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249685 - head/usr.bin/procstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:19:07 -0000 Author: trociny Date: Sat Apr 20 08:19:06 2013 New Revision: 249685 URL: http://svnweb.freebsd.org/changeset/base/249685 Log: Use procstat_getkstack(3) for retrieving process kernel stacks instead of direct sysctl calls. MFC after: 1 month Modified: head/usr.bin/procstat/procstat.c head/usr.bin/procstat/procstat.h head/usr.bin/procstat/procstat_kstack.c Modified: head/usr.bin/procstat/procstat.c ============================================================================== --- head/usr.bin/procstat/procstat.c Sat Apr 20 08:17:20 2013 (r249684) +++ head/usr.bin/procstat/procstat.c Sat Apr 20 08:19:06 2013 (r249685) @@ -71,7 +71,7 @@ procstat(struct procstat *prstat, struct else if (jflag) procstat_threads_sigs(prstat, kipp); else if (kflag) - procstat_kstack(kipp, kflag); + procstat_kstack(prstat, kipp, kflag); else if (lflag) procstat_rlimit(prstat, kipp); else if (sflag) Modified: head/usr.bin/procstat/procstat.h ============================================================================== --- head/usr.bin/procstat/procstat.h Sat Apr 20 08:17:20 2013 (r249684) +++ head/usr.bin/procstat/procstat.h Sat Apr 20 08:19:06 2013 (r249685) @@ -41,7 +41,8 @@ void procstat_bin(struct procstat *prsta void procstat_cred(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_env(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_files(struct procstat *prstat, struct kinfo_proc *kipp); -void procstat_kstack(struct kinfo_proc *kipp, int kflag); +void procstat_kstack(struct procstat *prstat, struct kinfo_proc *kipp, + int kflag); void procstat_rlimit(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_sigs(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_threads(struct procstat *prstat, struct kinfo_proc *kipp); Modified: head/usr.bin/procstat/procstat_kstack.c ============================================================================== --- head/usr.bin/procstat/procstat_kstack.c Sat Apr 20 08:17:20 2013 (r249684) +++ head/usr.bin/procstat/procstat_kstack.c Sat Apr 20 08:19:06 2013 (r249685) @@ -125,76 +125,35 @@ kinfo_kstack_sort(struct kinfo_kstack *k void -procstat_kstack(struct kinfo_proc *kipp, int kflag) +procstat_kstack(struct procstat *procstat, struct kinfo_proc *kipp, int kflag) { struct kinfo_kstack *kkstp, *kkstp_free; struct kinfo_proc *kip, *kip_free; char trace[KKST_MAXLEN]; - int error, name[4]; unsigned int i, j; - size_t kip_len, kstk_len; + unsigned int kip_count, kstk_count; if (!hflag) printf("%5s %6s %-16s %-16s %-29s\n", "PID", "TID", "COMM", "TDNAME", "KSTACK"); - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_KSTACK; - name[3] = kipp->ki_pid; - - kstk_len = 0; - error = sysctl(name, 4, NULL, &kstk_len, NULL, 0); - if (error < 0 && errno != ESRCH && errno != EPERM && errno != ENOENT) { - warn("sysctl: kern.proc.kstack: %d", kipp->ki_pid); - return; - } - if (error < 0 && errno == ENOENT) { - warnx("sysctl: kern.proc.kstack unavailable"); - errx(-1, "options DDB or options STACK required in kernel"); - } - if (error < 0) - return; - - kkstp = kkstp_free = malloc(kstk_len); + kkstp = kkstp_free = procstat_getkstack(procstat, kipp, &kstk_count); if (kkstp == NULL) - err(-1, "malloc"); - - if (sysctl(name, 4, kkstp, &kstk_len, NULL, 0) < 0) { - warn("sysctl: kern.proc.pid: %d", kipp->ki_pid); - free(kkstp); return; - } /* * We need to re-query for thread information, so don't use *kipp. */ - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_PID | KERN_PROC_INC_THREAD; - name[3] = kipp->ki_pid; - - kip_len = 0; - error = sysctl(name, 4, NULL, &kip_len, NULL, 0); - if (error < 0 && errno != ESRCH) { - warn("sysctl: kern.proc.pid: %d", kipp->ki_pid); - return; - } - if (error < 0) - return; + kip = kip_free = procstat_getprocs(procstat, + KERN_PROC_PID | KERN_PROC_INC_THREAD, kipp->ki_pid, &kip_count); - kip = kip_free = malloc(kip_len); - if (kip == NULL) - err(-1, "malloc"); - - if (sysctl(name, 4, kip, &kip_len, NULL, 0) < 0) { - warn("sysctl: kern.proc.pid: %d", kipp->ki_pid); - free(kip); + if (kip == NULL) { + procstat_freekstack(procstat, kkstp_free); return; } - kinfo_kstack_sort(kkstp, kstk_len / sizeof(*kkstp)); - for (i = 0; i < kstk_len / sizeof(*kkstp); i++) { + kinfo_kstack_sort(kkstp, kstk_count); + for (i = 0; i < kstk_count; i++) { kkstp = &kkstp_free[i]; /* @@ -202,7 +161,7 @@ procstat_kstack(struct kinfo_proc *kipp, * display the per-thread command line. */ kipp = NULL; - for (j = 0; j < kip_len / sizeof(*kipp); j++) { + for (j = 0; j < kip_count; j++) { kipp = &kip_free[j]; if (kkstp->kkst_tid == kipp->ki_tid) break; @@ -242,6 +201,6 @@ procstat_kstack(struct kinfo_proc *kipp, kstack_cleanup(kkstp->kkst_trace, trace, kflag); printf("%-29s\n", trace); } - free(kip_free); - free(kkstp_free); + procstat_freekstack(procstat, kkstp_free); + procstat_freeprocs(procstat, kip_free); } From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:22:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BD153B8D; Sat, 20 Apr 2013 08:22:10 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AE9FE12BC; Sat, 20 Apr 2013 08:22:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K8MAvn027605; Sat, 20 Apr 2013 08:22:10 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K8MAf6027601; Sat, 20 Apr 2013 08:22:10 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200822.r3K8MAf6027601@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249686 - head/usr.bin/procstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:22:10 -0000 Author: trociny Date: Sat Apr 20 08:22:09 2013 New Revision: 249686 URL: http://svnweb.freebsd.org/changeset/base/249686 Log: Make use of newly added libprocstat(3) ability to extract procstat info from a process core file. So now one can run procstat(1) on a process core e.g. to get a list of files opened by a process when it crashed: root@lisa:/ # procstat -f /root/vi.core PID COMM FD T V FLAGS REF OFFSET PRO NAME 658 vi text v r r-------- - - - /usr/bin/vi 658 vi ctty v c rw------- - - - /dev/pts/0 658 vi cwd v d r-------- - - - /root 658 vi root v d r-------- - - - / 658 vi 0 v c rw------- 11 3208 - /dev/pts/0 658 vi 1 v c rw------- 11 3208 - /dev/pts/0 658 vi 2 v c rw------- 11 3208 - /dev/pts/0 658 vi 3 v r r----n-l- 1 0 - /tmp/vi.0AYKz3Lps7 658 vi 4 v r rw------- 1 0 - /var/tmp/vi.recover/vi.GaGYsz 658 vi 5 v r rw------- 1 0 - - PR: kern/173723 Suggested by: jhb MFC after: 1 month Modified: head/usr.bin/procstat/procstat.1 head/usr.bin/procstat/procstat.c Modified: head/usr.bin/procstat/procstat.1 ============================================================================== --- head/usr.bin/procstat/procstat.1 Sat Apr 20 08:19:06 2013 (r249685) +++ head/usr.bin/procstat/procstat.1 Sat Apr 20 08:22:09 2013 (r249686) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 11, 2012 +.Dd April 20, 2013 .Dt PROCSTAT 1 .Os .Sh NAME @@ -38,7 +38,7 @@ .Op Fl C .Op Fl w Ar interval .Op Fl b | c | e | f | i | j | k | l | s | t | v | x -.Op Fl a | Ar pid ... +.Op Fl a | Ar pid | Ar core ... .Sh DESCRIPTION The .Nm @@ -47,6 +47,8 @@ utility displays detailed information ab arguments, or if the .Fl a flag is used, all processes. +It can also display information extracted from a process core file, if +the core file is specified as the argument. .Pp By default, basic process statistics are printed; one of the following options may be specified in order to select more detailed process information Modified: head/usr.bin/procstat/procstat.c ============================================================================== --- head/usr.bin/procstat/procstat.c Sat Apr 20 08:19:06 2013 (r249685) +++ head/usr.bin/procstat/procstat.c Sat Apr 20 08:22:09 2013 (r249686) @@ -50,7 +50,7 @@ usage(void) fprintf(stderr, "usage: procstat [-h] [-C] [-M core] [-N system] " "[-w interval] \n"); fprintf(stderr, " [-b | -c | -e | -f | -i | -j | -k | " - "-l | -s | -t | -v | -x] [-a | pid ...]\n"); + "-l | -s | -t | -v | -x] [-a | pid | core ...]\n"); exit(EX_USAGE); } @@ -116,7 +116,7 @@ main(int argc, char *argv[]) int ch, interval, tmp; int i; struct kinfo_proc *p; - struct procstat *prstat; + struct procstat *prstat, *cprstat; long l; pid_t pid; char *dummy; @@ -255,19 +255,32 @@ main(int argc, char *argv[]) } for (i = 0; i < argc; i++) { l = strtol(argv[i], &dummy, 10); - if (*dummy != '\0') - usage(); - if (l < 0) - usage(); - pid = l; - - p = procstat_getprocs(prstat, KERN_PROC_PID, pid, &cnt); - if (p == NULL) - errx(1, "procstat_getprocs()"); - if (cnt != 0) - procstat(prstat, p); - procstat_freeprocs(prstat, p); - + if (*dummy == '\0') { + if (l < 0) + usage(); + pid = l; + + p = procstat_getprocs(prstat, KERN_PROC_PID, pid, &cnt); + if (p == NULL) + errx(1, "procstat_getprocs()"); + if (cnt != 0) + procstat(prstat, p); + procstat_freeprocs(prstat, p); + } else { + cprstat = procstat_open_core(argv[i]); + if (cprstat == NULL) { + warnx("procstat_open()"); + continue; + } + p = procstat_getprocs(cprstat, KERN_PROC_PID, + -1, &cnt); + if (p == NULL) + errx(1, "procstat_getprocs()"); + if (cnt != 0) + procstat(cprstat, p); + procstat_freeprocs(cprstat, p); + procstat_close(cprstat); + } /* Suppress header after first process. */ hflag = 1; } From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:23:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 32013D00; Sat, 20 Apr 2013 08:23:20 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 245B312C2; Sat, 20 Apr 2013 08:23:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K8NKsu028776; Sat, 20 Apr 2013 08:23:20 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K8NJ27028770; Sat, 20 Apr 2013 08:23:19 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200823.r3K8NJ27028770@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249687 - head/usr.bin/gcore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:23:20 -0000 Author: trociny Date: Sat Apr 20 08:23:19 2013 New Revision: 249687 URL: http://svnweb.freebsd.org/changeset/base/249687 Log: Sync gcore(1) with the recent changes in kernel code aimed at adding procstat notes to a process core file. Suggested by: jhb MFC after: 1 month Modified: head/usr.bin/gcore/Makefile head/usr.bin/gcore/elfcore.c Modified: head/usr.bin/gcore/Makefile ============================================================================== --- head/usr.bin/gcore/Makefile Sat Apr 20 08:22:09 2013 (r249686) +++ head/usr.bin/gcore/Makefile Sat Apr 20 08:23:19 2013 (r249687) @@ -4,7 +4,7 @@ PROG= gcore SRCS= elfcore.c gcore.c DPADD= ${LIBUTIL} -LDADD= -lutil +LDADD= -lsbuf -lutil WARNS?= 1 Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Sat Apr 20 08:22:09 2013 (r249686) +++ head/usr.bin/gcore/elfcore.c Sat Apr 20 08:23:19 2013 (r249687) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -41,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -71,16 +73,33 @@ struct sseg_closure { size_t size; /* Total size of all writable segments. */ }; +typedef void* (*notefunc_t)(void *, size_t *); + static void cb_put_phdr(vm_map_entry_t, void *); static void cb_size_segment(vm_map_entry_t, void *); static void each_writable_segment(vm_map_entry_t, segment_callback, void *closure); static void elf_detach(void); /* atexit() handler. */ -static void elf_puthdr(pid_t, vm_map_entry_t, void *, size_t *, int numsegs); -static void elf_putnote(void *dst, size_t *off, const char *name, int type, - const void *desc, size_t descsz); +static void *elf_note_fpregset(void *, size_t *); +static void *elf_note_prpsinfo(void *, size_t *); +static void *elf_note_prstatus(void *, size_t *); +static void *elf_note_thrmisc(void *, size_t *); +static void *elf_note_procstat_auxv(void *, size_t *); +static void *elf_note_procstat_files(void *, size_t *); +static void *elf_note_procstat_groups(void *, size_t *); +static void *elf_note_procstat_osrel(void *, size_t *); +static void *elf_note_procstat_proc(void *, size_t *); +static void *elf_note_procstat_psstrings(void *, size_t *); +static void *elf_note_procstat_rlimit(void *, size_t *); +static void *elf_note_procstat_umask(void *, size_t *); +static void *elf_note_procstat_vmmap(void *, size_t *); +static void elf_puthdr(pid_t, vm_map_entry_t, void *, size_t, size_t, size_t, + int); +static void elf_putnote(int, notefunc_t, void *, struct sbuf *); +static void elf_putnotes(pid_t, struct sbuf *, size_t *); static void freemap(vm_map_entry_t); static vm_map_entry_t readmap(pid_t); +static void *procstat_sysctl(void *, int, size_t, size_t *sizep); static pid_t g_pid; /* Pid being dumped, global for elf_detach */ @@ -114,8 +133,10 @@ elf_coredump(int efd __unused, int fd, p { vm_map_entry_t map; struct sseg_closure seginfo; + struct sbuf *sb; void *hdr; - size_t hdrsize; + size_t hdrsize, notesz, segoff; + ssize_t n, old_len; Elf_Phdr *php; int i; @@ -139,27 +160,32 @@ elf_coredump(int efd __unused, int fd, p each_writable_segment(map, cb_size_segment, &seginfo); /* - * Calculate the size of the core file header area by making - * a dry run of generating it. Nothing is written, but the - * size is calculated. + * Build the header and the notes using sbuf and write to the file. */ - hdrsize = 0; - elf_puthdr(pid, map, NULL, &hdrsize, seginfo.count); - - /* - * Allocate memory for building the header, fill it up, - * and write it out. - */ - if ((hdr = calloc(1, hdrsize)) == NULL) - errx(1, "out of memory"); - + sb = sbuf_new_auto(); + hdrsize = sizeof(Elf_Ehdr) + sizeof(Elf_Phdr) * (1 + seginfo.count); + /* Start header + notes section. */ + sbuf_start_section(sb, NULL); + /* Make empty header subsection. */ + sbuf_start_section(sb, &old_len); + sbuf_putc(sb, 0); + sbuf_end_section(sb, old_len, hdrsize, 0); + /* Put notes. */ + elf_putnotes(pid, sb, ¬esz); + /* Align up to a page boundary for the program segments. */ + sbuf_end_section(sb, -1, PAGE_SIZE, 0); + if (sbuf_finish(sb) != 0) + err(1, "sbuf_finish"); + hdr = sbuf_data(sb); + segoff = sbuf_len(sb); /* Fill in the header. */ - hdrsize = 0; - elf_puthdr(pid, map, hdr, &hdrsize, seginfo.count); + elf_puthdr(pid, map, hdr, hdrsize, notesz, segoff, seginfo.count); - /* Write it to the core file. */ - if (write(fd, hdr, hdrsize) == -1) + n = write(fd, hdr, segoff); + if (n == -1) err(1, "write"); + if (n < segoff) + errx(1, "short write"); /* Write the contents of all of the writable segments. */ php = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)) + 1; @@ -195,7 +221,7 @@ elf_coredump(int efd __unused, int fd, p } php++; } - free(hdr); + sbuf_delete(sb); freemap(map); } @@ -257,209 +283,136 @@ each_writable_segment(vm_map_entry_t map } static void -elf_getstatus(pid_t pid, prpsinfo_t *psinfo) -{ - struct kinfo_proc kobj; - int name[4]; - size_t len; - - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_PID; - name[3] = pid; - - len = sizeof(kobj); - if (sysctl(name, 4, &kobj, &len, NULL, 0) == -1) - err(1, "error accessing kern.proc.pid.%u sysctl", pid); - if (kobj.ki_pid != pid) - err(1, "error accessing kern.proc.pid.%u sysctl datas", pid); - strncpy(psinfo->pr_fname, kobj.ki_comm, MAXCOMLEN); - strncpy(psinfo->pr_psargs, psinfo->pr_fname, PRARGSZ); -} - -/* - * Generate the ELF coredump header into the buffer at "dst". "dst" may - * be NULL, in which case the header is sized but not actually generated. - */ -static void -elf_puthdr(pid_t pid, vm_map_entry_t map, void *dst, size_t *off, int numsegs) +elf_putnotes(pid_t pid, struct sbuf *sb, size_t *sizep) { - struct ptrace_lwpinfo lwpinfo; - struct { - prstatus_t status; - prfpregset_t fpregset; - prpsinfo_t psinfo; - thrmisc_t thrmisc; - } *tempdata; - size_t ehoff; - size_t phoff; - size_t noteoff; - size_t notesz; - size_t threads; lwpid_t *tids; + size_t threads, old_len; + ssize_t size; int i; - prstatus_t *status; - prfpregset_t *fpregset; - prpsinfo_t *psinfo; - thrmisc_t *thrmisc; - - ehoff = *off; - *off += sizeof(Elf_Ehdr); - - phoff = *off; - *off += (numsegs + 1) * sizeof(Elf_Phdr); - - noteoff = *off; - - if (dst != NULL) { - if ((tempdata = calloc(1, sizeof(*tempdata))) == NULL) - errx(1, "out of memory"); - status = &tempdata->status; - fpregset = &tempdata->fpregset; - psinfo = &tempdata->psinfo; - thrmisc = &tempdata->thrmisc; - } else { - tempdata = NULL; - status = NULL; - fpregset = NULL; - psinfo = NULL; - thrmisc = NULL; - } - errno = 0; threads = ptrace(PT_GETNUMLWPS, pid, NULL, 0); if (errno) err(1, "PT_GETNUMLWPS"); + tids = malloc(threads * sizeof(*tids)); + if (tids == NULL) + errx(1, "out of memory"); + errno = 0; + ptrace(PT_GETLWPLIST, pid, (void *)tids, threads); + if (errno) + err(1, "PT_GETLWPLIST"); - if (dst != NULL) { - psinfo->pr_version = PRPSINFO_VERSION; - psinfo->pr_psinfosz = sizeof(prpsinfo_t); - elf_getstatus(pid, psinfo); - - } - elf_putnote(dst, off, "FreeBSD", NT_PRPSINFO, psinfo, - sizeof *psinfo); + sbuf_start_section(sb, &old_len); + elf_putnote(NT_PRPSINFO, elf_note_prpsinfo, &pid, sb); - if (dst != NULL) { - tids = malloc(threads * sizeof(*tids)); - if (tids == NULL) - errx(1, "out of memory"); - errno = 0; - ptrace(PT_GETLWPLIST, pid, (void *)tids, threads); - if (errno) - err(1, "PT_GETLWPLIST"); - } for (i = 0; i < threads; ++i) { - if (dst != NULL) { - status->pr_version = PRSTATUS_VERSION; - status->pr_statussz = sizeof(prstatus_t); - status->pr_gregsetsz = sizeof(gregset_t); - status->pr_fpregsetsz = sizeof(fpregset_t); - status->pr_osreldate = __FreeBSD_version; - status->pr_pid = tids[i]; - - ptrace(PT_GETREGS, tids[i], (void *)&status->pr_reg, 0); - ptrace(PT_GETFPREGS, tids[i], (void *)fpregset, 0); - ptrace(PT_LWPINFO, tids[i], (void *)&lwpinfo, - sizeof(lwpinfo)); - memset(&thrmisc->_pad, 0, sizeof(thrmisc->_pad)); - strcpy(thrmisc->pr_tname, lwpinfo.pl_tdname); - } - elf_putnote(dst, off, "FreeBSD", NT_PRSTATUS, status, - sizeof *status); - elf_putnote(dst, off, "FreeBSD", NT_FPREGSET, fpregset, - sizeof *fpregset); - elf_putnote(dst, off, "FreeBSD", NT_THRMISC, thrmisc, - sizeof *thrmisc); - } - - notesz = *off - noteoff; - - if (dst != NULL) { - free(tids); - free(tempdata); + elf_putnote(NT_PRSTATUS, elf_note_prstatus, tids + i, sb); + elf_putnote(NT_FPREGSET, elf_note_fpregset, tids + i, sb); + elf_putnote(NT_THRMISC, elf_note_thrmisc, tids + i, sb); } - /* Align up to a page boundary for the program segments. */ - *off = round_page(*off); - - if (dst != NULL) { - Elf_Ehdr *ehdr; - Elf_Phdr *phdr; - struct phdr_closure phc; - - /* - * Fill in the ELF header. - */ - ehdr = (Elf_Ehdr *)((char *)dst + ehoff); - ehdr->e_ident[EI_MAG0] = ELFMAG0; - ehdr->e_ident[EI_MAG1] = ELFMAG1; - ehdr->e_ident[EI_MAG2] = ELFMAG2; - ehdr->e_ident[EI_MAG3] = ELFMAG3; - ehdr->e_ident[EI_CLASS] = ELF_CLASS; - ehdr->e_ident[EI_DATA] = ELF_DATA; - ehdr->e_ident[EI_VERSION] = EV_CURRENT; - ehdr->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; - ehdr->e_ident[EI_ABIVERSION] = 0; - ehdr->e_ident[EI_PAD] = 0; - ehdr->e_type = ET_CORE; - ehdr->e_machine = ELF_ARCH; - ehdr->e_version = EV_CURRENT; - ehdr->e_entry = 0; - ehdr->e_phoff = phoff; - ehdr->e_flags = 0; - ehdr->e_ehsize = sizeof(Elf_Ehdr); - ehdr->e_phentsize = sizeof(Elf_Phdr); - ehdr->e_phnum = numsegs + 1; - ehdr->e_shentsize = sizeof(Elf_Shdr); - ehdr->e_shnum = 0; - ehdr->e_shstrndx = SHN_UNDEF; - - /* - * Fill in the program header entries. - */ - phdr = (Elf_Phdr *)((char *)dst + phoff); - - /* The note segment. */ - phdr->p_type = PT_NOTE; - phdr->p_offset = noteoff; - phdr->p_vaddr = 0; - phdr->p_paddr = 0; - phdr->p_filesz = notesz; - phdr->p_memsz = 0; - phdr->p_flags = 0; - phdr->p_align = 0; - phdr++; - - /* All the writable segments from the program. */ - phc.phdr = phdr; - phc.offset = *off; - each_writable_segment(map, cb_put_phdr, &phc); - } + elf_putnote(NT_PROCSTAT_PROC, elf_note_procstat_proc, &pid, sb); + elf_putnote(NT_PROCSTAT_FILES, elf_note_procstat_files, &pid, sb); + elf_putnote(NT_PROCSTAT_VMMAP, elf_note_procstat_vmmap, &pid, sb); + elf_putnote(NT_PROCSTAT_GROUPS, elf_note_procstat_groups, &pid, sb); + elf_putnote(NT_PROCSTAT_UMASK, elf_note_procstat_umask, &pid, sb); + elf_putnote(NT_PROCSTAT_RLIMIT, elf_note_procstat_rlimit, &pid, sb); + elf_putnote(NT_PROCSTAT_OSREL, elf_note_procstat_osrel, &pid, sb); + elf_putnote(NT_PROCSTAT_PSSTRINGS, elf_note_procstat_psstrings, &pid, + sb); + elf_putnote(NT_PROCSTAT_AUXV, elf_note_procstat_auxv, &pid, sb); + + size = sbuf_end_section(sb, old_len, 1, 0); + if (size == -1) + err(1, "sbuf_end_section"); + free(tids); + *sizep = size; } /* - * Emit one note section to "dst", or just size it if "dst" is NULL. + * Emit one note section to sbuf. */ static void -elf_putnote(void *dst, size_t *off, const char *name, int type, - const void *desc, size_t descsz) +elf_putnote(int type, notefunc_t notefunc, void *arg, struct sbuf *sb) { Elf_Note note; + size_t descsz; + ssize_t old_len; + void *desc; - note.n_namesz = strlen(name) + 1; + desc = notefunc(arg, &descsz); + note.n_namesz = 8; /* strlen("FreeBSD") + 1 */ note.n_descsz = descsz; note.n_type = type; - if (dst != NULL) - bcopy(¬e, (char *)dst + *off, sizeof note); - *off += sizeof note; - if (dst != NULL) - bcopy(name, (char *)dst + *off, note.n_namesz); - *off += roundup2(note.n_namesz, sizeof(Elf_Size)); - if (dst != NULL) - bcopy(desc, (char *)dst + *off, note.n_descsz); - *off += roundup2(note.n_descsz, sizeof(Elf_Size)); + + sbuf_bcat(sb, ¬e, sizeof(note)); + sbuf_start_section(sb, &old_len); + sbuf_bcat(sb, "FreeBSD", note.n_namesz); + sbuf_end_section(sb, old_len, sizeof(Elf32_Size), 0); + if (descsz == 0) + return; + sbuf_start_section(sb, &old_len); + sbuf_bcat(sb, desc, descsz); + sbuf_end_section(sb, old_len, sizeof(Elf32_Size), 0); + free(desc); +} + +/* + * Generate the ELF coredump header. + */ +static void +elf_puthdr(pid_t pid, vm_map_entry_t map, void *hdr, size_t hdrsize, + size_t notesz, size_t segoff, int numsegs) +{ + Elf_Ehdr *ehdr; + Elf_Phdr *phdr; + struct phdr_closure phc; + + ehdr = (Elf_Ehdr *)hdr; + phdr = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)); + + ehdr->e_ident[EI_MAG0] = ELFMAG0; + ehdr->e_ident[EI_MAG1] = ELFMAG1; + ehdr->e_ident[EI_MAG2] = ELFMAG2; + ehdr->e_ident[EI_MAG3] = ELFMAG3; + ehdr->e_ident[EI_CLASS] = ELF_CLASS; + ehdr->e_ident[EI_DATA] = ELF_DATA; + ehdr->e_ident[EI_VERSION] = EV_CURRENT; + ehdr->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; + ehdr->e_ident[EI_ABIVERSION] = 0; + ehdr->e_ident[EI_PAD] = 0; + ehdr->e_type = ET_CORE; + ehdr->e_machine = ELF_ARCH; + ehdr->e_version = EV_CURRENT; + ehdr->e_entry = 0; + ehdr->e_phoff = sizeof(Elf_Ehdr); + ehdr->e_flags = 0; + ehdr->e_ehsize = sizeof(Elf_Ehdr); + ehdr->e_phentsize = sizeof(Elf_Phdr); + ehdr->e_phnum = numsegs + 1; + ehdr->e_shentsize = sizeof(Elf_Shdr); + ehdr->e_shnum = 0; + ehdr->e_shstrndx = SHN_UNDEF; + + /* + * Fill in the program header entries. + */ + + /* The note segement. */ + phdr->p_type = PT_NOTE; + phdr->p_offset = hdrsize; + phdr->p_vaddr = 0; + phdr->p_paddr = 0; + phdr->p_filesz = notesz; + phdr->p_memsz = 0; + phdr->p_flags = PF_R; + phdr->p_align = sizeof(Elf32_Size); + phdr++; + + /* All the writable segments from the program. */ + phc.phdr = phdr; + phc.offset = segoff; + each_writable_segment(map, cb_put_phdr, &phc); } /* @@ -530,5 +483,223 @@ readmap(pid_t pid) return (map); } +/* + * Miscellaneous note out functions. + */ + +static void * +elf_note_prpsinfo(void *arg, size_t *sizep) +{ + pid_t pid; + prpsinfo_t *psinfo; + struct kinfo_proc kip; + size_t len; + int name[4]; + + pid = *(pid_t *)arg; + psinfo = calloc(1, sizeof(*psinfo)); + if (psinfo == NULL) + errx(1, "out of memory"); + psinfo->pr_version = PRPSINFO_VERSION; + psinfo->pr_psinfosz = sizeof(prpsinfo_t); + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_PID; + name[3] = pid; + len = sizeof(kip); + if (sysctl(name, 4, &kip, &len, NULL, 0) == -1) + err(1, "kern.proc.pid.%u", pid); + if (kip.ki_pid != pid) + err(1, "kern.proc.pid.%u", pid); + strncpy(psinfo->pr_fname, kip.ki_comm, MAXCOMLEN); + strncpy(psinfo->pr_psargs, psinfo->pr_fname, PRARGSZ); + + *sizep = sizeof(*psinfo); + return (psinfo); +} + +static void * +elf_note_prstatus(void *arg, size_t *sizep) +{ + lwpid_t tid; + prstatus_t *status; + + tid = *(lwpid_t *)arg; + status = calloc(1, sizeof(*status)); + if (status == NULL) + errx(1, "out of memory"); + status->pr_version = PRSTATUS_VERSION; + status->pr_statussz = sizeof(prstatus_t); + status->pr_gregsetsz = sizeof(gregset_t); + status->pr_fpregsetsz = sizeof(fpregset_t); + status->pr_osreldate = __FreeBSD_version; + status->pr_pid = tid; + ptrace(PT_GETREGS, tid, (void *)&status->pr_reg, 0); + + *sizep = sizeof(*status); + return (status); +} + +static void * +elf_note_fpregset(void *arg, size_t *sizep) +{ + lwpid_t tid; + prfpregset_t *fpregset; + + tid = *(lwpid_t *)arg; + fpregset = calloc(1, sizeof(*fpregset)); + if (fpregset == NULL) + errx(1, "out of memory"); + ptrace(PT_GETFPREGS, tid, (void *)fpregset, 0); + + *sizep = sizeof(*fpregset); + return (fpregset); +} + +static void * +elf_note_thrmisc(void *arg, size_t *sizep) +{ + lwpid_t tid; + struct ptrace_lwpinfo lwpinfo; + thrmisc_t *thrmisc; + + tid = *(lwpid_t *)arg; + thrmisc = calloc(1, sizeof(*thrmisc)); + if (thrmisc == NULL) + errx(1, "out of memory"); + ptrace(PT_LWPINFO, tid, (void *)&lwpinfo, + sizeof(lwpinfo)); + memset(&thrmisc->_pad, 0, sizeof(thrmisc->_pad)); + strcpy(thrmisc->pr_tname, lwpinfo.pl_tdname); + + *sizep = sizeof(*thrmisc); + return (thrmisc); +} + +static void * +procstat_sysctl(void *arg, int what, size_t structsz, size_t *sizep) +{ + size_t len, oldlen; + pid_t pid; + int name[4], structsize; + void *buf, *p; + + pid = *(pid_t *)arg; + structsize = structsz; + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = what; + name[3] = pid; + len = 0; + if (sysctl(name, 4, NULL, &len, NULL, 0) == -1) + err(1, "kern.proc.%d.%u", what, pid); + buf = calloc(1, sizeof(structsize) + len * 4 / 3); + if (buf == NULL) + errx(1, "out of memory"); + bcopy(&structsize, buf, sizeof(structsize)); + p = (char *)buf + sizeof(structsize); + if (sysctl(name, 4, p, &len, NULL, 0) == -1) + err(1, "kern.proc.%d.%u", what, pid); + + *sizep = sizeof(structsize) + len; + return (buf); +} + +static void * +elf_note_procstat_proc(void *arg, size_t *sizep) +{ + + return (procstat_sysctl(arg, KERN_PROC_PID | KERN_PROC_INC_THREAD, + sizeof(struct kinfo_proc), sizep)); +} + +static void * +elf_note_procstat_files(void *arg, size_t *sizep) +{ + + return (procstat_sysctl(arg, KERN_PROC_FILEDESC, + sizeof(struct kinfo_file), sizep)); +} + +static void * +elf_note_procstat_vmmap(void *arg, size_t *sizep) +{ + + return (procstat_sysctl(arg, KERN_PROC_VMMAP, + sizeof(struct kinfo_vmentry), sizep)); +} + +static void * +elf_note_procstat_groups(void *arg, size_t *sizep) +{ + + return (procstat_sysctl(arg, KERN_PROC_GROUPS, + (int)sizeof(gid_t), sizep)); +} + +static void * +elf_note_procstat_umask(void *arg, size_t *sizep) +{ + + return (procstat_sysctl(arg, KERN_PROC_UMASK, sizeof(u_short), sizep)); +} + +static void * +elf_note_procstat_osrel(void *arg, size_t *sizep) +{ + + return (procstat_sysctl(arg, KERN_PROC_OSREL, sizeof(int), sizep)); +} + +static void * +elf_note_procstat_psstrings(void *arg, size_t *sizep) +{ + + return (procstat_sysctl(arg, KERN_PROC_PS_STRINGS, + sizeof(vm_offset_t), sizep)); +} + +static void * +elf_note_procstat_auxv(void *arg, size_t *sizep) +{ + + return (procstat_sysctl(arg, KERN_PROC_AUXV, + sizeof(Elf_Auxinfo), sizep)); +} + +static void * +elf_note_procstat_rlimit(void *arg, size_t *sizep) +{ + pid_t pid; + size_t len; + int i, name[5], structsize; + void *buf, *p; + + pid = *(pid_t *)arg; + structsize = sizeof(struct rlimit) * RLIM_NLIMITS; + buf = calloc(1, sizeof(structsize) + structsize); + if (buf == NULL) + errx(1, "out of memory"); + bcopy(&structsize, buf, sizeof(structsize)); + p = (char *)buf + sizeof(structsize); + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_RLIMIT; + name[3] = pid; + len = sizeof(struct rlimit); + for (i = 0; i < RLIM_NLIMITS; i++) { + name[4] = i; + if (sysctl(name, 5, p, &len, NULL, 0) == -1) + err(1, "kern.proc.rlimit.%u", pid); + if (len != sizeof(struct rlimit)) + errx(1, "kern.proc.rlimit.%u: short read", pid); + p += len; + } + + *sizep = sizeof(structsize) + structsize; + return (buf); +} + struct dumpers elfdump = { elf_ident, elf_coredump }; TEXT_SET(dumpset, elfdump); From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 08:25:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A1E42EA1; Sat, 20 Apr 2013 08:25:15 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7A02F12D8; Sat, 20 Apr 2013 08:25:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3K8PFLm030826; Sat, 20 Apr 2013 08:25:15 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3K8PF9s030822; Sat, 20 Apr 2013 08:25:15 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304200825.r3K8PF9s030822@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 08:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249688 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 08:25:15 -0000 Author: trociny Date: Sat Apr 20 08:25:14 2013 New Revision: 249688 URL: http://svnweb.freebsd.org/changeset/base/249688 Log: Bump date. Modified: head/lib/libprocstat/libprocstat.3 Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:23:19 2013 (r249687) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 08:25:14 2013 (r249688) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 1, 2012 +.Dd April 20, 2013 .Dt LIBPROCSTAT 3 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 11:42:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 098E64EF; Sat, 20 Apr 2013 11:42:12 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EFAFB1848; Sat, 20 Apr 2013 11:42:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KBgB4f055380; Sat, 20 Apr 2013 11:42:11 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KBgAxu055364; Sat, 20 Apr 2013 11:42:11 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201304201142.r3KBgAxu055364@svn.freebsd.org> From: Edwin Groothuis Date: Sat, 20 Apr 2013 11:42:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249692 - head/contrib/tzdata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 11:42:12 -0000 Author: edwin Date: Sat Apr 20 11:42:10 2013 New Revision: 249692 URL: http://svnweb.freebsd.org/changeset/base/249692 Log: Merge of vendor of 249690, tzdata2013c - antarctica: AusAQ and ATAQ have been removed. - Antarctica/Macquarie has been moved to australasia file and AU. - Asia/Hebron, Palestine updated for 2013. - Paraguay stays with DST for the whole year. Modified: head/contrib/tzdata/antarctica head/contrib/tzdata/asia head/contrib/tzdata/australasia head/contrib/tzdata/southamerica head/contrib/tzdata/zone.tab Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/antarctica ============================================================================== --- head/contrib/tzdata/antarctica Sat Apr 20 11:35:25 2013 (r249691) +++ head/contrib/tzdata/antarctica Sat Apr 20 11:42:10 2013 (r249692) @@ -53,34 +53,6 @@ Rule ChileAQ 2011 only - Aug Sun>=16 4:0 Rule ChileAQ 2012 max - Apr Sun>=23 3:00u 0 - Rule ChileAQ 2012 max - Sep Sun>=2 4:00u 1:00 S -# These rules are stolen from the `australasia' file. -Rule AusAQ 1917 only - Jan 1 0:01 1:00 - -Rule AusAQ 1917 only - Mar 25 2:00 0 - -Rule AusAQ 1942 only - Jan 1 2:00 1:00 - -Rule AusAQ 1942 only - Mar 29 2:00 0 - -Rule AusAQ 1942 only - Sep 27 2:00 1:00 - -Rule AusAQ 1943 1944 - Mar lastSun 2:00 0 - -Rule AusAQ 1943 only - Oct 3 2:00 1:00 - -Rule ATAQ 1967 only - Oct Sun>=1 2:00s 1:00 - -Rule ATAQ 1968 only - Mar lastSun 2:00s 0 - -Rule ATAQ 1968 1985 - Oct lastSun 2:00s 1:00 - -Rule ATAQ 1969 1971 - Mar Sun>=8 2:00s 0 - -Rule ATAQ 1972 only - Feb lastSun 2:00s 0 - -Rule ATAQ 1973 1981 - Mar Sun>=1 2:00s 0 - -Rule ATAQ 1982 1983 - Mar lastSun 2:00s 0 - -Rule ATAQ 1984 1986 - Mar Sun>=1 2:00s 0 - -Rule ATAQ 1986 only - Oct Sun>=15 2:00s 1:00 - -Rule ATAQ 1987 1990 - Mar Sun>=15 2:00s 0 - -Rule ATAQ 1987 only - Oct Sun>=22 2:00s 1:00 - -Rule ATAQ 1988 1990 - Oct lastSun 2:00s 1:00 - -Rule ATAQ 1991 1999 - Oct Sun>=1 2:00s 1:00 - -Rule ATAQ 1991 2005 - Mar lastSun 2:00s 0 - -Rule ATAQ 2000 only - Aug lastSun 2:00s 1:00 - -Rule ATAQ 2001 max - Oct Sun>=1 2:00s 1:00 - -Rule ATAQ 2006 only - Apr Sun>=1 2:00s 0 - -Rule ATAQ 2007 only - Mar lastSun 2:00s 0 - -Rule ATAQ 2008 max - Apr Sun>=1 2:00s 0 - - # Argentina - year-round bases # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05 # Esperanza, San Martin Land, -6323-05659, since 1952-12-17 @@ -122,10 +94,7 @@ Rule ATAQ 2008 max - Apr Sun>=1 2:00s 0 # # From Steffen Thorsen (2010-03-10): -# We got these changes from the Australian Antarctic Division: -# - Macquarie Island will stay on UTC+11 for winter and therefore not -# switch back from daylight savings time when other parts of Australia do -# on 4 April. +# We got these changes from the Australian Antarctic Division: ... # # - Casey station reverted to its normal time of UTC+8 on 5 March 2010. # The change to UTC+11 is being considered as a regular summer thing but @@ -136,9 +105,6 @@ Rule ATAQ 2008 max - Apr Sun>=1 2:00s 0 # # - Mawson station stays on UTC+5. # -# In addition to the Rule changes for Casey/Davis, it means that Macquarie -# will no longer be like Hobart and will have to have its own Zone created. -# # Background: # # http://www.timeanddate.com/news/time/antartica-time-changes-2010.html @@ -165,12 +131,6 @@ Zone Antarctica/Mawson 0 - zzz 1954 Feb 6:00 - MAWT 2009 Oct 18 2:00 # Mawson Time 5:00 - MAWT -Zone Antarctica/Macquarie 0 - zzz 1911 - 10:00 - EST 1916 Oct 1 2:00 - 10:00 1:00 EST 1917 Feb - 10:00 AusAQ EST 1967 - 10:00 ATAQ EST 2010 Apr 4 3:00 - 11:00 - MIST # Macquarie Island Time # References: # # Casey Weather (1998-02-26) Modified: head/contrib/tzdata/asia ============================================================================== --- head/contrib/tzdata/asia Sat Apr 20 11:35:25 2013 (r249691) +++ head/contrib/tzdata/asia Sat Apr 20 11:42:10 2013 (r249692) @@ -2291,11 +2291,20 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # http://www.timeanddate.com/news/time/gaza-west-bank-dst-2012.html # -# From Arthur David Olson (2012-03-27): -# The timeanddate article for 2012 says that "the end date has not yet been -# announced" and that "Last year, both...paused daylight saving time during... -# Ramadan. It is not yet known [for] 2012." -# For now, assume both switch back on the last Friday in September. XXX +# From Steffen Thorsen (2013-03-26): +# The following news sources tells that Palestine will "start daylight saving +# time from midnight on Friday, March 29, 2013" (translated). +# [These are in Arabic and are for Gaza and for Ramallah, respectively.] +# http://www.samanews.com/index.php?act=Show&id=154120 +# http://safa.ps/details/news/99844/%D8%B1%D8%A7%D9%85-%D8%A7%D9%84%D9%84%D9%87-%D8%A8%D8%AF%D8%A1-%D8%A7%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%8A%D9%81%D9%8A-29-%D8%A7%D9%84%D8%AC%D8%A7%D8%B1%D9%8A.html + +# From Paul Eggert (2013-04-15): +# For future dates, guess the last Thursday in March at 24:00 through +# the first Friday on or after September 21 at 01:00. This is consistent with +# the predictions in today's editions of the following URLs, +# which are for Gaza and Hebron respectively: +# http://www.timeanddate.com/worldclock/timezone.html?n=702 +# http://www.timeanddate.com/worldclock/timezone.html?n=2364 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S @@ -2309,19 +2318,20 @@ Rule Palestine 1999 2005 - Apr Fri>=15 0 Rule Palestine 1999 2003 - Oct Fri>=15 0:00 0 - Rule Palestine 2004 only - Oct 1 1:00 0 - Rule Palestine 2005 only - Oct 4 2:00 0 - -Rule Palestine 2006 2008 - Apr 1 0:00 1:00 S +Rule Palestine 2006 2007 - Apr 1 0:00 1:00 S Rule Palestine 2006 only - Sep 22 0:00 0 - Rule Palestine 2007 only - Sep Thu>=8 2:00 0 - -Rule Palestine 2008 only - Aug lastFri 0:00 0 - -Rule Palestine 2009 only - Mar lastFri 0:00 1:00 S -Rule Palestine 2009 only - Sep Fri>=1 2:00 0 - -Rule Palestine 2010 only - Mar lastSat 0:01 1:00 S +Rule Palestine 2008 2009 - Mar lastFri 0:00 1:00 S +Rule Palestine 2008 only - Sep 1 0:00 0 - +Rule Palestine 2009 only - Sep Fri>=1 1:00 0 - +Rule Palestine 2010 only - Mar 26 0:00 1:00 S Rule Palestine 2010 only - Aug 11 0:00 0 - - -# From Arthur David Olson (2011-09-20): -# 2011 transitions per http://www.timeanddate.com as of 2011-09-20. -# From Paul Eggert (2012-10-12): -# 2012 transitions per http://www.timeanddate.com as of 2012-10-12. +Rule Palestine 2011 only - Apr 1 0:01 1:00 S +Rule Palestine 2011 only - Aug 1 0:00 0 - +Rule Palestine 2011 only - Aug 30 0:00 1:00 S +Rule Palestine 2011 only - Sep 30 0:00 0 - +Rule Palestine 2012 max - Mar lastThu 24:00 1:00 S +Rule Palestine 2012 max - Sep Fri>=21 1:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct @@ -2329,26 +2339,20 @@ Zone Asia/Gaza 2:17:52 - LMT 1900 Oct 2:00 EgyptAsia EE%sT 1967 Jun 5 2:00 Zion I%sT 1996 2:00 Jordan EE%sT 1999 - 2:00 Palestine EE%sT 2011 Apr 2 12:01 - 2:00 1:00 EEST 2011 Aug 1 - 2:00 - EET 2012 Mar 30 - 2:00 1:00 EEST 2012 Sep 21 1:00 - 2:00 - EET + 2:00 Palestine EE%sT 2008 Aug 29 0:00 + 2:00 - EET 2008 Sep + 2:00 Palestine EE%sT 2010 + 2:00 - EET 2010 Mar 27 0:01 + 2:00 Palestine EE%sT 2011 Aug 1 + 2:00 - EET 2012 + 2:00 Palestine EE%sT Zone Asia/Hebron 2:20:23 - LMT 1900 Oct 2:00 Zion EET 1948 May 15 2:00 EgyptAsia EE%sT 1967 Jun 5 2:00 Zion I%sT 1996 2:00 Jordan EE%sT 1999 - 2:00 Palestine EE%sT 2008 Aug - 2:00 1:00 EEST 2008 Sep - 2:00 Palestine EE%sT 2011 Apr 1 12:01 - 2:00 1:00 EEST 2011 Aug 1 - 2:00 - EET 2011 Aug 30 - 2:00 1:00 EEST 2011 Sep 30 3:00 - 2:00 - EET 2012 Mar 30 - 2:00 1:00 EEST 2012 Sep 21 1:00 - 2:00 - EET + 2:00 Palestine EE%sT # Paracel Is # no information Modified: head/contrib/tzdata/australasia ============================================================================== --- head/contrib/tzdata/australasia Sat Apr 20 11:35:25 2013 (r249691) +++ head/contrib/tzdata/australasia Sat Apr 20 11:42:10 2013 (r249692) @@ -218,9 +218,26 @@ Zone Australia/Lord_Howe 10:36:20 - LMT # no times are set # # Macquarie -# permanent occupation (scientific station) since 1948; -# sealing and penguin oil station operated 1888/1917 -# like Australia/Hobart +# Permanent occupation (scientific station) 1911-1915 and since 25 March 1948; +# sealing and penguin oil station operated Nov 1899 to Apr 1919. See the +# Tasmania Parks & Wildlife Service history of sealing at Macquarie Island +# +# . +# Guess that it was like Australia/Hobart while inhabited before 2010. +# +# From Steffen Thorsen (2010-03-10): +# We got these changes from the Australian Antarctic Division: +# - Macquarie Island will stay on UTC+11 for winter and therefore not +# switch back from daylight savings time when other parts of Australia do +# on 4 April. +Zone Antarctica/Macquarie 0 - zzz 1899 Nov + 10:00 - EST 1916 Oct 1 2:00 + 10:00 1:00 EST 1917 Feb + 10:00 Aus EST 1919 Apr + 0 - zzz 1948 Mar 25 + 10:00 Aus EST 1967 + 10:00 AT EST 2010 Apr 4 3:00 + 11:00 - MIST # Macquarie I Standard Time # Christmas # Zone NAME GMTOFF RULES FORMAT [UNTIL] Modified: head/contrib/tzdata/southamerica ============================================================================== --- head/contrib/tzdata/southamerica Sat Apr 20 11:35:25 2013 (r249691) +++ head/contrib/tzdata/southamerica Sat Apr 20 11:42:10 2013 (r249692) @@ -1566,16 +1566,16 @@ Rule Para 2005 2009 - Mar Sun>=8 0:00 0 # forward 60 minutes, in all the territory of the Paraguayan Republic. # ... Rule Para 2010 max - Oct Sun>=1 0:00 1:00 S -Rule Para 2010 max - Apr Sun>=8 0:00 0 - +Rule Para 2010 2012 - Apr Sun>=8 0:00 0 - # # From Steffen Thorsen (2013-03-07): # Paraguay will end DST on 2013-03-24 00:00.... -# They do not tell if this will be a permanent change or just this year.... # http://www.ande.gov.py/interna.php?id=1075 # -# From Paul Eggert (2013-03-07): -# For now, assume it's just this year. -Rule Para 2013 only - Mar 24 0:00 0 - +# From Carlos Raul Perasso (2013-03-15): +# The change in Paraguay is now final. Decree number 10780 +# http://www.presidencia.gov.py/uploads/pdf/presidencia-3b86ff4b691c79d4f5927ca964922ec74772ce857c02ca054a52a37b49afc7fb.pdf +Rule Para 2013 max - Mar Sun>=22 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Asuncion -3:50:40 - LMT 1890 Modified: head/contrib/tzdata/zone.tab ============================================================================== --- head/contrib/tzdata/zone.tab Sat Apr 20 11:35:25 2013 (r249691) +++ head/contrib/tzdata/zone.tab Sat Apr 20 11:42:10 2013 (r249692) @@ -42,7 +42,6 @@ AQ -6617+11031 Antarctica/Casey Casey St AQ -7824+10654 Antarctica/Vostok Vostok Station, Lake Vostok AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I -AQ -5430+15857 Antarctica/Macquarie Macquarie Island Station, Macquarie Island AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF) AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, MN, SE, SF) AR -2447-06525 America/Argentina/Salta (SA, LP, NQ, RN) @@ -58,6 +57,7 @@ AR -5448-06818 America/Argentina/Ushuaia AS -1416-17042 Pacific/Pago_Pago AT +4813+01620 Europe/Vienna AU -3133+15905 Australia/Lord_Howe Lord Howe Island +AU -5430+15857 Antarctica/Macquarie Macquarie Island AU -4253+14719 Australia/Hobart Tasmania - most locations AU -3956+14352 Australia/Currie Tasmania - King Island AU -3749+14458 Australia/Melbourne Victoria From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 11:45:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8BD5A94A for ; Sat, 20 Apr 2013 11:45:55 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by mx1.freebsd.org (Postfix) with ESMTP id 6721B1868 for ; Sat, 20 Apr 2013 11:45:55 +0000 (UTC) Received: by mail-pd0-f172.google.com with SMTP id 5so2703367pdd.31 for ; Sat, 20 Apr 2013 04:45:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer:x-gm-message-state; bh=8TCNneII8gau7mY+pR0sfxLAP7xIiIAiO9t+eyQcQCc=; b=ZdEDZlhP2x9l+HlY/JOAg9r1Y1R55jXMK1NheKTeuJOvF2acbe43St02g6Qf0QTOzY QOSd8yTH2IbZnJzjownO657aod+LaGvuX6OyjtsfYVpOrqp0myESjtzZBcTdaI6ieV/y rMtCy5Tyjp3lgesNc1S6u2gqVkMvZMxL1dHN3H9phiPIYr4vZgmiiLZ787/jJX3KZlxT ABUST8ftJYbVgOB3fe0Q3bR9YhR1l5B7t7DI+W8DEFUF2mP6DYetQvaxRN/gIgGZp7X5 XBnYSocbl+YwBTJ1AhgSAdwwslwktBqGBaglyANHCefdc2pW273/BH4Zquy6A/eNrcWK EqxA== X-Received: by 10.66.161.69 with SMTP id xq5mr20309658pab.136.1366458349037; Sat, 20 Apr 2013 04:45:49 -0700 (PDT) Received: from [10.0.0.53] (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPS id wi6sm16960045pbc.22.2013.04.20.04.45.46 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 20 Apr 2013 04:45:47 -0700 (PDT) Sender: Warner Losh Subject: Re: svn commit: r249658 - in head: bin/chio sys/cam/scsi sys/sys Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <201304192003.r3JK3qFB013463@svn.freebsd.org> Date: Sat, 20 Apr 2013 05:45:43 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <82451AEC-79FD-448F-B180-C2CEC47EB18B@bsdimp.com> References: <201304192003.r3JK3qFB013463@svn.freebsd.org> To: Kenneth D. Merry X-Mailer: Apple Mail (2.1085) X-Gm-Message-State: ALoCoQmoDExjkFJnyPsmmc5YoAMZojvJbZC8/lTkdRR46lep5ULt3p2vOIhZil1fPB6UrQDG5Ix5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 11:45:55 -0000 Hey Ken, this change doesn't compile for me. See below Warner On Apr 19, 2013, at 2:03 PM, Kenneth D. Merry wrote: > Author: ken > Date: Fri Apr 19 20:03:51 2013 > New Revision: 249658 > URL: http://svnweb.freebsd.org/changeset/base/249658 >=20 > Log: > Update chio(1) and ch(4) to support reporting element designators. >=20 > This allows mapping a tape drive in a changer (as reported by > 'chio status') to a sa(4) driver instance by comparing the > serial numbers. >=20 > The designators can be ASCII (which is printed out directly), binary > (which is printed in hex format) or UTF-8, which is printed in either > native UTF-8 format if the terminal can support it, or in %XX = notation > for non-ASCII characters. Thanks to Hiroki Sato for the > explaining UTF-8 printing and example UTF-8 printing code. >=20 > chio.h: Modify the changer_element_status structure to = add new > fields and definitions from the SMC3r16 spec. >=20 > Rename the original CHIOGSTATUS ioctl to OCHIOGTATUS and > define a new CHIOGSTATUS ioctl. >=20 > Clean up some tab/space issues. >=20 > chio.c: For the 'status' subcommand, print the designator field > if it is supplied by a device. >=20 > scsi_ch.h: Add new flags for DVCID and CURDATA to the READ > ELEMENT STATUS command structure. >=20 > Add a read_element_status_device_id structure > for the data fields in the new standard. Add new > unions, dt_or_obsolete and voltage_devid, to hold > and address data from either SCSI-2 or newer devices. >=20 > scsi_ch.c: Implement support for fetching device IDs with READ > ELEMENT STATUS data. >=20 > Add new arguments to scsi_read_element_status() to > allow the user to request the DVCID and CURDATA bits. > This isn't compiled into libcam (it's only an internal > kernel interface), so we don't need any special > handling for the API change. >=20 > If the user issues the new CHIOGSTATUS ioctl, copy all = of > the available element status data out. If he issues the > OCHIOGSTATUS ioctl, we don't copy the new fields in the > structure. >=20 > Fix a bug in chopen() that would result in the = peripheral > never getting unheld if chgetparams() failed. >=20 > Sponsored by: Spectra Logic > Submitted by: Po-Li Soong > MFC After: 1 week >=20 > Modified: > head/bin/chio/chio.c > head/sys/cam/scsi/scsi_ch.c > head/sys/cam/scsi/scsi_ch.h > head/sys/sys/chio.h >=20 > Modified: head/bin/chio/chio.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/bin/chio/chio.c Fri Apr 19 19:45:00 2013 = (r249657) > +++ head/bin/chio/chio.c Fri Apr 19 20:03:51 2013 = (r249658) > @@ -54,6 +54,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > +#include >=20 > #include "defs.h" > #include "pathnames.h" > @@ -81,6 +83,7 @@ static int do_status(const char *, int,=20 > static int do_ielem(const char *, int, char **); > static int do_return(const char *, int, char **); > static int do_voltag(const char *, int, char **); > +static void print_designator(const char *, u_int8_t, u_int8_t); >=20 > #ifndef CHET_VT > #define CHET_VT 10 /* Completely = Arbitrary */ > @@ -723,6 +726,10 @@ do_status(const char *cname, int argc, c > putchar('?'); > putchar('>'); > } > + if (ces->ces_designator_length > 0) > + print_designator(ces->ces_designator, > + ces->ces_code_set, > + = ces->ces_designator_length); > putchar('\n'); > } >=20 > @@ -1177,3 +1184,66 @@ usage(void) > "arg1 arg2 [arg3 [...]]\n", getprogname()); > exit(1); > } > + > +#define UTF8CODESET "UTF-8" > + > +static void > +print_designator(const char *designator, u_int8_t code_set, > + u_int8_t designator_length) > +{ > + printf(" serial number: <"); > + switch (code_set) { > + case CES_CODE_SET_ASCII: { > + /* > + * The driver insures that the string is always NUL = terminated. > + */ > + printf("%s", designator); > + break; > + } > + case CES_CODE_SET_UTF_8: { > + char *cs_native; > + > + setlocale(LC_ALL, ""); > + cs_native =3D nl_langinfo(CODESET); > + > + /* See if we can natively print UTF-8 */ > + if (strcmp(cs_native, UTF8CODESET) =3D=3D 0) > + cs_native =3D NULL; > + > + if (cs_native =3D=3D NULL) { > + /* We can natively print UTF-8, so use printf. = */ > + printf("%s", designator); > + } else { > + int i; > + > + /* > + * We can't natively print UTF-8. We should > + * convert it to the terminal's codeset, but = that > + * requires iconv(3) and FreeBSD doesn't have > + * iconv(3) in the base system yet. So we use = %XX > + * notation for non US-ASCII characters instead. > + */ > + for (i =3D 0; i < designator_length && > + designator[i] !=3D '\0'; i++) { > + if ((unsigned char)designator[i] < 0x80) > + printf("%c", designator[i]); > + else > + printf("%%%02x", > + (unsigned = char)designator[i]); > + } > + } > + break; > + } > + case CES_CODE_SET_BINARY: { > + int i; > + > + for (i =3D 0; i < designator_length; i++) > + printf("%02X%s", designator[i], > + (i =3D=3D designator_length - 1) ? "" : " = "); > + break; > + } > + default: > + break; > + } > + printf(">"); > +} >=20 > Modified: head/sys/cam/scsi/scsi_ch.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/cam/scsi/scsi_ch.c Fri Apr 19 19:45:00 2013 = (r249657) > +++ head/sys/cam/scsi/scsi_ch.c Fri Apr 19 20:03:51 2013 = (r249658) > @@ -194,12 +194,14 @@ static int chexchange(struct = cam_periph > static int chposition(struct cam_periph *periph, > struct changer_position *cp); > static int chgetelemstatus(struct cam_periph = *periph, > + int scsi_version, u_long cmd, > struct changer_element_status_request = *csr); > static int chsetvoltag(struct cam_periph *periph, > struct changer_set_voltag_request = *csvr); > static int chielem(struct cam_periph *periph,=20 > unsigned int timeout); > static int chgetparams(struct cam_periph *periph); > +static int chscsiversion(struct cam_periph = *periph); >=20 > static struct periph_driver chdriver =3D > { > @@ -474,6 +476,7 @@ chopen(struct cdev *dev, int flags, int=20 > * Load information about this changer device into the softc. > */ > if ((error =3D chgetparams(periph)) !=3D 0) { > + cam_periph_unhold(periph); > cam_periph_release_locked(periph); > cam_periph_unlock(periph); > return(error); > @@ -772,6 +775,7 @@ chioctl(struct cdev *dev, u_long cmd, ca > switch (cmd) { > case CHIOGPICKER: > case CHIOGPARAMS: > + case OCHIOGSTATUS: > case CHIOGSTATUS: > break; >=20 > @@ -824,10 +828,26 @@ chioctl(struct cdev *dev, u_long cmd, ca > error =3D chielem(periph, *(unsigned int *)addr); > break; >=20 > + case OCHIOGSTATUS: > + { > + error =3D chgetelemstatus(periph, SCSI_REV_2, cmd, > + (struct changer_element_status_request *)addr); > + break; > + } > + > case CHIOGSTATUS: > { > - error =3D chgetelemstatus(periph, > - (struct changer_element_status_request *) = addr); > + int scsi_version; > + > + scsi_version =3D chscsiversion(periph); > + if (scsi_version >=3D SCSI_REV_0) { > + error =3D chgetelemstatus(periph, scsi_version, = cmd, > + (struct changer_element_status_request = *)addr); > + } > + else { /* unable to determine the SCSI version */ > + cam_periph_unlock(periph); > + return (ENXIO); > + } > break; > } >=20 > @@ -1034,18 +1054,20 @@ copy_voltag(struct changer_voltag *uvolt > } >=20 > /* > - * Copy an an element status descriptor to a user-mode > + * Copy an element status descriptor to a user-mode > * changer_element_status structure. > */ > - > -static void > +static void > copy_element_status(struct ch_softc *softc, > u_int16_t flags, > struct read_element_status_descriptor *desc, > - struct changer_element_status *ces) > + struct changer_element_status *ces, > + int scsi_version) > { > u_int16_t eaddr =3D scsi_2btoul(desc->eaddr); > u_int16_t et; > + struct volume_tag *pvol_tag =3D NULL, *avol_tag =3D NULL; > + struct read_element_status_device_id *devid =3D NULL; >=20 > ces->ces_int_addr =3D eaddr; > /* set up logical address in element status */ > @@ -1076,7 +1098,7 @@ copy_element_status(struct ch_softc *sof > if ((softc->sc_firsts[et] <=3D eaddr) > && ((softc->sc_firsts[et] + = softc->sc_counts[et]) > > eaddr)) { > - ces->ces_source_addr =3D=20 > + ces->ces_source_addr =3D > eaddr - softc->sc_firsts[et]; > ces->ces_source_type =3D et; > ces->ces_flags |=3D CES_SOURCE_VALID; > @@ -1089,27 +1111,92 @@ copy_element_status(struct ch_softc *sof > "address %ud to a valid element type\n", > eaddr); > } > - =09 >=20 > + /* > + * pvoltag and avoltag are common between SCSI-2 and later = versions > + */ > if (flags & READ_ELEMENT_STATUS_PVOLTAG) > - copy_voltag(&(ces->ces_pvoltag), &(desc->pvoltag)); > + pvol_tag =3D &desc->voltag_devid.pvoltag; > if (flags & READ_ELEMENT_STATUS_AVOLTAG) > - copy_voltag(&(ces->ces_avoltag), &(desc->avoltag)); > - > - if (desc->dt_scsi_flags & READ_ELEMENT_STATUS_DT_IDVALID) { > - ces->ces_flags |=3D CES_SCSIID_VALID; > - ces->ces_scsi_id =3D desc->dt_scsi_addr; > - } > + avol_tag =3D (flags & READ_ELEMENT_STATUS_PVOLTAG) ? > + &desc->voltag_devid.voltag[1] = :&desc->voltag_devid.pvoltag; > + /* > + * For SCSI-3 and later, element status can carry designator and > + * other information. > + */ > + if (scsi_version >=3D SCSI_REV_SPC) { > + if ((flags & READ_ELEMENT_STATUS_PVOLTAG) ^ > + (flags & READ_ELEMENT_STATUS_AVOLTAG)) > + devid =3D = &desc->voltag_devid.pvol_and_devid.devid; > + else if (!(flags & READ_ELEMENT_STATUS_PVOLTAG) && > + !(flags & READ_ELEMENT_STATUS_AVOLTAG)) > + devid =3D &desc->voltag_devid.devid; > + else /* Have both PVOLTAG and AVOLTAG */ > + devid =3D = &desc->voltag_devid.vol_tags_and_devid.devid; > + } > + > + if (pvol_tag) > + copy_voltag(&(ces->ces_pvoltag), pvol_tag); > + if (avol_tag) > + copy_voltag(&(ces->ces_pvoltag), avol_tag); > + if (devid !=3D NULL) { > + if (devid->designator_length > 0) { > + bcopy((void *)devid->designator, > + (void *)ces->ces_designator, > + devid->designator_length); > + ces->ces_designator_length =3D = devid->designator_length; > + /* > + * Make sure we are always NUL terminated. The > + * buffer should be sized for the maximum > + * designator length plus 1, but this will make = sure > + * there is always a NUL at the end. This won't > + * matter for the binary code set, since the = user > + * will only pay attention to the length field. > + */ > + ces->ces_designator[ > + MIN(sizeof(ces->ces_designator) - 1, > + devid->designator_length)]=3D '\0'; compiler complains here that this comparison is always false due to data = ranges. I hacked it in my copy by always using devid->designator_length, = but I know that's a lame fix. Can you look into it? Also, just got tinderbox mail. Warner > + } > + if (devid->piv_assoc_designator_type & > + READ_ELEMENT_STATUS_PIV_SET) { > + ces->ces_flags |=3D CES_PIV; > + ces->ces_protocol_id =3D > + READ_ELEMENT_STATUS_PROTOCOL_ID( > + devid->prot_code_set); > + } > + ces->ces_code_set =3D > + READ_ELEMENT_STATUS_CODE_SET(devid->prot_code_set); > + ces->ces_assoc =3D READ_ELEMENT_STATUS_ASSOCIATION( > + devid->piv_assoc_designator_type); > + ces->ces_designator_type =3D = READ_ELEMENT_STATUS_DESIGNATOR_TYPE( > + devid->piv_assoc_designator_type); > + } else if (scsi_version > SCSI_REV_2) { > + /* SCSI-SPC and No devid, no designator */ > + ces->ces_designator_length =3D 0; > + ces->ces_designator[0] =3D '\0'; > + ces->ces_protocol_id =3D CES_PROTOCOL_ID_FCP_4; > + } > + > + if (scsi_version <=3D SCSI_REV_2) { > + if (desc->dt_or_obsolete.scsi_2.dt_scsi_flags & > + READ_ELEMENT_STATUS_DT_IDVALID) { > + ces->ces_flags |=3D CES_SCSIID_VALID; > + ces->ces_scsi_id =3D > + desc->dt_or_obsolete.scsi_2.dt_scsi_addr; > + } >=20 > - if (desc->dt_scsi_addr & READ_ELEMENT_STATUS_DT_LUVALID) { > - ces->ces_flags |=3D CES_LUN_VALID; > - ces->ces_scsi_lun =3D=20 > - desc->dt_scsi_flags & = READ_ELEMENT_STATUS_DT_LUNMASK; > + if (desc->dt_or_obsolete.scsi_2.dt_scsi_addr & > + READ_ELEMENT_STATUS_DT_LUVALID) { > + ces->ces_flags |=3D CES_LUN_VALID; > + ces->ces_scsi_lun =3D > + desc->dt_or_obsolete.scsi_2.dt_scsi_flags & > + READ_ELEMENT_STATUS_DT_LUNMASK; > + } > } > } >=20 > static int > -chgetelemstatus(struct cam_periph *periph,=20 > +chgetelemstatus(struct cam_periph *periph, int scsi_version, u_long = cmd, > struct changer_element_status_request *cesr) > { > struct read_element_status_header *st_hdr; > @@ -1155,6 +1242,8 @@ chgetelemstatus(struct cam_periph *perip > /* tag_action */ MSG_SIMPLE_Q_TAG, > /* voltag */ want_voltags, > /* sea */ softc->sc_firsts[chet], > + /* dvcid */ 1, > + /* curdata */ 1, > /* count */ 1, > /* data_ptr */ data, > /* dxfer_len */ 1024, > @@ -1177,7 +1266,6 @@ chgetelemstatus(struct cam_periph *perip > size =3D sizeof(struct read_element_status_header) + > sizeof(struct read_element_status_page_header) + > (desclen * cesr->cesr_element_count); > - > /* > * Reallocate storage for descriptors and get them from the > * device. > @@ -1193,12 +1281,14 @@ chgetelemstatus(struct cam_periph *perip > /* voltag */ want_voltags, > /* sea */ softc->sc_firsts[chet] > + cesr->cesr_element_base, > + /* dvcid */ 1, > + /* curdata */ 1, > /* count */ cesr->cesr_element_count, > /* data_ptr */ data, > /* dxfer_len */ size, > /* sense_len */ SSD_FULL_SIZE, > /* timeout */ = CH_TIMEOUT_READ_ELEMENT_STATUS); > -=09 > + > error =3D cam_periph_runccb(ccb, cherror, /*cam_flags*/ = CAM_RETRY_SELTO, > /*sense_flags*/ SF_RETRY_UA, > softc->device_stats); > @@ -1231,18 +1321,41 @@ chgetelemstatus(struct cam_periph *perip > * Set up the individual element status structures > */ > for (i =3D 0; i < avail; ++i) { > - struct changer_element_status *ces =3D &(user_data[i]); > + struct changer_element_status *ces; >=20 > - copy_element_status(softc, pg_hdr->flags, desc, ces); > + /* > + * In the changer_element_status structure, fields from > + * the beginning to the field of ces_scsi_lun are common > + * between SCSI-2 and SCSI-3, while all the rest are new > + * from SCSI-3. In order to maintain backward = compatibility > + * of the chio command, the ces pointer, below, is = computed > + * such that it lines up with the structure boundary > + * corresponding to the SCSI version. > + */ > + ces =3D cmd =3D=3D OCHIOGSTATUS ? > + (struct changer_element_status *) > + ((unsigned char *)user_data + i * > + (offsetof(struct = changer_element_status,ces_scsi_lun)+1)): > + &user_data[i]; > + > + copy_element_status(softc, pg_hdr->flags, desc, > + ces, scsi_version); >=20 > desc =3D (struct read_element_status_descriptor *) > - ((uintptr_t)desc + desclen); > + ((unsigned char *)desc + desclen); > } >=20 > /* Copy element status structures out to userspace. */ > - error =3D copyout(user_data, > - cesr->cesr_element_status, > - avail * sizeof(struct changer_element_status)); > + if (cmd =3D=3D OCHIOGSTATUS) > + error =3D copyout(user_data, > + cesr->cesr_element_status, > + avail* (offsetof(struct = changer_element_status, > + ces_scsi_lun) + 1)); > + else > + error =3D copyout(user_data, > + cesr->cesr_element_status, > + avail * sizeof(struct = changer_element_status)); > + > cam_periph_lock(periph); >=20 > done: > @@ -1549,6 +1662,39 @@ chgetparams(struct cam_periph *periph) > return(error); > } >=20 > +static int > +chscsiversion(struct cam_periph *periph) > +{ > + struct scsi_inquiry_data *inq_data; > + struct ccb_getdev *cgd; > + int dev_scsi_version; > + struct cam_sim *sim; > + > + sim =3D xpt_path_sim(periph->path); > + mtx_assert(sim->mtx, MA_OWNED); > + if ((cgd =3D (struct ccb_getdev *)xpt_alloc_ccb_nowait()) =3D=3D = NULL) > + return (-1); > + /* > + * Get the device information. > + */ > + xpt_setup_ccb(&cgd->ccb_h, > + periph->path, > + CAM_PRIORITY_NORMAL); > + cgd->ccb_h.func_code =3D XPT_GDEV_TYPE; > + xpt_action((union ccb *)cgd); > + > + if (cgd->ccb_h.status !=3D CAM_REQ_CMP) { > + xpt_free_ccb((union ccb *)cgd); > + return -1; > + } > + > + inq_data =3D &cgd->inq_data; > + dev_scsi_version =3D inq_data->version; > + xpt_free_ccb((union ccb *)cgd); > + > + return dev_scsi_version; > +} > + > void > scsi_move_medium(struct ccb_scsiio *csio, u_int32_t retries, > void (*cbfcnp)(struct cam_periph *, union ccb *), > @@ -1654,6 +1800,7 @@ void > scsi_read_element_status(struct ccb_scsiio *csio, u_int32_t retries, > void (*cbfcnp)(struct cam_periph *, union ccb = *), > u_int8_t tag_action, int voltag, u_int32_t sea, > + int curdata, int dvcid, > u_int32_t count, u_int8_t *data_ptr, > u_int32_t dxfer_len, u_int8_t sense_len, > u_int32_t timeout) > @@ -1668,6 +1815,10 @@ scsi_read_element_status(struct ccb_scsi > scsi_ulto2b(sea, scsi_cmd->sea); > scsi_ulto2b(count, scsi_cmd->count); > scsi_ulto3b(dxfer_len, scsi_cmd->len); > + if (dvcid) > + scsi_cmd->flags |=3D READ_ELEMENT_STATUS_DVCID; > + if (curdata) > + scsi_cmd->flags |=3D READ_ELEMENT_STATUS_CURDATA; >=20 > if (voltag) > scsi_cmd->byte2 |=3D READ_ELEMENT_STATUS_VOLTAG; >=20 > Modified: head/sys/cam/scsi/scsi_ch.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/cam/scsi/scsi_ch.h Fri Apr 19 19:45:00 2013 = (r249657) > +++ head/sys/cam/scsi/scsi_ch.h Fri Apr 19 20:03:51 2013 = (r249658) > @@ -136,11 +136,14 @@ struct scsi_position_to_element { > struct scsi_read_element_status { > u_int8_t opcode; > u_int8_t byte2; > -#define READ_ELEMENT_STATUS_VOLTAG 0x10 /* report volume tag = info */ > +#define READ_ELEMENT_STATUS_VOLTAG 0x10 /* report volume = tag info */ > /* ...next 4 bits are an element type code... */ > u_int8_t sea[2]; /* starting element address */ > u_int8_t count[2]; /* number of elements */ > - u_int8_t reserved0; > + u_int8_t flags; > +#define READ_ELEMENT_STATUS_DVCID 0x01 /* report device = serial number */ > +#define READ_ELEMENT_STATUS_CURDATA 0x02 /* allow motion = during command */ > + > u_int8_t len[3]; /* length of data buffer */ > u_int8_t reserved1; > u_int8_t control; > @@ -149,7 +152,7 @@ struct scsi_read_element_status { > struct scsi_request_volume_element_address { > u_int8_t opcode; > u_int8_t byte2; > -#define REQUEST_VOLUME_ELEMENT_ADDRESS_VOLTAG 0x10 > +#define REQUEST_VOLUME_ELEMENT_ADDRESS_VOLTAG 0x10 > /* ...next 4 bits are an element type code... */ > u_int8_t eaddr[2]; /* element address */ > u_int8_t count[2]; /* number of elements */ > @@ -182,8 +185,8 @@ struct read_element_status_header { > struct read_element_status_page_header { > u_int8_t type; /* element type code; see type codes = below */ > u_int8_t flags; > -#define READ_ELEMENT_STATUS_AVOLTAG 0x40 > -#define READ_ELEMENT_STATUS_PVOLTAG 0x80 > +#define READ_ELEMENT_STATUS_AVOLTAG 0x40 > +#define READ_ELEMENT_STATUS_PVOLTAG 0x80 > u_int8_t edl[2]; /* element descriptor length */ > u_int8_t reserved; > u_int8_t nbytes[3]; /* byte count of all descriptors */ > @@ -199,50 +202,79 @@ struct volume_tag { > u_int8_t vsn[2]; /* volume sequence number */ > }; >=20 > +struct read_element_status_device_id { > + u_int8_t prot_code_set; > +#define READ_ELEMENT_STATUS_CODE_SET(p) ((p) & 0x0F) > +#define READ_ELEMENT_STATUS_PROTOCOL_ID(p) ((p) >> 4) > + > + u_int8_t piv_assoc_designator_type; > +#define READ_ELEMENT_STATUS_PIV_SET 0x80 > +#define READ_ELEMENT_STATUS_ASSOCIATION(p) ((p) >> 4) > +#define READ_ELEMENT_STATUS_DESIGNATOR_TYPE(p) ((p) & 0x0F) > + > + u_int8_t reserved2; > + u_int8_t designator_length; > + u_int8_t designator[256]; /* Allocate max length */ > +}; > + > struct read_element_status_descriptor { > u_int8_t eaddr[2]; /* element address */ > u_int8_t flags1; >=20 > -#define READ_ELEMENT_STATUS_FULL 0x01 > -#define READ_ELEMENT_STATUS_IMPEXP 0x02 > -#define READ_ELEMENT_STATUS_EXCEPT 0x04 > -#define READ_ELEMENT_STATUS_ACCESS 0x08 > -#define READ_ELEMENT_STATUS_EXENAB 0x10 > -#define READ_ELEMENT_STATUS_INENAB 0x20 > - > -#define READ_ELEMENT_STATUS_MT_MASK1 0x05 > -#define READ_ELEMENT_STATUS_ST_MASK1 0x0c > -#define READ_ELEMENT_STATUS_IE_MASK1 0x3f > -#define READ_ELEMENT_STATUS_DT_MASK1 0x0c > +#define READ_ELEMENT_STATUS_FULL 0x01 > +#define READ_ELEMENT_STATUS_IMPEXP 0x02 > +#define READ_ELEMENT_STATUS_EXCEPT 0x04 > +#define READ_ELEMENT_STATUS_ACCESS 0x08 > +#define READ_ELEMENT_STATUS_EXENAB 0x10 > +#define READ_ELEMENT_STATUS_INENAB 0x20 > + > +#define READ_ELEMENT_STATUS_MT_MASK1 0x05 > +#define READ_ELEMENT_STATUS_ST_MASK1 0x0c > +#define READ_ELEMENT_STATUS_IE_MASK1 0x3f > +#define READ_ELEMENT_STATUS_DT_MASK1 0x0c >=20 > u_int8_t reserved0; > u_int8_t sense_code; > u_int8_t sense_qual; >=20 > - /* > - * dt_scsi_flags and dt_scsi_addr are valid only on data = transport > - * elements. These bytes are undefined for all other element = types. > - */ > - u_int8_t dt_scsi_flags; > - > -#define READ_ELEMENT_STATUS_DT_LUNMASK 0x07 > -#define READ_ELEMENT_STATUS_DT_LUVALID 0x10 > -#define READ_ELEMENT_STATUS_DT_IDVALID 0x20 > -#define READ_ELEMENT_STATUS_DT_NOTBUS 0x80 > - > - u_int8_t dt_scsi_addr; > - > - u_int8_t reserved1; > + union { > + struct { > + u_int8_t dt_scsi_flags; > + > +#define READ_ELEMENT_STATUS_DT_LUNMASK 0x07 > +#define READ_ELEMENT_STATUS_DT_LUVALID 0x10 > +#define READ_ELEMENT_STATUS_DT_IDVALID 0x20 > +#define READ_ELEMENT_STATUS_DT_NOTBUS 0x80 > + > + u_int8_t dt_scsi_addr; > + u_int8_t reserved1; > + } scsi_2; > + > + /* reserved and obsolete (as of SCSI-3) fields */ > + u_int8_t reserved_or_obsolete[3]; > + } dt_or_obsolete; >=20 > u_int8_t flags2; > -#define READ_ELEMENT_STATUS_INVERT 0x40 > -#define READ_ELEMENT_STATUS_SVALID 0x80 > - u_int8_t ssea[2]; /* source storage element = address */ > +#define READ_ELEMENT_STATUS_INVERT 0x40 > +#define READ_ELEMENT_STATUS_SVALID 0x80 > +#define READ_ELEMENT_STATUS_ED 0x80 > +#define READ_ELEMENT_STATUS_MEDIA_TYPE_MASK 0x07 >=20 > - struct volume_tag pvoltag; /* omitted if PVOLTAG =3D=3D 0 = */ > - struct volume_tag avoltag; /* omitted if AVOLTAG =3D=3D 0 = */ > + u_int8_t ssea[2]; /* source storage element = address */ >=20 > - /* Other data may follow */ > + union { > + struct volume_tag pvoltag; > + struct volume_tag voltag[2]; > + struct read_element_status_device_id devid; > + struct { > + struct volume_tag pvoltag; > + struct read_element_status_device_id devid; > + } pvol_and_devid; > + struct { > + struct volume_tag = voltag[2]; > + struct read_element_status_device_id devid; > + } vol_tags_and_devid; > + } voltag_devid; > }; >=20 > /* XXX add data returned by REQUEST VOLUME ELEMENT ADDRESS */ > @@ -457,6 +489,7 @@ void scsi_position_to_element(struct ccb > void scsi_read_element_status(struct ccb_scsiio *csio, u_int32_t = retries, > void (*cbfcnp)(struct cam_periph *, union = ccb *), > u_int8_t tag_action, int voltag, u_int32_t = sea, > + int curdata, int dvcid, > u_int32_t count, u_int8_t *data_ptr, > u_int32_t dxfer_len, u_int8_t sense_len, > u_int32_t timeout); >=20 > Modified: head/sys/sys/chio.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/sys/chio.h Fri Apr 19 19:45:00 2013 = (r249657) > +++ head/sys/sys/chio.h Fri Apr 19 20:03:51 2013 = (r249658) > @@ -152,7 +152,8 @@ typedef enum { > CES_INVERT =3D 0x040, /* invert bit */ > CES_SOURCE_VALID =3D 0x080, /* source address (ces_source) = valid */ > CES_SCSIID_VALID =3D 0x100, /* ces_scsi_id is valid */ > - CES_LUN_VALID =3D 0x200 /* ces_scsi_lun is valid */ > + CES_LUN_VALID =3D 0x200, /* ces_scsi_lun is valid */ > + CES_PIV =3D 0x400 /* ces_protocol_id is valid */ > } ces_status_flags; >=20 > struct changer_element_status { > @@ -181,6 +182,55 @@ struct changer_element_status { > changer_voltag_t ces_avoltag; /* alternate volume = tag */ > u_int8_t ces_scsi_id; /* SCSI id of element = */ > u_int8_t ces_scsi_lun; /* SCSI lun of element = */ > + > + /* > + * Data members for SMC3 and later versions > + */ > + u_int8_t ces_medium_type; > +#define CES_MEDIUM_TYPE_UNKNOWN 0 /* Medium type = unspecified */ > +#define CES_MEDIUM_TYPE_DATA 1 /* Data medium = */ > +#define CES_MEDIUM_TYPE_CLEANING 2 /* Cleaning = medium */ > +#define CES_MEDIUM_TYPE_DIAGNOSTIC 3 /* Diagnostic = medium */ > +#define CES_MEDIUM_TYPE_WORM 4 /* WORM medium = */ > +#define CES_MEDIUM_TYPE_MICROCODE 5 /* Microcode = image medium */ > + > + u_int8_t ces_protocol_id; > +#define CES_PROTOCOL_ID_FCP_4 0 /* Fiber channel */ > +#define CES_PROTOCOL_ID_SPI_5 1 /* Parallel SCSI */ > +#define CES_PROTOCOL_ID_SSA_S3P 2 /* SSA */ > +#define CES_PROTOCOL_ID_SBP_3 3 /* IEEE 1394 */ > +#define CES_PROTOCOL_ID_SRP 4 /* SCSI Remote DMA */ > +#define CES_PROTOCOL_ID_ISCSI 5 /* iSCSI */ > +#define CES_PROTOCOL_ID_SPL 6 /* SAS */ > +#define CES_PROTOCOL_ID_ADT_2 7 /* Automation/Drive = Interface */ > +#define CES_PROTOCOL_ID_ACS_2 8 /* ATA */ > + > + u_int8_t ces_assoc; > +#define CES_ASSOC_LOGICAL_UNIT 0 > +#define CES_ASSOC_TARGET_PORT 1 > +#define CES_ASSOC_TARGET_DEVICE 2 > + > + u_int8_t ces_designator_type; > +#define CES_DESIGNATOR_TYPE_VENDOR_SPECIFIC 0 > +#define CES_DESIGNATOR_TYPE_T10_VENDOR_ID 1 > +#define CES_DESIGNATOR_TYPE_EUI_64 2 > +#define CES_DESIGNATOR_TYPE_NAA 3 > +#define CES_DESIGNATOR_TYPE_TARGET_PORT_ID 4 > +#define CES_DESIGNATOR_TYPE_TARGET_PORT_GRP 5 > +#define CES_DESIGNATOR_TYPE_LOGICAL_UNIT_GRP 6 > +#define CES_DESIGNATOR_TYPE_MD5_LOGICAL_UNIT_ID 7 > +#define CES_DESIGNATOR_TYPE_SCSI_NAME_STRING 8 > + > + u_int8_t ces_code_set; > +#define CES_CODE_SET_RESERVED 0 > +#define CES_CODE_SET_BINARY 1 > +#define CES_CODE_SET_ASCII 2 > +#define CES_CODE_SET_UTF_8 3 > + > + u_int8_t ces_designator_length; > + > +#define CES_MAX_DESIGNATOR_LENGTH (1 << 8) > + u_int8_t ces_designator[CES_MAX_DESIGNATOR_LENGTH = + 1]; > }; >=20 > struct changer_element_status_request { > @@ -189,7 +239,7 @@ struct changer_element_status_request { > u_int16_t cesr_element_count; >=20 > u_int16_t cesr_flags; > -#define CESR_VOLTAGS 0x01 > +#define CESR_VOLTAGS 0x01 >=20 > struct changer_element_status *cesr_element_status; > }; > @@ -200,28 +250,29 @@ struct changer_set_voltag_request { > u_int16_t csvr_addr; >=20 > u_int16_t csvr_flags; > -#define CSVR_MODE_MASK 0x0f /* mode mask, acceptable = modes below: */ > +#define CSVR_MODE_MASK 0x0f /* mode mask, acceptable = modes below: */ > #define CSVR_MODE_SET 0x00 /* set volume tag if not = set */ > -#define CSVR_MODE_REPLACE 0x01 /* unconditionally replace = volume tag */ > -#define CSVR_MODE_CLEAR 0x02 /* clear volume tag */ > +#define CSVR_MODE_REPLACE 0x01 /* unconditionally = replace volume tag */ > +#define CSVR_MODE_CLEAR 0x02 /* clear volume tag */ >=20 > -#define CSVR_ALTERNATE 0x10 /* set to work with = alternate voltag */ > +#define CSVR_ALTERNATE 0x10 /* set to work with = alternate voltag */ >=20 > changer_voltag_t csvr_voltag; > }; >=20 >=20 > -#define CESTATUS_BITS \ > +#define CESTATUS_BITS \ > "\20\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL" >=20 > -#define CHIOMOVE _IOW('c', 0x01, struct changer_move) > -#define CHIOEXCHANGE _IOW('c', 0x02, struct changer_exchange) > -#define CHIOPOSITION _IOW('c', 0x03, struct changer_position) > -#define CHIOGPICKER _IOR('c', 0x04, int) > -#define CHIOSPICKER _IOW('c', 0x05, int) > -#define CHIOGPARAMS _IOR('c', 0x06, struct changer_params) > -#define CHIOIELEM _IOW('c', 0x07, u_int32_t) > -#define CHIOGSTATUS _IOW('c', 0x08, struct = changer_element_status_request) > -#define CHIOSETVOLTAG _IOW('c', 0x09, struct = changer_set_voltag_request) > +#define CHIOMOVE _IOW('c', 0x01, struct changer_move) > +#define CHIOEXCHANGE _IOW('c', 0x02, struct changer_exchange) > +#define CHIOPOSITION _IOW('c', 0x03, struct changer_position) > +#define CHIOGPICKER _IOR('c', 0x04, int) > +#define CHIOSPICKER _IOW('c', 0x05, int) > +#define CHIOGPARAMS _IOR('c', 0x06, struct changer_params) > +#define CHIOIELEM _IOW('c', 0x07, u_int32_t) > +#define OCHIOGSTATUS _IOW('c', 0x08, struct = changer_element_status_request) > +#define CHIOSETVOLTAG _IOW('c', 0x09, struct = changer_set_voltag_request) > +#define CHIOGSTATUS _IOW('c', 0x0A, struct = changer_element_status_request) >=20 > #endif /* !_SYS_CHIO_H_ */ From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 12:36:54 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 162C2A7B; Sat, 20 Apr 2013 12:36:54 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0951E1BD9; Sat, 20 Apr 2013 12:36:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KCarVA014881; Sat, 20 Apr 2013 12:36:53 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KCarTJ014879; Sat, 20 Apr 2013 12:36:53 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201304201236.r3KCarTJ014879@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 20 Apr 2013 12:36:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249697 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 12:36:54 -0000 Author: trasz Date: Sat Apr 20 12:36:53 2013 New Revision: 249697 URL: http://svnweb.freebsd.org/changeset/base/249697 Log: Make DELAY(9) reference pause(9). Modified: head/share/man/man9/DELAY.9 Modified: head/share/man/man9/DELAY.9 ============================================================================== --- head/share/man/man9/DELAY.9 Sat Apr 20 11:46:38 2013 (r249696) +++ head/share/man/man9/DELAY.9 Sat Apr 20 12:36:53 2013 (r249697) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 21, 2000 +.Dd April 20, 2013 .Dt DELAY 9 .Os .Sh NAME @@ -42,6 +42,8 @@ Delay for .Fa delay microseconds (1/1000000th of a second). +.Sh SEE ALSO +.Xr pause 9 .Sh AUTHORS This manual page was written by .An Alfred Perlstein . From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 12:41:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4A064C00; Sat, 20 Apr 2013 12:41:06 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 236EF1BE6; Sat, 20 Apr 2013 12:41:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KCf6Ua020537; Sat, 20 Apr 2013 12:41:06 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KCf6l5020535; Sat, 20 Apr 2013 12:41:06 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201304201241.r3KCf6l5020535@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 20 Apr 2013 12:41:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249698 - head/bin/df X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 12:41:06 -0000 Author: uqs Date: Sat Apr 20 12:41:05 2013 New Revision: 249698 URL: http://svnweb.freebsd.org/changeset/base/249698 Log: bin/df: Fix unitialized use in prtstat While here: - use NULL in the context of pointers - use memset instead of bzero throughout the file - free memory to appease clang static analyzer Found by: Coverity Scan (the UNINIT one) Modified: head/bin/df/df.c Modified: head/bin/df/df.c ============================================================================== --- head/bin/df/df.c Sat Apr 20 12:36:53 2013 (r249697) +++ head/bin/df/df.c Sat Apr 20 12:41:05 2013 (r249698) @@ -114,6 +114,7 @@ main(int argc, char *argv[]) fstype = "ufs"; (void)setlocale(LC_ALL, ""); + memset(&maxwidths, 0, sizeof(maxwidths)); memset(&totalbuf, 0, sizeof(totalbuf)); totalbuf.f_bsize = DEV_BSIZE; strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN); @@ -200,7 +201,7 @@ main(int argc, char *argv[]) } else { /* just the filesystems specified on the command line */ mntbuf = malloc(argc * sizeof(*mntbuf)); - if (mntbuf == 0) + if (mntbuf == NULL) err(1, "malloc()"); mntsize = 0; /* continued in for loop below */ @@ -209,13 +210,13 @@ main(int argc, char *argv[]) /* iterate through specified filesystems */ for (; *argv; argv++) { if (stat(*argv, &stbuf) < 0) { - if ((mntpt = getmntpt(*argv)) == 0) { + if ((mntpt = getmntpt(*argv)) == NULL) { warn("%s", *argv); rv = 1; continue; } } else if (S_ISCHR(stbuf.st_mode)) { - if ((mntpt = getmntpt(*argv)) == 0) { + if ((mntpt = getmntpt(*argv)) == NULL) { mdev.fspec = *argv; mntpath = strdup("/tmp/df.XXXXXX"); if (mntpath == NULL) { @@ -282,7 +283,7 @@ main(int argc, char *argv[]) mntbuf[mntsize++] = statfsbuf; } - bzero(&maxwidths, sizeof(maxwidths)); + memset(&maxwidths, 0, sizeof(maxwidths)); for (i = 0; i < mntsize; i++) { if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0) { update_maxwidths(&maxwidths, &mntbuf[i]); @@ -295,6 +296,7 @@ main(int argc, char *argv[]) prtstat(&mntbuf[i], &maxwidths); if (cflag) prtstat(&totalbuf, &maxwidths); + free(mntbuf); return (rv); } @@ -309,7 +311,7 @@ getmntpt(const char *name) if (!strcmp(mntbuf[i].f_mntfromname, name)) return (mntbuf[i].f_mntonname); } - return (0); + return (NULL); } /* From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 14:33:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3B3CAA12; Sat, 20 Apr 2013 14:33:56 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2CA6A1F60; Sat, 20 Apr 2013 14:33:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KEXuYN041939; Sat, 20 Apr 2013 14:33:56 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KEXufn041937; Sat, 20 Apr 2013 14:33:56 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201304201433.r3KEXufn041937@svn.freebsd.org> From: "Kenneth D. Merry" Date: Sat, 20 Apr 2013 14:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249701 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 14:33:56 -0000 Author: ken Date: Sat Apr 20 14:33:55 2013 New Revision: 249701 URL: http://svnweb.freebsd.org/changeset/base/249701 Log: Fix compilation. Pointy hat to: ken Modified: head/sys/cam/scsi/scsi_ch.c Modified: head/sys/cam/scsi/scsi_ch.c ============================================================================== --- head/sys/cam/scsi/scsi_ch.c Sat Apr 20 14:01:22 2013 (r249700) +++ head/sys/cam/scsi/scsi_ch.c Sat Apr 20 14:33:55 2013 (r249701) @@ -1147,15 +1147,11 @@ copy_element_status(struct ch_softc *sof ces->ces_designator_length = devid->designator_length; /* * Make sure we are always NUL terminated. The - * buffer should be sized for the maximum - * designator length plus 1, but this will make sure - * there is always a NUL at the end. This won't - * matter for the binary code set, since the user - * will only pay attention to the length field. + * This won't matter for the binary code set, + * since the user will only pay attention to the + * length field. */ - ces->ces_designator[ - MIN(sizeof(ces->ces_designator) - 1, - devid->designator_length)]= '\0'; + ces->ces_designator[devid->designator_length]= '\0'; } if (devid->piv_assoc_designator_type & READ_ELEMENT_STATUS_PIV_SET) { From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 14:37:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 81D48BBC; Sat, 20 Apr 2013 14:37:04 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id 396E41F71; Sat, 20 Apr 2013 14:37:03 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id r3KEb0eh044335; Sat, 20 Apr 2013 08:37:00 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id r3KEb0AV044334; Sat, 20 Apr 2013 08:37:00 -0600 (MDT) (envelope-from ken) Date: Sat, 20 Apr 2013 08:37:00 -0600 From: "Kenneth D. Merry" To: Warner Losh Subject: Re: svn commit: r249658 - in head: bin/chio sys/cam/scsi sys/sys Message-ID: <20130420143700.GA44286@nargothrond.kdm.org> References: <201304192003.r3JK3qFB013463@svn.freebsd.org> <82451AEC-79FD-448F-B180-C2CEC47EB18B@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <82451AEC-79FD-448F-B180-C2CEC47EB18B@bsdimp.com> User-Agent: Mutt/1.4.2i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 14:37:04 -0000 On Sat, Apr 20, 2013 at 05:45:43 -0600, Warner Losh wrote: > Hey Ken, > > this change doesn't compile for me. See below > > Warner > > On Apr 19, 2013, at 2:03 PM, Kenneth D. Merry wrote: [ ...] > > + ces->ces_designator_length = devid->designator_length; > > + /* > > + * Make sure we are always NUL terminated. The > > + * buffer should be sized for the maximum > > + * designator length plus 1, but this will make sure > > + * there is always a NUL at the end. This won't > > + * matter for the binary code set, since the user > > + * will only pay attention to the length field. > > + */ > > + ces->ces_designator[ > > + MIN(sizeof(ces->ces_designator) - 1, > > + devid->designator_length)]= '\0'; > > compiler complains here that this comparison is always false due to data ranges. I hacked it in my copy by always using devid->designator_length, but I know that's a lame fix. Can you look into it? > Not sure what happened there. Different warns levels on different architectures? In any case, I put in the same fix you did until I can figure out a better way to do it. (Hard to type with a toddler on your lap. :) Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 14:44:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9DF84F42; Sat, 20 Apr 2013 14:44:29 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9019F1F93; Sat, 20 Apr 2013 14:44:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KEiTLe051096; Sat, 20 Apr 2013 14:44:29 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KEiTr7051092; Sat, 20 Apr 2013 14:44:29 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201304201444.r3KEiTr7051092@svn.freebsd.org> From: Ed Schouten Date: Sat, 20 Apr 2013 14:44:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249702 - in head: gnu/lib/libgcc lib/libcompiler_rt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 14:44:29 -0000 Author: ed Date: Sat Apr 20 14:44:28 2013 New Revision: 249702 URL: http://svnweb.freebsd.org/changeset/base/249702 Log: Enable libcompiler-rt on MIPS. Originally we disabled libcompiler-rt on MIPS and SPARC64, because of an issue where __clzdi2 and __ctzdi2 would cause endless recursion. This bug has been fixed in r230021 already, but for some reason we only switched to libcompiler-rt on SPARC64 -- not MIPS. This means we can finally use on all our architectures. Modified: head/gnu/lib/libgcc/Makefile head/lib/libcompiler_rt/Makefile Modified: head/gnu/lib/libgcc/Makefile ============================================================================== --- head/gnu/lib/libgcc/Makefile Sat Apr 20 14:33:55 2013 (r249701) +++ head/gnu/lib/libgcc/Makefile Sat Apr 20 14:44:28 2013 (r249702) @@ -19,10 +19,6 @@ MK_SSP= no CFLAGS+= -DTARGET_ARM_EABI .endif -.if ${TARGET_CPUARCH} == "mips" -LIB= gcc -.endif - .PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}/config ${GCCDIR} CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ Modified: head/lib/libcompiler_rt/Makefile ============================================================================== --- head/lib/libcompiler_rt/Makefile Sat Apr 20 14:33:55 2013 (r249701) +++ head/lib/libcompiler_rt/Makefile Sat Apr 20 14:44:28 2013 (r249702) @@ -196,13 +196,11 @@ SRCS+= aeabi_idivmod.S \ aeabi_uldivmod.S .endif -.if ${MACHINE_CPUARCH} != "mips" -. if ${MK_INSTALLLIB} != "no" +.if ${MK_INSTALLLIB} != "no" SYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a -. endif -. if ${MK_PROFILE} != "no" +.endif +.if ${MK_PROFILE} != "no" SYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a -. endif .endif .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 15:37:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 19F50F9; Sat, 20 Apr 2013 15:37:35 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0C4751AD; Sat, 20 Apr 2013 15:37:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KFbYbn088265; Sat, 20 Apr 2013 15:37:34 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KFbYIk088263; Sat, 20 Apr 2013 15:37:34 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201304201537.r3KFbYIk088263@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 20 Apr 2013 15:37:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249704 - head/usr.bin/gcore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 15:37:35 -0000 Author: trociny Date: Sat Apr 20 15:37:33 2013 New Revision: 249704 URL: http://svnweb.freebsd.org/changeset/base/249704 Log: Wrong cast. MFC after: 1 month Modified: head/usr.bin/gcore/elfcore.c Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Sat Apr 20 14:55:48 2013 (r249703) +++ head/usr.bin/gcore/elfcore.c Sat Apr 20 15:37:33 2013 (r249704) @@ -634,8 +634,7 @@ static void * elf_note_procstat_groups(void *arg, size_t *sizep) { - return (procstat_sysctl(arg, KERN_PROC_GROUPS, - (int)sizeof(gid_t), sizep)); + return (procstat_sysctl(arg, KERN_PROC_GROUPS, sizeof(gid_t), sizep)); } static void * From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 22:16:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ECB065AB; Sat, 20 Apr 2013 22:16:49 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DF335109C; Sat, 20 Apr 2013 22:16:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KMGnlx060974; Sat, 20 Apr 2013 22:16:49 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KMGntw060973; Sat, 20 Apr 2013 22:16:49 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201304202216.r3KMGntw060973@svn.freebsd.org> From: Joel Dahl Date: Sat, 20 Apr 2013 22:16:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249711 - head/lib/libprocstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 22:16:50 -0000 Author: joel (doc committer) Date: Sat Apr 20 22:16:49 2013 New Revision: 249711 URL: http://svnweb.freebsd.org/changeset/base/249711 Log: mdoc: end function context properly. Modified: head/lib/libprocstat/libprocstat.3 Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Apr 20 19:13:56 2013 (r249710) +++ head/lib/libprocstat/libprocstat.3 Sat Apr 20 22:16:49 2013 (r249711) @@ -65,7 +65,6 @@ .In libprocstat.h .Ft void .Fn procstat_close "struct procstat *procstat" -.Fc .Ft void .Fo procstat_freeargv .Fa "struct procstat *procstat" @@ -167,6 +166,7 @@ .Fa "struct procstat *procstat" .Fa "struct kinfo_proc *kp" .Fa "unsigned int *count" +.Fc .Ft int .Fo procstat_getosrel .Fa "struct procstat *procstat" From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 22:26:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8B7F27B5; Sat, 20 Apr 2013 22:26:34 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7A13610D2; Sat, 20 Apr 2013 22:26:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KMQYLi067340; Sat, 20 Apr 2013 22:26:34 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KMQYsJ067339; Sat, 20 Apr 2013 22:26:34 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201304202226.r3KMQYsJ067339@svn.freebsd.org> From: Joel Dahl Date: Sat, 20 Apr 2013 22:26:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249712 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 22:26:34 -0000 Author: joel (doc committer) Date: Sat Apr 20 22:26:33 2013 New Revision: 249712 URL: http://svnweb.freebsd.org/changeset/base/249712 Log: Add missing Pp. Also remove some minor whitespace. PR: 177995 Submitted by: olgeni Modified: head/share/man/man4/syscons.4 Modified: head/share/man/man4/syscons.4 ============================================================================== --- head/share/man/man4/syscons.4 Sat Apr 20 22:16:49 2013 (r249711) +++ head/share/man/man4/syscons.4 Sat Apr 20 22:26:33 2013 (r249712) @@ -471,9 +471,9 @@ device atkbdc device atkbd device vga device sc - device splash .Ed +.Pp You also need the following lines in .Pa /boot/device.hints for these drivers. From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 22:46:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 45883D58; Sat, 20 Apr 2013 22:46:32 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 370511168; Sat, 20 Apr 2013 22:46:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KMkVUU080385; Sat, 20 Apr 2013 22:46:31 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KMkVeS080383; Sat, 20 Apr 2013 22:46:31 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201304202246.r3KMkVeS080383@svn.freebsd.org> From: Adrian Chadd Date: Sat, 20 Apr 2013 22:46:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249713 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 22:46:32 -0000 Author: adrian Date: Sat Apr 20 22:46:31 2013 New Revision: 249713 URL: http://svnweb.freebsd.org/changeset/base/249713 Log: There's some races (likely in the BAR handling, sigh) which is causing the pause/resume code to not be called completely symmetrically. I'll chase down the root cause of that soon; this at least works around the bug and tells me when it happens. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Sat Apr 20 22:26:33 2013 (r249712) +++ head/sys/dev/ath/if_ath_tx.c Sat Apr 20 22:46:31 2013 (r249713) @@ -2976,7 +2976,19 @@ ath_tx_tid_resume(struct ath_softc *sc, { ATH_TX_LOCK_ASSERT(sc); - tid->paused--; + /* + * There's some odd places where ath_tx_tid_resume() is called + * when it shouldn't be; this works around that particular issue + * until it's actually resolved. + */ + if (tid->paused == 0) { + device_printf(sc->sc_dev, "%s: %6D: paused=0?\n", + __func__, + tid->an->an_node.ni_macaddr, + ":"); + } else { + tid->paused--; + } DPRINTF(sc, ATH_DEBUG_SW_TX_CTRL, "%s: unpaused = %d\n", __func__, tid->paused); From owner-svn-src-head@FreeBSD.ORG Sat Apr 20 23:33:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 50E1D68C; Sat, 20 Apr 2013 23:33:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 280A312C8; Sat, 20 Apr 2013 23:33:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KNXqdM012498; Sat, 20 Apr 2013 23:33:52 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KNXqSN012497; Sat, 20 Apr 2013 23:33:52 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201304202333.r3KNXqSN012497@svn.freebsd.org> From: Warner Losh Date: Sat, 20 Apr 2013 23:33:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249714 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 23:33:52 -0000 Author: imp Date: Sat Apr 20 23:33:51 2013 New Revision: 249714 URL: http://svnweb.freebsd.org/changeset/base/249714 Log: Add more details about updating across the clang divide. Add hints about having a root shell around on live updates. Couple of additional nits. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Apr 20 22:46:31 2013 (r249713) +++ head/UPDATING Sat Apr 20 23:33:51 2013 (r249714) @@ -12,9 +12,9 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. NOTE: FreeBSD has switched from gcc to clang. If you have trouble bootstrapping -from older versions of FreeBSD, try WITHOUT_CLANG and WITHOUT_CLANG_IS_CC to -bootstrap to tip of head, and then rebuild without those options. The bootstrap -process from older version of current is a bit fragile. +from older versions of FreeBSD, try WITHOUT_CLANG to bootstrap to tip of +head, and then rebuild without this option. The bootstrap process from +older version of current is a bit fragile. NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW: FreeBSD 10.x has many debugging features turned on, in both the kernel @@ -127,7 +127,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 This means that the world and kernel will be compiled with clang and that clang will be installed as /usr/bin/cc, /usr/bin/c++, and /usr/bin/cpp. To disable this behavior and revert to building - with gcc, compile with WITHOUT_CLANG_IS_CC. + with gcc, compile with WITHOUT_CLANG_IS_CC. Really old versions + of current may need to bootstrap WITHOUT_CLANG first if the clang + build fails (its compatibility window doesn't extend to the 9 stable + branch point). 20121102: The IPFIREWALL_FORWARD kernel option has been removed. Its @@ -1609,6 +1612,11 @@ COMMON ITEMS: path, and has the highest probability of being successful. Please try this approach before reporting problems with a major version upgrade. + When upgrading a life system, having a root shell around before + installing anything can help undo problems. Not having a root shell + around can lead to problems if pam has changed too much from your + starting point to allow continued authentication after the upgrade. + ZFS notes --------- When upgrading the boot ZFS pool to a new version, always follow @@ -1674,7 +1682,6 @@ COMMON ITEMS: make delete-old [6] - To cross-install current onto a separate partition -------------------------------------------------- # In this approach we use a separate partition to hold