From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 00:20:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 653A9BC5; Sun, 16 Dec 2012 00:20:17 +0000 (UTC) (envelope-from gonzo@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 4A6BE8FC0A; Sun, 16 Dec 2012 00:20:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBG0KHGs065144; Sun, 16 Dec 2012 00:20:17 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBG0KHDL065143; Sun, 16 Dec 2012 00:20:17 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201212160020.qBG0KHDL065143@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 16 Dec 2012 00:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244281 - head/sys/arm/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 00:20:17 -0000 Author: gonzo Date: Sun Dec 16 00:20:16 2012 New Revision: 244281 URL: http://svnweb.freebsd.org/changeset/base/244281 Log: Fix comment to represent actual file purpose Spotted by: gavin@ Modified: head/sys/arm/conf/VERSATILEPB Modified: head/sys/arm/conf/VERSATILEPB ============================================================================== --- head/sys/arm/conf/VERSATILEPB Sat Dec 15 22:26:16 2012 (r244280) +++ head/sys/arm/conf/VERSATILEPB Sun Dec 16 00:20:16 2012 (r244281) @@ -1,4 +1,4 @@ -# RPI-B -- Custom configuration for the Raspberry Pi +# VERSATILEPB - Configuration for QEMU version of Versatile Platform Board # # For more information on this file, please read the handbook section on # Kernel Configuration Files: From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 01:00:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4FCCF33E; Sun, 16 Dec 2012 01:00:41 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 827818FC13; Sun, 16 Dec 2012 01:00:40 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so5845014vba.13 for ; Sat, 15 Dec 2012 17:00:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=VGxfAbtz5D3WwMIGSI6I7SP6cdQJ7K1Cx7GjdMqiL9M=; b=LMt2h+Em35GWU6FUmiZit4bDrDR7zTk3j5QhHNgg+avpCoB3X5lBJQ0k42phWnLa+T M5okyMXyY4gNHdistf4r26PdrUsHO/0tqcYYP+9TEK0bHdlh9Le9Dj5z/KjmfOwc+J0a 57uf2QbhT5m5rgEdQYmzedFO+jeW22MxusAzNa6cSGIk3SfAYQS9/DARQLADvql8a+Da WZbADSiSSrnqrRx0dXWEayno1cd32CtSctf/Chg+nxUhEVGVLfL7PbFy9V8QH7gieDa/ BMcICfaBW5JFoHJM9mbtNz2VoROLH2Qfa+4/93OD5V2FZ3uIFNJn+muS0NXQ2DXyRHZU q6rA== MIME-Version: 1.0 Received: by 10.59.13.135 with SMTP id ey7mr17000743ved.37.1355619639960; Sat, 15 Dec 2012 17:00:39 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.58.201.202 with HTTP; Sat, 15 Dec 2012 17:00:39 -0800 (PST) In-Reply-To: <201212151821.qBFILAOP013123@svn.freebsd.org> References: <201212151821.qBFILAOP013123@svn.freebsd.org> Date: Sat, 15 Dec 2012 17:00:39 -0800 X-Google-Sender-Auth: WV9Ot631vuLmRivhbe1R1eAxB8I Message-ID: Subject: Re: svn commit: r244271 - head/usr.sbin/iostat From: Adrian Chadd To: Mikolaj Golub 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 01:00:41 -0000 Hi, People may have scripts based on the current output. You should have introduced a new parameter which modifies the output behaviour in the way you wanted, rather than modifying the existing behaviour. Please consider reverting your change (which is a good idea, btw) and adding a new modifier that outputs the value(s), rather than a %age. Adrian On 15 December 2012 10:21, Mikolaj Golub wrote: > Author: trociny > Date: Sat Dec 15 18:21:09 2012 > New Revision: 244271 > URL: http://svnweb.freebsd.org/changeset/base/244271 > > Log: > Change `iostat -Ix` to display total duration of transactions instead > of average duration, and total busy time instead of %. > > This looks more useful when one runs `iostat -Ix` periodically to > collect statistics: e.g. now it is possible to calculate busy % > between two runs subtracting total busy times and dividing per time > period. > > Average duration and % busy are still available via `iostat -x`. > > Modified: > head/usr.sbin/iostat/iostat.8 > head/usr.sbin/iostat/iostat.c > > Modified: head/usr.sbin/iostat/iostat.8 > ============================================================================== > --- head/usr.sbin/iostat/iostat.8 Sat Dec 15 18:19:48 2012 (r244270) > +++ head/usr.sbin/iostat/iostat.8 Sat Dec 15 18:21:09 2012 (r244271) > @@ -56,7 +56,7 @@ > .\" > .\" @(#)iostat.8 8.1 (Berkeley) 6/6/93 > .\" > -.Dd November 24, 2010 > +.Dd December 15, 2012 > .Dt IOSTAT 8 > .Os > .Sh NAME > @@ -366,6 +366,32 @@ average duration of transactions, in mil > % of time the device had one or more outstanding transactions > .El > .Pp > +The extended > +.Nm > +device display, with the > +.Fl x > +and > +.Fl I > +flags specified, shows the following statistics: > +.Pp > +.Bl -tag -width indent -compact > +.It r/i > +read operations per time period > +.It w/i > +write operations per time period > +.It kr/i > +kilobytes read per time period > +.It kw/i > +kilobytes write per time period > +.It qlen > +transactions queue length > +.It tsvc_t/i > +total duration of transactions per time period, in seconds > +.It sb/i > +total time the device had one or more outstanding transactions per > +time period, in seconds > +.El > +.Pp > The old-style > .Nm > display (using > > Modified: head/usr.sbin/iostat/iostat.c > ============================================================================== > --- head/usr.sbin/iostat/iostat.c Sat Dec 15 18:19:48 2012 (r244270) > +++ head/usr.sbin/iostat/iostat.c Sat Dec 15 18:21:09 2012 (r244271) > @@ -731,10 +731,10 @@ devstats(int perf_select, long double et > u_int64_t total_bytes, total_transfers, total_blocks; > u_int64_t total_bytes_read, total_transfers_read; > u_int64_t total_bytes_write, total_transfers_write; > - long double busy_pct; > + long double busy_pct, busy_time; > u_int64_t queue_len; > long double total_mb; > - long double blocks_per_second, ms_per_transaction; > + long double blocks_per_second, ms_per_transaction, total_duration; > int firstline = 1; > char *devname; > > @@ -745,14 +745,13 @@ devstats(int perf_select, long double et > if (Cflag > 0) > printf(" cpu "); > printf("\n"); > - if (Iflag == 0) > - printf( > - "device r/s w/s kr/s kw/s qlen svc_t %%b " > - ); > - else > - printf( > - "device r/i w/i kr/i kw/i qlen svc_t %%b " > - ); > + if (Iflag == 0) { > + printf("device r/s w/s kr/s kw/s qlen " > + "svc_t %%b "); > + } else { > + printf("device r/i w/i kr/i" > + " kw/i qlen tsvc_t/i sb/i "); > + } > if (Tflag > 0) > printf("tin tout "); > if (Cflag > 0) > @@ -789,6 +788,8 @@ devstats(int perf_select, long double et > DSM_MS_PER_TRANSACTION, &ms_per_transaction, > DSM_BUSY_PCT, &busy_pct, > DSM_QUEUE_LENGTH, &queue_len, > + DSM_TOTAL_DURATION, &total_duration, > + DSM_TOTAL_BUSY_TIME, &busy_time, > DSM_NONE) != 0) > errx(1, "%s", devstat_errbuf); > > @@ -827,7 +828,9 @@ devstats(int perf_select, long double et > queue_len, > ms_per_transaction, busy_pct); > else > - printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4" PRIu64 " %5.1Lf %3.0Lf ", > + printf("%-8.8s %11.1Lf %11.1Lf " > + "%12.1Lf %12.1Lf %4" PRIu64 > + " %10.1Lf %9.1Lf ", > devname, > (long double)total_transfers_read, > (long double)total_transfers_write, > @@ -836,7 +839,7 @@ devstats(int perf_select, long double et > (long double) > total_bytes_write / 1024, > queue_len, > - ms_per_transaction, busy_pct); > + total_duration, busy_time); > if (firstline) { > /* > * If this is the first device From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 04:07:35 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 648C7A29; Sun, 16 Dec 2012 04:07:35 +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 AD5EE8FC0A; Sun, 16 Dec 2012 04:07:33 +0000 (UTC) Received: from server.rulingia.com (c220-239-237-241.belrs5.nsw.optusnet.com.au [220.239.237.241]) by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id qBG47QqQ028923 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 16 Dec 2012 15:07:26 +1100 (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 qBG47H0H030144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 16 Dec 2012 15:07:18 +1100 (EST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.5/8.14.5/Submit) id qBG47HiU030143; Sun, 16 Dec 2012 15:07:17 +1100 (EST) (envelope-from peter) Date: Sun, 16 Dec 2012 15:07:17 +1100 From: Peter Jeremy To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r244112 - head/sys/kern Message-ID: <20121216040717.GG35245@server.rulingia.com> References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212121046.43706.jhb@freebsd.org> <201212121658.49048.jhb@freebsd.org> <50C90567.8080406@FreeBSD.org> <50C909BD.9090709@mu.org> <50C91B32.4080904@FreeBSD.org> <20121215205202.GF1411@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JgQwtEuHJzHdouWu" Content-Disposition: inline In-Reply-To: <20121215205202.GF1411@garage.freebsd.pl> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 04:07:35 -0000 --JgQwtEuHJzHdouWu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [pruning the CC list] On 2012-Dec-15 21:52:03 +0100, Pawel Jakub Dawidek wrote: >On Wed, Dec 12, 2012 at 04:02:58PM -0800, Navdeep Parhar wrote: >> A KASSERT() really is for a condition that should never happen. and can't be practically recovered from. >I have sort of mixed feelings about this change, but in reality we have >three cases: > >1. Fatal conditions that shouldn't happen, but may happen for some > reason and we definiately want to stop running (corrupted file system > metadata that can mess up the file system more badly). For those we have > direct panic(9) calls. > >2. Fatal conditions that cannot happen and for those we have KASSERT(9). I don't see the difference between these two cases. In both of them, the system has entered a state that the designer/programmer didn't envisage and can't recover from. The best option is to abort as quickly to minimise further corruption. >3. Non-fatal conditions that cannot happen, which we have no way to > report more gracefully and we do it through KASSERT(9). "Cannot" needs to be quoted here because you can't hit them unless they actually do happen. And: 4. Unexpected conditions that should be non-fatal but no-one has written the code to recover so someone has included a KASSERT(9) as a place-holder. I suspect a lot of the heat in this discussion is associated with points 3 & 4 - unexpected conditions that the code can't cope with. >It is annoying to run INVARIANTS kernel and trigger 3. I had this >problem few times, for example in TCP/IP stack. It turned out to be >non-fatal and KASSERT(9) was there to understand the code better. >I'd much prefer to see it logged than to panic my box. Of course it is >also sometimes hard to judge if it is fatal or not. > >I use plenty of assertions in my code to catch bugs early, but >assertions like any other part of the code might have bugs and during >rapid development they help a lot when the code around is changing a lot >and some earlier assumptions are no longer valid. Many of those >assertions are non-fatal. IMHO, having lots of assertions (ala design-by-contract) can make it easier to understand a function's interfaces. Of course, if there are errors in the interface conditions, you can wind up with spurious panic()s. >For me this problem is pretty complex, because: > >1. It would be nice to have a macro to test non-fatal conditions, This should be fairly trivial to implement - test the specified condition and if it's false print out a rate-limited message and backtrace. > but it > is hard to tell sometimes if it is fatal or not. As a rule of thumb, if the code can't handle the condition not being met then it's fatal - this includes my point 4 above. If the code can recover (which may require it to take drastic action like aborting a process or closing a socket) then it's not fatal. OTOH, IMHO, not holding an expected lock _is_ fatal, even if there's no immediately obvious downside to just continuing. >3. Logging non-fatal "assertions" might make them go unnoticed, but we > currently don't enable kernel dumps by default, so when panic occurs > user has no idea what has happend, especially if he is in X. Logging > would give better chance to actually notice the problem currently. Rebooting does mean that we restore the system to a sane state, even if we don't record the previous state. >In my opinion we should do the following: > >1. Leave the option to make KASSERTs non-fatal, but log big fat warning > that this is development feature and should not be used in production. I disagree with this but not strongly enough to say it should be backed out. IMHO, an active KASSERT() should be fatal. >2. Introduce handy macro that would log the problem, but won't panic the > box for non-fatal conditions, just like we do with LORs. Agreed. >3. Enable kernel dumps by default. The main obstacle to do that was lack > of a way to limit number of kernel dumps, which could lead to filling > /var/ after hitting some panic/reboot cycle. I agree that it's reasonable to enable crashdumps by default. Note that /var/crash/minfree is supposed to stop /var filling up. >My contribution to solve this is implementation of 3: > http://people.freebsd.org/~pjd/patches/savecore.patch Adding a "maxdumps" parameter seems a good idea. The behaviour when it hits the limit is less clear - throwing away the latest crashdump is probably as easy to justify as throwing away the oldest one. A further downside to enabling crashdumps is the time overhead - initially writing the dump, copying it to /var/crash and running crashinfo. This all directly increases the length of the outage. --=20 Peter Jeremy --JgQwtEuHJzHdouWu Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlDNSPQACgkQ/opHv/APuIdZvwCgtapsSSdtUfzuzuHhUI/O+j5O 5FQAn2Ua9j5BtgC8F90i5a2WewS+jHg5 =aOF4 -----END PGP SIGNATURE----- --JgQwtEuHJzHdouWu-- From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 04:36:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B94541D7 for ; Sun, 16 Dec 2012 04:36:43 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 536F78FC0A for ; Sun, 16 Dec 2012 04:36:43 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so5924318vba.13 for ; Sat, 15 Dec 2012 20:36:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=f3g9ZRLCVXopTQlG2P1y0QTs9UYUKnjEErjOJ1/vfv4=; b=kAhmQr7U7lP3O1bbwxS1JWmFcAqTYGIIxDZEu1Y49k23WZ8CmckCdkZXpivUYq4Q2Z cA63WBjRtRQq4HFFmzA/BxRTs0n7IbrlKcE5j8/IkWNWWDBpWUYNCv5gtMC0C3BbAbrt 2hCJ0lt/XqWbHYWf7QWybUF36/FewlZzZIiSY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=f3g9ZRLCVXopTQlG2P1y0QTs9UYUKnjEErjOJ1/vfv4=; b=Re62fp1181KVR+xz2AUQYUAEOkAYvIO+f88tqH0asWKsOfg3KzF4SlPTU1GyArRTMe yN/XHNea+M5exhxwIzq/5IPFsks8uoVKriKRB347dEDEI1fIG6UaTN/WHb3wud+GhMGW KMxRN9OgOM1JcYpLkPNtuWqPNAvCt/Jj1AOVsib/SAuNMsSHsvjt/l7DF8XQet4P06bq qyvoKGaIq9ZgE4CCieVJJ5pOw8GzoioacggdA3PcfbeluQZVT17YnbYoZedNWUpH1ixF au6VPLHzEiJIJT7mvQtbM1h8+m6TBTka2Pw3MgtRJRkMCBwSzjNe0JzRi9V6xOdqW72K 7DiQ== MIME-Version: 1.0 Received: by 10.52.20.108 with SMTP id m12mr62018vde.11.1355632602618; Sat, 15 Dec 2012 20:36:42 -0800 (PST) Received: by 10.220.38.71 with HTTP; Sat, 15 Dec 2012 20:36:42 -0800 (PST) In-Reply-To: <20121216040717.GG35245@server.rulingia.com> References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212121046.43706.jhb@freebsd.org> <201212121658.49048.jhb@freebsd.org> <50C90567.8080406@FreeBSD.org> <50C909BD.9090709@mu.org> <50C91B32.4080904@FreeBSD.org> <20121215205202.GF1411@garage.freebsd.pl> <20121216040717.GG35245@server.rulingia.com> Date: Sat, 15 Dec 2012 20:36:42 -0800 Message-ID: Subject: Re: svn commit: r244112 - head/sys/kern From: Peter Wemm To: Peter Jeremy Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmhUZ7ZUBeqlqXUQ7TxBXiE5GE1WoZ2zk1aQCHfczs8MQU3PhIlf9XCKyHqi0+YvcFFoCYI Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 04:36:43 -0000 On Sat, Dec 15, 2012 at 8:07 PM, Peter Jeremy wrote: > [pruning the CC list] > On 2012-Dec-15 21:52:03 +0100, Pawel Jakub Dawidek wrote: >>On Wed, Dec 12, 2012 at 04:02:58PM -0800, Navdeep Parhar wrote: >>> A KASSERT() really is for a condition that should never happen. > > and can't be practically recovered from. > >>I have sort of mixed feelings about this change, but in reality we have >>three cases: >> >>1. Fatal conditions that shouldn't happen, but may happen for some >> reason and we definiately want to stop running (corrupted file system >> metadata that can mess up the file system more badly). For those we have >> direct panic(9) calls. >> >>2. Fatal conditions that cannot happen and for those we have KASSERT(9). > > I don't see the difference between these two cases. In both of them, > the system has entered a state that the designer/programmer didn't > envisage and can't recover from. The best option is to abort as > quickly to minimise further corruption. Actually it was a pretty good description of the situation as it existed for the last N years (where N > 10). Back in the early days we had #ifdef DIAGNOSTIC which was a general catch-all bucket to put anything remotely related to diagnostic code. The problem was that it gathered so much debugging code that so much was changed by all the added code that it was usually the case that a DIAGNOSTIC kernel added new problems, if it even booted at all. It had everything from extra functions that existed just for ddb's benefit through extra assertions. There was also the problem that there was no knob to compile in things you could call from ddb to check the state of things as it was all in one lump. That lead to the great DIAGNOSTIC -> INVARIANTS / INVARIANT_SUPPORT split. INVARIANTS was for extra assertions, and INVARIANT_SUPPORT was ddb callable functions and code for INVARIANTS assertions to call. panic remained for fatal conditions, while INVARIANTS (and KASSERT) were introduced to add additional non-invasive sanity checks to detect things that were going off into the weeds before too big a mess was made. The point of KASSERT was that it was something you could turn on during development and/or or while trying to get a look at a problem sooner in DDB before things got too messed up. It was an early warning to get you into ddb faster/sooner. We were not supposed to need it on during production use because it was for the kinds of problems that would be detected later via other means. eg: a panic or a trap. eg: one of the earlier uses was checking priorities before beginning a context switch. If you had an invalid priority state, you could get fairly deep into mi_switch() before a run queue slot was unable to be found. But by the time that happened, the context switch code had changed things a lot before it reached that fatal condition. So we'd add a KASSERT at the start so we could get into DDB before we'd started messing with run queues and had a better chance at seeing how we got into the mess. I must say I'm rather concerned about the direction of recent changes in this area. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 05:01:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ACF4D670; Sun, 16 Dec 2012 05:01:16 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id E5D938FC15; Sun, 16 Dec 2012 05:01:02 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.5/8.14.5) with ESMTP id qBG511fI073324; Sat, 15 Dec 2012 22:01:01 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id qBG50bL3061027; Sat, 15 Dec 2012 22:00:37 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Subject: Re: svn commit: r244112 - head/sys/kern From: Ian Lepore To: Peter Wemm In-Reply-To: References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212121046.43706.jhb@freebsd.org> <201212121658.49048.jhb@freebsd.org> <50C90567.8080406@FreeBSD.org> <50C909BD.9090709@mu.org> <50C91B32.4080904@FreeBSD.org> <20121215205202.GF1411@garage.freebsd.pl> <20121216040717.GG35245@server.rulingia.com> Content-Type: text/plain; charset="us-ascii" Date: Sat, 15 Dec 2012 22:00:37 -0700 Message-ID: <1355634037.1198.115.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Jeremy X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 05:01:16 -0000 On Sat, 2012-12-15 at 20:36 -0800, Peter Wemm wrote: > On Sat, Dec 15, 2012 at 8:07 PM, Peter Jeremy wrote: > > [pruning the CC list] > > On 2012-Dec-15 21:52:03 +0100, Pawel Jakub Dawidek wrote: > >>On Wed, Dec 12, 2012 at 04:02:58PM -0800, Navdeep Parhar wrote: > >>> A KASSERT() really is for a condition that should never happen. > > > > and can't be practically recovered from. > > > >>I have sort of mixed feelings about this change, but in reality we have > >>three cases: > >> > >>1. Fatal conditions that shouldn't happen, but may happen for some > >> reason and we definiately want to stop running (corrupted file system > >> metadata that can mess up the file system more badly). For those we have > >> direct panic(9) calls. > >> > >>2. Fatal conditions that cannot happen and for those we have KASSERT(9). > > > > I don't see the difference between these two cases. In both of them, > > the system has entered a state that the designer/programmer didn't > > envisage and can't recover from. The best option is to abort as > > quickly to minimise further corruption. > > Actually it was a pretty good description of the situation as it > existed for the last N years (where N > 10). > > Back in the early days we had #ifdef DIAGNOSTIC which was a general > catch-all bucket to put anything remotely related to diagnostic code. > The problem was that it gathered so much debugging code that so much > was changed by all the added code that it was usually the case that a > DIAGNOSTIC kernel added new problems, if it even booted at all. It > had everything from extra functions that existed just for ddb's > benefit through extra assertions. > > There was also the problem that there was no knob to compile in things > you could call from ddb to check the state of things as it was all in > one lump. That lead to the great DIAGNOSTIC -> INVARIANTS / > INVARIANT_SUPPORT split. INVARIANTS was for extra assertions, and > INVARIANT_SUPPORT was ddb callable functions and code for INVARIANTS > assertions to call. > > panic remained for fatal conditions, while INVARIANTS (and KASSERT) > were introduced to add additional non-invasive sanity checks to detect > things that were going off into the weeds before too big a mess was > made. > > The point of KASSERT was that it was something you could turn on > during development and/or or while trying to get a look at a problem > sooner in DDB before things got too messed up. It was an early > warning to get you into ddb faster/sooner. > > We were not supposed to need it on during production use because it > was for the kinds of problems that would be detected later via other > means. eg: a panic or a trap. > > eg: one of the earlier uses was checking priorities before beginning a > context switch. If you had an invalid priority state, you could get > fairly deep into mi_switch() before a run queue slot was unable to be > found. But by the time that happened, the context switch code had > changed things a lot before it reached that fatal condition. So we'd > add a KASSERT at the start so we could get into DDB before we'd > started messing with run queues and had a better chance at seeing how > we got into the mess. > > I must say I'm rather concerned about the direction of recent changes > in this area. To me, that all reads like bigtime support of what Alfred is up to. The messages emitted by KASSERT checks give you information about a problem before it becomes obscured. In development it can also abort on the spot, because a developer can do something useful with that abort. On the other hand, a production server or device that suddenly hangs, or worse keeps running but badly in some way, might be much easier to deal with if there was a logged message that let you know that some check failed and it would have aborted if the abort option were turned on. The question here isn't whether aborting or continuing beyond that point is a good idea. Some developer already made that choice by coding a KASSERT() instead of a panic(). The developer decided that a production machine should try to keep running at that point. The only question here is whether to let people to choose to get more information when they've also choosen not to immediately abort on a failed check. They still can't choose to override the decisions made by the developer about which situations must abort and which can try to continue. Why not let folks ask for more info, if they can afford the cost of the extra checks? So far the only really sane response I've seen in this thread was "tools, not policy". -- Ian From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 07:45:51 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A8CDE91; Sun, 16 Dec 2012 07:45:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 8A07D8FC0A; Sun, 16 Dec 2012 07:45:50 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA12833; Sun, 16 Dec 2012 09:45:35 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Tk8ul-0002jH-I7; Sun, 16 Dec 2012 09:45:35 +0200 Message-ID: <50CD7C1D.3020108@FreeBSD.org> Date: Sun, 16 Dec 2012 09:45:33 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Ian Lepore Subject: Re: svn commit: r244112 - head/sys/kern References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212121046.43706.jhb@freebsd.org> <201212121658.49048.jhb@freebsd.org> <50C90567.8080406@FreeBSD.org> <50C909BD.9090709@mu.org> <50C91B32.4080904@FreeBSD.org> <20121215205202.GF1411@garage.freebsd.pl> <20121216040717.GG35245@server.rulingia.com> <1355634037.1198.115.camel@revolution.hippie.lan> In-Reply-To: <1355634037.1198.115.camel@revolution.hippie.lan> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Peter Jeremy , Peter Wemm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 07:45:51 -0000 on 16/12/2012 07:00 Ian Lepore said the following: > The question here isn't whether aborting or continuing beyond that point > is a good idea. Some developer already made that choice by coding a > KASSERT() instead of a panic(). The developer decided that a production > machine should try to keep running at that point. Please don't perpetuate this argument. The point of KASSERT is not that the developer intended that the system should try to keep running in production. The point is that (1) the KASSERT should not be hit in production as was established in testing *and* (2) having all KASSERTs enabled in production is too expensive. That's all. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 08:06:10 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2E843719; Sun, 16 Dec 2012 08:06:10 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 068828FC0C; Sun, 16 Dec 2012 08:06:09 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 780E11A3C1C; Sun, 16 Dec 2012 00:06:08 -0800 (PST) Message-ID: <50CD80F0.6000203@mu.org> Date: Sun, 16 Dec 2012 00:06:08 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Andriy Gapon Subject: Re: svn commit: r244112 - head/sys/kern References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212121046.43706.jhb@freebsd.org> <201212121658.49048.jhb@freebsd.org> <50C90567.8080406@FreeBSD.org> <50C909BD.9090709@mu.org> <50C91B32.4080904@FreeBSD.org> <20121215205202.GF1411@garage.freebsd.pl> <20121216040717.GG35245@server.rulingia.com> <1355634037.1198.115.camel@revolution.hippie.lan> <50CD7C1D.3020108@FreeBSD.org> In-Reply-To: <50CD7C1D.3020108@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Ian Lepore , src-committers@FreeBSD.org, Peter Wemm , svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, Peter Jeremy X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 08:06:10 -0000 On 12/15/12 11:45 PM, Andriy Gapon wrote: > on 16/12/2012 07:00 Ian Lepore said the following: >> The question here isn't whether aborting or continuing beyond that point >> is a good idea. Some developer already made that choice by coding a >> KASSERT() instead of a panic(). The developer decided that a production >> machine should try to keep running at that point. > Please don't perpetuate this argument. The point of KASSERT is not that the > developer intended that the system should try to keep running in production. > The point is that (1) the KASSERT should not be hit in production as was > established in testing *and* (2) having all KASSERTs enabled in production is > too expensive. That's all. > I don't understand, we have a few partners running KASSERT enabled kernels. Depending on workload our machines can have enough CPU free for this. -Alfred From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 08:09:47 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 09C6F89D; Sun, 16 Dec 2012 08:09:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id D71CE8FC0C; Sun, 16 Dec 2012 08:09:45 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA12959; Sun, 16 Dec 2012 10:09:33 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Tk9Hx-0002lG-0G; Sun, 16 Dec 2012 10:09:33 +0200 Message-ID: <50CD81BB.5020600@FreeBSD.org> Date: Sun, 16 Dec 2012 10:09:31 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Alfred Perlstein Subject: Re: svn commit: r244112 - head/sys/kern References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212121046.43706.jhb@freebsd.org> <201212121658.49048.jhb@freebsd.org> <50C90567.8080406@FreeBSD.org> <50C909BD.9090709@mu.org> <50C91B32.4080904@FreeBSD.org> <20121215205202.GF1411@garage.freebsd.pl> <20121216040717.GG35245@server.rulingia.com> <1355634037.1198.115.camel@revolution.hippie.lan> <50CD7C1D.3020108@FreeBSD.org> <50CD80F0.6000203@mu.org> In-Reply-To: <50CD80F0.6000203@mu.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Ian Lepore , src-committers@FreeBSD.org, Peter Wemm , svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, Peter Jeremy X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 08:09:47 -0000 on 16/12/2012 10:06 Alfred Perlstein said the following: > On 12/15/12 11:45 PM, Andriy Gapon wrote: >> on 16/12/2012 07:00 Ian Lepore said the following: >>> Some developer already made that choice by coding a >>> KASSERT() instead of a panic(). >> Please don't perpetuate this argument. The point of KASSERT is not that the >> developer intended that the system should try to keep running in production. >> The point is that (1) the KASSERT should not be hit in production as was >> established in testing *and* (2) having all KASSERTs enabled in production is >> too expensive. That's all. >> > I don't understand, we have a few partners running KASSERT enabled kernels. > > Depending on workload our machines can have enough CPU free for this. Yes, sure. I have stated the reason why KASSERT is controlled by INVARIANTS. I haven't said that it must turned off in production. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 09:10:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 01768248; Sun, 16 Dec 2012 09:10:29 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id F08DE8FC19; Sun, 16 Dec 2012 09:10:27 +0000 (UTC) Received: by mail-ee0-f54.google.com with SMTP id c13so2662112eek.13 for ; Sun, 16 Dec 2012 01:10:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=0WODQ7D8Gh8WBDgeGVuatWZrkTtTF2exc2u+/wxuMnA=; b=kufFUK7PC2cZwLWOvtnooSQJi6uVrHUQV0pHt+riTmMZNRvZX1k8+4MJ1vaO4lsYlI XEcckrBFO/g5jz2UfXTHvYSop5vKxOShlNoX8iBTiIALq2fZSsQgHIPogSTIXclws6hv xJWEd4U+X2P72hWioNJKNMs2p351rBAcj2t5/At/5miecEuSYJckccWNYU6HQL/xyyk7 hV0dmKWSL67P0SApdbhRJH2hEyhQe7Yu9vhNgRfyc6nLWds66sXxhHoqYB2wHLUgVLnk bxLFXB7l5DDHx8Adra0aI/NgjPEIC86AaU6t4PJv4hhxDh+1jztNMlj7gavnGTRyRRHI pUzg== Received: by 10.14.176.66 with SMTP id a42mr30821034eem.34.1355649021356; Sun, 16 Dec 2012 01:10:21 -0800 (PST) Received: from localhost ([178.150.115.244]) by mx.google.com with ESMTPS id 6sm21214030eea.3.2012.12.16.01.10.19 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 16 Dec 2012 01:10:20 -0800 (PST) Sender: Mikolaj Golub Date: Sun, 16 Dec 2012 11:10:17 +0200 From: Mikolaj Golub To: Adrian Chadd Subject: Re: svn commit: r244271 - head/usr.sbin/iostat Message-ID: <20121216091016.GA3331@gmail.com> References: <201212151821.qBFILAOP013123@svn.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, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 09:10:29 -0000 On Sat, Dec 15, 2012 at 05:00:39PM -0800, Adrian Chadd wrote: > Hi, > > People may have scripts based on the current output. > > You should have introduced a new parameter which modifies the output > behaviour in the way you wanted, rather than modifying the existing > behaviour. > > Please consider reverting your change (which is a good idea, btw) and > adding a new modifier that outputs the value(s), rather than a %age. It is a pity that this question did not arise when I published this patch on hackers@: http://lists.freebsd.org/pipermail/freebsd-hackers/2012-September/040558.html I got then only one (private) reply from David Wolfskill, who though it was a good idea but had to go only to head (10.x) due to the changed behavior. I don't have plans to MFC this. I will revert the change, if other people also think I have to. I wont add a new modifier introducing yet another ugliness to iostat(8): iostat -Ix behavior before the change contradicted what was described in the man: -I Display total statistics for a given time period, rather than aver- age statistics for each second during that time period. In my opinion, preserving the wrong behaviour and adding yet another switch to have the desirable one is worse. So I'd rather just revert this back and keep using my sysutils/devstat utility, which already gives me what I want. -- Mikolaj Golub From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 09:59:39 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5B0F09FD; Sun, 16 Dec 2012 09:59:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 0E6C98FC0C; Sun, 16 Dec 2012 09:59:37 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA13422; Sun, 16 Dec 2012 11:59:36 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1TkB0S-0002s9-04; Sun, 16 Dec 2012 11:59:36 +0200 Message-ID: <50CD9B85.1040404@FreeBSD.org> Date: Sun, 16 Dec 2012 11:59:33 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: attilio@FreeBSD.org Subject: Re: svn commit: r243515 - head/sys/kern References: <201211251422.qAPEM8BV074656@svn.freebsd.org> <50C9B525.2060503@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 09:59:39 -0000 on 13/12/2012 22:17 Attilio Rao said the following: > Right, but as I said, for the time being we can at least have a > correct panic() semantic and take the right time to fix the > generic_stop_cpus() and then absorb also the panic() fix into it. > Right now the mechanism is still broken in panic and it can be fixed > with a very easy fix, so we should just do it. > This will also help vendors like Sandvine which may have hit just this bug too. Perhaps I got confused... Could you please re-explain to me your suggestion to fix panic(9)? Because I thought that it would require exactly the same steps as fixing generic_stop_cpus(). Sorry about this. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 13:56:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B788ACB6; Sun, 16 Dec 2012 13:56:38 +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 9BBFC8FC0A; Sun, 16 Dec 2012 13:56:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGDucTc087250; Sun, 16 Dec 2012 13:56:38 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGDucpa087249; Sun, 16 Dec 2012 13:56:38 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212161356.qBGDucpa087249@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 16 Dec 2012 13:56:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244288 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 13:56:38 -0000 Author: pjd Date: Sun Dec 16 13:56:38 2012 New Revision: 244288 URL: http://svnweb.freebsd.org/changeset/base/244288 Log: Use 'cred' variable. Obtained from: WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sun Dec 16 11:16:13 2012 (r244287) +++ head/sys/kern/kern_sig.c Sun Dec 16 13:56:38 2012 (r244288) @@ -3210,8 +3210,7 @@ coredump(struct thread *td) MPASS((p->p_flag & P_HADTHREADS) == 0 || p->p_singlethread == td); _STOPEVENT(p, S_CORE, 0); - name = expand_name(p->p_comm, td->td_ucred->cr_uid, p->p_pid, td, - compress); + name = expand_name(p->p_comm, cred->cr_uid, p->p_pid, td, compress); if (name == NULL) { PROC_UNLOCK(p); #ifdef AUDIT From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 14:01:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D09A7F34; Sun, 16 Dec 2012 14:01:57 +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 B48FA8FC0A; Sun, 16 Dec 2012 14:01:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGE1vV6088148; Sun, 16 Dec 2012 14:01:57 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGE1u4i088141; Sun, 16 Dec 2012 14:01:56 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201212161401.qBGE1u4i088141@svn.freebsd.org> From: Rick Macklem Date: Sun, 16 Dec 2012 14:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244289 - in stable/9/sys: fs/nfs fs/nfsclient nfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 14:01:57 -0000 Author: rmacklem Date: Sun Dec 16 14:01:56 2012 New Revision: 244289 URL: http://svnweb.freebsd.org/changeset/base/244289 Log: MFC: r243782 Add an nfssvc() option to the kernel for the new NFS client which dumps out the actual options being used by an NFS mount. This will be used to add a "-m" option to nfsstat(1). Modified: stable/9/sys/fs/nfs/nfs_var.h stable/9/sys/fs/nfsclient/nfs_clport.c stable/9/sys/fs/nfsclient/nfs_clvfsops.c stable/9/sys/nfs/nfs_nfssvc.c stable/9/sys/nfs/nfssvc.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/9/sys/fs/nfs/nfs_var.h Sun Dec 16 13:56:38 2012 (r244288) +++ stable/9/sys/fs/nfs/nfs_var.h Sun Dec 16 14:01:56 2012 (r244289) @@ -313,6 +313,7 @@ void nfsd_init(void); int nfsd_checkrootexp(struct nfsrv_descript *); /* nfs_clvfsops.c */ +void nfscl_retopts(struct nfsmount *, char *, size_t); /* nfs_commonport.c */ int nfsrv_checksockseqnum(struct socket *, tcp_seq); Modified: stable/9/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clport.c Sun Dec 16 13:56:38 2012 (r244288) +++ stable/9/sys/fs/nfsclient/nfs_clport.c Sun Dec 16 14:01:56 2012 (r244289) @@ -1207,6 +1207,9 @@ nfssvc_nfscl(struct thread *td, struct n struct nfscbd_args nfscbdarg; struct nfsd_nfscbd_args nfscbdarg2; int error; + struct nameidata nd; + struct nfscl_dumpmntopts dumpmntopts; + char *buf; if (uap->flag & NFSSVC_CBADDSOCK) { error = copyin(uap->argp, (caddr_t)&nfscbdarg, sizeof(nfscbdarg)); @@ -1239,6 +1242,28 @@ nfssvc_nfscl(struct thread *td, struct n if (error) return (error); error = nfscbd_nfsd(td, &nfscbdarg2); + } else if (uap->flag & NFSSVC_DUMPMNTOPTS) { + error = copyin(uap->argp, &dumpmntopts, sizeof(dumpmntopts)); + if (error == 0 && (dumpmntopts.ndmnt_blen < 256 || + dumpmntopts.ndmnt_blen > 1024)) + error = EINVAL; + if (error == 0) + error = nfsrv_lookupfilename(&nd, + dumpmntopts.ndmnt_fname, td); + if (error == 0 && strcmp(nd.ni_vp->v_mount->mnt_vfc->vfc_name, + "nfs") != 0) { + vput(nd.ni_vp); + error = EINVAL; + } + if (error == 0) { + buf = malloc(dumpmntopts.ndmnt_blen, M_TEMP, M_WAITOK); + nfscl_retopts(VFSTONFS(nd.ni_vp->v_mount), buf, + dumpmntopts.ndmnt_blen); + vput(nd.ni_vp); + error = copyout(buf, dumpmntopts.ndmnt_buf, + dumpmntopts.ndmnt_blen); + free(buf, M_TEMP); + } } else { error = EINVAL; } Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sun Dec 16 13:56:38 2012 (r244288) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sun Dec 16 14:01:56 2012 (r244289) @@ -1630,3 +1630,105 @@ nfs_getnlminfo(struct vnode *vp, uint8_t } } +/* + * This function prints out an option name, based on the conditional + * argument. + */ +static __inline void nfscl_printopt(struct nfsmount *nmp, int testval, + char *opt, char **buf, size_t *blen) +{ + int len; + + if (testval != 0 && *blen > strlen(opt)) { + len = snprintf(*buf, *blen, "%s", opt); + if (len != strlen(opt)) + printf("EEK!!\n"); + *buf += len; + *blen -= len; + } +} + +/* + * This function printf out an options integer value. + */ +static __inline void nfscl_printoptval(struct nfsmount *nmp, int optval, + char *opt, char **buf, size_t *blen) +{ + int len; + + if (*blen > strlen(opt) + 1) { + /* Could result in truncated output string. */ + len = snprintf(*buf, *blen, "%s=%d", opt, optval); + if (len < *blen) { + *buf += len; + *blen -= len; + } + } +} + +/* + * Load the option flags and values into the buffer. + */ +void nfscl_retopts(struct nfsmount *nmp, char *buffer, size_t buflen) +{ + char *buf; + size_t blen; + + buf = buffer; + blen = buflen; + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NFSV4) != 0, "nfsv4", &buf, + &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NFSV3) != 0, "nfsv3", &buf, + &blen); + nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0, + "nfsv2", &buf, &blen); + nfscl_printopt(nmp, nmp->nm_sotype == SOCK_STREAM, ",tcp", &buf, &blen); + nfscl_printopt(nmp, nmp->nm_sotype != SOCK_STREAM, ",udp", &buf, &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_RESVPORT) != 0, ",resvport", + &buf, &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NOCONN) != 0, ",noconn", + &buf, &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_SOFT) == 0, ",hard", &buf, + &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_SOFT) != 0, ",soft", &buf, + &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_INT) != 0, ",intr", &buf, + &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NOCTO) == 0, ",cto", &buf, + &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NOCTO) != 0, ",nocto", &buf, + &blen); + nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_NOLOCKD | NFSMNT_NFSV4)) == + 0, ",lockd", &buf, &blen); + nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_NOLOCKD | NFSMNT_NFSV4)) == + NFSMNT_NOLOCKD, ",nolockd", &buf, &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_RDIRPLUS) != 0, ",rdirplus", + &buf, &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_KERB) == 0, ",sec=sys", + &buf, &blen); + nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_KERB | NFSMNT_INTEGRITY | + NFSMNT_PRIVACY)) == NFSMNT_KERB, ",sec=krb5", &buf, &blen); + nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_KERB | NFSMNT_INTEGRITY | + NFSMNT_PRIVACY)) == (NFSMNT_KERB | NFSMNT_INTEGRITY), ",sec=krb5i", + &buf, &blen); + nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_KERB | NFSMNT_INTEGRITY | + NFSMNT_PRIVACY)) == (NFSMNT_KERB | NFSMNT_PRIVACY), ",sec=krb5p", + &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_acdirmin, ",acdirmin", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_acdirmax, ",acdirmax", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_acregmin, ",acregmin", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_acregmax, ",acregmax", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_nametimeo, ",nametimeo", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_negnametimeo, ",negnametimeo", &buf, + &blen); + nfscl_printoptval(nmp, nmp->nm_rsize, ",rsize", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_wsize, ",wsize", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_readdirsize, ",readdirsize", &buf, + &blen); + nfscl_printoptval(nmp, nmp->nm_readahead, ",readahead", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_wcommitsize, ",wcommitsize", &buf, + &blen); + nfscl_printoptval(nmp, nmp->nm_timeo, ",timeout", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_retry, ",retrans", &buf, &blen); +} + Modified: stable/9/sys/nfs/nfs_nfssvc.c ============================================================================== --- stable/9/sys/nfs/nfs_nfssvc.c Sun Dec 16 13:56:38 2012 (r244288) +++ stable/9/sys/nfs/nfs_nfssvc.c Sun Dec 16 14:01:56 2012 (r244289) @@ -91,8 +91,8 @@ sys_nfssvc(struct thread *td, struct nfs if ((uap->flag & (NFSSVC_ADDSOCK | NFSSVC_OLDNFSD | NFSSVC_NFSD)) && nfsd_call_nfsserver != NULL) error = (*nfsd_call_nfsserver)(td, uap); - else if ((uap->flag & (NFSSVC_CBADDSOCK | NFSSVC_NFSCBD)) && - nfsd_call_nfscl != NULL) + else if ((uap->flag & (NFSSVC_CBADDSOCK | NFSSVC_NFSCBD | + NFSSVC_DUMPMNTOPTS)) && nfsd_call_nfscl != NULL) error = (*nfsd_call_nfscl)(td, uap); else if ((uap->flag & (NFSSVC_IDNAME | NFSSVC_GETSTATS | NFSSVC_GSSDADDPORT | NFSSVC_GSSDADDFIRST | NFSSVC_GSSDDELETEALL | Modified: stable/9/sys/nfs/nfssvc.h ============================================================================== --- stable/9/sys/nfs/nfssvc.h Sun Dec 16 13:56:38 2012 (r244288) +++ stable/9/sys/nfs/nfssvc.h Sun Dec 16 14:01:56 2012 (r244289) @@ -68,5 +68,13 @@ #define NFSSVC_ZEROSRVSTATS 0x02000000 /* modifier for GETSTATS */ #define NFSSVC_SUSPENDNFSD 0x04000000 #define NFSSVC_RESUMENFSD 0x08000000 +#define NFSSVC_DUMPMNTOPTS 0x10000000 + +/* Argument structure for NFSSVC_DUMPMNTOPTS. */ +struct nfscl_dumpmntopts { + char *ndmnt_fname; /* File Name */ + size_t ndmnt_blen; /* Size of buffer */ + void *ndmnt_buf; /* and the buffer */ +}; #endif /* _NFS_NFSSVC_H */ From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 14:10:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 94D9341A; Sun, 16 Dec 2012 14:10:13 +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 5F4228FC0A; Sun, 16 Dec 2012 14:10:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGEAD9X089615; Sun, 16 Dec 2012 14:10:13 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGEADBP089614; Sun, 16 Dec 2012 14:10:13 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201212161410.qBGEADBP089614@svn.freebsd.org> From: Rick Macklem Date: Sun, 16 Dec 2012 14:10:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244291 - stable/9/usr.bin/nfsstat X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 14:10:13 -0000 Author: rmacklem Date: Sun Dec 16 14:10:12 2012 New Revision: 244291 URL: http://svnweb.freebsd.org/changeset/base/244291 Log: MFC: r243783 Add a "-m" option to nfsstat, which dumps out the actual options used by all NFS mounts. Works for the new/default NFS client only. Modified: stable/9/usr.bin/nfsstat/nfsstat.c Directory Properties: stable/9/usr.bin/nfsstat/ (props changed) Modified: stable/9/usr.bin/nfsstat/nfsstat.c ============================================================================== --- stable/9/usr.bin/nfsstat/nfsstat.c Sun Dec 16 14:09:18 2012 (r244290) +++ stable/9/usr.bin/nfsstat/nfsstat.c Sun Dec 16 14:10:12 2012 (r244291) @@ -107,14 +107,36 @@ main(int argc, char **argv) int ch; char *memf, *nlistf; char errbuf[_POSIX2_LINE_MAX]; + int mntlen, i; + char buf[1024]; + struct statfs *mntbuf; + struct nfscl_dumpmntopts dumpmntopts; interval = 0; memf = nlistf = NULL; - while ((ch = getopt(argc, argv, "cesWM:N:ow:z")) != -1) + while ((ch = getopt(argc, argv, "cesWM:mN:ow:z")) != -1) switch(ch) { case 'M': memf = optarg; break; + case 'm': + /* Display mount options for NFS mount points. */ + mntlen = getmntinfo(&mntbuf, MNT_NOWAIT); + for (i = 0; i < mntlen; i++) { + if (strcmp(mntbuf->f_fstypename, "nfs") == 0) { + dumpmntopts.ndmnt_fname = + mntbuf->f_mntonname; + dumpmntopts.ndmnt_buf = buf; + dumpmntopts.ndmnt_blen = sizeof(buf); + if (nfssvc(NFSSVC_DUMPMNTOPTS, + &dumpmntopts) >= 0) + printf("%s on %s\n%s\n", + mntbuf->f_mntfromname, + mntbuf->f_mntonname, buf); + } + mntbuf++; + } + exit(0); case 'N': nlistf = optarg; break; @@ -646,7 +668,7 @@ void usage(void) { (void)fprintf(stderr, - "usage: nfsstat [-ceoszW] [-M core] [-N system] [-w wait]\n"); + "usage: nfsstat [-cemoszW] [-M core] [-N system] [-w wait]\n"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 14:13:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 18C2C5CE; Sun, 16 Dec 2012 14:13:11 +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 F0D2B8FC12; Sun, 16 Dec 2012 14:13:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGEDA5l090222; Sun, 16 Dec 2012 14:13:10 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGEDAXb090221; Sun, 16 Dec 2012 14:13:10 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201212161413.qBGEDAXb090221@svn.freebsd.org> From: Rick Macklem Date: Sun, 16 Dec 2012 14:13:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244292 - stable/9/usr.bin/nfsstat X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 14:13:11 -0000 Author: rmacklem Date: Sun Dec 16 14:13:10 2012 New Revision: 244292 URL: http://svnweb.freebsd.org/changeset/base/244292 Log: MFC: r243784 Document the "-m" option added by r243783. This is a content change. Modified: stable/9/usr.bin/nfsstat/nfsstat.1 Directory Properties: stable/9/usr.bin/nfsstat/ (props changed) Modified: stable/9/usr.bin/nfsstat/nfsstat.1 ============================================================================== --- stable/9/usr.bin/nfsstat/nfsstat.1 Sun Dec 16 14:10:12 2012 (r244291) +++ stable/9/usr.bin/nfsstat/nfsstat.1 Sun Dec 16 14:13:10 2012 (r244292) @@ -28,7 +28,7 @@ .\" From: @(#)nfsstat.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd May 4, 2011 +.Dd November 14, 2012 .Dt NFSSTAT 1 .Os .Sh NAME @@ -38,7 +38,7 @@ statistics .Sh SYNOPSIS .Nm -.Op Fl ceoszW +.Op Fl cemoszW .Op Fl M Ar core .Op Fl N Ar system .Op Fl w Ar wait @@ -62,6 +62,12 @@ This option is incompatible with Extract values associated with the name list from the specified core instead of the default .Pa /dev/kmem . +.It Fl m +Report the mount options for all new NFS client mounts. +This option overrides all others and +.Nm +will exit after completing the report. +This option is only supported by the new NFS client. .It Fl N Extract the name list from the specified system instead of the default .Pa /boot/kernel/kernel . From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 14:14:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 360C373D; Sun, 16 Dec 2012 14:14: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 1BAE48FC14; Sun, 16 Dec 2012 14:14:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGEEI0a090453; Sun, 16 Dec 2012 14:14:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGEEItq090452; Sun, 16 Dec 2012 14:14:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212161414.qBGEEItq090452@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 16 Dec 2012 14:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244293 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 14:14:19 -0000 Author: pjd Date: Sun Dec 16 14:14:18 2012 New Revision: 244293 URL: http://svnweb.freebsd.org/changeset/base/244293 Log: Make the check easier to read. Obtained from: WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sun Dec 16 14:13:10 2012 (r244292) +++ head/sys/kern/kern_sig.c Sun Dec 16 14:14:18 2012 (r244293) @@ -3218,8 +3218,7 @@ coredump(struct thread *td) #endif return (EINVAL); } - if (((sugid_coredump == 0) && p->p_flag & P_SUGID) || - do_coredump == 0) { + if (!do_coredump || (!sugid_coredump && (p->p_flag & P_SUGID) != 0)) { PROC_UNLOCK(p); #ifdef AUDIT audit_proc_coredump(td, name, EFAULT); From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 14:24:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C7793A8D; Sun, 16 Dec 2012 14:24:59 +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 ABBB28FC0C; Sun, 16 Dec 2012 14:24:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGEOxgB091904; Sun, 16 Dec 2012 14:24:59 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGEOxFF091903; Sun, 16 Dec 2012 14:24:59 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212161424.qBGEOxFF091903@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 16 Dec 2012 14:24:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244294 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 14:24:59 -0000 Author: pjd Date: Sun Dec 16 14:24:59 2012 New Revision: 244294 URL: http://svnweb.freebsd.org/changeset/base/244294 Log: Don't add audit record when coredumps are disabled or name cannot be expanded. Discussed with: rwatson Obtained from: WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sun Dec 16 14:14:18 2012 (r244293) +++ head/sys/kern/kern_sig.c Sun Dec 16 14:24:59 2012 (r244294) @@ -3213,16 +3213,10 @@ coredump(struct thread *td) name = expand_name(p->p_comm, cred->cr_uid, p->p_pid, td, compress); if (name == NULL) { PROC_UNLOCK(p); -#ifdef AUDIT - audit_proc_coredump(td, NULL, EINVAL); -#endif return (EINVAL); } if (!do_coredump || (!sugid_coredump && (p->p_flag & P_SUGID) != 0)) { PROC_UNLOCK(p); -#ifdef AUDIT - audit_proc_coredump(td, name, EFAULT); -#endif free(name, M_TEMP); return (EFAULT); } @@ -3238,9 +3232,6 @@ coredump(struct thread *td) limit = (off_t)lim_cur(p, RLIMIT_CORE); if (limit == 0 || racct_get_available(p, RACCT_CORE) == 0) { PROC_UNLOCK(p); -#ifdef AUDIT - audit_proc_coredump(td, name, EFBIG); -#endif free(name, M_TEMP); return (EFBIG); } From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 14:37:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AF1C2E51; Sun, 16 Dec 2012 14:37:26 +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 7ADBA8FC19; Sun, 16 Dec 2012 14:37:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGEbQKt093588; Sun, 16 Dec 2012 14:37:26 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGEbQMX093587; Sun, 16 Dec 2012 14:37:26 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201212161437.qBGEbQMX093587@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 16 Dec 2012 14:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244295 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 14:37:26 -0000 Author: trasz Date: Sun Dec 16 14:37:25 2012 New Revision: 244295 URL: http://svnweb.freebsd.org/changeset/base/244295 Log: When growing a filesystem, don't leave unused space at the end if there is not enough room for a full cylinder group. Reviewed by: mckusick@ Modified: head/sbin/growfs/growfs.c Modified: head/sbin/growfs/growfs.c ============================================================================== --- head/sbin/growfs/growfs.c Sun Dec 16 14:24:59 2012 (r244294) +++ head/sbin/growfs/growfs.c Sun Dec 16 14:37:25 2012 (r244295) @@ -1611,17 +1611,20 @@ main(int argc, char **argv) } sblock.fs_ncg = howmany(sblock.fs_size, sblock.fs_fpg); + /* + * Allocate last cylinder group only if there is enough room + * for at least one data block. + */ if (sblock.fs_size % sblock.fs_fpg != 0 && - sblock.fs_size % sblock.fs_fpg < cgdmin(&sblock, sblock.fs_ncg)) { - /* - * The space in the new last cylinder group is too small, - * so revert back. - */ + sblock.fs_size <= cgdmin(&sblock, sblock.fs_ncg - 1)) { + humanize_number(oldsizebuf, sizeof(oldsizebuf), + (sblock.fs_size % sblock.fs_fpg) * sblock.fs_fsize, + "B", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); + warnx("no room to allocate last cylinder group; " + "leaving %s unused", oldsizebuf); sblock.fs_ncg--; if (sblock.fs_magic == FS_UFS1_MAGIC) sblock.fs_old_ncyl = sblock.fs_ncg * sblock.fs_old_cpg; - printf("Warning: %jd sector(s) cannot be allocated.\n", - (intmax_t)fsbtodb(&sblock, sblock.fs_size % sblock.fs_fpg)); sblock.fs_size = sblock.fs_ncg * sblock.fs_fpg; } From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 14:53:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 28280543; Sun, 16 Dec 2012 14:53:28 +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 E77EB8FC15; Sun, 16 Dec 2012 14:53:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGErReu095855; Sun, 16 Dec 2012 14:53:27 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGErRR8095854; Sun, 16 Dec 2012 14:53:27 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212161453.qBGErRR8095854@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 16 Dec 2012 14:53:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244296 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 14:53:28 -0000 Author: pjd Date: Sun Dec 16 14:53:27 2012 New Revision: 244296 URL: http://svnweb.freebsd.org/changeset/base/244296 Log: Move expand_name() after process lock is released. This fixed panic where we hold mutex (process lock) and try to obtain sleepable lock (vnode lock in expand_name()). The panic could occur when %I was used in kern.corefile. Additionally we avoid expand_name() overhead when coredumps are disabled. Obtained from: WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sun Dec 16 14:37:25 2012 (r244295) +++ head/sys/kern/kern_sig.c Sun Dec 16 14:53:27 2012 (r244296) @@ -3210,14 +3210,8 @@ coredump(struct thread *td) MPASS((p->p_flag & P_HADTHREADS) == 0 || p->p_singlethread == td); _STOPEVENT(p, S_CORE, 0); - name = expand_name(p->p_comm, cred->cr_uid, p->p_pid, td, compress); - if (name == NULL) { - PROC_UNLOCK(p); - return (EINVAL); - } if (!do_coredump || (!sugid_coredump && (p->p_flag & P_SUGID) != 0)) { PROC_UNLOCK(p); - free(name, M_TEMP); return (EFAULT); } @@ -3232,11 +3226,14 @@ coredump(struct thread *td) limit = (off_t)lim_cur(p, RLIMIT_CORE); if (limit == 0 || racct_get_available(p, RACCT_CORE) == 0) { PROC_UNLOCK(p); - free(name, M_TEMP); return (EFBIG); } PROC_UNLOCK(p); + name = expand_name(p->p_comm, cred->cr_uid, p->p_pid, td, compress); + if (name == NULL) + return (EINVAL); + restart: NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); flags = O_CREAT | FWRITE | O_NOFOLLOW; From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 16:55:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8DC0FCBE; Sun, 16 Dec 2012 16:55:12 +0000 (UTC) (envelope-from eadler@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 58BE58FC0C; Sun, 16 Dec 2012 16:55:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGGtCFl014558; Sun, 16 Dec 2012 16:55:12 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGGtCX4014556; Sun, 16 Dec 2012 16:55:12 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212161655.qBGGtCX4014556@svn.freebsd.org> From: Eitan Adler Date: Sun, 16 Dec 2012 16:55:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244297 - stable/9/usr.bin/cut X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 16:55:12 -0000 Author: eadler Date: Sun Dec 16 16:55:11 2012 New Revision: 244297 URL: http://svnweb.freebsd.org/changeset/base/244297 Log: MFC r236866,r236867: - Consistenly mention columns and fields - Add -b to short error messages Approved by: kevlo Approved by: cperciva (implicit) Modified: stable/9/usr.bin/cut/cut.1 stable/9/usr.bin/cut/cut.c Directory Properties: stable/9/usr.bin/cut/ (props changed) Modified: stable/9/usr.bin/cut/cut.1 ============================================================================== --- stable/9/usr.bin/cut/cut.1 Sun Dec 16 14:53:27 2012 (r244296) +++ stable/9/usr.bin/cut/cut.1 Sun Dec 16 16:55:11 2012 (r244297) @@ -68,7 +68,7 @@ The items specified by .Ar list can be in terms of column position or in terms of fields delimited by a special character. -Column numbering starts from 1. +Column and field numbering start from 1. .Pp The .Ar list @@ -78,14 +78,14 @@ number ranges. Number ranges consist of a number, a dash .Pq Sq \- , and a second number -and select the fields or columns from the first number to the second, +and select the columns or fields from the first number to the second, inclusive. Numbers or number ranges may be preceded by a dash, which selects all -fields or columns from 1 to the last number. +columns or fields from 1 to the last number. Numbers or number ranges may be followed by a dash, which selects all -fields or columns from the last number to the end of the line. +columns or fields from the last number to the end of the line. Numbers and number ranges may be repeated, overlapping, and in any order. -It is not an error to select fields or columns not present in the +It is not an error to select columns or fields not present in the input line. .Pp The options are as follows: Modified: stable/9/usr.bin/cut/cut.c ============================================================================== --- stable/9/usr.bin/cut/cut.c Sun Dec 16 14:53:27 2012 (r244296) +++ stable/9/usr.bin/cut/cut.c Sun Dec 16 16:55:11 2012 (r244297) @@ -164,7 +164,7 @@ get_list(char *list) * set a byte in the positions array to indicate if a field or * column is to be selected; use +1, it's 1-based, not 0-based. * Numbers and number ranges may be overlapping, repeated, and in - * any order. We handle "-3-5" although there's no real reason too. + * any order. We handle "-3-5" although there's no real reason to. */ for (; (p = strsep(&list, ", \t")) != NULL;) { setautostart = start = stop = 0; @@ -187,9 +187,9 @@ get_list(char *list) } } if (*p) - errx(1, "[-cf] list: illegal list value"); + errx(1, "[-bcf] list: illegal list value"); if (!stop || !start) - errx(1, "[-cf] list: values may not include zero"); + errx(1, "[-bcf] list: values may not include zero"); if (maxval < stop) { maxval = stop; needpos(maxval + 1); From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 16:55:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BE7BAE29; Sun, 16 Dec 2012 16:55:41 +0000 (UTC) (envelope-from eadler@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 8A19E8FC0C; Sun, 16 Dec 2012 16:55:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGGtfLX014649; Sun, 16 Dec 2012 16:55:41 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGGtfYU014646; Sun, 16 Dec 2012 16:55:41 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212161655.qBGGtfYU014646@svn.freebsd.org> From: Eitan Adler Date: Sun, 16 Dec 2012 16:55:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244298 - stable/8/usr.bin/cut X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 16:55:41 -0000 Author: eadler Date: Sun Dec 16 16:55:40 2012 New Revision: 244298 URL: http://svnweb.freebsd.org/changeset/base/244298 Log: MFC r236866,r236867: - Consistenly mention columns and fields - Add -b to short error messages Approved by: kevlo Approved by: cperciva (implicit) Modified: stable/8/usr.bin/cut/cut.1 stable/8/usr.bin/cut/cut.c Directory Properties: stable/8/usr.bin/cut/ (props changed) Modified: stable/8/usr.bin/cut/cut.1 ============================================================================== --- stable/8/usr.bin/cut/cut.1 Sun Dec 16 16:55:11 2012 (r244297) +++ stable/8/usr.bin/cut/cut.1 Sun Dec 16 16:55:40 2012 (r244298) @@ -72,7 +72,7 @@ The items specified by .Ar list can be in terms of column position or in terms of fields delimited by a special character. -Column numbering starts from 1. +Column and field numbering start from 1. .Pp The .Ar list @@ -82,14 +82,14 @@ number ranges. Number ranges consist of a number, a dash .Pq Sq \- , and a second number -and select the fields or columns from the first number to the second, +and select the columns or fields from the first number to the second, inclusive. Numbers or number ranges may be preceded by a dash, which selects all -fields or columns from 1 to the last number. +columns or fields from 1 to the last number. Numbers or number ranges may be followed by a dash, which selects all -fields or columns from the last number to the end of the line. +columns or fields from the last number to the end of the line. Numbers and number ranges may be repeated, overlapping, and in any order. -It is not an error to select fields or columns not present in the +It is not an error to select columns or fields not present in the input line. .Pp The options are as follows: Modified: stable/8/usr.bin/cut/cut.c ============================================================================== --- stable/8/usr.bin/cut/cut.c Sun Dec 16 16:55:11 2012 (r244297) +++ stable/8/usr.bin/cut/cut.c Sun Dec 16 16:55:40 2012 (r244298) @@ -168,7 +168,7 @@ get_list(char *list) * set a byte in the positions array to indicate if a field or * column is to be selected; use +1, it's 1-based, not 0-based. * Numbers and number ranges may be overlapping, repeated, and in - * any order. We handle "-3-5" although there's no real reason too. + * any order. We handle "-3-5" although there's no real reason to. */ for (; (p = strsep(&list, ", \t")) != NULL;) { setautostart = start = stop = 0; @@ -191,9 +191,9 @@ get_list(char *list) } } if (*p) - errx(1, "[-cf] list: illegal list value"); + errx(1, "[-bcf] list: illegal list value"); if (!stop || !start) - errx(1, "[-cf] list: values may not include zero"); + errx(1, "[-bcf] list: values may not include zero"); if (maxval < stop) { maxval = stop; needpos(maxval + 1); From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 16:56:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 08DF7F8B; Sun, 16 Dec 2012 16:56:00 +0000 (UTC) (envelope-from eadler@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 DC7B08FC18; Sun, 16 Dec 2012 16:55:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGGtx4g014712; Sun, 16 Dec 2012 16:55:59 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGGtxOk014710; Sun, 16 Dec 2012 16:55:59 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212161655.qBGGtxOk014710@svn.freebsd.org> From: Eitan Adler Date: Sun, 16 Dec 2012 16:55:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r244299 - stable/7/usr.bin/cut X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 16:56:00 -0000 Author: eadler Date: Sun Dec 16 16:55:59 2012 New Revision: 244299 URL: http://svnweb.freebsd.org/changeset/base/244299 Log: MFC r236866,r236867: - Consistenly mention columns and fields - Add -b to short error messages Approved by: kevlo Approved by: cperciva (implicit) Modified: stable/7/usr.bin/cut/cut.1 stable/7/usr.bin/cut/cut.c Directory Properties: stable/7/usr.bin/cut/ (props changed) Modified: stable/7/usr.bin/cut/cut.1 ============================================================================== --- stable/7/usr.bin/cut/cut.1 Sun Dec 16 16:55:40 2012 (r244298) +++ stable/7/usr.bin/cut/cut.1 Sun Dec 16 16:55:59 2012 (r244299) @@ -72,7 +72,7 @@ The items specified by .Ar list can be in terms of column position or in terms of fields delimited by a special character. -Column numbering starts from 1. +Column and field numbering start from 1. .Pp The .Ar list @@ -82,14 +82,14 @@ number ranges. Number ranges consist of a number, a dash .Pq Sq \- , and a second number -and select the fields or columns from the first number to the second, +and select the columns or fields from the first number to the second, inclusive. Numbers or number ranges may be preceded by a dash, which selects all -fields or columns from 1 to the last number. +columns or fields from 1 to the last number. Numbers or number ranges may be followed by a dash, which selects all -fields or columns from the last number to the end of the line. +columns or fields from the last number to the end of the line. Numbers and number ranges may be repeated, overlapping, and in any order. -It is not an error to select fields or columns not present in the +It is not an error to select columns or fields not present in the input line. .Pp The options are as follows: Modified: stable/7/usr.bin/cut/cut.c ============================================================================== --- stable/7/usr.bin/cut/cut.c Sun Dec 16 16:55:40 2012 (r244298) +++ stable/7/usr.bin/cut/cut.c Sun Dec 16 16:55:59 2012 (r244299) @@ -168,7 +168,7 @@ get_list(char *list) * set a byte in the positions array to indicate if a field or * column is to be selected; use +1, it's 1-based, not 0-based. * Numbers and number ranges may be overlapping, repeated, and in - * any order. We handle "-3-5" although there's no real reason too. + * any order. We handle "-3-5" although there's no real reason to. */ for (; (p = strsep(&list, ", \t")) != NULL;) { setautostart = start = stop = 0; @@ -191,9 +191,9 @@ get_list(char *list) } } if (*p) - errx(1, "[-cf] list: illegal list value"); + errx(1, "[-bcf] list: illegal list value"); if (!stop || !start) - errx(1, "[-cf] list: values may not include zero"); + errx(1, "[-bcf] list: values may not include zero"); if (maxval < stop) { maxval = stop; needpos(maxval + 1); From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 16:59:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 627AB2A9; Sun, 16 Dec 2012 16:59:43 +0000 (UTC) (envelope-from eadler@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 2BCC38FC0A; Sun, 16 Dec 2012 16:59:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGGxhV3015293; Sun, 16 Dec 2012 16:59:43 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGGxhxV015292; Sun, 16 Dec 2012 16:59:43 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212161659.qBGGxhxV015292@svn.freebsd.org> From: Eitan Adler Date: Sun, 16 Dec 2012 16:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244300 - stable/9/usr.bin/cut X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 16:59:43 -0000 Author: eadler Date: Sun Dec 16 16:59:42 2012 New Revision: 244300 URL: http://svnweb.freebsd.org/changeset/base/244300 Log: MFC r227162: Add missing static keywords to cut(1) Approved by: ed Approved by: cperciva (implicit) Modified: stable/9/usr.bin/cut/cut.c Directory Properties: stable/9/usr.bin/cut/ (props changed) Modified: stable/9/usr.bin/cut/cut.c ============================================================================== --- stable/9/usr.bin/cut/cut.c Sun Dec 16 16:55:59 2012 (r244299) +++ stable/9/usr.bin/cut/cut.c Sun Dec 16 16:59:42 2012 (r244300) @@ -50,25 +50,25 @@ __FBSDID("$FreeBSD$"); #include #include -int bflag; -int cflag; -wchar_t dchar; -char dcharmb[MB_LEN_MAX + 1]; -int dflag; -int fflag; -int nflag; -int sflag; - -size_t autostart, autostop, maxval; -char * positions; - -int b_cut(FILE *, const char *); -int b_n_cut(FILE *, const char *); -int c_cut(FILE *, const char *); -int f_cut(FILE *, const char *); -void get_list(char *); -void needpos(size_t); -static void usage(void); +static int bflag; +static int cflag; +static wchar_t dchar; +static char dcharmb[MB_LEN_MAX + 1]; +static int dflag; +static int fflag; +static int nflag; +static int sflag; + +static size_t autostart, autostop, maxval; +static char * positions; + +static int b_cut(FILE *, const char *); +static int b_n_cut(FILE *, const char *); +static int c_cut(FILE *, const char *); +static int f_cut(FILE *, const char *); +static void get_list(char *); +static void needpos(size_t); +static void usage(void); int main(int argc, char *argv[]) @@ -153,7 +153,7 @@ main(int argc, char *argv[]) exit(rval); } -void +static void get_list(char *list) { size_t setautostart, start, stop; @@ -208,7 +208,7 @@ get_list(char *list) memset(positions + 1, '1', autostart); } -void +static void needpos(size_t n) { static size_t npos; @@ -227,7 +227,7 @@ needpos(size_t n) } } -int +static int b_cut(FILE *fp, const char *fname __unused) { int ch, col; @@ -261,7 +261,7 @@ b_cut(FILE *fp, const char *fname __unus * Although this function also handles the case where -n is not specified, * b_cut() ought to be much faster. */ -int +static int b_n_cut(FILE *fp, const char *fname) { size_t col, i, lbuflen; @@ -323,7 +323,7 @@ b_n_cut(FILE *fp, const char *fname) return (warned); } -int +static int c_cut(FILE *fp, const char *fname) { wint_t ch; @@ -358,7 +358,7 @@ out: return (0); } -int +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 16:59:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7460E2AA; Sun, 16 Dec 2012 16:59:45 +0000 (UTC) (envelope-from eadler@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 3FC208FC12; Sun, 16 Dec 2012 16:59:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGGxjgT015328; Sun, 16 Dec 2012 16:59:45 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGGxjTA015327; Sun, 16 Dec 2012 16:59:45 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212161659.qBGGxjTA015327@svn.freebsd.org> From: Eitan Adler Date: Sun, 16 Dec 2012 16:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r244301 - stable/7/usr.bin/cut X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 16:59:45 -0000 Author: eadler Date: Sun Dec 16 16:59:44 2012 New Revision: 244301 URL: http://svnweb.freebsd.org/changeset/base/244301 Log: MFC r227162: Add missing static keywords to cut(1) Approved by: ed Approved by: cperciva (implicit) Modified: stable/7/usr.bin/cut/cut.c Directory Properties: stable/7/usr.bin/cut/ (props changed) Modified: stable/7/usr.bin/cut/cut.c ============================================================================== --- stable/7/usr.bin/cut/cut.c Sun Dec 16 16:59:42 2012 (r244300) +++ stable/7/usr.bin/cut/cut.c Sun Dec 16 16:59:44 2012 (r244301) @@ -54,25 +54,25 @@ __FBSDID("$FreeBSD$"); #include #include -int bflag; -int cflag; -wchar_t dchar; -char dcharmb[MB_LEN_MAX + 1]; -int dflag; -int fflag; -int nflag; -int sflag; - -size_t autostart, autostop, maxval; -char * positions; - -int b_cut(FILE *, const char *); -int b_n_cut(FILE *, const char *); -int c_cut(FILE *, const char *); -int f_cut(FILE *, const char *); -void get_list(char *); -void needpos(size_t); -static void usage(void); +static int bflag; +static int cflag; +static wchar_t dchar; +static char dcharmb[MB_LEN_MAX + 1]; +static int dflag; +static int fflag; +static int nflag; +static int sflag; + +static size_t autostart, autostop, maxval; +static char * positions; + +static int b_cut(FILE *, const char *); +static int b_n_cut(FILE *, const char *); +static int c_cut(FILE *, const char *); +static int f_cut(FILE *, const char *); +static void get_list(char *); +static void needpos(size_t); +static void usage(void); int main(int argc, char *argv[]) @@ -157,7 +157,7 @@ main(int argc, char *argv[]) exit(rval); } -void +static void get_list(char *list) { size_t setautostart, start, stop; @@ -212,7 +212,7 @@ get_list(char *list) memset(positions + 1, '1', autostart); } -void +static void needpos(size_t n) { static size_t npos; @@ -231,7 +231,7 @@ needpos(size_t n) } } -int +static int b_cut(FILE *fp, const char *fname __unused) { int ch, col; @@ -265,7 +265,7 @@ b_cut(FILE *fp, const char *fname __unus * Although this function also handles the case where -n is not specified, * b_cut() ought to be much faster. */ -int +static int b_n_cut(FILE *fp, const char *fname) { size_t col, i, lbuflen; @@ -327,7 +327,7 @@ b_n_cut(FILE *fp, const char *fname) return (warned); } -int +static int c_cut(FILE *fp, const char *fname) { wint_t ch; @@ -362,7 +362,7 @@ out: return (0); } -int +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 17:00:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2AEDF4D0; Sun, 16 Dec 2012 17:00:00 +0000 (UTC) (envelope-from eadler@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 EA1808FC13; Sun, 16 Dec 2012 16:59:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGGxx8B015402; Sun, 16 Dec 2012 16:59:59 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGGxx1G015401; Sun, 16 Dec 2012 16:59:59 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212161659.qBGGxx1G015401@svn.freebsd.org> From: Eitan Adler Date: Sun, 16 Dec 2012 16:59:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244302 - stable/8/usr.bin/cut X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 17:00:00 -0000 Author: eadler Date: Sun Dec 16 16:59:59 2012 New Revision: 244302 URL: http://svnweb.freebsd.org/changeset/base/244302 Log: MFC r227162: Add missing static keywords to cut(1) Approved by: ed Approved by: cperciva (implicit) Modified: stable/8/usr.bin/cut/cut.c Directory Properties: stable/8/usr.bin/cut/ (props changed) Modified: stable/8/usr.bin/cut/cut.c ============================================================================== --- stable/8/usr.bin/cut/cut.c Sun Dec 16 16:59:44 2012 (r244301) +++ stable/8/usr.bin/cut/cut.c Sun Dec 16 16:59:59 2012 (r244302) @@ -54,25 +54,25 @@ __FBSDID("$FreeBSD$"); #include #include -int bflag; -int cflag; -wchar_t dchar; -char dcharmb[MB_LEN_MAX + 1]; -int dflag; -int fflag; -int nflag; -int sflag; - -size_t autostart, autostop, maxval; -char * positions; - -int b_cut(FILE *, const char *); -int b_n_cut(FILE *, const char *); -int c_cut(FILE *, const char *); -int f_cut(FILE *, const char *); -void get_list(char *); -void needpos(size_t); -static void usage(void); +static int bflag; +static int cflag; +static wchar_t dchar; +static char dcharmb[MB_LEN_MAX + 1]; +static int dflag; +static int fflag; +static int nflag; +static int sflag; + +static size_t autostart, autostop, maxval; +static char * positions; + +static int b_cut(FILE *, const char *); +static int b_n_cut(FILE *, const char *); +static int c_cut(FILE *, const char *); +static int f_cut(FILE *, const char *); +static void get_list(char *); +static void needpos(size_t); +static void usage(void); int main(int argc, char *argv[]) @@ -157,7 +157,7 @@ main(int argc, char *argv[]) exit(rval); } -void +static void get_list(char *list) { size_t setautostart, start, stop; @@ -212,7 +212,7 @@ get_list(char *list) memset(positions + 1, '1', autostart); } -void +static void needpos(size_t n) { static size_t npos; @@ -231,7 +231,7 @@ needpos(size_t n) } } -int +static int b_cut(FILE *fp, const char *fname __unused) { int ch, col; @@ -265,7 +265,7 @@ b_cut(FILE *fp, const char *fname __unus * Although this function also handles the case where -n is not specified, * b_cut() ought to be much faster. */ -int +static int b_n_cut(FILE *fp, const char *fname) { size_t col, i, lbuflen; @@ -327,7 +327,7 @@ b_n_cut(FILE *fp, const char *fname) return (warned); } -int +static int c_cut(FILE *fp, const char *fname) { wint_t ch; @@ -362,7 +362,7 @@ out: return (0); } -int +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 17:01:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 35F4D728; Sun, 16 Dec 2012 17:01:24 +0000 (UTC) (envelope-from eadler@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 110618FC12; Sun, 16 Dec 2012 17:01:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGH1NBx015910; Sun, 16 Dec 2012 17:01:23 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGH1Nd4015903; Sun, 16 Dec 2012 17:01:23 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212161701.qBGH1Nd4015903@svn.freebsd.org> From: Eitan Adler Date: Sun, 16 Dec 2012 17:01:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244303 - stable/9/usr.bin/cut X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 17:01:24 -0000 Author: eadler Date: Sun Dec 16 17:01:23 2012 New Revision: 244303 URL: http://svnweb.freebsd.org/changeset/base/244303 Log: MFC r243320,r243474: Add 'w' flag to: Use whitespace (spaces and tabs) as the delimiter. Consecutive spaces and tabs count as one single field separator. Approved by: cperciva (implicit) Modified: stable/9/usr.bin/cut/cut.1 stable/9/usr.bin/cut/cut.c Directory Properties: stable/9/usr.bin/cut/ (props changed) Modified: stable/9/usr.bin/cut/cut.1 ============================================================================== --- stable/9/usr.bin/cut/cut.1 Sun Dec 16 16:59:59 2012 (r244302) +++ stable/9/usr.bin/cut/cut.1 Sun Dec 16 17:01:23 2012 (r244303) @@ -31,7 +31,7 @@ .\" @(#)cut.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd December 21, 2006 +.Dd August 8, 2012 .Dt CUT 1 .Os .Sh NAME @@ -47,7 +47,7 @@ .Op Ar .Nm .Fl f Ar list -.Op Fl d Ar delim +.Op Fl w | Fl d Ar delim .Op Fl s .Op Ar .Sh DESCRIPTION @@ -119,6 +119,9 @@ that form the character are selected. .It Fl s Suppress lines with no field delimiter characters. Unless specified, lines with no delimiters are passed through unmodified. +.It Fl w +Use whitespace (spaces and tabs) as the delimiter. +Consecutive spaces and tabs count as one single field separator. .El .Sh ENVIRONMENT The Modified: stable/9/usr.bin/cut/cut.c ============================================================================== --- stable/9/usr.bin/cut/cut.c Sun Dec 16 16:59:59 2012 (r244302) +++ stable/9/usr.bin/cut/cut.c Sun Dec 16 17:01:23 2012 (r244303) @@ -58,6 +58,7 @@ static int dflag; static int fflag; static int nflag; static int sflag; +static int wflag; static size_t autostart, autostop, maxval; static char * positions; @@ -67,6 +68,7 @@ static int b_n_cut(FILE *, const char *) static int c_cut(FILE *, const char *); static int f_cut(FILE *, const char *); static void get_list(char *); +static int is_delim(wchar_t); static void needpos(size_t); static void usage(void); @@ -84,7 +86,7 @@ main(int argc, char *argv[]) dchar = '\t'; /* default delimiter is \t */ strcpy(dcharmb, "\t"); - while ((ch = getopt(argc, argv, "b:c:d:f:sn")) != -1) + while ((ch = getopt(argc, argv, "b:c:d:f:snw")) != -1) switch(ch) { case 'b': get_list(optarg); @@ -111,6 +113,9 @@ main(int argc, char *argv[]) case 'n': nflag = 1; break; + case 'w': + wflag = 1; + break; case '?': default: usage(); @@ -119,9 +124,9 @@ main(int argc, char *argv[]) argv += optind; if (fflag) { - if (bflag || cflag || nflag) + if (bflag || cflag || nflag || (wflag && dflag)) usage(); - } else if (!(bflag || cflag) || dflag || sflag) + } else if (!(bflag || cflag) || dflag || sflag || wflag) usage(); else if (!bflag && nflag) usage(); @@ -359,18 +364,30 @@ out: } static int +is_delim(wchar_t ch) +{ + if (wflag) { + if (ch == ' ' || ch == '\t') + return 1; + } else { + if (ch == dchar) + return 1; + } + return 0; +} + +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; int field, i, isdelim; char *pos, *p; - wchar_t sep; int output; char *lbuf, *mlbuf; size_t clen, lbuflen, reallen; mlbuf = NULL; - for (sep = dchar; (lbuf = fgetln(fp, &lbuflen)) != NULL;) { + while ((lbuf = fgetln(fp, &lbuflen)) != NULL) { reallen = lbuflen; /* Assert EOL has a newline. */ if (*(lbuf + lbuflen - 1) != '\n') { @@ -394,7 +411,7 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; /* this should work if newline is delimiter */ - if (ch == sep) + if (is_delim(ch)) isdelim = 1; if (ch == '\n') { if (!isdelim && !sflag) @@ -421,8 +438,13 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; p += clen; - if (ch == '\n' || ch == sep) + if (ch == '\n' || is_delim(ch)) { + /* compress whitespace */ + if (wflag && ch != '\n') + while (is_delim(*p)) + p++; break; + } if (*pos) for (i = 0; i < (int)clen; i++) putchar(p[i - clen]); @@ -452,6 +474,6 @@ usage(void) (void)fprintf(stderr, "%s\n%s\n%s\n", "usage: cut -b list [-n] [file ...]", " cut -c list [file ...]", - " cut -f list [-s] [-d delim] [file ...]"); + " cut -f list [-s] [-w | -d delim] [file ...]"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 17:01:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7638F72D; Sun, 16 Dec 2012 17:01:24 +0000 (UTC) (envelope-from eadler@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 5B8318FC13; Sun, 16 Dec 2012 17:01:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGH1OmL015917; Sun, 16 Dec 2012 17:01:24 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGH1OVF015911; Sun, 16 Dec 2012 17:01:24 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212161701.qBGH1OVF015911@svn.freebsd.org> From: Eitan Adler Date: Sun, 16 Dec 2012 17:01:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r244304 - stable/7/usr.bin/cut X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 17:01:24 -0000 Author: eadler Date: Sun Dec 16 17:01:23 2012 New Revision: 244304 URL: http://svnweb.freebsd.org/changeset/base/244304 Log: MFC r243320,r243474: Add 'w' flag to: Use whitespace (spaces and tabs) as the delimiter. Consecutive spaces and tabs count as one single field separator. Approved by: cperciva (implicit) Modified: stable/7/usr.bin/cut/cut.1 stable/7/usr.bin/cut/cut.c Directory Properties: stable/7/usr.bin/cut/ (props changed) Modified: stable/7/usr.bin/cut/cut.1 ============================================================================== --- stable/7/usr.bin/cut/cut.1 Sun Dec 16 17:01:23 2012 (r244303) +++ stable/7/usr.bin/cut/cut.1 Sun Dec 16 17:01:23 2012 (r244304) @@ -35,7 +35,7 @@ .\" @(#)cut.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd December 21, 2006 +.Dd August 8, 2012 .Dt CUT 1 .Os .Sh NAME @@ -51,7 +51,7 @@ .Op Ar .Nm .Fl f Ar list -.Op Fl d Ar delim +.Op Fl w | Fl d Ar delim .Op Fl s .Op Ar .Sh DESCRIPTION @@ -123,6 +123,9 @@ that form the character are selected. .It Fl s Suppress lines with no field delimiter characters. Unless specified, lines with no delimiters are passed through unmodified. +.It Fl w +Use whitespace (spaces and tabs) as the delimiter. +Consecutive spaces and tabs count as one single field separator. .El .Sh ENVIRONMENT The Modified: stable/7/usr.bin/cut/cut.c ============================================================================== --- stable/7/usr.bin/cut/cut.c Sun Dec 16 17:01:23 2012 (r244303) +++ stable/7/usr.bin/cut/cut.c Sun Dec 16 17:01:23 2012 (r244304) @@ -62,6 +62,7 @@ static int dflag; static int fflag; static int nflag; static int sflag; +static int wflag; static size_t autostart, autostop, maxval; static char * positions; @@ -71,6 +72,7 @@ static int b_n_cut(FILE *, const char *) static int c_cut(FILE *, const char *); static int f_cut(FILE *, const char *); static void get_list(char *); +static int is_delim(wchar_t); static void needpos(size_t); static void usage(void); @@ -88,7 +90,7 @@ main(int argc, char *argv[]) dchar = '\t'; /* default delimiter is \t */ strcpy(dcharmb, "\t"); - while ((ch = getopt(argc, argv, "b:c:d:f:sn")) != -1) + while ((ch = getopt(argc, argv, "b:c:d:f:snw")) != -1) switch(ch) { case 'b': get_list(optarg); @@ -115,6 +117,9 @@ main(int argc, char *argv[]) case 'n': nflag = 1; break; + case 'w': + wflag = 1; + break; case '?': default: usage(); @@ -123,9 +128,9 @@ main(int argc, char *argv[]) argv += optind; if (fflag) { - if (bflag || cflag || nflag) + if (bflag || cflag || nflag || (wflag && dflag)) usage(); - } else if (!(bflag || cflag) || dflag || sflag) + } else if (!(bflag || cflag) || dflag || sflag || wflag) usage(); else if (!bflag && nflag) usage(); @@ -363,18 +368,30 @@ out: } static int +is_delim(wchar_t ch) +{ + if (wflag) { + if (ch == ' ' || ch == '\t') + return 1; + } else { + if (ch == dchar) + return 1; + } + return 0; +} + +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; int field, i, isdelim; char *pos, *p; - wchar_t sep; int output; char *lbuf, *mlbuf; size_t clen, lbuflen, reallen; mlbuf = NULL; - for (sep = dchar; (lbuf = fgetln(fp, &lbuflen)) != NULL;) { + while ((lbuf = fgetln(fp, &lbuflen)) != NULL) { reallen = lbuflen; /* Assert EOL has a newline. */ if (*(lbuf + lbuflen - 1) != '\n') { @@ -398,7 +415,7 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; /* this should work if newline is delimiter */ - if (ch == sep) + if (is_delim(ch)) isdelim = 1; if (ch == '\n') { if (!isdelim && !sflag) @@ -425,8 +442,13 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; p += clen; - if (ch == '\n' || ch == sep) + if (ch == '\n' || is_delim(ch)) { + /* compress whitespace */ + if (wflag && ch != '\n') + while (is_delim(*p)) + p++; break; + } if (*pos) for (i = 0; i < (int)clen; i++) putchar(p[i - clen]); @@ -456,6 +478,6 @@ usage(void) (void)fprintf(stderr, "%s\n%s\n%s\n", "usage: cut -b list [-n] [file ...]", " cut -c list [file ...]", - " cut -f list [-s] [-d delim] [file ...]"); + " cut -f list [-s] [-w | -d delim] [file ...]"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 17:01:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8026D731; Sun, 16 Dec 2012 17:01:24 +0000 (UTC) (envelope-from eadler@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 640E08FC15; Sun, 16 Dec 2012 17:01:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGH1OaJ015918; Sun, 16 Dec 2012 17:01:24 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGH1OW4015913; Sun, 16 Dec 2012 17:01:24 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212161701.qBGH1OW4015913@svn.freebsd.org> From: Eitan Adler Date: Sun, 16 Dec 2012 17:01:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244305 - stable/8/usr.bin/cut X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 17:01:24 -0000 Author: eadler Date: Sun Dec 16 17:01:23 2012 New Revision: 244305 URL: http://svnweb.freebsd.org/changeset/base/244305 Log: MFC r243320,r243474: Add 'w' flag to: Use whitespace (spaces and tabs) as the delimiter. Consecutive spaces and tabs count as one single field separator. Approved by: cperciva (implicit) Modified: stable/8/usr.bin/cut/cut.1 stable/8/usr.bin/cut/cut.c Directory Properties: stable/8/usr.bin/cut/ (props changed) Modified: stable/8/usr.bin/cut/cut.1 ============================================================================== --- stable/8/usr.bin/cut/cut.1 Sun Dec 16 17:01:23 2012 (r244304) +++ stable/8/usr.bin/cut/cut.1 Sun Dec 16 17:01:23 2012 (r244305) @@ -35,7 +35,7 @@ .\" @(#)cut.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd December 21, 2006 +.Dd August 8, 2012 .Dt CUT 1 .Os .Sh NAME @@ -51,7 +51,7 @@ .Op Ar .Nm .Fl f Ar list -.Op Fl d Ar delim +.Op Fl w | Fl d Ar delim .Op Fl s .Op Ar .Sh DESCRIPTION @@ -123,6 +123,9 @@ that form the character are selected. .It Fl s Suppress lines with no field delimiter characters. Unless specified, lines with no delimiters are passed through unmodified. +.It Fl w +Use whitespace (spaces and tabs) as the delimiter. +Consecutive spaces and tabs count as one single field separator. .El .Sh ENVIRONMENT The Modified: stable/8/usr.bin/cut/cut.c ============================================================================== --- stable/8/usr.bin/cut/cut.c Sun Dec 16 17:01:23 2012 (r244304) +++ stable/8/usr.bin/cut/cut.c Sun Dec 16 17:01:23 2012 (r244305) @@ -62,6 +62,7 @@ static int dflag; static int fflag; static int nflag; static int sflag; +static int wflag; static size_t autostart, autostop, maxval; static char * positions; @@ -71,6 +72,7 @@ static int b_n_cut(FILE *, const char *) static int c_cut(FILE *, const char *); static int f_cut(FILE *, const char *); static void get_list(char *); +static int is_delim(wchar_t); static void needpos(size_t); static void usage(void); @@ -88,7 +90,7 @@ main(int argc, char *argv[]) dchar = '\t'; /* default delimiter is \t */ strcpy(dcharmb, "\t"); - while ((ch = getopt(argc, argv, "b:c:d:f:sn")) != -1) + while ((ch = getopt(argc, argv, "b:c:d:f:snw")) != -1) switch(ch) { case 'b': get_list(optarg); @@ -115,6 +117,9 @@ main(int argc, char *argv[]) case 'n': nflag = 1; break; + case 'w': + wflag = 1; + break; case '?': default: usage(); @@ -123,9 +128,9 @@ main(int argc, char *argv[]) argv += optind; if (fflag) { - if (bflag || cflag || nflag) + if (bflag || cflag || nflag || (wflag && dflag)) usage(); - } else if (!(bflag || cflag) || dflag || sflag) + } else if (!(bflag || cflag) || dflag || sflag || wflag) usage(); else if (!bflag && nflag) usage(); @@ -363,18 +368,30 @@ out: } static int +is_delim(wchar_t ch) +{ + if (wflag) { + if (ch == ' ' || ch == '\t') + return 1; + } else { + if (ch == dchar) + return 1; + } + return 0; +} + +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; int field, i, isdelim; char *pos, *p; - wchar_t sep; int output; char *lbuf, *mlbuf; size_t clen, lbuflen, reallen; mlbuf = NULL; - for (sep = dchar; (lbuf = fgetln(fp, &lbuflen)) != NULL;) { + while ((lbuf = fgetln(fp, &lbuflen)) != NULL) { reallen = lbuflen; /* Assert EOL has a newline. */ if (*(lbuf + lbuflen - 1) != '\n') { @@ -398,7 +415,7 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; /* this should work if newline is delimiter */ - if (ch == sep) + if (is_delim(ch)) isdelim = 1; if (ch == '\n') { if (!isdelim && !sflag) @@ -425,8 +442,13 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; p += clen; - if (ch == '\n' || ch == sep) + if (ch == '\n' || is_delim(ch)) { + /* compress whitespace */ + if (wflag && ch != '\n') + while (is_delim(*p)) + p++; break; + } if (*pos) for (i = 0; i < (int)clen; i++) putchar(p[i - clen]); @@ -456,6 +478,6 @@ usage(void) (void)fprintf(stderr, "%s\n%s\n%s\n", "usage: cut -b list [-n] [file ...]", " cut -c list [file ...]", - " cut -f list [-s] [-d delim] [file ...]"); + " cut -f list [-s] [-w | -d delim] [file ...]"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 17:23:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D1010105; Sun, 16 Dec 2012 17:23:15 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id BF7D08FC12; Sun, 16 Dec 2012 17:23:14 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id u54so2370653wey.13 for ; Sun, 16 Dec 2012 09:23:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=Qf/CrXwViehZBv5u242Rd/XOPBQ1xH9u3Vbw87pK0ro=; b=eezZGz36FBJYE9+Mr7kfp8eDQ0ixsO3/5Bqx03BoYpYDADfxWEvHsigq/4b2yadO/C y815LzGo3eBi/QPKZnyJ6hmfMOzjcbBcVb+13MhGfdwMnmwu479E498RSqdgvrPFzwMQ cY8R3MC9D1tJavKodR4w4XCEYmHJJB8MjTV0rlvWK9tFQ9WG8TVmpNwBdmUAHHz+NMDx QeEJZbYxMuHjlKvMCgoDveI6mymNJ+KmLTpv5FWLO35r2JKEX6gfsKxe+m3Ey+rI/JXQ uItRka5YVOPAqXuQGuIWf2OPBG0JahmlTbgIypZaD6ewXsIvZkjpVJNiHmQt6xQ4N1zU ZLiQ== MIME-Version: 1.0 Received: by 10.180.102.234 with SMTP id fr10mr11621007wib.17.1355678593781; Sun, 16 Dec 2012 09:23:13 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.217.57.9 with HTTP; Sun, 16 Dec 2012 09:23:13 -0800 (PST) In-Reply-To: <50CD7C1D.3020108@FreeBSD.org> References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212121046.43706.jhb@freebsd.org> <201212121658.49048.jhb@freebsd.org> <50C90567.8080406@FreeBSD.org> <50C909BD.9090709@mu.org> <50C91B32.4080904@FreeBSD.org> <20121215205202.GF1411@garage.freebsd.pl> <20121216040717.GG35245@server.rulingia.com> <1355634037.1198.115.camel@revolution.hippie.lan> <50CD7C1D.3020108@FreeBSD.org> Date: Sun, 16 Dec 2012 09:23:13 -0800 X-Google-Sender-Auth: 0jKe4sI3oSJS00mCcwnVTOzzzMM Message-ID: Subject: Re: svn commit: r244112 - head/sys/kern From: Adrian Chadd To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Cc: Ian Lepore , src-committers@freebsd.org, Peter Wemm , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Peter Jeremy X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 17:23:15 -0000 On 15 December 2012 23:45, Andriy Gapon wrote: > on 16/12/2012 07:00 Ian Lepore said the following: >> The question here isn't whether aborting or continuing beyond that point >> is a good idea. Some developer already made that choice by coding a >> KASSERT() instead of a panic(). The developer decided that a production >> machine should try to keep running at that point. > > Please don't perpetuate this argument. The point of KASSERT is not that the > developer intended that the system should try to keep running in production. > The point is that (1) the KASSERT should not be hit in production as was > established in testing *and* (2) having all KASSERTs enabled in production is > too expensive. That's all. You can't possibly believe that once the kernel is in production, "testing" stops. That's why Alfred and I want to mak KASSERT() optionally just print that it happened and maybe add some further information, then continue. It doesn't change the status quo with the default, GENERIC "production" kernel. It still crashes where it would normally crash (timing bugs otherwise.) It still won't crash where it wouldn't trigger a kassert. A shipping, production kernel doesn't have KASSERT enabled. You may assert "assertions are supposed to crash", yet we ship with assertions disabled. Please, tell the software engineers here what you think that implies about what we think about those assertions. Let me give you a hint - if you ship with them disabled, they don't get run. So obviously we don't think there's a big enough problem to cause any real issues. Now, this may not be the case at all - in which case, those shouldn't be disabled in production kernels, for all the reasons everyone above has said. Yet, they're disabled. The status quo _does not change_ by default. Adrian From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 18:49:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 30B29507; Sun, 16 Dec 2012 18:49:52 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 138BD8FC0A; Sun, 16 Dec 2012 18:49:50 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id go10so4055447lbb.13 for ; Sun, 16 Dec 2012 10:49:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=MvIJTjkJ7xXBTJRzhnES3xiH7PHqY4d4wyhLrpTm3gc=; b=pWdg4jwZw0DCP511L6AeLD3OVhDFwv1kn0nyZYpEmBcE5DFnrsJl+KX9j0vtwePkj8 rJEZFknJ3OWRq3xDjKES/K3JgyjTsswWfHP0eqGmbpiNrX2+FiVZuirqcN/OlvuNIlF7 tF256deGQ+IogkbUuWCjzCt3TGLxdJYfsiA7pWh+0jfvVkCaYFCp2GLB2xNtKTO04q8g EbBGmFp7EeG9DrYzf8NZnxoVFHtF70eYE9O8FQGwgi+cEg2e5NtsooP5BYRpSibjtmg/ l+Fj38lb6urXo/O6+LL02/eIym2zxt5pKMSaUEaZebsPd0NCcMPpxvGocc4Avi7AI0jw ybxQ== MIME-Version: 1.0 Received: by 10.152.122.133 with SMTP id ls5mr8739597lab.9.1355683789876; Sun, 16 Dec 2012 10:49:49 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.112.84.193 with HTTP; Sun, 16 Dec 2012 10:49:49 -0800 (PST) In-Reply-To: <50CD9B85.1040404@FreeBSD.org> References: <201211251422.qAPEM8BV074656@svn.freebsd.org> <50C9B525.2060503@FreeBSD.org> <50CD9B85.1040404@FreeBSD.org> Date: Sun, 16 Dec 2012 10:49:49 -0800 X-Google-Sender-Auth: VdbwLrzuMaIXKnS18lj-BlxQkSE Message-ID: Subject: Re: svn commit: r243515 - head/sys/kern From: Attilio Rao To: Andriy Gapon 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 18:49:52 -0000 On Sun, Dec 16, 2012 at 1:59 AM, Andriy Gapon wrote: > on 13/12/2012 22:17 Attilio Rao said the following: >> Right, but as I said, for the time being we can at least have a >> correct panic() semantic and take the right time to fix the >> generic_stop_cpus() and then absorb also the panic() fix into it. >> Right now the mechanism is still broken in panic and it can be fixed >> with a very easy fix, so we should just do it. >> This will also help vendors like Sandvine which may have hit just this bug too. > > > Perhaps I got confused... > Could you please re-explain to me your suggestion to fix panic(9)? > Because I thought that it would require exactly the same steps as fixing > generic_stop_cpus(). Sorry about this. - about generic_stop_cpus() we need to implement all the things we discussed which are quite a few and for some things, like avoiding races between stop map, wakeup and set of cupid I admit I'm still not sure how easilly can be done without locking - about panic(), the check is much more easy, just see my first response to Ryan, because we don't have the wakeup/restart race as generic_stop_cpu() does. I propose to at least fix panic for the time being. Once generic_stop_cpus() is fully functional we can get rid of panic() chunk altogether. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 19:17:03 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1103198C; Sun, 16 Dec 2012 19:17:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id B52408FC0C; Sun, 16 Dec 2012 19:17:01 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id VAA16052; Sun, 16 Dec 2012 21:11:03 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1TkJc7-0003Pz-8m; Sun, 16 Dec 2012 21:11:03 +0200 Message-ID: <50CE1CC4.6010607@FreeBSD.org> Date: Sun, 16 Dec 2012 21:11:00 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: attilio@FreeBSD.org Subject: Re: svn commit: r243515 - head/sys/kern References: <201211251422.qAPEM8BV074656@svn.freebsd.org> <50C9B525.2060503@FreeBSD.org> <50CD9B85.1040404@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 19:17:03 -0000 on 16/12/2012 20:49 Attilio Rao said the following: > - about panic(), the check is much more easy, just see my first > response to Ryan, because we don't have the wakeup/restart race as > generic_stop_cpu() does That's what I meant - could you please resend that message to me? -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 20:43:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ED0E5B27; Sun, 16 Dec 2012 20:43:29 +0000 (UTC) (envelope-from marius@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 CFCDA8FC0A; Sun, 16 Dec 2012 20:43:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGKhT6g047441; Sun, 16 Dec 2012 20:43:29 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGKhT3l047440; Sun, 16 Dec 2012 20:43:29 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201212162043.qBGKhT3l047440@svn.freebsd.org> From: Marius Strobl Date: Sun, 16 Dec 2012 20:43:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244307 - head/sys/boot/sparc64/boot1 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 20:43:30 -0000 Author: marius Date: Sun Dec 16 20:43:29 2012 New Revision: 244307 URL: http://svnweb.freebsd.org/changeset/base/244307 Log: Restore pre-r234898 printing of boot loader and path. MFC after: 3 days Modified: head/sys/boot/sparc64/boot1/boot1.c Modified: head/sys/boot/sparc64/boot1/boot1.c ============================================================================== --- head/sys/boot/sparc64/boot1/boot1.c Sun Dec 16 19:51:34 2012 (r244306) +++ head/sys/boot/sparc64/boot1/boot1.c Sun Dec 16 20:43:29 2012 (r244307) @@ -340,11 +340,11 @@ main(int ac, char **av) } #ifdef ZFSBOOT - printf(" \n>> FreeBSD/sparc64 ZFS boot block\n Boot path: %s\n", + printf(" \n>> FreeBSD/sparc64 ZFS boot block\n Boot path: %s\n", bootpath); #else - printf(" \n>> FreeBSD/sparc64 boot block\n Boot path: %s\n" - " Boot loader: %s\n", "", bootpath, path); + printf(" \n>> FreeBSD/sparc64 boot block\n Boot path: %s\n" + " Boot loader: %s\n", bootpath, path); #endif if (domount(bootpath) == -1) From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 20:54:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B9116E1B; Sun, 16 Dec 2012 20:54:07 +0000 (UTC) (envelope-from marius@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 9D7DD8FC12; Sun, 16 Dec 2012 20:54:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGKs7K6048778; Sun, 16 Dec 2012 20:54:07 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGKs7Fx048777; Sun, 16 Dec 2012 20:54:07 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201212162054.qBGKs7Fx048777@svn.freebsd.org> From: Marius Strobl Date: Sun, 16 Dec 2012 20:54:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244308 - head/sys/sparc64/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 20:54:07 -0000 Author: marius Date: Sun Dec 16 20:54:07 2012 New Revision: 244308 URL: http://svnweb.freebsd.org/changeset/base/244308 Log: Revert r237842 and switch back to SCHED_ULE. All problems I encountered with the latter have been fixed with r241780. MFC after: 3 days Modified: head/sys/sparc64/conf/GENERIC Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Sun Dec 16 20:43:29 2012 (r244307) +++ head/sys/sparc64/conf/GENERIC Sun Dec 16 20:54:07 2012 (r244308) @@ -26,7 +26,7 @@ makeoptions DEBUG=-g # Build kernel wit # Platforms supported # At this time all platforms are supported, as-is. -options SCHED_4BSD # 4BSD scheduler +options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 22:59:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3061D6C7; Sun, 16 Dec 2012 22:59:26 +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 1498A8FC1D; Sun, 16 Dec 2012 22:59:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGMxPKe067324; Sun, 16 Dec 2012 22:59:25 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGMxPRK067323; Sun, 16 Dec 2012 22:59:25 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212162259.qBGMxPRK067323@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 16 Dec 2012 22:59:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244316 - head/sbin/savecore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 22:59:26 -0000 Author: pjd Date: Sun Dec 16 22:59:25 2012 New Revision: 244316 URL: http://svnweb.freebsd.org/changeset/base/244316 Log: Prefer snprintf() over sprintf(). Obtained from: WHEEL Systems Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Sun Dec 16 22:06:28 2012 (r244315) +++ head/sbin/savecore/savecore.c Sun Dec 16 22:59:25 2012 (r244316) @@ -543,7 +543,7 @@ DoFile(const char *savedir, const char * writebounds(bounds + 1); - sprintf(buf, "info.%d", bounds); + snprintf(buf, sizeof(buf), "info.%d", bounds); /* * Create or overwrite any existing dump header files. @@ -556,12 +556,12 @@ DoFile(const char *savedir, const char * } oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/ if (compress) { - sprintf(filename, "%s.%d.gz", istextdump ? "textdump.tar" : - "vmcore", bounds); + snprintf(filename, sizeof(filename), "%s.%d.gz", + istextdump ? "textdump.tar" : "vmcore", bounds); fp = zopen(filename, "w"); } else { - sprintf(filename, "%s.%d", istextdump ? "textdump.tar" : - "vmcore", bounds); + snprintf(filename, sizeof(filename), "%s.%d", + istextdump ? "textdump.tar" : "vmcore", bounds); fp = fopen(filename, "w"); } if (fp == NULL) { From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 22:59:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A7060833; Sun, 16 Dec 2012 22:59:59 +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 8ADCD8FC17; Sun, 16 Dec 2012 22:59:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGMxxTo067431; Sun, 16 Dec 2012 22:59:59 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGMxxkC067430; Sun, 16 Dec 2012 22:59:59 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212162259.qBGMxxkC067430@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 16 Dec 2012 22:59:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244317 - head/sbin/savecore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 22:59:59 -0000 Author: pjd Date: Sun Dec 16 22:59:58 2012 New Revision: 244317 URL: http://svnweb.freebsd.org/changeset/base/244317 Log: Sort flags properly. Obtained from: WHEEL Systems Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Sun Dec 16 22:59:25 2012 (r244316) +++ head/sbin/savecore/savecore.c Sun Dec 16 22:59:58 2012 (r244317) @@ -663,15 +663,15 @@ main(int argc, char **argv) case 'c': clear = 1; break; + case 'f': + force = 1; + break; case 'k': keep = 1; break; case 'v': verbose++; break; - case 'f': - force = 1; - break; case 'z': compress = 1; break; From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 23:00:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 21A8399E; Sun, 16 Dec 2012 23:00:14 +0000 (UTC) (envelope-from eadler@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 062FA8FC0A; Sun, 16 Dec 2012 23:00:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGN0Dg9067602; Sun, 16 Dec 2012 23:00:13 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGN0DVw067600; Sun, 16 Dec 2012 23:00:13 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212162300.qBGN0DVw067600@svn.freebsd.org> From: Eitan Adler Date: Sun, 16 Dec 2012 23:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244318 - in head: sbin/setkey usr.sbin/ndp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 23:00:14 -0000 Author: eadler Date: Sun Dec 16 23:00:13 2012 New Revision: 244318 URL: http://svnweb.freebsd.org/changeset/base/244318 Log: Minor wording improvments to some manual pages Approved by: bcr (mentor) Obtained from: DragonflyBSD (a5294ca835317c68c919ab43936da4f05ab6e926) MFC after: 3 days Modified: head/sbin/setkey/setkey.8 head/usr.sbin/ndp/ndp.8 Modified: head/sbin/setkey/setkey.8 ============================================================================== --- head/sbin/setkey/setkey.8 Sun Dec 16 22:59:58 2012 (r244317) +++ head/sbin/setkey/setkey.8 Sun Dec 16 23:00:13 2012 (r244318) @@ -110,7 +110,7 @@ Loop forever and dump all the messages t .Dv PF_KEY socket. .Fl xx -makes each timestamps unformatted. +makes each timestamp unformatted. .El .Ss Configuration syntax With Modified: head/usr.sbin/ndp/ndp.8 ============================================================================== --- head/usr.sbin/ndp/ndp.8 Sun Dec 16 22:59:58 2012 (r244317) +++ head/usr.sbin/ndp/ndp.8 Sun Dec 16 23:00:13 2012 (r244318) @@ -231,8 +231,8 @@ responding to requests for .Ar hostname even though the host address is not its own. .It Fl t -Print timestamp on each entry, -making it possible to merge output with +Print timestamp for each entry, +to make it possible to merge the output with .Xr tcpdump 1 . Most useful when used with .Fl A . From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 23:04:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 04D14C06; Sun, 16 Dec 2012 23:04:32 +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 DE0E28FC18; Sun, 16 Dec 2012 23:04:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGN4Vtc068999; Sun, 16 Dec 2012 23:04:31 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGN4VTI068998; Sun, 16 Dec 2012 23:04:31 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212162304.qBGN4VTI068998@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 16 Dec 2012 23:04:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244319 - head/sbin/savecore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 23:04:32 -0000 Author: pjd Date: Sun Dec 16 23:04:31 2012 New Revision: 244319 URL: http://svnweb.freebsd.org/changeset/base/244319 Log: Make use of the fact that we changed working directory to the dump directory earlier. Obtained from: WHEEL Systems Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Sun Dec 16 23:00:13 2012 (r244318) +++ head/sbin/savecore/savecore.c Sun Dec 16 23:04:31 2012 (r244319) @@ -188,17 +188,16 @@ check_space(const char *savedir, off_t d FILE *fp; off_t minfree, spacefree, totfree, needed; struct statfs fsbuf; - char buf[100], path[MAXPATHLEN]; + char buf[100]; - if (statfs(savedir, &fsbuf) < 0) { + if (statfs(".", &fsbuf) < 0) { syslog(LOG_ERR, "%s: %m", savedir); exit(1); } spacefree = ((off_t) fsbuf.f_bavail * fsbuf.f_bsize) / 1024; totfree = ((off_t) fsbuf.f_bfree * fsbuf.f_bsize) / 1024; - (void)snprintf(path, sizeof(path), "%s/minfree", savedir); - if ((fp = fopen(path, "r")) == NULL) + if ((fp = fopen("minfree", "r")) == NULL) minfree = 0; else { if (fgets(buf, sizeof(buf), fp) == NULL) From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 23:06:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7D1FDDE2; Sun, 16 Dec 2012 23:06:13 +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 616548FC14; Sun, 16 Dec 2012 23:06:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGN6DT7069282; Sun, 16 Dec 2012 23:06:13 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGN6CZR069280; Sun, 16 Dec 2012 23:06:12 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212162306.qBGN6CZR069280@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 16 Dec 2012 23:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244320 - head/sbin/savecore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 23:06:13 -0000 Author: pjd Date: Sun Dec 16 23:06:12 2012 New Revision: 244320 URL: http://svnweb.freebsd.org/changeset/base/244320 Log: Implement -m option to savecore(8) that allows to limit number of kernel dumps stored. Once the limit is reached it restarts from 0. Reviewed by: avg Obtained from: WHEEL Systems Modified: head/sbin/savecore/savecore.8 head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.8 ============================================================================== --- head/sbin/savecore/savecore.8 Sun Dec 16 23:04:31 2012 (r244319) +++ head/sbin/savecore/savecore.8 Sun Dec 16 23:06:12 2012 (r244320) @@ -28,7 +28,7 @@ .\" From: @(#)savecore.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd December 14, 2012 +.Dd December 17, 2012 .Dt SAVECORE 8 .Os .Sh NAME @@ -45,6 +45,7 @@ .Op Ar device ... .Nm .Op Fl fkvz +.Op Fl m Ar maxdumps .Op Ar directory Op Ar device ... .Sh DESCRIPTION The @@ -59,7 +60,7 @@ and enters a reboot message and informat the system log. .Pp The options are as follows: -.Bl -tag -width indent +.Bl -tag -width ".Fl m Ar maxdumps" .It Fl C Check to see if a dump exists, and display a brief message to indicate the status. @@ -77,6 +78,12 @@ Force a dump to be taken even if either dump header information is inconsistent. .It Fl k Do not clear the dump after saving it. +.It Fl m Ar maxdumps +Maximum number of dumps to store. +Once the number of stored dumps is equal to +.Ar maxdumps +the counter will restart from +.Dv 0 . .It Fl v Print out some additional debugging information. Specify twice for more information. Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Sun Dec 16 23:04:31 2012 (r244319) +++ head/sbin/savecore/savecore.c Sun Dec 16 23:06:12 2012 (r244320) @@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$"); static int checkfor, compress, clear, force, keep, verbose; /* flags */ static int nfound, nsaved, nerr; /* statistics */ +static int maxdumps; extern FILE *zopen(const char *, const char *); @@ -178,12 +179,62 @@ writebounds(int bounds) { fclose(fp); } +static off_t +file_size(const char *path) +{ + struct stat sb; + + /* Ignore all errors, those file may not exists. */ + if (stat(path, &sb) == -1) + return (0); + return (sb.st_size); +} + +static off_t +saved_dump_size(int bounds) +{ + static char path[PATH_MAX]; + off_t dumpsize; + + dumpsize = 0; + + (void)snprintf(path, sizeof(path), "info.%d", bounds); + dumpsize += file_size(path); + (void)snprintf(path, sizeof(path), "vmcore.%d", bounds); + dumpsize += file_size(path); + (void)snprintf(path, sizeof(path), "vmcore.%d.gz", bounds); + dumpsize += file_size(path); + (void)snprintf(path, sizeof(path), "textdump.tar.%d", bounds); + dumpsize += file_size(path); + (void)snprintf(path, sizeof(path), "textdump.tar.%d.gz", bounds); + dumpsize += file_size(path); + + return (dumpsize); +} + +static void +saved_dump_remove(int bounds) +{ + static char path[PATH_MAX]; + + (void)snprintf(path, sizeof(path), "info.%d", bounds); + (void)unlink(path); + (void)snprintf(path, sizeof(path), "vmcore.%d", bounds); + (void)unlink(path); + (void)snprintf(path, sizeof(path), "vmcore.%d.gz", bounds); + (void)unlink(path); + (void)snprintf(path, sizeof(path), "textdump.tar.%d", bounds); + (void)unlink(path); + (void)snprintf(path, sizeof(path), "textdump.tar.%d.gz", bounds); + (void)unlink(path); +} + /* * Check that sufficient space is available on the disk that holds the * save directory. */ static int -check_space(const char *savedir, off_t dumpsize) +check_space(const char *savedir, off_t dumpsize, int bounds) { FILE *fp; off_t minfree, spacefree, totfree, needed; @@ -208,7 +259,8 @@ check_space(const char *savedir, off_t d } needed = dumpsize / 1024 + 2; /* 2 for info file */ - if (((minfree > 0) ? spacefree : totfree) - needed < minfree) { + needed -= saved_dump_size(bounds); + if ((minfree > 0 ? spacefree : totfree) - needed < minfree) { syslog(LOG_WARNING, "no dump, not enough free space on device (%lld available, need %lld)", (long long)(minfree > 0 ? spacefree : totfree), @@ -367,7 +419,7 @@ DoTextdumpFile(int fd, off_t dumpsize, o static void DoFile(const char *savedir, const char *device) { - static char filename[PATH_MAX]; + static char infoname[PATH_MAX], corename[PATH_MAX]; static char *buf = NULL; struct kerneldumpheader kdhf, kdhl; off_t mediasize, dumpsize, firsthd, lasthd; @@ -382,6 +434,9 @@ DoFile(const char *savedir, const char * mediasize = 0; status = STATUS_UNKNOWN; + if (maxdumps > 0 && bounds == maxdumps) + bounds = 0; + if (buf == NULL) { buf = malloc(BUFFERSIZE); if (buf == NULL) { @@ -535,19 +590,22 @@ DoFile(const char *savedir, const char * if (verbose) printf("Checking for available free space\n"); - if (!check_space(savedir, dumpsize)) { + + if (!check_space(savedir, dumpsize, bounds)) { nerr++; goto closefd; } writebounds(bounds + 1); - snprintf(buf, sizeof(buf), "info.%d", bounds); + saved_dump_remove(bounds); + + snprintf(infoname, sizeof(infoname), "info.%d", bounds); /* * Create or overwrite any existing dump header files. */ - fdinfo = open(buf, O_WRONLY | O_CREAT | O_TRUNC, 0600); + fdinfo = open(infoname, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fdinfo < 0) { syslog(LOG_ERR, "%s: %m", buf); nerr++; @@ -555,16 +613,16 @@ DoFile(const char *savedir, const char * } oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/ if (compress) { - snprintf(filename, sizeof(filename), "%s.%d.gz", + snprintf(corename, sizeof(corename), "%s.%d.gz", istextdump ? "textdump.tar" : "vmcore", bounds); - fp = zopen(filename, "w"); + fp = zopen(corename, "w"); } else { - snprintf(filename, sizeof(filename), "%s.%d", + snprintf(corename, sizeof(corename), "%s.%d", istextdump ? "textdump.tar" : "vmcore", bounds); - fp = fopen(filename, "w"); + fp = fopen(corename, "w"); } if (fp == NULL) { - syslog(LOG_ERR, "%s: %m", filename); + syslog(LOG_ERR, "%s: %m", corename); close(fdinfo); nerr++; goto closefd; @@ -585,15 +643,15 @@ DoFile(const char *savedir, const char * printheader(info, &kdhl, device, bounds, status); fclose(info); - syslog(LOG_NOTICE, "writing %score to %s", - compress ? "compressed " : "", filename); + syslog(LOG_NOTICE, "writing %score to %s/%s", + compress ? "compressed " : "", savedir, corename); if (istextdump) { if (DoTextdumpFile(fd, dumpsize, lasthd, buf, device, - filename, fp) < 0) + corename, fp) < 0) goto closeall; } else { - if (DoRegularFile(fd, dumpsize, buf, device, filename, fp) + if (DoRegularFile(fd, dumpsize, buf, device, corename, fp) < 0) goto closeall; } @@ -601,10 +659,11 @@ DoFile(const char *savedir, const char * printf("\n"); if (fclose(fp) < 0) { - syslog(LOG_ERR, "error on %s: %m", filename); + syslog(LOG_ERR, "error on %s: %m", corename); nerr++; goto closeall; } + nsaved++; if (verbose) @@ -637,8 +696,8 @@ usage(void) fprintf(stderr, "%s\n%s\n%s\n", "usage: savecore -c [-v] [device ...]", " savecore -C [-v] [device ...]", - " savecore [-fkvz] [directory [device ...]]"); - exit (1); + " savecore [-fkvz] [-m maxdumps] [directory [device ...]]"); + exit(1); } int @@ -654,7 +713,7 @@ main(int argc, char **argv) openlog("savecore", LOG_PERROR, LOG_DAEMON); signal(SIGINFO, infohandler); - while ((ch = getopt(argc, argv, "Ccfkvz")) != -1) + while ((ch = getopt(argc, argv, "Ccfkm:vz")) != -1) switch(ch) { case 'C': checkfor = 1; @@ -668,6 +727,13 @@ main(int argc, char **argv) case 'k': keep = 1; break; + case 'm': + maxdumps = atoi(optarg); + if (maxdumps <= 0) { + syslog(LOG_ERR, "Invalid maxdump value"); + exit(1); + } + break; case 'v': verbose++; break; @@ -682,6 +748,8 @@ main(int argc, char **argv) usage(); if (clear && (compress || keep)) usage(); + if (maxdumps > 0 && (checkfor || clear)) + usage(); argc -= optind; argv += optind; if (argc >= 1 && !checkfor && !clear) { From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 23:09:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4DBF4108; Sun, 16 Dec 2012 23:09:28 +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 184B88FC0A; Sun, 16 Dec 2012 23:09:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGN9Rtb069782; Sun, 16 Dec 2012 23:09:27 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGN9RoU069781; Sun, 16 Dec 2012 23:09:27 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212162309.qBGN9RoU069781@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 16 Dec 2012 23:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244321 - head/sbin/savecore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 23:09:28 -0000 Author: pjd Date: Sun Dec 16 23:09:27 2012 New Revision: 244321 URL: http://svnweb.freebsd.org/changeset/base/244321 Log: With rotating kernel dumps the higest dump number is not necessarily the last one. To make it easier to find the last one create symlinks with 'last' suffix that will point to the files of the last coredump, eg.: info.last -> info.5 textdump.tar.last.gz -> textdump.tar.5.gz Reviewed by: avg Obtained from: WHEEL Systems Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Sun Dec 16 23:06:12 2012 (r244320) +++ head/sbin/savecore/savecore.c Sun Dec 16 23:09:27 2012 (r244321) @@ -229,6 +229,17 @@ saved_dump_remove(int bounds) (void)unlink(path); } +static void +symlinks_remove(void) +{ + + (void)unlink("info.last"); + (void)unlink("vmcore.last"); + (void)unlink("vmcore.last.gz"); + (void)unlink("textdump.tar.last"); + (void)unlink("textdump.tar.last.gz"); +} + /* * Check that sufficient space is available on the disk that holds the * save directory. @@ -419,7 +430,7 @@ DoTextdumpFile(int fd, off_t dumpsize, o static void DoFile(const char *savedir, const char *device) { - static char infoname[PATH_MAX], corename[PATH_MAX]; + static char infoname[PATH_MAX], corename[PATH_MAX], linkname[PATH_MAX]; static char *buf = NULL; struct kerneldumpheader kdhf, kdhl; off_t mediasize, dumpsize, firsthd, lasthd; @@ -664,6 +675,23 @@ DoFile(const char *savedir, const char * goto closeall; } + symlinks_remove(); + if (symlink(infoname, "info.last") == -1) { + syslog(LOG_WARNING, "unable to create symlink %s/%s: %m", + savedir, "info.last"); + } + if (compress) { + snprintf(linkname, sizeof(linkname), "%s.last.gz", + istextdump ? "textdump.tar" : "vmcore"); + } else { + snprintf(linkname, sizeof(linkname), "%s.last", + istextdump ? "textdump.tar" : "vmcore"); + } + if (symlink(corename, linkname) == -1) { + syslog(LOG_WARNING, "unable to create symlink %s/%s: %m", + savedir, linkname); + } + nsaved++; if (verbose) From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 23:29:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3B3FEA67; Sun, 16 Dec 2012 23:29:57 +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 05BB78FC0A; Sun, 16 Dec 2012 23:29:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGNTumt072685; Sun, 16 Dec 2012 23:29:56 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGNTufO072682; Sun, 16 Dec 2012 23:29:56 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212162329.qBGNTufO072682@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 16 Dec 2012 23:29:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244323 - in head: . etc/defaults X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 23:29:57 -0000 Author: pjd Date: Sun Dec 16 23:29:56 2012 New Revision: 244323 URL: http://svnweb.freebsd.org/changeset/base/244323 Log: Use new savecore(8) option and limit number of kernel dumps that will be kept around to the 10 most recent ones. Add UPDATING entry with info how to return to the previous behaviour (no limits). Obtained from: WHEEL Systems Modified: head/UPDATING head/etc/defaults/rc.conf Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Dec 16 23:23:34 2012 (r244322) +++ head/UPDATING Sun Dec 16 23:29:56 2012 (r244323) @@ -26,6 +26,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20121217: + By default, only the 10 most recent kernel dumps will be saved. To + restore the previous behaviour (no limit on the number of kernel dumps + stored in the dump directory) add the following line to /etc/rc.conf: + + savecore_flags="" + 20121201: With the addition of auditdistd(8), a new auditdistd user is now depended on during installworld. "mergemaster -p" can be used to add Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Sun Dec 16 23:23:34 2012 (r244322) +++ head/etc/defaults/rc.conf Sun Dec 16 23:29:56 2012 (r244323) @@ -605,7 +605,9 @@ chkprintcap_enable="NO" # Run chkprintca chkprintcap_flags="-d" # Create missing directories by default. dumpdev="AUTO" # Device to crashdump to (device name, AUTO, or NO). dumpdir="/var/crash" # Directory where crash dumps are to be stored -savecore_flags="" # Used if dumpdev is enabled above, and present. +savecore_flags="-m 10" # Used if dumpdev is enabled above, and present. + # By default, only the 10 most recent kernel dumps + # are saved. crashinfo_enable="YES" # Automatically generate crash dump summary. crashinfo_program="/usr/sbin/crashinfo" # Script to generate crash dump summary. quota_enable="NO" # turn on quotas on startup (or NO). From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 23:32:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3D5CEBF7; Sun, 16 Dec 2012 23:32:22 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id D82598FC15; Sun, 16 Dec 2012 23:32:21 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id wz12so3143850pbc.13 for ; Sun, 16 Dec 2012 15:32:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=gZs04hokNb/P17vOlN2bEyUT7MlpUuHxL75bkJoWbI4=; b=wvs76NLyVGm+8GcfF0/NnbRH8mZ2tZdUqYPg3V3bqvEnO6dXC7GscRdtw4D0/HgAIy k5ZPHM2kAQh7+Rtk8cMa6m1KwyzwDdppP2MNaXVWH13gCmFbWcUQWSIxSXdJ4MKteGoG UVIIIRmNaAmqvLygJ3/sFz8OwNIwoxQ9n+FQ0ZR5OYHrAe7/gvd1iVRoB9rDxZD2YOlk t6ckoaW4DjU392XXafjPmO1fghl8HUW4GIS/oYvEuQ/93lLQCoRiB8FfsFL7k9IBCNIu Ggzm5nKMMz3A/vHlVoBUzKu07DN+4YZjCJPMSRGbtuJv4zzNslcLujCbrRYb2oUhNqff RdIw== Received: by 10.68.130.170 with SMTP id of10mr37725819pbb.131.1355700741515; Sun, 16 Dec 2012 15:32:21 -0800 (PST) Received: from itx (c-24-6-45-85.hsd1.ca.comcast.net. [24.6.45.85]) by mx.google.com with ESMTPS id t5sm7397496paw.20.2012.12.16.15.32.18 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 16 Dec 2012 15:32:20 -0800 (PST) Date: Sun, 16 Dec 2012 15:32:13 -0800 From: Navdeep Parhar To: Adrian Chadd Subject: Re: svn commit: r244112 - head/sys/kern Message-ID: <20121216233213.GA1451@itx> Mail-Followup-To: Adrian Chadd , Andriy Gapon , Ian Lepore , Peter Wemm , Peter Jeremy , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org References: <201212121658.49048.jhb@freebsd.org> <50C90567.8080406@FreeBSD.org> <50C909BD.9090709@mu.org> <50C91B32.4080904@FreeBSD.org> <20121215205202.GF1411@garage.freebsd.pl> <20121216040717.GG35245@server.rulingia.com> <1355634037.1198.115.camel@revolution.hippie.lan> <50CD7C1D.3020108@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Ian Lepore , src-committers@freebsd.org, Peter Wemm , svn-src-all@freebsd.org, Andriy Gapon , svn-src-head@freebsd.org, Peter Jeremy X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 23:32:22 -0000 On Sun, Dec 16, 2012 at 09:23:13AM -0800, Adrian Chadd wrote: > On 15 December 2012 23:45, Andriy Gapon wrote: > > on 16/12/2012 07:00 Ian Lepore said the following: > >> The question here isn't whether aborting or continuing beyond that point > >> is a good idea. Some developer already made that choice by coding a > >> KASSERT() instead of a panic(). The developer decided that a production > >> machine should try to keep running at that point. > > > > Please don't perpetuate this argument. The point of KASSERT is not that the > > developer intended that the system should try to keep running in production. > > The point is that (1) the KASSERT should not be hit in production as was > > established in testing *and* (2) having all KASSERTs enabled in production is > > too expensive. That's all. > > You can't possibly believe that once the kernel is in production, > "testing" stops. > > That's why Alfred and I want to mak KASSERT() optionally just print > that it happened and maybe add some further information, then > continue. > > It doesn't change the status quo with the default, GENERIC > "production" kernel. It still crashes where it would normally crash > (timing bugs otherwise.) It still won't crash where it wouldn't > trigger a kassert. A shipping, production kernel doesn't have KASSERT > enabled. > > You may assert "assertions are supposed to crash", yet we ship with > assertions disabled. Please, tell the software engineers here what you > think that implies about what we think about those assertions. Let me > give you a hint - if you ship with them disabled, they don't get run. > So obviously we don't think there's a big enough problem to cause any > real issues. Now, this may not be the case at all - in which case, > those shouldn't be disabled in production kernels, for all the reasons > everyone above has said. Yet, they're disabled. It is correct (and standard practice) to ship with assertions disabled. This is recognition of the fact that assertions and run time error checks are two different beasts. Anything expressed as a KASSERT really should be ironclad by the time the code is deemed ready for production, and time spent verifying it isn't worth it. Creating a new class of checks for recoverable errors would be welcome. Just report the unexpected state and move on. A subset of these - the lightweight ones - could be enabled in production too, and that would be quite welcome too. Why not introduce new macros? Why change the meaning of a KASSERT? > > The status quo _does not change_ by default. > So now we have a knob that could be used to change the behaviour of all the KASSERTs in the system; one that hints that it may be possible to continue even if an assertion in the FreeBSD kernel doesn't hold good (this is the part that bothers me). I know all the KASSERTs I've looked at or written are genuine assertions -- the code simply wouldn't be able to cope if they were violated. You'd get NULL dereferences, or worse, access protected structures without corresponding locks held, etc. Regards, Navdeep From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 23:41:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98C8031B; Sun, 16 Dec 2012 23:41:36 +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 78D758FC13; Sun, 16 Dec 2012 23:41:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGNfaiF074414; Sun, 16 Dec 2012 23:41:36 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGNfYem074402; Sun, 16 Dec 2012 23:41:34 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212162341.qBGNfYem074402@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 16 Dec 2012 23:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244324 - in stable/9/sys: kern security/audit X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 23:41:36 -0000 Author: pjd Date: Sun Dec 16 23:41:34 2012 New Revision: 244324 URL: http://svnweb.freebsd.org/changeset/base/244324 Log: MFC r243719,r243720,r243722,r243723,r243726,r243727,r243746: r243719: IFp4 @208450: Remove redundant call to AUDIT_ARG_UPATH1(). Path will be remembered by the following NDINIT(AUDITVNODE1) call. Sponsored by: The FreeBSD Foundation (auditdistd) r243720: IFp4 @208381: For VOP_GETATTR() we just need vnode to be shared-locked. Sponsored by: The FreeBSD Foundation (auditdistd) r243722: IFp4 @208382: Currently on each record write we call VFS_STATFS() to get available space on the file system as well as VOP_GETATTR() to get trail file size. We can assume that trail file is only updated by the audit worker, so instead of asking for file size on every write, get file size on trail switch only (it should be zero, but it's not expensive) and use global variable audit_size protected by the audit worker lock to keep track of trail file's size. This eliminates VOP_GETATTR() call for every write. VFS_STATFS() is satisfied from in-memory data (mount->mnt_stat), so shouldn't be expensive. Sponsored by: The FreeBSD Foundation (auditdistd) r243723: IFp4 @208383: Currently when we discover that trail file is greater than configured limit we send AUDIT_TRIGGER_ROTATE_KERNEL trigger to the auditd daemon once. If for some reason auditd didn't rotate trail file it will never be rotated. Change it by sending the trigger when trail file size grows by the configured limit. For example if the limit is 1MB, we will send trigger on 1MB, 2MB, 3MB, etc. This is also needed for the auditd change that will be committed soon where auditd may ignore the trigger - it might be ignored if kernel requests the trail file to be rotated too quickly (often than once a second) which would result in overwriting previous trail file. Sponsored by: The FreeBSD Foundation (auditdistd) r243726: IFp4 @208451: Fix path handling for *at() syscalls. Before the change directory descriptor was totally ignored, so the relative path argument was appended to current working directory path and not to the path provided by descriptor, thus wrong paths were stored in audit logs. Now that we use directory descriptor in vfs_lookup, move AUDIT_ARG_UPATH1() and AUDIT_ARG_UPATH2() calls to the place where we hold file descriptors table lock, so we are sure paths will be resolved according to the same directory in audit record and in actual operation. Sponsored by: The FreeBSD Foundation (auditdistd) Reviewed by: rwatson r243727: IFp4 @208452: Audit handling for missing events: - AUE_READLINKAT - AUE_FACCESSAT - AUE_MKDIRAT - AUE_MKFIFOAT - AUE_MKNODAT - AUE_SYMLINKAT Sponsored by: FreeBSD Foundation (auditdistd) r243746: Fix one more compilation issue. Sponsored by: FreeBSD Foundation (auditdistd) Modified: stable/9/sys/kern/vfs_lookup.c stable/9/sys/kern/vfs_mount.c stable/9/sys/security/audit/audit.c stable/9/sys/security/audit/audit.h stable/9/sys/security/audit/audit_arg.c stable/9/sys/security/audit/audit_bsm.c stable/9/sys/security/audit/audit_bsm_klib.c stable/9/sys/security/audit/audit_private.h stable/9/sys/security/audit/audit_worker.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_lookup.c ============================================================================== --- stable/9/sys/kern/vfs_lookup.c Sun Dec 16 23:29:56 2012 (r244323) +++ stable/9/sys/kern/vfs_lookup.c Sun Dec 16 23:41:34 2012 (r244324) @@ -163,17 +163,6 @@ namei(struct nameidata *ndp) error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN, (size_t *)&ndp->ni_pathlen); - if (error == 0) { - /* - * If we are auditing the kernel pathname, save the user - * pathname. - */ - if (cnp->cn_flags & AUDITVNODE1) - AUDIT_ARG_UPATH1(td, cnp->cn_pnbuf); - if (cnp->cn_flags & AUDITVNODE2) - AUDIT_ARG_UPATH2(td, cnp->cn_pnbuf); - } - /* * Don't allow empty pathnames. */ @@ -216,6 +205,14 @@ namei(struct nameidata *ndp) ndp->ni_rootdir = fdp->fd_rdir; ndp->ni_topdir = fdp->fd_jdir; + /* + * If we are auditing the kernel pathname, save the user pathname. + */ + if (cnp->cn_flags & AUDITVNODE1) + AUDIT_ARG_UPATH1(td, ndp->ni_dirfd, cnp->cn_pnbuf); + if (cnp->cn_flags & AUDITVNODE2) + AUDIT_ARG_UPATH2(td, ndp->ni_dirfd, cnp->cn_pnbuf); + dp = NULL; if (cnp->cn_pnbuf[0] != '/') { if (ndp->ni_startdir != NULL) { Modified: stable/9/sys/kern/vfs_mount.c ============================================================================== --- stable/9/sys/kern/vfs_mount.c Sun Dec 16 23:29:56 2012 (r244323) +++ stable/9/sys/kern/vfs_mount.c Sun Dec 16 23:41:34 2012 (r244324) @@ -1169,7 +1169,6 @@ sys_unmount(td, uap) } mtx_unlock(&mountlist_mtx); } else { - AUDIT_ARG_UPATH1(td, pathbuf); /* * Try to find global path for path argument. */ Modified: stable/9/sys/security/audit/audit.c ============================================================================== --- stable/9/sys/security/audit/audit.c Sun Dec 16 23:29:56 2012 (r244323) +++ stable/9/sys/security/audit/audit.c Sun Dec 16 23:41:34 2012 (r244324) @@ -691,7 +691,7 @@ audit_proc_coredump(struct thread *td, c if (path != NULL) { pathp = &ar->k_ar.ar_arg_upath1; *pathp = malloc(MAXPATHLEN, M_AUDITPATH, M_WAITOK); - audit_canon_path(td, path, *pathp); + audit_canon_path(td, AT_FDCWD, path, *pathp); ARG_SET_VALID(ar, ARG_UPATH1); } ar->k_ar.ar_arg_signum = td->td_proc->p_sig; Modified: stable/9/sys/security/audit/audit.h ============================================================================== --- stable/9/sys/security/audit/audit.h Sun Dec 16 23:29:56 2012 (r244323) +++ stable/9/sys/security/audit/audit.h Sun Dec 16 23:41:34 2012 (r244324) @@ -99,8 +99,8 @@ void audit_arg_sockaddr(struct thread * void audit_arg_auid(uid_t auid); void audit_arg_auditinfo(struct auditinfo *au_info); void audit_arg_auditinfo_addr(struct auditinfo_addr *au_info); -void audit_arg_upath1(struct thread *td, char *upath); -void audit_arg_upath2(struct thread *td, char *upath); +void audit_arg_upath1(struct thread *td, int dirfd, char *upath); +void audit_arg_upath2(struct thread *td, int dirfd, char *upath); void audit_arg_vnode1(struct vnode *vp); void audit_arg_vnode2(struct vnode *vp); void audit_arg_text(char *text); @@ -276,14 +276,14 @@ void audit_thread_free(struct thread *t audit_arg_uid((uid)); \ } while (0) -#define AUDIT_ARG_UPATH1(td, upath) do { \ +#define AUDIT_ARG_UPATH1(td, dirfd, upath) do { \ if (AUDITING_TD(curthread)) \ - audit_arg_upath1((td), (upath)); \ + audit_arg_upath1((td), (dirfd), (upath)); \ } while (0) -#define AUDIT_ARG_UPATH2(td, upath) do { \ +#define AUDIT_ARG_UPATH2(td, dirfd, upath) do { \ if (AUDITING_TD(curthread)) \ - audit_arg_upath2((td), (upath)); \ + audit_arg_upath2((td), (dirfd), (upath)); \ } while (0) #define AUDIT_ARG_VALUE(value) do { \ @@ -356,8 +356,8 @@ void audit_thread_free(struct thread *t #define AUDIT_ARG_SUID(suid) #define AUDIT_ARG_TEXT(text) #define AUDIT_ARG_UID(uid) -#define AUDIT_ARG_UPATH1(td, upath) -#define AUDIT_ARG_UPATH2(td, upath) +#define AUDIT_ARG_UPATH1(td, dirfd, upath) +#define AUDIT_ARG_UPATH2(td, dirfd, upath) #define AUDIT_ARG_VALUE(value) #define AUDIT_ARG_VNODE1(vp) #define AUDIT_ARG_VNODE2(vp) Modified: stable/9/sys/security/audit/audit_arg.c ============================================================================== --- stable/9/sys/security/audit/audit_arg.c Sun Dec 16 23:29:56 2012 (r244323) +++ stable/9/sys/security/audit/audit_arg.c Sun Dec 16 23:41:34 2012 (r244324) @@ -463,7 +463,8 @@ audit_arg_sockaddr(struct thread *td, st break; case AF_UNIX: - audit_arg_upath1(td, ((struct sockaddr_un *)sa)->sun_path); + audit_arg_upath1(td, AT_FDCWD, + ((struct sockaddr_un *)sa)->sun_path); ARG_SET_VALID(ar, ARG_SADDRUNIX); break; /* XXXAUDIT: default:? */ @@ -710,16 +711,16 @@ audit_arg_file(struct proc *p, struct fi * freed when the audit record is freed. */ static void -audit_arg_upath(struct thread *td, char *upath, char **pathp) +audit_arg_upath(struct thread *td, int dirfd, char *upath, char **pathp) { if (*pathp == NULL) *pathp = malloc(MAXPATHLEN, M_AUDITPATH, M_WAITOK); - audit_canon_path(td, upath, *pathp); + audit_canon_path(td, dirfd, upath, *pathp); } void -audit_arg_upath1(struct thread *td, char *upath) +audit_arg_upath1(struct thread *td, int dirfd, char *upath) { struct kaudit_record *ar; @@ -727,12 +728,12 @@ audit_arg_upath1(struct thread *td, char if (ar == NULL) return; - audit_arg_upath(td, upath, &ar->k_ar.ar_arg_upath1); + audit_arg_upath(td, dirfd, upath, &ar->k_ar.ar_arg_upath1); ARG_SET_VALID(ar, ARG_UPATH1); } void -audit_arg_upath2(struct thread *td, char *upath) +audit_arg_upath2(struct thread *td, int dirfd, char *upath) { struct kaudit_record *ar; @@ -740,7 +741,7 @@ audit_arg_upath2(struct thread *td, char if (ar == NULL) return; - audit_arg_upath(td, upath, &ar->k_ar.ar_arg_upath2); + audit_arg_upath(td, dirfd, upath, &ar->k_ar.ar_arg_upath2); ARG_SET_VALID(ar, ARG_UPATH2); } Modified: stable/9/sys/security/audit/audit_bsm.c ============================================================================== --- stable/9/sys/security/audit/audit_bsm.c Sun Dec 16 23:29:56 2012 (r244323) +++ stable/9/sys/security/audit/audit_bsm.c Sun Dec 16 23:41:34 2012 (r244324) @@ -724,13 +724,6 @@ kaudit_to_bsm(struct kaudit_record *kar, */ break; - case AUE_MKFIFO: - if (ARG_IS_VALID(kar, ARG_MODE)) { - tok = au_to_arg32(2, "mode", ar->ar_arg_mode); - kau_write(rec, tok); - } - /* FALLTHROUGH */ - case AUE_CHDIR: case AUE_CHROOT: case AUE_FSTATAT: @@ -743,6 +736,7 @@ kaudit_to_bsm(struct kaudit_record *kar, case AUE_LPATHCONF: case AUE_PATHCONF: case AUE_READLINK: + case AUE_READLINKAT: case AUE_REVOKE: case AUE_RMDIR: case AUE_SEARCHFS: @@ -762,6 +756,8 @@ kaudit_to_bsm(struct kaudit_record *kar, case AUE_ACCESS: case AUE_EACCESS: + case AUE_FACCESSAT: + ATFD1_TOKENS(1); UPATH1_VNODE1_TOKENS; if (ARG_IS_VALID(kar, ARG_VALUE)) { tok = au_to_arg32(2, "mode", ar->ar_arg_value); @@ -1059,6 +1055,10 @@ kaudit_to_bsm(struct kaudit_record *kar, break; case AUE_MKDIR: + case AUE_MKDIRAT: + case AUE_MKFIFO: + case AUE_MKFIFOAT: + ATFD1_TOKENS(1); if (ARG_IS_VALID(kar, ARG_MODE)) { tok = au_to_arg32(2, "mode", ar->ar_arg_mode); kau_write(rec, tok); @@ -1067,6 +1067,8 @@ kaudit_to_bsm(struct kaudit_record *kar, break; case AUE_MKNOD: + case AUE_MKNODAT: + ATFD1_TOKENS(1); if (ARG_IS_VALID(kar, ARG_MODE)) { tok = au_to_arg32(2, "mode", ar->ar_arg_mode); kau_write(rec, tok); @@ -1546,10 +1548,12 @@ kaudit_to_bsm(struct kaudit_record *kar, break; case AUE_SYMLINK: + case AUE_SYMLINKAT: if (ARG_IS_VALID(kar, ARG_TEXT)) { tok = au_to_text(ar->ar_arg_text); kau_write(rec, tok); } + ATFD1_TOKENS(1); UPATH1_VNODE1_TOKENS; break; Modified: stable/9/sys/security/audit/audit_bsm_klib.c ============================================================================== --- stable/9/sys/security/audit/audit_bsm_klib.c Sun Dec 16 23:29:56 2012 (r244323) +++ stable/9/sys/security/audit/audit_bsm_klib.c Sun Dec 16 23:41:34 2012 (r244324) @@ -462,13 +462,13 @@ auditon_command_event(int cmd) * leave the filename starting with '/' in the audit log in this case. */ void -audit_canon_path(struct thread *td, char *path, char *cpath) +audit_canon_path(struct thread *td, int dirfd, char *path, char *cpath) { struct vnode *cvnp, *rvnp; char *rbuf, *fbuf, *copy; struct filedesc *fdp; struct sbuf sbf; - int error, cwir; + int error, needslash, vfslocked; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s: at %s:%d", __func__, __FILE__, __LINE__); @@ -491,10 +491,27 @@ audit_canon_path(struct thread *td, char * path. */ if (*path != '/') { - cvnp = fdp->fd_cdir; - vhold(cvnp); + if (dirfd == AT_FDCWD) { + cvnp = fdp->fd_cdir; + vhold(cvnp); + } else { + /* XXX: fgetvp() that vhold()s vnode instead of vref()ing it would be better */ + error = fgetvp(td, dirfd, 0, &cvnp); + if (error) { + cpath[0] = '\0'; + if (rvnp != NULL) + vdrop(rvnp); + return; + } + vhold(cvnp); + vfslocked = VFS_LOCK_GIANT(cvnp->v_mount); + vrele(cvnp); + VFS_UNLOCK_GIANT(vfslocked); + } + needslash = (fdp->fd_rdir != cvnp); + } else { + needslash = 1; } - cwir = (fdp->fd_rdir == fdp->fd_cdir); FILEDESC_SUNLOCK(fdp); /* * NB: We require that the supplied array be at least MAXPATHLEN bytes @@ -536,7 +553,7 @@ audit_canon_path(struct thread *td, char (void) sbuf_cat(&sbf, rbuf); free(fbuf, M_TEMP); } - if (cwir == 0 || (cwir != 0 && cvnp == NULL)) + if (needslash) (void) sbuf_putc(&sbf, '/'); /* * Now that we have processed any alternate root and relative path Modified: stable/9/sys/security/audit/audit_private.h ============================================================================== --- stable/9/sys/security/audit/audit_private.h Sun Dec 16 23:29:56 2012 (r244323) +++ stable/9/sys/security/audit/audit_private.h Sun Dec 16 23:41:34 2012 (r244324) @@ -388,7 +388,8 @@ au_event_t audit_flags_and_error_to_ope au_event_t audit_flags_and_error_to_openatevent(int oflags, int error); au_event_t audit_msgctl_to_event(int cmd); au_event_t audit_semctl_to_event(int cmr); -void audit_canon_path(struct thread *td, char *path, char *cpath); +void audit_canon_path(struct thread *td, int dirfd, char *path, + char *cpath); au_event_t auditon_command_event(int cmd); /* Modified: stable/9/sys/security/audit/audit_worker.c ============================================================================== --- stable/9/sys/security/audit/audit_worker.c Sun Dec 16 23:29:56 2012 (r244323) +++ stable/9/sys/security/audit/audit_worker.c Sun Dec 16 23:41:34 2012 (r244324) @@ -88,6 +88,7 @@ static struct proc *audit_thread; static int audit_file_rotate_wait; static struct ucred *audit_cred; static struct vnode *audit_vp; +static off_t audit_size; static struct sx audit_worker_lock; #define AUDIT_WORKER_LOCK_INIT() sx_init(&audit_worker_lock, \ @@ -115,7 +116,6 @@ audit_record_write(struct vnode *vp, str struct statfs *mnt_stat; int error, vfslocked; static int cur_fail; - struct vattr vattr; long temp; AUDIT_WORKER_LOCK_ASSERT(); @@ -134,12 +134,6 @@ audit_record_write(struct vnode *vp, str error = VFS_STATFS(vp->v_mount, mnt_stat); if (error) goto fail; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - error = VOP_GETATTR(vp, &vattr, cred); - VOP_UNLOCK(vp, 0); - if (error) - goto fail; - audit_fstat.af_currsz = vattr.va_size; /* * We handle four different space-related limits: @@ -196,11 +190,11 @@ audit_record_write(struct vnode *vp, str * to the daemon. This is only approximate, which is fine as more * records may be generated before the daemon rotates the file. */ - if ((audit_fstat.af_filesz != 0) && (audit_file_rotate_wait == 0) && - (vattr.va_size >= audit_fstat.af_filesz)) { + if (audit_fstat.af_filesz != 0 && + audit_size >= audit_fstat.af_filesz * (audit_file_rotate_wait + 1)) { AUDIT_WORKER_LOCK_ASSERT(); - audit_file_rotate_wait = 1; + audit_file_rotate_wait++; (void)audit_send_trigger(AUDIT_TRIGGER_ROTATE_KERNEL); } @@ -239,6 +233,8 @@ audit_record_write(struct vnode *vp, str goto fail_enospc; else if (error) goto fail; + AUDIT_WORKER_LOCK_ASSERT(); + audit_size += len; /* * Catch completion of a queue drain here; if we're draining and the @@ -452,10 +448,20 @@ audit_rotate_vnode(struct ucred *cred, s struct ucred *old_audit_cred; struct vnode *old_audit_vp; int vfslocked; + struct vattr vattr; KASSERT((cred != NULL && vp != NULL) || (cred == NULL && vp == NULL), ("audit_rotate_vnode: cred %p vp %p", cred, vp)); + if (vp != NULL) { + vn_lock(vp, LK_SHARED | LK_RETRY); + if (VOP_GETATTR(vp, &vattr, cred) != 0) + vattr.va_size = 0; + VOP_UNLOCK(vp, 0); + } else { + vattr.va_size = 0; + } + /* * Rotate the vnode/cred, and clear the rotate flag so that we will * send a rotate trigger if the new file fills. @@ -465,6 +471,7 @@ audit_rotate_vnode(struct ucred *cred, s old_audit_vp = audit_vp; audit_cred = cred; audit_vp = vp; + audit_size = vattr.va_size; audit_file_rotate_wait = 0; audit_enabled = (audit_vp != NULL); AUDIT_WORKER_UNLOCK(); From owner-svn-src-all@FreeBSD.ORG Sun Dec 16 23:47:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1252F4F4; Sun, 16 Dec 2012 23:47:00 +0000 (UTC) (envelope-from hrs@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 EC94B8FC0A; Sun, 16 Dec 2012 23:46:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGNkxPr075047; Sun, 16 Dec 2012 23:46:59 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGNkxZS075046; Sun, 16 Dec 2012 23:46:59 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201212162346.qBGNkxZS075046@svn.freebsd.org> From: Hiroki Sato Date: Sun, 16 Dec 2012 23:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244325 - head/sbin/route X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 23:47:00 -0000 Author: hrs Date: Sun Dec 16 23:46:59 2012 New Revision: 244325 URL: http://svnweb.freebsd.org/changeset/base/244325 Log: - Fix strtol() error handling. - Add a range condition of given FIB number and the related error messages. - Fix free() problem. Spotted by: Artyom Mirgorodskiy Discussed with: glebius Modified: head/sbin/route/route.c Modified: head/sbin/route/route.c ============================================================================== --- head/sbin/route/route.c Sun Dec 16 23:41:34 2012 (r244324) +++ head/sbin/route/route.c Sun Dec 16 23:46:59 2012 (r244325) @@ -260,19 +260,25 @@ static int fiboptlist_range(const char *arg, struct fibl_head_t *flh) { struct fibl *fl; - char *str, *token, *endptr; + char *str0, *str, *token, *endptr; int fib[2], i, error; - str = strdup(arg); + str0 = str = strdup(arg); error = 0; i = 0; while ((token = strsep(&str, "-")) != NULL) { switch (i) { case 0: case 1: + errno = 0; fib[i] = strtol(token, &endptr, 0); - if (*endptr != '\0' || (fib[i] == 0 && - (errno == EINVAL || errno == ERANGE))) + if (errno == 0) { + if (*endptr != '\0' || + fib[i] < 0 || + (numfibs != -1 && fib[i] > numfibs - 1)) + errno = EINVAL; + } + if (errno) error = 1; break; default: @@ -296,7 +302,7 @@ fiboptlist_range(const char *arg, struct TAILQ_INSERT_TAIL(flh, fl, fl_next); } fiboptlist_range_ret: - free(str); + free(str0); return (error); } @@ -305,7 +311,7 @@ static int fiboptlist_csv(const char *arg, struct fibl_head_t *flh) { struct fibl *fl; - char *str, *token, *endptr; + char *str0, *str, *token, *endptr; int fib, error; if (strcmp("all", arg) == 0) { @@ -319,14 +325,14 @@ fiboptlist_csv(const char *arg, struct f else snprintf(str, ALLSTRLEN - 1, "%d", 0); } else if (strcmp("default", arg) == 0) { - str = calloc(1, ALLSTRLEN); + str0 = str = calloc(1, ALLSTRLEN); if (str == NULL) { error = 1; goto fiboptlist_csv_ret; } snprintf(str, ALLSTRLEN - 1, "%d", defaultfib); } else - str = strdup(arg); + str0 = str = strdup(arg); error = 0; while ((token = strsep(&str, ",")) != NULL) { @@ -335,9 +341,15 @@ fiboptlist_csv(const char *arg, struct f if (error) goto fiboptlist_csv_ret; } else { + errno = 0; fib = strtol(token, &endptr, 0); - if (*endptr != '\0' || (fib == 0 && - (errno == EINVAL || errno == ERANGE))) { + if (errno == 0) { + if (*endptr != '\0' || + fib < 0 || + (numfibs != -1 && fib > numfibs - 1)) + errno = EINVAL; + } + if (errno) { error = 1; goto fiboptlist_csv_ret; } @@ -351,7 +363,7 @@ fiboptlist_csv(const char *arg, struct f } } fiboptlist_csv_ret: - free(str); + free(str0); return (error); } @@ -396,7 +408,7 @@ flushroutes(int argc, char *argv[]) usage(*argv); error = fiboptlist_csv(*++argv, &fibl_head); if (error) - usage(*argv); + errx(EX_USAGE, "invalid fib number: %s", *argv); break; default: usage(*argv); @@ -815,7 +827,8 @@ newroute(int argc, char **argv) usage(NULL); error = fiboptlist_csv(*++argv, &fibl_head); if (error) - usage(NULL); + errx(EX_USAGE, + "invalid fib number: %s", *argv); break; case K_IFA: if (!--argc) @@ -1383,10 +1396,16 @@ monitor(int argc, char *argv[]) case K_FIB: if (!--argc) usage(*argv); + errno = 0; fib = strtol(*++argv, &endptr, 0); - if (*endptr != '\0' || (fib == 0 && - (errno == EINVAL || errno == ERANGE))) - usage(*argv); + if (errno == 0) { + if (*endptr != '\0' || + fib < 0 || + (numfibs != -1 && fib > numfibs - 1)) + errno = EINVAL; + } + if (errno) + errx(EX_USAGE, "invalid fib number: %s", *argv); break; default: usage(*argv); From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 00:31:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F12D3705; Mon, 17 Dec 2012 00:31:55 +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 BD33A8FC15; Mon, 17 Dec 2012 00:31:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH0VtDN082033; Mon, 17 Dec 2012 00:31:55 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH0VtBZ082032; Mon, 17 Dec 2012 00:31:55 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201212170031.qBH0VtBZ082032@svn.freebsd.org> From: Rick Macklem Date: Mon, 17 Dec 2012 00:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244331 - head/usr.sbin/gssd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 00:31:56 -0000 Author: rmacklem Date: Mon Dec 17 00:31:55 2012 New Revision: 244331 URL: http://svnweb.freebsd.org/changeset/base/244331 Log: Fix the gssd daemon so that it uses syslog() to report an error instead of calling err() when it is daemonized, so that the error gets logged. Discussed with: rwatson, jhb Tested by: Illias A. Marinos, Herbert Poeckl MFC after: 2 weeks Modified: head/usr.sbin/gssd/gssd.c Modified: head/usr.sbin/gssd/gssd.c ============================================================================== --- head/usr.sbin/gssd/gssd.c Mon Dec 17 00:22:48 2012 (r244330) +++ head/usr.sbin/gssd/gssd.c Mon Dec 17 00:31:55 2012 (r244331) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -106,21 +107,43 @@ main(int argc, char **argv) sun.sun_len = SUN_LEN(&sun); fd = socket(AF_LOCAL, SOCK_STREAM, 0); if (!fd) { + if (debug_level == 0) { + syslog(LOG_ERR, "Can't create local gssd socket"); + exit(1); + } err(1, "Can't create local gssd socket"); } oldmask = umask(S_IXUSR|S_IRWXG|S_IRWXO); if (bind(fd, (struct sockaddr *) &sun, sun.sun_len) < 0) { + if (debug_level == 0) { + syslog(LOG_ERR, "Can't bind local gssd socket"); + exit(1); + } err(1, "Can't bind local gssd socket"); } umask(oldmask); if (listen(fd, SOMAXCONN) < 0) { + if (debug_level == 0) { + syslog(LOG_ERR, "Can't listen on local gssd socket"); + exit(1); + } err(1, "Can't listen on local gssd socket"); } xprt = svc_vc_create(fd, RPC_MAXDATASIZE, RPC_MAXDATASIZE); if (!xprt) { + if (debug_level == 0) { + syslog(LOG_ERR, + "Can't create transport for local gssd socket"); + exit(1); + } err(1, "Can't create transport for local gssd socket"); } if (!svc_reg(xprt, GSSD, GSSDVERS, gssd_1, NULL)) { + if (debug_level == 0) { + syslog(LOG_ERR, + "Can't register service for local gssd socket"); + exit(1); + } err(1, "Can't register service for local gssd socket"); } From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 00:34:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 67E33898; Mon, 17 Dec 2012 00:34:08 +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 33AF08FC14; Mon, 17 Dec 2012 00:34:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH0Y8UY082379; Mon, 17 Dec 2012 00:34:08 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH0Y8mA082378; Mon, 17 Dec 2012 00:34:08 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201212170034.qBH0Y8mA082378@svn.freebsd.org> From: Rui Paulo Date: Mon, 17 Dec 2012 00:34:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244332 - head/sys/boot/i386/efi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 00:34:08 -0000 Author: rpaulo Date: Mon Dec 17 00:34:07 2012 New Revision: 244332 URL: http://svnweb.freebsd.org/changeset/base/244332 Log: amd64 only has rela sections. Modified: head/sys/boot/i386/efi/ldscript.amd64 Modified: head/sys/boot/i386/efi/ldscript.amd64 ============================================================================== --- head/sys/boot/i386/efi/ldscript.amd64 Mon Dec 17 00:31:55 2012 (r244331) +++ head/sys/boot/i386/efi/ldscript.amd64 Mon Dec 17 00:34:07 2012 (r244332) @@ -50,19 +50,19 @@ SECTIONS . = ALIGN(4096); .dynamic : { *(.dynamic) } . = ALIGN(4096); - .rel.dyn : { - *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) - *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) - *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) - *(.rel.got) - *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) - *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) - *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) - *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) - *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) - *(.rel.plt) + .rela.dyn : { + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) + *(.rela.got) + *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) + *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) + *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) + *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) + *(.rela.plt) *(.relset_*) - *(.rel.dyn .rel.dyn.*) + *(.rela.dyn .rela.dyn.*) } . = ALIGN(4096); .reloc : { *(.reloc) } From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 03:05:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4A14574; Mon, 17 Dec 2012 03:05:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com [74.125.82.52]) by mx1.freebsd.org (Postfix) with ESMTP id 73AAC8FC15; Mon, 17 Dec 2012 03:05:50 +0000 (UTC) Received: by mail-wg0-f52.google.com with SMTP id 12so2322569wgh.31 for ; Sun, 16 Dec 2012 19:05:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=5b+Y5VaffajkbEZaMEvwnmiMVnw1d7NpqZHlqbpHCq8=; b=oc8+VVcCzYV0WRxXH7hFRFt8KO3gKJ/sq768W8Idhqzg+0L51PyLJDJVEerrqsF/HN CQHbRB1TJ3n50i+kLoy2vNwo8N0JW/Lwk+ADzOxEcBipEv2WwIUy1bizv9Ck2J6NIsMu aQfK871UlhcKirdrtKsXRNenD5QubXZC/WhJ3TIj/ATes/GfMIxf2CWlmkTloM3ycxOh onXCqD5ITIsGl+Vlsg8jQ2slEBTd5AdDfq3F5LX3ZXSbd2oSevG0WkU8Yu5/qcXo5tdP rAj4/G37d5Yg63WacU+jW8eYj4q34p+NNgYVZ09zciT9xMrGKypo9f5wDn/wN906/JUN Jfaw== MIME-Version: 1.0 Received: by 10.180.103.106 with SMTP id fv10mr13101133wib.19.1355713549388; Sun, 16 Dec 2012 19:05:49 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.217.57.9 with HTTP; Sun, 16 Dec 2012 19:05:48 -0800 (PST) In-Reply-To: <20121216233213.GA1451@itx> References: <201212121658.49048.jhb@freebsd.org> <50C90567.8080406@FreeBSD.org> <50C909BD.9090709@mu.org> <50C91B32.4080904@FreeBSD.org> <20121215205202.GF1411@garage.freebsd.pl> <20121216040717.GG35245@server.rulingia.com> <1355634037.1198.115.camel@revolution.hippie.lan> <50CD7C1D.3020108@FreeBSD.org> <20121216233213.GA1451@itx> Date: Sun, 16 Dec 2012 19:05:48 -0800 X-Google-Sender-Auth: rDPQ9t0DnAfUeZ0utfIKiza8GL0 Message-ID: Subject: Re: svn commit: r244112 - head/sys/kern From: Adrian Chadd To: Adrian Chadd , Andriy Gapon , Ian Lepore , Peter Wemm , Peter Jeremy , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 03:05:52 -0000 On 16 December 2012 15:32, Navdeep Parhar wrote: >> The status quo _does not change_ by default. > > So now we have a knob that could be used to change the behaviour of all > the KASSERTs in the system; one that hints that it may be possible to > continue even if an assertion in the FreeBSD kernel doesn't hold good > (this is the part that bothers me). I know all the KASSERTs I've looked > at or written are genuine assertions -- the code simply wouldn't be able > to cope if they were violated. You'd get NULL dereferences, or worse, > access protected structures without corresponding locks held, etc. In that case, those failures should be handled gracefully, or they should immediately panic the kernel. Claiming that a KASSERT() is optional at this point is basically us as a project saying "We know that if the kernel gets to this point and it fails this check, everything is busted after this." Ie, "Hey, if you disable KASSERT(), your data is potentially toast." Yet we ship with KASSERT() disabled. Silent data corruption, race conditions, etc. Not everything leads to a NULL pointer dereference. Again, we ship with KASSERT disabled in GENERIC on shipping production releases. The concerns you have with KASSERT printing out when Alfred's modification is enabled -does not change the fact that the kernel does _EXACTLY THIS_ kind of "oh well, I'll keep going" behaviour in a GENERIC, production, release kernel-. Adrian From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 05:13:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9DFBEC2A; Mon, 17 Dec 2012 05:13:16 +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 805EF8FC14; Mon, 17 Dec 2012 05:13:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH5DG90022367; Mon, 17 Dec 2012 05:13:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH5DGiw022365; Mon, 17 Dec 2012 05:13:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201212170513.qBH5DGiw022365@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 17 Dec 2012 05:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244337 - in stable/9/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 05:13:16 -0000 Author: kib Date: Mon Dec 17 05:13:15 2012 New Revision: 244337 URL: http://svnweb.freebsd.org/changeset/base/244337 Log: MFC r243836: Print the frame addresses for the backtraces on i386 and amd64. Modified: stable/9/sys/amd64/amd64/db_trace.c stable/9/sys/i386/i386/db_trace.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/db_trace.c ============================================================================== --- stable/9/sys/amd64/amd64/db_trace.c Mon Dec 17 01:10:06 2012 (r244336) +++ stable/9/sys/amd64/amd64/db_trace.c Mon Dec 17 05:13:15 2012 (r244337) @@ -186,7 +186,8 @@ db_ss(struct db_variable *vp, db_expr_t static void db_nextframe(struct amd64_frame **, db_addr_t *, struct thread *); static int db_numargs(struct amd64_frame *); -static void db_print_stack_entry(const char *, int, char **, long *, db_addr_t); +static void db_print_stack_entry(const char *, int, char **, long *, db_addr_t, + void *); static void decode_syscall(int, struct thread *); static const char * watchtype_str(int type); @@ -230,12 +231,13 @@ db_numargs(fp) } static void -db_print_stack_entry(name, narg, argnp, argp, callpc) +db_print_stack_entry(name, narg, argnp, argp, callpc, frame) const char *name; int narg; char **argnp; long *argp; db_addr_t callpc; + void *frame; { db_printf("%s(", name); #if 0 @@ -250,6 +252,8 @@ db_print_stack_entry(name, narg, argnp, #endif db_printf(") at "); db_printsym(callpc, DB_STGY_PROC); + if (frame != NULL) + db_printf("/frame 0x%lx", (register_t)frame); db_printf("\n"); } @@ -341,7 +345,7 @@ db_nextframe(struct amd64_frame **fp, db return; } - db_print_stack_entry(name, 0, 0, 0, rip); + db_print_stack_entry(name, 0, 0, 0, rip, &(*fp)->f_frame); /* * Point to base of trapframe which is just above the @@ -437,7 +441,8 @@ db_backtrace(struct thread *td, struct t * Don't try to walk back on a stack for a * process that hasn't actually been run yet. */ - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, + actframe); break; } first = FALSE; @@ -451,7 +456,7 @@ db_backtrace(struct thread *td, struct t narg = db_numargs(frame); } - db_print_stack_entry(name, narg, argnp, argp, pc); + db_print_stack_entry(name, narg, argnp, argp, pc, actframe); if (actframe != frame) { /* `frame' belongs to caller. */ @@ -465,7 +470,7 @@ db_backtrace(struct thread *td, struct t if (INKERNEL((long)pc) && !INKERNEL((long)frame)) { sym = db_search_symbol(pc, DB_STGY_ANY, &offset); db_symbol_values(sym, &name, NULL); - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, frame); break; } if (!INKERNEL((long) frame)) { Modified: stable/9/sys/i386/i386/db_trace.c ============================================================================== --- stable/9/sys/i386/i386/db_trace.c Mon Dec 17 01:10:06 2012 (r244336) +++ stable/9/sys/i386/i386/db_trace.c Mon Dec 17 05:13:15 2012 (r244337) @@ -176,7 +176,8 @@ db_ss(struct db_variable *vp, db_expr_t static void db_nextframe(struct i386_frame **, db_addr_t *, struct thread *); static int db_numargs(struct i386_frame *); -static void db_print_stack_entry(const char *, int, char **, int *, db_addr_t); +static void db_print_stack_entry(const char *, int, char **, int *, db_addr_t, + void *); static void decode_syscall(int, struct thread *); static const char * watchtype_str(int type); @@ -220,12 +221,13 @@ retry: } static void -db_print_stack_entry(name, narg, argnp, argp, callpc) +db_print_stack_entry(name, narg, argnp, argp, callpc, frame) const char *name; int narg; char **argnp; int *argp; db_addr_t callpc; + void *frame; { int n = narg >= 0 ? narg : 5; @@ -242,6 +244,8 @@ db_print_stack_entry(name, narg, argnp, db_printf(",..."); db_printf(") at "); db_printsym(callpc, DB_STGY_PROC); + if (frame != NULL) + db_printf("/frame 0x%r", (register_t)frame); db_printf("\n"); } @@ -326,7 +330,7 @@ db_nextframe(struct i386_frame **fp, db_ return; } - db_print_stack_entry(name, 0, 0, 0, eip); + db_print_stack_entry(name, 0, 0, 0, eip, &(*fp)->f_frame); /* * For a double fault, we have to snag the values from the @@ -467,7 +471,8 @@ db_backtrace(struct thread *td, struct t * Don't try to walk back on a stack for a * process that hasn't actually been run yet. */ - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, + actframe); break; } first = FALSE; @@ -481,7 +486,7 @@ db_backtrace(struct thread *td, struct t narg = db_numargs(frame); } - db_print_stack_entry(name, narg, argnp, argp, pc); + db_print_stack_entry(name, narg, argnp, argp, pc, actframe); if (actframe != frame) { /* `frame' belongs to caller. */ @@ -495,7 +500,7 @@ db_backtrace(struct thread *td, struct t if (INKERNEL((int)pc) && !INKERNEL((int) frame)) { sym = db_search_symbol(pc, DB_STGY_ANY, &offset); db_symbol_values(sym, &name, NULL); - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, frame); break; } if (!INKERNEL((int) frame)) { From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 05:15:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C6712DAA; Mon, 17 Dec 2012 05:15:51 +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 90FFE8FC12; Mon, 17 Dec 2012 05:15:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH5Fp1l022714; Mon, 17 Dec 2012 05:15:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH5Fp3o022713; Mon, 17 Dec 2012 05:15:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201212170515.qBH5Fp3o022713@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 17 Dec 2012 05:15:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244338 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 05:15:51 -0000 Author: kib Date: Mon Dec 17 05:15:51 2012 New Revision: 244338 URL: http://svnweb.freebsd.org/changeset/base/244338 Log: MFC r244076: Do not ignore zero address, possibly returned by the vm_map_find() call. Modified: stable/9/sys/kern/vfs_bio.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_bio.c ============================================================================== --- stable/9/sys/kern/vfs_bio.c Mon Dec 17 05:13:15 2012 (r244337) +++ stable/9/sys/kern/vfs_bio.c Mon Dec 17 05:15:51 2012 (r244338) @@ -2139,15 +2139,16 @@ restart: if (maxsize != bp->b_kvasize) { vm_offset_t addr = 0; + int rv; bfreekva(bp); vm_map_lock(buffer_map); if (vm_map_findspace(buffer_map, - vm_map_min(buffer_map), maxsize, &addr)) { + vm_map_min(buffer_map), maxsize, &addr)) { /* - * Uh oh. Buffer map is to fragmented. We - * must defragment the map. + * Buffer map is too fragmented. + * We must defragment the map. */ atomic_add_int(&bufdefragcnt, 1); vm_map_unlock(buffer_map); @@ -2156,22 +2157,21 @@ restart: brelse(bp); goto restart; } - if (addr) { - vm_map_insert(buffer_map, NULL, 0, - addr, addr + maxsize, - VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT); - - bp->b_kvabase = (caddr_t) addr; - bp->b_kvasize = maxsize; - atomic_add_long(&bufspace, bp->b_kvasize); - atomic_add_int(&bufreusecnt, 1); - } + rv = vm_map_insert(buffer_map, NULL, 0, addr, + addr + maxsize, VM_PROT_ALL, VM_PROT_ALL, + MAP_NOFAULT); + KASSERT(rv == KERN_SUCCESS, + ("vm_map_insert(buffer_map) rv %d", rv)); vm_map_unlock(buffer_map); + bp->b_kvabase = (caddr_t)addr; + bp->b_kvasize = maxsize; + atomic_add_long(&bufspace, bp->b_kvasize); + atomic_add_int(&bufreusecnt, 1); } bp->b_saveaddr = bp->b_kvabase; bp->b_data = bp->b_saveaddr; } - return(bp); + return (bp); } /* From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 05:18:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 11C9BF3A; Mon, 17 Dec 2012 05:18:17 +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 CFD698FC13; Mon, 17 Dec 2012 05:18:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH5IGLH023025; Mon, 17 Dec 2012 05:18:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH5IGC5023024; Mon, 17 Dec 2012 05:18:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201212170518.qBH5IGC5023024@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 17 Dec 2012 05:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244339 - stable/9/sys/amd64/amd64 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 05:18:17 -0000 Author: kib Date: Mon Dec 17 05:18:16 2012 New Revision: 244339 URL: http://svnweb.freebsd.org/changeset/base/244339 Log: MFC r244077: Add amd64-specific ddb command "show pte". The command displays the hierarchy of the page table entries which map the specified address. Modified: stable/9/sys/amd64/amd64/pmap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/pmap.c ============================================================================== --- stable/9/sys/amd64/amd64/pmap.c Mon Dec 17 05:15:51 2012 (r244338) +++ stable/9/sys/amd64/amd64/pmap.c Mon Dec 17 05:18:16 2012 (r244339) @@ -5462,3 +5462,46 @@ pmap_align_superpage(vm_object_t object, else *addr = ((*addr + PDRMASK) & ~PDRMASK) + superpage_offset; } + +#include "opt_ddb.h" +#ifdef DDB +#include + +DB_SHOW_COMMAND(pte, pmap_print_pte) +{ + pmap_t pmap; + pml4_entry_t *pml4; + pdp_entry_t *pdp; + pd_entry_t *pde; + pt_entry_t *pte; + vm_offset_t va; + + if (have_addr) { + va = (vm_offset_t)addr; + pmap = PCPU_GET(curpmap); /* XXX */ + } else { + db_printf("show pte addr\n"); + return; + } + pml4 = pmap_pml4e(pmap, va); + db_printf("VA %#016lx pml4e %#016lx", va, *pml4); + if ((*pml4 & PG_V) == 0) { + db_printf("\n"); + return; + } + pdp = pmap_pml4e_to_pdpe(pml4, va); + db_printf(" pdpe %#016lx", *pdp); + if ((*pdp & PG_V) == 0 || (*pdp & PG_PS) != 0) { + db_printf("\n"); + return; + } + pde = pmap_pdpe_to_pde(pdp, va); + db_printf(" pde %#016lx", *pde); + if ((*pde & PG_V) == 0 || (*pde & PG_PS) != 0) { + db_printf("\n"); + return; + } + pte = pmap_pde_to_pte(pde, va); + db_printf(" pte %#016lx\n", *pte); +} +#endif From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 05:31:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EF973335; Mon, 17 Dec 2012 05:31:42 +0000 (UTC) (envelope-from eadler@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 D29188FC0A; Mon, 17 Dec 2012 05:31:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH5Vgk2025076; Mon, 17 Dec 2012 05:31:42 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH5Vg31025075; Mon, 17 Dec 2012 05:31:42 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212170531.qBH5Vg31025075@svn.freebsd.org> From: Eitan Adler Date: Mon, 17 Dec 2012 05:31:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244340 - stable/9/share/man/man4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 05:31:43 -0000 Author: eadler Date: Mon Dec 17 05:31:42 2012 New Revision: 244340 URL: http://svnweb.freebsd.org/changeset/base/244340 Log: MFC r241836: Remove {harp,hfa,idt} man pages as they were removed in r179308. PR: docs/171234 Approved by: cperciva (implicit) Deleted: stable/9/share/man/man4/harp.4 stable/9/share/man/man4/hfa.4 stable/9/share/man/man4/idt.4 Modified: stable/9/share/man/man4/Makefile Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Mon Dec 17 05:18:16 2012 (r244339) +++ stable/9/share/man/man4/Makefile Mon Dec 17 05:31:42 2012 (r244340) @@ -148,9 +148,7 @@ MAN= aac.4 \ gpib.4 \ gre.4 \ h_ertt.4 \ - harp.4 \ hatm.4 \ - hfa.4 \ hifn.4 \ hme.4 \ hpet.4 \ @@ -164,7 +162,6 @@ MAN= aac.4 \ icmp.4 \ icmp6.4 \ ida.4 \ - idt.4 \ ifmib.4 \ igb.4 \ igmp.4 \ From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 06:01:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0C56B96F; Mon, 17 Dec 2012 06:01:58 +0000 (UTC) (envelope-from yongari@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 E43DB8FC15; Mon, 17 Dec 2012 06:01:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH61vrk028980; Mon, 17 Dec 2012 06:01:57 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH61vF2028979; Mon, 17 Dec 2012 06:01:57 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201212170601.qBH61vF2028979@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 17 Dec 2012 06:01:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244341 - head/sys/dev/ale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 06:01:58 -0000 Author: yongari Date: Mon Dec 17 06:01:57 2012 New Revision: 244341 URL: http://svnweb.freebsd.org/changeset/base/244341 Log: Make sure to stop both TX and RX MACs in ale_stop_mac(). Previously it used to stop TX MAC only such that MAC reconfiguration after getting a link didn't work as expected. PR: kern/173652 Modified: head/sys/dev/ale/if_ale.c Modified: head/sys/dev/ale/if_ale.c ============================================================================== --- head/sys/dev/ale/if_ale.c Mon Dec 17 05:31:42 2012 (r244340) +++ head/sys/dev/ale/if_ale.c Mon Dec 17 06:01:57 2012 (r244341) @@ -2932,7 +2932,7 @@ ale_stop_mac(struct ale_softc *sc) reg = CSR_READ_4(sc, ALE_MAC_CFG); if ((reg & (MAC_CFG_TX_ENB | MAC_CFG_RX_ENB)) != 0) { - reg &= ~MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; + reg &= ~(MAC_CFG_TX_ENB | MAC_CFG_RX_ENB); CSR_WRITE_4(sc, ALE_MAC_CFG, reg); } From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 06:35:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 429B146A; Mon, 17 Dec 2012 06:35:16 +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 0CE9A8FC14; Mon, 17 Dec 2012 06:35:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH6ZFNK033969; Mon, 17 Dec 2012 06:35:15 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH6ZF8f033967; Mon, 17 Dec 2012 06:35:15 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201212170635.qBH6ZF8f033967@svn.freebsd.org> From: Xin LI Date: Mon, 17 Dec 2012 06:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244342 - stable/9/usr.bin/less X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 06:35:16 -0000 Author: delphij Date: Mon Dec 17 06:35:15 2012 New Revision: 244342 URL: http://svnweb.freebsd.org/changeset/base/244342 Log: Note that the manual page of less(1) says: Note that a preprocessor cannot output an empty file, since that is interpreted as meaning there is no replacement, and the origi- nal file is used. To avoid this, if LESSOPEN starts with two ver- tical bars, the exit status of the script becomes meaningful. If the exit status is zero, the output is considered to be replace- ment text, even if it empty. If the exit status is nonzero, any output is ignored and the original file is used. For compatibil- ity with previous versions of less, if LESSOPEN starts with only one vertical bar, the exit status of the preprocessor is ignored. Use two pipe symbols for zless, so that zless'ing a compressed empty file will give output rather than being interpreted as its compressed form, which is typically a binary. Thanks Mark Nudelman for pointing out this difference and the suggested solution. Reported by: Matthias Meyser PR: bin/168839 Modified: stable/9/usr.bin/less/zless.sh Directory Properties: stable/9/usr.bin/less/ (props changed) Modified: stable/9/usr.bin/less/zless.sh ============================================================================== --- stable/9/usr.bin/less/zless.sh Mon Dec 17 06:01:57 2012 (r244341) +++ stable/9/usr.bin/less/zless.sh Mon Dec 17 06:35:15 2012 (r244342) @@ -3,5 +3,5 @@ # $FreeBSD$ # -export LESSOPEN="|/usr/bin/lesspipe.sh %s" +export LESSOPEN="||/usr/bin/lesspipe.sh %s" exec /usr/bin/less "$@" From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 06:38:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC6BF5FB; Mon, 17 Dec 2012 06:38: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 A8EA88FC15; Mon, 17 Dec 2012 06:38:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH6cMNx034372; Mon, 17 Dec 2012 06:38:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH6cMqT034371; Mon, 17 Dec 2012 06:38:22 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201212170638.qBH6cMqT034371@svn.freebsd.org> From: Xin LI Date: Mon, 17 Dec 2012 06:38:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244343 - stable/8/usr.bin/less X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 06:38:23 -0000 Author: delphij Date: Mon Dec 17 06:38:22 2012 New Revision: 244343 URL: http://svnweb.freebsd.org/changeset/base/244343 Log: MFC r243834: Note that the manual page of less(1) says: Note that a preprocessor cannot output an empty file, since that is interpreted as meaning there is no replacement, and the origi- nal file is used. To avoid this, if LESSOPEN starts with two ver- tical bars, the exit status of the script becomes meaningful. If the exit status is zero, the output is considered to be replace- ment text, even if it empty. If the exit status is nonzero, any output is ignored and the original file is used. For compatibil- ity with previous versions of less, if LESSOPEN starts with only one vertical bar, the exit status of the preprocessor is ignored. Use two pipe symbols for zless, so that zless'ing a compressed empty file will give output rather than being interpreted as its compressed form, which is typically a binary. Thanks Mark Nudelman for pointing out this difference and the suggested solution. Reported by: Matthias Meyser PR: bin/168839 Modified: stable/8/usr.bin/less/zless.sh Directory Properties: stable/8/usr.bin/less/ (props changed) Modified: stable/8/usr.bin/less/zless.sh ============================================================================== --- stable/8/usr.bin/less/zless.sh Mon Dec 17 06:35:15 2012 (r244342) +++ stable/8/usr.bin/less/zless.sh Mon Dec 17 06:38:22 2012 (r244343) @@ -3,5 +3,5 @@ # $FreeBSD$ # -export LESSOPEN="|/usr/bin/lesspipe.sh %s" +export LESSOPEN="||/usr/bin/lesspipe.sh %s" exec /usr/bin/less "$@" From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 06:43:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3062B7DE; Mon, 17 Dec 2012 06:43: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 046C98FC0A; Mon, 17 Dec 2012 06:43:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH6h8Rg035088; Mon, 17 Dec 2012 06:43:08 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH6h8iq035087; Mon, 17 Dec 2012 06:43:08 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201212170643.qBH6h8iq035087@svn.freebsd.org> From: Xin LI Date: Mon, 17 Dec 2012 06:43:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244344 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 06:43:09 -0000 Author: delphij Date: Mon Dec 17 06:43:08 2012 New Revision: 244344 URL: http://svnweb.freebsd.org/changeset/base/244344 Log: MFC r243807: Use SA_ZPL_CRTIME instead of SA_ZPL_CTIME for creation time. Submitted by: phil.stone at gmx.com Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Dec 17 06:38:22 2012 (r244343) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Dec 17 06:43:08 2012 (r244344) @@ -2682,7 +2682,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL, &mtime, 16); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, &ctime, 16); - SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, &crtime, 16); + SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CRTIME(zfsvfs), NULL, &crtime, 16); if (vp->v_type == VBLK || vp->v_type == VCHR) SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_RDEV(zfsvfs), NULL, &rdev, 8); From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 06:44:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B701B95C; Mon, 17 Dec 2012 06:44:16 +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 9A2AF8FC19; Mon, 17 Dec 2012 06:44:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH6iGDV035301; Mon, 17 Dec 2012 06:44:16 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH6iGME035300; Mon, 17 Dec 2012 06:44:16 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201212170644.qBH6iGME035300@svn.freebsd.org> From: Xin LI Date: Mon, 17 Dec 2012 06:44:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244345 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 06:44:16 -0000 Author: delphij Date: Mon Dec 17 06:44:16 2012 New Revision: 244345 URL: http://svnweb.freebsd.org/changeset/base/244345 Log: MFC r243807: Use SA_ZPL_CRTIME instead of SA_ZPL_CTIME for creation time. Submitted by: phil.stone at gmx.com Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Dec 17 06:43:08 2012 (r244344) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Dec 17 06:44:16 2012 (r244345) @@ -2683,7 +2683,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL, &mtime, 16); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, &ctime, 16); - SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, &crtime, 16); + SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CRTIME(zfsvfs), NULL, &crtime, 16); if (vp->v_type == VBLK || vp->v_type == VCHR) SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_RDEV(zfsvfs), NULL, &rdev, 8); From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 09:36:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 078216C9; Mon, 17 Dec 2012 09:36:44 +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 C4F118FC12; Mon, 17 Dec 2012 09:36:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH9ahI7059359; Mon, 17 Dec 2012 09:36:43 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH9ah0V059357; Mon, 17 Dec 2012 09:36:43 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201212170936.qBH9ah0V059357@svn.freebsd.org> From: Gabor Kovesdan Date: Mon, 17 Dec 2012 09:36:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244346 - head/usr.bin/sort X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 09:36:44 -0000 Author: gabor Date: Mon Dec 17 09:36:43 2012 New Revision: 244346 URL: http://svnweb.freebsd.org/changeset/base/244346 Log: - Use unsigned int for values obtained with sysctlbyname(). This fixes sparc64 performance problems. Submitted by: Oleg Moskalenko Tested by: trasz Modified: head/usr.bin/sort/sort.c head/usr.bin/sort/sort.h Modified: head/usr.bin/sort/sort.c ============================================================================== --- head/usr.bin/sort/sort.c Mon Dec 17 06:44:16 2012 (r244345) +++ head/usr.bin/sort/sort.c Mon Dec 17 09:36:43 2012 (r244346) @@ -103,7 +103,7 @@ bool debug_sort; bool need_hint; #if defined(SORT_THREADS) -size_t ncpu = 1; +unsigned int ncpu = 1; size_t nthreads = 1; #endif @@ -268,14 +268,16 @@ set_hw_params(void) #if defined(SORT_THREADS) size_t ncpusz; #endif - size_t pages, psize, psz, pszsz; + unsigned int pages, psize; + size_t psz, pszsz; pages = psize = 0; #if defined(SORT_THREADS) ncpu = 1; ncpusz = sizeof(size_t); #endif - psz = pszsz = sizeof(size_t); + psz = sizeof(pages); + pszsz = sizeof(psize); if (sysctlbyname("vm.stats.vm.v_free_count", &pages, &psz, NULL, 0) < 0) { @@ -299,6 +301,9 @@ set_hw_params(void) free_memory = (unsigned long long) pages * (unsigned long long) psize; available_free_memory = (free_memory * 9) / 10; + + if (available_free_memory < 1024) + available_free_memory = 1024; } /* Modified: head/usr.bin/sort/sort.h ============================================================================== --- head/usr.bin/sort/sort.h Mon Dec 17 06:44:16 2012 (r244345) +++ head/usr.bin/sort/sort.h Mon Dec 17 09:36:43 2012 (r244346) @@ -54,7 +54,7 @@ extern const char *nlsstr[]; #if defined(SORT_THREADS) #define MT_SORT_THRESHOLD (10000) -extern size_t ncpu; +extern unsigned int ncpu; extern size_t nthreads; #endif From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 10:10:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 184EF109; Mon, 17 Dec 2012 10:10:14 +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 D81508FC0A; Mon, 17 Dec 2012 10:10:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHAADSo064354; Mon, 17 Dec 2012 10:10:13 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHAADYP064352; Mon, 17 Dec 2012 10:10:13 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212171010.qBHAADYP064352@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Dec 2012 10:10:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244347 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 10:10:14 -0000 Author: pjd Date: Mon Dec 17 10:10:13 2012 New Revision: 244347 URL: http://svnweb.freebsd.org/changeset/base/244347 Log: Warn about reaching various PF limits. Reviewed by: glebius Obtained from: WHEEL Systems Modified: head/sys/netpfil/pf/pf.c head/sys/netpfil/pf/pf_norm.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Mon Dec 17 09:36:43 2012 (r244346) +++ head/sys/netpfil/pf/pf.c Mon Dec 17 10:10:13 2012 (r244347) @@ -713,6 +713,7 @@ pf_initialize() NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); V_pf_limits[PF_LIMIT_STATES].zone = V_pf_state_z; uma_zone_set_max(V_pf_state_z, PFSTATE_HIWAT); + uma_zone_set_warning(V_pf_state_z, "PF states limit reached"); V_pf_state_key_z = uma_zcreate("pf state keys", sizeof(struct pf_state_key), pf_state_key_ctor, NULL, NULL, NULL, @@ -734,6 +735,7 @@ pf_initialize() 0); V_pf_limits[PF_LIMIT_SRC_NODES].zone = V_pf_sources_z; uma_zone_set_max(V_pf_sources_z, PFSNODE_HIWAT); + uma_zone_set_warning(V_pf_sources_z, "PF source nodes limit reached"); V_pf_srchash = malloc(V_pf_srchashsize * sizeof(struct pf_srchash), M_PFHASH, M_WAITOK|M_ZERO); V_pf_srchashmask = V_pf_srchashsize - 1; Modified: head/sys/netpfil/pf/pf_norm.c ============================================================================== --- head/sys/netpfil/pf/pf_norm.c Mon Dec 17 09:36:43 2012 (r244346) +++ head/sys/netpfil/pf/pf_norm.c Mon Dec 17 10:10:13 2012 (r244347) @@ -161,6 +161,7 @@ pf_normalize_init(void) V_pf_limits[PF_LIMIT_FRAGS].zone = V_pf_frent_z; V_pf_limits[PF_LIMIT_FRAGS].limit = PFFRAG_FRENT_HIWAT; uma_zone_set_max(V_pf_frent_z, PFFRAG_FRENT_HIWAT); + uma_zone_set_warning(V_pf_frent_z, "PF frag entries limit reached"); mtx_init(&pf_frag_mtx, "pf fragments", NULL, MTX_DEF); From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 10:12:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F210E29A; Mon, 17 Dec 2012 10:12: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 BC2E18FC12; Mon, 17 Dec 2012 10:12:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHACCq4064728; Mon, 17 Dec 2012 10:12:12 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHACCdi064727; Mon, 17 Dec 2012 10:12:12 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201212171012.qBHACCdi064727@svn.freebsd.org> From: Gabor Kovesdan Date: Mon, 17 Dec 2012 10:12:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244348 - head/share/i18n/csmapper X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 10:12:13 -0000 Author: gabor Date: Mon Dec 17 10:12:12 2012 New Revision: 244348 URL: http://svnweb.freebsd.org/changeset/base/244348 Log: - Fix handling of .mps files PR: bin/161454 Submitted by: Yamaya Takashi Modified: head/share/i18n/csmapper/Makefile.part Modified: head/share/i18n/csmapper/Makefile.part ============================================================================== --- head/share/i18n/csmapper/Makefile.part Mon Dec 17 10:10:13 2012 (r244347) +++ head/share/i18n/csmapper/Makefile.part Mon Dec 17 10:12:12 2012 (r244348) @@ -28,9 +28,9 @@ mapper.dir.${ESUBDIR}: ${CODE}.part echo "# ${ESUBDIR}" > ${.TARGET} .for i in ${PART} printf "%-32s%-32s%s\n" ${ENCID:S@%%PART%%@${i}@}/UCS ${MAPPER} \ - ${ESUBDIR}/${TABLENAME:S@%%PART%%@${i}@}${ENCEXT} >> ${.TARGET} + ${ESUBDIR}/${TABLENAME:S@%%PART%%@${i}@:S/:/@/}${ENCEXT} >> ${.TARGET} printf "%-32s%-32s%s\n" UCS/${ENCID:S@%%PART%%@${i}@} ${MAPPER} \ - ${REVSYMBOL}${ESUBDIR}/${RTABLENAME:S@%%PART%%@${i}@}${ENCEXT} >> ${.TARGET} + ${REVSYMBOL}${ESUBDIR}/${RTABLENAME:S@%%PART%%@${i}@:S/:/@/}${ENCEXT} >> ${.TARGET} .endfor echo >> ${.TARGET} .else @@ -59,13 +59,13 @@ CLEANFILES+= charset.pivot.${ESUBDIR} .if !defined(MAPS) .for i in ${PART} -.if exists(${TABLENAME:S@%%PART%%@${i}@}.src) -FILES+= ${TABLENAME:S@%%PART%%@${i}@}.mps -CLEANFILES+= ${TABLENAME:S@%%PART%%@${i}@}.mps -.endif -.if exists(${RTABLENAME:S@%%PART%%@${i}@}.src) -FILES+= ${RTABLENAME:S@%%PART%%@${i}@}.mps -CLEANFILES+= ${RTABLENAME:S@%%PART%%@${i}@}.mps +.if exists(${TABLENAME:S@%%PART%%@${i}@:S/:/@/}.src) +FILES+= ${TABLENAME:S@%%PART%%@${i}@:S/:/@/}.mps +CLEANFILES+= ${TABLENAME:S@%%PART%%@${i}@:S/:/@/}.mps +.endif +.if exists(${RTABLENAME:S@%%PART%%@${i}@:S/:/@/}.src) +FILES+= ${RTABLENAME:S@%%PART%%@${i}@:S/:/@/}.mps +CLEANFILES+= ${RTABLENAME:S@%%PART%%@${i}@:S/:/@/}.mps .endif .endfor .else From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 10:38:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DFF799AA; Mon, 17 Dec 2012 10:38:51 +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 C238C8FC15; Mon, 17 Dec 2012 10:38:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHAcpSJ069686; Mon, 17 Dec 2012 10:38:51 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHAcpN4069685; Mon, 17 Dec 2012 10:38:51 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201212171038.qBHAcpN4069685@svn.freebsd.org> From: Jilles Tjoelker Date: Mon, 17 Dec 2012 10:38:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244350 - head/lib/libc/iconv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 10:38:52 -0000 Author: jilles Date: Mon Dec 17 10:38:51 2012 New Revision: 244350 URL: http://svnweb.freebsd.org/changeset/base/244350 Log: libc/iconv: Fix race condition with setting FD_CLOEXEC. A fork/exec could happen between open and fcntl, leaking a file descriptor. Using O_CLOEXEC fixes this and as a side effect simplifies the code. NetBSD already had this (I checked this after making the change myself). Reviewed by: gabor Modified: head/lib/libc/iconv/citrus_mmap.c Modified: head/lib/libc/iconv/citrus_mmap.c ============================================================================== --- head/lib/libc/iconv/citrus_mmap.c Mon Dec 17 10:23:22 2012 (r244349) +++ head/lib/libc/iconv/citrus_mmap.c Mon Dec 17 10:38:51 2012 (r244350) @@ -57,12 +57,8 @@ _citrus_map_file(struct _citrus_region * _region_init(r, NULL, 0); - if ((fd = open(path, O_RDONLY)) == -1) + if ((fd = open(path, O_RDONLY | O_CLOEXEC)) == -1) return (errno); - if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { - ret = errno; - goto error; - } if (fstat(fd, &st) == -1) { ret = errno; From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 10:48:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A08BC98; Mon, 17 Dec 2012 10:48:11 +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 1F5288FC0C; Mon, 17 Dec 2012 10:48:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHAmAc4070978; Mon, 17 Dec 2012 10:48:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHAmAkk070977; Mon, 17 Dec 2012 10:48:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212171048.qBHAmAkk070977@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Dec 2012 10:48:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244351 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 10:48:11 -0000 Author: pjd Date: Mon Dec 17 10:48:10 2012 New Revision: 244351 URL: http://svnweb.freebsd.org/changeset/base/244351 Log: Better variables naming in expand_name() to be more consistent with coredump(). Obtained from: WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Dec 17 10:38:51 2012 (r244350) +++ head/sys/kern/kern_sig.c Mon Dec 17 10:48:10 2012 (r244351) @@ -3045,23 +3045,23 @@ SYSCTL_STRING(_kern, OID_AUTO, corefile, * This is controlled by the sysctl variable kern.corefile (see above). */ static char * -expand_name(const char *name, uid_t uid, pid_t pid, struct thread *td, +expand_name(const char *comm, uid_t uid, pid_t pid, struct thread *td, int compress) { struct sbuf sb; const char *format; - char *temp; + char *name; size_t i; int indexpos; char *hostname; hostname = NULL; format = corefilename; - temp = malloc(MAXPATHLEN, M_TEMP, M_NOWAIT | M_ZERO); - if (temp == NULL) + name = malloc(MAXPATHLEN, M_TEMP, M_NOWAIT | M_ZERO); + if (name == NULL) return (NULL); indexpos = -1; - (void)sbuf_new(&sb, temp, MAXPATHLEN, SBUF_FIXEDLEN); + (void)sbuf_new(&sb, name, MAXPATHLEN, SBUF_FIXEDLEN); for (i = 0; format[i]; i++) { switch (format[i]) { case '%': /* Format character */ @@ -3079,7 +3079,7 @@ expand_name(const char *name, uid_t uid, "pid %ld (%s), uid (%lu): " "unable to alloc memory " "for corefile hostname\n", - (long)pid, name, + (long)pid, comm, (u_long)uid); goto nomem; } @@ -3093,7 +3093,7 @@ expand_name(const char *name, uid_t uid, indexpos = sbuf_len(&sb) - 1; break; case 'N': /* process name */ - sbuf_printf(&sb, "%s", name); + sbuf_printf(&sb, "%s", comm); break; case 'P': /* process id */ sbuf_printf(&sb, "%u", pid); @@ -3119,10 +3119,10 @@ expand_name(const char *name, uid_t uid, #endif if (sbuf_error(&sb) != 0) { log(LOG_ERR, "pid %ld (%s), uid (%lu): corename is too " - "long\n", (long)pid, name, (u_long)uid); + "long\n", (long)pid, comm, (u_long)uid); nomem: sbuf_delete(&sb); - free(temp, M_TEMP); + free(name, M_TEMP); return (NULL); } sbuf_finish(&sb); @@ -3145,9 +3145,9 @@ nomem: oflags = VN_OPEN_NOCAPCHECK; for (n = 0; n < num_cores; n++) { - temp[indexpos] = '0' + n; + name[indexpos] = '0' + n; NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, - temp, td); + name, td); error = vn_open_cred(&nd, &flags, cmode, oflags, td->td_ucred, NULL); if (error) { @@ -3156,8 +3156,8 @@ nomem: log(LOG_ERR, "pid %d (%s), uid (%u): Path `%s' failed " "on initial open test, error = %d\n", - pid, name, uid, temp, error); - free(temp, M_TEMP); + pid, comm, uid, name, error); + free(name, M_TEMP); return (NULL); } NDFREE(&nd, NDF_ONLY_PNBUF); @@ -3168,14 +3168,14 @@ nomem: "pid %d (%s), uid (%u): Path `%s' failed " "on close after initial open test, " "error = %d\n", - pid, name, uid, temp, error); - free(temp, M_TEMP); + pid, comm, uid, name, error); + free(name, M_TEMP); return (NULL); } break; } } - return (temp); + return (name); } /* From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 10:51:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5193FF0A; Mon, 17 Dec 2012 10:51:23 +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 35A618FC12; Mon, 17 Dec 2012 10:51:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHApNVC071435; Mon, 17 Dec 2012 10:51:23 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHApNYB071434; Mon, 17 Dec 2012 10:51:23 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212171051.qBHApNYB071434@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Dec 2012 10:51:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244352 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 10:51:23 -0000 Author: pjd Date: Mon Dec 17 10:51:22 2012 New Revision: 244352 URL: http://svnweb.freebsd.org/changeset/base/244352 Log: Minor style tweaks. Obtained from: WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Dec 17 10:48:10 2012 (r244351) +++ head/sys/kern/kern_sig.c Mon Dec 17 10:51:22 2012 (r244352) @@ -3113,9 +3113,8 @@ expand_name(const char *comm, uid_t uid, } free(hostname, M_TEMP); #ifdef COMPRESS_USER_CORES - if (compress) { + if (compress) sbuf_printf(&sb, GZ_SUFFIX); - } #endif if (sbuf_error(&sb) != 0) { log(LOG_ERR, "pid %ld (%s), uid (%lu): corename is too " @@ -3190,8 +3189,8 @@ static int coredump(struct thread *td) { struct proc *p = td->td_proc; - register struct vnode *vp; - register struct ucred *cred = td->td_ucred; + struct ucred *cred = td->td_ucred; + struct vnode *vp; struct flock lf; struct nameidata nd; struct vattr vattr; @@ -3251,8 +3250,8 @@ restart: vp = nd.ni_vp; /* Don't dump to non-regular files or files with links. */ - if (vp->v_type != VREG || - VOP_GETATTR(vp, &vattr, cred) || vattr.va_nlink != 1) { + if (vp->v_type != VREG || VOP_GETATTR(vp, &vattr, cred) != 0 || + vattr.va_nlink != 1) { VOP_UNLOCK(vp, 0); error = EFAULT; goto close; From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 10:58:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 43C753E0; Mon, 17 Dec 2012 10:58:30 +0000 (UTC) (envelope-from erwin@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 241648FC12; Mon, 17 Dec 2012 10:58:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHAwUZf072757; Mon, 17 Dec 2012 10:58:30 GMT (envelope-from erwin@svn.freebsd.org) Received: (from erwin@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHAwPWi072724; Mon, 17 Dec 2012 10:58:25 GMT (envelope-from erwin@svn.freebsd.org) Message-Id: <201212171058.qBHAwPWi072724@svn.freebsd.org> From: Erwin Lansing Date: Mon, 17 Dec 2012 10:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r244353 - in vendor/bind9/dist-9.6: . bin/check bin/dig bin/dnssec bin/named bin/nsupdate doc doc/arm doc/misc lib lib/bind9 lib/bind9/include lib/bind9/include/bind9 lib/dns lib/dns/in... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 10:58:30 -0000 Author: erwin Date: Mon Dec 17 10:58:24 2012 New Revision: 244353 URL: http://svnweb.freebsd.org/changeset/base/244353 Log: Vendor import of Bind 9.6-ESV-R8 Approved by: delphij (mentor) Sponsored by: DK Hostmaster A/S Modified: vendor/bind9/dist-9.6/CHANGES vendor/bind9/dist-9.6/README vendor/bind9/dist-9.6/bin/check/check-tool.c vendor/bind9/dist-9.6/bin/dig/nslookup.c vendor/bind9/dist-9.6/bin/dnssec/dnssec-signzone.c vendor/bind9/dist-9.6/bin/named/controlconf.c vendor/bind9/dist-9.6/bin/named/convertxsl.pl vendor/bind9/dist-9.6/bin/named/statschannel.c vendor/bind9/dist-9.6/bin/nsupdate/nsupdate.c vendor/bind9/dist-9.6/configure.in vendor/bind9/dist-9.6/doc/Makefile.in vendor/bind9/dist-9.6/doc/arm/Bv9ARM-book.xml vendor/bind9/dist-9.6/doc/arm/Bv9ARM.ch06.html vendor/bind9/dist-9.6/doc/arm/Bv9ARM.pdf vendor/bind9/dist-9.6/doc/misc/format-options.pl vendor/bind9/dist-9.6/doc/misc/sort-options.pl vendor/bind9/dist-9.6/isc-config.sh.in vendor/bind9/dist-9.6/lib/Makefile.in vendor/bind9/dist-9.6/lib/bind9/api vendor/bind9/dist-9.6/lib/bind9/check.c vendor/bind9/dist-9.6/lib/bind9/include/Makefile.in vendor/bind9/dist-9.6/lib/bind9/include/bind9/Makefile.in vendor/bind9/dist-9.6/lib/dns/adb.c vendor/bind9/dist-9.6/lib/dns/api vendor/bind9/dist-9.6/lib/dns/dnssec.c vendor/bind9/dist-9.6/lib/dns/dst_openssl.h vendor/bind9/dist-9.6/lib/dns/dst_parse.c vendor/bind9/dist-9.6/lib/dns/dst_result.c vendor/bind9/dist-9.6/lib/dns/include/Makefile.in vendor/bind9/dist-9.6/lib/dns/include/dns/dnssec.h vendor/bind9/dist-9.6/lib/dns/include/dns/iptable.h vendor/bind9/dist-9.6/lib/dns/include/dns/log.h vendor/bind9/dist-9.6/lib/dns/include/dns/stats.h vendor/bind9/dist-9.6/lib/dns/include/dns/zone.h vendor/bind9/dist-9.6/lib/dns/include/dst/Makefile.in vendor/bind9/dist-9.6/lib/dns/include/dst/result.h vendor/bind9/dist-9.6/lib/dns/log.c vendor/bind9/dist-9.6/lib/dns/master.c vendor/bind9/dist-9.6/lib/dns/masterdump.c vendor/bind9/dist-9.6/lib/dns/openssl_link.c vendor/bind9/dist-9.6/lib/dns/openssldh_link.c vendor/bind9/dist-9.6/lib/dns/openssldsa_link.c vendor/bind9/dist-9.6/lib/dns/opensslrsa_link.c vendor/bind9/dist-9.6/lib/dns/rbtdb.c vendor/bind9/dist-9.6/lib/dns/rdata.c vendor/bind9/dist-9.6/lib/dns/spnego_asn1.pl vendor/bind9/dist-9.6/lib/dns/zone.c vendor/bind9/dist-9.6/lib/isc/alpha/Makefile.in vendor/bind9/dist-9.6/lib/isc/alpha/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/alpha/include/isc/Makefile.in vendor/bind9/dist-9.6/lib/isc/api vendor/bind9/dist-9.6/lib/isc/ia64/Makefile.in vendor/bind9/dist-9.6/lib/isc/ia64/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/ia64/include/isc/Makefile.in vendor/bind9/dist-9.6/lib/isc/ia64/include/isc/atomic.h vendor/bind9/dist-9.6/lib/isc/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/include/isc/file.h vendor/bind9/dist-9.6/lib/isc/mem.c vendor/bind9/dist-9.6/lib/isc/mips/Makefile.in vendor/bind9/dist-9.6/lib/isc/mips/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/mips/include/isc/Makefile.in vendor/bind9/dist-9.6/lib/isc/noatomic/Makefile.in vendor/bind9/dist-9.6/lib/isc/noatomic/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/noatomic/include/isc/Makefile.in vendor/bind9/dist-9.6/lib/isc/nothreads/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/nothreads/include/isc/Makefile.in vendor/bind9/dist-9.6/lib/isc/powerpc/Makefile.in vendor/bind9/dist-9.6/lib/isc/powerpc/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/powerpc/include/isc/Makefile.in vendor/bind9/dist-9.6/lib/isc/pthreads/condition.c vendor/bind9/dist-9.6/lib/isc/pthreads/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/pthreads/include/isc/Makefile.in vendor/bind9/dist-9.6/lib/isc/sparc64/Makefile.in vendor/bind9/dist-9.6/lib/isc/sparc64/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/sparc64/include/isc/Makefile.in vendor/bind9/dist-9.6/lib/isc/unix/file.c vendor/bind9/dist-9.6/lib/isc/unix/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/unix/include/isc/Makefile.in vendor/bind9/dist-9.6/lib/isc/x86_32/Makefile.in vendor/bind9/dist-9.6/lib/isc/x86_32/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/x86_32/include/isc/Makefile.in vendor/bind9/dist-9.6/lib/isc/x86_64/Makefile.in vendor/bind9/dist-9.6/lib/isc/x86_64/include/Makefile.in vendor/bind9/dist-9.6/lib/isc/x86_64/include/isc/Makefile.in vendor/bind9/dist-9.6/lib/isccc/api vendor/bind9/dist-9.6/lib/isccc/cc.c vendor/bind9/dist-9.6/lib/isccc/include/Makefile.in vendor/bind9/dist-9.6/lib/isccc/include/isccc/Makefile.in vendor/bind9/dist-9.6/lib/isccfg/include/Makefile.in vendor/bind9/dist-9.6/lib/isccfg/include/isccfg/Makefile.in vendor/bind9/dist-9.6/lib/lwres/Makefile.in vendor/bind9/dist-9.6/lib/lwres/api vendor/bind9/dist-9.6/lib/lwres/getaddrinfo.c vendor/bind9/dist-9.6/lib/lwres/include/Makefile.in vendor/bind9/dist-9.6/lib/lwres/include/lwres/Makefile.in vendor/bind9/dist-9.6/lib/lwres/man/Makefile.in vendor/bind9/dist-9.6/lib/lwres/unix/Makefile.in vendor/bind9/dist-9.6/lib/lwres/unix/include/Makefile.in vendor/bind9/dist-9.6/lib/lwres/unix/include/lwres/Makefile.in vendor/bind9/dist-9.6/make/rules.in vendor/bind9/dist-9.6/version Modified: vendor/bind9/dist-9.6/CHANGES ============================================================================== --- vendor/bind9/dist-9.6/CHANGES Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/CHANGES Mon Dec 17 10:58:24 2012 (r244353) @@ -1,33 +1,87 @@ - --- 9.6-ESV-R7-P4 released --- + --- 9.6-ESV-R8 released --- 3383. [security] A certain combination of records in the RBT could cause named to hang while populating the additional section of a response. [RT #31090] - --- 9.6-ESV-R7-P3 released --- +3373. [bug] win32: open raw files in binary mode. [RT #30944] 3364. [security] Named could die on specially crafted record. [RT #30416] -3358 [bug] Fix declaration of fatal in bin/named/server.c + --- 9.6-ESV-R8rc1 released --- + +3369. [bug] nsupdate terminated unexpectedly in interactive mode + if built with readline support. [RT #29550] + +3368. [bug] and were not C++ safe. + +3366. [bug] Fixed Read-After-Write dependency violation for IA64 + atomic operations. [RT #25181] + +3365. [bug] Removed spurious newlines from log messages in + zone.c [RT #30675] + +3362. [bug] Setting some option values to 0 in named.conf + could trigger an assertion failure on startup. + [RT #27730] + +3360. [bug] 'host -w' could die. [RT #18723] + +3359. [bug] An improperly-formed TSIG secret could cause a + memory leak. [RT #30607] + +3358. [bug] Fix declaration of fatal in bin/named/server.c and bin/nsupdate/main.c. [RT #30522] - --- 9.6-ESV-R7-P2 released --- +3357. [port] Add support for libxml2-2.8.x [RT #30440] + + --- 9.6-ESV-R8b1 released --- + +3354. [func] Improve OpenSSL error logging. [RT #29932] + +3352. [bug] Ensure that learned server attributes timeout of the + adb cache. [RT #29856] + +3350. [bug] Memory read overrun in isc___mem_reallocate if + ISC_MEM_DEBUGCTX memory debugging flag is set. + [RT #30240] + +3348. [bug] Prevent RRSIG data from being cached if a negative + record matching the covering type exists at a higher + trust level. Such data already can't be retrieved from + the cache since change 3218 -- this prevents it + being inserted into the cache as well. [RT #26809] 3346. [security] Bad-cache data could be used before it was initialized, causing an assert. [RT #30025] -3343. [bug] Relax isc_random_jitter() REQUIRE tests. [RT #29821] +3343. [bug] Relax isc_random_jitter() REQUIRE tests. [RT #29821] 3342. [bug] Change #3314 broke saving of stub zones to disk resulting in excessive cpu usage in some cases. [RT #29952] - --- 9.6-ESV-R7-P1 released --- +3337. [bug] Change #3294 broke support for the multiple keys + in controls. [RT #29694] + +3335. [func] nslookup: return a nonzero exit code when unable + to get an answer. [RT #29492] + +3332. [bug] Re-use cached DS rrsets if possible. [RT #29446] 3331. [security] dns_rdataslab_fromrdataset could produce bad rdataslabs. [RT #29644] +3329. [bug] Handle RRSIG signer-name case consistently: We + generate RRSIG records with the signer-name in + lower case. We accept them with any case, but if + they fail to validate, we try again in lower case. + [RT #27451] + +3328. [bug] Fixed inconsistent data checking in dst_parse.c. + [RT #29401] + --- 9.6-ESV-R7 released --- 3318. [tuning] Reduce the amount of work performed while holding a Modified: vendor/bind9/dist-9.6/README ============================================================================== --- vendor/bind9/dist-9.6/README Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/README Mon Dec 17 10:58:24 2012 (r244353) @@ -48,9 +48,14 @@ BIND 9 For up-to-date release notes and errata, see http://www.isc.org/software/bind9/releasenotes +BIND 9.6-ESV-R8 (Extended Support Version) + + BIND 9.6-ESV-R8 includes several bug fixes and patches security + flaws described in CVE-2012-1667, CVE-2012-3817 and CVE-2012-4244. + BIND 9.6-ESV-R7 (Extended Support Version) - BIND 9.4-ESV-R7 is a maintenance release, fixing bugs in BIND + BIND 9.6-ESV-R7 is a maintenance release, fixing bugs in BIND 9.6-ESV-R6. BIND 9.6-ESV-R6 (Extended Support Version) @@ -60,7 +65,7 @@ BIND 9.6-ESV-R6 (Extended Support Versio BIND 9.6-ESV-R5 (Extended Support Version) - BIND 9.4-ESV-R5 is a maintenance release, fixing bugs in BIND + BIND 9.6-ESV-R5 is a maintenance release, fixing bugs in BIND 9.6-ESV-R4. BIND 9.6.3/BIND 9.6-ESV-R4 Modified: vendor/bind9/dist-9.6/bin/check/check-tool.c ============================================================================== --- vendor/bind9/dist-9.6/bin/check/check-tool.c Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/bin/check/check-tool.c Mon Dec 17 10:58:24 2012 (r244353) @@ -640,6 +640,9 @@ dump_zone(const char *zonename, dns_zone { isc_result_t result; FILE *output = stdout; + const char *flags; + + flags = (fileformat == dns_masterformat_text) ? "w+" : "wb+"; if (debug) { if (filename != NULL && strcmp(filename, "-") != 0) @@ -650,7 +653,7 @@ dump_zone(const char *zonename, dns_zone } if (filename != NULL && strcmp(filename, "-") != 0) { - result = isc_stdio_open(filename, "w+", &output); + result = isc_stdio_open(filename, flags, &output); if (result != ISC_R_SUCCESS) { fprintf(stderr, "could not open output " Modified: vendor/bind9/dist-9.6/bin/dig/nslookup.c ============================================================================== --- vendor/bind9/dist-9.6/bin/dig/nslookup.c Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/bin/dig/nslookup.c Mon Dec 17 10:58:24 2012 (r244353) @@ -57,6 +57,7 @@ static isc_boolean_t in_use = ISC_FALSE; static char defclass[MXRD] = "IN"; static char deftype[MXRD] = "A"; static isc_event_t *global_event = NULL; +static int query_error = 1, print_error = 0; static char domainopt[DNS_NAME_MAXTEXT]; @@ -406,6 +407,9 @@ isc_result_t printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { char servtext[ISC_SOCKADDR_FORMATSIZE]; + /* I've we've gotten this far, we've reached a server. */ + query_error = 0; + debug("printmessage()"); isc_sockaddr_format(&query->sockaddr, servtext, sizeof(servtext)); @@ -433,6 +437,9 @@ printmessage(dig_query_t *query, dns_mes (msg->rcode != dns_rcode_nxdomain) ? nametext : query->lookup->textname, rcode_totext(msg->rcode)); debug("returning with rcode == 0"); + + /* the lookup failed */ + print_error |= 1; return (ISC_R_SUCCESS); } @@ -903,5 +910,5 @@ main(int argc, char **argv) { destroy_libs(); isc_app_finish(); - return (0); + return (query_error | print_error); } Modified: vendor/bind9/dist-9.6/bin/dnssec/dnssec-signzone.c ============================================================================== --- vendor/bind9/dist-9.6/bin/dnssec/dnssec-signzone.c Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/bin/dnssec/dnssec-signzone.c Mon Dec 17 10:58:24 2012 (r244353) @@ -3520,7 +3520,10 @@ main(int argc, char *argv[]) { check_result(result, "isc_file_mktemplate"); fp = NULL; - result = isc_file_openunique(tempfile, &fp); + if (outputformat == dns_masterformat_text) + result = isc_file_openunique(tempfile, &fp); + else + result = isc_file_bopenunique(tempfile, &fp); if (result != ISC_R_SUCCESS) fatal("failed to open temporary output file: %s", isc_result_totext(result)); Modified: vendor/bind9/dist-9.6/bin/named/controlconf.c ============================================================================== --- vendor/bind9/dist-9.6/bin/named/controlconf.c Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/bin/named/controlconf.c Mon Dec 17 10:58:24 2012 (r244353) @@ -373,8 +373,10 @@ control_recvmessage(isc_task_t *task, is if (result == ISC_R_SUCCESS) break; isc_mem_put(listener->mctx, secret.rstart, REGION_SIZE(secret)); - log_invalid(&conn->ccmsg, result); - goto cleanup; + if (result != ISCCC_R_BADAUTH) { + log_invalid(&conn->ccmsg, result); + goto cleanup; + } } if (key == NULL) { Modified: vendor/bind9/dist-9.6/bin/named/convertxsl.pl ============================================================================== --- vendor/bind9/dist-9.6/bin/named/convertxsl.pl Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/bin/named/convertxsl.pl Mon Dec 17 10:58:24 2012 (r244353) @@ -1,6 +1,6 @@ #!/usr/bin/env perl # -# Copyright (C) 2006-2008 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2006-2008, 2012 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above Modified: vendor/bind9/dist-9.6/bin/named/statschannel.c ============================================================================== --- vendor/bind9/dist-9.6/bin/named/statschannel.c Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/bin/named/statschannel.c Mon Dec 17 10:58:24 2012 (r244353) @@ -84,16 +84,19 @@ static const char *nsstats_desc[dns_nsst static const char *resstats_desc[dns_resstatscounter_max]; static const char *zonestats_desc[dns_zonestatscounter_max]; static const char *sockstats_desc[isc_sockstatscounter_max]; +static const char *dnssecstats_desc[dns_dnssecstats_max]; #ifdef HAVE_LIBXML2 static const char *nsstats_xmldesc[dns_nsstatscounter_max]; static const char *resstats_xmldesc[dns_resstatscounter_max]; static const char *zonestats_xmldesc[dns_zonestatscounter_max]; static const char *sockstats_xmldesc[isc_sockstatscounter_max]; +static const char *dnssecstats_xmldesc[dns_dnssecstats_max]; #else #define nsstats_xmldesc NULL #define resstats_xmldesc NULL #define zonestats_xmldesc NULL #define sockstats_xmldesc NULL +#define dnssecstats_xmldesc NULL #endif /* HAVE_LIBXML2 */ #define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0) @@ -107,6 +110,7 @@ static int nsstats_index[dns_nsstatscoun static int resstats_index[dns_resstatscounter_max]; static int zonestats_index[dns_zonestatscounter_max]; static int sockstats_index[isc_sockstatscounter_max]; +static int dnssecstats_index[dns_dnssecstats_max]; static inline void set_desc(int counter, int maxcounter, const char *fdesc, const char **fdescs, @@ -408,6 +412,33 @@ init_desc(void) { "FDwatchRecvErr"); INSIST(i == isc_sockstatscounter_max); + /* Initialize DNSSEC statistics */ + for (i = 0; i < dns_dnssecstats_max; i++) + dnssecstats_desc[i] = NULL; +#ifdef HAVE_LIBXML2 + for (i = 0; i < dns_dnssecstats_max; i++) + dnssecstats_xmldesc[i] = NULL; +#endif + +#define SET_DNSSECSTATDESC(counterid, desc, xmldesc) \ + do { \ + set_desc(dns_dnssecstats_ ## counterid, \ + dns_dnssecstats_max, \ + desc, dnssecstats_desc,\ + xmldesc, dnssecstats_xmldesc); \ + dnssecstats_index[i++] = dns_dnssecstats_ ## counterid; \ + } while (0) + + i = 0; + SET_DNSSECSTATDESC(asis, "dnssec validation success with signer " + "\"as is\"", "DNSSECasis"); + SET_DNSSECSTATDESC(downcase, "dnssec validation success with signer " + "lower cased", "DNSSECdowncase"); + SET_DNSSECSTATDESC(wildcard, "dnssec validation of wildcard signature", + "DNSSECwild"); + SET_DNSSECSTATDESC(fail, "dnssec validation failures", "DNSSECfail"); + INSIST(i == dns_dnssecstats_max); + /* Sanity check */ for (i = 0; i < dns_nsstatscounter_max; i++) INSIST(nsstats_desc[i] != NULL); @@ -417,6 +448,8 @@ init_desc(void) { INSIST(zonestats_desc[i] != NULL); for (i = 0; i < isc_sockstatscounter_max; i++) INSIST(sockstats_desc[i] != NULL); + for (i = 0; i < dns_dnssecstats_max; i++) + INSIST(dnssecstats_desc[i] != NULL); #ifdef HAVE_LIBXML2 for (i = 0; i < dns_nsstatscounter_max; i++) INSIST(nsstats_xmldesc[i] != NULL); @@ -426,6 +459,8 @@ init_desc(void) { INSIST(zonestats_xmldesc[i] != NULL); for (i = 0; i < isc_sockstatscounter_max; i++) INSIST(sockstats_xmldesc[i] != NULL); + for (i = 0; i < dns_dnssecstats_max; i++) + INSIST(dnssecstats_xmldesc[i] != NULL); #endif } Modified: vendor/bind9/dist-9.6/bin/nsupdate/nsupdate.c ============================================================================== --- vendor/bind9/dist-9.6/bin/nsupdate/nsupdate.c Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/bin/nsupdate/nsupdate.c Mon Dec 17 10:58:24 2012 (r244353) @@ -1011,7 +1011,7 @@ parse_name(char **cmdlinep, dns_message_ isc_buffer_t source; word = nsu_strsep(cmdlinep, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { fprintf(stderr, "could not read owner name\n"); return (STATUS_SYNTAX); } @@ -1044,6 +1044,11 @@ parse_rdata(char **cmdlinep, dns_rdatacl dns_rdatacallbacks_t callbacks; isc_result_t result; + if (cmdline == NULL) { + rdata->flags = DNS_RDATA_UPDATE; + return (STATUS_MORE); + } + while (*cmdline != 0 && isspace((unsigned char)*cmdline)) cmdline++; @@ -1110,7 +1115,7 @@ make_prereq(char *cmdline, isc_boolean_t */ if (isrrset) { word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { fprintf(stderr, "could not read class or type\n"); goto failure; } @@ -1126,7 +1131,7 @@ make_prereq(char *cmdline, isc_boolean_t * Now read the type. */ word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { fprintf(stderr, "could not read type\n"); goto failure; } @@ -1200,7 +1205,7 @@ evaluate_prereq(char *cmdline) { ddebug("evaluate_prereq()"); word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { fprintf(stderr, "could not read operation code\n"); return (STATUS_SYNTAX); } @@ -1229,14 +1234,14 @@ evaluate_server(char *cmdline) { long port; word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { fprintf(stderr, "could not read server name\n"); return (STATUS_SYNTAX); } server = word; word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) + if (word == NULL || *word == 0) port = DNSDEFAULTPORT; else { char *endp; @@ -1270,14 +1275,14 @@ evaluate_local(char *cmdline) { struct in6_addr in6; word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { fprintf(stderr, "could not read server name\n"); return (STATUS_SYNTAX); } local = word; word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) + if (word == NULL || *word == 0) port = 0; else { char *endp; @@ -1326,7 +1331,7 @@ evaluate_key(char *cmdline) { char *n; namestr = nsu_strsep(&cmdline, " \t\r\n"); - if (*namestr == 0) { + if (namestr == NULL || *namestr == 0) { fprintf(stderr, "could not read key name\n"); return (STATUS_SYNTAX); } @@ -1350,7 +1355,7 @@ evaluate_key(char *cmdline) { } secretstr = nsu_strsep(&cmdline, "\r\n"); - if (*secretstr == 0) { + if (secretstr == NULL || *secretstr == 0) { fprintf(stderr, "could not read key secret\n"); return (STATUS_SYNTAX); } @@ -1391,7 +1396,7 @@ evaluate_zone(char *cmdline) { isc_result_t result; word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { fprintf(stderr, "could not read zone name\n"); return (STATUS_SYNTAX); } @@ -1418,7 +1423,7 @@ evaluate_realm(char *cmdline) { char buf[1024]; word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { if (realm != NULL) isc_mem_free(mctx, realm); realm = NULL; @@ -1443,7 +1448,7 @@ evaluate_ttl(char *cmdline) { isc_uint32_t ttl; word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { fprintf(stderr, "could not ttl\n"); return (STATUS_SYNTAX); } @@ -1477,7 +1482,7 @@ evaluate_class(char *cmdline) { dns_rdataclass_t rdclass; word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { fprintf(stderr, "could not read class name\n"); return (STATUS_SYNTAX); } @@ -1535,7 +1540,7 @@ update_addordelete(char *cmdline, isc_bo * If it's a delete, ignore a TTL if present (for compatibility). */ word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { if (!isdelete) { fprintf(stderr, "could not read owner ttl\n"); goto failure; @@ -1576,7 +1581,7 @@ update_addordelete(char *cmdline, isc_bo */ word = nsu_strsep(&cmdline, " \t\r\n"); parseclass: - if (*word == 0) { + if (word == NULL || *word == 0) { if (isdelete) { rdataclass = dns_rdataclass_any; rdatatype = dns_rdatatype_any; @@ -1600,7 +1605,7 @@ update_addordelete(char *cmdline, isc_bo * Now read the type. */ word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { if (isdelete) { rdataclass = dns_rdataclass_any; rdatatype = dns_rdatatype_any; @@ -1680,7 +1685,7 @@ evaluate_update(char *cmdline) { ddebug("evaluate_update()"); word = nsu_strsep(&cmdline, " \t\r\n"); - if (*word == 0) { + if (word == NULL || *word == 0) { fprintf(stderr, "could not read operation code\n"); return (STATUS_SYNTAX); } @@ -1770,6 +1775,7 @@ get_next_command(void) { char cmdlinebuf[MAXCMD]; char *cmdline; char *word; + char *tmp; ddebug("get_next_command()"); if (interactive) { @@ -1781,11 +1787,18 @@ get_next_command(void) { isc_app_unblock(); if (cmdline == NULL) return (STATUS_QUIT); + + /* + * Normalize input by removing any eol. + */ + tmp = cmdline; + (void)nsu_strsep(&tmp, "\r\n"); + word = nsu_strsep(&cmdline, " \t\r\n"); if (feof(input)) return (STATUS_QUIT); - if (*word == 0) + if (word == NULL || *word == 0) return (STATUS_SEND); if (word[0] == ';') return (STATUS_MORE); Modified: vendor/bind9/dist-9.6/configure.in ============================================================================== --- vendor/bind9/dist-9.6/configure.in Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/configure.in Mon Dec 17 10:58:24 2012 (r244353) @@ -1,4 +1,4 @@ -# Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -1090,7 +1090,7 @@ case "$use_libxml2" in ;; auto|yes) case X`(xml2-config --version) 2>/dev/null` in - X2.[[67]].*) + X2.[[678]].*) libxml2_libs=`xml2-config --libs` libxml2_cflags=`xml2-config --cflags` ;; Modified: vendor/bind9/dist-9.6/doc/Makefile.in ============================================================================== --- vendor/bind9/dist-9.6/doc/Makefile.in Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/doc/Makefile.in Mon Dec 17 10:58:24 2012 (r244353) @@ -1,4 +1,4 @@ -# Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004-2007, 2012 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2000, 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any Modified: vendor/bind9/dist-9.6/doc/arm/Bv9ARM-book.xml ============================================================================== --- vendor/bind9/dist-9.6/doc/arm/Bv9ARM-book.xml Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/doc/arm/Bv9ARM-book.xml Mon Dec 17 10:58:24 2012 (r244353) @@ -9978,7 +9978,7 @@ zone zone_nameidentity + is specified in the identity field. @@ -9995,7 +9995,7 @@ zone zone_nameidentity field. + identity field. @@ -10010,7 +10010,7 @@ zone zone_nameidentity + is specified in the identity field. @@ -10027,7 +10027,7 @@ zone zone_nameidentity field. + identity field. Modified: vendor/bind9/dist-9.6/doc/arm/Bv9ARM.ch06.html ============================================================================== --- vendor/bind9/dist-9.6/doc/arm/Bv9ARM.ch06.html Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/doc/arm/Bv9ARM.ch06.html Mon Dec 17 10:58:24 2012 (r244353) @@ -6255,7 +6255,7 @@ zone zone_ (machine$@REALM) for machine in REALM and and converts it machine.realm allowing the machine to update machine.realm. The REALM to be matched - is specified in the <replacable>identity</replacable> + is specified in the identity field.

@@ -6273,7 +6273,7 @@ zone zone_ converts it to machine.realm allowing the machine to update subdomains of machine.realm. The REALM to be matched is specified in the - <replacable>identity</replacable> field. + identity field.

@@ -6289,7 +6289,7 @@ zone zone_ (host/machine@REALM) for machine in REALM and and converts it machine.realm allowing the machine to update machine.realm. The REALM to be matched - is specified in the <replacable>identity</replacable> + is specified in the identity field.

@@ -6307,7 +6307,7 @@ zone zone_ converts it to machine.realm allowing the machine to update subdomains of machine.realm. The REALM to be matched is specified in the - <replacable>identity</replacable> field. + identity field.

Modified: vendor/bind9/dist-9.6/doc/arm/Bv9ARM.pdf ============================================================================== Binary file (source and/or target). No diff available. Modified: vendor/bind9/dist-9.6/doc/misc/format-options.pl ============================================================================== --- vendor/bind9/dist-9.6/doc/misc/format-options.pl Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/doc/misc/format-options.pl Mon Dec 17 10:58:24 2012 (r244353) @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any Modified: vendor/bind9/dist-9.6/doc/misc/sort-options.pl ============================================================================== --- vendor/bind9/dist-9.6/doc/misc/sort-options.pl Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/doc/misc/sort-options.pl Mon Dec 17 10:58:24 2012 (r244353) @@ -1,6 +1,6 @@ #!/bin/perl # -# Copyright (C) 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2007, 2012 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above Modified: vendor/bind9/dist-9.6/isc-config.sh.in ============================================================================== --- vendor/bind9/dist-9.6/isc-config.sh.in Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/isc-config.sh.in Mon Dec 17 10:58:24 2012 (r244353) @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2000, 2001, 2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any Modified: vendor/bind9/dist-9.6/lib/Makefile.in ============================================================================== --- vendor/bind9/dist-9.6/lib/Makefile.in Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/lib/Makefile.in Mon Dec 17 10:58:24 2012 (r244353) @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2001, 2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any Modified: vendor/bind9/dist-9.6/lib/bind9/api ============================================================================== --- vendor/bind9/dist-9.6/lib/bind9/api Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/lib/bind9/api Mon Dec 17 10:58:24 2012 (r244353) @@ -4,5 +4,5 @@ # 9.8: 80-89 # 9.9: 90-109 LIBINTERFACE = 50 -LIBREVISION = 7 +LIBREVISION = 9 LIBAGE = 0 Modified: vendor/bind9/dist-9.6/lib/bind9/check.c ============================================================================== --- vendor/bind9/dist-9.6/lib/bind9/check.c Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/lib/bind9/check.c Mon Dec 17 10:58:24 2012 (r244353) @@ -287,10 +287,6 @@ disabled_algorithms(const cfg_obj_t *dis tresult = dns_secalg_fromtext(&alg, &r); if (tresult != ISC_R_SUCCESS) { - isc_uint8_t ui; - result = isc_parse_uint8(&ui, r.base, 10); - } - if (tresult != ISC_R_SUCCESS) { cfg_obj_log(cfg_listelt_value(element), logctx, ISC_LOG_ERROR, "invalid algorithm '%s'", r.base); @@ -1028,6 +1024,29 @@ typedef struct { } optionstable; static isc_result_t +check_nonzero(const cfg_obj_t *options, isc_log_t *logctx) { + isc_result_t result = ISC_R_SUCCESS; + const cfg_obj_t *obj = NULL; + unsigned int i; + + static const char *nonzero[] = { "max-retry-time", "min-retry-time", + "max-refresh-time", "min-refresh-time" }; + /* + * Check if value is zero. + */ + for (i = 0; i < sizeof(nonzero) / sizeof(nonzero[0]); i++) { + obj = NULL; + if (cfg_map_get(options, nonzero[i], &obj) == ISC_R_SUCCESS && + cfg_obj_asuint32(obj) == 0) { + cfg_obj_log(obj, logctx, ISC_LOG_ERROR, + "'%s' must not be zero", nonzero[i]); + result = ISC_R_FAILURE; + } + } + return (result); +} + +static isc_result_t check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, const cfg_obj_t *config, isc_symtab_t *symtab, dns_rdataclass_t defclass, cfg_aclconfctx_t *actx, @@ -1036,7 +1055,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const char *zname; const char *typestr; unsigned int ztype; - const cfg_obj_t *zoptions; + const cfg_obj_t *zoptions, *goptions = NULL; const cfg_obj_t *obj = NULL; isc_result_t result = ISC_R_SUCCESS; isc_result_t tresult; @@ -1105,9 +1124,11 @@ check_zoneconf(const cfg_obj_t *zconfig, }; zname = cfg_obj_asstring(cfg_tuple_get(zconfig, "name")); - zoptions = cfg_tuple_get(zconfig, "options"); + if (config != NULL) + cfg_map_get(config, "options", &goptions); + obj = NULL; (void)cfg_map_get(zoptions, "type", &obj); if (obj == NULL) { @@ -1188,6 +1209,12 @@ check_zoneconf(const cfg_obj_t *zconfig, } /* + * Check if value is zero. + */ + if (check_nonzero(zoptions, logctx) != ISC_R_SUCCESS) + result = ISC_R_FAILURE; + + /* * Look for inappropriate options for the given zone type. * Check that ACLs expand correctly. */ @@ -1760,10 +1787,16 @@ check_viewconf(const cfg_obj_t *config, isc_result_t result = ISC_R_SUCCESS; isc_result_t tresult = ISC_R_SUCCESS; cfg_aclconfctx_t actx; + const cfg_obj_t *options = NULL; const cfg_obj_t *obj; isc_boolean_t enablednssec, enablevalidation; /* + * Get global options block. + */ + (void)cfg_map_get(config, "options", &options); + + /* * Check that all zone statements are syntactically correct and * there are no duplicate zones. */ @@ -1798,8 +1831,6 @@ check_viewconf(const cfg_obj_t *config, * Check that forwarding is reasonable. */ if (voptions == NULL) { - const cfg_obj_t *options = NULL; - (void)cfg_map_get(config, "options", &options); if (options != NULL) if (check_forward(options, NULL, logctx) != ISC_R_SUCCESS) @@ -1810,11 +1841,17 @@ check_viewconf(const cfg_obj_t *config, } /* + * Check non-zero options at the global and view levels. + */ + if (options != NULL && check_nonzero(options, logctx) != ISC_R_SUCCESS) + result = ISC_R_FAILURE; + if (voptions != NULL &&check_nonzero(voptions, logctx) != ISC_R_SUCCESS) + result = ISC_R_FAILURE; + + /* * Check that dual-stack-servers is reasonable. */ if (voptions == NULL) { - const cfg_obj_t *options = NULL; - (void)cfg_map_get(config, "options", &options); if (options != NULL) if (check_dual_stack(options, logctx) != ISC_R_SUCCESS) result = ISC_R_FAILURE; @@ -1838,15 +1875,15 @@ check_viewconf(const cfg_obj_t *config, tresult = isc_symtab_create(mctx, 1000, freekey, mctx, ISC_FALSE, &symtab); if (tresult != ISC_R_SUCCESS) - return (ISC_R_NOMEMORY); + goto cleanup; (void)cfg_map_get(config, "key", &keys); tresult = check_keylist(keys, symtab, mctx, logctx); if (tresult == ISC_R_EXISTS) result = ISC_R_FAILURE; else if (tresult != ISC_R_SUCCESS) { - isc_symtab_destroy(&symtab); - return (tresult); + result = tresult; + goto cleanup; } if (voptions != NULL) { @@ -1856,8 +1893,8 @@ check_viewconf(const cfg_obj_t *config, if (tresult == ISC_R_EXISTS) result = ISC_R_FAILURE; else if (tresult != ISC_R_SUCCESS) { - isc_symtab_destroy(&symtab); - return (tresult); + result = tresult; + goto cleanup; } } @@ -1939,6 +1976,9 @@ check_viewconf(const cfg_obj_t *config, if (tresult != ISC_R_SUCCESS) result = tresult; + cleanup: + if (symtab != NULL) + isc_symtab_destroy(&symtab); cfg_aclconfctx_destroy(&actx); return (result); Modified: vendor/bind9/dist-9.6/lib/bind9/include/Makefile.in ============================================================================== --- vendor/bind9/dist-9.6/lib/bind9/include/Makefile.in Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/lib/bind9/include/Makefile.in Mon Dec 17 10:58:24 2012 (r244353) @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any Modified: vendor/bind9/dist-9.6/lib/bind9/include/bind9/Makefile.in ============================================================================== --- vendor/bind9/dist-9.6/lib/bind9/include/bind9/Makefile.in Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/lib/bind9/include/bind9/Makefile.in Mon Dec 17 10:58:24 2012 (r244353) @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any Modified: vendor/bind9/dist-9.6/lib/dns/adb.c ============================================================================== --- vendor/bind9/dist-9.6/lib/dns/adb.c Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/lib/dns/adb.c Mon Dec 17 10:58:24 2012 (r244353) @@ -3430,8 +3430,10 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_a addr->entry->srtt = new_srtt; addr->srtt = new_srtt; - isc_stdtime_get(&now); - addr->entry->expires = now + ADB_ENTRY_WINDOW; + if (addr->entry->expires == 0) { + isc_stdtime_get(&now); + addr->entry->expires = now + ADB_ENTRY_WINDOW; + } UNLOCK(&adb->entrylocks[bucket]); } @@ -3441,6 +3443,7 @@ dns_adb_changeflags(dns_adb_t *adb, dns_ unsigned int bits, unsigned int mask) { int bucket; + isc_stdtime_t now; REQUIRE(DNS_ADB_VALID(adb)); REQUIRE(DNS_ADBADDRINFO_VALID(addr)); @@ -3449,6 +3452,11 @@ dns_adb_changeflags(dns_adb_t *adb, dns_ LOCK(&adb->entrylocks[bucket]); addr->entry->flags = (addr->entry->flags & ~mask) | (bits & mask); + if (addr->entry->expires == 0) { + isc_stdtime_get(&now); + addr->entry->expires = now + ADB_ENTRY_WINDOW; + } + /* * Note that we do not update the other bits in addr->flags with * the most recent values from addr->entry->flags. @@ -3527,15 +3535,16 @@ dns_adb_freeaddrinfo(dns_adb_t *adb, dns entry = addr->entry; REQUIRE(DNS_ADBENTRY_VALID(entry)); - isc_stdtime_get(&now); - *addrp = NULL; overmem = isc_mem_isovermem(adb->mctx); bucket = addr->entry->lock_bucket; LOCK(&adb->entrylocks[bucket]); - entry->expires = now + ADB_ENTRY_WINDOW; + if (entry->expires == 0) { + isc_stdtime_get(&now); + entry->expires = now + ADB_ENTRY_WINDOW; + } want_check_exit = dec_entry_refcnt(adb, overmem, entry, ISC_FALSE); Modified: vendor/bind9/dist-9.6/lib/dns/api ============================================================================== --- vendor/bind9/dist-9.6/lib/dns/api Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/lib/dns/api Mon Dec 17 10:58:24 2012 (r244353) @@ -3,6 +3,6 @@ # 9.7: 60-79 # 9.8: 80-89 # 9.9: 90-109 -LIBINTERFACE = 110 +LIBINTERFACE = 111 LIBREVISION = 2 -LIBAGE = 0 +LIBAGE = 1 Modified: vendor/bind9/dist-9.6/lib/dns/dnssec.c ============================================================================== --- vendor/bind9/dist-9.6/lib/dns/dnssec.c Mon Dec 17 10:51:22 2012 (r244352) +++ vendor/bind9/dist-9.6/lib/dns/dnssec.c Mon Dec 17 10:58:24 2012 (r244353) @@ -35,16 +35,20 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include /* for DNS_TSIG_FUDGE */ #include +LIBDNS_EXTERNAL_DATA isc_stats_t *dns_dnssec_stats; + #define is_response(msg) (msg->flags & DNS_MESSAGEFLAG_QR) #define RETERR(x) do { \ @@ -74,6 +78,12 @@ digest_callback(void *arg, isc_region_t return (dst_context_adddata(ctx, data)); } +static inline void +inc_stat(isc_statscounter_t counter) { + if (dns_dnssec_stats != NULL) + isc_stats_increment(dns_dnssec_stats, counter); +} + /* * Make qsort happy. */ @@ -150,7 +160,9 @@ dns_dnssec_keyfromrdata(dns_name_t *name } static isc_result_t -digest_sig(dst_context_t *ctx, dns_rdata_t *sigrdata, dns_rdata_rrsig_t *sig) { +digest_sig(dst_context_t *ctx, isc_boolean_t downcase, dns_rdata_t *sigrdata, + dns_rdata_rrsig_t *rrsig) +{ isc_region_t r; isc_result_t ret; dns_fixedname_t fname; @@ -162,11 +174,16 @@ digest_sig(dst_context_t *ctx, dns_rdata ret = dst_context_adddata(ctx, &r); if (ret != ISC_R_SUCCESS) return (ret); - dns_fixedname_init(&fname); - RUNTIME_CHECK(dns_name_downcase(&sig->signer, - dns_fixedname_name(&fname), NULL) - == ISC_R_SUCCESS); - dns_name_toregion(dns_fixedname_name(&fname), &r); + if (downcase) { + dns_fixedname_init(&fname); + + RUNTIME_CHECK(dns_name_downcase(&rrsig->signer, + dns_fixedname_name(&fname), + NULL) == ISC_R_SUCCESS); + dns_name_toregion(dns_fixedname_name(&fname), &r); + } else + dns_name_toregion(&rrsig->signer, &r); + return (dst_context_adddata(ctx, &r)); } @@ -188,6 +205,7 @@ dns_dnssec_sign(dns_name_t *name, dns_rd isc_uint32_t flags; unsigned int sigsize; dns_fixedname_t fnewname; + dns_fixedname_t fsigner; REQUIRE(name != NULL); REQUIRE(dns_name_countlabels(name) <= 255); @@ -215,8 +233,14 @@ dns_dnssec_sign(dns_name_t *name, dns_rd sig.common.rdtype = dns_rdatatype_rrsig; ISC_LINK_INIT(&sig.common, link); + /* + * Downcase signer. + */ dns_name_init(&sig.signer, NULL); - dns_name_clone(dst_key_name(key), &sig.signer); + dns_fixedname_init(&fsigner); + RUNTIME_CHECK(dns_name_downcase(dst_key_name(key), + dns_fixedname_name(&fsigner), NULL) == ISC_R_SUCCESS); + dns_name_clone(dns_fixedname_name(&fsigner), &sig.signer); sig.covered = set->type; sig.algorithm = dst_key_alg(key); @@ -256,7 +280,7 @@ dns_dnssec_sign(dns_name_t *name, dns_rd /* * Digest the SIG rdata. */ - ret = digest_sig(ctx, &tmpsigrdata, &sig); + ret = digest_sig(ctx, ISC_FALSE, &tmpsigrdata, &sig); if (ret != ISC_R_SUCCESS) goto cleanup_context; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 11:00:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 36A7D654; Mon, 17 Dec 2012 11:00:04 +0000 (UTC) (envelope-from erwin@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 02EB78FC0C; Mon, 17 Dec 2012 11:00:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHB03fU073077; Mon, 17 Dec 2012 11:00:03 GMT (envelope-from erwin@svn.freebsd.org) Received: (from erwin@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHB03LV073075; Mon, 17 Dec 2012 11:00:03 GMT (envelope-from erwin@svn.freebsd.org) Message-Id: <201212171100.qBHB03LV073075@svn.freebsd.org> From: Erwin Lansing Date: Mon, 17 Dec 2012 11:00:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r244354 - vendor/bind9/9.6-ESV-R8 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 11:00:04 -0000 Author: erwin Date: Mon Dec 17 11:00:03 2012 New Revision: 244354 URL: http://svnweb.freebsd.org/changeset/base/244354 Log: Tag the Bind 9.6-ESV-R8 release. Approved by: delphij (mentor) Added: vendor/bind9/9.6-ESV-R8/ - copied from r244353, vendor/bind9/dist-9.6/ From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 11:31:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E32009AF; Mon, 17 Dec 2012 11:31:58 +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 3761E8FC0C; Mon, 17 Dec 2012 11:31:58 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qBHBVpxl022797; Mon, 17 Dec 2012 13:31:51 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.3 kib.kiev.ua qBHBVpxl022797 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qBHBVpRH022796; Mon, 17 Dec 2012 13:31:51 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 17 Dec 2012 13:31:51 +0200 From: Konstantin Belousov To: Gabor Kovesdan Subject: Re: svn commit: r244346 - head/usr.bin/sort Message-ID: <20121217113151.GA71906@kib.kiev.ua> References: <201212170936.qBH9ah0V059357@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2VcK7Ezgm4IMdfSa" Content-Disposition: inline In-Reply-To: <201212170936.qBH9ah0V059357@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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 11:31:59 -0000 --2VcK7Ezgm4IMdfSa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 17, 2012 at 09:36:43AM +0000, Gabor Kovesdan wrote: > Author: gabor > Date: Mon Dec 17 09:36:43 2012 > New Revision: 244346 > URL: http://svnweb.freebsd.org/changeset/base/244346 >=20 > Log: > - Use unsigned int for values obtained with sysctlbyname(). This fixes > sparc64 performance problems. > =20 > Submitted by: Oleg Moskalenko > Tested by: trasz >=20 > Modified: > head/usr.bin/sort/sort.c > head/usr.bin/sort/sort.h >=20 > Modified: head/usr.bin/sort/sort.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/usr.bin/sort/sort.c Mon Dec 17 06:44:16 2012 (r244345) > +++ head/usr.bin/sort/sort.c Mon Dec 17 09:36:43 2012 (r244346) > @@ -103,7 +103,7 @@ bool debug_sort; > bool need_hint; > =20 > #if defined(SORT_THREADS) > -size_t ncpu =3D 1; > +unsigned int ncpu =3D 1; > size_t nthreads =3D 1; > #endif > =20 > @@ -268,14 +268,16 @@ set_hw_params(void) > #if defined(SORT_THREADS) > size_t ncpusz; > #endif > - size_t pages, psize, psz, pszsz; > + unsigned int pages, psize; > + size_t psz, pszsz; > =20 > pages =3D psize =3D 0; > #if defined(SORT_THREADS) > ncpu =3D 1; > ncpusz =3D sizeof(size_t); > #endif > - psz =3D pszsz =3D sizeof(size_t); > + psz =3D sizeof(pages); > + pszsz =3D sizeof(psize); > =20 > if (sysctlbyname("vm.stats.vm.v_free_count", &pages, &psz, > NULL, 0) < 0) { > @@ -299,6 +301,9 @@ set_hw_params(void) > =20 > free_memory =3D (unsigned long long) pages * (unsigned long long) psize; > available_free_memory =3D (free_memory * 9) / 10; > + > + if (available_free_memory < 1024) > + available_free_memory =3D 1024; > } Instead of direct use of sysctl interface for hw.ncpu, use sysconf(_SC_NPROCESSORS_ONLN). The 'query' for the available memory is absolutely wrong and is beyond any repair, it must be removed. > =20 > /* >=20 > Modified: head/usr.bin/sort/sort.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/usr.bin/sort/sort.h Mon Dec 17 06:44:16 2012 (r244345) > +++ head/usr.bin/sort/sort.h Mon Dec 17 09:36:43 2012 (r244346) > @@ -54,7 +54,7 @@ extern const char *nlsstr[]; > =20 > #if defined(SORT_THREADS) > #define MT_SORT_THRESHOLD (10000) > -extern size_t ncpu; > +extern unsigned int ncpu; > extern size_t nthreads; > #endif > =20 --2VcK7Ezgm4IMdfSa Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJQzwKmAAoJEJDCuSvBvK1Bb+YP/jcn4MhUCyLIxXZVK4TW7cUI 9yTk4jPRJl/pJMIj+oRizANPxGwJBQfDW3h+oCBO5CgwRkfM3vVm/TIs6OKGdNxU utsNQeF17XvtBgoF2sMiff0VcecJgfGKzKve5ffgg8Z82Hvz28ae9/23P5MD5t7P P9gwOsbYjKFdCoYL5ldGZlFJFR48OralcML+f86B7gudWhpU0eNBbAL5cnYGxobe o1j8sS0+aZNQxzjSGnuMyf9t3G5sWpl4aTsbj96ZHYxOd06b6X8UXD+EbOIdSZnX O/BlLkDy+E/nJxqdqk5RVbLE/nUBG9+kUKiptcN+TDVJzo6ctEiAmzFh9XmVuLaB v1XUKt3ZmnOknl8ZiSqXscvBwEGYzKBvz6Dkv72BIvkUVJ0WduloruJne6QvKNSR 6sDx0EFRFZqhYaIX6tgXQMZOAmjcFQUeDcmuAZVaWL/8NEnciC1YViutaZjaT8H4 bZF0vWV43lgQPfveVdBh6lhtdtuxxBDKWeixZZLwVZTU83gPqL2K48KAb0aE0foY ny7QUHXKSObtgEzXriwvYO4eQXWvUYmbWrzH08Aznwg7w04FkKAiYGcEe0OKuNeb d2C6CxS0dWIistK2sRz4hFgS4MgkOzAspTWPI4bJuZuqm76OcNYmxp488y0a0izi UsHrei63BY+k/AK66fqR =yKDY -----END PGP SIGNATURE----- --2VcK7Ezgm4IMdfSa-- From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 11:47:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 22E3CDDF; Mon, 17 Dec 2012 11:47:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id CD59C8FC0C; Mon, 17 Dec 2012 11:47:40 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 68C5B46B20; Mon, 17 Dec 2012 06:47:39 -0500 (EST) Date: Mon, 17 Dec 2012 11:47:39 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Adrian Chadd Subject: Re: svn commit: r244271 - head/usr.sbin/iostat In-Reply-To: Message-ID: References: <201212151821.qBFILAOP013123@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Mikolaj Golub , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 11:47:41 -0000 On Sat, 15 Dec 2012, Adrian Chadd wrote: > People may have scripts based on the current output. > > You should have introduced a new parameter which modifies the output > behaviour in the way you wanted, rather than modifying the existing > behaviour. > > Please consider reverting your change (which is a good idea, btw) and adding > a new modifier that outputs the value(s), rather than a %age. I would really like all of our monitoring commands -- netstat, iostat, vmstat, ... to support a machine-readable output mode, in which they encode their output using XML (or something) that can be used by scripts. This could then, perhaps, be combined with a new command-line tool that can be used to extract (e.g.,) named values for specific devices, PIDs, etc. That would make continued updates to human-readable output more palettable. Robert > > Adrian > > > On 15 December 2012 10:21, Mikolaj Golub wrote: >> Author: trociny >> Date: Sat Dec 15 18:21:09 2012 >> New Revision: 244271 >> URL: http://svnweb.freebsd.org/changeset/base/244271 >> >> Log: >> Change `iostat -Ix` to display total duration of transactions instead >> of average duration, and total busy time instead of %. >> >> This looks more useful when one runs `iostat -Ix` periodically to >> collect statistics: e.g. now it is possible to calculate busy % >> between two runs subtracting total busy times and dividing per time >> period. >> >> Average duration and % busy are still available via `iostat -x`. >> >> Modified: >> head/usr.sbin/iostat/iostat.8 >> head/usr.sbin/iostat/iostat.c >> >> Modified: head/usr.sbin/iostat/iostat.8 >> ============================================================================== >> --- head/usr.sbin/iostat/iostat.8 Sat Dec 15 18:19:48 2012 (r244270) >> +++ head/usr.sbin/iostat/iostat.8 Sat Dec 15 18:21:09 2012 (r244271) >> @@ -56,7 +56,7 @@ >> .\" >> .\" @(#)iostat.8 8.1 (Berkeley) 6/6/93 >> .\" >> -.Dd November 24, 2010 >> +.Dd December 15, 2012 >> .Dt IOSTAT 8 >> .Os >> .Sh NAME >> @@ -366,6 +366,32 @@ average duration of transactions, in mil >> % of time the device had one or more outstanding transactions >> .El >> .Pp >> +The extended >> +.Nm >> +device display, with the >> +.Fl x >> +and >> +.Fl I >> +flags specified, shows the following statistics: >> +.Pp >> +.Bl -tag -width indent -compact >> +.It r/i >> +read operations per time period >> +.It w/i >> +write operations per time period >> +.It kr/i >> +kilobytes read per time period >> +.It kw/i >> +kilobytes write per time period >> +.It qlen >> +transactions queue length >> +.It tsvc_t/i >> +total duration of transactions per time period, in seconds >> +.It sb/i >> +total time the device had one or more outstanding transactions per >> +time period, in seconds >> +.El >> +.Pp >> The old-style >> .Nm >> display (using >> >> Modified: head/usr.sbin/iostat/iostat.c >> ============================================================================== >> --- head/usr.sbin/iostat/iostat.c Sat Dec 15 18:19:48 2012 (r244270) >> +++ head/usr.sbin/iostat/iostat.c Sat Dec 15 18:21:09 2012 (r244271) >> @@ -731,10 +731,10 @@ devstats(int perf_select, long double et >> u_int64_t total_bytes, total_transfers, total_blocks; >> u_int64_t total_bytes_read, total_transfers_read; >> u_int64_t total_bytes_write, total_transfers_write; >> - long double busy_pct; >> + long double busy_pct, busy_time; >> u_int64_t queue_len; >> long double total_mb; >> - long double blocks_per_second, ms_per_transaction; >> + long double blocks_per_second, ms_per_transaction, total_duration; >> int firstline = 1; >> char *devname; >> >> @@ -745,14 +745,13 @@ devstats(int perf_select, long double et >> if (Cflag > 0) >> printf(" cpu "); >> printf("\n"); >> - if (Iflag == 0) >> - printf( >> - "device r/s w/s kr/s kw/s qlen svc_t %%b " >> - ); >> - else >> - printf( >> - "device r/i w/i kr/i kw/i qlen svc_t %%b " >> - ); >> + if (Iflag == 0) { >> + printf("device r/s w/s kr/s kw/s qlen " >> + "svc_t %%b "); >> + } else { >> + printf("device r/i w/i kr/i" >> + " kw/i qlen tsvc_t/i sb/i "); >> + } >> if (Tflag > 0) >> printf("tin tout "); >> if (Cflag > 0) >> @@ -789,6 +788,8 @@ devstats(int perf_select, long double et >> DSM_MS_PER_TRANSACTION, &ms_per_transaction, >> DSM_BUSY_PCT, &busy_pct, >> DSM_QUEUE_LENGTH, &queue_len, >> + DSM_TOTAL_DURATION, &total_duration, >> + DSM_TOTAL_BUSY_TIME, &busy_time, >> DSM_NONE) != 0) >> errx(1, "%s", devstat_errbuf); >> >> @@ -827,7 +828,9 @@ devstats(int perf_select, long double et >> queue_len, >> ms_per_transaction, busy_pct); >> else >> - printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4" PRIu64 " %5.1Lf %3.0Lf ", >> + printf("%-8.8s %11.1Lf %11.1Lf " >> + "%12.1Lf %12.1Lf %4" PRIu64 >> + " %10.1Lf %9.1Lf ", >> devname, >> (long double)total_transfers_read, >> (long double)total_transfers_write, >> @@ -836,7 +839,7 @@ devstats(int perf_select, long double et >> (long double) >> total_bytes_write / 1024, >> queue_len, >> - ms_per_transaction, busy_pct); >> + total_duration, busy_time); >> if (firstline) { >> /* >> * If this is the first device > From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 12:26:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 746C0DED; Mon, 17 Dec 2012 12:26:11 +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 553CE8FC0C; Mon, 17 Dec 2012 12:26:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHCQB4D085894; Mon, 17 Dec 2012 12:26:11 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHCQBTU085893; Mon, 17 Dec 2012 12:26:11 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201212171226.qBHCQBTU085893@svn.freebsd.org> From: Jilles Tjoelker Date: Mon, 17 Dec 2012 12:26:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244356 - stable/9/lib/libc/gen X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 12:26:11 -0000 Author: jilles Date: Mon Dec 17 12:26:10 2012 New Revision: 244356 URL: http://svnweb.freebsd.org/changeset/base/244356 Log: MFC r239150: nftw(): Do not check the maxfds argument against OPEN_MAX. Apart from the fact that nothing should have OPEN_MAX as a limit (as opposed to RLIMIT_NOFILE from getrlimit() or _SC_OPEN_MAX from sysconf()), POSIX does not require us to check this. PR: 95239 Submitted by: Todd Miller Modified: stable/9/lib/libc/gen/nftw.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/nftw.c ============================================================================== --- stable/9/lib/libc/gen/nftw.c Mon Dec 17 11:12:09 2012 (r244355) +++ stable/9/lib/libc/gen/nftw.c Mon Dec 17 12:26:10 2012 (r244356) @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, @@ -47,7 +46,7 @@ nftw(const char *path, int (*fn)(const c int error = 0, ftsflags, fnflag, postorder, sverrno; /* XXX - nfds is currently unused */ - if (nfds < 1 || nfds > OPEN_MAX) { + if (nfds < 1) { errno = EINVAL; return (-1); } From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 12:50:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D4B5369B; Mon, 17 Dec 2012 12:50:06 +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 6D1108FC12; Mon, 17 Dec 2012 12:50:05 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 9A7DA358C58; Mon, 17 Dec 2012 13:50:04 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 875072848C; Mon, 17 Dec 2012 13:50:04 +0100 (CET) Date: Mon, 17 Dec 2012 13:50:04 +0100 From: Jilles Tjoelker To: Xin LI Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl Message-ID: <20121217125004.GA47894@stack.nl> References: <201212132332.qBDNWmK4037503@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201212132332.qBDNWmK4037503@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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 12:50:06 -0000 On Thu, Dec 13, 2012 at 11:32:48PM +0000, Xin LI wrote: > Author: delphij > Date: Thu Dec 13 23:32:47 2012 > New Revision: 244198 > URL: http://svnweb.freebsd.org/changeset/base/244198 > Log: > Teach sysctl(8) about parsing a file (while I'm there also give it > capability of parsing both = and : formats). > Submitted by: hrs (initial version, bugs are mine) > MFC after: 3 months > Modified: head/sbin/sysctl/sysctl.c > ============================================================================== > --- head/sbin/sysctl/sysctl.c Thu Dec 13 23:19:13 2012 (r244197) > +++ head/sbin/sysctl/sysctl.c Thu Dec 13 23:32:47 2012 (r244198) > [snip] > @@ -194,6 +213,14 @@ parse(const char *string) > } > while (isspace(*cp)) > cp++; > + /* Strip a pair of " or ' if any. */ > + switch (*cp) { > + case '\"': > + case '\'': > + if (cp[strlen(cp) - 1] == *cp) > + cp[strlen(cp) - 1] = '\0'; > + cp++; > + } > newval = cp; > newsize = strlen(cp); > } As I wrote in http://lists.freebsd.org/pipermail/freebsd-current/2012-December/038241.html I think this is messy, and requires a confusing change to user code that called sysctl(8) with strings starting with a quote. On the positive side this allows setting sysctl values starting with whitespace, but perhaps the isspace loop above it should be removed as well so that can be done without adding quotes. It seems inappropriate for sysctl.conf in particular since that file did not allow the extra whitespace in the first place. -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 12:55:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F1786A40; Mon, 17 Dec 2012 12:55:01 +0000 (UTC) (envelope-from eadler@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 D5CF98FC13; Mon, 17 Dec 2012 12:55:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHCt11i089496; Mon, 17 Dec 2012 12:55:01 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHCt1Vp089495; Mon, 17 Dec 2012 12:55:01 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212171255.qBHCt1Vp089495@svn.freebsd.org> From: Eitan Adler Date: Mon, 17 Dec 2012 12:55:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244357 - stable/9/share/man/man4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 12:55:02 -0000 Author: eadler Date: Mon Dec 17 12:55:01 2012 New Revision: 244357 URL: http://svnweb.freebsd.org/changeset/base/244357 Log: MFC r241864: Remove MLINK for if_idt. Approved by: cperciva (implicit) Modified: stable/9/share/man/man4/Makefile Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Mon Dec 17 12:26:10 2012 (r244356) +++ stable/9/share/man/man4/Makefile Mon Dec 17 12:55:01 2012 (r244357) @@ -592,7 +592,6 @@ MLINKS+=hme.4 if_hme.4 MLINKS+=hpet.4 acpi_hpet.4 MLINKS+=${_hptrr.4} ${_rr232x.4} MLINKS+=${_attimer.4} ${_i8254.4} -MLINKS+=idt.4 if_idt.4 MLINKS+=igb.4 if_igb.4 MLINKS+=ip.4 rawip.4 MLINKS+=ipfirewall.4 ipaccounting.4 \ From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 12:57:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 551D9DD2; Mon, 17 Dec 2012 12:57:37 +0000 (UTC) (envelope-from eadler@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 3B1BD8FC0C; Mon, 17 Dec 2012 12:57:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHCvbrn089832; Mon, 17 Dec 2012 12:57:37 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHCvbUA089831; Mon, 17 Dec 2012 12:57:37 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212171257.qBHCvbUA089831@svn.freebsd.org> From: Eitan Adler Date: Mon, 17 Dec 2012 12:57:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244358 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 12:57:37 -0000 Author: eadler Date: Mon Dec 17 12:57:36 2012 New Revision: 244358 URL: http://svnweb.freebsd.org/changeset/base/244358 Log: Fix warning from valgrind when a failed entry is tested. PR: kern/173008 Submitted by: Zhihao Yuan Reviewed by: gabor Approved by: cperciva (implicit) MFC after: 1 week Modified: head/lib/libc/nls/msgcat.c Modified: head/lib/libc/nls/msgcat.c ============================================================================== --- head/lib/libc/nls/msgcat.c Mon Dec 17 12:55:01 2012 (r244357) +++ head/lib/libc/nls/msgcat.c Mon Dec 17 12:57:36 2012 (r244358) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); if (np != NULL) { \ np->name = strdup(n); \ np->path = NULL; \ + np->catd = NLERR; \ np->lang = (l == NULL) ? NULL : \ strdup(l); \ np->caterrno = e; \ From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 13:03:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 03542FD; Mon, 17 Dec 2012 13:03:14 +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 DA3D48FC15; Mon, 17 Dec 2012 13:03:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHD3DBw090772; Mon, 17 Dec 2012 13:03:13 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHD3D0X090771; Mon, 17 Dec 2012 13:03:13 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201212171303.qBHD3D0X090771@svn.freebsd.org> From: Jilles Tjoelker Date: Mon, 17 Dec 2012 13:03:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244359 - stable/9/lib/libc/gen X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 13:03:14 -0000 Author: jilles Date: Mon Dec 17 13:03:13 2012 New Revision: 244359 URL: http://svnweb.freebsd.org/changeset/base/244359 Log: MFC r239151: ftw(): Do not check the maxfds argument against OPEN_MAX. Apart from the fact that nothing should have OPEN_MAX as a limit (as opposed to RLIMIT_NOFILE from getrlimit() or _SC_OPEN_MAX from sysconf()), POSIX does not require us to check this. POSIX does have a requirement on the application that maxfds not exceed {OPEN_MAX}, but does not require the implementation to check it ("may fail"). PR: 95239 Modified: stable/9/lib/libc/gen/ftw.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/ftw.c ============================================================================== --- stable/9/lib/libc/gen/ftw.c Mon Dec 17 12:57:36 2012 (r244358) +++ stable/9/lib/libc/gen/ftw.c Mon Dec 17 13:03:13 2012 (r244359) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include int ftw(const char *path, int (*fn)(const char *, const struct stat *, int), @@ -40,7 +39,7 @@ ftw(const char *path, int (*fn)(const ch int error = 0, fnflag, sverrno; /* XXX - nfds is currently unused */ - if (nfds < 1 || nfds > OPEN_MAX) { + if (nfds < 1) { errno = EINVAL; return (-1); } From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 13:16:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 256514FC; Mon, 17 Dec 2012 13:16:57 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id CF2EF8FC0A; Mon, 17 Dec 2012 13:16:55 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 3AB4BF88; Mon, 17 Dec 2012 14:14:49 +0100 (CET) Date: Mon, 17 Dec 2012 14:18:35 +0100 From: Pawel Jakub Dawidek To: Konstantin Belousov Subject: Re: svn commit: r244154 - head/bin/ps Message-ID: <20121217131834.GC1363@garage.freebsd.pl> References: <201212121545.qBCFj4Hl086444@svn.freebsd.org> <20121212210652.GO3013@kib.kiev.ua> <20121213111240.GB1381@garage.freebsd.pl> <201212141152.15567.jhb@freebsd.org> <20121214214246.GB1411@garage.freebsd.pl> <20121215011300.GN71906@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hoZxPH4CaxYzWscb" Content-Disposition: inline In-Reply-To: <20121215011300.GN71906@kib.kiev.ua> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Julian Elischer , John Baldwin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 13:16:57 -0000 --hoZxPH4CaxYzWscb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 15, 2012 at 03:13:00AM +0200, Konstantin Belousov wrote: > On Fri, Dec 14, 2012 at 10:42:47PM +0100, Pawel Jakub Dawidek wrote: > > In that case I'd prefer to make existing kern.pid_max sysctl read-only > > and make it loader tunable. I don't expect there are many users of this > > sysctl... > >=20 > No, I described you the purpose of the sysctl. Requiring reboot just for > running the old binaries is not useful. Please do not break it. Kostik. How many users of this sysctl are there? 2? 3? Is it really worth introducing yet another sysctl to export PID_MAX from the kernel? I think if someone decides to run 1.x binary there will be some inconvenience apart from the need to reboot. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --hoZxPH4CaxYzWscb Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlDPG6oACgkQForvXbEpPzTVLgCgo/ZlZwnx2RKDh0CZwIWBNsyU FW4AoPDvqoomooP8dJRrIWbmbS4/Naag =w6uI -----END PGP SIGNATURE----- --hoZxPH4CaxYzWscb-- From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 14:36:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8B5B1C82; Mon, 17 Dec 2012 14:36:57 +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 6ECFE8FC12; Mon, 17 Dec 2012 14:36:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHEavpx005524; Mon, 17 Dec 2012 14:36:57 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHEav2I005522; Mon, 17 Dec 2012 14:36:57 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201212171436.qBHEav2I005522@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 17 Dec 2012 14:36:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244360 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 14:36:57 -0000 Author: ae Date: Mon Dec 17 14:36:56 2012 New Revision: 244360 URL: http://svnweb.freebsd.org/changeset/base/244360 Log: Use M_PROTO7 flag for M_IP6_NEXTHOP, because M_PROTO2 was used for M_AUTHIPHDR. Pointy hat to: ae Reported by: Vadim Goncharov MFC after: 3 days Modified: head/sys/netinet6/ip6_var.h Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Mon Dec 17 13:03:13 2012 (r244359) +++ head/sys/netinet6/ip6_var.h Mon Dec 17 14:36:56 2012 (r244360) @@ -285,7 +285,7 @@ struct ip6aux { #define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */ #define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */ -#define M_IP6_NEXTHOP M_PROTO2 /* explicit ip nexthop */ +#define M_IP6_NEXTHOP M_PROTO7 /* explicit ip nexthop */ #ifdef __NO_STRICT_ALIGNMENT #define IP6_HDR_ALIGNED_P(ip) 1 From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 16:40:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C8418CDB; Mon, 17 Dec 2012 16:40:06 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-ia0-f182.google.com (mail-ia0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6AB068FC0C; Mon, 17 Dec 2012 16:40:06 +0000 (UTC) Received: by mail-ia0-f182.google.com with SMTP id x2so5548323iad.13 for ; Mon, 17 Dec 2012 08:40:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=PXewVJAOszM7Eb3MxmvmFpzoFJKIto+ZpfPddZHz7UQ=; b=uioLazZBVV/r2a+H2i5OuPPh9OCBamqLniyPVGfgiQOrACwLiovhPInmD57R193slo g7fJjzCR1csBrPDTIj5Yh9F17gtuqTP4zB/P2UqjbrxFygfFK8X89cs90t5txSz3kUW5 zDiIyLGwBkwELe/8LgoZLR9ki9b+/mScVOXAeHP7vjc47PsTtiI5PJ6PBJfyJJEHQdX0 +aZ0RwD5uMwONF+8HNvhGLHFaCpELTX/g5U/yLkn+nA0UjVxQ9A8KVgSWerPVUxf3m4Z Ku5MiOYlGKBp6PvBG2BBXv/dwin4U72DU370XaWKa6EixA/60KWGsfXcHY4GSCTbHX+t /Xug== MIME-Version: 1.0 Received: by 10.50.220.166 with SMTP id px6mr9603833igc.8.1355762399887; Mon, 17 Dec 2012 08:39:59 -0800 (PST) Sender: carpeddiem@gmail.com Received: by 10.50.112.134 with HTTP; Mon, 17 Dec 2012 08:39:59 -0800 (PST) In-Reply-To: References: <201212150003.qBF03Zr0085865@svn.freebsd.org> Date: Mon, 17 Dec 2012 11:39:59 -0500 X-Google-Sender-Auth: 51oIczUy3laMbDQ12SqqR43QSGI Message-ID: Subject: Re: svn commit: r244236 - head/share/mk From: Ed Maste To: Garrett Cooper 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 16:40:06 -0000 On 14 December 2012 19:13, Garrett Cooper wrote: > On Fri, Dec 14, 2012 at 4:03 PM, Ed Maste wrote: >> Author: emaste >> Date: Sat Dec 15 00:03:35 2012 >> New Revision: 244236 >> URL: http://svnweb.freebsd.org/changeset/base/244236 > > ... > >> Modified: head/share/mk/sys.mk >> ============================================================================== >> --- head/share/mk/sys.mk Fri Dec 14 23:13:06 2012 (r244235) >> +++ head/share/mk/sys.mk Sat Dec 15 00:03:35 2012 (r244236) >> @@ -134,6 +134,8 @@ NM ?= nm >> OBJC ?= cc >> OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import >> >> +OBJCOPY ?= objcopy >> + >> PC ?= pc >> PFLAGS ?= > > This shouldn't be defined when !defined(%POSIX) is true. The > .endif should be pulled down to just above SHELL?= according to what > I'm reading in http://pubs.opengroup.org/onlinepubs/009695399/utilities/make.html > . Thanks for pointing this out; unfortunately it seems we have a bit of a mess here already. For one example see bin/155000; it looks it's not even possible to correctly specify POSIX mode anyway. I'd like to see us grow support for a POSIX-sys.mk as bde mentions in 155000, and we could then do away with all of the .if goo. For now though I'll move the .endif down. > Other spots in the tree where OBJCOPY?= is noted can be probably > start to be reaped (thinking about sys/boot/, etc in particular). I > have a PR open for some work Warner started with an initial patch that > I've kind of been keeping up to date in git, but it needs to be > updated now per this change (and also because I didn't notice that > these variables weren't supposed to be defined when POSIX mode was > on). I'd think none of the other files should be affected by changes to support POSIX mode. From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 19:17:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B93A6BE0; Mon, 17 Dec 2012 19:17:10 +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 9E6E48FC15; Mon, 17 Dec 2012 19:17:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHJHAXo049609; Mon, 17 Dec 2012 19:17:10 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHJHAop049608; Mon, 17 Dec 2012 19:17:10 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <201212171917.qBHJHAop049608@svn.freebsd.org> From: "Andrey A. Chernov" Date: Mon, 17 Dec 2012 19:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244362 - head/gnu/usr.bin/binutils/as X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 19:17:10 -0000 Author: ache Date: Mon Dec 17 19:17:10 2012 New Revision: 244362 URL: http://svnweb.freebsd.org/changeset/base/244362 Log: Fix: line 11: Malformed conditional (${TARGET} == "arm" || ${TARGET_ARCH} == "powerpc64") Modified: head/gnu/usr.bin/binutils/as/Makefile Modified: head/gnu/usr.bin/binutils/as/Makefile ============================================================================== --- head/gnu/usr.bin/binutils/as/Makefile Mon Dec 17 19:00:52 2012 (r244361) +++ head/gnu/usr.bin/binutils/as/Makefile Mon Dec 17 19:17:10 2012 (r244362) @@ -8,7 +8,7 @@ .PATH: ${SRCDIR}/gas ${SRCDIR}/gas/config -.if ${TARGET} == "arm" || ${TARGET_ARCH} == "powerpc64" +.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "powerpc64" NO_WERROR.clang= .endif From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 20:55:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8EB9472A; Mon, 17 Dec 2012 20:55:34 +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 733868FC1A; Mon, 17 Dec 2012 20:55:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHKtYui070165; Mon, 17 Dec 2012 20:55:34 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHKtYgX070163; Mon, 17 Dec 2012 20:55:34 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201212172055.qBHKtYgX070163@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 17 Dec 2012 20:55:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244365 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 20:55:34 -0000 Author: ae Date: Mon Dec 17 20:55:33 2012 New Revision: 244365 URL: http://svnweb.freebsd.org/changeset/base/244365 Log: Since we use different flags to detect tcp forwarding, and we share the same code for IPv4 and IPv6 in tcp_input, we should check both M_IP_NEXTHOP and M_IP6_NEXTHOP flags. MFC after: 3 days Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Mon Dec 17 20:36:56 2012 (r244364) +++ head/sys/netinet/tcp_input.c Mon Dec 17 20:55:33 2012 (r244365) @@ -780,7 +780,8 @@ findpcb: /* * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. */ - if (m->m_flags & M_IP_NEXTHOP) + if ((isipv6 && (m->m_flags & M_IP6_NEXTHOP)) || + (!isipv6 && (m->m_flags & M_IP_NEXTHOP))) fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); #ifdef INET6 From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 21:09:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 455E1BF7; Mon, 17 Dec 2012 21:09:45 +0000 (UTC) (envelope-from emaste@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 293498FC13; Mon, 17 Dec 2012 21:09:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBHL9j2s074798; Mon, 17 Dec 2012 21:09:45 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBHL9jK1074797; Mon, 17 Dec 2012 21:09:45 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201212172109.qBHL9jK1074797@svn.freebsd.org> From: Ed Maste Date: Mon, 17 Dec 2012 21:09:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244366 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 21:09:45 -0000 Author: emaste Date: Mon Dec 17 21:09:44 2012 New Revision: 244366 URL: http://svnweb.freebsd.org/changeset/base/244366 Log: Hide OBJCOPY and others in POSIX mode Submitted by: Garrett Cooper Modified: head/share/mk/sys.mk Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Mon Dec 17 20:55:33 2012 (r244365) +++ head/share/mk/sys.mk Mon Dec 17 21:09:44 2012 (r244366) @@ -129,7 +129,6 @@ MAKE ?= make .if !defined(%POSIX) NM ?= nm -.endif OBJC ?= cc OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import @@ -141,6 +140,7 @@ PFLAGS ?= RC ?= f77 RFLAGS ?= +.endif SHELL ?= sh From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 21:16:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4FAEFFC9; Mon, 17 Dec 2012 21:16:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 1AF1B8FC0C; Mon, 17 Dec 2012 21:16:52 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8947FB915; Mon, 17 Dec 2012 16:16:51 -0500 (EST) From: John Baldwin To: Alfred Perlstein Subject: Re: svn commit: r244112 - head/sys/kern Date: Mon, 17 Dec 2012 14:38:05 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212141149.07671.jhb@freebsd.org> <50CB8B0C.2060908@mu.org> In-Reply-To: <50CB8B0C.2060908@mu.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Message-Id: <201212171438.05577.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 17 Dec 2012 16:16:51 -0500 (EST) Cc: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , Andriy Gapon , Gleb Smirnoff , Navdeep Parhar , svn-src-head@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 21:16:52 -0000 On Friday, December 14, 2012 3:24:44 pm Alfred Perlstein wrote: > On 12/14/12 8:49 AM, John Baldwin wrote: > > On Thursday, December 13, 2012 4:02:15 am Gleb Smirnoff wrote: > >> On Wed, Dec 12, 2012 at 04:53:48PM -0800, Alfred Perlstein wrote: > >> A> The problem again is that not all the KASSERTS are inviolable, if you > >> A> want to do a project to split them, then please do, it would really be > >> A> helpful, as for now, they are a mis-mash of death/warnings and there are > >> A> at least three vendors who approve of this as well as 3 long term > >> A> committers that approved my change (not including Adrian). > >> > >> Can you show examples of not inviolable KASSERTs? > > There are none. > > They are all assertions for a reason. However, in my > > experience at several large consumers of FreeBSD, no one wants to run with > > INVARIANTS in production. Not because we don't want panics (believe me, > > Yahoo! gets plenty of panics even with INVARIANTS disabled), but because the > > performance overhead, and redefining INVARIANTS into printf doesn't address > > that at all. > > > > Also, in regards to "if you think an a condition should be inviolable, make it > > a panic". I _did_ do that in WITNESS and you just reverted them! In all the > > cases of things like mismatching slock -> xlock you are about to corrupt > > WITNESS' internal state (leading to false positives or missed warnings) as > > well as the state of the locks themselves resulting in either hangs or random > > data corruption. > > > > Also, if you don't have a console wired up on all your machines (which not > > everyone does these days) a hang is _far_ worse than a crashdump, as when the > > machine hangs, you have to power cycle it, and you won't find the messages in > > /var/log/messages. With a straight-up panic if someone wants to run with > > INVARIANTS enabled they would instead have a nice crashdump that could be > > examined after the machine comes back up that points to the offending > > location. > > > > So in general, I will never use this and find it doesn't add any benefit > > whatsoever. OTOH, if it is not invasive (e.g. your original commit), then I > > think it might be ok if there are some folks who might actually find it > > useful. That said, I think direct use of kassert_panic() such as your changes > > to WITNESS is wrong. If you are going to change explicit panics, make them > > into a KASSERT() instead of changing a panic into a kassert_panic(). > > > Would that not break WITNESS without INVARIANTS. > > I can get a kernel to compile with a functional WITNESS without > INVARIANTS, however with this proposed change, then WITNESS wouldn't do > anything (not even log) without INVARIANTS. > > We can probably cobble up a WITNESS_ASSERT for witness if you'd like > that does the right thing based on ifdef INVARIANTS. > > Let me know what you think of that. Ugh, that isn't really any better than directly using kassert_panic(). Ideally the kasserts-that-aren't stuff would be transparent, but if that isn't possible directly calling kassert_panic() is probably less gross than the other alternatives. > I've also given you my personal phone number so we can hash this out > over the phone, but you have not called nor responded to that email. E-mail is functional, nor do I think that it is appropriate to exclude other folks on this thread from the conversation. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 21:16:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C4C2CFCF; Mon, 17 Dec 2012 21:16:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 8F2038FC12; Mon, 17 Dec 2012 21:16:57 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 138E8B939; Mon, 17 Dec 2012 16:16:57 -0500 (EST) From: John Baldwin To: Bruce Evans Subject: Re: svn commit: r244112 - head/sys/kern Date: Mon, 17 Dec 2012 14:39:26 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201212110708.qBB78EWx025288@svn.freebsd.org> <50CBC285.7060307@mu.org> <20121215161414.V1029@besplex.bde.org> In-Reply-To: <20121215161414.V1029@besplex.bde.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201212171439.27297.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 17 Dec 2012 16:16:57 -0500 (EST) X-Mailman-Approved-At: Mon, 17 Dec 2012 21:27:28 +0000 Cc: Adrian Chadd , Alfred Perlstein , src-committers@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , Andriy Gapon , Gleb Smirnoff , Robert Watson , Navdeep Parhar , svn-src-head@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 21:16:57 -0000 On Saturday, December 15, 2012 1:04:17 am Bruce Evans wrote: > On Fri, 14 Dec 2012, Alfred Perlstein wrote: > > > On 12/14/12 4:12 PM, Robert Watson wrote: > >> On Fri, 14 Dec 2012, John Baldwin wrote: > >> > >>> On Thursday, December 13, 2012 4:02:15 am Gleb Smirnoff wrote: > >>>> On Wed, Dec 12, 2012 at 04:53:48PM -0800, Alfred Perlstein wrote: A> The > >>>> problem again is that not all the KASSERTS are inviolable, if you A> want > >>>> to do a project to split them, then please do, it would really be A> > >>>> helpful, as for now, they are a mis-mash of death/warnings and there are > >>>> A> at least three vendors who approve of this as well as 3 long term A> > >>>> committers that approved my change (not including Adrian). > >>>> > >>>> Can you show examples of not inviolable KASSERTs? > >>> > >>> There are none. They are all assertions for a reason. However, in my > > Not even one whose existence is a bug? :-) They should just not exist at all then. :) All the more reason for them to panic early and often so developers will be prompted to remove them. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 21:21:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4B92B46A; Mon, 17 Dec 2012 21:21:47 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 23FCA8FC0C; Mon, 17 Dec 2012 21:21:47 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 762AA1A3C4C; Mon, 17 Dec 2012 13:21:46 -0800 (PST) Message-ID: <50CF8CE7.4020906@mu.org> Date: Mon, 17 Dec 2012 13:21:43 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: John Baldwin Subject: Re: svn commit: r244112 - head/sys/kern References: <201212110708.qBB78EWx025288@svn.freebsd.org> <50CBC285.7060307@mu.org> <20121215161414.V1029@besplex.bde.org> <201212171439.27297.jhb@freebsd.org> In-Reply-To: <201212171439.27297.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Mon, 17 Dec 2012 21:57:20 +0000 Cc: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , Andriy Gapon , Gleb Smirnoff , Robert Watson , Navdeep Parhar , Bruce Evans , svn-src-head@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 21:21:47 -0000 On 12/17/12 11:39 AM, John Baldwin wrote: > On Saturday, December 15, 2012 1:04:17 am Bruce Evans wrote: >> On Fri, 14 Dec 2012, Alfred Perlstein wrote: >> >>> On 12/14/12 4:12 PM, Robert Watson wrote: >>>> On Fri, 14 Dec 2012, John Baldwin wrote: >>>> >>>>> On Thursday, December 13, 2012 4:02:15 am Gleb Smirnoff wrote: >>>>>> On Wed, Dec 12, 2012 at 04:53:48PM -0800, Alfred Perlstein wrote: A> The >>>>>> problem again is that not all the KASSERTS are inviolable, if you A> want >>>>>> to do a project to split them, then please do, it would really be A> >>>>>> helpful, as for now, they are a mis-mash of death/warnings and there are >>>>>> A> at least three vendors who approve of this as well as 3 long term A> >>>>>> committers that approved my change (not including Adrian). >>>>>> >>>>>> Can you show examples of not inviolable KASSERTs? >>>>> There are none. They are all assertions for a reason. However, in my >> Not even one whose existence is a bug? :-) > They should just not exist at all then. :) All the more reason for them to > panic early and often so developers will be prompted to remove them. > This is hard to explain to a customer. customer: "So we ran your debug image and got you a panic, here is the information. So can you tell us what is the problem?" alfred: "well that is due to XXX other thing that is broken, thanks for helping us resolve that unrelated problem!" customer: "i hate you" alfred: "get in line." -Alfred From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 21:47:38 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A80EB1DA; Mon, 17 Dec 2012 21:47:38 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 61C8F8FC17; Mon, 17 Dec 2012 21:47:36 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA29540; Mon, 17 Dec 2012 23:47:30 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1TkiX4-0005o1-E3; Mon, 17 Dec 2012 23:47:30 +0200 Message-ID: <50CF92F0.5020904@FreeBSD.org> Date: Mon, 17 Dec 2012 23:47:28 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Alfred Perlstein Subject: Re: svn commit: r244112 - head/sys/kern References: <201212110708.qBB78EWx025288@svn.freebsd.org> <50CBC285.7060307@mu.org> <20121215161414.V1029@besplex.bde.org> <201212171439.27297.jhb@freebsd.org> <50CF8CE7.4020906@mu.org> In-Reply-To: <50CF8CE7.4020906@mu.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Mon, 17 Dec 2012 22:10:34 +0000 Cc: Adrian Chadd , src-committers@FreeBSD.org, John Baldwin , svn-src-all@FreeBSD.org, Alfred Perlstein , Gleb Smirnoff , Robert Watson , Navdeep Parhar , Bruce Evans , svn-src-head@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 21:47:38 -0000 on 17/12/2012 23:21 Alfred Perlstein said the following: > This is hard to explain to a customer. > > customer: "So we ran your debug image and got you a panic, here is the > information. So can you tell us what is the problem?" > alfred: "well that is due to XXX other thing that is broken, thanks for helping > us resolve that unrelated problem!" > customer: "i hate you" > alfred: "get in line." But you see, the following is still illogical _to me_. If one believes that all KASSERTs are bogus then one should compile them out and just forget about them. If one believes that at least some KASSERTs are such that the execution should not continue after them, then one should enable all of them and panic on all of them (better safe than sorry). If one is not satisfied with the above choices, then one should meticulously go over all (or at least some) of KASSERTs and make a decision which KASSERTs are bogus, which are true and which should be turned into something else (error checking, warnings, etc). The proposed solution simultaneously enables all KASSERTs, as if all of them were true, and doesn't panic on any KASSERT, as if neither of them is fatal (i.e. they all are bogus to one degree and another). P.S. I am not talking about the status quo because the status quo would be maintained even without the changes in question. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 22:12:47 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BAF26F4F; Mon, 17 Dec 2012 22:12:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 759CD8FC12; Mon, 17 Dec 2012 22:12:45 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id AAA29959; Tue, 18 Dec 2012 00:12:44 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1TkivU-0005rI-Fi; Tue, 18 Dec 2012 00:12:44 +0200 Message-ID: <50CF98DB.1050102@FreeBSD.org> Date: Tue, 18 Dec 2012 00:12:43 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r244112 - head/sys/kern References: <201212110708.qBB78EWx025288@svn.freebsd.org> <50CBC285.7060307@mu.org> <20121215161414.V1029@besplex.bde.org> <201212171439.27297.jhb@freebsd.org> <50CF8CE7.4020906@mu.org> <50CF92F0.5020904@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 22:12:47 -0000 on 18/12/2012 00:02 Adrian Chadd said the following: > Why are they there, if we just ship production releases with > INVARIANTS disabled? Because there is an axis orthogonal to asserting correctness - performance. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 22:02:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 66AF997B; Mon, 17 Dec 2012 22:02:56 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com [74.125.82.52]) by mx1.freebsd.org (Postfix) with ESMTP id AC3168FC0C; Mon, 17 Dec 2012 22:02:54 +0000 (UTC) Received: by mail-wg0-f52.google.com with SMTP id 12so2839872wgh.31 for ; Mon, 17 Dec 2012 14:02:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=CUuTEzCDxqxxYZ3DWcty/om5SxC8tywmUvEbsLYeVP0=; b=bRtnGYxriAL35qu4Ae2v3MHMtVtmuxycT6I1XurnvHJfKTMgferzJYXJPqhL+eaKvo GwrYPbwhL7Ev+tLYuhNZccHEcNWHZ47MA//QS3pdoLzV/KJch4bQQbZUIA0Ek4YBzLG/ AMY1/6Mu/Ujkxm90XzvKc8fVJcrF6IhKJ1y6pWw6N3DYmaXT5eTSqzH2mDXjy93jGwMf xS2h10su3lHVknjQmOS1sluDwgzs8Hfllr0kA4/+EG6+Ma45jZqjM+HO80U24jOSMN2s ogdT59z++PoDnWX5Zt8thkAbSBbJlAs1L5GUWHGNP/u9A+2yG6Se/Drs49W30hwjW7su SfrQ== MIME-Version: 1.0 Received: by 10.194.83.36 with SMTP id n4mr9426726wjy.59.1355781773725; Mon, 17 Dec 2012 14:02:53 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.217.57.9 with HTTP; Mon, 17 Dec 2012 14:02:53 -0800 (PST) In-Reply-To: <50CF92F0.5020904@FreeBSD.org> References: <201212110708.qBB78EWx025288@svn.freebsd.org> <50CBC285.7060307@mu.org> <20121215161414.V1029@besplex.bde.org> <201212171439.27297.jhb@freebsd.org> <50CF8CE7.4020906@mu.org> <50CF92F0.5020904@FreeBSD.org> Date: Mon, 17 Dec 2012 14:02:53 -0800 X-Google-Sender-Auth: w1ax1vdRzgz6CrFxL3v1BbRbmp0 Message-ID: Subject: Re: svn commit: r244112 - head/sys/kern From: Adrian Chadd To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 X-Mailman-Approved-At: Mon, 17 Dec 2012 22:19:28 +0000 Cc: Alfred Perlstein , src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, Alfred Perlstein , Gleb Smirnoff , Robert Watson , Navdeep Parhar , Bruce Evans , svn-src-head@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 22:02:56 -0000 On 17 December 2012 13:47, Andriy Gapon wrote: > But you see, the following is still illogical _to me_. And this is the core of the problem. A lot of developers are interpreting the KASSERT() conditions as an invariant condition that, if in any way enabled, should be completely trusted, believed and cause an immediate panic(). However, we leave them out on shipping, production kernels. Why's that? Because the contract here is "the code should never hit these situations, so we don't bother checking." It's totally understandable at this point why there's such a huge amount of confusion here. On one hand we have a construct that allows the developer to enforce correct behaviour and panic early if it gets caught out; on the other hand we totally ignore all of that in shipping, production kernels. Why are they there, if we just ship production releases with INVARIANTS disabled? > If one believes that all KASSERTs are bogus then one should compile them out and > just forget about them. There's a lot of perfectly good reasons for leaving KASSERT()s there in the source. The main reason: because they enforce what the correct behaviour SHOULD be. Even if the code doesn't fail the invariant check, it may do so in the future. Why? * because we're not perfect, not at all. The existing code may be subtly buggy. * it protects those bits of code from changes in other areas of code that can cause flow-on effects that trigger these kinds of invariant checks. > If one believes that at least some KASSERTs are such that the execution should > not continue after them, then one should enable all of them and panic on all of > them (better safe than sorry). Yes, but we really should turn as many of those panic conditions into "handle the invariant failure gracefully", since it may be recoverable. Again, right now GENERIC wouldn't panic if those conditions are met, as right now we don't compile them in. > If one is not satisfied with the above choices, then one should meticulously go > over all (or at least some) of KASSERTs and make a decision which KASSERTs are > bogus, which are true and which should be turned into something else (error > checking, warnings, etc). Again, look above. Those assertions mean more than "make sure the code works right at the present moment." However, I'm in the field of "defensive programming" - a lot of those invariants likely could be dealt with inside the function itself. Eg, something like this: KASSERT(n >= 0 || n < max, ("n out of bounds")); if (n < 0 || n >= max) return -EINVAL; .. that kind of thing should be the norm. In any case, _that_ is a separate discussion to all of this. > The proposed solution simultaneously enables all KASSERTs, as if all of them > were true, and doesn't panic on any KASSERT, as if neither of them is fatal > (i.e. they all are bogus to one degree and another). .. GENERIC doesn't panic on the KASSERTs, because they're not even compiled in. Thus, the kernel doesn't panic (much) more or less than before. See below. > P.S. I am not talking about the status quo because the status quo would be > maintained even without the changes in question. The status quo in _behaviour_ is: * shipping kernels don't panic on an invariant check, because we don't even compile them in; * doing the invariant checks shouldn't affect future execution paths (except for whatever changes occur because we're printing them out); * if it crashed in GENERIC because it wasn't caught by a (not compiled in) invariant check, it will very likely still crash with alfreds work - we'll just get told about it beforehand. * if it wouldn't crash in GENERIC after it wasn't caught by a (not compiled in) invariant check, we'll still get a printout of the assertion failure, then execution will continue. The _behaviour_ doesn't change, outside of some extra console IO and some potential for race conditions to occur "differently." Adrian From owner-svn-src-all@FreeBSD.ORG Mon Dec 17 22:23:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ED8FB923; Mon, 17 Dec 2012 22:23:56 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7F1BC8FC0C; Mon, 17 Dec 2012 22:23:56 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi5so49836pad.13 for ; Mon, 17 Dec 2012 14:23:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=R2TkEe3bg1QWkIvIPEgmsK0vExMAa5SyjYoC6UxxSyQ=; b=r3bAcUFUnlzrHpnaSa+YrmLPkiQt0Yq+TJ+7MCBqaYUksKV4YqS+IBEHOLhsOnFp76 x8aZJe2HL5XNQFAm4266py6cVQZrMDd+AGNtsGCJl14LPlVrF5Ep1kD0SE8tPk2AiBN6 lP8L9xcN4eaa7Jj8qlkvlhW/xIHSGHkK5q6lQJ8MUAeVrRnFYqLUunbCzYfRTEuRliJ0 y/Fd/aLnaJzDlpeH//y0mtE4ATLBxscJeKLnOvOkUKzm+RQIgHucG//yYN1AsR+GlKgL tLYLLYGR+YIGTPQI8j1jkZdbj+80AqM4HaAw+bgjtGuZn47ISf2sz9M/HrNcqzZhFGIz yyZA== Received: by 10.68.137.167 with SMTP id qj7mr47031702pbb.148.1355783035719; Mon, 17 Dec 2012 14:23:55 -0800 (PST) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPS id d2sm120337paw.19.2012.12.17.14.23.53 (version=SSLv3 cipher=OTHER); Mon, 17 Dec 2012 14:23:54 -0800 (PST) Sender: Navdeep Parhar Message-ID: <50CF9B77.6090006@FreeBSD.org> Date: Mon, 17 Dec 2012 14:23:51 -0800 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r244112 - head/sys/kern References: <201212110708.qBB78EWx025288@svn.freebsd.org> <50CBC285.7060307@mu.org> <20121215161414.V1029@besplex.bde.org> <201212171439.27297.jhb@freebsd.org> <50CF8CE7.4020906@mu.org> <50CF92F0.5020904@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Mon, 17 Dec 2012 22:34:38 +0000 Cc: Alfred Perlstein , src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, Alfred Perlstein , Andriy Gapon , Gleb Smirnoff , Robert Watson , Bruce Evans , svn-src-head@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 22:23:57 -0000 On 12/17/12 14:02, Adrian Chadd wrote: > On 17 December 2012 13:47, Andriy Gapon wrote: > >> But you see, the following is still illogical _to me_. > > And this is the core of the problem. > > A lot of developers are interpreting the KASSERT() conditions as an > invariant condition that, if in any way enabled, should be completely > trusted, believed and cause an immediate panic(). > > However, we leave them out on shipping, production kernels. Why's > that? Because the contract here is "the code should never hit these > situations, so we don't bother checking." > > It's totally understandable at this point why there's such a huge > amount of confusion here. On one hand we have a construct that allows > the developer to enforce correct behaviour and panic early if it gets > caught out; on the other hand we totally ignore all of that in > shipping, production kernels. > > Why are they there, if we just ship production releases with > INVARIANTS disabled? Read the section titled "NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:" in /usr/src/UPDATING if you're wondering why. Regards, Navdeep From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 00:00:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1EB0C2F3; Tue, 18 Dec 2012 00:00:08 +0000 (UTC) (envelope-from jimharris@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 DD5CE8FC1F; Tue, 18 Dec 2012 00:00:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI007uc004338; Tue, 18 Dec 2012 00:00:07 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI007IR004337; Tue, 18 Dec 2012 00:00:07 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201212180000.qBI007IR004337@svn.freebsd.org> From: Jim Harris Date: Tue, 18 Dec 2012 00:00:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244369 - head/sys/dev/arcmsr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 00:00:08 -0000 Author: jimharris Date: Tue Dec 18 00:00:07 2012 New Revision: 244369 URL: http://svnweb.freebsd.org/changeset/base/244369 Log: Use CAM_DEV_NOT_THERE instead of CAM_SEL_TIMEOUT to report nonexistent LUNs for the virtual processor device. This removes lots of CAM warnings, and follows similar recent changes to tws(4) and twa(4) drivers. Also fix case where CAM_REQ_CMP was getting OR'd with CAM_DEV_NOT_THERE in the nonexistent LUN case, resulting in different CAM status (CAM_UA_TERMIO) getting reported to CAM. This issue existing previously, but was more subtle because it changed CAM_SEL_TIMEOUT to CAM_CMD_TIMEOUT. Sponsored by: Intel Reported and tested by: Willem Jan Withagen MFC after: 1 week Modified: head/sys/dev/arcmsr/arcmsr.c Modified: head/sys/dev/arcmsr/arcmsr.c ============================================================================== --- head/sys/dev/arcmsr/arcmsr.c Mon Dec 17 22:06:10 2012 (r244368) +++ head/sys/dev/arcmsr/arcmsr.c Tue Dec 18 00:00:07 2012 (r244369) @@ -2432,14 +2432,13 @@ static void arcmsr_bus_reset(struct Adap static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb, union ccb * pccb) { - pccb->ccb_h.status |= CAM_REQ_CMP; switch (pccb->csio.cdb_io.cdb_bytes[0]) { case INQUIRY: { unsigned char inqdata[36]; char *buffer=pccb->csio.data_ptr; if (pccb->ccb_h.target_lun) { - pccb->ccb_h.status |= CAM_SEL_TIMEOUT; + pccb->ccb_h.status |= CAM_DEV_NOT_THERE; xpt_done(pccb); return; } @@ -2455,6 +2454,7 @@ static void arcmsr_handle_virtual_comman strncpy(&inqdata[16], "RAID controller ", 16); /* Product Identification */ strncpy(&inqdata[32], "R001", 4); /* Product Revision */ memcpy(buffer, inqdata, sizeof(inqdata)); + pccb->ccb_h.status |= CAM_REQ_CMP; xpt_done(pccb); } break; @@ -2464,10 +2464,12 @@ static void arcmsr_handle_virtual_comman pccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR; pccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; } + pccb->ccb_h.status |= CAM_REQ_CMP; xpt_done(pccb); } break; default: + pccb->ccb_h.status |= CAM_REQ_CMP; xpt_done(pccb); } } From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 00:25:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9D085CE5; Tue, 18 Dec 2012 00:25:51 +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 7FF5F8FC1A; Tue, 18 Dec 2012 00:25:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI0Ppm2009921; Tue, 18 Dec 2012 00:25:51 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI0Pm9Z009904; Tue, 18 Dec 2012 00:25:48 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201212180025.qBI0Pm9Z009904@svn.freebsd.org> From: Rick Macklem Date: Tue, 18 Dec 2012 00:25:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244370 - head/sys/kgssapi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 00:25:51 -0000 Author: rmacklem Date: Tue Dec 18 00:25:48 2012 New Revision: 244370 URL: http://svnweb.freebsd.org/changeset/base/244370 Log: Piete.Brooks at cl.cam.ac.uk reported via email a crash which was caused by use of an invalid kgss_gssd_handle during an upcall to the gssd daemon when it has exited. This patch seems to avoid the crashes by holding a reference count on the kgss_gssd_handle until the upcall is done. It also adds a new mutex kgss_gssd_lock used to make manipulation of kgss_gssd_handle SMP safe. Tested by: Illias A. Marinos, Herbert Poeckl Reviewed by: jhb MFC after: 2 weeks Modified: head/sys/kgssapi/gss_accept_sec_context.c head/sys/kgssapi/gss_acquire_cred.c head/sys/kgssapi/gss_canonicalize_name.c head/sys/kgssapi/gss_delete_sec_context.c head/sys/kgssapi/gss_display_status.c head/sys/kgssapi/gss_export_name.c head/sys/kgssapi/gss_impl.c head/sys/kgssapi/gss_import_name.c head/sys/kgssapi/gss_init_sec_context.c head/sys/kgssapi/gss_pname_to_uid.c head/sys/kgssapi/gss_release_cred.c head/sys/kgssapi/gss_release_name.c head/sys/kgssapi/gss_set_cred_option.c head/sys/kgssapi/gssapi_impl.h Modified: head/sys/kgssapi/gss_accept_sec_context.c ============================================================================== --- head/sys/kgssapi/gss_accept_sec_context.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_accept_sec_context.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -58,9 +60,13 @@ OM_uint32 gss_accept_sec_context(OM_uint gss_ctx_id_t ctx = *context_handle; gss_name_t name; gss_cred_id_t cred; + CLIENT *cl; - if (!kgss_gssd_handle) + cl = kgss_gssd_client(); + if (cl == NULL) { + *minor_status = 0; return (GSS_S_FAILURE); + } if (ctx) args.ctx = ctx->handle; @@ -74,7 +80,8 @@ OM_uint32 gss_accept_sec_context(OM_uint args.input_chan_bindings = input_chan_bindings; bzero(&res, sizeof(res)); - stat = gssd_accept_sec_context_1(&args, &res, kgss_gssd_handle); + stat = gssd_accept_sec_context_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); Modified: head/sys/kgssapi/gss_acquire_cred.c ============================================================================== --- head/sys/kgssapi/gss_acquire_cred.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_acquire_cred.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -55,8 +57,11 @@ gss_acquire_cred(OM_uint32 *minor_status enum clnt_stat stat; gss_cred_id_t cred; int i; + CLIENT *cl; - if (!kgss_gssd_handle) + *minor_status = 0; + cl = kgss_gssd_client(); + if (cl == NULL) return (GSS_S_FAILURE); args.uid = curthread->td_ucred->cr_uid; @@ -69,7 +74,8 @@ gss_acquire_cred(OM_uint32 *minor_status args.cred_usage = cred_usage; bzero(&res, sizeof(res)); - stat = gssd_acquire_cred_1(&args, &res, kgss_gssd_handle); + stat = gssd_acquire_cred_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); @@ -80,7 +86,6 @@ gss_acquire_cred(OM_uint32 *minor_status return (res.major_status); } - *minor_status = 0; cred = malloc(sizeof(struct _gss_cred_id_t), M_GSSAPI, M_WAITOK); cred->handle = res.output_cred; *output_cred_handle = cred; Modified: head/sys/kgssapi/gss_canonicalize_name.c ============================================================================== --- head/sys/kgssapi/gss_canonicalize_name.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_canonicalize_name.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -48,15 +50,19 @@ gss_canonicalize_name(OM_uint32 *minor_s struct canonicalize_name_args args; enum clnt_stat stat; gss_name_t name; + CLIENT *cl; - if (!kgss_gssd_handle) + *minor_status = 0; + cl = kgss_gssd_client(); + if (cl == NULL) return (GSS_S_FAILURE); args.input_name = input_name->handle; args.mech_type = mech_type; bzero(&res, sizeof(res)); - stat = gssd_canonicalize_name_1(&args, &res, kgss_gssd_handle); + stat = gssd_canonicalize_name_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); @@ -69,7 +75,6 @@ gss_canonicalize_name(OM_uint32 *minor_s name = malloc(sizeof(struct _gss_name_t), M_GSSAPI, M_WAITOK); name->handle = res.output_name; - *minor_status = 0; *output_name = name; return (GSS_S_COMPLETE); Modified: head/sys/kgssapi/gss_delete_sec_context.c ============================================================================== --- head/sys/kgssapi/gss_delete_sec_context.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_delete_sec_context.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -46,6 +48,9 @@ gss_delete_sec_context(OM_uint32 *minor_ struct delete_sec_context_args args; enum clnt_stat stat; gss_ctx_id_t ctx; + CLIENT *cl; + + *minor_status = 0; if (!kgss_gssd_handle) return (GSS_S_FAILURE); @@ -60,9 +65,13 @@ gss_delete_sec_context(OM_uint32 *minor_ */ if (ctx->handle) { args.ctx = ctx->handle; + cl = kgss_gssd_client(); + if (cl == NULL) + return (GSS_S_FAILURE); bzero(&res, sizeof(res)); - stat = gssd_delete_sec_context_1(&args, &res, kgss_gssd_handle); + stat = gssd_delete_sec_context_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); @@ -85,7 +94,5 @@ gss_delete_sec_context(OM_uint32 *minor_ } } - *minor_status = 0; - return (GSS_S_COMPLETE); } Modified: head/sys/kgssapi/gss_display_status.c ============================================================================== --- head/sys/kgssapi/gss_display_status.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_display_status.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -49,8 +51,11 @@ gss_display_status(OM_uint32 *minor_stat struct display_status_res res; struct display_status_args args; enum clnt_stat stat; + CLIENT *cl; - if (!kgss_gssd_handle) + *minor_status = 0; + cl = kgss_gssd_client(); + if (cl == NULL) return (GSS_S_FAILURE); args.status_value = status_value; @@ -59,7 +64,8 @@ gss_display_status(OM_uint32 *minor_stat args.message_context = *message_context; bzero(&res, sizeof(res)); - stat = gssd_display_status_1(&args, &res, kgss_gssd_handle); + stat = gssd_display_status_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); @@ -70,7 +76,6 @@ gss_display_status(OM_uint32 *minor_stat return (res.major_status); } - *minor_status = 0; *message_context = res.message_context; kgss_copy_buffer(&res.status_string, status_string); xdr_free((xdrproc_t) xdr_display_status_res, &res); Modified: head/sys/kgssapi/gss_export_name.c ============================================================================== --- head/sys/kgssapi/gss_export_name.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_export_name.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -45,14 +47,18 @@ gss_export_name(OM_uint32 *minor_status, struct export_name_res res; struct export_name_args args; enum clnt_stat stat; + CLIENT *cl; - if (!kgss_gssd_handle) + *minor_status = 0; + cl = kgss_gssd_client(); + if (cl == NULL) return (GSS_S_FAILURE); args.input_name = input_name->handle; bzero(&res, sizeof(res)); - stat = gssd_export_name_1(&args, &res, kgss_gssd_handle); + stat = gssd_export_name_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); @@ -63,7 +69,6 @@ gss_export_name(OM_uint32 *minor_status, return (res.major_status); } - *minor_status = 0; kgss_copy_buffer(&res.exported_name, exported_name); xdr_free((xdrproc_t) xdr_export_name_res, &res); Modified: head/sys/kgssapi/gss_impl.c ============================================================================== --- head/sys/kgssapi/gss_impl.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_impl.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,8 +31,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -59,6 +61,7 @@ static bool_t gssd_syscall_registered = struct kgss_mech_list kgss_mechs; CLIENT *kgss_gssd_handle; +struct mtx kgss_gssd_lock; static void kgss_init(void *dummy) @@ -92,14 +95,12 @@ sys_gssd_syscall(struct thread *td, stru struct netconfig *nconf; char path[MAXPATHLEN]; int error; + CLIENT *cl, *oldcl; error = priv_check(td, PRIV_NFS_DAEMON); if (error) return (error); - if (kgss_gssd_handle) - CLNT_DESTROY(kgss_gssd_handle); - error = copyinstr(uap->path, path, sizeof(path), NULL); if (error) return (error); @@ -109,10 +110,20 @@ sys_gssd_syscall(struct thread *td, stru sun.sun_len = SUN_LEN(&sun); nconf = getnetconfigent("local"); - kgss_gssd_handle = clnt_reconnect_create(nconf, + cl = clnt_reconnect_create(nconf, (struct sockaddr *) &sun, GSSD, GSSDVERS, RPC_MAXDATASIZE, RPC_MAXDATASIZE); + mtx_lock(&kgss_gssd_lock); + oldcl = kgss_gssd_handle; + kgss_gssd_handle = cl; + mtx_unlock(&kgss_gssd_lock); + + if (oldcl != NULL) { + CLNT_CLOSE(oldcl); + CLNT_RELEASE(oldcl); + } + return (0); } @@ -249,6 +260,23 @@ kgss_copy_buffer(const gss_buffer_t from } /* + * Acquire the kgss_gssd_handle and return it with a reference count, + * if it is available. + */ +CLIENT * +kgss_gssd_client(void) +{ + CLIENT *cl; + + mtx_lock(&kgss_gssd_lock); + cl = kgss_gssd_handle; + if (cl != NULL) + CLNT_ACQUIRE(cl); + mtx_unlock(&kgss_gssd_lock); + return (cl); +} + +/* * Kernel module glue */ static int @@ -280,6 +308,7 @@ kgssapi_modevent(module_t mod, int type, rpc_gss_get_principal_name; rpc_gss_entries.rpc_gss_svc_max_data_length = rpc_gss_svc_max_data_length; + mtx_init(&kgss_gssd_lock, "kgss_gssd_lock", NULL, MTX_DEF); break; case MOD_UNLOAD: /* Modified: head/sys/kgssapi/gss_import_name.c ============================================================================== --- head/sys/kgssapi/gss_import_name.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_import_name.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -48,18 +50,21 @@ gss_import_name(OM_uint32 *minor_status, struct import_name_args args; enum clnt_stat stat; gss_name_t name; + CLIENT *cl; *minor_status = 0; *output_name = GSS_C_NO_NAME; - if (!kgss_gssd_handle) + cl = kgss_gssd_client(); + if (cl == NULL) return (GSS_S_FAILURE); args.input_name_buffer = *input_name_buffer; args.input_name_type = input_name_type; bzero(&res, sizeof(res)); - stat = gssd_import_name_1(&args, &res, kgss_gssd_handle); + stat = gssd_import_name_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); Modified: head/sys/kgssapi/gss_init_sec_context.c ============================================================================== --- head/sys/kgssapi/gss_init_sec_context.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_init_sec_context.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -60,10 +62,12 @@ gss_init_sec_context(OM_uint32 * minor_s struct init_sec_context_args args; enum clnt_stat stat; gss_ctx_id_t ctx = *context_handle; + CLIENT *cl; *minor_status = 0; - if (!kgss_gssd_handle) + cl = kgss_gssd_client(); + if (cl == NULL) return (GSS_S_FAILURE); args.uid = curthread->td_ucred->cr_uid; @@ -88,7 +92,8 @@ gss_init_sec_context(OM_uint32 * minor_s } bzero(&res, sizeof(res)); - stat = gssd_init_sec_context_1(&args, &res, kgss_gssd_handle); + stat = gssd_init_sec_context_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); Modified: head/sys/kgssapi/gss_pname_to_uid.c ============================================================================== --- head/sys/kgssapi/gss_pname_to_uid.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_pname_to_uid.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -45,20 +47,23 @@ gss_pname_to_uid(OM_uint32 *minor_status struct pname_to_uid_res res; struct pname_to_uid_args args; enum clnt_stat stat; + CLIENT *cl; *minor_status = 0; - if (!kgss_gssd_handle) - return (GSS_S_FAILURE); - if (pname == GSS_C_NO_NAME) return (GSS_S_BAD_NAME); + cl = kgss_gssd_client(); + if (cl == NULL) + return (GSS_S_FAILURE); + args.pname = pname->handle; args.mech = mech; bzero(&res, sizeof(res)); - stat = gssd_pname_to_uid_1(&args, &res, kgss_gssd_handle); + stat = gssd_pname_to_uid_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); @@ -83,20 +88,23 @@ gss_pname_to_unix_cred(OM_uint32 *minor_ struct pname_to_uid_args args; enum clnt_stat stat; int i, n; + CLIENT *cl; *minor_status = 0; - if (!kgss_gssd_handle) - return (GSS_S_FAILURE); - if (pname == GSS_C_NO_NAME) return (GSS_S_BAD_NAME); + cl = kgss_gssd_client(); + if (cl == NULL) + return (GSS_S_FAILURE); + args.pname = pname->handle; args.mech = mech; bzero(&res, sizeof(res)); - stat = gssd_pname_to_uid_1(&args, &res, kgss_gssd_handle); + stat = gssd_pname_to_uid_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); Modified: head/sys/kgssapi/gss_release_cred.c ============================================================================== --- head/sys/kgssapi/gss_release_cred.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_release_cred.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -44,13 +46,21 @@ gss_release_cred(OM_uint32 *minor_status struct release_cred_res res; struct release_cred_args args; enum clnt_stat stat; + CLIENT *cl; + + *minor_status = 0; if (!kgss_gssd_handle) return (GSS_S_FAILURE); if (*cred_handle) { args.cred = (*cred_handle)->handle; - stat = gssd_release_cred_1(&args, &res, kgss_gssd_handle); + + cl = kgss_gssd_client(); + if (cl == NULL) + return (GSS_S_FAILURE); + stat = gssd_release_cred_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); @@ -63,7 +73,5 @@ gss_release_cred(OM_uint32 *minor_status return (res.major_status); } - *minor_status = 0; - return (GSS_S_COMPLETE); } Modified: head/sys/kgssapi/gss_release_name.c ============================================================================== --- head/sys/kgssapi/gss_release_name.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_release_name.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -45,6 +47,9 @@ gss_release_name(OM_uint32 *minor_status struct release_name_args args; enum clnt_stat stat; gss_name_t name; + CLIENT *cl; + + *minor_status = 0; if (!kgss_gssd_handle) return (GSS_S_FAILURE); @@ -53,7 +58,11 @@ gss_release_name(OM_uint32 *minor_status name = *input_name; args.input_name = name->handle; - stat = gssd_release_name_1(&args, &res, kgss_gssd_handle); + cl = kgss_gssd_client(); + if (cl == NULL) + return (GSS_S_FAILURE); + stat = gssd_release_name_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; return (GSS_S_FAILURE); @@ -68,7 +77,5 @@ gss_release_name(OM_uint32 *minor_status } } - *minor_status = 0; - return (GSS_S_COMPLETE); } Modified: head/sys/kgssapi/gss_set_cred_option.c ============================================================================== --- head/sys/kgssapi/gss_set_cred_option.c Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gss_set_cred_option.c Tue Dec 18 00:25:48 2012 (r244370) @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -47,10 +49,12 @@ gss_set_cred_option(OM_uint32 *minor_sta struct set_cred_option_res res; struct set_cred_option_args args; enum clnt_stat stat; + CLIENT *cl; *minor_status = 0; - if (!kgss_gssd_handle) + cl = kgss_gssd_client(); + if (cl == NULL) return (GSS_S_FAILURE); if (cred) @@ -61,7 +65,8 @@ gss_set_cred_option(OM_uint32 *minor_sta args.option_value = *option_value; bzero(&res, sizeof(res)); - stat = gssd_set_cred_option_1(&args, &res, kgss_gssd_handle); + stat = gssd_set_cred_option_1(&args, &res, cl); + CLNT_RELEASE(cl); if (stat != RPC_SUCCESS) { *minor_status = stat; Modified: head/sys/kgssapi/gssapi_impl.h ============================================================================== --- head/sys/kgssapi/gssapi_impl.h Tue Dec 18 00:00:07 2012 (r244369) +++ head/sys/kgssapi/gssapi_impl.h Tue Dec 18 00:25:48 2012 (r244370) @@ -53,8 +53,10 @@ struct kgss_mech { LIST_HEAD(kgss_mech_list, kgss_mech); extern CLIENT *kgss_gssd_handle; +extern struct mtx kgss_gssd_lock; extern struct kgss_mech_list kgss_mechs; +CLIENT *kgss_gssd_client(void); int kgss_oid_equal(const gss_OID oid1, const gss_OID oid2); extern void kgss_install_mech(gss_OID mech_type, const char *name, struct kobj_class *cls); From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 01:17:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0BF58A66; Tue, 18 Dec 2012 01:17:08 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-da0-f47.google.com (mail-da0-f47.google.com [209.85.210.47]) by mx1.freebsd.org (Postfix) with ESMTP id B64008FC0A; Tue, 18 Dec 2012 01:17:07 +0000 (UTC) Received: by mail-da0-f47.google.com with SMTP id s35so25807dak.20 for ; Mon, 17 Dec 2012 17:17:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:x-mailer:from:subject:date :to; bh=Y2EZoK+i2cPe8Uz2JWGVJveHvY6qm+dWRWfNjY0aGr0=; b=FlndlyvyjUZ1h0+hpf8kS6xg2HZ2fznE6LBR+hfFMRjAlWdVqVAsjM2IZ176TAiZF2 zkrWX1W1snAMGRQ28JTB0p62n1EQOvbl4rhfqnghxF9Ba4VrdD7hGVnCY73WkK4COkA9 yAHreNsh1YnG+A6oYWxC1iBF4sjxLYVmx/1xyNDKlrvut4fL+PIG/bfz/wz2YsvrOuKJ 4GS8tPnl+bvwFXIde8MGoRRjT2OsLObM07qiuZGztkKEbpCzCn3vOoQ15OR6uZrKOQfN IuZjprUqG55+IOkWUBS4fCftXDL384e/ehaz+rAzH27xzgKW0Q/+/by1c2U0/zkaQ1jx n5EQ== X-Received: by 10.66.73.105 with SMTP id k9mr1478639pav.37.1355793424810; Mon, 17 Dec 2012 17:17:04 -0800 (PST) Received: from [10.197.2.164] (mobile-166-147-095-021.mycingular.net. [166.147.95.21]) by mx.google.com with ESMTPS id sk1sm105399pbc.0.2012.12.17.17.16.55 (version=SSLv3 cipher=OTHER); Mon, 17 Dec 2012 17:17:03 -0800 (PST) References: <201212172055.qBHKtYgX070163@svn.freebsd.org> Mime-Version: 1.0 (1.0) In-Reply-To: <201212172055.qBHKtYgX070163@svn.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <3E7ACF8A-3192-40C1-9F42-C701BF3483CE@gmail.com> X-Mailer: iPhone Mail (10A523) From: Garrett Cooper Subject: Re: svn commit: r244365 - head/sys/netinet Date: Mon, 17 Dec 2012 17:16:51 -0800 To: "Andrey V. Elsukov" Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 01:17:08 -0000 This broke !inet6 kernels. Sent from my iPhone On Dec 17, 2012, at 12:55 PM, "Andrey V. Elsukov" wrote: > Author: ae > Date: Mon Dec 17 20:55:33 2012 > New Revision: 244365 > URL: http://svnweb.freebsd.org/changeset/base/244365 >=20 > Log: > Since we use different flags to detect tcp forwarding, and we share the > same code for IPv4 and IPv6 in tcp_input, we should check both > M_IP_NEXTHOP and M_IP6_NEXTHOP flags. >=20 > MFC after: 3 days >=20 > Modified: > head/sys/netinet/tcp_input.c >=20 > Modified: head/sys/netinet/tcp_input.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/netinet/tcp_input.c Mon Dec 17 20:36:56 2012 (r244364) > +++ head/sys/netinet/tcp_input.c Mon Dec 17 20:55:33 2012 (r244365) > @@ -780,7 +780,8 @@ findpcb: > /* > * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. > */ > - if (m->m_flags & M_IP_NEXTHOP) > + if ((isipv6 && (m->m_flags & M_IP6_NEXTHOP)) || > + (!isipv6 && (m->m_flags & M_IP_NEXTHOP))) > fwd_tag =3D m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); >=20 > #ifdef INET6 > _______________________________________________ > 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-all@FreeBSD.ORG Tue Dec 18 04:18:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4A91D16D; Tue, 18 Dec 2012 04:18:43 +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 142DB8FC0C; Tue, 18 Dec 2012 04:18:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI4IgL4051844; Tue, 18 Dec 2012 04:18:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI4Ig2j051841; Tue, 18 Dec 2012 04:18:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201212180418.qBI4Ig2j051841@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 18 Dec 2012 04:18:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244373 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 04:18:43 -0000 Author: kib Date: Tue Dec 18 04:18:42 2012 New Revision: 244373 URL: http://svnweb.freebsd.org/changeset/base/244373 Log: MFC r243869: Fix a race between kern_setitimer() and realitexpire(), by using the process mutex to interlock the callout start. Modified: stable/9/sys/kern/init_main.c stable/9/sys/kern/kern_fork.c stable/9/sys/kern/kern_time.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/init_main.c ============================================================================== --- stable/9/sys/kern/init_main.c Tue Dec 18 01:23:37 2012 (r244372) +++ stable/9/sys/kern/init_main.c Tue Dec 18 04:18:42 2012 (r244373) @@ -497,7 +497,7 @@ proc0_init(void *dummy __unused) strncpy(p->p_comm, "kernel", sizeof (p->p_comm)); strncpy(td->td_name, "swapper", sizeof (td->td_name)); - callout_init(&p->p_itcallout, CALLOUT_MPSAFE); + callout_init_mtx(&p->p_itcallout, &p->p_mtx, 0); callout_init_mtx(&p->p_limco, &p->p_mtx, 0); callout_init(&td->td_slpcallout, CALLOUT_MPSAFE); Modified: stable/9/sys/kern/kern_fork.c ============================================================================== --- stable/9/sys/kern/kern_fork.c Tue Dec 18 01:23:37 2012 (r244372) +++ stable/9/sys/kern/kern_fork.c Tue Dec 18 04:18:42 2012 (r244373) @@ -592,7 +592,7 @@ do_fork(struct thread *td, int flags, st LIST_INIT(&p2->p_children); LIST_INIT(&p2->p_orphans); - callout_init(&p2->p_itcallout, CALLOUT_MPSAFE); + callout_init_mtx(&p2->p_itcallout, &p2->p_mtx, 0); /* * If PF_FORK is set, the child process inherits the Modified: stable/9/sys/kern/kern_time.c ============================================================================== --- stable/9/sys/kern/kern_time.c Tue Dec 18 01:23:37 2012 (r244372) +++ stable/9/sys/kern/kern_time.c Tue Dec 18 04:18:42 2012 (r244373) @@ -659,13 +659,11 @@ realitexpire(void *arg) struct timeval ctv, ntv; p = (struct proc *)arg; - PROC_LOCK(p); kern_psignal(p, SIGALRM); if (!timevalisset(&p->p_realtimer.it_interval)) { timevalclear(&p->p_realtimer.it_value); if (p->p_flag & P_WEXIT) wakeup(&p->p_itcallout); - PROC_UNLOCK(p); return; } for (;;) { @@ -677,7 +675,6 @@ realitexpire(void *arg) timevalsub(&ntv, &ctv); callout_reset(&p->p_itcallout, tvtohz(&ntv) - 1, realitexpire, p); - PROC_UNLOCK(p); return; } } From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 04:23:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0B29F383; Tue, 18 Dec 2012 04:23:45 +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 E1C7E8FC0A; Tue, 18 Dec 2012 04:23:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI4Ni7W052676; Tue, 18 Dec 2012 04:23:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI4Niiu052675; Tue, 18 Dec 2012 04:23:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201212180423.qBI4Niiu052675@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 18 Dec 2012 04:23:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244374 - stable/9/sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 04:23:45 -0000 Author: kib Date: Tue Dec 18 04:23:44 2012 New Revision: 244374 URL: http://svnweb.freebsd.org/changeset/base/244374 Log: MFC r244238: Line up the continuation backslashes. Modified: stable/9/sys/sys/mount.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sys/mount.h ============================================================================== --- stable/9/sys/sys/mount.h Tue Dec 18 04:18:42 2012 (r244373) +++ stable/9/sys/sys/mount.h Tue Dec 18 04:23:44 2012 (r244374) @@ -198,8 +198,8 @@ struct vnode *__mnt_vnode_next_all(struc struct vnode *__mnt_vnode_first_all(struct vnode **mvp, struct mount *mp); void __mnt_vnode_markerfree_all(struct vnode **mvp, struct mount *mp); -#define MNT_VNODE_FOREACH_ALL(vp, mp, mvp) \ - for (vp = __mnt_vnode_first_all(&(mvp), (mp)); \ +#define MNT_VNODE_FOREACH_ALL(vp, mp, mvp) \ + for (vp = __mnt_vnode_first_all(&(mvp), (mp)); \ (vp) != NULL; vp = __mnt_vnode_next_all(&(mvp), (mp))) #define MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp) \ From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 04:27:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EDE78653; Tue, 18 Dec 2012 04:27:33 +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 D12E18FC0C; Tue, 18 Dec 2012 04:27:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI4RXSh053272; Tue, 18 Dec 2012 04:27:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI4RXpj053271; Tue, 18 Dec 2012 04:27:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201212180427.qBI4RXpj053271@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 18 Dec 2012 04:27:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244375 - stable/9/sys/ufs/ufs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 04:27:34 -0000 Author: kib Date: Tue Dec 18 04:27:33 2012 New Revision: 244375 URL: http://svnweb.freebsd.org/changeset/base/244375 Log: MFC r244239: Fix a typo, resulting in the NULL pointer dereference. Modified: stable/9/sys/ufs/ufs/ufs_quota.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/9/sys/ufs/ufs/ufs_quota.c Tue Dec 18 04:23:44 2012 (r244374) +++ stable/9/sys/ufs/ufs/ufs_quota.c Tue Dec 18 04:27:33 2012 (r244375) @@ -1052,7 +1052,7 @@ again: error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td); if (error) { if (error == ENOENT) { - MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp); + MNT_VNODE_FOREACH_ACTIVE_ABORT(mp, mvp); goto again; } continue; From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 04:38:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A1FDC894; Tue, 18 Dec 2012 04:38: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 84BFA8FC16; Tue, 18 Dec 2012 04:38:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI4cZtM054965; Tue, 18 Dec 2012 04:38:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI4cZwJ054963; Tue, 18 Dec 2012 04:38:35 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201212180438.qBI4cZwJ054963@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 18 Dec 2012 04:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244376 - in stable/9/sys: kern sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 04:38:35 -0000 Author: kib Date: Tue Dec 18 04:38:34 2012 New Revision: 244376 URL: http://svnweb.freebsd.org/changeset/base/244376 Log: MFC r243835: The vnode_free_list_mtx is required unconditionally when iterating over the active list. MFC r244095: Do not yield while owning a mutex, by stopping acquiring mount interlock. MFC r244240: Use user priority for the yield, do not spin on UP. Restructure the iteration initializer and the iterator to remove code duplication. Modified: stable/9/sys/kern/vfs_subr.c stable/9/sys/sys/mount.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_subr.c ============================================================================== --- stable/9/sys/kern/vfs_subr.c Tue Dec 18 04:27:33 2012 (r244375) +++ stable/9/sys/kern/vfs_subr.c Tue Dec 18 04:38:34 2012 (r244376) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -4697,20 +4698,54 @@ __mnt_vnode_markerfree_all(struct vnode * These are helper functions for filesystems to traverse their * active vnodes. See MNT_VNODE_FOREACH_ACTIVE() in sys/mount.h */ -struct vnode * -__mnt_vnode_next_active(struct vnode **mvp, struct mount *mp) +static void +mnt_vnode_markerfree_active(struct vnode **mvp, struct mount *mp) { - struct vnode *vp, *nvp; - if (should_yield()) - kern_yield(PRI_UNCHANGED); + KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch")); + MNT_ILOCK(mp); + MNT_REL(mp); + MNT_IUNLOCK(mp); + free(*mvp, M_VNODE_MARKER); + *mvp = NULL; +} + +#ifdef SMP +#define ALWAYS_YIELD (mp_ncpus == 1) +#else +#define ALWAYS_YIELD 1 +#endif + +static struct vnode * +mnt_vnode_next_active(struct vnode **mvp, struct mount *mp) +{ + struct vnode *vp, *nvp; + + mtx_assert(&vnode_free_list_mtx, MA_OWNED); KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch")); +restart: vp = TAILQ_NEXT(*mvp, v_actfreelist); + TAILQ_REMOVE(&mp->mnt_activevnodelist, *mvp, v_actfreelist); while (vp != NULL) { - VI_LOCK(vp); - if (vp->v_mount == mp && vp->v_type != VMARKER && - (vp->v_iflag & VI_DOOMED) == 0) + if (vp->v_type == VMARKER) { + vp = TAILQ_NEXT(vp, v_actfreelist); + continue; + } + if (!VI_TRYLOCK(vp)) { + if (ALWAYS_YIELD || should_yield()) { + TAILQ_INSERT_BEFORE(vp, *mvp, v_actfreelist); + mtx_unlock(&vnode_free_list_mtx); + kern_yield(PRI_USER); + mtx_lock(&vnode_free_list_mtx); + goto restart; + } + continue; + } + KASSERT(vp->v_type != VMARKER, ("locked marker %p", vp)); + KASSERT(vp->v_mount == mp || vp->v_mount == NULL, + ("alien vnode on the active list %p %p", vp, mp)); + if (vp->v_mount == mp && (vp->v_iflag & VI_DOOMED) == 0) break; nvp = TAILQ_NEXT(vp, v_actfreelist); VI_UNLOCK(vp); @@ -4719,73 +4754,60 @@ __mnt_vnode_next_active(struct vnode **m /* Check if we are done */ if (vp == NULL) { - __mnt_vnode_markerfree_active(mvp, mp); - /* MNT_IUNLOCK(mp); -- done in above function */ - mtx_assert(MNT_MTX(mp), MA_NOTOWNED); + mtx_unlock(&vnode_free_list_mtx); + mnt_vnode_markerfree_active(mvp, mp); return (NULL); } - mtx_lock(&vnode_free_list_mtx); - TAILQ_REMOVE(&mp->mnt_activevnodelist, *mvp, v_actfreelist); TAILQ_INSERT_AFTER(&mp->mnt_activevnodelist, vp, *mvp, v_actfreelist); mtx_unlock(&vnode_free_list_mtx); - MNT_IUNLOCK(mp); + ASSERT_VI_LOCKED(vp, "active iter"); + KASSERT((vp->v_iflag & VI_ACTIVE) != 0, ("Non-active vp %p", vp)); return (vp); } +#undef ALWAYS_YIELD + +struct vnode * +__mnt_vnode_next_active(struct vnode **mvp, struct mount *mp) +{ + + if (should_yield()) + kern_yield(PRI_UNCHANGED); + mtx_lock(&vnode_free_list_mtx); + return (mnt_vnode_next_active(mvp, mp)); +} struct vnode * __mnt_vnode_first_active(struct vnode **mvp, struct mount *mp) { - struct vnode *vp, *nvp; + struct vnode *vp; *mvp = malloc(sizeof(struct vnode), M_VNODE_MARKER, M_WAITOK | M_ZERO); MNT_ILOCK(mp); MNT_REF(mp); + MNT_IUNLOCK(mp); (*mvp)->v_type = VMARKER; + (*mvp)->v_mount = mp; + mtx_lock(&vnode_free_list_mtx); vp = TAILQ_FIRST(&mp->mnt_activevnodelist); - while (vp != NULL) { - VI_LOCK(vp); - if (vp->v_mount == mp && vp->v_type != VMARKER && - (vp->v_iflag & VI_DOOMED) == 0) - break; - nvp = TAILQ_NEXT(vp, v_actfreelist); - VI_UNLOCK(vp); - vp = nvp; - } - - /* Check if we are done */ if (vp == NULL) { - MNT_REL(mp); - MNT_IUNLOCK(mp); - free(*mvp, M_VNODE_MARKER); - *mvp = NULL; + mtx_unlock(&vnode_free_list_mtx); + mnt_vnode_markerfree_active(mvp, mp); return (NULL); } - (*mvp)->v_mount = mp; - mtx_lock(&vnode_free_list_mtx); - TAILQ_INSERT_AFTER(&mp->mnt_activevnodelist, vp, *mvp, v_actfreelist); - mtx_unlock(&vnode_free_list_mtx); - MNT_IUNLOCK(mp); - return (vp); + TAILQ_INSERT_BEFORE(vp, *mvp, v_actfreelist); + return (mnt_vnode_next_active(mvp, mp)); } void __mnt_vnode_markerfree_active(struct vnode **mvp, struct mount *mp) { - if (*mvp == NULL) { - MNT_IUNLOCK(mp); + if (*mvp == NULL) return; - } - - mtx_assert(MNT_MTX(mp), MA_OWNED); - KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch")); mtx_lock(&vnode_free_list_mtx); TAILQ_REMOVE(&mp->mnt_activevnodelist, *mvp, v_actfreelist); mtx_unlock(&vnode_free_list_mtx); - MNT_REL(mp); - MNT_IUNLOCK(mp); - free(*mvp, M_VNODE_MARKER); - *mvp = NULL; + mnt_vnode_markerfree_active(mvp, mp); } Modified: stable/9/sys/sys/mount.h ============================================================================== --- stable/9/sys/sys/mount.h Tue Dec 18 04:27:33 2012 (r244375) +++ stable/9/sys/sys/mount.h Tue Dec 18 04:38:34 2012 (r244376) @@ -217,17 +217,12 @@ struct vnode *__mnt_vnode_next_active(st struct vnode *__mnt_vnode_first_active(struct vnode **mvp, struct mount *mp); void __mnt_vnode_markerfree_active(struct vnode **mvp, struct mount *); -#define MNT_VNODE_FOREACH_ACTIVE(vp, mp, mvp) \ - for (vp = __mnt_vnode_first_active(&(mvp), (mp)); \ +#define MNT_VNODE_FOREACH_ACTIVE(vp, mp, mvp) \ + for (vp = __mnt_vnode_first_active(&(mvp), (mp)); \ (vp) != NULL; vp = __mnt_vnode_next_active(&(mvp), (mp))) #define MNT_VNODE_FOREACH_ACTIVE_ABORT(mp, mvp) \ - do { \ - MNT_ILOCK(mp); \ - __mnt_vnode_markerfree_active(&(mvp), (mp)); \ - /* MNT_IUNLOCK(mp); -- done in above function */ \ - mtx_assert(MNT_MTX(mp), MA_NOTOWNED); \ - } while (0) + __mnt_vnode_markerfree_active(&(mvp), (mp)) /* * Definitions for MNT_VNODE_FOREACH. From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 04:44:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CAC65AC8; Tue, 18 Dec 2012 04:44:36 +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 AD9008FC0A; Tue, 18 Dec 2012 04:44:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI4ia4G055905; Tue, 18 Dec 2012 04:44:36 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI4iack055904; Tue, 18 Dec 2012 04:44:36 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <201212180444.qBI4iack055904@svn.freebsd.org> From: "Andrey A. Chernov" Date: Tue, 18 Dec 2012 04:44:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244377 - head/gnu/usr.bin/binutils/as X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 04:44:36 -0000 Author: ache Date: Tue Dec 18 04:44:36 2012 New Revision: 244377 URL: http://svnweb.freebsd.org/changeset/base/244377 Log: More correct version of prev. fix. Modified: head/gnu/usr.bin/binutils/as/Makefile Modified: head/gnu/usr.bin/binutils/as/Makefile ============================================================================== --- head/gnu/usr.bin/binutils/as/Makefile Tue Dec 18 04:38:34 2012 (r244376) +++ head/gnu/usr.bin/binutils/as/Makefile Tue Dec 18 04:44:36 2012 (r244377) @@ -8,7 +8,7 @@ .PATH: ${SRCDIR}/gas ${SRCDIR}/gas/config -.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "powerpc64" +.if ${TARGET_ARCH:Marm*} || ${TARGET_ARCH} == "powerpc64" NO_WERROR.clang= .endif From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 05:40:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7D854302; Tue, 18 Dec 2012 05:40:28 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [88.198.91.248]) by mx1.freebsd.org (Postfix) with ESMTP id 220988FC0A; Tue, 18 Dec 2012 05:40:27 +0000 (UTC) Received: from [207.6.254.8] (helo=[192.168.1.67]) by id.bluezbox.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1Tkpuj-000I6C-14; Mon, 17 Dec 2012 21:40:26 -0800 Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: svn commit: r243631 - in head/sys: kern sys From: Oleksandr Tymoshenko In-Reply-To: <50C3AF72.4010902@rice.edu> Date: Mon, 17 Dec 2012 21:40:07 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <330405A1-312A-45A5-BB86-4969478D8BBD@bluezbox.com> References: <201211272119.qARLJxXV061083@svn.freebsd.org> <50C1BC90.90106@freebsd.org> <50C25A27.4060007@bluezbox.com> <50C26331.6030504@freebsd.org> <50C26AE9.4020600@bluezbox.com> <50C3A3D3.9000804@freebsd.org> <50C3AF72.4010902@rice.edu> To: Alan Cox X-Mailer: Apple Mail (2.1499) Sender: gonzo@id.bluezbox.com X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: On 2012-12-08, at 1:21 PM, Alan Cox wrote: > On 12/08/2012 14:32, Andre Oppermann wrote: >>> .. skipped .. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 05:40:28 -0000 On 2012-12-08, at 1:21 PM, Alan Cox wrote: > On 12/08/2012 14:32, Andre Oppermann wrote: >>>=20 .. skipped .. >>=20 >> The trouble seems to come from NSFBUFS which is (512 + maxusers * 16) >> resulting in a kernel map of (512 + 400 * 16) * PAGE_SIZE =3D 27MB. = This >> seem to be pushing it with the smaller ARM kmap layout. >>=20 >> Does it boot and run when you set the tunable kern.ipc.nsfbufs=3D3500? >>=20 >> ARM does have a direct map mode as well which doesn't require the >> allocation >> of sfbufs. I'm not sure which other problems that approach has. >>=20 >=20 >=20 > Only a few (3?) platforms use it. It reduces the size of the user > address space, and translation between physical addresses and direct = map > addresses is not computationally trivial as it is on other > architectures, e.g., amd64, ia64. However, it does try to use large > page mappings. >=20 >=20 >> Hopefully alc@ (added to cc) can answer that and also why the kmap of >> 27MB >> manages to wrench the ARM kernel. >>=20 >=20 >=20 > Arm does not define caps on either the buffer map size (param.h) or = the > kmem map size (vmparam.h). It would probably make sense to copy these > definitions from i386. Adding caps didn't help. I did some digging and found out that although = address range 0xc0000000 .. 0xffffffff is indeed valid for ARM in general actual KVA = space varies for each specific hardware platform. This "real" KVA is defined by = pair and ifI use them instead of in init_param2 function my pandaboard successfully boots. Since former = pair is used for defining=20 kernel_map boundaries I believe it should be used for auto tuning as = well.=20 From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 05:45:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 715D9526; Tue, 18 Dec 2012 05:45:30 +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 0C06D8FC12; Tue, 18 Dec 2012 05:45:29 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qBI5jQGh032414; Tue, 18 Dec 2012 07:45:26 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.3 kib.kiev.ua qBI5jQGh032414 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qBI5jQeO032413; Tue, 18 Dec 2012 07:45:26 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 18 Dec 2012 07:45:26 +0200 From: Konstantin Belousov To: Pawel Jakub Dawidek Subject: Re: svn commit: r244154 - head/bin/ps Message-ID: <20121218054526.GL71906@kib.kiev.ua> References: <201212121545.qBCFj4Hl086444@svn.freebsd.org> <20121212210652.GO3013@kib.kiev.ua> <20121213111240.GB1381@garage.freebsd.pl> <201212141152.15567.jhb@freebsd.org> <20121214214246.GB1411@garage.freebsd.pl> <20121215011300.GN71906@kib.kiev.ua> <20121217131834.GC1363@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NqBeRcvybb6C9jMF" Content-Disposition: inline In-Reply-To: <20121217131834.GC1363@garage.freebsd.pl> 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, Julian Elischer , John Baldwin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 05:45:30 -0000 --NqBeRcvybb6C9jMF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 17, 2012 at 02:18:35PM +0100, Pawel Jakub Dawidek wrote: > On Sat, Dec 15, 2012 at 03:13:00AM +0200, Konstantin Belousov wrote: > > On Fri, Dec 14, 2012 at 10:42:47PM +0100, Pawel Jakub Dawidek wrote: > > > In that case I'd prefer to make existing kern.pid_max sysctl read-only > > > and make it loader tunable. I don't expect there are many users of th= is > > > sysctl... > > >=20 > > No, I described you the purpose of the sysctl. Requiring reboot just for > > running the old binaries is not useful. Please do not break it. >=20 > Kostik. How many users of this sysctl are there? 2? 3? Is it really > worth introducing yet another sysctl to export PID_MAX from the kernel? > I think if someone decides to run 1.x binary there will be some > inconvenience apart from the need to reboot. I always surprised when users of the old ABIs appear, but trust me, there is more than you would like. I do not see why should we break existing feature. The only thing you need to have on both i386 and amd64 right now for a.out execution is a suitable COMPAT_ options included into the kernel config. Everything else is dynamically adjustable, including the binary format support and knobs needed mostly to allow the compatibility environment. The sysctl kern.pid_max is one of them, other is security.bsd.map_at_zero. So I object against breaking this feature. Please add a sysctl you need, if 99999 should be changed for some reasons. --NqBeRcvybb6C9jMF Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJQ0AL1AAoJEJDCuSvBvK1BpRMP/0pX81r4jXr9ZhzDFaNOYa9g piyTU+vz1hb7OzXfU9fdErDg01elmx0ZkFzAyiI3IAQ6omQp2hMMS1168xKEdHvL EncArA+zQvtXqMV+0DV/qzDKRAethIqMFl37/iM0IRm8G+3F2G/cvPJdkXJWJ3ZN ln0lrWGX9z4tXi4BXY7mteUOLdp6fMQFjP8ivo8JhOXNwIRiOx0gDJ0esoocTjF9 UE3203JiVygWxrZT9Rlewf7sMM5DYB7euiEhHYhoR3R2tKO21q+ADUMAcnO4Y/bf qDd+bWRojGkGxrNpsU3NylapHnvcFZ1Oz9SQPY201O3crQsMYr3RL2KRvZrPFhUA EQW5Tcp009xIvsvMY8jqbmsZL/MshCRnObL1S/hXdqlGSMQ9QIoqtkueI2Yad1O6 JolGDd0F/gIVomBLI/kkiZay4Dqxy9fVbGBzbnud+kehFCVV71FeNQBCrTT07vvb wLvD9qDgrhtfLUwFDmt14zGUwCXxyhue/QkfwO4uw7vetBtfYDHbXWGz7h7RCGTb /2MppaS50kGha4dAb2FPEQ0+WdMu2SWOkQhxLVn6e6TsFdCRmw62bSamWqUKDUHq mcw85id/Y2HA6iOCWXdiXKH8ZmUO+UKsPLhgsbOKy4t8BWg3Q6aexMVRAwkirnhk 3jqHpdi/2lQLO31q+rzj =cpQr -----END PGP SIGNATURE----- --NqBeRcvybb6C9jMF-- From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 06:37:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E45AA161; Tue, 18 Dec 2012 06:37:23 +0000 (UTC) (envelope-from kevlo@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 C8A138FC18; Tue, 18 Dec 2012 06:37:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI6bNEp074458; Tue, 18 Dec 2012 06:37:23 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI6bNFA074457; Tue, 18 Dec 2012 06:37:23 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201212180637.qBI6bNFA074457@svn.freebsd.org> From: Kevin Lo Date: Tue, 18 Dec 2012 06:37:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244378 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 06:37:24 -0000 Author: kevlo Date: Tue Dec 18 06:37:23 2012 New Revision: 244378 URL: http://svnweb.freebsd.org/changeset/base/244378 Log: Fix typo in comment. Reviewed by: thompsa Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Tue Dec 18 04:44:36 2012 (r244377) +++ head/sys/net/if_bridge.c Tue Dec 18 06:37:23 2012 (r244378) @@ -532,7 +532,7 @@ DECLARE_MODULE(if_bridge, bridge_mod, SI MODULE_DEPEND(if_bridge, bridgestp, 1, 1, 1); /* - * handler for net.link.bridge.pfil_ipfw + * handler for net.link.bridge.ipfw */ static int sysctl_pfil_ipfw(SYSCTL_HANDLER_ARGS) From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 06:55:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9702954D; Tue, 18 Dec 2012 06:55:14 +0000 (UTC) (envelope-from hrs@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 77EF08FC12; Tue, 18 Dec 2012 06:55:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI6tEGL077352; Tue, 18 Dec 2012 06:55:14 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI6tEsD077348; Tue, 18 Dec 2012 06:55:14 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201212180655.qBI6tEsD077348@svn.freebsd.org> From: Hiroki Sato Date: Tue, 18 Dec 2012 06:55:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244379 - in stable/9/release/doc: en_US.ISO8859-1/errata en_US.ISO8859-1/relnotes en_US.ISO8859-1/share/xml share/xml X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 06:55:14 -0000 Author: hrs Date: Tue Dec 18 06:55:13 2012 New Revision: 244379 URL: http://svnweb.freebsd.org/changeset/base/244379 Log: - Trim old entries. - Update errata items. - Bump &release.*; Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.xml stable/9/release/doc/en_US.ISO8859-1/relnotes/article.xml stable/9/release/doc/en_US.ISO8859-1/share/xml/release.dsl stable/9/release/doc/share/xml/release.dsl stable/9/release/doc/share/xml/release.ent Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/errata/article.xml Tue Dec 18 06:37:23 2012 (r244378) +++ stable/9/release/doc/en_US.ISO8859-1/errata/article.xml Tue Dec 18 06:55:13 2012 (r244379) @@ -1,22 +1,3 @@ - - -%entities; - - -%release; - - -]]> - -]]> - -]]> -]> - + + +%entities; + +%release; +]>
- &os; &release; Errata + &os; +<![ %release.type.current [ + &release.current; +]]> +<![ %release.type.snapshot [ + &release.prev; +]]> +<![ %release.type.release [ + &release.current; +]]> + Errata The &os; Project @@ -132,11 +130,10 @@ - - - - - + + + + Advisory Date @@ -146,194 +143,68 @@ - SA-11:01.mountd - 20 April 2011 - Network ACL mishandling in &man.mountd.8; + SA-12:01.openssl + 3 May 2012 + OpenSSL multiple vulnerabilities - SA-11:02.bind - 28 May 2011 - BIND remote DoS with large RRSIG RRsets and negative - caching + SA-12:02.crypt + 30 May 2012 + Incorrect crypt() hashing - SA-11:04.compress - 28 September 2011 - Errors handling corrupt compress file in - &man.compress.1; and &man.gzip.1; + SA-12:03.bind + 12 June 2012 + Incorrect handling of zero-length RDATA fields in &man.named.8; - SA-11:05.unix - 28 September 2011 - Buffer overflow in handling of UNIX socket - addresses + SA-12:04.sysret + 12 June 2012 + Privilege escalation when returning from kernel - SA-11:06.bind - 23 December 2011 - Remote packet Denial of Service against &man.named.8; - servers + SA-12:05.bind + 6 August 2012 + &man.named.8; DNSSEC validation Denial of Service - SA-11:07.chroot - 23 December 2011 - Code execution via chrooted ftpd + SA-12:06.bind + 22 November 2012 + Multiple Denial of Service vulnerabilities with &man.named.8; - SA-11:08.telnetd - 23 December 2011 - telnetd code execution vulnerability + SA-12:07.hostapd + 22 November 2012 + Insufficient message length validation for EAP-TLS messages - SA-11:09.pam_ssh - 23 December 2011 - pam_ssh improperly grants access when user account has - unencrypted SSH private keys - - - - SA-11:10.pam - 23 December 2011 - pam_start() does not validate - service names + SA-12:08.linux + 22 November 2012 + Linux compatibility layer input validation error - - Open Issues - - - - In some releases prior to &release.current;, upgrading - by using &man.freebsd-update.8; can fail. This issue has - been fixed by a change in Errata Notice EN-12:01. For more - information, see - - - - &os; &release.current; includes - several changes to improve resource management of PCI - devices. Some x86 machines may not boot or may have devices - that no longer attach when using ACPI as a result of these - changes. This can be worked around by setting a - &man.loader.8; tunable - debug.acpi.disabled to - hostres. To do this, enter the following - lines at the loader prompt: - - set debug.acpi.disabled="hostres" -boot - - Or, put the following line into - /boot/loader.conf: - - debug.acpi.disabled="hostres" - - - - A &man.devctl.4; event upon arrival of a &man.ugen.4; - device has been changed. The event now includes - ugen and cdev - variables instead of device-name. This - change can prevent the following &man.devd.8; rule which - worked in a previous releases from working: - - attach 0 { - match "device-name" "ugen[0-9]+.[0-9]+"; - action "/path/to/script /dev/$device-name"; -} - - This should be updated to the following: - - attach 0 { - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "cdev" "ugen[0-9]+.[0-9]+"; - action "/path/to/script /dev/$cdev"; -} - - - - The &os; &release.current; Release Notes should have - mentioned that SSM (Source-Specific Multicast) MLDv2 now - uses ALLOW_NEW_SOURCES and - BLOCK_OLD_SOURCES record types to signal - a join or a leave by default. This conforms RFC 4604, - Using Internet Group Management Protocol Version 3 - (IGMPv3) and Multicast Listener Discovery Protocol Version 2 - (MLDv2) for Source-Specific Multicast. A new - &man.sysctl.8; variable - net.inet6.mld.use_allow which controls - the behavior has been added. The default value is - 1 (use - ALLOW_NEW_SOURCES and - BLOCK_OLD_SOURCES). - - - - &release.current; fails to configure an interface - specified in the &man.rc.conf.5; variable - ipv6_prefix_IF - when the interface does not have a corresponding - ifconfig_IF_ipv6 - variable. This problem will be fixed in the future - releases. To work around this problem on &release.current;, - add an - ifconfig_IF_ipv6 - line for each interface specified in - ipv6_prefix_IF - as the following: - - ipv6_prefix_em0="2001:db8:1:0 2001:db8:2:0" -ifconfig_em0_ipv6="inet6 auto_linklocal" - - - - In &release.current; the &os; USB subsystem supports USB - 3.0 by the &man.xhci.4; driver. However, a bug that could - prevent it from working with a USB 3.0 hub has been found - and fixed after the release date. This means - &release.current; and prior do not work with a USB 3.0 hub. - This problem has been fixed in HEAD and will be merged into - the 9-STABLE branch. - - - - Late-Breaking News -No news. -]]> - -No news. -]]> - -No news. -]]> -
Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Dec 18 06:37:23 2012 (r244378) +++ stable/9/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Dec 18 06:55:13 2012 (r244379) @@ -70,1303 +70,10 @@ - What's New + What's New - This section describes - the most user-visible new or changed features in &os; - since &release.prev;. - - Typical release note items - document recent security advisories issued after - &release.prev;, - new drivers or hardware support, new commands or options, - major bug fixes, or contributed software upgrades. They may also - list changes to major ports/packages or release engineering - practices. Clearly the release notes cannot list every single - change made to &os; between releases; this document focuses - primarily on security advisories, user-visible changes, and major - architectural improvements. - - - Security Advisories - - Problems described in the following security advisories have - been fixed. For more information, consult the individual - advisories available from - . - - - - - - - - - Advisory - Date - Topic - - - - - - SA-11:01.mountd - 20 April 2011 - Network ACL mishandling in &man.mountd.8; - - - - SA-11:02.bind - 28 May 2011 - BIND remote DoS with large RRSIG RRsets and negative - caching - - - - SA-11:04.compress - 28 September 2011 - Errors handling corrupt compress file in - &man.compress.1; and &man.gzip.1; - - - - SA-11:05.unix - 28 September 2011 - Buffer overflow in handling of UNIX socket - addresses - - - - SA-11:06.bind - 23 December 2011 - Remote packet Denial of Service against &man.named.8; - servers - - - - SA-11:07.chroot - 23 December 2011 - Code execution via chrooted ftpd - - - - SA-11:08.telnetd - 23 December 2011 - telnetd code execution vulnerability - - - - SA-11:09.pam_ssh - 23 December 2011 - pam_ssh improperly grants access when user account has - unencrypted SSH private keys - - - - SA-11:10.pam - 23 December 2011 - pam_start() does not validate - service names - - - - - - - - Kernel Changes - - The &os; kernel now supports Capsicum - Capability Mode. Capsicum is a set of features for sandboxing - support, using a capability model in which the capabilities - are file descriptors. Two new kernel options - CAPABILITIES and - CAPABILITY_MODE have been added to the - GENERIC kernel. For more information - about Capsicum, see . - - The &os; - &man.dtrace.1; framework now supports - systrace for system calls of - linux32 and freebsd32 on - &os;/&arch.amd64;. Two new - systrace_linux32 and - systrace_freebsd32 kernel modules provide - support for tracing compat system calls in addition to the native - system call tracing provided by the - systrace module. - - The - &os; ELF image activator now supports the - PT_GNU_STACK program header. This is - disabled by default. New &man.sysctl.8; variables - kern.elf32.nxstack and - kern.elf64.nxstack allow enabling - PT_GNU_STACK for the specified ABIs - (e.g. elf32 for 32-bit ABI). - - The &man.hhook.9; (Helper Hook) - and &man.khelp.9; (Kernel Helpers) KPIs have been implemented. - These are a kind of superset of &man.pfil.9; framework for - more general use in the kernel. The &man.hhook.9; KPI - provides a way for kernel subsystems to export hook points - that &man.khelp.9; modules can hook to provide enhanced or new - functionality to the kernel. The &man.khelp.9; KPI provides a - framework for managing &man.khelp.9; modules, which indirectly - use the &man.hhook.9; KPI to register their hook functions - with hook points of interest within the kernel. These allow a - structured way to dynamically extend the kernel at runtime in - an ABI preserving manner. - - A &man.loader.8; - tunable hw.memtest.tests has been added. - This controls whether to perform memory testing at boot time - or not. The default value is 1 (perform a - memory test). - - A new resource accounting API has been - implemented. It can keep per-process, per-jail, and - per-loginclass resource accounting information. Note that - this is not built nor installed by default. To build and - install them, specify options RACCT in the - kernel configuration file and rebuild the base system as - described in the &os; - Handbook. - - A new resource-limiting API has been - implemented. It works in conjunction with the - RACCT resource accounting implementation - and takes user-configurable actions based on the set of rules - it maintains and the current resource usage. The &man.rctl.8; - utility has been added to manage the rules in userland. Note - that this is not built nor installed by default. To build and - install them, specify options RCTL in the - kernel configuration file and rebuild the base system as - described in the &os; - Handbook. - - The &man.sendmsg.2; and &man.recvmsg.2; - system calls in the &os; Linux ABI compatibility have been - improved. - - The &man.open.2; and &man.fhopen.2; - system calls now support the O_CLOEXEC flag, - which allows setting the FD_CLOEXEC flag for the - newly created file descriptor. This is standardized in IEEE - Std 1003.1-2008 (POSIX, Single UNIX Specification Version - 4). - - The &man.posix.fallocate.2; system call has - been implemented. This is a function in POSIX to ensure that - a part of the storage for regular file data is allocated on the - file system storage media. - - Two new system calls - setloginclass(2) and - getloginclass(2) have been added. This - makes it possible for the kernel to track the login class a - process is assigned to, which is required for the - RCTL resource limiting framework. - - &os; now supports executing - &os; 1/&arch.i386; a.out binaries on &os;/&arch.amd64;. Note - that this is not built nor installed by default. To build and - install them, specify options COMPAT_43 in - the kernel configuration file and rebuild the base system as - described in the &os; - Handbook. - - The following - &man.sysctl.8; variables have been added to show the availability - of various kernel features: - - - - - - - - &man.sysctl.8; variable name - Description - - - - - - kern.features.ufs_acl - ACL (Access Control List) support in UFS - - - - kern.features.ufs_gjournal - journaling support through &man.gjournal.8; for - UFS - - - - kern.features.ufs_quota - UFS disk quotas support - - - - kern.features.ufs_quota64 - 64-bit UFS disk quotas support - - - - kern.features.softupdates - FFS soft-updates support - - - - kern.features.ffs_snapshot - FFS snapshot support - - - - kern.features.nfsclient - NFS client (old implementation) - - - - kern.features.nfscl - NFS client (new implementation) - - - - kern.features.nfsserver - NFS server (old implementation) - - - - kern.features.nfsd - NFS server (new implementation) - - - - kern.features.kdtrace_hooks - Kernel DTrace hooks which are required to load - DTrace kernel modules - - - - kern.features.ktr - Kernel support for KTR kernel tracing facility - - - - kern.features.ktrace - Kernel support for system call tracing - - - - kern.features.hwpmc_hooks - Kernel support for HW PMC - - - - kern.features.sysv_msg - System V message queues support - - - - kern.features.sysv_sem - System V semaphores support - - - - kern.features.p1003_1b_mqueue - POSIX P1003.1B message queues support - - - - kern.features.p1003_1b_semaphores - POSIX P1003.1B semaphores support - - - - kern.features.kposix_priority_scheduling - POSIX P1003.1B real-time extensions - - - - kern.features.stack - Support for capturing the kernel stack - - - - kern.features.sysv_shm - System V shared memory segments support - - - - kern.features.pps_sync - Support usage of external PPS signal by kernel PLL - - - - kern.features.regression - Kernel support for interfaces necessary for - regression testing - - - - kern.features.invariant_support - Support for modules compiled with the INVARIANTS option - - - - kern.features.zero_copy_sockets - Zero copy sockets support - - - - kern.features.libmchain - mchain library - - - - kern.features.scbus - SCSI devices support - - - - kern.features.mac - Mandatory Access Control Framework support - - - - kern.features.audit - BSM audit support - - - - kern.features.geom_gate - GEOM Gate module - - - - kern.features.geom_uzip - GEOM uzip read-only compressed disks support - - - - kern.features.geom_cache - GEOM cache module - - - - kern.features.geom_mirror - GEOM mirroring support - - - - kern.features.geom_stripe - GEOM striping support - - - - kern.features.geom_concat - GEOM concatenation support - - - - kern.features.geom_raid3 - GEOM RAID-3 functionality - - - - kern.features.geom_fox - GEOM FOX redundant path mitigation support - - - - kern.features.geom_multipath - GEOM multipath support - - - - kern.features.g_virstor - GEOM virtual storage support - - - - kern.features.geom_bde - GEOM-based Disk Encryption - - - - kern.features.geom_eli - GEOM crypto module - - - - kern.features.geom_journal - GEOM journaling support - - - - kern.features.geom_shsec - GEOM shared secret device support - - - - kern.features.geom_vol - GEOM support for volume names from UFS superblocks - - - - kern.features.geom_label - GEOM labeling support - - - - kern.features.geom_sunlabel - GEOM Sun/Solaris partitioning support - - - - kern.features.geom_bsd - GEOM BSD disklabels support - - - - kern.features.geom_pc98 - GEOM NEC PC9800 partitioning support - - - - kern.features.geom_linux_lvm - GEOM Linux LVM partitioning support - - - - kern.features.geom_part_pc98 - GEOM partitioning class for PC-9800 disk partitions - - - - kern.features.geom_part_vtoc8 - GEOM partitioning class for SMI VTOC8 disk labels - - - - kern.features.geom_part_bsd - GEOM partitioning class for BSD disklabels - - - - kern.features.geom_part_ebr - GEOM partitioning class for extended boot records support - - - - kern.features.geom_part_ebr_compat - GEOM EBR partitioning class: - backward-compatible partition names - - - - kern.features.geom_part_gpt - GEOM partitioning class for GPT partitions - support - - - - kern.features.geom_part_apm - GEOM partitioning class for Apple-style - partitions - - - - kern.features.geom_part_mbr - GEOM partitioning class for MBR support - - - - - - - Boot Loader Changes - - The default boot loader menu has been - updated. - - The &man.loader.8; loader - now supports PBVM (Pre-Boot Virtual Memory). This allows - linking the kernel at a fixed virtual address without having to - make any assumptions about the physical memory layout. The - PBVM also allows fine control of the address where the - kernel and its modules are to be loaded. - - - - Hardware Support - - &os;/powerpc now - supports Sony Playstation 3 using the OtherOS feature - available on firmwares 3.15 and earlier. - - A new &man.loader.8; tunable - machdep.disable_tsc has been added. - Setting this to a non-zero value disables use of TSC (Time - Stamp Counter) by turning off boot-time CPU frequency - calibration, DELAY(9) with TSC, and using TSC as a CPU - ticker. Another new &man.loader.8; tunable - machdep.disable_tsc_calibration allows to - skip the TSC frequency calibration only. This is useful when - one wants to use the nominal frequency of the chip in Intel - processors, for example. - - The &os; &man.usb.4; - subsystem now supports USB 3.0 by default. - - The &os; &man.usb.4; subsystem now - supports USB packet filter. This allows to capture packets - which go through each USB host controller. The - implementation is almost based on &man.bpf.4; code. - The userland program &man.usbdump.8; has been added. - - - Network Interface Support - - A bug in the &man.alc.4; driver which - could make AR8152-based network interfaces stop working - has been fixed. - - A bxe(4) driver for Broadcom - NetXtreme II 10GbE controllers (BCM57710, BCM57711, - BCM57711E) has been added. - - The &man.cxgb.4; driver has been - updated to version 7.11.0. - - A &man.cxgbe.4; driver for Chelsio - T4 (Terminator 4) based 10Gb/1Gb adapters has been - added. - - The &man.dc.4; driver - now works correctly in kernels with the - option. - - The &man.em.4; driver has been - updated to version 7.3.2. - - The &man.igb.4; driver has been - updated to version 2.2.5. - - The &man.igb.4; driver now supports - Intel I350 PCIe Gigabit Ethernet controllers. - - The &man.ixgbe.4; driver has been - updated to version 2.3.8. - - Firmware images in the &man.iwn.4; - driver for 1000, 5000, 6000, and 6500 series cards have been - updated. - - A bug in the &man.msk.4; driver has been - fixed. It could prevent RX checksum offloading from - working. - - A bug in the &man.nfe.4; driver which - could prevent reinitialization after changing the MTU has - been fixed. - - A bug in the &man.ral.4; and &man.run.4; - drivers which could prevent hostap mode - from working has been fixed. - - A rdcphy(4) driver for RDC Semiconductor - R6040 10/100 PHY has been added. - - The &man.re.4; driver now supports - RTL8168E/8111E-VL PCIe Gigabit Ethernet controllers and - RTL8401E PCIe Fast Ethernet controllers. - - The &man.re.4; driver now supports - TX interrupt moderation on RTL810xE PCIe Fast Ethernet - controllers. - - The &man.re.4; driver now supports - another mechanism for RX interrupt moderation because of - performance problems. A &man.sysctl.8; variable - dev.re.N.int_rx_mod - has been added to control amount of time to delay RX - interrupt processing, in units of microsecond. Setting it - to 0 completely disables RX interrupt - moderation. A &man.loader.8; tunable - hw.re.intr_filter controls whether the - old mechanism utilizing MSI/MSI-X capability on - supported controllers is used or not. When set to - a non-zero value, the &man.re.4; driver uses the old - mechanism. The default value is 0 and - this tunable has no effect on controllers without MSI/MSI-X - capability. - - The &man.re.4; driver now - supports TSO (TCP Segmentation Offload) on RealTek - RTL8168/8111 C or later controllers. Note that this is - disabled by default because broken frames can be sent - under certain conditions. - - The &man.re.4; driver now - supports enabling TX and/or RX checksum offloading - independently from each other. Note that TX IP checksum - is disabled on some RTL8168C-based network interfaces - because it can generate an incorrect IP checksum when the - packet contains IP options. - - A bug in the &man.re.4; driver has - been fixed. It could cause a panic when receiving a jumbo - frame on an RTL8169C, 8169D, or 8169E controller-based - network interface. - - The &man.re.4; driver now supports - RTL8105E PCIe Fast Ethernet controllers. - - The rlphy(4) driver now supports the - Realtek RTL8201E 10/100 PHY found in RTL8105E - controllers. - - A bug in the &man.sis.4; driver has - been fixed. It could prevent a proper reinitialization - on DP83815, DP83816, and SiS 900/7016 controllers when the - configuration of multicast packet handling and/or - promiscuous mode is changed. - - A bug in the &man.vlan.4; pseudo interface - han been fixed. It could have a random interface - identifier in an automatically configured IPv6 link-local - address, instead of one generated with the parent - interface's IEEE 802 48-bit MAC address and an algorithm - described in RFC 4291. - - A &man.vte.4; driver for RDC R6040 Fast - Ethernet controllers, which are commonly found on the Vortex86 - System On a Chip, has been added. - - A &man.vxge.4; driver for the Neterion - X3100 10GbE Server/Storage adapter has been added. - - A bug in the &man.wpi.4; driver has been - fixed. It could display the following error messages and - result in the device being unusable: - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 07:26:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5DD1EF9F; Tue, 18 Dec 2012 07:26:56 +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 4314B8FC0A; Tue, 18 Dec 2012 07:26:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI7QuGS083973; Tue, 18 Dec 2012 07:26:56 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI7Qt7T083968; Tue, 18 Dec 2012 07:26:55 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201212180726.qBI7Qt7T083968@svn.freebsd.org> From: Andrew Turner Date: Tue, 18 Dec 2012 07:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244382 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 07:26:56 -0000 Author: andrew Date: Tue Dec 18 07:26:55 2012 New Revision: 244382 URL: http://svnweb.freebsd.org/changeset/base/244382 Log: Get libcompiler-rt and libgcc building on ARM with clang. * Don't provide clear_cache or the __sync_* functions on ARM with clang as they are provided by clang as builtin functions. * Tell clang it is aloud to compile some libgcc code using heinous GCC extensions. Modified: head/gnu/lib/libgcc/Makefile head/lib/libcompiler_rt/Makefile Modified: head/gnu/lib/libgcc/Makefile ============================================================================== --- head/gnu/lib/libgcc/Makefile Tue Dec 18 07:15:03 2012 (r244381) +++ head/gnu/lib/libgcc/Makefile Tue Dec 18 07:26:55 2012 (r244382) @@ -38,13 +38,16 @@ OBJS= # added to below in various ways # # Library members defined in libgcc2.c. LIB2FUNCS= _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 \ - _cmpdi2 _ucmpdi2 _clear_cache \ + _cmpdi2 _ucmpdi2 \ _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3 \ _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \ _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab \ _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2 \ _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 \ _divxc3 _divtc3 +.if ${COMPILER_TYPE} != "clang" || ${TARGET_CPUARCH} != "arm" +LIB2FUNCS+= _clear_cache +.endif # The floating-point conversion routines that involve a single-word integer. .for mode in sf df xf @@ -106,6 +109,10 @@ LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udi .if ${TARGET_CPUARCH} == "arm" # from config/arm/t-strongarm-elf CFLAGS+= -Dinhibit_libc -fno-inline +.if ${COMPILER_TYPE} == "clang" +CFLAGS+= -fheinous-gnu-extensions +.endif + LIB1ASMSRC = lib1funcs.asm LIB1ASMFUNCS = _dvmd_tls _bb_init_func LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c Modified: head/lib/libcompiler_rt/Makefile ============================================================================== --- head/lib/libcompiler_rt/Makefile Tue Dec 18 07:15:03 2012 (r244381) +++ head/lib/libcompiler_rt/Makefile Tue Dec 18 07:26:55 2012 (r244382) @@ -28,7 +28,6 @@ SRCF= absvdi2 \ ashlti3 \ ashrdi3 \ ashrti3 \ - clear_cache \ clzdi2 \ clzsi2 \ clzti2 \ @@ -126,6 +125,11 @@ SRCF= absvdi2 \ umoddi3 \ umodti3 +# Don't build clear_cache on ARM with clang as it is a builtin there. +.if ${MACHINE_CPUARCH} != "arm" || ${COMPILER_TYPE} != "clang" +SRCF+= clear_cache +.endif + # These are already shipped by libc.a on arm and mips .if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" SRCF+= adddf3 \ @@ -148,8 +152,9 @@ SRCF+= adddf3 \ umodsi3 .endif -# FreeBSD-specific atomic intrinsics. -.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" +# FreeBSD-specific atomic intrinsics. Clang provides them as a builtin. +.if (${MACHINE_CPUARCH} == "arm" && ${COMPILER_TYPE} != "clang") || \ + ${MACHINE_CPUARCH} == "mips" SRCF+= __sync_fetch_and_add_4 \ __sync_fetch_and_and_4 \ __sync_fetch_and_or_4 \ From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 07:27:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 940921A3; Tue, 18 Dec 2012 07:27:51 +0000 (UTC) (envelope-from zont@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 781A98FC0A; Tue, 18 Dec 2012 07:27:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI7Rp2x084373; Tue, 18 Dec 2012 07:27:51 GMT (envelope-from zont@svn.freebsd.org) Received: (from zont@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI7Rp0t084371; Tue, 18 Dec 2012 07:27:51 GMT (envelope-from zont@svn.freebsd.org) Message-Id: <201212180727.qBI7Rp0t084371@svn.freebsd.org> From: Andrey Zonov Date: Tue, 18 Dec 2012 07:27:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244383 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 07:27:51 -0000 Author: zont Date: Tue Dec 18 07:27:50 2012 New Revision: 244383 URL: http://svnweb.freebsd.org/changeset/base/244383 Log: - Set memorylocked limit to 64Kb for default login class. This prevents unprivileged users to lock too much memory. - Set memorylocked limit to 64Mb for daemon login class. Some daemons such as amd(8) and watchdogd(8) calls mlockall(2) on startup, they are run from init(8) which uses daemon login class. - Set memorylocked limit to unlimited for root login class. Suggested by: avg Approved by: kib (mentor) MFC after: 1 week Modified: head/etc/login.conf Modified: head/etc/login.conf ============================================================================== --- head/etc/login.conf Tue Dec 18 07:26:55 2012 (r244382) +++ head/etc/login.conf Tue Dec 18 07:27:50 2012 (r244383) @@ -32,7 +32,7 @@ default:\ :cputime=unlimited:\ :datasize=unlimited:\ :stacksize=unlimited:\ - :memorylocked=unlimited:\ + :memorylocked=64K:\ :memoryuse=unlimited:\ :filesize=unlimited:\ :coredumpsize=unlimited:\ @@ -59,6 +59,7 @@ xuser:\ staff:\ :tc=default: daemon:\ + :memorylocked=64M:\ :tc=default: news:\ :tc=default: @@ -72,6 +73,7 @@ dialer:\ # in preference to 'default'. root:\ :ignorenologin:\ + :memorylocked=unlimited:\ :tc=default: # From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 07:35:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C46E2552; Tue, 18 Dec 2012 07:35:02 +0000 (UTC) (envelope-from zont@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 A70E88FC14; Tue, 18 Dec 2012 07:35:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI7Z2CV085875; Tue, 18 Dec 2012 07:35:02 GMT (envelope-from zont@svn.freebsd.org) Received: (from zont@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI7Z1a0085871; Tue, 18 Dec 2012 07:35:01 GMT (envelope-from zont@svn.freebsd.org) Message-Id: <201212180735.qBI7Z1a0085871@svn.freebsd.org> From: Andrey Zonov Date: Tue, 18 Dec 2012 07:35:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244384 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 07:35:02 -0000 Author: zont Date: Tue Dec 18 07:35:01 2012 New Revision: 244384 URL: http://svnweb.freebsd.org/changeset/base/244384 Log: - Fix locked memory accounting for maps with MAP_WIREFUTURE flag. - Add sysctl vm.old_mlock which may turn such accounting off. Reviewed by: avg, trasz Approved by: kib (mentor) MFC after: 1 week Modified: head/sys/vm/vm.h head/sys/vm/vm_map.c head/sys/vm/vm_mmap.c head/sys/vm/vm_unix.c Modified: head/sys/vm/vm.h ============================================================================== --- head/sys/vm/vm.h Tue Dec 18 07:27:50 2012 (r244383) +++ head/sys/vm/vm.h Tue Dec 18 07:35:01 2012 (r244384) @@ -141,6 +141,8 @@ struct kva_md_info { extern struct kva_md_info kmi; extern void vm_ksubmap_init(struct kva_md_info *); +extern int old_mlock; + struct ucred; int swap_reserve(vm_ooffset_t incr); int swap_reserve_by_cred(vm_ooffset_t incr, struct ucred *cred); Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Tue Dec 18 07:27:50 2012 (r244383) +++ head/sys/vm/vm_map.c Tue Dec 18 07:35:01 2012 (r244384) @@ -3247,7 +3247,7 @@ vm_map_stack(vm_map_t map, vm_offset_t a vm_offset_t bot, top; vm_size_t growsize, init_ssize; int orient, rv; - rlim_t vmemlim; + rlim_t lmemlim, vmemlim; /* * The stack orientation is piggybacked with the cow argument. @@ -3267,9 +3267,10 @@ vm_map_stack(vm_map_t map, vm_offset_t a growsize = sgrowsiz; init_ssize = (max_ssize < growsize) ? max_ssize : growsize; - PROC_LOCK(curthread->td_proc); - vmemlim = lim_cur(curthread->td_proc, RLIMIT_VMEM); - PROC_UNLOCK(curthread->td_proc); + PROC_LOCK(curproc); + lmemlim = lim_cur(curproc, RLIMIT_MEMLOCK); + vmemlim = lim_cur(curproc, RLIMIT_VMEM); + PROC_UNLOCK(curproc); vm_map_lock(map); @@ -3279,6 +3280,14 @@ vm_map_stack(vm_map_t map, vm_offset_t a return (KERN_NO_SPACE); } + if (!old_mlock && map->flags & MAP_WIREFUTURE) { + if (ptoa(vmspace_wired_count(curproc->p_vmspace)) + + init_ssize > lmemlim) { + vm_map_unlock(map); + return (KERN_NO_SPACE); + } + } + /* If we would blow our VMEM resource limit, no go */ if (map->size + init_ssize > vmemlim) { vm_map_unlock(map); @@ -3360,7 +3369,7 @@ vm_map_growstack(struct proc *p, vm_offs vm_offset_t end; vm_size_t growsize; size_t grow_amount, max_grow; - rlim_t stacklim, vmemlim; + rlim_t lmemlim, stacklim, vmemlim; int is_procstack, rv; struct ucred *cred; #ifdef notyet @@ -3372,6 +3381,7 @@ vm_map_growstack(struct proc *p, vm_offs Retry: PROC_LOCK(p); + lmemlim = lim_cur(p, RLIMIT_MEMLOCK); stacklim = lim_cur(p, RLIMIT_STACK); vmemlim = lim_cur(p, RLIMIT_VMEM); PROC_UNLOCK(p); @@ -3494,7 +3504,25 @@ Retry: if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > limit)) grow_amount = limit - ctob(vm->vm_ssize); #endif - + if (!old_mlock && map->flags & MAP_WIREFUTURE) { + if (ptoa(vmspace_wired_count(p->p_vmspace)) + grow_amount > + lmemlim) { + vm_map_unlock_read(map); + rv = KERN_NO_SPACE; + goto out; + } +#ifdef RACCT + PROC_LOCK(p); + if (racct_set(p, RACCT_MEMLOCK, + ptoa(vmspace_wired_count(p->p_vmspace)) + grow_amount)) { + PROC_UNLOCK(p); + vm_map_unlock_read(map); + rv = KERN_NO_SPACE; + goto out; + } + PROC_UNLOCK(p); +#endif + } /* If we would blow our VMEM resource limit, no go */ if (map->size + grow_amount > vmemlim) { vm_map_unlock_read(map); @@ -3615,6 +3643,11 @@ out: PROC_LOCK(p); error = racct_set(p, RACCT_VMEM, map->size); KASSERT(error == 0, ("decreasing RACCT_VMEM failed")); + if (!old_mlock) { + error = racct_set(p, RACCT_MEMLOCK, + ptoa(vmspace_wired_count(p->p_vmspace))); + KASSERT(error == 0, ("decreasing RACCT_MEMLOCK failed")); + } error = racct_set(p, RACCT_STACK, ctob(vm->vm_ssize)); KASSERT(error == 0, ("decreasing RACCT_STACK failed")); PROC_UNLOCK(p); Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Tue Dec 18 07:27:50 2012 (r244383) +++ head/sys/vm/vm_mmap.c Tue Dec 18 07:35:01 2012 (r244384) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -87,6 +88,11 @@ __FBSDID("$FreeBSD$"); #include #endif +int old_mlock = 0; +SYSCTL_INT(_vm, OID_AUTO, old_mlock, CTLFLAG_RW | CTLFLAG_TUN, &old_mlock, 0, + "Do not apply RLIMIT_MEMLOCK on mlockall"); +TUNABLE_INT("vm.old_mlock", &old_mlock); + #ifndef _SYS_SYSPROTO_H_ struct sbrk_args { int incr; @@ -1096,27 +1102,25 @@ sys_mlockall(td, uap) int error; map = &td->td_proc->p_vmspace->vm_map; - error = 0; + error = priv_check(td, PRIV_VM_MLOCK); + if (error) + return (error); if ((uap->how == 0) || ((uap->how & ~(MCL_CURRENT|MCL_FUTURE)) != 0)) return (EINVAL); -#if 0 /* * If wiring all pages in the process would cause it to exceed * a hard resource limit, return ENOMEM. */ - PROC_LOCK(td->td_proc); - if (map->size > lim_cur(td->td_proc, RLIMIT_MEMLOCK)) { + if (!old_mlock && uap->how & MCL_CURRENT) { + PROC_LOCK(td->td_proc); + if (map->size > lim_cur(td->td_proc, RLIMIT_MEMLOCK)) { + PROC_UNLOCK(td->td_proc); + return (ENOMEM); + } PROC_UNLOCK(td->td_proc); - return (ENOMEM); } - PROC_UNLOCK(td->td_proc); -#else - error = priv_check(td, PRIV_VM_MLOCK); - if (error) - return (error); -#endif #ifdef RACCT PROC_LOCK(td->td_proc); error = racct_set(td->td_proc, RACCT_MEMLOCK, map->size); @@ -1480,6 +1484,24 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, PROC_UNLOCK(td->td_proc); return (ENOMEM); } + if (!old_mlock && map->flags & MAP_WIREFUTURE) { + if (ptoa(vmspace_wired_count(td->td_proc->p_vmspace)) + + size > lim_cur(td->td_proc, RLIMIT_MEMLOCK)) { + racct_set_force(td->td_proc, RACCT_VMEM, + map->size); + PROC_UNLOCK(td->td_proc); + return (ENOMEM); + } + error = racct_set(td->td_proc, RACCT_MEMLOCK, + ptoa(vmspace_wired_count(td->td_proc->p_vmspace)) + + size); + if (error != 0) { + racct_set_force(td->td_proc, RACCT_VMEM, + map->size); + PROC_UNLOCK(td->td_proc); + return (error); + } + } PROC_UNLOCK(td->td_proc); } Modified: head/sys/vm/vm_unix.c ============================================================================== --- head/sys/vm/vm_unix.c Tue Dec 18 07:27:50 2012 (r244383) +++ head/sys/vm/vm_unix.c Tue Dec 18 07:35:01 2012 (r244384) @@ -77,13 +77,14 @@ sys_obreak(td, uap) { struct vmspace *vm = td->td_proc->p_vmspace; vm_offset_t new, old, base; - rlim_t datalim, vmemlim; + rlim_t datalim, lmemlim, vmemlim; int prot, rv; int error = 0; boolean_t do_map_wirefuture; PROC_LOCK(td->td_proc); datalim = lim_cur(td->td_proc, RLIMIT_DATA); + lmemlim = lim_cur(td->td_proc, RLIMIT_MEMLOCK); vmemlim = lim_cur(td->td_proc, RLIMIT_VMEM); PROC_UNLOCK(td->td_proc); @@ -116,6 +117,13 @@ sys_obreak(td, uap) goto done; } if (new > old) { + if (!old_mlock && vm->vm_map.flags & MAP_WIREFUTURE) { + if (ptoa(vmspace_wired_count(td->td_proc->p_vmspace)) + + (new - old) > lmemlim) { + error = ENOMEM; + goto done; + } + } if (vm->vm_map.size + (new - old) > vmemlim) { error = ENOMEM; goto done; @@ -136,6 +144,20 @@ sys_obreak(td, uap) error = ENOMEM; goto done; } + if (!old_mlock && vm->vm_map.flags & MAP_WIREFUTURE) { + error = racct_set(td->td_proc, RACCT_MEMLOCK, + ptoa(vmspace_wired_count(td->td_proc->p_vmspace)) + + (new - old)); + if (error != 0) { + racct_set_force(td->td_proc, RACCT_DATA, + old - base); + racct_set_force(td->td_proc, RACCT_VMEM, + vm->vm_map.size); + PROC_UNLOCK(td->td_proc); + error = ENOMEM; + goto done; + } + } PROC_UNLOCK(td->td_proc); #endif prot = VM_PROT_RW; @@ -152,6 +174,11 @@ sys_obreak(td, uap) PROC_LOCK(td->td_proc); racct_set_force(td->td_proc, RACCT_DATA, old - base); racct_set_force(td->td_proc, RACCT_VMEM, vm->vm_map.size); + if (!old_mlock && vm->vm_map.flags & MAP_WIREFUTURE) { + racct_set_force(td->td_proc, RACCT_MEMLOCK, + ptoa(vmspace_wired_count( + td->td_proc->p_vmspace))); + } PROC_UNLOCK(td->td_proc); #endif error = ENOMEM; @@ -183,6 +210,10 @@ sys_obreak(td, uap) PROC_LOCK(td->td_proc); racct_set_force(td->td_proc, RACCT_DATA, new - base); racct_set_force(td->td_proc, RACCT_VMEM, vm->vm_map.size); + if (!old_mlock && vm->vm_map.flags & MAP_WIREFUTURE) { + racct_set_force(td->td_proc, RACCT_MEMLOCK, + ptoa(vmspace_wired_count(td->td_proc->p_vmspace))); + } PROC_UNLOCK(td->td_proc); #endif } From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 07:36:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2FBB67F8; Tue, 18 Dec 2012 07:36:46 +0000 (UTC) (envelope-from zont@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 EDE1B8FC0C; Tue, 18 Dec 2012 07:36:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI7ajgj086138; Tue, 18 Dec 2012 07:36:45 GMT (envelope-from zont@svn.freebsd.org) Received: (from zont@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI7aj4K086137; Tue, 18 Dec 2012 07:36:45 GMT (envelope-from zont@svn.freebsd.org) Message-Id: <201212180736.qBI7aj4K086137@svn.freebsd.org> From: Andrey Zonov Date: Tue, 18 Dec 2012 07:36:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244385 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 07:36:46 -0000 Author: zont Date: Tue Dec 18 07:36:45 2012 New Revision: 244385 URL: http://svnweb.freebsd.org/changeset/base/244385 Log: - Add sysctl to allow unprivileged users to call mlock(2)-family system calls and turn it on. - Do not allow to call them inside jail. [1] Pointed out by: trasz [1] Reviewed by: avg Approved by: kib (mentor) MFC after: 1 week Modified: head/sys/kern/kern_priv.c Modified: head/sys/kern/kern_priv.c ============================================================================== --- head/sys/kern/kern_priv.c Tue Dec 18 07:35:01 2012 (r244384) +++ head/sys/kern/kern_priv.c Tue Dec 18 07:36:45 2012 (r244385) @@ -59,6 +59,11 @@ SYSCTL_INT(_security_bsd, OID_AUTO, suse &suser_enabled, 0, "processes with uid 0 have privilege"); TUNABLE_INT("security.bsd.suser_enabled", &suser_enabled); +static int unprivileged_mlock = 1; +SYSCTL_INT(_security_bsd, OID_AUTO, unprivileged_mlock, CTLFLAG_RW|CTLFLAG_TUN, + &unprivileged_mlock, 0, "Allow non-root users to call mlock(2)"); +TUNABLE_INT("security.bsd.unprivileged_mlock", &unprivileged_mlock); + SDT_PROVIDER_DEFINE(priv); SDT_PROBE_DEFINE1(priv, kernel, priv_check, priv_ok, priv-ok, "int"); SDT_PROBE_DEFINE1(priv, kernel, priv_check, priv_err, priv-err, "int"); @@ -93,6 +98,19 @@ priv_check_cred(struct ucred *cred, int if (error) goto out; + if (unprivileged_mlock) { + /* + * Allow unprivileged users to call mlock(2)/munlock(2) and + * mlockall(2)/munlockall(2). + */ + switch (priv) { + case PRIV_VM_MLOCK: + case PRIV_VM_MUNLOCK: + error = 0; + goto out; + } + } + /* * Having determined if privilege is restricted by various policies, * now determine if privilege is granted. At this point, any policy From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 08:09:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4F4FDF53; Tue, 18 Dec 2012 08:09:45 +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 341A58FC0A; Tue, 18 Dec 2012 08:09:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI89jal091822; Tue, 18 Dec 2012 08:09:45 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI89jUi091821; Tue, 18 Dec 2012 08:09:45 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201212180809.qBI89jUi091821@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 18 Dec 2012 08:09:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244386 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 08:09:45 -0000 Author: glebius Date: Tue Dec 18 08:09:44 2012 New Revision: 244386 URL: http://svnweb.freebsd.org/changeset/base/244386 Log: Clear correct flag in INET6 case. Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Dec 18 07:36:45 2012 (r244385) +++ head/sys/netinet/tcp_input.c Tue Dec 18 08:09:44 2012 (r244386) @@ -810,7 +810,7 @@ findpcb: } /* Remove the tag from the packet. We don't need it anymore. */ m_tag_delete(m, fwd_tag); - m->m_flags &= ~M_IP_NEXTHOP; + m->m_flags &= ~M_IP6_NEXTHOP; fwd_tag = NULL; } else if (isipv6) { inp = in6_pcblookup_mbuf(&V_tcbinfo, &ip6->ip6_src, From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 08:14:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EDAA42C4; Tue, 18 Dec 2012 08:14:16 +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 D1DCB8FC17; Tue, 18 Dec 2012 08:14:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI8EGHW092799; Tue, 18 Dec 2012 08:14:16 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI8EGfe092798; Tue, 18 Dec 2012 08:14:16 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201212180814.qBI8EGfe092798@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 18 Dec 2012 08:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244387 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 08:14:17 -0000 Author: glebius Date: Tue Dec 18 08:14:16 2012 New Revision: 244387 URL: http://svnweb.freebsd.org/changeset/base/244387 Log: Fix !INET6 build after r244365. Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Dec 18 08:09:44 2012 (r244386) +++ head/sys/netinet/tcp_input.c Tue Dec 18 08:14:16 2012 (r244387) @@ -780,8 +780,17 @@ findpcb: /* * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. */ - if ((isipv6 && (m->m_flags & M_IP6_NEXTHOP)) || - (!isipv6 && (m->m_flags & M_IP_NEXTHOP))) + if ( +#ifdef INET6 + (isipv6 && (m->m_flags & M_IP6_NEXTHOP)) +#ifdef INET + || (!isipv6 && (m->m_flags & M_IP_NEXTHOP)) +#endif +#endif +#if defined(INET) && !defined(INET6) + (m->m_flags & M_IP_NEXTHOP) +#endif + ) fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); #ifdef INET6 From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 08:24:39 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BF91F67F; Tue, 18 Dec 2012 08:24:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 3D37E8FC0C; Tue, 18 Dec 2012 08:24:39 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id qBI8Ocau062026; Tue, 18 Dec 2012 12:24:38 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id qBI8Oc3S062025; Tue, 18 Dec 2012 12:24:38 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 18 Dec 2012 12:24:38 +0400 From: Gleb Smirnoff To: ae@FreeBSD.org Subject: Re: svn commit: r244387 - head/sys/netinet Message-ID: <20121218082438.GJ94420@FreeBSD.org> References: <201212180814.qBI8EGfe092798@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201212180814.qBI8EGfe092798@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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 08:24:39 -0000 Andrey, On Tue, Dec 18, 2012 at 08:14:16AM +0000, Gleb Smirnoff wrote: T> Author: glebius T> Date: Tue Dec 18 08:14:16 2012 T> New Revision: 244387 T> URL: http://svnweb.freebsd.org/changeset/base/244387 T> T> Log: T> Fix !INET6 build after r244365. T> T> Modified: T> head/sys/netinet/tcp_input.c T> At review stage of the r242079 I have noted, that more effort should be put into mbuf flags prior to this change: - cleanse deprecated mbuf flags (at least M_FREELIST) - move 90% of mbuf flags to pkthdr flags - not utilize protocol specific flag, but use a global one to mark packet as having forward tag Several of the fallouts from r242079 could be avoided. IMHO, if anyone is hacking on a new feature or optimisation and encounters a "bad code" (tm), he/she should remove the bad code from his/her way and not leave it to be worked on sometime later, which usually ends up in never. This approach adds more work before the feature/optimisation is commited, but reduces probability of problems after commit and thus amount of urgent work after commit. P.S. Please do not take above ranting paragraph as personal critics of yourself, this is just thinking out loud on how things should be done :) T> Modified: head/sys/netinet/tcp_input.c T> ============================================================================== T> --- head/sys/netinet/tcp_input.c Tue Dec 18 08:09:44 2012 (r244386) T> +++ head/sys/netinet/tcp_input.c Tue Dec 18 08:14:16 2012 (r244387) T> @@ -780,8 +780,17 @@ findpcb: T> /* T> * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. T> */ T> - if ((isipv6 && (m->m_flags & M_IP6_NEXTHOP)) || T> - (!isipv6 && (m->m_flags & M_IP_NEXTHOP))) T> + if ( T> +#ifdef INET6 T> + (isipv6 && (m->m_flags & M_IP6_NEXTHOP)) T> +#ifdef INET T> + || (!isipv6 && (m->m_flags & M_IP_NEXTHOP)) T> +#endif T> +#endif T> +#if defined(INET) && !defined(INET6) T> + (m->m_flags & M_IP_NEXTHOP) T> +#endif T> + ) T> fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); T> T> #ifdef INET6 -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 08:28:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 869D6826; Tue, 18 Dec 2012 08:28:50 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com [74.125.82.46]) by mx1.freebsd.org (Postfix) with ESMTP id 850D48FC0C; Tue, 18 Dec 2012 08:28:49 +0000 (UTC) Received: by mail-wg0-f46.google.com with SMTP id dr13so138052wgb.1 for ; Tue, 18 Dec 2012 00:28:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=2Nmf82wun86o2QHzKCRuOY/rwY1W+dcA+04FFmdAZ14=; b=VHv/zC1ObcOA3x4mCrxjQz5qpwUe9k2IZdZQhTYQLd/D9FSfdbMES/9Dv/XYu+XaxL 3vvtkBv8f6IfhNw6K4EtibBRiEBXkaxifjHtejjKJjy+apyg4UBTfSocnlrOwwwRO9pg IGJhiZRfE0nWHzY83yf0HHxl2inxSmtS1FYx7LwMeCPYrbcAhnXCROYTytfwO4KXG4rr CvtsMp1epWmbEgVHa+vSQhLX0v+KZ4MgqB9DMulIER/67+7VEIn+HTCMXZXda1avHPQa 4wnohouC1fxmgcxnL7qBR+xYUH7hWmKmBMdcOK8jh11ifmws0u0nzc5MmmxsbhSKn5uP 6ewg== MIME-Version: 1.0 Received: by 10.180.87.102 with SMTP id w6mr2244804wiz.19.1355818879134; Tue, 18 Dec 2012 00:21:19 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.217.57.9 with HTTP; Tue, 18 Dec 2012 00:21:18 -0800 (PST) In-Reply-To: <201212180814.qBI8EGfe092798@svn.freebsd.org> References: <201212180814.qBI8EGfe092798@svn.freebsd.org> Date: Tue, 18 Dec 2012 00:21:18 -0800 X-Google-Sender-Auth: XTenKv1eGOBByJFgL0f8k-JTh5E Message-ID: Subject: Re: svn commit: r244387 - head/sys/netinet From: Adrian Chadd 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 08:28:50 -0000 Thanks! Adrian On 18 December 2012 00:14, Gleb Smirnoff wrote: > Author: glebius > Date: Tue Dec 18 08:14:16 2012 > New Revision: 244387 > URL: http://svnweb.freebsd.org/changeset/base/244387 > > Log: > Fix !INET6 build after r244365. > > Modified: > head/sys/netinet/tcp_input.c > > Modified: head/sys/netinet/tcp_input.c > ============================================================================== > --- head/sys/netinet/tcp_input.c Tue Dec 18 08:09:44 2012 (r244386) > +++ head/sys/netinet/tcp_input.c Tue Dec 18 08:14:16 2012 (r244387) > @@ -780,8 +780,17 @@ findpcb: > /* > * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. > */ > - if ((isipv6 && (m->m_flags & M_IP6_NEXTHOP)) || > - (!isipv6 && (m->m_flags & M_IP_NEXTHOP))) > + if ( > +#ifdef INET6 > + (isipv6 && (m->m_flags & M_IP6_NEXTHOP)) > +#ifdef INET > + || (!isipv6 && (m->m_flags & M_IP_NEXTHOP)) > +#endif > +#endif > +#if defined(INET) && !defined(INET6) > + (m->m_flags & M_IP_NEXTHOP) > +#endif > + ) > fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); > > #ifdef INET6 From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 08:41:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 92180C5D; Tue, 18 Dec 2012 08:41:24 +0000 (UTC) (envelope-from monthadar@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 76D748FC0C; Tue, 18 Dec 2012 08:41:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI8fOxI097039; Tue, 18 Dec 2012 08:41:24 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI8fOKs097038; Tue, 18 Dec 2012 08:41:24 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201212180841.qBI8fOKs097038@svn.freebsd.org> From: Monthadar Al Jaberi Date: Tue, 18 Dec 2012 08:41:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244388 - head/sys/dev/wtap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 08:41:24 -0000 Author: monthadar Date: Tue Dec 18 08:41:23 2012 New Revision: 244388 URL: http://svnweb.freebsd.org/changeset/base/244388 Log: wtap: fix clang warning. * The warning message was: 'warning error: format string is not a string literal'; * Changed how make_dev is called, now a string literal for formatting is used; Approved by: adrian (mentor) Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c ============================================================================== --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:14:16 2012 (r244387) +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:41:23 2012 (r244388) @@ -348,7 +348,7 @@ wtap_vap_create(struct ieee80211com *ic, /* complete setup */ ieee80211_vap_attach(vap, wtap_media_change, ieee80211_media_status); avp->av_dev = make_dev(&wtap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, - (const char *)ic->ic_ifp->if_xname); + "%s", (const char *)ic->ic_ifp->if_xname); /* TODO this is a hack to force it to choose the rate we want */ ni = ieee80211_ref_node(vap->iv_bss); From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 08:44:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C6099E1D; Tue, 18 Dec 2012 08:44:59 +0000 (UTC) (envelope-from monthadar@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 AA8C98FC0C; Tue, 18 Dec 2012 08:44:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI8ix62097634; Tue, 18 Dec 2012 08:44:59 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI8ixdX097633; Tue, 18 Dec 2012 08:44:59 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201212180844.qBI8ixdX097633@svn.freebsd.org> From: Monthadar Al Jaberi Date: Tue, 18 Dec 2012 08:44:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244389 - head/sys/dev/wtap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 08:44:59 -0000 Author: monthadar Date: Tue Dec 18 08:44:59 2012 New Revision: 244389 URL: http://svnweb.freebsd.org/changeset/base/244389 Log: wtap should check if ieee80211_vap_setup fails. * If ieee80211_vap_setup fails, we free allocated M_80211_VAP memory and return NULL; Approved by: adrian (mentor) Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c ============================================================================== --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:41:23 2012 (r244388) +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:44:59 2012 (r244389) @@ -334,6 +334,10 @@ wtap_vap_create(struct ieee80211com *ic, vap = (struct ieee80211vap *) avp; error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + if (error) { + free((struct wtap_vap*) vap, M_80211_VAP); + return NULL; + } /* override various methods */ avp->av_recv_mgmt = vap->iv_recv_mgmt; From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 08:53:08 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 62585184; Tue, 18 Dec 2012 08:53:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id B8AA38FC13; Tue, 18 Dec 2012 08:53:07 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id qBI8r6P6062205; Tue, 18 Dec 2012 12:53:06 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id qBI8r6DS062204; Tue, 18 Dec 2012 12:53:06 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 18 Dec 2012 12:53:06 +0400 From: Gleb Smirnoff To: Monthadar Al Jaberi Subject: Re: svn commit: r244389 - head/sys/dev/wtap Message-ID: <20121218085306.GK94420@FreeBSD.org> References: <201212180844.qBI8ixdX097633@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="UlVJffcvxoiEqYs2" Content-Disposition: inline In-Reply-To: <201212180844.qBI8ixdX097633@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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 08:53:08 -0000 --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Monthadar, On Tue, Dec 18, 2012 at 08:44:59AM +0000, Monthadar Al Jaberi wrote: M> Author: monthadar M> Date: Tue Dec 18 08:44:59 2012 M> New Revision: 244389 M> URL: http://svnweb.freebsd.org/changeset/base/244389 M> M> Log: M> wtap should check if ieee80211_vap_setup fails. M> M> * If ieee80211_vap_setup fails, we free allocated M_80211_VAP M> memory and return NULL; M> M> Approved by: adrian (mentor) M> M> Modified: M> head/sys/dev/wtap/if_wtap.c M> M> Modified: head/sys/dev/wtap/if_wtap.c M> ============================================================================== M> --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:41:23 2012 (r244388) M> +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:44:59 2012 (r244389) M> @@ -334,6 +334,10 @@ wtap_vap_create(struct ieee80211com *ic, M> vap = (struct ieee80211vap *) avp; M> error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, M> flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); M> + if (error) { M> + free((struct wtap_vap*) vap, M_80211_VAP); M> + return NULL; M> + } M> M> /* override various methods */ M> avp->av_recv_mgmt = vap->iv_recv_mgmt; You don't need to cast first argument of free(9). And you don't need a cast before malloc(9) as well. If you are calling malloc(9) with M_NOWAIT, you need to check return result. Also, more stylish would be to supply to free() the same variable that was assigned at malloc(9) call, in this particular case it is "avp". Patch attached. -- Totus tuus, Glebius. --UlVJffcvxoiEqYs2 Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="if_wtap.c.diff" Index: if_wtap.c =================================================================== --- if_wtap.c (revision 244389) +++ if_wtap.c (working copy) @@ -326,8 +326,9 @@ DWTAP_PRINTF("%s\n", __func__); - avp = (struct wtap_vap *) malloc(sizeof(struct wtap_vap), - M_80211_VAP, M_NOWAIT | M_ZERO); + avp = malloc(sizeof(struct wtap_vap), M_80211_VAP, M_NOWAIT | M_ZERO); + if (avp == NULL) + return (NULL); avp->id = sc->id; avp->av_md = sc->sc_md; avp->av_bcinterval = msecs_to_ticks(BEACON_INTRERVAL + 100*sc->id); @@ -335,8 +336,8 @@ error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); if (error) { - free((struct wtap_vap*) vap, M_80211_VAP); - return NULL; + free(avp, M_80211_VAP); + return (NULL); } /* override various methods */ --UlVJffcvxoiEqYs2-- From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 09:27:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 79F64CAB for ; Tue, 18 Dec 2012 09:27:28 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id D02038FC14 for ; Tue, 18 Dec 2012 09:27:27 +0000 (UTC) Received: (qmail 22830 invoked from network); 18 Dec 2012 10:55:13 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 18 Dec 2012 10:55:13 -0000 Message-ID: <50D036F8.1000406@freebsd.org> Date: Tue, 18 Dec 2012 10:27:20 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Oleksandr Tymoshenko Subject: Re: svn commit: r243631 - in head/sys: kern sys References: <201211272119.qARLJxXV061083@svn.freebsd.org> <50C1BC90.90106@freebsd.org> <50C25A27.4060007@bluezbox.com> <50C26331.6030504@freebsd.org> <50C26AE9.4020600@bluezbox.com> <50C3A3D3.9000804@freebsd.org> <50C3AF72.4010902@rice.edu> <330405A1-312A-45A5-BB86-4969478D8BBD@bluezbox.com> In-Reply-To: <330405A1-312A-45A5-BB86-4969478D8BBD@bluezbox.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Alan Cox X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 09:27:28 -0000 On 18.12.2012 06:40, Oleksandr Tymoshenko wrote: > > On 2012-12-08, at 1:21 PM, Alan Cox wrote: > >> On 12/08/2012 14:32, Andre Oppermann wrote: >>>> > > .. skipped .. > >>> >>> The trouble seems to come from NSFBUFS which is (512 + maxusers * 16) >>> resulting in a kernel map of (512 + 400 * 16) * PAGE_SIZE = 27MB. This >>> seem to be pushing it with the smaller ARM kmap layout. >>> >>> Does it boot and run when you set the tunable kern.ipc.nsfbufs=3500? >>> >>> ARM does have a direct map mode as well which doesn't require the >>> allocation >>> of sfbufs. I'm not sure which other problems that approach has. >>> >> >> >> Only a few (3?) platforms use it. It reduces the size of the user >> address space, and translation between physical addresses and direct map >> addresses is not computationally trivial as it is on other >> architectures, e.g., amd64, ia64. However, it does try to use large >> page mappings. >> >> >>> Hopefully alc@ (added to cc) can answer that and also why the kmap of >>> 27MB >>> manages to wrench the ARM kernel. >>> >> >> >> Arm does not define caps on either the buffer map size (param.h) or the >> kmem map size (vmparam.h). It would probably make sense to copy these >> definitions from i386. > > > Adding caps didn't help. I did some digging and found out that although address range > 0xc0000000 .. 0xffffffff is indeed valid for ARM in general actual KVA space varies for > each specific hardware platform. This "real" KVA is defined by > pair and ifI use them instead of > in init_param2 function my pandaboard successfully boots. Since former pair is used for defining > kernel_map boundaries I believe it should be used for auto tuning as well. OK. Thank you for debugging this on ARM. I'll adjust the auto-tuning code accordingly. -- Andre From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 09:32:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A6593EB1; Tue, 18 Dec 2012 09:32:46 +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 877078FC0A; Tue, 18 Dec 2012 09:32:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBI9Wk2e006464; Tue, 18 Dec 2012 09:32:46 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBI9Wilx006448; Tue, 18 Dec 2012 09:32:44 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201212180932.qBI9Wilx006448@svn.freebsd.org> From: Robert Watson Date: Tue, 18 Dec 2012 09:32:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244390 - in stable/9/contrib/openbsm: . bin bin/audit bin/auditd bin/auditdistd bin/auditfilterd bin/auditreduce bin/praudit bsm compat config etc libauditd libbsm m4 man modules modul... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 09:32:46 -0000 Author: rwatson Date: Tue Dec 18 09:32:44 2012 New Revision: 244390 URL: http://svnweb.freebsd.org/changeset/base/244390 Log: Merge OpenBSM 1.2-alpha3 from head to stable/9, upgrading from the previous OpenBSM 1.1p2: OpenBSM 1.2 alpha 3 - Various minor tweaks to the auditdistd build to make it fit the FreeBSD build environment better. - AUE_WAIT6 merged from FreeBSD 9. OpenBSM 1.2 alpha 2 - auditdistd, a distributed audit trail management daemon, has now been merged. This allows trail files to be securely and reliably synced from audited hosts to an audit server, and employs TLS encryption. Where available, it uses Capsicum to sandbox the service. This work was contributed by Pawel Jakub Dawidek under sponsorship from the FreeBSD Foundation. OpenBSM 1.2 alpha 1 - Add Capsicum-related error numbers for FreeBSD: ENOTCAPABLE, ECAPMODE. - Add Capsicum, process descriptor audit events for FreeBSD. - Allow 0% minspace. - Fixes from the clang static analyser. - Fix expiration of trail files when the host parameter is used. - Various typo fixes. - Support for Solaris privilege and privilege set tokens. - Documentation for getachost(), improvements for getacfilesz(). - Fix a directory descriptor leak that happened when audit trail partitions filled. - Support for more Linux distributions with a partial contemporary endian.h. - Improved escaping of XML-encapsulated BSM. - A variety of minor documentation, style, and functional. A separate commit will merge build changes to enable auditdistd, etc. Obtained from: TrustedBSD Project Sponsored by: The FreeBSD Foundation (auditdistd) Added: stable/9/contrib/openbsm/bin/auditdistd/ - copied from r244360, head/contrib/openbsm/bin/auditdistd/ stable/9/contrib/openbsm/compat/closefrom.h - copied unchanged from r244360, head/contrib/openbsm/compat/closefrom.h stable/9/contrib/openbsm/compat/compat.h - copied unchanged from r244360, head/contrib/openbsm/compat/compat.h stable/9/contrib/openbsm/compat/endian_enc.h - copied unchanged from r244360, head/contrib/openbsm/compat/endian_enc.h stable/9/contrib/openbsm/compat/flopen.h - copied unchanged from r244360, head/contrib/openbsm/compat/flopen.h stable/9/contrib/openbsm/compat/pidfile.h - copied unchanged from r244360, head/contrib/openbsm/compat/pidfile.h stable/9/contrib/openbsm/compat/vis.h - copied unchanged from r244360, head/contrib/openbsm/compat/vis.h stable/9/contrib/openbsm/config/ylwrap - copied unchanged from r244360, head/contrib/openbsm/config/ylwrap stable/9/contrib/openbsm/m4/ - copied from r244360, head/contrib/openbsm/m4/ Modified: stable/9/contrib/openbsm/CREDITS stable/9/contrib/openbsm/INSTALL stable/9/contrib/openbsm/LICENSE stable/9/contrib/openbsm/Makefile.am stable/9/contrib/openbsm/Makefile.in stable/9/contrib/openbsm/NEWS stable/9/contrib/openbsm/README stable/9/contrib/openbsm/TODO stable/9/contrib/openbsm/VERSION stable/9/contrib/openbsm/aclocal.m4 stable/9/contrib/openbsm/autogen.sh stable/9/contrib/openbsm/bin/Makefile.am stable/9/contrib/openbsm/bin/Makefile.in stable/9/contrib/openbsm/bin/audit/Makefile.am stable/9/contrib/openbsm/bin/audit/Makefile.in stable/9/contrib/openbsm/bin/audit/audit.8 stable/9/contrib/openbsm/bin/auditd/Makefile.am stable/9/contrib/openbsm/bin/auditd/Makefile.in stable/9/contrib/openbsm/bin/auditd/auditd.8 stable/9/contrib/openbsm/bin/auditd/auditd.c stable/9/contrib/openbsm/bin/auditfilterd/Makefile.am stable/9/contrib/openbsm/bin/auditfilterd/Makefile.in stable/9/contrib/openbsm/bin/auditreduce/Makefile.am stable/9/contrib/openbsm/bin/auditreduce/Makefile.in stable/9/contrib/openbsm/bin/auditreduce/auditreduce.1 stable/9/contrib/openbsm/bin/praudit/Makefile.am stable/9/contrib/openbsm/bin/praudit/Makefile.in stable/9/contrib/openbsm/bin/praudit/praudit.1 stable/9/contrib/openbsm/bin/praudit/praudit.c stable/9/contrib/openbsm/bsm/Makefile.am stable/9/contrib/openbsm/bsm/Makefile.in stable/9/contrib/openbsm/bsm/auditd_lib.h stable/9/contrib/openbsm/bsm/libbsm.h stable/9/contrib/openbsm/compat/endian.h stable/9/contrib/openbsm/config/config.h stable/9/contrib/openbsm/config/config.h.in stable/9/contrib/openbsm/config/ltmain.sh stable/9/contrib/openbsm/configure stable/9/contrib/openbsm/configure.ac stable/9/contrib/openbsm/etc/audit_control stable/9/contrib/openbsm/etc/audit_event stable/9/contrib/openbsm/libauditd/Makefile.am stable/9/contrib/openbsm/libauditd/Makefile.in stable/9/contrib/openbsm/libauditd/auditd_lib.c stable/9/contrib/openbsm/libbsm/Makefile.am stable/9/contrib/openbsm/libbsm/Makefile.in stable/9/contrib/openbsm/libbsm/au_control.3 stable/9/contrib/openbsm/libbsm/au_fcntl_cmd.3 stable/9/contrib/openbsm/libbsm/au_io.3 stable/9/contrib/openbsm/libbsm/audit_submit.3 stable/9/contrib/openbsm/libbsm/bsm_audit.c stable/9/contrib/openbsm/libbsm/bsm_class.c stable/9/contrib/openbsm/libbsm/bsm_control.c stable/9/contrib/openbsm/libbsm/bsm_errno.c stable/9/contrib/openbsm/libbsm/bsm_io.c stable/9/contrib/openbsm/libbsm/bsm_token.c stable/9/contrib/openbsm/libbsm/bsm_user.c stable/9/contrib/openbsm/libbsm/bsm_wrappers.c stable/9/contrib/openbsm/man/Makefile.am stable/9/contrib/openbsm/man/Makefile.in stable/9/contrib/openbsm/man/audit.log.5 stable/9/contrib/openbsm/man/audit_control.5 stable/9/contrib/openbsm/man/auditon.2 stable/9/contrib/openbsm/man/getaudit.2 stable/9/contrib/openbsm/man/setaudit.2 stable/9/contrib/openbsm/modules/Makefile.am stable/9/contrib/openbsm/modules/Makefile.in stable/9/contrib/openbsm/modules/auditfilter_noop/Makefile.am stable/9/contrib/openbsm/modules/auditfilter_noop/Makefile.in stable/9/contrib/openbsm/sys/Makefile.am stable/9/contrib/openbsm/sys/Makefile.in stable/9/contrib/openbsm/sys/bsm/Makefile.am stable/9/contrib/openbsm/sys/bsm/Makefile.in stable/9/contrib/openbsm/sys/bsm/audit_errno.h stable/9/contrib/openbsm/sys/bsm/audit_internal.h stable/9/contrib/openbsm/sys/bsm/audit_kevents.h stable/9/contrib/openbsm/sys/bsm/audit_record.h stable/9/contrib/openbsm/test/Makefile.am stable/9/contrib/openbsm/test/Makefile.in stable/9/contrib/openbsm/test/bsm/Makefile.am stable/9/contrib/openbsm/test/bsm/Makefile.in stable/9/contrib/openbsm/tools/Makefile.am stable/9/contrib/openbsm/tools/Makefile.in Directory Properties: stable/9/contrib/openbsm/ (props changed) Modified: stable/9/contrib/openbsm/CREDITS ============================================================================== --- stable/9/contrib/openbsm/CREDITS Tue Dec 18 08:44:59 2012 (r244389) +++ stable/9/contrib/openbsm/CREDITS Tue Dec 18 09:32:44 2012 (r244390) @@ -29,6 +29,12 @@ the development of OpenBSM: Stacey Son Todd Heberlein Gary Hoo + Dave Bertouille + Jonathan Anderson + Pawel Jakub Dawidek + Joel Dahl + Ryan Steinmetz + The FreeBSD Foundation In addition, Coverity, Inc.'s Prevent(tm) static analysis tool and Gimpel Software's FlexeLint tool were used to identify a number of bugs in the Modified: stable/9/contrib/openbsm/INSTALL ============================================================================== --- stable/9/contrib/openbsm/INSTALL Tue Dec 18 08:44:59 2012 (r244389) +++ stable/9/contrib/openbsm/INSTALL Tue Dec 18 09:32:44 2012 (r244390) @@ -9,11 +9,17 @@ suppport is found. Typical builds will make If doing development work on OpenBSM with gcc, the following invocation of -configure may be preferred in order to generate full compiler warnings and -force the compile to fail if a warning is found: +configure is preferred in order to generate full compiler warnings and force +the compile to fail if a warning is found: CFLAGS="-Wall -Werror" ./configure +On Linux systems, OpenSSL headers may have to be installed to support +encryption of on-the-wire audit streams using auditdistd; the following +appears to work on Ubuntu: + + sudo apt-get install libssl-dev + To install the library, binaries, and man pages, use: make install Modified: stable/9/contrib/openbsm/LICENSE ============================================================================== --- stable/9/contrib/openbsm/LICENSE Tue Dec 18 08:44:59 2012 (r244389) +++ stable/9/contrib/openbsm/LICENSE Tue Dec 18 09:32:44 2012 (r244390) @@ -2,34 +2,37 @@ OpenBSM Copyrights and Licensing OpenBSM is covered by a number of copyrights, with licenses being either two or three clause BSD licenses. Individual file headers should be consulted -for specific copyrights on specific components. The TrustedBSD Project would -appreciate the contribution of fixes and enhancements under identical or -substantially similar licenses: - - * Copyright (c) - * 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. +for copyrights on specific elements of the distribution. -$P4: //depot/projects/trustedbsd/openbsm/LICENSE#5 $ +The following copyright and license are asserted over the OpenBSM distribution +as a whole: + + Copyright (c) 2005-2012 Robert N.M. Watson + 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. + +The TrustedBSD Project would appreciate the contribution of fixes and +enhancements under an identical license in order to avoid potentially +confusing license proliferation. + +$P4: //depot/projects/trustedbsd/openbsm/LICENSE#6 $ Modified: stable/9/contrib/openbsm/Makefile.am ============================================================================== --- stable/9/contrib/openbsm/Makefile.am Tue Dec 18 08:44:59 2012 (r244389) +++ stable/9/contrib/openbsm/Makefile.am Tue Dec 18 09:32:44 2012 (r244390) @@ -1,6 +1,6 @@ -# -# $P4: //depot/projects/trustedbsd/openbsm/Makefile.am#4 $ -# +## +## $P4: //depot/projects/trustedbsd/openbsm/Makefile.am#5 $ +## SUBDIRS = \ bsm @@ -17,6 +17,7 @@ SUBDIRS += \ modules \ sys +ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = \ CHANGELOG \ Modified: stable/9/contrib/openbsm/Makefile.in ============================================================================== --- stable/9/contrib/openbsm/Makefile.in Tue Dec 18 08:44:59 2012 (r244389) +++ stable/9/contrib/openbsm/Makefile.in Tue Dec 18 09:32:44 2012 (r244390) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,14 +13,28 @@ # PARTICULAR PURPOSE. @SET_MAKE@ - -# -# $P4: //depot/projects/trustedbsd/openbsm/Makefile.in#10 $ -# VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c @@ -40,10 +54,14 @@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(top_srcdir)/config/config.h.in \ - $(top_srcdir)/configure INSTALL NEWS TODO config/config.guess \ - config/config.sub config/depcomp config/install-sh \ - config/ltmain.sh config/missing + $(srcdir)/Makefile.in $(top_srcdir)/config/config.guess \ + $(top_srcdir)/config/config.h.in \ + $(top_srcdir)/config/config.sub \ + $(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \ + $(top_srcdir)/config/missing $(top_srcdir)/configure INSTALL \ + NEWS TODO config/config.guess config/config.sub config/depcomp \ + config/install-sh config/ltmain.sh config/missing \ + config/ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -53,6 +71,7 @@ am__CONFIG_DISTCLEAN_FILES = config.stat mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config/config.h CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ @@ -62,21 +81,61 @@ RECURSIVE_TARGETS = all-recursive check- install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + cscope distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags +CSCOPE = cscope DIST_SUBDIRS = bsm libauditd libbsm bin man modules sys DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best +DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -90,45 +149,52 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MIG = @MIG@ MKDIR_P = @MKDIR_P@ +NM = @NM@ NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ @@ -137,13 +203,15 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -190,6 +258,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = bsm $(am__append_1) libbsm bin man modules sys +ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = \ CHANGELOG \ LICENSE \ @@ -200,21 +269,21 @@ EXTRA_DIST = \ all: all-recursive .SUFFIXES: -am--refresh: +am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ - cd $(srcdir) && $(AUTOMAKE) --foreign \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -230,21 +299,20 @@ $(top_builddir)/config.status: $(top_src $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) + $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): config/config.h: config/stamp-h1 - @if test ! -f $@; then \ - rm -f config/stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) config/stamp-h1; \ - else :; fi + @if test ! -f $@; then rm -f config/stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) config/stamp-h1; else :; fi config/stamp-h1: $(top_srcdir)/config/config.h.in $(top_builddir)/config.status @rm -f config/stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config/config.h $(top_srcdir)/config/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f config/stamp-h1 touch $@ @@ -258,16 +326,16 @@ clean-libtool: -rm -rf .libs _libs distclean-libtool: - -rm -f libtool + -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -276,7 +344,11 @@ $(RECURSIVE_TARGETS): done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -284,50 +356,23 @@ $(RECURSIVE_TARGETS): else \ local_target="$$target"; \ fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done +cscopelist-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -335,14 +380,14 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ + set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ @@ -354,7 +399,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCE list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -363,36 +408,65 @@ TAGS: tags-recursive $(HEADERS) $(SOURCE done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) + +clean-cscope: + -rm -f cscope.files + +cscope.files: clean-cscope cscopelist-recursive cscopelist + +cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) - test -d $(distdir) || mkdir $(distdir) + test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -408,66 +482,84 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ + am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) + || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) + $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) + $(am__post_remove_distdir) -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another @@ -475,26 +567,31 @@ dist dist-all: distdir distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod a+w $(distdir) + chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ @@ -515,14 +612,24 @@ distcheck: dist && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ @@ -553,16 +660,22 @@ install-am: all-am installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -583,6 +696,8 @@ dvi-am: html: html-recursive +html-am: + info: info-recursive info-am: @@ -591,18 +706,28 @@ install-data-am: install-dvi: install-dvi-recursive +install-dvi-am: + install-exec-am: install-html: install-html-recursive +install-html-am: + install-info: install-info-recursive +install-info-am: + install-man: install-pdf: install-pdf-recursive +install-pdf-am: + install-ps: install-ps-recursive +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-recursive @@ -625,24 +750,27 @@ ps-am: uninstall-am: -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \ + cscopelist-recursive ctags-recursive install-am install-strip \ + tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-generic \ - clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ - dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \ - distclean distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am + all all-am am--refresh check check-am clean clean-cscope \ + clean-generic clean-libtool cscope cscopelist \ + cscopelist-recursive ctags ctags-recursive dist dist-all \ + dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ dist-xz \ + dist-zip distcheck distclean distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. Modified: stable/9/contrib/openbsm/NEWS ============================================================================== --- stable/9/contrib/openbsm/NEWS Tue Dec 18 08:44:59 2012 (r244389) +++ stable/9/contrib/openbsm/NEWS Tue Dec 18 09:32:44 2012 (r244390) @@ -1,5 +1,36 @@ OpenBSM Version History +OpenBSM 1.2 alpha 3 + +- Various minor tweaks to the auditdistd build to make it fit the FreeBSD + build environment better. +- AUE_WAIT6 merged from FreeBSD 9. + +OpenBSM 1.2 alpha 2 + +- auditdistd, a distributed audit trail management daemon, has now been + merged. This allows trail files to be securely and reliably synced from + audited hosts to an audit server, and employs TLS encryption. Where + available, it uses Capsicum to sandbox the service. This work was + contributed by Pawel Jakub Dawidek under sponsorship from the FreeBSD + Foundation. + +OpenBSM 1.2 alpha 1 + +- Add Capsicum-related error numbers for FreeBSD: ENOTCAPABLE, ECAPMODE. +- Add Capsicum, process descriptor audit events for FreeBSD. +- Allow 0% minspace. +- Fixes from the clang static analyser. +- Fix expiration of trail files when the host parameter is used. +- Various typo fixes. +- Support for Solaris privilege and privilege set tokens. +- Documentation for getachost(), improvements for getacfilesz(). +- Fix a directory descriptor leak that happened when audit trail partitions + filled. +- Support for more Linux distributions with a partial contemporary endian.h. +- Improved escaping of XML-encapsulated BSM. +- A variety of minor documentation, style, and functional. + OpenBSM 1.1p2 - Fix audit_event definitions of AUE_OPENAT_RWT and AUE_OPENAT_RWTC. @@ -464,4 +495,4 @@ OpenBSM 1.0 alpha 1 to support reloading of kernel event table. - Allow comments in /etc/security configuration files. -$P4: //depot/projects/trustedbsd/openbsm/NEWS#43 $ +$P4: //depot/projects/trustedbsd/openbsm/NEWS#55 $ Modified: stable/9/contrib/openbsm/README ============================================================================== --- stable/9/contrib/openbsm/README Tue Dec 18 08:44:59 2012 (r244389) +++ stable/9/contrib/openbsm/README Tue Dec 18 09:32:44 2012 (r244390) @@ -1,4 +1,4 @@ -OpenBSM 1.1p2 +OpenBSM 1.2a2 Introduction @@ -38,6 +38,7 @@ The following programs are included with audit Command line audit control tool auditd Audit management daemon + auditdistd Audit trail distribution daemon auditfilterd Experimental event monitoring framework auditreduce Audit trail reduction tool audump Debugging tool to parse and print audit databases @@ -64,4 +65,4 @@ Information on TrustedBSD may be found o http://www.TrustedBSD.org/ -$P4: //depot/projects/trustedbsd/openbsm/README#37 $ +$P4: //depot/projects/trustedbsd/openbsm/README#41 $ Modified: stable/9/contrib/openbsm/TODO ============================================================================== --- stable/9/contrib/openbsm/TODO Tue Dec 18 08:44:59 2012 (r244389) +++ stable/9/contrib/openbsm/TODO Tue Dec 18 09:32:44 2012 (r244390) @@ -21,5 +21,7 @@ OpenBSM TODO alternative locations can be used. - NLS support for au_strerror(3), which provides error strings for BSM errors not available on the local OS platform. +- Support for client certificates in auditdistd, to include certificate chain + validation. -$P4: //depot/projects/trustedbsd/openbsm/TODO#13 $ +$P4: //depot/projects/trustedbsd/openbsm/TODO#14 $ Modified: stable/9/contrib/openbsm/VERSION ============================================================================== --- stable/9/contrib/openbsm/VERSION Tue Dec 18 08:44:59 2012 (r244389) +++ stable/9/contrib/openbsm/VERSION Tue Dec 18 09:32:44 2012 (r244390) @@ -1 +1 @@ -OPENBSM_1_1p2 +OPENBSM_1_2_alpha3 Modified: stable/9/contrib/openbsm/aclocal.m4 ============================================================================== --- stable/9/contrib/openbsm/aclocal.m4 Tue Dec 18 08:44:59 2012 (r244389) +++ stable/9/contrib/openbsm/aclocal.m4 Tue Dec 18 09:32:44 2012 (r244390) @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10.1 -*- Autoconf -*- +# generated automatically by aclocal 1.12.2 -*- Autoconf -*- + +# Copyright (C) 1996-2012 Free Software Foundation, Inc. -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,108 +13,206 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(AC_AUTOCONF_VERSION, [2.62],, -[m4_warning([this file was generated for autoconf 2.62. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 09:50:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BAD2E4E4; Tue, 18 Dec 2012 09:50:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8D00A8FC14; Tue, 18 Dec 2012 09:50:47 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 1BB6046B06; Tue, 18 Dec 2012 04:50:47 -0500 (EST) Date: Tue, 18 Dec 2012 09:50:46 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Andrey Zonov Subject: Re: svn commit: r244383 - head/etc In-Reply-To: <201212180727.qBI7Rp0t084371@svn.freebsd.org> Message-ID: References: <201212180727.qBI7Rp0t084371@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 09:50:47 -0000 On Tue, 18 Dec 2012, Andrey Zonov wrote: > Author: zont > Date: Tue Dec 18 07:27:50 2012 > New Revision: 244383 > URL: http://svnweb.freebsd.org/changeset/base/244383 > > Log: > - Set memorylocked limit to 64Kb for default login class. > This prevents unprivileged users to lock too much memory. > - Set memorylocked limit to 64Mb for daemon login class. > Some daemons such as amd(8) and watchdogd(8) calls mlockall(2) on > startup, they are run from init(8) which uses daemon login class. > - Set memorylocked limit to unlimited for root login class. > > Suggested by: avg > Approved by: kib (mentor) > MFC after: 1 week I think you should not MFC this one quickly -- let's wait for it to shake out in the -CURRENT userbase for a few months to see what breaks. I wouldn't be surprised if a fair number of applications (both publicly available, and local at various FreeBSD-using shops) are implicitly depending on their not being limits to memorylocked by default. After an upgrade, they might find that their applications simply stop working for potentially hard-to-debug reasons. Or we might find no one notices -- but deferring an MFC will help give us a better sense of which outcome is more likely. Robert > > Modified: > head/etc/login.conf > > Modified: head/etc/login.conf > ============================================================================== > --- head/etc/login.conf Tue Dec 18 07:26:55 2012 (r244382) > +++ head/etc/login.conf Tue Dec 18 07:27:50 2012 (r244383) > @@ -32,7 +32,7 @@ default:\ > :cputime=unlimited:\ > :datasize=unlimited:\ > :stacksize=unlimited:\ > - :memorylocked=unlimited:\ > + :memorylocked=64K:\ > :memoryuse=unlimited:\ > :filesize=unlimited:\ > :coredumpsize=unlimited:\ > @@ -59,6 +59,7 @@ xuser:\ > staff:\ > :tc=default: > daemon:\ > + :memorylocked=64M:\ > :tc=default: > news:\ > :tc=default: > @@ -72,6 +73,7 @@ dialer:\ > # in preference to 'default'. > root:\ > :ignorenologin:\ > + :memorylocked=unlimited:\ > :tc=default: > > # > From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 09:51:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 44B2573A; Tue, 18 Dec 2012 09:51:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 160098FC14; Tue, 18 Dec 2012 09:51:47 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id B1F0A46B35; Tue, 18 Dec 2012 04:51:46 -0500 (EST) Date: Tue, 18 Dec 2012 09:51:46 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Andrey Zonov Subject: Re: svn commit: r244383 - head/etc In-Reply-To: Message-ID: References: <201212180727.qBI7Rp0t084371@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 09:51:47 -0000 On Tue, 18 Dec 2012, Robert Watson wrote: >> Log: >> - Set memorylocked limit to 64Kb for default login class. >> This prevents unprivileged users to lock too much memory. >> - Set memorylocked limit to 64Mb for daemon login class. >> Some daemons such as amd(8) and watchdogd(8) calls mlockall(2) on >> startup, they are run from init(8) which uses daemon login class. >> - Set memorylocked limit to unlimited for root login class. >> >> Suggested by: avg >> Approved by: kib (mentor) >> MFC after: 1 week > > I think you should not MFC this one quickly -- let's wait for it to shake out > in the -CURRENT userbase for a few months to see what breaks. I wouldn't be > surprised if a fair number of applications (both publicly available, and > local at various FreeBSD-using shops) are implicitly depending on their not > being limits to memorylocked by default. After an upgrade, they might find > that their applications simply stop working for potentially hard-to-debug > reasons. > > Or we might find no one notices -- but deferring an MFC will help give us a > better sense of which outcome is more likely. ... or maybe this doesn't matter before your later sysctl commit? Robert > > Robert > >> >> Modified: >> head/etc/login.conf >> >> Modified: head/etc/login.conf >> ============================================================================== >> --- head/etc/login.conf Tue Dec 18 07:26:55 2012 (r244382) >> +++ head/etc/login.conf Tue Dec 18 07:27:50 2012 (r244383) >> @@ -32,7 +32,7 @@ default:\ >> :cputime=unlimited:\ >> :datasize=unlimited:\ >> :stacksize=unlimited:\ >> - :memorylocked=unlimited:\ >> + :memorylocked=64K:\ >> :memoryuse=unlimited:\ >> :filesize=unlimited:\ >> :coredumpsize=unlimited:\ >> @@ -59,6 +59,7 @@ xuser:\ >> staff:\ >> :tc=default: >> daemon:\ >> + :memorylocked=64M:\ >> :tc=default: >> news:\ >> :tc=default: >> @@ -72,6 +73,7 @@ dialer:\ >> # in preference to 'default'. >> root:\ >> :ignorenologin:\ >> + :memorylocked=unlimited:\ >> :tc=default: >> >> # >> > From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 10:08:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A1139CB8; Tue, 18 Dec 2012 10:08:01 +0000 (UTC) (envelope-from alc@rice.edu) Received: from mh11.mail.rice.edu (mh11.mail.rice.edu [128.42.199.30]) by mx1.freebsd.org (Postfix) with ESMTP id 6574D8FC12; Tue, 18 Dec 2012 10:08:01 +0000 (UTC) Received: from mh11.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh11.mail.rice.edu (Postfix) with ESMTP id 6F96B4C050A; Tue, 18 Dec 2012 03:59:33 -0600 (CST) Received: from mh11.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh11.mail.rice.edu (Postfix) with ESMTP id 6DE164C0501; Tue, 18 Dec 2012 03:59:33 -0600 (CST) X-Virus-Scanned: by amavis-2.7.0 at mh11.mail.rice.edu, auth channel Received: from mh11.mail.rice.edu ([127.0.0.1]) by mh11.mail.rice.edu (mh11.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id Cm9SGs536314; Tue, 18 Dec 2012 03:59:33 -0600 (CST) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh11.mail.rice.edu (Postfix) with ESMTPSA id E0F704C0233; Tue, 18 Dec 2012 03:59:32 -0600 (CST) Message-ID: <50D03E83.8060908@rice.edu> Date: Tue, 18 Dec 2012 03:59:31 -0600 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Oleksandr Tymoshenko Subject: Re: svn commit: r243631 - in head/sys: kern sys References: <201211272119.qARLJxXV061083@svn.freebsd.org> <50C1BC90.90106@freebsd.org> <50C25A27.4060007@bluezbox.com> <50C26331.6030504@freebsd.org> <50C26AE9.4020600@bluezbox.com> <50C3A3D3.9000804@freebsd.org> <50C3AF72.4010902@rice.edu> <330405A1-312A-45A5-BB86-4969478D8BBD@bluezbox.com> In-Reply-To: <330405A1-312A-45A5-BB86-4969478D8BBD@bluezbox.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 10:08:01 -0000 On 12/17/2012 23:40, Oleksandr Tymoshenko wrote: > On 2012-12-08, at 1:21 PM, Alan Cox wrote: > >> On 12/08/2012 14:32, Andre Oppermann wrote: > .. skipped .. > >>> The trouble seems to come from NSFBUFS which is (512 + maxusers * 16) >>> resulting in a kernel map of (512 + 400 * 16) * PAGE_SIZE = 27MB. This >>> seem to be pushing it with the smaller ARM kmap layout. >>> >>> Does it boot and run when you set the tunable kern.ipc.nsfbufs=3500? >>> >>> ARM does have a direct map mode as well which doesn't require the >>> allocation >>> of sfbufs. I'm not sure which other problems that approach has. >>> >> >> Only a few (3?) platforms use it. It reduces the size of the user >> address space, and translation between physical addresses and direct map >> addresses is not computationally trivial as it is on other >> architectures, e.g., amd64, ia64. However, it does try to use large >> page mappings. >> >> >>> Hopefully alc@ (added to cc) can answer that and also why the kmap of >>> 27MB >>> manages to wrench the ARM kernel. >>> >> >> Arm does not define caps on either the buffer map size (param.h) or the >> kmem map size (vmparam.h). It would probably make sense to copy these >> definitions from i386. > > Adding caps didn't help. I did some digging and found out that although address range > 0xc0000000 .. 0xffffffff is indeed valid for ARM in general actual KVA space varies for > each specific hardware platform. This "real" KVA is defined by > pair and ifI use them instead of > in init_param2 function my pandaboard successfully boots. Since former pair is used for defining > kernel_map boundaries I believe it should be used for auto tuning as well. That makes sense. However, "virtual_avail" isn't the start of the kernel address space. The kernel map always starts at VM_MIN_KERNEL_ADDRESS. (See kmem_init().) "virtual_avail" represents the next unallocated virtual address in the kernel address space at an early point in initialization. "virtual_avail" and "virtual_end" aren't used after that, or outside the VM system. Please use vm_map_min(kernel_map) and vm_map_max(kernel_map) instead. That said, I would still add caps on the buffer map and kmem map size. As memory sizes on arm systems grow, you'll eventually need them, just like we did on i386. Alan From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 10:24:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 68BAA11D; Tue, 18 Dec 2012 10:24:00 +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 4BAF48FC14; Tue, 18 Dec 2012 10:24:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIAO0GJ017374; Tue, 18 Dec 2012 10:24:00 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIANx97017356; Tue, 18 Dec 2012 10:23:59 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201212181023.qBIANx97017356@svn.freebsd.org> From: Robert Watson Date: Tue, 18 Dec 2012 10:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244391 - in stable/9/sys: bsm security/audit X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 10:24:00 -0000 Author: rwatson Date: Tue Dec 18 10:23:58 2012 New Revision: 244391 URL: http://svnweb.freebsd.org/changeset/base/244391 Log: Merge r243751 from head to stable/9: Merge OpenBSM 1.2-alpha2 changes from contrib/openbsm to src/sys/{bsm,security/audit}. There are a few tweaks to help with the FreeBSD build environment that will be merged back to OpenBSM. No significant functional changes appear on the kernel side. Obtained from: TrustedBSD Project Sponsored by: The FreeBSD Foundation (auditdistd) Modified: stable/9/sys/bsm/audit_errno.h stable/9/sys/bsm/audit_internal.h stable/9/sys/bsm/audit_record.h stable/9/sys/security/audit/audit_bsm_errno.c stable/9/sys/security/audit/audit_bsm_token.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/bsm/audit_errno.h ============================================================================== --- stable/9/sys/bsm/audit_errno.h Tue Dec 18 09:32:44 2012 (r244390) +++ stable/9/sys/bsm/audit_errno.h Tue Dec 18 10:23:58 2012 (r244391) @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#5 + * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#7 * $FreeBSD$ */ Modified: stable/9/sys/bsm/audit_internal.h ============================================================================== --- stable/9/sys/bsm/audit_internal.h Tue Dec 18 09:32:44 2012 (r244390) +++ stable/9/sys/bsm/audit_internal.h Tue Dec 18 10:23:58 2012 (r244391) @@ -15,7 +15,7 @@ * 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. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -30,7 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_internal.h#5 + * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_internal.h#6 * $FreeBSD$ */ Modified: stable/9/sys/bsm/audit_record.h ============================================================================== --- stable/9/sys/bsm/audit_record.h Tue Dec 18 09:32:44 2012 (r244390) +++ stable/9/sys/bsm/audit_record.h Tue Dec 18 10:23:58 2012 (r244391) @@ -234,6 +234,7 @@ token_t *au_to_ipc_perm(struct ipc_perm token_t *au_to_iport(uint16_t iport); token_t *au_to_opaque(const char *data, uint16_t bytes); token_t *au_to_path(const char *path); +token_t *au_to_privset(char *privtypestr, char *privstr); token_t *au_to_process(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid); token_t *au_to_process32(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, @@ -279,6 +280,7 @@ token_t *au_to_exec_env(char **envp); token_t *au_to_text(const char *text); token_t *au_to_kevent(struct kevent *kev); token_t *au_to_trailer(int rec_size); +token_t *au_to_upriv(char sorf, char *priv); token_t *au_to_zonename(const char *zonename); /* Modified: stable/9/sys/security/audit/audit_bsm_errno.c ============================================================================== --- stable/9/sys/security/audit/audit_bsm_errno.c Tue Dec 18 09:32:44 2012 (r244390) +++ stable/9/sys/security/audit/audit_bsm_errno.c Tue Dec 18 10:23:58 2012 (r244391) @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#18 + * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#22 */ #include @@ -494,7 +494,7 @@ static const struct bsm_errno bsm_errnos #ifdef EPROCUNAVAIL EPROCUNAVAIL, #else - ERRNO_NO_LOCAL_MAPPING + ERRNO_NO_LOCAL_MAPPING, #endif ES("Bad procedure for program") }, { BSM_ERRNO_EFTYPE, @@ -666,7 +666,7 @@ static const struct bsm_errno bsm_errnos #endif ES("Required key not available") }, { BSM_ERRNO_EKEYEXPIRED, -#ifdef EKEEXPIRED +#ifdef EKEYEXPIRED EKEYEXPIRED, #else ERRNO_NO_LOCAL_MAPPING, @@ -680,7 +680,7 @@ static const struct bsm_errno bsm_errnos #endif ES("Key has been revoked") }, { BSM_ERRNO_EKEYREJECTED, -#ifdef EKEREJECTED +#ifdef EKEYREJECTED EKEYREJECTED, #else ERRNO_NO_LOCAL_MAPPING, Modified: stable/9/sys/security/audit/audit_bsm_token.c ============================================================================== --- stable/9/sys/security/audit/audit_bsm_token.c Tue Dec 18 09:32:44 2012 (r244390) +++ stable/9/sys/security/audit/audit_bsm_token.c Tue Dec 18 10:23:58 2012 (r244391) @@ -30,7 +30,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#93 + * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#99 */ #include @@ -68,6 +68,57 @@ __FBSDID("$FreeBSD$"); /* * token ID 1 byte + * success/failure 1 byte + * privstrlen 2 bytes + * privstr N bytes + 1 (\0 byte) + */ +token_t * +au_to_upriv(char sorf, char *priv) +{ + u_int16_t textlen; + u_char *dptr; + token_t *t; + + textlen = strlen(priv) + 1; + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_char) + + sizeof(u_int16_t) + textlen); + + ADD_U_CHAR(dptr, AUT_UPRIV); + ADD_U_CHAR(dptr, sorf); + ADD_U_INT16(dptr, textlen); + ADD_STRING(dptr, priv, textlen); + return (t); +} + +/* + * token ID 1 byte + * privtstrlen 2 bytes + * privtstr N bytes + 1 + * privstrlen 2 bytes + * privstr N bytes + 1 + */ +token_t * +au_to_privset(char *privtypestr, char *privstr) +{ + u_int16_t type_len, priv_len; + u_char *dptr; + token_t *t; + + type_len = strlen(privtypestr) + 1; + priv_len = strlen(privstr) + 1; + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int16_t) + + sizeof(u_int16_t) + type_len + priv_len); + + ADD_U_CHAR(dptr, AUT_PRIV); + ADD_U_INT16(dptr, type_len); + ADD_STRING(dptr, privtypestr, type_len); + ADD_U_INT16(dptr, priv_len); + ADD_STRING(dptr, privstr, priv_len); + return (t); +} + +/* + * token ID 1 byte * argument # 1 byte * argument value 4 bytes/8 bytes (32-bit/64-bit value) * text length 2 bytes @@ -1204,9 +1255,9 @@ au_to_me(void) auinfo.ai_asid, &auinfo.ai_termid)); } else { /* getaudit_addr(2) failed for some other reason. */ - return (NULL); + return (NULL); } - } + } return (au_to_subject32_ex(aia.ai_auid, geteuid(), getegid(), getuid(), getgid(), getpid(), aia.ai_asid, &aia.ai_termid)); @@ -1438,7 +1489,7 @@ au_to_header32_ex_tm(int rec_size, au_ev ADD_U_INT32(dptr, tm.tv_sec); ADD_U_INT32(dptr, timems); /* We need time in ms. */ - return (t); + return (t); } token_t * From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 10:29:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1238C332; Tue, 18 Dec 2012 10:29:29 +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 EA0448FC15; Tue, 18 Dec 2012 10:29:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIATSlg018325; Tue, 18 Dec 2012 10:29:28 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIATSC2018324; Tue, 18 Dec 2012 10:29:28 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201212181029.qBIATSC2018324@svn.freebsd.org> From: Robert Watson Date: Tue, 18 Dec 2012 10:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244392 - stable/9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 10:29:29 -0000 Author: rwatson Date: Tue Dec 18 10:29:28 2012 New Revision: 244392 URL: http://svnweb.freebsd.org/changeset/base/244392 Log: Merge r243798 from head to stable/9: Add auditdistd to the pre-install required uid check list. Modified: stable/9/Makefile.inc1 (contents, props changed) Directory Properties: stable/9/ (props changed) Modified: stable/9/Makefile.inc1 ============================================================================== --- stable/9/Makefile.inc1 Tue Dec 18 10:23:58 2012 (r244391) +++ stable/9/Makefile.inc1 Tue Dec 18 10:29:28 2012 (r244392) @@ -600,7 +600,7 @@ installcheck_DESTDIR: # # Check for missing UIDs/GIDs. # -CHECK_UIDS= +CHECK_UIDS= auditdistd CHECK_GIDS= audit .if ${MK_SENDMAIL} != "no" CHECK_UIDS+= smmsp From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 10:34:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA75B573; Tue, 18 Dec 2012 10:34:18 +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 9541C8FC14; Tue, 18 Dec 2012 10:34:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIAYIJc019206; Tue, 18 Dec 2012 10:34:18 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIAYIpN019205; Tue, 18 Dec 2012 10:34:18 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201212181034.qBIAYIpN019205@svn.freebsd.org> From: Robert Watson Date: Tue, 18 Dec 2012 10:34:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244393 - stable/9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 10:34:18 -0000 Author: rwatson Date: Tue Dec 18 10:34:18 2012 New Revision: 244393 URL: http://svnweb.freebsd.org/changeset/base/244393 Log: Merge r243800 from head to stable/9: Specifically point at the Handbook instructions for world updates in UPDATING by URL. As there has been some confusion over the need to run "mergemaster -p", part of our standard upgrade procedure, following the recent addition of an "auditdistd" user, add a note about it to UPDATING explicitly. Modified: stable/9/UPDATING (contents, props changed) Directory Properties: stable/9/ (props changed) Modified: stable/9/UPDATING ============================================================================== --- stable/9/UPDATING Tue Dec 18 10:29:28 2012 (r244392) +++ stable/9/UPDATING Tue Dec 18 10:34:18 2012 (r244393) @@ -4,11 +4,18 @@ This file is maintained and copyrighted See end of file for further details. For commonly done items, please see the COMMON ITEMS: section later in the file. These instructions assume that you basically know what you are doing. If not, then please consult the FreeBSD -handbook. +handbook: + + http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20121218: + With the addition of auditdistd(8), a new auditdistd user is now + depended on during installworld. "mergemaster -p" can be used to add + the user prior to installworld, as documented in the handbook. + 20121205: 9.1-RELEASE. From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 11:30:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7406E53A; Tue, 18 Dec 2012 11:30:55 +0000 (UTC) (envelope-from monthadar@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 599FF8FC15; Tue, 18 Dec 2012 11:30:54 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id u54so241148wey.13 for ; Tue, 18 Dec 2012 03:30:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Nr1VNdXAjRpcrBbPQcKUc3+pGBW9Y8pa/BNOY+W1f28=; b=uQba1VbA2PaJUYHwB2S5cnAuSyh45wg6G4fu+aCK5gV18g8vKhD5dmftUj7P/gClMg Q5oDsrcu7UvWbf4pANmM+nVhreB7R/p7hD5rr0f9EGqvyH12YL5Ned08xXpwKf/g5Z1g wTY/iO1rLqetZEY7j8lFjDYwn88Ioan1pZ0ZlrRwrkCQs86MdVKn91z48dPXRvwCrzIX 95ma3vnHmpVUd8FMqKunWzL5ATwAq2VvjVOilksHBLex2nq1a+chL/nV10wYKuqugmvh zzW/5o+4OTy/WpVqetsmsJ2U7Br7t/XAUkT75c2NxKThvTXbiaPnvAvjumbfbhnvki2W b9gQ== MIME-Version: 1.0 Received: by 10.180.97.68 with SMTP id dy4mr3576959wib.7.1355830253188; Tue, 18 Dec 2012 03:30:53 -0800 (PST) Received: by 10.227.59.19 with HTTP; Tue, 18 Dec 2012 03:30:53 -0800 (PST) In-Reply-To: <20121218085306.GK94420@FreeBSD.org> References: <201212180844.qBI8ixdX097633@svn.freebsd.org> <20121218085306.GK94420@FreeBSD.org> Date: Tue, 18 Dec 2012 12:30:53 +0100 Message-ID: Subject: Re: svn commit: r244389 - head/sys/dev/wtap From: Monthadar Al Jaberi To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 Cc: Monthadar Al Jaberi , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 11:30:55 -0000 On Tue, Dec 18, 2012 at 9:53 AM, Gleb Smirnoff wrote: > Monthadar, > > On Tue, Dec 18, 2012 at 08:44:59AM +0000, Monthadar Al Jaberi wrote: > M> Author: monthadar > M> Date: Tue Dec 18 08:44:59 2012 > M> New Revision: 244389 > M> URL: http://svnweb.freebsd.org/changeset/base/244389 > M> > M> Log: > M> wtap should check if ieee80211_vap_setup fails. > M> > M> * If ieee80211_vap_setup fails, we free allocated M_80211_VAP > M> memory and return NULL; > M> > M> Approved by: adrian (mentor) > M> > M> Modified: > M> head/sys/dev/wtap/if_wtap.c > M> > M> Modified: head/sys/dev/wtap/if_wtap.c > M> ============================================================================== > M> --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:41:23 2012 (r244388) > M> +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:44:59 2012 (r244389) > M> @@ -334,6 +334,10 @@ wtap_vap_create(struct ieee80211com *ic, > M> vap = (struct ieee80211vap *) avp; > M> error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, > M> flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); > M> + if (error) { > M> + free((struct wtap_vap*) vap, M_80211_VAP); > M> + return NULL; > M> + } > M> > M> /* override various methods */ > M> avp->av_recv_mgmt = vap->iv_recv_mgmt; > > You don't need to cast first argument of free(9). And you don't need a cast > before malloc(9) as well. > > If you are calling malloc(9) with M_NOWAIT, you need to check return result. > > Also, more stylish would be to supply to free() the same variable that was > assigned at malloc(9) call, in this particular case it is "avp". > > Patch attached. Thank you for the patch, I can commit it for you, if you havn't done it yet? br, > > -- > Totus tuus, Glebius. -- Monthadar Al Jaberi From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 12:36:18 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EC1E0C2E for ; Tue, 18 Dec 2012 12:36:18 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 4E2508FC15 for ; Tue, 18 Dec 2012 12:36:18 +0000 (UTC) Received: (qmail 23563 invoked from network); 18 Dec 2012 14:04:07 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 18 Dec 2012 14:04:07 -0000 Message-ID: <50D06340.5020904@freebsd.org> Date: Tue, 18 Dec 2012 13:36:16 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Andriy Gapon Subject: Re: svn commit: r244112 - head/sys/kern References: <201212110708.qBB78EWx025288@svn.freebsd.org> <50CBC285.7060307@mu.org> <20121215161414.V1029@besplex.bde.org> <201212171439.27297.jhb@freebsd.org> <50CF8CE7.4020906@mu.org> <50CF92F0.5020904@FreeBSD.org> <50CF98DB.1050102@FreeBSD.org> In-Reply-To: <50CF98DB.1050102@FreeBSD.org> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, Adrian Chadd , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 12:36:19 -0000 On 17.12.2012 23:12, Andriy Gapon wrote: > on 18/12/2012 00:02 Adrian Chadd said the following: >> Why are they there, if we just ship production releases with >> INVARIANTS disabled? > > Because there is an axis orthogonal to asserting correctness - performance. Indeed. There are, or will be, a couple of very intrusive and expensive mbuf and socket buffer integrity checks under KASSERT/INVARIANTS that are not appropriate and performance reducing for productions kernels. The same goes for UMA memory fuzzing. I've always used and placed KASSERTs with this assumption. I do have some sympathy for a certain run-time KASSERT() check that will print a backtrace but won't panic. However it is a distinct class from what we have now and needs to be explicitly placed by the programmer to make sense with the logic around it. -- Andre From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 12:37:53 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 915DCE97 for ; Tue, 18 Dec 2012 12:37:53 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id EED338FC16 for ; Tue, 18 Dec 2012 12:37:52 +0000 (UTC) Received: (qmail 23539 invoked from network); 18 Dec 2012 13:59:01 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 18 Dec 2012 13:59:01 -0000 Message-ID: <50D0620D.7080808@freebsd.org> Date: Tue, 18 Dec 2012 13:31:09 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Gleb Smirnoff Subject: Re: svn commit: r244387 - head/sys/netinet References: <201212180814.qBI8EGfe092798@svn.freebsd.org> <20121218082438.GJ94420@FreeBSD.org> In-Reply-To: <20121218082438.GJ94420@FreeBSD.org> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, ae@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 12:37:53 -0000 On 18.12.2012 09:24, Gleb Smirnoff wrote: > Andrey, > > On Tue, Dec 18, 2012 at 08:14:16AM +0000, Gleb Smirnoff wrote: > T> Author: glebius > T> Date: Tue Dec 18 08:14:16 2012 > T> New Revision: 244387 > T> URL: http://svnweb.freebsd.org/changeset/base/244387 > T> > T> Log: > T> Fix !INET6 build after r244365. > T> > T> Modified: > T> head/sys/netinet/tcp_input.c > T> > > At review stage of the r242079 I have noted, that more effort should > be put into mbuf flags prior to this change: > > - cleanse deprecated mbuf flags (at least M_FREELIST) > - move 90% of mbuf flags to pkthdr flags Please do not commit these two steps immediately to HEAD. Ask for review first. > - not utilize protocol specific flag, but use a global one > to mark packet as having forward tag Nope, please don't. It's protocol specific and should stay there. -- Andre > Several of the fallouts from r242079 could be avoided. > > IMHO, if anyone is hacking on a new feature or optimisation and > encounters a "bad code" (tm), he/she should remove the bad code from > his/her way and not leave it to be worked on sometime later, which > usually ends up in never. This approach adds more work before the > feature/optimisation is commited, but reduces probability of problems > after commit and thus amount of urgent work after commit. > > P.S. Please do not take above ranting paragraph as personal critics > of yourself, this is just thinking out loud on how things should be > done :) > > T> Modified: head/sys/netinet/tcp_input.c > T> ============================================================================== > T> --- head/sys/netinet/tcp_input.c Tue Dec 18 08:09:44 2012 (r244386) > T> +++ head/sys/netinet/tcp_input.c Tue Dec 18 08:14:16 2012 (r244387) > T> @@ -780,8 +780,17 @@ findpcb: > T> /* > T> * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. > T> */ > T> - if ((isipv6 && (m->m_flags & M_IP6_NEXTHOP)) || > T> - (!isipv6 && (m->m_flags & M_IP_NEXTHOP))) > T> + if ( > T> +#ifdef INET6 > T> + (isipv6 && (m->m_flags & M_IP6_NEXTHOP)) > T> +#ifdef INET > T> + || (!isipv6 && (m->m_flags & M_IP_NEXTHOP)) > T> +#endif > T> +#endif > T> +#if defined(INET) && !defined(INET6) > T> + (m->m_flags & M_IP_NEXTHOP) > T> +#endif > T> + ) > T> fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); > T> > T> #ifdef INET6 > From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 13:13:09 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B39ACD37; Tue, 18 Dec 2012 13:13:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 2E9BA8FC13; Tue, 18 Dec 2012 13:13:08 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id qBIDD0F8063392; Tue, 18 Dec 2012 17:13:00 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id qBIDD0QY063391; Tue, 18 Dec 2012 17:13:00 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 18 Dec 2012 17:13:00 +0400 From: Gleb Smirnoff To: Monthadar Al Jaberi Subject: Re: svn commit: r244389 - head/sys/dev/wtap Message-ID: <20121218131300.GP94420@FreeBSD.org> References: <201212180844.qBI8ixdX097633@svn.freebsd.org> <20121218085306.GK94420@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Monthadar Al Jaberi , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 13:13:09 -0000 On Tue, Dec 18, 2012 at 12:30:53PM +0100, Monthadar Al Jaberi wrote: M> On Tue, Dec 18, 2012 at 9:53 AM, Gleb Smirnoff wrote: M> > Monthadar, M> > M> > On Tue, Dec 18, 2012 at 08:44:59AM +0000, Monthadar Al Jaberi wrote: M> > M> Author: monthadar M> > M> Date: Tue Dec 18 08:44:59 2012 M> > M> New Revision: 244389 M> > M> URL: http://svnweb.freebsd.org/changeset/base/244389 M> > M> M> > M> Log: M> > M> wtap should check if ieee80211_vap_setup fails. M> > M> M> > M> * If ieee80211_vap_setup fails, we free allocated M_80211_VAP M> > M> memory and return NULL; M> > M> M> > M> Approved by: adrian (mentor) M> > M> M> > M> Modified: M> > M> head/sys/dev/wtap/if_wtap.c M> > M> M> > M> Modified: head/sys/dev/wtap/if_wtap.c M> > M> ============================================================================== M> > M> --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:41:23 2012 (r244388) M> > M> +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:44:59 2012 (r244389) M> > M> @@ -334,6 +334,10 @@ wtap_vap_create(struct ieee80211com *ic, M> > M> vap = (struct ieee80211vap *) avp; M> > M> error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, M> > M> flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); M> > M> + if (error) { M> > M> + free((struct wtap_vap*) vap, M_80211_VAP); M> > M> + return NULL; M> > M> + } M> > M> M> > M> /* override various methods */ M> > M> avp->av_recv_mgmt = vap->iv_recv_mgmt; M> > M> > You don't need to cast first argument of free(9). And you don't need a cast M> > before malloc(9) as well. M> > M> > If you are calling malloc(9) with M_NOWAIT, you need to check return result. M> > M> > Also, more stylish would be to supply to free() the same variable that was M> > assigned at malloc(9) call, in this particular case it is "avp". M> > M> > Patch attached. M> M> Thank you for the patch, I can commit it for you, if you havn't done it yet? Please commit, I'm not confident with wtap. -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 14:31:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA451A27; Tue, 18 Dec 2012 14:31:55 +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 ACECE8FC0C; Tue, 18 Dec 2012 14:31:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIEVtnN061902; Tue, 18 Dec 2012 14:31:55 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIEVtjI061901; Tue, 18 Dec 2012 14:31:55 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201212181431.qBIEVtjI061901@svn.freebsd.org> From: Robert Watson Date: Tue, 18 Dec 2012 14:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244397 - stable/9/contrib/openbsm/bin/auditdistd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 14:31:55 -0000 Author: rwatson Date: Tue Dec 18 14:31:55 2012 New Revision: 244397 URL: http://svnweb.freebsd.org/changeset/base/244397 Log: Apply minor local adjustment to OpenBSM's parse.y due to differences in Yacc between 10-CURRENT and 9-STABLE; this will allow the soon-to-be-connected auditdistd to build on 9.x. Pointer from: bapt Modified: stable/9/contrib/openbsm/bin/auditdistd/parse.y Modified: stable/9/contrib/openbsm/bin/auditdistd/parse.y ============================================================================== --- stable/9/contrib/openbsm/bin/auditdistd/parse.y Tue Dec 18 12:28:00 2012 (r244396) +++ stable/9/contrib/openbsm/bin/auditdistd/parse.y Tue Dec 18 14:31:55 2012 (r244397) @@ -56,6 +56,7 @@ extern int lineno; extern FILE *yyin; extern char *yytext; +extern int yyparse(void); static struct adist_config *lconfig; static struct adist_host *curhost; From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 14:32:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B18ABBDB; Tue, 18 Dec 2012 14:32:55 +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 8CE3B8FC17; Tue, 18 Dec 2012 14:32:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIEWtjv062097; Tue, 18 Dec 2012 14:32:55 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIEWs6A062091; Tue, 18 Dec 2012 14:32:54 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201212181432.qBIEWs6A062091@svn.freebsd.org> From: Robert Watson Date: Tue, 18 Dec 2012 14:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244398 - in stable/9: etc/defaults etc/mtree etc/rc.d share/man/man4 usr.sbin usr.sbin/auditdistd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 14:32:55 -0000 Author: rwatson Date: Tue Dec 18 14:32:53 2012 New Revision: 244398 URL: http://svnweb.freebsd.org/changeset/base/244398 Log: Merge r244181 from head to stable/9: Fix the location of auditdistd configuration file. Reported by: Johan Hendriks Merge remaining unmerged portions of r243752 from head to stable/9; parts adding the new 'auditdistd' user were previously merged in r243947: Merge a number of changes required to hook up OpenBSM 1.2-alpha2's auditdistd (distributed audit daemon) to the build: - Manual cross references - Makefile for auditdistd - rc.d script, rc.conf entrie - New group and user for auditdistd; associated aliases, etc. The audit trail distribution daemon provides reliable, cryptographically protected (and sandboxed) delivery of audit tails from live clients to audit server hosts in order to both allow centralised analysis, and improve resilience in the event of client compromises: clients are not permitted to change trail contents after submission. Submitted by: pjd Sponsored by: The FreeBSD Foundation (auditdistd) Obtained from: TrustedBSD Project Added: stable/9/etc/rc.d/auditdistd - copied, changed from r243752, head/etc/rc.d/auditdistd stable/9/usr.sbin/auditdistd/ - copied from r243752, head/usr.sbin/auditdistd/ Modified: stable/9/etc/defaults/rc.conf stable/9/etc/mtree/BSD.var.dist stable/9/etc/rc.d/Makefile stable/9/share/man/man4/audit.4 stable/9/usr.sbin/Makefile Directory Properties: stable/9/etc/ (props changed) stable/9/share/man/man4/ (props changed) stable/9/usr.sbin/ (props changed) Modified: stable/9/etc/defaults/rc.conf ============================================================================== --- stable/9/etc/defaults/rc.conf Tue Dec 18 14:31:55 2012 (r244397) +++ stable/9/etc/defaults/rc.conf Tue Dec 18 14:32:53 2012 (r244398) @@ -587,6 +587,9 @@ sendmail_rebuild_aliases="NO" # Run newa auditd_enable="NO" # Run the audit daemon. auditd_program="/usr/sbin/auditd" # Path to the audit daemon. auditd_flags="" # Which options to pass to the audit daemon. +auditdistd_enable="NO" # Run the audit daemon. +auditdistd_program="/usr/sbin/auditdistd" # Path to the auditdistd daemon. +auditdistd_flags="" # Which options to pass to the auditdistd daemon. cron_enable="YES" # Run the periodic job daemon. cron_program="/usr/sbin/cron" # Which cron executable to run (if enabled). cron_dst="YES" # Handle DST transitions intelligently (YES/NO) Modified: stable/9/etc/mtree/BSD.var.dist ============================================================================== --- stable/9/etc/mtree/BSD.var.dist Tue Dec 18 14:31:55 2012 (r244397) +++ stable/9/etc/mtree/BSD.var.dist Tue Dec 18 14:32:53 2012 (r244398) @@ -19,6 +19,10 @@ /set gname=audit audit .. + dist uname=auditdistd gname=audit mode=0770 + .. + remote uname=auditdistd gname=wheel mode=0700 + .. /set gname=wheel backups .. Modified: stable/9/etc/rc.d/Makefile ============================================================================== --- stable/9/etc/rc.d/Makefile Tue Dec 18 14:31:55 2012 (r244397) +++ stable/9/etc/rc.d/Makefile Tue Dec 18 14:32:53 2012 (r244398) @@ -4,7 +4,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \ abi accounting addswap adjkerntz amd \ - apm apmd archdep atm1 atm2 atm3 auditd \ + apm apmd archdep atm1 atm2 atm3 auditd auditdistd \ bgfsck bluetooth bootparams bridge bsnmpd bthidd \ ccd cleanvar cleartmp cron \ ddb defaultroute devd devfs dhclient \ Copied and modified: stable/9/etc/rc.d/auditdistd (from r243752, head/etc/rc.d/auditdistd) ============================================================================== --- head/etc/rc.d/auditdistd Sat Dec 1 15:11:46 2012 (r243752, copy source) +++ stable/9/etc/rc.d/auditdistd Tue Dec 18 14:32:53 2012 (r244398) @@ -14,7 +14,7 @@ name="auditdistd" rcvar="${name}_enable" pidfile="/var/run/${name}.pid" command="/usr/sbin/${name}" -required_files="/etc/${name}.conf" +required_files="/etc/security/${name}.conf" extra_commands="reload" load_rc_config $name Modified: stable/9/share/man/man4/audit.4 ============================================================================== --- stable/9/share/man/man4/audit.4 Tue Dec 18 14:31:55 2012 (r244397) +++ stable/9/share/man/man4/audit.4 Tue Dec 18 14:32:53 2012 (r244398) @@ -96,7 +96,8 @@ to track users and events in a fine-grai .Xr audit_warn 5 , .Xr rc.conf 5 , .Xr audit 8 , -.Xr auditd 8 +.Xr auditd 8 , +.Xr auditdistd 8 .Sh HISTORY The .Tn OpenBSM Modified: stable/9/usr.sbin/Makefile ============================================================================== --- stable/9/usr.sbin/Makefile Tue Dec 18 14:31:55 2012 (r244397) +++ stable/9/usr.sbin/Makefile Tue Dec 18 14:32:53 2012 (r244398) @@ -109,6 +109,9 @@ SUBDIR+= amd .if ${MK_AUDIT} != "no" SUBDIR+= audit SUBDIR+= auditd +.if ${MK_OPENSSL} != "no" +SUBDIR+= auditdistd +.endif SUBDIR+= auditreduce SUBDIR+= praudit .endif From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 14:46:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 029CBF2; Tue, 18 Dec 2012 14:46:33 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx1.freebsd.org (Postfix) with ESMTP id 664A88FC0A; Tue, 18 Dec 2012 14:46:32 +0000 (UTC) Received: by mail-vc0-f171.google.com with SMTP id n11so927374vch.2 for ; Tue, 18 Dec 2012 06:46:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=tgsCbKhTii0CkKr+7aBiCCq4oe246avDd9W67vchI80=; b=zf/mM1QBfdUMdT6idcf72ouq3XSBHUbZkRZwoqAAiyJ1Se4O5dbladIUhqO8jFPi18 JUJEzux0OtzRgrb60dhThSeOTuT5tZcwFnCjDRMBlgM3VFURLlyEPqt0Ot4R9T9OiKa4 GQt16jZ+v1oWJO3XdeGmO98ujFKONHGU4gZLgnLAohtRwo3CvSwjGf1G7zphT7YTvOiZ XSf7vBEZV9IKS+eap3sMDZyBIImPxWTFa1WE2l3SVSIl5HpV8AaKt0jUHqXL2xU/G86D ae37annJFwr+Xf53Pwy4H9PluCpTIhs0FV/kzK1pndWxdPS4+RmNWoYuSx3DcEkMLEh8 wkeQ== Received: by 10.220.209.74 with SMTP id gf10mr3342408vcb.10.1355841540839; Tue, 18 Dec 2012 06:39:00 -0800 (PST) MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.58.107.230 with HTTP; Tue, 18 Dec 2012 06:38:20 -0800 (PST) In-Reply-To: <201212180736.qBI7aj4K086137@svn.freebsd.org> References: <201212180736.qBI7aj4K086137@svn.freebsd.org> From: Ivan Voras Date: Tue, 18 Dec 2012 15:38:20 +0100 X-Google-Sender-Auth: VY_eUB33aX91xaLNVzyKa8B2LqU Message-ID: Subject: Re: svn commit: r244385 - head/sys/kern To: Andrey Zonov 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 14:46:33 -0000 On 18 December 2012 08:36, Andrey Zonov wrote: > Author: zont > Date: Tue Dec 18 07:36:45 2012 > New Revision: 244385 > URL: http://svnweb.freebsd.org/changeset/base/244385 > > Log: > - Add sysctl to allow unprivileged users to call mlock(2)-family system > calls and turn it on. > - Do not allow to call them inside jail. [1] There's a sysctl branch security.jail.param.allow. which might be useful here to add for jails. From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 16:11:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3DBD2939; Tue, 18 Dec 2012 16:11:14 +0000 (UTC) (envelope-from monthadar@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 22B598FC0A; Tue, 18 Dec 2012 16:11:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIGBEwO079707; Tue, 18 Dec 2012 16:11:14 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIGBDIT079705; Tue, 18 Dec 2012 16:11:13 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201212181611.qBIGBDIT079705@svn.freebsd.org> From: Monthadar Al Jaberi Date: Tue, 18 Dec 2012 16:11:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244399 - head/sys/dev/wtap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 16:11:14 -0000 Author: monthadar Date: Tue Dec 18 16:11:13 2012 New Revision: 244399 URL: http://svnweb.freebsd.org/changeset/base/244399 Log: wtap fix malloc/free. * Remove malloc/free pointer cast; * Check return value from malloc; Submitted by: glebius Approved by: adrian (mentor) Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c ============================================================================== --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 14:32:53 2012 (r244398) +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 16:11:13 2012 (r244399) @@ -326,8 +326,9 @@ wtap_vap_create(struct ieee80211com *ic, DWTAP_PRINTF("%s\n", __func__); - avp = (struct wtap_vap *) malloc(sizeof(struct wtap_vap), - M_80211_VAP, M_NOWAIT | M_ZERO); + avp = malloc(sizeof(struct wtap_vap), M_80211_VAP, M_NOWAIT | M_ZERO); + if (avp == NULL) + return (NULL); avp->id = sc->id; avp->av_md = sc->sc_md; avp->av_bcinterval = msecs_to_ticks(BEACON_INTRERVAL + 100*sc->id); @@ -335,8 +336,8 @@ wtap_vap_create(struct ieee80211com *ic, error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); if (error) { - free((struct wtap_vap*) vap, M_80211_VAP); - return NULL; + free(avp, M_80211_VAP); + return (NULL); } /* override various methods */ From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 16:15:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8ED10D44; Tue, 18 Dec 2012 16:15:21 +0000 (UTC) (envelope-from monthadar@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 724BF8FC0A; Tue, 18 Dec 2012 16:15:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIGFLML080499; Tue, 18 Dec 2012 16:15:21 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIGFL8K080498; Tue, 18 Dec 2012 16:15:21 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201212181615.qBIGFL8K080498@svn.freebsd.org> From: Monthadar Al Jaberi Date: Tue, 18 Dec 2012 16:15:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244400 - head/sys/dev/wtap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 16:15:21 -0000 Author: monthadar Date: Tue Dec 18 16:15:20 2012 New Revision: 244400 URL: http://svnweb.freebsd.org/changeset/base/244400 Log: wtap should not set the IEEE80211_F_DATAPAD flag; Approved by: adrian (mentor) Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c ============================================================================== --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 16:11:13 2012 (r244399) +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 16:15:20 2012 (r244400) @@ -808,11 +808,7 @@ wtap_attach(struct wtap_softc *sc, const ic->ic_regdomain.location = 1; /* Indoors */ ic->ic_regdomain.isocc[0] = 'S'; ic->ic_regdomain.isocc[1] = 'E'; - /* - * Indicate we need the 802.11 header padded to a - * 32-bit boundary for 4-address and QoS frames. - */ - ic->ic_flags |= IEEE80211_F_DATAPAD; + ic->ic_nchans = 1; ic->ic_channels[0].ic_flags = IEEE80211_CHAN_B; ic->ic_channels[0].ic_freq = 2412; From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 16:16:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E5F2FEE6; Tue, 18 Dec 2012 16:16:17 +0000 (UTC) (envelope-from monthadar@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id B16AA8FC1D; Tue, 18 Dec 2012 16:16:16 +0000 (UTC) Received: by mail-wg0-f50.google.com with SMTP id es5so391196wgb.17 for ; Tue, 18 Dec 2012 08:16:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6KOFlOEn0D8HUfDABnykxN+VKmVkCApN4Cugk+MCsm0=; b=I2/eOi1FzPPr+UNMPKhcXTkdgY8XXPGLlUlZ7q1/qX74Hsr1smzq0sJQDA+MfNofhm rQQwIzAQvRxScfbGHHQDiaINW1Z9K6R5ZGnxNZKg66M8fcN5+IL4ogHoGuYvJZyE6udz L+rMtwC/7CIls1LbcjRJIsaX/cPpYe+VgGIrtoC9mYRhPyWXQO4tJo1WXhwwOBx3oRcs Hyms2A6n2QAcnJtTjGF+wz8fqHHX7mF8mbWo0WH0fdvqiUDdAZlMeiS6O/OOdUWvVcT2 8XKPSx91iipuYjN3+XihdA4eOKnBXUtxrREE9rlHKdmkNJSxiOET4EoYEeKrfoI3ghK5 zVNA== MIME-Version: 1.0 Received: by 10.194.236.68 with SMTP id us4mr5684420wjc.11.1355847369340; Tue, 18 Dec 2012 08:16:09 -0800 (PST) Received: by 10.227.59.19 with HTTP; Tue, 18 Dec 2012 08:16:09 -0800 (PST) In-Reply-To: <20121218131300.GP94420@FreeBSD.org> References: <201212180844.qBI8ixdX097633@svn.freebsd.org> <20121218085306.GK94420@FreeBSD.org> <20121218131300.GP94420@FreeBSD.org> Date: Tue, 18 Dec 2012 17:16:09 +0100 Message-ID: Subject: Re: svn commit: r244389 - head/sys/dev/wtap From: Monthadar Al Jaberi To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 Cc: Monthadar Al Jaberi , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 16:16:18 -0000 On Tue, Dec 18, 2012 at 2:13 PM, Gleb Smirnoff wrote: > On Tue, Dec 18, 2012 at 12:30:53PM +0100, Monthadar Al Jaberi wrote: > M> On Tue, Dec 18, 2012 at 9:53 AM, Gleb Smirnoff wrote: > M> > Monthadar, > M> > > M> > On Tue, Dec 18, 2012 at 08:44:59AM +0000, Monthadar Al Jaberi wrote: > M> > M> Author: monthadar > M> > M> Date: Tue Dec 18 08:44:59 2012 > M> > M> New Revision: 244389 > M> > M> URL: http://svnweb.freebsd.org/changeset/base/244389 > M> > M> > M> > M> Log: > M> > M> wtap should check if ieee80211_vap_setup fails. > M> > M> > M> > M> * If ieee80211_vap_setup fails, we free allocated M_80211_VAP > M> > M> memory and return NULL; > M> > M> > M> > M> Approved by: adrian (mentor) > M> > M> > M> > M> Modified: > M> > M> head/sys/dev/wtap/if_wtap.c > M> > M> > M> > M> Modified: head/sys/dev/wtap/if_wtap.c > M> > M> ============================================================================== > M> > M> --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:41:23 2012 (r244388) > M> > M> +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:44:59 2012 (r244389) > M> > M> @@ -334,6 +334,10 @@ wtap_vap_create(struct ieee80211com *ic, > M> > M> vap = (struct ieee80211vap *) avp; > M> > M> error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, > M> > M> flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); > M> > M> + if (error) { > M> > M> + free((struct wtap_vap*) vap, M_80211_VAP); > M> > M> + return NULL; > M> > M> + } > M> > M> > M> > M> /* override various methods */ > M> > M> avp->av_recv_mgmt = vap->iv_recv_mgmt; > M> > > M> > You don't need to cast first argument of free(9). And you don't need a cast > M> > before malloc(9) as well. > M> > > M> > If you are calling malloc(9) with M_NOWAIT, you need to check return result. > M> > > M> > Also, more stylish would be to supply to free() the same variable that was > M> > assigned at malloc(9) call, in this particular case it is "avp". > M> > > M> > Patch attached. > M> > M> Thank you for the patch, I can commit it for you, if you havn't done it yet? > > Please commit, I'm not confident with wtap. Done, thank you! > > -- > Totus tuus, Glebius. -- Monthadar Al Jaberi From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 16:37:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4E04FA28; Tue, 18 Dec 2012 16:37:27 +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 308DF8FC16; Tue, 18 Dec 2012 16:37:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIGbRRg084157; Tue, 18 Dec 2012 16:37:27 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIGbP7e084145; Tue, 18 Dec 2012 16:37:25 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201212181637.qBIGbP7e084145@svn.freebsd.org> From: Brooks Davis Date: Tue, 18 Dec 2012 16:37:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244401 - in head: contrib/libc-vis include 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 16:37:27 -0000 Author: brooks Date: Tue Dec 18 16:37:24 2012 New Revision: 244401 URL: http://svnweb.freebsd.org/changeset/base/244401 Log: Replace our implementation of the vis(3) and unvis(3) APIs with NetBSD's. This output size limited versions of vis and unvis functions as well as a set of vis variants that allow arbitrary characters to be specified for encoding. Finally, MIME Quoted-Printable encoding as described in RFC 2045 is supported. Added: head/contrib/libc-vis/ - copied from r244235, vendor/NetBSD/libc-vis/dist/ head/lib/libc/gen/unvis-compat.c (contents, props changed) Deleted: head/include/vis.h head/lib/libc/gen/unvis.3 head/lib/libc/gen/unvis.c head/lib/libc/gen/vis.3 head/lib/libc/gen/vis.c Modified: head/contrib/libc-vis/unvis.3 head/contrib/libc-vis/unvis.c head/contrib/libc-vis/vis.3 head/contrib/libc-vis/vis.c head/contrib/libc-vis/vis.h head/include/Makefile head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map Modified: head/contrib/libc-vis/unvis.3 ============================================================================== --- vendor/NetBSD/libc-vis/dist/unvis.3 Fri Dec 14 23:13:06 2012 (r244235) +++ head/contrib/libc-vis/unvis.3 Tue Dec 18 16:37:24 2012 (r244401) @@ -1,4 +1,5 @@ .\" $NetBSD: unvis.3,v 1.23 2011/03/17 14:06:29 wiz Exp $ +.\" $FreeBSD$ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -241,4 +242,6 @@ The and .Fn strnunvisx functions appeared in -.Nx 6.0 . +.Nx 6.0 +and +.Fx 10.0 . Modified: head/contrib/libc-vis/unvis.c ============================================================================== --- vendor/NetBSD/libc-vis/dist/unvis.c Fri Dec 14 23:13:06 2012 (r244235) +++ head/contrib/libc-vis/unvis.c Tue Dec 18 16:37:24 2012 (r244401) @@ -37,6 +37,7 @@ static char sccsid[] = "@(#)unvis.c 8.1 __RCSID("$NetBSD: unvis.c,v 1.40 2012/12/14 21:31:01 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ +__FBSDID("$FreeBSD$"); #include "namespace.h" #include @@ -48,6 +49,14 @@ __RCSID("$NetBSD: unvis.c,v 1.40 2012/12 #include #include +#define _DIAGASSERT(x) assert(x) + +/* + * Return the number of elements in a statically-allocated array, + * __x. + */ +#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) + #ifdef __weak_alias __weak_alias(strnunvisx,_strnunvisx) #endif Modified: head/contrib/libc-vis/vis.3 ============================================================================== --- vendor/NetBSD/libc-vis/dist/vis.3 Fri Dec 14 23:13:06 2012 (r244235) +++ head/contrib/libc-vis/vis.3 Tue Dec 18 16:37:24 2012 (r244401) @@ -1,4 +1,5 @@ .\" $NetBSD: vis.3,v 1.29 2012/12/14 22:55:59 christos Exp $ +.\" $FreeBSD$ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -438,7 +439,9 @@ The and .Fn strsvisx functions appeared in -.Nx 1.5 . +.Nx 1.5 +and +.Fx 10.0 . The buffer size limited versions of the functions .Po Fn nvis , .Fn strnvis , @@ -448,4 +451,6 @@ The buffer size limited versions of the and .Fn strsnvisx Pc appeared in -.Nx 6.0 . +.Nx 6.0 +and +.Fx 10.0 . Modified: head/contrib/libc-vis/vis.c ============================================================================== --- vendor/NetBSD/libc-vis/dist/vis.c Fri Dec 14 23:13:06 2012 (r244235) +++ head/contrib/libc-vis/vis.c Tue Dec 18 16:37:24 2012 (r244401) @@ -59,6 +59,7 @@ #if defined(LIBC_SCCS) && !defined(lint) __RCSID("$NetBSD: vis.c,v 1.45 2012/12/14 21:38:18 christos Exp $"); #endif /* LIBC_SCCS and not lint */ +__FBSDID("$FreeBSD$"); #include "namespace.h" #include @@ -68,6 +69,8 @@ __RCSID("$NetBSD: vis.c,v 1.45 2012/12/1 #include #include +#define _DIAGASSERT(x) assert(x) + #ifdef __weak_alias __weak_alias(strvisx,_strvisx) #endif Modified: head/contrib/libc-vis/vis.h ============================================================================== --- vendor/NetBSD/libc-vis/dist/vis.h Fri Dec 14 23:13:06 2012 (r244235) +++ head/contrib/libc-vis/vis.h Tue Dec 18 16:37:24 2012 (r244401) @@ -1,4 +1,5 @@ /* $NetBSD: vis.h,v 1.20 2012/12/14 21:36:59 christos Exp $ */ +/* $FreeBSD$ */ /*- * Copyright (c) 1990, 1993 @@ -58,11 +59,11 @@ #define VIS_NOSLASH 0x0040 /* inhibit printing '\' */ #define VIS_HTTP1808 0x0080 /* http-style escape % hex hex */ #define VIS_HTTPSTYLE 0x0080 /* http-style escape % hex hex */ -#define VIS_MIMESTYLE 0x0100 /* mime-style escape = HEX HEX */ -#define VIS_HTTP1866 0x0200 /* http-style &#num; or &string; */ -#define VIS_NOESCAPE 0x0400 /* don't decode `\' */ -#define _VIS_END 0x0800 /* for unvis */ -#define VIS_GLOB 0x1000 /* encode glob(3) magic characters */ +#define VIS_GLOB 0x0100 /* encode glob(3) magic characters */ +#define VIS_MIMESTYLE 0x0200 /* mime-style escape = HEX HEX */ +#define VIS_HTTP1866 0x0400 /* http-style &#num; or &string; */ +#define VIS_NOESCAPE 0x0800 /* don't decode `\' */ +#define _VIS_END 0x1000 /* for unvis */ /* * unvis return codes @@ -106,7 +107,7 @@ int strunvisx(char *, const char *, int) int strnunvisx(char *, size_t, const char *, int); #ifndef __LIBC12_SOURCE__ -int unvis(char *, int, int *, int) __RENAME(__unvis50); +int unvis(char *, int, int *, int); #endif __END_DECLS Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Tue Dec 18 16:15:20 2012 (r244400) +++ head/include/Makefile Tue Dec 18 16:37:24 2012 (r244401) @@ -23,9 +23,12 @@ INCS= a.out.h ar.h assert.h bitstring.h stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \ strings.h sysexits.h tar.h termios.h tgmath.h \ time.h timeconv.h timers.h ttyent.h \ - ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h vis.h \ + ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \ wchar.h wctype.h wordexp.h xlocale.h +.PATH: ${.CURDIR}/../contrib/libc-vis +INCS+= vis.h + MHDRS= float.h floatingpoint.h stdarg.h PHDRS= sched.h _semaphore.h Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Tue Dec 18 16:15:20 2012 (r244400) +++ head/lib/libc/gen/Makefile.inc Tue Dec 18 16:37:24 2012 (r244401) @@ -32,13 +32,16 @@ SRCS+= __getosreldate.c __xuname.c \ sigsetops.c sleep.c srand48.c statvfs.c stringlist.c strtofflags.c \ sysconf.c sysctl.c sysctlbyname.c sysctlnametomib.c \ syslog.c telldir.c termios.c time.c times.c timezone.c tls.c \ - ttyname.c ttyslot.c ualarm.c ulimit.c uname.c unvis.c \ - usleep.c utime.c utxdb.c valloc.c vis.c wait.c wait3.c waitpid.c \ + ttyname.c ttyslot.c ualarm.c ulimit.c uname.c unvis-compat.c \ + usleep.c utime.c utxdb.c valloc.c wait.c wait3.c waitpid.c \ waitid.c wordexp.c .PATH: ${.CURDIR}/../../contrib/libc-pwcache SRCS+= pwcache.c pwcache.h +.PATH: ${.CURDIR}/../../contrib/libc-vis +SRCS+= unvis.c vis.c + MISRCS+=modf.c CANCELPOINTS_SRCS=sem.c sem_new.c Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Tue Dec 18 16:15:20 2012 (r244400) +++ head/lib/libc/gen/Symbol.map Tue Dec 18 16:37:24 2012 (r244401) @@ -298,9 +298,6 @@ FBSD_1.0 { ualarm; ulimit; uname; - unvis; - strunvis; - strunvisx; usleep; utime; valloc; @@ -388,9 +385,23 @@ FBSD_1.3 { __FreeBSD_libc_enter_restricted_mode; getcontextx; gid_from_group; + nvis; pwcache_userdb; pwcache_groupdb; + snvis; + strnunvis; + strnunvisx; + strunvis; + strunvisx; + strnvis; + strnvisx; + strsnvis; + strsnvisx; + strsvis; + strsvisx; + svis; uid_from_user; + unvis; waitid; }; Added: head/lib/libc/gen/unvis-compat.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/gen/unvis-compat.c Tue Dec 18 16:37:24 2012 (r244401) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2012 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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 + +#define _UNVIS_END 1 + +int +__unvis_44bsd(char *cp, int c, int *astate, int flag) +{ + + if (flag & _UNVIS_END) + flag = (flag & ~_UNVIS_END) ^ UNVIS_END; + return unvis(cp, c, astate, flag); +} + +__sym_compat(unvis, __vis_44bsd, FBSD_1.0); From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 18:04:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 667C895F; Tue, 18 Dec 2012 18:04:30 +0000 (UTC) (envelope-from emaste@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 4A4658FC0A; Tue, 18 Dec 2012 18:04:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBII4UB5099187; Tue, 18 Dec 2012 18:04:30 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBII4TQL099185; Tue, 18 Dec 2012 18:04:29 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201212181804.qBII4TQL099185@svn.freebsd.org> From: Ed Maste Date: Tue, 18 Dec 2012 18:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r244403 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 18:04:30 -0000 Author: emaste Date: Tue Dec 18 18:04:29 2012 New Revision: 244403 URL: http://svnweb.freebsd.org/changeset/base/244403 Log: Welcome Mark Johnston (markj@) as a new src committer. I will be his mentor, with Ryan Stone as co-mentor. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Tue Dec 18 17:13:16 2012 (r244402) +++ svnadmin/conf/access Tue Dec 18 18:04:29 2012 (r244403) @@ -156,6 +156,7 @@ luigi luoqi marcel marius +markj markm markus matteo Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Tue Dec 18 17:13:16 2012 (r244402) +++ svnadmin/conf/mentors Tue Dec 18 18:04:29 2012 (r244403) @@ -25,6 +25,7 @@ jlh kib jonathan rwatson jwd rmacklem kargl das +markj emaste Co-mentor: rstone miwi rwatson monthadar adrian nork imp From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 18:34:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 492A328C; Tue, 18 Dec 2012 18:34:37 +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 2DEB58FC15; Tue, 18 Dec 2012 18:34:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIIYbEw004312; Tue, 18 Dec 2012 18:34:37 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIIYbxh004311; Tue, 18 Dec 2012 18:34:37 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201212181834.qBIIYbxh004311@svn.freebsd.org> From: Mateusz Guzik Date: Tue, 18 Dec 2012 18:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244404 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 18:34:37 -0000 Author: mjg Date: Tue Dec 18 18:34:36 2012 New Revision: 244404 URL: http://svnweb.freebsd.org/changeset/base/244404 Log: prison_racct_detach can be called for not fully initialized jail, so make it check that the jail has racct before doing anything PR: kern/174436 Reviewed by: trasz MFC after: 3 days Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Tue Dec 18 18:04:29 2012 (r244403) +++ head/sys/kern/kern_jail.c Tue Dec 18 18:34:36 2012 (r244404) @@ -4518,6 +4518,8 @@ prison_racct_detach(struct prison *pr) sx_assert(&allprison_lock, SA_UNLOCKED); + if (pr->pr_prison_racct == NULL) + return; prison_racct_free(pr->pr_prison_racct); pr->pr_prison_racct = NULL; } From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 20:02:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E82D635; Tue, 18 Dec 2012 20:02:54 +0000 (UTC) (envelope-from dumbbell@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 DC8398FC13; Tue, 18 Dec 2012 20:02:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIK2r16017893; Tue, 18 Dec 2012 20:02:53 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIK2rMb017892; Tue, 18 Dec 2012 20:02:53 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201212182002.qBIK2rMb017892@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Tue, 18 Dec 2012 20:02:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244405 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 20:02:54 -0000 Author: dumbbell Date: Tue Dec 18 20:02:53 2012 New Revision: 244405 URL: http://svnweb.freebsd.org/changeset/base/244405 Log: psm: Support detection of Synaptics touchpad v7.5 and above Starting with firmware v7.5, the "Read TouchPad Modes" ($01) and "Read Capabilities" ($02) commands changed: previously constant bytes now carry variable information. We now compare those bytes to expected constants only for firmware prior to v7.5. Tested by: Zeus Panchenko MFC after: 1 week Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Tue Dec 18 18:34:36 2012 (r244404) +++ head/sys/dev/atkbdc/psm.c Tue Dec 18 20:02:53 2012 (r244405) @@ -239,6 +239,10 @@ typedef struct synapticspacket { #define SYNAPTICS_QUEUE_CURSOR(x) \ (x + SYNAPTICS_PACKETQUEUE) % SYNAPTICS_PACKETQUEUE +#define SYNAPTICS_VERSION_GE(synhw, major, minor) \ + ((synhw).infoMajor > (major) || \ + ((synhw).infoMajor == (major) && (synhw).infoMinor >= (minor))) + typedef struct synapticsaction { synapticspacket_t queue[SYNAPTICS_PACKETQUEUE]; int queue_len; @@ -867,7 +871,9 @@ doopen(struct psm_softc *sc, int command if (sc->hw.model == MOUSE_MODEL_SYNAPTICS) { mouse_ext_command(sc->kbdc, 1); get_mouse_status(sc->kbdc, stat, 0, 3); - if (stat[1] == 0x47 && stat[2] == 0x40) { + if ((SYNAPTICS_VERSION_GE(sc->synhw, 7, 5) || + stat[1] == 0x47) && + stat[2] == 0x40) { /* Set the mode byte -- request wmode where * available */ if (sc->synhw.capExtended) @@ -4383,7 +4389,7 @@ enable_synaptics(KBDC kbdc, struct psm_s return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) return (FALSE); - if (status[1] != 0x47) { + if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != 0x47) { printf(" Failed to read extended capability bits\n"); return (FALSE); } @@ -4439,7 +4445,7 @@ enable_synaptics(KBDC kbdc, struct psm_s return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) return (FALSE); - if (status[1] != 0x47) { + if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != 0x47) { printf(" Failed to read mode byte\n"); return (FALSE); } From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 20:44:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F1451A3; Tue, 18 Dec 2012 20:44:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 4D2CB8FC0C; Tue, 18 Dec 2012 20:44:52 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AC24CB94B; Tue, 18 Dec 2012 15:44:51 -0500 (EST) From: John Baldwin To: Pawel Jakub Dawidek Subject: Re: svn commit: r244320 - head/sbin/savecore Date: Tue, 18 Dec 2012 14:08:17 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201212162306.qBGN6CZR069280@svn.freebsd.org> In-Reply-To: <201212162306.qBGN6CZR069280@svn.freebsd.org> MIME-Version: 1.0 Message-Id: <201212181408.18179.jhb@freebsd.org> Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 18 Dec 2012 15:44:51 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 20:44:52 -0000 On Sunday, December 16, 2012 6:06:12 pm Pawel Jakub Dawidek wrote: > Author: pjd > Date: Sun Dec 16 23:06:12 2012 > New Revision: 244320 > URL: http://svnweb.freebsd.org/changeset/base/244320 > > Log: > Implement -m option to savecore(8) that allows to limit number of kernel > dumps stored. Once the limit is reached it restarts from 0. Why restart at zero? The old behavior is that if you rm'd /var/crash/vmcore.0 then new dumps would just get increasing numbers. That seems fine (just delete the "oldest" core dumps if you are out of room). I guess the restarting lets you be lazy and avoid finding the "oldest" dump via a glob, but: The real feature request was not a limit on the number of core dumps IIRC, but a way to specify a minimum amount of free space in the partition and to delete tne oldest dump if the new dump would put the partition over the limit. To do this you have to be able to find the "oldest" dump, so if you solve this you no longer have to rely on rotating names (and no longer need a 'last' link). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 20:45:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4265A2C8; Tue, 18 Dec 2012 20:45:02 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 0FE188FC0A; Tue, 18 Dec 2012 20:45:02 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7EE0AB97D; Tue, 18 Dec 2012 15:45:01 -0500 (EST) From: John Baldwin To: Adrian Chadd Subject: Re: svn commit: r244112 - head/sys/kern Date: Tue, 18 Dec 2012 15:23:05 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201212121658.49048.jhb@freebsd.org> <20121216233213.GA1451@itx> In-Reply-To: MIME-Version: 1.0 Message-Id: <201212181523.05713.jhb@freebsd.org> Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 18 Dec 2012 15:45:01 -0500 (EST) Cc: Ian Lepore , src-committers@freebsd.org, Peter Wemm , svn-src-all@freebsd.org, Andriy Gapon , svn-src-head@freebsd.org, Peter Jeremy X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 20:45:02 -0000 On Sunday, December 16, 2012 10:05:48 pm Adrian Chadd wrote: > On 16 December 2012 15:32, Navdeep Parhar wrote: > > > >> The status quo _does not change_ by default. > > > > So now we have a knob that could be used to change the behaviour of all > > the KASSERTs in the system; one that hints that it may be possible to > > continue even if an assertion in the FreeBSD kernel doesn't hold good > > (this is the part that bothers me). I know all the KASSERTs I've looked > > at or written are genuine assertions -- the code simply wouldn't be able > > to cope if they were violated. You'd get NULL dereferences, or worse, > > access protected structures without corresponding locks held, etc. > > In that case, those failures should be handled gracefully, or they > should immediately panic the kernel. > > Claiming that a KASSERT() is optional at this point is basically us as > a project saying "We know that if the kernel gets to this point and it > fails this check, everything is busted after this." Ie, "Hey, if you > disable KASSERT(), your data is potentially toast." > > Yet we ship with KASSERT() disabled. Silent data corruption, race > conditions, etc. Not everything leads to a NULL pointer dereference. > > Again, we ship with KASSERT disabled in GENERIC on shipping production > releases. The concerns you have with KASSERT printing out when > Alfred's modification is enabled -does not change the fact that the > kernel does _EXACTLY THIS_ kind of "oh well, I'll keep going" > behaviour in a GENERIC, production, release kernel-. It seems to me that if you are willing to pay the cost of extra sanity checks, you should gain the extra protection against data corruption. We have made the design decision to trade the extra data protection for increased performance in GENERIC since we feel the cases of data corruption should be rare. In HEAD we have altered the tradeoff since code in HEAD has had less testing and is thus assumed to be more risky. In your case you seem to be trading performance for reduced data protection. Can you at least appreciate that argument? Also, to Alfred's point that "we have spare CPU lying around". Performance is not only measured in throughput, it can also be measured in latency. One other note: have you noticed that there is not a similar "whine but don't core" option for the userland assert()? OTOH, there are such things in glib and the core KDE libraries. Try firing up a gnome or KDE application in a terminal window. You will be greeted by an endless stream of various debug messages. The noise is so great that I haven't bothered to report any of them as bugs. OTOH, I do open bugs if a KDE app cores. It would not surprise me to find that enabling KASSERTS but having them only log doesn't actually help with anything as the extra logging could prove so noisy that no one bothers reporting them (and/or you end up with spurious noise due to secondary failures similar to the noise one can get with compiler warnings). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 20:47:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0E6FC6E7; Tue, 18 Dec 2012 20:47:24 +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 E58F48FC12; Tue, 18 Dec 2012 20:47:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIKlNpI025000; Tue, 18 Dec 2012 20:47:23 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIKlN7u024997; Tue, 18 Dec 2012 20:47:23 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201212182047.qBIKlN7u024997@svn.freebsd.org> From: Xin LI Date: Tue, 18 Dec 2012 20:47:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244406 - in head: share/man/man4 sys/dev/arcmsr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 20:47:24 -0000 Author: delphij Date: Tue Dec 18 20:47:23 2012 New Revision: 244406 URL: http://svnweb.freebsd.org/changeset/base/244406 Log: Update arcmsr(4) to vendor version 1.20.00.26, this adds support for their new RAID adapter ARC-1214. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 Ching-Lung Huang MFC after: 2 weeks Modified: head/share/man/man4/arcmsr.4 head/sys/dev/arcmsr/arcmsr.c head/sys/dev/arcmsr/arcmsr.h Modified: head/share/man/man4/arcmsr.4 ============================================================================== --- head/share/man/man4/arcmsr.4 Tue Dec 18 20:02:53 2012 (r244405) +++ head/share/man/man4/arcmsr.4 Tue Dec 18 20:47:23 2012 (r244406) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 3, 2012 +.Dd December 18, 2012 .Dt ARCMSR 4 .Os .Sh NAME @@ -100,6 +100,8 @@ ARC-1212 .It ARC-1213 .It +ARC-1214 +.It ARC-1220 .It ARC-1222 Modified: head/sys/dev/arcmsr/arcmsr.c ============================================================================== --- head/sys/dev/arcmsr/arcmsr.c Tue Dec 18 20:02:53 2012 (r244405) +++ head/sys/dev/arcmsr/arcmsr.c Tue Dec 18 20:47:23 2012 (r244406) @@ -10,8 +10,7 @@ ****************************************************************************************** ************************************************************************ ** -** Copyright (c) 2004-2010 ARECA Co. Ltd. -** Erich Chen, Taipei Taiwan All rights reserved. +** Copyright (C) 2002 - 2010, Areca Technology Corporation All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions @@ -74,6 +73,7 @@ ** 1.20.00.23 01/30/2012 Ching Huang Fixed Request requeued and Retrying command ** 1.20.00.24 06/11/2012 Ching Huang Fixed return sense data condition ** 1.20.00.25 08/17/2012 Ching Huang Fixed hotplug device no function on type A adapter +** 1.20.00.26 12/14/2012 Ching Huang Added support ARC1214 ****************************************************************************************** */ @@ -129,24 +129,10 @@ __FBSDID("$FreeBSD$"); #include #include #include - #define ARCMSR_LOCK_INIT(l, s) mtx_init(l, s, NULL, MTX_DEF) - #define ARCMSR_LOCK_DESTROY(l) mtx_destroy(l) - #define ARCMSR_LOCK_ACQUIRE(l) mtx_lock(l) - #define ARCMSR_LOCK_RELEASE(l) mtx_unlock(l) - #define ARCMSR_LOCK_TRY(l) mtx_trylock(l) - #define arcmsr_htole32(x) htole32(x) - typedef struct mtx arcmsr_lock_t; #else #include #include #include - #define ARCMSR_LOCK_INIT(l, s) simple_lock_init(l) - #define ARCMSR_LOCK_DESTROY(l) - #define ARCMSR_LOCK_ACQUIRE(l) simple_lock(l) - #define ARCMSR_LOCK_RELEASE(l) simple_unlock(l) - #define ARCMSR_LOCK_TRY(l) simple_lock_try(l) - #define arcmsr_htole32(x) (x) - typedef struct simplelock arcmsr_lock_t; #endif #if !defined(CAM_NEW_TRAN_CODE) && __FreeBSD_version >= 700025 @@ -159,23 +145,15 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a); #endif -#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.25 2012-08-17" +#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.26 2012-12-14" #include -#define SRB_SIZE ((sizeof(struct CommandControlBlock)+0x1f) & 0xffe0) -#define ARCMSR_SRBS_POOL_SIZE (SRB_SIZE * ARCMSR_MAX_FREESRB_NUM) -/* -************************************************************************** -************************************************************************** -*/ -#define CHIP_REG_READ32(s, b, r) bus_space_read_4(acb->btag[b], acb->bhandle[b], offsetof(struct s, r)) -#define CHIP_REG_WRITE32(s, b, r, d) bus_space_write_4(acb->btag[b], acb->bhandle[b], offsetof(struct s, r), d) /* ************************************************************************** ************************************************************************** */ static void arcmsr_free_srb(struct CommandControlBlock *srb); -static struct CommandControlBlock * arcmsr_get_freesrb(struct AdapterControlBlock *acb); -static u_int8_t arcmsr_seek_cmd2abort(union ccb * abortccb); +static struct CommandControlBlock *arcmsr_get_freesrb(struct AdapterControlBlock *acb); +static u_int8_t arcmsr_seek_cmd2abort(union ccb *abortccb); static int arcmsr_probe(device_t dev); static int arcmsr_attach(device_t dev); static int arcmsr_detach(device_t dev); @@ -190,18 +168,20 @@ static void arcmsr_stop_adapter_bgrb(str static void arcmsr_start_adapter_bgrb(struct AdapterControlBlock *acb); static void arcmsr_iop_init(struct AdapterControlBlock *acb); static void arcmsr_flush_adapter_cache(struct AdapterControlBlock *acb); -static void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *acb); +static void arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer); +static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb); static void arcmsr_abort_allcmd(struct AdapterControlBlock *acb); static void arcmsr_srb_complete(struct CommandControlBlock *srb, int stand_flag); static void arcmsr_iop_reset(struct AdapterControlBlock *acb); static void arcmsr_report_sense_info(struct CommandControlBlock *srb); -static void arcmsr_build_srb(struct CommandControlBlock *srb, bus_dma_segment_t * dm_segs, u_int32_t nseg); -static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, union ccb * pccb); +static void arcmsr_build_srb(struct CommandControlBlock *srb, bus_dma_segment_t *dm_segs, u_int32_t nseg); +static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, union ccb *pccb); static int arcmsr_resume(device_t dev); static int arcmsr_suspend(device_t dev); static void arcmsr_rescanLun_cb(struct cam_periph *periph, union ccb *ccb); -static void arcmsr_polling_devmap(void* arg); -static void arcmsr_srb_timeout(void* arg); +static void arcmsr_polling_devmap(void *arg); +static void arcmsr_srb_timeout(void *arg); +static void arcmsr_hbd_postqueue_isr(struct AdapterControlBlock *acb); #ifdef ARCMSR_DEBUG1 static void arcmsr_dump_data(struct AdapterControlBlock *acb); #endif @@ -293,12 +273,12 @@ static struct cdevsw arcmsr_cdevsw = { #endif { #if __FreeBSD_version < 503000 - struct AdapterControlBlock *acb=dev->si_drv1; + struct AdapterControlBlock *acb = dev->si_drv1; #else int unit = dev2unit(dev); struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); #endif - if(acb==NULL) { + if(acb == NULL) { return ENXIO; } return (0); @@ -318,12 +298,12 @@ static struct cdevsw arcmsr_cdevsw = { #endif { #if __FreeBSD_version < 503000 - struct AdapterControlBlock *acb=dev->si_drv1; + struct AdapterControlBlock *acb = dev->si_drv1; #else int unit = dev2unit(dev); struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); #endif - if(acb==NULL) { + if(acb == NULL) { return ENXIO; } return 0; @@ -343,13 +323,13 @@ static struct cdevsw arcmsr_cdevsw = { #endif { #if __FreeBSD_version < 503000 - struct AdapterControlBlock *acb=dev->si_drv1; + struct AdapterControlBlock *acb = dev->si_drv1; #else int unit = dev2unit(dev); struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); #endif - if(acb==NULL) { + if(acb == NULL) { return ENXIO; } return (arcmsr_iop_ioctlcmd(acb, ioctl_cmd, arg)); @@ -360,28 +340,34 @@ static struct cdevsw arcmsr_cdevsw = { */ static u_int32_t arcmsr_disable_allintr( struct AdapterControlBlock *acb) { - u_int32_t intmask_org=0; + u_int32_t intmask_org = 0; switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_A: { /* disable all outbound interrupt */ - intmask_org=CHIP_REG_READ32(HBA_MessageUnit, 0, outbound_intmask); /* disable outbound message0 int */ + intmask_org = CHIP_REG_READ32(HBA_MessageUnit, 0, outbound_intmask); /* disable outbound message0 int */ CHIP_REG_WRITE32(HBA_MessageUnit, 0, outbound_intmask, intmask_org|ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE); } break; case ACB_ADAPTER_TYPE_B: { /* disable all outbound interrupt */ - intmask_org=CHIP_REG_READ32(HBB_DOORBELL, + intmask_org = CHIP_REG_READ32(HBB_DOORBELL, 0, iop2drv_doorbell_mask) & (~ARCMSR_IOP2DRV_MESSAGE_CMD_DONE); /* disable outbound message0 int */ CHIP_REG_WRITE32(HBB_DOORBELL, 0, iop2drv_doorbell_mask, 0); /* disable all interrupt */ } break; case ACB_ADAPTER_TYPE_C: { /* disable all outbound interrupt */ - intmask_org=CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_mask) ; /* disable outbound message0 int */ + intmask_org = CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_mask) ; /* disable outbound message0 int */ CHIP_REG_WRITE32(HBC_MessageUnit, 0, host_int_mask, intmask_org|ARCMSR_HBCMU_ALL_INTMASKENABLE); } break; + case ACB_ADAPTER_TYPE_D: { + /* disable all outbound interrupt */ + intmask_org = CHIP_REG_READ32(HBD_MessageUnit, 0, pcief0_int_enable) ; /* disable outbound message0 int */ + CHIP_REG_WRITE32(HBD_MessageUnit, 0, pcief0_int_enable, ARCMSR_HBDMU_ALL_INT_DISABLE); + } + break; } return (intmask_org); } @@ -396,23 +382,31 @@ static void arcmsr_enable_allintr( struc switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_A: { /* enable outbound Post Queue, outbound doorbell Interrupt */ - mask=~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE|ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE|ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE); + mask = ~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE|ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE|ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE); CHIP_REG_WRITE32(HBA_MessageUnit, 0, outbound_intmask, intmask_org & mask); acb->outbound_int_enable = ~(intmask_org & mask) & 0x000000ff; } break; case ACB_ADAPTER_TYPE_B: { /* enable ARCMSR_IOP2DRV_MESSAGE_CMD_DONE */ - mask=(ARCMSR_IOP2DRV_DATA_WRITE_OK|ARCMSR_IOP2DRV_DATA_READ_OK|ARCMSR_IOP2DRV_CDB_DONE|ARCMSR_IOP2DRV_MESSAGE_CMD_DONE); + mask = (ARCMSR_IOP2DRV_DATA_WRITE_OK|ARCMSR_IOP2DRV_DATA_READ_OK|ARCMSR_IOP2DRV_CDB_DONE|ARCMSR_IOP2DRV_MESSAGE_CMD_DONE); CHIP_REG_WRITE32(HBB_DOORBELL, 0, iop2drv_doorbell_mask, intmask_org | mask); /*1=interrupt enable, 0=interrupt disable*/ acb->outbound_int_enable = (intmask_org | mask) & 0x0000000f; } break; case ACB_ADAPTER_TYPE_C: { /* enable outbound Post Queue, outbound doorbell Interrupt */ - mask=~(ARCMSR_HBCMU_UTILITY_A_ISR_MASK | ARCMSR_HBCMU_OUTBOUND_DOORBELL_ISR_MASK | ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR_MASK); + mask = ~(ARCMSR_HBCMU_UTILITY_A_ISR_MASK | ARCMSR_HBCMU_OUTBOUND_DOORBELL_ISR_MASK | ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR_MASK); CHIP_REG_WRITE32(HBC_MessageUnit, 0, host_int_mask, intmask_org & mask); - acb->outbound_int_enable= ~(intmask_org & mask) & 0x0000000f; + acb->outbound_int_enable = ~(intmask_org & mask) & 0x0000000f; + } + break; + case ACB_ADAPTER_TYPE_D: { + /* enable outbound Post Queue, outbound doorbell Interrupt */ + mask = ARCMSR_HBDMU_ALL_INT_ENABLE; + CHIP_REG_WRITE32(HBD_MessageUnit, 0, pcief0_int_enable, intmask_org | mask); + CHIP_REG_READ32(HBD_MessageUnit, 0, pcief0_int_enable); + acb->outbound_int_enable = mask; } break; } @@ -424,7 +418,7 @@ static void arcmsr_enable_allintr( struc static u_int8_t arcmsr_hba_wait_msgint_ready(struct AdapterControlBlock *acb) { u_int32_t Index; - u_int8_t Retries=0x00; + u_int8_t Retries = 0x00; do { for(Index=0; Index < 100; Index++) { @@ -444,7 +438,7 @@ static u_int8_t arcmsr_hba_wait_msgint_r static u_int8_t arcmsr_hbb_wait_msgint_ready(struct AdapterControlBlock *acb) { u_int32_t Index; - u_int8_t Retries=0x00; + u_int8_t Retries = 0x00; do { for(Index=0; Index < 100; Index++) { @@ -465,7 +459,7 @@ static u_int8_t arcmsr_hbb_wait_msgint_r static u_int8_t arcmsr_hbc_wait_msgint_ready(struct AdapterControlBlock *acb) { u_int32_t Index; - u_int8_t Retries=0x00; + u_int8_t Retries = 0x00; do { for(Index=0; Index < 100; Index++) { @@ -479,12 +473,32 @@ static u_int8_t arcmsr_hbc_wait_msgint_r return (FALSE); } /* +********************************************************************** +********************************************************************** +*/ +static u_int8_t arcmsr_hbd_wait_msgint_ready(struct AdapterControlBlock *acb) +{ + u_int32_t Index; + u_int8_t Retries = 0x00; + + do { + for(Index=0; Index < 100; Index++) { + if(CHIP_REG_READ32(HBD_MessageUnit, 0, outbound_doorbell) & ARCMSR_HBDMU_IOP2DRV_MESSAGE_CMD_DONE) { + CHIP_REG_WRITE32(HBD_MessageUnit, 0, outbound_doorbell, ARCMSR_HBDMU_IOP2DRV_MESSAGE_CMD_DONE_CLEAR);/*clear interrupt*/ + return TRUE; + } + UDELAY(10000); + }/*max 1 seconds*/ + }while(Retries++ < 20);/*max 20 sec*/ + return (FALSE); +} +/* ************************************************************************ ************************************************************************ */ static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb) { - int retry_count=30;/* enlarge wait flush adapter cache time: 10 minute */ + int retry_count = 30;/* enlarge wait flush adapter cache time: 10 minute */ CHIP_REG_WRITE32(HBA_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_FLUSH_CACHE); do { @@ -493,7 +507,7 @@ static void arcmsr_flush_hba_cache(struc } else { retry_count--; } - }while(retry_count!=0); + }while(retry_count != 0); } /* ************************************************************************ @@ -501,7 +515,7 @@ static void arcmsr_flush_hba_cache(struc */ static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb) { - int retry_count=30;/* enlarge wait flush adapter cache time: 10 minute */ + int retry_count = 30;/* enlarge wait flush adapter cache time: 10 minute */ CHIP_REG_WRITE32(HBB_DOORBELL, 0, drv2iop_doorbell, ARCMSR_MESSAGE_FLUSH_CACHE); @@ -511,7 +525,7 @@ static void arcmsr_flush_hbb_cache(struc } else { retry_count--; } - }while(retry_count!=0); + }while(retry_count != 0); } /* ************************************************************************ @@ -519,7 +533,7 @@ static void arcmsr_flush_hbb_cache(struc */ static void arcmsr_flush_hbc_cache(struct AdapterControlBlock *acb) { - int retry_count=30;/* enlarge wait flush adapter cache time: 10 minute */ + int retry_count = 30;/* enlarge wait flush adapter cache time: 10 minute */ CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_FLUSH_CACHE); CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_doorbell, ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE); @@ -529,7 +543,24 @@ static void arcmsr_flush_hbc_cache(struc } else { retry_count--; } - }while(retry_count!=0); + }while(retry_count != 0); +} +/* +************************************************************************ +************************************************************************ +*/ +static void arcmsr_flush_hbd_cache(struct AdapterControlBlock *acb) +{ + int retry_count = 30; /* enlarge wait flush adapter cache time: 10 minute */ + + CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_FLUSH_CACHE); + do { + if(arcmsr_hbd_wait_msgint_ready(acb)) { + break; + } else { + retry_count--; + } + }while(retry_count != 0); } /* ************************************************************************ @@ -550,6 +581,10 @@ static void arcmsr_flush_adapter_cache(s arcmsr_flush_hbc_cache(acb); } break; + case ACB_ADAPTER_TYPE_D: { + arcmsr_flush_hbd_cache(acb); + } + break; } } /* @@ -585,14 +620,14 @@ static void arcmsr_async(void *cb_arg, u { struct AdapterControlBlock *acb; u_int8_t target_id, target_lun; - struct cam_sim * sim; + struct cam_sim *sim; - sim=(struct cam_sim *) cb_arg; + sim = (struct cam_sim *) cb_arg; acb =(struct AdapterControlBlock *) cam_sim_softc(sim); switch (code) { case AC_LOST_DEVICE: - target_id=xpt_path_target_id(path); - target_lun=xpt_path_lun_id(path); + target_id = xpt_path_target_id(path); + target_lun = xpt_path_lun_id(path); if((target_id > ARCMSR_MAX_TARGETID) || (target_lun > ARCMSR_MAX_TARGETLUN)) { break; } @@ -608,7 +643,7 @@ static void arcmsr_async(void *cb_arg, u */ static void arcmsr_report_sense_info(struct CommandControlBlock *srb) { - union ccb * pccb=srb->pccb; + union ccb *pccb = srb->pccb; pccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR; pccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; @@ -658,6 +693,17 @@ static void arcmsr_abort_hbc_allcmd(stru ********************************************************************* ********************************************************************* */ +static void arcmsr_abort_hbd_allcmd(struct AdapterControlBlock *acb) +{ + CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_ABORT_CMD); + if(!arcmsr_hbd_wait_msgint_ready(acb)) { + printf("arcmsr%d: wait 'abort all outstanding command' timeout \n", acb->pci_unit); + } +} +/* +********************************************************************* +********************************************************************* +*/ static void arcmsr_abort_allcmd(struct AdapterControlBlock *acb) { switch (acb->adapter_type) { @@ -673,6 +719,10 @@ static void arcmsr_abort_allcmd(struct A arcmsr_abort_hbc_allcmd(acb); } break; + case ACB_ADAPTER_TYPE_D: { + arcmsr_abort_hbd_allcmd(acb); + } + break; } } /* @@ -681,8 +731,8 @@ static void arcmsr_abort_allcmd(struct A */ static void arcmsr_srb_complete(struct CommandControlBlock *srb, int stand_flag) { - struct AdapterControlBlock *acb=srb->acb; - union ccb * pccb=srb->pccb; + struct AdapterControlBlock *acb = srb->acb; + union ccb *pccb = srb->pccb; if(srb->srb_flags & SRB_FLAG_TIMER_START) callout_stop(&srb->ccb_callout); @@ -697,19 +747,17 @@ static void arcmsr_srb_complete(struct C bus_dmamap_sync(acb->dm_segs_dmat, srb->dm_segs_dmamap, op); bus_dmamap_unload(acb->dm_segs_dmat, srb->dm_segs_dmamap); } - if(stand_flag==1) { + if(stand_flag == 1) { atomic_subtract_int(&acb->srboutstandingcount, 1); if((acb->acb_flags & ACB_F_CAM_DEV_QFRZN) && ( - acb->srboutstandingcount < ARCMSR_RELEASE_SIMQ_LEVEL)) { + acb->srboutstandingcount < (acb->firm_numbers_queue -10))) { acb->acb_flags &= ~ACB_F_CAM_DEV_QFRZN; pccb->ccb_h.status |= CAM_RELEASE_SIMQ; } } if(srb->srb_state != ARCMSR_SRB_TIMEOUT) arcmsr_free_srb(srb); -#ifdef ARCMSR_DEBUG1 acb->pktReturnCount++; -#endif xpt_done(pccb); } /* @@ -720,34 +768,34 @@ static void arcmsr_report_srb_state(stru { int target, lun; - target=srb->pccb->ccb_h.target_id; - lun=srb->pccb->ccb_h.target_lun; + target = srb->pccb->ccb_h.target_id; + lun = srb->pccb->ccb_h.target_lun; if(error == FALSE) { - if(acb->devstate[target][lun]==ARECA_RAID_GONE) { - acb->devstate[target][lun]=ARECA_RAID_GOOD; + if(acb->devstate[target][lun] == ARECA_RAID_GONE) { + acb->devstate[target][lun] = ARECA_RAID_GOOD; } srb->pccb->ccb_h.status |= CAM_REQ_CMP; arcmsr_srb_complete(srb, 1); } else { switch(srb->arcmsr_cdb.DeviceStatus) { case ARCMSR_DEV_SELECT_TIMEOUT: { - if(acb->devstate[target][lun]==ARECA_RAID_GOOD) { + if(acb->devstate[target][lun] == ARECA_RAID_GOOD) { printf( "arcmsr%d: Target=%x, Lun=%x, selection timeout, raid volume was lost\n", acb->pci_unit, target, lun); } - acb->devstate[target][lun]=ARECA_RAID_GONE; + acb->devstate[target][lun] = ARECA_RAID_GONE; srb->pccb->ccb_h.status |= CAM_DEV_NOT_THERE; arcmsr_srb_complete(srb, 1); } break; case ARCMSR_DEV_ABORTED: case ARCMSR_DEV_INIT_FAIL: { - acb->devstate[target][lun]=ARECA_RAID_GONE; + acb->devstate[target][lun] = ARECA_RAID_GONE; srb->pccb->ccb_h.status |= CAM_DEV_NOT_THERE; arcmsr_srb_complete(srb, 1); } break; case SCSISTAT_CHECK_CONDITION: { - acb->devstate[target][lun]=ARECA_RAID_GOOD; + acb->devstate[target][lun] = ARECA_RAID_GOOD; arcmsr_report_sense_info(srb); arcmsr_srb_complete(srb, 1); } @@ -755,7 +803,7 @@ static void arcmsr_report_srb_state(stru default: printf("arcmsr%d: scsi id=%d lun=%d isr got command error done,but got unknown DeviceStatus=0x%x \n" , acb->pci_unit, target, lun ,srb->arcmsr_cdb.DeviceStatus); - acb->devstate[target][lun]=ARECA_RAID_GONE; + acb->devstate[target][lun] = ARECA_RAID_GONE; srb->pccb->ccb_h.status |= CAM_UNCOR_PARITY; /*unknown error or crc error just for retry*/ arcmsr_srb_complete(srb, 1); @@ -774,7 +822,8 @@ static void arcmsr_drain_donequeue(struc /* check if command done with no error*/ switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_C: - srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb & 0xFFFFFFE0));/*frame must be 32 bytes aligned*/ + case ACB_ADAPTER_TYPE_D: + srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb & 0xFFFFFFE0)); /*frame must be 32 bytes aligned*/ break; case ACB_ADAPTER_TYPE_A: case ACB_ADAPTER_TYPE_B: @@ -782,7 +831,7 @@ static void arcmsr_drain_donequeue(struc srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb << 5));/*frame must be 32 bytes aligned*/ break; } - if((srb->acb!=acb) || (srb->srb_state!=ARCMSR_SRB_START)) { + if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) { if(srb->srb_state == ARCMSR_SRB_TIMEOUT) { arcmsr_free_srb(srb); printf("arcmsr%d: srb='%p' return srb has been timeouted\n", acb->pci_unit, srb); @@ -799,17 +848,17 @@ static void arcmsr_drain_donequeue(struc ************************************************************************** ************************************************************************** */ -static void arcmsr_srb_timeout(void* arg) +static void arcmsr_srb_timeout(void *arg) { struct CommandControlBlock *srb = (struct CommandControlBlock *)arg; struct AdapterControlBlock *acb; int target, lun; u_int8_t cmd; - target=srb->pccb->ccb_h.target_id; - lun=srb->pccb->ccb_h.target_lun; + target = srb->pccb->ccb_h.target_id; + lun = srb->pccb->ccb_h.target_lun; acb = srb->acb; - ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); + ARCMSR_LOCK_ACQUIRE(&acb->isr_lock); if(srb->srb_state == ARCMSR_SRB_START) { cmd = srb->pccb->csio.cdb_io.cdb_bytes[0]; @@ -819,7 +868,7 @@ static void arcmsr_srb_timeout(void* arg printf("arcmsr%d: scsi id %d lun %d cmd=0x%x srb='%p' ccb command time out!\n", acb->pci_unit, target, lun, cmd, srb); } - ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); + ARCMSR_LOCK_RELEASE(&acb->isr_lock); #ifdef ARCMSR_DEBUG1 arcmsr_dump_data(acb); #endif @@ -840,10 +889,10 @@ static void arcmsr_done4abort_postqueue( u_int32_t outbound_intstatus; /*clear and abort all outbound posted Q*/ - outbound_intstatus=CHIP_REG_READ32(HBA_MessageUnit, 0, outbound_intstatus) & acb->outbound_int_enable; + outbound_intstatus = CHIP_REG_READ32(HBA_MessageUnit, 0, outbound_intstatus) & acb->outbound_int_enable; CHIP_REG_WRITE32(HBA_MessageUnit, 0, outbound_intstatus, outbound_intstatus);/*clear interrupt*/ while(((flag_srb=CHIP_REG_READ32(HBA_MessageUnit, 0, outbound_queueport)) != 0xFFFFFFFF) && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) { - error=(flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; + error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; arcmsr_drain_donequeue(acb, flag_srb, error); } } @@ -854,26 +903,30 @@ static void arcmsr_done4abort_postqueue( /*clear all outbound posted Q*/ CHIP_REG_WRITE32(HBB_DOORBELL, 0, iop2drv_doorbell, ARCMSR_DOORBELL_INT_CLEAR_PATTERN); /* clear doorbell interrupt */ for(i=0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) { - if((flag_srb=phbbmu->done_qbuffer[i])!=0) { - phbbmu->done_qbuffer[i]=0; - error=(flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; + if((flag_srb = phbbmu->done_qbuffer[i]) != 0) { + phbbmu->done_qbuffer[i] = 0; + error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; arcmsr_drain_donequeue(acb, flag_srb, error); } - phbbmu->post_qbuffer[i]=0; + phbbmu->post_qbuffer[i] = 0; }/*drain reply FIFO*/ - phbbmu->doneq_index=0; - phbbmu->postq_index=0; + phbbmu->doneq_index = 0; + phbbmu->postq_index = 0; } break; case ACB_ADAPTER_TYPE_C: { while((CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_status) & ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR) && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) { - flag_srb=CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_queueport_low); - error=(flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1)?TRUE:FALSE; + flag_srb = CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_queueport_low); + error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1) ? TRUE : FALSE; arcmsr_drain_donequeue(acb, flag_srb, error); } } break; + case ACB_ADAPTER_TYPE_D: { + arcmsr_hbd_postqueue_isr(acb); + } + break; } } /* @@ -888,15 +941,15 @@ static void arcmsr_iop_reset(struct Adap if(acb->srboutstandingcount>0) { /* disable all outbound interrupt */ - intmask_org=arcmsr_disable_allintr(acb); + intmask_org = arcmsr_disable_allintr(acb); /*clear and abort all outbound posted Q*/ arcmsr_done4abort_postqueue(acb); /* talk to iop 331 outstanding command aborted*/ arcmsr_abort_allcmd(acb); - for(i=0;ipsrb_pool[i]; - if(srb->srb_state==ARCMSR_SRB_START) { - srb->srb_state=ARCMSR_SRB_ABORTED; + for(i=0; i < ARCMSR_MAX_FREESRB_NUM; i++) { + srb = acb->psrb_pool[i]; + if(srb->srb_state == ARCMSR_SRB_START) { + srb->srb_state = ARCMSR_SRB_ABORTED; srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; arcmsr_srb_complete(srb, 1); printf("arcmsr%d: scsi id=%d lun=%d srb='%p' aborted\n" @@ -907,13 +960,11 @@ static void arcmsr_iop_reset(struct Adap /* enable all outbound interrupt */ arcmsr_enable_allintr(acb, intmask_org); } - acb->srboutstandingcount=0; - acb->workingsrb_doneindex=0; - acb->workingsrb_startindex=0; -#ifdef ARCMSR_DEBUG1 + acb->srboutstandingcount = 0; + acb->workingsrb_doneindex = 0; + acb->workingsrb_startindex = 0; acb->pktRequestCount = 0; acb->pktReturnCount = 0; -#endif } /* ********************************************************************** @@ -922,67 +973,66 @@ static void arcmsr_iop_reset(struct Adap static void arcmsr_build_srb(struct CommandControlBlock *srb, bus_dma_segment_t *dm_segs, u_int32_t nseg) { - struct ARCMSR_CDB * arcmsr_cdb= &srb->arcmsr_cdb; - u_int8_t * psge=(u_int8_t *)&arcmsr_cdb->u; + struct ARCMSR_CDB *arcmsr_cdb = &srb->arcmsr_cdb; + u_int8_t *psge = (u_int8_t *)&arcmsr_cdb->u; u_int32_t address_lo, address_hi; - union ccb * pccb=srb->pccb; - struct ccb_scsiio * pcsio= &pccb->csio; - u_int32_t arccdbsize=0x30; + union ccb *pccb = srb->pccb; + struct ccb_scsiio *pcsio = &pccb->csio; + u_int32_t arccdbsize = 0x30; memset(arcmsr_cdb, 0, sizeof(struct ARCMSR_CDB)); - arcmsr_cdb->Bus=0; - arcmsr_cdb->TargetID=pccb->ccb_h.target_id; - arcmsr_cdb->LUN=pccb->ccb_h.target_lun; - arcmsr_cdb->Function=1; - arcmsr_cdb->CdbLength=(u_int8_t)pcsio->cdb_len; - arcmsr_cdb->Context=0; + arcmsr_cdb->Bus = 0; + arcmsr_cdb->TargetID = pccb->ccb_h.target_id; + arcmsr_cdb->LUN = pccb->ccb_h.target_lun; + arcmsr_cdb->Function = 1; + arcmsr_cdb->CdbLength = (u_int8_t)pcsio->cdb_len; bcopy(pcsio->cdb_io.cdb_bytes, arcmsr_cdb->Cdb, pcsio->cdb_len); if(nseg != 0) { - struct AdapterControlBlock *acb=srb->acb; + struct AdapterControlBlock *acb = srb->acb; bus_dmasync_op_t op; - u_int32_t length, i, cdb_sgcount=0; + u_int32_t length, i, cdb_sgcount = 0; if((pccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - op=BUS_DMASYNC_PREREAD; + op = BUS_DMASYNC_PREREAD; } else { - op=BUS_DMASYNC_PREWRITE; - arcmsr_cdb->Flags|=ARCMSR_CDB_FLAG_WRITE; - srb->srb_flags|=SRB_FLAG_WRITE; + op = BUS_DMASYNC_PREWRITE; + arcmsr_cdb->Flags |= ARCMSR_CDB_FLAG_WRITE; + srb->srb_flags |= SRB_FLAG_WRITE; } bus_dmamap_sync(acb->dm_segs_dmat, srb->dm_segs_dmamap, op); - for(i=0;iaddress=address_lo; - pdma_sg->length=length; + length = arcmsr_htole32(dm_segs[i].ds_len); + address_lo = arcmsr_htole32(dma_addr_lo32(dm_segs[i].ds_addr)); + address_hi = arcmsr_htole32(dma_addr_hi32(dm_segs[i].ds_addr)); + if(address_hi == 0) { + struct SG32ENTRY *pdma_sg = (struct SG32ENTRY *)psge; + pdma_sg->address = address_lo; + pdma_sg->length = length; psge += sizeof(struct SG32ENTRY); arccdbsize += sizeof(struct SG32ENTRY); } else { - u_int32_t sg64s_size=0, tmplength=length; + u_int32_t sg64s_size = 0, tmplength = length; while(1) { u_int64_t span4G, length0; - struct SG64ENTRY * pdma_sg=(struct SG64ENTRY *)psge; + struct SG64ENTRY *pdma_sg = (struct SG64ENTRY *)psge; - span4G=(u_int64_t)address_lo + tmplength; - pdma_sg->addresshigh=address_hi; - pdma_sg->address=address_lo; + span4G = (u_int64_t)address_lo + tmplength; + pdma_sg->addresshigh = address_hi; + pdma_sg->address = address_lo; if(span4G > 0x100000000) { /*see if cross 4G boundary*/ - length0=0x100000000-address_lo; - pdma_sg->length=(u_int32_t)length0|IS_SG64_ADDR; - address_hi=address_hi+1; - address_lo=0; - tmplength=tmplength-(u_int32_t)length0; + length0 = 0x100000000-address_lo; + pdma_sg->length = (u_int32_t)length0 | IS_SG64_ADDR; + address_hi = address_hi+1; + address_lo = 0; + tmplength = tmplength - (u_int32_t)length0; sg64s_size += sizeof(struct SG64ENTRY); psge += sizeof(struct SG64ENTRY); cdb_sgcount++; } else { - pdma_sg->length=tmplength|IS_SG64_ADDR; + pdma_sg->length = tmplength | IS_SG64_ADDR; sg64s_size += sizeof(struct SG64ENTRY); psge += sizeof(struct SG64ENTRY); break; @@ -992,15 +1042,16 @@ static void arcmsr_build_srb(struct Comm } cdb_sgcount++; } - arcmsr_cdb->sgcount=(u_int8_t)cdb_sgcount; - arcmsr_cdb->DataLength=pcsio->dxfer_len; + arcmsr_cdb->sgcount = (u_int8_t)cdb_sgcount; + arcmsr_cdb->DataLength = pcsio->dxfer_len; if( arccdbsize > 256) { - arcmsr_cdb->Flags|=ARCMSR_CDB_FLAG_SGL_BSIZE; + arcmsr_cdb->Flags |= ARCMSR_CDB_FLAG_SGL_BSIZE; } } else { arcmsr_cdb->DataLength = 0; } - srb->arc_cdb_size=arccdbsize; + srb->arc_cdb_size = arccdbsize; + arcmsr_cdb->msgPages = (arccdbsize/256) + ((arccdbsize % 256) ? 1 : 0); } /* ************************************************************************** @@ -1008,46 +1059,45 @@ static void arcmsr_build_srb(struct Comm */ static void arcmsr_post_srb(struct AdapterControlBlock *acb, struct CommandControlBlock *srb) { - u_int32_t cdb_shifted_phyaddr=(u_int32_t) srb->cdb_shifted_phyaddr; - struct ARCMSR_CDB * arcmsr_cdb=(struct ARCMSR_CDB *)&srb->arcmsr_cdb; + u_int32_t cdb_phyaddr_low = (u_int32_t) srb->cdb_phyaddr_low; + struct ARCMSR_CDB *arcmsr_cdb = (struct ARCMSR_CDB *)&srb->arcmsr_cdb; bus_dmamap_sync(acb->srb_dmat, acb->srb_dmamap, (srb->srb_flags & SRB_FLAG_WRITE) ? BUS_DMASYNC_POSTWRITE:BUS_DMASYNC_POSTREAD); atomic_add_int(&acb->srboutstandingcount, 1); - srb->srb_state=ARCMSR_SRB_START; + srb->srb_state = ARCMSR_SRB_START; switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_A: { if(arcmsr_cdb->Flags & ARCMSR_CDB_FLAG_SGL_BSIZE) { - CHIP_REG_WRITE32(HBA_MessageUnit, 0, inbound_queueport, cdb_shifted_phyaddr|ARCMSR_SRBPOST_FLAG_SGL_BSIZE); + CHIP_REG_WRITE32(HBA_MessageUnit, 0, inbound_queueport, cdb_phyaddr_low|ARCMSR_SRBPOST_FLAG_SGL_BSIZE); } else { - CHIP_REG_WRITE32(HBA_MessageUnit, 0, inbound_queueport, cdb_shifted_phyaddr); + CHIP_REG_WRITE32(HBA_MessageUnit, 0, inbound_queueport, cdb_phyaddr_low); } } break; case ACB_ADAPTER_TYPE_B: { - struct HBB_MessageUnit *phbbmu=(struct HBB_MessageUnit *)acb->pmu; + struct HBB_MessageUnit *phbbmu = (struct HBB_MessageUnit *)acb->pmu; int ending_index, index; - index=phbbmu->postq_index; - ending_index=((index+1)%ARCMSR_MAX_HBB_POSTQUEUE); - phbbmu->post_qbuffer[ending_index]=0; + index = phbbmu->postq_index; + ending_index = ((index+1) % ARCMSR_MAX_HBB_POSTQUEUE); + phbbmu->post_qbuffer[ending_index] = 0; if(arcmsr_cdb->Flags & ARCMSR_CDB_FLAG_SGL_BSIZE) { - phbbmu->post_qbuffer[index]= cdb_shifted_phyaddr|ARCMSR_SRBPOST_FLAG_SGL_BSIZE; + phbbmu->post_qbuffer[index] = cdb_phyaddr_low | ARCMSR_SRBPOST_FLAG_SGL_BSIZE; } else { - phbbmu->post_qbuffer[index]= cdb_shifted_phyaddr; + phbbmu->post_qbuffer[index] = cdb_phyaddr_low; } index++; index %= ARCMSR_MAX_HBB_POSTQUEUE; /*if last index number set it to 0 */ - phbbmu->postq_index=index; + phbbmu->postq_index = index; CHIP_REG_WRITE32(HBB_DOORBELL, 0, drv2iop_doorbell, ARCMSR_DRV2IOP_CDB_POSTED); } break; - case ACB_ADAPTER_TYPE_C: - { + case ACB_ADAPTER_TYPE_C: { u_int32_t ccb_post_stamp, arc_cdb_size, cdb_phyaddr_hi32; - arc_cdb_size=(srb->arc_cdb_size>0x300)?0x300:srb->arc_cdb_size; - ccb_post_stamp=(cdb_shifted_phyaddr | ((arc_cdb_size-1) >> 6) | 1); + arc_cdb_size = (srb->arc_cdb_size > 0x300) ? 0x300 : srb->arc_cdb_size; + ccb_post_stamp = (cdb_phyaddr_low | ((arc_cdb_size-1) >> 6) | 1); cdb_phyaddr_hi32 = acb->srb_phyaddr.B.phyadd_high; if(cdb_phyaddr_hi32) { @@ -1060,33 +1110,67 @@ static void arcmsr_post_srb(struct Adapt } } break; + case ACB_ADAPTER_TYPE_D: { + struct HBD_MessageUnit0 *phbdmu = (struct HBD_MessageUnit0 *)acb->pmu; + u_int16_t index_stripped; + u_int16_t postq_index; + struct InBound_SRB *pinbound_srb; + + ARCMSR_LOCK_ACQUIRE(&acb->postDone_lock); + postq_index = phbdmu->postq_index; + pinbound_srb = (struct InBound_SRB *)&phbdmu->post_qbuffer[postq_index & 0xFF]; + pinbound_srb->addressHigh = srb->cdb_phyaddr_high; + pinbound_srb->addressLow = srb->cdb_phyaddr_low; + pinbound_srb->length = srb->arc_cdb_size >> 2; + arcmsr_cdb->Context = srb->cdb_phyaddr_low; + if (postq_index & 0x4000) { + index_stripped = postq_index & 0xFF; + index_stripped += 1; + index_stripped %= ARCMSR_MAX_HBD_POSTQUEUE; + phbdmu->postq_index = index_stripped ? (index_stripped | 0x4000) : index_stripped; + } else { + index_stripped = postq_index; + index_stripped += 1; + index_stripped %= ARCMSR_MAX_HBD_POSTQUEUE; + phbdmu->postq_index = index_stripped ? index_stripped : (index_stripped | 0x4000); + } + CHIP_REG_WRITE32(HBD_MessageUnit, 0, inboundlist_write_pointer, postq_index); + ARCMSR_LOCK_RELEASE(&acb->postDone_lock); + } + break; } } /* ************************************************************************ ************************************************************************ */ -static struct QBUFFER * arcmsr_get_iop_rqbuffer( struct AdapterControlBlock *acb) +static struct QBUFFER *arcmsr_get_iop_rqbuffer( struct AdapterControlBlock *acb) { struct QBUFFER *qbuffer=NULL; switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_A: { - struct HBA_MessageUnit *phbamu=(struct HBA_MessageUnit *)acb->pmu; + struct HBA_MessageUnit *phbamu = (struct HBA_MessageUnit *)acb->pmu; - qbuffer=(struct QBUFFER *)&phbamu->message_rbuffer; + qbuffer = (struct QBUFFER *)&phbamu->message_rbuffer; } break; case ACB_ADAPTER_TYPE_B: { - struct HBB_MessageUnit *phbbmu=(struct HBB_MessageUnit *)acb->pmu; + struct HBB_MessageUnit *phbbmu = (struct HBB_MessageUnit *)acb->pmu; - qbuffer=(struct QBUFFER *)&phbbmu->hbb_rwbuffer->message_rbuffer; + qbuffer = (struct QBUFFER *)&phbbmu->hbb_rwbuffer->message_rbuffer; } break; case ACB_ADAPTER_TYPE_C: { - struct HBC_MessageUnit *phbcmu=(struct HBC_MessageUnit *)acb->pmu; + struct HBC_MessageUnit *phbcmu = (struct HBC_MessageUnit *)acb->pmu; - qbuffer=(struct QBUFFER *)&phbcmu->message_rbuffer; + qbuffer = (struct QBUFFER *)&phbcmu->message_rbuffer; + } + break; + case ACB_ADAPTER_TYPE_D: { + struct HBD_MessageUnit0 *phbdmu = (struct HBD_MessageUnit0 *)acb->pmu; + + qbuffer = (struct QBUFFER *)&phbdmu->phbdmu->message_rbuffer; } break; } @@ -1096,27 +1180,33 @@ static struct QBUFFER * arcmsr_get_iop_r ************************************************************************ ************************************************************************ */ -static struct QBUFFER * arcmsr_get_iop_wqbuffer( struct AdapterControlBlock *acb) +static struct QBUFFER *arcmsr_get_iop_wqbuffer( struct AdapterControlBlock *acb) { - struct QBUFFER *qbuffer=NULL; + struct QBUFFER *qbuffer = NULL; switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_A: { - struct HBA_MessageUnit *phbamu=(struct HBA_MessageUnit *)acb->pmu; + struct HBA_MessageUnit *phbamu = (struct HBA_MessageUnit *)acb->pmu; - qbuffer=(struct QBUFFER *)&phbamu->message_wbuffer; + qbuffer = (struct QBUFFER *)&phbamu->message_wbuffer; } break; case ACB_ADAPTER_TYPE_B: { - struct HBB_MessageUnit *phbbmu=(struct HBB_MessageUnit *)acb->pmu; + struct HBB_MessageUnit *phbbmu = (struct HBB_MessageUnit *)acb->pmu; - qbuffer=(struct QBUFFER *)&phbbmu->hbb_rwbuffer->message_wbuffer; + qbuffer = (struct QBUFFER *)&phbbmu->hbb_rwbuffer->message_wbuffer; } break; case ACB_ADAPTER_TYPE_C: { - struct HBC_MessageUnit *phbcmu=(struct HBC_MessageUnit *)acb->pmu; + struct HBC_MessageUnit *phbcmu = (struct HBC_MessageUnit *)acb->pmu; - qbuffer=(struct QBUFFER *)&phbcmu->message_wbuffer; + qbuffer = (struct QBUFFER *)&phbcmu->message_wbuffer; + } + break; + case ACB_ADAPTER_TYPE_D: { + struct HBD_MessageUnit0 *phbdmu = (struct HBD_MessageUnit0 *)acb->pmu; + + qbuffer = (struct QBUFFER *)&phbdmu->phbdmu->message_wbuffer; } break; } @@ -1143,6 +1233,12 @@ static void arcmsr_iop_message_read(stru /* let IOP know data has been read */ CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_doorbell, ARCMSR_HBCMU_DRV2IOP_DATA_READ_OK); } + break; + case ACB_ADAPTER_TYPE_D: { + /* let IOP know data has been read */ + CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_doorbell, ARCMSR_HBDMU_DRV2IOP_DATA_OUT_READ); + } + break; } } /* @@ -1176,37 +1272,14 @@ static void arcmsr_iop_message_wrote(str CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_doorbell, ARCMSR_HBCMU_DRV2IOP_DATA_WRITE_OK); } break; - } -} -/* -********************************************************************** -********************************************************************** -*/ -static void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *acb) -{ - u_int8_t *pQbuffer; - struct QBUFFER *pwbuffer; - u_int8_t * iop_data; - int32_t allxfer_len=0; - - pwbuffer=arcmsr_get_iop_wqbuffer(acb); - iop_data=(u_int8_t *)pwbuffer->data; - if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) { - acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ); - while((acb->wqbuf_firstindex!=acb->wqbuf_lastindex) - && (allxfer_len<124)) { - pQbuffer=&acb->wqbuffer[acb->wqbuf_firstindex]; - memcpy(iop_data, pQbuffer, 1); - acb->wqbuf_firstindex++; - acb->wqbuf_firstindex %=ARCMSR_MAX_QBUFFER; /*if last index number set it to 0 */ - iop_data++; - allxfer_len++; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 21:02:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7671DB10; Tue, 18 Dec 2012 21:02:39 +0000 (UTC) (envelope-from eadler@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 3FBB48FC0A; Tue, 18 Dec 2012 21:02:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIL2dN2027598; Tue, 18 Dec 2012 21:02:39 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIL2cqj027595; Tue, 18 Dec 2012 21:02:38 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212182102.qBIL2cqj027595@svn.freebsd.org> From: Eitan Adler Date: Tue, 18 Dec 2012 21:02:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244407 - in head: tools/regression/usr.bin/printf usr.bin/printf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 21:02:39 -0000 Author: eadler Date: Tue Dec 18 21:02:38 2012 New Revision: 244407 URL: http://svnweb.freebsd.org/changeset/base/244407 Log: POSIX requires that non-existent or null arguments be treated as if a zero argument were supplied. Add a regression test to catch this case as well. PR: bin/174521 Submitted by: Daniel Shahaf (pr) Submitted by: Mark Johnston (initial patch) Reviewed by: jilles Approved by: cperciva (implicit) MFC after: 3 weeks Added: head/tools/regression/usr.bin/printf/regress.zero.out (contents, props changed) Modified: head/tools/regression/usr.bin/printf/regress.sh head/usr.bin/printf/printf.c Modified: head/tools/regression/usr.bin/printf/regress.sh ============================================================================== --- head/tools/regression/usr.bin/printf/regress.sh Tue Dec 18 20:47:23 2012 (r244406) +++ head/tools/regression/usr.bin/printf/regress.sh Tue Dec 18 21:02:38 2012 (r244407) @@ -2,7 +2,7 @@ REGRESSION_START($1) -echo '1..11' +echo '1..12' REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"') REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123') @@ -15,5 +15,6 @@ REGRESSION_TEST(`m3', `printf "%%%s\n" a REGRESSION_TEST(`m4', `printf "%d,%f,%c,%s\n"') REGRESSION_TEST(`m5', `printf -- "-d\n"') REGRESSION_TEST(`s', `printf "%.3s,%-5s\n" abcd abc') +REGRESSION_TEST('zero', `printf "%u%u\n" 15') REGRESSION_END() Added: head/tools/regression/usr.bin/printf/regress.zero.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/printf/regress.zero.out Tue Dec 18 21:02:38 2012 (r244407) @@ -0,0 +1 @@ +150 Modified: head/usr.bin/printf/printf.c ============================================================================== --- head/usr.bin/printf/printf.c Tue Dec 18 20:47:23 2012 (r244406) +++ head/usr.bin/printf/printf.c Tue Dec 18 21:02:38 2012 (r244407) @@ -473,7 +473,7 @@ getnum(intmax_t *ip, uintmax_t *uip, int int rval; if (!*gargv) { - *ip = 0; + *ip = *uip = 0; return (0); } if (**gargv == '"' || **gargv == '\'') { From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 20:45:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC44B434; Tue, 18 Dec 2012 20:45:11 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 748D88FC1B; Tue, 18 Dec 2012 20:45:11 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C7C42B9B2; Tue, 18 Dec 2012 15:45:10 -0500 (EST) From: John Baldwin To: Alfred Perlstein Subject: Re: svn commit: r244112 - head/sys/kern Date: Tue, 18 Dec 2012 15:37:22 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212171439.27297.jhb@freebsd.org> <50CF8CE7.4020906@mu.org> In-Reply-To: <50CF8CE7.4020906@mu.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201212181537.23341.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 18 Dec 2012 15:45:10 -0500 (EST) X-Mailman-Approved-At: Tue, 18 Dec 2012 21:09:27 +0000 Cc: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , Andriy Gapon , Gleb Smirnoff , Robert Watson , Navdeep Parhar , Bruce Evans , svn-src-head@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 20:45:11 -0000 On Monday, December 17, 2012 4:21:43 pm Alfred Perlstein wrote: > On 12/17/12 11:39 AM, John Baldwin wrote: > > On Saturday, December 15, 2012 1:04:17 am Bruce Evans wrote: > >> On Fri, 14 Dec 2012, Alfred Perlstein wrote: > >> > >>> On 12/14/12 4:12 PM, Robert Watson wrote: > >>>> On Fri, 14 Dec 2012, John Baldwin wrote: > >>>> > >>>>> On Thursday, December 13, 2012 4:02:15 am Gleb Smirnoff wrote: > >>>>>> On Wed, Dec 12, 2012 at 04:53:48PM -0800, Alfred Perlstein wrote: A> The > >>>>>> problem again is that not all the KASSERTS are inviolable, if you A> want > >>>>>> to do a project to split them, then please do, it would really be A> > >>>>>> helpful, as for now, they are a mis-mash of death/warnings and there are > >>>>>> A> at least three vendors who approve of this as well as 3 long term A> > >>>>>> committers that approved my change (not including Adrian). > >>>>>> > >>>>>> Can you show examples of not inviolable KASSERTs? > >>>>> There are none. They are all assertions for a reason. However, in my > >> Not even one whose existence is a bug? :-) > > They should just not exist at all then. :) All the more reason for them to > > panic early and often so developers will be prompted to remove them. > > > This is hard to explain to a customer. > > customer: "So we ran your debug image and got you a panic, here is the > information. So can you tell us what is the problem?" > alfred: "well that is due to XXX other thing that is broken, thanks for > helping us resolve that unrelated problem!" > customer: "i hate you" > alfred: "get in line." Are your customers running HEAD? Assertions in a stable branch have been through testing and generally aren't bogus, so dying on incorrect assertions (meaning the assertion tripped for non-buggy code) should not be the common case. Thus, that shouldn't really be the basis for an argument on this. I can also come up with arbitrary strawmen: customer: "help! we lost a bunch of data!" jhb: "oh, well, I can see why: the box reported this critical error while your data was still there, but it went ahead and corrupted it all anyway even though it knew about the error because I thought you wanted longer uptimes" jhb: "don't worry, I have a patch to fix the error" customer: "don't bother, we are switching to X" -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 21:13:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1BDCDF80; Tue, 18 Dec 2012 21:13:04 +0000 (UTC) (envelope-from emaste@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 F3B5C8FC13; Tue, 18 Dec 2012 21:13:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBILD3sr029702; Tue, 18 Dec 2012 21:13:03 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBILD3nj029701; Tue, 18 Dec 2012 21:13:03 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201212182113.qBILD3nj029701@svn.freebsd.org> From: Ed Maste Date: Tue, 18 Dec 2012 21:13:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244408 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 21:13:04 -0000 Author: emaste Date: Tue Dec 18 21:13:03 2012 New Revision: 244408 URL: http://svnweb.freebsd.org/changeset/base/244408 Log: No reason to install debug data with the schg flag Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Tue Dec 18 21:02:38 2012 (r244407) +++ head/share/mk/bsd.lib.mk Tue Dec 18 21:13:03 2012 (r244408) @@ -282,7 +282,7 @@ _libinstall: ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR} .if defined(DEBUG_FLAGS) ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ + ${_INSTALLFLAGS} \ ${SHLIB_NAME}.symbols ${DESTDIR}${SHLIBDIR} .endif .if defined(SHLIB_LINK) From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 21:42:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2E857B3C; Tue, 18 Dec 2012 21:42:46 +0000 (UTC) (envelope-from eadler@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 12B7C8FC13; Tue, 18 Dec 2012 21:42:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBILgjHF035018; Tue, 18 Dec 2012 21:42:45 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBILgjX5035017; Tue, 18 Dec 2012 21:42:45 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212182142.qBILgjX5035017@svn.freebsd.org> From: Eitan Adler Date: Tue, 18 Dec 2012 21:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244409 - head/tools/regression/usr.bin/printf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 21:42:46 -0000 Author: eadler Date: Tue Dec 18 21:42:45 2012 New Revision: 244409 URL: http://svnweb.freebsd.org/changeset/base/244409 Log: Add an additional regression tests for other cases to ensure these do not get fixed by accident. Modified: head/tools/regression/usr.bin/printf/regress.sh Modified: head/tools/regression/usr.bin/printf/regress.sh ============================================================================== --- head/tools/regression/usr.bin/printf/regress.sh Tue Dec 18 21:13:03 2012 (r244408) +++ head/tools/regression/usr.bin/printf/regress.sh Tue Dec 18 21:42:45 2012 (r244409) @@ -16,5 +16,8 @@ REGRESSION_TEST(`m4', `printf "%d,%f,%c, REGRESSION_TEST(`m5', `printf -- "-d\n"') REGRESSION_TEST(`s', `printf "%.3s,%-5s\n" abcd abc') REGRESSION_TEST('zero', `printf "%u%u\n" 15') +REGRESSION_TEST('zero', `printf "%d%d\n" 15') +REGRESSION_TEST('zero', `printf "%d%u\n" 15') +REGRESSION_TEST('zero', `printf "%u%d\n" 15') REGRESSION_END() From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 21:50:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 71D10F9B; Tue, 18 Dec 2012 21:50:49 +0000 (UTC) (envelope-from jimharris@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 550D48FC24; Tue, 18 Dec 2012 21:50:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBILonjP036260; Tue, 18 Dec 2012 21:50:49 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBILomNf036256; Tue, 18 Dec 2012 21:50:48 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201212182150.qBILomNf036256@svn.freebsd.org> From: Jim Harris Date: Tue, 18 Dec 2012 21:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244410 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 21:50:49 -0000 Author: jimharris Date: Tue Dec 18 21:50:48 2012 New Revision: 244410 URL: http://svnweb.freebsd.org/changeset/base/244410 Log: Do not use taskqueue to defer completion work when using INTx. INTx now matches MSI-X behavior. Sponsored by: Intel Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Tue Dec 18 21:42:45 2012 (r244409) +++ head/sys/dev/nvme/nvme.c Tue Dec 18 21:50:48 2012 (r244410) @@ -298,11 +298,6 @@ nvme_detach (device_t dev) struct nvme_namespace *ns; int i; - if (ctrlr->taskqueue) { - taskqueue_drain(ctrlr->taskqueue, &ctrlr->task); - taskqueue_free(ctrlr->taskqueue); - } - for (i = 0; i < NVME_MAX_NAMESPACES; i++) { ns = &ctrlr->ns[i]; if (ns->cdev) Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Tue Dec 18 21:42:45 2012 (r244409) +++ head/sys/dev/nvme/nvme_ctrlr.c Tue Dec 18 21:50:48 2012 (r244410) @@ -619,10 +619,12 @@ err: } static void -nvme_ctrlr_intx_task(void *arg, int pending) +nvme_ctrlr_intx_handler(void *arg) { struct nvme_controller *ctrlr = arg; + nvme_mmio_write_4(ctrlr, intms, 1); + nvme_qpair_process_completions(&ctrlr->adminq); if (ctrlr->ioq[0].cpl) @@ -631,15 +633,6 @@ nvme_ctrlr_intx_task(void *arg, int pend nvme_mmio_write_4(ctrlr, intmc, 1); } -static void -nvme_ctrlr_intx_handler(void *arg) -{ - struct nvme_controller *ctrlr = arg; - - nvme_mmio_write_4(ctrlr, intms, 1); - taskqueue_enqueue_fast(ctrlr->taskqueue, &ctrlr->task); -} - static int nvme_ctrlr_configure_intx(struct nvme_controller *ctrlr) { @@ -665,12 +658,6 @@ nvme_ctrlr_configure_intx(struct nvme_co return (ENOMEM); } - TASK_INIT(&ctrlr->task, 0, nvme_ctrlr_intx_task, ctrlr); - ctrlr->taskqueue = taskqueue_create_fast("nvme_taskq", M_NOWAIT, - taskqueue_thread_enqueue, &ctrlr->taskqueue); - taskqueue_start_threads(&ctrlr->taskqueue, 1, PI_NET, - "%s intx taskq", device_get_nameunit(ctrlr->dev)); - return (0); } Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Tue Dec 18 21:42:45 2012 (r244409) +++ head/sys/dev/nvme/nvme_private.h Tue Dec 18 21:50:48 2012 (r244410) @@ -36,7 +36,6 @@ #include #include #include -#include #include @@ -222,8 +221,6 @@ struct nvme_controller { int rid; struct resource *res; void *tag; - struct task task; - struct taskqueue *taskqueue; bus_dma_tag_t hw_desc_tag; bus_dmamap_t hw_desc_map; From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 22:10:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D12465F; Tue, 18 Dec 2012 22:10:41 +0000 (UTC) (envelope-from jimharris@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 018B98FC0A; Tue, 18 Dec 2012 22:10:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIMAesh039638; Tue, 18 Dec 2012 22:10:40 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIMAeSw039637; Tue, 18 Dec 2012 22:10:40 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201212182210.qBIMAeSw039637@svn.freebsd.org> From: Jim Harris Date: Tue, 18 Dec 2012 22:10:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244411 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 22:10:41 -0000 Author: jimharris Date: Tue Dec 18 22:10:40 2012 New Revision: 244411 URL: http://svnweb.freebsd.org/changeset/base/244411 Log: Simplify module definition by adding nvme_modevent to DRIVER_MODULE() definition. Submitted by: Carl Delsey Modified: head/sys/dev/nvme/nvme.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Tue Dec 18 21:50:48 2012 (r244410) +++ head/sys/dev/nvme/nvme.c Tue Dec 18 22:10:40 2012 (r244411) @@ -53,6 +53,7 @@ MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) m static int nvme_probe(device_t); static int nvme_attach(device_t); static int nvme_detach(device_t); +static int nvme_modevent(module_t mod, int type, void *arg); static devclass_t nvme_devclass; @@ -70,7 +71,7 @@ static driver_t nvme_pci_driver = { sizeof(struct nvme_controller), }; -DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, 0, 0); +DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, nvme_modevent, 0); MODULE_VERSION(nvme, 1); static struct _pcsid @@ -196,14 +197,6 @@ nvme_modevent(module_t mod, int type, vo return (0); } -moduledata_t nvme_mod = { - "nvme", - (modeventhand_t)nvme_modevent, - 0 -}; - -DECLARE_MODULE(nvme, nvme_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); - void nvme_dump_command(struct nvme_command *cmd) { From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 22:18:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 42CCF9B5; Tue, 18 Dec 2012 22:18:55 +0000 (UTC) (envelope-from gonzo@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 26A078FC15; Tue, 18 Dec 2012 22:18:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIMItn4041210; Tue, 18 Dec 2012 22:18:55 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIMIt01041209; Tue, 18 Dec 2012 22:18:55 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201212182218.qBIMIt01041209@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 18 Dec 2012 22:18:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244412 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 22:18:55 -0000 Author: gonzo Date: Tue Dec 18 22:18:54 2012 New Revision: 244412 URL: http://svnweb.freebsd.org/changeset/base/244412 Log: Add sysctls for changing GPIO pins function Submitted by: Luiz Otavio O Souza Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Tue Dec 18 22:10:40 2012 (r244411) +++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Tue Dec 18 22:18:54 2012 (r244412) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -66,6 +67,11 @@ __FBSDID("$FreeBSD$"); #define BCM_GPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN) +struct bcm_gpio_sysctl { + struct bcm_gpio_softc *sc; + uint32_t pin; +}; + struct bcm_gpio_softc { device_t sc_dev; struct mtx sc_mtx; @@ -78,6 +84,7 @@ struct bcm_gpio_softc { int sc_ro_npins; int sc_ro_pins[BCM_GPIO_PINS]; struct gpio_pin sc_gpio_pins[BCM_GPIO_PINS]; + struct bcm_gpio_sysctl sc_sysctl[BCM_GPIO_PINS]; }; enum bcm_gpio_fsel { @@ -99,6 +106,7 @@ enum bcm_gpio_pud { #define BCM_GPIO_LOCK(_sc) mtx_lock(&_sc->sc_mtx) #define BCM_GPIO_UNLOCK(_sc) mtx_unlock(&_sc->sc_mtx) +#define BCM_GPIO_LOCK_ASSERT(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED) #define BCM_GPIO_GPFSEL(_bank) 0x00 + _bank * 4 #define BCM_GPIO_GPSET(_bank) 0x1c + _bank * 4 @@ -126,53 +134,89 @@ bcm_gpio_pin_is_ro(struct bcm_gpio_softc static uint32_t bcm_gpio_get_function(struct bcm_gpio_softc *sc, uint32_t pin) { - uint32_t bank, data, offset; + uint32_t bank, func, offset; /* Five banks, 10 pins per bank, 3 bits per pin. */ bank = pin / 10; offset = (pin - bank * 10) * 3; BCM_GPIO_LOCK(sc); - data = (BCM_GPIO_READ(sc, BCM_GPIO_GPFSEL(bank)) >> offset) & 7; + func = (BCM_GPIO_READ(sc, BCM_GPIO_GPFSEL(bank)) >> offset) & 7; BCM_GPIO_UNLOCK(sc); -#ifdef DEBUG - device_printf(sc->sc_dev, "pin %d function: ", pin); - switch (data) { + return (func); +} + +static void +bcm_gpio_func_str(uint32_t nfunc, char *buf, int bufsize) +{ + + switch (nfunc) { case BCM_GPIO_INPUT: - printf("input\n"); + strncpy(buf, "input", bufsize); break; case BCM_GPIO_OUTPUT: - printf("output\n"); + strncpy(buf, "output", bufsize); break; case BCM_GPIO_ALT0: - printf("alt0\n"); + strncpy(buf, "alt0", bufsize); break; case BCM_GPIO_ALT1: - printf("alt1\n"); + strncpy(buf, "alt1", bufsize); break; case BCM_GPIO_ALT2: - printf("alt2\n"); + strncpy(buf, "alt2", bufsize); break; case BCM_GPIO_ALT3: - printf("alt3\n"); + strncpy(buf, "alt3", bufsize); break; case BCM_GPIO_ALT4: - printf("alt4\n"); + strncpy(buf, "alt4", bufsize); break; case BCM_GPIO_ALT5: - printf("alt5\n"); + strncpy(buf, "alt5", bufsize); break; + default: + strncpy(buf, "invalid", bufsize); } -#endif +} + +static int +bcm_gpio_str_func(char *func, uint32_t *nfunc) +{ + + if (strcasecmp(func, "input") == 0) + *nfunc = BCM_GPIO_INPUT; + else if (strcasecmp(func, "output") == 0) + *nfunc = BCM_GPIO_OUTPUT; + else if (strcasecmp(func, "alt0") == 0) + *nfunc = BCM_GPIO_ALT0; + else if (strcasecmp(func, "alt1") == 0) + *nfunc = BCM_GPIO_ALT1; + else if (strcasecmp(func, "alt2") == 0) + *nfunc = BCM_GPIO_ALT2; + else if (strcasecmp(func, "alt3") == 0) + *nfunc = BCM_GPIO_ALT3; + else if (strcasecmp(func, "alt4") == 0) + *nfunc = BCM_GPIO_ALT4; + else if (strcasecmp(func, "alt5") == 0) + *nfunc = BCM_GPIO_ALT5; + else + return (-1); - switch (data) { + return (0); +} + +static uint32_t +bcm_gpio_func_flag(uint32_t nfunc) +{ + + switch (nfunc) { case BCM_GPIO_INPUT: return (GPIO_PIN_INPUT); case BCM_GPIO_OUTPUT: return (GPIO_PIN_OUTPUT); } - return (0); } @@ -181,16 +225,17 @@ bcm_gpio_set_function(struct bcm_gpio_so { uint32_t bank, data, offset; + /* Must be called with lock held. */ + BCM_GPIO_LOCK_ASSERT(sc); + /* Five banks, 10 pins per bank, 3 bits per pin. */ bank = pin / 10; offset = (pin - bank * 10) * 3; - BCM_GPIO_LOCK(sc); data = BCM_GPIO_READ(sc, BCM_GPIO_GPFSEL(bank)); data &= ~(7 << offset); data |= (f << offset); BCM_GPIO_WRITE(sc, BCM_GPIO_GPFSEL(bank), data); - BCM_GPIO_UNLOCK(sc); } static void @@ -198,17 +243,18 @@ bcm_gpio_set_pud(struct bcm_gpio_softc * { uint32_t bank, offset; + /* Must be called with lock held. */ + BCM_GPIO_LOCK_ASSERT(sc); + bank = pin / 32; offset = pin - 32 * bank; - BCM_GPIO_LOCK(sc); BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUD(0), state); DELAY(10); BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), (1 << offset)); DELAY(10); BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUD(0), 0); BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), 0); - BCM_GPIO_UNLOCK(sc); } static void @@ -216,6 +262,8 @@ bcm_gpio_pin_configure(struct bcm_gpio_s unsigned int flags) { + BCM_GPIO_LOCK(sc); + /* * Manage input/output. */ @@ -244,6 +292,8 @@ bcm_gpio_pin_configure(struct bcm_gpio_s } } else bcm_gpio_set_pud(sc, pin->gp_pin, BCM_GPIO_NONE); + + BCM_GPIO_UNLOCK(sc); } static int @@ -471,7 +521,7 @@ bcm_gpio_get_ro_pins(struct bcm_gpio_sof printf(","); printf("%d", sc->sc_ro_pins[i]); } - if (i > 0) + if (i > 0) printf("."); printf("\n"); @@ -479,6 +529,89 @@ bcm_gpio_get_ro_pins(struct bcm_gpio_sof } static int +bcm_gpio_func_proc(SYSCTL_HANDLER_ARGS) +{ + char buf[16]; + struct bcm_gpio_softc *sc; + struct bcm_gpio_sysctl *sc_sysctl; + uint32_t nfunc; + int i, error; + + sc_sysctl = arg1; + sc = sc_sysctl->sc; + + /* Get the current pin function. */ + nfunc = bcm_gpio_get_function(sc, sc_sysctl->pin); + bcm_gpio_func_str(nfunc, buf, sizeof(buf)); + + error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + if (error != 0 || req->newptr == NULL) + return (error); + + /* Parse the user supplied string and check for a valid pin function. */ + if (bcm_gpio_str_func(buf, &nfunc) != 0) + return (EINVAL); + + BCM_GPIO_LOCK(sc); + + /* Disable pull-up or pull-down on pin. */ + bcm_gpio_set_pud(sc, sc_sysctl->pin, BCM_GPIO_NONE); + + /* And now set the pin function. */ + bcm_gpio_set_function(sc, sc_sysctl->pin, nfunc); + + /* Update the pin flags. */ + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == sc_sysctl->pin) + break; + } + if (i < sc->sc_gpio_npins) + sc->sc_gpio_pins[i].gp_flags = bcm_gpio_func_flag(nfunc); + + BCM_GPIO_UNLOCK(sc); + + return (0); +} + +static void +bcm_gpio_sysctl_init(struct bcm_gpio_softc *sc) +{ + char pinbuf[3]; + struct bcm_gpio_sysctl *sc_sysctl; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree_node, *pin_node, *pinN_node; + struct sysctl_oid_list *tree, *pin_tree, *pinN_tree; + int i; + + /* + * Add per-pin sysctl tree/handlers. + */ + ctx = device_get_sysctl_ctx(sc->sc_dev); + tree_node = device_get_sysctl_tree(sc->sc_dev); + tree = SYSCTL_CHILDREN(tree_node); + pin_node = SYSCTL_ADD_NODE(ctx, tree, OID_AUTO, "pin", + CTLFLAG_RW, NULL, "GPIO Pins"); + pin_tree = SYSCTL_CHILDREN(pin_node); + + for (i = 0; i < sc->sc_gpio_npins; i++) { + + snprintf(pinbuf, sizeof(pinbuf), "%d", i); + pinN_node = SYSCTL_ADD_NODE(ctx, pin_tree, OID_AUTO, pinbuf, + CTLFLAG_RD, NULL, "GPIO Pin"); + pinN_tree = SYSCTL_CHILDREN(pinN_node); + + sc->sc_sysctl[i].sc = sc; + sc_sysctl = &sc->sc_sysctl[i]; + sc_sysctl->sc = sc; + sc_sysctl->pin = sc->sc_gpio_pins[i].gp_pin; + SYSCTL_ADD_PROC(ctx, pinN_tree, OID_AUTO, "function", + CTLFLAG_RW | CTLTYPE_STRING, sc_sysctl, + sizeof(struct bcm_gpio_sysctl), bcm_gpio_func_proc, + "A", "Pin Function"); + } +} + +static int bcm_gpio_get_reserved_pins(struct bcm_gpio_softc *sc) { int i, j, len, npins; @@ -499,7 +632,7 @@ bcm_gpio_get_reserved_pins(struct bcm_gp */ reserved = 0; while ((node != 0) && (reserved == 0)) { - len = OF_getprop(node, "name", name, + len = OF_getprop(node, "name", name, sizeof(name) - 1); name[len] = 0; if (strcmp(name, "reserved") == 0) @@ -532,7 +665,7 @@ bcm_gpio_get_reserved_pins(struct bcm_gp sc->sc_ro_pins[j++ + sc->sc_ro_npins] = fdt32_to_cpu(pins[i]); } sc->sc_ro_npins += j; - if (i > 0) + if (i > 0) printf("."); printf("\n"); @@ -553,6 +686,7 @@ static int bcm_gpio_attach(device_t dev) { struct bcm_gpio_softc *sc = device_get_softc(dev); + uint32_t func; int i, j, rid; phandle_t gpio; @@ -600,15 +734,18 @@ bcm_gpio_attach(device_t dev) continue; snprintf(sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME, "pin %d", j); + func = bcm_gpio_get_function(sc, j); sc->sc_gpio_pins[i].gp_pin = j; sc->sc_gpio_pins[i].gp_caps = BCM_GPIO_DEFAULT_CAPS; - sc->sc_gpio_pins[i].gp_flags = bcm_gpio_get_function(sc, j); + sc->sc_gpio_pins[i].gp_flags = bcm_gpio_func_flag(func); i++; } sc->sc_gpio_npins = i; - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + bcm_gpio_sysctl_init(sc); + + device_add_child(dev, "gpioc", device_get_unit(dev)); + device_add_child(dev, "gpiobus", device_get_unit(dev)); return (bus_generic_attach(dev)); fail: From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 22:31:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 79BF4D1C; Tue, 18 Dec 2012 22:31:48 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 51FA78FC15; Tue, 18 Dec 2012 22:31:48 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id DE1061A3D02; Tue, 18 Dec 2012 14:31:47 -0800 (PST) Message-ID: <50D0EED3.8020301@mu.org> Date: Tue, 18 Dec 2012 14:31:47 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: John Baldwin Subject: Re: svn commit: r244112 - head/sys/kern References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212171439.27297.jhb@freebsd.org> <50CF8CE7.4020906@mu.org> <201212181537.23341.jhb@freebsd.org> In-Reply-To: <201212181537.23341.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 18 Dec 2012 23:10:44 +0000 Cc: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , Andriy Gapon , Gleb Smirnoff , Robert Watson , Navdeep Parhar , Bruce Evans , svn-src-head@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 22:31:48 -0000 On 12/18/12 12:37 PM, John Baldwin wrote: > On Monday, December 17, 2012 4:21:43 pm Alfred Perlstein wrote: >> On 12/17/12 11:39 AM, John Baldwin wrote: >>> On Saturday, December 15, 2012 1:04:17 am Bruce Evans wrote: >>>> On Fri, 14 Dec 2012, Alfred Perlstein wrote: >>>> >>>>> On 12/14/12 4:12 PM, Robert Watson wrote: >>>>>> On Fri, 14 Dec 2012, John Baldwin wrote: >>>>>> >>>>>>> On Thursday, December 13, 2012 4:02:15 am Gleb Smirnoff wrote: >>>>>>>> On Wed, Dec 12, 2012 at 04:53:48PM -0800, Alfred Perlstein wrote: A> The >>>>>>>> problem again is that not all the KASSERTS are inviolable, if you A> want >>>>>>>> to do a project to split them, then please do, it would really be A> >>>>>>>> helpful, as for now, they are a mis-mash of death/warnings and there are >>>>>>>> A> at least three vendors who approve of this as well as 3 long term A> >>>>>>>> committers that approved my change (not including Adrian). >>>>>>>> >>>>>>>> Can you show examples of not inviolable KASSERTs? >>>>>>> There are none. They are all assertions for a reason. However, in my >>>> Not even one whose existence is a bug? :-) >>> They should just not exist at all then. :) All the more reason for them to >>> panic early and often so developers will be prompted to remove them. >>> >> This is hard to explain to a customer. >> >> customer: "So we ran your debug image and got you a panic, here is the >> information. So can you tell us what is the problem?" >> alfred: "well that is due to XXX other thing that is broken, thanks for >> helping us resolve that unrelated problem!" >> customer: "i hate you" >> alfred: "get in line." > Are your customers running HEAD? Assertions in a stable branch have been > through testing and generally aren't bogus, so dying on incorrect assertions > (meaning the assertion tripped for non-buggy code) should not be the common > case. Thus, that shouldn't really be the basis for an argument on this. > > I can also come up with arbitrary strawmen: > > customer: "help! we lost a bunch of data!" > jhb: "oh, well, I can see why: the box reported this critical error while > your data was still there, but it went ahead and corrupted it all > anyway even though it knew about the error because I thought you wanted > longer uptimes" > jhb: "don't worry, I have a patch to fix the error" > customer: "don't bother, we are switching to X" > Yes, that happens when they run -stable. -Alfred From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 23:27:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 45ECF7F8; Tue, 18 Dec 2012 23:27:19 +0000 (UTC) (envelope-from jimharris@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 10E218FC16; Tue, 18 Dec 2012 23:27:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBINRITU054014; Tue, 18 Dec 2012 23:27:18 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBINRICS054009; Tue, 18 Dec 2012 23:27:18 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201212182327.qBINRICS054009@svn.freebsd.org> From: Jim Harris Date: Tue, 18 Dec 2012 23:27:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244413 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 23:27:19 -0000 Author: jimharris Date: Tue Dec 18 23:27:18 2012 New Revision: 244413 URL: http://svnweb.freebsd.org/changeset/base/244413 Log: Map BAR 4/5, because NVMe spec says devices may place the MSI-X table behind BAR 4/5, rather than in BAR 0/1 with the control/doorbell registers. Sponsored by: Intel Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Tue Dec 18 22:18:54 2012 (r244412) +++ head/sys/dev/nvme/nvme.c Tue Dec 18 23:27:18 2012 (r244413) @@ -313,6 +313,11 @@ nvme_detach (device_t dev) ctrlr->resource_id, ctrlr->resource); } + if (ctrlr->bar4_resource != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + ctrlr->bar4_resource_id, ctrlr->bar4_resource); + } + #ifdef CHATHAM2 if (ctrlr->chatham_resource != NULL) { bus_release_resource(dev, SYS_RES_MEMORY, Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Tue Dec 18 22:18:54 2012 (r244412) +++ head/sys/dev/nvme/nvme_ctrlr.c Tue Dec 18 23:27:18 2012 (r244413) @@ -78,6 +78,17 @@ nvme_ctrlr_allocate_bar(struct nvme_cont ctrlr->bus_handle = rman_get_bushandle(ctrlr->resource); ctrlr->regs = (struct nvme_registers *)ctrlr->bus_handle; + /* + * The NVMe spec allows for the MSI-X table to be placed behind + * BAR 4/5, separate from the control/doorbell registers. Always + * try to map this bar, because it must be mapped prior to calling + * pci_alloc_msix(). If the table isn't behind BAR 4/5, + * bus_alloc_resource() will just return NULL which is OK. + */ + ctrlr->bar4_resource_id = PCIR_BAR(4); + ctrlr->bar4_resource = bus_alloc_resource(ctrlr->dev, SYS_RES_MEMORY, + &ctrlr->bar4_resource_id, 0, ~0, 1, RF_ACTIVE); + return (0); } Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Tue Dec 18 22:18:54 2012 (r244412) +++ head/sys/dev/nvme/nvme_private.h Tue Dec 18 23:27:18 2012 (r244413) @@ -199,6 +199,14 @@ struct nvme_controller { int resource_id; struct resource *resource; + /* + * The NVMe spec allows for the MSI-X table to be placed in BAR 4/5, + * separate from the control registers which are in BAR 0/1. These + * members track the mapping of BAR 4/5 for that reason. + */ + int bar4_resource_id; + struct resource *bar4_resource; + #ifdef CHATHAM2 bus_space_tag_t chatham_bus_tag; bus_space_handle_t chatham_bus_handle; From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 22:41:22 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19327102; Tue, 18 Dec 2012 22:41:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id C2BF48FC13; Tue, 18 Dec 2012 22:41:19 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id AAA12832; Wed, 19 Dec 2012 00:41:15 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Tl5qc-0007X4-PZ; Wed, 19 Dec 2012 00:41:14 +0200 Message-ID: <50D0F108.1030200@FreeBSD.org> Date: Wed, 19 Dec 2012 00:41:12 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Alfred Perlstein Subject: Re: svn commit: r244112 - head/sys/kern References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212171439.27297.jhb@freebsd.org> <50CF8CE7.4020906@mu.org> <201212181537.23341.jhb@freebsd.org> <50D0EED3.8020301@mu.org> In-Reply-To: <50D0EED3.8020301@mu.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 18 Dec 2012 23:45:43 +0000 Cc: Adrian Chadd , src-committers@FreeBSD.org, John Baldwin , svn-src-all@FreeBSD.org, Alfred Perlstein , Gleb Smirnoff , Robert Watson , Navdeep Parhar , Bruce Evans , svn-src-head@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 22:41:22 -0000 on 19/12/2012 00:31 Alfred Perlstein said the following: > Yes, that happens when they run -stable. Does it? Do you have a solution? [*] [*] - which doesn't involve "it runs so slow I am switching to Y". -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 22:45:26 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 15062311; Tue, 18 Dec 2012 22:45:26 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id E1C8B8FC12; Tue, 18 Dec 2012 22:45:25 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 1D1D71A3D09; Tue, 18 Dec 2012 14:45:25 -0800 (PST) Message-ID: <50D0F204.90507@mu.org> Date: Tue, 18 Dec 2012 14:45:24 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Andriy Gapon Subject: Re: svn commit: r244112 - head/sys/kern References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212171439.27297.jhb@freebsd.org> <50CF8CE7.4020906@mu.org> <201212181537.23341.jhb@freebsd.org> <50D0EED3.8020301@mu.org> <50D0F108.1030200@FreeBSD.org> In-Reply-To: <50D0F108.1030200@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 18 Dec 2012 23:45:57 +0000 Cc: Adrian Chadd , src-committers@FreeBSD.org, John Baldwin , svn-src-all@FreeBSD.org, Alfred Perlstein , Gleb Smirnoff , Robert Watson , Navdeep Parhar , Bruce Evans , svn-src-head@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 22:45:26 -0000 On 12/18/12 2:41 PM, Andriy Gapon wrote: > on 19/12/2012 00:31 Alfred Perlstein said the following: >> Yes, that happens when they run -stable. > Does it? > Do you have a solution? [*] > > [*] - which doesn't involve "it runs so slow I am switching to Y". > I already suggested that we copy from KTR so that KASSERTS can be selectively used in the system. Another option is probably some dtrace magic where we hot patch the code with direct jumps rather than conditional ones if possible. I'm sure there are plenty of solutions for your problem. -Alfred From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 00:24:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9810CAE3; Wed, 19 Dec 2012 00:24:32 +0000 (UTC) (envelope-from cognet@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 742678FC12; Wed, 19 Dec 2012 00:24:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJ0OWm6064592; Wed, 19 Dec 2012 00:24:32 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJ0OVZG064588; Wed, 19 Dec 2012 00:24:31 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201212190024.qBJ0OVZG064588@svn.freebsd.org> From: Olivier Houchard Date: Wed, 19 Dec 2012 00:24:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244414 - in head/sys/arm: arm include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 00:24:32 -0000 Author: cognet Date: Wed Dec 19 00:24:31 2012 New Revision: 244414 URL: http://svnweb.freebsd.org/changeset/base/244414 Log: Properly implement pmap_[get|set]_memattr Submitted by: Ian Lepore Modified: head/sys/arm/arm/pmap-v6.c head/sys/arm/arm/pmap.c head/sys/arm/include/pmap.h head/sys/arm/include/vm.h Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Tue Dec 18 23:27:18 2012 (r244413) +++ head/sys/arm/arm/pmap-v6.c Wed Dec 19 00:24:31 2012 (r244414) @@ -1131,6 +1131,7 @@ pmap_page_init(vm_page_t m) { TAILQ_INIT(&m->md.pv_list); + m->md.pv_memattr = VM_MEMATTR_DEFAULT; } /* @@ -2662,7 +2663,8 @@ do_l2b_alloc: if (!(prot & VM_PROT_EXECUTE) && m) npte |= L2_XN; - npte |= pte_l2_s_cache_mode; + if (!(m->md.pv_memattr & VM_MEMATTR_UNCACHEABLE)) + npte |= pte_l2_s_cache_mode; if (m && m == opg) { /* @@ -3817,3 +3819,22 @@ pmap_dmap_iscurrent(pmap_t pmap) return(pmap_is_current(pmap)); } +void +pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) +{ + /* + * Remember the memattr in a field that gets used to set the appropriate + * bits in the PTEs as mappings are established. + */ + m->md.pv_memattr = ma; + + /* + * It appears that this function can only be called before any mappings + * for the page are established on ARM. If this ever changes, this code + * will need to walk the pv_list and make each of the existing mappings + * uncacheable, being careful to sync caches and PTEs (and maybe + * invalidate TLB?) for any current mapping it modifies. + */ + if (m->md.pv_kva != 0 || TAILQ_FIRST(&m->md.pv_list) != NULL) + panic("Can't change memattr on page with existing mappings"); +} Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Tue Dec 18 23:27:18 2012 (r244413) +++ head/sys/arm/arm/pmap.c Wed Dec 19 00:24:31 2012 (r244414) @@ -1366,7 +1366,8 @@ pmap_fix_cache(struct vm_page *pg, pmap_ (pv->pv_flags & PVF_NC)) { pv->pv_flags &= ~PVF_NC; - pmap_set_cache_entry(pv, pm, va, 1); + if (!(pg->md.pv_memattr & VM_MEMATTR_UNCACHEABLE)) + pmap_set_cache_entry(pv, pm, va, 1); continue; } /* user is no longer sharable and writable */ @@ -1375,7 +1376,8 @@ pmap_fix_cache(struct vm_page *pg, pmap_ !pmwc && (pv->pv_flags & PVF_NC)) { pv->pv_flags &= ~(PVF_NC | PVF_MWC); - pmap_set_cache_entry(pv, pm, va, 1); + if (!(pg->md.pv_memattr & VM_MEMATTR_UNCACHEABLE)) + pmap_set_cache_entry(pv, pm, va, 1); } } @@ -1426,15 +1428,16 @@ pmap_clearbit(struct vm_page *pg, u_int if (!(oflags & maskbits)) { if ((maskbits & PVF_WRITE) && (pv->pv_flags & PVF_NC)) { - /* It is safe to re-enable cacheing here. */ - PMAP_LOCK(pm); - l2b = pmap_get_l2_bucket(pm, va); - ptep = &l2b->l2b_kva[l2pte_index(va)]; - *ptep |= pte_l2_s_cache_mode; - PTE_SYNC(ptep); - PMAP_UNLOCK(pm); + if (!(pg->md.pv_memattr & + VM_MEMATTR_UNCACHEABLE)) { + PMAP_LOCK(pm); + l2b = pmap_get_l2_bucket(pm, va); + ptep = &l2b->l2b_kva[l2pte_index(va)]; + *ptep |= pte_l2_s_cache_mode; + PTE_SYNC(ptep); + PMAP_UNLOCK(pm); + } pv->pv_flags &= ~(PVF_NC | PVF_MWC); - } continue; } @@ -1463,7 +1466,9 @@ pmap_clearbit(struct vm_page *pg, u_int * permission. */ if (maskbits & PVF_WRITE) { - npte |= pte_l2_s_cache_mode; + if (!(pg->md.pv_memattr & + VM_MEMATTR_UNCACHEABLE)) + npte |= pte_l2_s_cache_mode; pv->pv_flags &= ~(PVF_NC | PVF_MWC); } } else @@ -1794,6 +1799,7 @@ pmap_page_init(vm_page_t m) { TAILQ_INIT(&m->md.pv_list); + m->md.pv_memattr = VM_MEMATTR_DEFAULT; } /* @@ -3393,7 +3399,8 @@ do_l2b_alloc: (m->oflags & VPO_UNMANAGED) == 0) vm_page_aflag_set(m, PGA_WRITEABLE); } - npte |= pte_l2_s_cache_mode; + if (!(m->md.pv_memattr & VM_MEMATTR_UNCACHEABLE)) + npte |= pte_l2_s_cache_mode; if (m && m == opg) { /* * We're changing the attrs of an existing mapping. @@ -4929,3 +4936,24 @@ pmap_devmap_find_va(vm_offset_t va, vm_s return (NULL); } +void +pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) +{ + /* + * Remember the memattr in a field that gets used to set the appropriate + * bits in the PTEs as mappings are established. + */ + m->md.pv_memattr = ma; + + /* + * It appears that this function can only be called before any mappings + * for the page are established on ARM. If this ever changes, this code + * will need to walk the pv_list and make each of the existing mappings + * uncacheable, being careful to sync caches and PTEs (and maybe + * invalidate TLB?) for any current mapping it modifies. + */ + if (m->md.pv_kva != 0 || TAILQ_FIRST(&m->md.pv_list) != NULL) + panic("Can't change memattr on page with existing mappings"); +} + + Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Tue Dec 18 23:27:18 2012 (r244413) +++ head/sys/arm/include/pmap.h Wed Dec 19 00:24:31 2012 (r244414) @@ -96,10 +96,10 @@ enum mem_type { #endif -#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT +#define pmap_page_get_memattr(m) ((m)->md.pv_memattr) #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) #define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) -#define pmap_page_set_memattr(m, ma) (void)0 +void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); /* * Pmap stuff @@ -119,6 +119,7 @@ struct pv_entry; struct md_page { int pvh_attrs; + vm_memattr_t pv_memattr; vm_offset_t pv_kva; /* first kernel VA mapping */ TAILQ_HEAD(,pv_entry) pv_list; }; Modified: head/sys/arm/include/vm.h ============================================================================== --- head/sys/arm/include/vm.h Tue Dec 18 23:27:18 2012 (r244413) +++ head/sys/arm/include/vm.h Wed Dec 19 00:24:31 2012 (r244414) @@ -29,7 +29,8 @@ #ifndef _MACHINE_VM_H_ #define _MACHINE_VM_H_ -/* Memory attribute configuration is not (yet) implemented. */ +/* Memory attribute configuration. */ #define VM_MEMATTR_DEFAULT 0 +#define VM_MEMATTR_UNCACHEABLE 1 #endif /* !_MACHINE_VM_H_ */ From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 04:18:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 077FB82E; Wed, 19 Dec 2012 04:18:22 +0000 (UTC) (envelope-from markj@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 E090E8FC13; Wed, 19 Dec 2012 04:18:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJ4ILI8006930; Wed, 19 Dec 2012 04:18:21 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJ4ILaj006929; Wed, 19 Dec 2012 04:18:21 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201212190418.qBJ4ILaj006929@svn.freebsd.org> From: Mark Johnston Date: Wed, 19 Dec 2012 04:18:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244415 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 04:18:22 -0000 Author: markj Date: Wed Dec 19 04:18:21 2012 New Revision: 244415 URL: http://svnweb.freebsd.org/changeset/base/244415 Log: Add myself as a new src committer. Approved by: emaste (co-mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Wed Dec 19 00:24:31 2012 (r244414) +++ head/share/misc/committers-src.dot Wed Dec 19 04:18:21 2012 (r244415) @@ -194,6 +194,7 @@ le [label="Lukas Ertl\nle@FreeBSD.org\n2 lstewart [label="Lawrence Stewart\nlstewart@FreeBSD.org\n2008/10/06"] marcel [label="Marcel Moolenaar\nmarcel@FreeBSD.org\n1999/07/03"] marius [label="Marius Strobl\nmarius@FreeBSD.org\n2004/04/17"] +markj [label="Mark Johnston\nmarkj@FreeBSD.org\n2012/12/18"] markm [label="Mark Murray\nmarkm@FreeBSD.org\n199?/??/??"] markus [label="Markus Brueffer\nmarkus@FreeBSD.org\n2006/06/01"] matteo [label="Matteo Riondato\nmatteo@FreeBSD.org\n2006/01/18"] @@ -378,6 +379,7 @@ eivind -> rwatson emaste -> rstone emaste -> dteske +emaste -> markj emax -> markus @@ -573,6 +575,8 @@ rrs -> brucec rrs -> jchandra rrs -> tuexen +rstone -> markj + ru -> ceri ru -> cjc ru -> eik From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 04:24:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E06E0A7D; Wed, 19 Dec 2012 04:24:11 +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 C5BB38FC13; Wed, 19 Dec 2012 04:24:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJ4OB04007868; Wed, 19 Dec 2012 04:24:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJ4OBVZ007867; Wed, 19 Dec 2012 04:24:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201212190424.qBJ4OBVZ007867@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 19 Dec 2012 04:24:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244416 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 04:24:12 -0000 Author: kib Date: Wed Dec 19 04:24:11 2012 New Revision: 244416 URL: http://svnweb.freebsd.org/changeset/base/244416 Log: MFC r243901: Fixes to ensure the integrity of the callwheel tailqs. MFC r243912 (by attilio): Rearrange comments, use cached callout flags when callout could have been already destroyed. Modified: stable/9/sys/kern/kern_timeout.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_timeout.c ============================================================================== --- stable/9/sys/kern/kern_timeout.c Wed Dec 19 04:18:21 2012 (r244415) +++ stable/9/sys/kern/kern_timeout.c Wed Dec 19 04:24:11 2012 (r244416) @@ -441,15 +441,13 @@ static void callout_cc_del(struct callout *c, struct callout_cpu *cc) { - if (cc->cc_next == c) - cc->cc_next = TAILQ_NEXT(c, c_links.tqe); - if (c->c_flags & CALLOUT_LOCAL_ALLOC) { - c->c_func = NULL; - SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); - } + if ((c->c_flags & CALLOUT_LOCAL_ALLOC) == 0) + return; + c->c_func = NULL; + SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); } -static struct callout * +static void softclock_call_cc(struct callout *c, struct callout_cpu *cc, int *mpcalls, int *lockcalls, int *gcalls) { @@ -471,7 +469,9 @@ softclock_call_cc(struct callout *c, str static timeout_t *lastfunc; #endif - cc->cc_next = TAILQ_NEXT(c, c_links.tqe); + KASSERT((c->c_flags & (CALLOUT_PENDING | CALLOUT_ACTIVE)) == + (CALLOUT_PENDING | CALLOUT_ACTIVE), + ("softclock_call_cc: pend|act %p %x", c, c->c_flags)); class = (c->c_lock != NULL) ? LOCK_CLASS(c->c_lock) : NULL; sharedlock = (c->c_flags & CALLOUT_SHAREDLOCK) ? 0 : 1; c_lock = c->c_lock; @@ -539,20 +539,7 @@ softclock_call_cc(struct callout *c, str class->lc_unlock(c_lock); skip: CC_LOCK(cc); - /* - * If the current callout is locally allocated (from - * timeout(9)) then put it on the freelist. - * - * Note: we need to check the cached copy of c_flags because - * if it was not local, then it's not safe to deref the - * callout pointer. - */ - if (c_flags & CALLOUT_LOCAL_ALLOC) { - KASSERT(c->c_flags == CALLOUT_LOCAL_ALLOC, - ("corrupted callout")); - c->c_func = NULL; - SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); - } + KASSERT(cc->cc_curr == c, ("mishandled cc_curr")); cc->cc_curr = NULL; if (cc->cc_waiting) { /* @@ -561,13 +548,22 @@ skip: * If the callout was scheduled for * migration just cancel it. */ - if (cc_cme_migrating(cc)) + if (cc_cme_migrating(cc)) { cc_cme_cleanup(cc); + + /* + * It should be assert here that the callout is not + * destroyed but that is not easy. + */ + c->c_flags &= ~CALLOUT_DFRMIGRATION; + } cc->cc_waiting = 0; CC_UNLOCK(cc); wakeup(&cc->cc_waiting); CC_LOCK(cc); } else if (cc_cme_migrating(cc)) { + KASSERT((c_flags & CALLOUT_LOCAL_ALLOC) == 0, + ("Migrating legacy callout %p", c)); #ifdef SMP /* * If the callout was scheduled for @@ -580,23 +576,20 @@ skip: cc_cme_cleanup(cc); /* - * Handle deferred callout stops + * It should be assert here that the callout is not destroyed + * but that is not easy. + * + * As first thing, handle deferred callout stops. */ if ((c->c_flags & CALLOUT_DFRMIGRATION) == 0) { CTR3(KTR_CALLOUT, "deferred cancelled %p func %p arg %p", c, new_func, new_arg); callout_cc_del(c, cc); - goto nextc; + return; } - c->c_flags &= ~CALLOUT_DFRMIGRATION; - /* - * It should be assert here that the - * callout is not destroyed but that - * is not easy. - */ new_cc = callout_cpu_switch(c, cc, new_cpu); callout_cc_add(c, new_cc, new_ticks, new_func, new_arg, new_cpu); @@ -606,10 +599,19 @@ skip: panic("migration should not happen"); #endif } -#ifdef SMP -nextc: -#endif - return (cc->cc_next); + /* + * If the current callout is locally allocated (from + * timeout(9)) then put it on the freelist. + * + * Note: we need to check the cached copy of c_flags because + * if it was not local, then it's not safe to deref the + * callout pointer. + */ + KASSERT((c_flags & CALLOUT_LOCAL_ALLOC) == 0 || + c->c_flags == CALLOUT_LOCAL_ALLOC, + ("corrupted callout")); + if (c_flags & CALLOUT_LOCAL_ALLOC) + callout_cc_del(c, cc); } /* @@ -676,10 +678,12 @@ softclock(void *arg) steps = 0; } } else { + cc->cc_next = TAILQ_NEXT(c, c_links.tqe); TAILQ_REMOVE(bucket, c, c_links.tqe); - c = softclock_call_cc(c, cc, &mpcalls, + softclock_call_cc(c, cc, &mpcalls, &lockcalls, &gcalls); steps = 0; + c = cc->cc_next; } } } @@ -1024,6 +1028,8 @@ again: CTR3(KTR_CALLOUT, "cancelled %p func %p arg %p", c, c->c_func, c->c_arg); + if (cc->cc_next == c) + cc->cc_next = TAILQ_NEXT(c, c_links.tqe); TAILQ_REMOVE(&cc->cc_callwheel[c->c_time & callwheelmask], c, c_links.tqe); callout_cc_del(c, cc); From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 05:07:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ED6101BB; Wed, 19 Dec 2012 05:07:27 +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 D23BE8FC12; Wed, 19 Dec 2012 05:07:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJ57RFW015162; Wed, 19 Dec 2012 05:07:27 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJ57R0c015161; Wed, 19 Dec 2012 05:07:27 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201212190507.qBJ57R0c015161@svn.freebsd.org> From: Alan Cox Date: Wed, 19 Dec 2012 05:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244417 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 05:07:28 -0000 Author: alc Date: Wed Dec 19 05:07:27 2012 New Revision: 244417 URL: http://svnweb.freebsd.org/changeset/base/244417 Log: Eliminate some definitions that haven't been used in a decade or more. Modified: head/sys/mips/include/param.h Modified: head/sys/mips/include/param.h ============================================================================== --- head/sys/mips/include/param.h Wed Dec 19 04:24:11 2012 (r244416) +++ head/sys/mips/include/param.h Wed Dec 19 05:07:27 2012 (r244417) @@ -163,20 +163,6 @@ #define KSTACK_PAGES 2 /* kernel stack */ #define KSTACK_GUARD_PAGES 2 /* pages of kstack guard; 0 disables */ -#define UPAGES 2 - -/* pages ("clicks") (4096 bytes) to disk blocks */ -#define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT)) -#define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT)) - -/* - * Map a ``block device block'' to a file system block. - * This should be device dependent, and should use the bsize - * field from the disk label. - * For now though just use DEV_BSIZE. - */ -#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) - /* * Mach derived conversion macros */ From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 09:55:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C53A2300; Wed, 19 Dec 2012 09:55:13 +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 A8E0E8FC16; Wed, 19 Dec 2012 09:55:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJ9tDwS064177; Wed, 19 Dec 2012 09:55:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJ9tDrS064176; Wed, 19 Dec 2012 09:55:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201212190955.qBJ9tDrS064176@svn.freebsd.org> From: Alexander Motin Date: Wed, 19 Dec 2012 09:55:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244418 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 09:55:13 -0000 Author: mav Date: Wed Dec 19 09:55:13 2012 New Revision: 244418 URL: http://svnweb.freebsd.org/changeset/base/244418 Log: Fix bug in r242720, that caused additional status page to not be used if descriptor page is supported. Modified: head/sys/cam/scsi/scsi_enc_ses.c Modified: head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_ses.c Wed Dec 19 05:07:27 2012 (r244417) +++ head/sys/cam/scsi/scsi_enc_ses.c Wed Dec 19 09:55:13 2012 (r244418) @@ -1272,13 +1272,10 @@ ses_process_pages(enc_softc_t *enc, stru err = 0; for (i = 0; i < length; i++) { - if (page->params[i] == SesElementDescriptor) { + if (page->params[i] == SesElementDescriptor) ses->ses_flags |= SES_FLAG_DESC; - break; - } else if (page->params[i] == SesAddlElementStatus) { + else if (page->params[i] == SesAddlElementStatus) ses->ses_flags |= SES_FLAG_ADDLSTATUS; - break; - } } out: From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 10:57:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8C0DB5E3 for ; Wed, 19 Dec 2012 10:57:47 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com [209.85.215.51]) by mx1.freebsd.org (Postfix) with ESMTP id EFBD88FC12 for ; Wed, 19 Dec 2012 10:57:46 +0000 (UTC) Received: by mail-la0-f51.google.com with SMTP id e4so1472613lag.38 for ; Wed, 19 Dec 2012 02:57:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:x-enigmail-version:content-type :x-gm-message-state; bh=IVY24jEWDuF5FcTA64wu2xVa86byTxp+m6WqvNgWjoI=; b=h7+pUmlleiJFNT60nwcVHAFv+eu/lvqlLiwfh9LyZ4gIcUpvxQcdQK0ItMBQVYs0/j /jCXArKjDDPzukWTo/ALAu9OqqFrtSz3J9o2mZss2m9wje3jHO5X48XpH+z68pahZbsP qKTKTUHQEuae7fE5I4oHvgDEFEw8wJpLsIy8ZTBWyy0r2wJjeRId++KLpOAGAsfoRdJ+ hgvbV8ivK8GP0jzz40GqN4cS6eY0bZYFDw6+Viw3HFmp+KuxMuf5P4vY/gpfLsCD6wX7 qBuPGUaYUKTJ3/6+YnfBPOnaNK8+agFI+9qVvYepC+ffBglf/LuIuO9HXTaHko0iSYA2 9Z0Q== X-Received: by 10.152.134.243 with SMTP id pn19mr4863211lab.11.1355914660510; Wed, 19 Dec 2012 02:57:40 -0800 (PST) Received: from dhcp170-82-red.yandex.net (dhcp170-82-red.yandex.net. [95.108.170.82]) by mx.google.com with ESMTPS id b3sm1978426lbl.0.2012.12.19.02.57.38 (version=SSLv3 cipher=OTHER); Wed, 19 Dec 2012 02:57:39 -0800 (PST) Sender: Andrey Zonov Message-ID: <50D19D9D.9090200@FreeBSD.org> Date: Wed, 19 Dec 2012 14:57:33 +0400 From: Andrey Zonov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Robert Watson Subject: Re: svn commit: r244383 - head/etc References: <201212180727.qBI7Rp0t084371@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig0F7929E2F39FA333DA5C6F30" X-Gm-Message-State: ALoCoQnVZqyhk+i2pXpgOppdLsq5/DhZQJlUPScx8dftObu3jTyPZ9Dj+epGENdtxg1dCPH90q8O Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 10:57:47 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0F7929E2F39FA333DA5C6F30 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 12/18/12 1:51 PM, Robert Watson wrote: >=20 > On Tue, 18 Dec 2012, Robert Watson wrote: >=20 >>> Log: >>> - Set memorylocked limit to 64Kb for default login class. >>> This prevents unprivileged users to lock too much memory. >>> - Set memorylocked limit to 64Mb for daemon login class. >>> Some daemons such as amd(8) and watchdogd(8) calls mlockall(2) on >>> startup, they are run from init(8) which uses daemon login class. >>> - Set memorylocked limit to unlimited for root login class. >>> >>> Suggested by: avg >>> Approved by: kib (mentor) >>> MFC after: 1 week >> >> I think you should not MFC this one quickly -- let's wait for it to >> shake out in the -CURRENT userbase for a few months to see what >> breaks. I wouldn't be surprised if a fair number of applications >> (both publicly available, and local at various FreeBSD-using shops) >> are implicitly depending on their not being limits to memorylocked by >> default. After an upgrade, they might find that their applications >> simply stop working for potentially hard-to-debug reasons. >> >> Or we might find no one notices -- but deferring an MFC will help give= >> us a better sense of which outcome is more likely. >=20 > ... or maybe this doesn't matter before your later sysctl commit? >=20 Yes. This change should not hurt anybody, because I change defaults for vm.old_mlock and security.bsd.unprivileged_mlock for stable. --=20 Andrey Zonov --------------enig0F7929E2F39FA333DA5C6F30 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.18 (Darwin) Comment: GPGTools - http://gpgtools.org iQEcBAEBAgAGBQJQ0Z2gAAoJEBWLemxX/CvTgWAH/1BhjAiSlNbpy9+le2VB6n2j wQqIlTsHGL/6WXDWIxYu2LYE+zMYHgPYE9JeD6Ok08VsE9JvfPNoCM8kL+QIrmtm /AWL16/XnJkeuAVsJnxJd30xg96ebnv5pTnCi0uVj1k5K7eFLCAgzrOqK7Yde2Am 31/267mQcgZtVYDmkwfWcCtdXBKgzSg2BxXmCdtbeYuOaxrF9nAkV9+aO6W21Vdx TV8Sufd+ZU+Q7KWCDMMRFsSSzFj0+KKrLrUiRgjUeQypRplz1GPnAyFdHkswG1CT aya4HuvuMptuXMoEKZ05JKOILd6KxBrk1CPyUsLr3nJvfn/tXpXqPNei1tt8iVA= =JR93 -----END PGP SIGNATURE----- --------------enig0F7929E2F39FA333DA5C6F30-- From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 10:59:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2441A7E1 for ; Wed, 19 Dec 2012 10:59:56 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) by mx1.freebsd.org (Postfix) with ESMTP id 839D88FC15 for ; Wed, 19 Dec 2012 10:59:55 +0000 (UTC) Received: by mail-lb0-f180.google.com with SMTP id gj3so1570629lbb.25 for ; Wed, 19 Dec 2012 02:59:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:x-enigmail-version:content-type :x-gm-message-state; bh=hh+x6Tf2i2v8t2bkZSwPixMp136zScocgl79aOEOYa4=; b=ekt6VVUot6RvzPNcKFEegP7rzCmvnNicKiFoYeQcHVRgTU3sey0F95lIo3aWqSyMMz 6J/j/7PopflFutc+nZHydw/6Z1Rhk3ycFtqZL5ZqkiAD0CsNlCXJZ9l0RB4YDLwjc48E YC70SE5Nj8sqtaG8HkfHsPbUrCZFcLOHZpu9HMgVi0rwlmRQh25RZRXddHwNEFzt5OIp ubpgPXgMJ3jecQP4YnMkxmP9jrTxpJChB1sUTe9YSsyCzVxfY9InSgOVjquiB7hesFY2 la8ZiCiJ0i8kVtI3WooAbhRKn7GidDJI/RLTk7NyYwmkCMyPluVw6vkpXnm9qHAFH2Yv P+Vg== X-Received: by 10.152.105.203 with SMTP id go11mr4801277lab.53.1355914794080; Wed, 19 Dec 2012 02:59:54 -0800 (PST) Received: from dhcp170-82-red.yandex.net (dhcp170-82-red.yandex.net. [95.108.170.82]) by mx.google.com with ESMTPS id n7sm1973797lbz.5.2012.12.19.02.59.52 (version=SSLv3 cipher=OTHER); Wed, 19 Dec 2012 02:59:53 -0800 (PST) Sender: Andrey Zonov Message-ID: <50D19E27.4060008@FreeBSD.org> Date: Wed, 19 Dec 2012 14:59:51 +0400 From: Andrey Zonov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Ivan Voras Subject: Re: svn commit: r244385 - head/sys/kern References: <201212180736.qBI7aj4K086137@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig790F40198BDD342CB1065A34" X-Gm-Message-State: ALoCoQm1MBnhAv7yggJ1YulGKkCRhg1ykiLk0DcP/Nv28YJn0155lVzF91BjLCR4rqbDqXA/n1kf Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 10:59:56 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig790F40198BDD342CB1065A34 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12/18/12 6:38 PM, Ivan Voras wrote: > On 18 December 2012 08:36, Andrey Zonov wrote: >> Author: zont >> Date: Tue Dec 18 07:36:45 2012 >> New Revision: 244385 >> URL: http://svnweb.freebsd.org/changeset/base/244385 >> >> Log: >> - Add sysctl to allow unprivileged users to call mlock(2)-family sys= tem >> calls and turn it on. >> - Do not allow to call them inside jail. [1] >=20 > There's a sysctl branch security.jail.param.allow. which might be > useful here to add for jails. >=20 This one is on my list. --=20 Andrey Zonov --------------enig790F40198BDD342CB1065A34 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.18 (Darwin) Comment: GPGTools - http://gpgtools.org iQEcBAEBAgAGBQJQ0Z4nAAoJEBWLemxX/CvTAYgH/jANDqXFGpQ4LsfmPQsbImAT /RZBTVIfWymmSo2tlediSbNVZVdW65k4Def5hWzDDUeFQsSYJGW97SHtN+8e0s40 8RWJ10PRej9WIXsOJQeNSANVl+fKKnKTxkdpMIP0HCkTKiv9czEZPHNdVjpOGOx/ txM9aHtq4169+14Mn5GF3Z1735G3B1qD0+FsLeaDkknN2Iqg6AJ20nd1mX0KOjCZ zSalPvWdAe8k+w8Nl/Hc8n2HSvyXQTZ2p1ZV1J7lC+ZA9SZec/p1/qNIDxRaK7f5 sWgRKsIN9xQ2krgCB5rkEY0Q8dLTnYzgt4n3XXtmv4pRttJgy6XC9UKsEybqkk8= =Q1ES -----END PGP SIGNATURE----- --------------enig790F40198BDD342CB1065A34-- From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 11:04:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98857C69; Wed, 19 Dec 2012 11:04:11 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 68CEB8FC0A; Wed, 19 Dec 2012 11:04:11 +0000 (UTC) Received: from [192.168.2.119] (host86-129-88-139.range86-129.btcentralplus.com [86.129.88.139]) by cyrus.watson.org (Postfix) with ESMTPSA id 2C2EB46B09; Wed, 19 Dec 2012 06:04:04 -0500 (EST) Subject: Re: svn commit: r244383 - head/etc Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-1 From: "Robert N. M. Watson" In-Reply-To: <50D19D9D.9090200@FreeBSD.org> Date: Wed, 19 Dec 2012 11:04:01 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201212180727.qBI7Rp0t084371@svn.freebsd.org> <50D19D9D.9090200@FreeBSD.org> To: Andrey Zonov 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 11:04:11 -0000 On 19 Dec 2012, at 10:57, Andrey Zonov wrote: >>> I think you should not MFC this one quickly -- let's wait for it to >>> shake out in the -CURRENT userbase for a few months to see what >>> breaks. I wouldn't be surprised if a fair number of applications >>> (both publicly available, and local at various FreeBSD-using shops) >>> are implicitly depending on their not being limits to memorylocked = by >>> default. After an upgrade, they might find that their applications >>> simply stop working for potentially hard-to-debug reasons. >>>=20 >>> Or we might find no one notices -- but deferring an MFC will help = give >>> us a better sense of which outcome is more likely. >>=20 >> ... or maybe this doesn't matter before your later sysctl commit? >=20 > Yes. This change should not hurt anybody, because I change defaults = for > vm.old_mlock and security.bsd.unprivileged_mlock for stable. Very exciting indeed, then! Lots of gpg/etc users will appreciate this = greatly. Robert= From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 12:00:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 708C08F2; Wed, 19 Dec 2012 12:00:10 +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 3B6108FC0A; Wed, 19 Dec 2012 12:00:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJC0Ar2087313; Wed, 19 Dec 2012 12:00:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJC0AJO087312; Wed, 19 Dec 2012 12:00:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212191200.qBJC0AJO087312@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 19 Dec 2012 12:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244424 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 12:00:10 -0000 Author: pjd Date: Wed Dec 19 12:00:09 2012 New Revision: 244424 URL: http://svnweb.freebsd.org/changeset/base/244424 Log: The expand_name() function isn't called with the process lock held anymore, so we can safely use malloc(M_WAITOK) now. Pointed out by: kib Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Wed Dec 19 11:17:08 2012 (r244423) +++ head/sys/kern/kern_sig.c Wed Dec 19 12:00:09 2012 (r244424) @@ -3057,9 +3057,7 @@ expand_name(const char *comm, uid_t uid, hostname = NULL; format = corefilename; - name = malloc(MAXPATHLEN, M_TEMP, M_NOWAIT | M_ZERO); - if (name == NULL) - return (NULL); + name = malloc(MAXPATHLEN, M_TEMP, M_WAITOK | M_ZERO); indexpos = -1; (void)sbuf_new(&sb, name, MAXPATHLEN, SBUF_FIXEDLEN); for (i = 0; format[i]; i++) { @@ -3073,16 +3071,7 @@ expand_name(const char *comm, uid_t uid, case 'H': /* hostname */ if (hostname == NULL) { hostname = malloc(MAXHOSTNAMELEN, - M_TEMP, M_NOWAIT); - if (hostname == NULL) { - log(LOG_ERR, - "pid %ld (%s), uid (%lu): " - "unable to alloc memory " - "for corefile hostname\n", - (long)pid, comm, - (u_long)uid); - goto nomem; - } + M_TEMP, M_WAITOK); } getcredhostname(td->td_ucred, hostname, MAXHOSTNAMELEN); @@ -3119,7 +3108,6 @@ expand_name(const char *comm, uid_t uid, if (sbuf_error(&sb) != 0) { log(LOG_ERR, "pid %ld (%s), uid (%lu): corename is too " "long\n", (long)pid, comm, (u_long)uid); -nomem: sbuf_delete(&sb); free(name, M_TEMP); return (NULL); From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 12:10:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4274BC5A; Wed, 19 Dec 2012 12:10:15 +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 273A48FC14; Wed, 19 Dec 2012 12:10:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJCAFPj089359; Wed, 19 Dec 2012 12:10:15 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJCAF6V089357; Wed, 19 Dec 2012 12:10:15 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212191210.qBJCAF6V089357@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 19 Dec 2012 12:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244426 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 12:10:15 -0000 Author: pjd Date: Wed Dec 19 12:10:14 2012 New Revision: 244426 URL: http://svnweb.freebsd.org/changeset/base/244426 Log: Style cleanups. Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Wed Dec 19 12:09:02 2012 (r244425) +++ head/sys/kern/kern_sig.c Wed Dec 19 12:10:14 2012 (r244426) @@ -202,37 +202,37 @@ SYSCTL_INT(_kern, OID_AUTO, nodump_cored #define SA_CANTMASK 0x40 /* non-maskable, catchable */ static int sigproptbl[NSIG] = { - SA_KILL, /* SIGHUP */ - SA_KILL, /* SIGINT */ - SA_KILL|SA_CORE, /* SIGQUIT */ - SA_KILL|SA_CORE, /* SIGILL */ - SA_KILL|SA_CORE, /* SIGTRAP */ - SA_KILL|SA_CORE, /* SIGABRT */ - SA_KILL|SA_CORE, /* SIGEMT */ - SA_KILL|SA_CORE, /* SIGFPE */ - SA_KILL, /* SIGKILL */ - SA_KILL|SA_CORE, /* SIGBUS */ - SA_KILL|SA_CORE, /* SIGSEGV */ - SA_KILL|SA_CORE, /* SIGSYS */ - SA_KILL, /* SIGPIPE */ - SA_KILL, /* SIGALRM */ - SA_KILL, /* SIGTERM */ - SA_IGNORE, /* SIGURG */ - SA_STOP, /* SIGSTOP */ - SA_STOP|SA_TTYSTOP, /* SIGTSTP */ - SA_IGNORE|SA_CONT, /* SIGCONT */ - SA_IGNORE, /* SIGCHLD */ - SA_STOP|SA_TTYSTOP, /* SIGTTIN */ - SA_STOP|SA_TTYSTOP, /* SIGTTOU */ - SA_IGNORE, /* SIGIO */ - SA_KILL, /* SIGXCPU */ - SA_KILL, /* SIGXFSZ */ - SA_KILL, /* SIGVTALRM */ - SA_KILL, /* SIGPROF */ - SA_IGNORE, /* SIGWINCH */ - SA_IGNORE, /* SIGINFO */ - SA_KILL, /* SIGUSR1 */ - SA_KILL, /* SIGUSR2 */ + SA_KILL, /* SIGHUP */ + SA_KILL, /* SIGINT */ + SA_KILL|SA_CORE, /* SIGQUIT */ + SA_KILL|SA_CORE, /* SIGILL */ + SA_KILL|SA_CORE, /* SIGTRAP */ + SA_KILL|SA_CORE, /* SIGABRT */ + SA_KILL|SA_CORE, /* SIGEMT */ + SA_KILL|SA_CORE, /* SIGFPE */ + SA_KILL, /* SIGKILL */ + SA_KILL|SA_CORE, /* SIGBUS */ + SA_KILL|SA_CORE, /* SIGSEGV */ + SA_KILL|SA_CORE, /* SIGSYS */ + SA_KILL, /* SIGPIPE */ + SA_KILL, /* SIGALRM */ + SA_KILL, /* SIGTERM */ + SA_IGNORE, /* SIGURG */ + SA_STOP, /* SIGSTOP */ + SA_STOP|SA_TTYSTOP, /* SIGTSTP */ + SA_IGNORE|SA_CONT, /* SIGCONT */ + SA_IGNORE, /* SIGCHLD */ + SA_STOP|SA_TTYSTOP, /* SIGTTIN */ + SA_STOP|SA_TTYSTOP, /* SIGTTOU */ + SA_IGNORE, /* SIGIO */ + SA_KILL, /* SIGXCPU */ + SA_KILL, /* SIGXFSZ */ + SA_KILL, /* SIGVTALRM */ + SA_KILL, /* SIGPROF */ + SA_IGNORE, /* SIGWINCH */ + SA_IGNORE, /* SIGINFO */ + SA_KILL, /* SIGUSR1 */ + SA_KILL, /* SIGUSR2 */ }; static void reschedule_signals(struct proc *p, sigset_t block, int flags); @@ -3018,11 +3018,11 @@ SYSCTL_PROC(_debug, OID_AUTO, ncores, CT #if defined(COMPRESS_USER_CORES) int compress_user_cores = 1; SYSCTL_INT(_kern, OID_AUTO, compress_user_cores, CTLFLAG_RW, - &compress_user_cores, 0, ""); + &compress_user_cores, 0, "Compression of user corefiles"); int compress_user_cores_gzlevel = -1; /* default level */ SYSCTL_INT(_kern, OID_AUTO, compress_user_cores_gzlevel, CTLFLAG_RW, - &compress_user_cores_gzlevel, -1, "user core gz compression level"); + &compress_user_cores_gzlevel, -1, "Corefile gzip compression level"); #define GZ_SUFFIX ".gz" #define GZ_SUFFIX_LEN 3 @@ -3031,7 +3031,7 @@ SYSCTL_INT(_kern, OID_AUTO, compress_use static char corefilename[MAXPATHLEN] = {"%N.core"}; TUNABLE_STR("kern.corefile", corefilename, sizeof(corefilename)); SYSCTL_STRING(_kern, OID_AUTO, corefile, CTLFLAG_RW, corefilename, - sizeof(corefilename), "process corefile name format string"); + sizeof(corefilename), "Process corefile name format string"); /* * expand_name(name, uid, pid, td, compress) @@ -3051,8 +3051,7 @@ expand_name(const char *comm, uid_t uid, struct sbuf sb; const char *format; char *name; - size_t i; - int indexpos; + int i, indexpos; char *hostname; hostname = NULL; @@ -3060,7 +3059,7 @@ expand_name(const char *comm, uid_t uid, name = malloc(MAXPATHLEN, M_TEMP, M_WAITOK | M_ZERO); indexpos = -1; (void)sbuf_new(&sb, name, MAXPATHLEN, SBUF_FIXEDLEN); - for (i = 0; format[i]; i++) { + for (i = 0; format[i] != '\0'; i++) { switch (format[i]) { case '%': /* Format character */ i++; @@ -3072,12 +3071,12 @@ expand_name(const char *comm, uid_t uid, if (hostname == NULL) { hostname = malloc(MAXHOSTNAMELEN, M_TEMP, M_WAITOK); - } + } getcredhostname(td->td_ucred, hostname, MAXHOSTNAMELEN); sbuf_printf(&sb, "%s", hostname); break; - case 'I': /* autoincrementing index */ + case 'I': /* autoincrementing index */ sbuf_printf(&sb, "0"); indexpos = sbuf_len(&sb) - 1; break; @@ -3094,6 +3093,7 @@ expand_name(const char *comm, uid_t uid, log(LOG_ERR, "Unknown format character %c in " "corename `%s'\n", format[i], format); + break; } break; default: @@ -3123,16 +3123,14 @@ expand_name(const char *comm, uid_t uid, */ if (indexpos != -1) { struct nameidata nd; - int error, n; - int flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW; - int cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; - int oflags = 0; + int cmode, flags, oflags, error; - if (capmode_coredump) - oflags = VN_OPEN_NOCAPCHECK; + flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW; + cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; + oflags = capmode_coredump ? VN_OPEN_NOCAPCHECK : 0; - for (n = 0; n < num_cores; n++) { - name[indexpos] = '0' + n; + for (i = 0; i < num_cores; i++) { + name[indexpos] = '0' + i; NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); error = vn_open_cred(&nd, &flags, cmode, oflags, @@ -3142,7 +3140,7 @@ expand_name(const char *comm, uid_t uid, continue; log(LOG_ERR, "pid %d (%s), uid (%u): Path `%s' failed " - "on initial open test, error = %d\n", + "on initial open test, error = %d\n", pid, comm, uid, name, error); free(name, M_TEMP); return (NULL); @@ -3153,8 +3151,8 @@ expand_name(const char *comm, uid_t uid, if (error) { log(LOG_ERR, "pid %d (%s), uid (%u): Path `%s' failed " - "on close after initial open test, " - "error = %d\n", + "on close after initial open test, " + "error = %d\n", pid, comm, uid, name, error); free(name, M_TEMP); return (NULL); From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 12:12:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EA6D871; Wed, 19 Dec 2012 12:12:53 +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 CFDB88FC13; Wed, 19 Dec 2012 12:12:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJCCr6i090006; Wed, 19 Dec 2012 12:12:53 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJCCrR0090005; Wed, 19 Dec 2012 12:12:53 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212191212.qBJCCrR0090005@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 19 Dec 2012 12:12:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244428 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 12:12:54 -0000 Author: pjd Date: Wed Dec 19 12:12:53 2012 New Revision: 244428 URL: http://svnweb.freebsd.org/changeset/base/244428 Log: Do not audit paths we try when kern.corefile contains %I. Obtained from: WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Wed Dec 19 12:12:24 2012 (r244427) +++ head/sys/kern/kern_sig.c Wed Dec 19 12:12:53 2012 (r244428) @@ -3127,7 +3127,8 @@ expand_name(const char *comm, uid_t uid, flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW; cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; - oflags = capmode_coredump ? VN_OPEN_NOCAPCHECK : 0; + oflags = VN_OPEN_NOAUDIT | + (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0); for (i = 0; i < num_cores; i++) { name[indexpos] = '0' + i; From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 12:14:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B994E212; Wed, 19 Dec 2012 12:14:08 +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 9E0038FC14; Wed, 19 Dec 2012 12:14:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJCE8jr090295; Wed, 19 Dec 2012 12:14:08 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJCE8sF090294; Wed, 19 Dec 2012 12:14:08 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212191214.qBJCE8sF090294@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 19 Dec 2012 12:14:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244429 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 12:14:08 -0000 Author: pjd Date: Wed Dec 19 12:14:08 2012 New Revision: 244429 URL: http://svnweb.freebsd.org/changeset/base/244429 Log: The 'flags' argument can be modified in vn_open_cred(), so we need to set it for every loop interation. Pointed out by: kib Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Wed Dec 19 12:12:53 2012 (r244428) +++ head/sys/kern/kern_sig.c Wed Dec 19 12:14:08 2012 (r244429) @@ -3125,12 +3125,12 @@ expand_name(const char *comm, uid_t uid, struct nameidata nd; int cmode, flags, oflags, error; - flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW; cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; oflags = VN_OPEN_NOAUDIT | (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0); for (i = 0; i < num_cores; i++) { + flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW; name[indexpos] = '0' + i; NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 12:19:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BA703609; Wed, 19 Dec 2012 12:19:45 +0000 (UTC) (envelope-from dim@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 9EAE18FC13; Wed, 19 Dec 2012 12:19:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJCJjkk091452; Wed, 19 Dec 2012 12:19:45 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJCJjgc091451; Wed, 19 Dec 2012 12:19:45 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201212191219.qBJCJjgc091451@svn.freebsd.org> From: Dimitry Andric Date: Wed, 19 Dec 2012 12:19:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244430 - stable/9/sbin/devd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 12:19:45 -0000 Author: dim Date: Wed Dec 19 12:19:45 2012 New Revision: 244430 URL: http://svnweb.freebsd.org/changeset/base/244430 Log: MFC r243907: Fix an old bug in devd, where it uses std::sort() to sort the various lists it reads from its configuration files on the priority field. Because some items in the lists have the same priority, and std::sort() is not stable, the exact order in which the items are enumerated does not have to correspond to the order they appear in the configuration files. Apparently this was never noticed with libstdc++, but with libc++ it could cause the "uhid" entry from /etc/devd/usb.conf to be used instead of the "ums" entry (which is earlier in the file). This caused the problem described in the PR: the USB mouse module was never loaded, and the other actions (such as starting moused) were not executed. To fix the problem, make devd use std:stable_sort() instead. Reported by: Jan Beich PR: bin/172958 Modified: stable/9/sbin/devd/devd.cc Directory Properties: stable/9/sbin/devd/ (props changed) Modified: stable/9/sbin/devd/devd.cc ============================================================================== --- stable/9/sbin/devd/devd.cc Wed Dec 19 12:14:08 2012 (r244429) +++ stable/9/sbin/devd/devd.cc Wed Dec 19 12:19:45 2012 (r244430) @@ -436,7 +436,7 @@ public: void config::sort_vector(vector &v) { - sort(v.begin(), v.end(), epv_greater()); + stable_sort(v.begin(), v.end(), epv_greater()); } void From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 12:19:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98EED761; Wed, 19 Dec 2012 12:19:57 +0000 (UTC) (envelope-from dim@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 7E6CE8FC15; Wed, 19 Dec 2012 12:19:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJCJvwI091522; Wed, 19 Dec 2012 12:19:57 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJCJvrO091521; Wed, 19 Dec 2012 12:19:57 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201212191219.qBJCJvrO091521@svn.freebsd.org> From: Dimitry Andric Date: Wed, 19 Dec 2012 12:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244431 - stable/8/sbin/devd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 12:19:57 -0000 Author: dim Date: Wed Dec 19 12:19:56 2012 New Revision: 244431 URL: http://svnweb.freebsd.org/changeset/base/244431 Log: MFC r243907: Fix an old bug in devd, where it uses std::sort() to sort the various lists it reads from its configuration files on the priority field. Because some items in the lists have the same priority, and std::sort() is not stable, the exact order in which the items are enumerated does not have to correspond to the order they appear in the configuration files. Apparently this was never noticed with libstdc++, but with libc++ it could cause the "uhid" entry from /etc/devd/usb.conf to be used instead of the "ums" entry (which is earlier in the file). This caused the problem described in the PR: the USB mouse module was never loaded, and the other actions (such as starting moused) were not executed. To fix the problem, make devd use std:stable_sort() instead. Reported by: Jan Beich PR: bin/172958 Modified: stable/8/sbin/devd/devd.cc Directory Properties: stable/8/sbin/devd/ (props changed) Modified: stable/8/sbin/devd/devd.cc ============================================================================== --- stable/8/sbin/devd/devd.cc Wed Dec 19 12:19:45 2012 (r244430) +++ stable/8/sbin/devd/devd.cc Wed Dec 19 12:19:56 2012 (r244431) @@ -352,7 +352,7 @@ public: void config::sort_vector(vector &v) { - sort(v.begin(), v.end(), epv_greater()); + stable_sort(v.begin(), v.end(), epv_greater()); } void From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 12:20:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98B5386E; Wed, 19 Dec 2012 12:20:05 +0000 (UTC) (envelope-from dim@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 E54C48FC0A; Wed, 19 Dec 2012 12:20:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJCK4El091602; Wed, 19 Dec 2012 12:20:04 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJCK49p091601; Wed, 19 Dec 2012 12:20:04 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201212191220.qBJCK49p091601@svn.freebsd.org> From: Dimitry Andric Date: Wed, 19 Dec 2012 12:20:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r244432 - stable/7/sbin/devd X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 12:20:05 -0000 Author: dim Date: Wed Dec 19 12:20:04 2012 New Revision: 244432 URL: http://svnweb.freebsd.org/changeset/base/244432 Log: MFC r243907: Fix an old bug in devd, where it uses std::sort() to sort the various lists it reads from its configuration files on the priority field. Because some items in the lists have the same priority, and std::sort() is not stable, the exact order in which the items are enumerated does not have to correspond to the order they appear in the configuration files. Apparently this was never noticed with libstdc++, but with libc++ it could cause the "uhid" entry from /etc/devd/usb.conf to be used instead of the "ums" entry (which is earlier in the file). This caused the problem described in the PR: the USB mouse module was never loaded, and the other actions (such as starting moused) were not executed. To fix the problem, make devd use std:stable_sort() instead. Reported by: Jan Beich PR: bin/172958 Modified: stable/7/sbin/devd/devd.cc Directory Properties: stable/7/sbin/devd/ (props changed) Modified: stable/7/sbin/devd/devd.cc ============================================================================== --- stable/7/sbin/devd/devd.cc Wed Dec 19 12:19:56 2012 (r244431) +++ stable/7/sbin/devd/devd.cc Wed Dec 19 12:20:04 2012 (r244432) @@ -351,7 +351,7 @@ public: void config::sort_vector(vector &v) { - sort(v.begin(), v.end(), epv_greater()); + stable_sort(v.begin(), v.end(), epv_greater()); } void From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 12:52:34 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D1FB2231; Wed, 19 Dec 2012 12:52:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 64BFC8FC12; Wed, 19 Dec 2012 12:52:33 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qBJCqJMb010893 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 19 Dec 2012 23:52:26 +1100 Date: Wed, 19 Dec 2012 23:52:19 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Gleb Smirnoff Subject: Re: svn commit: r244389 - head/sys/dev/wtap In-Reply-To: <20121218085306.GK94420@FreeBSD.org> Message-ID: <20121219234351.A1351@besplex.bde.org> References: <201212180844.qBI8ixdX097633@svn.freebsd.org> <20121218085306.GK94420@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=BrrFWvr5 c=1 sm=1 a=qoJ-q_1_yCsA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=fu44smWAT9sA:10 a=iWf13sLgguKfD9NmPfEA:9 a=CjuIK1q_8ugA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: Monthadar Al Jaberi , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 12:52:34 -0000 On Tue, 18 Dec 2012, Gleb Smirnoff wrote: > On Tue, Dec 18, 2012 at 08:44:59AM +0000, Monthadar Al Jaberi wrote: > ... > M> Modified: head/sys/dev/wtap/if_wtap.c > M> ============================================================================== > M> --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:41:23 2012 (r244388) > M> +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:44:59 2012 (r244389) > M> @@ -334,6 +334,10 @@ wtap_vap_create(struct ieee80211com *ic, > M> vap = (struct ieee80211vap *) avp; > M> error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, > M> flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); > M> + if (error) { > M> + free((struct wtap_vap*) vap, M_80211_VAP); > M> + return NULL; > M> + } > M> > M> /* override various methods */ > M> avp->av_recv_mgmt = vap->iv_recv_mgmt; > > You don't need to cast first argument of free(9). And you don't need a cast > before malloc(9) as well. A cast might be needed if free()'s arg is a point to constant storage. This is not the case here. > ... > Also, more stylish would be to supply to free() the same variable that was > assigned at malloc(9) call, in this particular case it is "avp". Another style bug is associated with this. free() does's take args of type struct wtap_vap*. Casting to that converts vap back to the type of avp, but not to either original type returned by malloc() or the type taken by free(). Also, in KNF: - casts are not followed by a space - '*' (in almost all contexts, including the above) is preceded by a space. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 15:03:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 605E014F for ; Wed, 19 Dec 2012 15:03:04 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id C65DB8FC17 for ; Wed, 19 Dec 2012 15:03:03 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id j13so1492728lah.41 for ; Wed, 19 Dec 2012 07:03:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:x-enigmail-version:content-type :x-gm-message-state; bh=U3r6N9VTRhfEGd+3vLEaSFyyM1K/iXc0X8paMUirrmA=; b=Te8B7vvUW0sR+2JwWRUpTvSe07d9l8UHcBJ7n/LrVCxvfeA6AMZwtrZZiNXPXA2N4I ifKme0hRurgBObWhJw/zf8BU+xpwZto81ExNFbfEh1wmnW7lxobUrLEL63A/ej4/uox1 +MOTvimCruVENZbXEHs8ttmGy+SID/A9jbUB9EIyXuKFaekwBki+TUwY/gfUvxgj3v9W xVuOFZTChI4l2mOcibsPF27eay/MgQSLbcGI06dkZE7zFFVEI7dk/tUEf5484ncOxWYT h3hNTobIK36EJmYbVp7A6mH7EDGtFPRFs3b2ZBIzzaziMjCsIt7hOx6JB4zrdnmiAQlv hvJg== X-Received: by 10.112.49.97 with SMTP id t1mr2436548lbn.58.1355929382122; Wed, 19 Dec 2012 07:03:02 -0800 (PST) Received: from dhcp170-82-red.yandex.net (dhcp170-82-red.yandex.net. [95.108.170.82]) by mx.google.com with ESMTPS id ox6sm2168588lab.16.2012.12.19.07.03.00 (version=SSLv3 cipher=OTHER); Wed, 19 Dec 2012 07:03:01 -0800 (PST) Sender: Andrey Zonov Message-ID: <50D1D720.80206@FreeBSD.org> Date: Wed, 19 Dec 2012 19:02:56 +0400 From: Andrey Zonov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Xin LI Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl References: <201212132332.qBDNWmK4037503@svn.freebsd.org> In-Reply-To: <201212132332.qBDNWmK4037503@svn.freebsd.org> X-Enigmail-Version: 1.4.6 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig805A045EAA6379B1C8C69FAC" X-Gm-Message-State: ALoCoQkR9YQmySiE0NK57QKfzCecig1MLy3QrHTvvNSv8+jroa5rZ4AukOhb3QtYwGvYYEYPDUfj Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 15:03:04 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig805A045EAA6379B1C8C69FAC Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12/14/12 3:32 AM, Xin LI wrote: > Author: delphij > Date: Thu Dec 13 23:32:47 2012 > New Revision: 244198 > URL: http://svnweb.freebsd.org/changeset/base/244198 >=20 > Log: > Teach sysctl(8) about parsing a file (while I'm there also give it > capability of parsing both =3D and : formats). > =20 > Submitted by: hrs (initial version, bugs are mine) > MFC after: 3 months >=20 > Modified: > head/etc/rc.d/sysctl > head/sbin/sysctl/sysctl.8 > head/sbin/sysctl/sysctl.c >=20 > Modified: head/etc/rc.d/sysctl > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/etc/rc.d/sysctl Thu Dec 13 23:19:13 2012 (r244197) > +++ head/etc/rc.d/sysctl Thu Dec 13 23:32:47 2012 (r244198) > @@ -8,51 +8,27 @@ > . /etc/rc.subr > =20 > name=3D"sysctl" > +command=3D"/sbin/sysctl" > stop_cmd=3D":" > start_cmd=3D"sysctl_start" > reload_cmd=3D"sysctl_start" > lastload_cmd=3D"sysctl_start last" > extra_commands=3D"reload lastload" > =20 > -# > -# Read in a file containing sysctl settings and set things accordingly= =2E > -# > -parse_file() > -{ > - if [ -f $1 ]; then > - while read var comments > - do > - case ${var} in > - \#*|'') > - ;; > - *) > - mib=3D${var%=3D*} > - val=3D${var#*=3D} > - > - if current_value=3D`${SYSCTL} -n ${mib} 2>/dev/null`; then > - case ${current_value} in > - ${val}) > - ;; > - *) > - if ! sysctl "${var}" >/dev/null 2>&1; then > - warn "unable to set ${var}" > - fi > - ;; > - esac > - elif [ "$2" =3D "last" ]; then > - warn "sysctl ${mib} does not exist." > - fi > - ;; > - esac > - done < $1 > - fi > -} > - > sysctl_start() > { > - > - parse_file /etc/sysctl.conf $1 > - parse_file /etc/sysctl.conf.local $1 > + case $1 in > + last) > + command_args=3D"-i -f" > + ;; > + *) > + command_args=3D"-f" > + ;; > + esac > + > + for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do > + [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null > + done > } > =20 > load_rc_config $name >=20 Hi, I'd really like to see something like the patch bellow in the tree. I found it very useful with cfengine configuration (as like as cron.d). What do think? diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl index 36f1414..014e4c5 100755 --- a/etc/rc.d/sysctl +++ b/etc/rc.d/sysctl @@ -26,7 +26,7 @@ sysctl_start() ;; esac - for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do + for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf /etc/sysctl.conf.local; do [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/n= ull done } --=20 Andrey Zonov --------------enig805A045EAA6379B1C8C69FAC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.18 (Darwin) Comment: GPGTools - http://gpgtools.org iQEcBAEBAgAGBQJQ0dcjAAoJEBWLemxX/CvTxocH/0CHufHaEb4Hp9cxhJ7jY/th D3ohgw1Bcu4qKvqUIq2k6COfUdWwPF0Y97/abowLRT55uHKuzhlwVeOiIqh8+ieJ 20R78DozLDc3QJT8HaJ/m/QQjsWFG8oFr0H5F8S/B+HLZ56mjGAYmsEqy5oAVLT/ rEkp3QEYgZhXP/iwfBJ1GNUDnnskbhqa3aZvuudohPwXW2flwtlLgZHcFnIfYYvV cc3+3TH5Kp597YiY/1gs9uEXw7QY6aon7B1RK+boxM0n9yh30SHcfuZMMbt9whs0 +i3Hw7NzKY4BjpNmjyHkgucHLYuhiUHbskKLSk6ZBhBO5HaWeDX32b1sbUV2AAs= =vB3y -----END PGP SIGNATURE----- --------------enig805A045EAA6379B1C8C69FAC-- From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 15:37:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6885D28B; Wed, 19 Dec 2012 15:37:43 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id D2C438FC19; Wed, 19 Dec 2012 15:37:42 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.5/8.14.5) with ESMTP id qBJFbeu4010179; Wed, 19 Dec 2012 08:37:41 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id qBJFbabs065360; Wed, 19 Dec 2012 08:37:36 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl From: Ian Lepore To: Andrey Zonov In-Reply-To: <50D1D720.80206@FreeBSD.org> References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> Content-Type: multipart/mixed; boundary="=-RsHxNxMBlv4DJdm7YETt" Date: Wed, 19 Dec 2012 08:37:36 -0700 Message-ID: <1355931456.1198.203.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 15:37:43 -0000 --=-RsHxNxMBlv4DJdm7YETt Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote: > On 12/14/12 3:32 AM, Xin LI wrote: > > Author: delphij > > Date: Thu Dec 13 23:32:47 2012 > > New Revision: 244198 > > URL: http://svnweb.freebsd.org/changeset/base/244198 > > > > Log: > > Teach sysctl(8) about parsing a file (while I'm there also give it > > capability of parsing both = and : formats). > > > > Submitted by: hrs (initial version, bugs are mine) > > MFC after: 3 months > > > > Modified: > > head/etc/rc.d/sysctl > > head/sbin/sysctl/sysctl.8 > > head/sbin/sysctl/sysctl.c > > > > Modified: head/etc/rc.d/sysctl > > ============================================================================== > > --- head/etc/rc.d/sysctl Thu Dec 13 23:19:13 2012 (r244197) > > +++ head/etc/rc.d/sysctl Thu Dec 13 23:32:47 2012 (r244198) > > @@ -8,51 +8,27 @@ > > . /etc/rc.subr > > > > name="sysctl" > > +command="/sbin/sysctl" > > stop_cmd=":" > > start_cmd="sysctl_start" > > reload_cmd="sysctl_start" > > lastload_cmd="sysctl_start last" > > extra_commands="reload lastload" > > > > -# > > -# Read in a file containing sysctl settings and set things accordingly. > > -# > > -parse_file() > > -{ > > - if [ -f $1 ]; then > > - while read var comments > > - do > > - case ${var} in > > - \#*|'') > > - ;; > > - *) > > - mib=${var%=*} > > - val=${var#*=} > > - > > - if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then > > - case ${current_value} in > > - ${val}) > > - ;; > > - *) > > - if ! sysctl "${var}" >/dev/null 2>&1; then > > - warn "unable to set ${var}" > > - fi > > - ;; > > - esac > > - elif [ "$2" = "last" ]; then > > - warn "sysctl ${mib} does not exist." > > - fi > > - ;; > > - esac > > - done < $1 > > - fi > > -} > > - > > sysctl_start() > > { > > - > > - parse_file /etc/sysctl.conf $1 > > - parse_file /etc/sysctl.conf.local $1 > > + case $1 in > > + last) > > + command_args="-i -f" > > + ;; > > + *) > > + command_args="-f" > > + ;; > > + esac > > + > > + for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do > > + [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null > > + done > > } > > > > load_rc_config $name > > > > Hi, > > I'd really like to see something like the patch bellow in the tree. I > found it very useful with cfengine configuration (as like as cron.d). > > What do think? > > diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl > index 36f1414..014e4c5 100755 > --- a/etc/rc.d/sysctl > +++ b/etc/rc.d/sysctl > @@ -26,7 +26,7 @@ sysctl_start() > ;; > esac > > - for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do > + for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf > /etc/sysctl.conf.local; do > [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null > done > } > Instead of running sysctl a bunch of times, how about something conceptually similar to cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - Along with this (untested) patch to make sysctl understand "-f -". Hmmm, is /dev/stdin available as early as sysctl.conf runs? If not, the attached patch isn't going to work. -- Ian --=-RsHxNxMBlv4DJdm7YETt Content-Disposition: inline; filename="sysctl.diff" Content-Type: text/x-patch; name="sysctl.diff"; charset="us-ascii" Content-Transfer-Encoding: 7bit diff -r cc5bd6d80aa1 sbin/sysctl/sysctl.c --- sbin/sysctl/sysctl.c Sun Aug 19 11:01:08 2012 -0600 +++ sbin/sysctl/sysctl.c Wed Dec 19 08:31:14 2012 -0700 @@ -112,7 +112,10 @@ main(int argc, char **argv) eflag = 1; break; case 'f': - conffile = optarg; + if (strcmp(optarg, "-") == 0) + conffile = "/dev/stdin"; + else + conffile = optarg; break; case 'h': hflag = 1; --=-RsHxNxMBlv4DJdm7YETt-- From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 15:52:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C2C479AD; Wed, 19 Dec 2012 15:52:51 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 9CA138FC0A; Wed, 19 Dec 2012 15:52:51 +0000 (UTC) Received: from [10.0.1.102] (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 1FBC71A3C1A; Wed, 19 Dec 2012 07:52:51 -0800 (PST) References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> Mime-Version: 1.0 (1.0) In-Reply-To: <1355931456.1198.203.camel@revolution.hippie.lan> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> X-Mailer: iPhone Mail (10A523) From: Alfred Perlstein Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl Date: Wed, 19 Dec 2012 07:52:49 -0800 To: Ian Lepore Cc: "svn-src-head@freebsd.org" , Andrey Zonov , "src-committers@freebsd.org" , Xin LI , "svn-src-all@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 15:52:51 -0000 Wouldn't this obfuscate any errors in files? Sent from my iPhone On Dec 19, 2012, at 7:37 AM, Ian Lepore wrot= e: > On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote: >> On 12/14/12 3:32 AM, Xin LI wrote: >>> Author: delphij >>> Date: Thu Dec 13 23:32:47 2012 >>> New Revision: 244198 >>> URL: http://svnweb.freebsd.org/changeset/base/244198 >>>=20 >>> Log: >>> Teach sysctl(8) about parsing a file (while I'm there also give it >>> capability of parsing both =3D and : formats). >>>=20 >>> Submitted by: hrs (initial version, bugs are mine) >>> MFC after: 3 months >>>=20 >>> Modified: >>> head/etc/rc.d/sysctl >>> head/sbin/sysctl/sysctl.8 >>> head/sbin/sysctl/sysctl.c >>>=20 >>> Modified: head/etc/rc.d/sysctl >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/etc/rc.d/sysctl Thu Dec 13 23:19:13 2012 (r244197) >>> +++ head/etc/rc.d/sysctl Thu Dec 13 23:32:47 2012 (r244198) >>> @@ -8,51 +8,27 @@ >>> . /etc/rc.subr >>>=20 >>> name=3D"sysctl" >>> +command=3D"/sbin/sysctl" >>> stop_cmd=3D":" >>> start_cmd=3D"sysctl_start" >>> reload_cmd=3D"sysctl_start" >>> lastload_cmd=3D"sysctl_start last" >>> extra_commands=3D"reload lastload" >>>=20 >>> -# >>> -# Read in a file containing sysctl settings and set things accordingly.= >>> -# >>> -parse_file() >>> -{ >>> - if [ -f $1 ]; then >>> - while read var comments >>> - do >>> - case ${var} in >>> - \#*|'') >>> - ;; >>> - *) >>> - mib=3D${var%=3D*} >>> - val=3D${var#*=3D} >>> - >>> - if current_value=3D`${SYSCTL} -n ${mib} 2>/dev/null`; t= hen >>> - case ${current_value} in >>> - ${val}) >>> - ;; >>> - *) >>> - if ! sysctl "${var}" >/dev/null 2>&1; then >>> - warn "unable to set ${var}" >>> - fi >>> - ;; >>> - esac >>> - elif [ "$2" =3D "last" ]; then >>> - warn "sysctl ${mib} does not exist." >>> - fi >>> - ;; >>> - esac >>> - done < $1 >>> - fi >>> -} >>> - >>> sysctl_start() >>> { >>> - >>> - parse_file /etc/sysctl.conf $1 >>> - parse_file /etc/sysctl.conf.local $1 >>> + case $1 in >>> + last) >>> + command_args=3D"-i -f" >>> + ;; >>> + *) >>> + command_args=3D"-f" >>> + ;; >>> + esac >>> + >>> + for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do >>> + [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null >>> + done >>> } >>>=20 >>> load_rc_config $name >>=20 >> Hi, >>=20 >> I'd really like to see something like the patch bellow in the tree. I >> found it very useful with cfengine configuration (as like as cron.d). >>=20 >> What do think? >>=20 >> diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl >> index 36f1414..014e4c5 100755 >> --- a/etc/rc.d/sysctl >> +++ b/etc/rc.d/sysctl >> @@ -26,7 +26,7 @@ sysctl_start() >> ;; >> esac >>=20 >> - for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do >> + for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf >> /etc/sysctl.conf.local; do >> [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/nu= ll >> done >> } >=20 > Instead of running sysctl a bunch of times, how about something > conceptually similar to >=20 > cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - >=20 > Along with this (untested) patch to make sysctl understand "-f -". >=20 > Hmmm, is /dev/stdin available as early as sysctl.conf runs? If not, the > attached patch isn't going to work. >=20 > -- Ian >=20 > diff -r cc5bd6d80aa1 sbin/sysctl/sysctl.c --- sbin/sysctl/sysctl.c Sun= Aug 19 11:01:08 2012 -0600 +++ sbin/sysctl/sysctl.c Wed Dec 19 08:31:14= 2012 -0700 @@ -112,7 +112,10 @@ main(int argc, char **argv) eflag =3D 1; br= eak; case 'f': - conffile =3D optarg; + if (strcmp(optarg, "-") =3D=3D 0) += conffile =3D "/dev/stdin"; + else + conffile =3D optarg; break= ; case 'h': hflag =3D 1; From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 15:56:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BF917BD5; Wed, 19 Dec 2012 15:56:51 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id 6EAB48FC15; Wed, 19 Dec 2012 15:56:50 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.5/8.14.5) with ESMTP id qBJFuoPv011524; Wed, 19 Dec 2012 08:56:50 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id qBJFulZ3065395; Wed, 19 Dec 2012 08:56:47 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl From: Ian Lepore To: Alfred Perlstein In-Reply-To: <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> Content-Type: text/plain; charset="us-ascii" Date: Wed, 19 Dec 2012 08:56:47 -0700 Message-ID: <1355932607.1198.206.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , Andrey Zonov , "src-committers@freebsd.org" , Xin LI , "svn-src-all@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 15:56:51 -0000 Hrm. Yeah, it would. Or at least, it might. If the error message cites the text of the line it chokes on, maybe that's not a problem. Running sysctl once passing it a list of files would fix that, but would probably be more complexity than it's worth. I just always try to find ways to reduce rc processing time on wimpy platforms, so these wild ideas pop into my head. -- Ian On Wed, 2012-12-19 at 07:52 -0800, Alfred Perlstein wrote: > Wouldn't this obfuscate any errors in files? > > Sent from my iPhone > > On Dec 19, 2012, at 7:37 AM, Ian Lepore wrote: > > > On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote: > >> On 12/14/12 3:32 AM, Xin LI wrote: > >>> Author: delphij > >>> Date: Thu Dec 13 23:32:47 2012 > >>> New Revision: 244198 > >>> URL: http://svnweb.freebsd.org/changeset/base/244198 > >>> > >>> Log: > >>> Teach sysctl(8) about parsing a file (while I'm there also give it > >>> capability of parsing both = and : formats). > >>> > >>> Submitted by: hrs (initial version, bugs are mine) > >>> MFC after: 3 months > >>> > >>> Modified: > >>> head/etc/rc.d/sysctl > >>> head/sbin/sysctl/sysctl.8 > >>> head/sbin/sysctl/sysctl.c > >>> > >>> Modified: head/etc/rc.d/sysctl > >>> ============================================================================== > >>> --- head/etc/rc.d/sysctl Thu Dec 13 23:19:13 2012 (r244197) > >>> +++ head/etc/rc.d/sysctl Thu Dec 13 23:32:47 2012 (r244198) > >>> @@ -8,51 +8,27 @@ > >>> . /etc/rc.subr > >>> > >>> name="sysctl" > >>> +command="/sbin/sysctl" > >>> stop_cmd=":" > >>> start_cmd="sysctl_start" > >>> reload_cmd="sysctl_start" > >>> lastload_cmd="sysctl_start last" > >>> extra_commands="reload lastload" > >>> > >>> -# > >>> -# Read in a file containing sysctl settings and set things accordingly. > >>> -# > >>> -parse_file() > >>> -{ > >>> - if [ -f $1 ]; then > >>> - while read var comments > >>> - do > >>> - case ${var} in > >>> - \#*|'') > >>> - ;; > >>> - *) > >>> - mib=${var%=*} > >>> - val=${var#*=} > >>> - > >>> - if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then > >>> - case ${current_value} in > >>> - ${val}) > >>> - ;; > >>> - *) > >>> - if ! sysctl "${var}" >/dev/null 2>&1; then > >>> - warn "unable to set ${var}" > >>> - fi > >>> - ;; > >>> - esac > >>> - elif [ "$2" = "last" ]; then > >>> - warn "sysctl ${mib} does not exist." > >>> - fi > >>> - ;; > >>> - esac > >>> - done < $1 > >>> - fi > >>> -} > >>> - > >>> sysctl_start() > >>> { > >>> - > >>> - parse_file /etc/sysctl.conf $1 > >>> - parse_file /etc/sysctl.conf.local $1 > >>> + case $1 in > >>> + last) > >>> + command_args="-i -f" > >>> + ;; > >>> + *) > >>> + command_args="-f" > >>> + ;; > >>> + esac > >>> + > >>> + for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do > >>> + [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null > >>> + done > >>> } > >>> > >>> load_rc_config $name > >> > >> Hi, > >> > >> I'd really like to see something like the patch bellow in the tree. I > >> found it very useful with cfengine configuration (as like as cron.d). > >> > >> What do think? > >> > >> diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl > >> index 36f1414..014e4c5 100755 > >> --- a/etc/rc.d/sysctl > >> +++ b/etc/rc.d/sysctl > >> @@ -26,7 +26,7 @@ sysctl_start() > >> ;; > >> esac > >> > >> - for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do > >> + for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf > >> /etc/sysctl.conf.local; do > >> [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null > >> done > >> } > > > > Instead of running sysctl a bunch of times, how about something > > conceptually similar to > > > > cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - > > > > Along with this (untested) patch to make sysctl understand "-f -". > > > > Hmmm, is /dev/stdin available as early as sysctl.conf runs? If not, the > > attached patch isn't going to work. > > > > -- Ian > > > > diff -r cc5bd6d80aa1 sbin/sysctl/sysctl.c --- sbin/sysctl/sysctl.c Sun Aug 19 11:01:08 2012 -0600 +++ sbin/sysctl/sysctl.c Wed Dec 19 08:31:14 2012 -0700 @@ -112,7 +112,10 @@ main(int argc, char **argv) eflag = 1; break; case 'f': - conffile = optarg; + if (strcmp(optarg, "-") == 0) + conffile = "/dev/stdin"; + else + conffile = optarg; break; case 'h': hflag = 1; > _______________________________________________ > 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-all@FreeBSD.ORG Wed Dec 19 16:22:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 07B19C1F; Wed, 19 Dec 2012 16:22:48 +0000 (UTC) (envelope-from dim@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 E124A8FC13; Wed, 19 Dec 2012 16:22:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJGMlTw035380; Wed, 19 Dec 2012 16:22:47 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJGMk1e035370; Wed, 19 Dec 2012 16:22:46 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201212191622.qBJGMk1e035370@svn.freebsd.org> From: Dimitry Andric Date: Wed, 19 Dec 2012 16:22:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244436 - stable/9/contrib/libc++/include X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 16:22:48 -0000 Author: dim Date: Wed Dec 19 16:22:46 2012 New Revision: 244436 URL: http://svnweb.freebsd.org/changeset/base/244436 Log: MFC r243572: Pull in r168610 from upstream libc++: When using libc++ headers on FreeBSD, in combination with -std=c++98, -ansi or -std=c++03, the long long type is not supported. So in this case, several functions and types, like lldiv_t, strtoll(), are not declared. This should make it possible to use the libc++ headers in c++98 mode. Note: libc++ is originally designed as a c++0x or higher library, so you should still take care when using it with c++98 or c++03. Noted by: Yamaya Takashi MFC r243673 (by theraven): Merge new libc++ into head. Modified: stable/9/contrib/libc++/include/__config stable/9/contrib/libc++/include/cstdlib stable/9/contrib/libc++/include/cwchar stable/9/contrib/libc++/include/exception stable/9/contrib/libc++/include/iterator stable/9/contrib/libc++/include/locale Directory Properties: stable/9/contrib/libc++/ (props changed) Modified: stable/9/contrib/libc++/include/__config ============================================================================== --- stable/9/contrib/libc++/include/__config Wed Dec 19 13:26:46 2012 (r244435) +++ stable/9/contrib/libc++/include/__config Wed Dec 19 16:22:46 2012 (r244436) @@ -51,6 +51,9 @@ # define _LIBCPP_LITTLE_ENDIAN 0 # define _LIBCPP_BIG_ENDIAN 1 # endif // _BYTE_ORDER == _LITTLE_ENDIAN +# ifndef __LONG_LONG_SUPPORTED +# define _LIBCPP_HAS_NO_LONG_LONG +# endif // __LONG_LONG_SUPPORTED #endif // __FreeBSD__ #ifdef _WIN32 Modified: stable/9/contrib/libc++/include/cstdlib ============================================================================== --- stable/9/contrib/libc++/include/cstdlib Wed Dec 19 13:26:46 2012 (r244435) +++ stable/9/contrib/libc++/include/cstdlib Wed Dec 19 16:22:46 2012 (r244436) @@ -97,18 +97,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD using ::size_t; using ::div_t; using ::ldiv_t; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::lldiv_t; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::atof; using ::atoi; using ::atol; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::atoll; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::strtod; using ::strtof; using ::strtold; using ::strtol; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::strtoll; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::strtoul; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::strtoull; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::rand; using ::srand; using ::calloc; @@ -125,10 +133,14 @@ using ::bsearch; using ::qsort; using ::abs; using ::labs; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::llabs; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::div; using ::ldiv; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::lldiv; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::mblen; using ::mbtowc; using ::wctomb; @@ -145,10 +157,14 @@ using ::aligned_alloc; // MSVC already has the correct prototype in #ifdef __cplusplus #if !defined(_MSC_VER) && !defined(__sun__) inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} +#ifndef _LIBCPP_HAS_NO_LONG_LONG inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} +#endif // _LIBCPP_HAS_NO_LONG_LONG inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);} +#ifndef _LIBCPP_HAS_NO_LONG_LONG inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);} +#endif // _LIBCPP_HAS_NO_LONG_LONG #endif // _MSC_VER _LIBCPP_END_NAMESPACE_STD Modified: stable/9/contrib/libc++/include/cwchar ============================================================================== --- stable/9/contrib/libc++/include/cwchar Wed Dec 19 13:26:46 2012 (r244435) +++ stable/9/contrib/libc++/include/cwchar Wed Dec 19 16:22:46 2012 (r244436) @@ -151,9 +151,13 @@ using ::wcstof; using ::wcstold; #endif // _MSC_VER using ::wcstol; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::wcstoll; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::wcstoul; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::wcstoull; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::wcscpy; using ::wcsncpy; using ::wcscat; Modified: stable/9/contrib/libc++/include/exception ============================================================================== --- stable/9/contrib/libc++/include/exception Wed Dec 19 13:26:46 2012 (r244435) +++ stable/9/contrib/libc++/include/exception Wed Dec 19 16:22:46 2012 (r244436) @@ -143,7 +143,7 @@ public: {return !(__x == __y);} friend exception_ptr current_exception() _NOEXCEPT; - _LIBCPP_NORETURN friend void rethrow_exception(exception_ptr); + friend void rethrow_exception(exception_ptr); }; template Modified: stable/9/contrib/libc++/include/iterator ============================================================================== --- stable/9/contrib/libc++/include/iterator Wed Dec 19 13:26:46 2012 (r244435) +++ stable/9/contrib/libc++/include/iterator Wed Dec 19 16:22:46 2012 (r244436) @@ -317,6 +317,10 @@ template T* end(T (& #include #include #include +#if __APPLE__ +#include +#endif + #ifdef _LIBCPP_DEBUG #include #endif @@ -795,7 +799,7 @@ public: typedef basic_streambuf<_CharT,_Traits> streambuf_type; typedef basic_istream<_CharT,_Traits> istream_type; private: - streambuf_type* __sbuf_; + mutable streambuf_type* __sbuf_; class __proxy { @@ -809,13 +813,14 @@ private: }; _LIBCPP_INLINE_VISIBILITY - void __test_for_eof() + bool __test_for_eof() const { if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof())) __sbuf_ = 0; + return __sbuf_ == 0; } public: - _LIBCPP_INLINE_VISIBILITY istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT : __sbuf_(__s.rdbuf()) {__test_for_eof();} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT @@ -828,19 +833,16 @@ public: _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++() { - if (traits_type::eq_int_type(__sbuf_->snextc(), traits_type::eof())) - __sbuf_ = 0; + __sbuf_->sbumpc(); return *this; } _LIBCPP_INLINE_VISIBILITY __proxy operator++(int) { - char_type __c = __sbuf_->sgetc(); - ++(*this); - return __proxy(__c, __sbuf_); + return __proxy(__sbuf_->sbumpc(), __sbuf_); } _LIBCPP_INLINE_VISIBILITY bool equal(const istreambuf_iterator& __b) const - {return (__sbuf_ == 0) == (__b.__sbuf_ == 0);} + {return __test_for_eof() == __b.__test_for_eof();} }; template @@ -882,6 +884,10 @@ public: _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;} _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;} +#if !defined(__APPLE__) || \ + (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0) + template friend _LIBCPP_HIDDEN @@ -889,6 +895,7 @@ public: __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s, const _Ch* __ob, const _Ch* __op, const _Ch* __oe, ios_base& __iob, _Ch __fl); +#endif }; template Modified: stable/9/contrib/libc++/include/locale ============================================================================== --- stable/9/contrib/libc++/include/locale Wed Dec 19 13:26:46 2012 (r244435) +++ stable/9/contrib/libc++/include/locale Wed Dec 19 16:22:46 2012 (r244436) @@ -192,6 +192,10 @@ template class messages_by #include #endif // !_WIN32 +#if __APPLE__ +#include +#endif + #include <__undef_min_max> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -1587,6 +1591,10 @@ __pad_and_output(_OutputIterator __s, return __s; } +#if !defined(__APPLE__) || \ + (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0) + template _LIBCPP_HIDDEN ostreambuf_iterator<_CharT, _Traits> @@ -1633,6 +1641,8 @@ __pad_and_output(ostreambuf_iterator<_Ch return __s; } +#endif + template _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 16:23:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6ADD2D9F; Wed, 19 Dec 2012 16:23:22 +0000 (UTC) (envelope-from emaste@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 4F1158FC1D; Wed, 19 Dec 2012 16:23:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJGNMgc035527; Wed, 19 Dec 2012 16:23:22 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJGNLrm035520; Wed, 19 Dec 2012 16:23:21 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201212191623.qBJGNLrm035520@svn.freebsd.org> From: Ed Maste Date: Wed, 19 Dec 2012 16:23:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244437 - head/contrib/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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 16:23:22 -0000 Author: emaste Date: Wed Dec 19 16:23:20 2012 New Revision: 244437 URL: http://svnweb.freebsd.org/changeset/base/244437 Log: Support restrict qualifier in dwarf debug info Newer clang/llvm emit DW_TAG_restrict_type, which wasn't handled by gdb. Import support from Apple's gdb-1822: | 2009-03-24 Jason Molenda (jmolenda@apple.com) | | * gdbtypes.c (make_cv_type): Rename this function to make_cvr_type to | also handle restrict qualifiers. | (check_typedef): Handle TYPE_RESTRICT. | * gdbtypes.h (TYPE_FLAG_RESTRICT, TYPE_RESTRICT): New. | * hpread.c (hpread_type_lookup): Update to use make_cvr_type. | * stabsread.c (read_type): Pass the restrict qualifiers along. | * parse.c (follow_types): Pass the restrict qualifiers along. | * dwarf2read.c (read_tag_const_type): Call make_cvr_type. | (read_tag_volatile_type): Same. | (read_tag_restrict_type): New function. | (read_type_die): Handle DW_TAG_restrict_type. Obtained from: Apple Sponsored by: ADARA Networks Modified: head/contrib/gdb/gdb/dwarf2read.c head/contrib/gdb/gdb/gdbtypes.c head/contrib/gdb/gdb/gdbtypes.h head/contrib/gdb/gdb/hpread.c head/contrib/gdb/gdb/parse.c head/contrib/gdb/gdb/stabsread.c Modified: head/contrib/gdb/gdb/dwarf2read.c ============================================================================== --- head/contrib/gdb/gdb/dwarf2read.c Wed Dec 19 16:22:46 2012 (r244436) +++ head/contrib/gdb/gdb/dwarf2read.c Wed Dec 19 16:23:20 2012 (r244437) @@ -834,6 +834,8 @@ static void read_tag_const_type (struct static void read_tag_volatile_type (struct die_info *, struct dwarf2_cu *); +static void read_tag_restrict_type (struct die_info *, struct dwarf2_cu *); + static void read_tag_string_type (struct die_info *, struct dwarf2_cu *); static void read_subroutine_type (struct die_info *, struct dwarf2_cu *); @@ -3729,7 +3731,8 @@ read_tag_const_type (struct die_info *di } base_type = die_type (die, cu); - die->type = make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0); + die->type = make_cvr_type (1, TYPE_VOLATILE (base_type), + TYPE_RESTRICT (base_type), base_type, 0); } static void @@ -3743,7 +3746,23 @@ read_tag_volatile_type (struct die_info } base_type = die_type (die, cu); - die->type = make_cv_type (TYPE_CONST (base_type), 1, base_type, 0); + die->type = make_cvr_type (TYPE_CONST (base_type), 1, + TYPE_RESTRICT (base_type), base_type, 0); +} + +static void +read_tag_restrict_type (struct die_info *die, struct dwarf2_cu *cu) +{ + struct type *base_type; + + if (die->type) + { + return; + } + + base_type = die_type (die, cu); + die->type = make_cvr_type (TYPE_CONST (base_type), TYPE_VOLATILE (base_type), + 1, base_type, 0); } /* Extract all information from a DW_TAG_string_type DIE and add to @@ -6086,6 +6105,9 @@ read_type_die (struct die_info *die, str case DW_TAG_volatile_type: read_tag_volatile_type (die, cu); break; + case DW_TAG_restrict_type: + read_tag_restrict_type (die, cu); + break; case DW_TAG_string_type: read_tag_string_type (die, cu); break; Modified: head/contrib/gdb/gdb/gdbtypes.c ============================================================================== --- head/contrib/gdb/gdb/gdbtypes.c Wed Dec 19 16:22:46 2012 (r244436) +++ head/contrib/gdb/gdb/gdbtypes.c Wed Dec 19 16:23:20 2012 (r244437) @@ -502,7 +502,8 @@ make_type_with_address_space (struct typ We allocate new memory if needed. */ struct type * -make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr) +make_cvr_type (int cnst, int voltl, int restrct, struct type *type, + struct type **typeptr) { struct type *ntype; /* New type */ struct type *tmp_type = type; /* tmp type */ @@ -517,6 +518,9 @@ make_cv_type (int cnst, int voltl, struc if (voltl) new_flags |= TYPE_FLAG_VOLATILE; + if (restrct) + new_flags |= TYPE_FLAG_RESTRICT; + if (typeptr && *typeptr != NULL) { /* Objfile is per-core-type. This const-qualified type had best @@ -1371,7 +1375,7 @@ struct type * check_typedef (struct type *type) { struct type *orig_type = type; - int is_const, is_volatile; + int is_const, is_volatile, is_restrict; while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) { @@ -1407,6 +1411,7 @@ check_typedef (struct type *type) is_const = TYPE_CONST (type); is_volatile = TYPE_VOLATILE (type); + is_restrict = TYPE_RESTRICT (type); /* If this is a struct/class/union with no fields, then check whether a full definition exists somewhere else. This is for systems where a @@ -1424,7 +1429,7 @@ check_typedef (struct type *type) } newtype = lookup_transparent_type (name); if (newtype) - make_cv_type (is_const, is_volatile, newtype, &type); + make_cvr_type (is_const, is_volatile, is_restrict, newtype, &type); } /* Otherwise, rely on the stub flag being set for opaque/stubbed types */ else if (TYPE_STUB (type) && !currently_reading_symtab) @@ -1442,7 +1447,8 @@ check_typedef (struct type *type) } sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0, (struct symtab **) NULL); if (sym) - make_cv_type (is_const, is_volatile, SYMBOL_TYPE (sym), &type); + make_cvr_type (is_const, is_volatile, is_restrict, SYMBOL_TYPE (sym), + &type); } if (TYPE_TARGET_STUB (type)) Modified: head/contrib/gdb/gdb/gdbtypes.h ============================================================================== --- head/contrib/gdb/gdb/gdbtypes.h Wed Dec 19 16:22:46 2012 (r244436) +++ head/contrib/gdb/gdb/gdbtypes.h Wed Dec 19 16:23:20 2012 (r244437) @@ -273,6 +273,13 @@ enum type_code #define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \ & TYPE_FLAG_ADDRESS_CLASS_ALL) +/* Restrict type. If this is set, the corresponding type has a + * restrict modifier. + */ + +#define TYPE_FLAG_RESTRICT (1 << 17) +#define TYPE_RESTRICT(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_RESTRICT) + /* Array bound type. */ enum array_bound_type { @@ -1099,7 +1106,8 @@ extern struct type *lookup_reference_typ extern struct type *make_reference_type (struct type *, struct type **); -extern struct type *make_cv_type (int, int, struct type *, struct type **); +extern struct type *make_cvr_type (int, int, int, struct type *, + struct type **); extern void replace_type (struct type *, struct type *); Modified: head/contrib/gdb/gdb/hpread.c ============================================================================== --- head/contrib/gdb/gdb/hpread.c Wed Dec 19 16:22:46 2012 (r244436) +++ head/contrib/gdb/gdb/hpread.c Wed Dec 19 16:23:20 2012 (r244437) @@ -4939,8 +4939,9 @@ hpread_type_lookup (dnttpointer hp_type, * "m_void" modifiers? Is static_flag really needed here? * (m_static used for methods of classes, elsewhere). */ - tmp_type = make_cv_type (dn_bufp->dmodifier.m_const, + tmp_type = make_cvr_type (dn_bufp->dmodifier.m_const, dn_bufp->dmodifier.m_volatile, + 0, hpread_type_lookup (dn_bufp->dmodifier.type, objfile), 0); return tmp_type; Modified: head/contrib/gdb/gdb/parse.c ============================================================================== --- head/contrib/gdb/gdb/parse.c Wed Dec 19 16:22:46 2012 (r244436) +++ head/contrib/gdb/gdb/parse.c Wed Dec 19 16:23:20 2012 (r244437) @@ -1167,13 +1167,15 @@ follow_types (struct type *follow_type) case tp_end: done = 1; if (make_const) - follow_type = make_cv_type (make_const, - TYPE_VOLATILE (follow_type), - follow_type, 0); + follow_type = make_cvr_type (make_const, + TYPE_VOLATILE (follow_type), + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_volatile) - follow_type = make_cv_type (TYPE_CONST (follow_type), - make_volatile, - follow_type, 0); + follow_type = make_cvr_type (TYPE_CONST (follow_type), + make_volatile, + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_addr_space) follow_type = make_type_with_address_space (follow_type, make_addr_space); @@ -1192,13 +1194,15 @@ follow_types (struct type *follow_type) case tp_pointer: follow_type = lookup_pointer_type (follow_type); if (make_const) - follow_type = make_cv_type (make_const, - TYPE_VOLATILE (follow_type), - follow_type, 0); + follow_type = make_cvr_type (make_const, + TYPE_VOLATILE (follow_type), + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_volatile) - follow_type = make_cv_type (TYPE_CONST (follow_type), - make_volatile, - follow_type, 0); + follow_type = make_cvr_type (TYPE_CONST (follow_type), + make_volatile, + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_addr_space) follow_type = make_type_with_address_space (follow_type, make_addr_space); @@ -1208,13 +1212,15 @@ follow_types (struct type *follow_type) case tp_reference: follow_type = lookup_reference_type (follow_type); if (make_const) - follow_type = make_cv_type (make_const, - TYPE_VOLATILE (follow_type), - follow_type, 0); + follow_type = make_cvr_type (make_const, + TYPE_VOLATILE (follow_type), + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_volatile) - follow_type = make_cv_type (TYPE_CONST (follow_type), - make_volatile, - follow_type, 0); + follow_type = make_cvr_type (TYPE_CONST (follow_type), + make_volatile, + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_addr_space) follow_type = make_type_with_address_space (follow_type, make_addr_space); Modified: head/contrib/gdb/gdb/stabsread.c ============================================================================== --- head/contrib/gdb/gdb/stabsread.c Wed Dec 19 16:22:46 2012 (r244436) +++ head/contrib/gdb/gdb/stabsread.c Wed Dec 19 16:23:20 2012 (r244437) @@ -1750,13 +1750,13 @@ again: case 'k': /* Const qualifier on some type (Sun) */ type = read_type (pp, objfile); - type = make_cv_type (1, TYPE_VOLATILE (type), type, + type = make_cvr_type (1, TYPE_VOLATILE (type), TYPE_RESTRICT(type), type, dbx_lookup_type (typenums)); break; case 'B': /* Volatile qual on some type (Sun) */ type = read_type (pp, objfile); - type = make_cv_type (TYPE_CONST (type), 1, type, + type = make_cvr_type (TYPE_CONST (type), 1, TYPE_RESTRICT(type), type, dbx_lookup_type (typenums)); break; From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 17:02:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0156DE88; Wed, 19 Dec 2012 17:02:08 +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 D9B068FC14; Wed, 19 Dec 2012 17:02:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJH27ZO042151; Wed, 19 Dec 2012 17:02:07 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJH271Q042150; Wed, 19 Dec 2012 17:02:07 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201212191702.qBJH271Q042150@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 19 Dec 2012 17:02:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244439 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 17:02:08 -0000 Author: ae Date: Wed Dec 19 17:02:07 2012 New Revision: 244439 URL: http://svnweb.freebsd.org/changeset/base/244439 Log: The selectroute functions does own account of EHOSTUNREACH errors, no need to do it twice. MFC after: 1 week Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Wed Dec 19 16:37:05 2012 (r244438) +++ head/sys/netinet6/ip6_output.c Wed Dec 19 17:02:07 2012 (r244439) @@ -645,14 +645,6 @@ again: ifp = ro->ro_rt->rt_ifp; } else if ((error = in6_selectroute_fib(&dst_sa, opt, im6o, ro, &ifp, &rt, inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m))) != 0) { - switch (error) { - case EHOSTUNREACH: - V_ip6stat.ip6s_noroute++; - break; - case EADDRNOTAVAIL: - default: - break; /* XXX statistics? */ - } if (ifp != NULL) in6_ifstat_inc(ifp, ifs6_out_discard); goto bad; From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 17:08:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 64293171; Wed, 19 Dec 2012 17:08:50 +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 48EB78FC0A; Wed, 19 Dec 2012 17:08:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJH8oE6044012; Wed, 19 Dec 2012 17:08:50 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJH8o4W044011; Wed, 19 Dec 2012 17:08:50 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201212191708.qBJH8o4W044011@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 19 Dec 2012 17:08:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244440 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 17:08:50 -0000 Author: ae Date: Wed Dec 19 17:08:49 2012 New Revision: 244440 URL: http://svnweb.freebsd.org/changeset/base/244440 Log: Make dst_sa initialization only when it is actually needed. MFC after: 1 week Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Wed Dec 19 17:02:07 2012 (r244439) +++ head/sys/netinet6/ip6_output.c Wed Dec 19 17:08:49 2012 (r244440) @@ -636,18 +636,21 @@ again: /* adjust pointer */ ip6 = mtod(m, struct ip6_hdr *); - bzero(&dst_sa, sizeof(dst_sa)); - dst_sa.sin6_family = AF_INET6; - dst_sa.sin6_len = sizeof(dst_sa); - dst_sa.sin6_addr = ip6->ip6_dst; if (ro->ro_rt) { rt = ro->ro_rt; ifp = ro->ro_rt->rt_ifp; - } else if ((error = in6_selectroute_fib(&dst_sa, opt, im6o, ro, - &ifp, &rt, inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m))) != 0) { - if (ifp != NULL) - in6_ifstat_inc(ifp, ifs6_out_discard); - goto bad; + } else { + bzero(&dst_sa, sizeof(dst_sa)); + dst_sa.sin6_family = AF_INET6; + dst_sa.sin6_len = sizeof(dst_sa); + dst_sa.sin6_addr = ip6->ip6_dst; + error = in6_selectroute_fib(&dst_sa, opt, im6o, ro, &ifp, + &rt, inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m)); + if (error != 0) { + if (ifp != NULL) + in6_ifstat_inc(ifp, ifs6_out_discard); + goto bad; + } } if (rt == NULL) { /* From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 17:28:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BB842708; Wed, 19 Dec 2012 17:28:18 +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 875D78FC12; Wed, 19 Dec 2012 17:28:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJHSIc9047467; Wed, 19 Dec 2012 17:28:18 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJHSIKe047466; Wed, 19 Dec 2012 17:28:18 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201212191728.qBJHSIKe047466@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 19 Dec 2012 17:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244441 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 17:28:18 -0000 Author: ae Date: Wed Dec 19 17:28:17 2012 New Revision: 244441 URL: http://svnweb.freebsd.org/changeset/base/244441 Log: When we have some address to forward (e.g. it was specified with ipfw fwd), we should pass it as first argument into in6_selectroute_fib function to initiate new route lookup. MFC after: 1 week Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Wed Dec 19 17:08:49 2012 (r244440) +++ head/sys/netinet6/ip6_output.c Wed Dec 19 17:28:17 2012 (r244441) @@ -257,7 +257,7 @@ ip6_output(struct mbuf *m0, struct ip6_p int segleft_org = 0; struct secpolicy *sp = NULL; #endif /* IPSEC */ - struct m_tag *fwd_tag; + struct m_tag *fwd_tag = NULL; ip6 = mtod(m, struct ip6_hdr *); if (ip6 == NULL) { @@ -636,14 +636,16 @@ again: /* adjust pointer */ ip6 = mtod(m, struct ip6_hdr *); - if (ro->ro_rt) { + if (ro->ro_rt && fwd_tag == NULL) { rt = ro->ro_rt; ifp = ro->ro_rt->rt_ifp; } else { - bzero(&dst_sa, sizeof(dst_sa)); - dst_sa.sin6_family = AF_INET6; - dst_sa.sin6_len = sizeof(dst_sa); - dst_sa.sin6_addr = ip6->ip6_dst; + if (fwd_tag == NULL) { + bzero(&dst_sa, sizeof(dst_sa)); + dst_sa.sin6_family = AF_INET6; + dst_sa.sin6_len = sizeof(dst_sa); + dst_sa.sin6_addr = ip6->ip6_dst; + } error = in6_selectroute_fib(&dst_sa, opt, im6o, ro, &ifp, &rt, inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m)); if (error != 0) { @@ -928,7 +930,7 @@ again: if ((m->m_flags & M_IP6_NEXTHOP) && (fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL)) != NULL) { dst = (struct sockaddr_in6 *)&ro->ro_dst; - bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in6)); + bcopy((fwd_tag+1), &dst_sa, sizeof(struct sockaddr_in6)); m->m_flags |= M_SKIP_FIREWALL; m->m_flags &= ~M_IP6_NEXTHOP; m_tag_delete(m, fwd_tag); From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 17:37:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BA441B27; Wed, 19 Dec 2012 17:37:19 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 95C7D8FC0A; Wed, 19 Dec 2012 17:37:19 +0000 (UTC) Received: from [10.0.1.102] (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id DBD3C1A3C2A; Wed, 19 Dec 2012 09:37:18 -0800 (PST) References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> Mime-Version: 1.0 (1.0) In-Reply-To: <1355932607.1198.206.camel@revolution.hippie.lan> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: X-Mailer: iPhone Mail (10A523) From: Alfred Perlstein Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl Date: Wed, 19 Dec 2012 09:37:16 -0800 To: Ian Lepore Cc: "svn-src-head@freebsd.org" , Andrey Zonov , "src-committers@freebsd.org" , Xin LI , "svn-src-all@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 17:37:19 -0000 I think that it's a good idea. Maybe there's some way to give sysctl.conf th= e equivalent of #file preprocessor directives? Sent from my iPhone On Dec 19, 2012, at 7:56 AM, Ian Lepore wrot= e: > Hrm. Yeah, it would. Or at least, it might. If the error message > cites the text of the line it chokes on, maybe that's not a problem. >=20 > Running sysctl once passing it a list of files would fix that, but would > probably be more complexity than it's worth. I just always try to find > ways to reduce rc processing time on wimpy platforms, so these wild > ideas pop into my head. >=20 > -- Ian >=20 > On Wed, 2012-12-19 at 07:52 -0800, Alfred Perlstein wrote: >> Wouldn't this obfuscate any errors in files? >>=20 >> Sent from my iPhone >>=20 >> On Dec 19, 2012, at 7:37 AM, Ian Lepore w= rote: >>=20 >>> On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote: >>>> On 12/14/12 3:32 AM, Xin LI wrote: >>>>> Author: delphij >>>>> Date: Thu Dec 13 23:32:47 2012 >>>>> New Revision: 244198 >>>>> URL: http://svnweb.freebsd.org/changeset/base/244198 >>>>>=20 >>>>> Log: >>>>> Teach sysctl(8) about parsing a file (while I'm there also give it >>>>> capability of parsing both =3D and : formats). >>>>>=20 >>>>> Submitted by: hrs (initial version, bugs are mine) >>>>> MFC after: 3 months >>>>>=20 >>>>> Modified: >>>>> head/etc/rc.d/sysctl >>>>> head/sbin/sysctl/sysctl.8 >>>>> head/sbin/sysctl/sysctl.c >>>>>=20 >>>>> Modified: head/etc/rc.d/sysctl >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/etc/rc.d/sysctl Thu Dec 13 23:19:13 2012 (r244197) >>>>> +++ head/etc/rc.d/sysctl Thu Dec 13 23:32:47 2012 (r244198) >>>>> @@ -8,51 +8,27 @@ >>>>> . /etc/rc.subr >>>>>=20 >>>>> name=3D"sysctl" >>>>> +command=3D"/sbin/sysctl" >>>>> stop_cmd=3D":" >>>>> start_cmd=3D"sysctl_start" >>>>> reload_cmd=3D"sysctl_start" >>>>> lastload_cmd=3D"sysctl_start last" >>>>> extra_commands=3D"reload lastload" >>>>>=20 >>>>> -# >>>>> -# Read in a file containing sysctl settings and set things accordingl= y. >>>>> -# >>>>> -parse_file() >>>>> -{ >>>>> - if [ -f $1 ]; then >>>>> - while read var comments >>>>> - do >>>>> - case ${var} in >>>>> - \#*|'') >>>>> - ;; >>>>> - *) >>>>> - mib=3D${var%=3D*} >>>>> - val=3D${var#*=3D} >>>>> - >>>>> - if current_value=3D`${SYSCTL} -n ${mib} 2>/dev/null`;= then >>>>> - case ${current_value} in >>>>> - ${val}) >>>>> - ;; >>>>> - *) >>>>> - if ! sysctl "${var}" >/dev/null 2>&1; then >>>>> - warn "unable to set ${var}" >>>>> - fi >>>>> - ;; >>>>> - esac >>>>> - elif [ "$2" =3D "last" ]; then >>>>> - warn "sysctl ${mib} does not exist." >>>>> - fi >>>>> - ;; >>>>> - esac >>>>> - done < $1 >>>>> - fi >>>>> -} >>>>> - >>>>> sysctl_start() >>>>> { >>>>> - >>>>> - parse_file /etc/sysctl.conf $1 >>>>> - parse_file /etc/sysctl.conf.local $1 >>>>> + case $1 in >>>>> + last) >>>>> + command_args=3D"-i -f" >>>>> + ;; >>>>> + *) >>>>> + command_args=3D"-f" >>>>> + ;; >>>>> + esac >>>>> + >>>>> + for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do >>>>> + [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null >>>>> + done >>>>> } >>>>>=20 >>>>> load_rc_config $name >>>>=20 >>>> Hi, >>>>=20 >>>> I'd really like to see something like the patch bellow in the tree. I >>>> found it very useful with cfengine configuration (as like as cron.d). >>>>=20 >>>> What do think? >>>>=20 >>>> diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl >>>> index 36f1414..014e4c5 100755 >>>> --- a/etc/rc.d/sysctl >>>> +++ b/etc/rc.d/sysctl >>>> @@ -26,7 +26,7 @@ sysctl_start() >>>> ;; >>>> esac >>>>=20 >>>> - for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do >>>> + for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf >>>> /etc/sysctl.conf.local; do >>>> [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/n= ull >>>> done >>>> } >>>=20 >>> Instead of running sysctl a bunch of times, how about something >>> conceptually similar to >>>=20 >>> cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - >>>=20 >>> Along with this (untested) patch to make sysctl understand "-f -". >>>=20 >>> Hmmm, is /dev/stdin available as early as sysctl.conf runs? If not, the= >>> attached patch isn't going to work. >>>=20 >>> -- Ian >>>=20 >>> diff -r cc5bd6d80aa1 sbin/sysctl/sysctl.c --- sbin/sysctl/sysctl.c Su= n Aug 19 11:01:08 2012 -0600 +++ sbin/sysctl/sysctl.c Wed Dec 19 08:31:14= 2012 -0700 @@ -112,7 +112,10 @@ main(int argc, char **argv) eflag =3D 1; br= eak; case 'f': - conffile =3D optarg; + if (strcmp(optarg, "-") =3D=3D 0= ) + conffile =3D "/dev/stdin"; + else + conffile =3D optarg; break; c= ase 'h': hflag =3D 1; >> _______________________________________________ >> 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" >=20 >=20 From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 19:04:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0D7EB5DC; Wed, 19 Dec 2012 19:04:22 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id DB3DC8FC12; Wed, 19 Dec 2012 19:04:21 +0000 (UTC) Received: from [10.226.124.117] (191.sub-174-253-232.myvzw.com [174.253.232.191]) by elvis.mu.org (Postfix) with ESMTPSA id 84B091A3C2B; Wed, 19 Dec 2012 11:04:19 -0800 (PST) References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <8897E6EF-3F09-4EAD-9DE9-7BE77ADD18C4@mu.org> X-Mailer: iPhone Mail (10A523) From: Alfred Perlstein Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl Date: Wed, 19 Dec 2012 11:04:17 -0800 To: Ian Lepore Cc: "svn-src-head@freebsd.org" , Andrey Zonov , "src-committers@freebsd.org" , Xin LI , "svn-src-all@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 19:04:22 -0000 I didn't catch your idea of multiple files to parse. That sounds like a bett= er idea than mine (# based file directives) for sure.=20 Sent from my iPhone On Dec 19, 2012, at 9:37 AM, Alfred Perlstein wrote: > I think that it's a good idea. Maybe there's some way to give sysctl.conf t= he equivalent of #file preprocessor directives? >=20 > Sent from my iPhone >=20 > On Dec 19, 2012, at 7:56 AM, Ian Lepore wr= ote: >=20 >> Hrm. Yeah, it would. Or at least, it might. If the error message >> cites the text of the line it chokes on, maybe that's not a problem. >>=20 >> Running sysctl once passing it a list of files would fix that, but would >> probably be more complexity than it's worth. I just always try to find >> ways to reduce rc processing time on wimpy platforms, so these wild >> ideas pop into my head. >>=20 >> -- Ian >>=20 >> On Wed, 2012-12-19 at 07:52 -0800, Alfred Perlstein wrote: >>> Wouldn't this obfuscate any errors in files? >>>=20 >>> Sent from my iPhone >>>=20 >>> On Dec 19, 2012, at 7:37 AM, Ian Lepore w= rote: >>>=20 >>>> On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote: >>>>> On 12/14/12 3:32 AM, Xin LI wrote: >>>>>> Author: delphij >>>>>> Date: Thu Dec 13 23:32:47 2012 >>>>>> New Revision: 244198 >>>>>> URL: http://svnweb.freebsd.org/changeset/base/244198 >>>>>>=20 >>>>>> Log: >>>>>> Teach sysctl(8) about parsing a file (while I'm there also give it >>>>>> capability of parsing both =3D and : formats). >>>>>>=20 >>>>>> Submitted by: hrs (initial version, bugs are mine) >>>>>> MFC after: 3 months >>>>>>=20 >>>>>> Modified: >>>>>> head/etc/rc.d/sysctl >>>>>> head/sbin/sysctl/sysctl.8 >>>>>> head/sbin/sysctl/sysctl.c >>>>>>=20 >>>>>> Modified: head/etc/rc.d/sysctl >>>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/etc/rc.d/sysctl Thu Dec 13 23:19:13 2012 (r244197) >>>>>> +++ head/etc/rc.d/sysctl Thu Dec 13 23:32:47 2012 (r244198) >>>>>> @@ -8,51 +8,27 @@ >>>>>> . /etc/rc.subr >>>>>>=20 >>>>>> name=3D"sysctl" >>>>>> +command=3D"/sbin/sysctl" >>>>>> stop_cmd=3D":" >>>>>> start_cmd=3D"sysctl_start" >>>>>> reload_cmd=3D"sysctl_start" >>>>>> lastload_cmd=3D"sysctl_start last" >>>>>> extra_commands=3D"reload lastload" >>>>>>=20 >>>>>> -# >>>>>> -# Read in a file containing sysctl settings and set things according= ly. >>>>>> -# >>>>>> -parse_file() >>>>>> -{ >>>>>> - if [ -f $1 ]; then >>>>>> - while read var comments >>>>>> - do >>>>>> - case ${var} in >>>>>> - \#*|'') >>>>>> - ;; >>>>>> - *) >>>>>> - mib=3D${var%=3D*} >>>>>> - val=3D${var#*=3D} >>>>>> - >>>>>> - if current_value=3D`${SYSCTL} -n ${mib} 2>/dev/null`= ; then >>>>>> - case ${current_value} in >>>>>> - ${val}) >>>>>> - ;; >>>>>> - *) >>>>>> - if ! sysctl "${var}" >/dev/null 2>&1; then >>>>>> - warn "unable to set ${var}" >>>>>> - fi >>>>>> - ;; >>>>>> - esac >>>>>> - elif [ "$2" =3D "last" ]; then >>>>>> - warn "sysctl ${mib} does not exist." >>>>>> - fi >>>>>> - ;; >>>>>> - esac >>>>>> - done < $1 >>>>>> - fi >>>>>> -} >>>>>> - >>>>>> sysctl_start() >>>>>> { >>>>>> - >>>>>> - parse_file /etc/sysctl.conf $1 >>>>>> - parse_file /etc/sysctl.conf.local $1 >>>>>> + case $1 in >>>>>> + last) >>>>>> + command_args=3D"-i -f" >>>>>> + ;; >>>>>> + *) >>>>>> + command_args=3D"-f" >>>>>> + ;; >>>>>> + esac >>>>>> + >>>>>> + for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do >>>>>> + [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null= >>>>>> + done >>>>>> } >>>>>>=20 >>>>>> load_rc_config $name >>>>>=20 >>>>> Hi, >>>>>=20 >>>>> I'd really like to see something like the patch bellow in the tree. I= >>>>> found it very useful with cfengine configuration (as like as cron.d). >>>>>=20 >>>>> What do think? >>>>>=20 >>>>> diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl >>>>> index 36f1414..014e4c5 100755 >>>>> --- a/etc/rc.d/sysctl >>>>> +++ b/etc/rc.d/sysctl >>>>> @@ -26,7 +26,7 @@ sysctl_start() >>>>> ;; >>>>> esac >>>>>=20 >>>>> - for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do >>>>> + for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf >>>>> /etc/sysctl.conf.local; do >>>>> [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/n= ull >>>>> done >>>>> } >>>>=20 >>>> Instead of running sysctl a bunch of times, how about something >>>> conceptually similar to >>>>=20 >>>> cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - >>>>=20 >>>> Along with this (untested) patch to make sysctl understand "-f -". >>>>=20 >>>> Hmmm, is /dev/stdin available as early as sysctl.conf runs? If not, th= e >>>> attached patch isn't going to work. >>>>=20 >>>> -- Ian >>>>=20 >>>> diff -r cc5bd6d80aa1 sbin/sysctl/sysctl.c --- sbin/sysctl/sysctl.c S= un Aug 19 11:01:08 2012 -0600 +++ sbin/sysctl/sysctl.c Wed Dec 19 08:31:1= 4 2012 -0700 @@ -112,7 +112,10 @@ main(int argc, char **argv) eflag =3D 1; b= reak; case 'f': - conffile =3D optarg; + if (strcmp(optarg, "-") =3D=3D 0= ) + conffile =3D "/dev/stdin"; + else + conffile =3D optarg; break; c= ase 'h': hflag =3D 1; >>> _______________________________________________ >>> 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" >=20 From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 19:16:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B4948852; Wed, 19 Dec 2012 19:16:33 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) by mx1.freebsd.org (Postfix) with ESMTP id 893AA8FC0A; Wed, 19 Dec 2012 19:16:33 +0000 (UTC) Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 9A8EF22C32; Wed, 19 Dec 2012 11:16:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1355944587; bh=IWxvwyCU5MVZgMl1sgOq3sAVx55rTKqt6QLBSa0Xpww=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=02Hiam4Ebthai11TeBb6cGSIS+VJc9pGmFn48axd4CKd7lbMdJhLkgocG+6yahnWh t5yf+/jiFajERo/ohjaDOWfVyC+Ow4BENXldJH+Nqf7UcdFRniJVFxIbovKkOMp0m8 wTULAsWRm2rz/3GjmgMlUg7u+skgWErSnvBffZH8= Message-ID: <50D2128A.7030205@delphij.net> Date: Wed, 19 Dec 2012 11:16:26 -0800 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: Alfred Perlstein Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Ian Lepore , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 19:16:33 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 12/19/12 09:37, Alfred Perlstein wrote: > I think that it's a good idea. Maybe there's some way to give > sysctl.conf the equivalent of #file preprocessor directives? /me seeing sysctl(8) expanding to grow e-mail reading capability in the future? :) It may be worthy to make sysctl(8) to accept mutiple -f's, but it seems to be hard to write shell scripts that utilizes this feature in a elegant manner. It shouldn't be hard to add -f - capability as well, which will be useful for applications like FreeNAS. Jilles also have some comments that I wanted to address as well. > Sent from my iPhone > > On Dec 19, 2012, at 7:56 AM, Ian Lepore > wrote: > >> Hrm. Yeah, it would. Or at least, it might. If the error >> message cites the text of the line it chokes on, maybe that's not >> a problem. >> >> Running sysctl once passing it a list of files would fix that, >> but would probably be more complexity than it's worth. I just >> always try to find ways to reduce rc processing time on wimpy >> platforms, so these wild ideas pop into my head. >> >> -- Ian >> >> On Wed, 2012-12-19 at 07:52 -0800, Alfred Perlstein wrote: >>> Wouldn't this obfuscate any errors in files? >>> >>> Sent from my iPhone >>> >>> On Dec 19, 2012, at 7:37 AM, Ian Lepore >>> wrote: >>> >>>> On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote: >>>>> On 12/14/12 3:32 AM, Xin LI wrote: >>>>>> Author: delphij Date: Thu Dec 13 23:32:47 2012 New >>>>>> Revision: 244198 URL: >>>>>> http://svnweb.freebsd.org/changeset/base/244198 >>>>>> >>>>>> Log: Teach sysctl(8) about parsing a file (while I'm >>>>>> there also give it capability of parsing both = and : >>>>>> formats). >>>>>> >>>>>> Submitted by: hrs (initial version, bugs are mine) MFC >>>>>> after: 3 months >>>>>> >>>>>> Modified: head/etc/rc.d/sysctl head/sbin/sysctl/sysctl.8 >>>>>> head/sbin/sysctl/sysctl.c >>>>>> >>>>>> Modified: head/etc/rc.d/sysctl >>>>>> ============================================================================== >>>>>> >>>>>> - --- head/etc/rc.d/sysctl Thu Dec 13 23:19:13 2012 (r244197) >>>>>> +++ head/etc/rc.d/sysctl Thu Dec 13 23:32:47 2012 >>>>>> (r244198) @@ -8,51 +8,27 @@ . /etc/rc.subr >>>>>> >>>>>> name="sysctl" +command="/sbin/sysctl" stop_cmd=":" >>>>>> start_cmd="sysctl_start" reload_cmd="sysctl_start" >>>>>> lastload_cmd="sysctl_start last" extra_commands="reload >>>>>> lastload" >>>>>> >>>>>> -# -# Read in a file containing sysctl settings and set >>>>>> things accordingly. -# -parse_file() -{ - if [ -f $1 >>>>>> ]; then - while read var comments - do - >>>>>> case ${var} in - \#*|'') - ;; - >>>>>> *) - mib=${var%=*} - >>>>>> val=${var#*=} - - if >>>>>> current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then - >>>>>> case ${current_value} in - ${val}) - >>>>>> ;; - *) - if ! >>>>>> sysctl "${var}" >/dev/null 2>&1; then - >>>>>> warn "unable to set ${var}" - fi - >>>>>> ;; - esac - elif [ "$2" >>>>>> = "last" ]; then - warn "sysctl ${mib} >>>>>> does not exist." - fi - ;; >>>>>> - esac - done < $1 - fi -} - >>>>>> sysctl_start() { - - parse_file /etc/sysctl.conf $1 - >>>>>> parse_file /etc/sysctl.conf.local $1 + case $1 in + >>>>>> last) + command_args="-i -f" + ;; + *) + >>>>>> command_args="-f" + ;; + esac + + for _f in >>>>>> /etc/sysctl.conf /etc/sysctl.conf.local; do + [ -r >>>>>> ${_f} ] && ${command} ${command_args} ${_f} > /dev/null + >>>>>> done } >>>>>> >>>>>> load_rc_config $name >>>>> >>>>> Hi, >>>>> >>>>> I'd really like to see something like the patch bellow in >>>>> the tree. I found it very useful with cfengine >>>>> configuration (as like as cron.d). >>>>> >>>>> What do think? >>>>> >>>>> diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl index >>>>> 36f1414..014e4c5 100755 --- a/etc/rc.d/sysctl +++ >>>>> b/etc/rc.d/sysctl @@ -26,7 +26,7 @@ sysctl_start() ;; esac >>>>> >>>>> - for _f in /etc/sysctl.conf /etc/sysctl.conf.local; >>>>> do + for _f in `ls /etc/sysctl.d/* 2> /dev/null` >>>>> /etc/sysctl.conf /etc/sysctl.conf.local; do [ -r ${_f} ] && >>>>> ${command} ${command_args} ${_f} > /dev/null done } >>>> >>>> Instead of running sysctl a bunch of times, how about >>>> something conceptually similar to >>>> >>>> cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - >>>> >>>> Along with this (untested) patch to make sysctl understand >>>> "-f -". >>>> >>>> Hmmm, is /dev/stdin available as early as sysctl.conf runs? >>>> If not, the attached patch isn't going to work. >>>> >>>> -- Ian >>>> >>>> diff -r cc5bd6d80aa1 sbin/sysctl/sysctl.c --- >>>> sbin/sysctl/sysctl.c Sun Aug 19 11:01:08 2012 -0600 +++ >>>> sbin/sysctl/sysctl.c Wed Dec 19 08:31:14 2012 -0700 @@ >>>> -112,7 +112,10 @@ main(int argc, char **argv) eflag = 1; >>>> break; case 'f': - conffile = optarg; + if >>>> (strcmp(optarg, "-") == 0) + conffile = "/dev/stdin"; + >>>> else + conffile = optarg; break; case 'h': hflag = 1; >>> _______________________________________________ >>> 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" >> >> - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJQ0hKKAAoJEG80Jeu8UPuzBGUIAMZHbBqBtWCKeAd1+q8rSGqp 5BkFrKAHHgFbYEA2N9KwMZLqv9iQuBCpdXclUrhivT29A+FtdpUDgDO/LmDPsU71 Xj3hr+VpS47YCeW0jZqbJqpr8QiYdpduJ/MuaykI8QHo8+OPsjupzaQhclKrqcD1 1hVVUnolKXw5X2tIVjDBSpM7NYjtGCk0N3Xca49CJOZ+2aPv8oNHImasxQejT2t5 34OThhWSP+Ir4GNbsPVt/K+qtGiKY8Ugwm3O4M4ssS7hys/orkCFUhBd94Ty7XDD 8nxcbHA5uX5fVkxJ9aKo6VEfeyjP+Dw3CnKdSgoNVDKlAagr+hsHK6B7m0Lgk7s= =F93W -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 19:37:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC2C8DB; Wed, 19 Dec 2012 19:37:07 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-oa0-f42.google.com (mail-oa0-f42.google.com [209.85.219.42]) by mx1.freebsd.org (Postfix) with ESMTP id F358C8FC0C; Wed, 19 Dec 2012 19:37:06 +0000 (UTC) Received: by mail-oa0-f42.google.com with SMTP id j1so2527610oag.1 for ; Wed, 19 Dec 2012 11:37:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=VdDYERLLnX+GBETlQzQL6X6M50ohbYYFtgNsRHzDiqE=; b=fDoV/g7lAP0dOvmaELaBWs0GKGSZhn9SpFzxCe+fK/p6jiHAhjILS35qQoy2Kd4SdV bdf8Qlh8jHinG+jd6nrHdf9uHkwiwsbogwTHWrPw8H5w5ePqyhskSJ7C1VV8lekV/VNa GMWxz65LA52+jLwt/P5NbAKqwSJnYA1cpGqG9Ynqq2boGR5hLKzRdNFuyZQc41awb5WS A9EaPIajRUgbg1SA5OJ2Qmiys4IYWdC/eBGUEAPS+yE9D+wGAvcewxfn+22AbqPCb6dk smmJRBDG44ZDZBngaUV5RTj59KxHc51652kDB0nFWtZAtHnKW8DPgP9FEjeyOAlwVoaL ri6A== MIME-Version: 1.0 Received: by 10.182.2.169 with SMTP id 9mr5815665obv.66.1355944240375; Wed, 19 Dec 2012 11:10:40 -0800 (PST) Received: by 10.76.143.33 with HTTP; Wed, 19 Dec 2012 11:10:40 -0800 (PST) In-Reply-To: <1355931456.1198.203.camel@revolution.hippie.lan> References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> Date: Wed, 19 Dec 2012 11:10:40 -0800 Message-ID: Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl From: Garrett Cooper To: Ian Lepore Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, Andrey Zonov , src-committers@freebsd.org, Xin LI , svn-src-all@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 19:37:07 -0000 On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore wrote: ... > Instead of running sysctl a bunch of times, how about something > conceptually similar to > > cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - > > Along with this (untested) patch to make sysctl understand "-f -". > > Hmmm, is /dev/stdin available as early as sysctl.conf runs? If not, the > attached patch isn't going to work. Why not just make sysctl understand multiple -f options? You're probably going to run into more problems parsing from /dev/stdin and it's going to obfuscate things a lot dealing with which file came last, feeding back diagnostic info, etc. Please don't "linuxise" this tool. Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 19:42:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0913429B; Wed, 19 Dec 2012 19:42:03 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id 1B4388FC0C; Wed, 19 Dec 2012 19:42:02 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.5/8.14.5) with ESMTP id qBJJg1Od014452; Wed, 19 Dec 2012 12:42:01 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id qBJJfwn1065582; Wed, 19 Dec 2012 12:41:58 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl From: Ian Lepore To: Garrett Cooper In-Reply-To: References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> Content-Type: text/plain; charset="us-ascii" Date: Wed, 19 Dec 2012 12:41:58 -0700 Message-ID: <1355946118.1198.217.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, Andrey Zonov , src-committers@freebsd.org, Xin LI , svn-src-all@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 19:42:03 -0000 On Wed, 2012-12-19 at 11:10 -0800, Garrett Cooper wrote: > On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore > wrote: > > ... > > > Instead of running sysctl a bunch of times, how about something > > conceptually similar to > > > > cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - > > > > Along with this (untested) patch to make sysctl understand "-f -". > > > > Hmmm, is /dev/stdin available as early as sysctl.conf runs? If not, the > > attached patch isn't going to work. > > Why not just make sysctl understand multiple -f options? You're > probably going to run into more problems parsing from /dev/stdin and > it's going to obfuscate things a lot dealing with which file came > last, feeding back diagnostic info, etc. > Please don't "linuxise" this tool. > Thanks, > -Garrett Hrm. I would consider enhancing a program to accept data on stdin, thereby allowing complex tasks to be efficiently accomplished using pipelines of simple tools, to be more "unix-ising" than "linux-ising". -- Ian From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 20:08:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 827D1E29; Wed, 19 Dec 2012 20:08:07 +0000 (UTC) (envelope-from jeff@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 659CF8FC16; Wed, 19 Dec 2012 20:08:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJK87p2075254; Wed, 19 Dec 2012 20:08:07 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJK87j0075252; Wed, 19 Dec 2012 20:08:07 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201212192008.qBJK87j0075252@svn.freebsd.org> From: Jeff Roberson Date: Wed, 19 Dec 2012 20:08:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244444 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 20:08:07 -0000 Author: jeff Date: Wed Dec 19 20:08:06 2012 New Revision: 244444 URL: http://svnweb.freebsd.org/changeset/base/244444 Log: - Correctly handle EWOULDBLOCK in quiesce_cpus Discussed with: mav Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Wed Dec 19 18:51:35 2012 (r244443) +++ head/sys/kern/subr_smp.c Wed Dec 19 20:08:06 2012 (r244444) @@ -766,8 +766,9 @@ quiesce_cpus(cpuset_t map, const char *w thread_unlock(curthread); while (gen[cpu] == pcpu->pc_idlethread->td_generation) { error = tsleep(quiesce_cpus, prio, wmesg, 1); - if (error) + if (error != EWOULDBLOCK) goto out; + error = 0; } } out: From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 20:10:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 585642C1; Wed, 19 Dec 2012 20:10:01 +0000 (UTC) (envelope-from jeff@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 3C7948FC14; Wed, 19 Dec 2012 20:10:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJKA18a075963; Wed, 19 Dec 2012 20:10:01 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJKA0lb075959; Wed, 19 Dec 2012 20:10:00 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201212192010.qBJKA0lb075959@svn.freebsd.org> From: Jeff Roberson Date: Wed, 19 Dec 2012 20:10:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244445 - in head/sys: kern sys tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 20:10:01 -0000 Author: jeff Date: Wed Dec 19 20:10:00 2012 New Revision: 244445 URL: http://svnweb.freebsd.org/changeset/base/244445 Log: - Add new machine parsable KTR macros for timing events. - Use this new format to automatically handle syscalls and VOPs. This changes the earlier format but is still human readable. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/subr_syscall.c head/sys/sys/ktr.h head/sys/tools/vnode_if.awk Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Wed Dec 19 20:08:06 2012 (r244444) +++ head/sys/kern/subr_syscall.c Wed Dec 19 20:10:00 2012 (r244445) @@ -77,13 +77,12 @@ syscallenter(struct thread *td, struct s if (KTRPOINT(td, KTR_SYSCALL)) ktrsyscall(sa->code, sa->narg, sa->args); #endif - - CTR6(KTR_SYSC, -"syscall: td=%p pid %d %s (%#lx, %#lx, %#lx)", - td, td->td_proc->p_pid, syscallname(p, sa->code), - sa->args[0], sa->args[1], sa->args[2]); + KTR_START4(KTR_SYSC, "syscall", syscallname(p, sa->code), + td, "pid:%d", td->td_proc->p_pid, "arg0:%p", sa->args[0], + "arg1:%p", sa->args[1], "arg2:%p", sa->args[2]); if (error == 0) { + STOPEVENT(p, S_SCE, sa->narg); if (p->p_flag & P_TRACED && p->p_stops & S_PT_SCE) { PROC_LOCK(p); @@ -150,10 +149,12 @@ syscallenter(struct thread *td, struct s sa->callp, NULL, (error) ? -1 : td->td_retval[0]); #endif syscall_thread_exit(td, sa->callp); - CTR4(KTR_SYSC, "syscall: p=%p error=%d return %#lx %#lx", - p, error, td->td_retval[0], td->td_retval[1]); } retval: + KTR_STOP4(KTR_SYSC, "syscall", syscallname(p, sa->code), + td, "pid:%d", td->td_proc->p_pid, "error:%d", error, + "retval0:%#lx", td->td_retval[0], "retval1:%#lx", + td->td_retval[1]); if (traced) { PROC_LOCK(p); td->td_dbgflags &= ~TDB_SCE; @@ -176,9 +177,6 @@ syscallret(struct thread *td, int error, */ userret(td, td->td_frame); - CTR4(KTR_SYSC, "syscall %s exit thread %p pid %d proc %s", - syscallname(p, sa->code), td, td->td_proc->p_pid, td->td_name); - #ifdef KTRACE if (KTRPOINT(td, KTR_SYSRET)) { ktrsysret(sa->code, (td->td_pflags & TDP_NERRNO) == 0 ? Modified: head/sys/sys/ktr.h ============================================================================== --- head/sys/sys/ktr.h Wed Dec 19 20:08:06 2012 (r244444) +++ head/sys/sys/ktr.h Wed Dec 19 20:10:00 2012 (r244445) @@ -244,6 +244,50 @@ void ktr_tracepoint(u_int mask, const ch point, a0, (v0), a1, (v1), a2, (v2), a3, (v3)) /* + * Start functions denote the start of a region of code or operation + * and should be paired with stop functions for timing of nested + * sequences. + * + * Specifying extra attributes with the name "key" will result in + * multi-part keys. For example a block device and offset pair + * might be used to describe a buf undergoing I/O. + */ +#define KTR_START0(m, egroup, ident, key) \ + KTR_EVENT0(m, egroup, ident, "start:0x%jX", (uintmax_t)key) +#define KTR_START1(m, egroup, ident, key, a0, v0) \ + KTR_EVENT1(m, egroup, ident, "start:0x%jX", (uintmax_t)key, a0, (v0)) +#define KTR_START2(m, egroup, ident, key, a0, v0, a1, v1) \ + KTR_EVENT2(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \ + a0, (v0), a1, (v1)) +#define KTR_START3(m, egroup, ident, key, a0, v0, a1, v1, a2, v2)\ + KTR_EVENT3(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \ + a0, (v0), a1, (v1), a2, (v2)) +#define KTR_START4(m, egroup, ident, key, \ + a0, v0, a1, v1, a2, v2, a3, v3) \ + KTR_EVENT4(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \ + a0, (v0), a1, (v1), a2, (v2), a3, (v3)) + +/* + * Stop functions denote the end of a region of code or operation + * and should be paired with start functions for timing of nested + * sequences. + */ +#define KTR_STOP0(m, egroup, ident, key) \ + KTR_EVENT0(m, egroup, ident, "stop:0x%jX", (uintmax_t)key) +#define KTR_STOP1(m, egroup, ident, key, a0, v0) \ + KTR_EVENT1(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, a0, (v0)) +#define KTR_STOP2(m, egroup, ident, key, a0, v0, a1, v1) \ + KTR_EVENT2(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, \ + a0, (v0), a1, (v1)) +#define KTR_STOP3(m, egroup, ident, key, a0, v0, a1, v1, a2, v2)\ + KTR_EVENT3(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, \ + a0, (v0), a1, (v1), a2, (v2)) +#define KTR_STOP4(m, egroup, ident, \ + key, a0, v0, a1, v1, a2, v2, a3, v3) \ + KTR_EVENT4(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, \ + a0, (v0), a1, (v1), a2, (v2), a3, (v3)) + +/* * Trace initialization events, similar to CTR with KTR_INIT, but * completely ifdef'ed out if KTR_INIT isn't in KTR_COMPILE (to * save string space, the compiler doesn't optimize out strings Modified: head/sys/tools/vnode_if.awk ============================================================================== --- head/sys/tools/vnode_if.awk Wed Dec 19 20:08:06 2012 (r244444) +++ head/sys/tools/vnode_if.awk Wed Dec 19 20:10:00 2012 (r244445) @@ -222,8 +222,6 @@ while ((getline < srcfile) > 0) { name = $1; uname = toupper(name); - # Start constructing a ktrpoint string - ctrstr = "\"" uname; # Get the function arguments. for (numargs = 0; ; ++numargs) { if ((getline < srcfile) <= 0) { @@ -267,27 +265,15 @@ while ((getline < srcfile) > 0) { # remove trailing space (if any) sub(/ $/, ""); types[numargs] = $0; - - # We can do a maximum of 6 arguments to CTR* - if (numargs <= 6) { - if (numargs == 0) - ctrstr = ctrstr "(" args[numargs]; - else - ctrstr = ctrstr ", " args[numargs]; - if (types[numargs] ~ /\*/) - ctrstr = ctrstr " 0x%lX"; - else - ctrstr = ctrstr " %ld"; - } } - if (numargs > 6) - ctrargs = 6; + if (numargs > 4) + ctrargs = 4; else ctrargs = numargs; - ctrstr = "\tCTR" ctrargs "(KTR_VOP,\n\t " ctrstr ")\",\n\t "; - ctrstr = ctrstr "a->a_" args[0]; + ctrstr = ctrargs "(KTR_VOP, \"VOP\", \"" uname "\", a,\n\t "; + ctrstr = ctrstr "\"" args[0] ":0x%jX\", (uintptr_t)a->a_" args[0]; for (i = 1; i < ctrargs; ++i) - ctrstr = ctrstr ", a->a_" args[i]; + ctrstr = ctrstr ", \"" args[i] ":0x%jX\", a->a_" args[i]; ctrstr = ctrstr ");"; if (pfile) { @@ -377,12 +363,12 @@ while ((getline < srcfile) > 0) { printc("\tSDT_PROBE(vfs, vop, " name ", entry, a->a_" args[0] ", a, 0, 0, 0);\n"); for (i = 0; i < numargs; ++i) add_debug_code(name, args[i], "Entry", "\t"); + printc("\tKTR_START" ctrstr); add_pre(name); printc("\tif (vop->"name" != NULL)") printc("\t\trc = vop->"name"(a);") printc("\telse") printc("\t\trc = vop->vop_bypass(&a->a_gen);") - printc(ctrstr); printc("\tSDT_PROBE(vfs, vop, " name ", return, a->a_" args[0] ", a, rc, 0, 0);\n"); printc("\tif (rc == 0) {"); for (i = 0; i < numargs; ++i) @@ -392,6 +378,7 @@ while ((getline < srcfile) > 0) { add_debug_code(name, args[i], "Error", "\t\t"); printc("\t}"); add_post(name); + printc("\tKTR_STOP" ctrstr); printc("\treturn (rc);"); printc("}\n"); From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 20:20:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DCC4D721; Wed, 19 Dec 2012 20:20:08 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-bk0-f50.google.com (mail-bk0-f50.google.com [209.85.214.50]) by mx1.freebsd.org (Postfix) with ESMTP id 626CB8FC0A; Wed, 19 Dec 2012 20:20:07 +0000 (UTC) Received: by mail-bk0-f50.google.com with SMTP id jf3so1260102bkc.37 for ; Wed, 19 Dec 2012 12:20:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=jYoYev7E7R2tXWeSeWqz4DpSktzIwbQTe4LAsYth8VA=; b=m2+Zk31589/S6em4TY8BW4v/9jZsb98kOQUKc54mt8qjxByW+JwTBm/avdx1sdVg6b 60eS2Dg6SxwZenVGtG3zNNa5+wfnxmSjcUaJjMwvSFQo5stR3xz/Aam6vuR/4SffrKAC oNgmI+bFi/7bev6hZwzQ4g/gdQObVxTUaocBMRcH9opCWu8VhQpWGQ6L3EHbuGBBIDBA DQPIIasveD4FhsJmMLg8eBtKBgHUiUZYcZ0KoccxmYhSZl0AU7xIROhnyWkpFTHhAClt DmlcDVOQXxvaJnkDtMoa40EVUS2nvZ5R208YaioaSI+39aWWWd7pqKIsCRraBpdp59KT vCUg== MIME-Version: 1.0 Received: by 10.204.4.131 with SMTP id 3mr3217137bkr.25.1355948054494; Wed, 19 Dec 2012 12:14:14 -0800 (PST) Received: by 10.204.167.71 with HTTP; Wed, 19 Dec 2012 12:14:14 -0800 (PST) Received: by 10.204.167.71 with HTTP; Wed, 19 Dec 2012 12:14:14 -0800 (PST) In-Reply-To: References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> Date: Wed, 19 Dec 2012 20:14:14 +0000 Message-ID: Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl From: Chris Rees To: Garrett Cooper Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, Xin LI , svn-src-head@freebsd.org, Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 20:20:09 -0000 On 19 Dec 2012 19:37, "Garrett Cooper" wrote: > > On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore > wrote: > > ... > > > Instead of running sysctl a bunch of times, how about something > > conceptually similar to > > > > cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - > > > > Along with this (untested) patch to make sysctl understand "-f -". > > > > Hmmm, is /dev/stdin available as early as sysctl.conf runs? If not, the > > attached patch isn't going to work. > > Why not just make sysctl understand multiple -f options? You're > probably going to run into more problems parsing from /dev/stdin and > it's going to obfuscate things a lot dealing with which file came > last, feeding back diagnostic info, etc. > Please don't "linuxise" this tool. I seem to recall cpio being around a lot before Linux... Our sh also accepts piped scripts. It's useful. ssh host cat file | sysctl -f - Chris From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 20:33:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3DC0BE0B; Wed, 19 Dec 2012 20:33:17 +0000 (UTC) (envelope-from gonzo@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 2159D8FC0C; Wed, 19 Dec 2012 20:33:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJKXGF6080092; Wed, 19 Dec 2012 20:33:16 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJKXGFB080091; Wed, 19 Dec 2012 20:33:16 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201212192033.qBJKXGFB080091@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Wed, 19 Dec 2012 20:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244446 - head/sys/arm/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 20:33:17 -0000 Author: gonzo Date: Wed Dec 19 20:33:16 2012 New Revision: 244446 URL: http://svnweb.freebsd.org/changeset/base/244446 Log: Use NFSCL since NFSCLIENT build is broken at the moment Modified: head/sys/arm/conf/PANDABOARD Modified: head/sys/arm/conf/PANDABOARD ============================================================================== --- head/sys/arm/conf/PANDABOARD Wed Dec 19 20:10:00 2012 (r244445) +++ head/sys/arm/conf/PANDABOARD Wed Dec 19 20:33:16 2012 (r244446) @@ -47,9 +47,7 @@ options UFS_DIRHASH #Improve performan device snp options BREAK_TO_DEBUGGER -#options NFSCL -options NFSCLIENT #Network Filesystem Client -#options NFSSERVER #Network Filesystem Server +options NFSCL options NFS_ROOT #NFS usable as /, requires NFSCLIENT #options BOOTP_NFSROOT #options BOOTP_COMPAT From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 21:00:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 105C4A2B; Wed, 19 Dec 2012 21:00:23 +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 E8B6C8FC13; Wed, 19 Dec 2012 21:00:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJL0M9a084650; Wed, 19 Dec 2012 21:00:22 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJL0MQx084649; Wed, 19 Dec 2012 21:00:22 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201212192100.qBJL0MQx084649@svn.freebsd.org> From: Rick Macklem Date: Wed, 19 Dec 2012 21:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244447 - head/usr.sbin/nfsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 21:00:23 -0000 Author: rmacklem Date: Wed Dec 19 21:00:22 2012 New Revision: 244447 URL: http://svnweb.freebsd.org/changeset/base/244447 Log: Post r243965 the nfsd daemon will not start up for kernels built without "options INET6". This patch fixes the problem. Reported by: avg Tested by: avg MFC after: 2 weeks Modified: head/usr.sbin/nfsd/nfsd.c Modified: head/usr.sbin/nfsd/nfsd.c ============================================================================== --- head/usr.sbin/nfsd/nfsd.c Wed Dec 19 20:33:16 2012 (r244446) +++ head/usr.sbin/nfsd/nfsd.c Wed Dec 19 21:00:22 2012 (r244447) @@ -264,7 +264,7 @@ main(int argc, char **argv) ip6flag = 1; s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (s == -1) { - if (errno != EPROTONOSUPPORT) + if (errno != EPROTONOSUPPORT && errno != EAFNOSUPPORT) err(1, "socket"); ip6flag = 0; } else if (getnetconfigent("udp6") == NULL || From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 21:04:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 27780F75; Wed, 19 Dec 2012 21:04:22 +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 AAF8B8FC0A; Wed, 19 Dec 2012 21:04:19 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 0A8E0358C2A; Wed, 19 Dec 2012 22:04:19 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id DDFBA2848C; Wed, 19 Dec 2012 22:04:18 +0100 (CET) Date: Wed, 19 Dec 2012 22:04:18 +0100 From: Jilles Tjoelker To: d@delphij.net Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl Message-ID: <20121219210418.GA83983@stack.nl> References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50D2128A.7030205@delphij.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Ian Lepore , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , Alfred Perlstein , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 21:04:22 -0000 On Wed, Dec 19, 2012 at 11:16:26AM -0800, Xin Li wrote: > It may be worthy to make sysctl(8) to accept mutiple -f's, but it > seems to be hard to write shell scripts that utilizes this feature in > a elegant manner. This is possible but indeed a bit ugly. Hard-coding the list of files is not too bad: shift $# for _f in /etc/sysctl.d/* /etc/sysctl.conf /etc/sysctl.conf.local; do [ -r "$_f" ] && set -- "$@" -f "$_f" done sysctl "$@" If the list is passed in the positional parameters it becomes uglier: _first=1 for _f do [ -n "$_first" ] && shift $# _first= [ -r "$_f" ] && set -- "$@" -f "$_f" done sysctl "$@" This uses for's temporary storage of the words being iterated over, building a new set of positional parameters in the loop. An alternative is to append the new list to the old one and to use a saved copy of $# to remove the old elements afterwards. It would be nice to store the arguments in a variable but that is not possible because all characters are valid in pathnames, except the null character which cannot be used in shell either. -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 21:08:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6D4F534E; Wed, 19 Dec 2012 21:08:27 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) by mx1.freebsd.org (Postfix) with ESMTP id 9BBE08FC13; Wed, 19 Dec 2012 21:08:25 +0000 (UTC) Received: by mail-la0-f41.google.com with SMTP id m15so1892677lah.28 for ; Wed, 19 Dec 2012 13:08:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=83saUwzJ3TFp9U1HpFFeBsHfJ1i4WUaH7TDhBKhUP3U=; b=V7SiCoPz2ElazrBcGTaeiWsRrqJKVEbRnW52EYYQpCS54jeayfjellaRijdf8wupkV 0WeRbiV/dbzVkoz15oaLZZOp8LrU/+wqhxjiZWmISfu5VgI5kKIwVfHjmlXuIwUiOKeh kuaSbB4KuuyfeextryaoU3vI4YKRNrQhuvmYdbbT92ir8Dyx0IEkEmBszrJrlK6RbPYd uS1lB/tXTPsyhTfB79DG6EBT+L+w2MEm6bKp8ybtCeOO1PZ6nNvLVgk9ssx5U91RDJyd frTcBRv9sURYQLXPdZ6ca8mOFRuivDjhxMcKc1IYke4Ew7Fivic3JQ8M9QE17eFvuGMP eWWQ== MIME-Version: 1.0 Received: by 10.152.106.212 with SMTP id gw20mr6665683lab.8.1355951304285; Wed, 19 Dec 2012 13:08:24 -0800 (PST) Received: by 10.112.99.70 with HTTP; Wed, 19 Dec 2012 13:08:24 -0800 (PST) In-Reply-To: References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> Date: Wed, 19 Dec 2012 13:08:24 -0800 Message-ID: Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl From: Garrett Cooper To: Chris Rees Content-Type: text/plain; charset=ISO-8859-1 Cc: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, Xin LI , svn-src-head@freebsd.org, Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 21:08:27 -0000 On Wed, Dec 19, 2012 at 12:14 PM, Chris Rees wrote: > > On 19 Dec 2012 19:37, "Garrett Cooper" wrote: >> >> On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore >> wrote: >> >> ... >> >> > Instead of running sysctl a bunch of times, how about something >> > conceptually similar to >> > >> > cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - >> > >> > Along with this (untested) patch to make sysctl understand "-f -". >> > >> > Hmmm, is /dev/stdin available as early as sysctl.conf runs? If not, the >> > attached patch isn't going to work. >> >> Why not just make sysctl understand multiple -f options? You're >> probably going to run into more problems parsing from /dev/stdin and >> it's going to obfuscate things a lot dealing with which file came >> last, feeding back diagnostic info, etc. >> Please don't "linuxise" this tool. > > I seem to recall cpio being around a lot before Linux... Our sh also accepts > piped scripts. It's useful. Yes, but it just compresses data and doesn't have to necessarily backtrack in order to do so. > ssh host cat file | sysctl -f - I prefer: ssh host cat file > foo sysctl -f foo ... and my bikesheds navy blue. Point is that Ian is potentially solving the problem incorrectly (his concern is over I/O latency when booting up on slower platforms). Unless he has measurements and tests to support doing this, it really doesn't make sense to morph sysctl from the stripped down sh "interpreter" that it is today into something that have to handle some of the other error conditions and input permutations that hexdump/od deals with (which his beforementioned patch doesn't do, neither did the patch/commit that hrs/delphij posted) as real files are grossly different from character devices and stdio file descriptors. I would have less qualms if the support came directly from NetBSD as there would have been some traction on it, but the problem is that the proposal will a) make sysctl slower and bigger (I know more than a handful of scripts that execute sysctl _a lot_, so the faster it is at loading the image into memory and executing the better), and b) will make sysctl diverge further from the other BSDs (which means less testing, more code janitor work later on, have to deal with backport issues, etc). Traditional Unix philosophy is construction of simple commands with a particular, well-defined purpose. Some of the suggestions made here doing #file, etc are going in a very Linux centric direction by making sysctl into a custom swiss army knife that does 20 different things instead of [again] solving what the root issue is in Ian's case: making his system boot faster. Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 21:10:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5CE014C5; Wed, 19 Dec 2012 21:10:15 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9A4CC8FC0A; Wed, 19 Dec 2012 21:10:13 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id j13so1898943lah.27 for ; Wed, 19 Dec 2012 13:10:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=fUt08Oiq5Sqv9g4vAy37oxmQtD/oW0djGSdJK0wIjbI=; b=tnyB6XVRUXAJK9f5epLL/q9nXEg8HXqIZWXn1mE324jrnDxarl6OH0MUec1CeqfVP4 c5Kh2tg8FsexUr6oWCVSOIXN1gj8Pv44ftGynmGgTJEM1W7sbnUjPE9Dy8YCYtQQLg7k u7dCDhnZIbK23ly43EqxPGSM75kHmyDz6hHIfLr4N+b+jMoGQSab7pJBuaQUcq86ATIf RSJAPmvOUukhWgQNQOSkxT0iPbzJ5unlsAP/Bj1FCoYq/Ebfpe4Pu17epJeL3khe7plN Pk969aFqnUmu3jRdi5deDyhCk1Os5vzpcpV9hc/re2llXRPQwIxv9i/sxviQ4ky1ESM9 9ttw== MIME-Version: 1.0 Received: by 10.112.29.104 with SMTP id j8mr2968990lbh.0.1355951406791; Wed, 19 Dec 2012 13:10:06 -0800 (PST) Received: by 10.112.99.70 with HTTP; Wed, 19 Dec 2012 13:10:06 -0800 (PST) In-Reply-To: <20121219210418.GA83983@stack.nl> References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> Date: Wed, 19 Dec 2012 13:10:06 -0800 Message-ID: Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl From: Garrett Cooper To: Jilles Tjoelker Content-Type: text/plain; charset=ISO-8859-1 Cc: Ian Lepore , "src-committers@freebsd.org" , d@delphij.net, "svn-src-all@freebsd.org" , Alfred Perlstein , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 21:10:15 -0000 On Wed, Dec 19, 2012 at 1:04 PM, Jilles Tjoelker wrote: > On Wed, Dec 19, 2012 at 11:16:26AM -0800, Xin Li wrote: >> It may be worthy to make sysctl(8) to accept mutiple -f's, but it >> seems to be hard to write shell scripts that utilizes this feature in >> a elegant manner. > > This is possible but indeed a bit ugly. > > Hard-coding the list of files is not too bad: > > shift $# > for _f in /etc/sysctl.d/* /etc/sysctl.conf /etc/sysctl.conf.local; do > [ -r "$_f" ] && set -- "$@" -f "$_f" > done > sysctl "$@" > > If the list is passed in the positional parameters it becomes uglier: > > _first=1 > for _f do > [ -n "$_first" ] && shift $# > _first= > [ -r "$_f" ] && set -- "$@" -f "$_f" > done > sysctl "$@" > > This uses for's temporary storage of the words being iterated over, > building a new set of positional parameters in the loop. > > An alternative is to append the new list to the old one and to use a > saved copy of $# to remove the old elements afterwards. > > It would be nice to store the arguments in a variable but that is not > possible because all characters are valid in pathnames, except the null > character which cannot be used in shell either. find -exec / echo | xargs ? Seems like there's a better way to solve this. Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 21:12:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A2607744; Wed, 19 Dec 2012 21:12:29 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com [209.85.215.47]) by mx1.freebsd.org (Postfix) with ESMTP id DFC098FC0A; Wed, 19 Dec 2012 21:12:27 +0000 (UTC) Received: by mail-la0-f47.google.com with SMTP id u2so1855125lag.6 for ; Wed, 19 Dec 2012 13:12:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=L7BWns3Uf3WQN48Yl0CUM+VCQJiFnZ+Od31L1Mxcx2Q=; b=DVgDn49SyVDMeSq4FDUm+BF2jVBY2Wfrgi/JEL9EntR+zJt5FRNAQl+PDnocF9eQtE okzhYuUKlJv+ufzX/hiZuDaMcm2l1h7bTkHIFTmL1dyNy2n7NcB46nNDKdfxt7nVfXB/ bsQu2qyEXSXWY1NEoNgbYXrCNI411WL+RoJ1Zv8XE35rOWtjQtysYMvqKcaKbgsYeDJW 4hpWxX3KqpJUm0SUVVjZ09B28p9UCHSJimYZV/Vd0HMRWODsARaBMB++Yy8LDcyZLsUo V7odQImXv7QGTEXV4fJv2+gf+qFbwG72HTicN/760+l99HGa6Neg+diAPTc08E2jA3S0 dpMw== MIME-Version: 1.0 Received: by 10.112.88.7 with SMTP id bc7mr2945235lbb.108.1355951540674; Wed, 19 Dec 2012 13:12:20 -0800 (PST) Received: by 10.112.99.70 with HTTP; Wed, 19 Dec 2012 13:12:20 -0800 (PST) In-Reply-To: References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> Date: Wed, 19 Dec 2012 13:12:20 -0800 Message-ID: Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl From: Garrett Cooper To: Jilles Tjoelker Content-Type: text/plain; charset=ISO-8859-1 Cc: Ian Lepore , "src-committers@freebsd.org" , d@delphij.net, "svn-src-all@freebsd.org" , Alfred Perlstein , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 21:12:29 -0000 On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper wrote: ... > find -exec / echo | xargs ? Seems like there's a better way to solve this. Of course we also might be overengineering the problem (my suggestion definitely was overengineered). Why not pass in the appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 21:59:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 195813AE; Wed, 19 Dec 2012 21:59:31 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) by mx1.freebsd.org (Postfix) with ESMTP id E2BB38FC14; Wed, 19 Dec 2012 21:59:30 +0000 (UTC) Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id CB2ED225C3; Wed, 19 Dec 2012 13:59:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1355954370; bh=DPLaYQvr7e54yNUHx+N99FmaPELCT/xedpwKrVRP0EM=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=hw04+fFBIJ2VQx6byR8FAFcEVy8XmgC2kdeLzJK+Jxf9FxzNNI6mb6CuNqIinS+mD AqcMf4ZMPuiZzZcUlzlca/zFYSG5GfRUczBvQmgFE+jmB+XmxrNIh7jbWcO9k7hZCi kvEJvghgr4+4MQMITF5C39Asw7iQBVB2lbPX3UwU= Message-ID: <50D238C1.2010803@delphij.net> Date: Wed, 19 Dec 2012 13:59:29 -0800 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: Garrett Cooper Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Wed, 19 Dec 2012 22:07:16 +0000 Cc: Ian Lepore , "src-committers@freebsd.org" , d@delphij.net, Jilles Tjoelker , "svn-src-all@freebsd.org" , Alfred Perlstein , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 21:59:31 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 12/19/12 13:10, Garrett Cooper wrote: > On Wed, Dec 19, 2012 at 1:04 PM, Jilles Tjoelker > wrote: >> On Wed, Dec 19, 2012 at 11:16:26AM -0800, Xin Li wrote: >>> It may be worthy to make sysctl(8) to accept mutiple -f's, but >>> it seems to be hard to write shell scripts that utilizes this >>> feature in a elegant manner. >> >> This is possible but indeed a bit ugly. >> >> Hard-coding the list of files is not too bad: >> >> shift $# for _f in /etc/sysctl.d/* /etc/sysctl.conf >> /etc/sysctl.conf.local; do [ -r "$_f" ] && set -- "$@" -f "$_f" >> done sysctl "$@" >> >> If the list is passed in the positional parameters it becomes >> uglier: >> >> _first=1 for _f do [ -n "$_first" ] && shift $# _first= [ -r >> "$_f" ] && set -- "$@" -f "$_f" done sysctl "$@" >> >> This uses for's temporary storage of the words being iterated >> over, building a new set of positional parameters in the loop. >> >> An alternative is to append the new list to the old one and to >> use a saved copy of $# to remove the old elements afterwards. >> >> It would be nice to store the arguments in a variable but that is >> not possible because all characters are valid in pathnames, >> except the null character which cannot be used in shell either. > > find -exec / echo | xargs ? Seems like there's a better way to > solve this. Thanks, Won't work because you have to add -f's. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJQ0jjBAAoJEG80Jeu8UPuzdRQH/AxNFRT1n+9aGQ7BuwHXSl5k aY+Em7+W7de4HRh2Xmkt66q64419HxgKBv45DBtcg35xEWIaDBNTgZ0JKfvG94eg mH43tq270sTuWJ1pZRIxybfLSPrP2uwsyG372Vw40AW2KdrWH1VZgKlTlmU8nF9G b/cnTa5BhD5r+35o2gsWIQT6j34hWGja9tOi4vgmAAMxDbgdL2sHE42R0Tex/Ydz hlRXAl+dMNqx9mw0rUwKdGBUFa5vDLokhI+AKCiAOMPxtUqheee1GqAytyEb0nst uZcF/cmBDoS5j/W7UGfLrlR6fSr0nxqjbIVr4VSa15aUCvEmW5oZ3HhRy+lZYM4= =5kx8 -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 22:02:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F326D517; Wed, 19 Dec 2012 22:02:10 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) by mx1.freebsd.org (Postfix) with ESMTP id C4B348FC0A; Wed, 19 Dec 2012 22:02:10 +0000 (UTC) Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 3286C22622; Wed, 19 Dec 2012 14:02:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1355954530; bh=reqCkzXeOODDvfRtwT4cDncdPQtJQ2QHtok8EE9tIys=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=ntl3T9O0ukW9hKk4/huhuJji4hE9AoJjX6vDxyxJcS51GoXqohK1yov8w2/7LhOB7 z9usuZDmUXsdFYFvKWxlB3nQf6gOUUfhMZlTErAlQkv1IgWaduonI5fqqpJL0n0WtE CkimwaYFjrkKLJ35m47PghgZe8n7pOJimL+u1tkM= Message-ID: <50D23961.7090803@delphij.net> Date: Wed, 19 Dec 2012 14:02:09 -0800 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: Garrett Cooper Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Wed, 19 Dec 2012 22:07:25 +0000 Cc: Ian Lepore , "src-committers@freebsd.org" , d@delphij.net, Jilles Tjoelker , "svn-src-all@freebsd.org" , Alfred Perlstein , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 22:02:11 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 12/19/12 13:12, Garrett Cooper wrote: > On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper > wrote: > > ... > >> find -exec / echo | xargs ? Seems like there's a better way to >> solve this. > > Of course we also might be overengineering the problem (my > suggestion definitely was overengineered). Why not pass in the > appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks, Irrelevant. Consider this (extreme) situation: someone distributes several sets of sysctl values tuned for certain situations, like tcp.conf, supermicro.conf, ... and wants to put them together in a directory, it's useful to source from the directory without having to do a generation of command line on boot, so when something goes wrong, they just remove the pack rather than changing /etc/rc.conf. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJQ0jlhAAoJEG80Jeu8UPuzxfMH+wejtu+VZeIqL9QMDT1LRlgp l3BQgq2SHg25agnDBrt0fj8T69oR9+T/o6cXUlfQH05U0Lb6E70AFd69YeLrdxfj KmwPmh2R/I8tdvlAp8cUn6FGuuM/9ssMk+ppmU3hjxynuVCRmuY3Dra9RJZ7Sh+J P+MgN50KwRHBvWSLITNyr9u3TE2euk23Q/QZLqw2lZpWRiM96aSYzHHtdmJZkk+F 1A9cZPsGGy4w9fhxzANbMfDwGfvKucG79l7W6wly85LCAOMv/M9GmWUWDC6j4Q93 sIJyca/19JOdDBQL0zBLDarCkZdgeKYUHbZNY4h1SCT2tjuIHF3Qc6sHRRyhDjQ= =a5K4 -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 22:07:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B822285D; Wed, 19 Dec 2012 22:07:39 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) by mx1.freebsd.org (Postfix) with ESMTP id 8CE0B8FC0C; Wed, 19 Dec 2012 22:07:39 +0000 (UTC) Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 44DF42269F; Wed, 19 Dec 2012 14:07:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1355954859; bh=7iOAbT4OTctHHOGNiBDQJ8kIqzUvIzZUY79Ik8u4qnE=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=5fZSq3eTdXhhBJjePcmGl0tJWKvV6TOmvd8abUN/DoNkUVeHq5aQK7CqDHtuHBp9o G/YBpxBERz1my5lKEZULMC/7+SGpvly5r5GnzZtGAj6Ot4CoxIRGaIgeDbb83UvGUp Ap2GR3fVb/A1cejHQLbtp9ycLdRN8MIwLqTBLEf8= Message-ID: <50D23AAA.9070804@delphij.net> Date: Wed, 19 Dec 2012 14:07:38 -0800 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: Garrett Cooper Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, Xin LI , svn-src-head@freebsd.org, Andrey Zonov , Chris Rees X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 22:07:39 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 12/19/12 13:08, Garrett Cooper wrote: > On Wed, Dec 19, 2012 at 12:14 PM, Chris Rees > wrote: >> >> On 19 Dec 2012 19:37, "Garrett Cooper" >> wrote: >>> >>> On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore >>> wrote: >>> >>> ... >>> >>>> Instead of running sysctl a bunch of times, how about >>>> something conceptually similar to >>>> >>>> cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - >>>> >>>> Along with this (untested) patch to make sysctl understand >>>> "-f -". >>>> >>>> Hmmm, is /dev/stdin available as early as sysctl.conf runs? >>>> If not, the attached patch isn't going to work. >>> >>> Why not just make sysctl understand multiple -f options? >>> You're probably going to run into more problems parsing from >>> /dev/stdin and it's going to obfuscate things a lot dealing >>> with which file came last, feeding back diagnostic info, etc. >>> Please don't "linuxise" this tool. >> >> I seem to recall cpio being around a lot before Linux... Our sh >> also accepts piped scripts. It's useful. > > Yes, but it just compresses data and doesn't have to necessarily > backtrack in order to do so. > >> ssh host cat file | sysctl -f - > > I prefer: > > ssh host cat file > foo sysctl -f foo > > ... and my bikesheds navy blue. Vulnerable to temporary file attacks (which is relatively easy to mitigate with mkstemp, though) and poor error handling. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJQ0jqqAAoJEG80Jeu8UPuzBiMH/3EF1cDUcjpa9+k7OAPmJx89 PGQhy64QH5CZiztTFMpHsywaAJSr/5LeR/28SdP4YRB67P4IeSLFgRsB+6XqmCJz cwtuYmZKiorjUhZ9jojwuYG+tab/dRFit46oqk5FujVE8FPhvvBcDpwVyX5vXfsX HHUyks49pjx/pTFGldb6BxZ9Gp9OZyNXgAM5/RLAW/NLYMEksSp2z4YUquYIZYeh 8ZWsdpQKLFRXv3XG1pnpNYinoKjJ5Khxi6J10yrrOnBdUE1d0VBbMb5BdrBui65I bQVBTNPnoIQEYP2HtLybL5nnpwvX23ujLDQOxOA6/HtEUz6+206s9JHjRTTWOnc= =+9Qv -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 22:28:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9D184FB8; Wed, 19 Dec 2012 22:28:54 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by mx1.freebsd.org (Postfix) with ESMTP id 300F48FC0C; Wed, 19 Dec 2012 22:28:53 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so3699692ieb.11 for ; Wed, 19 Dec 2012 14:28:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=+L3EevxDrIyNNB7pVx4QYG0ghHT6r7J6GeCJt7FJaXY=; b=YfyK0bSgOQCkDtw+p/0n5KCXx5uUZkzpYslKFbODQyMIyflDpqhV2ST+mhDeFDub2C WjOA4Ob1FpVKep0gDNHuhrVbYdeMCziLtiweDqVt3c3p1kA2ChqielR3BnF3rfl0LAiJ kkw9h9D3JDlZmenzU6M5X26LlhB/MDw9A3iG5Jx6BeRSkoKSZiB7p5k224f0nmdB5uYr 54vSKChjxfpxqagN49UcgrznjLYL2s/E0SsQi666Lglk/lKG1lHcuya2v+PG0tDgy9HA WcAVcRmYxO/ASUefWs+9YTIUoyKyLSE93T4WRgp9d/bfkbOGQ0Fo8gn08n9IP2e/JCQx oLWg== MIME-Version: 1.0 Received: by 10.42.101.144 with SMTP id e16mr7522948ico.5.1355956133502; Wed, 19 Dec 2012 14:28:53 -0800 (PST) Received: by 10.42.56.83 with HTTP; Wed, 19 Dec 2012 14:28:53 -0800 (PST) In-Reply-To: <50D23961.7090803@delphij.net> References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> <50D23961.7090803@delphij.net> Date: Wed, 19 Dec 2012 17:28:53 -0500 Message-ID: Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl From: Benjamin Kaduk To: bjk@freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 22:28:54 -0000 [cc trimmed] On Wed, Dec 19, 2012 at 5:02 PM, Xin Li wrote: > Irrelevant. Consider this (extreme) situation: someone distributes > several sets of sysctl values tuned for certain situations, like > tcp.conf, supermicro.conf, ... and wants to put them together in a > directory, it's useful to source from the directory without having to > do a generation of command line on boot, so when something goes wrong, > they just remove the pack rather than changing /etc/rc.conf. > Not a direct reply, but just noting that it can be *very* useful to have, e.g., a README or foo.old or foo.disabled file in the same directory where the "live" configuration files live. Always interpreting the full '*' glob is not always the best thing to do. -Ben Kaduk From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 22:31:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EA4AD1D5; Wed, 19 Dec 2012 22:31:01 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx1.freebsd.org (Postfix) with ESMTP id 03BCA8FC12; Wed, 19 Dec 2012 22:30:59 +0000 (UTC) Received: by mail-la0-f43.google.com with SMTP id z14so1925188lag.2 for ; Wed, 19 Dec 2012 14:30:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=17ocGceaDK98HwnI5T+fwO4R8MK9hhGjvYzJX20tdQY=; b=C2UgO5o/VQ+hd/I42A3rw0ObrH4J+MmNwIdEv9buQXZ44LzyKQv2ZA4/JIbt7uk4Yu bJRhPgrMS1YXLi91TD8Zir39D0vRvf7Sra5CfreUlpg3ubVG4cL9XANrV1HfQ1bGAArv jVbwhKWD0gnWNjl3lAXZB78/F6VlpFC8bn0UF0rWS3TeACq+ziTzGFZTE7KgtT2WtUzz nSNkSZCmMVZiLSHMZhLaJSqO0D9kAGb1pwn2J9hH5jNs8JtMleMtNfOw+wIx4W5EH+R6 S4MGH4at9+FMBZTCELkHK8NFNpEwOuLaIlFZEDRARPTwe7jxabbnENZOz9dmvFv5kbdq ZdTg== MIME-Version: 1.0 Received: by 10.152.131.168 with SMTP id on8mr6823465lab.38.1355956258641; Wed, 19 Dec 2012 14:30:58 -0800 (PST) Received: by 10.112.99.70 with HTTP; Wed, 19 Dec 2012 14:30:58 -0800 (PST) In-Reply-To: <50D23AAA.9070804@delphij.net> References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <50D23AAA.9070804@delphij.net> Date: Wed, 19 Dec 2012 14:30:58 -0800 Message-ID: Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl From: Garrett Cooper To: d@delphij.net Content-Type: text/plain; charset=ISO-8859-1 Cc: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, Xin LI , svn-src-head@freebsd.org, Andrey Zonov , Chris Rees X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 22:31:02 -0000 On Wed, Dec 19, 2012 at 2:07 PM, Xin Li wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 12/19/12 13:08, Garrett Cooper wrote: >> On Wed, Dec 19, 2012 at 12:14 PM, Chris Rees >> wrote: >>> >>> On 19 Dec 2012 19:37, "Garrett Cooper" >>> wrote: >>>> >>>> On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore >>>> wrote: >>>> >>>> ... >>>> >>>>> Instead of running sysctl a bunch of times, how about >>>>> something conceptually similar to >>>>> >>>>> cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f - >>>>> >>>>> Along with this (untested) patch to make sysctl understand >>>>> "-f -". >>>>> >>>>> Hmmm, is /dev/stdin available as early as sysctl.conf runs? >>>>> If not, the attached patch isn't going to work. >>>> >>>> Why not just make sysctl understand multiple -f options? >>>> You're probably going to run into more problems parsing from >>>> /dev/stdin and it's going to obfuscate things a lot dealing >>>> with which file came last, feeding back diagnostic info, etc. >>>> Please don't "linuxise" this tool. >>> >>> I seem to recall cpio being around a lot before Linux... Our sh >>> also accepts piped scripts. It's useful. >> >> Yes, but it just compresses data and doesn't have to necessarily >> backtrack in order to do so. >> >>> ssh host cat file | sysctl -f - >> >> I prefer: >> >> ssh host cat file > foo sysctl -f foo >> >> ... and my bikesheds navy blue. > > Vulnerable to temporary file attacks (which is relatively easy to > mitigate with mkstemp, though) and poor error handling. I am well aware of that; it was just a simple example. Pedantically speaking if I really cared about "robustness" in terms of setting sysctls, I would do this: #!/bin/sh set -ex : ${TMPDIR=/tmp} tmp="$(mktemp "$TMPDIR/sysctl.XXXXXX")" trap "rm -f '$tmp'" EXIT ssh host "cat file" > "$tmp" sysctl -f "$tmp" # ================= But even that's not perfect: just like all the EISPIPE errors that could come along and ruin one's day running sysctl(8) with the previous suggested patch if one has things defined in the right/wrong order, partial input comes across the fifo/pipe/socket/etc, or I needed to roll back the changes as well. Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 22:37:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D3E8668E; Wed, 19 Dec 2012 22:37:16 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) by mx1.freebsd.org (Postfix) with ESMTP id A5E7F8FC0C; Wed, 19 Dec 2012 22:37:16 +0000 (UTC) Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 4059B227EE; Wed, 19 Dec 2012 14:37:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1355956636; bh=C0eJDS77XdzvvXz1WONu1ZNZu8kbtGMDfSCmZnCsV+Y=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=OLcI4vx/b3pQw0YZukZP9USz1xNZ6NUEAM7ceaSqHLW+5N7/gJ2f07j6yeeClFMnS SpPQdxFrAwkdzhCMaSU/ds5KDXUFUYoLbPPqqc58iTuGCp4W8U7WQ78aD8XQGlzLYJ sMR4WREgB+N9EhbdiI2RWmaKUNw1jWdq750mRbGg= Message-ID: <50D2419B.20906@delphij.net> Date: Wed, 19 Dec 2012 14:37:15 -0800 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: Benjamin Kaduk Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> <50D23961.7090803@delphij.net> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , bjk@freebsd.org, "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 22:37:16 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 12/19/12 14:28, Benjamin Kaduk wrote: > [cc trimmed] > > On Wed, Dec 19, 2012 at 5:02 PM, Xin Li > wrote: > > Irrelevant. Consider this (extreme) situation: someone > distributes several sets of sysctl values tuned for certain > situations, like tcp.conf, supermicro.conf, ... and wants to put > them together in a directory, it's useful to source from the > directory without having to do a generation of command line on > boot, so when something goes wrong, they just remove the pack > rather than changing /etc/rc.conf. > > > Not a direct reply, but just noting that it can be *very* useful > to have, e.g., a README or foo.old or foo.disabled file in the same > directory where the "live" configuration files live. Always > interpreting the full '*' glob is not always the best thing to do. This is not an Unix utility should solve. To quote Terry Lambert: "If you aim the gun at your foot and pull the trigger, it's UNIX's job to ensure reliable delivery of the bullet to where you aimed the gun (in this case, Mr. Foot)." In other words, sysctl -f README should interpret README as input, not a file that contains user consumable text. To solve the problem we need a construct like in /etc/rc.subr, run_rc_script(). Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJQ0kGbAAoJEG80Jeu8UPuzdzsH/35v8W1ww2AIqun5Hhwp35Az xxlf/TDQdW1WE3ZwW2gqOD7AgGx+Q3yRKf+nGmQe1yvu8WP3i4HVUkDfp+ySzytZ oEBxLJnYZGstuHcmhncLGU6PbCBwcK3Y9dRlFIb9L5srFHaVuMsWK2nIZDx7TeOS +tcSwOSuJrerqCw6e6O61spHYTnIdnlAb1jEV7GaUciVqcgBxbKMf9iMpAspWm/e vl3dogHI+0NCT/tgaKAjS2EdG5UKqugF6Opc5RrwqDRo6kFNExy+0DN1UeFN4ahV 775872xHZEkHJvZtoTNXH5wKsfPhvjKLne2/nVkKhfu9aHwkXaHdZZXJdxB7+RU= =kMyx -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 22:44:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BBAB997E; Wed, 19 Dec 2012 22:44:31 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by mx1.freebsd.org (Postfix) with ESMTP id 4B0908FC15; Wed, 19 Dec 2012 22:44:31 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so3719333ieb.11 for ; Wed, 19 Dec 2012 14:44:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=uyRSI/VZG4vkcaUcWcTzi9FRtAWsQkFIwYnKoK8EqmQ=; b=YMEOpzkxEWT0jpslfJmJQAGTIXxDYunwgk7ST73xY/yVAEopKFpuN24pOIurOFpQxj 782OirTLh1EbS0uypkg1zsVBVE/x1WGZz5TTlT42RfDfe7vdyHNBulBuUV2cZZmXDEQk NsfHz+TA4jALtyWGW/lzZ535m0rH65e+2tpMCDUqVz/so1NFGf2f5u/m6OuMx85dIxKL i2gyIV4AjNe+LndyW0q4wG5M3DwtIO7Cjzg2P4kNqtgeSBx72nh3AvFwn12xRYPu/Ryg QvO568cSKTK+10YyMeB7UeOw/cAyGe/YVO58YIIt0l4qARAcFkX9CQXQSEjnLhuGDqQg UXSg== MIME-Version: 1.0 Received: by 10.50.242.73 with SMTP id wo9mr8836465igc.36.1355957070793; Wed, 19 Dec 2012 14:44:30 -0800 (PST) Received: by 10.42.56.83 with HTTP; Wed, 19 Dec 2012 14:44:30 -0800 (PST) In-Reply-To: <50D2419B.20906@delphij.net> References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> <50D23961.7090803@delphij.net> <50D2419B.20906@delphij.net> Date: Wed, 19 Dec 2012 17:44:30 -0500 Message-ID: Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl From: Benjamin Kaduk To: d@delphij.net Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: "svn-src-head@freebsd.org" , bjk@freebsd.org, "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 22:44:31 -0000 On Wed, Dec 19, 2012 at 5:37 PM, Xin Li wrote: > > Not a direct reply, but just noting that it can be *very* useful > > to have, e.g., a README or foo.old or foo.disabled file in the same > > directory where the "live" configuration files live. Always > > interpreting the full '*' glob is not always the best thing to do. > > This is not an Unix utility should solve. To quote Terry Lambert: "If > you aim the gun at your foot and pull the trigger, it's UNIX's job to > ensure reliable delivery of the bullet to where you aimed the gun (in > this case, Mr. Foot)." In other words, sysctl -f README should > interpret README as input, not a file that contains user consumable text. > Certainly. I was thinking about the proposal akin to 'cat /etc/sysctl.d/* | sysctl -f -' and similar proposals bandied about. I would prefer to not see an unanchored glob used in such a case. -Ben Kaduk From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 23:40:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CE128401; Wed, 19 Dec 2012 23:40:02 +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 B33A58FC1D; Wed, 19 Dec 2012 23:40:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJNe2NW013838; Wed, 19 Dec 2012 23:40:02 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJNe2er013837; Wed, 19 Dec 2012 23:40:02 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212192340.qBJNe2er013837@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 19 Dec 2012 23:40:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244451 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 23:40:02 -0000 Author: pjd Date: Wed Dec 19 23:40:02 2012 New Revision: 244451 URL: http://svnweb.freebsd.org/changeset/base/244451 Log: Use correct file permissions when looking for available core file if kern.corefile contains %I. Obtained from: WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Wed Dec 19 23:34:19 2012 (r244450) +++ head/sys/kern/kern_sig.c Wed Dec 19 23:40:02 2012 (r244451) @@ -3125,7 +3125,7 @@ expand_name(const char *comm, uid_t uid, struct nameidata nd; int cmode, flags, oflags, error; - cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; + cmode = S_IRUSR | S_IWUSR; oflags = VN_OPEN_NOAUDIT | (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0); From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 23:59:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F324FA40; Wed, 19 Dec 2012 23:59:48 +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 CDF198FC0C; Wed, 19 Dec 2012 23:59:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJNxmKx016497; Wed, 19 Dec 2012 23:59:48 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJNxmpa016496; Wed, 19 Dec 2012 23:59:48 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212192359.qBJNxmpa016496@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 19 Dec 2012 23:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244452 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 23:59:49 -0000 Author: pjd Date: Wed Dec 19 23:59:48 2012 New Revision: 244452 URL: http://svnweb.freebsd.org/changeset/base/244452 Log: Replace expand_name() function with corefile_open() function, which not only returns name, but also vnode of corefile to use. This simplifies the code and closes few races, especially in %I handling. Reviewed by: kib Obtained from: WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Wed Dec 19 23:40:02 2012 (r244451) +++ head/sys/kern/kern_sig.c Wed Dec 19 23:59:48 2012 (r244452) @@ -106,7 +106,6 @@ SDT_PROBE_ARGTYPE(proc, kernel, , signal SDT_PROBE_ARGTYPE(proc, kernel, , signal_discard, 2, "int"); static int coredump(struct thread *); -static char *expand_name(const char *, uid_t, pid_t, struct thread *, int); static int killpg1(struct thread *td, int sig, int pgid, int all, ksiginfo_t *ksi); static int issignal(struct thread *td, int stop_allowed); @@ -3034,8 +3033,9 @@ SYSCTL_STRING(_kern, OID_AUTO, corefile, sizeof(corefilename), "Process corefile name format string"); /* - * expand_name(name, uid, pid, td, compress) - * Expand the name described in corefilename, using name, uid, and pid. + * corefile_open(comm, uid, pid, td, compress, vpp, namep) + * Expand the name described in corefilename, using name, uid, and pid + * and open/create core file. * corefilename is a printf-like string, with three format specifiers: * %N name of process ("name") * %P process id (pid) @@ -3044,15 +3044,15 @@ SYSCTL_STRING(_kern, OID_AUTO, corefile, * by using "/dev/null", or all core files can be stored in "/cores/%U/%N-%P". * This is controlled by the sysctl variable kern.corefile (see above). */ -static char * -expand_name(const char *comm, uid_t uid, pid_t pid, struct thread *td, - int compress) +static int +corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td, + int compress, struct vnode **vpp, char **namep) { + struct nameidata nd; struct sbuf sb; const char *format; - char *name; - int i, indexpos; - char *hostname; + char *hostname, *name; + int indexpos, i, error, cmode, flags, oflags; hostname = NULL; format = corefilename; @@ -3110,11 +3110,14 @@ expand_name(const char *comm, uid_t uid, "long\n", (long)pid, comm, (u_long)uid); sbuf_delete(&sb); free(name, M_TEMP); - return (NULL); + return (ENOMEM); } sbuf_finish(&sb); sbuf_delete(&sb); + cmode = S_IRUSR | S_IWUSR; + oflags = VN_OPEN_NOAUDIT | (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0); + /* * If the core format has a %I in it, then we need to check * for existing corefiles before returning a name. @@ -3122,18 +3125,10 @@ expand_name(const char *comm, uid_t uid, * non-existing core file name to use. */ if (indexpos != -1) { - struct nameidata nd; - int cmode, flags, oflags, error; - - cmode = S_IRUSR | S_IWUSR; - oflags = VN_OPEN_NOAUDIT | - (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0); - for (i = 0; i < num_cores; i++) { flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW; name[indexpos] = '0' + i; - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, - name, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); error = vn_open_cred(&nd, &flags, cmode, oflags, td->td_ucred, NULL); if (error) { @@ -3143,25 +3138,26 @@ expand_name(const char *comm, uid_t uid, "pid %d (%s), uid (%u): Path `%s' failed " "on initial open test, error = %d\n", pid, comm, uid, name, error); - free(name, M_TEMP); - return (NULL); - } - NDFREE(&nd, NDF_ONLY_PNBUF); - VOP_UNLOCK(nd.ni_vp, 0); - error = vn_close(nd.ni_vp, FWRITE, td->td_ucred, td); - if (error) { - log(LOG_ERR, - "pid %d (%s), uid (%u): Path `%s' failed " - "on close after initial open test, " - "error = %d\n", - pid, comm, uid, name, error); - free(name, M_TEMP); - return (NULL); } - break; + goto out; } } - return (name); + + flags = O_CREAT | FWRITE | O_NOFOLLOW; + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); + error = vn_open_cred(&nd, &flags, cmode, oflags, td->td_ucred, NULL); +out: + if (error) { +#ifdef AUDIT + audit_proc_coredump(td, name, error); +#endif + free(name, M_TEMP); + return (error); + } + NDFREE(&nd, NDF_ONLY_PNBUF); + *vpp = nd.ni_vp; + *namep = name; + return (0); } /* @@ -3179,9 +3175,8 @@ coredump(struct thread *td) struct ucred *cred = td->td_ucred; struct vnode *vp; struct flock lf; - struct nameidata nd; struct vattr vattr; - int error, error1, flags, locked; + int error, error1, locked; struct mount *mp; char *name; /* name of corefile */ off_t limit; @@ -3216,25 +3211,11 @@ coredump(struct thread *td) } PROC_UNLOCK(p); - name = expand_name(p->p_comm, cred->cr_uid, p->p_pid, td, compress); - if (name == NULL) - return (EINVAL); - restart: - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); - flags = O_CREAT | FWRITE | O_NOFOLLOW; - error = vn_open_cred(&nd, &flags, S_IRUSR | S_IWUSR, - VN_OPEN_NOAUDIT | (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0), - cred, NULL); - if (error) { -#ifdef AUDIT - audit_proc_coredump(td, name, error); -#endif - free(name, M_TEMP); + error = corefile_open(p->p_comm, cred->cr_uid, p->p_pid, td, compress, + &vp, &name); + if (error != 0) return (error); - } - NDFREE(&nd, NDF_ONLY_PNBUF); - vp = nd.ni_vp; /* Don't dump to non-regular files or files with links. */ if (vp->v_type != VREG || VOP_GETATTR(vp, &vattr, cred) != 0 || From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:06:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B902BD53; Thu, 20 Dec 2012 00:06:25 +0000 (UTC) (envelope-from cognet@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 8406C8FC0A; Thu, 20 Dec 2012 00:06:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK06P9v017745; Thu, 20 Dec 2012 00:06:25 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK06Pkx017744; Thu, 20 Dec 2012 00:06:25 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201212200006.qBK06Pkx017744@svn.freebsd.org> From: Olivier Houchard Date: Thu, 20 Dec 2012 00:06:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244453 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:06:25 -0000 Author: cognet Date: Thu Dec 20 00:06:24 2012 New Revision: 244453 URL: http://svnweb.freebsd.org/changeset/base/244453 Log: Get the old NFSCLIENT to compile by adding now needed files. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Dec 19 23:59:48 2012 (r244452) +++ head/sys/conf/files Thu Dec 20 00:06:24 2012 (r244453) @@ -3511,15 +3511,15 @@ rpc/clnt_dg.c optional krpc | nfslockd rpc/clnt_rc.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_vc.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/getnetconfig.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd -rpc/replay.c optional krpc | nfslockd | nfsserver | nfscl | nfsd +rpc/replay.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpc_callmsg.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpc_generic.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpc_prot.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpcb_clnt.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpcb_prot.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd -rpc/svc.c optional krpc | nfslockd | nfsserver | nfscl | nfsd -rpc/svc_auth.c optional krpc | nfslockd | nfsserver | nfscl | nfsd -rpc/svc_auth_unix.c optional krpc | nfslockd | nfsserver | nfscl | nfsd +rpc/svc.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +rpc/svc_auth.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +rpc/svc_auth_unix.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/svc_dg.c optional krpc | nfslockd | nfsserver | nfscl | nfsd rpc/svc_generic.c optional krpc | nfslockd | nfsserver | nfscl | nfsd rpc/svc_vc.c optional krpc | nfslockd | nfsserver | nfscl | nfsd From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 22:52:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DEE0BD44; Wed, 19 Dec 2012 22:52:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id A75708FC15; Wed, 19 Dec 2012 22:52:21 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0087FB944; Wed, 19 Dec 2012 17:52:21 -0500 (EST) From: John Baldwin To: Alfred Perlstein Subject: Re: svn commit: r244112 - head/sys/kern Date: Wed, 19 Dec 2012 17:32:15 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201212110708.qBB78EWx025288@svn.freebsd.org> <201212181537.23341.jhb@freebsd.org> <50D0EED3.8020301@mu.org> In-Reply-To: <50D0EED3.8020301@mu.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201212191732.15777.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 19 Dec 2012 17:52:21 -0500 (EST) X-Mailman-Approved-At: Thu, 20 Dec 2012 00:09:40 +0000 Cc: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , Andriy Gapon , Gleb Smirnoff , Robert Watson , Navdeep Parhar , Bruce Evans , svn-src-head@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 22:52:22 -0000 On Tuesday, December 18, 2012 5:31:47 pm Alfred Perlstein wrote: > On 12/18/12 12:37 PM, John Baldwin wrote: > > On Monday, December 17, 2012 4:21:43 pm Alfred Perlstein wrote: > >> On 12/17/12 11:39 AM, John Baldwin wrote: > >>> On Saturday, December 15, 2012 1:04:17 am Bruce Evans wrote: > >>>> On Fri, 14 Dec 2012, Alfred Perlstein wrote: > >>>> > >>>>> On 12/14/12 4:12 PM, Robert Watson wrote: > >>>>>> On Fri, 14 Dec 2012, John Baldwin wrote: > >>>>>> > >>>>>>> On Thursday, December 13, 2012 4:02:15 am Gleb Smirnoff wrote: > >>>>>>>> On Wed, Dec 12, 2012 at 04:53:48PM -0800, Alfred Perlstein wrote: A> The > >>>>>>>> problem again is that not all the KASSERTS are inviolable, if you A> want > >>>>>>>> to do a project to split them, then please do, it would really be A> > >>>>>>>> helpful, as for now, they are a mis-mash of death/warnings and there are > >>>>>>>> A> at least three vendors who approve of this as well as 3 long term A> > >>>>>>>> committers that approved my change (not including Adrian). > >>>>>>>> > >>>>>>>> Can you show examples of not inviolable KASSERTs? > >>>>>>> There are none. They are all assertions for a reason. However, in my > >>>> Not even one whose existence is a bug? :-) > >>> They should just not exist at all then. :) All the more reason for them to > >>> panic early and often so developers will be prompted to remove them. > >>> > >> This is hard to explain to a customer. > >> > >> customer: "So we ran your debug image and got you a panic, here is the > >> information. So can you tell us what is the problem?" > >> alfred: "well that is due to XXX other thing that is broken, thanks for > >> helping us resolve that unrelated problem!" > >> customer: "i hate you" > >> alfred: "get in line." > > Are your customers running HEAD? Assertions in a stable branch have been > > through testing and generally aren't bogus, so dying on incorrect assertions > > (meaning the assertion tripped for non-buggy code) should not be the common > > case. Thus, that shouldn't really be the basis for an argument on this. > > > > I can also come up with arbitrary strawmen: > > > > customer: "help! we lost a bunch of data!" > > jhb: "oh, well, I can see why: the box reported this critical error while > > your data was still there, but it went ahead and corrupted it all > > anyway even though it knew about the error because I thought you wanted > > longer uptimes" > > jhb: "don't worry, I have a patch to fix the error" > > customer: "don't bother, we are switching to X" > > > > Yes, that happens when they run -stable. No, the kernel doesn't "know" it's going to corrupt the data if assertions aren't enabled. If you had something that only selectively enabled certain assertions that would be fine, but in my use case I'd still want them to always panic. That would just give you a more fine-grained tool for how much performance you are willing to sacrafice for extra safety. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 22:59:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 49D3D252; Wed, 19 Dec 2012 22:59:08 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-ie0-f179.google.com (mail-ie0-f179.google.com [209.85.223.179]) by mx1.freebsd.org (Postfix) with ESMTP id BE0188FC12; Wed, 19 Dec 2012 22:59:07 +0000 (UTC) Received: by mail-ie0-f179.google.com with SMTP id k14so3768505iea.10 for ; Wed, 19 Dec 2012 14:59:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=WY9W9Him/eJhhD53LXC+W24+Js8Lo3ZF6cKp5tGSSX8=; b=HHxGdP1t3uHpRwlQM1R7jK0I5z9reEPvC5bil+aagymxyYSXh9rkqxxGts4jbv/eyq 1i9PV0ScrZYQi8V61HrRjUqYvp+3HmrCCGvy/jBrTVgWW7nfNO9z5YnfGGI70jDqHdsq /jGn2sOpfTNPkCY6RjjjojtklnQxxBD+Je7JqbfJ9+8YXKpodBjX0wXNZz8FGNrZZqQa uLfMU1dS/MRCqxCDLGscE0cENP2VHC7qlGzU08nrQ9naslLwik/cmkPK+HGzyg51f9Rd Vp7c9w8LdCXBpuj8rpKoqzxeRTWaqdVxXolNNNCzE8XhCi9NTtv/v7nWXhzvDj5rpLFl W8pQ== X-Received: by 10.50.151.207 with SMTP id us15mr2530507igb.10.1355957941067; Wed, 19 Dec 2012 14:59:01 -0800 (PST) Received: from oddish ([66.11.160.25]) by mx.google.com with ESMTPS id bh3sm11841495igc.0.2012.12.19.14.58.59 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Dec 2012 14:59:00 -0800 (PST) Date: Wed, 19 Dec 2012 17:58:54 -0500 From: Mark Johnston To: d@delphij.net Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl Message-ID: <20121219225854.GA8399@oddish> References: <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> <50D23961.7090803@delphij.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50D23961.7090803@delphij.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Thu, 20 Dec 2012 00:10:04 +0000 Cc: Ian Lepore , "src-committers@freebsd.org" , Jilles Tjoelker , Garrett Cooper , "svn-src-all@freebsd.org" , Alfred Perlstein , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 22:59:08 -0000 On Wed, Dec 19, 2012 at 02:02:09PM -0800, Xin Li wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 12/19/12 13:12, Garrett Cooper wrote: > > On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper > > wrote: > > > > ... > > > >> find -exec / echo | xargs ? Seems like there's a better way to > >> solve this. > > > > Of course we also might be overengineering the problem (my > > suggestion definitely was overengineered). Why not pass in the > > appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks, > > Irrelevant. Consider this (extreme) situation: someone distributes > several sets of sysctl values tuned for certain situations, like > tcp.conf, supermicro.conf, ... and wants to put them together in a > directory, it's useful to source from the directory without having to > do a generation of command line on boot, so when something goes wrong, > they just remove the pack rather than changing /etc/rc.conf. At work I've changed the -f flag of syslogd and newsyslog to accept a directory which gets non-recursively searched for input files. This way we can have a directory, say /etc/syslog.d, into which package install scripts can easily drop config files. For something like sysctl this might be a bit much, but it's just a thought. The example diff below is what I have in mind. -Mark diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 8fad089..c880b45 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -42,6 +42,7 @@ static const char rcsid[] = #endif /* not lint */ #include +#include #include #include #include @@ -49,6 +50,7 @@ static const char rcsid[] = #include #include +#include #include #include #include @@ -64,6 +66,7 @@ static const char *conffile; static int aflag, bflag, dflag, eflag, hflag, iflag; static int Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag; +static int handlefile(const char *); static int oidfmt(int *, int, char *, u_int *); static int parsefile(const char *); static int parse(const char *, int); @@ -165,7 +168,7 @@ main(int argc, char **argv) warncount = 0; if (conffile != NULL) - warncount += parsefile(conffile); + warncount += handlefile(conffile); while (argc-- > 0) warncount += parse(*argv++, 0); @@ -402,6 +405,48 @@ parse(const char *string, int lineno) } static int +handlefile(const char *filename) +{ + DIR *dir; + struct dirent *de; + struct stat sb; + char path[MAXPATHLEN], *fname; + size_t off; + int warncount = 0; + + if (stat(filename, &sb)) + err(EX_NOINPUT, "%s", filename); + if (S_ISREG(sb.st_mode)) { + return (parsefile(filename)); + } else if (!S_ISDIR(sb.st_mode)) + errx(EX_USAGE, "invalid input file '%s'", filename); + + dir = opendir(filename); + if (dir == NULL) + err(EX_NOINPUT, "%s", filename); + off = strlcpy(path, filename, sizeof(path) - 1); + if (off >= sizeof(path) - 1) + errx(EX_NOINPUT, "input path '%s' too long", filename); + + fname = path + off; + *fname++ = '/'; + off++; + while ((de = readdir(dir)) != NULL) { + strlcpy(fname, de->d_name, sizeof(path) - off); + if (stat(path, &sb)) { + warn("%s", path); + continue; + } else if (!S_ISREG(sb.st_mode)) + continue; + + warncount += parsefile(path); + } + closedir(dir); + + return (warncount); +} + +static int parsefile(const char *filename) { FILE *file; From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 23:21:53 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B883198D; Wed, 19 Dec 2012 23:21:53 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id E86DE8FC0A; Wed, 19 Dec 2012 23:21:51 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.5/8.14.5) with ESMTP id qBJNLe0g041464; Wed, 19 Dec 2012 17:21:40 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.5/8.14.5/Submit) id qBJNLehC041463; Wed, 19 Dec 2012 17:21:40 -0600 (CST) (envelope-from brooks) Date: Wed, 19 Dec 2012 17:21:40 -0600 From: Brooks Davis To: Mark Johnston Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl Message-ID: <20121219232140.GA40927@lor.one-eyed-alien.net> References: <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> <50D23961.7090803@delphij.net> <20121219225854.GA8399@oddish> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: <20121219225854.GA8399@oddish> User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Thu, 20 Dec 2012 00:19:35 +0000 Cc: Ian Lepore , "src-committers@freebsd.org" , d@delphij.net, Jilles Tjoelker , Garrett Cooper , "svn-src-all@freebsd.org" , Alfred Perlstein , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 23:21:53 -0000 --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 19, 2012 at 05:58:54PM -0500, Mark Johnston wrote: > On Wed, Dec 19, 2012 at 02:02:09PM -0800, Xin Li wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA256 > >=20 > > On 12/19/12 13:12, Garrett Cooper wrote: > > > On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper > > > wrote: > > >=20 > > > ... > > >=20 > > >> find -exec / echo | xargs ? Seems like there's a better way to > > >> solve this. > > >=20 > > > Of course we also might be overengineering the problem (my=20 > > > suggestion definitely was overengineered). Why not pass in the=20 > > > appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks, > >=20 > > Irrelevant. Consider this (extreme) situation: someone distributes > > several sets of sysctl values tuned for certain situations, like > > tcp.conf, supermicro.conf, ... and wants to put them together in a > > directory, it's useful to source from the directory without having to > > do a generation of command line on boot, so when something goes wrong, > > they just remove the pack rather than changing /etc/rc.conf. >=20 > At work I've changed the -f flag of syslogd and newsyslog to accept a > directory which gets non-recursively searched for input files. This way > we can have a directory, say /etc/syslog.d, into which package install > scripts can easily drop config files. >=20 > For something like sysctl this might be a bit much, but it's just a > thought. The example diff below is what I have in mind. I don't have a strong opinion about the usefulness of this feature. It seems useful particularly in conjunction with supporting multiple -f's. I do have a few comments on the implementation below. > -Mark >=20 > diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c > index 8fad089..c880b45 100644 > --- a/sbin/sysctl/sysctl.c > +++ b/sbin/sysctl/sysctl.c > @@ -42,6 +42,7 @@ static const char rcsid[] =3D > #endif /* not lint */ > =20 > #include > +#include > #include > #include > #include > @@ -49,6 +50,7 @@ static const char rcsid[] =3D > #include > =20 > #include > +#include > #include > #include > #include > @@ -64,6 +66,7 @@ static const char *conffile; > static int aflag, bflag, dflag, eflag, hflag, iflag; > static int Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag; > =20 > +static int handlefile(const char *); > static int oidfmt(int *, int, char *, u_int *); > static int parsefile(const char *); > static int parse(const char *, int); > @@ -165,7 +168,7 @@ main(int argc, char **argv) > =20 > warncount =3D 0; > if (conffile !=3D NULL) > - warncount +=3D parsefile(conffile); > + warncount +=3D handlefile(conffile); > =20 > while (argc-- > 0) > warncount +=3D parse(*argv++, 0); > @@ -402,6 +405,48 @@ parse(const char *string, int lineno) > } > =20 > static int > +handlefile(const char *filename) > +{ > + DIR *dir; > + struct dirent *de; > + struct stat sb; > + char path[MAXPATHLEN], *fname; > + size_t off; > + int warncount =3D 0; > + > + if (stat(filename, &sb)) > + err(EX_NOINPUT, "%s", filename); I'd open the file and then use fstat here. You will need to open it one way or another and there's no point it checking it's type if you can't. > + if (S_ISREG(sb.st_mode)) { > + return (parsefile(filename)); > + } else if (!S_ISDIR(sb.st_mode)) > + errx(EX_USAGE, "invalid input file '%s'", filename); > + > + dir =3D opendir(filename); With the above suggestion, this would become just use fdopendir() here. > + if (dir =3D=3D NULL) > + err(EX_NOINPUT, "%s", filename); > + off =3D strlcpy(path, filename, sizeof(path) - 1); > + if (off >=3D sizeof(path) - 1) > + errx(EX_NOINPUT, "input path '%s' too long", filename); > + > + fname =3D path + off; > + *fname++ =3D '/'; > + off++; > + while ((de =3D readdir(dir)) !=3D NULL) { Per other's suggestions I would probably only read .conf files. A simple fnmatch() will let you do that. > + strlcpy(fname, de->d_name, sizeof(path) - off); Rather than doing string manipulation, use openat() here to open the files in the directory. > + if (stat(path, &sb)) { > + warn("%s", path); > + continue; > + } else if (!S_ISREG(sb.st_mode)) > + continue; > + > + warncount +=3D parsefile(path); > + } > + closedir(dir); > + > + return (warncount); > +} > + > +static int > parsefile(const char *filename) Alter to take a file descriptor instead of a path. -- Brooks > { > FILE *file; >=20 --/04w6evG8XlLl3ft Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFQ0kwEXY6L6fI4GtQRAudlAKDXkrA4CnILsV0iwPhf1oz47MoligCgmoK7 RH1vSQt6VLr/Tn7N7TSi8b8= =4OQM -----END PGP SIGNATURE----- --/04w6evG8XlLl3ft-- From owner-svn-src-all@FreeBSD.ORG Wed Dec 19 23:59:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C94C4921; Wed, 19 Dec 2012 23:59:27 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3CF228FC16; Wed, 19 Dec 2012 23:59:26 +0000 (UTC) Received: by mail-ie0-f182.google.com with SMTP id s9so3826857iec.27 for ; Wed, 19 Dec 2012 15:59:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=kjnWCRDOQU08kwYFK+WlRA26GQmRzndrJrC0ib18HVc=; b=L5Hb0IN8hcUMyrh2aXxikTVzIv5bOdQGK3JOUJ20irrluYI/WIa/xpxI8ecFrOrxCc 05aU/PzxgDZ9odwlPV+qSUPWRRfM+LzOvwNR/V5JfS5UeObJ0M8YenwNw7HriOF0yrqe Xo0Nx8QZ1mwBki7DTyY3fw1applGy32uWfmwb+P73TZwi/xgxSpzW+feRkmAiYmBfbRB /hNsdXaVOCStYEL307uKbkJCWmXgj9qqH1z1PnfTKN+KZj8y3X5tOXul11Q5ta+vsDQw D2b/3ER0PNZ1vbe+7a4qxqfgCqZyimy45V1620KpJt6piHDI2bA5BPn7+b3INzrN9El3 NzcA== X-Received: by 10.50.242.73 with SMTP id wo9mr8993466igc.36.1355961560767; Wed, 19 Dec 2012 15:59:20 -0800 (PST) Received: from oddish ([66.11.160.25]) by mx.google.com with ESMTPS id gs6sm5480266igc.11.2012.12.19.15.59.19 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Dec 2012 15:59:20 -0800 (PST) Date: Wed, 19 Dec 2012 18:59:17 -0500 From: Mark Johnston To: Brooks Davis Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl Message-ID: <20121219235917.GD8399@oddish> References: <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> <50D23961.7090803@delphij.net> <20121219225854.GA8399@oddish> <20121219232140.GA40927@lor.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121219232140.GA40927@lor.one-eyed-alien.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Thu, 20 Dec 2012 00:19:35 +0000 Cc: Ian Lepore , "src-committers@freebsd.org" , d@delphij.net, Jilles Tjoelker , Garrett Cooper , "svn-src-all@freebsd.org" , Alfred Perlstein , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 23:59:27 -0000 On Wed, Dec 19, 2012 at 05:21:40PM -0600, Brooks Davis wrote: > On Wed, Dec 19, 2012 at 05:58:54PM -0500, Mark Johnston wrote: > > On Wed, Dec 19, 2012 at 02:02:09PM -0800, Xin Li wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > > Hash: SHA256 > > > > > > On 12/19/12 13:12, Garrett Cooper wrote: > > > > On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper > > > > wrote: > > > > > > > > ... > > > > > > > >> find -exec / echo | xargs ? Seems like there's a better way to > > > >> solve this. > > > > > > > > Of course we also might be overengineering the problem (my > > > > suggestion definitely was overengineered). Why not pass in the > > > > appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks, > > > > > > Irrelevant. Consider this (extreme) situation: someone distributes > > > several sets of sysctl values tuned for certain situations, like > > > tcp.conf, supermicro.conf, ... and wants to put them together in a > > > directory, it's useful to source from the directory without having to > > > do a generation of command line on boot, so when something goes wrong, > > > they just remove the pack rather than changing /etc/rc.conf. > > > > At work I've changed the -f flag of syslogd and newsyslog to accept a > > directory which gets non-recursively searched for input files. This way > > we can have a directory, say /etc/syslog.d, into which package install > > scripts can easily drop config files. > > > > For something like sysctl this might be a bit much, but it's just a > > thought. The example diff below is what I have in mind. > > I don't have a strong opinion about the usefulness of this feature. It > seems useful particularly in conjunction with supporting multiple -f's. I don't really either. Just thought I'd suggest it. > > I do have a few comments on the implementation below. > Thanks! I didn't know about openat(). Here's the regenerated diff. diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 8fad089..9e453f6 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -42,6 +42,7 @@ static const char rcsid[] = #endif /* not lint */ #include +#include #include #include #include @@ -49,8 +50,11 @@ static const char rcsid[] = #include #include +#include #include #include +#include +#include #include #include #include @@ -64,8 +68,9 @@ static const char *conffile; static int aflag, bflag, dflag, eflag, hflag, iflag; static int Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag; +static int handlefile(const char *); static int oidfmt(int *, int, char *, u_int *); -static int parsefile(const char *); +static int parsefile(int); static int parse(const char *, int); static int show_var(int *, int); static int sysctl_all(int *oid, int len); @@ -165,7 +170,7 @@ main(int argc, char **argv) warncount = 0; if (conffile != NULL) - warncount += parsefile(conffile); + warncount += handlefile(conffile); while (argc-- > 0) warncount += parse(*argv++, 0); @@ -402,15 +407,55 @@ parse(const char *string, int lineno) } static int -parsefile(const char *filename) +handlefile(const char *filename) +{ + DIR *dir; + struct dirent *de; + struct stat sb; + int fd, warncount = 0; + + fd = open(filename, O_RDONLY); + if (fd < 0) + err(EX_NOINPUT, "%s", filename); + if (fstat(fd, &sb)) + err(EX_NOINPUT, "%s", filename); + + if (S_ISREG(sb.st_mode)) { + return (parsefile(fd)); + } else if (!S_ISDIR(sb.st_mode)) + errx(EX_USAGE, "invalid input file '%s'", filename); + + dir = fdopendir(fd); + if (dir == NULL) + err(EX_NOINPUT, "%s", filename); + while ((de = readdir(dir)) != NULL) { + if (fnmatch("*.conf", de->d_name, 0) != 0) + continue; + fd = openat(fd, de->d_name, O_RDONLY); + if (fd < 0 || fstat(fd, &sb) != 0) { + warn("%s", de->d_name); + continue; + } else if (!S_ISREG(sb.st_mode)) + continue; + + warncount += parsefile(fd); + close(fd); + } + closedir(dir); + + return (warncount); +} + +static int +parsefile(int fd) { FILE *file; char line[BUFSIZ], *p, *pq, *pdq; int warncount = 0, lineno = 0; - file = fopen(filename, "r"); + file = fdopen(fd, "r"); if (file == NULL) - err(EX_NOINPUT, "%s", filename); + err(EX_OSERR, "fdopen()"); while (fgets(line, sizeof(line), file) != NULL) { lineno++; p = line; @@ -446,7 +491,6 @@ parsefile(const char *filename) else warncount += parse(p, lineno); } - fclose(file); return (warncount); } From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:26:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 81452284; Thu, 20 Dec 2012 00:26:47 +0000 (UTC) (envelope-from eadler@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 4B6398FC12; Thu, 20 Dec 2012 00:26:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0QloY020835; Thu, 20 Dec 2012 00:26:47 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0QlDJ020829; Thu, 20 Dec 2012 00:26:47 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200026.qBK0QlDJ020829@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244454 - stable/9/usr.sbin/mergemaster X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:26:47 -0000 Author: eadler Date: Thu Dec 20 00:26:46 2012 New Revision: 244454 URL: http://svnweb.freebsd.org/changeset/base/244454 Log: MFC r243892: Remove pointless check for the existence of /usr/bin/less which exists in all configurations. Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/mergemaster/ (props changed) Modified: stable/9/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/9/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:06:24 2012 (r244453) +++ stable/9/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:26:46 2012 (r244454) @@ -421,9 +421,7 @@ check_pager () { echo " I cannot execute it. So, what would you like to do?" echo '' echo " Use 'e' to exit mergemaster and fix your PAGER variable" - if [ -x /usr/bin/less -o -x /usr/local/bin/less ]; then echo " Use 'l' to set PAGER to 'less' for this run" - fi echo " Use 'm' to use plain old 'more' as your PAGER for this run" echo '' echo " Default is to use plain old 'more' " @@ -436,17 +434,7 @@ check_pager () { exit 0 ;; [lL]) - if [ -x /usr/bin/less ]; then - PAGER=/usr/bin/less - elif [ -x /usr/local/bin/less ]; then - PAGER=/usr/local/bin/less - else - echo '' - echo " *** Fatal Error:" - echo " You asked to use 'less' as your pager, but I can't" - echo " find it in /usr/bin or /usr/local/bin" - exit 1 - fi + PAGER=less ;; [mM]|'') PAGER=more From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:26:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BEFAC285; Thu, 20 Dec 2012 00:26:47 +0000 (UTC) (envelope-from eadler@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 8902B8FC13; Thu, 20 Dec 2012 00:26:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0QlSb020848; Thu, 20 Dec 2012 00:26:47 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0QlrV020842; Thu, 20 Dec 2012 00:26:47 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200026.qBK0QlrV020842@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244455 - stable/8/usr.sbin/mergemaster X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:26:47 -0000 Author: eadler Date: Thu Dec 20 00:26:46 2012 New Revision: 244455 URL: http://svnweb.freebsd.org/changeset/base/244455 Log: MFC r243892: Remove pointless check for the existence of /usr/bin/less which exists in all configurations. Approved by: cperciva (implicit) Modified: stable/8/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/8/usr.sbin/ (props changed) stable/8/usr.sbin/mergemaster/ (props changed) Modified: stable/8/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:26:46 2012 (r244454) +++ stable/8/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:26:46 2012 (r244455) @@ -421,9 +421,7 @@ check_pager () { echo " I cannot execute it. So, what would you like to do?" echo '' echo " Use 'e' to exit mergemaster and fix your PAGER variable" - if [ -x /usr/bin/less -o -x /usr/local/bin/less ]; then echo " Use 'l' to set PAGER to 'less' for this run" - fi echo " Use 'm' to use plain old 'more' as your PAGER for this run" echo '' echo " Default is to use plain old 'more' " @@ -436,17 +434,7 @@ check_pager () { exit 0 ;; [lL]) - if [ -x /usr/bin/less ]; then - PAGER=/usr/bin/less - elif [ -x /usr/local/bin/less ]; then - PAGER=/usr/local/bin/less - else - echo '' - echo " *** Fatal Error:" - echo " You asked to use 'less' as your pager, but I can't" - echo " find it in /usr/bin or /usr/local/bin" - exit 1 - fi + PAGER=less ;; [mM]|'') PAGER=more From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:26:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 36D62286; Thu, 20 Dec 2012 00:26:48 +0000 (UTC) (envelope-from eadler@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 013A38FC14; Thu, 20 Dec 2012 00:26:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0Qlqa020857; Thu, 20 Dec 2012 00:26:47 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0Qld5020856; Thu, 20 Dec 2012 00:26:47 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200026.qBK0Qld5020856@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r244456 - stable/7/usr.sbin/mergemaster X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:26:48 -0000 Author: eadler Date: Thu Dec 20 00:26:47 2012 New Revision: 244456 URL: http://svnweb.freebsd.org/changeset/base/244456 Log: MFC r243892: Remove pointless check for the existence of /usr/bin/less which exists in all configurations. Approved by: cperciva (implicit) Modified: stable/7/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/7/usr.sbin/ (props changed) stable/7/usr.sbin/mergemaster/ (props changed) Modified: stable/7/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/7/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:26:46 2012 (r244455) +++ stable/7/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:26:47 2012 (r244456) @@ -421,9 +421,7 @@ check_pager () { echo " I cannot execute it. So, what would you like to do?" echo '' echo " Use 'e' to exit mergemaster and fix your PAGER variable" - if [ -x /usr/bin/less -o -x /usr/local/bin/less ]; then echo " Use 'l' to set PAGER to 'less' for this run" - fi echo " Use 'm' to use plain old 'more' as your PAGER for this run" echo '' echo " Default is to use plain old 'more' " @@ -436,17 +434,7 @@ check_pager () { exit 0 ;; [lL]) - if [ -x /usr/bin/less ]; then - PAGER=/usr/bin/less - elif [ -x /usr/local/bin/less ]; then - PAGER=/usr/local/bin/less - else - echo '' - echo " *** Fatal Error:" - echo " You asked to use 'less' as your pager, but I can't" - echo " find it in /usr/bin or /usr/local/bin" - exit 1 - fi + PAGER=less ;; [mM]|'') PAGER=more From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:28:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88D637E6; Thu, 20 Dec 2012 00:28:52 +0000 (UTC) (envelope-from eadler@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 6D4EC8FC0A; Thu, 20 Dec 2012 00:28:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0Sq6N021270; Thu, 20 Dec 2012 00:28:52 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0Sq6t021260; Thu, 20 Dec 2012 00:28:52 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200028.qBK0Sq6t021260@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244457 - stable/8/usr.sbin/pw X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:28:52 -0000 Author: eadler Date: Thu Dec 20 00:28:51 2012 New Revision: 244457 URL: http://svnweb.freebsd.org/changeset/base/244457 Log: MFC r243894: Remove useless check for NULL prior to free. Approved by: cperciva (implicit) Modified: stable/8/usr.sbin/pw/bitmap.c stable/8/usr.sbin/pw/pw_group.c Directory Properties: stable/8/usr.sbin/pw/ (props changed) Modified: stable/8/usr.sbin/pw/bitmap.c ============================================================================== --- stable/8/usr.sbin/pw/bitmap.c Thu Dec 20 00:26:47 2012 (r244456) +++ stable/8/usr.sbin/pw/bitmap.c Thu Dec 20 00:28:51 2012 (r244457) @@ -50,8 +50,7 @@ bm_alloc(int size) void bm_dealloc(struct bitmap * bm) { - if (bm->map) - free(bm->map); + free(bm->map); } static void Modified: stable/8/usr.sbin/pw/pw_group.c ============================================================================== --- stable/8/usr.sbin/pw/pw_group.c Thu Dec 20 00:26:47 2012 (r244456) +++ stable/8/usr.sbin/pw/pw_group.c Thu Dec 20 00:28:51 2012 (r244457) @@ -272,8 +272,7 @@ pw_group(struct userconf * cnf, int mode pw_log(cnf, mode, W_GROUP, "%s(%ld)", grp->gr_name, (long) grp->gr_gid); - if (members) - free(members); + free(members); return EXIT_SUCCESS; } From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:28:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 960CE7E7; Thu, 20 Dec 2012 00:28:52 +0000 (UTC) (envelope-from eadler@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 79DC08FC0C; Thu, 20 Dec 2012 00:28:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0SqBU021272; Thu, 20 Dec 2012 00:28:52 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0SqZh021262; Thu, 20 Dec 2012 00:28:52 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200028.qBK0SqZh021262@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r244458 - stable/7/usr.sbin/pw X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:28:52 -0000 Author: eadler Date: Thu Dec 20 00:28:51 2012 New Revision: 244458 URL: http://svnweb.freebsd.org/changeset/base/244458 Log: MFC r243894: Remove useless check for NULL prior to free. Approved by: cperciva (implicit) Modified: stable/7/usr.sbin/pw/bitmap.c stable/7/usr.sbin/pw/pw_group.c Directory Properties: stable/7/usr.sbin/pw/ (props changed) Modified: stable/7/usr.sbin/pw/bitmap.c ============================================================================== --- stable/7/usr.sbin/pw/bitmap.c Thu Dec 20 00:28:51 2012 (r244457) +++ stable/7/usr.sbin/pw/bitmap.c Thu Dec 20 00:28:51 2012 (r244458) @@ -50,8 +50,7 @@ bm_alloc(int size) void bm_dealloc(struct bitmap * bm) { - if (bm->map) - free(bm->map); + free(bm->map); } static void Modified: stable/7/usr.sbin/pw/pw_group.c ============================================================================== --- stable/7/usr.sbin/pw/pw_group.c Thu Dec 20 00:28:51 2012 (r244457) +++ stable/7/usr.sbin/pw/pw_group.c Thu Dec 20 00:28:51 2012 (r244458) @@ -272,8 +272,7 @@ pw_group(struct userconf * cnf, int mode pw_log(cnf, mode, W_GROUP, "%s(%ld)", grp->gr_name, (long) grp->gr_gid); - if (members) - free(members); + free(members); return EXIT_SUCCESS; } From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:28:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4B1E27E8; Thu, 20 Dec 2012 00:28:53 +0000 (UTC) (envelope-from eadler@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 306B98FC13; Thu, 20 Dec 2012 00:28:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0SrTV021289; Thu, 20 Dec 2012 00:28:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0SqUp021287; Thu, 20 Dec 2012 00:28:52 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200028.qBK0SqUp021287@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244459 - stable/9/usr.sbin/pw X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:28:53 -0000 Author: eadler Date: Thu Dec 20 00:28:52 2012 New Revision: 244459 URL: http://svnweb.freebsd.org/changeset/base/244459 Log: MFC r243894: Remove useless check for NULL prior to free. Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/pw/bitmap.c stable/9/usr.sbin/pw/pw_group.c Directory Properties: stable/9/usr.sbin/pw/ (props changed) Modified: stable/9/usr.sbin/pw/bitmap.c ============================================================================== --- stable/9/usr.sbin/pw/bitmap.c Thu Dec 20 00:28:51 2012 (r244458) +++ stable/9/usr.sbin/pw/bitmap.c Thu Dec 20 00:28:52 2012 (r244459) @@ -50,8 +50,7 @@ bm_alloc(int size) void bm_dealloc(struct bitmap * bm) { - if (bm->map) - free(bm->map); + free(bm->map); } static void Modified: stable/9/usr.sbin/pw/pw_group.c ============================================================================== --- stable/9/usr.sbin/pw/pw_group.c Thu Dec 20 00:28:51 2012 (r244458) +++ stable/9/usr.sbin/pw/pw_group.c Thu Dec 20 00:28:52 2012 (r244459) @@ -272,8 +272,7 @@ pw_group(struct userconf * cnf, int mode pw_log(cnf, mode, W_GROUP, "%s(%ld)", grp->gr_name, (long) grp->gr_gid); - if (members) - free(members); + free(members); return EXIT_SUCCESS; } From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:30:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D8F20C36; Thu, 20 Dec 2012 00:30:48 +0000 (UTC) (envelope-from eadler@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 BD8958FC14; Thu, 20 Dec 2012 00:30:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0UmfB021755; Thu, 20 Dec 2012 00:30:48 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0UmWg021753; Thu, 20 Dec 2012 00:30:48 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200030.qBK0UmWg021753@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244460 - stable/8/usr.sbin/mergemaster X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:30:48 -0000 Author: eadler Date: Thu Dec 20 00:30:48 2012 New Revision: 244460 URL: http://svnweb.freebsd.org/changeset/base/244460 Log: MFC r243891: Add ability to mergemaster to permit the user to type the absolute path to PAGER if mergemaster can not find the one already set. Approved by: cperciva (implicit) Modified: stable/8/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/8/usr.sbin/mergemaster/ (props changed) Modified: stable/8/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:28:52 2012 (r244459) +++ stable/8/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:30:48 2012 (r244460) @@ -424,6 +424,8 @@ check_pager () { echo " Use 'l' to set PAGER to 'less' for this run" echo " Use 'm' to use plain old 'more' as your PAGER for this run" echo '' + echo " or you may type an absolute path to PAGER for this run" + echo '' echo " Default is to use plain old 'more' " echo '' echo -n "What should I do? [Use 'more'] " @@ -439,6 +441,9 @@ check_pager () { [mM]|'') PAGER=more ;; + /*) + PAGER="$FIXPAGER" + ;; *) echo '' echo "invalid choice: ${FIXPAGER}" From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:30:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 14E54C37; Thu, 20 Dec 2012 00:30:49 +0000 (UTC) (envelope-from eadler@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 ED50F8FC16; Thu, 20 Dec 2012 00:30:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0Um54021761; Thu, 20 Dec 2012 00:30:48 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0UmYA021760; Thu, 20 Dec 2012 00:30:48 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200030.qBK0UmYA021760@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244461 - stable/9/usr.sbin/mergemaster X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:30:49 -0000 Author: eadler Date: Thu Dec 20 00:30:48 2012 New Revision: 244461 URL: http://svnweb.freebsd.org/changeset/base/244461 Log: MFC r243891: Add ability to mergemaster to permit the user to type the absolute path to PAGER if mergemaster can not find the one already set. Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/9/usr.sbin/mergemaster/ (props changed) Modified: stable/9/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/9/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:30:48 2012 (r244460) +++ stable/9/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:30:48 2012 (r244461) @@ -424,6 +424,8 @@ check_pager () { echo " Use 'l' to set PAGER to 'less' for this run" echo " Use 'm' to use plain old 'more' as your PAGER for this run" echo '' + echo " or you may type an absolute path to PAGER for this run" + echo '' echo " Default is to use plain old 'more' " echo '' echo -n "What should I do? [Use 'more'] " @@ -439,6 +441,9 @@ check_pager () { [mM]|'') PAGER=more ;; + /*) + PAGER="$FIXPAGER" + ;; *) echo '' echo "invalid choice: ${FIXPAGER}" From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:30:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A36FC38; Thu, 20 Dec 2012 00:30:49 +0000 (UTC) (envelope-from eadler@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 1EC888FC17; Thu, 20 Dec 2012 00:30:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0Unpc021765; Thu, 20 Dec 2012 00:30:49 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0UmQY021764; Thu, 20 Dec 2012 00:30:48 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200030.qBK0UmQY021764@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r244462 - stable/7/usr.sbin/mergemaster X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:30:49 -0000 Author: eadler Date: Thu Dec 20 00:30:48 2012 New Revision: 244462 URL: http://svnweb.freebsd.org/changeset/base/244462 Log: MFC r243891: Add ability to mergemaster to permit the user to type the absolute path to PAGER if mergemaster can not find the one already set. Approved by: cperciva (implicit) Modified: stable/7/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/7/usr.sbin/mergemaster/ (props changed) Modified: stable/7/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/7/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:30:48 2012 (r244461) +++ stable/7/usr.sbin/mergemaster/mergemaster.sh Thu Dec 20 00:30:48 2012 (r244462) @@ -424,6 +424,8 @@ check_pager () { echo " Use 'l' to set PAGER to 'less' for this run" echo " Use 'm' to use plain old 'more' as your PAGER for this run" echo '' + echo " or you may type an absolute path to PAGER for this run" + echo '' echo " Default is to use plain old 'more' " echo '' echo -n "What should I do? [Use 'more'] " @@ -439,6 +441,9 @@ check_pager () { [mM]|'') PAGER=more ;; + /*) + PAGER="$FIXPAGER" + ;; *) echo '' echo "invalid choice: ${FIXPAGER}" From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:32:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 69846109; Thu, 20 Dec 2012 00:32:44 +0000 (UTC) (envelope-from eadler@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 4ED9D8FC0C; Thu, 20 Dec 2012 00:32:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0Winl022171; Thu, 20 Dec 2012 00:32:44 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0Whoi022165; Thu, 20 Dec 2012 00:32:43 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200032.qBK0Whoi022165@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:32:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244463 - in stable/8: sbin/setkey usr.sbin/ndp X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:32:44 -0000 Author: eadler Date: Thu Dec 20 00:32:43 2012 New Revision: 244463 URL: http://svnweb.freebsd.org/changeset/base/244463 Log: MFC r244318: Minor wording improvments to some manual pages Approved by: cperciva (implicit) Modified: stable/8/sbin/setkey/setkey.8 stable/8/usr.sbin/ndp/ndp.8 Directory Properties: stable/8/sbin/setkey/ (props changed) stable/8/usr.sbin/ndp/ (props changed) Modified: stable/8/sbin/setkey/setkey.8 ============================================================================== --- stable/8/sbin/setkey/setkey.8 Thu Dec 20 00:30:48 2012 (r244462) +++ stable/8/sbin/setkey/setkey.8 Thu Dec 20 00:32:43 2012 (r244463) @@ -110,7 +110,7 @@ Loop forever and dump all the messages t .Dv PF_KEY socket. .Fl xx -makes each timestamps unformatted. +makes each timestamp unformatted. .El .Ss Configuration syntax With Modified: stable/8/usr.sbin/ndp/ndp.8 ============================================================================== --- stable/8/usr.sbin/ndp/ndp.8 Thu Dec 20 00:30:48 2012 (r244462) +++ stable/8/usr.sbin/ndp/ndp.8 Thu Dec 20 00:32:43 2012 (r244463) @@ -236,8 +236,8 @@ responding to requests for .Ar hostname even though the host address is not its own. .It Fl t -Print timestamp on each entry, -making it possible to merge output with +Print timestamp for each entry, +to make it possible to merge the output with .Xr tcpdump 1 . Most useful when used with .Fl A . From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:32:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8B97810A; Thu, 20 Dec 2012 00:32:44 +0000 (UTC) (envelope-from eadler@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 6D0EE8FC12; Thu, 20 Dec 2012 00:32:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0Wihi022176; Thu, 20 Dec 2012 00:32:44 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0Wi37022167; Thu, 20 Dec 2012 00:32:44 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200032.qBK0Wi37022167@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:32:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244464 - in stable/9: sbin/setkey usr.sbin/ndp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:32:44 -0000 Author: eadler Date: Thu Dec 20 00:32:43 2012 New Revision: 244464 URL: http://svnweb.freebsd.org/changeset/base/244464 Log: MFC r244318: Minor wording improvments to some manual pages Approved by: cperciva (implicit) Modified: stable/9/sbin/setkey/setkey.8 stable/9/usr.sbin/ndp/ndp.8 Directory Properties: stable/9/sbin/setkey/ (props changed) stable/9/usr.sbin/ndp/ (props changed) Modified: stable/9/sbin/setkey/setkey.8 ============================================================================== --- stable/9/sbin/setkey/setkey.8 Thu Dec 20 00:32:43 2012 (r244463) +++ stable/9/sbin/setkey/setkey.8 Thu Dec 20 00:32:43 2012 (r244464) @@ -110,7 +110,7 @@ Loop forever and dump all the messages t .Dv PF_KEY socket. .Fl xx -makes each timestamps unformatted. +makes each timestamp unformatted. .El .Ss Configuration syntax With Modified: stable/9/usr.sbin/ndp/ndp.8 ============================================================================== --- stable/9/usr.sbin/ndp/ndp.8 Thu Dec 20 00:32:43 2012 (r244463) +++ stable/9/usr.sbin/ndp/ndp.8 Thu Dec 20 00:32:43 2012 (r244464) @@ -240,8 +240,8 @@ responding to requests for .Ar hostname even though the host address is not its own. .It Fl t -Print timestamp on each entry, -making it possible to merge output with +Print timestamp for each entry, +to make it possible to merge the output with .Xr tcpdump 1 . Most useful when used with .Fl A . From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:32:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8BFAD10B; Thu, 20 Dec 2012 00:32:44 +0000 (UTC) (envelope-from eadler@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 7000B8FC13; Thu, 20 Dec 2012 00:32:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0WiCL022175; Thu, 20 Dec 2012 00:32:44 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0WifW022170; Thu, 20 Dec 2012 00:32:44 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200032.qBK0WifW022170@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:32:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r244465 - in stable/7: sbin/setkey usr.sbin/ndp X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:32:44 -0000 Author: eadler Date: Thu Dec 20 00:32:43 2012 New Revision: 244465 URL: http://svnweb.freebsd.org/changeset/base/244465 Log: MFC r244318: Minor wording improvments to some manual pages Approved by: cperciva (implicit) Modified: stable/7/sbin/setkey/setkey.8 stable/7/usr.sbin/ndp/ndp.8 Directory Properties: stable/7/sbin/setkey/ (props changed) stable/7/usr.sbin/ndp/ (props changed) Modified: stable/7/sbin/setkey/setkey.8 ============================================================================== --- stable/7/sbin/setkey/setkey.8 Thu Dec 20 00:32:43 2012 (r244464) +++ stable/7/sbin/setkey/setkey.8 Thu Dec 20 00:32:43 2012 (r244465) @@ -110,7 +110,7 @@ Loop forever and dump all the messages t .Dv PF_KEY socket. .Fl xx -makes each timestamps unformatted. +makes each timestamp unformatted. .El .Ss Configuration syntax With Modified: stable/7/usr.sbin/ndp/ndp.8 ============================================================================== --- stable/7/usr.sbin/ndp/ndp.8 Thu Dec 20 00:32:43 2012 (r244464) +++ stable/7/usr.sbin/ndp/ndp.8 Thu Dec 20 00:32:43 2012 (r244465) @@ -236,8 +236,8 @@ responding to requests for .Ar hostname even though the host address is not its own. .It Fl t -Print timestamp on each entry, -making it possible to merge output with +Print timestamp for each entry, +to make it possible to merge the output with .Xr tcpdump 1 . Most useful when used with .Fl A . From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:34:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9D0F954C; Thu, 20 Dec 2012 00:34:55 +0000 (UTC) (envelope-from cognet@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 81A158FC13; Thu, 20 Dec 2012 00:34:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0YtCk022551; Thu, 20 Dec 2012 00:34:55 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0YtUd022549; Thu, 20 Dec 2012 00:34:55 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201212200034.qBK0YtUd022549@svn.freebsd.org> From: Olivier Houchard Date: Thu, 20 Dec 2012 00:34:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244466 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:34:55 -0000 Author: cognet Date: Thu Dec 20 00:34:54 2012 New Revision: 244466 URL: http://svnweb.freebsd.org/changeset/base/244466 Log: Create an architecture-agnostic buffer pool manager that uses uma(9) to manage a set of power-of-2 sized buffers for bus_dmamem_alloc(). This allows the caller to provide the back-end allocator uma allocator, allowing full control of the memory pages backing the pool. For convenience, it provides an optional builtin allocator that provides pages allocated with the VM_MEMATTR_UNCACHEABLE attribute, for managing pools of DMA buffers for BUS_DMA_COHERENT or BUS_DMA_NOCACHE. This also allows the caller to specify a minimum alignment, and it ensures that all buffers start on a boundary and have a length that's a multiple of that value, to avoid using buffers that trigger partial cache line flushes. Submitted by: Ian Lepore Added: head/sys/kern/subr_busdma_bufalloc.c (contents, props changed) head/sys/sys/busdma_bufalloc.h (contents, props changed) Added: head/sys/kern/subr_busdma_bufalloc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/subr_busdma_bufalloc.c Thu Dec 20 00:34:54 2012 (r244466) @@ -0,0 +1,174 @@ +/*- + * Copyright (c) 2012 Ian Lepore + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Buffer allocation support routines for bus_dmamem_alloc implementations. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* + * We manage buffer zones up to a page in size. Buffers larger than a page can + * be managed by one of the kernel's page-oriented memory allocation routines as + * efficiently as what we can do here. Also, a page is the largest size for + * which we can g'tee contiguity when using uma, and contiguity is one of the + * requirements we have to fulfill. + */ +#define MIN_ZONE_BUFSIZE 32 +#define MAX_ZONE_BUFSIZE PAGE_SIZE + +/* + * The static array of 12 bufzones is big enough to handle all the zones for the + * smallest supported allocation size of 32 through the largest supported page + * size of 64K. If you up the biggest page size number, up the array size too. + * Basically the size of the array needs to be log2(maxsize)-log2(minsize)+1, + * but I don't know of an easy way to express that as a compile-time constant. + */ +#if PAGE_SIZE > 65536 +#error Unsupported page size +#endif + +struct busdma_bufalloc { + bus_size_t min_size; + size_t num_zones; + struct busdma_bufzone buf_zones[12]; +}; + +busdma_bufalloc_t +busdma_bufalloc_create(const char *name, bus_size_t minimum_alignment, + uma_alloc alloc_func, uma_free free_func, u_int32_t zcreate_flags) +{ + struct busdma_bufalloc *ba; + struct busdma_bufzone *bz; + int i; + bus_size_t cursize; + + ba = malloc(sizeof(struct busdma_bufalloc), M_DEVBUF, + M_ZERO | M_WAITOK); + + ba->min_size = MAX(MIN_ZONE_BUFSIZE, minimum_alignment); + + /* + * Each uma zone is created with an alignment of size-1, meaning that + * the alignment is equal to the size (I.E., 64 byte buffers are aligned + * to 64 byte boundaries, etc). This allows for a fast efficient test + * when deciding whether a pool buffer meets the constraints of a given + * tag used for allocation: the buffer is usable if tag->alignment <= + * bufzone->size. + */ + for (i = 0, bz = ba->buf_zones, cursize = ba->min_size; + i < nitems(ba->buf_zones) && cursize <= MAX_ZONE_BUFSIZE; + ++i, ++bz, cursize <<= 1) { + snprintf(bz->name, sizeof(bz->name), "dma %.10s %lu", + name, cursize); + bz->size = cursize; + bz->umazone = uma_zcreate(bz->name, bz->size, + NULL, NULL, NULL, NULL, bz->size - 1, zcreate_flags); + if (bz->umazone == NULL) { + busdma_bufalloc_destroy(ba); + return (NULL); + } + if (alloc_func != NULL) + uma_zone_set_allocf(bz->umazone, alloc_func); + if (free_func != NULL) + uma_zone_set_freef(bz->umazone, free_func); + ++ba->num_zones; + } + + return (ba); +} + +void +busdma_bufalloc_destroy(busdma_bufalloc_t ba) +{ + struct busdma_bufzone *bz; + int i; + + if (ba == NULL) + return; + + for (i = 0, bz = ba->buf_zones; i < ba->num_zones; ++i, ++bz) { + uma_zdestroy(bz->umazone); + } + + free(ba, M_DEVBUF); +} + +struct busdma_bufzone * +busdma_bufalloc_findzone(busdma_bufalloc_t ba, bus_size_t size) +{ + struct busdma_bufzone *bz; + int i; + + if (size > MAX_ZONE_BUFSIZE) + return (NULL); + + for (i = 0, bz = ba->buf_zones; i < ba->num_zones; ++i, ++bz) { + if (bz->size >= size) + return (bz); + } + + panic("Didn't find a buffer zone of the right size"); +} + +void * +busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, int size, u_int8_t *pflag, + int wait) +{ +#ifdef VM_MEMATTR_UNCACHEABLE + + /* Inform UMA that this allocator uses kernel_map/object. */ + *pflag = UMA_SLAB_KERNEL; + + return ((void *)kmem_alloc_attr(kernel_map, size, wait, 0, + BUS_SPACE_MAXADDR, VM_MEMATTR_UNCACHEABLE)); + +#else + + panic("VM_MEMATTR_UNCACHEABLE unavailable"); + +#endif /* VM_MEMATTR_UNCACHEABLE */ +} + +void +busdma_bufalloc_free_uncacheable(void *item, int size, u_int8_t pflag) +{ + + kmem_free(kernel_map, (vm_offset_t)item, size); +} + Added: head/sys/sys/busdma_bufalloc.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/busdma_bufalloc.h Thu Dec 20 00:34:54 2012 (r244466) @@ -0,0 +1,118 @@ +/*- + * Copyright (c) 2012 Ian Lepore + * 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$ + */ + +/* + * A buffer pool manager, for use by a platform's busdma implementation. + */ + +#ifndef _MACHINE_BUSDMA_BUFALLOC_H_ +#define _MACHINE_BUSDMA_BUFALLOC_H_ + +#include +#include + +/* + * Information about a buffer zone, returned by busdma_bufalloc_findzone(). + */ +struct busdma_bufzone { + bus_size_t size; + uma_zone_t umazone; + char name[24]; +}; + +/* + * Opaque handle type returned by busdma_bufalloc_create(). + */ +struct busdma_bufalloc; +typedef struct busdma_bufalloc *busdma_bufalloc_t; + +/* + * Create an allocator that manages a pool of DMA buffers. + * + * The allocator manages a collection of uma(9) zones of buffers in power-of-two + * sized increments ranging from minimum_alignment to the platform's PAGE_SIZE. + * The buffers within each zone are aligned on boundaries corresponding to the + * buffer size, and thus by implication each buffer is contiguous within a page + * and does not cross a power of two boundary larger than the buffer size. + * These rules are intended to make it easy for a busdma implementation to + * check whether a tag's constraints allow use of a buffer from the allocator. + * + * minimum_alignment is also the minimum buffer allocation size. For platforms + * with software-assisted cache coherency, this is typically the data cache line + * size (and MUST not be smaller than the cache line size). + * + * name appears in zone stats as 'dma name nnnnn' where 'dma' is fixed and + * 'nnnnn' is the size of buffers in that zone. + * + * If if the alloc/free function pointers are NULL, the regular uma internal + * allocators are used (I.E., you get "plain old kernel memory"). On a platform + * with an exclusion zone that applies to all DMA operations, a custom allocator + * could be used to ensure no buffer memory is ever allocated from that zone, + * allowing the bus_dmamem_alloc() implementation to make the assumption that + * buffers provided by the allocation could never lead to the need for a bounce. + */ +busdma_bufalloc_t busdma_bufalloc_create(const char *name, + bus_size_t minimum_alignment, + uma_alloc uma_alloc_func, uma_free uma_free_func, + u_int32_t uma_zcreate_flags); + +/* + * Destroy an allocator created by busdma_bufalloc_create(). + * Safe to call with a NULL pointer. + */ +void busdma_bufalloc_destroy(busdma_bufalloc_t ba); + +/* + * Return a pointer to the busdma_bufzone that should be used to allocate or + * free a buffer of the given size. Returns NULL if the size is larger than the + * largest zone handled by the allocator. + */ +struct busdma_bufzone * busdma_bufalloc_findzone(busdma_bufalloc_t ba, + bus_size_t size); + +/* + * These built-in allocation routines are available for managing a pools of + * uncacheable memory on platforms that support VM_MEMATTR_UNCACHEABLE. + * + * Allocation is done using kmem_alloc_attr() with these parameters: + * lowaddr = 0 + * highaddr = BUS_SPACE_MAXADDR + * memattr = VM_MEMATTR_UNCACHEABLE. + * + * If your platform has no exclusion region (lowaddr/highaddr), and its pmap + * routines support pmap_page_set_memattr() and the VM_MEMATTR_UNCACHEABLE flag + * you can probably use these when you need uncacheable buffers. + */ +void * busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, int size, + u_int8_t *pflag, int wait); +void busdma_bufalloc_free_uncacheable(void *item, int size, u_int8_t pflag); + +#endif /* _MACHINE_BUSDMA_BUFALLOC_H_ */ + From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:35:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 52F786B0; Thu, 20 Dec 2012 00:35:09 +0000 (UTC) (envelope-from eadler@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 369A08FC12; Thu, 20 Dec 2012 00:35:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0Z9M5022662; Thu, 20 Dec 2012 00:35:09 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0Z9fx022661; Thu, 20 Dec 2012 00:35:09 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200035.qBK0Z9fx022661@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244467 - stable/9/share/misc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:35:09 -0000 Author: eadler Date: Thu Dec 20 00:35:08 2012 New Revision: 244467 URL: http://svnweb.freebsd.org/changeset/base/244467 Log: MFC r243890: Connect organization.dot to the build Approved by: cperciva (implicit) Modified: stable/9/share/misc/Makefile Directory Properties: stable/9/share/misc/ (props changed) Modified: stable/9/share/misc/Makefile ============================================================================== --- stable/9/share/misc/Makefile Thu Dec 20 00:34:54 2012 (r244466) +++ stable/9/share/misc/Makefile Thu Dec 20 00:35:08 2012 (r244467) @@ -6,7 +6,8 @@ FILES= ascii birthtoken bsd-family-tree committers-doc.dot committers-ports.dot \ committers-src.dot eqnchar flowers init.ee \ iso3166 iso639 latin1 man.template mdoc.template operator pci_vendors \ - scsi_modes usb_hid_usages usbdevs + scsi_modes usb_hid_usages usbdevs \ + organization.dot NO_OBJ= FILESDIR= ${BINDIR}/misc From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:35:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 916586B1; Thu, 20 Dec 2012 00:35:09 +0000 (UTC) (envelope-from eadler@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 74D5D8FC15; Thu, 20 Dec 2012 00:35:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0Z9ig022668; Thu, 20 Dec 2012 00:35:09 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0Z9Qp022667; Thu, 20 Dec 2012 00:35:09 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200035.qBK0Z9Qp022667@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244468 - stable/8/share/misc X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:35:09 -0000 Author: eadler Date: Thu Dec 20 00:35:08 2012 New Revision: 244468 URL: http://svnweb.freebsd.org/changeset/base/244468 Log: MFC r243890: Connect organization.dot to the build Approved by: cperciva (implicit) Modified: stable/8/share/misc/Makefile Directory Properties: stable/8/share/misc/ (props changed) Modified: stable/8/share/misc/Makefile ============================================================================== --- stable/8/share/misc/Makefile Thu Dec 20 00:35:08 2012 (r244467) +++ stable/8/share/misc/Makefile Thu Dec 20 00:35:08 2012 (r244468) @@ -6,7 +6,8 @@ FILES= ascii birthtoken bsd-family-tree committers-doc.dot committers-ports.dot \ committers-src.dot eqnchar flowers init.ee \ iso3166 iso639 latin1 man.template mdoc.template operator pci_vendors \ - scsi_modes usb_hid_usages usbdevs + scsi_modes usb_hid_usages usbdevs \ + organization.dot NO_OBJ= FILESDIR= ${BINDIR}/misc From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:35:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 82A9A926; Thu, 20 Dec 2012 00:35:27 +0000 (UTC) (envelope-from cognet@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 678D68FC1B; Thu, 20 Dec 2012 00:35:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0ZRIW022740; Thu, 20 Dec 2012 00:35:27 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0ZRU0022739; Thu, 20 Dec 2012 00:35:27 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201212200035.qBK0ZRU0022739@svn.freebsd.org> From: Olivier Houchard Date: Thu, 20 Dec 2012 00:35:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244469 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:35:27 -0000 Author: cognet Date: Thu Dec 20 00:35:26 2012 New Revision: 244469 URL: http://svnweb.freebsd.org/changeset/base/244469 Log: Use the new allocator in bus_dmamem_alloc(). Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Thu Dec 20 00:35:08 2012 (r244468) +++ head/sys/arm/arm/busdma_machdep-v6.c Thu Dec 20 00:35:26 2012 (r244469) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2012 Ian Lepore * Copyright (c) 2010 Mark Tinguely * Copyright (c) 2004 Olivier Houchard * Copyright (c) 2002 Peter Grehan @@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -53,6 +55,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -83,7 +87,6 @@ struct bus_dma_tag { int map_count; bus_dma_lock_t *lockfunc; void *lockfuncarg; - bus_dma_segment_t *segments; struct bounce_zone *bounce_zone; /* * DMA range for this tag. If the page doesn't fall within @@ -93,6 +96,14 @@ struct bus_dma_tag { */ struct arm32_dma_range *ranges; int _nranges; + /* + * Most tags need one or two segments, and can use the local tagsegs + * array. For tags with a larger limit, we'll allocate a bigger array + * on first use. + */ + bus_dma_segment_t *segments; + bus_dma_segment_t tagsegs[2]; + }; @@ -150,6 +161,8 @@ struct bus_dmamap { pmap_t pmap; bus_dmamap_callback_t *callback; void *callback_arg; + int flags; +#define DMAMAP_COHERENT (1 << 0) STAILQ_ENTRY(bus_dmamap) links; STAILQ_HEAD(,sync_list) slist; }; @@ -169,6 +182,38 @@ int run_filter(bus_dma_tag_t dmat, bus_a static int _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, bus_size_t buflen, int flags); +static busdma_bufalloc_t coherent_allocator; /* Cache of coherent buffers */ +static busdma_bufalloc_t standard_allocator; /* Cache of standard buffers */ +static void +busdma_init(void *dummy) +{ + + /* Create a cache of buffers in standard (cacheable) memory. */ + standard_allocator = busdma_bufalloc_create("buffer", + arm_dcache_align, /* minimum_alignment */ + NULL, /* uma_alloc func */ + NULL, /* uma_free func */ + 0); /* uma_zcreate_flags */ + + /* + * Create a cache of buffers in uncacheable memory, to implement the + * BUS_DMA_COHERENT (and potentially BUS_DMA_NOCACHE) flag. + */ + coherent_allocator = busdma_bufalloc_create("coherent", + arm_dcache_align, /* minimum_alignment */ + busdma_bufalloc_alloc_uncacheable, + busdma_bufalloc_free_uncacheable, + 0); /* uma_zcreate_flags */ +} + +/* + * This init historically used SI_SUB_VM, but now the init code requires + * malloc(9) using M_DEVBUF memory, which is set up later than SI_SUB_VM, by + * SI_SUB_KMEM and SI_ORDER_SECOND, so we'll go right after that by using + * SI_SUB_KMEM and SI_ORDER_THIRD. + */ +SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_THIRD, busdma_init, NULL); + static __inline int _bus_dma_can_bounce(vm_offset_t lowaddr, vm_offset_t highaddr) { @@ -322,7 +367,18 @@ bus_dma_tag_create(bus_dma_tag_t parent, newtag->lockfunc = dflt_lock; newtag->lockfuncarg = NULL; } - newtag->segments = NULL; + /* + * If all the segments we need fit into the local tagsegs array, set the + * pointer now. Otherwise NULL the pointer and an array of segments + * will be allocated later, on first use. We don't pre-allocate now + * because some tags exist just to pass contraints to children in the + * device hierarchy, and they tend to use BUS_SPACE_UNRESTRICTED and we + * sure don't want to try to allocate an array for that. + */ + if (newtag->nsegments <= nitems(newtag->tagsegs)) + newtag->segments = newtag->tagsegs; + else + newtag->segments = NULL; /* Take into account any restrictions imposed by our parent tag */ if (parent != NULL) { @@ -411,7 +467,8 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) parent = dmat->parent; atomic_subtract_int(&dmat->ref_count, 1); if (dmat->ref_count == 0) { - if (dmat->segments != NULL) + if (dmat->segments != NULL && + dmat->segments != dmat->tagsegs) free(dmat->segments, M_DEVBUF); free(dmat, M_DEVBUF); /* @@ -545,7 +602,10 @@ int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, bus_dmamap_t *mapp) { - int mflags, len; + busdma_bufalloc_t ba; + struct busdma_bufzone *bufzone; + vm_memattr_t memattr; + int mflags; if (flags & BUS_DMA_NOWAIT) mflags = M_NOWAIT; @@ -579,34 +639,54 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi if (flags & BUS_DMA_ZERO) mflags |= M_ZERO; + if (flags & BUS_DMA_COHERENT) { + memattr = VM_MEMATTR_UNCACHEABLE; + ba = coherent_allocator; + (*mapp)->flags |= DMAMAP_COHERENT; + } else { + memattr = VM_MEMATTR_DEFAULT; + ba = standard_allocator; + (*mapp)->flags = 0; + } +#ifdef notyet + /* All buffers we allocate are cache-aligned. */ + map->flags |= DMAMAP_CACHE_ALIGNED; +#endif - /* - * XXX: - * (dmat->alignment < dmat->maxsize) is just a quick hack; the exact - * alignment guarantees of malloc need to be nailed down, and the - * code below should be rewritten to take that into account. - * - * In the meantime, we'll warn the user if malloc gets it wrong. - * - * allocate at least a cache line. This should help avoid cache - * corruption. + /* + * Try to find a bufzone in the allocator that holds a cache of buffers + * of the right size for this request. If the buffer is too big to be + * held in the allocator cache, this returns NULL. + */ + bufzone = busdma_bufalloc_findzone(ba, dmat->maxsize); + + /* + * Allocate the buffer from the uma(9) allocator if... + * - It's small enough to be in the allocator (bufzone not NULL). + * - The alignment constraint isn't larger than the allocation size + * (the allocator aligns buffers to their size boundaries). + * - There's no need to handle lowaddr/highaddr exclusion zones. + * else allocate non-contiguous pages if... + * - The page count that could get allocated doesn't exceed nsegments. + * - The alignment constraint isn't larger than a page boundary. + * - There are no boundary-crossing constraints. + * else allocate a block of contiguous pages because one or more of the + * constraints is something that only the contig allocator can fulfill. */ - len = max(dmat->maxsize, arm_dcache_align); - if (len <= PAGE_SIZE && - (dmat->alignment < len) && - !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) { - *vaddr = malloc(len, M_DEVBUF, mflags); + if (bufzone != NULL && dmat->alignment <= bufzone->size && + !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) { + *vaddr = uma_zalloc(bufzone->umazone, mflags); + } else if (dmat->nsegments >= btoc(dmat->maxsize) && + dmat->alignment <= PAGE_SIZE && dmat->boundary == 0) { + *vaddr = (void *)kmem_alloc_attr(kernel_map, dmat->maxsize, + mflags, 0, dmat->lowaddr, memattr); } else { - /* - * XXX Use Contigmalloc until it is merged into this facility - * and handles multi-seg allocations. Nobody is doing - * multi-seg allocations yet though. - * XXX Certain AGP hardware does. - */ - *vaddr = contigmalloc(len, M_DEVBUF, mflags, - 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, - dmat->boundary); + *vaddr = (void *)kmem_alloc_contig(kernel_map, dmat->maxsize, + mflags, 0, dmat->lowaddr, dmat->alignment, dmat->boundary, + memattr); } + + if (*vaddr == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); @@ -630,19 +710,24 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) { - int len; + struct busdma_bufzone *bufzone; + busdma_bufalloc_t ba; + + if (map->flags & DMAMAP_COHERENT) + ba = coherent_allocator; + else + ba = standard_allocator; + + /* Be careful not to access map from here on. */ + + bufzone = busdma_bufalloc_findzone(ba, dmat->maxsize); + + if (bufzone != NULL && dmat->alignment <= bufzone->size && + !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) + uma_zfree(bufzone->umazone, vaddr); + else + kmem_free(kernel_map, (vm_offset_t)vaddr, dmat->maxsize); -#ifdef mftnotyet - pmap_change_attr((vm_offset_t)vaddr, dmat->maxsize, ARM_WRITE_BACK); -#endif - len = max(dmat->maxsize, arm_dcache_align); - if (len <= PAGE_SIZE && - (dmat->alignment < len) && - !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) - free(vaddr, M_DEVBUF); - else { - contigfree(vaddr, len, M_DEVBUF); - } dmat->map_count--; free(map, M_DEVBUF); CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, dmat, dmat->flags); @@ -1177,6 +1262,8 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus dmat->bounce_zone->total_bounced++; } } + if (map->flags & DMAMAP_COHERENT) + return; sl = STAILQ_FIRST(&map->slist); while (sl) { From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:37:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C18D6B07; Thu, 20 Dec 2012 00:37:12 +0000 (UTC) (envelope-from eadler@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 A4F7F8FC0C; Thu, 20 Dec 2012 00:37:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0bC03023022; Thu, 20 Dec 2012 00:37:12 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0bCdT023019; Thu, 20 Dec 2012 00:37:12 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200037.qBK0bCdT023019@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:37:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244470 - stable/9/sbin/devd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:37:12 -0000 Author: eadler Date: Thu Dec 20 00:37:11 2012 New Revision: 244470 URL: http://svnweb.freebsd.org/changeset/base/244470 Log: MFC r243932: Prefer the use of initalizer lists to ctor assignment. Approved by: cperciva (implicit) Modified: stable/9/sbin/devd/devd.cc stable/9/sbin/devd/devd.hh Directory Properties: stable/9/sbin/devd/ (props changed) Modified: stable/9/sbin/devd/devd.cc ============================================================================== --- stable/9/sbin/devd/devd.cc Thu Dec 20 00:35:26 2012 (r244469) +++ stable/9/sbin/devd/devd.cc Thu Dec 20 00:37:11 2012 (r244470) @@ -248,9 +248,8 @@ action::do_action(config &c) } match::match(config &c, const char *var, const char *re) - : _var(var) + : _var(var), _re("^") { - _re = "^"; _re.append(c.expand_string(string(re))); _re.append("$"); regcomp(&_regex, _re.c_str(), REG_EXTENDED | REG_NOSUB | REG_ICASE); Modified: stable/9/sbin/devd/devd.hh ============================================================================== --- stable/9/sbin/devd/devd.hh Thu Dec 20 00:35:26 2012 (r244469) +++ stable/9/sbin/devd/devd.hh Thu Dec 20 00:37:11 2012 (r244470) @@ -143,7 +143,7 @@ private: class config { public: - config() { _pidfile = ""; push_var_table(); } + config() : _pidfile("") { push_var_table(); } virtual ~config() { reset(); } void add_attach(int, event_proc *); void add_detach(int, event_proc *); From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:38:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9D6D9C72; Thu, 20 Dec 2012 00:38:08 +0000 (UTC) (envelope-from cognet@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 7F9978FC12; Thu, 20 Dec 2012 00:38:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0c8sI023178; Thu, 20 Dec 2012 00:38:08 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0c8op023177; Thu, 20 Dec 2012 00:38:08 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201212200038.qBK0c8op023177@svn.freebsd.org> From: Olivier Houchard Date: Thu, 20 Dec 2012 00:38:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244471 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:38:08 -0000 Author: cognet Date: Thu Dec 20 00:38:08 2012 New Revision: 244471 URL: http://svnweb.freebsd.org/changeset/base/244471 Log: Busdma enhancements, especially for managing small uncacheable buffers. - Use the new architecture-agnostic buffer pool manager that uses uma(9) to manage a set of power-of-2 sized buffers for bus_dmamem_alloc(). - Create pools of buffers backed by both regular and uncacheable memory, and use them to handle regular versus BUS_DMA_COHERENT allocations. - Use uma(9) to manage a pool of bus_dmamap structs instead of local code to manage a static list of 500 items (it took 3300 maps to get to multi-user mode, so the static pool wasn't much of an optimization). - Small BUS_DMA_COHERENT allocations no longer waste an entire page per allocation, or set pages to uncached when they contain data other than DMA buffers. There's no longer a need for drivers to work around the inefficiency by allocing large buffers then sub-dividing them. - Because we know the alignment and padding of buffers allocated by bus_dmamem_alloc() (whether coherent or regular memory, and whether obtained from the pool allocator or directly from the kernel) we can avoid doing partial cacheline flushes on them. - Add a fast-out to _bus_dma_could_bounce() (and some comments about what the routine really does because the old misplaced comment was wrong). - Everywhere the dma tag alignment is used, the interpretation is that an alignment of 1 means no special alignment. If the tag is created with an alignment argument of zero, store it in the tag as one, and remove all the code scattered around that changed 0->1 at point of use. - Remove stack-allocated arrays of segments, use a local array of two segments within the tag struct, or dynamically allocate an array at first use if nsegments > 2. On an arm system I tested, only 5 of 97 tags used more than two segments. On my x86 desktop it was only 7 of 111 tags. Submitted by: Ian Lepore Modified: head/sys/arm/arm/busdma_machdep.c Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Thu Dec 20 00:37:11 2012 (r244470) +++ head/sys/arm/arm/busdma_machdep.c Thu Dec 20 00:38:08 2012 (r244471) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2012 Ian Lepore * Copyright (c) 2004 Olivier Houchard * Copyright (c) 2002 Peter Grehan * Copyright (c) 1997, 1998 Justin T. Gibbs. @@ -32,7 +33,23 @@ __FBSDID("$FreeBSD$"); /* - * ARM bus dma support routines + * ARM bus dma support routines. + * + * XXX Things to investigate / fix some day... + * - What is the earliest that this API can be called? Could there be any + * fallout from changing the SYSINIT() order from SI_SUB_VM to SI_SUB_KMEM? + * - The manpage mentions the BUS_DMA_NOWAIT flag only in the context of the + * bus_dmamap_load() function. This code has historically (and still does) + * honor it in bus_dmamem_alloc(). If we got rid of that we could lose some + * error checking because some resource management calls would become WAITOK + * and thus "cannot fail." + * - The decisions made by _bus_dma_can_bounce() should be made once, at tag + * creation time, and the result stored in the tag. + * - It should be possible to take some shortcuts when mapping a buffer we know + * came from the uma(9) allocators based on what we know about such buffers + * (aligned, contiguous, etc). + * - The allocation of bounce pages could probably be cleaned up, then we could + * retire arm_remap_nocache(). */ #define _ARM32_BUS_DMA_PRIVATE @@ -40,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -50,7 +68,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include +#include #include #include @@ -81,7 +102,6 @@ struct bus_dma_tag { int map_count; bus_dma_lock_t *lockfunc; void *lockfuncarg; - bus_dma_segment_t *segments; /* * DMA range for this tag. If the page doesn't fall within * one of these ranges, an error is returned. The caller @@ -91,6 +111,13 @@ struct bus_dma_tag { struct arm32_dma_range *ranges; int _nranges; struct bounce_zone *bounce_zone; + /* + * Most tags need one or two segments, and can use the local tagsegs + * array. For tags with a larger limit, we'll allocate a bigger array + * on first use. + */ + bus_dma_segment_t *segments; + bus_dma_segment_t tagsegs[2]; }; struct bounce_page { @@ -134,7 +161,7 @@ SYSCTL_INT(_hw_busdma, OID_AUTO, total_b #define DMAMAP_LINEAR 0x1 #define DMAMAP_MBUF 0x2 #define DMAMAP_UIO 0x4 -#define DMAMAP_ALLOCATED 0x10 +#define DMAMAP_CACHE_ALIGNED 0x10 #define DMAMAP_TYPE_MASK (DMAMAP_LINEAR|DMAMAP_MBUF|DMAMAP_UIO) #define DMAMAP_COHERENT 0x8 struct bus_dmamap { @@ -144,9 +171,6 @@ struct bus_dmamap { bus_dma_tag_t dmat; int flags; void *buffer; - void *origbuffer; - void *allocbuffer; - TAILQ_ENTRY(bus_dmamap) freelist; int len; STAILQ_ENTRY(bus_dmamap) links; bus_dmamap_callback_t *callback; @@ -157,12 +181,6 @@ struct bus_dmamap { static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist; static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist; -static TAILQ_HEAD(,bus_dmamap) dmamap_freelist = - TAILQ_HEAD_INITIALIZER(dmamap_freelist); - -#define BUSDMA_STATIC_MAPS 500 -static struct bus_dmamap map_pool[BUSDMA_STATIC_MAPS]; - static struct mtx busdma_mtx; MTX_SYSINIT(busdma_mtx, &busdma_mtx, "busdma lock", MTX_DEF); @@ -179,6 +197,87 @@ static void free_bounce_page(bus_dma_tag /* Default tag, as most drivers provide no parent tag. */ bus_dma_tag_t arm_root_dma_tag; +//---------------------------------------------------------------------------- +// Begin block of code useful to transplant to other implementations. + +static uma_zone_t dmamap_zone; /* Cache of struct bus_dmamap items */ + +static busdma_bufalloc_t coherent_allocator; /* Cache of coherent buffers */ +static busdma_bufalloc_t standard_allocator; /* Cache of standard buffers */ + +/* + * This is the ctor function passed to uma_zcreate() for the pool of dma maps. + * It'll need platform-specific changes if this code is copied. + */ +static int +dmamap_ctor(void *mem, int size, void *arg, int flags) +{ + bus_dmamap_t map; + bus_dma_tag_t dmat; + + map = (bus_dmamap_t)mem; + dmat = (bus_dma_tag_t)arg; + + dmat->map_count++; + + map->dmat = dmat; + map->flags = 0; + STAILQ_INIT(&map->bpages); + + return (0); +} + +/* + * This is the dtor function passed to uma_zcreate() for the pool of dma maps. + * It may need platform-specific changes if this code is copied . + */ +static void +dmamap_dtor(void *mem, int size, void *arg) +{ + bus_dmamap_t map; + + map = (bus_dmamap_t)mem; + + map->dmat->map_count--; +} + +static void +busdma_init(void *dummy) +{ + + /* Create a cache of maps for bus_dmamap_create(). */ + dmamap_zone = uma_zcreate("dma maps", sizeof(struct bus_dmamap), + dmamap_ctor, dmamap_dtor, NULL, NULL, UMA_ALIGN_PTR, 0); + + /* Create a cache of buffers in standard (cacheable) memory. */ + standard_allocator = busdma_bufalloc_create("buffer", + arm_dcache_align, /* minimum_alignment */ + NULL, /* uma_alloc func */ + NULL, /* uma_free func */ + 0); /* uma_zcreate_flags */ + + /* + * Create a cache of buffers in uncacheable memory, to implement the + * BUS_DMA_COHERENT (and potentially BUS_DMA_NOCACHE) flag. + */ + coherent_allocator = busdma_bufalloc_create("coherent", + arm_dcache_align, /* minimum_alignment */ + busdma_bufalloc_alloc_uncacheable, + busdma_bufalloc_free_uncacheable, + 0); /* uma_zcreate_flags */ +} + +/* + * This init historically used SI_SUB_VM, but now the init code requires + * malloc(9) using M_DEVBUF memory, which is set up later than SI_SUB_VM, by + * SI_SUB_KMEM and SI_ORDER_SECOND, so we'll go right after that by using + * SI_SUB_KMEM and SI_ORDER_THIRD. + */ +SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_THIRD, busdma_init, NULL); + +// End block of code useful to transplant to other implementations. +//---------------------------------------------------------------------------- + /* * Return true if a match is made. * @@ -206,30 +305,26 @@ run_filter(bus_dma_tag_t dmat, bus_addr_ return (retval); } -static void -arm_dmamap_freelist_init(void *dummy) -{ - int i; - - for (i = 0; i < BUSDMA_STATIC_MAPS; i++) - TAILQ_INSERT_HEAD(&dmamap_freelist, &map_pool[i], freelist); -} - -SYSINIT(busdma, SI_SUB_VM, SI_ORDER_ANY, arm_dmamap_freelist_init, NULL); - /* - * Check to see if the specified page is in an allowed DMA range. + * This routine checks the exclusion zone constraints from a tag against the + * physical RAM available on the machine. If a tag specifies an exclusion zone + * but there's no RAM in that zone, then we avoid allocating resources to bounce + * a request, and we can use any memory allocator (as opposed to needing + * kmem_alloc_contig() just because it can allocate pages in an address range). + * + * Most tags have BUS_SPACE_MAXADDR or BUS_SPACE_MAXADDR_32BIT (they are the + * same value on 32-bit architectures) as their lowaddr constraint, and we can't + * possibly have RAM at an address higher than the highest address we can + * express, so we take a fast out. */ - -static __inline int -bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dma_segment_t *segs, - bus_dmamap_t map, void *buf, bus_size_t buflen, struct pmap *pmap, - int flags, vm_offset_t *lastaddrp, int *segp); - static __inline int _bus_dma_can_bounce(vm_offset_t lowaddr, vm_offset_t highaddr) { int i; + + if (lowaddr >= BUS_SPACE_MAXADDR) + return (0); + for (i = 0; phys_avail[i] && phys_avail[i + 1]; i += 2) { if ((lowaddr >= phys_avail[i] && lowaddr <= phys_avail[i + 1]) || (lowaddr < phys_avail[i] && @@ -294,38 +389,6 @@ dflt_lock(void *arg, bus_dma_lock_op_t o #endif } -static __inline bus_dmamap_t -_busdma_alloc_dmamap(void) -{ - bus_dmamap_t map; - - mtx_lock(&busdma_mtx); - map = TAILQ_FIRST(&dmamap_freelist); - if (map) - TAILQ_REMOVE(&dmamap_freelist, map, freelist); - mtx_unlock(&busdma_mtx); - if (!map) { - map = malloc(sizeof(*map), M_DEVBUF, M_NOWAIT | M_ZERO); - if (map) - map->flags = DMAMAP_ALLOCATED; - } else - map->flags = 0; - STAILQ_INIT(&map->bpages); - return (map); -} - -static __inline void -_busdma_free_dmamap(bus_dmamap_t map) -{ - if (map->flags & DMAMAP_ALLOCATED) - free(map, M_DEVBUF); - else { - mtx_lock(&busdma_mtx); - TAILQ_INSERT_HEAD(&dmamap_freelist, map, freelist); - mtx_unlock(&busdma_mtx); - } -} - /* * Allocate a device specific dma_tag. */ @@ -354,7 +417,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, } newtag->parent = parent; - newtag->alignment = alignment; + newtag->alignment = alignment ? alignment : 1; newtag->boundary = boundary; newtag->lowaddr = trunc_page((vm_offset_t)lowaddr) + (PAGE_SIZE - 1); newtag->highaddr = trunc_page((vm_offset_t)highaddr) + (PAGE_SIZE - 1); @@ -375,9 +438,19 @@ bus_dma_tag_create(bus_dma_tag_t parent, newtag->lockfunc = dflt_lock; newtag->lockfuncarg = NULL; } - newtag->segments = NULL; - - /* + /* + * If all the segments we need fit into the local tagsegs array, set the + * pointer now. Otherwise NULL the pointer and an array of segments + * will be allocated later, on first use. We don't pre-allocate now + * because some tags exist just to pass contraints to children in the + * device hierarchy, and they tend to use BUS_SPACE_UNRESTRICTED and we + * sure don't want to try to allocate an array for that. + */ + if (newtag->nsegments <= nitems(newtag->tagsegs)) + newtag->segments = newtag->tagsegs; + else + newtag->segments = NULL; + /* * Take into account any restrictions imposed by our parent tag */ if (parent != NULL) { @@ -450,6 +523,7 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) #endif if (dmat != NULL) { + if (dmat->map_count != 0) return (EBUSY); @@ -459,7 +533,8 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) parent = dmat->parent; atomic_subtract_int(&dmat->ref_count, 1); if (dmat->ref_count == 0) { - if (dmat->segments != NULL) + if (dmat->segments != NULL && + dmat->segments != dmat->tagsegs) free(dmat->segments, M_DEVBUF); free(dmat, M_DEVBUF); /* @@ -485,29 +560,19 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) { - bus_dmamap_t newmap; + bus_dmamap_t map; int error = 0; - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - M_NOWAIT); - if (dmat->segments == NULL) { - CTR3(KTR_BUSDMA, "%s: tag %p error %d", - __func__, dmat, ENOMEM); - return (ENOMEM); - } - } + map = uma_zalloc_arg(dmamap_zone, dmat, M_WAITOK); + *mapp = map; - newmap = _busdma_alloc_dmamap(); - if (newmap == NULL) { - CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM); - return (ENOMEM); - } - *mapp = newmap; - newmap->dmat = dmat; - newmap->allocbuffer = NULL; - dmat->map_count++; + /* + * If the tag's segments haven't been allocated yet we need to do it + * now, because we can't sleep for resources at map load time. + */ + if (dmat->segments == NULL) + dmat->segments = malloc(dmat->nsegments * + sizeof(*dmat->segments), M_DEVBUF, M_WAITOK); /* * Bouncing might be required if the driver asks for an active @@ -522,7 +587,7 @@ bus_dmamap_create(bus_dma_tag_t dmat, in if (dmat->bounce_zone == NULL) { if ((error = alloc_bounce_zone(dmat)) != 0) { - _busdma_free_dmamap(newmap); + uma_zfree(dmamap_zone, map); *mapp = NULL; return (error); } @@ -575,118 +640,129 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, b __func__, dmat, EBUSY); return (EBUSY); } - _busdma_free_dmamap(map); + uma_zfree(dmamap_zone, map); if (dmat->bounce_zone) dmat->bounce_zone->map_count--; - dmat->map_count--; CTR2(KTR_BUSDMA, "%s: tag %p error 0", __func__, dmat); return (0); } /* - * Allocate a piece of memory that can be efficiently mapped into - * bus device space based on the constraints lited in the dma tag. - * A dmamap to for use with dmamap_load is also allocated. + * Allocate a piece of memory that can be efficiently mapped into bus device + * space based on the constraints listed in the dma tag. Returns a pointer to + * the allocated memory, and a pointer to an associated bus_dmamap. */ int -bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, +bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddrp, int flags, bus_dmamap_t *mapp) { - bus_dmamap_t newmap = NULL; - + void * vaddr; + struct busdma_bufzone *bufzone; + busdma_bufalloc_t ba; + bus_dmamap_t map; int mflags; + vm_memattr_t memattr; if (flags & BUS_DMA_NOWAIT) mflags = M_NOWAIT; else mflags = M_WAITOK; - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - mflags); - if (dmat->segments == NULL) { - CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", - __func__, dmat, dmat->flags, ENOMEM); - return (ENOMEM); - } + + /* + * If the tag's segments haven't been allocated yet we need to do it + * now, because we can't sleep for resources at map load time. + */ + if (dmat->segments == NULL) + dmat->segments = malloc(dmat->nsegments * + sizeof(*dmat->segments), M_DEVBUF, mflags); + + map = uma_zalloc_arg(dmamap_zone, dmat, mflags); + if (map == NULL) + return (ENOMEM); + + if (flags & BUS_DMA_COHERENT) { + memattr = VM_MEMATTR_UNCACHEABLE; + ba = coherent_allocator; + map->flags |= DMAMAP_COHERENT; + } else { + memattr = VM_MEMATTR_DEFAULT; + ba = standard_allocator; } + /* All buffers we allocate are cache-aligned. */ + map->flags |= DMAMAP_CACHE_ALIGNED; + if (flags & BUS_DMA_ZERO) mflags |= M_ZERO; - newmap = _busdma_alloc_dmamap(); - if (newmap == NULL) { - CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", - __func__, dmat, dmat->flags, ENOMEM); - return (ENOMEM); + /* + * Try to find a bufzone in the allocator that holds a cache of buffers + * of the right size for this request. If the buffer is too big to be + * held in the allocator cache, this returns NULL. + */ + bufzone = busdma_bufalloc_findzone(ba, dmat->maxsize); + + /* + * Allocate the buffer from the uma(9) allocator if... + * - It's small enough to be in the allocator (bufzone not NULL). + * - The alignment constraint isn't larger than the allocation size + * (the allocator aligns buffers to their size boundaries). + * - There's no need to handle lowaddr/highaddr exclusion zones. + * else allocate non-contiguous pages if... + * - The page count that could get allocated doesn't exceed nsegments. + * - The alignment constraint isn't larger than a page boundary. + * - There are no boundary-crossing constraints. + * else allocate a block of contiguous pages because one or more of the + * constraints is something that only the contig allocator can fulfill. + */ + if (bufzone != NULL && dmat->alignment <= bufzone->size && + !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) { + vaddr = uma_zalloc(bufzone->umazone, mflags); + } else if (dmat->nsegments >= btoc(dmat->maxsize) && + dmat->alignment <= PAGE_SIZE && dmat->boundary == 0) { + vaddr = (void *)kmem_alloc_attr(kernel_map, dmat->maxsize, + mflags, 0, dmat->lowaddr, memattr); + } else { + vaddr = (void *)kmem_alloc_contig(kernel_map, dmat->maxsize, + mflags, 0, dmat->lowaddr, dmat->alignment, dmat->boundary, + memattr); } - dmat->map_count++; - *mapp = newmap; - newmap->dmat = dmat; - - if (dmat->maxsize <= PAGE_SIZE && - (dmat->alignment < dmat->maxsize) && - !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) { - *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); - } else { - /* - * XXX Use Contigmalloc until it is merged into this facility - * and handles multi-seg allocations. Nobody is doing - * multi-seg allocations yet though. - */ - *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, - 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, - dmat->boundary); - } - if (*vaddr == NULL) { - if (newmap != NULL) { - _busdma_free_dmamap(newmap); - dmat->map_count--; - } - *mapp = NULL; - return (ENOMEM); + + if (vaddr == NULL) { + uma_zfree(dmamap_zone, map); + map = NULL; } - if (flags & BUS_DMA_COHERENT) { - void *tmpaddr = arm_remap_nocache( - (void *)((vm_offset_t)*vaddr &~ PAGE_MASK), - dmat->maxsize + ((vm_offset_t)*vaddr & PAGE_MASK)); - - if (tmpaddr) { - tmpaddr = (void *)((vm_offset_t)(tmpaddr) + - ((vm_offset_t)*vaddr & PAGE_MASK)); - newmap->origbuffer = *vaddr; - newmap->allocbuffer = tmpaddr; - *vaddr = tmpaddr; - } else - newmap->origbuffer = newmap->allocbuffer = NULL; - } else - newmap->origbuffer = newmap->allocbuffer = NULL; - return (0); + + *vaddrp = vaddr; + *mapp = map; + + return (vaddr == NULL ? ENOMEM : 0); } /* - * Free a piece of memory and it's allocated dmamap, that was allocated - * via bus_dmamem_alloc. Make the same choice for free/contigfree. + * Free a piece of memory that was allocated via bus_dmamem_alloc, along with + * its associated map. */ void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) { - if (map->allocbuffer) { - KASSERT(map->allocbuffer == vaddr, - ("Trying to freeing the wrong DMA buffer")); - vaddr = map->origbuffer; - arm_unmap_nocache(map->allocbuffer, - dmat->maxsize + ((vm_offset_t)vaddr & PAGE_MASK)); - } - if (dmat->maxsize <= PAGE_SIZE && - dmat->alignment < dmat->maxsize && + struct busdma_bufzone *bufzone; + busdma_bufalloc_t ba; + + if (map->flags & DMAMAP_COHERENT) + ba = coherent_allocator; + else + ba = standard_allocator; + uma_zfree(dmamap_zone, map); + + /* Be careful not to access map from here on. */ + + bufzone = busdma_bufalloc_findzone(ba, dmat->maxsize); + + if (bufzone != NULL && dmat->alignment <= bufzone->size && !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) - free(vaddr, M_DEVBUF); - else { - contigfree(vaddr, dmat->maxsize, M_DEVBUF); - } - dmat->map_count--; - _busdma_free_dmamap(map); - CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, dmat, dmat->flags); + uma_zfree(bufzone->umazone, vaddr); + else + kmem_free(kernel_map, (vm_offset_t)vaddr, dmat->maxsize); } static int @@ -795,10 +871,6 @@ bus_dmamap_load_buffer(bus_dma_tag_t dma else curaddr = (*pde & L1_S_FRAME) | (vaddr & L1_S_OFFSET); - if (*pde & L1_S_CACHE_MASK) { - map->flags &= - ~DMAMAP_COHERENT; - } } else { pte = *ptep; KASSERT((pte & L2_TYPE_MASK) != L2_TYPE_INV, @@ -807,18 +879,9 @@ bus_dmamap_load_buffer(bus_dma_tag_t dma == L2_TYPE_L)) { curaddr = (pte & L2_L_FRAME) | (vaddr & L2_L_OFFSET); - if (pte & L2_L_CACHE_MASK) { - map->flags &= - ~DMAMAP_COHERENT; - - } } else { curaddr = (pte & L2_S_FRAME) | (vaddr & L2_S_OFFSET); - if (pte & L2_S_CACHE_MASK) { - map->flags &= - ~DMAMAP_COHERENT; - } } } } else { @@ -914,7 +977,7 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_ map->callback = callback; map->callback_arg = callback_arg; map->flags &= ~DMAMAP_TYPE_MASK; - map->flags |= DMAMAP_LINEAR|DMAMAP_COHERENT; + map->flags |= DMAMAP_LINEAR; map->buffer = buf; map->len = buflen; error = bus_dmamap_load_buffer(dmat, @@ -935,6 +998,15 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_ /* * Like bus_dmamap_load(), but for mbufs. + * + * Note that the manpage states that BUS_DMA_NOWAIT is implied for mbufs. + * + * We know that the way the system allocates and uses mbufs implies that we can + * treat them as DMAMAP_CACHE_ALIGNED in terms of handling partial cache line + * flushes. Even though the flush may reference the data area within the mbuf + * that isn't aligned to a cache line, we know the overall mbuf itself is + * properly aligned, and we know that the CPU will not touch the header fields + * before the data area while the DMA is in progress. */ int bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map, struct mbuf *m0, @@ -945,8 +1017,9 @@ bus_dmamap_load_mbuf(bus_dma_tag_t dmat, M_ASSERTPKTHDR(m0); + flags |= BUS_DMA_NOWAIT; map->flags &= ~DMAMAP_TYPE_MASK; - map->flags |= DMAMAP_MBUF | DMAMAP_COHERENT; + map->flags |= DMAMAP_MBUF | DMAMAP_CACHE_ALIGNED; map->buffer = m0; map->len = 0; if (m0->m_pkthdr.len <= dmat->maxsize) { @@ -969,7 +1042,7 @@ bus_dmamap_load_mbuf(bus_dma_tag_t dmat, /* * force "no valid mappings" on error in callback. */ - (*callback)(callback_arg, dmat->segments, 0, 0, error); + (*callback)(callback_arg, NULL, 0, 0, error); } else { (*callback)(callback_arg, dmat->segments, nsegs + 1, m0->m_pkthdr.len, error); @@ -991,7 +1064,7 @@ bus_dmamap_load_mbuf_sg(bus_dma_tag_t dm flags |= BUS_DMA_NOWAIT; *nsegs = -1; map->flags &= ~DMAMAP_TYPE_MASK; - map->flags |= DMAMAP_MBUF | DMAMAP_COHERENT; + map->flags |= DMAMAP_MBUF | DMAMAP_CACHE_ALIGNED; map->buffer = m0; map->len = 0; if (m0->m_pkthdr.len <= dmat->maxsize) { @@ -1035,7 +1108,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, resid = uio->uio_resid; iov = uio->uio_iov; map->flags &= ~DMAMAP_TYPE_MASK; - map->flags |= DMAMAP_UIO|DMAMAP_COHERENT; + map->flags |= DMAMAP_UIO; map->buffer = uio; map->len = 0; @@ -1058,7 +1131,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, caddr_t addr = (caddr_t) iov[i].iov_base; if (minlen > 0) { - error = bus_dmamap_load_buffer(dmat, dmat->segments, + error = bus_dmamap_load_buffer(dmat, dmat->segments, map, addr, minlen, pmap, flags, &lastaddr, &nsegs); map->len += minlen; @@ -1070,7 +1143,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, /* * force "no valid mappings" on error in callback. */ - (*callback)(callback_arg, dmat->segments, 0, 0, error); + (*callback)(callback_arg, NULL, 0, 0, error); } else { (*callback)(callback_arg, dmat->segments, nsegs+1, uio->uio_resid, error); @@ -1098,7 +1171,7 @@ _bus_dmamap_unload(bus_dma_tag_t dmat, b } static void -bus_dmamap_sync_buf(void *buf, int len, bus_dmasync_op_t op) +bus_dmamap_sync_buf(void *buf, int len, bus_dmasync_op_t op, int bufaligned) { char _tmp_cl[arm_dcache_align], _tmp_clend[arm_dcache_align]; register_t s; @@ -1108,7 +1181,25 @@ bus_dmamap_sync_buf(void *buf, int len, cpu_dcache_wb_range((vm_offset_t)buf, len); cpu_l2cache_wb_range((vm_offset_t)buf, len); } + + /* + * If the caller promises the buffer is properly aligned to a cache line + * (even if the call parms make it look like it isn't) we can avoid + * attempting to preserve the non-DMA part of the cache line in the + * POSTREAD case, but we MUST still do a writeback in the PREREAD case. + * + * This covers the case of mbufs, where we know how they're aligned and + * know the CPU doesn't touch the header in front of the DMA data area + * during the IO, but it may have touched it right before invoking the + * sync, so a PREREAD writeback is required. + * + * It also handles buffers we created in bus_dmamem_alloc(), which are + * always aligned and padded to cache line size even if the IO length + * isn't a multiple of cache line size. In this case the PREREAD + * writeback probably isn't required, but it's harmless. + */ partial = (((vm_offset_t)buf) | len) & arm_dcache_align_mask; + if (op & BUS_DMASYNC_PREREAD) { if (!(op & BUS_DMASYNC_PREWRITE) && !partial) { cpu_dcache_inv_range((vm_offset_t)buf, len); @@ -1119,7 +1210,7 @@ bus_dmamap_sync_buf(void *buf, int len, } } if (op & BUS_DMASYNC_POSTREAD) { - if (partial) { + if (partial && !bufaligned) { s = intr_disable(); if ((vm_offset_t)buf & arm_dcache_align_mask) memcpy(_tmp_cl, (void *)((vm_offset_t)buf & @@ -1133,7 +1224,7 @@ bus_dmamap_sync_buf(void *buf, int len, } cpu_dcache_inv_range((vm_offset_t)buf, len); cpu_l2cache_inv_range((vm_offset_t)buf, len); - if (partial) { + if (partial && !bufaligned) { if ((vm_offset_t)buf & arm_dcache_align_mask) memcpy((void *)((vm_offset_t)buf & ~arm_dcache_align_mask), _tmp_cl, @@ -1204,25 +1295,29 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus struct uio *uio; int resid; struct iovec *iov; - + int bufaligned; + if (op == BUS_DMASYNC_POSTWRITE) return; + if (map->flags & DMAMAP_COHERENT) + goto drain; if (STAILQ_FIRST(&map->bpages)) _bus_dmamap_sync_bp(dmat, map, op); - if (map->flags & DMAMAP_COHERENT) - return; CTR3(KTR_BUSDMA, "%s: op %x flags %x", __func__, op, map->flags); + bufaligned = (map->flags & DMAMAP_CACHE_ALIGNED); switch(map->flags & DMAMAP_TYPE_MASK) { case DMAMAP_LINEAR: if (!(_bus_dma_buf_is_in_bp(map, map->buffer, map->len))) - bus_dmamap_sync_buf(map->buffer, map->len, op); + bus_dmamap_sync_buf(map->buffer, map->len, op, + bufaligned); break; case DMAMAP_MBUF: m = map->buffer; while (m) { if (m->m_len > 0 && !(_bus_dma_buf_is_in_bp(map, m->m_data, m->m_len))) - bus_dmamap_sync_buf(m->m_data, m->m_len, op); + bus_dmamap_sync_buf(m->m_data, m->m_len, op, + bufaligned); m = m->m_next; } break; @@ -1237,7 +1332,7 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus if (!_bus_dma_buf_is_in_bp(map, iov[i].iov_base, minlen)) bus_dmamap_sync_buf(iov[i].iov_base, - minlen, op); + minlen, op, bufaligned); resid -= minlen; } } @@ -1245,6 +1340,9 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus default: break; } + +drain: + cpu_drain_writebuf(); } From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:41:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9B627EAB; Thu, 20 Dec 2012 00:41:00 +0000 (UTC) (envelope-from eadler@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 662D18FC12; Thu, 20 Dec 2012 00:41:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0f0xg023664; Thu, 20 Dec 2012 00:41:00 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0f0FL023661; Thu, 20 Dec 2012 00:41:00 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200041.qBK0f0FL023661@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 00:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244472 - stable/8/sys/dev/sound/pci/hda X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:41:00 -0000 Author: eadler Date: Thu Dec 20 00:40:59 2012 New Revision: 244472 URL: http://svnweb.freebsd.org/changeset/base/244472 Log: MFC r243793: Add support for hdmi hda codec onboard nvidia gt 440 graphics card PR: kern/174059 Approved by: cperciva (implicit) Modified: stable/8/sys/dev/sound/pci/hda/hdac.h stable/8/sys/dev/sound/pci/hda/hdacc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/sound/ (props changed) stable/8/sys/dev/sound/pci/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.h Thu Dec 20 00:38:08 2012 (r244471) +++ stable/8/sys/dev/sound/pci/hda/hdac.h Thu Dec 20 00:40:59 2012 (r244472) @@ -573,6 +573,7 @@ #define HDA_CODEC_NVIDIAGT21X HDA_CODEC_CONSTRUCT(NVIDIA, 0x000b) #define HDA_CODEC_NVIDIAMCP89 HDA_CODEC_CONSTRUCT(NVIDIA, 0x000c) #define HDA_CODEC_NVIDIAGT240 HDA_CODEC_CONSTRUCT(NVIDIA, 0x000d) +#define HDA_CODEC_NVIDIAGT440 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0014) #define HDA_CODEC_NVIDIAMCP67 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0067) #define HDA_CODEC_NVIDIAMCP73 HDA_CODEC_CONSTRUCT(NVIDIA, 0x8001) #define HDA_CODEC_NVIDIAXXXX HDA_CODEC_CONSTRUCT(NVIDIA, 0xffff) Modified: stable/8/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdacc.c Thu Dec 20 00:38:08 2012 (r244471) +++ stable/8/sys/dev/sound/pci/hda/hdacc.c Thu Dec 20 00:40:59 2012 (r244472) @@ -307,6 +307,7 @@ static const struct { { HDA_CODEC_NVIDIAGT21X, 0, "NVIDIA GT21x" }, { HDA_CODEC_NVIDIAMCP89, 0, "NVIDIA MCP89" }, { HDA_CODEC_NVIDIAGT240, 0, "NVIDIA GT240" }, + { HDA_CODEC_NVIDIAGT440, 0, "NVIDIA GT440" }, { HDA_CODEC_INTELIP, 0, "Intel Ibex Peak" }, { HDA_CODEC_INTELBL, 0, "Intel Bearlake" }, { HDA_CODEC_INTELCA, 0, "Intel Cantiga" }, From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:50:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3298124; Thu, 20 Dec 2012 00:50:04 +0000 (UTC) (envelope-from cognet@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 C79B18FC0A; Thu, 20 Dec 2012 00:50:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0o4q6024942; Thu, 20 Dec 2012 00:50:04 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0o4p9024941; Thu, 20 Dec 2012 00:50:04 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201212200050.qBK0o4p9024941@svn.freebsd.org> From: Olivier Houchard Date: Thu, 20 Dec 2012 00:50:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244473 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:50:05 -0000 Author: cognet Date: Thu Dec 20 00:50:04 2012 New Revision: 244473 URL: http://svnweb.freebsd.org/changeset/base/244473 Log: Use C comments instead of C++ comments. Spotted out by: gonzo (thanks, man) Modified: head/sys/arm/arm/busdma_machdep.c Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Thu Dec 20 00:40:59 2012 (r244472) +++ head/sys/arm/arm/busdma_machdep.c Thu Dec 20 00:50:04 2012 (r244473) @@ -197,8 +197,10 @@ static void free_bounce_page(bus_dma_tag /* Default tag, as most drivers provide no parent tag. */ bus_dma_tag_t arm_root_dma_tag; -//---------------------------------------------------------------------------- -// Begin block of code useful to transplant to other implementations. +/* + * ---------------------------------------------------------------------------- + * Begin block of code useful to transplant to other implementations. + */ static uma_zone_t dmamap_zone; /* Cache of struct bus_dmamap items */ @@ -275,8 +277,10 @@ busdma_init(void *dummy) */ SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_THIRD, busdma_init, NULL); -// End block of code useful to transplant to other implementations. -//---------------------------------------------------------------------------- +/* + * End block of code useful to transplant to other implementations. + * ---------------------------------------------------------------------------- + */ /* * Return true if a match is made. From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:57:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 63D7239C; Thu, 20 Dec 2012 00:57:25 +0000 (UTC) (envelope-from cognet@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 48ECE8FC13; Thu, 20 Dec 2012 00:57:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK0vPAE026016; Thu, 20 Dec 2012 00:57:25 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK0vPeL026015; Thu, 20 Dec 2012 00:57:25 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201212200057.qBK0vPeL026015@svn.freebsd.org> From: Olivier Houchard Date: Thu, 20 Dec 2012 00:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244474 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:57:25 -0000 Author: cognet Date: Thu Dec 20 00:57:24 2012 New Revision: 244474 URL: http://svnweb.freebsd.org/changeset/base/244474 Log: We want to build subr_busdma_bufalloc.c on arm. Modified: head/sys/conf/files.arm Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Thu Dec 20 00:50:04 2012 (r244473) +++ head/sys/conf/files.arm Thu Dec 20 00:57:24 2012 (r244474) @@ -70,6 +70,7 @@ font.h optional sc \ compile-with "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \ no-obj no-implicit-rule before-depend \ clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8" +kern/subr_busdma_bufalloc.c standard kern/subr_dummy_vdso_tc.c standard libkern/arm/divsi3.S standard libkern/arm/ffs.S standard From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 02:22:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D09C2E5A; Thu, 20 Dec 2012 02:22:37 +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 8A63E8FC0A; Thu, 20 Dec 2012 02:22:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK2Mb2c047016; Thu, 20 Dec 2012 02:22:37 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK2Mall046842; Thu, 20 Dec 2012 02:22:36 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201212200222.qBK2Mall046842@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 20 Dec 2012 02:22:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244475 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 02:22:37 -0000 Author: pfg Date: Thu Dec 20 02:22:36 2012 New Revision: 244475 URL: http://svnweb.freebsd.org/changeset/base/244475 Log: More constant renaming in preparation for newer features. We also try to make better use of the fs flags instead of trying adapt the code according to the fs structures. In the case of subsecond timestamps and birthtime we now check that the feature is explicitly enabled: previously we only checked that the reserved space was available and silently wrote them. This approach is much safer, especially if the filesystem happens to use embedded inodes or support EAs. Discussed with: Zheng Liu MFC after: 5 days Modified: head/sys/fs/ext2fs/ext2_dinode.h head/sys/fs/ext2fs/ext2_inode_cnv.c head/sys/fs/ext2fs/ext2_vfsops.c head/sys/fs/ext2fs/ext2fs.h Modified: head/sys/fs/ext2fs/ext2_dinode.h ============================================================================== --- head/sys/fs/ext2fs/ext2_dinode.h Thu Dec 20 00:57:24 2012 (r244474) +++ head/sys/fs/ext2fs/ext2_dinode.h Thu Dec 20 02:22:36 2012 (r244475) @@ -60,15 +60,16 @@ #define EXT2_APPEND 0x00000020 /* writes to file may only append */ #define EXT2_NODUMP 0x00000040 /* do not dump file */ #define EXT2_NOATIME 0x00000080 /* do not update atime */ -#define EXT2_INDEX 0x00001000 /* hash-indexed directory */ -#define EXT2_IMAGIC 0x00002000 /* AFS directory */ -#define EXT2_JOURNAL_DATA 0x00004000 /* file data should be journaled */ -#define EXT2_NOTAIL 0x00008000 /* file tail should not be merged */ -#define EXT2_DIRSYNC 0x00010000 /* dirsync behaviour */ -#define EXT2_TOPDIR 0x00020000 /* Top of directory hierarchies*/ -#define EXT2_HUGE_FILE 0x00040000 /* Set to each huge file */ -#define EXT2_EXTENTS 0x00080000 /* Inode uses extents */ -#define EXT2_EOFBLOCKS 0x00400000 /* Blocks allocated beyond EOF */ + +#define EXT4_INDEX 0x00001000 /* hash-indexed directory */ +#define EXT4_IMAGIC 0x00002000 /* AFS directory */ +#define EXT4_JOURNAL_DATA 0x00004000 /* file data should be journaled */ +#define EXT4_NOTAIL 0x00008000 /* file tail should not be merged */ +#define EXT4_DIRSYNC 0x00010000 /* dirsync behaviour */ +#define EXT4_TOPDIR 0x00020000 /* Top of directory hierarchies*/ +#define EXT4_HUGE_FILE 0x00040000 /* Set to each huge file */ +#define EXT4_EXTENTS 0x00080000 /* Inode uses extents */ +#define EXT4_EOFBLOCKS 0x00400000 /* Blocks allocated beyond EOF */ /* * Definitions for nanosecond timestamps. @@ -78,8 +79,7 @@ #define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1) #define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS) -#define E2DI_HAS_XTIME(ip) (EXT2_INODE_SIZE((ip)->i_e2fs) > \ - E2FS_REV0_INODE_SIZE) +#define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, EXT2F_ROCOMPAT_EXTRA_ISIZE)) /* * Structure of an inode on the disk Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode_cnv.c Thu Dec 20 00:57:24 2012 (r244474) +++ head/sys/fs/ext2fs/ext2_inode_cnv.c Thu Dec 20 02:22:36 2012 (r244475) @@ -27,17 +27,18 @@ */ #include #include +#include #include #include #include #include #include -#include #include +#include #define XTIME_TO_NSEC(x) ((x & EXT3_NSEC_MASK) >> 2) -#define NSEC_TO_XTIME(t) ((t << 2) & EXT3_NSEC_MASK) +#define NSEC_TO_XTIME(t) (le32toh(t << 2) & EXT3_NSEC_MASK) void ext2_print_inode( in ) Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Thu Dec 20 00:57:24 2012 (r244474) +++ head/sys/fs/ext2fs/ext2_vfsops.c Thu Dec 20 02:22:36 2012 (r244475) @@ -349,7 +349,7 @@ compute_sb_data(struct vnode *devvp, str } } /* Check for extra isize in big inodes. */ - if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT4F_ROCOMPAT_EXTRA_ISIZE) && + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_EXTRA_ISIZE) && EXT2_INODE_SIZE(fs) < sizeof(struct ext2fs_dinode)) { printf("ext2fs: no space for extra inode timestamps\n"); return (EINVAL); Modified: head/sys/fs/ext2fs/ext2fs.h ============================================================================== --- head/sys/fs/ext2fs/ext2fs.h Thu Dec 20 00:57:24 2012 (r244474) +++ head/sys/fs/ext2fs/ext2fs.h Thu Dec 20 02:22:36 2012 (r244475) @@ -215,18 +215,18 @@ struct m_ext2fs { #define EXT2F_ROCOMPAT_SPARSESUPER 0x0001 #define EXT2F_ROCOMPAT_LARGEFILE 0x0002 #define EXT2F_ROCOMPAT_BTREE_DIR 0x0004 -#define EXT4F_ROCOMPAT_HUGE_FILE 0x0008 -#define EXT4F_ROCOMPAT_GDT_CSUM 0x0010 -#define EXT4F_ROCOMPAT_DIR_NLINK 0x0020 -#define EXT4F_ROCOMPAT_EXTRA_ISIZE 0x0040 +#define EXT2F_ROCOMPAT_HUGE_FILE 0x0008 +#define EXT2F_ROCOMPAT_GDT_CSUM 0x0010 +#define EXT2F_ROCOMPAT_DIR_NLINK 0x0020 +#define EXT2F_ROCOMPAT_EXTRA_ISIZE 0x0040 #define EXT2F_INCOMPAT_COMP 0x0001 #define EXT2F_INCOMPAT_FTYPE 0x0002 -#define EXT4F_INCOMPAT_META_BG 0x0010 -#define EXT4F_INCOMPAT_EXTENTS 0x0040 -#define EXT4F_INCOMPAT_64BIT 0x0080 -#define EXT4F_INCOMPAT_MMP 0x0100 -#define EXT4F_INCOMPAT_FLEX_BG 0x0200 +#define EXT2F_INCOMPAT_META_BG 0x0010 +#define EXT2F_INCOMPAT_EXTENTS 0x0040 +#define EXT2F_INCOMPAT_64BIT 0x0080 +#define EXT2F_INCOMPAT_MMP 0x0100 +#define EXT2F_INCOMPAT_FLEX_BG 0x0200 /* * Features supported in this implementation @@ -239,7 +239,7 @@ struct m_ext2fs { #define EXT2F_COMPAT_SUPP 0x0000 #define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \ EXT2F_ROCOMPAT_LARGEFILE | \ - EXT4F_ROCOMPAT_EXTRA_ISIZE) + EXT2F_ROCOMPAT_EXTRA_ISIZE) #define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE /* Assume that user mode programs are passing in an ext2fs superblock, not From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 03:33:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7E187885; Thu, 20 Dec 2012 03:33:34 +0000 (UTC) (envelope-from gonzo@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 6144D8FC0C; Thu, 20 Dec 2012 03:33:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK3XYxw060681; Thu, 20 Dec 2012 03:33:34 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK3XY7F060680; Thu, 20 Dec 2012 03:33:34 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201212200333.qBK3XY7F060680@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 20 Dec 2012 03:33:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244476 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 03:33:34 -0000 Author: gonzo Date: Thu Dec 20 03:33:33 2012 New Revision: 244476 URL: http://svnweb.freebsd.org/changeset/base/244476 Log: Fix misleading comment Modified: head/sys/arm/include/pmap.h Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Thu Dec 20 02:22:36 2012 (r244475) +++ head/sys/arm/include/pmap.h Thu Dec 20 03:33:33 2012 (r244476) @@ -551,7 +551,7 @@ void pmap_pte_init_arm10(void); #endif /* CPU_ARM10 */ #if (ARM_MMU_V6 + ARM_MMU_V7) != 0 void pmap_pte_init_mmu_v6(void); -#endif /* CPU_ARM11 */ +#endif /* (ARM_MMU_V6 + ARM_MMU_V7) != 0 */ #endif /* (ARM_MMU_GENERIC + ARM_MMU_SA1) != 0 */ #if /* ARM_MMU_SA1 == */1 From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 00:26:58 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1ABE0395; Thu, 20 Dec 2012 00:26:58 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id D04BC8FC17; Thu, 20 Dec 2012 00:26:55 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.5/8.14.5) with ESMTP id qBK0Qif4041782; Wed, 19 Dec 2012 18:26:44 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.5/8.14.5/Submit) id qBK0Qhkj041781; Wed, 19 Dec 2012 18:26:43 -0600 (CST) (envelope-from brooks) Date: Wed, 19 Dec 2012 18:26:43 -0600 From: Brooks Davis To: Mark Johnston Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl Message-ID: <20121220002643.GA41556@lor.one-eyed-alien.net> References: <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> <50D23961.7090803@delphij.net> <20121219225854.GA8399@oddish> <20121219232140.GA40927@lor.one-eyed-alien.net> <20121219235917.GD8399@oddish> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="d6Gm4EdcadzBjdND" Content-Disposition: inline In-Reply-To: <20121219235917.GD8399@oddish> User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Thu, 20 Dec 2012 03:46:55 +0000 Cc: Ian Lepore , Brooks Davis , d@delphij.net, Jilles Tjoelker , Garrett Cooper , "svn-src-all@freebsd.org" , Alfred Perlstein , "src-committers@freebsd.org" , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 00:26:58 -0000 --d6Gm4EdcadzBjdND Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 19, 2012 at 06:59:17PM -0500, Mark Johnston wrote: > On Wed, Dec 19, 2012 at 05:21:40PM -0600, Brooks Davis wrote: > > On Wed, Dec 19, 2012 at 05:58:54PM -0500, Mark Johnston wrote: > > > On Wed, Dec 19, 2012 at 02:02:09PM -0800, Xin Li wrote: > > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > Hash: SHA256 > > > >=20 > > > > On 12/19/12 13:12, Garrett Cooper wrote: > > > > > On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper > > > > > wrote: > > > > >=20 > > > > > ... > > > > >=20 > > > > >> find -exec / echo | xargs ? Seems like there's a better way to > > > > >> solve this. > > > > >=20 > > > > > Of course we also might be overengineering the problem (my=20 > > > > > suggestion definitely was overengineered). Why not pass in the=20 > > > > > appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks, > > > >=20 > > > > Irrelevant. Consider this (extreme) situation: someone distributes > > > > several sets of sysctl values tuned for certain situations, like > > > > tcp.conf, supermicro.conf, ... and wants to put them together in a > > > > directory, it's useful to source from the directory without having = to > > > > do a generation of command line on boot, so when something goes wro= ng, > > > > they just remove the pack rather than changing /etc/rc.conf. > > >=20 > > > At work I've changed the -f flag of syslogd and newsyslog to accept a > > > directory which gets non-recursively searched for input files. This w= ay > > > we can have a directory, say /etc/syslog.d, into which package install > > > scripts can easily drop config files. > > >=20 > > > For something like sysctl this might be a bit much, but it's just a > > > thought. The example diff below is what I have in mind. > >=20 > > I don't have a strong opinion about the usefulness of this feature. It > > seems useful particularly in conjunction with supporting multiple -f's. >=20 > I don't really either. Just thought I'd suggest it. >=20 > >=20 > > I do have a few comments on the implementation below. > >=20 >=20 > Thanks! I didn't know about openat(). Here's the regenerated diff. >=20 > diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c > index 8fad089..9e453f6 100644 > --- a/sbin/sysctl/sysctl.c > +++ b/sbin/sysctl/sysctl.c > @@ -42,6 +42,7 @@ static const char rcsid[] =3D > #endif /* not lint */ > =20 > #include > +#include > #include > #include > #include > @@ -49,8 +50,11 @@ static const char rcsid[] =3D > #include > =20 > #include > +#include > #include > #include > +#include > +#include > #include > #include > #include > @@ -64,8 +68,9 @@ static const char *conffile; > static int aflag, bflag, dflag, eflag, hflag, iflag; > static int Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag; > =20 > +static int handlefile(const char *); > static int oidfmt(int *, int, char *, u_int *); > -static int parsefile(const char *); > +static int parsefile(int); > static int parse(const char *, int); > static int show_var(int *, int); > static int sysctl_all(int *oid, int len); > @@ -165,7 +170,7 @@ main(int argc, char **argv) > =20 > warncount =3D 0; > if (conffile !=3D NULL) > - warncount +=3D parsefile(conffile); > + warncount +=3D handlefile(conffile); > =20 > while (argc-- > 0) > warncount +=3D parse(*argv++, 0); > @@ -402,15 +407,55 @@ parse(const char *string, int lineno) > } > =20 > static int > -parsefile(const char *filename) > +handlefile(const char *filename) > +{ > + DIR *dir; > + struct dirent *de; > + struct stat sb; > + int fd, warncount =3D 0; > + > + fd =3D open(filename, O_RDONLY); > + if (fd < 0) > + err(EX_NOINPUT, "%s", filename); > + if (fstat(fd, &sb)) > + err(EX_NOINPUT, "%s", filename); > + > + if (S_ISREG(sb.st_mode)) { > + return (parsefile(fd)); This leaks the fd. I might just keep the close() in parsefile() so that in consumes the fd. -- Brooks > + } else if (!S_ISDIR(sb.st_mode)) > + errx(EX_USAGE, "invalid input file '%s'", filename); > + > + dir =3D fdopendir(fd); > + if (dir =3D=3D NULL) > + err(EX_NOINPUT, "%s", filename); > + while ((de =3D readdir(dir)) !=3D NULL) { > + if (fnmatch("*.conf", de->d_name, 0) !=3D 0) > + continue; > + fd =3D openat(fd, de->d_name, O_RDONLY); > + if (fd < 0 || fstat(fd, &sb) !=3D 0) { > + warn("%s", de->d_name); > + continue; > + } else if (!S_ISREG(sb.st_mode)) > + continue; > + > + warncount +=3D parsefile(fd); > + close(fd); > + } > + closedir(dir); > + > + return (warncount); > +} > + > +static int > +parsefile(int fd) > { > FILE *file; > char line[BUFSIZ], *p, *pq, *pdq; > int warncount =3D 0, lineno =3D 0; > =20 > - file =3D fopen(filename, "r"); > + file =3D fdopen(fd, "r"); > if (file =3D=3D NULL) > - err(EX_NOINPUT, "%s", filename); > + err(EX_OSERR, "fdopen()"); > while (fgets(line, sizeof(line), file) !=3D NULL) { > lineno++; > p =3D line; > @@ -446,7 +491,6 @@ parsefile(const char *filename) > else > warncount +=3D parse(p, lineno); > } > - fclose(file); > =20 > return (warncount); > } >=20 --d6Gm4EdcadzBjdND Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFQ0ltDXY6L6fI4GtQRAsdYAKCV5A0A0zPBHxtymlxL+JgzcxEolQCguuBi rQJqGziPFhuUsHBJetVcqcQ= =cJdi -----END PGP SIGNATURE----- --d6Gm4EdcadzBjdND-- From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 04:16:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BBA6DD3B; Thu, 20 Dec 2012 04:16:25 +0000 (UTC) (envelope-from eadler@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 9FACF8FC12; Thu, 20 Dec 2012 04:16:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK4GPEC067058; Thu, 20 Dec 2012 04:16:25 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK4GPBQ067055; Thu, 20 Dec 2012 04:16:25 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200416.qBK4GPBQ067055@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 04:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244477 - stable/8/sys/dev/sio X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 04:16:25 -0000 Author: eadler Date: Thu Dec 20 04:16:25 2012 New Revision: 244477 URL: http://svnweb.freebsd.org/changeset/base/244477 Log: MFC r242996: Add support for CIR1000 - Cirrus Logic V34 to the sio driver PR: kern/44267 Approved by: cperciva (implicit) Modified: stable/8/sys/dev/sio/sio_isa.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/sio/ (props changed) Modified: stable/8/sys/dev/sio/sio_isa.c ============================================================================== --- stable/8/sys/dev/sio/sio_isa.c Thu Dec 20 03:33:33 2012 (r244476) +++ stable/8/sys/dev/sio/sio_isa.c Thu Dec 20 04:16:25 2012 (r244477) @@ -83,6 +83,7 @@ static struct isa_pnp_id sio_ids[] = { {0x0034490a, NULL}, /* BRI3400 - Internal ACF Modem */ {0x0094490a, NULL}, /* BRI9400 - Boca K56Flex PnP */ {0x00b4490a, NULL}, /* BRIB400 - Boca 56k PnP */ + {0x0010320d, NULL}, /* CIR1000 - Cirrus Logic V34 */ {0x0030320d, NULL}, /* CIR3000 - Cirrus Logic V43 */ {0x0100440e, NULL}, /* CRD0001 - Cardinal MVP288IV ? */ {0x01308c0e, NULL}, /* CTL3001 - Creative Labs Phoneblaster */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 04:16:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 15B0AD3C; Thu, 20 Dec 2012 04:16:26 +0000 (UTC) (envelope-from eadler@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 EE8128FC13; Thu, 20 Dec 2012 04:16:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK4GPJ6067074; Thu, 20 Dec 2012 04:16:25 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK4GPUk067073; Thu, 20 Dec 2012 04:16:25 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200416.qBK4GPUk067073@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 04:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r244478 - stable/7/sys/dev/sio X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 04:16:26 -0000 Author: eadler Date: Thu Dec 20 04:16:25 2012 New Revision: 244478 URL: http://svnweb.freebsd.org/changeset/base/244478 Log: MFC r242996: Add support for CIR1000 - Cirrus Logic V34 to the sio driver PR: kern/44267 Approved by: cperciva (implicit) Modified: stable/7/sys/dev/sio/sio_isa.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/sio/sio_isa.c ============================================================================== --- stable/7/sys/dev/sio/sio_isa.c Thu Dec 20 04:16:25 2012 (r244477) +++ stable/7/sys/dev/sio/sio_isa.c Thu Dec 20 04:16:25 2012 (r244478) @@ -81,6 +81,7 @@ static struct isa_pnp_id sio_ids[] = { {0x0034490a, NULL}, /* BRI3400 - Internal ACF Modem */ {0x0094490a, NULL}, /* BRI9400 - Boca K56Flex PnP */ {0x00b4490a, NULL}, /* BRIB400 - Boca 56k PnP */ + {0x0010320d, NULL}, /* CIR1000 - Cirrus Logic V34 */ {0x0030320d, NULL}, /* CIR3000 - Cirrus Logic V43 */ {0x0100440e, NULL}, /* CRD0001 - Cardinal MVP288IV ? */ {0x01308c0e, NULL}, /* CTL3001 - Creative Labs Phoneblaster */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 04:16:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3824BD3D; Thu, 20 Dec 2012 04:16:26 +0000 (UTC) (envelope-from eadler@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 1C3A68FC14; Thu, 20 Dec 2012 04:16:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK4GP9t067078; Thu, 20 Dec 2012 04:16:25 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK4GPnj067075; Thu, 20 Dec 2012 04:16:25 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212200416.qBK4GPnj067075@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 04:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244479 - stable/9/sys/dev/sio X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 04:16:26 -0000 Author: eadler Date: Thu Dec 20 04:16:25 2012 New Revision: 244479 URL: http://svnweb.freebsd.org/changeset/base/244479 Log: MFC r242996: Add support for CIR1000 - Cirrus Logic V34 to the sio driver PR: kern/44267 Approved by: cperciva (implicit) Modified: stable/9/sys/dev/sio/sio_isa.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/sio/sio_isa.c ============================================================================== --- stable/9/sys/dev/sio/sio_isa.c Thu Dec 20 04:16:25 2012 (r244478) +++ stable/9/sys/dev/sio/sio_isa.c Thu Dec 20 04:16:25 2012 (r244479) @@ -83,6 +83,7 @@ static struct isa_pnp_id sio_ids[] = { {0x0034490a, NULL}, /* BRI3400 - Internal ACF Modem */ {0x0094490a, NULL}, /* BRI9400 - Boca K56Flex PnP */ {0x00b4490a, NULL}, /* BRIB400 - Boca 56k PnP */ + {0x0010320d, NULL}, /* CIR1000 - Cirrus Logic V34 */ {0x0030320d, NULL}, /* CIR3000 - Cirrus Logic V43 */ {0x0100440e, NULL}, /* CRD0001 - Cardinal MVP288IV ? */ {0x01308c0e, NULL}, /* CTL3001 - Creative Labs Phoneblaster */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 04:32:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 248D8435; Thu, 20 Dec 2012 04:32:06 +0000 (UTC) (envelope-from gonzo@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 069A78FC15; Thu, 20 Dec 2012 04:32:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK4W5lh069379; Thu, 20 Dec 2012 04:32:05 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK4W3QI069359; Thu, 20 Dec 2012 04:32:03 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201212200432.qBK4W3QI069359@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 20 Dec 2012 04:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244480 - in head/sys: arm/arm arm/broadcom/bcm2835 arm/conf arm/include arm/versatile conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 04:32:06 -0000 Author: gonzo Date: Thu Dec 20 04:32:02 2012 New Revision: 244480 URL: http://svnweb.freebsd.org/changeset/base/244480 Log: Replace generic ARM11 option with more specific support for ARM1136 and ARM1176 Submitted by: Daisuke Aoyama Obtained from: NetBSD Added: head/sys/arm/arm/cpufunc_asm_arm11x6.S (contents, props changed) Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/arm/elf_trampoline.c head/sys/arm/arm/identcpu.c head/sys/arm/arm/locore.S head/sys/arm/broadcom/bcm2835/files.bcm2835 head/sys/arm/conf/RPI-B head/sys/arm/conf/VERSATILEPB head/sys/arm/include/armreg.h head/sys/arm/include/cpuconf.h head/sys/arm/include/cpufunc.h head/sys/arm/include/intr.h head/sys/arm/versatile/files.versatile head/sys/conf/files.arm head/sys/conf/options.arm Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/arm/cpufunc.c Thu Dec 20 04:32:02 2012 (r244480) @@ -974,18 +974,18 @@ struct cpu_functions fa526_cpufuncs = { }; #endif /* CPU_FA526 || CPU_FA626TE */ -#if defined(CPU_ARM11) -struct cpu_functions arm11_cpufuncs = { +#if defined(CPU_ARM1136) +struct cpu_functions arm1136_cpufuncs = { /* CPU functions */ cpufunc_id, /* id */ - arm11_drain_writebuf, /* cpwait */ + cpufunc_nullop, /* cpwait */ /* MMU functions */ cpufunc_control, /* control */ cpufunc_domains, /* Domain */ - arm11_setttb, /* Setttb */ + arm11x6_setttb, /* Setttb */ cpufunc_faultstatus, /* Faultstatus */ cpufunc_faultaddress, /* Faultaddress */ @@ -1000,30 +1000,91 @@ struct cpu_functions arm11_cpufuncs = { /* Cache operations */ - armv6_icache_sync_all, /* icache_sync_all */ - armv6_icache_sync_range, /* icache_sync_range */ + arm11x6_icache_sync_all, /* icache_sync_all */ + arm11x6_icache_sync_range, /* icache_sync_range */ - armv6_dcache_wbinv_all, /* dcache_wbinv_all */ + arm11x6_dcache_wbinv_all, /* dcache_wbinv_all */ armv6_dcache_wbinv_range, /* dcache_wbinv_range */ armv6_dcache_inv_range, /* dcache_inv_range */ armv6_dcache_wb_range, /* dcache_wb_range */ - armv6_idcache_wbinv_all, /* idcache_wbinv_all */ - armv6_idcache_wbinv_range, /* idcache_wbinv_range */ + arm11x6_idcache_wbinv_all, /* idcache_wbinv_all */ + arm11x6_idcache_wbinv_range, /* idcache_wbinv_range */ - (void*)cpufunc_nullop, /* l2cache_wbinv_all */ + (void *)cpufunc_nullop, /* l2cache_wbinv_all */ (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ /* Other functions */ - cpufunc_nullop, /* flush_prefetchbuf */ + arm11x6_flush_prefetchbuf, /* flush_prefetchbuf */ arm11_drain_writebuf, /* drain_writebuf */ cpufunc_nullop, /* flush_brnchtgt_C */ (void *)cpufunc_nullop, /* flush_brnchtgt_E */ - arm11_sleep, /* sleep */ + arm11_sleep, /* sleep */ + + /* Soft functions */ + + cpufunc_null_fixup, /* dataabt_fixup */ + cpufunc_null_fixup, /* prefetchabt_fixup */ + + arm11_context_switch, /* context_switch */ + + arm11x6_setup /* cpu setup */ +}; +#endif /* CPU_ARM1136 */ +#if defined(CPU_ARM1176) +struct cpu_functions arm1176_cpufuncs = { + /* CPU functions */ + + cpufunc_id, /* id */ + cpufunc_nullop, /* cpwait */ + + /* MMU functions */ + + cpufunc_control, /* control */ + cpufunc_domains, /* Domain */ + arm11x6_setttb, /* Setttb */ + cpufunc_faultstatus, /* Faultstatus */ + cpufunc_faultaddress, /* Faultaddress */ + + /* TLB functions */ + + arm11_tlb_flushID, /* tlb_flushID */ + arm11_tlb_flushID_SE, /* tlb_flushID_SE */ + arm11_tlb_flushI, /* tlb_flushI */ + arm11_tlb_flushI_SE, /* tlb_flushI_SE */ + arm11_tlb_flushD, /* tlb_flushD */ + arm11_tlb_flushD_SE, /* tlb_flushD_SE */ + + /* Cache operations */ + + arm11x6_icache_sync_all, /* icache_sync_all */ + arm11x6_icache_sync_range, /* icache_sync_range */ + + arm11x6_dcache_wbinv_all, /* dcache_wbinv_all */ + armv6_dcache_wbinv_range, /* dcache_wbinv_range */ + armv6_dcache_inv_range, /* dcache_inv_range */ + armv6_dcache_wb_range, /* dcache_wb_range */ + + arm11x6_idcache_wbinv_all, /* idcache_wbinv_all */ + arm11x6_idcache_wbinv_range, /* idcache_wbinv_range */ + + (void *)cpufunc_nullop, /* l2cache_wbinv_all */ + (void *)cpufunc_nullop, /* l2cache_wbinv_range */ + (void *)cpufunc_nullop, /* l2cache_inv_range */ + (void *)cpufunc_nullop, /* l2cache_wb_range */ + + /* Other functions */ + + arm11x6_flush_prefetchbuf, /* flush_prefetchbuf */ + arm11_drain_writebuf, /* drain_writebuf */ + cpufunc_nullop, /* flush_brnchtgt_C */ + (void *)cpufunc_nullop, /* flush_brnchtgt_E */ + + arm11x6_sleep, /* sleep */ /* Soft functions */ @@ -1032,9 +1093,9 @@ struct cpu_functions arm11_cpufuncs = { arm11_context_switch, /* context_switch */ - arm11_setup /* cpu setup */ + arm11x6_setup /* cpu setup */ }; -#endif /* CPU_ARM11 */ +#endif /*CPU_ARM1176 */ #if defined(CPU_CORTEXA) struct cpu_functions cortexa_cpufuncs = { @@ -1111,8 +1172,8 @@ u_int cputype; u_int cpu_reset_needs_v4_MMU_disable; /* flag used in locore.s */ #if defined(CPU_ARM7TDMI) || defined(CPU_ARM8) || defined(CPU_ARM9) || \ - defined (CPU_ARM9E) || defined (CPU_ARM10) || defined (CPU_ARM11) || \ - defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ + defined (CPU_ARM9E) || defined (CPU_ARM10) || defined (CPU_ARM1136) || \ + defined(CPU_ARM1176) || defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \ defined(CPU_FA526) || defined(CPU_FA626TE) || defined(CPU_MV_PJ4B) || \ defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) || \ @@ -1393,15 +1454,27 @@ set_cpufuncs() goto out; } #endif /* CPU_ARM10 */ -#ifdef CPU_ARM11 - cpufuncs = arm11_cpufuncs; - cpu_reset_needs_v4_MMU_disable = 1; /* V4 or higher */ - get_cachetype_cp15(); - - pmap_pte_init_mmu_v6(); +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) + if (cputype == CPU_ID_ARM1136JS + || cputype == CPU_ID_ARM1136JSR1 + || cputype == CPU_ID_ARM1176JZS) { +#ifdef CPU_ARM1136 + if (cputype == CPU_ID_ARM1136JS + || cputype == CPU_ID_ARM1136JSR1) + cpufuncs = arm1136_cpufuncs; +#endif +#ifdef CPU_ARM1176 + if (cputype == CPU_ID_ARM1176JZS) + cpufuncs = arm1176_cpufuncs; +#endif + cpu_reset_needs_v4_MMU_disable = 1; /* V4 or higher */ + get_cachetype_cp15(); + + pmap_pte_init_mmu_v6(); - goto out; -#endif /* CPU_ARM11 */ + goto out; + } +#endif /* CPU_ARM1136 || CPU_ARM1176 */ #ifdef CPU_CORTEXA if (cputype == CPU_ID_CORTEXA8R1 || cputype == CPU_ID_CORTEXA8R2 || @@ -1962,7 +2035,7 @@ late_abort_fixup(arg) defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \ defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) || \ - defined(CPU_ARM10) || defined(CPU_ARM11) || \ + defined(CPU_ARM10) || defined(CPU_ARM1136) || defined(CPU_ARM1176) ||\ defined(CPU_FA526) || defined(CPU_FA626TE) #define IGN 0 @@ -2262,7 +2335,7 @@ arm10_setup(args) } #endif /* CPU_ARM9E || CPU_ARM10 */ -#ifdef CPU_ARM11 +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) struct cpu_option arm11_options[] = { { "cpu.cache", BIC, OR, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) }, { "cpu.nocache", OR, BIC, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) }, @@ -2273,41 +2346,100 @@ struct cpu_option arm11_options[] = { }; void -arm11_setup(args) - char *args; +arm11x6_setup(char *args) { - int cpuctrl; + int cpuctrl, cpuctrl_wax; + uint32_t auxctrl, auxctrl_wax; + uint32_t tmp, tmp2; + uint32_t sbz=0; + uint32_t cpuid; + + cpuid = cpufunc_id(); + + cpuctrl = + CPU_CONTROL_MMU_ENABLE | + CPU_CONTROL_DC_ENABLE | + CPU_CONTROL_WBUF_ENABLE | + CPU_CONTROL_32BP_ENABLE | + CPU_CONTROL_32BD_ENABLE | + CPU_CONTROL_LABT_ENABLE | + CPU_CONTROL_SYST_ENABLE | + CPU_CONTROL_IC_ENABLE; + + /* + * "write as existing" bits + * inverse of this is mask + */ + cpuctrl_wax = + (3 << 30) | /* SBZ */ + (1 << 29) | /* FA */ + (1 << 28) | /* TR */ + (3 << 26) | /* SBZ */ + (3 << 19) | /* SBZ */ + (1 << 17); /* SBZ */ + + cpuctrl |= CPU_CONTROL_BPRD_ENABLE; + cpuctrl |= CPU_CONTROL_V6_EXTPAGE; - cpuctrl = CPU_CONTROL_MMU_ENABLE; -#ifndef ARM32_DISABLE_ALIGNMENT_FAULTS - cpuctrl |= CPU_CONTROL_AFLT_ENABLE; -#endif - cpuctrl |= CPU_CONTROL_DC_ENABLE; - cpuctrl |= (0xf << 3); cpuctrl = parse_cpu_options(args, arm11_options, cpuctrl); + #ifdef __ARMEB__ cpuctrl |= CPU_CONTROL_BEND_ENABLE; #endif - cpuctrl |= CPU_CONTROL_SYST_ENABLE; - cpuctrl |= CPU_CONTROL_BPRD_ENABLE; - cpuctrl |= CPU_CONTROL_IC_ENABLE; + if (vector_page == ARM_VECTORS_HIGH) cpuctrl |= CPU_CONTROL_VECRELOC; - cpuctrl |= (0x5 << 16); - cpuctrl |= CPU_CONTROL_V6_EXTPAGE; - /* Make sure caches are clean. */ + auxctrl = 0; + auxctrl_wax = ~0; + /* + * This options enables the workaround for the 364296 ARM1136 + * r0pX errata (possible cache data corruption with + * hit-under-miss enabled). It sets the undocumented bit 31 in + * the auxiliary control register and the FI bit in the control + * register, thus disabling hit-under-miss without putting the + * processor into full low interrupt latency mode. ARM11MPCore + * is not affected. + */ + if ((cpuid & CPU_ID_CPU_MASK) == CPU_ID_ARM1136JS) { /* ARM1136JSr0pX */ + cpuctrl |= CPU_CONTROL_FI_ENABLE; + auxctrl = ARM1136_AUXCTL_PFI; + auxctrl_wax = ~ARM1136_AUXCTL_PFI; + } + + /* + * Enable an errata workaround + */ + if ((cpuid & CPU_ID_CPU_MASK) == CPU_ID_ARM1176JZS) { /* ARM1176JZSr0 */ + auxctrl = ARM1176_AUXCTL_PHD; + auxctrl_wax = ~ARM1176_AUXCTL_PHD; + } + + /* Clear out the cache */ cpu_idcache_wbinv_all(); - cpu_l2cache_wbinv_all(); + + /* Now really make sure they are clean. */ + __asm volatile ("mcr\tp15, 0, %0, c7, c7, 0" : : "r"(sbz)); + + /* Allow detection code to find the VFP if it's fitted. */ + __asm volatile ("mcr\tp15, 0, %0, c1, c0, 2" : : "r" (0x0fffffff)); /* Set the control register */ ctrl = cpuctrl; - cpu_control(0xffffffff, cpuctrl); + cpu_control(~cpuctrl_wax, cpuctrl); + __asm volatile ("mrc p15, 0, %0, c1, c0, 1\n\t" + "and %1, %0, %2\n\t" + "orr %1, %1, %3\n\t" + "teq %0, %1\n\t" + "mcrne p15, 0, %1, c1, c0, 1\n\t" + : "=r"(tmp), "=r"(tmp2) : + "r"(auxctrl_wax), "r"(auxctrl)); + + /* And again. */ cpu_idcache_wbinv_all(); - cpu_l2cache_wbinv_all(); } -#endif /* CPU_ARM11 */ +#endif /* CPU_ARM1136 || CPU_ARM1176 */ #ifdef CPU_MV_PJ4B void Added: head/sys/arm/arm/cpufunc_asm_arm11x6.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/arm/cpufunc_asm_arm11x6.S Thu Dec 20 04:32:02 2012 (r244480) @@ -0,0 +1,216 @@ +/* $NetBSD: cpufunc_asm_arm11x6.S,v 1.1 2012/07/21 12:19:15 skrll Exp $ */ + +/* + * Copyright (c) 2007 Microsoft + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Microsoft + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 CONTRIBUTERS 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. + */ + +/*- + * Copyright (c) 2012 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Eben Upton + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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$"); + +#if 0 +#define Invalidate_I_cache(Rtmp1, Rtmp2) \ + mcr p15, 0, Rtmp1, c7, c5, 0 /* Invalidate Entire I cache */ +#else +/* + * Workaround for + * + * Erratum 411920 in ARM1136 (fixed in r1p4) + * Erratum 415045 in ARM1176 (fixed in r0p5?) + * + * - value of arg 'reg' Should Be Zero + */ +#define Invalidate_I_cache(Rtmp1, Rtmp2) \ + mov Rtmp1, #0; /* SBZ */ \ + mrs Rtmp2, cpsr; \ + cpsid ifa; \ + mcr p15, 0, Rtmp1, c7, c5, 0; /* Nuke Whole Icache */ \ + mcr p15, 0, Rtmp1, c7, c5, 0; /* Nuke Whole Icache */ \ + mcr p15, 0, Rtmp1, c7, c5, 0; /* Nuke Whole Icache */ \ + mcr p15, 0, Rtmp1, c7, c5, 0; /* Nuke Whole Icache */ \ + msr cpsr_cx, Rtmp2; \ + nop; \ + nop; \ + nop; \ + nop; \ + nop; \ + nop; \ + nop; \ + nop; \ + nop; \ + nop; \ + nop; +#endif + +#if 1 +#define Flush_D_cache(reg) \ + mov reg, #0; /* SBZ */ \ + mcr p15, 0, reg, c7, c14, 0;/* Clean and Invalidate Entire Data Cache */ \ + mcr p15, 0, reg, c7, c10, 4;/* Data Synchronization Barrier */ +#else +#define Flush_D_cache(reg) \ +1: mov reg, #0; /* SBZ */ \ + mcr p15, 0, reg, c7, c14, 0;/* Clean and Invalidate Entire Data Cache */ \ + mrc p15, 0, reg, C7, C10, 6;/* Read Cache Dirty Status Register */ \ + ands reg, reg, #01; /* Check if it is clean */ \ + bne 1b; /* loop if not */ \ + mcr p15, 0, reg, c7, c10, 4;/* Data Synchronization Barrier */ +#endif + +ENTRY(arm11x6_setttb) +#ifdef PMAP_CACHE_VIVT + Flush_D_cache(r1) + Invalidate_I_cache(r1, r2) +#else + mov r1, #0 +#endif + mcr p15, 0, r0, c2, c0, 0 /* load new TTB */ + mcr p15, 0, r1, c8, c7, 0 /* invalidate I+D TLBs */ + mcr p15, 0, r1, c7, c10, 4 /* drain write buffer */ + RET + +ENTRY_NP(arm11x6_idcache_wbinv_all) + Flush_D_cache(r0) + Invalidate_I_cache(r0, r1) + RET + +ENTRY_NP(arm11x6_dcache_wbinv_all) + Flush_D_cache(r0) + RET + +ENTRY_NP(arm11x6_icache_sync_all) + Flush_D_cache(r0) + Invalidate_I_cache(r0, r1) + RET + +ENTRY_NP(arm11x6_flush_prefetchbuf) + mcr p15, 0, r0, c7, c5, 4 /* Flush Prefetch Buffer */ + RET + +ENTRY_NP(arm11x6_icache_sync_range) + add r1, r1, r0 + sub r1, r1, #1 + /* Erratum ARM1136 371025, workaround #2 */ + /* Erratum ARM1176 371367 */ + mrs r2, cpsr /* save the CPSR */ + cpsid ifa /* disable interrupts (irq,fiq,abort) */ + mov r3, #0 + mcr p15, 0, r3, c13, c0, 0 /* write FCSE (uTLB invalidate) */ + mcr p15, 0, r3, c7, c5, 4 /* flush prefetch buffer */ + add r3, pc, #0x24 + mcr p15, 0, r3, c7, c13, 1 /* prefetch I-cache line */ + mcrr p15, 0, r1, r0, c5 /* invalidate I-cache range */ + msr cpsr_cx, r2 /* local_irq_restore */ + nop + nop + nop + nop + nop + nop + nop + + mcrr p15, 0, r1, r0, c12 /* clean and invalidate D cache range */ /* XXXNH */ + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + RET + +ENTRY_NP(arm11x6_idcache_wbinv_range) + add r1, r1, r0 + sub r1, r1, #1 + /* Erratum ARM1136 371025, workaround #2 */ + /* Erratum ARM1176 371367 */ + mrs r2, cpsr /* save the CPSR */ + cpsid ifa /* disable interrupts (irq,fiq,abort) */ + mov r3, #0 + mcr p15, 0, r3, c13, c0, 0 /* write FCSE (uTLB invalidate) */ + mcr p15, 0, r3, c7, c5, 4 /* flush prefetch buffer */ + add r3, pc, #0x24 + mcr p15, 0, r3, c7, c13, 1 /* prefetch I-cache line */ + mcrr p15, 0, r1, r0, c5 /* invalidate I-cache range */ + msr cpsr_cx, r2 /* local_irq_restore */ + nop + nop + nop + nop + nop + nop + nop + + mcrr p15, 0, r1, r0, c14 /* clean and invalidate D cache range */ + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + RET + +/* + * Preload the cache before issuing the WFI by conditionally disabling the + * mcr intstructions the first time around the loop. Ensure the function is + * cacheline aligned. + */ + .arch armv6 + .p2align 5 + +ENTRY_NP(arm11x6_sleep) + mov r0, #0 + mov r1, #2 +1: + subs r1, #1 + nop + mcreq p15, 0, r0, c7, c10, 4 /* data sync barrier */ + mcreq p15, 0, r0, c7, c0, 4 /* wait for interrupt */ + nop + nop + nop + bne 1b + RET Modified: head/sys/arm/arm/elf_trampoline.c ============================================================================== --- head/sys/arm/arm/elf_trampoline.c Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/arm/elf_trampoline.c Thu Dec 20 04:32:02 2012 (r244480) @@ -63,7 +63,7 @@ void __startC(void); #define cpu_idcache_wbinv_all armv5_ec_idcache_wbinv_all #elif defined(CPU_ARM10) #define cpu_idcache_wbinv_all arm10_idcache_wbinv_all -#elif defined(CPU_ARM11) +#elif defined(CPU_ARM1136) || defined(CPU_ARM1176) #define cpu_idcache_wbinv_all armv6_idcache_wbinv_all #elif defined(CPU_SA110) || defined(CPU_SA1110) || defined(CPU_SA1100) || \ defined(CPU_IXP12X0) Modified: head/sys/arm/arm/identcpu.c ============================================================================== --- head/sys/arm/arm/identcpu.c Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/arm/identcpu.c Thu Dec 20 04:32:02 2012 (r244480) @@ -307,6 +307,8 @@ const struct cpuidtab cpuids[] = { generic_steppings }, { CPU_ID_ARM1136JSR1, CPU_CLASS_ARM11J, "ARM1136J-S R1", generic_steppings }, + { CPU_ID_ARM1176JZS, CPU_CLASS_ARM11J, "ARM1176JZ-S", + generic_steppings }, { CPU_ID_MV88FR131, CPU_CLASS_MARVELL, "Feroceon 88FR131", generic_steppings }, Modified: head/sys/arm/arm/locore.S ============================================================================== --- head/sys/arm/arm/locore.S Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/arm/locore.S Thu Dec 20 04:32:02 2012 (r244480) @@ -168,7 +168,7 @@ Lunmapped: mcr p15, 0, r0, c2, c0, 0 /* Set TTB */ mcr p15, 0, r0, c8, c7, 0 /* Flush TLB */ -#if defined(CPU_ARM11) || defined(CPU_CORTEXA) || defined(CPU_MV_PJ4B) +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) || defined(CPU_CORTEXA) || defined(CPU_MV_PJ4B) mov r0, #0 mcr p15, 0, r0, c13, c0, 1 /* Set ASID to 0 */ #endif @@ -178,7 +178,7 @@ Lunmapped: mcr p15, 0, r0, c3, c0, 0 /* Enable MMU */ mrc p15, 0, r0, c1, c0, 0 -#if defined(CPU_ARM11) || defined(CPU_CORTEXA) || defined(CPU_MV_PJ4B) +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) || defined(CPU_CORTEXA) || defined(CPU_MV_PJ4B) orr r0, r0, #CPU_CONTROL_V6_EXTPAGE #endif orr r0, r0, #(CPU_CONTROL_MMU_ENABLE) @@ -363,7 +363,7 @@ Ltag: mcr p15, 0, r0, c2, c0, 0 /* Set TTB */ mcr p15, 0, r0, c8, c7, 0 /* Flush TLB */ -#if defined(CPU_ARM11) || defined(CPU_MV_PJ4B) || defined(CPU_CORTEXA) +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) || defined(CPU_MV_PJ4B) || defined(CPU_CORTEXA) mov r0, #0 mcr p15, 0, r0, c13, c0, 1 /* Set ASID to 0 */ #endif @@ -375,7 +375,7 @@ Ltag: mcr p15, 0, r0, c3, c0, 0 /* Enable MMU */ mrc p15, 0, r0, c1, c0, 0 -#if defined(CPU_ARM11) || defined(CPU_MV_PJ4B) || defined(CPU_CORTEXA) +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) || defined(CPU_MV_PJ4B) || defined(CPU_CORTEXA) orr r0, r0, #CPU_CONTROL_V6_EXTPAGE #endif orr r0, r0, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE) Modified: head/sys/arm/broadcom/bcm2835/files.bcm2835 ============================================================================== --- head/sys/arm/broadcom/bcm2835/files.bcm2835 Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/broadcom/bcm2835/files.bcm2835 Thu Dec 20 04:32:02 2012 (r244480) @@ -15,6 +15,7 @@ arm/broadcom/bcm2835/dwc_otg_brcm.c opt arm/arm/bus_space_generic.c standard arm/arm/bus_space_asm_generic.S standard arm/arm/cpufunc_asm_arm11.S standard +arm/arm/cpufunc_asm_arm11x6.S standard arm/arm/cpufunc_asm_armv5.S standard arm/arm/cpufunc_asm_armv6.S standard arm/arm/irq_dispatch.S standard Modified: head/sys/arm/conf/RPI-B ============================================================================== --- head/sys/arm/conf/RPI-B Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/conf/RPI-B Thu Dec 20 04:32:02 2012 (r244480) @@ -19,7 +19,7 @@ ident RPI-B machine arm armv6 -cpu CPU_ARM11 +cpu CPU_ARM1176 files "../broadcom/bcm2835/files.bcm2835" makeoptions MODULES_OVERRIDE="" Modified: head/sys/arm/conf/VERSATILEPB ============================================================================== --- head/sys/arm/conf/VERSATILEPB Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/conf/VERSATILEPB Thu Dec 20 04:32:02 2012 (r244480) @@ -19,7 +19,7 @@ ident VERSATILEPB machine arm armv6 -cpu CPU_ARM11 +cpu CPU_ARM1176 files "../versatile/files.versatile" makeoptions MODULES_OVERRIDE="" Modified: head/sys/arm/include/armreg.h ============================================================================== --- head/sys/arm/include/armreg.h Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/include/armreg.h Thu Dec 20 04:32:02 2012 (r244480) @@ -146,6 +146,7 @@ #define CPU_ID_ARM1026EJS 0x4106a260 #define CPU_ID_ARM1136JS 0x4107b360 #define CPU_ID_ARM1136JSR1 0x4117b360 +#define CPU_ID_ARM1176JZS 0x410fb760 #define CPU_ID_CORTEXA8R1 0x411fc080 #define CPU_ID_CORTEXA8R2 0x412fc080 #define CPU_ID_CORTEXA8R3 0x413fc080 @@ -284,11 +285,36 @@ #define CPU_CONTROL_VECRELOC 0x00002000 /* V: Vector relocation */ #define CPU_CONTROL_ROUNDROBIN 0x00004000 /* RR: Predictable replacement */ #define CPU_CONTROL_V4COMPAT 0x00008000 /* L4: ARMv4 compat LDR R15 etc */ +#define CPU_CONTROL_FI_ENABLE 0x00200000 /* FI: Low interrupt latency */ +#define CPU_CONTROL_UNAL_ENABLE 0x00400000 /* U: unaligned data access */ #define CPU_CONTROL_V6_EXTPAGE 0x00800000 /* XP: ARMv6 extended page tables */ #define CPU_CONTROL_L2_ENABLE 0x04000000 /* L2 Cache enabled */ #define CPU_CONTROL_IDC_ENABLE CPU_CONTROL_DC_ENABLE +/* ARM11x6 Auxiliary Control Register (CP15 register 1, opcode2 1) */ +#define ARM11X6_AUXCTL_RS 0x00000001 /* return stack */ +#define ARM11X6_AUXCTL_DB 0x00000002 /* dynamic branch prediction */ +#define ARM11X6_AUXCTL_SB 0x00000004 /* static branch prediction */ +#define ARM11X6_AUXCTL_TR 0x00000008 /* MicroTLB replacement strat. */ +#define ARM11X6_AUXCTL_EX 0x00000010 /* exclusive L1/L2 cache */ +#define ARM11X6_AUXCTL_RA 0x00000020 /* clean entire cache disable */ +#define ARM11X6_AUXCTL_RV 0x00000040 /* block transfer cache disable */ +#define ARM11X6_AUXCTL_CZ 0x00000080 /* restrict cache size */ + +/* ARM1136 Auxiliary Control Register (CP15 register 1, opcode2 1) */ +#define ARM1136_AUXCTL_PFI 0x80000000 /* PFI: partial FI mode. */ + /* This is an undocumented flag + * used to work around a cache bug + * in r0 steppings. See errata + * 364296. + */ +/* ARM1176 Auxiliary Control Register (CP15 register 1, opcode2 1) */ +#define ARM1176_AUXCTL_PHD 0x10000000 /* inst. prefetch halting disable */ +#define ARM1176_AUXCTL_BFD 0x20000000 /* branch folding disable */ +#define ARM1176_AUXCTL_FSD 0x40000000 /* force speculative ops disable */ +#define ARM1176_AUXCTL_FIO 0x80000000 /* low intr latency override */ + /* XScale Auxillary Control Register (CP15 register 1, opcode2 1) */ #define XSCALE_AUXCTL_K 0x00000001 /* dis. write buffer coalescing */ #define XSCALE_AUXCTL_P 0x00000002 /* ECC protect page table access */ Modified: head/sys/arm/include/cpuconf.h ============================================================================== --- head/sys/arm/include/cpuconf.h Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/include/cpuconf.h Thu Dec 20 04:32:02 2012 (r244480) @@ -54,7 +54,8 @@ defined(CPU_ARM8) + defined(CPU_ARM9) + \ defined(CPU_ARM9E) + \ defined(CPU_ARM10) + \ - defined(CPU_ARM11) + \ + defined(CPU_ARM1136) + \ + defined(CPU_ARM1176) + \ defined(CPU_SA110) + defined(CPU_SA1100) + \ defined(CPU_SA1110) + \ defined(CPU_IXP12X0) + \ @@ -89,7 +90,7 @@ #endif #if !defined(ARM_ARCH_6) -#if defined(CPU_ARM11) || defined(CPU_MV_PJ4B) +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) || defined(CPU_MV_PJ4B) #define ARM_ARCH_6 1 #else #define ARM_ARCH_6 0 @@ -149,7 +150,7 @@ #define ARM_MMU_GENERIC 0 #endif -#if defined(CPU_ARM11) || defined(CPU_MV_PJ4B) +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) || defined(CPU_MV_PJ4B) #define ARM_MMU_V6 1 #else #define ARM_MMU_V6 0 Modified: head/sys/arm/include/cpufunc.h ============================================================================== --- head/sys/arm/include/cpufunc.h Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/include/cpufunc.h Thu Dec 20 04:32:02 2012 (r244480) @@ -462,7 +462,8 @@ void sheeva_l2cache_wb_range (vm_offset void sheeva_l2cache_wbinv_all (void); #endif -#if defined(CPU_ARM11) || defined(CPU_MV_PJ4B) || defined(CPU_CORTEXA) +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) || \ + defined(CPU_MV_PJ4B) || defined(CPU_CORTEXA) void arm11_setttb (u_int); void arm11_sleep (int); @@ -532,6 +533,21 @@ void armadaxp_idcache_wbinv_all (void); void cortexa_setup (char *); #endif +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) +void arm11x6_setttb (u_int); +void arm11x6_idcache_wbinv_all (void); +void arm11x6_dcache_wbinv_all (void); +void arm11x6_icache_sync_all (void); +void arm11x6_flush_prefetchbuf (void); +void arm11x6_icache_sync_range (vm_offset_t, vm_size_t); +void arm11x6_idcache_wbinv_range (vm_offset_t, vm_size_t); +void arm11x6_setup (char *string); +void arm11x6_sleep (int); /* no ref. for errata */ +#endif +#if defined(CPU_ARM1136) +void arm1136_sleep_rev0 (int); /* for errata 336501 */ +#endif + #if defined(CPU_ARM9E) || defined (CPU_ARM10) void armv5_ec_setttb(u_int); Modified: head/sys/arm/include/intr.h ============================================================================== --- head/sys/arm/include/intr.h Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/include/intr.h Thu Dec 20 04:32:02 2012 (r244480) @@ -52,7 +52,7 @@ #define NIRQ 64 #elif defined(CPU_CORTEXA) #define NIRQ 128 -#elif defined(CPU_ARM11) +#elif defined(CPU_ARM1136) || defined(CPU_ARM1176) #define NIRQ 128 #elif defined(SOC_MV_ARMADAXP) #define MAIN_IRQ_NUM 116 Modified: head/sys/arm/versatile/files.versatile ============================================================================== --- head/sys/arm/versatile/files.versatile Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/arm/versatile/files.versatile Thu Dec 20 04:32:02 2012 (r244480) @@ -3,6 +3,7 @@ arm/arm/bus_space_asm_generic.S standard arm/arm/bus_space_generic.c standard arm/arm/cpufunc_asm_arm11.S standard +arm/arm/cpufunc_asm_arm11x6.S standard arm/arm/cpufunc_asm_armv5.S standard arm/arm/cpufunc_asm_armv6.S standard arm/arm/irq_dispatch.S standard Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/conf/files.arm Thu Dec 20 04:32:02 2012 (r244480) @@ -6,7 +6,7 @@ arm/arm/blockio.S standard arm/arm/bootconfig.c standard arm/arm/bus_space_asm_generic.S standard arm/arm/busdma_machdep.c optional cpu_arm9 | cpu_arm9e | cpu_fa526 | cpu_sa1100 | cpu_sa1110 | cpu_xscale_80219 | cpu_xscale_80321 | cpu_xscale_81342 | cpu_xscale_ixp425 | cpu_xscale_ixp435 | cpu_xscale_pxa2x0 -arm/arm/busdma_machdep-v6.c optional cpu_arm11 | cpu_cortexa | cpu_mv_pj4b +arm/arm/busdma_machdep-v6.c optional cpu_arm1136 | cpu_arm1176 | cpu_cortexa | cpu_mv_pj4b arm/arm/copystr.S standard arm/arm/cpufunc.c standard arm/arm/cpufunc_asm.S standard @@ -35,7 +35,7 @@ arm/arm/nexus.c standard arm/arm/pl190.c optional pl190 arm/arm/pl310.c optional pl310 arm/arm/pmap.c optional cpu_arm9 | cpu_arm9e | cpu_fa526 | cpu_sa1100 | cpu_sa1110 | cpu_xscale_80219 | cpu_xscale_80321 | cpu_xscale_81342 | cpu_xscale_ixp425 | cpu_xscale_ixp435 | cpu_xscale_pxa2x0 -arm/arm/pmap-v6.c optional cpu_arm11 | cpu_cortexa | cpu_mv_pj4b +arm/arm/pmap-v6.c optional cpu_arm1136 | cpu_arm1176 | cpu_cortexa | cpu_mv_pj4b arm/arm/sc_machdep.c optional sc arm/arm/setcpsr.S standard arm/arm/setstack.s standard Modified: head/sys/conf/options.arm ============================================================================== --- head/sys/conf/options.arm Thu Dec 20 04:16:25 2012 (r244479) +++ head/sys/conf/options.arm Thu Dec 20 04:32:02 2012 (r244480) @@ -11,7 +11,8 @@ ARM_WANT_TP_ADDRESS opt_global.h COUNTS_PER_SEC opt_timer.h CPU_ARM9 opt_global.h CPU_ARM9E opt_global.h -CPU_ARM11 opt_global.h +CPU_ARM1136 opt_global.h +CPU_ARM1176 opt_global.h CPU_CORTEXA opt_global.h CPU_FA526 opt_global.h CPU_FA626TE opt_global.h From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 04:47:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6EDD8631; Thu, 20 Dec 2012 04:47:32 +0000 (UTC) (envelope-from yongari@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 52BDD8FC0C; Thu, 20 Dec 2012 04:47:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK4lWmO071455; Thu, 20 Dec 2012 04:47:32 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK4lWMg071454; Thu, 20 Dec 2012 04:47:32 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201212200447.qBK4lWMg071454@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 20 Dec 2012 04:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244481 - head/sys/dev/mii X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 04:47:32 -0000 Author: yongari Date: Thu Dec 20 04:47:31 2012 New Revision: 244481 URL: http://svnweb.freebsd.org/changeset/base/244481 Log: For fiber PHYs, BRGPHY_MII_1000CTL register is not defined at all so do not touch it. Modified: head/sys/dev/mii/brgphy.c Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Thu Dec 20 04:32:02 2012 (r244480) +++ head/sys/dev/mii/brgphy.c Thu Dec 20 04:47:31 2012 (r244481) @@ -608,6 +608,11 @@ brgphy_mii_phy_auto(struct mii_softc *sc (sc->mii_flags & MIIF_FORCEPAUSE) != 0) anar |= BRGPHY_ANAR_PC | BRGPHY_ANAR_ASP; PHY_WRITE(sc, BRGPHY_MII_ANAR, anar); + ktcr = BRGPHY_1000CTL_AFD | BRGPHY_1000CTL_AHD; + if (sc->mii_mpd_model == MII_MODEL_BROADCOM_BCM5701) + ktcr |= BRGPHY_1000CTL_MSE | BRGPHY_1000CTL_MSC; + PHY_WRITE(sc, BRGPHY_MII_1000CTL, ktcr); + PHY_READ(sc, BRGPHY_MII_1000CTL); } else { anar = BRGPHY_SERDES_ANAR_FDX | BRGPHY_SERDES_ANAR_HDX; if ((media & IFM_FLOW) != 0 || @@ -616,12 +621,6 @@ brgphy_mii_phy_auto(struct mii_softc *sc PHY_WRITE(sc, BRGPHY_SERDES_ANAR, anar); } - ktcr = BRGPHY_1000CTL_AFD | BRGPHY_1000CTL_AHD; - if (sc->mii_mpd_model == MII_MODEL_BROADCOM_BCM5701) - ktcr |= BRGPHY_1000CTL_MSE | BRGPHY_1000CTL_MSC; - PHY_WRITE(sc, BRGPHY_MII_1000CTL, ktcr); - ktcr = PHY_READ(sc, BRGPHY_MII_1000CTL); - PHY_WRITE(sc, BRGPHY_MII_BMCR, BRGPHY_BMCR_AUTOEN | BRGPHY_BMCR_STARTNEG); PHY_WRITE(sc, BRGPHY_MII_IMR, 0xFF00); From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 05:02:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E7EEA7F7; Thu, 20 Dec 2012 05:02:13 +0000 (UTC) (envelope-from yongari@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 B31458FC13; Thu, 20 Dec 2012 05:02:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBK52Dv2073648; Thu, 20 Dec 2012 05:02:13 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBK52Dj6073645; Thu, 20 Dec 2012 05:02:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201212200502.qBK52Dj6073645@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 20 Dec 2012 05:02:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244482 - head/sys/dev/mii X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 05:02:14 -0000 Author: yongari Date: Thu Dec 20 05:02:12 2012 New Revision: 244482 URL: http://svnweb.freebsd.org/changeset/base/244482 Log: Recognize 5720S PHY and treat it as 5708S PHY. Unfortunately 5720S uses 5709S PHY id so add a hack to detect 5720S PHY by checking parent device name. 5720S PHY does not support 2500SX. Tested by: Geans Pin < geanspin <> broadcom dot com > Modified: head/sys/dev/mii/brgphy.c head/sys/dev/mii/miidevs Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Thu Dec 20 04:47:31 2012 (r244481) +++ head/sys/dev/mii/brgphy.c Thu Dec 20 05:02:12 2012 (r244482) @@ -204,6 +204,13 @@ brgphy_attach(device_t dev) &brgphy_funcs, 0); bsc->serdes_flags = 0; + ifp = sc->mii_pdata->mii_ifp; + + /* Find the MAC driver associated with this PHY. */ + if (strcmp(ifp->if_dname, "bge") == 0) + bge_sc = ifp->if_softc; + else if (strcmp(ifp->if_dname, "bce") == 0) + bce_sc = ifp->if_softc; /* Handle any special cases based on the PHY ID */ switch (sc->mii_mpd_oui) { @@ -235,22 +242,21 @@ brgphy_attach(device_t dev) sc->mii_flags |= MIIF_HAVEFIBER; break; case MII_MODEL_BROADCOM2_BCM5709S: - bsc->serdes_flags |= BRGPHY_5709S; + /* + * XXX + * 5720S and 5709S shares the same PHY id. + * Assume 5720S PHY if parent device is bge(4). + */ + if (bge_sc != NULL) + bsc->serdes_flags |= BRGPHY_5708S; + else + bsc->serdes_flags |= BRGPHY_5709S; sc->mii_flags |= MIIF_HAVEFIBER; break; } break; } - ifp = sc->mii_pdata->mii_ifp; - - /* Find the MAC driver associated with this PHY. */ - if (strcmp(ifp->if_dname, "bge") == 0) { - bge_sc = ifp->if_softc; - } else if (strcmp(ifp->if_dname, "bce") == 0) { - bce_sc = ifp->if_softc; - } - PHY_RESET(sc); /* Read the PHY's capabilities. */ Modified: head/sys/dev/mii/miidevs ============================================================================== --- head/sys/dev/mii/miidevs Thu Dec 20 04:47:31 2012 (r244481) +++ head/sys/dev/mii/miidevs Thu Dec 20 05:02:12 2012 (r244482) @@ -180,7 +180,7 @@ model BROADCOM2 BCM5722 0x002d BCM5722 model BROADCOM2 BCM5784 0x003a BCM5784 10/100/1000baseT PHY model BROADCOM2 BCM5709C 0x003c BCM5709 10/100/1000baseT PHY model BROADCOM2 BCM5761 0x003d BCM5761 10/100/1000baseT PHY -model BROADCOM2 BCM5709S 0x003f BCM5709S 1000/2500baseSX PHY +model BROADCOM2 BCM5709S 0x003f BCM5709S/5720S 1000/2500baseSX PHY model BROADCOM3 BCM57780 0x0019 BCM57780 1000BASE-T media interface model BROADCOM3 BCM5717C 0x0020 BCM5717C 1000BASE-T media interface model BROADCOM3 BCM5719C 0x0022 BCM5719C 1000BASE-T media interface From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 11:10:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0CDC1F47; Thu, 20 Dec 2012 11:10:24 +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 CB0628FC0C; Thu, 20 Dec 2012 11:10:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKBANLr033293; Thu, 20 Dec 2012 11:10:23 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKBAN0S033290; Thu, 20 Dec 2012 11:10:23 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201212201110.qBKBAN0S033290@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 20 Dec 2012 11:10:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244483 - in stable/9/sys: netinet netinet6 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 11:10:24 -0000 Author: ae Date: Thu Dec 20 11:10:23 2012 New Revision: 244483 URL: http://svnweb.freebsd.org/changeset/base/244483 Log: MFC r244360: Use M_PROTO7 flag for M_IP6_NEXTHOP, because M_PROTO2 was used for M_AUTHIPHDR. MFC r244365: Since we use different flags to detect tcp forwarding, and we share the same code for IPv4 and IPv6 in tcp_input, we should check both M_IP_NEXTHOP and M_IP6_NEXTHOP flags. MFC r244386 (by glebius): Clear correct flag in INET6 case. MFC r244387 (by glebius): Fix !INET6 build after r244365. Modified: stable/9/sys/netinet/tcp_input.c stable/9/sys/netinet6/ip6_var.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/tcp_input.c ============================================================================== --- stable/9/sys/netinet/tcp_input.c Thu Dec 20 05:02:12 2012 (r244482) +++ stable/9/sys/netinet/tcp_input.c Thu Dec 20 11:10:23 2012 (r244483) @@ -792,7 +792,17 @@ findpcb: /* * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. */ - if (m->m_flags & M_IP_NEXTHOP) + if ( +#ifdef INET6 + (isipv6 && (m->m_flags & M_IP6_NEXTHOP)) +#ifdef INET + || (!isipv6 && (m->m_flags & M_IP_NEXTHOP)) +#endif +#endif +#if defined(INET) && !defined(INET6) + (m->m_flags & M_IP_NEXTHOP) +#endif + ) fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); #ifdef INET6 @@ -821,7 +831,7 @@ findpcb: } /* Remove the tag from the packet. We don't need it anymore. */ m_tag_delete(m, fwd_tag); - m->m_flags &= ~M_IP_NEXTHOP; + m->m_flags &= ~M_IP6_NEXTHOP; fwd_tag = NULL; } else if (isipv6) { inp = in6_pcblookup_mbuf(&V_tcbinfo, &ip6->ip6_src, Modified: stable/9/sys/netinet6/ip6_var.h ============================================================================== --- stable/9/sys/netinet6/ip6_var.h Thu Dec 20 05:02:12 2012 (r244482) +++ stable/9/sys/netinet6/ip6_var.h Thu Dec 20 11:10:23 2012 (r244483) @@ -285,7 +285,7 @@ struct ip6aux { #define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */ #define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */ -#define M_IP6_NEXTHOP M_PROTO2 /* explicit ip nexthop */ +#define M_IP6_NEXTHOP M_PROTO7 /* explicit ip nexthop */ #ifdef __NO_STRICT_ALIGNMENT #define IP6_HDR_ALIGNED_P(ip) 1 From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 11:39:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D40FF838; Thu, 20 Dec 2012 11:39:20 +0000 (UTC) (envelope-from bapt@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 B87378FC0A; Thu, 20 Dec 2012 11:39:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKBdKkq037446; Thu, 20 Dec 2012 11:39:20 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKBdKB0037445; Thu, 20 Dec 2012 11:39:20 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201212201139.qBKBdKB0037445@svn.freebsd.org> From: Baptiste Daroussin Date: Thu, 20 Dec 2012 11:39:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244484 - head/etc/periodic/daily X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 11:39:20 -0000 Author: bapt Date: Thu Dec 20 11:39:20 2012 New Revision: 244484 URL: http://svnweb.freebsd.org/changeset/base/244484 Log: make installation of the 220.backup-pkgdb periodic script depend on PKGTOOLS knob Modified: head/etc/periodic/daily/Makefile Modified: head/etc/periodic/daily/Makefile ============================================================================== --- head/etc/periodic/daily/Makefile Thu Dec 20 11:10:23 2012 (r244483) +++ head/etc/periodic/daily/Makefile Thu Dec 20 11:39:20 2012 (r244484) @@ -6,7 +6,6 @@ FILES= 100.clean-disks \ 110.clean-tmps \ 120.clean-preserve \ 200.backup-passwd \ - 220.backup-pkgdb \ 330.news \ 400.status-disks \ 405.status-ata-raid \ @@ -41,7 +40,8 @@ FILES+= 480.status-ntpd .endif .if ${MK_PKGTOOLS} != "no" -FILES+= 490.status-pkg-changes +FILES+= 220.backup-pkgdb \ + 490.status-pkg-changes .endif .if ${MK_RCMDS} != "no" From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 16:21:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A32A94B0; Thu, 20 Dec 2012 16:21:03 +0000 (UTC) (envelope-from hselasky@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 6DBB68FC0C; Thu, 20 Dec 2012 16:21:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKGL32u079169; Thu, 20 Dec 2012 16:21:03 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKGL3kp079167; Thu, 20 Dec 2012 16:21:03 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201212201621.qBKGL3kp079167@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 20 Dec 2012 16:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244489 - head/sys/dev/usb/serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 16:21:03 -0000 Author: hselasky Date: Thu Dec 20 16:21:02 2012 New Revision: 244489 URL: http://svnweb.freebsd.org/changeset/base/244489 Log: Make sure we block recursion on TTY's inwakeup callback Suggested by: davide MFC after: 1 week Modified: head/sys/dev/usb/serial/usb_serial.c head/sys/dev/usb/serial/usb_serial.h Modified: head/sys/dev/usb/serial/usb_serial.c ============================================================================== --- head/sys/dev/usb/serial/usb_serial.c Thu Dec 20 13:27:43 2012 (r244488) +++ head/sys/dev/usb/serial/usb_serial.c Thu Dec 20 16:21:02 2012 (r244489) @@ -797,10 +797,14 @@ ucom_inwakeup(struct tty *tp) DPRINTF("tp=%p\n", tp); if (ttydisc_can_bypass(tp) != 0 || - (sc->sc_flag & UCOM_FLAG_HL_READY) == 0) { + (sc->sc_flag & UCOM_FLAG_HL_READY) == 0 || + (sc->sc_flag & UCOM_FLAG_INWAKEUP) != 0) { return; } + /* prevent recursion */ + sc->sc_flag |= UCOM_FLAG_INWAKEUP; + pos = sc->sc_jitterbuf_out; while (sc->sc_jitterbuf_in != pos) { @@ -821,6 +825,8 @@ ucom_inwakeup(struct tty *tp) if ((sc->sc_jitterbuf_in == pos) && (sc->sc_flag & UCOM_FLAG_RTS_IFLOW)) ucom_rts(sc, 0); + + sc->sc_flag &= ~UCOM_FLAG_INWAKEUP; } static int Modified: head/sys/dev/usb/serial/usb_serial.h ============================================================================== --- head/sys/dev/usb/serial/usb_serial.h Thu Dec 20 13:27:43 2012 (r244488) +++ head/sys/dev/usb/serial/usb_serial.h Thu Dec 20 16:21:02 2012 (r244489) @@ -183,6 +183,7 @@ struct ucom_softc { #define UCOM_FLAG_CONSOLE 0x80 /* set if device is a console */ #define UCOM_FLAG_WAIT_REFS 0x0100 /* set if we must wait for refs */ #define UCOM_FLAG_FREE_UNIT 0x0200 /* set if we must free the unit */ +#define UCOM_FLAG_INWAKEUP 0x0400 /* set if we are in the tsw_inwakeup callback */ uint8_t sc_lsr; uint8_t sc_msr; uint8_t sc_mcr; From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 17:14:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F0E90221; Thu, 20 Dec 2012 17:14:10 +0000 (UTC) (envelope-from hselasky@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 BC2608FC0A; Thu, 20 Dec 2012 17:14:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKHEAgX087379; Thu, 20 Dec 2012 17:14:10 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKHEAgv087378; Thu, 20 Dec 2012 17:14:10 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201212201714.qBKHEAgv087378@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 20 Dec 2012 17:14:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244491 - head/sys/dev/usb/storage X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 17:14:11 -0000 Author: hselasky Date: Thu Dec 20 17:14:10 2012 New Revision: 244491 URL: http://svnweb.freebsd.org/changeset/base/244491 Log: Add support for throttling UMASS. Mostly useful for debugging purposes. MFC after: 1 week Modified: head/sys/dev/usb/storage/umass.c Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Thu Dec 20 17:13:01 2012 (r244490) +++ head/sys/dev/usb/storage/umass.c Thu Dec 20 17:14:10 2012 (r244491) @@ -163,12 +163,16 @@ __FBSDID("$FreeBSD$"); #define UDMASS_CBI 0x00400000 /* CBI transfers */ #define UDMASS_WIRE (UDMASS_BBB|UDMASS_CBI) #define UDMASS_ALL 0xffff0000 /* all of the above */ -static int umass_debug = 0; +static int umass_debug; +static int umass_throttle; static SYSCTL_NODE(_hw_usb, OID_AUTO, umass, CTLFLAG_RW, 0, "USB umass"); SYSCTL_INT(_hw_usb_umass, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN, &umass_debug, 0, "umass debug level"); TUNABLE_INT("hw.usb.umass.debug", &umass_debug); +SYSCTL_INT(_hw_usb_umass, OID_AUTO, throttle, CTLFLAG_RW | CTLFLAG_TUN, + &umass_throttle, 0, "Forced delay between commands in milliseconds"); +TUNABLE_INT("hw.usb.umass.throttle", &umass_throttle); #else #define DIF(...) do { } while (0) #define DPRINTF(...) do { } while (0) @@ -881,7 +885,7 @@ umass_attach(device_t dev) struct usb_attach_arg *uaa = device_get_ivars(dev); struct umass_probe_proto temp = umass_probe_proto(dev, uaa); struct usb_interface_descriptor *id; - int32_t err; + int err; /* * NOTE: the softc struct is cleared in device_set_driver. @@ -994,6 +998,24 @@ umass_attach(device_t dev) "transfers, %s\n", usbd_errstr(err)); goto detach; } +#ifdef USB_DEBUG + if (umass_throttle > 0) { + uint8_t x; + int iv; + + iv = umass_throttle; + + if (iv < 1) + iv = 1; + else if (iv > 8000) + iv = 8000; + + for (x = 0; x != UMASS_T_MAX; x++) { + if (sc->sc_xfer[x] != NULL) + usbd_xfer_set_interval(sc->sc_xfer[x], iv); + } + } +#endif sc->sc_transform = (sc->sc_proto & UMASS_PROTO_SCSI) ? &umass_scsi_transform : (sc->sc_proto & UMASS_PROTO_UFI) ? &umass_ufi_transform : From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 17:38:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 94DD2AED; Thu, 20 Dec 2012 17:38:15 +0000 (UTC) (envelope-from eadler@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 5FA588FC12; Thu, 20 Dec 2012 17:38:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKHcFcS090729; Thu, 20 Dec 2012 17:38:15 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKHcEGZ090726; Thu, 20 Dec 2012 17:38:14 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212201738.qBKHcEGZ090726@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 17:38:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244493 - head/usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 17:38:15 -0000 Author: eadler Date: Thu Dec 20 17:38:14 2012 New Revision: 244493 URL: http://svnweb.freebsd.org/changeset/base/244493 Log: Make bsdgrep behave as gnugrep and as documented: -m should only stop reading the specific file, not any file. Tested by: frogs (irc) Reviewed by: gabor Approved by: cperciva (implicit) MFC after: 1 week Modified: head/usr.bin/grep/grep.c head/usr.bin/grep/grep.h head/usr.bin/grep/util.c Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Thu Dec 20 17:23:40 2012 (r244492) +++ head/usr.bin/grep/grep.c Thu Dec 20 17:38:14 2012 (r244493) @@ -108,6 +108,7 @@ bool iflag; /* -i: ignore case */ bool lflag; /* -l: only show names of files with matches */ bool mflag; /* -m x: stop reading the files after x matches */ long long mcount; /* count for -m */ +long long mlimit; /* requested value for -m */ bool nflag; /* -n: show line numbers in front of matching lines */ bool oflag; /* -o: print only matching part */ bool qflag; /* -q: quiet mode (don't output anything) */ @@ -524,7 +525,7 @@ main(int argc, char *argv[]) case 'm': mflag = true; errno = 0; - mcount = strtoll(optarg, &ep, 10); + mlimit = mcount = strtoll(optarg, &ep, 10); if (((errno == ERANGE) && (mcount == LLONG_MAX)) || ((errno == EINVAL) && (mcount == 0))) err(2, NULL); Modified: head/usr.bin/grep/grep.h ============================================================================== --- head/usr.bin/grep/grep.h Thu Dec 20 17:23:40 2012 (r244492) +++ head/usr.bin/grep/grep.h Thu Dec 20 17:38:14 2012 (r244493) @@ -115,6 +115,7 @@ extern bool Eflag, Fflag, Gflag, Hflag, extern bool dexclude, dinclude, fexclude, finclude, lbflag, nullflag; extern unsigned long long Aflag, Bflag; extern long long mcount; +extern long long mlimit; extern char *label; extern const char *color; extern int binbehave, devbehave, dirbehave, filebehave, grepbehave, linkbehave; Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Thu Dec 20 17:23:40 2012 (r244492) +++ head/usr.bin/grep/util.c Thu Dec 20 17:38:14 2012 (r244493) @@ -176,8 +176,7 @@ procfile(const char *fn) mode_t s; int c, t; - if (mflag && (mcount <= 0)) - return (0); + mcount = mlimit; if (strcmp(fn, "-") == 0) { fn = label != NULL ? label : getstr(1); From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 18:13:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 560A575E; Thu, 20 Dec 2012 18:13:05 +0000 (UTC) (envelope-from eadler@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 3A4C48FC0A; Thu, 20 Dec 2012 18:13:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKID5M6096393; Thu, 20 Dec 2012 18:13:05 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKID5h2096392; Thu, 20 Dec 2012 18:13:05 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212201813.qBKID5h2096392@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 18:13:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244497 - stable/8/usr.bin/fetch X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 18:13:05 -0000 Author: eadler Date: Thu Dec 20 18:13:04 2012 New Revision: 244497 URL: http://svnweb.freebsd.org/changeset/base/244497 Log: MFC r244037: Add check for failure of mkstemp and setenv. Approved by: cperciva (implicit) Modified: stable/8/usr.bin/fetch/fetch.c Directory Properties: stable/8/usr.bin/fetch/ (props changed) Modified: stable/8/usr.bin/fetch/fetch.c ============================================================================== --- stable/8/usr.bin/fetch/fetch.c Thu Dec 20 18:12:40 2012 (r244496) +++ stable/8/usr.bin/fetch/fetch.c Thu Dec 20 18:13:04 2012 (r244497) @@ -604,7 +604,10 @@ fetch(char *URL, const char *path) asprintf(&tmppath, "%.*s.fetch.XXXXXX.%s", (int)(slash - path), path, slash); if (tmppath != NULL) { - mkstemps(tmppath, strlen(slash) + 1); + if (mkstemps(tmppath, strlen(slash) + 1) == -1) { + warn("%s: mkstemps()", path); + goto failure; + } of = fopen(tmppath, "w"); chown(tmppath, sb.st_uid, sb.st_gid); chmod(tmppath, sb.st_mode & ALLPERMS); @@ -974,7 +977,8 @@ main(int argc, char *argv[]) if (v_tty) fetchAuthMethod = query_auth; if (N_filename != NULL) - setenv("NETRC", N_filename, 1); + if (setenv("NETRC", N_filename, 1) == -1) + err(1, "setenv: cannot set NETRC=%s", N_filename); while (argc) { if ((p = strrchr(*argv, '/')) == NULL) From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 18:13:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A207775F; Thu, 20 Dec 2012 18:13:05 +0000 (UTC) (envelope-from eadler@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 86ED58FC12; Thu, 20 Dec 2012 18:13:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKID5Is096403; Thu, 20 Dec 2012 18:13:05 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKID5oZ096401; Thu, 20 Dec 2012 18:13:05 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212201813.qBKID5oZ096401@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 18:13:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r244498 - stable/7/usr.bin/fetch X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 18:13:05 -0000 Author: eadler Date: Thu Dec 20 18:13:04 2012 New Revision: 244498 URL: http://svnweb.freebsd.org/changeset/base/244498 Log: MFC r244037: Add check for failure of mkstemp and setenv. Approved by: cperciva (implicit) Modified: stable/7/usr.bin/fetch/fetch.c Directory Properties: stable/7/usr.bin/fetch/ (props changed) Modified: stable/7/usr.bin/fetch/fetch.c ============================================================================== --- stable/7/usr.bin/fetch/fetch.c Thu Dec 20 18:13:04 2012 (r244497) +++ stable/7/usr.bin/fetch/fetch.c Thu Dec 20 18:13:04 2012 (r244498) @@ -604,7 +604,10 @@ fetch(char *URL, const char *path) asprintf(&tmppath, "%.*s.fetch.XXXXXX.%s", (int)(slash - path), path, slash); if (tmppath != NULL) { - mkstemps(tmppath, strlen(slash) + 1); + if (mkstemps(tmppath, strlen(slash) + 1) == -1) { + warn("%s: mkstemps()", path); + goto failure; + } of = fopen(tmppath, "w"); chown(tmppath, sb.st_uid, sb.st_gid); chmod(tmppath, sb.st_mode & ALLPERMS); @@ -969,7 +972,8 @@ main(int argc, char *argv[]) if (v_tty) fetchAuthMethod = query_auth; if (N_filename != NULL) - setenv("NETRC", N_filename, 1); + if (setenv("NETRC", N_filename, 1) == -1) + err(1, "setenv: cannot set NETRC=%s", N_filename); while (argc) { if ((p = strrchr(*argv, '/')) == NULL) From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 18:13:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A26D6760; Thu, 20 Dec 2012 18:13:05 +0000 (UTC) (envelope-from eadler@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 835FC8FC0C; Thu, 20 Dec 2012 18:13:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKID5rC096402; Thu, 20 Dec 2012 18:13:05 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKID5fY096400; Thu, 20 Dec 2012 18:13:05 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212201813.qBKID5fY096400@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 18:13:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244499 - stable/9/usr.bin/fetch X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 18:13:05 -0000 Author: eadler Date: Thu Dec 20 18:13:04 2012 New Revision: 244499 URL: http://svnweb.freebsd.org/changeset/base/244499 Log: MFC r244037: Add check for failure of mkstemp and setenv. Approved by: cperciva (implicit) Modified: stable/9/usr.bin/fetch/fetch.c Directory Properties: stable/9/usr.bin/fetch/ (props changed) Modified: stable/9/usr.bin/fetch/fetch.c ============================================================================== --- stable/9/usr.bin/fetch/fetch.c Thu Dec 20 18:13:04 2012 (r244498) +++ stable/9/usr.bin/fetch/fetch.c Thu Dec 20 18:13:04 2012 (r244499) @@ -604,7 +604,10 @@ fetch(char *URL, const char *path) asprintf(&tmppath, "%.*s.fetch.XXXXXX.%s", (int)(slash - path), path, slash); if (tmppath != NULL) { - mkstemps(tmppath, strlen(slash) + 1); + if (mkstemps(tmppath, strlen(slash) + 1) == -1) { + warn("%s: mkstemps()", path); + goto failure; + } of = fopen(tmppath, "w"); chown(tmppath, sb.st_uid, sb.st_gid); chmod(tmppath, sb.st_mode & ALLPERMS); @@ -974,7 +977,8 @@ main(int argc, char *argv[]) if (v_tty) fetchAuthMethod = query_auth; if (N_filename != NULL) - setenv("NETRC", N_filename, 1); + if (setenv("NETRC", N_filename, 1) == -1) + err(1, "setenv: cannot set NETRC=%s", N_filename); while (argc) { if ((p = strrchr(*argv, '/')) == NULL) From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 18:13:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 588C8AF2; Thu, 20 Dec 2012 18:13:38 +0000 (UTC) (envelope-from hselasky@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 323AC8FC13; Thu, 20 Dec 2012 18:13:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKIDcPV096535; Thu, 20 Dec 2012 18:13:38 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKIDbgw096532; Thu, 20 Dec 2012 18:13:37 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201212201813.qBKIDbgw096532@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 20 Dec 2012 18:13:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244500 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 18:13:38 -0000 Author: hselasky Date: Thu Dec 20 18:13:37 2012 New Revision: 244500 URL: http://svnweb.freebsd.org/changeset/base/244500 Log: Allocate separate USB buffers for DMA'ed data, so that DMA data does not reside next to non DMA data. This might cause more memory to be allocated, but solves problems on platforms using manual cache synchronization. Add a convenience function to get the buffer only from a USB transfer's page cache structure. MFC after: 1 week Suggested by: imp Modified: head/sys/dev/usb/usb_transfer.c head/sys/dev/usb/usbdi.h Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Thu Dec 20 18:13:04 2012 (r244499) +++ head/sys/dev/usb/usb_transfer.c Thu Dec 20 18:13:37 2012 (r244500) @@ -181,6 +181,10 @@ usbd_get_dma_delay(struct usb_device *ud * according to "size", "align" and "count" arguments. "ppc" is * pointed to a linear array of USB page caches afterwards. * + * If the "align" argument is equal to "1" a non-contiguous allocation + * can happen. Else if the "align" argument is greater than "1", the + * allocation will always be contiguous in memory. + * * Returns: * 0: Success * Else: Failure @@ -195,13 +199,14 @@ usbd_transfer_setup_sub_malloc(struct us struct usb_page *pg; void *buf; usb_size_t n_dma_pc; + usb_size_t n_dma_pg; usb_size_t n_obj; usb_size_t x; usb_size_t y; usb_size_t r; usb_size_t z; - USB_ASSERT(align > 1, ("Invalid alignment, 0x%08x\n", + USB_ASSERT(align > 0, ("Invalid alignment, 0x%08x\n", align)); USB_ASSERT(size > 0, ("Invalid size = 0\n")); @@ -217,8 +222,14 @@ usbd_transfer_setup_sub_malloc(struct us * Try multi-allocation chunks to reduce the number of DMA * allocations, hence DMA allocations are slow. */ - if (size >= USB_PAGE_SIZE) { + if (align == 1) { + /* special case - non-cached multi page DMA memory */ + n_dma_pc = count; + n_dma_pg = (2 + (size / USB_PAGE_SIZE)); + n_obj = 1; + } else if (size >= USB_PAGE_SIZE) { n_dma_pc = count; + n_dma_pg = 1; n_obj = 1; } else { /* compute number of objects per page */ @@ -228,13 +239,22 @@ usbd_transfer_setup_sub_malloc(struct us * to nearest one: */ n_dma_pc = ((count + n_obj - 1) / n_obj); + n_dma_pg = 1; } + /* + * DMA memory is allocated once, but mapped twice. That's why + * there is one list for auto-free and another list for + * non-auto-free which only holds the mapping and not the + * allocation. + */ if (parm->buf == NULL) { - /* for the future */ - parm->dma_page_ptr += n_dma_pc; + /* reserve memory (auto-free) */ + parm->dma_page_ptr += n_dma_pc * n_dma_pg; parm->dma_page_cache_ptr += n_dma_pc; - parm->dma_page_ptr += count; + + /* reserve memory (no-auto-free) */ + parm->dma_page_ptr += count * n_dma_pg; parm->xfer_page_cache_ptr += count; return (0); } @@ -272,9 +292,9 @@ usbd_transfer_setup_sub_malloc(struct us buf = parm->dma_page_cache_ptr->buffer; /* Make room for one DMA page cache and one page */ parm->dma_page_cache_ptr++; - pg++; + pg += n_dma_pg; - for (y = 0; (y != n_obj); y++, r--, pc++, pg++) { + for (y = 0; (y != n_obj); y++, r--, pc++, pg += n_dma_pg) { /* Load sub-chunk into DMA */ if (usb_pc_dmamap_create(pc, size)) { @@ -688,12 +708,30 @@ usbd_transfer_setup_sub(struct usb_setup */ if (!xfer->flags.ext_buffer) { +#if USB_HAVE_BUSDMA + struct usb_page_search page_info; + struct usb_page_cache *pc; + if (usbd_transfer_setup_sub_malloc(parm, + &pc, parm->bufsize, 1, 1)) { + parm->err = USB_ERR_NOMEM; + } else if (parm->buf != NULL) { + + usbd_get_page(pc, 0, &page_info); + + xfer->local_buffer = page_info.buffer; + + usbd_xfer_set_frame_offset(xfer, 0, 0); + + if ((type == UE_CONTROL) && (n_frbuffers > 1)) { + usbd_xfer_set_frame_offset(xfer, REQ_SIZE, 1); + } + } +#else /* align data */ parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); - if (parm->buf) { - + if (parm->buf != NULL) { xfer->local_buffer = USB_ADD_BYTES(parm->buf, parm->size[0]); @@ -707,6 +745,7 @@ usbd_transfer_setup_sub(struct usb_setup /* align data again */ parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); +#endif } /* * Compute maximum buffer size @@ -1078,9 +1117,12 @@ usbd_transfer_setup(struct usb_device *u * The number of DMA tags required depends on * the number of endpoints. The current estimate * for maximum number of DMA tags per endpoint - * is two. + * is three: + * 1) for loading memory + * 2) for allocating memory + * 3) for fixing memory [UHCI] */ - parm.dma_tag_max += 2 * MIN(n_setup, USB_EP_MAX); + parm.dma_tag_max += 3 * MIN(n_setup, USB_EP_MAX); /* * DMA tags for QH, TD, Data and more. @@ -1943,6 +1985,17 @@ usbd_xfer_get_frame(struct usb_xfer *xfe return (&xfer->frbuffers[frindex]); } +void * +usbd_xfer_get_frame_buffer(struct usb_xfer *xfer, usb_frcount_t frindex) +{ + struct usb_page_search page_info; + + KASSERT(frindex < xfer->max_frame_count, ("frame index overflow")); + + usbd_get_page(&xfer->frbuffers[frindex], 0, &page_info); + return (page_info.buffer); +} + /*------------------------------------------------------------------------* * usbd_xfer_get_fps_shift * Modified: head/sys/dev/usb/usbdi.h ============================================================================== --- head/sys/dev/usb/usbdi.h Thu Dec 20 18:13:04 2012 (r244499) +++ head/sys/dev/usb/usbdi.h Thu Dec 20 18:13:37 2012 (r244500) @@ -530,8 +530,8 @@ usb_frlength_t usbd_xfer_old_frame_length(struct usb_xfer *xfer, usb_frcount_t frindex); void usbd_xfer_status(struct usb_xfer *xfer, int *actlen, int *sumlen, int *aframes, int *nframes); -struct usb_page_cache *usbd_xfer_get_frame(struct usb_xfer *xfer, - usb_frcount_t frindex); +struct usb_page_cache *usbd_xfer_get_frame(struct usb_xfer *, usb_frcount_t); +void *usbd_xfer_get_frame_buffer(struct usb_xfer *, usb_frcount_t); void *usbd_xfer_softc(struct usb_xfer *xfer); void *usbd_xfer_get_priv(struct usb_xfer *xfer); void usbd_xfer_set_priv(struct usb_xfer *xfer, void *); From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 18:38:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A802272; Thu, 20 Dec 2012 18:38:03 +0000 (UTC) (envelope-from hselasky@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 6C2B78FC0A; Thu, 20 Dec 2012 18:38:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKIc34v000139; Thu, 20 Dec 2012 18:38:03 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKIc2nA000133; Thu, 20 Dec 2012 18:38:02 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201212201838.qBKIc2nA000133@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 20 Dec 2012 18:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244503 - in head/sys/dev/usb: . storage wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 18:38:03 -0000 Author: hselasky Date: Thu Dec 20 18:38:02 2012 New Revision: 244503 URL: http://svnweb.freebsd.org/changeset/base/244503 Log: Make sure all USB drivers allocate buffer memory through the USB API and/or busdma. The following assumptions have been made: umass - buffers passed from CAM/SCSI layer are OK network - mbufs are OK. Some other nits while at it. MFC after: 1 week Suggested by: imp Modified: head/sys/dev/usb/storage/ustorage_fs.c head/sys/dev/usb/usb_msctest.c head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_uathvar.h head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/usb/wlan/if_upgtvar.h head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_urtwvar.h Modified: head/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- head/sys/dev/usb/storage/ustorage_fs.c Thu Dec 20 18:30:34 2012 (r244502) +++ head/sys/dev/usb/storage/ustorage_fs.c Thu Dec 20 18:38:02 2012 (r244503) @@ -74,7 +74,7 @@ SYSCTL_INT(_hw_usb_ustorage_fs, OID_AUTO /* Define some limits */ #ifndef USTORAGE_FS_BULK_SIZE -#define USTORAGE_FS_BULK_SIZE (1UL << 17) /* bytes */ +#define USTORAGE_FS_BULK_SIZE (1U << 17) /* bytes */ #endif #ifndef USTORAGE_FS_MAX_LUN @@ -85,8 +85,6 @@ SYSCTL_INT(_hw_usb_ustorage_fs, OID_AUTO #define USTORAGE_QDATA_MAX 40 /* bytes */ #endif -#define sc_cmd_data sc_cbw.CBWCDB - /* * The SCSI ID string must be exactly 28 characters long * exluding the terminating zero. @@ -176,8 +174,9 @@ struct ustorage_fs_lun { struct ustorage_fs_softc { - ustorage_fs_bbb_cbw_t sc_cbw; /* Command Wrapper Block */ - ustorage_fs_bbb_csw_t sc_csw; /* Command Status Block */ + ustorage_fs_bbb_cbw_t *sc_cbw; /* Command Wrapper Block */ + ustorage_fs_bbb_csw_t *sc_csw; /* Command Status Block */ + void *sc_dma_ptr; /* Main data buffer */ struct mtx sc_mtx; @@ -275,7 +274,6 @@ static struct usb_config ustorage_fs_bbb .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = sizeof(ustorage_fs_bbb_cbw_t), - .flags = {.ext_buffer = 1,}, .callback = &ustorage_fs_t_bbb_command_callback, .usb_mode = USB_MODE_DEVICE, }, @@ -295,7 +293,7 @@ static struct usb_config ustorage_fs_bbb .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = USTORAGE_FS_BULK_SIZE, - .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,.ext_buffer = 1}, + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1}, .callback = &ustorage_fs_t_bbb_data_read_callback, .usb_mode = USB_MODE_DEVICE, }, @@ -315,7 +313,7 @@ static struct usb_config ustorage_fs_bbb .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = sizeof(ustorage_fs_bbb_csw_t), - .flags = {.short_xfer_ok = 1,.ext_buffer = 1,}, + .flags = {.short_xfer_ok = 1}, .callback = &ustorage_fs_t_bbb_status_callback, .usb_mode = USB_MODE_DEVICE, }, @@ -409,6 +407,14 @@ ustorage_fs_attach(device_t dev) "transfers, %s\n", usbd_errstr(err)); goto detach; } + + sc->sc_cbw = usbd_xfer_get_frame_buffer(sc->sc_xfer[ + USTORAGE_FS_T_BBB_COMMAND], 0); + sc->sc_csw = usbd_xfer_get_frame_buffer(sc->sc_xfer[ + USTORAGE_FS_T_BBB_STATUS], 0); + sc->sc_dma_ptr = usbd_xfer_get_frame_buffer(sc->sc_xfer[ + USTORAGE_FS_T_BBB_DATA_READ], 0); + /* start Mass Storage State Machine */ mtx_lock(&sc->sc_mtx); @@ -518,44 +524,44 @@ ustorage_fs_t_bbb_command_callback(struc switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - tag = UGETDW(sc->sc_cbw.dCBWSignature); + tag = UGETDW(sc->sc_cbw->dCBWSignature); if (tag != CBWSIGNATURE) { /* do nothing */ DPRINTF("invalid signature 0x%08x\n", tag); break; } - tag = UGETDW(sc->sc_cbw.dCBWTag); + tag = UGETDW(sc->sc_cbw->dCBWTag); /* echo back tag */ - USETDW(sc->sc_csw.dCSWTag, tag); + USETDW(sc->sc_csw->dCSWTag, tag); /* reset status */ - sc->sc_csw.bCSWStatus = 0; + sc->sc_csw->bCSWStatus = 0; /* reset data offset, data length and data remainder */ sc->sc_transfer.offset = 0; sc->sc_transfer.data_rem = - UGETDW(sc->sc_cbw.dCBWDataTransferLength); + UGETDW(sc->sc_cbw->dCBWDataTransferLength); /* reset data flags */ sc->sc_transfer.data_short = 0; /* extract LUN */ - sc->sc_transfer.lun = sc->sc_cbw.bCBWLUN; + sc->sc_transfer.lun = sc->sc_cbw->bCBWLUN; if (sc->sc_transfer.data_rem == 0) { sc->sc_transfer.cbw_dir = DIR_NONE; } else { - if (sc->sc_cbw.bCBWFlags & CBWFLAGS_IN) { + if (sc->sc_cbw->bCBWFlags & CBWFLAGS_IN) { sc->sc_transfer.cbw_dir = DIR_WRITE; } else { sc->sc_transfer.cbw_dir = DIR_READ; } } - sc->sc_transfer.cmd_len = sc->sc_cbw.bCDBLength; - if ((sc->sc_transfer.cmd_len > sizeof(sc->sc_cbw.CBWCDB)) || + sc->sc_transfer.cmd_len = sc->sc_cbw->bCDBLength; + if ((sc->sc_transfer.cmd_len > sizeof(sc->sc_cbw->CBWCDB)) || (sc->sc_transfer.cmd_len == 0)) { /* just halt - this is invalid */ DPRINTF("invalid command length %d bytes\n", @@ -597,9 +603,6 @@ tr_setup: usbd_xfer_set_stall(xfer); DPRINTF("stall pipe\n"); } - - usbd_xfer_set_frame_data(xfer, 0, &sc->sc_cbw, - sizeof(sc->sc_cbw)); usbd_transfer_submit(xfer); break; @@ -616,9 +619,9 @@ tr_setup: goto tr_setup; } if (err) { - if (sc->sc_csw.bCSWStatus == 0) { + if (sc->sc_csw->bCSWStatus == 0) { /* set some default error code */ - sc->sc_csw.bCSWStatus = CSWSTATUS_FAILED; + sc->sc_csw->bCSWStatus = CSWSTATUS_FAILED; } if (sc->sc_transfer.cbw_dir == DIR_READ) { /* dump all data */ @@ -699,6 +702,9 @@ ustorage_fs_t_bbb_data_read_callback(str switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: + /* XXX copy data from DMA buffer */ + memcpy(sc->sc_transfer.data_ptr, sc->sc_dma_ptr, actlen); + sc->sc_transfer.data_rem -= actlen; sc->sc_transfer.data_ptr += actlen; sc->sc_transfer.offset += actlen; @@ -721,8 +727,7 @@ tr_setup: usbd_xfer_set_stall(xfer); } - usbd_xfer_set_frame_data(xfer, 0, sc->sc_transfer.data_ptr, - max_bulk); + usbd_xfer_set_frame_data(xfer, 0, sc->sc_dma_ptr, max_bulk); usbd_transfer_submit(xfer); break; @@ -778,8 +783,10 @@ tr_setup: usbd_xfer_set_stall(xfer); } - usbd_xfer_set_frame_data(xfer, 0, sc->sc_transfer.data_ptr, - max_bulk); + /* XXX copy data to DMA buffer */ + memcpy(sc->sc_dma_ptr, sc->sc_transfer.data_ptr, max_bulk); + + usbd_xfer_set_frame_data(xfer, 0, sc->sc_dma_ptr, max_bulk); usbd_transfer_submit(xfer); break; @@ -813,16 +820,13 @@ ustorage_fs_t_bbb_status_callback(struct case USB_ST_SETUP: tr_setup: - USETDW(sc->sc_csw.dCSWSignature, CSWSIGNATURE); - USETDW(sc->sc_csw.dCSWDataResidue, sc->sc_transfer.data_rem); + USETDW(sc->sc_csw->dCSWSignature, CSWSIGNATURE); + USETDW(sc->sc_csw->dCSWDataResidue, sc->sc_transfer.data_rem); if (sc->sc_transfer.data_error) { sc->sc_transfer.data_error = 0; usbd_xfer_set_stall(xfer); } - - usbd_xfer_set_frame_data(xfer, 0, &sc->sc_csw, - sizeof(sc->sc_csw)); usbd_transfer_submit(xfer); break; @@ -934,17 +938,17 @@ ustorage_fs_verify(struct ustorage_fs_so /* * Get the starting Logical Block Address */ - lba = get_be32(&sc->sc_cmd_data[2]); + lba = get_be32(&sc->sc_cbw->CBWCDB[2]); /* * We allow DPO (Disable Page Out = don't save data in the cache) * but we don't implement it. */ - if ((sc->sc_cmd_data[1] & ~0x10) != 0) { + if ((sc->sc_cbw->CBWCDB[1] & ~0x10) != 0) { currlun->sense_data = SS_INVALID_FIELD_IN_CDB; return (1); } - vlen = get_be16(&sc->sc_cmd_data[7]); + vlen = get_be16(&sc->sc_cbw->CBWCDB[7]); if (vlen == 0) { goto done; } @@ -1092,8 +1096,8 @@ ustorage_fs_read_capacity(struct ustorag { uint8_t *buf = sc->sc_transfer.data_ptr; struct ustorage_fs_lun *currlun = sc->sc_transfer.currlun; - uint32_t lba = get_be32(&sc->sc_cmd_data[2]); - uint8_t pmi = sc->sc_cmd_data[8]; + uint32_t lba = get_be32(&sc->sc_cbw->CBWCDB[2]); + uint8_t pmi = sc->sc_cbw->CBWCDB[8]; /* Check the PMI and LBA fields */ if ((pmi > 1) || ((pmi == 0) && (lba != 0))) { @@ -1126,7 +1130,7 @@ ustorage_fs_mode_sense(struct ustorage_f uint8_t *buf0; uint16_t len; uint16_t limit; - uint8_t mscmnd = sc->sc_cmd_data[0]; + uint8_t mscmnd = sc->sc_cbw->CBWCDB[0]; uint8_t pc; uint8_t page_code; uint8_t changeable_values; @@ -1134,13 +1138,13 @@ ustorage_fs_mode_sense(struct ustorage_f buf0 = buf; - if ((sc->sc_cmd_data[1] & ~0x08) != 0) { + if ((sc->sc_cbw->CBWCDB[1] & ~0x08) != 0) { /* Mask away DBD */ currlun->sense_data = SS_INVALID_FIELD_IN_CDB; return (1); } - pc = sc->sc_cmd_data[2] >> 6; - page_code = sc->sc_cmd_data[2] & 0x3f; + pc = sc->sc_cbw->CBWCDB[2] >> 6; + page_code = sc->sc_cbw->CBWCDB[2] & 0x3f; if (pc == 3) { currlun->sense_data = SS_SAVING_PARAMETERS_NOT_SUPPORTED; return (1); @@ -1237,9 +1241,9 @@ ustorage_fs_start_stop(struct ustorage_f currlun->sense_data = SS_INVALID_COMMAND; return (1); } - immed = sc->sc_cmd_data[1] & 0x01; - loej = sc->sc_cmd_data[4] & 0x02; - start = sc->sc_cmd_data[4] & 0x01; + immed = sc->sc_cbw->CBWCDB[1] & 0x01; + loej = sc->sc_cbw->CBWCDB[4] & 0x02; + start = sc->sc_cbw->CBWCDB[4] & 0x01; if (immed || loej || start) { /* compile fix */ @@ -1264,8 +1268,8 @@ ustorage_fs_prevent_allow(struct ustorag currlun->sense_data = SS_INVALID_COMMAND; return (1); } - prevent = sc->sc_cmd_data[4] & 0x01; - if ((sc->sc_cmd_data[4] & ~0x01) != 0) { + prevent = sc->sc_cbw->CBWCDB[4] & 0x01; + if ((sc->sc_cbw->CBWCDB[4] & ~0x01) != 0) { /* Mask away Prevent */ currlun->sense_data = SS_INVALID_FIELD_IN_CDB; return (1); @@ -1369,18 +1373,18 @@ ustorage_fs_read(struct ustorage_fs_soft * Get the starting Logical Block Address and check that it's not * too big */ - if (sc->sc_cmd_data[0] == SC_READ_6) { - lba = (((uint32_t)sc->sc_cmd_data[1]) << 16) | - get_be16(&sc->sc_cmd_data[2]); + if (sc->sc_cbw->CBWCDB[0] == SC_READ_6) { + lba = (((uint32_t)sc->sc_cbw->CBWCDB[1]) << 16) | + get_be16(&sc->sc_cbw->CBWCDB[2]); } else { - lba = get_be32(&sc->sc_cmd_data[2]); + lba = get_be32(&sc->sc_cbw->CBWCDB[2]); /* * We allow DPO (Disable Page Out = don't save data in the * cache) and FUA (Force Unit Access = don't read from the * cache), but we don't implement them. */ - if ((sc->sc_cmd_data[1] & ~0x18) != 0) { + if ((sc->sc_cbw->CBWCDB[1] & ~0x18) != 0) { currlun->sense_data = SS_INVALID_FIELD_IN_CDB; return (1); } @@ -1427,11 +1431,11 @@ ustorage_fs_write(struct ustorage_fs_sof * Get the starting Logical Block Address and check that it's not * too big. */ - if (sc->sc_cmd_data[0] == SC_WRITE_6) - lba = (((uint32_t)sc->sc_cmd_data[1]) << 16) | - get_be16(&sc->sc_cmd_data[2]); + if (sc->sc_cbw->CBWCDB[0] == SC_WRITE_6) + lba = (((uint32_t)sc->sc_cbw->CBWCDB[1]) << 16) | + get_be16(&sc->sc_cbw->CBWCDB[2]); else { - lba = get_be32(&sc->sc_cmd_data[2]); + lba = get_be32(&sc->sc_cbw->CBWCDB[2]); /* * We allow DPO (Disable Page Out = don't save data in the @@ -1439,11 +1443,11 @@ ustorage_fs_write(struct ustorage_fs_sof * medium). We don't implement DPO; we implement FUA by * performing synchronous output. */ - if ((sc->sc_cmd_data[1] & ~0x18) != 0) { + if ((sc->sc_cbw->CBWCDB[1] & ~0x18) != 0) { currlun->sense_data = SS_INVALID_FIELD_IN_CDB; return (1); } - if (sc->sc_cmd_data[1] & 0x08) { + if (sc->sc_cbw->CBWCDB[1] & 0x08) { /* FUA */ /* XXX set SYNC flag here */ } @@ -1483,7 +1487,7 @@ ustorage_fs_min_len(struct ustorage_fs_s * there must be something wrong about this SCSI * command */ - sc->sc_csw.bCSWStatus = CSWSTATUS_PHASE; + sc->sc_csw->bCSWStatus = CSWSTATUS_PHASE; return (1); } /* compute the minimum length */ @@ -1519,18 +1523,18 @@ ustorage_fs_check_cmd(struct ustorage_fs uint16_t mask, uint8_t needs_medium) { struct ustorage_fs_lun *currlun; - uint8_t lun = (sc->sc_cmd_data[1] >> 5); + uint8_t lun = (sc->sc_cbw->CBWCDB[1] >> 5); uint8_t i; /* Verify the length of the command itself */ if (min_cmd_size > sc->sc_transfer.cmd_len) { DPRINTF("%u > %u\n", min_cmd_size, sc->sc_transfer.cmd_len); - sc->sc_csw.bCSWStatus = CSWSTATUS_PHASE; + sc->sc_csw->bCSWStatus = CSWSTATUS_PHASE; return (1); } /* Mask away the LUN */ - sc->sc_cmd_data[1] &= 0x1f; + sc->sc_cbw->CBWCDB[1] &= 0x1f; /* Check if LUN is correct */ if (lun != sc->sc_transfer.lun) { @@ -1540,7 +1544,7 @@ ustorage_fs_check_cmd(struct ustorage_fs if (sc->sc_transfer.lun <= sc->sc_last_lun) { sc->sc_transfer.currlun = currlun = sc->sc_lun + sc->sc_transfer.lun; - if (sc->sc_cmd_data[0] != SC_REQUEST_SENSE) { + if (sc->sc_cbw->CBWCDB[0] != SC_REQUEST_SENSE) { currlun->sense_data = SS_NO_SENSE; currlun->sense_data_info = 0; currlun->info_valid = 0; @@ -1551,8 +1555,8 @@ ustorage_fs_check_cmd(struct ustorage_fs * else must fail! */ if ((currlun->unit_attention_data != SS_NO_SENSE) && - (sc->sc_cmd_data[0] != SC_INQUIRY) && - (sc->sc_cmd_data[0] != SC_REQUEST_SENSE)) { + (sc->sc_cbw->CBWCDB[0] != SC_INQUIRY) && + (sc->sc_cbw->CBWCDB[0] != SC_REQUEST_SENSE)) { currlun->sense_data = currlun->unit_attention_data; currlun->unit_attention_data = SS_NO_SENSE; return (1); @@ -1564,8 +1568,8 @@ ustorage_fs_check_cmd(struct ustorage_fs * INQUIRY and REQUEST SENSE commands are explicitly allowed * to use unsupported LUNs; all others may not. */ - if ((sc->sc_cmd_data[0] != SC_INQUIRY) && - (sc->sc_cmd_data[0] != SC_REQUEST_SENSE)) { + if ((sc->sc_cbw->CBWCDB[0] != SC_INQUIRY) && + (sc->sc_cbw->CBWCDB[0] != SC_REQUEST_SENSE)) { return (1); } } @@ -1575,7 +1579,7 @@ ustorage_fs_check_cmd(struct ustorage_fs * non-zero. */ for (i = 0; i != min_cmd_size; i++) { - if (sc->sc_cmd_data[i] && !(mask & (1UL << i))) { + if (sc->sc_cbw->CBWCDB[i] && !(mask & (1UL << i))) { if (currlun) { currlun->sense_data = SS_INVALID_FIELD_IN_CDB; } @@ -1613,12 +1617,12 @@ ustorage_fs_do_cmd(struct ustorage_fs_so sc->sc_transfer.data_ptr = sc->sc_qdata; DPRINTF("cmd_data[0]=0x%02x, data_rem=0x%08x\n", - sc->sc_cmd_data[0], sc->sc_transfer.data_rem); + sc->sc_cbw->CBWCDB[0], sc->sc_transfer.data_rem); - switch (sc->sc_cmd_data[0]) { + switch (sc->sc_cbw->CBWCDB[0]) { case SC_INQUIRY: sc->sc_transfer.cmd_dir = DIR_WRITE; - error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], -1U); + error = ustorage_fs_min_len(sc, sc->sc_cbw->CBWCDB[4], -1U); if (error) { break; } @@ -1633,7 +1637,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_MODE_SELECT_6: sc->sc_transfer.cmd_dir = DIR_READ; - error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], -1U); + error = ustorage_fs_min_len(sc, sc->sc_cbw->CBWCDB[4], -1U); if (error) { break; } @@ -1649,7 +1653,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_MODE_SELECT_10: sc->sc_transfer.cmd_dir = DIR_READ; error = ustorage_fs_min_len(sc, - get_be16(&sc->sc_cmd_data[7]), -1U); + get_be16(&sc->sc_cbw->CBWCDB[7]), -1U); if (error) { break; } @@ -1664,7 +1668,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_MODE_SENSE_6: sc->sc_transfer.cmd_dir = DIR_WRITE; - error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], -1U); + error = ustorage_fs_min_len(sc, sc->sc_cbw->CBWCDB[4], -1U); if (error) { break; } @@ -1680,7 +1684,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_MODE_SENSE_10: sc->sc_transfer.cmd_dir = DIR_WRITE; error = ustorage_fs_min_len(sc, - get_be16(&sc->sc_cmd_data[7]), -1U); + get_be16(&sc->sc_cbw->CBWCDB[7]), -1U); if (error) { break; } @@ -1708,7 +1712,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; case SC_READ_6: - i = sc->sc_cmd_data[4]; + i = sc->sc_cbw->CBWCDB[4]; sc->sc_transfer.cmd_dir = DIR_WRITE; temp = ((i == 0) ? 256UL : i); error = ustorage_fs_min_len(sc, temp << 9, mask9); @@ -1726,7 +1730,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_READ_10: sc->sc_transfer.cmd_dir = DIR_WRITE; - temp = get_be16(&sc->sc_cmd_data[7]); + temp = get_be16(&sc->sc_cbw->CBWCDB[7]); error = ustorage_fs_min_len(sc, temp << 9, mask9); if (error) { break; @@ -1742,10 +1746,10 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_READ_12: sc->sc_transfer.cmd_dir = DIR_WRITE; - temp = get_be32(&sc->sc_cmd_data[6]); + temp = get_be32(&sc->sc_cbw->CBWCDB[6]); if (temp >= (1UL << (32 - 9))) { /* numerical overflow */ - sc->sc_csw.bCSWStatus = CSWSTATUS_FAILED; + sc->sc_csw->bCSWStatus = CSWSTATUS_FAILED; error = 1; break; } @@ -1776,7 +1780,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_READ_FORMAT_CAPACITIES: sc->sc_transfer.cmd_dir = DIR_WRITE; error = ustorage_fs_min_len(sc, - get_be16(&sc->sc_cmd_data[7]), -1U); + get_be16(&sc->sc_cbw->CBWCDB[7]), -1U); if (error) { break; } @@ -1791,7 +1795,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_REQUEST_SENSE: sc->sc_transfer.cmd_dir = DIR_WRITE; - error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], -1U); + error = ustorage_fs_min_len(sc, sc->sc_cbw->CBWCDB[4], -1U); if (error) { break; } @@ -1860,7 +1864,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; case SC_WRITE_6: - i = sc->sc_cmd_data[4]; + i = sc->sc_cbw->CBWCDB[4]; sc->sc_transfer.cmd_dir = DIR_READ; temp = ((i == 0) ? 256UL : i); error = ustorage_fs_min_len(sc, temp << 9, mask9); @@ -1878,7 +1882,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_WRITE_10: sc->sc_transfer.cmd_dir = DIR_READ; - temp = get_be16(&sc->sc_cmd_data[7]); + temp = get_be16(&sc->sc_cbw->CBWCDB[7]); error = ustorage_fs_min_len(sc, temp << 9, mask9); if (error) { break; @@ -1894,10 +1898,10 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_WRITE_12: sc->sc_transfer.cmd_dir = DIR_READ; - temp = get_be32(&sc->sc_cmd_data[6]); + temp = get_be32(&sc->sc_cbw->CBWCDB[6]); if (temp > (mask9 >> 9)) { /* numerical overflow */ - sc->sc_csw.bCSWStatus = CSWSTATUS_FAILED; + sc->sc_csw->bCSWStatus = CSWSTATUS_FAILED; error = 1; break; } Modified: head/sys/dev/usb/usb_msctest.c ============================================================================== --- head/sys/dev/usb/usb_msctest.c Thu Dec 20 18:30:34 2012 (r244502) +++ head/sys/dev/usb/usb_msctest.c Thu Dec 20 18:38:02 2012 (r244503) @@ -139,8 +139,8 @@ struct bbb_csw { struct bbb_transfer { struct mtx mtx; struct cv cv; - struct bbb_cbw cbw; - struct bbb_csw csw; + struct bbb_cbw *cbw; + struct bbb_csw *csw; struct usb_xfer *xfer[ST_MAX]; @@ -158,7 +158,7 @@ struct bbb_transfer { uint8_t status_try; int error; - uint8_t buffer[SCSI_MAX_LEN] __aligned(4); + uint8_t *buffer; }; static usb_callback_t bbb_command_callback; @@ -184,7 +184,6 @@ static const struct usb_config bbb_confi .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = sizeof(struct bbb_cbw), - .flags = {.ext_buffer = 1,}, .callback = &bbb_command_callback, .timeout = 4 * USB_MS_HZ, /* 4 seconds */ }, @@ -193,8 +192,8 @@ static const struct usb_config bbb_confi .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .bufsize = BULK_SIZE, - .flags = {.ext_buffer = 1,.proxy_buffer = 1,.short_xfer_ok = 1,}, + .bufsize = MAX(SCSI_MAX_LEN, BULK_SIZE), + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, .callback = &bbb_data_read_callback, .timeout = 4 * USB_MS_HZ, /* 4 seconds */ }, @@ -232,7 +231,7 @@ static const struct usb_config bbb_confi .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = sizeof(struct bbb_csw), - .flags = {.ext_buffer = 1,.short_xfer_ok = 1,}, + .flags = {.short_xfer_ok = 1,}, .callback = &bbb_status_callback, .timeout = 1 * USB_MS_HZ, /* 1 second */ }, @@ -241,7 +240,6 @@ static const struct usb_config bbb_confi static void bbb_done(struct bbb_transfer *sc, int error) { - sc->error = error; sc->state = ST_COMMAND; sc->status_try = 1; @@ -290,18 +288,17 @@ bbb_command_callback(struct usb_xfer *xf case USB_ST_SETUP: sc->status_try = 0; - tag = UGETDW(sc->cbw.dCBWTag) + 1; - USETDW(sc->cbw.dCBWSignature, CBWSIGNATURE); - USETDW(sc->cbw.dCBWTag, tag); - USETDW(sc->cbw.dCBWDataTransferLength, (uint32_t)sc->data_len); - sc->cbw.bCBWFlags = ((sc->dir == DIR_IN) ? CBWFLAGS_IN : CBWFLAGS_OUT); - sc->cbw.bCBWLUN = sc->lun; - sc->cbw.bCDBLength = sc->cmd_len; - if (sc->cbw.bCDBLength > sizeof(sc->cbw.CBWCDB)) { - sc->cbw.bCDBLength = sizeof(sc->cbw.CBWCDB); + tag = UGETDW(sc->cbw->dCBWTag) + 1; + USETDW(sc->cbw->dCBWSignature, CBWSIGNATURE); + USETDW(sc->cbw->dCBWTag, tag); + USETDW(sc->cbw->dCBWDataTransferLength, (uint32_t)sc->data_len); + sc->cbw->bCBWFlags = ((sc->dir == DIR_IN) ? CBWFLAGS_IN : CBWFLAGS_OUT); + sc->cbw->bCBWLUN = sc->lun; + sc->cbw->bCDBLength = sc->cmd_len; + if (sc->cbw->bCDBLength > sizeof(sc->cbw->CBWCDB)) { + sc->cbw->bCDBLength = sizeof(sc->cbw->CBWCDB); DPRINTFN(0, "Truncating long command\n"); } - usbd_xfer_set_frame_data(xfer, 0, &sc->cbw, sizeof(sc->cbw)); usbd_transfer_submit(xfer); break; @@ -430,9 +427,9 @@ bbb_status_callback(struct usb_xfer *xfe /* very simple status check */ - if (actlen < (int)sizeof(sc->csw)) { + if (actlen < (int)sizeof(struct bbb_csw)) { bbb_done(sc, USB_ERR_SHORT_XFER); - } else if (sc->csw.bCSWStatus == CSWSTATUS_GOOD) { + } else if (sc->csw->bCSWStatus == CSWSTATUS_GOOD) { bbb_done(sc, 0); /* success */ } else { bbb_done(sc, ERR_CSW_FAILED); /* error */ @@ -440,7 +437,6 @@ bbb_status_callback(struct usb_xfer *xfe break; case USB_ST_SETUP: - usbd_xfer_set_frame_data(xfer, 0, &sc->csw, sizeof(sc->csw)); usbd_transfer_submit(xfer); break; @@ -478,9 +474,9 @@ bbb_command_start(struct bbb_transfer *s sc->data_timeout = (data_timeout + USB_MS_HZ); sc->actlen = 0; sc->cmd_len = cmd_len; - memset(&sc->cbw.CBWCDB, 0, sizeof(sc->cbw.CBWCDB)); - memcpy(&sc->cbw.CBWCDB, cmd_ptr, cmd_len); - DPRINTFN(1, "SCSI cmd = %*D\n", (int)cmd_len, (char *)sc->cbw.CBWCDB, ":"); + memset(&sc->cbw->CBWCDB, 0, sizeof(sc->cbw->CBWCDB)); + memcpy(&sc->cbw->CBWCDB, cmd_ptr, cmd_len); + DPRINTFN(1, "SCSI cmd = %*D\n", (int)cmd_len, (char *)sc->cbw->CBWCDB, ":"); mtx_lock(&sc->mtx); usbd_transfer_start(sc->xfer[sc->state]); @@ -554,6 +550,14 @@ bbb_attach(struct usb_device *udev, uint bbb_detach(sc); return (NULL); } + /* store pointer to DMA buffers */ + sc->buffer = usbd_xfer_get_frame_buffer( + sc->xfer[ST_DATA_RD], 0); + sc->cbw = usbd_xfer_get_frame_buffer( + sc->xfer[ST_COMMAND], 0); + sc->csw = usbd_xfer_get_frame_buffer( + sc->xfer[ST_STATUS], 0); + return (sc); } Modified: head/sys/dev/usb/wlan/if_uath.c ============================================================================== --- head/sys/dev/usb/wlan/if_uath.c Thu Dec 20 18:30:34 2012 (r244502) +++ head/sys/dev/usb/wlan/if_uath.c Thu Dec 20 18:38:02 2012 (r244503) @@ -217,9 +217,8 @@ static const struct usb_config uath_usbc .type = UE_BULK, .endpoint = 0x1, .direction = UE_DIR_OUT, - .bufsize = UATH_MAX_CMDSZ, + .bufsize = UATH_MAX_CMDSZ * UATH_CMD_LIST_COUNT, .flags = { - .ext_buffer = 1, .force_short_xfer = 1, .pipe_bof = 1, }, @@ -242,9 +241,8 @@ static const struct usb_config uath_usbc .type = UE_BULK, .endpoint = 0x2, .direction = UE_DIR_OUT, - .bufsize = UATH_MAX_TXBUFSZ, + .bufsize = UATH_MAX_TXBUFSZ * UATH_TX_DATA_LIST_COUNT, .flags = { - .ext_buffer = 1, .force_short_xfer = 1, .pipe_bof = 1 }, @@ -258,10 +256,8 @@ static struct ieee80211vap *uath_vap_cre const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN]); static void uath_vap_delete(struct ieee80211vap *); -static int uath_alloc_cmd_list(struct uath_softc *, struct uath_cmd [], - int, int); -static void uath_free_cmd_list(struct uath_softc *, struct uath_cmd [], - int); +static int uath_alloc_cmd_list(struct uath_softc *, struct uath_cmd []); +static void uath_free_cmd_list(struct uath_softc *, struct uath_cmd []); static int uath_host_available(struct uath_softc *); static int uath_get_capability(struct uath_softc *, uint32_t, uint32_t *); static int uath_get_devcap(struct uath_softc *); @@ -365,8 +361,7 @@ uath_attach(device_t dev) /* * Allocate xfers for firmware commands. */ - error = uath_alloc_cmd_list(sc, sc->sc_cmd, UATH_CMD_LIST_COUNT, - UATH_MAX_CMDSZ); + error = uath_alloc_cmd_list(sc, sc->sc_cmd); if (error != 0) { device_printf(sc->sc_dev, "could not allocate Tx command list\n"); @@ -381,6 +376,11 @@ uath_attach(device_t dev) goto fail1; } + sc->sc_cmd_dma_buf = + usbd_xfer_get_frame_buffer(sc->sc_xfer[UATH_INTR_TX], 0); + sc->sc_tx_dma_buf = + usbd_xfer_get_frame_buffer(sc->sc_xfer[UATH_BULK_TX], 0); + /* * We're now ready to send+receive firmware commands. */ @@ -493,7 +493,7 @@ uath_attach(device_t dev) fail4: if_free(ifp); fail3: UATH_UNLOCK(sc); fail2: usbd_transfer_unsetup(sc->sc_xfer, UATH_N_XFERS); -fail1: uath_free_cmd_list(sc, sc->sc_cmd, UATH_CMD_LIST_COUNT); +fail1: uath_free_cmd_list(sc, sc->sc_cmd); fail: return (error); } @@ -524,7 +524,7 @@ uath_detach(device_t dev) UATH_LOCK(sc); uath_free_rx_data_list(sc); uath_free_tx_data_list(sc); - uath_free_cmd_list(sc, sc->sc_cmd, UATH_CMD_LIST_COUNT); + uath_free_cmd_list(sc, sc->sc_cmd); UATH_UNLOCK(sc); if_free(ifp); @@ -533,45 +533,35 @@ uath_detach(device_t dev) } static void -uath_free_cmd_list(struct uath_softc *sc, struct uath_cmd cmds[], int ncmd) +uath_free_cmd_list(struct uath_softc *sc, struct uath_cmd cmds[]) { int i; - for (i = 0; i < ncmd; i++) - if (cmds[i].buf != NULL) - free(cmds[i].buf, M_USBDEV); + for (i = 0; i != UATH_CMD_LIST_COUNT; i++) + cmds[i].buf = NULL; } static int -uath_alloc_cmd_list(struct uath_softc *sc, struct uath_cmd cmds[], - int ncmd, int maxsz) +uath_alloc_cmd_list(struct uath_softc *sc, struct uath_cmd cmds[]) { - int i, error; + int i; STAILQ_INIT(&sc->sc_cmd_active); STAILQ_INIT(&sc->sc_cmd_pending); STAILQ_INIT(&sc->sc_cmd_waiting); STAILQ_INIT(&sc->sc_cmd_inactive); - for (i = 0; i < ncmd; i++) { + for (i = 0; i != UATH_CMD_LIST_COUNT; i++) { struct uath_cmd *cmd = &cmds[i]; cmd->sc = sc; /* backpointer for callbacks */ cmd->msgid = i; - cmd->buf = malloc(maxsz, M_USBDEV, M_NOWAIT); - if (cmd->buf == NULL) { - device_printf(sc->sc_dev, - "could not allocate xfer buffer\n"); - error = ENOMEM; - goto fail; - } + cmd->buf = ((uint8_t *)sc->sc_cmd_dma_buf) + + (i * UATH_MAX_CMDSZ); STAILQ_INSERT_TAIL(&sc->sc_cmd_inactive, cmd, next); UATH_STAT_INC(sc, st_cmd_inactive); } return (0); - -fail: uath_free_cmd_list(sc, cmds, ncmd); - return (error); } static int @@ -942,10 +932,7 @@ uath_free_data_list(struct uath_softc *s dp->buf = NULL; } } else { - if (dp->buf != NULL) { - free(dp->buf, M_USBDEV); - dp->buf = NULL; - } + dp->buf = NULL; } #ifdef UATH_DEBUG if (dp->ni != NULL) @@ -956,7 +943,7 @@ uath_free_data_list(struct uath_softc *s static int uath_alloc_data_list(struct uath_softc *sc, struct uath_data data[], - int ndata, int maxsz, int fillmbuf) + int ndata, int maxsz, void *dma_buf) { int i, error; @@ -964,7 +951,7 @@ uath_alloc_data_list(struct uath_softc * struct uath_data *dp = &data[i]; dp->sc = sc; - if (fillmbuf) { + if (dma_buf == NULL) { /* XXX check maxsz */ dp->m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (dp->m == NULL) { @@ -976,20 +963,14 @@ uath_alloc_data_list(struct uath_softc * dp->buf = mtod(dp->m, uint8_t *); } else { dp->m = NULL; - dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT); - if (dp->buf == NULL) { - device_printf(sc->sc_dev, - "could not allocate buffer\n"); - error = ENOMEM; - goto fail; - } + dp->buf = ((uint8_t *)dma_buf) + (i * maxsz); } dp->ni = NULL; } return (0); -fail: uath_free_data_list(sc, data, ndata, fillmbuf); +fail: uath_free_data_list(sc, data, ndata, 1 /* free mbufs */); return (error); } @@ -1001,7 +982,7 @@ uath_alloc_rx_data_list(struct uath_soft /* XXX is it enough to store the RX packet with MCLBYTES bytes? */ error = uath_alloc_data_list(sc, sc->sc_rx, UATH_RX_DATA_LIST_COUNT, MCLBYTES, - 1 /* setup mbufs */); + NULL /* setup mbufs */); if (error != 0) return (error); @@ -1024,7 +1005,7 @@ uath_alloc_tx_data_list(struct uath_soft error = uath_alloc_data_list(sc, sc->sc_tx, UATH_TX_DATA_LIST_COUNT, UATH_MAX_TXBUFSZ, - 0 /* no mbufs */); + sc->sc_tx_dma_buf); if (error != 0) return (error); @@ -2741,8 +2722,7 @@ setup: UATH_STAT_DEC(sc, st_rx_inactive); STAILQ_INSERT_TAIL(&sc->sc_rx_active, data, next); UATH_STAT_INC(sc, st_rx_active); - usbd_xfer_set_frame_data(xfer, 0, data->buf, - usbd_xfer_max_len(xfer)); + usbd_xfer_set_frame_data(xfer, 0, data->buf, MCLBYTES); usbd_transfer_submit(xfer); /* @@ -2890,7 +2870,7 @@ static device_method_t uath_methods[] = DEVMETHOD(device_probe, uath_match), DEVMETHOD(device_attach, uath_attach), DEVMETHOD(device_detach, uath_detach), - { 0, 0 } + DEVMETHOD_END }; static driver_t uath_driver = { .name = "uath", Modified: head/sys/dev/usb/wlan/if_uathvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_uathvar.h Thu Dec 20 18:30:34 2012 (r244502) +++ head/sys/dev/usb/wlan/if_uathvar.h Thu Dec 20 18:38:02 2012 (r244503) @@ -186,6 +186,8 @@ struct uath_softc { struct ifnet *sc_ifp; device_t sc_dev; struct usb_device *sc_udev; + void *sc_cmd_dma_buf; + void *sc_tx_dma_buf; struct mtx sc_mtx; uint32_t sc_debug; Modified: head/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- head/sys/dev/usb/wlan/if_upgt.c Thu Dec 20 18:30:34 2012 (r244502) +++ head/sys/dev/usb/wlan/if_upgt.c Thu Dec 20 18:38:02 2012 (r244503) @@ -201,9 +201,8 @@ static const struct usb_config upgt_conf .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = MCLBYTES, + .bufsize = MCLBYTES * UPGT_TX_MAXCOUNT, .flags = { - .ext_buffer = 1, .force_short_xfer = 1, .pipe_bof = 1 }, @@ -214,9 +213,8 @@ static const struct usb_config upgt_conf .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .bufsize = MCLBYTES, + .bufsize = MCLBYTES * UPGT_RX_MAXCOUNT, .flags = { - .ext_buffer = 1, .pipe_bof = 1, .short_xfer_ok = 1 }, @@ -277,6 +275,11 @@ upgt_attach(device_t dev) goto fail3; } + sc->sc_rx_dma_buf = usbd_xfer_get_frame_buffer( + sc->sc_xfer[UPGT_BULK_RX], 0); + sc->sc_tx_dma_buf = usbd_xfer_get_frame_buffer( + sc->sc_xfer[UPGT_BULK_TX], 0); + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); if (ifp == NULL) { device_printf(dev, "can not if_alloc()\n"); @@ -1952,13 +1955,7 @@ upgt_alloc_tx(struct upgt_softc *sc) for (i = 0; i < UPGT_TX_MAXCOUNT; i++) { struct upgt_data *data = &sc->sc_tx_data[i]; - - data->buf = malloc(MCLBYTES, M_USBDEV, M_NOWAIT | M_ZERO); - if (data->buf == NULL) { - device_printf(sc->sc_dev, - "could not allocate TX buffer\n"); - return (ENOMEM); - } + data->buf = ((uint8_t *)sc->sc_tx_dma_buf) + (i * MCLBYTES); STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, data, next); UPGT_STAT_INC(sc, st_tx_inactive); } @@ -1976,13 +1973,7 @@ upgt_alloc_rx(struct upgt_softc *sc) for (i = 0; i < UPGT_RX_MAXCOUNT; i++) { struct upgt_data *data = &sc->sc_rx_data[i]; - - data->buf = malloc(MCLBYTES, M_USBDEV, M_NOWAIT | M_ZERO); - if (data->buf == NULL) { - device_printf(sc->sc_dev, - "could not allocate RX buffer\n"); - return (ENOMEM); - } + data->buf = ((uint8_t *)sc->sc_rx_dma_buf) + (i * MCLBYTES); STAILQ_INSERT_TAIL(&sc->sc_rx_inactive, data, next); } @@ -2004,8 +1995,10 @@ upgt_detach(device_t dev) callout_drain(&sc->sc_led_ch); callout_drain(&sc->sc_watchdog_ch); - usbd_transfer_unsetup(sc->sc_xfer, UPGT_N_XFERS); ieee80211_ifdetach(ic); + + usbd_transfer_unsetup(sc->sc_xfer, UPGT_N_XFERS); + upgt_free_rx(sc); upgt_free_tx(sc); @@ -2023,7 +2016,7 @@ upgt_free_rx(struct upgt_softc *sc) for (i = 0; i < UPGT_RX_MAXCOUNT; i++) { struct upgt_data *data = &sc->sc_rx_data[i]; - free(data->buf, M_USBDEV); + data->buf = NULL; data->ni = NULL; } } @@ -2036,7 +2029,7 @@ upgt_free_tx(struct upgt_softc *sc) for (i = 0; i < UPGT_TX_MAXCOUNT; i++) { struct upgt_data *data = &sc->sc_tx_data[i]; - free(data->buf, M_USBDEV); + data->buf = NULL; data->ni = NULL; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 19:51:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F3E7653; Thu, 20 Dec 2012 19:51:33 +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 624638FC0C; Thu, 20 Dec 2012 19:51:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKJpXO7011034; Thu, 20 Dec 2012 19:51:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKJpXtt011032; Thu, 20 Dec 2012 19:51:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201212201951.qBKJpXtt011032@svn.freebsd.org> From: Alexander Motin Date: Thu, 20 Dec 2012 19:51:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244508 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 19:51:33 -0000 Author: mav Date: Thu Dec 20 19:51:32 2012 New Revision: 244508 URL: http://svnweb.freebsd.org/changeset/base/244508 Log: Make SES driver to not fall out on some errors in Additional Status page. This allows CAM devices still get their physical paths even if status of later elements it corrupted. Sponsored by: iXsystems, Inc. Modified: head/sys/cam/scsi/scsi_enc_ses.c Modified: head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_ses.c Thu Dec 20 19:47:46 2012 (r244507) +++ head/sys/cam/scsi/scsi_enc_ses.c Thu Dec 20 19:51:32 2012 (r244508) @@ -1801,8 +1801,7 @@ ses_process_elm_addlstatus(enc_softc_t * ENC_VLOG(enc, "Element %d Beyond End " "of Additional Element Status Descriptors\n", iter.global_element_index); - err = EIO; - goto out; + break; } /* Advance to the protocol data, skipping eip bytes if needed */ @@ -1831,7 +1830,7 @@ ses_process_elm_addlstatus(enc_softc_t * ENC_VLOG(enc, "Element %d: Unknown Additional Element " "Protocol 0x%x\n", iter.global_element_index, ses_elm_addlstatus_proto(elmpriv->addl.hdr)); - goto out; + break; } offset += proto_info_len; From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 20:18:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 533D6C13; Thu, 20 Dec 2012 20:18: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 373208FC0C; Thu, 20 Dec 2012 20:18:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKKISEA015346; Thu, 20 Dec 2012 20:18:28 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKKISw6015344; Thu, 20 Dec 2012 20:18:28 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201212202018.qBKKISw6015344@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Thu, 20 Dec 2012 20:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244510 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 20:18:28 -0000 Author: des Date: Thu Dec 20 20:18:27 2012 New Revision: 244510 URL: http://svnweb.freebsd.org/changeset/base/244510 Log: Rewrite fdgrowtable() so common mortals can actually understand what it does and how, and add comments describing the data structures and explaining how they are managed. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Dec 20 19:59:13 2012 (r244509) +++ head/sys/kern/kern_descrip.c Thu Dec 20 20:18:27 2012 (r244510) @@ -133,12 +133,26 @@ static int fill_socket_info(struct socke static int fill_vnode_info(struct vnode *vp, struct kinfo_file *kif); /* - * A process is initially started out with NDFILE descriptors stored within - * this structure, selected to be enough for typical applications based on - * the historical limit of 20 open files (and the usage of descriptors by - * shells). If these descriptors are exhausted, a larger descriptor table - * may be allocated, up to a process' resource limit; the internal arrays - * are then unused. + * Each process has: + * + * - An array of open file descriptors (fd_ofiles) + * - An array of file flags (fd_ofileflags) + * - A bitmap recording which descriptors are in use (fd_map) + * + * A process starts out with NDFILE descriptors. The value of NDFILE has + * been selected based the historical limit of 20 open files, and an + * assumption that the majority of processes, especially short-lived + * processes like shells, will never need more. + * + * If this initial allocation is exhausted, a larger descriptor table and + * map are allocated dynamically, and the pointers in the process's struct + * filedesc are updated to point to those. This is repeated every time + * the process runs out of file descriptors (provided it hasn't hit its + * resource limit). + * + * Since threads may hold references to individual descriptor table + * entries, the tables are never freed. Instead, they are placed on a + * linked list and freed only when the struct filedesc is released. */ #define NDFILE 20 #define NDSLOTSIZE sizeof(NDSLOTTYPE) @@ -148,34 +162,23 @@ static int fill_vnode_info(struct vnode #define NDSLOTS(x) (((x) + NDENTRIES - 1) / NDENTRIES) /* - * Storage required per open file descriptor. - */ -#define OFILESIZE (sizeof(struct file *) + sizeof(char)) - -/* - * Storage to hold unused ofiles that need to be reclaimed. + * SLIST entry used to keep track of ofiles which must be reclaimed when + * the process exits. */ struct freetable { - struct file **ft_table; + struct file **ft_table; SLIST_ENTRY(freetable) ft_next; }; /* - * Basic allocation of descriptors: - * one of the above, plus arrays for NDFILE descriptors. + * Initial allocation: a filedesc structure + the head of SLIST used to + * keep track of old ofiles + enough space for NDFILE descriptors. */ struct filedesc0 { - struct filedesc fd_fd; - /* - * ofiles which need to be reclaimed on free. - */ - SLIST_HEAD(,freetable) fd_free; - /* - * These arrays are used when the number of open files is - * <= NDFILE, and are then pointed to by the pointers above. - */ - struct file *fd_dfiles[NDFILE]; - char fd_dfileflags[NDFILE]; + struct filedesc fd_fd; + SLIST_HEAD(, freetable) fd_free; + struct file *fd_dfiles[NDFILE]; + char fd_dfileflags[NDFILE]; NDSLOTTYPE fd_dmap[NDSLOTS(NDFILE)]; }; @@ -1414,58 +1417,74 @@ static void fdgrowtable(struct filedesc *fdp, int nfd) { struct filedesc0 *fdp0; - struct freetable *fo; + struct freetable *ft; struct file **ntable; struct file **otable; - char *nfileflags; + char *nfileflags, *ofileflags; int nnfiles, onfiles; - NDSLOTTYPE *nmap; + NDSLOTTYPE *nmap, *omap; FILEDESC_XLOCK_ASSERT(fdp); KASSERT(fdp->fd_nfiles > 0, ("zero-length file table")); - /* compute the size of the new table */ + /* save old values */ onfiles = fdp->fd_nfiles; + otable = fdp->fd_ofiles; + ofileflags = fdp->fd_ofileflags; + omap = fdp->fd_map; + + /* compute the size of the new table */ nnfiles = NDSLOTS(nfd) * NDENTRIES; /* round up */ if (nnfiles <= onfiles) /* the table is already large enough */ return; - /* allocate a new table and (if required) new bitmaps */ - ntable = malloc((nnfiles * OFILESIZE) + sizeof(struct freetable), + /* + * Allocate a new table and map. We need enough space for a) the + * file entries themselves, b) the file flags, and c) the struct + * freetable we will use when we decommission the table and place + * it on the freelist. We place the struct freetable in the + * middle so we don't have to worry about padding. + */ + ntable = malloc(nnfiles * sizeof(*ntable) + + sizeof(struct freetable) + + nnfiles * sizeof(*nfileflags), + M_FILEDESC, M_ZERO | M_WAITOK); + nfileflags = (char *)&ntable[nnfiles] + sizeof(struct freetable); + nmap = malloc(NDSLOTS(nnfiles) * NDSLOTSIZE, M_FILEDESC, M_ZERO | M_WAITOK); - nfileflags = (char *)&ntable[nnfiles]; - if (NDSLOTS(nnfiles) > NDSLOTS(onfiles)) - nmap = malloc(NDSLOTS(nnfiles) * NDSLOTSIZE, - M_FILEDESC, M_ZERO | M_WAITOK); - else - nmap = NULL; - bcopy(fdp->fd_ofiles, ntable, onfiles * sizeof(*ntable)); - bcopy(fdp->fd_ofileflags, nfileflags, onfiles); - otable = fdp->fd_ofiles; - fdp->fd_ofileflags = nfileflags; + /* copy the old data over and point at the new tables */ + memcpy(ntable, otable, onfiles * sizeof(*otable)); + memcpy(nfileflags, ofileflags, onfiles * sizeof(*ofileflags)); + memcpy(nmap, omap, NDSLOTS(onfiles) * sizeof(*omap)); + + /* update the pointers and counters */ + fdp->fd_nfiles = nnfiles; fdp->fd_ofiles = ntable; + fdp->fd_ofileflags = nfileflags; + fdp->fd_map = nmap; + /* - * We must preserve ofiles until the process exits because we can't - * be certain that no threads have references to the old table via - * _fget(). + * Do not free the old file table, as some threads may still + * reference entries within it. Instead, place it on a freelist + * which will be processed when the struct filedesc is released. + * + * Do, however, free the old map. + * + * Note that if onfiles == NDFILE, we're dealing with the original + * static allocation contained within (struct filedesc0 *)fdp, + * which must not be freed. */ if (onfiles > NDFILE) { - fo = (struct freetable *)&otable[onfiles]; + ft = (struct freetable *)&otable[onfiles]; fdp0 = (struct filedesc0 *)fdp; - fo->ft_table = otable; - SLIST_INSERT_HEAD(&fdp0->fd_free, fo, ft_next); - } - if (NDSLOTS(nnfiles) > NDSLOTS(onfiles)) { - bcopy(fdp->fd_map, nmap, NDSLOTS(onfiles) * sizeof(*nmap)); - if (NDSLOTS(onfiles) > NDSLOTS(NDFILE)) - free(fdp->fd_map, M_FILEDESC); - fdp->fd_map = nmap; + ft->ft_table = otable; + SLIST_INSERT_HEAD(&fdp0->fd_free, ft, ft_next); + free(omap, M_FILEDESC); } - fdp->fd_nfiles = nnfiles; } /* From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 22:07:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8B0EDF8F; Thu, 20 Dec 2012 22:07:48 +0000 (UTC) (envelope-from bapt@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 7009A8FC0A; Thu, 20 Dec 2012 22:07:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKM7mlw031096; Thu, 20 Dec 2012 22:07:48 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKM7mst031095; Thu, 20 Dec 2012 22:07:48 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201212202207.qBKM7mst031095@svn.freebsd.org> From: Baptiste Daroussin Date: Thu, 20 Dec 2012 22:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244512 - head/tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 22:07:48 -0000 Author: bapt Date: Thu Dec 20 22:07:47 2012 New Revision: 244512 URL: http://svnweb.freebsd.org/changeset/base/244512 Log: Add etc/periodic/daily/220.backup-pkgdb to OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Thu Dec 20 20:41:01 2012 (r244511) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Thu Dec 20 22:07:47 2012 (r244512) @@ -3688,6 +3688,7 @@ OLD_FILES+=usr/sbin/pkg .endif .if ${MK_PKGTOOLS} == no +OLD_FILES+=etc/periodic/daily/220.backup-pkgdb OLD_FILES+=etc/periodic/daily/490.status-pkg-changes OLD_FILES+=etc/periodic/security/460.chkportsum OLD_FILES+=etc/periodic/weekly/400.status-pkg From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 22:26:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 726E98AE; Thu, 20 Dec 2012 22:26:04 +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 4CF928FC12; Thu, 20 Dec 2012 22:26:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKMQ4Wc034182; Thu, 20 Dec 2012 22:26:04 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKMQ3JC034179; Thu, 20 Dec 2012 22:26:03 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201212202226.qBKMQ3JC034179@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 20 Dec 2012 22:26:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244514 - in head/sys/dev: ixgbe netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 22:26:04 -0000 Author: luigi Date: Thu Dec 20 22:26:03 2012 New Revision: 244514 URL: http://svnweb.freebsd.org/changeset/base/244514 Log: rename the 'tag' and 'map' fields used the rx ring to their previous names, 'ptag' and 'pmap' -- p stands for packet. This change reduces the difference between the code in stable/9 and head, and also helps using the same ixgbe_netmap.h on both branches. Approved by: Jack Vogel Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h head/sys/dev/netmap/ixgbe_netmap.h Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Thu Dec 20 22:22:57 2012 (r244513) +++ head/sys/dev/ixgbe/ixgbe.c Thu Dec 20 22:26:03 2012 (r244514) @@ -3721,8 +3721,8 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, */ if ((rxbuf->flags & IXGBE_RX_COPY) == 0) { /* Get the memory mapping */ - error = bus_dmamap_load_mbuf_sg(rxr->tag, - rxbuf->map, mp, seg, &nsegs, BUS_DMA_NOWAIT); + error = bus_dmamap_load_mbuf_sg(rxr->ptag, + rxbuf->pmap, mp, seg, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { printf("Refresh mbufs: payload dmamap load" " failure - %d\n", error); @@ -3731,7 +3731,7 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, goto update; } rxbuf->buf = mp; - bus_dmamap_sync(rxr->tag, rxbuf->map, + bus_dmamap_sync(rxr->ptag, rxbuf->pmap, BUS_DMASYNC_PREREAD); rxbuf->addr = rxr->rx_base[i].read.pkt_addr = htole64(seg[0].ds_addr); @@ -3790,15 +3790,15 @@ ixgbe_allocate_receive_buffers(struct rx 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ - &rxr->tag))) { + &rxr->ptag))) { device_printf(dev, "Unable to create RX DMA tag\n"); goto fail; } for (i = 0; i < rxr->num_desc; i++, rxbuf++) { rxbuf = &rxr->rx_buffers[i]; - error = bus_dmamap_create(rxr->tag, - BUS_DMA_NOWAIT, &rxbuf->map); + error = bus_dmamap_create(rxr->ptag, + BUS_DMA_NOWAIT, &rxbuf->pmap); if (error) { device_printf(dev, "Unable to create RX dma map\n"); goto fail; @@ -3897,9 +3897,9 @@ ixgbe_free_receive_ring(struct rx_ring * for (i = 0; i < rxr->num_desc; i++) { rxbuf = &rxr->rx_buffers[i]; if (rxbuf->buf != NULL) { - bus_dmamap_sync(rxr->tag, rxbuf->map, + bus_dmamap_sync(rxr->ptag, rxbuf->pmap, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(rxr->tag, rxbuf->map); + bus_dmamap_unload(rxr->ptag, rxbuf->pmap); rxbuf->buf->m_flags |= M_PKTHDR; m_freem(rxbuf->buf); rxbuf->buf = NULL; @@ -3966,7 +3966,7 @@ ixgbe_setup_receive_ring(struct rx_ring void *addr; addr = PNMB(slot + sj, &paddr); - netmap_load_map(rxr->tag, rxbuf->map, addr); + netmap_load_map(rxr->ptag, rxbuf->pmap, addr); /* Update descriptor */ rxr->rx_base[j].read.pkt_addr = htole64(paddr); continue; @@ -3981,13 +3981,13 @@ ixgbe_setup_receive_ring(struct rx_ring mp = rxbuf->buf; mp->m_pkthdr.len = mp->m_len = rxr->mbuf_sz; /* Get the memory mapping */ - error = bus_dmamap_load_mbuf_sg(rxr->tag, - rxbuf->map, mp, seg, + error = bus_dmamap_load_mbuf_sg(rxr->ptag, + rxbuf->pmap, mp, seg, &nsegs, BUS_DMA_NOWAIT); if (error != 0) goto fail; - bus_dmamap_sync(rxr->tag, - rxbuf->map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(rxr->ptag, + rxbuf->pmap, BUS_DMASYNC_PREREAD); /* Update descriptor */ rxr->rx_base[j].read.pkt_addr = htole64(seg[0].ds_addr); } @@ -4237,16 +4237,16 @@ ixgbe_free_receive_buffers(struct rx_rin for (int i = 0; i < adapter->num_rx_desc; i++) { rxbuf = &rxr->rx_buffers[i]; if (rxbuf->buf != NULL) { - bus_dmamap_sync(rxr->tag, rxbuf->map, + bus_dmamap_sync(rxr->ptag, rxbuf->pmap, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(rxr->tag, rxbuf->map); + bus_dmamap_unload(rxr->ptag, rxbuf->pmap); rxbuf->buf->m_flags |= M_PKTHDR; m_freem(rxbuf->buf); } rxbuf->buf = NULL; - if (rxbuf->map != NULL) { - bus_dmamap_destroy(rxr->tag, rxbuf->map); - rxbuf->map = NULL; + if (rxbuf->pmap != NULL) { + bus_dmamap_destroy(rxr->ptag, rxbuf->pmap); + rxbuf->pmap = NULL; } } if (rxr->rx_buffers != NULL) { @@ -4255,9 +4255,9 @@ ixgbe_free_receive_buffers(struct rx_rin } } - if (rxr->tag != NULL) { - bus_dma_tag_destroy(rxr->tag); - rxr->tag = NULL; + if (rxr->ptag != NULL) { + bus_dma_tag_destroy(rxr->ptag); + rxr->ptag = NULL; } return; Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Thu Dec 20 22:22:57 2012 (r244513) +++ head/sys/dev/ixgbe/ixgbe.h Thu Dec 20 22:26:03 2012 (r244514) @@ -247,7 +247,7 @@ struct ixgbe_tx_buf { struct ixgbe_rx_buf { struct mbuf *buf; struct mbuf *fmp; - bus_dmamap_t map; + bus_dmamap_t pmap; u_int flags; #define IXGBE_RX_COPY 0x01 uint64_t addr; @@ -348,7 +348,7 @@ struct rx_ring { u16 process_limit; char mtx_name[16]; struct ixgbe_rx_buf *rx_buffers; - bus_dma_tag_t tag; + bus_dma_tag_t ptag; u32 bytes; /* Used for AIM calc */ u32 packets; Modified: head/sys/dev/netmap/ixgbe_netmap.h ============================================================================== --- head/sys/dev/netmap/ixgbe_netmap.h Thu Dec 20 22:22:57 2012 (r244513) +++ head/sys/dev/netmap/ixgbe_netmap.h Thu Dec 20 22:26:03 2012 (r244514) @@ -503,8 +503,8 @@ ixgbe_netmap_rxsync(struct ifnet *ifp, u ring->slot[j].len = le16toh(curr->wb.upper.length) - crclen; if (ix_write_len) D("rx[%d] len %d", j, ring->slot[j].len); - bus_dmamap_sync(rxr->tag, - rxr->rx_buffers[l].map, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(rxr->ptag, + rxr->rx_buffers[l].pmap, BUS_DMASYNC_POSTREAD); j = (j == lim) ? 0 : j + 1; l = (l == lim) ? 0 : l + 1; } @@ -556,12 +556,12 @@ ixgbe_netmap_rxsync(struct ifnet *ifp, u goto ring_reset; if (slot->flags & NS_BUF_CHANGED) { - netmap_reload_map(rxr->tag, rxbuf->map, addr); + netmap_reload_map(rxr->ptag, rxbuf->pmap, addr); slot->flags &= ~NS_BUF_CHANGED; } curr->wb.upper.status_error = 0; curr->read.pkt_addr = htole64(paddr); - bus_dmamap_sync(rxr->tag, rxbuf->map, + bus_dmamap_sync(rxr->ptag, rxbuf->pmap, BUS_DMASYNC_PREREAD); j = (j == lim) ? 0 : j + 1; l = (l == lim) ? 0 : l + 1; From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 22:30:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8465EA64; Thu, 20 Dec 2012 22:30:41 +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 4DC4D8FC15; Thu, 20 Dec 2012 22:30:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKMUfXn034838; Thu, 20 Dec 2012 22:30:41 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKMUf5D034837; Thu, 20 Dec 2012 22:30:41 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201212202230.qBKMUf5D034837@svn.freebsd.org> From: Gabor Kovesdan Date: Thu, 20 Dec 2012 22:30:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244515 - head/usr.bin/sort X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 22:30:41 -0000 Author: gabor Date: Thu Dec 20 22:30:40 2012 New Revision: 244515 URL: http://svnweb.freebsd.org/changeset/base/244515 Log: - Change the memory heuristics to an actually working one Submitted by: Oleg Moskalenko Prodded by: kib Modified: head/usr.bin/sort/sort.c Modified: head/usr.bin/sort/sort.c ============================================================================== --- head/usr.bin/sort/sort.c Thu Dec 20 22:26:03 2012 (r244514) +++ head/usr.bin/sort/sort.c Thu Dec 20 22:30:40 2012 (r244515) @@ -265,33 +265,27 @@ read_fns_from_file0(const char *fn) static void set_hw_params(void) { -#if defined(SORT_THREADS) - size_t ncpusz; -#endif - unsigned int pages, psize; - size_t psz, pszsz; + long pages, psize; pages = psize = 0; + #if defined(SORT_THREADS) ncpu = 1; - ncpusz = sizeof(size_t); #endif - psz = sizeof(pages); - pszsz = sizeof(psize); - if (sysctlbyname("vm.stats.vm.v_free_count", &pages, &psz, - NULL, 0) < 0) { - perror("vm.stats.vm.v_free_count"); - return; - } - if (sysctlbyname("vm.stats.vm.v_page_size", &psize, &pszsz, - NULL, 0) < 0) { - perror("vm.stats.vm.v_page_size"); - return; + pages = sysconf(_SC_PHYS_PAGES); + if (pages < 1) { + perror("sysconf pages"); + psize = 1; + } + psize = sysconf(_SC_PAGESIZE); + if (psize < 1) { + perror("sysconf psize"); + psize = 4096; } #if defined(SORT_THREADS) - if (sysctlbyname("hw.ncpu", &ncpu, &ncpusz, - NULL, 0) < 0) + ncpu = (unsigned int)sysconf(_SC_NPROCESSORS_ONLN); + if (ncpu < 1) ncpu = 1; else if(ncpu > 32) ncpu = 32; @@ -300,7 +294,7 @@ set_hw_params(void) #endif free_memory = (unsigned long long) pages * (unsigned long long) psize; - available_free_memory = (free_memory * 9) / 10; + available_free_memory = free_memory / 2; if (available_free_memory < 1024) available_free_memory = 1024; @@ -1232,7 +1226,9 @@ main(int argc, char **argv) } if (debug_sort) { + printf("Memory to be used for sorting: %llu\n",available_free_memory); #if defined(SORT_THREADS) + printf("Number of CPUs: %d\n",(int)ncpu); nthreads = 1; #endif printf("Using collate rules of %s locale\n", From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 23:18:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 37A13E9E; Thu, 20 Dec 2012 23:18:37 +0000 (UTC) (envelope-from markj@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 1B1A68FC12; Thu, 20 Dec 2012 23:18:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKNIaxA042491; Thu, 20 Dec 2012 23:18:36 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKNIaTf042490; Thu, 20 Dec 2012 23:18:36 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201212202318.qBKNIaTf042490@svn.freebsd.org> From: Mark Johnston Date: Thu, 20 Dec 2012 23:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244522 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 23:18:37 -0000 Author: markj Date: Thu Dec 20 23:18:36 2012 New Revision: 244522 URL: http://svnweb.freebsd.org/changeset/base/244522 Log: Don't reload syslogd after rotating sendmail.st, as this file isn't managed by syslogd. PR: conf/169973 Approved by: rstone (co-mentor) MFC after: 1 week Modified: head/etc/newsyslog.conf Modified: head/etc/newsyslog.conf ============================================================================== --- head/etc/newsyslog.conf Thu Dec 20 23:06:47 2012 (r244521) +++ head/etc/newsyslog.conf Thu Dec 20 23:18:36 2012 (r244522) @@ -33,7 +33,7 @@ /var/log/pflog 600 3 100 * JB /var/run/pflogd.pid /var/log/ppp.log root:network 640 3 100 * JC /var/log/security 600 10 100 * JC -/var/log/sendmail.st 640 10 * 168 B +/var/log/sendmail.st 640 10 * 168 BN /var/log/utx.log 644 3 * @01T05 B /var/log/weekly.log 640 5 * $W6D0 JN /var/log/xferlog 600 7 100 * JC From owner-svn-src-all@FreeBSD.ORG Thu Dec 20 23:21:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B90AF91; Thu, 20 Dec 2012 23:21:21 +0000 (UTC) (envelope-from markj@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 831138FC13; Thu, 20 Dec 2012 23:21:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKNLLVF042933; Thu, 20 Dec 2012 23:21:21 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKNLLYr042932; Thu, 20 Dec 2012 23:21:21 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201212202321.qBKNLLYr042932@svn.freebsd.org> From: Mark Johnston Date: Thu, 20 Dec 2012 23:21:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244523 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 23:21:21 -0000 Author: markj Date: Thu Dec 20 23:21:20 2012 New Revision: 244523 URL: http://svnweb.freebsd.org/changeset/base/244523 Log: - Make sure that errno isn't modified before calling logerror() in error conditions. - Don't check for AF_INET6 when compiled without INET6 support. PR: bin/173930 Submitted by: Garrett Cooper Approved by: rstone (co-mentor) MFC after: 1 week Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Thu Dec 20 23:18:36 2012 (r244522) +++ head/usr.sbin/syslogd/syslogd.c Thu Dec 20 23:21:20 2012 (r244523) @@ -1873,6 +1873,7 @@ cfline(const char *line, struct filed *f pri = decode(buf, prioritynames); if (pri < 0) { + errno = 0; (void)snprintf(ebuf, sizeof ebuf, "unknown priority name \"%s\"", buf); logerror(ebuf); @@ -1901,6 +1902,7 @@ cfline(const char *line, struct filed *f } else { i = decode(buf, facilitynames); if (i < 0) { + errno = 0; (void)snprintf(ebuf, sizeof ebuf, "unknown facility name \"%s\"", buf); @@ -2687,6 +2689,7 @@ socksetup(int af, char *bindhostname) logerror("socket"); continue; } +#ifdef INET6 if (r->ai_family == AF_INET6) { if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&on, sizeof (on)) < 0) { @@ -2695,6 +2698,7 @@ socksetup(int af, char *bindhostname) continue; } } +#endif if (setsockopt(*s, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof (on)) < 0) { logerror("setsockopt"); @@ -2711,8 +2715,8 @@ socksetup(int af, char *bindhostname) */ if (!NoBind) { if (bind(*s, r->ai_addr, r->ai_addrlen) < 0) { - close(*s); logerror("bind"); + close(*s); continue; } From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 00:41:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A491110B; Fri, 21 Dec 2012 00:41:56 +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 87E738FC13; Fri, 21 Dec 2012 00:41:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBL0fufh054813; Fri, 21 Dec 2012 00:41:56 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBL0fqcu054784; Fri, 21 Dec 2012 00:41:52 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201212210041.qBL0fqcu054784@svn.freebsd.org> From: Xin LI Date: Fri, 21 Dec 2012 00:41:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244524 - in stable/9/sys: netinet netinet6 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 00:41:56 -0000 Author: delphij Date: Fri Dec 21 00:41:52 2012 New Revision: 244524 URL: http://svnweb.freebsd.org/changeset/base/244524 Log: MFC r241916: Remove __P. Submitted by: kevlo Modified: stable/9/sys/netinet/sctp_uio.h stable/9/sys/netinet/sctp_var.h stable/9/sys/netinet6/icmp6.c stable/9/sys/netinet6/in6.c stable/9/sys/netinet6/in6.h stable/9/sys/netinet6/in6_gif.h stable/9/sys/netinet6/in6_ifattach.h stable/9/sys/netinet6/in6_pcb.h stable/9/sys/netinet6/in6_src.c stable/9/sys/netinet6/in6_var.h stable/9/sys/netinet6/ip6_output.c stable/9/sys/netinet6/ip6_var.h stable/9/sys/netinet6/ip6protosw.h stable/9/sys/netinet6/nd6.c stable/9/sys/netinet6/nd6.h stable/9/sys/netinet6/nd6_rtr.c stable/9/sys/netinet6/pim6_var.h stable/9/sys/netinet6/scope6_var.h stable/9/sys/netinet6/sctp6_var.h stable/9/sys/netinet6/tcp6_var.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_uio.h ============================================================================== --- stable/9/sys/netinet/sctp_uio.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet/sctp_uio.h Fri Dec 21 00:41:52 2012 (r244524) @@ -1267,44 +1267,44 @@ sctp_sorecvmsg(struct socket *so, #if !(defined(_KERNEL)) && !(defined(__Userspace__)) __BEGIN_DECLS -int sctp_peeloff __P((int, sctp_assoc_t)); -int sctp_bindx __P((int, struct sockaddr *, int, int)); -int sctp_connectx __P((int, const struct sockaddr *, int, sctp_assoc_t *)); -int sctp_getaddrlen __P((sa_family_t)); -int sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **)); -void sctp_freepaddrs __P((struct sockaddr *)); -int sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **)); -void sctp_freeladdrs __P((struct sockaddr *)); -int sctp_opt_info __P((int, sctp_assoc_t, int, void *, socklen_t *)); +int sctp_peeloff(int, sctp_assoc_t); +int sctp_bindx(int, struct sockaddr *, int, int); +int sctp_connectx(int, const struct sockaddr *, int, sctp_assoc_t *); +int sctp_getaddrlen(sa_family_t); +int sctp_getpaddrs(int, sctp_assoc_t, struct sockaddr **); +void sctp_freepaddrs(struct sockaddr *); +int sctp_getladdrs(int, sctp_assoc_t, struct sockaddr **); +void sctp_freeladdrs(struct sockaddr *); +int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *); /* deprecated */ ssize_t sctp_sendmsg -__P((int, const void *, size_t, const struct sockaddr *, - socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t)); +(int, const void *, size_t, const struct sockaddr *, + socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); /* deprecated */ - ssize_t sctp_send __P((int, const void *, size_t, - const struct sctp_sndrcvinfo *, int)); + ssize_t sctp_send(int, const void *, size_t, + const struct sctp_sndrcvinfo *, int); /* deprecated */ - ssize_t sctp_sendx __P((int, const void *, size_t, struct sockaddr *, - int, struct sctp_sndrcvinfo *, int)); + ssize_t sctp_sendx(int, const void *, size_t, struct sockaddr *, + int, struct sctp_sndrcvinfo *, int); /* deprecated */ - ssize_t sctp_sendmsgx __P((int sd, const void *, size_t, struct sockaddr *, - int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t)); + ssize_t sctp_sendmsgx(int sd, const void *, size_t, struct sockaddr *, + int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); - sctp_assoc_t sctp_getassocid __P((int, struct sockaddr *)); + sctp_assoc_t sctp_getassocid(int, struct sockaddr *); /* deprecated */ - ssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *, socklen_t *, - struct sctp_sndrcvinfo *, int *)); + ssize_t sctp_recvmsg(int, void *, size_t, struct sockaddr *, socklen_t *, + struct sctp_sndrcvinfo *, int *); - ssize_t sctp_sendv __P((int, const struct iovec *, int, struct sockaddr *, - int, void *, socklen_t, unsigned int, int)); + ssize_t sctp_sendv(int, const struct iovec *, int, struct sockaddr *, + int, void *, socklen_t, unsigned int, int); - ssize_t sctp_recvv __P((int, const struct iovec *, int, struct sockaddr *, - socklen_t *, void *, socklen_t *, unsigned int *, int *)); + ssize_t sctp_recvv(int, const struct iovec *, int, struct sockaddr *, + socklen_t *, void *, socklen_t *, unsigned int *, int *); __END_DECLS Modified: stable/9/sys/netinet/sctp_var.h ============================================================================== --- stable/9/sys/netinet/sctp_var.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet/sctp_var.h Fri Dec 21 00:41:52 2012 (r244524) @@ -322,29 +322,29 @@ struct sctphdr; void sctp_close(struct socket *so); int sctp_disconnect(struct socket *so); -void sctp_ctlinput __P((int, struct sockaddr *, void *)); -int sctp_ctloutput __P((struct socket *, struct sockopt *)); +void sctp_ctlinput(int, struct sockaddr *, void *); +int sctp_ctloutput(struct socket *, struct sockopt *); #ifdef INET -void sctp_input_with_port __P((struct mbuf *, int, uint16_t)); +void sctp_input_with_port(struct mbuf *, int, uint16_t); #endif #ifdef INET -void sctp_input __P((struct mbuf *, int)); +void sctp_input(struct mbuf *, int); #endif -void sctp_pathmtu_adjustment __P((struct sctp_tcb *, uint16_t)); -void sctp_drain __P((void)); -void sctp_init __P((void)); +void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t); +void sctp_drain(void); +void sctp_init(void); void sctp_finish(void); int sctp_flush(struct socket *, int); -int sctp_shutdown __P((struct socket *)); +int sctp_shutdown(struct socket *); void sctp_notify -__P((struct sctp_inpcb *, struct ip *ip, struct sctphdr *, +(struct sctp_inpcb *, struct ip *ip, struct sctphdr *, struct sockaddr *, struct sctp_tcb *, - struct sctp_nets *)); + struct sctp_nets *); int sctp_bindx(struct socket *, int, struct sockaddr_storage *, int, int, struct proc *); Modified: stable/9/sys/netinet6/icmp6.c ============================================================================== --- stable/9/sys/netinet6/icmp6.c Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/icmp6.c Fri Dec 21 00:41:52 2012 (r244524) @@ -133,15 +133,15 @@ VNET_DECLARE(int, icmp6_nodeinfo); static void icmp6_errcount(struct icmp6errstat *, int, int); static int icmp6_rip6_input(struct mbuf **, int); static int icmp6_ratelimit(const struct in6_addr *, const int, const int); -static const char *icmp6_redirect_diag __P((struct in6_addr *, - struct in6_addr *, struct in6_addr *)); +static const char *icmp6_redirect_diag(struct in6_addr *, + struct in6_addr *, struct in6_addr *); static struct mbuf *ni6_input(struct mbuf *, int); static struct mbuf *ni6_nametodns(const char *, int, int); static int ni6_dnsmatch(const char *, int, const char *, int); -static int ni6_addrs __P((struct icmp6_nodeinfo *, struct mbuf *, - struct ifnet **, struct in6_addr *)); -static int ni6_store_addrs __P((struct icmp6_nodeinfo *, struct icmp6_nodeinfo *, - struct ifnet *, int)); +static int ni6_addrs(struct icmp6_nodeinfo *, struct mbuf *, + struct ifnet **, struct in6_addr *); +static int ni6_store_addrs(struct icmp6_nodeinfo *, struct icmp6_nodeinfo *, + struct ifnet *, int); static int icmp6_notify_error(struct mbuf **, int, int, int); /* Modified: stable/9/sys/netinet6/in6.c ============================================================================== --- stable/9/sys/netinet6/in6.c Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/in6.c Fri Dec 21 00:41:52 2012 (r244524) @@ -128,10 +128,10 @@ const struct in6_addr in6mask128 = IN6MA const struct sockaddr_in6 sa6_any = { sizeof(sa6_any), AF_INET6, 0, 0, IN6ADDR_ANY_INIT, 0 }; -static int in6_lifaddr_ioctl __P((struct socket *, u_long, caddr_t, - struct ifnet *, struct thread *)); -static int in6_ifinit __P((struct ifnet *, struct in6_ifaddr *, - struct sockaddr_in6 *, int)); +static int in6_lifaddr_ioctl(struct socket *, u_long, caddr_t, + struct ifnet *, struct thread *); +static int in6_ifinit(struct ifnet *, struct in6_ifaddr *, + struct sockaddr_in6 *, int); static void in6_unlink_ifa(struct in6_ifaddr *, struct ifnet *); int (*faithprefix_p)(struct in6_addr *); Modified: stable/9/sys/netinet6/in6.h ============================================================================== --- stable/9/sys/netinet6/in6.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/in6.h Fri Dec 21 00:41:52 2012 (r244524) @@ -635,22 +635,22 @@ struct cmsghdr; struct ip6_hdr; int in6_cksum_pseudo(struct ip6_hdr *, uint32_t, uint8_t, uint16_t); -int in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t)); -int in6_localaddr __P((struct in6_addr *)); +int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t); +int in6_localaddr(struct in6_addr *); int in6_localip(struct in6_addr *); -int in6_addrscope __P((struct in6_addr *)); -struct in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *)); -extern void in6_if_up __P((struct ifnet *)); +int in6_addrscope(struct in6_addr *); +struct in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *); +extern void in6_if_up(struct ifnet *); struct sockaddr; extern u_char ip6_protox[]; -void in6_sin6_2_sin __P((struct sockaddr_in *sin, - struct sockaddr_in6 *sin6)); -void in6_sin_2_v4mapsin6 __P((struct sockaddr_in *sin, - struct sockaddr_in6 *sin6)); -void in6_sin6_2_sin_in_sock __P((struct sockaddr *nam)); -void in6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam)); -extern void addrsel_policy_init __P((void)); +void in6_sin6_2_sin(struct sockaddr_in *sin, + struct sockaddr_in6 *sin6); +void in6_sin_2_v4mapsin6(struct sockaddr_in *sin, + struct sockaddr_in6 *sin6); +void in6_sin6_2_sin_in_sock(struct sockaddr *nam); +void in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam); +extern void addrsel_policy_init(void); #define satosin6(sa) ((struct sockaddr_in6 *)(sa)) #define sin6tosa(sin6) ((struct sockaddr *)(sin6)) @@ -674,43 +674,43 @@ typedef __socklen_t socklen_t; __BEGIN_DECLS struct cmsghdr; -extern int inet6_option_space __P((int)); -extern int inet6_option_init __P((void *, struct cmsghdr **, int)); -extern int inet6_option_append __P((struct cmsghdr *, const uint8_t *, - int, int)); -extern uint8_t *inet6_option_alloc __P((struct cmsghdr *, int, int, int)); -extern int inet6_option_next __P((const struct cmsghdr *, uint8_t **)); -extern int inet6_option_find __P((const struct cmsghdr *, uint8_t **, int)); - -extern size_t inet6_rthdr_space __P((int, int)); -extern struct cmsghdr *inet6_rthdr_init __P((void *, int)); -extern int inet6_rthdr_add __P((struct cmsghdr *, const struct in6_addr *, - unsigned int)); -extern int inet6_rthdr_lasthop __P((struct cmsghdr *, unsigned int)); +extern int inet6_option_space(int); +extern int inet6_option_init(void *, struct cmsghdr **, int); +extern int inet6_option_append(struct cmsghdr *, const uint8_t *, + int, int); +extern uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int); +extern int inet6_option_next(const struct cmsghdr *, uint8_t **); +extern int inet6_option_find(const struct cmsghdr *, uint8_t **, int); + +extern size_t inet6_rthdr_space(int, int); +extern struct cmsghdr *inet6_rthdr_init(void *, int); +extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *, + unsigned int); +extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int); #if 0 /* not implemented yet */ -extern int inet6_rthdr_reverse __P((const struct cmsghdr *, struct cmsghdr *)); +extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *); #endif -extern int inet6_rthdr_segments __P((const struct cmsghdr *)); -extern struct in6_addr *inet6_rthdr_getaddr __P((struct cmsghdr *, int)); -extern int inet6_rthdr_getflags __P((const struct cmsghdr *, int)); - -extern int inet6_opt_init __P((void *, socklen_t)); -extern int inet6_opt_append __P((void *, socklen_t, int, uint8_t, socklen_t, - uint8_t, void **)); -extern int inet6_opt_finish __P((void *, socklen_t, int)); -extern int inet6_opt_set_val __P((void *, int, void *, socklen_t)); - -extern int inet6_opt_next __P((void *, socklen_t, int, uint8_t *, socklen_t *, - void **)); -extern int inet6_opt_find __P((void *, socklen_t, int, uint8_t, socklen_t *, - void **)); -extern int inet6_opt_get_val __P((void *, int, void *, socklen_t)); -extern socklen_t inet6_rth_space __P((int, int)); -extern void *inet6_rth_init __P((void *, socklen_t, int, int)); -extern int inet6_rth_add __P((void *, const struct in6_addr *)); -extern int inet6_rth_reverse __P((const void *, void *)); -extern int inet6_rth_segments __P((const void *)); -extern struct in6_addr *inet6_rth_getaddr __P((const void *, int)); +extern int inet6_rthdr_segments(const struct cmsghdr *); +extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int); +extern int inet6_rthdr_getflags(const struct cmsghdr *, int); + +extern int inet6_opt_init(void *, socklen_t); +extern int inet6_opt_append(void *, socklen_t, int, uint8_t, socklen_t, + uint8_t, void **); +extern int inet6_opt_finish(void *, socklen_t, int); +extern int inet6_opt_set_val(void *, int, void *, socklen_t); + +extern int inet6_opt_next(void *, socklen_t, int, uint8_t *, socklen_t *, + void **); +extern int inet6_opt_find(void *, socklen_t, int, uint8_t, socklen_t *, + void **); +extern int inet6_opt_get_val(void *, int, void *, socklen_t); +extern socklen_t inet6_rth_space(int, int); +extern void *inet6_rth_init(void *, socklen_t, int, int); +extern int inet6_rth_add(void *, const struct in6_addr *); +extern int inet6_rth_reverse(const void *, void *); +extern int inet6_rth_segments(const void *); +extern struct in6_addr *inet6_rth_getaddr(const void *, int); __END_DECLS #endif /* __BSD_VISIBLE */ Modified: stable/9/sys/netinet6/in6_gif.h ============================================================================== --- stable/9/sys/netinet6/in6_gif.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/in6_gif.h Fri Dec 21 00:41:52 2012 (r244524) @@ -36,10 +36,10 @@ #define GIF_HLIM 30 struct gif_softc; -int in6_gif_input __P((struct mbuf **, int *, int)); -int in6_gif_output __P((struct ifnet *, int, struct mbuf *)); -int gif_encapcheck6 __P((const struct mbuf *, int, int, void *)); -int in6_gif_attach __P((struct gif_softc *)); -int in6_gif_detach __P((struct gif_softc *)); +int in6_gif_input(struct mbuf **, int *, int); +int in6_gif_output(struct ifnet *, int, struct mbuf *); +int gif_encapcheck6(const struct mbuf *, int, int, void *); +int in6_gif_attach(struct gif_softc *); +int in6_gif_detach(struct gif_softc *); #endif /* _NETINET6_IN6_GIF_H_ */ Modified: stable/9/sys/netinet6/in6_ifattach.h ============================================================================== --- stable/9/sys/netinet6/in6_ifattach.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/in6_ifattach.h Fri Dec 21 00:41:52 2012 (r244524) @@ -34,12 +34,12 @@ #define _NETINET6_IN6_IFATTACH_H_ #ifdef _KERNEL -void in6_ifattach __P((struct ifnet *, struct ifnet *)); -void in6_ifdetach __P((struct ifnet *)); -int in6_get_tmpifid __P((struct ifnet *, u_int8_t *, const u_int8_t *, int)); -void in6_tmpaddrtimer __P((void *)); -int in6_get_hw_ifid __P((struct ifnet *, struct in6_addr *)); -int in6_nigroup __P((struct ifnet *, const char *, int, struct in6_addr *)); +void in6_ifattach(struct ifnet *, struct ifnet *); +void in6_ifdetach(struct ifnet *); +int in6_get_tmpifid(struct ifnet *, u_int8_t *, const u_int8_t *, int); +void in6_tmpaddrtimer(void *); +int in6_get_hw_ifid(struct ifnet *, struct in6_addr *); +int in6_nigroup(struct ifnet *, const char *, int, struct in6_addr *); #endif /* _KERNEL */ #endif /* _NETINET6_IN6_IFATTACH_H_ */ Modified: stable/9/sys/netinet6/in6_pcb.h ============================================================================== --- stable/9/sys/netinet6/in6_pcb.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/in6_pcb.h Fri Dec 21 00:41:52 2012 (r244524) @@ -72,53 +72,53 @@ struct inpcbgroup * in6_pcbgroup_byhash(struct inpcbinfo *, u_int, uint32_t); struct inpcbgroup * - in6_pcbgroup_byinpcb __P((struct inpcb *)); + in6_pcbgroup_byinpcb(struct inpcb *); struct inpcbgroup * in6_pcbgroup_bymbuf(struct inpcbinfo *, struct mbuf *); struct inpcbgroup * - in6_pcbgroup_bytuple __P((struct inpcbinfo *, const struct in6_addr *, - u_short, const struct in6_addr *, u_short)); + in6_pcbgroup_bytuple(struct inpcbinfo *, const struct in6_addr *, + u_short, const struct in6_addr *, u_short); -void in6_pcbpurgeif0 __P((struct inpcbinfo *, struct ifnet *)); -void in6_losing __P((struct inpcb *)); -int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct ucred *)); -int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct ucred *)); -int in6_pcbconnect_mbuf __P((struct inpcb *, struct sockaddr *, - struct ucred *, struct mbuf *)); -void in6_pcbdisconnect __P((struct inpcb *)); +void in6_pcbpurgeif0(struct inpcbinfo *, struct ifnet *); +void in6_losing(struct inpcb *); +int in6_pcbbind(struct inpcb *, struct sockaddr *, struct ucred *); +int in6_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *); +int in6_pcbconnect_mbuf(struct inpcb *, struct sockaddr *, + struct ucred *, struct mbuf *); +void in6_pcbdisconnect(struct inpcb *); int in6_pcbladdr(struct inpcb *, struct sockaddr *, struct in6_addr *); struct inpcb * - in6_pcblookup_local __P((struct inpcbinfo *, + in6_pcblookup_local(struct inpcbinfo *, struct in6_addr *, u_short, int, - struct ucred *)); + struct ucred *); struct inpcb * - in6_pcblookup __P((struct inpcbinfo *, struct in6_addr *, + in6_pcblookup(struct inpcbinfo *, struct in6_addr *, u_int, struct in6_addr *, u_int, int, - struct ifnet *)); + struct ifnet *); struct inpcb * - in6_pcblookup_hash_locked __P((struct inpcbinfo *, struct in6_addr *, + in6_pcblookup_hash_locked(struct inpcbinfo *, struct in6_addr *, u_int, struct in6_addr *, u_int, int, - struct ifnet *)); + struct ifnet *); struct inpcb * - in6_pcblookup_mbuf __P((struct inpcbinfo *, struct in6_addr *, + in6_pcblookup_mbuf(struct inpcbinfo *, struct in6_addr *, u_int, struct in6_addr *, u_int, int, - struct ifnet *ifp, struct mbuf *)); -void in6_pcbnotify __P((struct inpcbinfo *, struct sockaddr *, + struct ifnet *ifp, struct mbuf *); +void in6_pcbnotify(struct inpcbinfo *, struct sockaddr *, u_int, const struct sockaddr *, u_int, int, void *, - struct inpcb *(*)(struct inpcb *, int))); + struct inpcb *(*)(struct inpcb *, int)); struct inpcb * - in6_rtchange __P((struct inpcb *, int)); + in6_rtchange(struct inpcb *, int); struct sockaddr * - in6_sockaddr __P((in_port_t port, struct in6_addr *addr_p)); + in6_sockaddr(in_port_t port, struct in6_addr *addr_p); struct sockaddr * - in6_v4mapsin6_sockaddr __P((in_port_t port, struct in_addr *addr_p)); -int in6_getpeeraddr __P((struct socket *so, struct sockaddr **nam)); -int in6_getsockaddr __P((struct socket *so, struct sockaddr **nam)); -int in6_mapped_sockaddr __P((struct socket *so, struct sockaddr **nam)); -int in6_mapped_peeraddr __P((struct socket *so, struct sockaddr **nam)); -int in6_selecthlim __P((struct in6pcb *, struct ifnet *)); -int in6_pcbsetport __P((struct in6_addr *, struct inpcb *, struct ucred *)); -void init_sin6 __P((struct sockaddr_in6 *sin6, struct mbuf *m)); + in6_v4mapsin6_sockaddr(in_port_t port, struct in_addr *addr_p); +int in6_getpeeraddr(struct socket *so, struct sockaddr **nam); +int in6_getsockaddr(struct socket *so, struct sockaddr **nam); +int in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam); +int in6_mapped_peeraddr(struct socket *so, struct sockaddr **nam); +int in6_selecthlim(struct in6pcb *, struct ifnet *); +int in6_pcbsetport(struct in6_addr *, struct inpcb *, struct ucred *); +void init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m); #endif /* _KERNEL */ #endif /* !_NETINET6_IN6_PCB_H_ */ Modified: stable/9/sys/netinet6/in6_src.c ============================================================================== --- stable/9/sys/netinet6/in6_src.c Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/in6_src.c Fri Dec 21 00:41:52 2012 (r244524) @@ -127,20 +127,20 @@ static VNET_DEFINE(struct in6_addrpolicy VNET_DEFINE(int, ip6_prefer_tempaddr) = 0; -static int selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, +static int selectroute(struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *, struct ifnet **, - struct rtentry **, int, u_int)); -static int in6_selectif __P((struct sockaddr_in6 *, struct ip6_pktopts *, + struct rtentry **, int, u_int); +static int in6_selectif(struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *ro, struct ifnet **, - struct ifnet *, u_int)); + struct ifnet *, u_int); static struct in6_addrpolicy *lookup_addrsel_policy(struct sockaddr_in6 *); static void init_policy_queue(void); static int add_addrsel_policyent(struct in6_addrpolicy *); static int delete_addrsel_policyent(struct in6_addrpolicy *); -static int walk_addrsel_policy __P((int (*)(struct in6_addrpolicy *, void *), - void *)); +static int walk_addrsel_policy(int (*)(struct in6_addrpolicy *, void *), + void *); static int dump_addrsel_policyent(struct in6_addrpolicy *, void *); static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *); Modified: stable/9/sys/netinet6/in6_var.h ============================================================================== --- stable/9/sys/netinet6/in6_var.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/in6_var.h Fri Dec 21 00:41:52 2012 (r244524) @@ -750,36 +750,36 @@ int in6_leavegroup(struct in6_multi_mshi /* flags to in6_update_ifa */ #define IN6_IFAUPDATE_DADDELAY 0x1 /* first time to configure an address */ -int in6_mask2len __P((struct in6_addr *, u_char *)); -int in6_control __P((struct socket *, u_long, caddr_t, struct ifnet *, - struct thread *)); -int in6_update_ifa __P((struct ifnet *, struct in6_aliasreq *, - struct in6_ifaddr *, int)); -void in6_purgeaddr __P((struct ifaddr *)); -int in6if_do_dad __P((struct ifnet *)); -void in6_purgeif __P((struct ifnet *)); -void in6_savemkludge __P((struct in6_ifaddr *)); -void *in6_domifattach __P((struct ifnet *)); -void in6_domifdetach __P((struct ifnet *, void *)); -void in6_setmaxmtu __P((void)); -int in6_if2idlen __P((struct ifnet *)); -struct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *, int)); -struct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *, struct in6_addr *)); -char *ip6_sprintf __P((char *, const struct in6_addr *)); -int in6_addr2zoneid __P((struct ifnet *, struct in6_addr *, u_int32_t *)); -int in6_matchlen __P((struct in6_addr *, struct in6_addr *)); -int in6_are_prefix_equal __P((struct in6_addr *, struct in6_addr *, int)); -void in6_prefixlen2mask __P((struct in6_addr *, int)); -int in6_prefix_ioctl __P((struct socket *, u_long, caddr_t, - struct ifnet *)); -int in6_prefix_add_ifid __P((int, struct in6_ifaddr *)); -void in6_prefix_remove_ifid __P((int, struct in6_ifaddr *)); -void in6_purgeprefix __P((struct ifnet *)); +int in6_mask2len(struct in6_addr *, u_char *); +int in6_control(struct socket *, u_long, caddr_t, struct ifnet *, + struct thread *); +int in6_update_ifa(struct ifnet *, struct in6_aliasreq *, + struct in6_ifaddr *, int); +void in6_purgeaddr(struct ifaddr *); +int in6if_do_dad(struct ifnet *); +void in6_purgeif(struct ifnet *); +void in6_savemkludge(struct in6_ifaddr *); +void *in6_domifattach(struct ifnet *); +void in6_domifdetach(struct ifnet *, void *); +void in6_setmaxmtu(void); +int in6_if2idlen(struct ifnet *); +struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int); +struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, struct in6_addr *); +char *ip6_sprintf(char *, const struct in6_addr *); +int in6_addr2zoneid(struct ifnet *, struct in6_addr *, u_int32_t *); +int in6_matchlen(struct in6_addr *, struct in6_addr *); +int in6_are_prefix_equal(struct in6_addr *, struct in6_addr *, int); +void in6_prefixlen2mask(struct in6_addr *, int); +int in6_prefix_ioctl(struct socket *, u_long, caddr_t, + struct ifnet *); +int in6_prefix_add_ifid(int, struct in6_ifaddr *); +void in6_prefix_remove_ifid(int, struct in6_ifaddr *); +void in6_purgeprefix(struct ifnet *); void in6_ifremloop(struct ifaddr *); void in6_ifaddloop(struct ifaddr *); -int in6_is_addr_deprecated __P((struct sockaddr_in6 *)); -int in6_src_ioctl __P((u_long, caddr_t)); +int in6_is_addr_deprecated(struct sockaddr_in6 *); +int in6_src_ioctl(u_long, caddr_t); /* * Extended API for IPv6 FIB support. Modified: stable/9/sys/netinet6/ip6_output.c ============================================================================== --- stable/9/sys/netinet6/ip6_output.c Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/ip6_output.c Fri Dec 21 00:41:52 2012 (r244524) @@ -130,21 +130,21 @@ struct ip6_exthdrs { struct mbuf *ip6e_dest2; }; -static int ip6_pcbopt __P((int, u_char *, int, struct ip6_pktopts **, - struct ucred *, int)); -static int ip6_pcbopts __P((struct ip6_pktopts **, struct mbuf *, - struct socket *, struct sockopt *)); +static int ip6_pcbopt(int, u_char *, int, struct ip6_pktopts **, + struct ucred *, int); +static int ip6_pcbopts(struct ip6_pktopts **, struct mbuf *, + struct socket *, struct sockopt *); static int ip6_getpcbopt(struct ip6_pktopts *, int, struct sockopt *); -static int ip6_setpktopt __P((int, u_char *, int, struct ip6_pktopts *, - struct ucred *, int, int, int)); +static int ip6_setpktopt(int, u_char *, int, struct ip6_pktopts *, + struct ucred *, int, int, int); static int ip6_copyexthdr(struct mbuf **, caddr_t, int); -static int ip6_insertfraghdr __P((struct mbuf *, struct mbuf *, int, - struct ip6_frag **)); +static int ip6_insertfraghdr(struct mbuf *, struct mbuf *, int, + struct ip6_frag **); static int ip6_insert_jumboopt(struct ip6_exthdrs *, u_int32_t); static int ip6_splithdr(struct mbuf *, struct ip6_exthdrs *); -static int ip6_getpmtu __P((struct route_in6 *, struct route_in6 *, - struct ifnet *, struct in6_addr *, u_long *, int *, u_int)); +static int ip6_getpmtu(struct route_in6 *, struct route_in6 *, + struct ifnet *, struct in6_addr *, u_long *, int *, u_int); static int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *, int); Modified: stable/9/sys/netinet6/ip6_var.h ============================================================================== --- stable/9/sys/netinet6/ip6_var.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/ip6_var.h Fri Dec 21 00:41:52 2012 (r244524) @@ -371,87 +371,87 @@ struct sockopt; struct inpcb; -int icmp6_ctloutput __P((struct socket *, struct sockopt *sopt)); +int icmp6_ctloutput(struct socket *, struct sockopt *sopt); struct in6_ifaddr; -void ip6_init __P((void)); +void ip6_init(void); #ifdef VIMAGE -void ip6_destroy __P((void)); +void ip6_destroy(void); #endif int ip6proto_register(short); int ip6proto_unregister(short); -void ip6_input __P((struct mbuf *)); -struct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *)); -void ip6_freepcbopts __P((struct ip6_pktopts *)); - -int ip6_unknown_opt __P((u_int8_t *, struct mbuf *, int)); -char * ip6_get_prevhdr __P((struct mbuf *, int)); -int ip6_nexthdr __P((struct mbuf *, int, int, int *)); -int ip6_lasthdr __P((struct mbuf *, int, int, int *)); +void ip6_input(struct mbuf *); +struct in6_ifaddr *ip6_getdstifaddr(struct mbuf *); +void ip6_freepcbopts(struct ip6_pktopts *); + +int ip6_unknown_opt(u_int8_t *, struct mbuf *, int); +char * ip6_get_prevhdr(struct mbuf *, int); +int ip6_nexthdr(struct mbuf *, int, int, int *); +int ip6_lasthdr(struct mbuf *, int, int, int *); #ifdef __notyet__ -struct ip6aux *ip6_findaux __P((struct mbuf *)); +struct ip6aux *ip6_findaux(struct mbuf *); #endif extern int (*ip6_mforward)(struct ip6_hdr *, struct ifnet *, struct mbuf *); -int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *, - u_int32_t *)); +int ip6_process_hopopts(struct mbuf *, u_int8_t *, int, u_int32_t *, + u_int32_t *); struct mbuf **ip6_savecontrol_v4(struct inpcb *, struct mbuf *, struct mbuf **, int *); -void ip6_savecontrol __P((struct inpcb *, struct mbuf *, struct mbuf **)); -void ip6_notify_pmtu __P((struct inpcb *, struct sockaddr_in6 *, - u_int32_t *)); -int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); +void ip6_savecontrol(struct inpcb *, struct mbuf *, struct mbuf **); +void ip6_notify_pmtu(struct inpcb *, struct sockaddr_in6 *, + u_int32_t *); +int ip6_sysctl(int *, u_int, void *, size_t *, void *, size_t); -void ip6_forward __P((struct mbuf *, int)); +void ip6_forward(struct mbuf *, int); -void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *)); -int ip6_output __P((struct mbuf *, struct ip6_pktopts *, +void ip6_mloopback(struct ifnet *, struct mbuf *, struct sockaddr_in6 *); +int ip6_output(struct mbuf *, struct ip6_pktopts *, struct route_in6 *, int, struct ip6_moptions *, struct ifnet **, - struct inpcb *)); -int ip6_ctloutput __P((struct socket *, struct sockopt *)); -int ip6_raw_ctloutput __P((struct socket *, struct sockopt *)); -void ip6_initpktopts __P((struct ip6_pktopts *)); -int ip6_setpktopts __P((struct mbuf *, struct ip6_pktopts *, - struct ip6_pktopts *, struct ucred *, int)); -void ip6_clearpktopts __P((struct ip6_pktopts *, int)); -struct ip6_pktopts *ip6_copypktopts __P((struct ip6_pktopts *, int)); -int ip6_optlen __P((struct inpcb *)); - -int route6_input __P((struct mbuf **, int *, int)); - -void frag6_init __P((void)); -int frag6_input __P((struct mbuf **, int *, int)); -void frag6_slowtimo __P((void)); -void frag6_drain __P((void)); - -void rip6_init __P((void)); -int rip6_input __P((struct mbuf **, int *, int)); -void rip6_ctlinput __P((int, struct sockaddr *, void *)); -int rip6_ctloutput __P((struct socket *, struct sockopt *)); -int rip6_output __P((struct mbuf *, ...)); -int rip6_usrreq __P((struct socket *, - int, struct mbuf *, struct mbuf *, struct mbuf *, struct thread *)); + struct inpcb *); +int ip6_ctloutput(struct socket *, struct sockopt *); +int ip6_raw_ctloutput(struct socket *, struct sockopt *); +void ip6_initpktopts(struct ip6_pktopts *); +int ip6_setpktopts(struct mbuf *, struct ip6_pktopts *, + struct ip6_pktopts *, struct ucred *, int); +void ip6_clearpktopts(struct ip6_pktopts *, int); +struct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int); +int ip6_optlen(struct inpcb *); + +int route6_input(struct mbuf **, int *, int); + +void frag6_init(void); +int frag6_input(struct mbuf **, int *, int); +void frag6_slowtimo(void); +void frag6_drain(void); + +void rip6_init(void); +int rip6_input(struct mbuf **, int *, int); +void rip6_ctlinput(int, struct sockaddr *, void *); +int rip6_ctloutput(struct socket *, struct sockopt *); +int rip6_output(struct mbuf *, ...); +int rip6_usrreq(struct socket *, + int, struct mbuf *, struct mbuf *, struct mbuf *, struct thread *); -int dest6_input __P((struct mbuf **, int *, int)); -int none_input __P((struct mbuf **, int *, int)); +int dest6_input(struct mbuf **, int *, int); +int none_input(struct mbuf **, int *, int); int in6_selectsrc(struct sockaddr_in6 *, struct ip6_pktopts *, struct inpcb *inp, struct route_in6 *, struct ucred *cred, struct ifnet **, struct in6_addr *); -int in6_selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, +int in6_selectroute(struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *, struct ifnet **, - struct rtentry **)); + struct rtentry **); int in6_selectroute_fib(struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *, struct ifnet **, struct rtentry **, u_int); -u_int32_t ip6_randomid __P((void)); -u_int32_t ip6_randomflowlabel __P((void)); +u_int32_t ip6_randomid(void); +u_int32_t ip6_randomflowlabel(void); #endif /* _KERNEL */ #endif /* !_NETINET6_IP6_VAR_H_ */ Modified: stable/9/sys/netinet6/ip6protosw.h ============================================================================== --- stable/9/sys/netinet6/ip6protosw.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/ip6protosw.h Fri Dec 21 00:41:52 2012 (r244524) @@ -118,26 +118,26 @@ struct ip6protosw { /* protocol-protocol hooks */ int (*pr_input) /* input to protocol (from below) */ - __P((struct mbuf **, int *, int)); + (struct mbuf **, int *, int); int (*pr_output) /* output to protocol (from above) */ - __P((struct mbuf *, ...)); + (struct mbuf *, ...); void (*pr_ctlinput) /* control input (from below) */ - __P((int, struct sockaddr *, void *)); + (int, struct sockaddr *, void *); int (*pr_ctloutput) /* control output (from above) */ - __P((struct socket *, struct sockopt *)); + (struct socket *, struct sockopt *); /* utility hooks */ void (*pr_init) /* initialization hook */ - __P((void)); + (void); void (*pr_destroy) /* cleanup hook */ - __P((void)); + (void); void (*pr_fasttimo) /* fast timeout (200ms) */ - __P((void)); + (void); void (*pr_slowtimo) /* slow timeout (500ms) */ - __P((void)); + (void); void (*pr_drain) /* flush any excess space possible */ - __P((void)); + (void); struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ }; Modified: stable/9/sys/netinet6/nd6.c ============================================================================== --- stable/9/sys/netinet6/nd6.c Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/nd6.c Fri Dec 21 00:41:52 2012 (r244524) @@ -124,8 +124,8 @@ static struct sockaddr_in6 all1_sa; int (*send_sendso_input_hook)(struct mbuf *, struct ifnet *, int, int); -static int nd6_is_new_addr_neighbor __P((struct sockaddr_in6 *, - struct ifnet *)); +static int nd6_is_new_addr_neighbor(struct sockaddr_in6 *, + struct ifnet *); static void nd6_setmtu0(struct ifnet *, struct nd_ifinfo *); static void nd6_slowtimo(void *); static int regen_tmpaddr(struct in6_ifaddr *); Modified: stable/9/sys/netinet6/nd6.h ============================================================================== --- stable/9/sys/netinet6/nd6.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/nd6.h Fri Dec 21 00:41:52 2012 (r244524) @@ -384,68 +384,68 @@ union nd_opts { /* XXX: need nd6_var.h?? */ /* nd6.c */ -void nd6_init __P((void)); +void nd6_init(void); #ifdef VIMAGE -void nd6_destroy __P((void)); +void nd6_destroy(void); #endif -struct nd_ifinfo *nd6_ifattach __P((struct ifnet *)); -void nd6_ifdetach __P((struct nd_ifinfo *)); -int nd6_is_addr_neighbor __P((struct sockaddr_in6 *, struct ifnet *)); -void nd6_option_init __P((void *, int, union nd_opts *)); -struct nd_opt_hdr *nd6_option __P((union nd_opts *)); -int nd6_options __P((union nd_opts *)); -struct llentry *nd6_lookup __P((struct in6_addr *, int, struct ifnet *)); -void nd6_setmtu __P((struct ifnet *)); -void nd6_llinfo_settimer __P((struct llentry *, long)); -void nd6_llinfo_settimer_locked __P((struct llentry *, long)); -void nd6_timer __P((void *)); -void nd6_purge __P((struct ifnet *)); -void nd6_nud_hint __P((struct rtentry *, struct in6_addr *, int)); -int nd6_resolve __P((struct ifnet *, struct rtentry *, struct mbuf *, - struct sockaddr *, u_char *)); -void nd6_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *)); -int nd6_ioctl __P((u_long, caddr_t, struct ifnet *)); -struct llentry *nd6_cache_lladdr __P((struct ifnet *, struct in6_addr *, - char *, int, int, int)); -int nd6_output __P((struct ifnet *, struct ifnet *, struct mbuf *, - struct sockaddr_in6 *, struct rtentry *)); -int nd6_output_lle __P((struct ifnet *, struct ifnet *, struct mbuf *, +struct nd_ifinfo *nd6_ifattach(struct ifnet *); +void nd6_ifdetach(struct nd_ifinfo *); +int nd6_is_addr_neighbor(struct sockaddr_in6 *, struct ifnet *); +void nd6_option_init(void *, int, union nd_opts *); +struct nd_opt_hdr *nd6_option(union nd_opts *); +int nd6_options(union nd_opts *); +struct llentry *nd6_lookup(struct in6_addr *, int, struct ifnet *); +void nd6_setmtu(struct ifnet *); +void nd6_llinfo_settimer(struct llentry *, long); +void nd6_llinfo_settimer_locked(struct llentry *, long); +void nd6_timer(void *); +void nd6_purge(struct ifnet *); +void nd6_nud_hint(struct rtentry *, struct in6_addr *, int); +int nd6_resolve(struct ifnet *, struct rtentry *, struct mbuf *, + struct sockaddr *, u_char *); +void nd6_rtrequest(int, struct rtentry *, struct rt_addrinfo *); +int nd6_ioctl(u_long, caddr_t, struct ifnet *); +struct llentry *nd6_cache_lladdr(struct ifnet *, struct in6_addr *, + char *, int, int, int); +int nd6_output(struct ifnet *, struct ifnet *, struct mbuf *, + struct sockaddr_in6 *, struct rtentry *); +int nd6_output_lle(struct ifnet *, struct ifnet *, struct mbuf *, struct sockaddr_in6 *, struct rtentry *, struct llentry *, - struct mbuf **)); -int nd6_output_flush __P((struct ifnet *, struct ifnet *, struct mbuf *, - struct sockaddr_in6 *, struct route *)); -int nd6_need_cache __P((struct ifnet *)); -int nd6_storelladdr __P((struct ifnet *, struct mbuf *, - struct sockaddr *, u_char *, struct llentry **)); + struct mbuf **); +int nd6_output_flush(struct ifnet *, struct ifnet *, struct mbuf *, + struct sockaddr_in6 *, struct route *); +int nd6_need_cache(struct ifnet *); +int nd6_storelladdr(struct ifnet *, struct mbuf *, + struct sockaddr *, u_char *, struct llentry **); /* nd6_nbr.c */ -void nd6_na_input __P((struct mbuf *, int, int)); -void nd6_na_output __P((struct ifnet *, const struct in6_addr *, - const struct in6_addr *, u_long, int, struct sockaddr *)); -void nd6_ns_input __P((struct mbuf *, int, int)); -void nd6_ns_output __P((struct ifnet *, const struct in6_addr *, - const struct in6_addr *, struct llentry *, int)); -caddr_t nd6_ifptomac __P((struct ifnet *)); -void nd6_dad_start __P((struct ifaddr *, int)); -void nd6_dad_stop __P((struct ifaddr *)); -void nd6_dad_duplicated __P((struct ifaddr *)); +void nd6_na_input(struct mbuf *, int, int); +void nd6_na_output(struct ifnet *, const struct in6_addr *, + const struct in6_addr *, u_long, int, struct sockaddr *); +void nd6_ns_input(struct mbuf *, int, int); +void nd6_ns_output(struct ifnet *, const struct in6_addr *, + const struct in6_addr *, struct llentry *, int); +caddr_t nd6_ifptomac(struct ifnet *); +void nd6_dad_start(struct ifaddr *, int); +void nd6_dad_stop(struct ifaddr *); +void nd6_dad_duplicated(struct ifaddr *); /* nd6_rtr.c */ -void nd6_rs_input __P((struct mbuf *, int, int)); -void nd6_ra_input __P((struct mbuf *, int, int)); -void prelist_del __P((struct nd_prefix *)); -void defrouter_reset __P((void)); -void defrouter_select __P((void)); -void defrtrlist_del __P((struct nd_defrouter *)); -void prelist_remove __P((struct nd_prefix *)); -int nd6_prelist_add __P((struct nd_prefixctl *, struct nd_defrouter *, - struct nd_prefix **)); -void pfxlist_onlink_check __P((void)); -struct nd_defrouter *defrouter_lookup __P((struct in6_addr *, struct ifnet *)); -struct nd_prefix *nd6_prefix_lookup __P((struct nd_prefixctl *)); -void rt6_flush __P((struct in6_addr *, struct ifnet *)); -int nd6_setdefaultiface __P((int)); -int in6_tmpifadd __P((const struct in6_ifaddr *, int, int)); +void nd6_rs_input(struct mbuf *, int, int); +void nd6_ra_input(struct mbuf *, int, int); +void prelist_del(struct nd_prefix *); +void defrouter_reset(void); +void defrouter_select(void); +void defrtrlist_del(struct nd_defrouter *); +void prelist_remove(struct nd_prefix *); +int nd6_prelist_add(struct nd_prefixctl *, struct nd_defrouter *, + struct nd_prefix **); +void pfxlist_onlink_check(void); +struct nd_defrouter *defrouter_lookup(struct in6_addr *, struct ifnet *); +struct nd_prefix *nd6_prefix_lookup(struct nd_prefixctl *); +void rt6_flush(struct in6_addr *, struct ifnet *); +int nd6_setdefaultiface(int); +int in6_tmpifadd(const struct in6_ifaddr *, int, int); #endif /* _KERNEL */ Modified: stable/9/sys/netinet6/nd6_rtr.c ============================================================================== --- stable/9/sys/netinet6/nd6_rtr.c Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/nd6_rtr.c Fri Dec 21 00:41:52 2012 (r244524) @@ -68,11 +68,11 @@ __FBSDID("$FreeBSD$"); static int rtpref(struct nd_defrouter *); static struct nd_defrouter *defrtrlist_update(struct nd_defrouter *); -static int prelist_update __P((struct nd_prefixctl *, struct nd_defrouter *, - struct mbuf *, int)); -static struct in6_ifaddr *in6_ifadd(struct nd_prefixctl *, int); -static struct nd_pfxrouter *pfxrtr_lookup __P((struct nd_prefix *, - struct nd_defrouter *)); +static int prelist_update(struct nd_prefixctl *, struct nd_defrouter *, + struct mbuf *, int); +static struct in6_ifaddr *in6_ifadd(struct nd_prefixctl *, int); +static struct nd_pfxrouter *pfxrtr_lookup(struct nd_prefix *, + struct nd_defrouter *); static void pfxrtr_add(struct nd_prefix *, struct nd_defrouter *); static void pfxrtr_del(struct nd_pfxrouter *); static struct nd_pfxrouter *find_pfxlist_reachable_router @@ -81,8 +81,8 @@ static void defrouter_delreq(struct nd_d static void nd6_rtmsg(int, struct rtentry *); static int in6_init_prefix_ltimes(struct nd_prefix *); -static void in6_init_address_ltimes __P((struct nd_prefix *, - struct in6_addrlifetime *)); +static void in6_init_address_ltimes(struct nd_prefix *, + struct in6_addrlifetime *); static int nd6_prefix_onlink(struct nd_prefix *); static int nd6_prefix_offlink(struct nd_prefix *); Modified: stable/9/sys/netinet6/pim6_var.h ============================================================================== --- stable/9/sys/netinet6/pim6_var.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/pim6_var.h Fri Dec 21 00:41:52 2012 (r244524) @@ -52,7 +52,7 @@ struct pim6stat { }; #if (defined(KERNEL)) || (defined(_KERNEL)) -int pim6_input __P((struct mbuf **, int*, int)); +int pim6_input(struct mbuf **, int*, int); #endif /* KERNEL */ /* Modified: stable/9/sys/netinet6/scope6_var.h ============================================================================== --- stable/9/sys/netinet6/scope6_var.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/scope6_var.h Fri Dec 21 00:41:52 2012 (r244524) @@ -42,18 +42,18 @@ struct scope6_id { u_int32_t s6id_list[16]; }; -void scope6_init __P((void)); -struct scope6_id *scope6_ifattach __P((struct ifnet *)); -void scope6_ifdetach __P((struct scope6_id *)); -int scope6_set __P((struct ifnet *, struct scope6_id *)); -int scope6_get __P((struct ifnet *, struct scope6_id *)); -void scope6_setdefault __P((struct ifnet *)); -int scope6_get_default __P((struct scope6_id *)); -u_int32_t scope6_addr2default __P((struct in6_addr *)); -int sa6_embedscope __P((struct sockaddr_in6 *, int)); -int sa6_recoverscope __P((struct sockaddr_in6 *)); -int in6_setscope __P((struct in6_addr *, struct ifnet *, u_int32_t *)); -int in6_clearscope __P((struct in6_addr *)); +void scope6_init(void); +struct scope6_id *scope6_ifattach(struct ifnet *); +void scope6_ifdetach(struct scope6_id *); +int scope6_set(struct ifnet *, struct scope6_id *); +int scope6_get(struct ifnet *, struct scope6_id *); +void scope6_setdefault(struct ifnet *); +int scope6_get_default(struct scope6_id *); +u_int32_t scope6_addr2default(struct in6_addr *); +int sa6_embedscope(struct sockaddr_in6 *, int); +int sa6_recoverscope(struct sockaddr_in6 *); +int in6_setscope(struct in6_addr *, struct ifnet *, u_int32_t *); +int in6_clearscope(struct in6_addr *); uint16_t in6_getscope(struct in6_addr *); #endif /* _KERNEL */ Modified: stable/9/sys/netinet6/sctp6_var.h ============================================================================== --- stable/9/sys/netinet6/sctp6_var.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/sctp6_var.h Fri Dec 21 00:41:52 2012 (r244524) @@ -42,11 +42,11 @@ SYSCTL_DECL(_net_inet6_sctp6); extern struct pr_usrreqs sctp6_usrreqs; -int sctp6_input __P((struct mbuf **, int *, int)); +int sctp6_input(struct mbuf **, int *, int); int sctp6_output -__P((struct sctp_inpcb *, struct mbuf *, struct sockaddr *, - struct mbuf *, struct proc *)); - void sctp6_ctlinput __P((int, struct sockaddr *, void *)); +(struct sctp_inpcb *, struct mbuf *, struct sockaddr *, + struct mbuf *, struct proc *); + void sctp6_ctlinput(int, struct sockaddr *, void *); extern void sctp6_notify(struct sctp_inpcb *inp, Modified: stable/9/sys/netinet6/tcp6_var.h ============================================================================== --- stable/9/sys/netinet6/tcp6_var.h Thu Dec 20 23:21:20 2012 (r244523) +++ stable/9/sys/netinet6/tcp6_var.h Fri Dec 21 00:41:52 2012 (r244524) @@ -71,9 +71,9 @@ VNET_DECLARE(int, tcp_v6mssdflt); /* XXX #endif struct ip6_hdr; -void tcp6_ctlinput __P((int, struct sockaddr *, void *)); -void tcp6_init __P((void)); -int tcp6_input __P((struct mbuf **, int *, int)); +void tcp6_ctlinput(int, struct sockaddr *, void *); +void tcp6_init(void); +int tcp6_input(struct mbuf **, int *, int); struct rtentry *tcp_rtlookup6(struct in_conninfo *); extern struct pr_usrreqs tcp6_usrreqs; From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 01:19:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E290768F; Fri, 21 Dec 2012 01:19:49 +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 C362F8FC12; Fri, 21 Dec 2012 01:19:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBL1Jn0Q060632; Fri, 21 Dec 2012 01:19:49 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBL1Jn1T060627; Fri, 21 Dec 2012 01:19:49 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201212210119.qBL1Jn1T060627@svn.freebsd.org> From: Neel Natu Date: Fri, 21 Dec 2012 01:19:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244525 - head/usr.sbin/acpi/acpidump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 01:19:50 -0000 Author: neel Date: Fri Dec 21 01:19:48 2012 New Revision: 244525 URL: http://svnweb.freebsd.org/changeset/base/244525 Log: Teach acpidump to dump the DMA Remapping Reporting table (aka DMAR). The DMAR table is documented in chapter 8 of the Intel VT-d specification. Reviewed by: jhb Obtained from: NetApp Modified: head/usr.sbin/acpi/acpidump/acpi.c head/usr.sbin/acpi/acpidump/acpidump.8 Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Fri Dec 21 00:41:52 2012 (r244524) +++ head/usr.sbin/acpi/acpidump/acpi.c Fri Dec 21 01:19:48 2012 (r244525) @@ -123,6 +123,31 @@ static const char *TCPA_pcclient_strings "Table of Devices", }; +#define PRINTFLAG_END() printflag_end() + +static char pf_sep = '{'; + +static void +printflag_end(void) +{ + + if (pf_sep != '{') { + printf("}"); + pf_sep = '{'; + } + printf("\n"); +} + +static void +printflag(uint64_t var, uint64_t mask, const char *name) +{ + + if (var & mask) { + printf("%c%s", pf_sep, name); + pf_sep = ','; + } +} + static void acpi_print_string(char *s, size_t length) { @@ -729,6 +754,238 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); } +static const char * +devscope_type2str(int type) +{ + static char typebuf[16]; + + switch (type) { + case 1: + return ("PCI Endpoint Device"); + case 2: + return ("PCI Sub-Hierarchy"); + case 3: + return ("IOAPIC"); + case 4: + return ("HPET"); + default: + snprintf(typebuf, sizeof(typebuf), "%d", type); + return (typebuf); + } +} + +static int +acpi_handle_dmar_devscope(void *addr, int remaining) +{ + char sep; + int pathlen; + ACPI_DMAR_PCI_PATH *path, *pathend; + ACPI_DMAR_DEVICE_SCOPE *devscope = addr; + + if (remaining < (int)sizeof(ACPI_DMAR_DEVICE_SCOPE)) + return (-1); + + if (remaining < devscope->Length) + return (-1); + + printf("\n"); + printf("\t\tType=%s\n", devscope_type2str(devscope->EntryType)); + printf("\t\tLength=%d\n", devscope->Length); + printf("\t\tEnumerationId=%d\n", devscope->EnumerationId); + printf("\t\tStartBusNumber=%d\n", devscope->Bus); + + path = (ACPI_DMAR_PCI_PATH *)(devscope + 1); + pathlen = devscope->Length - sizeof(ACPI_DMAR_DEVICE_SCOPE); + pathend = path + pathlen / sizeof(ACPI_DMAR_PCI_PATH); + if (path < pathend) { + sep = '{'; + printf("\t\tPath="); + do { + printf("%c%d:%d", sep, path->Device, path->Function); + sep=','; + path++; + } while (path < pathend); + printf("}\n"); + } + + return (devscope->Length); +} + +static void +acpi_handle_dmar_drhd(ACPI_DMAR_HARDWARE_UNIT *drhd) +{ + char *cp; + int remaining, consumed; + + printf("\n"); + printf("\tType=DRHD\n"); + printf("\tLength=%d\n", drhd->Header.Length); + +#define PRINTFLAG(var, flag) printflag((var), ACPI_DMAR_## flag, #flag) + + printf("\tFlags="); + PRINTFLAG(drhd->Flags, INCLUDE_ALL); + PRINTFLAG_END(); + +#undef PRINTFLAG + + printf("\tSegment=%d\n", drhd->Segment); + printf("\tAddress=0x%0jx\n", drhd->Address); + + remaining = drhd->Header.Length - sizeof(ACPI_DMAR_HARDWARE_UNIT); + if (remaining > 0) + printf("\tDevice Scope:"); + while (remaining > 0) { + cp = (char *)drhd + drhd->Header.Length - remaining; + consumed = acpi_handle_dmar_devscope(cp, remaining); + if (consumed <= 0) + break; + else + remaining -= consumed; + } +} + +static void +acpi_handle_dmar_rmrr(ACPI_DMAR_RESERVED_MEMORY *rmrr) +{ + char *cp; + int remaining, consumed; + + printf("\n"); + printf("\tType=RMRR\n"); + printf("\tLength=%d\n", rmrr->Header.Length); + printf("\tSegment=%d\n", rmrr->Segment); + printf("\tBaseAddress=0x%0jx\n", rmrr->BaseAddress); + printf("\tLimitAddress=0x%0jx\n", rmrr->EndAddress); + + remaining = rmrr->Header.Length - sizeof(ACPI_DMAR_RESERVED_MEMORY); + if (remaining > 0) + printf("\tDevice Scope:"); + while (remaining > 0) { + cp = (char *)rmrr + rmrr->Header.Length - remaining; + consumed = acpi_handle_dmar_devscope(cp, remaining); + if (consumed <= 0) + break; + else + remaining -= consumed; + } +} + +static void +acpi_handle_dmar_atsr(ACPI_DMAR_ATSR *atsr) +{ + char *cp; + int remaining, consumed; + + printf("\n"); + printf("\tType=ATSR\n"); + printf("\tLength=%d\n", atsr->Header.Length); + +#define PRINTFLAG(var, flag) printflag((var), ACPI_DMAR_## flag, #flag) + + printf("\tFlags="); + PRINTFLAG(atsr->Flags, ALL_PORTS); + PRINTFLAG_END(); + +#undef PRINTFLAG + + printf("\tSegment=%d\n", atsr->Segment); + + remaining = atsr->Header.Length - sizeof(ACPI_DMAR_ATSR); + if (remaining > 0) + printf("\tDevice Scope:"); + while (remaining > 0) { + cp = (char *)atsr + atsr->Header.Length - remaining; + consumed = acpi_handle_dmar_devscope(cp, remaining); + if (consumed <= 0) + break; + else + remaining -= consumed; + } +} + +static void +acpi_handle_dmar_rhsa(ACPI_DMAR_RHSA *rhsa) +{ + + printf("\n"); + printf("\tType=RHSA\n"); + printf("\tLength=%d\n", rhsa->Header.Length); + printf("\tBaseAddress=0x%0jx\n", rhsa->BaseAddress); + printf("\tProximityDomain=0x%08x\n", rhsa->ProximityDomain); +} + +static int +acpi_handle_dmar_remapping_structure(void *addr, int remaining) +{ + ACPI_DMAR_HEADER *hdr = addr; + + if (remaining < (int)sizeof(ACPI_DMAR_HEADER)) + return (-1); + + if (remaining < hdr->Length) + return (-1); + + switch (hdr->Type) { + case ACPI_DMAR_TYPE_HARDWARE_UNIT: + acpi_handle_dmar_drhd(addr); + break; + case ACPI_DMAR_TYPE_RESERVED_MEMORY: + acpi_handle_dmar_rmrr(addr); + break; + case ACPI_DMAR_TYPE_ATSR: + acpi_handle_dmar_atsr(addr); + break; + case ACPI_DMAR_HARDWARE_AFFINITY: + acpi_handle_dmar_rhsa(addr); + break; + default: + printf("\n"); + printf("\tType=%d\n", hdr->Type); + printf("\tLength=%d\n", hdr->Length); + break; + } + return (hdr->Length); +} + +#ifndef ACPI_DMAR_X2APIC_OPT_OUT +#define ACPI_DMAR_X2APIC_OPT_OUT (0x2) +#endif + +static void +acpi_handle_dmar(ACPI_TABLE_HEADER *sdp) +{ + char *cp; + int remaining, consumed; + ACPI_TABLE_DMAR *dmar; + + printf(BEGIN_COMMENT); + acpi_print_sdt(sdp); + dmar = (ACPI_TABLE_DMAR *)sdp; + printf("\tHost Address Width=%d\n", dmar->Width + 1); + +#define PRINTFLAG(var, flag) printflag((var), ACPI_DMAR_## flag, #flag) + + printf("\tFlags="); + PRINTFLAG(dmar->Flags, INTR_REMAP); + PRINTFLAG(dmar->Flags, X2APIC_OPT_OUT); + PRINTFLAG_END(); + +#undef PRINTFLAG + + remaining = sdp->Length - sizeof(ACPI_TABLE_DMAR); + while (remaining > 0) { + cp = (char *)sdp + sdp->Length - remaining; + consumed = acpi_handle_dmar_remapping_structure(cp, remaining); + if (consumed <= 0) + break; + else + remaining -= consumed; + } + + printf(END_COMMENT); +} + static void acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp) { @@ -854,7 +1111,6 @@ acpi_print_fadt(ACPI_TABLE_HEADER *sdp) { ACPI_TABLE_FADT *fadt; const char *pm; - char sep; fadt = (ACPI_TABLE_FADT *)sdp; printf(BEGIN_COMMENT); @@ -914,25 +1170,17 @@ acpi_print_fadt(ACPI_TABLE_HEADER *sdp) printf("\tDAY_ALRM=%d, MON_ALRM=%d, CENTURY=%d\n", fadt->DayAlarm, fadt->MonthAlarm, fadt->Century); -#define PRINTFLAG(var, flag) do { \ - if ((var) & ACPI_FADT_## flag) { \ - printf("%c%s", sep, #flag); sep = ','; \ - } \ -} while (0) +#define PRINTFLAG(var, flag) printflag((var), ACPI_FADT_## flag, #flag) printf("\tIAPC_BOOT_ARCH="); - sep = '{'; PRINTFLAG(fadt->BootFlags, LEGACY_DEVICES); PRINTFLAG(fadt->BootFlags, 8042); PRINTFLAG(fadt->BootFlags, NO_VGA); PRINTFLAG(fadt->BootFlags, NO_MSI); PRINTFLAG(fadt->BootFlags, NO_ASPM); - if (fadt->BootFlags != 0) - printf("}"); - printf("\n"); + PRINTFLAG_END(); printf("\tFlags="); - sep = '{'; PRINTFLAG(fadt->Flags, WBINVD); PRINTFLAG(fadt->Flags, WBINVD_FLUSH); PRINTFLAG(fadt->Flags, C1_SUPPORTED); @@ -953,8 +1201,7 @@ acpi_print_fadt(ACPI_TABLE_HEADER *sdp) PRINTFLAG(fadt->Flags, REMOTE_POWER_ON); PRINTFLAG(fadt->Flags, APIC_CLUSTER); PRINTFLAG(fadt->Flags, APIC_PHYSICAL); - if (fadt->Flags != 0) - printf("}\n"); + PRINTFLAG_END(); #undef PRINTFLAG @@ -1127,6 +1374,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp acpi_handle_srat(sdp); else if (!memcmp(sdp->Signature, ACPI_SIG_TCPA, 4)) acpi_handle_tcpa(sdp); + else if (!memcmp(sdp->Signature, ACPI_SIG_DMAR, 4)) + acpi_handle_dmar(sdp); else { printf(BEGIN_COMMENT); acpi_print_sdt(sdp); Modified: head/usr.sbin/acpi/acpidump/acpidump.8 ============================================================================== --- head/usr.sbin/acpi/acpidump/acpidump.8 Fri Dec 21 00:41:52 2012 (r244524) +++ head/usr.sbin/acpi/acpidump/acpidump.8 Fri Dec 21 01:19:48 2012 (r244525) @@ -97,6 +97,7 @@ flag, the utility dumps contents of the following tables: .Pp .Bl -tag -offset indent -width 12345 -compact +.It DMAR .It DSDT .It ECDT .It FACS From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 01:31:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E440EA3E; Fri, 21 Dec 2012 01:31:56 +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 C862F8FC0A; Fri, 21 Dec 2012 01:31:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBL1VuJ2062308; Fri, 21 Dec 2012 01:31:56 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBL1Vuu4062307; Fri, 21 Dec 2012 01:31:56 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201212210131.qBL1Vuu4062307@svn.freebsd.org> From: Neel Natu Date: Fri, 21 Dec 2012 01:31:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244526 - head/usr.sbin/mptable X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 01:31:57 -0000 Author: neel Date: Fri Dec 21 01:31:56 2012 New Revision: 244526 URL: http://svnweb.freebsd.org/changeset/base/244526 Log: The MPtable specification allows for an 8-bit "BUS ID" and "I/O APIC ID". Since the 'busses[]' and 'apics[]' arrays are indexed by these 8-bit IDs make sure that they have enough space to accomodate up to 256 entries. Submitted by: Ravi Shamanna Obtained from: NetApp Modified: head/usr.sbin/mptable/mptable.c Modified: head/usr.sbin/mptable/mptable.c ============================================================================== --- head/usr.sbin/mptable/mptable.c Fri Dec 21 01:19:48 2012 (r244525) +++ head/usr.sbin/mptable/mptable.c Fri Dec 21 01:31:56 2012 (r244526) @@ -270,8 +270,8 @@ static void pnstr( char* s, int c ); /* global data */ static int pfd; /* physical /dev/mem fd */ -static int busses[16]; -static int apics[16]; +static int busses[256]; +static int apics[256]; static int ncpu; static int nbus; @@ -711,7 +711,7 @@ MPConfigTableHeader( u_int32_t pap ) printf( "MP Config Base Table Entries:\n\n" ); /* initialze tables */ - for ( x = 0; x < 16; ++x ) { + for ( x = 0; x < 256; ++x ) { busses[ x ] = apics[ x ] = 0xff; } From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 02:07:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F020E9C; Fri, 21 Dec 2012 02:07:48 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id A21EB8FC14; Fri, 21 Dec 2012 02:07:47 +0000 (UTC) Received: by mail-ob0-f182.google.com with SMTP id 16so4009502obc.41 for ; Thu, 20 Dec 2012 18:07:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=yAq0sv19E/kcqWj51fr7jhlWgLtSmNGgDvpVihsVeC0=; b=H1SV00OLuPmob8MZQ2Ioq7ReZN7Xsk5emrSWVJX5bpV4gOYld9OMr4xP/sKtbfXYqU x4DcCok+AhlHnuMJKwcD8nCgWdkk9c04AFvRb42tIxmK3m0mOSVOb+8Ev3Ss4/aqO4aP ZqGECfhYQaQh4mud5e809nJa6Uc965zXYv+EQOLiNDMrYYsjwpXdgIfd4E7DUF6L5wpj IGn/UyxDTLEps8ALt2N/Z2C2Mo0sZsPi+2d48vq9crawyDXblqPwUYi2ZH89dMd6msSc 0DK4w51wn/u77CVKvQ4BcbuKpAD0RF1Sjx83I3NRq2/naoacEXazqtL00OeLXTywTCWr 5FAw== MIME-Version: 1.0 Received: by 10.182.2.169 with SMTP id 9mr9890464obv.66.1356055666996; Thu, 20 Dec 2012 18:07:46 -0800 (PST) Received: by 10.76.143.33 with HTTP; Thu, 20 Dec 2012 18:07:46 -0800 (PST) In-Reply-To: <201212210131.qBL1Vuu4062307@svn.freebsd.org> References: <201212210131.qBL1Vuu4062307@svn.freebsd.org> Date: Thu, 20 Dec 2012 18:07:46 -0800 Message-ID: Subject: Re: svn commit: r244526 - head/usr.sbin/mptable From: Garrett Cooper To: Neel Natu 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 02:07:48 -0000 On Thu, Dec 20, 2012 at 5:31 PM, Neel Natu wrote: > Author: neel > Date: Fri Dec 21 01:31:56 2012 > New Revision: 244526 > URL: http://svnweb.freebsd.org/changeset/base/244526 > > Log: > The MPtable specification allows for an 8-bit "BUS ID" and "I/O APIC ID". > > Since the 'busses[]' and 'apics[]' arrays are indexed by these 8-bit IDs > make sure that they have enough space to accomodate up to 256 entries. > > Submitted by: Ravi Shamanna > Obtained from: NetApp > > Modified: > head/usr.sbin/mptable/mptable.c > > Modified: head/usr.sbin/mptable/mptable.c > ============================================================================== > --- head/usr.sbin/mptable/mptable.c Fri Dec 21 01:19:48 2012 (r244525) > +++ head/usr.sbin/mptable/mptable.c Fri Dec 21 01:31:56 2012 (r244526) > @@ -270,8 +270,8 @@ static void pnstr( char* s, int c ); > /* global data */ > static int pfd; /* physical /dev/mem fd */ > > -static int busses[16]; > -static int apics[16]; > +static int busses[256]; > +static int apics[256]; > > static int ncpu; > static int nbus; > @@ -711,7 +711,7 @@ MPConfigTableHeader( u_int32_t pap ) > printf( "MP Config Base Table Entries:\n\n" ); > > /* initialze tables */ > - for ( x = 0; x < 16; ++x ) { > + for ( x = 0; x < 256; ++x ) { `nitems(busses)` (requires sys/param.h)? > busses[ x ] = apics[ x ] = 0xff; > > } Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 02:18:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E31EF160; Fri, 21 Dec 2012 02:18:11 +0000 (UTC) (envelope-from emaste@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 C7FD88FC13; Fri, 21 Dec 2012 02:18:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBL2IBFl069254; Fri, 21 Dec 2012 02:18:11 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBL2IBfD069253; Fri, 21 Dec 2012 02:18:11 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201212210218.qBL2IBfD069253@svn.freebsd.org> From: Ed Maste Date: Fri, 21 Dec 2012 02:18:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244527 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 02:18:12 -0000 Author: emaste Date: Fri Dec 21 02:18:11 2012 New Revision: 244527 URL: http://svnweb.freebsd.org/changeset/base/244527 Log: Sort default option lists Modified: head/share/mk/bsd.own.mk Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Fri Dec 21 01:31:56 2012 (r244526) +++ head/share/mk/bsd.own.mk Fri Dec 21 02:18:11 2012 (r244527) @@ -322,9 +322,6 @@ __DEFAULT_YES_OPTIONS = \ BOOT \ BSD_CPIO \ BSNMP \ - SOURCELESS \ - SOURCELESS_HOST \ - SOURCELESS_UCODE \ BZIP2 \ CALENDAR \ CAPSICUM \ @@ -401,10 +398,13 @@ __DEFAULT_YES_OPTIONS = \ SENDMAIL \ SETUID_LOGIN \ SHAREDOCS \ + SOURCELESS \ + SOURCELESS_HOST \ + SOURCELESS_UCODE \ SSP \ - SYSINSTALL \ SYMVER \ SYSCONS \ + SYSINSTALL \ TCSH \ TELNET \ TEXTPROC \ @@ -417,14 +417,14 @@ __DEFAULT_YES_OPTIONS = \ ZONEINFO __DEFAULT_NO_OPTIONS = \ - BMAKE \ - BSD_GREP \ BIND_IDN \ BIND_LARGE_FILE \ BIND_LIBS \ BIND_SIGCHASE \ BIND_XML \ + BMAKE \ BSDCONFIG \ + BSD_GREP \ CLANG_EXTRAS \ CTF \ HESIOD \ From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 04:28:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 350F32C8; Fri, 21 Dec 2012 04:28: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 1A3A08FC16; Fri, 21 Dec 2012 04:28:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBL4S50E088625; Fri, 21 Dec 2012 04:28:05 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBL4S5fP088624; Fri, 21 Dec 2012 04:28:05 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201212210428.qBL4S5fP088624@svn.freebsd.org> From: Adrian Chadd Date: Fri, 21 Dec 2012 04:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244529 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 04:28:06 -0000 Author: adrian Date: Fri Dec 21 04:28:05 2012 New Revision: 244529 URL: http://svnweb.freebsd.org/changeset/base/244529 Log: Note why fast frames is disabled for 802.11n NICs now. It actually works, but net80211 handles A-MPDU and Fast frames incorrectly; it tries enabling both in some instances, with tragic results. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Dec 21 02:42:35 2012 (r244528) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Dec 21 04:28:05 2012 (r244529) @@ -898,7 +898,13 @@ ar5416FillCapabilityInfo(struct ath_hal pCap->halCompressSupport = AH_FALSE; pCap->halBurstSupport = AH_TRUE; - pCap->halFastFramesSupport = AH_FALSE; /* XXX? */ + /* + * This is disabled for now; the net80211 layer needs to be + * taught when it is and isn't appropriate to enable FF processing + * with 802.11n NICs (it tries to enable both A-MPDU and + * fast frames, with very tragic crash-y results.) + */ + pCap->halFastFramesSupport = AH_FALSE; pCap->halChapTuningSupport = AH_TRUE; pCap->halTurboPrimeSupport = AH_TRUE; From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 04:44:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5CD09566; Fri, 21 Dec 2012 04:44:41 +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 41ACB8FC12; Fri, 21 Dec 2012 04:44:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBL4ifNN090877; Fri, 21 Dec 2012 04:44:41 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBL4if6j090876; Fri, 21 Dec 2012 04:44:41 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201212210444.qBL4if6j090876@svn.freebsd.org> From: Neel Natu Date: Fri, 21 Dec 2012 04:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244530 - head/usr.sbin/mptable X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 04:44:41 -0000 Author: neel Date: Fri Dec 21 04:44:40 2012 New Revision: 244530 URL: http://svnweb.freebsd.org/changeset/base/244530 Log: Divine the array size by using 'nitems(array)' instead of using magic numbers. Suggested by: Garrett Cooper Modified: head/usr.sbin/mptable/mptable.c Modified: head/usr.sbin/mptable/mptable.c ============================================================================== --- head/usr.sbin/mptable/mptable.c Fri Dec 21 04:28:05 2012 (r244529) +++ head/usr.sbin/mptable/mptable.c Fri Dec 21 04:44:40 2012 (r244530) @@ -42,7 +42,7 @@ static const char rcsid[] = #define EXTENDED_PROCESSING_READY #define OEM_PROCESSING_READY_NOT -#include +#include #include #include #include @@ -710,10 +710,12 @@ MPConfigTableHeader( u_int32_t pap ) printf( "MP Config Base Table Entries:\n\n" ); - /* initialze tables */ - for ( x = 0; x < 256; ++x ) { - busses[ x ] = apics[ x ] = 0xff; - } + /* initialize tables */ + for (x = 0; x < (int)nitems(busses); x++) + busses[x] = 0xff; + + for (x = 0; x < (int)nitems(apics); x++) + apics[x] = 0xff; ncpu = 0; nbus = 0; From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 04:47:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 67CD476F; Fri, 21 Dec 2012 04:47:08 +0000 (UTC) (envelope-from neelnatu@gmail.com) Received: from mail-ie0-f178.google.com (mail-ie0-f178.google.com [209.85.223.178]) by mx1.freebsd.org (Postfix) with ESMTP id F351A8FC13; Fri, 21 Dec 2012 04:47:07 +0000 (UTC) Received: by mail-ie0-f178.google.com with SMTP id c12so5614786ieb.37 for ; Thu, 20 Dec 2012 20:47:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=3pNN1SvxAiZR/Ym8gWowrdmnar+otmmLtrg3DneL8gY=; b=TMw0+xtLGiRsull9SIMOV0t6hROuJjB0CKuBZZBxb0B12HniKCntyvE/B/QXbHBs/J 1bzNb+8yebDaSRQKdvGXRkpbV13vB1iokYcYDObUZGH4NAxgqffXQEf4mcyp/An1n4Xq hP3d42NKS5EH8vUD8olonMrp0biWPbHHlr1Oa493E6/kwF8QLmkc9oVtbpGKcRoNmoyw 0JMiHaQeKafynxIT+HlhGxDQmaPJZprrXOhWx4J5Zy3264orBDXLsV+ibVKLaEL7cgN/ Zhv4dtVMp+qjY42lmoL/Jp8xVkdgwUmD2mQHGoTrckx/pskmiQG8yajRj7nBkdQ9XlGX OHKw== MIME-Version: 1.0 Received: by 10.43.17.199 with SMTP id qd7mr6221242icb.52.1356065227186; Thu, 20 Dec 2012 20:47:07 -0800 (PST) Received: by 10.43.112.194 with HTTP; Thu, 20 Dec 2012 20:47:07 -0800 (PST) In-Reply-To: References: <201212210131.qBL1Vuu4062307@svn.freebsd.org> Date: Thu, 20 Dec 2012 20:47:07 -0800 Message-ID: Subject: Re: svn commit: r244526 - head/usr.sbin/mptable From: Neel Natu To: Garrett Cooper Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Neel Natu X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 04:47:08 -0000 Hi Garrett, On Thu, Dec 20, 2012 at 6:07 PM, Garrett Cooper wrote: > On Thu, Dec 20, 2012 at 5:31 PM, Neel Natu wrote: >> Author: neel >> Date: Fri Dec 21 01:31:56 2012 >> New Revision: 244526 >> URL: http://svnweb.freebsd.org/changeset/base/244526 >> >> Log: >> The MPtable specification allows for an 8-bit "BUS ID" and "I/O APIC ID". >> >> Since the 'busses[]' and 'apics[]' arrays are indexed by these 8-bit IDs >> make sure that they have enough space to accomodate up to 256 entries. >> >> Submitted by: Ravi Shamanna >> Obtained from: NetApp >> >> Modified: >> head/usr.sbin/mptable/mptable.c >> >> Modified: head/usr.sbin/mptable/mptable.c >> ============================================================================== >> --- head/usr.sbin/mptable/mptable.c Fri Dec 21 01:19:48 2012 (r244525) >> +++ head/usr.sbin/mptable/mptable.c Fri Dec 21 01:31:56 2012 (r244526) >> @@ -270,8 +270,8 @@ static void pnstr( char* s, int c ); >> /* global data */ >> static int pfd; /* physical /dev/mem fd */ >> >> -static int busses[16]; >> -static int apics[16]; >> +static int busses[256]; >> +static int apics[256]; >> >> static int ncpu; >> static int nbus; >> @@ -711,7 +711,7 @@ MPConfigTableHeader( u_int32_t pap ) >> printf( "MP Config Base Table Entries:\n\n" ); >> >> /* initialze tables */ >> - for ( x = 0; x < 16; ++x ) { >> + for ( x = 0; x < 256; ++x ) { > > `nitems(busses)` (requires sys/param.h)? Sure. Fixed in: http://svnweb.freebsd.org/base?view=revision&revision=244530 best Neel > >> busses[ x ] = apics[ x ] = 0xff; >> >> } > > Thanks, > -Garrett From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 05:22:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7E908B6D; Fri, 21 Dec 2012 05:22:15 +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 490CA8FC0C; Fri, 21 Dec 2012 05:22:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBL5MF7X096658; Fri, 21 Dec 2012 05:22:15 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBL5ME7A096655; Fri, 21 Dec 2012 05:22:14 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201212210522.qBL5ME7A096655@svn.freebsd.org> From: Rui Paulo Date: Fri, 21 Dec 2012 05:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244531 - in head/sys/boot: ficl ficl64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 05:22:15 -0000 Author: rpaulo Date: Fri Dec 21 05:22:14 2012 New Revision: 244531 URL: http://svnweb.freebsd.org/changeset/base/244531 Log: Build a 64 bit version of the FICL library. This is need for a 64 bit EFI bootloader (amd64 only for now). This is not yet connected to the build. Added: head/sys/boot/ficl64/ head/sys/boot/ficl64/Makefile (contents, props changed) Modified: head/sys/boot/ficl/Makefile Modified: head/sys/boot/ficl/Makefile ============================================================================== --- head/sys/boot/ficl/Makefile Fri Dec 21 04:44:40 2012 (r244530) +++ head/sys/boot/ficl/Makefile Fri Dec 21 05:22:14 2012 (r244531) @@ -1,6 +1,13 @@ # $FreeBSD$ # -.PATH: ${.CURDIR}/${MACHINE_CPUARCH:S/amd64/i386/} + +FICLDIR?= ${.CURDIR} + +.if !defined(FICL64) +.PATH: ${FICLDIR}/${MACHINE_CPUARCH:S/amd64/i386/} +.else +.PATH: ${FICLDIR}/${MACHINE_CPUARCH} +.endif BASE_SRCS= dict.c ficl.c fileaccess.c float.c loader.c math64.c \ prefix.c search.c stack.c tools.c vm.c words.c @@ -8,8 +15,10 @@ SRCS= ${BASE_SRCS} sysdep.c softcore.c CLEANFILES= softcore.c testmain testmain.o CFLAGS+= -ffreestanding .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +.if !defined(FICL64) CFLAGS+= -march=i386 CFLAGS+= -mpreferred-stack-boundary=2 +.endif CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float .endif .if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "arm" @@ -33,13 +42,13 @@ INTERNALLIB= .endif # Standard softwords -.PATH: ${.CURDIR}/softwords +.PATH: ${FICLDIR}/softwords SOFTWORDS= softcore.fr jhlocal.fr marker.fr freebsd.fr ficllocal.fr \ ifbrack.fr # Optional OO extension softwords #SOFTWORDS+= oo.fr classes.fr -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" && !defined(FICL64) CFLAGS+= -m32 -I. .endif @@ -47,11 +56,11 @@ CFLAGS+= -m32 -I. CFLAGS+= -m32 -mcpu=powerpc -I. .endif -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${MACHINE_CPUARCH:S/amd64/i386/} \ - -I${.CURDIR}/../common +CFLAGS+= -I${FICLDIR} -I${FICLDIR}/${MACHINE_CPUARCH:S/amd64/i386/} \ + -I${FICLDIR}/../common softcore.c: ${SOFTWORDS} softcore.awk - (cd ${.CURDIR}/softwords; cat ${SOFTWORDS} \ + (cd ${FICLDIR}/softwords; cat ${SOFTWORDS} \ | awk -f softcore.awk -v datestamp="`LC_ALL=C date`") > ${.TARGET} .if ${MACHINE_CPUARCH} == "amd64" Added: head/sys/boot/ficl64/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/ficl64/Makefile Fri Dec 21 05:22:14 2012 (r244531) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +FICL64= +FICLDIR= ${.CURDIR}/../ficl + +.PATH: ${FICLDIR} + +.include "${FICLDIR}/Makefile" From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 10:09:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D6886A2D; Fri, 21 Dec 2012 10:09:45 +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 BB4AA8FC15; Fri, 21 Dec 2012 10:09:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLA9jAJ038309; Fri, 21 Dec 2012 10:09:45 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLA9jN6038308; Fri, 21 Dec 2012 10:09:45 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201212211009.qBLA9jN6038308@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 21 Dec 2012 10:09:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244532 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 10:09:45 -0000 Author: glebius Date: Fri Dec 21 10:09:45 2012 New Revision: 244532 URL: http://svnweb.freebsd.org/changeset/base/244532 Log: Comment fix: there is no ub_ptr, instead explain meaning of uz_count field verbally. Modified: head/sys/vm/uma_int.h Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Fri Dec 21 05:22:14 2012 (r244531) +++ head/sys/vm/uma_int.h Fri Dec 21 10:09:45 2012 (r244532) @@ -329,7 +329,7 @@ struct uma_zone { u_int64_t uz_fails; /* Total number of alloc failures */ u_int64_t uz_sleeps; /* Total number of alloc sleeps */ uint16_t uz_fills; /* Outstanding bucket fills */ - uint16_t uz_count; /* Highest value ub_ptr can have */ + uint16_t uz_count; /* Highest amount of items in bucket */ /* The next three fields are used to print a rate-limited warnings. */ const char *uz_warning; /* Warning to print on failure */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 12:11:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 17587EC4; Fri, 21 Dec 2012 12:11:50 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f179.google.com (mail-ob0-f179.google.com [209.85.214.179]) by mx1.freebsd.org (Postfix) with ESMTP id 783718FC12; Fri, 21 Dec 2012 12:11:49 +0000 (UTC) Received: by mail-ob0-f179.google.com with SMTP id x4so4403923obh.24 for ; Fri, 21 Dec 2012 04:11:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=jutCFm/CLZ6VK+QmE+wY4FuMHf7p6UV7FyP8uKLXfxA=; b=ccLRRdbNU8ypyX6n5ncivVN83nCVdXtQ9nS/ymig51ijVPZJacmLiIGe2uE++uPyXe WYySDBBi4GsD1Egmf/tN2dELlxFZ9CFZhuIvqCBpyDsp7SAEbyBw0S9Mtkbx8kI4PNq/ JwfMO5lDfCvaEFveAxsfOwPDVs2sAqVmKzxqZZraKY416Jx4+llGO25ke1UF5D9iUcnD ZnLGSXTABlkSHRaZoNKsnBKiJUm+w5Y5S3eA85q3x8YLyfsYVsLo4Xn7zUolwmpOGc0T l8AZ6tWc1dM6t2BabC3U7tVRobWcqAG2h0kw9UlHJrZ0YnjhIYyfP2n/ec3xLysu/puk HBig== MIME-Version: 1.0 Received: by 10.60.0.165 with SMTP id 5mr10985542oef.128.1356091908507; Fri, 21 Dec 2012 04:11:48 -0800 (PST) Received: by 10.76.143.33 with HTTP; Fri, 21 Dec 2012 04:11:48 -0800 (PST) Date: Fri, 21 Dec 2012 04:11:48 -0800 Message-ID: Subject: Broken error handling with AF_* and socket(2) [was Re: svn commit: r243965 - in head/sys: kern sys] From: Garrett Cooper To: Kevin Lo Content-Type: multipart/mixed; boundary=e89a8ff2535c7d472104d15bc0b0 Cc: src-committers@freebsd.org, freebsd-net@freebsd.org, svn-src-all@freebsd.org, Gleb Smirnoff , svn-src-head@freebsd.org, Rick Macklem X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 12:11:50 -0000 --e89a8ff2535c7d472104d15bc0b0 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Dec 6, 2012 at 6:22 PM, Kevin Lo wrote: > Author: kevlo > Date: Fri Dec 7 02:22:48 2012 > New Revision: 243965 > URL: http://svnweb.freebsd.org/changeset/base/243965 > > Log: > - according to POSIX, make socket(2) return EAFNOSUPPORT rather than > EPROTONOSUPPORT if the address family is not supported. > - introduce pffinddomain() to find a domain by family and use it as > appropriate. > > Reviewed by: glebius This commit broke netgraph (and potentially more things). I fixed netgraph locally like so: $ git diff lib/libnetgraph/ diff --git a/lib/libnetgraph/sock.c b/lib/libnetgraph/sock.c index fca3900..5f9f563 100644 --- a/lib/libnetgraph/sock.c +++ b/lib/libnetgraph/sock.c @@ -71,10 +71,10 @@ NgMkSockNode(const char *name, int *csp, int *dsp) name = NULL; /* Create control socket; this also creates the netgraph node. - If we get an EPROTONOSUPPORT then the socket node type is + If we get an EAFNOSUPPORT then the socket node type is not loaded, so load it and try again. */ if ((cs = socket(AF_NETGRAPH, SOCK_DGRAM, NG_CONTROL)) < 0) { - if (errno == EPROTONOSUPPORT) { + if (errno == EAFNOSUPPORT) { if (kldload(NG_SOCKET_KLD) < 0) { errnosv = errno; if (_gNgDebugLevel >= 1) Reproing the issue was trivial using the ether.bridge example script setup with appropriate interfaces. I have the patch with the netgraph fix attached, along with other potential fixes that needs to be more properly tested. Thanks, -Garrett --e89a8ff2535c7d472104d15bc0b0 Content-Type: application/octet-stream; name="0001-Fix-socket-calls-on-error-post-r243965.patch" Content-Disposition: attachment; filename="0001-Fix-socket-calls-on-error-post-r243965.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_haza2zk10 RnJvbSBjYzZmNzRiMmIyMTlkMjgzZjM0NWViMzE5NjY5NDE0NWMzM2EzODVlIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBHYXJyZXR0IENvb3BlciA8eWFuZWdvbWlAZ21haWwuY29tPgpE YXRlOiBGcmksIDIxIERlYyAyMDEyIDA0OjEwOjA3IC0wODAwClN1YmplY3Q6IFtQQVRDSF0gRml4 IHNvY2tldCBjYWxscyBvbiBlcnJvciBwb3N0LXIyNDM5NjUKClNpZ25lZC1vZmYtYnk6IEdhcnJl dHQgQ29vcGVyIDx5YW5lZ29taUBnbWFpbC5jb20+Ci0tLQogYmluL2RhdGUvbmV0ZGF0ZS5jICAg ICAgIHwgMiArLQogbGliL2xpYm5ldGdyYXBoL3NvY2suYyAgIHwgNCArKy0tCiBzYmluL2hhc3Rk L3BhcnNlLnkgICAgICAgfCAyICstCiBzYmluL2lmY29uZmlnL2FmX25kNi5jICAgfCAyICstCiBz YmluL2lmY29uZmlnL2lmY29uZmlnLmMgfCAyICstCiB1c3Iuc2Jpbi9tdGVzdC9tdGVzdC5jICAg fCA0ICsrLS0KIHVzci5zYmluL25mc2QvbmZzZC5jICAgICB8IDIgKy0KIDcgZmlsZXMgY2hhbmdl ZCwgOSBpbnNlcnRpb25zKCspLCA5IGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL2Jpbi9kYXRl L25ldGRhdGUuYyBiL2Jpbi9kYXRlL25ldGRhdGUuYwppbmRleCBiMDg1YmU0Li5lNTA2ZTZkIDEw MDY0NAotLS0gYS9iaW4vZGF0ZS9uZXRkYXRlLmMKKysrIGIvYmluL2RhdGUvbmV0ZGF0ZS5jCkBA IC04NSw3ICs4NSw3IEBAIG5ldHNldHRpbWUodGltZV90IHR2YWwpCiAJZGVzdC5zaW5fYWRkci5z X2FkZHIgPSBodG9ubCgodV9sb25nKUlOQUREUl9BTlkpOwogCXMgPSBzb2NrZXQoQUZfSU5FVCwg U09DS19ER1JBTSwgMCk7CiAJaWYgKHMgPCAwKSB7Ci0JCWlmIChlcnJubyAhPSBFUFJPVE9OT1NV UFBPUlQpCisJCWlmIChlcnJubyAhPSBFQUZOT1NVUFBPUlQpCiAJCQl3YXJuKCJ0aW1lZCIpOwog CQlyZXR1cm4gKHJldHZhbCA9IDIpOwogCX0KZGlmZiAtLWdpdCBhL2xpYi9saWJuZXRncmFwaC9z b2NrLmMgYi9saWIvbGlibmV0Z3JhcGgvc29jay5jCmluZGV4IGZjYTM5MDAuLjVmOWY1NjMgMTAw NjQ0Ci0tLSBhL2xpYi9saWJuZXRncmFwaC9zb2NrLmMKKysrIGIvbGliL2xpYm5ldGdyYXBoL3Nv Y2suYwpAQCAtNzEsMTAgKzcxLDEwIEBAIE5nTWtTb2NrTm9kZShjb25zdCBjaGFyICpuYW1lLCBp bnQgKmNzcCwgaW50ICpkc3ApCiAJCW5hbWUgPSBOVUxMOwogCiAJLyogQ3JlYXRlIGNvbnRyb2wg c29ja2V0OyB0aGlzIGFsc28gY3JlYXRlcyB0aGUgbmV0Z3JhcGggbm9kZS4KLQkgICBJZiB3ZSBn ZXQgYW4gRVBST1RPTk9TVVBQT1JUIHRoZW4gdGhlIHNvY2tldCBub2RlIHR5cGUgaXMKKwkgICBJ ZiB3ZSBnZXQgYW4gRUFGTk9TVVBQT1JUIHRoZW4gdGhlIHNvY2tldCBub2RlIHR5cGUgaXMKIAkg ICBub3QgbG9hZGVkLCBzbyBsb2FkIGl0IGFuZCB0cnkgYWdhaW4uICovCiAJaWYgKChjcyA9IHNv Y2tldChBRl9ORVRHUkFQSCwgU09DS19ER1JBTSwgTkdfQ09OVFJPTCkpIDwgMCkgewotCQlpZiAo ZXJybm8gPT0gRVBST1RPTk9TVVBQT1JUKSB7CisJCWlmIChlcnJubyA9PSBFQUZOT1NVUFBPUlQp IHsKIAkJCWlmIChrbGRsb2FkKE5HX1NPQ0tFVF9LTEQpIDwgMCkgewogCQkJCWVycm5vc3YgPSBl cnJubzsKIAkJCQlpZiAoX2dOZ0RlYnVnTGV2ZWwgPj0gMSkKZGlmZiAtLWdpdCBhL3NiaW4vaGFz dGQvcGFyc2UueSBiL3NiaW4vaGFzdGQvcGFyc2UueQppbmRleCBhMjBiNjFhLi4wNGVhN2FiIDEw MDY0NAotLS0gYS9zYmluL2hhc3RkL3BhcnNlLnkKKysrIGIvc2Jpbi9oYXN0ZC9wYXJzZS55CkBA IC03NjksNyArNzY5LDcgQEAgZmFtaWx5X3N1cHBvcnRlZChpbnQgZmFtaWx5KQogCWludCBzb2Nr OwogCiAJc29jayA9IHNvY2tldChmYW1pbHksIFNPQ0tfU1RSRUFNLCAwKTsKLQlpZiAoc29jayA9 PSAtMSAmJiBlcnJubyA9PSBFUFJPVE9OT1NVUFBPUlQpCisJaWYgKHNvY2sgPT0gLTEgJiYgZXJy bm8gPT0gRUFGTk9TVVBQT1JUKQogCQlyZXR1cm4gKGZhbHNlKTsKIAlpZiAoc29jayA+PSAwKQog CQkodm9pZCljbG9zZShzb2NrKTsKZGlmZiAtLWdpdCBhL3NiaW4vaWZjb25maWcvYWZfbmQ2LmMg Yi9zYmluL2lmY29uZmlnL2FmX25kNi5jCmluZGV4IDY1NGUyZDkuLjgwMDY1ZjYgMTAwNjQ0Ci0t LSBhL3NiaW4vaWZjb25maWcvYWZfbmQ2LmMKKysrIGIvc2Jpbi9pZmNvbmZpZy9hZl9uZDYuYwpA QCAtMTQ4LDcgKzE0OCw3IEBAIG5kNl9zdGF0dXMoaW50IHMpCiAJbWVtc2V0KCZuZCwgMCwgc2l6 ZW9mKG5kKSk7CiAJc3RybmNweShuZC5pZm5hbWUsIGlmci5pZnJfbmFtZSwgc2l6ZW9mKG5kLmlm bmFtZSkpOwogCWlmICgoczYgPSBzb2NrZXQoQUZfSU5FVDYsIFNPQ0tfREdSQU0sIDApKSA8IDAp IHsKLQkJaWYgKGVycm5vICE9IEVQUk9UT05PU1VQUE9SVCkKKwkJaWYgKGVycm5vICE9IEVBRk5P U1VQUE9SVCkKIAkJCXdhcm4oInNvY2tldChBRl9JTkVUNiwgU09DS19ER1JBTSkiKTsKIAkJcmV0 dXJuOwogCX0KZGlmZiAtLWdpdCBhL3NiaW4vaWZjb25maWcvaWZjb25maWcuYyBiL3NiaW4vaWZj b25maWcvaWZjb25maWcuYwppbmRleCA4NzBhY2RkLi45ODNlMjFmIDEwMDY0NAotLS0gYS9zYmlu L2lmY29uZmlnL2lmY29uZmlnLmMKKysrIGIvc2Jpbi9pZmNvbmZpZy9pZmNvbmZpZy5jCkBAIC01 MjAsNyArNTIwLDcgQEAgdG9wOgogCQlBRl9MT0NBTCA6IGFmcC0+YWZfYWY7CiAKIAlpZiAoKHMg PSBzb2NrZXQoaWZyLmlmcl9hZGRyLnNhX2ZhbWlseSwgU09DS19ER1JBTSwgMCkpIDwgMCAmJgot CSAgICAodWFmcCAhPSBOVUxMIHx8IGVycm5vICE9IEVQUk9UT05PU1VQUE9SVCB8fAorCSAgICAo dWFmcCAhPSBOVUxMIHx8IGVycm5vICE9IEVBRk5PU1VQUE9SVCB8fAogCSAgICAgKHMgPSBzb2Nr ZXQoQUZfTE9DQUwsIFNPQ0tfREdSQU0sIDApKSA8IDApKQogCQllcnIoMSwgInNvY2tldChmYW1p bHkgJXUsU09DS19ER1JBTSIsIGlmci5pZnJfYWRkci5zYV9mYW1pbHkpOwogCmRpZmYgLS1naXQg YS91c3Iuc2Jpbi9tdGVzdC9tdGVzdC5jIGIvdXNyLnNiaW4vbXRlc3QvbXRlc3QuYwppbmRleCA2 MGY3ZTA5Li5hMjhmYWI3IDEwMDY0NAotLS0gYS91c3Iuc2Jpbi9tdGVzdC9tdGVzdC5jCisrKyBi L3Vzci5zYmluL210ZXN0L210ZXN0LmMKQEAgLTIwNCwxMiArMjA0LDEyIEBAIG1haW4oaW50IGFy Z2MsIGNoYXIgKiphcmd2KQogCXM2ID0gLTE7CiAjaWZkZWYgSU5FVAogCXMgPSBzb2NrZXQoQUZf SU5FVCwgU09DS19ER1JBTSwgSVBQUk9UT19VRFApOwotCWlmIChzID09IC0xICYmIGVycm5vICE9 IEVQUk9UT05PU1VQUE9SVCkKKwlpZiAocyA9PSAtMSAmJiBlcnJubyAhPSBFQUZOT1NVUFBPUlQp CiAJCWVycigxLCAiY2FuJ3Qgb3BlbiBJUHY0IHNvY2tldCIpOwogI2VuZGlmCiAjaWZkZWYgSU5F VDYKIAlzNiA9IHNvY2tldChBRl9JTkVUNiwgU09DS19ER1JBTSwgSVBQUk9UT19VRFApOwotCWlm IChzNiA9PSAtMSAmJiBlcnJubyAhPSBFUFJPVE9OT1NVUFBPUlQpCisJaWYgKHM2ID09IC0xICYm IGVycm5vICE9IEVBRk5PU1VQUE9SVCkKIAkJZXJyKDEsICJjYW4ndCBvcGVuIElQdjYgc29ja2V0 Iik7CiAjZW5kaWYKIAlpZiAocyA9PSAtMSAmJiBzNiA9PSAtMSkKZGlmZiAtLWdpdCBhL3Vzci5z YmluL25mc2QvbmZzZC5jIGIvdXNyLnNiaW4vbmZzZC9uZnNkLmMKaW5kZXggNmEyZjc4NS4uMmZl ZjdmNSAxMDA2NDQKLS0tIGEvdXNyLnNiaW4vbmZzZC9uZnNkLmMKKysrIGIvdXNyLnNiaW4vbmZz ZC9uZnNkLmMKQEAgLTI2NCw3ICsyNjQsNyBAQCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikK IAlpcDZmbGFnID0gMTsKIAlzID0gc29ja2V0KEFGX0lORVQ2LCBTT0NLX0RHUkFNLCBJUFBST1RP X1VEUCk7CiAJaWYgKHMgPT0gLTEpIHsKLQkJaWYgKGVycm5vICE9IEVQUk9UT05PU1VQUE9SVCkK KwkJaWYgKGVycm5vICE9IEVBRk5PU1VQUE9SVCkKIAkJCWVycigxLCAic29ja2V0Iik7CiAJCWlw NmZsYWcgPSAwOwogCX0gZWxzZSBpZiAoZ2V0bmV0Y29uZmlnZW50KCJ1ZHA2IikgPT0gTlVMTCB8 fAotLSAKMS44LjAKCg== --e89a8ff2535c7d472104d15bc0b0-- From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 12:31:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9843D6D5 for ; Fri, 21 Dec 2012 12:31:27 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay01.ispgateway.de (smtprelay01.ispgateway.de [80.67.31.39]) by mx1.freebsd.org (Postfix) with ESMTP id 201898FC13 for ; Fri, 21 Dec 2012 12:31:27 +0000 (UTC) Received: from [78.35.147.221] (helo=fabiankeil.de) by smtprelay01.ispgateway.de with esmtpsa (SSLv3:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1Tm1gS-0006ts-Oo for svn-src-all@freebsd.org; Fri, 21 Dec 2012 13:26:36 +0100 Date: Fri, 21 Dec 2012 13:23:03 +0100 From: Fabian Keil To: svn-src-all@freebsd.org Subject: Re: svn commit: r243554 - in head/usr.sbin/pkg_install: add create delete info lib updating version Message-ID: <20121221132303.124765b7@fabiankeil.de> In-Reply-To: References: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> <20121128170032.730be5fab68dba2a09aaa14e@FreeBSD.org> <20121128183422.714562856f27371c95d2a84e@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/oaj8yDwZ6z9F8IHXwzTWZ_d"; protocol="application/pgp-signature" X-Df-Sender: Nzc1MDY3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 12:31:27 -0000 --Sig_/oaj8yDwZ6z9F8IHXwzTWZ_d Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Eitan Adler wrote: > On 28 November 2012 21:34, Stanislav Sedov wrote: > > I don't really see how this > > message being in pkg_ tools helps to prevent a possible foot-shooting > > at all. >=20 > It reminds people that using the pkg_* tools once a conversion is done is= wrong. I don't see how that prevents foot-shooting either. Is there a single case where running one of the pkg_* tools is dangerous and spamming the console somehow mitigates this? How is the following helpful?: # pkg2ng pkg_info: You appear to be using the newer pkg(1) tool on this system for p= ackage management, rather than the legacy package management tools (pkg_*).= The legacy tools should no longer be used on this system. Creating backup pkg_info(1) database directory in /var/db/pkg.bak. pkg_info: You appear to be using the newer pkg(1) tool on this system for p= ackage management, rather than the legacy package management tools (pkg_*).= The legacy tools should no longer be used on this system. pkg_info: You appear to be using the newer pkg(1) tool on this system for p= ackage management, rather than the legacy package management tools (pkg_*).= The legacy tools should no longer be used on this system. pkg_info: You appear to be using the newer pkg(1) tool on this system for p= ackage management, rather than the legacy package management tools (pkg_*).= The legacy tools should no longer be used on this system. Installing adns-1.4_1... done pkg_info: You appear to be using the newer pkg(1) tool on this system for p= ackage management, rather than the legacy package management tools (pkg_*).= The legacy tools should no longer be used on this system. pkg_info: You appear to be using the newer pkg(1) tool on this system for p= ackage management, rather than the legacy package management tools (pkg_*).= The legacy tools should no longer be used on this system. pkg_info: You appear to be using the newer pkg(1) tool on this system for p= ackage management, rather than the legacy package management tools (pkg_*).= The legacy tools should no longer be used on this system. pkg_info: You appear to be using the newer pkg(1) tool on this system for p= ackage management, rather than the legacy package management tools (pkg_*).= The legacy tools should no longer be used on this system. pkg_info: You appear to be using the newer pkg(1) tool on this system for p= ackage management, rather than the legacy package management tools (pkg_*).= The legacy tools should no longer be used on this system. pkg_info: You appear to be using the newer pkg(1) tool on this system for p= ackage management, rather than the legacy package management tools (pkg_*).= The legacy tools should no longer be used on this system. Installing autoconf-2.68... done [...] =20 > > At very least, it makes sense to make it conditional on WITH_PKGNG, so = this > > code does not end up compiled in if PKGNG is disabled in src.conf. >=20 > Interesting idea. Maybe I shall do this. Yes, please.=20 Fabian --Sig_/oaj8yDwZ6z9F8IHXwzTWZ_d Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlDUVKoACgkQBYqIVf93VJ0V7gCgqkVWtx+PwPARlXdYlh+upqVr ZGEAnixtfHAVrQjmYgHeHjn60Ohh2GmL =KcI+ -----END PGP SIGNATURE----- --Sig_/oaj8yDwZ6z9F8IHXwzTWZ_d-- From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 12:37:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E0572777; Fri, 21 Dec 2012 12:37:28 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-oa0-f50.google.com (mail-oa0-f50.google.com [209.85.219.50]) by mx1.freebsd.org (Postfix) with ESMTP id 4EF998FC12; Fri, 21 Dec 2012 12:37:28 +0000 (UTC) Received: by mail-oa0-f50.google.com with SMTP id n16so4553780oag.37 for ; Fri, 21 Dec 2012 04:37:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=sdqCRhAxEylcDHRuphrrew3ErGWTr0a/H9pMqaPCwAc=; b=FM/tLioAejYY6N1Jt/ly8YsSfL+peIrHeU7aSeF1GwuBjjZk1UgFKEm1UejOztQRE+ n2Xr78HMm2balCZNIKLHaoOx2BMT8xHk5Xkj5dTyyIyiaX4II4AiW0JryyvHaHmkE0qT n7Ddqv6nZbpmiwxuTvnBci4fY+YCA/Z5z40DjBY39QWosIyWFuLa4F5a4f3lokvNDamQ 9QXeT4BUsRR1VhdqYlh3CWArtai8lh54WdwocRRGrAfDAE1gmdmqm/8x4lQhwXKKs8+M Q++7BCrjAiQ6tQPTV7uwbinvRzoSS6vthnwKYkIjbgIr/66UWy1sbhueuIDzB1JGFR+c 9VjQ== MIME-Version: 1.0 Received: by 10.182.172.74 with SMTP id ba10mr10871591obc.83.1356093442291; Fri, 21 Dec 2012 04:37:22 -0800 (PST) Received: by 10.76.143.33 with HTTP; Fri, 21 Dec 2012 04:37:22 -0800 (PST) In-Reply-To: References: Date: Fri, 21 Dec 2012 04:37:22 -0800 Message-ID: Subject: Re: Broken error handling with AF_* and socket(2) [was Re: svn commit: r243965 - in head/sys: kern sys] From: Garrett Cooper To: Kevin Lo Content-Type: text/plain; charset=ISO-8859-1 Cc: src-committers@freebsd.org, freebsd-net@freebsd.org, svn-src-all@freebsd.org, Gleb Smirnoff , svn-src-head@freebsd.org, Rick Macklem X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 12:37:29 -0000 (Don't know why I hit reply instead of reply-all, but oh well... I had one more reply anyhow) On Fri, Dec 21, 2012 at 4:28 AM, Garrett Cooper wrote: > On Fri, Dec 21, 2012 at 4:11 AM, Garrett Cooper wrote: >> On Thu, Dec 6, 2012 at 6:22 PM, Kevin Lo wrote: >>> Author: kevlo >>> Date: Fri Dec 7 02:22:48 2012 >>> New Revision: 243965 >>> URL: http://svnweb.freebsd.org/changeset/base/243965 >>> >>> Log: >>> - according to POSIX, make socket(2) return EAFNOSUPPORT rather than >>> EPROTONOSUPPORT if the address family is not supported. >>> - introduce pffinddomain() to find a domain by family and use it as >>> appropriate. >>> >>> Reviewed by: glebius >> >> This commit broke netgraph (and potentially more things). I fixed >> netgraph locally like so: >> >> $ git diff lib/libnetgraph/ >> diff --git a/lib/libnetgraph/sock.c b/lib/libnetgraph/sock.c >> index fca3900..5f9f563 100644 >> --- a/lib/libnetgraph/sock.c >> +++ b/lib/libnetgraph/sock.c >> @@ -71,10 +71,10 @@ NgMkSockNode(const char *name, int *csp, int *dsp) >> name = NULL; >> >> /* Create control socket; this also creates the netgraph node. >> - If we get an EPROTONOSUPPORT then the socket node type is >> + If we get an EAFNOSUPPORT then the socket node type is >> not loaded, so load it and try again. */ >> if ((cs = socket(AF_NETGRAPH, SOCK_DGRAM, NG_CONTROL)) < 0) { >> - if (errno == EPROTONOSUPPORT) { >> + if (errno == EAFNOSUPPORT) { >> if (kldload(NG_SOCKET_KLD) < 0) { >> errnosv = errno; >> if (_gNgDebugLevel >= 1) >> >> Reproing the issue was trivial using the ether.bridge example >> script setup with appropriate interfaces. >> I have the patch with the netgraph fix attached, along with other >> potential fixes that needs to be more properly tested. > > usr.sbin/mountd/mountd.c > usr.sbin/rpcbind/rpcbind.c > usr.sbin/ypserv/yp_main.c > > might be broken as well because they're calling __rpc_nconf2fd, > which just wraps socket(2) underneath it all. > At this point it might be wise to consider doing something about > the ABI because the contract has been grossly changed enough that > things that tried to make sense of sockets with EPROTONOSUPPORT are > going to have issues now on FreeBSD [potentially] in either positive > or negative cases. My fix wasn't necessarily the right answer for netgraph, et al. It was just what I needed in order to get it to function with the new socket(2) API. Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 12:38:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6EB7797D for ; Fri, 21 Dec 2012 12:38:29 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by mx1.freebsd.org (Postfix) with ESMTP id DBEAD8FC1C for ; Fri, 21 Dec 2012 12:38:28 +0000 (UTC) Received: by mail-wg0-f43.google.com with SMTP id e12so2089479wge.10 for ; Fri, 21 Dec 2012 04:38:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=0oeXFCSIXQRiGuM71z8da2vYRczK7k3U1RI3R1abpD0=; b=m5P2eo/o02yxwPGBSLthfuysjBaLuPMM532R40uEMqjob1/Ob/ZwqYW03/vcXQ8eUY whLCqAUVyIrvFBCSIdc1Kr3yoT2FIvZDf/rS+yJ79DT2wHGYdAYfj+Sd4JNwE1m/4r4X nQogzGValWcUR1aXSriCRthGnbfIs+kKMD9ro/c4Btr+iMs4pgnsypsvtx10EA0L29rw EdNPeo32uAJUKWnZ3yE4vtHBRbi7DJXUUqHBHngAcEHzhGKEU935pY1uaduwjZ2OnTlN xBWuW3cFyUuxAVq3XNhceRDZN1x4JYHyphuS6coGJSQcQbnJFfc7pVKN8j1ZZluwGLxC dOOw== X-Received: by 10.194.123.105 with SMTP id lz9mr23483452wjb.43.1356093501884; Fri, 21 Dec 2012 04:38:21 -0800 (PST) Received: from ithaqua.etoilebsd.net (ithaqua.etoilebsd.net. [37.59.37.188]) by mx.google.com with ESMTPS id hu8sm7671973wib.6.2012.12.21.04.38.21 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Dec 2012 04:38:21 -0800 (PST) Sender: Baptiste Daroussin Date: Fri, 21 Dec 2012 13:38:19 +0100 From: Baptiste Daroussin To: Fabian Keil Subject: Re: svn commit: r243554 - in head/usr.sbin/pkg_install: add create delete info lib updating version Message-ID: <20121221123819.GC34987@ithaqua.etoilebsd.net> References: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> <20121128170032.730be5fab68dba2a09aaa14e@FreeBSD.org> <20121128183422.714562856f27371c95d2a84e@FreeBSD.org> <20121221132303.124765b7@fabiankeil.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qtZFehHsKgwS5rPz" Content-Disposition: inline In-Reply-To: <20121221132303.124765b7@fabiankeil.de> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-all@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 12:38:29 -0000 --qtZFehHsKgwS5rPz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 21, 2012 at 01:23:03PM +0100, Fabian Keil wrote: > Eitan Adler wrote: >=20 > > On 28 November 2012 21:34, Stanislav Sedov wrote: >=20 > > > I don't really see how this > > > message being in pkg_ tools helps to prevent a possible foot-shooting > > > at all. > >=20 > > It reminds people that using the pkg_* tools once a conversion is done = is wrong. >=20 > I don't see how that prevents foot-shooting either. >=20 > Is there a single case where running one of the pkg_* tools > is dangerous and spamming the console somehow mitigates this? >=20 > How is the following helpful?: >=20 > # pkg2ng > pkg_info: You appear to be using the newer pkg(1) tool on this system for= package management, rather than the legacy package management tools (pkg_*= ). The legacy tools should no longer be used on this system. > Creating backup pkg_info(1) database directory in /var/db/pkg.bak. > pkg_info: You appear to be using the newer pkg(1) tool on this system for= package management, rather than the legacy package management tools (pkg_*= ). The legacy tools should no longer be used on this system. > pkg_info: You appear to be using the newer pkg(1) tool on this system for= package management, rather than the legacy package management tools (pkg_*= ). The legacy tools should no longer be used on this system. > pkg_info: You appear to be using the newer pkg(1) tool on this system for= package management, rather than the legacy package management tools (pkg_*= ). The legacy tools should no longer be used on this system. > Installing adns-1.4_1... done > pkg_info: You appear to be using the newer pkg(1) tool on this system for= package management, rather than the legacy package management tools (pkg_*= ). The legacy tools should no longer be used on this system. > pkg_info: You appear to be using the newer pkg(1) tool on this system for= package management, rather than the legacy package management tools (pkg_*= ). The legacy tools should no longer be used on this system. > pkg_info: You appear to be using the newer pkg(1) tool on this system for= package management, rather than the legacy package management tools (pkg_*= ). The legacy tools should no longer be used on this system. > pkg_info: You appear to be using the newer pkg(1) tool on this system for= package management, rather than the legacy package management tools (pkg_*= ). The legacy tools should no longer be used on this system. > pkg_info: You appear to be using the newer pkg(1) tool on this system for= package management, rather than the legacy package management tools (pkg_*= ). The legacy tools should no longer be used on this system. > pkg_info: You appear to be using the newer pkg(1) tool on this system for= package management, rather than the legacy package management tools (pkg_*= ). The legacy tools should no longer be used on this system. Fixed since a few seconds :) > Installing autoconf-2.68... done > [...] > =20 > > > At very least, it makes sense to make it conditional on WITH_PKGNG, s= o this > > > code does not end up compiled in if PKGNG is disabled in src.conf. > >=20 > > Interesting idea. Maybe I shall do this. >=20 > Yes, please.=20 >=20 done since a few seconds :) and=20 --qtZFehHsKgwS5rPz Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlDUWDsACgkQ8kTtMUmk6Ezm9QCfakDSI61/Rs6/oelx6SP5yUbQ uKMAni5NEZSiKrYfxrOuO+wSCXQfmp7I =5qgD -----END PGP SIGNATURE----- --qtZFehHsKgwS5rPz-- From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 13:14:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6FD77E57; Fri, 21 Dec 2012 13:14:13 +0000 (UTC) (envelope-from attilio@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 551318FC0C; Fri, 21 Dec 2012 13:14:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLDEDK1066255; Fri, 21 Dec 2012 13:14:13 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLDECrk066247; Fri, 21 Dec 2012 13:14:12 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201212211314.qBLDECrk066247@svn.freebsd.org> From: Attilio Rao Date: Fri, 21 Dec 2012 13:14:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244534 - in head/sys: kern ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 13:14:13 -0000 Author: attilio Date: Fri Dec 21 13:14:12 2012 New Revision: 244534 URL: http://svnweb.freebsd.org/changeset/base/244534 Log: Fixup r218424: uio_yield() was scaling directly to userland priority. When kern_yield() was introduced with the possibility to specify a new priority, the behaviour changed by not lowering priority at all in the consumers, making the yielding mechanism highly ineffective for high priority kthreads like bufdaemon, syncer, vlrudaemon, etc. There are no evidences that consumers could bear with such change in semantic and this situation could finally lead to bugs similar to the ones fixed in r244240. Re-specify userland pri for kthreads involved. Tested by: pho Reviewed by: kib, mdf MFC after: 1 week Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_mount.c head/sys/kern/vfs_subr.c head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Fri Dec 21 11:08:44 2012 (r244533) +++ head/sys/kern/vfs_bio.c Fri Dec 21 13:14:12 2012 (r244534) @@ -2209,7 +2209,7 @@ buf_daemon() while (numdirtybuffers > lodirtybuffers) { if (buf_do_flush(NULL) == 0) break; - kern_yield(PRI_UNCHANGED); + kern_yield(PRI_USER); } lodirtybuffers = lodirtysave; Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Fri Dec 21 11:08:44 2012 (r244533) +++ head/sys/kern/vfs_mount.c Fri Dec 21 13:14:12 2012 (r244534) @@ -1724,7 +1724,7 @@ __mnt_vnode_next(struct vnode **mvp, str KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch")); if (should_yield()) { MNT_IUNLOCK(mp); - kern_yield(PRI_UNCHANGED); + kern_yield(PRI_USER); MNT_ILOCK(mp); } vp = TAILQ_NEXT(*mvp, v_nmntvnodes); Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Fri Dec 21 11:08:44 2012 (r244533) +++ head/sys/kern/vfs_subr.c Fri Dec 21 13:14:12 2012 (r244534) @@ -741,7 +741,7 @@ next_iter: continue; MNT_IUNLOCK(mp); yield: - kern_yield(PRI_UNCHANGED); + kern_yield(PRI_USER); relock_mnt: MNT_ILOCK(mp); } @@ -853,7 +853,7 @@ vnlru_proc(void) vnlru_nowhere++; tsleep(vnlruproc, PPAUSE, "vlrup", hz * 3); } else - kern_yield(PRI_UNCHANGED); + kern_yield(PRI_USER); } } @@ -4635,7 +4635,7 @@ __mnt_vnode_next_all(struct vnode **mvp, struct vnode *vp; if (should_yield()) - kern_yield(PRI_UNCHANGED); + kern_yield(PRI_USER); MNT_ILOCK(mp); KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch")); vp = TAILQ_NEXT(*mvp, v_nmntvnodes); @@ -4784,7 +4784,7 @@ __mnt_vnode_next_active(struct vnode **m { if (should_yield()) - kern_yield(PRI_UNCHANGED); + kern_yield(PRI_USER); mtx_lock(&vnode_free_list_mtx); return (mnt_vnode_next_active(mvp, mp)); } Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri Dec 21 11:08:44 2012 (r244533) +++ head/sys/ufs/ffs/ffs_softdep.c Fri Dec 21 13:14:12 2012 (r244534) @@ -1569,7 +1569,7 @@ softdep_process_worklist(mp, full) */ if (should_yield()) { FREE_LOCK(&lk); - kern_yield(PRI_UNCHANGED); + kern_yield(PRI_USER); bwillwrite(); ACQUIRE_LOCK(&lk); } From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 14:01:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 23278743 for ; Fri, 21 Dec 2012 14:01:11 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 77B728FC0A for ; Fri, 21 Dec 2012 14:01:09 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id j13so4993650lah.41 for ; Fri, 21 Dec 2012 06:01:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=9Z5baYOFCpcK8p0XJDN2ycrcubpuYOZaBcHFYg3A5iU=; b=kuPQi2iIcyUJsGJF46bKzO9KI/TX1V8Sl19V9Gk4tZ+DWDijVZSm9+6U5vRsBv9jQz H65ay5DZS+1UxDdpy/vOfNxc29YBCfzM8dBffgiIzWb7Ln9DrJRZ/28lEC3mhHl0RBSI tYgZmkhkQTt37hBg+qQ7/ufrrsKCSHIovTbis= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-gm-message-state; bh=9Z5baYOFCpcK8p0XJDN2ycrcubpuYOZaBcHFYg3A5iU=; b=aJjurs7XONXSvqn/36EtP+9ZHoL0Zx2I8vfRvZSgCrmwJAmi0XEHB7vy4wXWvYAey5 gsDiIoK8Yv5LJE+cGsQQWXwxpm0ySlKaTRVFH0g6iBYjucrdiDW6s9w7gZkqECwbzZMT Z2dHahqVeq1bMZVvZcakJkKVWwC4XsC8p12pzhzGMV4uk6HPTNJy5blfdUjiILGzOTVX kf1cuLVLyJrswwGW+WUvJ47+lW6O2+Q26z2hFlE6E6C9Dl5zVc4+stMjnD+3XBv2lyI0 EMuK3IPL1M+nbV8DOV5QWOLIJnBP/b25s+MqKjxr+FPfqIAyKGjKBlxwlhVQYeNQZcvc tjRA== Received: by 10.152.124.111 with SMTP id mh15mr12363939lab.20.1356098468643; Fri, 21 Dec 2012 06:01:08 -0800 (PST) MIME-Version: 1.0 Received: by 10.112.162.100 with HTTP; Fri, 21 Dec 2012 06:00:38 -0800 (PST) In-Reply-To: <20121221132303.124765b7@fabiankeil.de> References: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> <20121128170032.730be5fab68dba2a09aaa14e@FreeBSD.org> <20121128183422.714562856f27371c95d2a84e@FreeBSD.org> <20121221132303.124765b7@fabiankeil.de> From: Eitan Adler Date: Fri, 21 Dec 2012 09:00:38 -0500 Message-ID: Subject: Re: svn commit: r243554 - in head/usr.sbin/pkg_install: add create delete info lib updating version To: Fabian Keil Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlOekHnIihmwHqaqNdsr1d2xonhYijEymEcNBD1QaWmp/Zvm+Fs6QvwVcOTl8seyGpki7kf Cc: svn-src-all@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 14:01:11 -0000 On 21 December 2012 07:23, Fabian Keil wrote: > Eitan Adler wrote: > >> On 28 November 2012 21:34, Stanislav Sedov wrote: > >> > I don't really see how this >> > message being in pkg_ tools helps to prevent a possible foot-shooting >> > at all. >> >> It reminds people that using the pkg_* tools once a conversion is done is wrong. > > I don't see how that prevents foot-shooting either. pkg2ng is not the only tool that emits this warnings. When you accidentally use pkg_info in a month you will see. > > Is there a single case where running one of the pkg_* tools > is dangerous and spamming the console somehow mitigates this? > > How is the following helpful?: There is a feature committed that allows pkg2ng to silence these warnings. This was committed so you are using an old version. -- Eitan Adler From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 14:17:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E483BE8; Fri, 21 Dec 2012 14:17:40 +0000 (UTC) (envelope-from hselasky@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 095268FC0A; Fri, 21 Dec 2012 14:17:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLEHdOK076224; Fri, 21 Dec 2012 14:17:39 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLEHdP0076223; Fri, 21 Dec 2012 14:17:39 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201212211417.qBLEHdP0076223@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 21 Dec 2012 14:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244535 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 14:17:40 -0000 Author: hselasky Date: Fri Dec 21 14:17:39 2012 New Revision: 244535 URL: http://svnweb.freebsd.org/changeset/base/244535 Log: Regression issue: Use a boundary of zero, hence a PAGE_SIZE boundary is implied by all memory allocations. Background: Busdma has problems to allocate more than PAGE_SIZE bytes when the boundary is PAGE_SIZE bytes too. Initially it was thought that a boundary of PAGE_SIZE bytes will only affect loading of DMA memory, so that segments get split correctly, but it also affects allocation of DMA'able memory. Solution: USB can detect big segments and split them as required by the USB code. MFC after: 1 week Reported by: gonzo Modified: head/sys/dev/usb/usb_busdma.c Modified: head/sys/dev/usb/usb_busdma.c ============================================================================== --- head/sys/dev/usb/usb_busdma.c Fri Dec 21 13:14:12 2012 (r244534) +++ head/sys/dev/usb/usb_busdma.c Fri Dec 21 14:17:39 2012 (r244535) @@ -358,8 +358,7 @@ usb_dma_tag_create(struct usb_dma_tag *u if (bus_dma_tag_create ( /* parent */ udt->tag_parent->tag, /* alignment */ align, - /* boundary */ (align == 1) ? - USB_PAGE_SIZE : 0, + /* boundary */ 0, /* lowaddr */ (2ULL << (udt->tag_parent->dma_bits - 1)) - 1, /* highaddr */ BUS_SPACE_MAXADDR, /* filter */ NULL, @@ -418,6 +417,7 @@ usb_pc_common_mem_cb(void *arg, bus_dma_ struct usb_page_cache *pc; struct usb_page *pg; usb_size_t rem; + bus_size_t off; uint8_t owned; pc = arg; @@ -433,6 +433,8 @@ usb_pc_common_mem_cb(void *arg, bus_dma_ if (error) { goto done; } + + off = 0; pg = pc->page_start; pg->physaddr = segs->ds_addr & ~(USB_PAGE_SIZE - 1); rem = segs->ds_addr & (USB_PAGE_SIZE - 1); @@ -450,10 +452,16 @@ usb_pc_common_mem_cb(void *arg, bus_dma_ } #endif while (nseg > 0) { - nseg--; - segs++; + off += USB_PAGE_SIZE; + if (off >= (segs->ds_len + rem)) { + /* page crossing */ + nseg--; + segs++; + off = 0; + rem = 0; + } pg++; - pg->physaddr = segs->ds_addr & ~(USB_PAGE_SIZE - 1); + pg->physaddr = (segs->ds_addr + off) & ~(USB_PAGE_SIZE - 1); } done: From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 15:15:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E5B43B99; Fri, 21 Dec 2012 15:15:35 +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 C74F38FC0C; Fri, 21 Dec 2012 15:15:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLFFZOY084617; Fri, 21 Dec 2012 15:15:35 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLFFZMe084616; Fri, 21 Dec 2012 15:15:35 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201212211515.qBLFFZMe084616@svn.freebsd.org> From: Rui Paulo Date: Fri, 21 Dec 2012 15:15:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244537 - in head: lib/libstand/amd64 sys/boot/userboot/libstand sys/boot/userboot/libstand/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 15:15:36 -0000 Author: rpaulo Date: Fri Dec 21 15:15:35 2012 New Revision: 244537 URL: http://svnweb.freebsd.org/changeset/base/244537 Log: Move the 64-bit _setjmp to lib/libstand. Added: head/lib/libstand/amd64/ - copied from r244525, head/sys/boot/userboot/libstand/amd64/ Deleted: head/sys/boot/userboot/libstand/amd64/ Modified: head/sys/boot/userboot/libstand/Makefile Modified: head/sys/boot/userboot/libstand/Makefile ============================================================================== --- head/sys/boot/userboot/libstand/Makefile Fri Dec 21 15:06:40 2012 (r244536) +++ head/sys/boot/userboot/libstand/Makefile Fri Dec 21 15:15:35 2012 (r244537) @@ -94,7 +94,7 @@ SRCS+= uuid_equal.c uuid_is_nil.c # _setjmp/_longjmp .if ${MACHINE_CPUARCH} == "amd64" -.PATH: ${.CURDIR}/amd64 +.PATH: ${S}/amd64 .elif ${MACHINE_ARCH} == "powerpc64" .PATH: ${S}/powerpc .else From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 15:52:11 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 030829C3; Fri, 21 Dec 2012 15:52:11 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from ns.kevlo.org (kevlo.org [220.128.136.52]) by mx1.freebsd.org (Postfix) with ESMTP id 691728FC0C; Fri, 21 Dec 2012 15:52:09 +0000 (UTC) Received: from srg.kevlo.org (git.kevlo.org [220.128.136.52]) by ns.kevlo.org (8.14.5/8.14.5) with ESMTP id qBLFpqV8091827; Fri, 21 Dec 2012 23:51:52 +0800 (CST) (envelope-from kevlo@FreeBSD.org) Message-ID: <50D485A1.8040006@FreeBSD.org> Date: Fri, 21 Dec 2012 23:52:01 +0800 From: Kevin Lo User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Garrett Cooper Subject: Re: Broken error handling with AF_* and socket(2) [was Re: svn commit: r243965 - in head/sys: kern sys] References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, freebsd-net@FreeBSD.org, svn-src-all@FreeBSD.org, Gleb Smirnoff , svn-src-head@FreeBSD.org, Rick Macklem X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 15:52:11 -0000 On 2012/12/21 20:11, Garrett Cooper wrote: > On Thu, Dec 6, 2012 at 6:22 PM, Kevin Lo wrote: >> Author: kevlo >> Date: Fri Dec 7 02:22:48 2012 >> New Revision: 243965 >> URL: http://svnweb.freebsd.org/changeset/base/243965 >> >> Log: >> - according to POSIX, make socket(2) return EAFNOSUPPORT rather than >> EPROTONOSUPPORT if the address family is not supported. >> - introduce pffinddomain() to find a domain by family and use it as >> appropriate. >> >> Reviewed by: glebius > This commit broke netgraph (and potentially more things). I fixed > netgraph locally like so: > > $ git diff lib/libnetgraph/ > diff --git a/lib/libnetgraph/sock.c b/lib/libnetgraph/sock.c > index fca3900..5f9f563 100644 > --- a/lib/libnetgraph/sock.c > +++ b/lib/libnetgraph/sock.c > @@ -71,10 +71,10 @@ NgMkSockNode(const char *name, int *csp, int *dsp) > name = NULL; > > /* Create control socket; this also creates the netgraph node. > - If we get an EPROTONOSUPPORT then the socket node type is > + If we get an EAFNOSUPPORT then the socket node type is > not loaded, so load it and try again. */ > if ((cs = socket(AF_NETGRAPH, SOCK_DGRAM, NG_CONTROL)) < 0) { > - if (errno == EPROTONOSUPPORT) { > + if (errno == EAFNOSUPPORT) { > if (kldload(NG_SOCKET_KLD) < 0) { > errnosv = errno; > if (_gNgDebugLevel >= 1) > > Reproing the issue was trivial using the ether.bridge example > script setup with appropriate interfaces. > I have the patch with the netgraph fix attached, along with other > potential fixes that needs to be more properly tested. Ah, seems I forgot to commit the change. Thanks for the patch, Garrett, I'll fix it right away. > Thanks, > -Garrett Kevin From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 15:54:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2C6C2DEC; Fri, 21 Dec 2012 15:54:16 +0000 (UTC) (envelope-from kevlo@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 06C9C8FC0A; Fri, 21 Dec 2012 15:54:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLFsFge090524; Fri, 21 Dec 2012 15:54:15 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLFsE2P090506; Fri, 21 Dec 2012 15:54:14 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201212211554.qBLFsE2P090506@svn.freebsd.org> From: Kevin Lo Date: Fri, 21 Dec 2012 15:54:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244538 - in head: bin/date lib/libnetgraph sbin/hastd sbin/ifconfig usr.sbin/mountd usr.sbin/mtest usr.sbin/rpcbind usr.sbin/ypserv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 15:54:16 -0000 Author: kevlo Date: Fri Dec 21 15:54:13 2012 New Revision: 244538 URL: http://svnweb.freebsd.org/changeset/base/244538 Log: Fix socket calls on error post-r243965. Submitted by: Garrett Cooper Modified: head/bin/date/netdate.c head/lib/libnetgraph/sock.c head/sbin/hastd/parse.y head/sbin/ifconfig/af_nd6.c head/sbin/ifconfig/ifconfig.c head/usr.sbin/mountd/mountd.c head/usr.sbin/mtest/mtest.c head/usr.sbin/rpcbind/rpcbind.c head/usr.sbin/ypserv/yp_main.c Modified: head/bin/date/netdate.c ============================================================================== --- head/bin/date/netdate.c Fri Dec 21 15:15:35 2012 (r244537) +++ head/bin/date/netdate.c Fri Dec 21 15:54:13 2012 (r244538) @@ -85,7 +85,7 @@ netsettime(time_t tval) dest.sin_addr.s_addr = htonl((u_long)INADDR_ANY); s = socket(AF_INET, SOCK_DGRAM, 0); if (s < 0) { - if (errno != EPROTONOSUPPORT) + if (errno != EAFNOSUPPORT) warn("timed"); return (retval = 2); } Modified: head/lib/libnetgraph/sock.c ============================================================================== --- head/lib/libnetgraph/sock.c Fri Dec 21 15:15:35 2012 (r244537) +++ head/lib/libnetgraph/sock.c Fri Dec 21 15:54:13 2012 (r244538) @@ -71,10 +71,10 @@ NgMkSockNode(const char *name, int *csp, name = NULL; /* Create control socket; this also creates the netgraph node. - If we get an EPROTONOSUPPORT then the socket node type is + If we get an EAFNOSUPPORT then the socket node type is not loaded, so load it and try again. */ if ((cs = socket(AF_NETGRAPH, SOCK_DGRAM, NG_CONTROL)) < 0) { - if (errno == EPROTONOSUPPORT) { + if (errno == EAFNOSUPPORT) { if (kldload(NG_SOCKET_KLD) < 0) { errnosv = errno; if (_gNgDebugLevel >= 1) Modified: head/sbin/hastd/parse.y ============================================================================== --- head/sbin/hastd/parse.y Fri Dec 21 15:15:35 2012 (r244537) +++ head/sbin/hastd/parse.y Fri Dec 21 15:54:13 2012 (r244538) @@ -769,7 +769,7 @@ family_supported(int family) int sock; sock = socket(family, SOCK_STREAM, 0); - if (sock == -1 && errno == EPROTONOSUPPORT) + if (sock == -1 && errno == EAFNOSUPPORT) return (false); if (sock >= 0) (void)close(sock); Modified: head/sbin/ifconfig/af_nd6.c ============================================================================== --- head/sbin/ifconfig/af_nd6.c Fri Dec 21 15:15:35 2012 (r244537) +++ head/sbin/ifconfig/af_nd6.c Fri Dec 21 15:54:13 2012 (r244538) @@ -148,7 +148,7 @@ nd6_status(int s) memset(&nd, 0, sizeof(nd)); strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname)); if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { - if (errno != EPROTONOSUPPORT) + if (errno != EAFNOSUPPORT) warn("socket(AF_INET6, SOCK_DGRAM)"); return; } Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Fri Dec 21 15:15:35 2012 (r244537) +++ head/sbin/ifconfig/ifconfig.c Fri Dec 21 15:54:13 2012 (r244538) @@ -520,7 +520,7 @@ top: AF_LOCAL : afp->af_af; if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0 && - (uafp != NULL || errno != EPROTONOSUPPORT || + (uafp != NULL || errno != EAFNOSUPPORT || (s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0)) err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family); Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Fri Dec 21 15:15:35 2012 (r244537) +++ head/usr.sbin/mountd/mountd.c Fri Dec 21 15:54:13 2012 (r244538) @@ -649,7 +649,7 @@ create_service(struct netconfig *nconf) */ if ((fd = __rpc_nconf2fd(nconf)) < 0) { int non_fatal = 0; - if (errno == EPROTONOSUPPORT && + if (errno == EAFNOSUPPORT && nconf->nc_semantics != NC_TPI_CLTS) non_fatal = 1; Modified: head/usr.sbin/mtest/mtest.c ============================================================================== --- head/usr.sbin/mtest/mtest.c Fri Dec 21 15:15:35 2012 (r244537) +++ head/usr.sbin/mtest/mtest.c Fri Dec 21 15:54:13 2012 (r244538) @@ -204,12 +204,12 @@ main(int argc, char **argv) s6 = -1; #ifdef INET s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (s == -1 && errno != EPROTONOSUPPORT) + if (s == -1 && errno != EAFNOSUPPORT) err(1, "can't open IPv4 socket"); #endif #ifdef INET6 s6 = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); - if (s6 == -1 && errno != EPROTONOSUPPORT) + if (s6 == -1 && errno != EAFNOSUPPORT) err(1, "can't open IPv6 socket"); #endif if (s == -1 && s6 == -1) Modified: head/usr.sbin/rpcbind/rpcbind.c ============================================================================== --- head/usr.sbin/rpcbind/rpcbind.c Fri Dec 21 15:15:35 2012 (r244537) +++ head/usr.sbin/rpcbind/rpcbind.c Fri Dec 21 15:54:13 2012 (r244538) @@ -289,7 +289,7 @@ init_transport(struct netconfig *nconf) */ if ((fd = __rpc_nconf2fd(nconf)) < 0) { int non_fatal = 0; - if (errno == EPROTONOSUPPORT) + if (errno == EAFNOSUPPORT) non_fatal = 1; syslog(non_fatal?LOG_DEBUG:LOG_ERR, "cannot create socket for %s", nconf->nc_netid); @@ -352,7 +352,7 @@ init_transport(struct netconfig *nconf) */ if ((fd = __rpc_nconf2fd(nconf)) < 0) { int non_fatal = 0; - if (errno == EPROTONOSUPPORT && + if (errno == EAFNOSUPPORT && nconf->nc_semantics != NC_TPI_CLTS) non_fatal = 1; syslog(non_fatal ? LOG_DEBUG : LOG_ERR, Modified: head/usr.sbin/ypserv/yp_main.c ============================================================================== --- head/usr.sbin/ypserv/yp_main.c Fri Dec 21 15:15:35 2012 (r244537) +++ head/usr.sbin/ypserv/yp_main.c Fri Dec 21 15:54:13 2012 (r244538) @@ -292,7 +292,7 @@ create_service(const int sock, const str s = __rpc_nconf2fd(nconf); if (s < 0) { - if (errno == EPROTONOSUPPORT) + if (errno == EAFNOSUPPORT) _msgout("unsupported" " transport: %s", nconf->nc_netid); From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 16:54:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6EAA8EFE; Fri, 21 Dec 2012 16:54:01 +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 50FD18FC12; Fri, 21 Dec 2012 16:54:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLGs15K099252; Fri, 21 Dec 2012 16:54:01 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLGs0XQ099245; Fri, 21 Dec 2012 16:54:00 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201212211654.qBLGs0XQ099245@svn.freebsd.org> From: Brooks Davis Date: Fri, 21 Dec 2012 16:54:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r244541 - in vendor/NetBSD/mtree: . dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 16:54:01 -0000 Author: brooks Date: Fri Dec 21 16:54:00 2012 New Revision: 244541 URL: http://svnweb.freebsd.org/changeset/base/244541 Log: Vendor import of NetBSD's mtree at 2012-12-21 Added: vendor/NetBSD/mtree/ vendor/NetBSD/mtree/dist/ vendor/NetBSD/mtree/dist/Makefile (contents, props changed) vendor/NetBSD/mtree/dist/compare.c (contents, props changed) vendor/NetBSD/mtree/dist/crc.c (contents, props changed) vendor/NetBSD/mtree/dist/create.c (contents, props changed) vendor/NetBSD/mtree/dist/excludes.c (contents, props changed) vendor/NetBSD/mtree/dist/extern.h (contents, props changed) vendor/NetBSD/mtree/dist/getid.c (contents, props changed) vendor/NetBSD/mtree/dist/misc.c (contents, props changed) vendor/NetBSD/mtree/dist/mtree.8 (contents, props changed) vendor/NetBSD/mtree/dist/mtree.c (contents, props changed) vendor/NetBSD/mtree/dist/mtree.h (contents, props changed) vendor/NetBSD/mtree/dist/spec.c (contents, props changed) vendor/NetBSD/mtree/dist/specspec.c (contents, props changed) vendor/NetBSD/mtree/dist/verify.c (contents, props changed) Added: vendor/NetBSD/mtree/dist/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/mtree/dist/Makefile Fri Dec 21 16:54:00 2012 (r244541) @@ -0,0 +1,20 @@ +# $NetBSD: Makefile,v 1.33 2012/10/05 01:26:56 christos Exp $ +# from: @(#)Makefile 8.2 (Berkeley) 4/27/95 + +.include + +PROG= mtree +#CPPFLAGS+=-DDEBUG +CPPFLAGS+= -DMTREE +MAN= mtree.8 +SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c specspec.c \ + verify.c getid.c pack_dev.c +.if (${HOSTPROG:U} == "") +DPADD+= ${LIBUTIL} +LDADD+= -lutil +.endif + +CPPFLAGS+= -I${NETBSDSRCDIR}/sbin/mknod +.PATH: ${NETBSDSRCDIR}/sbin/mknod + +.include Added: vendor/NetBSD/mtree/dist/compare.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/mtree/dist/compare.c Fri Dec 21 16:54:00 2012 (r244541) @@ -0,0 +1,528 @@ +/* $NetBSD: compare.c,v 1.55 2012/10/05 00:59:35 christos Exp $ */ + +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include +#if defined(__RCSID) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93"; +#else +__RCSID("$NetBSD: compare.c,v 1.55 2012/10/05 00:59:35 christos Exp $"); +#endif +#endif /* not lint */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifndef NO_MD5 +#include +#endif +#ifndef NO_RMD160 +#include +#endif +#ifndef NO_SHA1 +#include +#endif +#ifndef NO_SHA2 +#include +#endif + +#include "extern.h" + +#define INDENTNAMELEN 8 +#define MARK \ +do { \ + len = printf("%s: ", RP(p)); \ + if (len > INDENTNAMELEN) { \ + tab = "\t"; \ + printf("\n"); \ + } else { \ + tab = ""; \ + printf("%*s", INDENTNAMELEN - (int)len, ""); \ + } \ +} while (0) +#define LABEL if (!label++) MARK + +#if HAVE_STRUCT_STAT_ST_FLAGS + + +#define CHANGEFLAGS \ + if (flags != p->fts_statp->st_flags) { \ + char *sf; \ + if (!label) { \ + MARK; \ + sf = flags_to_string(p->fts_statp->st_flags, "none"); \ + printf("%sflags (\"%s\"", tab, sf); \ + free(sf); \ + } \ + if (lchflags(p->fts_accpath, flags)) { \ + label++; \ + printf(", not modified: %s)\n", \ + strerror(errno)); \ + } else { \ + sf = flags_to_string(flags, "none"); \ + printf(", modified to \"%s\")\n", sf); \ + free(sf); \ + } \ + } + +/* SETFLAGS: + * given pflags, additionally set those flags specified in s->st_flags and + * selected by mask (the other flags are left unchanged). + */ +#define SETFLAGS(pflags, mask) \ +do { \ + flags = (s->st_flags & (mask)) | (pflags); \ + CHANGEFLAGS; \ +} while (0) + +/* CLEARFLAGS: + * given pflags, reset the flags specified in s->st_flags and selected by mask + * (the other flags are left unchanged). + */ +#define CLEARFLAGS(pflags, mask) \ +do { \ + flags = (~(s->st_flags & (mask)) & CH_MASK) & (pflags); \ + CHANGEFLAGS; \ +} while (0) +#endif /* HAVE_STRUCT_STAT_ST_FLAGS */ + +int +compare(NODE *s, FTSENT *p) +{ + u_int32_t len, val, flags; + int fd, label; + const char *cp, *tab; +#if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2) + char *digestbuf; +#endif + + tab = NULL; + label = 0; + switch(s->type) { + case F_BLOCK: + if (!S_ISBLK(p->fts_statp->st_mode)) + goto typeerr; + break; + case F_CHAR: + if (!S_ISCHR(p->fts_statp->st_mode)) + goto typeerr; + break; + case F_DIR: + if (!S_ISDIR(p->fts_statp->st_mode)) + goto typeerr; + break; + case F_FIFO: + if (!S_ISFIFO(p->fts_statp->st_mode)) + goto typeerr; + break; + case F_FILE: + if (!S_ISREG(p->fts_statp->st_mode)) + goto typeerr; + break; + case F_LINK: + if (!S_ISLNK(p->fts_statp->st_mode)) + goto typeerr; + break; +#ifdef S_ISSOCK + case F_SOCK: + if (!S_ISSOCK(p->fts_statp->st_mode)) + goto typeerr; + break; +#endif +typeerr: LABEL; + printf("\ttype (%s, %s)\n", + nodetype(s->type), inotype(p->fts_statp->st_mode)); + return (label); + } + if (mtree_Wflag) + goto afterpermwhack; +#if HAVE_STRUCT_STAT_ST_FLAGS + if (iflag && !uflag) { + if (s->flags & F_FLAGS) + SETFLAGS(p->fts_statp->st_flags, SP_FLGS); + return (label); + } + if (mflag && !uflag) { + if (s->flags & F_FLAGS) + CLEARFLAGS(p->fts_statp->st_flags, SP_FLGS); + return (label); + } +#endif + if (s->flags & F_DEV && + (s->type == F_BLOCK || s->type == F_CHAR) && + s->st_rdev != p->fts_statp->st_rdev) { + LABEL; + printf("%sdevice (%#llx, %#llx", + tab, (long long)s->st_rdev, + (long long)p->fts_statp->st_rdev); + if (uflag) { + if ((unlink(p->fts_accpath) == -1) || + (mknod(p->fts_accpath, + s->st_mode | nodetoino(s->type), + s->st_rdev) == -1) || + (lchown(p->fts_accpath, p->fts_statp->st_uid, + p->fts_statp->st_gid) == -1) ) + printf(", not modified: %s)\n", + strerror(errno)); + else + printf(", modified)\n"); + } else + printf(")\n"); + tab = "\t"; + } + /* Set the uid/gid first, then set the mode. */ + if (s->flags & (F_UID | F_UNAME) && s->st_uid != p->fts_statp->st_uid) { + LABEL; + printf("%suser (%lu, %lu", + tab, (u_long)s->st_uid, (u_long)p->fts_statp->st_uid); + if (uflag) { + if (lchown(p->fts_accpath, s->st_uid, -1)) + printf(", not modified: %s)\n", + strerror(errno)); + else + printf(", modified)\n"); + } else + printf(")\n"); + tab = "\t"; + } + if (s->flags & (F_GID | F_GNAME) && s->st_gid != p->fts_statp->st_gid) { + LABEL; + printf("%sgid (%lu, %lu", + tab, (u_long)s->st_gid, (u_long)p->fts_statp->st_gid); + if (uflag) { + if (lchown(p->fts_accpath, -1, s->st_gid)) + printf(", not modified: %s)\n", + strerror(errno)); + else + printf(", modified)\n"); + } + else + printf(")\n"); + tab = "\t"; + } + if (s->flags & F_MODE && + s->st_mode != (p->fts_statp->st_mode & MBITS)) { + if (lflag) { + mode_t tmode, mode; + + tmode = s->st_mode; + mode = p->fts_statp->st_mode & MBITS; + /* + * if none of the suid/sgid/etc bits are set, + * then if the mode is a subset of the target, + * skip. + */ + if (!((tmode & ~(S_IRWXU|S_IRWXG|S_IRWXO)) || + (mode & ~(S_IRWXU|S_IRWXG|S_IRWXO)))) + if ((mode | tmode) == tmode) + goto skip; + } + + LABEL; + printf("%spermissions (%#lo, %#lo", + tab, (u_long)s->st_mode, + (u_long)p->fts_statp->st_mode & MBITS); + if (uflag) { + if (lchmod(p->fts_accpath, s->st_mode)) + printf(", not modified: %s)\n", + strerror(errno)); + else + printf(", modified)\n"); + } + else + printf(")\n"); + tab = "\t"; + skip: ; + } + if (s->flags & F_NLINK && s->type != F_DIR && + s->st_nlink != p->fts_statp->st_nlink) { + LABEL; + printf("%slink count (%lu, %lu)\n", + tab, (u_long)s->st_nlink, (u_long)p->fts_statp->st_nlink); + tab = "\t"; + } + if (s->flags & F_SIZE && s->st_size != p->fts_statp->st_size) { + LABEL; + printf("%ssize (%lld, %lld)\n", + tab, (long long)s->st_size, + (long long)p->fts_statp->st_size); + tab = "\t"; + } + /* + * XXX + * Since utimes(2) only takes a timeval, there's no point in + * comparing the low bits of the timespec nanosecond field. This + * will only result in mismatches that we can never fix. + * + * Doesn't display microsecond differences. + */ + if (s->flags & F_TIME) { + struct timeval tv[2]; + struct stat *ps = p->fts_statp; + time_t smtime = s->st_mtimespec.tv_sec; + +#if defined(BSD4_4) && !defined(HAVE_NBTOOL_CONFIG_H) + time_t pmtime = ps->st_mtimespec.tv_sec; + + TIMESPEC_TO_TIMEVAL(&tv[0], &s->st_mtimespec); + TIMESPEC_TO_TIMEVAL(&tv[1], &ps->st_mtimespec); +#else + time_t pmtime = (time_t)ps->st_mtime; + + tv[0].tv_sec = smtime; + tv[0].tv_usec = 0; + tv[1].tv_sec = pmtime; + tv[1].tv_usec = 0; +#endif + + if (tv[0].tv_sec != tv[1].tv_sec || + tv[0].tv_usec != tv[1].tv_usec) { + LABEL; + printf("%smodification time (%.24s, ", + tab, ctime(&smtime)); + printf("%.24s", ctime(&pmtime)); + if (tflag) { + tv[1] = tv[0]; + if (utimes(p->fts_accpath, tv)) + printf(", not modified: %s)\n", + strerror(errno)); + else + printf(", modified)\n"); + } else + printf(")\n"); + tab = "\t"; + } + } +#if HAVE_STRUCT_STAT_ST_FLAGS + /* + * XXX + * since lchflags(2) will reset file times, the utimes() above + * may have been useless! oh well, we'd rather have correct + * flags, rather than times? + */ + if ((s->flags & F_FLAGS) && ((s->st_flags != p->fts_statp->st_flags) + || mflag || iflag)) { + if (s->st_flags != p->fts_statp->st_flags) { + char *f_s; + LABEL; + f_s = flags_to_string(s->st_flags, "none"); + printf("%sflags (\"%s\" is not ", tab, f_s); + free(f_s); + f_s = flags_to_string(p->fts_statp->st_flags, "none"); + printf("\"%s\"", f_s); + free(f_s); + } + if (uflag) { + if (iflag) + SETFLAGS(0, CH_MASK); + else if (mflag) + CLEARFLAGS(0, SP_FLGS); + else + SETFLAGS(0, (~SP_FLGS & CH_MASK)); + } else + printf(")\n"); + tab = "\t"; + } +#endif /* HAVE_STRUCT_STAT_ST_FLAGS */ + + /* + * from this point, no more permission checking or whacking + * occurs, only checking of stuff like checksums and symlinks. + */ + afterpermwhack: + if (s->flags & F_CKSUM) { + if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0) { + LABEL; + printf("%scksum: %s: %s\n", + tab, p->fts_accpath, strerror(errno)); + tab = "\t"; + } else if (crc(fd, &val, &len)) { + close(fd); + LABEL; + printf("%scksum: %s: %s\n", + tab, p->fts_accpath, strerror(errno)); + tab = "\t"; + } else { + close(fd); + if (s->cksum != val) { + LABEL; + printf("%scksum (%lu, %lu)\n", + tab, s->cksum, (unsigned long)val); + } + tab = "\t"; + } + } +#ifndef NO_MD5 + if (s->flags & F_MD5) { + if ((digestbuf = MD5File(p->fts_accpath, NULL)) == NULL) { + LABEL; + printf("%s%s: %s: %s\n", + tab, MD5KEY, p->fts_accpath, strerror(errno)); + tab = "\t"; + } else { + if (strcmp(s->md5digest, digestbuf)) { + LABEL; + printf("%s%s (0x%s, 0x%s)\n", + tab, MD5KEY, s->md5digest, digestbuf); + } + tab = "\t"; + free(digestbuf); + } + } +#endif /* ! NO_MD5 */ +#ifndef NO_RMD160 + if (s->flags & F_RMD160) { + if ((digestbuf = RMD160File(p->fts_accpath, NULL)) == NULL) { + LABEL; + printf("%s%s: %s: %s\n", + tab, RMD160KEY, p->fts_accpath, strerror(errno)); + tab = "\t"; + } else { + if (strcmp(s->rmd160digest, digestbuf)) { + LABEL; + printf("%s%s (0x%s, 0x%s)\n", + tab, RMD160KEY, s->rmd160digest, digestbuf); + } + tab = "\t"; + free(digestbuf); + } + } +#endif /* ! NO_RMD160 */ +#ifndef NO_SHA1 + if (s->flags & F_SHA1) { + if ((digestbuf = SHA1File(p->fts_accpath, NULL)) == NULL) { + LABEL; + printf("%s%s: %s: %s\n", + tab, SHA1KEY, p->fts_accpath, strerror(errno)); + tab = "\t"; + } else { + if (strcmp(s->sha1digest, digestbuf)) { + LABEL; + printf("%s%s (0x%s, 0x%s)\n", + tab, SHA1KEY, s->sha1digest, digestbuf); + } + tab = "\t"; + free(digestbuf); + } + } +#endif /* ! NO_SHA1 */ +#ifndef NO_SHA2 + if (s->flags & F_SHA256) { + if ((digestbuf = SHA256_File(p->fts_accpath, NULL)) == NULL) { + LABEL; + printf("%s%s: %s: %s\n", + tab, SHA256KEY, p->fts_accpath, strerror(errno)); + tab = "\t"; + } else { + if (strcmp(s->sha256digest, digestbuf)) { + LABEL; + printf("%s%s (0x%s, 0x%s)\n", + tab, SHA256KEY, s->sha256digest, digestbuf); + } + tab = "\t"; + free(digestbuf); + } + } +#ifdef SHA384_BLOCK_LENGTH + if (s->flags & F_SHA384) { + if ((digestbuf = SHA384_File(p->fts_accpath, NULL)) == NULL) { + LABEL; + printf("%s%s: %s: %s\n", + tab, SHA384KEY, p->fts_accpath, strerror(errno)); + tab = "\t"; + } else { + if (strcmp(s->sha384digest, digestbuf)) { + LABEL; + printf("%s%s (0x%s, 0x%s)\n", + tab, SHA384KEY, s->sha384digest, digestbuf); + } + tab = "\t"; + free(digestbuf); + } + } +#endif + if (s->flags & F_SHA512) { + if ((digestbuf = SHA512_File(p->fts_accpath, NULL)) == NULL) { + LABEL; + printf("%s%s: %s: %s\n", + tab, SHA512KEY, p->fts_accpath, strerror(errno)); + tab = "\t"; + } else { + if (strcmp(s->sha512digest, digestbuf)) { + LABEL; + printf("%s%s (0x%s, 0x%s)\n", + tab, SHA512KEY, s->sha512digest, digestbuf); + } + tab = "\t"; + free(digestbuf); + } + } +#endif /* ! NO_SHA2 */ + if (s->flags & F_SLINK && + strcmp(cp = rlink(p->fts_accpath), s->slink)) { + LABEL; + printf("%slink ref (%s, %s", tab, cp, s->slink); + if (uflag) { + if ((unlink(p->fts_accpath) == -1) || + (symlink(s->slink, p->fts_accpath) == -1) ) + printf(", not modified: %s)\n", + strerror(errno)); + else + printf(", modified)\n"); + } else + printf(")\n"); + } + return (label); +} + +const char * +rlink(const char *name) +{ + static char lbuf[MAXPATHLEN]; + int len; + + if ((len = readlink(name, lbuf, sizeof(lbuf) - 1)) == -1) + mtree_err("%s: %s", name, strerror(errno)); + lbuf[len] = '\0'; + return (lbuf); +} Added: vendor/NetBSD/mtree/dist/crc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/mtree/dist/crc.c Fri Dec 21 16:54:00 2012 (r244541) @@ -0,0 +1,163 @@ +/* $NetBSD: crc.c,v 1.9 2012/10/05 00:40:51 christos Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * James W. Williams of NASA Goddard Space Flight Center. + * + * 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include +#if defined(__RCSID) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 6/17/93"; +#else +__RCSID("$NetBSD: crc.c,v 1.9 2012/10/05 00:40:51 christos Exp $"); +#endif +#endif /* not lint */ + +#include + +#include +#include +#include + +#include "extern.h" + +static const u_int32_t crctab[] = { + 0x0, + 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, + 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, + 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, + 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, + 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, + 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, + 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, + 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, + 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, + 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, + 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, + 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, + 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, + 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, + 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, + 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, + 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, + 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, + 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, + 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, + 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, + 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, + 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, + 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, + 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, + 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, + 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, + 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, + 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, + 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, + 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, + 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, + 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, + 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, + 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, + 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, + 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, + 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, + 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, + 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, + 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, + 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, + 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, + 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, + 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, + 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, + 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, + 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, + 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, + 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, + 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 +}; + +/* + * Compute a POSIX 1003.2 checksum. This routine has been broken out so that + * other programs can use it. It takes a file descriptor to read from and + * locations to store the crc and the number of bytes read. It returns 0 on + * success and 1 on failure. Errno is set on failure. + */ +u_int32_t crc_total = ~0; /* The crc over a number of files. */ + +int +crc(int fd, u_int32_t *cval, u_int32_t *clen) +{ + u_char *p; + int nr; + u_int32_t thecrc, len; + u_int32_t crctot; + u_char buf[16 * 1024]; + +#define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)] + + thecrc = len = crctot = 0; + if (sflag) + crctot = ~crc_total; + while ((nr = read(fd, buf, sizeof(buf))) > 0) + if (sflag) { + for (len += nr, p = buf; nr--; ++p) { + COMPUTE(thecrc, *p); + COMPUTE(crctot, *p); + } + } else { + for (len += nr, p = buf; nr--; ++p) + COMPUTE(thecrc, *p); + } + if (nr < 0) + return 1; + + *clen = len; + + /* Include the length of the file. */ + if (sflag) { + for (; len != 0; len >>= 8) { + COMPUTE(thecrc, len & 0xff); + COMPUTE(crctot, len & 0xff); + } + } else { + for (; len != 0; len >>= 8) + COMPUTE(thecrc, len & 0xff); + } + + *cval = ~thecrc; + if (sflag) + crc_total = ~crctot; + return 0; +} Added: vendor/NetBSD/mtree/dist/create.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/mtree/dist/create.c Fri Dec 21 16:54:00 2012 (r244541) @@ -0,0 +1,467 @@ +/* $NetBSD: create.c,v 1.68 2012/12/20 16:43:16 christos Exp $ */ + +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include +#if defined(__RCSID) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; +#else +__RCSID("$NetBSD: create.c,v 1.68 2012/12/20 16:43:16 christos Exp $"); +#endif +#endif /* not lint */ + +#include +#include + +#if ! HAVE_NBTOOL_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef NO_MD5 +#include +#endif +#ifndef NO_RMD160 +#include +#endif +#ifndef NO_SHA1 +#include +#endif +#ifndef NO_SHA2 +#include +#endif + +#include "extern.h" + +#define INDENTNAMELEN 15 +#define MAXLINELEN 80 + +static gid_t gid; +static uid_t uid; +static mode_t mode; +static u_long flags; + +#ifdef __FreeBSD__ +#define FTS_CONST const +#else +#define FTS_CONST +#endif + +static int dcmp(const FTSENT *FTS_CONST *, const FTSENT *FTS_CONST *); +static void output(int, int *, const char *, ...) + __attribute__((__format__(__printf__, 3, 4))); +static int statd(FTS *, FTSENT *, uid_t *, gid_t *, mode_t *, u_long *); +static void statf(int, FTSENT *); + +void +cwalk(void) +{ + FTS *t; + FTSENT *p; + time_t clocktime; + char host[MAXHOSTNAMELEN + 1]; + const char *user; + char *argv[2]; + char dot[] = "."; + int indent = 0; + + argv[0] = dot; + argv[1] = NULL; + + time(&clocktime); + gethostname(host, sizeof(host)); + host[sizeof(host) - 1] = '\0'; + if ((user = getlogin()) == NULL) { + struct passwd *pw; + user = (pw = getpwuid(getuid())) == NULL ? pw->pw_name : + ""; + } + + if (!nflag) + printf( + "#\t user: %s\n#\tmachine: %s\n#\t tree: %s\n" + "#\t date: %s", + user, host, fullpath, ctime(&clocktime)); + + if ((t = fts_open(argv, ftsoptions, dcmp)) == NULL) + mtree_err("fts_open: %s", strerror(errno)); + while ((p = fts_read(t)) != NULL) { + if (jflag) + indent = p->fts_level * 4; + if (check_excludes(p->fts_name, p->fts_path)) { + fts_set(t, p, FTS_SKIP); + continue; + } + switch(p->fts_info) { + case FTS_D: + if (!bflag) + printf("\n"); + if (!nflag) + printf("# %s\n", p->fts_path); + statd(t, p, &uid, &gid, &mode, &flags); + statf(indent, p); + break; + case FTS_DP: + if (p->fts_level > 0) + if (!nflag) + printf("%*s# %s\n", indent, "", + p->fts_path); + if (p->fts_level > 0 || flavor == F_FREEBSD9) { + printf("%*s..\n", indent, ""); + if (!bflag) + printf("\n"); + } + break; + case FTS_DNR: + case FTS_ERR: + case FTS_NS: + mtree_err("%s: %s", + p->fts_path, strerror(p->fts_errno)); + break; + default: + if (!dflag) + statf(indent, p); + break; + + } + } + fts_close(t); + if (sflag && keys & F_CKSUM) + mtree_err("%s checksum: %u", fullpath, crc_total); +} + +static void +statf(int indent, FTSENT *p) +{ + u_int32_t len, val; + int fd, offset; + const char *name = NULL; +#if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2) + char *digestbuf; +#endif + + offset = printf("%*s%s%s", indent, "", + S_ISDIR(p->fts_statp->st_mode) ? "" : " ", vispath(p->fts_name)); + + if (offset > (INDENTNAMELEN + indent)) + offset = MAXLINELEN; + else + offset += printf("%*s", (INDENTNAMELEN + indent) - offset, ""); + + if (!S_ISREG(p->fts_statp->st_mode) && (flavor == F_NETBSD6 || !dflag)) + output(indent, &offset, "type=%s", + inotype(p->fts_statp->st_mode)); + if (keys & (F_UID | F_UNAME) && p->fts_statp->st_uid != uid) { + if (keys & F_UNAME && + (name = user_from_uid(p->fts_statp->st_uid, 1)) != NULL) + output(indent, &offset, "uname=%s", name); + if (keys & F_UID || (keys & F_UNAME && name == NULL)) + output(indent, &offset, "uid=%u", p->fts_statp->st_uid); + } + if (keys & (F_GID | F_GNAME) && p->fts_statp->st_gid != gid) { + if (keys & F_GNAME && + (name = group_from_gid(p->fts_statp->st_gid, 1)) != NULL) + output(indent, &offset, "gname=%s", name); + if (keys & F_GID || (keys & F_GNAME && name == NULL)) + output(indent, &offset, "gid=%u", p->fts_statp->st_gid); + } + if (keys & F_MODE && (p->fts_statp->st_mode & MBITS) != mode) + output(indent, &offset, "mode=%#o", + p->fts_statp->st_mode & MBITS); + if (keys & F_DEV && + (S_ISBLK(p->fts_statp->st_mode) || S_ISCHR(p->fts_statp->st_mode))) + output(indent, &offset, "device=%#llx", + (long long)p->fts_statp->st_rdev); + if (keys & F_NLINK && p->fts_statp->st_nlink != 1) + output(indent, &offset, "nlink=%u", p->fts_statp->st_nlink); + if (keys & F_SIZE && + (flavor != F_NETBSD6 || S_ISREG(p->fts_statp->st_mode))) + output(indent, &offset, "size=%lld", + (long long)p->fts_statp->st_size); + if (keys & F_TIME) +#if defined(BSD4_4) && !defined(HAVE_NBTOOL_CONFIG_H) + output(indent, &offset, "time=%ld.%09ld", + (long)p->fts_statp->st_mtimespec.tv_sec, + p->fts_statp->st_mtimespec.tv_nsec); +#else + output(indent, &offset, "time=%ld.%09ld", + (long)p->fts_statp->st_mtime, (long)0); +#endif + if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) { + if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 || + crc(fd, &val, &len)) + mtree_err("%s: %s", p->fts_accpath, strerror(errno)); + close(fd); + output(indent, &offset, "cksum=%lu", (long)val); + } +#ifndef NO_MD5 + if (keys & F_MD5 && S_ISREG(p->fts_statp->st_mode)) { + if ((digestbuf = MD5File(p->fts_accpath, NULL)) == NULL) + mtree_err("%s: MD5File failed: %s", p->fts_accpath, + strerror(errno)); + output(indent, &offset, "%s=%s", MD5KEY, digestbuf); + free(digestbuf); + } +#endif /* ! NO_MD5 */ +#ifndef NO_RMD160 + if (keys & F_RMD160 && S_ISREG(p->fts_statp->st_mode)) { + if ((digestbuf = RMD160File(p->fts_accpath, NULL)) == NULL) + mtree_err("%s: RMD160File failed: %s", p->fts_accpath, + strerror(errno)); + output(indent, &offset, "%s=%s", RMD160KEY, digestbuf); + free(digestbuf); + } +#endif /* ! NO_RMD160 */ +#ifndef NO_SHA1 + if (keys & F_SHA1 && S_ISREG(p->fts_statp->st_mode)) { + if ((digestbuf = SHA1File(p->fts_accpath, NULL)) == NULL) + mtree_err("%s: SHA1File failed: %s", p->fts_accpath, + strerror(errno)); + output(indent, &offset, "%s=%s", SHA1KEY, digestbuf); + free(digestbuf); + } +#endif /* ! NO_SHA1 */ +#ifndef NO_SHA2 + if (keys & F_SHA256 && S_ISREG(p->fts_statp->st_mode)) { + if ((digestbuf = SHA256_File(p->fts_accpath, NULL)) == NULL) + mtree_err("%s: SHA256_File failed: %s", p->fts_accpath, + strerror(errno)); + output(indent, &offset, "%s=%s", SHA256KEY, digestbuf); + free(digestbuf); + } +#ifdef SHA384_BLOCK_LENGTH + if (keys & F_SHA384 && S_ISREG(p->fts_statp->st_mode)) { + if ((digestbuf = SHA384_File(p->fts_accpath, NULL)) == NULL) + mtree_err("%s: SHA384_File failed: %s", p->fts_accpath, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 16:54:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4AB64E9; Fri, 21 Dec 2012 16:54:34 +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 16B078FC15; Fri, 21 Dec 2012 16:54:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLGsXCK099355; Fri, 21 Dec 2012 16:54:33 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLGsXsp099354; Fri, 21 Dec 2012 16:54:33 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201212211654.qBLGsXsp099354@svn.freebsd.org> From: Brooks Davis Date: Fri, 21 Dec 2012 16:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r244542 - vendor/NetBSD/mtree/20122112 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 16:54:34 -0000 Author: brooks Date: Fri Dec 21 16:54:33 2012 New Revision: 244542 URL: http://svnweb.freebsd.org/changeset/base/244542 Log: Tag 2012-12-21 import of NetBSD's mtree Added: vendor/NetBSD/mtree/20122112/ - copied from r244541, vendor/NetBSD/mtree/dist/ From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 17:08:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C816F546; Fri, 21 Dec 2012 17:08:02 +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 ACDE68FC14; Fri, 21 Dec 2012 17:08:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLH82ob001605; Fri, 21 Dec 2012 17:08:02 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLH82tk001603; Fri, 21 Dec 2012 17:08:02 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201212211708.qBLH82tk001603@svn.freebsd.org> From: Brooks Davis Date: Fri, 21 Dec 2012 17:08:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r244543 - in vendor/NetBSD/mknod: . dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 17:08:02 -0000 Author: brooks Date: Fri Dec 21 17:08:01 2012 New Revision: 244543 URL: http://svnweb.freebsd.org/changeset/base/244543 Log: Vendor import of pack_dev.* from NetBSD's mknod at 2012-12-21 Added: vendor/NetBSD/mknod/ vendor/NetBSD/mknod/dist/ vendor/NetBSD/mknod/dist/pack_dev.c (contents, props changed) vendor/NetBSD/mknod/dist/pack_dev.h (contents, props changed) Added: vendor/NetBSD/mknod/dist/pack_dev.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/mknod/dist/pack_dev.c Fri Dec 21 17:08:01 2012 (r244543) @@ -0,0 +1,290 @@ +/* $NetBSD: pack_dev.c,v 1.11 2011/08/27 18:37:41 joerg Exp $ */ + +/*- + * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Charles M. Hannum. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include +#if !defined(lint) +__RCSID("$NetBSD: pack_dev.c,v 1.11 2011/08/27 18:37:41 joerg Exp $"); +#endif /* not lint */ + +#include +#include + +#include +#include +#include +#include +#include + +#include "pack_dev.h" + +static pack_t pack_netbsd; +static pack_t pack_freebsd; +static pack_t pack_8_8; +static pack_t pack_12_20; +static pack_t pack_14_18; +static pack_t pack_8_24; +static pack_t pack_bsdos; +static int compare_format(const void *, const void *); + +static const char iMajorError[] = "invalid major number"; +static const char iMinorError[] = "invalid minor number"; +static const char tooManyFields[] = "too many fields for format"; + + /* exported */ +portdev_t +pack_native(int n, u_long numbers[], const char **error) +{ + portdev_t dev = 0; + + if (n == 2) { + dev = makedev(numbers[0], numbers[1]); + if ((u_long)major(dev) != numbers[0]) + *error = iMajorError; + else if ((u_long)minor(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +static portdev_t +pack_netbsd(int n, u_long numbers[], const char **error) +{ + portdev_t dev = 0; + + if (n == 2) { + dev = makedev_netbsd(numbers[0], numbers[1]); + if ((u_long)major_netbsd(dev) != numbers[0]) + *error = iMajorError; + else if ((u_long)minor_netbsd(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_freebsd(x) ((int32_t)(((x) & 0x0000ff00) >> 8)) +#define minor_freebsd(x) ((int32_t)(((x) & 0xffff00ff) >> 0)) +#define makedev_freebsd(x,y) ((portdev_t)((((x) << 8) & 0x0000ff00) | \ + (((y) << 0) & 0xffff00ff))) + +static portdev_t +pack_freebsd(int n, u_long numbers[], const char **error) +{ + portdev_t dev = 0; + + if (n == 2) { + dev = makedev_freebsd(numbers[0], numbers[1]); + if ((u_long)major_freebsd(dev) != numbers[0]) + *error = iMajorError; + if ((u_long)minor_freebsd(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_8_8(x) ((int32_t)(((x) & 0x0000ff00) >> 8)) +#define minor_8_8(x) ((int32_t)(((x) & 0x000000ff) >> 0)) +#define makedev_8_8(x,y) ((portdev_t)((((x) << 8) & 0x0000ff00) | \ + (((y) << 0) & 0x000000ff))) + +static portdev_t +pack_8_8(int n, u_long numbers[], const char **error) +{ + portdev_t dev = 0; + + if (n == 2) { + dev = makedev_8_8(numbers[0], numbers[1]); + if ((u_long)major_8_8(dev) != numbers[0]) + *error = iMajorError; + if ((u_long)minor_8_8(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_12_20(x) ((int32_t)(((x) & 0xfff00000) >> 20)) +#define minor_12_20(x) ((int32_t)(((x) & 0x000fffff) >> 0)) +#define makedev_12_20(x,y) ((portdev_t)((((x) << 20) & 0xfff00000) | \ + (((y) << 0) & 0x000fffff))) + +static portdev_t +pack_12_20(int n, u_long numbers[], const char **error) +{ + portdev_t dev = 0; + + if (n == 2) { + dev = makedev_12_20(numbers[0], numbers[1]); + if ((u_long)major_12_20(dev) != numbers[0]) + *error = iMajorError; + if ((u_long)minor_12_20(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_14_18(x) ((int32_t)(((x) & 0xfffc0000) >> 18)) +#define minor_14_18(x) ((int32_t)(((x) & 0x0003ffff) >> 0)) +#define makedev_14_18(x,y) ((portdev_t)((((x) << 18) & 0xfffc0000) | \ + (((y) << 0) & 0x0003ffff))) + +static portdev_t +pack_14_18(int n, u_long numbers[], const char **error) +{ + portdev_t dev = 0; + + if (n == 2) { + dev = makedev_14_18(numbers[0], numbers[1]); + if ((u_long)major_14_18(dev) != numbers[0]) + *error = iMajorError; + if ((u_long)minor_14_18(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_8_24(x) ((int32_t)(((x) & 0xff000000) >> 24)) +#define minor_8_24(x) ((int32_t)(((x) & 0x00ffffff) >> 0)) +#define makedev_8_24(x,y) ((portdev_t)((((x) << 24) & 0xff000000) | \ + (((y) << 0) & 0x00ffffff))) + +static portdev_t +pack_8_24(int n, u_long numbers[], const char **error) +{ + portdev_t dev = 0; + + if (n == 2) { + dev = makedev_8_24(numbers[0], numbers[1]); + if ((u_long)major_8_24(dev) != numbers[0]) + *error = iMajorError; + if ((u_long)minor_8_24(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_12_12_8(x) ((int32_t)(((x) & 0xfff00000) >> 20)) +#define unit_12_12_8(x) ((int32_t)(((x) & 0x000fff00) >> 8)) +#define subunit_12_12_8(x) ((int32_t)(((x) & 0x000000ff) >> 0)) +#define makedev_12_12_8(x,y,z) ((portdev_t)((((x) << 20) & 0xfff00000) | \ + (((y) << 8) & 0x000fff00) | \ + (((z) << 0) & 0x000000ff))) + +static portdev_t +pack_bsdos(int n, u_long numbers[], const char **error) +{ + portdev_t dev = 0; + + if (n == 2) { + dev = makedev_12_20(numbers[0], numbers[1]); + if ((u_long)major_12_20(dev) != numbers[0]) + *error = iMajorError; + if ((u_long)minor_12_20(dev) != numbers[1]) + *error = iMinorError; + } else if (n == 3) { + dev = makedev_12_12_8(numbers[0], numbers[1], numbers[2]); + if ((u_long)major_12_12_8(dev) != numbers[0]) + *error = iMajorError; + if ((u_long)unit_12_12_8(dev) != numbers[1]) + *error = "invalid unit number"; + if ((u_long)subunit_12_12_8(dev) != numbers[2]) + *error = "invalid subunit number"; + } else + *error = tooManyFields; + return (dev); +} + + + /* list of formats and pack functions */ + /* this list must be sorted lexically */ +static struct format { + const char *name; + pack_t *pack; +} formats[] = { + {"386bsd", pack_8_8}, + {"4bsd", pack_8_8}, + {"bsdos", pack_bsdos}, + {"freebsd", pack_freebsd}, + {"hpux", pack_8_24}, + {"isc", pack_8_8}, + {"linux", pack_8_8}, + {"native", pack_native}, + {"netbsd", pack_netbsd}, + {"osf1", pack_12_20}, + {"sco", pack_8_8}, + {"solaris", pack_14_18}, + {"sunos", pack_8_8}, + {"svr3", pack_8_8}, + {"svr4", pack_14_18}, + {"ultrix", pack_8_8}, +}; + +static int +compare_format(const void *key, const void *element) +{ + const char *name; + const struct format *format; + + name = key; + format = element; + + return (strcmp(name, format->name)); +} + + +pack_t * +pack_find(const char *name) +{ + struct format *format; + + format = bsearch(name, formats, + sizeof(formats)/sizeof(formats[0]), + sizeof(formats[0]), compare_format); + if (format == 0) + return (NULL); + return (format->pack); +} Added: vendor/NetBSD/mknod/dist/pack_dev.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/mknod/dist/pack_dev.h Fri Dec 21 17:08:01 2012 (r244543) @@ -0,0 +1,52 @@ +/* $NetBSD: pack_dev.h,v 1.7 2008/04/28 20:23:09 martin Exp $ */ + +/*- + * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Charles M. Hannum. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#ifndef _PACK_DEV_H +#define _PACK_DEV_H + +#ifdef __CYGWIN__ +typedef __dev32_t portdev_t; +#else +typedef dev_t portdev_t; +#endif +typedef portdev_t pack_t(int, u_long [], const char **); + +pack_t *pack_find(const char *); +pack_t pack_native; + +#define major_netbsd(x) ((int32_t)((((x) & 0x000fff00) >> 8))) +#define minor_netbsd(x) ((int32_t)((((x) & 0xfff00000) >> 12) | \ + (((x) & 0x000000ff) >> 0))) +#define makedev_netbsd(x,y) ((dev_t)((((x) << 8) & 0x000fff00) | \ + (((y) << 12) & 0xfff00000) | \ + (((y) << 0) & 0x000000ff))) + +#endif /* _PACK_DEV_H */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 17:08:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E83A069D; Fri, 21 Dec 2012 17:08:17 +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 B3F9E8FC0C; Fri, 21 Dec 2012 17:08:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLH8HgY001682; Fri, 21 Dec 2012 17:08:17 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLH8HFl001681; Fri, 21 Dec 2012 17:08:17 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201212211708.qBLH8HFl001681@svn.freebsd.org> From: Brooks Davis Date: Fri, 21 Dec 2012 17:08:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r244544 - vendor/NetBSD/mknod/20122112 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 17:08:18 -0000 Author: brooks Date: Fri Dec 21 17:08:17 2012 New Revision: 244544 URL: http://svnweb.freebsd.org/changeset/base/244544 Log: Tag 2012-12-21 import of NetBSD's mknod Added: vendor/NetBSD/mknod/20122112/ - copied from r244543, vendor/NetBSD/mknod/dist/ From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 16:58:50 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6018533A; Fri, 21 Dec 2012 16:58:50 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id B85F98FC0A; Fri, 21 Dec 2012 16:58:49 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 79F8FDA6; Fri, 21 Dec 2012 17:56:33 +0100 (CET) Date: Fri, 21 Dec 2012 17:58:42 +0100 From: Pawel Jakub Dawidek To: Mark Johnston Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl Message-ID: <20121221165842.GE1397@garage.freebsd.pl> References: <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> <50D23961.7090803@delphij.net> <20121219225854.GA8399@oddish> <20121219232140.GA40927@lor.one-eyed-alien.net> <20121219235917.GD8399@oddish> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JBi0ZxuS5uaEhkUZ" Content-Disposition: inline In-Reply-To: <20121219235917.GD8399@oddish> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Fri, 21 Dec 2012 17:54:31 +0000 Cc: Ian Lepore , Brooks Davis , d@delphij.net, Jilles Tjoelker , Garrett Cooper , "svn-src-all@freebsd.org" , Alfred Perlstein , "src-committers@freebsd.org" , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 16:58:50 -0000 --JBi0ZxuS5uaEhkUZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 19, 2012 at 06:59:17PM -0500, Mark Johnston wrote: > On Wed, Dec 19, 2012 at 05:21:40PM -0600, Brooks Davis wrote: > > On Wed, Dec 19, 2012 at 05:58:54PM -0500, Mark Johnston wrote: > > > On Wed, Dec 19, 2012 at 02:02:09PM -0800, Xin Li wrote: > > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > Hash: SHA256 > > > >=20 > > > > On 12/19/12 13:12, Garrett Cooper wrote: > > > > > On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper > > > > > wrote: > > > > >=20 > > > > > ... > > > > >=20 > > > > >> find -exec / echo | xargs ? Seems like there's a better way to > > > > >> solve this. > > > > >=20 > > > > > Of course we also might be overengineering the problem (my=20 > > > > > suggestion definitely was overengineered). Why not pass in the=20 > > > > > appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks, > > > >=20 > > > > Irrelevant. Consider this (extreme) situation: someone distributes > > > > several sets of sysctl values tuned for certain situations, like > > > > tcp.conf, supermicro.conf, ... and wants to put them together in a > > > > directory, it's useful to source from the directory without having = to > > > > do a generation of command line on boot, so when something goes wro= ng, > > > > they just remove the pack rather than changing /etc/rc.conf. > > >=20 > > > At work I've changed the -f flag of syslogd and newsyslog to accept a > > > directory which gets non-recursively searched for input files. This w= ay > > > we can have a directory, say /etc/syslog.d, into which package install > > > scripts can easily drop config files. > > >=20 > > > For something like sysctl this might be a bit much, but it's just a > > > thought. The example diff below is what I have in mind. > >=20 > > I don't have a strong opinion about the usefulness of this feature. It > > seems useful particularly in conjunction with supporting multiple -f's. >=20 > I don't really either. Just thought I'd suggest it. >=20 > >=20 > > I do have a few comments on the implementation below. > >=20 >=20 > Thanks! I didn't know about openat(). Here's the regenerated diff. [...] > static int > -parsefile(const char *filename) > +handlefile(const char *filename) > +{ > + DIR *dir; > + struct dirent *de; > + struct stat sb; > + int fd, warncount =3D 0; > + > + fd =3D open(filename, O_RDONLY); > + if (fd < 0) > + err(EX_NOINPUT, "%s", filename); > + if (fstat(fd, &sb)) > + err(EX_NOINPUT, "%s", filename); > + > + if (S_ISREG(sb.st_mode)) { > + return (parsefile(fd)); > + } else if (!S_ISDIR(sb.st_mode)) You don't need { } here. > + errx(EX_USAGE, "invalid input file '%s'", filename); > + > + dir =3D fdopendir(fd); > + if (dir =3D=3D NULL) > + err(EX_NOINPUT, "%s", filename); > + while ((de =3D readdir(dir)) !=3D NULL) { > + if (fnmatch("*.conf", de->d_name, 0) !=3D 0) > + continue; > + fd =3D openat(fd, de->d_name, O_RDONLY); You override 'fd'. After first file read it will stop working. > + if (fd < 0 || fstat(fd, &sb) !=3D 0) { > + warn("%s", de->d_name); If 'fd' is >=3D 0 you should close it. > + continue; > + } else if (!S_ISREG(sb.st_mode)) > + continue; You are leaking it here as well. > + warncount +=3D parsefile(fd); > + close(fd); [...] > - fclose(file); Removing fclose() is wrong. Once you do fdopen(3) you should use fclose(), instead you removed fclose(3) and you close(2) after parsefile() returned. You leak FILE structure this way. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --JBi0ZxuS5uaEhkUZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlDUlUIACgkQForvXbEpPzRZdACfY2Jiga1LFREBbgtlJo7XlhDp t70AnjkOIcY5oj8Wboh40LEzsqZxCLCs =io2b -----END PGP SIGNATURE----- --JBi0ZxuS5uaEhkUZ-- From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 18:25:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC5ED53E; Fri, 21 Dec 2012 18:25:08 +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 8DAB28FC13; Fri, 21 Dec 2012 18:25:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLIP855012701; Fri, 21 Dec 2012 18:25:08 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLIP5Fr012680; Fri, 21 Dec 2012 18:25:05 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201212211825.qBLIP5Fr012680@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 21 Dec 2012 18:25:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244547 - in stable/9/sys: dev/fdc geom geom/bde geom/cache geom/label geom/mountver geom/multipath geom/nop geom/sched vm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 18:25:08 -0000 Author: jh Date: Fri Dec 21 18:25:05 2012 New Revision: 244547 URL: http://svnweb.freebsd.org/changeset/base/244547 Log: MFC r243333: - Don't pass geom and provider names as format strings. - Add __printflike() attributes. - Remove an extra argument for the g_new_geomf() call in swapongeom_ev(). Modified: stable/9/sys/dev/fdc/fdc.c stable/9/sys/geom/bde/g_bde.c stable/9/sys/geom/cache/g_cache.c stable/9/sys/geom/geom.h stable/9/sys/geom/geom_aes.c stable/9/sys/geom/geom_dev.c stable/9/sys/geom/geom_mbr.c stable/9/sys/geom/geom_slice.c stable/9/sys/geom/geom_slice.h stable/9/sys/geom/label/g_label.c stable/9/sys/geom/mountver/g_mountver.c stable/9/sys/geom/multipath/g_multipath.c stable/9/sys/geom/nop/g_nop.c stable/9/sys/geom/sched/g_sched.c stable/9/sys/vm/swap_pager.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/fdc/fdc.c ============================================================================== --- stable/9/sys/dev/fdc/fdc.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/dev/fdc/fdc.c Fri Dec 21 18:25:05 2012 (r244547) @@ -865,7 +865,7 @@ fdc_worker(struct fdc_data *fdc) g_orphan_provider(fd->fd_provider, ENXIO); fd->fd_provider->flags |= G_PF_WITHER; fd->fd_provider = - g_new_providerf(fd->fd_geom, fd->fd_geom->name); + g_new_providerf(fd->fd_geom, "%s", fd->fd_geom->name); g_error_provider(fd->fd_provider, 0); g_topology_unlock(); return (fdc_biodone(fdc, ENXIO)); @@ -2011,7 +2011,7 @@ fd_attach2(void *arg, int flag) fd->fd_geom = g_new_geomf(&g_fd_class, "fd%d", device_get_unit(fd->dev)); - fd->fd_provider = g_new_providerf(fd->fd_geom, fd->fd_geom->name); + fd->fd_provider = g_new_providerf(fd->fd_geom, "%s", fd->fd_geom->name); fd->fd_geom->softc = fd; g_error_provider(fd->fd_provider, 0); } Modified: stable/9/sys/geom/bde/g_bde.c ============================================================================== --- stable/9/sys/geom/bde/g_bde.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/bde/g_bde.c Fri Dec 21 18:25:05 2012 (r244547) @@ -188,7 +188,7 @@ g_bde_create_geom(struct gctl_req *req, /* XXX: error check */ kproc_create(g_bde_worker, gp, &sc->thread, 0, 0, "g_bde %s", gp->name); - pp = g_new_providerf(gp, gp->name); + pp = g_new_providerf(gp, "%s", gp->name); #if 0 /* * XXX: Disable this for now. Appearantly UFS no longer Modified: stable/9/sys/geom/cache/g_cache.c ============================================================================== --- stable/9/sys/geom/cache/g_cache.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/cache/g_cache.c Fri Dec 21 18:25:05 2012 (r244547) @@ -501,7 +501,7 @@ g_cache_create(struct g_class *mp, struc return (NULL); } - gp = g_new_geomf(mp, md->md_name); + gp = g_new_geomf(mp, "%s", md->md_name); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); sc->sc_type = type; sc->sc_bshift = bshift; Modified: stable/9/sys/geom/geom.h ============================================================================== --- stable/9/sys/geom/geom.h Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/geom.h Fri Dec 21 18:25:05 2012 (r244547) @@ -263,8 +263,10 @@ int g_handleattr_int(struct bio *bp, con int g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val); int g_handleattr_str(struct bio *bp, const char *attribute, const char *str); struct g_consumer * g_new_consumer(struct g_geom *gp); -struct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...); -struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...); +struct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...) + __printflike(2, 3); +struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...) + __printflike(2, 3); int g_retaste(struct g_class *mp); void g_spoil(struct g_provider *pp, struct g_consumer *cp); int g_std_access(struct g_provider *pp, int dr, int dw, int de); Modified: stable/9/sys/geom/geom_aes.c ============================================================================== --- stable/9/sys/geom/geom_aes.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/geom_aes.c Fri Dec 21 18:25:05 2012 (r244547) @@ -344,7 +344,7 @@ g_aes_taste(struct g_class *mp, struct g } } g_topology_lock(); - pp = g_new_providerf(gp, gp->name); + pp = g_new_providerf(gp, "%s", gp->name); pp->mediasize = mediasize - sectorsize; pp->sectorsize = sectorsize; g_error_provider(pp, 0); Modified: stable/9/sys/geom/geom_dev.c ============================================================================== --- stable/9/sys/geom/geom_dev.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/geom_dev.c Fri Dec 21 18:25:05 2012 (r244547) @@ -164,7 +164,7 @@ g_dev_taste(struct g_class *mp, struct g LIST_FOREACH(cp, &pp->consumers, consumers) if (cp->geom->class == mp) return (NULL); - gp = g_new_geomf(mp, pp->name); + gp = g_new_geomf(mp, "%s", pp->name); cp = g_new_consumer(gp); error = g_attach(cp, pp); KASSERT(error == 0, Modified: stable/9/sys/geom/geom_mbr.c ============================================================================== --- stable/9/sys/geom/geom_mbr.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/geom_mbr.c Fri Dec 21 18:25:05 2012 (r244547) @@ -483,8 +483,8 @@ g_mbrext_taste(struct g_class *mp, struc ((off_t)dp[0].dp_size) << 9ULL, sectorsize, "%*.*s%d", - strlen(gp->name) - 1, - strlen(gp->name) - 1, + (int)strlen(gp->name) - 1, + (int)strlen(gp->name) - 1, gp->name, slice + 5); g_topology_unlock(); Modified: stable/9/sys/geom/geom_slice.c ============================================================================== --- stable/9/sys/geom/geom_slice.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/geom_slice.c Fri Dec 21 18:25:05 2012 (r244547) @@ -390,7 +390,7 @@ g_slice_config(struct g_geom *gp, u_int sbuf_vprintf(sb, fmt, ap); va_end(ap); sbuf_finish(sb); - pp = g_new_providerf(gp, sbuf_data(sb)); + pp = g_new_providerf(gp, "%s", sbuf_data(sb)); pp2 = LIST_FIRST(&gp->consumer)->provider; pp->flags = pp2->flags & G_PF_CANDELETE; pp->stripesize = pp2->stripesize; Modified: stable/9/sys/geom/geom_slice.h ============================================================================== --- stable/9/sys/geom/geom_slice.h Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/geom_slice.h Fri Dec 21 18:25:05 2012 (r244547) @@ -69,7 +69,7 @@ struct g_slicer { }; g_dumpconf_t g_slice_dumpconf; -int g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...); +int g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...) __printflike(7, 8); void g_slice_spoiled(struct g_consumer *cp); void g_slice_orphan(struct g_consumer *cp); #define G_SLICE_CONFIG_CHECK 0 Modified: stable/9/sys/geom/label/g_label.c ============================================================================== --- stable/9/sys/geom/label/g_label.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/label/g_label.c Fri Dec 21 18:25:05 2012 (r244547) @@ -187,7 +187,7 @@ g_label_create(struct gctl_req *req, str gp->spoiled = g_label_spoiled; g_access(cp, -1, 0, 0); g_slice_config(gp, 0, G_SLICE_CONFIG_SET, (off_t)0, mediasize, - pp->sectorsize, name); + pp->sectorsize, "%s", name); G_LABEL_DEBUG(1, "Label for provider %s is %s.", pp->name, name); return (gp); } Modified: stable/9/sys/geom/mountver/g_mountver.c ============================================================================== --- stable/9/sys/geom/mountver/g_mountver.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/mountver/g_mountver.c Fri Dec 21 18:25:05 2012 (r244547) @@ -249,7 +249,7 @@ g_mountver_create(struct gctl_req *req, return (EEXIST); } } - gp = g_new_geomf(mp, name); + gp = g_new_geomf(mp, "%s", name); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); mtx_init(&sc->sc_mtx, "gmountver", NULL, MTX_DEF); TAILQ_INIT(&sc->sc_queue); @@ -260,7 +260,7 @@ g_mountver_create(struct gctl_req *req, gp->access = g_mountver_access; gp->dumpconf = g_mountver_dumpconf; - newpp = g_new_providerf(gp, gp->name); + newpp = g_new_providerf(gp, "%s", gp->name); newpp->mediasize = pp->mediasize; newpp->sectorsize = pp->sectorsize; Modified: stable/9/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/9/sys/geom/multipath/g_multipath.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/multipath/g_multipath.c Fri Dec 21 18:25:05 2012 (r244547) @@ -429,7 +429,7 @@ g_multipath_create(struct g_class *mp, s } } - gp = g_new_geomf(mp, md->md_name); + gp = g_new_geomf(mp, "%s", md->md_name); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); mtx_init(&sc->sc_mtx, "multipath", NULL, MTX_DEF); memcpy(sc->sc_uuid, md->md_uuid, sizeof (sc->sc_uuid)); Modified: stable/9/sys/geom/nop/g_nop.c ============================================================================== --- stable/9/sys/geom/nop/g_nop.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/nop/g_nop.c Fri Dec 21 18:25:05 2012 (r244547) @@ -189,7 +189,7 @@ g_nop_create(struct gctl_req *req, struc return (EEXIST); } } - gp = g_new_geomf(mp, name); + gp = g_new_geomf(mp, "%s", name); sc = g_malloc(sizeof(*sc), M_WAITOK); sc->sc_offset = offset; sc->sc_error = ioerror; @@ -205,7 +205,7 @@ g_nop_create(struct gctl_req *req, struc gp->access = g_nop_access; gp->dumpconf = g_nop_dumpconf; - newpp = g_new_providerf(gp, gp->name); + newpp = g_new_providerf(gp, "%s", gp->name); newpp->mediasize = size; newpp->sectorsize = secsize; Modified: stable/9/sys/geom/sched/g_sched.c ============================================================================== --- stable/9/sys/geom/sched/g_sched.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/sched/g_sched.c Fri Dec 21 18:25:05 2012 (r244547) @@ -1003,7 +1003,7 @@ g_sched_create(struct gctl_req *req, str } } - gp = g_new_geomf(mp, name); + gp = g_new_geomf(mp, "%s", name); dstgp = proxy ? pp->geom : gp; /* where do we link the provider */ sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); @@ -1029,7 +1029,7 @@ g_sched_create(struct gctl_req *req, str gp->access = g_sched_access; gp->dumpconf = g_sched_dumpconf; - newpp = g_new_providerf(dstgp, gp->name); + newpp = g_new_providerf(dstgp, "%s", gp->name); newpp->mediasize = pp->mediasize; newpp->sectorsize = pp->sectorsize; Modified: stable/9/sys/vm/swap_pager.c ============================================================================== --- stable/9/sys/vm/swap_pager.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/vm/swap_pager.c Fri Dec 21 18:25:05 2012 (r244547) @@ -2612,7 +2612,7 @@ swapongeom_ev(void *arg, int flags) } mtx_unlock(&sw_dev_mtx); if (gp == NULL) - gp = g_new_geomf(&g_swap_class, "swap", NULL); + gp = g_new_geomf(&g_swap_class, "swap"); cp = g_new_consumer(gp); g_attach(cp, pp); /* From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 18:58:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 25A6C1F4; Fri, 21 Dec 2012 18:58:22 +0000 (UTC) (envelope-from dteske@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 083E28FC13; Fri, 21 Dec 2012 18:58:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLIwMpT017179; Fri, 21 Dec 2012 18:58:22 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLIwJCI017163; Fri, 21 Dec 2012 18:58:19 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201212211858.qBLIwJCI017163@svn.freebsd.org> From: Devin Teske Date: Fri, 21 Dec 2012 18:58:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244548 - in head/usr.sbin/bsdconfig: console mouse networking/share share startup startup/share usermgmt/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 18:58:22 -0000 Author: dteske Date: Fri Dec 21 18:58:19 2012 New Revision: 244548 URL: http://svnweb.freebsd.org/changeset/base/244548 Log: Add much-needed dialog(1) --inputbox function for simplifying the process of requesting input from the user. Modified: head/usr.sbin/bsdconfig/console/saver head/usr.sbin/bsdconfig/mouse/flags head/usr.sbin/bsdconfig/networking/share/hostname.subr head/usr.sbin/bsdconfig/networking/share/ipaddr.subr head/usr.sbin/bsdconfig/networking/share/netmask.subr head/usr.sbin/bsdconfig/networking/share/resolv.subr head/usr.sbin/bsdconfig/networking/share/routing.subr head/usr.sbin/bsdconfig/share/dialog.subr head/usr.sbin/bsdconfig/startup/misc head/usr.sbin/bsdconfig/startup/share/rcconf.subr head/usr.sbin/bsdconfig/startup/share/rcedit.subr head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Modified: head/usr.sbin/bsdconfig/console/saver ============================================================================== --- head/usr.sbin/bsdconfig/console/saver Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/console/saver Fri Dec 21 18:58:19 2012 (r244548) @@ -167,33 +167,10 @@ while :; do break ;; "$msg_timeout") # Set the screen saver timeout interval f_dialog_title "$msg_value_required" - title="$DIALOG_TITLE" - btitle="$DIALOG_BACKTITLE" + blanktime=$( f_dialog_input "$msg_enter_timeout_period" \ + "$( f_sysrc_get blanktime )" + ) && f_sysrc_set blanktime "$blanktime" f_dialog_title_restore - prompt="$msg_enter_timeout_period" - blanktime=$( f_sysrc_get blanktime ) - hline="" - size=$( f_dialog_inputbox_size \ - "$title" \ - "$btitle" \ - "$prompt" \ - "$blanktime" \ - "$hline" ) - dialog_inputbox=$( $DIALOG \ - --title "$title" \ - --backtitle "$btitle" \ - --hline "$hline" \ - --ok-label "$msg_ok" \ - --cancel-label "$msg_cancel" \ - --inputbox "$prompt" $size \ - "$blanktime" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - blanktime=$( f_dialog_inputstr ) - [ $retval -eq $SUCCESS ] && - f_sysrc_set blanktime "$blanktime" ;; esac done Modified: head/usr.sbin/bsdconfig/mouse/flags ============================================================================== --- head/usr.sbin/bsdconfig/mouse/flags Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/mouse/flags Fri Dec 21 18:58:19 2012 (r244548) @@ -79,32 +79,10 @@ flags=$( f_sysrc_get moused_flags ) # Prompt the user with the current value # f_dialog_title "$msg_value_required" -title="$DIALOG_TITLE" -btitle="$DIALOG_BACKTITLE" +flags=$( f_dialog_input "$msg_please_specify_the_mouse_daemon_flags" \ + "$flags" + ) || f_die f_dialog_title_restore -hline= -prompt="$msg_please_specify_the_mouse_daemon_flags" -size=$( f_dialog_inputbox_size \ - "$title" \ - "$btitle" \ - "$prompt" \ - "$flags" \ - "$hline" ) -dialog_inputbox=$( eval $DIALOG \ - --title \"\$title\" \ - --backtitle \"\$btitle\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$prompt\" $size \ - \"\$flags\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD -) -retval=$? -setvar MENU_INPUTBOX_$$ "$dialog_inputbox" -flags=$( f_dialog_inputstr ) - -[ $retval -eq $SUCCESS ] || f_die # # Save the new value Modified: head/usr.sbin/bsdconfig/networking/share/hostname.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/hostname.subr Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/networking/share/hostname.subr Fri Dec 21 18:58:19 2012 (r244548) @@ -132,41 +132,15 @@ f_dialog_input_hostname() msg="$msg_please_enter_fqhn" fi - local hline="$hline_alnum_punc_tab_enter" - # # Loop until the user provides taint-free input. # - local size height width while :; do - - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$hostname" \ - "$hline" ) - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$hostname\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - local retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - hostname=$( f_dialog_inputstr ) - - [ $retval -eq $SUCCESS ] || return $retval - + hostname=$( f_dialog_input "$msg" "$hostname" \ + "$hline_alnum_punc_tab_enter" + ) || return # Taint-check the user's input f_dialog_validate_hostname "$hostname" && break - done # Modified: head/usr.sbin/bsdconfig/networking/share/ipaddr.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Fri Dec 21 18:58:19 2012 (r244548) @@ -360,41 +360,21 @@ f_dialog_input_ipaddr() fi local msg="$( printf "$msg_please_enter_new_ip_addr" "$interface" )" - local hline="$hline_num_punc_tab_enter" - local size="$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_ipaddr" \ - "$hline" )" # # Loop until the user provides taint-free input. # + local retval while :; do - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_ipaddr\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - local retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) - # # Return error status if: - # - User has not made any changes to the given value # - User has either pressed ESC or chosen Cancel/No + # - User has not made any changes to the given value # + _input=$( f_dialog_input "$msg" "$_ipaddr" \ + "$hline_num_punc_tab_enter" + ) || return [ "$_ipaddr" = "$_input" ] && return $FAILURE - [ $retval -eq $SUCCESS ] || return $retval # Return success if NULL value was entered [ "$_input" ] || return $SUCCESS Modified: head/usr.sbin/bsdconfig/networking/share/netmask.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/netmask.subr Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/networking/share/netmask.subr Fri Dec 21 18:58:19 2012 (r244548) @@ -164,42 +164,20 @@ f_dialog_input_netmask() return $FAILURE fi - local msg="$( printf "$msg_please_enter_subnet_mask" "$interface" )" - local hline="$hline_num_punc_tab_enter" - local size="$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_netmask" \ - "$hline" )" - # # Loop until the user provides taint-free input. # + local msg="$( printf "$msg_please_enter_subnet_mask" "$interface" )" while :; do - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_netmask\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - local retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) - # # Return error status if: - # - User has not made any changes to the given value # - User has either pressed ESC or chosen Cancel/No + # - User has not made any changes to the given value # + _input=$( f_dialog_input "$msg" "$_netmask" \ + "$hline_num_punc_tab_enter" + ) || return [ "$_netmask" = "$_input" ] && return $FAILURE - [ $retval -eq $SUCCESS ] || return $retval # Return success if NULL value was entered [ "$_input" ] || return $SUCCESS Modified: head/usr.sbin/bsdconfig/networking/share/resolv.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/resolv.subr Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/networking/share/resolv.subr Fri Dec 21 18:58:19 2012 (r244548) @@ -329,36 +329,13 @@ f_dialog_input_nameserver() msg="$msg_please_enter_nameserver" fi - local hline="$hline_num_punc_tab_enter" - local size="$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$ns" \ - "$hline" )" - # # Loop until the user provides taint-free input. # while :; do - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$ns\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - local retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - new_ns=$( f_dialog_inputstr ) - - [ $retval -eq $SUCCESS ] || return $retval + new_ns=$( f_dialog_input "$msg" "$ns" \ + "$hline_num_punc_tab_enter" + ) || return # Take only the first "word" of the user's input new_ns="${new_ns%%[$IFS]*}" @@ -369,7 +346,6 @@ f_dialog_input_nameserver() # Update prompt to allow user to re-edit previous entry ns="$new_ns" - done # Modified: head/usr.sbin/bsdconfig/networking/share/routing.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/routing.subr Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/networking/share/routing.subr Fri Dec 21 18:58:19 2012 (r244548) @@ -97,35 +97,16 @@ f_dialog_input_defaultrouter() return $FAILURE fi - local msg="$msg_please_enter_default_router" - local hline="$hline_num_punc_tab_enter" - local size="$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$defaultrouter" \ - "$hline" )" - # # Loop until the user provides taint-free input. # + local retval while :; do - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$defaultrouter\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + defaultrouter=$( f_dialog_input \ + "$msg_please_enter_default_router" \ + "$defaultrouter" "$hline_num_punc_tab_enter" ) - - local retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - defaultrouter=$( f_dialog_inputstr ) - + retval=$? [ "$defaultrouter" ] || return $SUCCESS [ $retval -eq $SUCCESS ] || return $retval Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/share/dialog.subr Fri Dec 21 18:58:19 2012 (r244548) @@ -1115,7 +1115,7 @@ f_dialog_noyes() # f_dialog_inputstr # # Obtain the inputstr entered by the user from the most recently displayed -# dialog(1) inputbox and clean up any temporary files. +# dialog(1) inputbox and clean up any temporary files/variables. # f_dialog_inputstr() { @@ -1138,12 +1138,58 @@ f_dialog_inputstr() return $SUCCESS } +# f_dialog_input $prompt [$init [$hline]] +# +# Prompt the user with a dialog(1) inputbox to enter some value. The inputbox +# remains until the the user presses ENTER or ESC, or otherwise ends the +# editing session, by selecting `Cancel' for example. +# +# If the user presses ENTER, the exit status is zero (success), otherwise if +# the user presses ESC the exit status is 255, or if the user chose Cancel, the +# exit status is instead 1. +# +# NOTE: The hline should correspond to the type of data you want from the user. +# NOTE: Should not be used to edit multiline values. +# +f_dialog_input() +{ + local prompt="$1" init="$2" hline="$3" + local size="$( f_dialog_inputbox_size \ + "$DIALOG_TITLE" \ + "$DIALOG_BACKTITLE" \ + "$prompt" \ + "$init" \ + "$hline" )" + + local opterm="--" + [ "$USE_XDIALOG" ] && opterm= + + local dialog_input + dialog_input=$( + eval $DIALOG \ + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --inputbox \"\$prompt\" $size \ + $opterm \"\$init\" \ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) + local retval=$? + + setvar DIALOG_INPUTBOX_$$ "$dialog_input" + f_dialog_inputstr + + return $retval +} + ############################################################ MENU FUNCTIONS # f_dialog_menutag # # Obtain the menutag chosen by the user from the most recently displayed -# dialog(1) menu and clean up any temporary files. +# dialog(1) menu and clean up any temporary files/variables. # f_dialog_menutag() { Modified: head/usr.sbin/bsdconfig/startup/misc ============================================================================== --- head/usr.sbin/bsdconfig/startup/misc Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/startup/misc Fri Dec 21 18:58:19 2012 (r244548) @@ -253,34 +253,11 @@ dialog_menu_main() # dialog_input_value() { - local hline="$hline_alnum_tab_enter" - local size prompt="$1" _input="$2" + local prompt="$1" _input="$2" f_dialog_title "$msg_value_required" - - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$prompt" \ - "$_input" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$prompt\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) - + _input=$( f_dialog_input "$prompt" "$_input" "$hline_alnum_tab_enter" ) + local retval=$? f_dialog_title_restore # Return if user has either pressed ESC or chosen Cancel/No Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcconf.subr Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr Fri Dec 21 18:58:19 2012 (r244548) @@ -418,39 +418,16 @@ f_dialog_input_rclist() # f_dialog_input_rcvar() { - local msg="$msg_please_enter_rcvar_name" - local hline="$hline_alnum_tab_enter" - # # Loop until the user provides taint-free/valid input # - local size _input="$1" + local _input="$1" while :; do - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) # Return if user either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval + _input=$( f_dialog_input "$msg_please_enter_rcvar_name" \ + "$_input" "$hline_alnum_tab_enter" + ) || return # Check for invalid entry (1of2) if ! echo "$_input" | grep -q "^[[:alpha:]_]"; then Modified: head/usr.sbin/bsdconfig/startup/share/rcedit.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcedit.subr Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/startup/share/rcedit.subr Fri Dec 21 18:58:19 2012 (r244548) @@ -53,8 +53,7 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/inc # f_dialog_rcedit() { - local msg size retval var="$1" _input - local hline="$hline_alnum_punc_tab_enter" + local msg var="$1" _input msg=$( printf "$msg_please_enter_a_new_value" \ "$var" "$( f_sysrc_get_default "$var" )" ) @@ -67,34 +66,10 @@ f_dialog_rcedit() _input=$( f_sysrc_get "$var" ) fi - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - - local opterm="--" - [ "$USE_XDIALOG" ] && opterm= - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - $opterm \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) - # Return if user has either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval + _input=$( f_dialog_input "$msg" "$_input" \ + "$hline_alnum_punc_tab_enter" + ) || return # Return if the value has not changed from current local cur_val="$( f_sysrc_get "$var" )" Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Fri Dec 21 18:58:19 2012 (r244548) @@ -111,39 +111,16 @@ f_dialog_menu_group_list() # f_dialog_input_group_name() { - local msg="$( printf "$msg_group" )" - local hline="$hline_alnum_tab_enter" - # # Loop until the user provides taint-free/valid input # - local size retval _name="$1" _input="$1" + local _name="$1" _input="$1" while :; do - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval + _input=$( f_dialog_input "$msg_group" "$_input" \ + "$hline_alnum_tab_enter" + ) || return # Check for no-change [ "$_input" = "$_name" ] && return $SUCCESS @@ -283,35 +260,12 @@ f_dialog_input_group_password() # f_dialog_input_group_gid() { - local msg size retval _input="$1" - local hline="$hline_num_tab_enter" - - msg=$( printf "$msg_group_id_leave_empty_for_default" ) - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) + local _input="$1" # Return if user has either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval + _input=$( f_dialog_input "$msg_group_id_leave_empty_for_default" \ + "$_input" "$hline_num_tab_enter" + ) || return group_gid="$_input" save_flag=1 @@ -416,36 +370,13 @@ f_dialog_input_group_members() _input="$_group_members" ;; 2) # Enter Group Members manually - hline="$hline_num_tab_enter" - msg=$( - printf "$msg_group_members ($msg_separated_by_commas)" - ) - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _group_members=$( f_dialog_inputstr ) + msg="$msg_group_members ($msg_separated_by_commas)" # Return to previous menu if user has either # pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || continue + _group_members=$( f_dialog_input "$msg" "$_input" \ + "$hline_num_tab_enter" + ) || continue _input="$_group_members" ;; Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Fri Dec 21 18:25:05 2012 (r244547) +++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Fri Dec 21 18:58:19 2012 (r244548) @@ -216,39 +216,16 @@ f_dialog_input_member_groups() # f_dialog_input_name() { - local msg="$( printf "$msg_login" )" - local hline="$hline_alnum_tab_enter" - # # Loop until the user provides taint-free/valid input # - local size retval _name="$1" _input="$1" + local _name="$1" _input="$1" while :; do - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) # Return if user has either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval + _input=$( f_dialog_input "$msg_login" "$_input" \ + "$hline_alnum_tab_enter" + ) || return # Check for no-change [ "$_input" = "$_name" ] && return $SUCCESS @@ -389,35 +366,12 @@ f_dialog_input_password() # f_dialog_input_gecos() { - local msg size retval _input="$1" - local hline="$hline_alnum_punc_tab_enter" - - msg=$( printf "$msg_full_name" ) - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) + local _input="$1" # Return if user has either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval + _input=$( f_dialog_input "$msg_full_name" "$_input" \ + "$hline_alnum_punc_tab_enter" + ) || return pw_gecos="$_input" save_flag=1 @@ -435,35 +389,12 @@ f_dialog_input_gecos() # f_dialog_input_uid() { - local msg size retval _input="$1" - local hline="$hline_num_tab_enter" - - msg=$( printf "$msg_user_id_leave_empty_for_default" ) - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) + local _input="$1" # Return if user has either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval + _input=$( f_dialog_input "$msg_user_id_leave_empty_for_default" \ + "$_input" "$hline_num_tab_enter" + ) || return pw_uid="$_input" save_flag=1 @@ -481,35 +412,12 @@ f_dialog_input_uid() # f_dialog_input_gid() { - local msg size retval _input="$1" - local hline="$hline_num_tab_enter" - - msg=$( printf "$msg_group_id_leave_empty_for_default" ) - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) + local _input="$1" # Return if user has either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval + _input=$( f_dialog_input "$msg_group_id_leave_empty_for_default" \ + "$_input" "$hline_num_tab_enter" + ) || return pw_gid="$_input" save_flag=1 @@ -527,35 +435,12 @@ f_dialog_input_gid() # f_dialog_input_class() { - local msg size retval _input="$1" - local hline="$hline_alnum_tab_enter" - - msg=$( printf "$msg_login_class" ) - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _input=$( f_dialog_inputstr ) + local _input="$1" # Return if user has either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval + _input=$( f_dialog_input "$msg_login_class" "$_input" \ + "$hline_alnum_tab_enter" + ) || return pw_class="$_input" save_flag=1 @@ -695,31 +580,11 @@ f_dialog_input_change() f_isinteger "$ret_days" && ret_days=$(( $ret_days + 1 )) - msg="$msg_password_expires_in_how_many_days" - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$ret_days" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$ret_days\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - ret_days=$( f_dialog_inputstr ) - # Return to menu if either ESC or Cancel/No - [ $retval -eq $SUCCESS ] || continue + ret_days=$( f_dialog_input \ + "$msg_password_expires_in_how_many_days" \ + "$ret_days" "$hline" + ) || continue # Taint-check the user's input if ! f_isinteger "$ret_days"; then @@ -741,30 +606,10 @@ f_dialog_input_change() msg=$( printf "$msg_number_of_seconds_since_epoch" \ "$( date -r 1 "+%c %Z" )" ) - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - ret_secs=$( f_dialog_inputstr ) # Return to menu if either ESC or Cancel/No - [ $retval -eq $SUCCESS ] || continue + ret_secs=$( f_dialog_input \ + "$msg" "$_input" "$hline" ) || continue _input="$ret_secs" @@ -919,31 +764,11 @@ f_dialog_input_expire() f_isinteger "$ret_days" && ret_days=$(( $ret_days + 1 )) - msg="$msg_account_expires_in_how_many_days" - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$ret_days" \ - "$hline" ) - - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$ret_days\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - ret_days=$( f_dialog_inputstr ) - # Return to menu if either ESC or Cancel/No - [ $retval -eq $SUCCESS ] || continue + ret_days=$( f_dialog_input \ + "$msg_account_expires_in_how_many_days" \ + "$ret_days" "$hline" + ) || continue # Taint-check the user's input if ! f_isinteger "$ret_days"; then @@ -965,30 +790,10 @@ f_dialog_input_expire() msg=$( printf "$msg_number_of_seconds_since_epoch" \ "$( date -r 1 "+%c %Z" )" ) - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$_input" \ - "$hline" ) - local dialog_inputbox - dialog_inputbox=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --inputbox \"\$msg\" $size \ - \"\$_input\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - ret_secs=$( f_dialog_inputstr ) # Return to menu if either ESC or Cancel/No - [ $retval -eq $SUCCESS ] || continue + ret_secs=$( f_dialog_input \ + "$msg" "$_input" "$hline" ) || continue _input="$ret_secs" @@ -1022,35 +827,12 @@ f_dialog_input_expire() # f_dialog_input_home_dir() { - local msg size retval _input="$1" - local hline="$hline_alnum_punc_tab_enter" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 19:13:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0BE057B6; Fri, 21 Dec 2012 19:13:49 +0000 (UTC) (envelope-from jimharris@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 E3D378FC0A; Fri, 21 Dec 2012 19:13:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLJDmP6019839; Fri, 21 Dec 2012 19:13:48 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLJDmpm019837; Fri, 21 Dec 2012 19:13:48 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201212211913.qBLJDmpm019837@svn.freebsd.org> From: Jim Harris Date: Fri, 21 Dec 2012 19:13:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244549 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 19:13:49 -0000 Author: jimharris Date: Fri Dec 21 19:13:48 2012 New Revision: 244549 URL: http://svnweb.freebsd.org/changeset/base/244549 Log: Put kthreads under curproc so they are attached to nvmecontrol rather than pid 0. Sponsored by: Intel Modified: head/sys/dev/nvme/nvme_test.c Modified: head/sys/dev/nvme/nvme_test.c ============================================================================== --- head/sys/dev/nvme/nvme_test.c Fri Dec 21 18:58:19 2012 (r244548) +++ head/sys/dev/nvme/nvme_test.c Fri Dec 21 19:13:48 2012 (r244549) @@ -287,10 +287,10 @@ nvme_ns_test(struct nvme_namespace *ns, for (i = 0; i < io_test->num_threads; i++) #if __FreeBSD_version >= 800004 kthread_add(fn, io_test_internal, - NULL, NULL, 0, 0, "nvme_io_test[%d]", i); + curproc, NULL, 0, 0, "nvme_io_test[%d]", i); #else kthread_create(fn, io_test_internal, - NULL, 0, 0, "nvme_io_test[%d]", i); + curproc, 0, 0, "nvme_io_test[%d]", i); #endif tsleep(io_test_internal, 0, "nvme_test", io_test->time * 2 * hz); From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 19:26:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0BFBFA10; Fri, 21 Dec 2012 19:26:21 +0000 (UTC) (envelope-from dteske@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 E359D8FC0C; Fri, 21 Dec 2012 19:26:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLJQKTb021781; Fri, 21 Dec 2012 19:26:20 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLJQIQp021758; Fri, 21 Dec 2012 19:26:18 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201212211926.qBLJQIQp021758@svn.freebsd.org> From: Devin Teske Date: Fri, 21 Dec 2012 19:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244550 - in head/usr.sbin/bsdconfig: . examples share startup/share usermgmt usermgmt/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 19:26:21 -0000 Author: dteske Date: Fri Dec 21 19:26:17 2012 New Revision: 244550 URL: http://svnweb.freebsd.org/changeset/base/244550 Log: Improve the debugging abilities and clean up debug messages. In most cases, all one has to do is set the environment variable DEBUGGING to get the debug messages to appear on the console. Modified: head/usr.sbin/bsdconfig/bsdconfig head/usr.sbin/bsdconfig/examples/bsdconfigrc head/usr.sbin/bsdconfig/share/common.subr head/usr.sbin/bsdconfig/share/dialog.subr head/usr.sbin/bsdconfig/startup/share/rcconf.subr head/usr.sbin/bsdconfig/startup/share/rcedit.subr head/usr.sbin/bsdconfig/usermgmt/groupdel head/usr.sbin/bsdconfig/usermgmt/groupedit head/usr.sbin/bsdconfig/usermgmt/groupinput head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr head/usr.sbin/bsdconfig/usermgmt/userdel head/usr.sbin/bsdconfig/usermgmt/useredit head/usr.sbin/bsdconfig/usermgmt/userinput head/usr.sbin/bsdconfig/usermgmt/usermgmt Modified: head/usr.sbin/bsdconfig/bsdconfig ============================================================================== --- head/usr.sbin/bsdconfig/bsdconfig Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/bsdconfig Fri Dec 21 19:26:17 2012 (r244550) @@ -70,7 +70,7 @@ usage() # local longest_cmd longest_cmd=$( echo "$cmd_list" | f_longest_line_length ) - f_dprintf "longest_cmd=[$longest_cmd]" + f_dprintf "longest_cmd=[%s]" "$longest_cmd" # # Determine the maximum width of terminal/console @@ -79,7 +79,7 @@ usage() max_size=$( stty size 2> /dev/null ) : ${max_size:="24 80"} max_width="${max_size#*[$IFS]}" - f_dprintf "max_width=[$max_width]" + f_dprintf "max_width=[%s]" "$max_width" # # Using the longest command-length as the width of a single column, @@ -92,7 +92,7 @@ usage() ncols=$(( $ncols + 1 )) x=$(( $x + 3 + $longest_cmd )) done - f_dprintf "ncols=[$ncols] x=[$x]" + f_dprintf "ncols=[%u] x=[%u]" $ncols $x # # Re-format the command-list into multiple columns @@ -117,7 +117,8 @@ usage() { n++ cur_col = (( n - 1 ) % ncols ) + 1 - printf "f_dprintf \"row_item[%u]=[%s]\"\n", cur_col, $0 + printf "f_dprintf \"row_item[%u]=[%%s]\" \"%s\"\n", + cur_col, $0 row_item[cur_col] = $0 if ( cur_col == ncols ) print_row() } @@ -238,7 +239,8 @@ f_dialog_title "$msg_main_menu" export UNAME_S="$(uname -s)" # Operating System (i.e. FreeBSD) export UNAME_P="$(uname -p)" # Processor Architecture (i.e. i386) export UNAME_R="$(uname -r)" # Release Level (i.e. X.Y-RELEASE) -f_dprintf "UNAME_S=[$UNAME_S] UNAME_P=[$UNAME_P] UNAME_R=[$UNAME_R]" +f_dprintf "UNAME_S=[%s] UNAME_P=[%s] UNAME_R=[%s]" \ + "$UNAME_S" "$UNAME_P" "$UNAME_R" cd $BSDCFG_LIBE || f_die 1 "$msg_directory_not_found" "$BSDCFG_LIBE" @@ -276,7 +278,7 @@ while :; do dialog_menu_main retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" if [ $retval -eq 2 ]; then # The Help button was pressed @@ -298,7 +300,7 @@ while :; do *) # Dynamically loaded menuitem cmd=$( eval echo \"\$menu_program$mtag\" ) - f_dprintf "cmd=[$cmd]" + f_dprintf "cmd=[%s]" "$cmd" $cmd ${USE_XDIALOG:+-X} ;; Modified: head/usr.sbin/bsdconfig/examples/bsdconfigrc ============================================================================== --- head/usr.sbin/bsdconfig/examples/bsdconfigrc Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/examples/bsdconfigrc Fri Dec 21 19:26:17 2012 (r244550) @@ -31,5 +31,6 @@ # debugging aid for development # f_dprintf() { -# echo "$(date):$pgm: $1" >> $HOME/out +# local format="$1"; shift +# printf "$(date):$pgm:$format\n" "$@" >> $HOME/out # } Modified: head/usr.sbin/bsdconfig/share/common.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/common.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/share/common.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -27,6 +27,15 @@ if [ ! "$_COMMON_SUBR" ]; then _COMMON_S # # $FreeBSD$ # +############################################################ CONFIGURATION + +# +# Default file descriptors to link to stdout/stderr for passthru allowing +# redirection within a sub-shell to bypass directly to the terminal. +# +: ${TERMINAL_STDOUT_PASSTHRU:=3}} +: ${TERMINAL_STDERR_PASSTHRU:=4}} + ############################################################ GLOBALS # @@ -56,6 +65,14 @@ f_dprintf() { : this page intentionally left blank } +[ "$DEBUGGING" ] && f_dprintf() +{ + local fmt="$1" + shift + printf "$fmt${fmt:+\n}" "$@" \ + >&${TERMINAL_STDOUT_PASSTHRU:-1} +} && + export DEBUGGING # f_err $fmt [ $opts ... ] # @@ -63,7 +80,7 @@ f_dprintf() # f_err() { - printf "$@" >&2 + printf "$@" >&${TERMINAL_STDERR_PASSTHRU:-2} } # f_quietly $command [ $arguments ... ] @@ -181,6 +198,7 @@ f_show_help() f_include() { local file="$1" + f_dprintf "f_include: file=[%s]" "$file" . "$file" || exit $? } @@ -202,7 +220,7 @@ f_include_lang() local file="$1" local lang="${LANG:-$LC_ALL}" - f_dprintf "lang=[$lang]" + f_dprintf "f_include_lang: file=[%s] lang=[%s]" "$file" "$lang" if [ -f "$file.$lang" ]; then . "$file.$lang" || exit $? else @@ -247,7 +265,7 @@ f_usage() local file="$1" local lang="${LANG:-$LC_ALL}" - f_dprintf "lang=[$lang]" + f_dprintf "f_usage: file=[%s] lang=[%s]" "$file" "$lang" shift 1 # file @@ -300,7 +318,7 @@ f_index_file() local keyword="$1" local lang="${LANG:-$LC_ALL}" - f_dprintf "lang=[$lang]" + f_dprintf "f_index_file: keyword=[%s] lang=[%s]" "$keyword" "$lang" if [ "$lang" ]; then awk -v keyword="$keyword" "$f_index_file_awk" \ @@ -362,7 +380,8 @@ f_index_menusel_keyword() local indexfile="$1" pgm="$2" local lang="${LANG:-$LC_ALL}" - f_dprintf "lang=[$lang]" + f_dprintf "f_index_menusel_keyword: index=[%s] pgm=[%s] lang=[%s]" \ + "$indexfile" "$pgm" "$lang" if [ -f "$indexfile.$lang" ]; then awk -v pgm="$pgm" \ @@ -424,7 +443,8 @@ f_index_menusel_command() local indexfile="$1" keyword="$2" command local lang="${LANG:-$LC_ALL}" - f_dprintf "lang=[$lang]" + f_dprintf "f_index_menusel_command: index=[%s] key=[%s] lang=[%s]" \ + "$indexfile" "$keyword" "$lang" if [ -f "$indexfile.$lang" ]; then command=$( awk -v key="$keyword" \ @@ -463,4 +483,10 @@ trap 'f_die' SIGTERM SIGPIPE SIGXCPU SIG SIGFPE SIGTRAP SIGABRT SIGSEGV trap '' SIGALRM SIGPROF SIGUSR1 SIGUSR2 SIGHUP SIGVTALRM +# +# Clone terminal stdout/stderr so we can redirect to it from within sub-shells +# +eval exec $TERMINAL_STDOUT_PASSTHRU\>\&1 +eval exec $TERMINAL_STDERR_PASSTHRU\>\&2 + fi # ! $_COMMON_SUBR Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/share/dialog.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -42,7 +42,7 @@ f_include_lang $BSDCFG_LIBE/include/mess # execution of dialog from within a sub-shell (so-long as its standard output # is explicitly redirected to this file descriptor). # -: ${DIALOG_TERMINAL_PASSTHRU_FD:=3} +: ${DIALOG_TERMINAL_PASSTHRU_FD:=${TERMINAL_STDOUT_PASSTHRU:-3}} ############################################################ GLOBALS Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcconf.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -446,7 +446,7 @@ f_dialog_input_rcvar() break done - f_dprintf "f_dialog_input_rcvar: rcvar->[$rcvar]" + f_dprintf "f_dialog_input_rcvar: rcvar->[%s]" "$rcvar" return $SUCCESS } Modified: head/usr.sbin/bsdconfig/startup/share/rcedit.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcedit.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/startup/share/rcedit.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -75,7 +75,7 @@ f_dialog_rcedit() local cur_val="$( f_sysrc_get "$var" )" [ "$_input" = "$cur_val" ] && return $SUCCESS - f_dprintf "$var: [$cur_val]->[$_input]" + f_dprintf "%s: [%s]->[%s]" "$var" "$cur_val" "$_input" err=$( f_sysrc_set "$var" "$_input" 2>&1 ) || f_show_msg "$err" Modified: head/usr.sbin/bsdconfig/usermgmt/groupdel ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/groupdel Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/groupdel Fri Dec 21 19:26:17 2012 (r244550) @@ -71,7 +71,7 @@ while :; do f_dialog_menu_group_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" [ $retval -eq 0 ] || f_die Modified: head/usr.sbin/bsdconfig/usermgmt/groupedit ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/groupedit Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/groupedit Fri Dec 21 19:26:17 2012 (r244550) @@ -71,7 +71,7 @@ while :; do f_dialog_menu_group_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%s mtag=[%s]" $retval "$mtag" [ $retval -eq 0 ] || f_die Modified: head/usr.sbin/bsdconfig/usermgmt/groupinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/groupinput Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/groupinput Fri Dec 21 19:26:17 2012 (r244550) @@ -77,7 +77,7 @@ save_changes() elif [ "$group_password" ]; then cmd="echo \"\$group_password\" | $cmd -h 0" fi - f_dprintf "cmd=$cmd" + f_dprintf "cmd=%s" "$cmd" err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then @@ -96,7 +96,7 @@ save_changes() elif [ "$group_password" ]; then cmd="echo \"\$group_password\" | $cmd -h 0" fi - f_dprintf "cmd=$cmd" + f_dprintf "cmd=%s" "$cmd" err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then @@ -136,14 +136,14 @@ dialog_title_update() while [ $# -gt 0 ]; do key="${1%%=*}" value="${1#*=}" - f_dprintf "key=[$key] value=[$value]" + f_dprintf "key=[%s] value=[%s]" "$key" "$value" case "$key" in mode) mode="$value";; group) group="$value";; esac shift done -f_dprintf "mode=[$mode] group=[$group]" +f_dprintf "mode=[%s] group=[%s]" "$mode" "$group" # # Initialize @@ -242,7 +242,7 @@ while :; do retval=$? setvar DIALOG_MENU_$$ "$dialog_menu" mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" # Exit if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || f_die @@ -261,7 +261,7 @@ while :; do f_dialog_menu_group_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" # Loop if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || continue Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -154,7 +154,7 @@ f_dialog_input_group_name() done save_flag=1 - f_dprintf "group_name: [$cur_group_name]->[$group_name]" + f_dprintf "group_name: [%s]->[%s]" "$cur_group_name" "$group_name" return $SUCCESS } @@ -247,7 +247,8 @@ f_dialog_input_group_password() done save_flag=1 - f_dprintf "group_password: [$cur_group_password]->[$group_password]" + f_dprintf "group_password: [%s]->[%s]" \ + "$cur_group_password" "$group_password" return $SUCCESS } @@ -270,7 +271,7 @@ f_dialog_input_group_gid() group_gid="$_input" save_flag=1 - f_dprintf "group_gid: [$cur_group_gid]->[$group_gid]" + f_dprintf "group_gid: [%s]->[%s]" "$cur_group_gid" "$group_gid" return $SUCCESS } @@ -319,7 +320,7 @@ f_dialog_input_group_members() retval=$? setvar DIALOG_MENU_$$ "$dialog_menu" menu_choice=$( f_dialog_menutag ) - f_dprintf "retval=$retval menu_choice=[$menu_choice]" + f_dprintf "retval=%u menu_choice=[%s]" $retval "$menu_choice" # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval @@ -385,7 +386,8 @@ f_dialog_input_group_members() group_members="$_input" save_flag=1 - f_dprintf "group_members: [$cur_group_members]->[$group_members]" + f_dprintf "group_members: [%s]->[%s]" \ + "$cur_group_members" "$group_members" return $SUCCESS } Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -198,8 +198,8 @@ f_dialog_input_member_groups() done save_flag=1 - local debug="pw_member_groups:" - f_dprintf "$debug [$cur_pw_member_groups]->[$pw_member_groups]" + f_dprintf "pw_member_groups: [%s]->[%s]" \ + "$cur_pw_member_groups" "$pw_member_groups" return $SUCCESS } @@ -259,7 +259,7 @@ f_dialog_input_name() done save_flag=1 - f_dprintf "pw_name: [$cur_pw_name]->[$pw_name]" + f_dprintf "pw_name: [%s]->[%s]" "$cur_pw_name" "$pw_name" return $SUCCESS } @@ -352,7 +352,7 @@ f_dialog_input_password() done save_flag=1 - f_dprintf "pw_password: [$cur_pw_password]->[$pw_password]" + f_dprintf "pw_password: [%s]->[%s]" "$cur_pw_password" "$pw_password" return $SUCCESS } @@ -376,7 +376,7 @@ f_dialog_input_gecos() pw_gecos="$_input" save_flag=1 - f_dprintf "pw_gecos: [$cur_pw_gecos]->[$pw_gecos]" + f_dprintf "pw_gecos: [%s]->[%s]" "$cur_pw_gecos" "$pw_gecos" return $SUCCESS } @@ -399,7 +399,7 @@ f_dialog_input_uid() pw_uid="$_input" save_flag=1 - f_dprintf "pw_uid: [$cur_pw_uid]->[$pw_uid]" + f_dprintf "pw_uid: [%s]->[%s]" "$cur_pw_uid" "$pw_uid" return $SUCCESS } @@ -422,7 +422,7 @@ f_dialog_input_gid() pw_gid="$_input" save_flag=1 - f_dprintf "pw_gid: [$cur_pw_gid]->[$pw_gid]" + f_dprintf "pw_gid: [%s]->[%s]" "$cur_pw_gid" "$pw_gid" return $SUCCESS } @@ -445,7 +445,7 @@ f_dialog_input_class() pw_class="$_input" save_flag=1 - f_dprintf "pw_class: [$cur_pw_class]->[$pw_class]" + f_dprintf "pw_class: [%s]->[%s]" "$cur_pw_class" "$pw_class" return $SUCCESS } @@ -496,7 +496,7 @@ f_dialog_input_change() retval=$? setvar DIALOG_MENU_$$ "$dialog_menu" date_type=$( f_dialog_menutag ) - f_dprintf "retval=$retval date_type=[$date_type]" + f_dprintf "retval=%u date_type=[%s]" $retval "$date_type" # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval @@ -532,7 +532,7 @@ f_dialog_input_change() retval=$? setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_date=$( f_dialog_inputstr ) - f_dprintf "retval=$retval ret_date=[$ret_date]" + f_dprintf "retval=%u ret_date=[%s]" $retval "$ret_date" # Return to menu if either ESC or Cancel/No [ $retval -eq $SUCCESS ] || continue @@ -559,7 +559,7 @@ f_dialog_input_change() retval=$? setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_time=$( f_dialog_inputstr ) - f_dprintf "retval=$retval ret_time=[$ret_time]" + f_dprintf "retval=%u ret_time=[%s]" $retval "$ret_time" # Return to menu if either ESC or Cancel/No [ $retval -eq $SUCCESS ] || continue @@ -568,7 +568,7 @@ f_dialog_input_change() -j -f "%d/%m/%Y %T" \ -- "$ret_date $ret_time" \ +%s 2> /dev/null ) - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; 3) # Enter number of days into the future @@ -592,13 +592,13 @@ f_dialog_input_change() continue fi - f_dprintf "ret_days=[$ret_days]" + f_dprintf "ret_days=[%s]" "$ret_days" case "$ret_days" in [-+]*) _input=$( date -v${ret_days}d +%s );; 0) _input=$( date +%s );; *) _input=$( date -v+${ret_days}d +%s );; esac - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; 4) # Enter value manually @@ -619,7 +619,7 @@ f_dialog_input_change() continue fi - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; esac @@ -629,8 +629,8 @@ f_dialog_input_change() pw_password_expire="$_input" save_flag=1 - local debug=pw_password_expire - f_dprintf "$debug: [$cur_pw_password_expire]->[$pw_password_expire]" + f_dprintf "pw_password_expire: [%s]->[%s]" \ + "$cur_pw_password_expire" "$pw_password_expire" return $SUCCESS } @@ -681,7 +681,7 @@ f_dialog_input_expire() retval=$? setvar DIALOG_MENU_$$ "$dialog_menu" date_type=$( f_dialog_menutag ) - f_dprintf "retval=$retval date_type=[$date_type]" + f_dprintf "retval=%u date_type=[%s]" $retval "$date_type" # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval @@ -717,7 +717,7 @@ f_dialog_input_expire() retval=$? setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_date=$( f_dialog_inputstr ) - f_dprintf "retval=$retval ret_date=[$ret_date]" + f_dprintf "retval=%u ret_date=[%s]" $retval "$ret_date" # Return to menu if either ESC or Cancel/No [ $retval -eq $SUCCESS ] || continue @@ -743,7 +743,7 @@ f_dialog_input_expire() retval=$? setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_time=$( f_dialog_inputstr ) - f_dprintf "retval=$retval ret_time=[$ret_time]" + f_dprintf "retval=%u ret_time=[%s]" $retval "$ret_time" # Return to menu if either ESC or Cancel/No [ $retval -eq $SUCCESS ] || continue @@ -752,7 +752,7 @@ f_dialog_input_expire() -j -f "%d/%m/%Y %T" \ -- "$ret_date $ret_time" \ +%s 2> /dev/null ) - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; 3) # Enter number of days into the future @@ -776,13 +776,13 @@ f_dialog_input_expire() continue fi - f_dprintf "ret_days=[$ret_days]" + f_dprintf "ret_days=[%s]" "$ret_days" case "$ret_days" in [-+]*) _input=$( date -v${ret_days}d +%s );; 0) _input=$( date +%s );; *) _input=$( date -v+${ret_days}d +%s );; esac - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; 4) # Enter value manually @@ -803,7 +803,7 @@ f_dialog_input_expire() continue fi - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; esac @@ -813,8 +813,8 @@ f_dialog_input_expire() pw_account_expire="$_input" save_flag=1 - local debug=pw_account_expire - f_dprintf "$debug: [$cur_pw_account_expire]->[$pw_account_expire]" + f_dprintf "pw_account_expire: [%s]->[%s]" \ + "$cur_pw_account_expire" "$pw_account_expire" return $SUCCESS } @@ -837,7 +837,7 @@ f_dialog_input_home_dir() pw_home_dir="$_input" save_flag=1 - f_dprintf "pw_home_dir: [$cur_pw_home_dir]->[$pw_home_dir]" + f_dprintf "pw_home_dir: [%s]->[%s]" "$cur_pw_home_dir" "$pw_home_dir" return $SUCCESS } @@ -863,7 +863,8 @@ f_dialog_input_home_create() fi save_flag=1 - f_dprintf "pw_home_create: [$cur_pw_home_create]->[$pw_home_create]" + f_dprintf "pw_home_create: [%s]->[%s]" \ + "$cur_pw_home_create" "$pw_home_create" [ $retval -ne 255 ] # return failure if user pressed ESC } @@ -905,7 +906,8 @@ f_dialog_input_group_delete() fi save_flag=1 - f_dprintf "pw_group_delete: [$cur_pw_group_delete]->[$pw_group_delete]" + f_dprintf "pw_group_delete: [%s]->[%s]" \ + "$cur_pw_group_delete" "$pw_group_delete" [ $retval -ne 255 ] # return failure if user pressed ESC } @@ -931,7 +933,8 @@ f_dialog_input_home_delete() fi save_flag=1 - f_dprintf "pw_home_delete: [$cur_pw_home_delete]->[$pw_home_delete]" + f_dprintf "pw_home_delete: [%s]->[%s]" \ + "$cur_pw_home_delete" "$pw_home_delete" [ $retval -ne 255 ] # return failure if user pressed ESC } @@ -958,8 +961,8 @@ f_dialog_input_dotfiles_create() fi save_flag=1 - local debug="pw_dotfiles_create:" - f_dprintf "$debug: [$cur_pw_dotfiles_create]->[$pw_dotfiles_create]" + f_dprintf "pw_dotfiles_create: [%s]->[%s]" \ + "$cur_pw_dotfiles_create" "$pw_dotfiles_create" [ $retval -ne 255 ] # return failure if user pressed ESC } @@ -1017,7 +1020,7 @@ f_dialog_input_shell() pw_shell="$_input" save_flag=1 - f_dprintf "pw_shell: [$cur_pw_shell]->[$pw_shell]" + f_dprintf "pw_shell: [%s]->[%s]" "$cur_pw_shell" "$pw_shell" return $SUCCESS } Modified: head/usr.sbin/bsdconfig/usermgmt/userdel ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/userdel Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/userdel Fri Dec 21 19:26:17 2012 (r244550) @@ -71,7 +71,7 @@ while :; do f_dialog_menu_user_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" [ $retval -eq 0 ] || f_die Modified: head/usr.sbin/bsdconfig/usermgmt/useredit ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/useredit Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/useredit Fri Dec 21 19:26:17 2012 (r244550) @@ -71,7 +71,7 @@ while :; do f_dialog_menu_user_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" [ $retval -eq 0 ] || f_die Modified: head/usr.sbin/bsdconfig/usermgmt/userinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/userinput Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/userinput Fri Dec 21 19:26:17 2012 (r244550) @@ -114,7 +114,7 @@ save_changes() elif [ "$pw_password" ]; then cmd="echo \"\$pw_password\" | $cmd -h 0" fi - f_dprintf "cmd=$cmd" + f_dprintf "cmd=%s" "$cmd" err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then @@ -160,7 +160,7 @@ save_changes() elif [ "$pw_password" ]; then cmd="echo \"\$pw_password\" | $cmd -h 0" fi - f_dprintf "cmd=$cmd" + f_dprintf "cmd=%s" "$cmd" err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then @@ -217,14 +217,14 @@ dialog_title_update() while [ $# -gt 0 ]; do key="${1%%=*}" value="${1#*=}" - f_dprintf "key=[$key] value=[$value]" + f_dprintf "key=[%s] value=[%s]" "$key" "$value" case "$key" in mode) mode="$value";; user) user="$value";; esac shift done -f_dprintf "mode=[$mode] user=[$user]" +f_dprintf "mode=[%s] user=[%s]" "$mode" "$user" # # Initialize @@ -406,7 +406,7 @@ while :; do retval=$? setvar DIALOG_MENU_$$ "$dialog_menu" mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" # Exit if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || f_die @@ -425,7 +425,7 @@ while :; do f_dialog_menu_user_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" # Loop if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || continue Modified: head/usr.sbin/bsdconfig/usermgmt/usermgmt ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/usermgmt Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/usermgmt Fri Dec 21 19:26:17 2012 (r244550) @@ -126,7 +126,7 @@ while :; do dialog_menu_main retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" if [ $retval -eq 2 ]; then # The Help button was pressed From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 19:28:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 769EAD38; Fri, 21 Dec 2012 19:28:18 +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 5AFFD8FC13; Fri, 21 Dec 2012 19:28:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLJSI87022157; Fri, 21 Dec 2012 19:28:18 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLJSIJ1022156; Fri, 21 Dec 2012 19:28:18 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201212211928.qBLJSIJ1022156@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 21 Dec 2012 19:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244551 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 19:28:18 -0000 Author: np Date: Fri Dec 21 19:28:17 2012 New Revision: 244551 URL: http://svnweb.freebsd.org/changeset/base/244551 Log: cxgbe(4): must hold a write-lock on the table while allocating an L2 entry for switching. MFC after: 3 days Modified: head/sys/dev/cxgbe/t4_l2t.c Modified: head/sys/dev/cxgbe/t4_l2t.c ============================================================================== --- head/sys/dev/cxgbe/t4_l2t.c Fri Dec 21 19:26:17 2012 (r244550) +++ head/sys/dev/cxgbe/t4_l2t.c Fri Dec 21 19:28:17 2012 (r244551) @@ -149,7 +149,7 @@ t4_l2t_alloc_switching(struct l2t_data * { struct l2t_entry *e; - rw_rlock(&d->lock); + rw_wlock(&d->lock); e = t4_alloc_l2e(d); if (e) { mtx_lock(&e->lock); /* avoid race with t4_l2t_free */ @@ -157,7 +157,7 @@ t4_l2t_alloc_switching(struct l2t_data * atomic_store_rel_int(&e->refcnt, 1); mtx_unlock(&e->lock); } - rw_runlock(&d->lock); + rw_wunlock(&d->lock); return e; } From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 19:45:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CEC9F2AF; Fri, 21 Dec 2012 19:45:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id A01A68FC0C; Fri, 21 Dec 2012 19:45:47 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0B495B946; Fri, 21 Dec 2012 14:45:47 -0500 (EST) From: John Baldwin To: Jim Harris Subject: Re: svn commit: r244549 - head/sys/dev/nvme Date: Fri, 21 Dec 2012 14:24:16 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201212211913.qBLJDmpm019837@svn.freebsd.org> In-Reply-To: <201212211913.qBLJDmpm019837@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201212211424.16934.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 21 Dec 2012 14:45:47 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 19:45:47 -0000 On Friday, December 21, 2012 2:13:48 pm Jim Harris wrote: > Author: jimharris > Date: Fri Dec 21 19:13:48 2012 > New Revision: 244549 > URL: http://svnweb.freebsd.org/changeset/base/244549 > > Log: > Put kthreads under curproc so they are attached to nvmecontrol rather > than pid 0. > > Sponsored by: Intel Hmm, is this really wise? I'm not sure how well the kernel would handle a kthread belonging to a userland process. You could just have each test create a new kproc that holds the associated threads for that test instead perhaps? -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 20:01:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 157196CC; Fri, 21 Dec 2012 20:01:14 +0000 (UTC) (envelope-from matthew@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 EE5358FC0A; Fri, 21 Dec 2012 20:01:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLK1Dxq027190; Fri, 21 Dec 2012 20:01:13 GMT (envelope-from matthew@svn.freebsd.org) Received: (from matthew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLK1DCQ027189; Fri, 21 Dec 2012 20:01:13 GMT (envelope-from matthew@svn.freebsd.org) Message-Id: <201212212001.qBLK1DCQ027189@svn.freebsd.org> From: Matthew Seaman Date: Fri, 21 Dec 2012 20:01:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244553 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 20:01:14 -0000 Author: matthew (ports committer) Date: Fri Dec 21 20:01:13 2012 New Revision: 244553 URL: http://svnweb.freebsd.org/changeset/base/244553 Log: In preparation for making 'pkg -n' the one true method of determining whether a system has been configured to use pkgng, cause /usr/sbin/pkg recognise a -n option and exit with a failure code when the pkg port is not installed. Approved by: bapt MFC after: 2 weeks Modified: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Fri Dec 21 19:36:08 2012 (r244552) +++ head/usr.sbin/pkg/pkg.c Fri Dec 21 20:01:13 2012 (r244553) @@ -452,6 +452,16 @@ main(__unused int argc, char *argv[]) getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); if (access(pkgpath, X_OK) == -1) { + /* + * To allow 'pkg -n' to be used as a reliable test for whether + * a system is configured to use pkg, don't bootstrap pkg + * when that argument is given as argv[1]. + */ + if ( argv[1] != NULL && strcmp(argv[1], "-n") == 0) { + printf("%s", "pkg is not installed\n"); + exit(EXIT_FAILURE); + } + /* * Do not ask for confirmation if either of stdin or stdout is * not tty. Check the environment to see if user has answer From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 20:11:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 307B6890; Fri, 21 Dec 2012 20:11:43 +0000 (UTC) (envelope-from dteske@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 091A28FC0C; Fri, 21 Dec 2012 20:11:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLKBg5Z029007; Fri, 21 Dec 2012 20:11:42 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLKBfC2028995; Fri, 21 Dec 2012 20:11:41 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201212212011.qBLKBfC2028995@svn.freebsd.org> From: Devin Teske Date: Fri, 21 Dec 2012 20:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244554 - in head/usr.sbin/bsdconfig: networking/share share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 20:11:43 -0000 Author: dteske Date: Fri Dec 21 20:11:41 2012 New Revision: 244554 URL: http://svnweb.freebsd.org/changeset/base/244554 Log: Use f_show_help() where printf(1) syntax is desired. Modified: head/usr.sbin/bsdconfig/networking/share/device.subr head/usr.sbin/bsdconfig/networking/share/hostname.subr head/usr.sbin/bsdconfig/networking/share/ipaddr.subr head/usr.sbin/bsdconfig/networking/share/media.subr head/usr.sbin/bsdconfig/networking/share/netmask.subr head/usr.sbin/bsdconfig/networking/share/routing.subr head/usr.sbin/bsdconfig/share/mustberoot.subr Modified: head/usr.sbin/bsdconfig/networking/share/device.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/device.subr Fri Dec 21 20:01:13 2012 (r244553) +++ head/usr.sbin/bsdconfig/networking/share/device.subr Fri Dec 21 20:11:41 2012 (r244554) @@ -378,11 +378,7 @@ f_dialog_menu_netdev_edit() if f_nfs_mounted && ! f_jailed; then local setting="$( printf "$msg_current_dhcp_status" \ "$interface" "$dhcp_status" )" - local message="$( - printf "$msg_nfs_mounts_may_cause_hang" \ - "$setting" - )" - f_dialog_msgbox "$message" + f_show_msg "$msg_nfs_mounts_may_cause_hang" "$setting" continue fi Modified: head/usr.sbin/bsdconfig/networking/share/hostname.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/hostname.subr Fri Dec 21 20:01:13 2012 (r244553) +++ head/usr.sbin/bsdconfig/networking/share/hostname.subr Fri Dec 21 20:11:41 2012 (r244554) @@ -101,16 +101,11 @@ f_dialog_validate_hostname() # local retval=$? case $retval in - 1) f_dialog_msgbox "$( printf \ - "$msg_hostname_label_contains_invalid_chars" "$fqhn" )";; - 2) f_dialog_msgbox "$( printf \ - "$msg_hostname_label_starts_or_ends_with_hyphen" "$fqhn" )";; - 3) f_dialog_msgbox "$( printf \ - "$msg_hostname_label_is_null" "$fqhn" )";; - 63) f_dialog_msgbox "$( printf \ - "$msg_hostname_label_exceeds_max_length" "$fqhn" )";; - 255) f_dialog_msgbox "$( printf \ - "$msg_hostname_exceeds_max_length" "$fqhn" )";; + 1) f_show_msg "$msg_hostname_label_contains_invalid_chars" "$fqhn";; + 2) f_show_msg "$msg_hostname_label_starts_or_ends_with_hyphen" "$fqhn";; + 3) f_show_msg "$msg_hostname_label_is_null" "$fqhn";; + 63) f_show_msg "$msg_hostname_label_exceeds_max_length" "$fqhn";; + 255) f_show_msg "$msg_hostname_exceeds_max_length" "$fqhn";; esac return $retval @@ -169,10 +164,8 @@ f_dialog_input_hostname() # "X11 connection rejected because of wrong authentication." # if [ "$USE_XDIALOG" -a "$SSH_CONNECTION" ]; then - f_dialog_msgbox "$( - printf "$msg_activate_hostname_x11warning" \ - "$( hostname )" "$hostname" - )" + f_show_msg "$msg_activate_hostname_x11warning" \ + "$( hostname )" "$hostname" else f_dialog_yesno "$( printf "$msg_activate_hostname" \ Modified: head/usr.sbin/bsdconfig/networking/share/ipaddr.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Fri Dec 21 20:01:13 2012 (r244553) +++ head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Fri Dec 21 20:11:41 2012 (r244554) @@ -116,14 +116,10 @@ f_dialog_iperror() [ ${error:-0} -ne 0 ] || return $SUCCESS case "$error" in - 1) f_dialog_msgbox "$( printf \ - "$msg_ipv4_addr_octet_contains_invalid_chars" "$ip" )";; - 2) f_dialog_msgbox "$( printf \ - "$msg_ipv4_addr_octet_is_null" "$ip" )";; - 3) f_dialog_msgbox "$( printf \ - "$msg_ipv4_addr_octet_exceeds_max_value" "$ip" )";; - 4) f_dialog_msgbox "$( printf \ - "$msg_ipv4_addr_octet_missing_or_extra" "$ip" )";; + 1) f_show_msg "$msg_ipv4_addr_octet_contains_invalid_chars" "$ip";; + 2) f_show_msg "$msg_ipv4_addr_octet_is_null" "$ip";; + 3) f_show_msg "$msg_ipv4_addr_octet_exceeds_max_value" "$ip";; + 4) f_show_msg "$msg_ipv4_addr_octet_missing_or_extra" "$ip";; esac } @@ -294,14 +290,10 @@ f_dialog_ip6error() [ ${error:-0} -ne 0 ] || return $SUCCESS case "$error" in - 1) f_dialog_msgbox "$( printf \ - "$msg_ipv6_addr_segment_contains_invalid_chars" "$ip" )";; - 2) f_dialog_msgbox "$( printf \ - "$msg_ipv6_addr_too_many_null_segments" "$ip" )";; - 3) f_dialog_msgbox "$( printf \ - "$msg_ipv6_addr_segment_contains_too_many_chars" "$ip" )";; - 4) f_dialog_msgbox "$( printf \ - "$msg_ipv6_addr_too_few_or_extra_segments" "$ip" )";; + 1) f_show_msg "$msg_ipv6_addr_segment_contains_invalid_chars" "$ip";; + 2) f_show_msg "$msg_ipv6_addr_too_many_null_segments" "$ip";; + 3) f_show_msg "$msg_ipv6_addr_segment_contains_too_many_chars" "$ip";; + 4) f_show_msg "$msg_ipv6_addr_too_few_or_extra_segments" "$ip";; *) if [ $(( $error & 0xF )) -eq 5 ]; then # IPv4 at the end of IPv6 address is invalid @@ -353,9 +345,7 @@ f_dialog_input_ipaddr() if f_nfs_mounted && ! f_jailed; then local setting="$( printf "$msg_current_ipaddr" \ "$interface" "$_ipaddr" )" - local message="$( printf "$msg_nfs_mounts_may_cause_hang" \ - "$setting" )" - f_dialog_msgbox "$message" + f_show_msg "$msg_nfs_mounts_may_cause_hang" "$setting" return $FAILURE fi Modified: head/usr.sbin/bsdconfig/networking/share/media.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/media.subr Fri Dec 21 20:01:13 2012 (r244553) +++ head/usr.sbin/bsdconfig/networking/share/media.subr Fri Dec 21 20:11:41 2012 (r244554) @@ -114,9 +114,7 @@ f_dialog_input_options() if f_nfs_mounted && ! f_jailed; then local setting="$( printf "$msg_current_options" \ "$interface" "$options" )" - local message="$( printf "$msg_nfs_mounts_may_cause_hang" \ - "$setting" )" - f_dialog_msgbox "$message" + f_show_msg "$msg_nfs_mounts_may_cause_hang" "$setting" return $FAILURE fi @@ -165,9 +163,7 @@ f_dialog_menu_media_options() if f_nfs_mounted && ! f_jailed; then local setting="$( printf "$msg_current_options" \ "$interface" "$_options" )" - local message="$( printf "$msg_nfs_mounts_may_cause_hang" \ - "$setting" )" - f_dialog_msgbox "$message" + f_show_msg "$msg_nfs_mounts_may_cause_hang" "$setting" return $FAILURE fi Modified: head/usr.sbin/bsdconfig/networking/share/netmask.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/netmask.subr Fri Dec 21 20:01:13 2012 (r244553) +++ head/usr.sbin/bsdconfig/networking/share/netmask.subr Fri Dec 21 20:11:41 2012 (r244554) @@ -127,16 +127,11 @@ f_dialog_validate_netmask() # local retval=$? case $retval in - 1) f_dialog_msgbox "$( printf \ - "$msg_ipv4_mask_field_contains_invalid_chars" "$mask" )";; - 2) f_dialog_msgbox "$( printf \ - "$msg_ipv4_mask_field_is_null" "$mask" )";; - 3) f_dialog_msgbox "$( printf \ - "$msg_ipv4_mask_field_exceeds_max_value" "$mask" )";; - 4) f_dialog_msgbox "$( printf \ - "$msg_ipv4_mask_field_missing_or_extra" "$mask" )";; - 5) f_dialog_msgbox "$( printf \ - "$msg_ipv4_mask_field_invalid_value" "$mask" )";; + 1) f_show_msg "$msg_ipv4_mask_field_contains_invalid_chars" "$mask";; + 2) f_show_msg "$msg_ipv4_mask_field_is_null" "$mask";; + 3) f_show_msg "$msg_ipv4_mask_field_exceeds_max_value" "$mask";; + 4) f_show_msg "$msg_ipv4_mask_field_missing_or_extra" "$mask";; + 5) f_show_msg "$msg_ipv4_mask_field_invalid_value" "$mask";; esac return $retval @@ -158,9 +153,7 @@ f_dialog_input_netmask() if f_nfs_mounted && ! f_jailed; then local setting="$( printf "$msg_current_subnet" \ "$interface" "$_netmask" )" - local message="$( printf "$msg_nfs_mounts_may_cause_hang" \ - "$setting" )" - f_dialog_msgbox "$message" + f_show_msg "$msg_nfs_mounts_may_cause_hang" "$setting" return $FAILURE fi Modified: head/usr.sbin/bsdconfig/networking/share/routing.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/routing.subr Fri Dec 21 20:01:13 2012 (r244553) +++ head/usr.sbin/bsdconfig/networking/share/routing.subr Fri Dec 21 20:11:41 2012 (r244554) @@ -91,9 +91,7 @@ f_dialog_input_defaultrouter() if f_nfs_mounted && ! f_jailed; then local setting="$( printf "$msg_current_default_router" \ "$defaultrouter" )" - local message="$( printf "$msg_nfs_mounts_may_cause_hang" \ - "$setting" )" - f_dialog_msgbox "$message" + f_show_msg "$msg_nfs_mounts_may_cause_hang" "$setting" return $FAILURE fi Modified: head/usr.sbin/bsdconfig/share/mustberoot.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/mustberoot.subr Fri Dec 21 20:01:13 2012 (r244553) +++ head/usr.sbin/bsdconfig/share/mustberoot.subr Fri Dec 21 20:11:41 2012 (r244554) @@ -338,16 +338,14 @@ f_authenticate_some_user() case "$user" in root|toor) nfailures=$(( $nfailures + 1 )) - f_dialog_msgbox "$( printf \ - "$msg_user_disallowed" "$user" )" + f_show_msg "$msg_user_disallowed" "$user" continue esac fi if ! f_quietly id "$user"; then nfailures=$(( $nfailures + 1 )) if [ "$SECURE_DIVULGE_UNKNOWN_USER" ]; then - f_dialog_msgbox "$( printf \ - "$msg_unknown_user" "$user" )" + f_show_msg "$msg_unknown_user" "$user" elif [ $nfailures -lt $PASSWD_TRIES ]; then f_dialog_info "$msg_sorry_try_again" sleep 1 From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 20:21:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 92749A4A; Fri, 21 Dec 2012 20:21:57 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id 514DD8FC12; Fri, 21 Dec 2012 20:21:56 +0000 (UTC) Received: from smtp.fisglobal.com ([10.132.206.16]) by ltcfislmsgpa06.fnfis.com (8.14.5/8.14.5) with ESMTP id qBLKLt71025043 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Fri, 21 Dec 2012 14:21:55 -0600 Received: from [10.0.0.102] (10.14.152.61) by smtp.fisglobal.com (10.132.206.16) with Microsoft SMTP Server (TLS) id 14.2.309.2; Fri, 21 Dec 2012 14:21:54 -0600 Subject: Re: svn commit: r244553 - head/usr.sbin/pkg MIME-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset="us-ascii" From: Devin Teske In-Reply-To: <201212212001.qBLK1DCQ027189@svn.freebsd.org> Date: Fri, 21 Dec 2012 12:21:52 -0800 Content-Transfer-Encoding: quoted-printable Message-ID: References: <201212212001.qBLK1DCQ027189@svn.freebsd.org> To: Matthew Seaman X-Mailer: Apple Mail (2.1283) X-Originating-IP: [10.14.152.61] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.9.8327, 1.0.431, 0.0.0000 definitions=2012-12-21_06:2012-12-21,2012-12-21,1970-01-01 signatures=0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Devin Teske List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 20:21:57 -0000 Sweet! This will simplify things on the bsdconfig side for the pkgng module I'm wr= iting. --=20 Devin On Dec 21, 2012, at 12:01 PM, Matthew Seaman wrote: > Author: matthew (ports committer) > Date: Fri Dec 21 20:01:13 2012 > New Revision: 244553 > URL: http://svnweb.freebsd.org/changeset/base/244553 >=20 > Log: > In preparation for making 'pkg -n' the one true method of determining > whether a system has been configured to use pkgng, cause /usr/sbin/pkg > recognise a -n option and exit with a failure code when the pkg port > is not installed. >=20 > Approved by: bapt > MFC after: 2 weeks >=20 > Modified: > head/usr.sbin/pkg/pkg.c >=20 > Modified: head/usr.sbin/pkg/pkg.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/usr.sbin/pkg/pkg.c Fri Dec 21 19:36:08 2012 (r244552) > +++ head/usr.sbin/pkg/pkg.c Fri Dec 21 20:01:13 2012 (r244553) > @@ -452,6 +452,16 @@ main(__unused int argc, char *argv[]) > getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); >=20 > if (access(pkgpath, X_OK) =3D=3D -1) { > + /*=20 > + * To allow 'pkg -n' to be used as a reliable test for whether > + * a system is configured to use pkg, don't bootstrap pkg > + * when that argument is given as argv[1]. > + */ > + if ( argv[1] !=3D NULL && strcmp(argv[1], "-n") =3D=3D 0) { > + printf("%s", "pkg is not installed\n"); > + exit(EXIT_FAILURE); > + } > + > /* > * Do not ask for confirmation if either of stdin or stdout is > * not tty. Check the environment to see if user has answer _____________ The information contained in this message is proprietary and/or confidentia= l. If you are not the intended recipient, please: (i) delete the message an= d all copies; (ii) do not disclose, distribute or use the message in any ma= nner; and (iii) notify the sender immediately. In addition, please be aware= that any message addressed to our domain is subject to archiving and revie= w by persons other than the intended recipient. Thank you. From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 20:29:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A6CDDC45; Fri, 21 Dec 2012 20:29:29 +0000 (UTC) (envelope-from dteske@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 713F88FC16; Fri, 21 Dec 2012 20:29:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLKTT41032652; Fri, 21 Dec 2012 20:29:29 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLKTT8P032650; Fri, 21 Dec 2012 20:29:29 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201212212029.qBLKTT8P032650@svn.freebsd.org> From: Devin Teske Date: Fri, 21 Dec 2012 20:29:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244555 - in head/usr.sbin/bsdconfig: networking/share share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 20:29:29 -0000 Author: dteske Date: Fri Dec 21 20:29:28 2012 New Revision: 244555 URL: http://svnweb.freebsd.org/changeset/base/244555 Log: New f_show_info() function for dialog(1) --infobox using printf(1) syntax. Modified: head/usr.sbin/bsdconfig/networking/share/device.subr head/usr.sbin/bsdconfig/share/common.subr Modified: head/usr.sbin/bsdconfig/networking/share/device.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/device.subr Fri Dec 21 20:11:41 2012 (r244554) +++ head/usr.sbin/bsdconfig/networking/share/device.subr Fri Dec 21 20:29:28 2012 (r244555) @@ -436,8 +436,7 @@ f_dialog_menu_netdev_edit() "$options" != "$options_orig" -o \ "$dhcp" != "$dhcp_orig" ] then - f_dialog_info "$( printf "$msg_saving_network_interface" \ - "$interface" )" + f_show_info "$msg_saving_network_interface" "$interface" local value= if [ "$dhcp" ]; then @@ -458,8 +457,7 @@ f_dialog_menu_netdev_edit() f_dialog_yesno "Would you like to bring the $interface" \ "interface up right now?" if [ $? -eq $SUCCESS ]; then - f_dialog_info "$( printf "$msg_bring_interface_up" \ - "$interface" )" + f_show_info "$msg_bring_interface_up" "$interface" local dr="$( f_sysrc_get defaultrouter )" err if [ "$dr" = "NO" -o ! "$dr" ]; then Modified: head/usr.sbin/bsdconfig/share/common.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/common.subr Fri Dec 21 20:11:41 2012 (r244554) +++ head/usr.sbin/bsdconfig/share/common.subr Fri Dec 21 20:29:28 2012 (r244555) @@ -136,6 +136,27 @@ f_interrupt() f_die } +# f_show_info $fmt [ $opts ... ] +# +# Display a message in a dialog infobox using printf(1) syntax. +# +f_show_info() +{ + local msg + msg=$( printf "$@" ) + + # + # Use f_dialog_infobox from dialog.subr if possible, otherwise fall + # back to dialog(1) (without options, making it obvious when using + # un-aided system dialog). + # + if f_have f_dialog_info; then + f_dialog_info "$msg" + else + dialog --infobox "$msg" 0 0 + fi +} + # f_show_msg $fmt [ $opts ... ] # # Display a message in a dialog box using printf(1) syntax. From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 20:36:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6F631DF1; Fri, 21 Dec 2012 20:36:13 +0000 (UTC) (envelope-from dteske@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 538F08FC0C; Fri, 21 Dec 2012 20:36:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLKaDHq033669; Fri, 21 Dec 2012 20:36:13 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLKaDW6033668; Fri, 21 Dec 2012 20:36:13 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201212212036.qBLKaDW6033668@svn.freebsd.org> From: Devin Teske Date: Fri, 21 Dec 2012 20:36:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244556 - head/usr.sbin/bsdconfig/usermgmt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 20:36:13 -0000 Author: dteske Date: Fri Dec 21 20:36:12 2012 New Revision: 244556 URL: http://svnweb.freebsd.org/changeset/base/244556 Log: Remove erroneous use of "local" (not in a function). Modified: head/usr.sbin/bsdconfig/usermgmt/userinput Modified: head/usr.sbin/bsdconfig/usermgmt/userinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/userinput Fri Dec 21 20:29:28 2012 (r244555) +++ head/usr.sbin/bsdconfig/usermgmt/userinput Fri Dec 21 20:36:12 2012 (r244556) @@ -391,7 +391,6 @@ while :; do \"\$hline\" \ $menu_items ) - local dialog_menu dialog_menu=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 20:37:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 172DAF69; Fri, 21 Dec 2012 20:37:41 +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 EE3838FC0C; Fri, 21 Dec 2012 20:37:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLKbeDD033887; Fri, 21 Dec 2012 20:37:40 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLKbctg033873; Fri, 21 Dec 2012 20:37:38 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201212212037.qBLKbctg033873@svn.freebsd.org> From: Brooks Davis Date: Fri, 21 Dec 2012 20:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244557 - in head/lib: . libnetbsd libnetbsd/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 20:37:41 -0000 Author: brooks Date: Fri Dec 21 20:37:38 2012 New Revision: 244557 URL: http://svnweb.freebsd.org/changeset/base/244557 Log: Add libnetbsd, a thin compatibility layer intended to allow a limited set of NetBSD software to compile as part of the FreeBSD build with little or no modifiction. It is built as a static library and not installed for general use. Likewise, its header files are not installed. Sponsored by: DARPA, AFRL Added: head/lib/libnetbsd/ head/lib/libnetbsd/Makefile (contents, props changed) head/lib/libnetbsd/README (contents, props changed) head/lib/libnetbsd/rmd160.h (contents, props changed) head/lib/libnetbsd/sha1.h (contents, props changed) head/lib/libnetbsd/sha2.h (contents, props changed) head/lib/libnetbsd/stdlib.h (contents, props changed) head/lib/libnetbsd/strsuftoll.c (contents, props changed) head/lib/libnetbsd/sys/ head/lib/libnetbsd/sys/cdefs.h (contents, props changed) head/lib/libnetbsd/util.c (contents, props changed) head/lib/libnetbsd/util.h (contents, props changed) Modified: head/lib/Makefile Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Fri Dec 21 20:36:12 2012 (r244556) +++ head/lib/Makefile Fri Dec 21 20:37:38 2012 (r244557) @@ -90,6 +90,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libmilter} \ ${_libmp} \ ${_libnandfs} \ + libnetbsd \ ${_libngatm} \ libopie \ libpam \ Added: head/lib/libnetbsd/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libnetbsd/Makefile Fri Dec 21 20:37:38 2012 (r244557) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.include + +LIB= netbsd + +CFLAGS+= -I${.CURDIR} + +SRCS+= strsuftoll.c util.c util.h + +INTERNALLIB= + +.include Added: head/lib/libnetbsd/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libnetbsd/README Fri Dec 21 20:37:38 2012 (r244557) @@ -0,0 +1,7 @@ +$FreeBSD$ + +libnetbsd is a thin compatibility layer intended to allow a limited +set of NetBSD software to compile as part of the FreeBSD build with +little or no modifiction. It is built as a static library and not +installed for general use. Likewise, its header files are not +installed. Added: head/lib/libnetbsd/rmd160.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libnetbsd/rmd160.h Fri Dec 21 20:37:38 2012 (r244557) @@ -0,0 +1,44 @@ +/* $FreeBSD$ */ + +/*- + * Copyright (c) 2012 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + */ + +#ifndef _RMD160_H_ +#define _RMD160_H_ + +#include + +#define RMD160_CTX RIPEMD160_CTX +#define RMD160End RIPEMD160_End +#define RMD160File RIPEMD160_File +#define RMD160Init RIPEMD160_Init +#define RMD160Update RIPEMD160_Update + +#endif /* _RMD160_H_ */ Added: head/lib/libnetbsd/sha1.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libnetbsd/sha1.h Fri Dec 21 20:37:38 2012 (r244557) @@ -0,0 +1,43 @@ +/* $FreeBSD$ */ + +/*- + * Copyright (c) 2012 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + */ + +#ifndef _SHA1_H_ +#define _SHA1_H_ + +#include + +#define SHA1End SHA1_End +#define SHA1File SHA1_File +#define SHA1Init SHA1_Init +#define SHA1Update SHA1_Update + +#endif /* _SHA1_H_ */ Added: head/lib/libnetbsd/sha2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libnetbsd/sha2.h Fri Dec 21 20:37:38 2012 (r244557) @@ -0,0 +1,39 @@ +/* $FreeBSD$ */ + +/*- + * Copyright (c) 2012 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + */ + +#ifndef _SHA2_H_ +#define _SHA2_H_ + +#include +#include + +#endif /* _SHA2_H_ */ Added: head/lib/libnetbsd/stdlib.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libnetbsd/stdlib.h Fri Dec 21 20:37:38 2012 (r244557) @@ -0,0 +1,70 @@ +/* $FreeBSD$ */ + +/*- + * Copyright (c) 2012 SRI International + * Copyright (c) 2001-2002,2004 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBNETBSD_STDLIB_H_ +#define _LIBNETBSD_STDLIB_H_ + +#include_next + +long long strsuftoll(const char *, const char *, long long, long long); +long long strsuftollx(const char *, const char *, + long long, long long, char *, size_t); + +#endif /* _LIBNETBSD_STDLIB_H_ */ Added: head/lib/libnetbsd/strsuftoll.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libnetbsd/strsuftoll.c Fri Dec 21 20:37:38 2012 (r244557) @@ -0,0 +1,222 @@ +/* $NetBSD: strsuftoll.c,v 1.6 2004/03/05 05:58:29 lukem Exp $ */ +/*- + * Copyright (c) 2001-2002,2004 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ +/*- + * Copyright (c) 1991, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Keith Muller of the University of California, San Diego and Lance + * Visser of Convex Computer 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _LIBC +# ifdef __weak_alias +__weak_alias(strsuftoll, _strsuftoll) +__weak_alias(strsuftollx, _strsuftollx) +# endif +#endif /* LIBC */ + +/* + * Convert an expression of the following forms to a (u)int64_t. + * 1) A positive decimal number. + * 2) A positive decimal number followed by a b (mult by 512). + * 3) A positive decimal number followed by a k (mult by 1024). + * 4) A positive decimal number followed by a m (mult by 1048576). + * 5) A positive decimal number followed by a g (mult by 1073741824). + * 6) A positive decimal number followed by a t (mult by 1099511627776). + * 7) A positive decimal number followed by a w (mult by sizeof int) + * 8) Two or more positive decimal numbers (with/without k,b or w). + * separated by x (also * for backwards compatibility), specifying + * the product of the indicated values. + * Returns the result upon successful conversion, or exits with an + * appropriate error. + * + */ + +/* + * As strsuftoll(), but returns the error message into the provided buffer + * rather than exiting with it. + */ +/* LONGLONG */ +long long +strsuftollx(const char *desc, const char *val, + long long min, long long max, char *ebuf, size_t ebuflen) +{ + long long num, t; + char *expr; + + errno = 0; + ebuf[0] = '\0'; + + while (isspace((unsigned char)*val)) /* Skip leading space */ + val++; + + num = strtoll(val, &expr, 10); + if (errno == ERANGE) + goto erange; /* Overflow */ + + if (expr == val) /* No digits */ + goto badnum; + + switch (*expr) { + case 'b': + t = num; + num *= 512; /* 1 block */ + if (t > num) + goto erange; + ++expr; + break; + case 'k': + t = num; + num *= 1024; /* 1 kilobyte */ + if (t > num) + goto erange; + ++expr; + break; + case 'm': + t = num; + num *= 1048576; /* 1 megabyte */ + if (t > num) + goto erange; + ++expr; + break; + case 'g': + t = num; + num *= 1073741824; /* 1 gigabyte */ + if (t > num) + goto erange; + ++expr; + break; + case 't': + t = num; + num *= 1099511627776LL; /* 1 terabyte */ + if (t > num) + goto erange; + ++expr; + break; + case 'w': + t = num; + num *= sizeof(int); /* 1 word */ + if (t > num) + goto erange; + ++expr; + break; + } + + switch (*expr) { + case '\0': + break; + case '*': /* Backward compatible */ + case 'x': + t = num; + num *= strsuftollx(desc, expr + 1, min, max, ebuf, ebuflen); + if (*ebuf != '\0') + return (0); + if (t > num) { + erange: + snprintf(ebuf, ebuflen, + "%s: %s", desc, strerror(ERANGE)); + return (0); + } + break; + default: + badnum: snprintf(ebuf, ebuflen, + "%s `%s': illegal number", desc, val); + return (0); + } + if (num < min) { + /* LONGLONG */ + snprintf(ebuf, ebuflen, "%s %lld is less than %lld.", + desc, (long long)num, (long long)min); + return (0); + } + if (num > max) { + /* LONGLONG */ + snprintf(ebuf, ebuflen, + "%s %lld is greater than %lld.", + desc, (long long)num, (long long)max); + return (0); + } + *ebuf = '\0'; + return (num); +} + +/* LONGLONG */ +long long +strsuftoll(const char *desc, const char *val, + long long min, long long max) +{ + long long result; + char errbuf[100]; + + result = strsuftollx(desc, val, min, max, errbuf, sizeof(errbuf)); + if (*errbuf != '\0') + errx(1, "%s", errbuf); + return (result); +} Added: head/lib/libnetbsd/sys/cdefs.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libnetbsd/sys/cdefs.h Fri Dec 21 20:37:38 2012 (r244557) @@ -0,0 +1,50 @@ +/* $FreeBSD$ */ + +/*- + * Copyright (c) 2012 SRI International + * Copyright (c) 1992, 1993 + * The Regents of the University of California. 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBNETBSD_SYS_CDEFS_H_ +#define _LIBNETBSD_SYS_CDEFS_H_ + +#include_next + +#ifdef __dead2 +#define __dead __dead2 +#else +#define __dead +#endif + +/* + * Return the number of elements in a statically-allocated array, + * __x. + */ +#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) + +#endif /* _LIBNETBSD_SYS_CDEFS_H_ */ Added: head/lib/libnetbsd/util.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libnetbsd/util.c Fri Dec 21 20:37:38 2012 (r244557) @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2012 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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 + +char * +flags_to_string(u_long flags, const char *def) +{ + char *str; + + str = fflagstostr(flags); + if (*str == '\0') { + free(str); + str = strdup(def); + } + return (str); +} + +int +string_to_flags(char **stringp, u_long *setp, u_long *clrp) +{ + + return strtofflags(stringp, setp, clrp); +} Added: head/lib/libnetbsd/util.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libnetbsd/util.h Fri Dec 21 20:37:38 2012 (r244557) @@ -0,0 +1,41 @@ +/* $FreeBSD$ */ + +/*- + * Copyright (c) 2012 SRI International + * Copyright (c) 1995 + * The Regents of the University of California. 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _UTIL_H_ +#define _UTIL_H_ + +#include + +char *flags_to_string(u_long flags, const char *def); +int string_to_flags(char **stringp, u_long *setp, u_long *clrp); + +#endif /* _UTIL_H_ */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 20:46:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 39B5F227; Fri, 21 Dec 2012 20:46:59 +0000 (UTC) (envelope-from dteske@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 1DA2D8FC0A; Fri, 21 Dec 2012 20:46:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLKkwZC035194; Fri, 21 Dec 2012 20:46:58 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLKkwGJ035193; Fri, 21 Dec 2012 20:46:58 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201212212046.qBLKkwGJ035193@svn.freebsd.org> From: Devin Teske Date: Fri, 21 Dec 2012 20:46:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244558 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 20:46:59 -0000 Author: dteske Date: Fri Dec 21 20:46:58 2012 New Revision: 244558 URL: http://svnweb.freebsd.org/changeset/base/244558 Log: Change axiom for initialization. Including script can disable (default) automatic initialization by setting appropriate variable to particular value. Modified: head/usr.sbin/bsdconfig/share/dialog.subr Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Fri Dec 21 20:37:38 2012 (r244557) +++ head/usr.sbin/bsdconfig/share/dialog.subr Fri Dec 21 20:46:58 2012 (r244558) @@ -1477,6 +1477,9 @@ f_dialog_init() ############################################################ MAIN -[ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init +case "$DIALOG_SELF_INITIALIZE" in +""|0|[Nn][Oo]|[Oo][Ff][Ff]|[Ff][Aa][Ll][Ss][Ee]) : do nothing ;; +*) f_dialog_init +esac fi # ! $_DIALOG_SUBR From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 20:47:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D12D139B; Fri, 21 Dec 2012 20:47:58 +0000 (UTC) (envelope-from mm@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 B2B808FC12; Fri, 21 Dec 2012 20:47:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLKlwfW035362; Fri, 21 Dec 2012 20:47:58 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLKlvrU035353; Fri, 21 Dec 2012 20:47:57 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201212212047.qBLKlvrU035353@svn.freebsd.org> From: Martin Matuska Date: Fri, 21 Dec 2012 20:47:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r244559 - in vendor/xz/dist: . po src/common src/liblzma/api/lzma src/liblzma/simple src/xz X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 20:47:59 -0000 Author: mm Date: Fri Dec 21 20:47:57 2012 New Revision: 244559 URL: http://svnweb.freebsd.org/changeset/base/244559 Log: Update vendor/xz from v5.0 branch to 5.0.4 Git commit: 20778053a07eb90c159c1377ca8dc05a90fd530b Modified: vendor/xz/dist/AUTHORS vendor/xz/dist/ChangeLog vendor/xz/dist/README vendor/xz/dist/THANKS vendor/xz/dist/po/de.po vendor/xz/dist/po/fr.po vendor/xz/dist/po/it.po vendor/xz/dist/po/pl.po vendor/xz/dist/src/common/sysdefs.h vendor/xz/dist/src/liblzma/api/lzma/version.h vendor/xz/dist/src/liblzma/simple/simple_coder.c vendor/xz/dist/src/liblzma/simple/simple_private.h vendor/xz/dist/src/xz/args.c vendor/xz/dist/src/xz/coder.c vendor/xz/dist/src/xz/message.c vendor/xz/dist/src/xz/xz.1 Modified: vendor/xz/dist/AUTHORS ============================================================================== --- vendor/xz/dist/AUTHORS Fri Dec 21 20:46:58 2012 (r244558) +++ vendor/xz/dist/AUTHORS Fri Dec 21 20:47:57 2012 (r244559) @@ -16,11 +16,11 @@ Authors of XZ Utils Some scripts have been adapted from gzip. The original versions were written by Jean-loup Gailly, Charles Levert, and Paul Eggert. - Andrew Dudman helped adapting the script and their man pages for + Andrew Dudman helped adapting the scripts and their man pages for XZ Utils. - The GNU Autotools based build system contains files from many authors, - which I'm not trying list here. + The GNU Autotools-based build system contains files from many authors, + which I'm not trying to list here. Several people have contributed fixes or reported bugs. Most of them are mentioned in the file THANKS. Modified: vendor/xz/dist/ChangeLog ============================================================================== --- vendor/xz/dist/ChangeLog Fri Dec 21 20:46:58 2012 (r244558) +++ vendor/xz/dist/ChangeLog Fri Dec 21 20:47:57 2012 (r244559) @@ -1,3 +1,335 @@ +commit 20778053a07eb90c159c1377ca8dc05a90fd530b +Author: Lasse Collin +Date: Fri Jun 22 14:36:16 2012 +0300 + + xz: Update man page date to match the latest update. + +commit 2cefa84af676da37d7e9c466d55d46c67ab00c22 +Author: Lasse Collin +Date: Fri Jun 22 10:25:43 2012 +0300 + + Bump version and soname for 5.0.4. + +commit 433fec191a17e45690809e54146ea7a773f54cff +Author: Lasse Collin +Date: Fri Jun 22 10:25:09 2012 +0300 + + Update NEWS for 5.0.4. + +commit 711fa680f552a4003df73b37e6dc4d6e00b47bcd +Author: Lasse Collin +Date: Mon Jun 18 21:27:47 2012 +0300 + + Docs: Language fix to 01_compress_easy.c. + + Thanks to Jonathan Nieder. + +commit 3d7ab1dc61a75c560828be5df96598388b771456 +Author: Lasse Collin +Date: Thu Jun 14 20:15:30 2012 +0300 + + Fix the top-level Makefile.am for the new example programs. + +commit ef8b8e5f111469b5bc005975f7abb9abbd372b25 +Author: Lasse Collin +Date: Thu Jun 14 10:52:33 2012 +0300 + + Docs: Add new example programs. + + These have more comments than the old examples and + human-readable error messages. More tutorial-like examples + are needed but these are a start. + +commit 75c149bc8045a26f8bc719cb8ed20668dab79091 +Author: Lasse Collin +Date: Thu Jun 14 10:33:27 2012 +0300 + + Docs: Move xz_pipe_comp.c and xz_pipe_decomp.c to doc/examples_old. + + It is good to keep these around to so that if someone has + copied the decompressor bug from xz_pipe_decomp.c he has + an example how to easily fix it. + +commit 456307ebf947a5f50bd995d617b99c1215572308 +Author: Lasse Collin +Date: Thu Jun 14 10:33:01 2012 +0300 + + Docs: Fix a bug in xz_pipe_decomp.c example program. + +commit 4c310b8a29bc257e6ccbd2310f12f258678f3fef +Author: Lasse Collin +Date: Thu May 31 15:53:25 2012 +0300 + + Translations: Update the Italian translation. + + Thanks to Milo Casagrande. + +commit ec32b79366dc47a55ea877589df9e8509ba113a7 +Author: Lasse Collin +Date: Wed May 30 23:15:07 2012 +0300 + + Translations: Update the French translation. + + Thanks to Adrien Nader. + +commit dd06f40e4dd7649525e4f28d890dc238a3aa37e5 +Author: Lasse Collin +Date: Tue May 29 22:26:27 2012 +0300 + + Translations: Update the German translation. + +commit c66808d1f55d0149ed57c536cc9b52e9c8b583bc +Author: Lasse Collin +Date: Tue May 29 22:12:57 2012 +0300 + + Translations: Update Polish translation. + +commit 556c22dfed195c1466b298183b850d6c28544900 +Author: Lasse Collin +Date: Tue May 29 13:10:36 2012 +0300 + + Preliminary NEWS for 5.0.4. + +commit dd13b66bf582f49d3aec36e3410ff8541b7506da +Author: Lasse Collin +Date: Mon May 28 20:42:11 2012 +0300 + + liblzma: Fix possibility of incorrect LZMA_BUF_ERROR. + + lzma_code() could incorrectly return LZMA_BUF_ERROR if + all of the following was true: + + - The caller knows how many bytes of output to expect + and only provides that much output space. + + - When the last output bytes are decoded, the + caller-provided input buffer ends right before + the LZMA2 end of payload marker. So LZMA2 won't + provide more output anymore, but it won't know it + yet and thus won't return LZMA_STREAM_END yet. + + - A BCJ filter is in use and it hasn't left any + unfiltered bytes in the temp buffer. This can happen + with any BCJ filter, but in practice it's more likely + with filters other than the x86 BCJ. + + Another situation where the bug can be triggered happens + if the uncompressed size is zero bytes and no output space + is provided. In this case the decompression can fail even + if the whole input file is given to lzma_code(). + + A similar bug was fixed in XZ Embedded on 2011-09-19. + +commit a0223bf796fdaad51a11ad02c4195c694849cc78 +Author: Lasse Collin +Date: Mon May 28 15:38:32 2012 +0300 + + Update THANKS. + +commit 86e57e4bfefe3fd8e13615c41604165bb2359501 +Author: Lasse Collin +Date: Mon May 28 15:37:43 2012 +0300 + + xz: Don't show a huge number in -vv when memory limit is disabled. + +commit 13e44a94da19d1ef14832ff12d3877a6fd2c54c0 +Author: Lasse Collin +Date: Sun May 27 22:30:17 2012 +0300 + + xz: Document the "summary" lines of --robot -lvv. + + This documents only the columns that are in v5.0. + The new columns added in the master branch aren't + necessarily stable yet. + +commit 2f90345e13ab8fea4de45a4f1caa73ebc63a62e7 +Author: Lasse Collin +Date: Sun May 27 21:53:20 2012 +0300 + + xz: Fix output of verbose --robot --list modes. + + It printed the filename in "filename (x/y)" format + which it obviously shouldn't do in robot mode. + +commit 8d4864f53ffae5d862c691a0b334a6b69bc5366e +Author: Lasse Collin +Date: Thu May 10 21:15:17 2012 +0300 + + Update THANKS. + +commit 35e9c58abb0ce3993da844aaeaa3e7231cd2be8f +Author: Lasse Collin +Date: Thu May 10 21:14:16 2012 +0300 + + Docs: Cleanup line wrapping a bit. + +commit 532b3e4c568a228309b56f95c13435fd078dbe02 +Author: Benno Schulenberg +Date: Tue Mar 13 22:04:04 2012 +0100 + + Fix a few typos and add some missing articles in some documents. + + Also hyphenate several compound adjectives. + + Signed-off-by: Benno Schulenberg + +commit afb6ce8c82ffef8f2505a3759da72a733c7b0b8f +Author: Lasse Collin +Date: Sun Apr 29 11:51:25 2012 +0300 + + Windows: Update notes about static linking with MSVC. + +commit 7c3ba2ed5c3c878d4a14ca549b46dbff60c6d565 +Author: Lasse Collin +Date: Thu Apr 19 15:25:26 2012 +0300 + + liblzma: Remove outdated comments. + +commit f55db9c187651094f43881c49db2b2d9ffee6b80 +Author: Lasse Collin +Date: Thu Apr 19 14:17:52 2012 +0300 + + DOS: Link against DJGPP's libemu to support FPU emulation. + + This way xz should work on 386SX and 486SX. Floating point + only is needed for verbose output in xz. + +commit 203edff4c761dbd7cac76ea66e4eed501c23e7a3 +Author: Lasse Collin +Date: Thu Apr 19 13:58:55 2012 +0300 + + Docs: Update MINIX 3 information in INSTALL. + +commit f0a8f95c215628967b7cf9bd9b0a9e4172f50bb4 +Author: Lasse Collin +Date: Wed Feb 22 14:23:13 2012 +0200 + + Update THANKS. + +commit b7ad23fa78646036c0290cd91eada939c9a31526 +Author: Lasse Collin +Date: Wed Feb 22 14:02:34 2012 +0200 + + Fix exit status of xzgrep when grepping binary files. + + When grepping binary files, grep may exit before it has + read all the input. In this case, gzip -q returns 2 (eating + SIGPIPE), but xz and bzip2 show SIGPIPE as the exit status + (e.g. 141). This causes wrong exit status when grepping + xz- or bzip2-compressed binary files. + + The fix checks for the special exit status that indicates SIGPIPE. + It uses kill -l which should be supported everywhere since it + is in both SUSv2 (1997) and POSIX.1-2008. + + Thanks to James Buren for the bug report. + +commit 4e19fbb04a0035030406482319e264426459eb24 +Author: Lasse Collin +Date: Wed Feb 22 12:08:43 2012 +0200 + + Update THANKS. + +commit c6fa03a427e3d1320794102cee3ff4f5ae00eb36 +Author: Lasse Collin +Date: Thu May 24 18:47:52 2012 +0300 + + Fix compiling with IBM XL C on AIX. + +commit 7b6ffc98645e1b3b302b6680be0a901d1ebf7358 +Author: Lasse Collin +Date: Thu May 24 18:37:08 2012 +0300 + + Build: Upgrade m4/acx_pthread.m4 to the latest version. + + It was renamed to ax_pthread.m4 in Autoconf Archive. + +commit bfac2be5023994fcc53de2844e7dd3af61910dc2 +Author: Lasse Collin +Date: Tue Jan 10 17:13:03 2012 +0200 + + Tests: Fix a compiler warning with _FORTIFY_SOURCE. + + Reported here: + http://sourceforge.net/projects/lzmautils/forums/forum/708858/topic/4927385 + +commit df85e156716a4eecb7e2978691f03f729444d998 +Author: Lasse Collin +Date: Mon Dec 19 21:21:29 2011 +0200 + + Docs: Explain the stable releases better in README. + +commit d06d32f108c8278c25c24b2e8666bda7b2ec23b5 +Author: Lasse Collin +Date: Fri Nov 4 17:57:16 2011 +0200 + + xz: Fix a typo in a comment. + + Thanks to Bela Lubkin. + +commit 636fdcfbf542f1e84db2c4736004d84be4b12c84 +Author: Lasse Collin +Date: Thu Nov 3 17:08:02 2011 +0200 + + Update THANKS. + +commit 55fd02f83ecd6cbd6925a3e8a3d43b8d4ef2a17c +Author: Lasse Collin +Date: Thu Nov 3 17:07:22 2011 +0200 + + xz: Fix xz on EBCDIC systems. + + Thanks to Chris Donawa. + +commit 4052f36053b931bad847a36aabf1a07d0034e297 +Author: Lasse Collin +Date: Tue Sep 6 12:03:41 2011 +0300 + + Build: Fix "make check" on Windows. + +commit 0f25758459c74c366a73f35d47ee12b75890bb79 +Author: Lasse Collin +Date: Tue Aug 9 21:19:13 2011 +0300 + + Update THANKS. + +commit 70f03b51ffcb783646b20de8d97b6986c4280eec +Author: Lasse Collin +Date: Tue Aug 9 21:16:44 2011 +0300 + + Workaround unusual SIZE_MAX on SCO OpenServer. + +commit f138bdf76a70029e8360062a0b227936b83b24c9 +Author: Lasse Collin +Date: Sat Aug 6 20:37:28 2011 +0300 + + Run the scripts with the correct shell in test_scripts.sh. + + The scripts are now made executable in the build tree. + This way the scripts can be run like programs in + test_scripts.sh. Previously test_scripts.sh always + used sh but it's not correct if @POSIX_SHELL@ is set + to something else by configure. + + Thanks to Jonathan Nieder for the patch. + +commit 2c144a0365c84dbf1b6722466746d42f2563a319 +Author: Lasse Collin +Date: Sun Jul 31 11:01:47 2011 +0300 + + Fix exit status of "xzdiff foo.xz bar.xz". + + xzdiff was clobbering the exit status from diff in a case + statement used to analyze the exit statuses from "xz" when + its operands were two compressed files. Save and restore + diff's exit status to fix this. + + The bug is inherited from zdiff in GNU gzip and was fixed + there on 2009-10-09. + + Thanks to Jonathan Nieder for the patch and + to Peter Pallinger for reporting the bug. + commit edf339227a966f24aebe1845fcca9429b8f6e318 Author: Anders F Bjorklund Date: Fri Nov 5 12:56:11 2010 +0100 Modified: vendor/xz/dist/README ============================================================================== --- vendor/xz/dist/README Fri Dec 21 20:46:58 2012 (r244558) +++ vendor/xz/dist/README Fri Dec 21 20:47:57 2012 (r244559) @@ -5,7 +5,7 @@ XZ Utils 0. Overview 1. Documentation 1.1. Overall documentation - 1.2. Documentation for command line tools + 1.2. Documentation for command-line tools 1.3. Documentation for liblzma 2. Version numbering 3. Reporting bugs @@ -17,21 +17,21 @@ XZ Utils 0. Overview ----------- - XZ Utils provide a general-purpose data compression library and - command line tools. The native file format is the .xz format, but + XZ Utils provide a general-purpose data-compression library plus + command-line tools. The native file format is the .xz format, but also the legacy .lzma format is supported. The .xz format supports - multiple compression algorithms, which are called "filters" in + multiple compression algorithms, which are called "filters" in the context of XZ Utils. The primary filter is currently LZMA2. With typical files, XZ Utils create about 30 % smaller files than gzip. To ease adapting support for the .xz format into existing applications and scripts, the API of liblzma is somewhat similar to the API of the - popular zlib library. For the same reason, the command line tool xz - has similar command line syntax than that of gzip. + popular zlib library. For the same reason, the command-line tool xz + has a command-line syntax similar to that of gzip. - When aiming for the highest compression ratio, LZMA2 encoder uses + When aiming for the highest compression ratio, the LZMA2 encoder uses a lot of CPU time and may use, depending on the settings, even - hundreds of megabytes of RAM. However, in fast modes, LZMA2 encoder + hundreds of megabytes of RAM. However, in fast modes, the LZMA2 encoder competes with bzip2 in compression speed, RAM usage, and compression ratio. @@ -44,8 +44,8 @@ XZ Utils since that needs to be done only once to benefit many people. With some file types, combining (or "chaining") LZMA2 with an - additional filter can improve compression ratio. A filter chain may - contain up to four filters, although usually only one two is used. + additional filter can improve the compression ratio. A filter chain may + contain up to four filters, although usually only one or two are used. For example, putting a BCJ (Branch/Call/Jump) filter before LZMA2 in the filter chain can improve compression ratio of executable files. @@ -88,9 +88,9 @@ XZ Utils packages. -1.2. Documentation for command line tools +1.2. Documentation for command-line tools - The command line tools are documented as man pages. In source code + The command-line tools are documented as man pages. In source code releases (and possibly also in some binary packages), the man pages are also provided in plain text (ASCII only) and PDF formats in the directory "doc/man" to make the man pages more accessible to those @@ -109,8 +109,8 @@ XZ Utils written yet. For now, if you have never used liblzma, libbzip2, or zlib, I - recommend learning *basics* of zlib API. Once you know that, it - should be easier to learn liblzma. + recommend learning the *basics* of the zlib API. Once you know that, + it should be easier to learn liblzma. http://zlib.net/manual.html http://zlib.net/zlib_how.html @@ -124,23 +124,27 @@ XZ Utils - X is the major version. When this is incremented, the library API and ABI break. - - Y is the minor version. It is incremented when new features are - added without breaking existing API or ABI. Even Y indicates - stable release and odd Y indicates unstable (alpha or beta - version). + - Y is the minor version. It is incremented when new features + are added without breaking the existing API or ABI. An even Y + indicates a stable release and an odd Y indicates unstable + (alpha or beta version). - - Z is the revision. This has different meaning for stable and + - Z is the revision. This has a different meaning for stable and unstable releases: + * Stable: Z is incremented when bugs get fixed without adding - any new features. + any new features. This is intended to be convenient for + downstream distributors that want bug fixes but don't want + any new features to minimize the risk of introducing new bugs. + * Unstable: Z is just a counter. API or ABI of features added in earlier unstable releases having the same X.Y may break. - S indicates stability of the release. It is missing from the - stable releases where Y is an even number. When Y is odd, S + stable releases, where Y is an even number. When Y is odd, S is either "alpha" or "beta" to make it very clear that such versions are not stable releases. The same X.Y.Z combination is - not used for more than one stability level i.e. after X.Y.Zalpha, + not used for more than one stability level, i.e. after X.Y.Zalpha, the next version can be X.Y.(Z+1)beta but not X.Y.Zbeta. @@ -176,7 +180,7 @@ XZ Utils Don't send core dump files or any executables. If you have a small example file(s) (total size less than 256 KiB), please include it/them as an attachment. If you have bigger test files, put them - online somewhere and include an URL to the file(s) in the bug report. + online somewhere and include a URL to the file(s) in the bug report. Always include the exact version number of XZ Utils in the bug report. If you are using a snapshot from the git repository, use "git describe" @@ -193,7 +197,7 @@ XZ Utils The messages from the xz tool have been translated into a few languages. Before starting to translate into a new language, ask - the author that someone else hasn't already started working on it. + the author whether someone else hasn't already started working on it. Test your translation. Testing includes comparing the translated output to the original English version by running the same commands @@ -214,7 +218,7 @@ XZ Utils Note especially the following: - The output of --help and --long-help must look nice on - a 80-column terminal. It's OK to add extra lines if needed. + an 80-column terminal. It's OK to add extra lines if needed. - In contrast, don't add extra lines to error messages and such. They are often preceded with e.g. a filename on the same line, Modified: vendor/xz/dist/THANKS ============================================================================== --- vendor/xz/dist/THANKS Fri Dec 21 20:46:58 2012 (r244558) +++ vendor/xz/dist/THANKS Fri Dec 21 20:47:57 2012 (r244559) @@ -14,16 +14,19 @@ has been important. :-) In alphabetical - Jakub Bogusz - Maarten Bosmans - Trent W. Buck + - James Buren - David Burklund - Daniel Mealha Cabrita - Milo Casagrande - Marek Černocký + - Chris Donawa - Andrew Dudman - Markus Duft - İsmail Dönmez - Robert Elz - Gilles Espinasse - Denis Excoffier + - Michael Felt - Mike Frysinger - Jason Gorski - Juan Manuel Guerrero @@ -38,8 +41,10 @@ has been important. :-) In alphabetical - Peter Lawler - Hin-Tak Leung - Andraž 'ruskie' Levstik + - Cary Lewis - Wim Lewis - Lorenzo De Liso + - Bela Lubkin - Gregory Margo - Jim Meyering - Rafał Mużyło @@ -48,6 +53,7 @@ has been important. :-) In alphabetical - Jonathan Nieder - Andre Noll - Peter O'Gorman + - Peter Pallinger - Igor Pavlov - Diego Elio Pettenò - Elbert Pol @@ -58,6 +64,7 @@ has been important. :-) In alphabetical - Christian von Roques - Jukka Salmi - Alexandre Sauvé + - Benno Schulenberg - Andreas Schwab - Dan Shechter - Stuart Shelton Modified: vendor/xz/dist/po/de.po ============================================================================== --- vendor/xz/dist/po/de.po Fri Dec 21 20:46:58 2012 (r244558) +++ vendor/xz/dist/po/de.po Fri Dec 21 20:47:57 2012 (r244559) @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: XZ Utils 4.999.9beta\n" "Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n" -"POT-Creation-Date: 2010-09-11 17:07+0200\n" +"POT-Creation-Date: 2012-05-29 17:20+0200\n" "PO-Revision-Date: 2010-09-07 20:27+0200\n" "Last-Translator: \n" "Language-Team: German\n" @@ -96,7 +96,7 @@ msgid "%s: File seems to have been moved msgstr "" "%s: Datei scheint umbenannt worden zu sein, daher wird sie nicht gelöscht" -#: src/xz/file_io.c:144 src/xz/file_io.c:590 +#: src/xz/file_io.c:144 src/xz/file_io.c:589 #, c-format msgid "%s: Cannot remove: %s" msgstr "%s: Kann nicht löschen: %s" @@ -126,59 +126,59 @@ msgstr "%s: Überspringe symbolischen Ve msgid "%s: Is a directory, skipping" msgstr "%s: Überspringe Verzeichnis" -#: src/xz/file_io.c:462 +#: src/xz/file_io.c:461 #, c-format msgid "%s: Not a regular file, skipping" msgstr "%s: Keine reguläre Datei, überspringe" -#: src/xz/file_io.c:479 +#: src/xz/file_io.c:478 #, c-format msgid "%s: File has setuid or setgid bit set, skipping" msgstr "%s: Datei hat das setuid oder setgid Bit gesetzt, überspringe" -#: src/xz/file_io.c:486 +#: src/xz/file_io.c:485 #, c-format msgid "%s: File has sticky bit set, skipping" msgstr "%s: Datei hat sticky Bit gesetzt, überspringe" -#: src/xz/file_io.c:493 +#: src/xz/file_io.c:492 #, c-format msgid "%s: Input file has more than one hard link, skipping" msgstr "%s: Eingabedatei hat mehr als einen hard link, überspringe" -#: src/xz/file_io.c:714 +#: src/xz/file_io.c:713 #, c-format msgid "Error restoring the O_APPEND flag to standard output: %s" msgstr "" "Fehler beim Wiederherstellen des O_APPEND flags bei Standard Output: %s" -#: src/xz/file_io.c:726 +#: src/xz/file_io.c:725 #, c-format msgid "%s: Closing the file failed: %s" msgstr "%s: Fehler beim Schießen der Datei: %s" -#: src/xz/file_io.c:762 src/xz/file_io.c:946 +#: src/xz/file_io.c:761 src/xz/file_io.c:945 #, c-format msgid "%s: Seeking failed when trying to create a sparse file: %s" msgstr "" "%s: Positionierungsfehler beim Versuch eine sparse Datei zu erzeugen: %s" -#: src/xz/file_io.c:821 +#: src/xz/file_io.c:820 #, c-format msgid "%s: Read error: %s" msgstr "%s: Lesefehler: %s" -#: src/xz/file_io.c:844 +#: src/xz/file_io.c:843 #, c-format msgid "%s: Error seeking the file: %s" msgstr "%s: Fehler beim Lesen der Dateinamen: %s" -#: src/xz/file_io.c:854 +#: src/xz/file_io.c:853 #, c-format msgid "%s: Unexpected end of file" msgstr "%s: Unerwartetes Ende der Datei" -#: src/xz/file_io.c:904 +#: src/xz/file_io.c:903 #, c-format msgid "%s: Write error: %s" msgstr "%s: Schreibfehler: %s" @@ -212,7 +212,7 @@ msgstr "Kein" #. but the Check ID is known (here 2). This and other "Unknown-N" #. strings are used in tables, so the width must not exceed ten #. columns with a fixed-width font. It's OK to omit the dash if -#. you need space for one extra letter. +#. you need space for one extra letter, but don't use spaces. #: src/xz/list.c:69 msgid "Unknown-2" msgstr "Unbek.2" @@ -275,41 +275,41 @@ msgstr "%s: Zu klein um ein gültiges .x #. to Ratio, the columns are right aligned. Check and Filename #. are left aligned. If you need longer words, it's OK to #. use two lines here. Test with "xz -l foo.xz". -#: src/xz/list.c:612 +#: src/xz/list.c:603 msgid "Strms Blocks Compressed Uncompressed Ratio Check Filename" msgstr " Str. Blöcke Kompr. Unkompr. Verh. Check Dateiname" -#: src/xz/list.c:652 +#: src/xz/list.c:643 #, c-format msgid " Streams: %s\n" msgstr " Ströme: %s\n" -#: src/xz/list.c:654 +#: src/xz/list.c:645 #, c-format msgid " Blocks: %s\n" msgstr " Blöcke: %s\n" -#: src/xz/list.c:656 +#: src/xz/list.c:647 #, c-format msgid " Compressed size: %s\n" msgstr " Größe komprimiert: %s\n" -#: src/xz/list.c:659 +#: src/xz/list.c:650 #, c-format msgid " Uncompressed size: %s\n" msgstr " Größe unkomprimiert: %s\n" -#: src/xz/list.c:662 +#: src/xz/list.c:653 #, c-format msgid " Ratio: %s\n" msgstr " Verhältnis: %s\n" -#: src/xz/list.c:664 +#: src/xz/list.c:655 #, c-format msgid " Check: %s\n" msgstr " Check: %s\n" -#: src/xz/list.c:665 +#: src/xz/list.c:656 #, c-format msgid " Stream padding: %s\n" msgstr " Strom Auffüllung: %s\n" @@ -317,7 +317,7 @@ msgstr " Strom Auffüllung: %s\n" #. TRANSLATORS: The second line is column headings. All except #. Check are right aligned; Check is left aligned. Test with #. "xz -lv foo.xz". -#: src/xz/list.c:693 +#: src/xz/list.c:684 msgid "" " Streams:\n" " Stream Blocks CompOffset UncompOffset CompSize " @@ -329,7 +329,7 @@ msgstr "" #. TRANSLATORS: The second line is column headings. All #. except Check are right aligned; Check is left aligned. -#: src/xz/list.c:748 +#: src/xz/list.c:739 #, c-format msgid "" " Blocks:\n" @@ -347,53 +347,53 @@ msgstr "" #. are right aligned. %*s is replaced with 0-120 #. spaces to make the CheckVal column wide enough. #. Test with "xz -lvv foo.xz". -#: src/xz/list.c:760 +#: src/xz/list.c:751 #, c-format msgid " CheckVal %*s Header Flags CompSize MemUsage Filters" msgstr " CheckWert %*s Kopf Schalter KompGröße Speicher Filter" -#: src/xz/list.c:838 src/xz/list.c:1007 +#: src/xz/list.c:829 src/xz/list.c:998 #, c-format msgid " Memory needed: %s MiB\n" msgstr " Benötigter Speicher: %s MiB\n" -#: src/xz/list.c:840 src/xz/list.c:1009 +#: src/xz/list.c:831 src/xz/list.c:1000 #, c-format msgid " Sizes in headers: %s\n" msgstr " Größe in Köpfen: %s\n" -#: src/xz/list.c:841 src/xz/list.c:1010 +#: src/xz/list.c:832 src/xz/list.c:1001 msgid "Yes" msgstr "Ja" -#: src/xz/list.c:841 src/xz/list.c:1010 +#: src/xz/list.c:832 src/xz/list.c:1001 msgid "No" msgstr "Nein" #. TRANSLATORS: %s is an integer. Only the plural form of this #. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz". -#: src/xz/list.c:986 +#: src/xz/list.c:977 #, c-format msgid "%s file\n" msgid_plural "%s files\n" msgstr[0] "%s Datei\n" msgstr[1] "%s Dateien\n" -#: src/xz/list.c:999 +#: src/xz/list.c:990 msgid "Totals:" msgstr "Gesamt:" -#: src/xz/list.c:1000 +#: src/xz/list.c:991 #, c-format msgid " Number of files: %s\n" msgstr " Anzahl Dateien: %s\n" -#: src/xz/list.c:1072 +#: src/xz/list.c:1063 msgid "--list works only on .xz files (--format=xz or --format=auto)" msgstr "" "--list funktioniert nur mit .xz Dateien (--format=xz oder --format=auto)" -#: src/xz/list.c:1078 +#: src/xz/list.c:1069 msgid "--list does not support reading from standard input" msgstr "--list unterstützt kein Lesen der Standardeingabe" @@ -428,60 +428,73 @@ msgstr "" "Lesen der Standardeingabe ist nicht möglich, wenn die Dateinamen auch von " "der Standardeingabe gelesen werden" -#: src/xz/message.c:800 src/xz/message.c:844 +#. TRANSLATORS: This is the program name in the beginning +#. of the line in messages. Usually it becomes "xz: ". +#. This is a translatable string because French needs +#. a space before a colon. +#: src/xz/message.c:733 +#, c-format +msgid "%s: " +msgstr "" + +#: src/xz/message.c:796 src/xz/message.c:846 msgid "Internal error (bug)" msgstr "Interner Fehler (Bug)" -#: src/xz/message.c:807 +#: src/xz/message.c:803 msgid "Cannot establish signal handlers" msgstr "Kann Signal Routine nicht setzen" -#: src/xz/message.c:816 +#: src/xz/message.c:812 msgid "No integrity check; not verifying file integrity" msgstr "Kein Integritäts-Check; werde Datei-Integrität nicht überprüfen" -#: src/xz/message.c:819 +#: src/xz/message.c:815 msgid "Unsupported type of integrity check; not verifying file integrity" msgstr "" "Typ des Integritäts-Checks nicht unterstützt; werde Datei-Integrität nicht " "überprüfen" -#: src/xz/message.c:826 +#: src/xz/message.c:822 msgid "Memory usage limit reached" msgstr "Speicher-Limit erreicht" -#: src/xz/message.c:829 +#: src/xz/message.c:825 msgid "File format not recognized" msgstr "Datei Format nicht erkannt" -#: src/xz/message.c:832 +#: src/xz/message.c:828 msgid "Unsupported options" msgstr "Optionen nicht unterstützt" -#: src/xz/message.c:835 +#: src/xz/message.c:831 msgid "Compressed data is corrupt" msgstr "Komprimierte Daten sind korrupt" -#: src/xz/message.c:838 +#: src/xz/message.c:834 msgid "Unexpected end of input" msgstr "Unerwartetes Eingabe Ende" -#: src/xz/message.c:886 +#: src/xz/message.c:867 +msgid "%s MiB of memory is required. The limiter is disabled." +msgstr "%s MiB Speicher wird benötigt. Der Begrenzer ist deaktiviert." + +#: src/xz/message.c:895 #, c-format msgid "%s MiB of memory is required. The limit is %s." msgstr "%s MiB Speicher wird benötigt. Limit ist %s." -#: src/xz/message.c:1053 +#: src/xz/message.c:1062 #, c-format msgid "%s: Filter chain: %s\n" msgstr "%s: Filter Kette: %s\n" -#: src/xz/message.c:1063 +#: src/xz/message.c:1072 #, c-format msgid "Try `%s --help' for more information." msgstr "Versuchen Sie `%s --help' für mehr Informationen." -#: src/xz/message.c:1089 +#: src/xz/message.c:1098 #, c-format msgid "" "Usage: %s [OPTION]... [FILE]...\n" @@ -492,18 +505,18 @@ msgstr "" "Komprimiert oder dekomprimiert .xz DATEI(EN).\n" "\n" -#: src/xz/message.c:1096 +#: src/xz/message.c:1105 msgid "" "Mandatory arguments to long options are mandatory for short options too.\n" msgstr "" "Obligatorische Argumente für lange Optionen sind auch für kurze Optionen\n" "zwingend.\n" -#: src/xz/message.c:1100 +#: src/xz/message.c:1109 msgid " Operation mode:\n" msgstr " Operationsmodus:\n" -#: src/xz/message.c:1103 +#: src/xz/message.c:1112 msgid "" " -z, --compress force compression\n" " -d, --decompress force decompression\n" @@ -515,7 +528,7 @@ msgstr "" " -t, --test überprüfe Datei Integrität\n" " -l, --list liste Datei Informationen" -#: src/xz/message.c:1109 +#: src/xz/message.c:1118 msgid "" "\n" " Operation modifiers:\n" @@ -523,7 +536,7 @@ msgstr "" "\n" " Operationsmodifikatoren:\n" -#: src/xz/message.c:1112 +#: src/xz/message.c:1121 msgid "" " -k, --keep keep (don't delete) input files\n" " -f, --force force overwrite of output file and (de)compress links\n" @@ -535,7 +548,7 @@ msgstr "" " -c, --stdout schreibe nach Standard Output und lösche nicht die\n" " Eingabedateien" -#: src/xz/message.c:1118 +#: src/xz/message.c:1127 msgid "" " --no-sparse do not create sparse files when decompressing\n" " -S, --suffix=.SUF use the suffix `.SUF' on compressed files\n" @@ -554,7 +567,7 @@ msgstr "" " --files0=[DATEI] wie --files, aber benutze den Null Charakter als " "Trenner" -#: src/xz/message.c:1126 +#: src/xz/message.c:1135 msgid "" "\n" " Basic file format and compression options:\n" @@ -562,7 +575,7 @@ msgstr "" "\n" " Grundlegende Optionen für Dateiformat und Kompression:\n" -#: src/xz/message.c:1128 +#: src/xz/message.c:1137 msgid "" " -F, --format=FMT file format to encode or decode; possible values are\n" " `auto' (default), `xz', `lzma', and `raw'\n" @@ -578,7 +591,7 @@ msgstr "" "`crc32',\n" " `crc64' (Voreinstellung), oder `sha256'" -#: src/xz/message.c:1135 +#: src/xz/message.c:1144 msgid "" " -0 ... -9 compression preset; default is 6; take compressor " "*and*\n" @@ -591,7 +604,7 @@ msgstr "" "des\n" " Dekomprimierers, wenn Sie 7-9 benutzen!" -#: src/xz/message.c:1139 +#: src/xz/message.c:1148 msgid "" " -e, --extreme try to improve compression ratio by using more CPU " "time;\n" @@ -602,7 +615,7 @@ msgstr "" " verhältnis zu verbessern. Das beeinflusst nicht den\n" " Speicherbedarf des Dekomprimierers." -#: src/xz/message.c:1144 +#: src/xz/message.c:1153 #, no-c-format msgid "" " --memlimit-compress=LIMIT\n" @@ -619,7 +632,7 @@ msgstr "" "RAM,\n" " oder 0 für Grundeinstellungen." -#: src/xz/message.c:1151 +#: src/xz/message.c:1160 msgid "" " --no-adjust if compression settings exceed the memory usage " "limit,\n" @@ -631,7 +644,7 @@ msgstr "" "statt\n" " die Einstellungen nach unten anzupassen." -#: src/xz/message.c:1157 +#: src/xz/message.c:1166 msgid "" "\n" " Custom filter chain for compression (alternative for using presets):" @@ -639,7 +652,7 @@ msgstr "" "\n" " User-definierte Filter Kette für Kompression (alternativ zu Voreinstellung):" -#: src/xz/message.c:1166 +#: src/xz/message.c:1175 msgid "" "\n" " --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero " @@ -683,7 +696,7 @@ msgstr "" " depth=NUM Maximale Suchtiefe; 0=automatisch\n" " (Voreinstellung)" -#: src/xz/message.c:1181 +#: src/xz/message.c:1190 msgid "" "\n" " --x86[=OPTS] x86 BCJ filter (32-bit and 64-bit)\n" @@ -706,7 +719,7 @@ msgstr "" " start=NUM Start-Offset für Konversion\n" " (Voreinstellung=0)" -#: src/xz/message.c:1193 +#: src/xz/message.c:1202 msgid "" "\n" " --delta[=OPTS] Delta filter; valid OPTS (valid values; default):\n" @@ -720,7 +733,7 @@ msgstr "" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 20:48:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DB2254FD; Fri, 21 Dec 2012 20:48:54 +0000 (UTC) (envelope-from mm@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 A63168FC13; Fri, 21 Dec 2012 20:48:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLKmsUj035532; Fri, 21 Dec 2012 20:48:54 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLKms15035531; Fri, 21 Dec 2012 20:48:54 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201212212048.qBLKms15035531@svn.freebsd.org> From: Martin Matuska Date: Fri, 21 Dec 2012 20:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r244560 - vendor/xz/5.0.4 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 20:48:54 -0000 Author: mm Date: Fri Dec 21 20:48:54 2012 New Revision: 244560 URL: http://svnweb.freebsd.org/changeset/base/244560 Log: Tag vendor/xz as version 5.0.4 Added: vendor/xz/5.0.4/ - copied from r244559, vendor/xz/dist/ From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 21:00:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D6DD395B; Fri, 21 Dec 2012 21:00:01 +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 A10D88FC12; Fri, 21 Dec 2012 21:00:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLL01OC037166; Fri, 21 Dec 2012 21:00:01 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLL01qt037156; Fri, 21 Dec 2012 21:00:01 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201212212100.qBLL01qt037156@svn.freebsd.org> From: Brooks Davis Date: Fri, 21 Dec 2012 21:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244562 - in head: contrib/mknod contrib/mtree usr.sbin usr.sbin/nmtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 21:00:01 -0000 Author: brooks Date: Fri Dec 21 21:00:00 2012 New Revision: 244562 URL: http://svnweb.freebsd.org/changeset/base/244562 Log: Add NetBSD's mtree to the tree and install it as nmtree as the first step towards replacing our mtree. Sponsored by: DARPA, AFRL Thanks to: cristos@NetBSD for reviewing and committing my patches wiz@NetBSD for fixing typos in my patches Added: head/contrib/mknod/ - copied from r244548, vendor/NetBSD/mknod/dist/ head/contrib/mtree/ - copied from r244548, vendor/NetBSD/mtree/dist/ head/usr.sbin/nmtree/ head/usr.sbin/nmtree/Makefile (contents, props changed) Modified: head/usr.sbin/Makefile Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Fri Dec 21 20:50:47 2012 (r244561) +++ head/usr.sbin/Makefile Fri Dec 21 21:00:00 2012 (r244562) @@ -55,6 +55,7 @@ SUBDIR= adduser \ nfsdumpstate \ nfsrevoke \ nfsuserd \ + nmtree \ nologin \ pc-sysinstall \ pciconf \ Added: head/usr.sbin/nmtree/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nmtree/Makefile Fri Dec 21 21:00:00 2012 (r244562) @@ -0,0 +1,26 @@ +# $FreeBSD$ + +.include + +.PATH: ${.CURDIR}/../../contrib/mtree + +PROG= nmtree +MAN= nmtree.8 +SRCS= compare.c crc.c create.c excludes.c getid.c misc.c mtree.c \ + spec.c specspec.c verify.c +LDADD+= -lmd -lutil + +CFLAGS+= -I${.CURDIR}/../../contrib/mknod +.PATH: ${.CURDIR}/../../contrib/mknod +SRCS+= pack_dev.c + +CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd +LIBNETBSDDIR= ${.OBJDIR}/../../lib/libnetbsd +LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a +DPADD+= {LIBNETBSD} +LDADD+= ${LIBNETBSD} + +nmtree.8: mtree.8 + cp ${.ALLSRC} ${.TARGET} + +.include From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 21:03:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9A240BF6; Fri, 21 Dec 2012 21:03:35 +0000 (UTC) (envelope-from dteske@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 7CA668FC0A; Fri, 21 Dec 2012 21:03:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLL3ZhY037894; Fri, 21 Dec 2012 21:03:35 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLL3ZQR037893; Fri, 21 Dec 2012 21:03:35 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201212212103.qBLL3ZQR037893@svn.freebsd.org> From: Devin Teske Date: Fri, 21 Dec 2012 21:03:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244563 - head/usr.sbin/bsdconfig/networking/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 21:03:35 -0000 Author: dteske Date: Fri Dec 21 21:03:34 2012 New Revision: 244563 URL: http://svnweb.freebsd.org/changeset/base/244563 Log: Remove unused include. Modified: head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Modified: head/usr.sbin/bsdconfig/networking/share/ipaddr.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Fri Dec 21 21:00:00 2012 (r244562) +++ head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Fri Dec 21 21:03:34 2012 (r244563) @@ -30,7 +30,6 @@ if [ ! "$_NETWORKING_IPADDR_SUBR" ]; the BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 -f_include $BSDCFG_SHARE/sysrc.subr f_include $BSDCFG_SHARE/dialog.subr f_include $BSDCFG_SHARE/strings.subr f_include $BSDCFG_SHARE/networking/common.subr From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 21:33:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A46932DC; Fri, 21 Dec 2012 21:33:48 +0000 (UTC) (envelope-from dteske@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 878528FC13; Fri, 21 Dec 2012 21:33:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLLXmxh042433; Fri, 21 Dec 2012 21:33:48 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLLXmqT042431; Fri, 21 Dec 2012 21:33:48 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201212212133.qBLLXmqT042431@svn.freebsd.org> From: Devin Teske Date: Fri, 21 Dec 2012 21:33:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244565 - head/usr.sbin/bsdconfig/networking/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 21:33:48 -0000 Author: dteske Date: Fri Dec 21 21:33:47 2012 New Revision: 244565 URL: http://svnweb.freebsd.org/changeset/base/244565 Log: Split dialog(1)-based validators for hostname/netmask into two, providing transparent validators that can be used free of dialog(1) where needed. Syntax/return of the original dialog(1)-based validators remains unchanged. Modified: head/usr.sbin/bsdconfig/networking/share/hostname.subr head/usr.sbin/bsdconfig/networking/share/netmask.subr Modified: head/usr.sbin/bsdconfig/networking/share/hostname.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/hostname.subr Fri Dec 21 21:26:36 2012 (r244564) +++ head/usr.sbin/bsdconfig/networking/share/hostname.subr Fri Dec 21 21:33:47 2012 (r244565) @@ -40,7 +40,7 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/inc ############################################################ FUNCTIONS -# f_dialog_validate_hostname $hostname +# f_validate_hostname $hostname # # Returns zero if the given argument (a fully-qualified hostname) is compliant # with standards set-forth in RFC's 952 and 1123 of the Network Working Group: @@ -65,9 +65,9 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/inc # 3 One or more individual labels within the hostname are null. # # If the hostname is determined to be invalid, the appropriate error will be -# displayed using the f_dialog_msgbox function. +# displayed using the f_show_msg function. # -f_dialog_validate_hostname() +f_validate_hostname() { local fqhn="$1" @@ -95,18 +95,51 @@ f_dialog_validate_hostname() done ) +} - # - # Produce an appropriate error message if necessary. - # - local retval=$? - case $retval in +# f_dialog_hnerror $error $hostname +# +# Display a msgbox with the appropriate error message for an error returned by +# the f_validate_hostname function. +# +f_dialog_hnerror() +{ + local error="$1" fqhn="$2" + + [ ${error:-0} -ne 0 ] || return $SUCCESS + + case "$error" in 1) f_show_msg "$msg_hostname_label_contains_invalid_chars" "$fqhn";; 2) f_show_msg "$msg_hostname_label_starts_or_ends_with_hyphen" "$fqhn";; 3) f_show_msg "$msg_hostname_label_is_null" "$fqhn";; 63) f_show_msg "$msg_hostname_label_exceeds_max_length" "$fqhn";; 255) f_show_msg "$msg_hostname_exceeds_max_length" "$fqhn";; esac +} + +# f_dialog_validate_hostname $hostname +# +# Returns zero if the given argument (a fully-qualified hostname) is compliant +# with standards set-forth in RFC's 952 and 1123 of the Network Working Group: +# +# RFC 952 - DoD Internet host table specification +# http://tools.ietf.org/html/rfc952 +# +# RFC 1123 - Requirements for Internet Hosts - Application and Support +# http://tools.ietf.org/html/rfc1123 +# +# If the hostname is determined to be invalid, the appropriate error will be +# displayed using the f_dialog_hnerror function above. +# +f_dialog_validate_hostname() +{ + local fqhn="$1" + + f_validate_hostname "$fqhn" + local retval=$? + + # Produce an appropriate error message if necessary. + [ $retval -eq $SUCCESS ] || f_dialog_hnerror $retval "$fqhn" return $retval } Modified: head/usr.sbin/bsdconfig/networking/share/netmask.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/netmask.subr Fri Dec 21 21:26:36 2012 (r244564) +++ head/usr.sbin/bsdconfig/networking/share/netmask.subr Fri Dec 21 21:33:47 2012 (r244565) @@ -69,7 +69,7 @@ f_ifconfig_netmask() echo $netmask } -# f_dialog_validate_netmask $netmask +# f_validate_netmask $netmask # # Returns zero if the given argument (a subnet mask) is of the proper format. # @@ -85,10 +85,7 @@ f_ifconfig_netmask() # invalid integer (only 0,128,192,224,240,248,252,254,255 are # valid integers). # -# If the subnet mask is determined to be invalid, the appropriate error will be -# displayed using the f_dialog_msgbox function. -# -f_dialog_validate_netmask() +f_validate_netmask() { local mask="$1" @@ -121,18 +118,44 @@ f_dialog_validate_netmask() [ $nfields -eq 4 ] || exit 4 ) +} - # - # Produce an appropriate error message if necessary. - # - local retval=$? - case $retval in +# f_dialog_maskerror $error $netmask +# +# Display a msgbox with the appropriate error message for an error returned by +# the f_validate_netmask function. +# +f_dialog_maskerror() +{ + local error="$1" netmask="$2" + + [ ${error:-0} -ne 0 ] || return $SUCCESS + + case "$error" in 1) f_show_msg "$msg_ipv4_mask_field_contains_invalid_chars" "$mask";; 2) f_show_msg "$msg_ipv4_mask_field_is_null" "$mask";; 3) f_show_msg "$msg_ipv4_mask_field_exceeds_max_value" "$mask";; 4) f_show_msg "$msg_ipv4_mask_field_missing_or_extra" "$mask";; 5) f_show_msg "$msg_ipv4_mask_field_invalid_value" "$mask";; esac +} + +# f_dialog_validate_netmask $netmask +# +# Returns zero if the given argument (a subnet mask) is of the proper format. +# +# If the subnet mask is determined to be invalid, the appropriate error will be +# displayed using the f_dialog_maskerror function above. +# +f_dialog_validate_netmask() +{ + local netmask="$1" + + f_validate_netmask "$netmask" + local retval=$? + + # Produce an appropriate error message if necessary. + [ $retval -eq $SUCCESS ] || f_dialog_maskerror $retval "$netmask" return $retval } From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 21:40:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4C3375E; Fri, 21 Dec 2012 21:40:52 +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 86C638FC19; Fri, 21 Dec 2012 21:40:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLLeqfQ043504; Fri, 21 Dec 2012 21:40:52 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLLeqpU043503; Fri, 21 Dec 2012 21:40:52 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201212212140.qBLLeqpU043503@svn.freebsd.org> From: Mateusz Guzik Date: Fri, 21 Dec 2012 21:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244566 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 21:40:52 -0000 Author: mjg Date: Fri Dec 21 21:40:51 2012 New Revision: 244566 URL: http://svnweb.freebsd.org/changeset/base/244566 Log: MFC r244404: prison_racct_detach can be called for not fully initialized jail, so make it check that the jail has racct before doing anything PR: kern/174436 Modified: stable/9/sys/kern/kern_jail.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_jail.c ============================================================================== --- stable/9/sys/kern/kern_jail.c Fri Dec 21 21:33:47 2012 (r244565) +++ stable/9/sys/kern/kern_jail.c Fri Dec 21 21:40:51 2012 (r244566) @@ -4533,6 +4533,8 @@ prison_racct_detach(struct prison *pr) sx_assert(&allprison_lock, SA_UNLOCKED); + if (pr->pr_prison_racct == NULL) + return; prison_racct_free(pr->pr_prison_racct); pr->pr_prison_racct = NULL; } From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 21:41:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9C2DE8C4; Fri, 21 Dec 2012 21:41:23 +0000 (UTC) (envelope-from hselasky@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 7EFA68FC12; Fri, 21 Dec 2012 21:41:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLLfNC4043629; Fri, 21 Dec 2012 21:41:23 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLLfNQF043628; Fri, 21 Dec 2012 21:41:23 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201212212141.qBLLfNQF043628@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 21 Dec 2012 21:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244567 - head/sys/dev/sound/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 21:41:23 -0000 Author: hselasky Date: Fri Dec 21 21:41:23 2012 New Revision: 244567 URL: http://svnweb.freebsd.org/changeset/base/244567 Log: Reduce stack usage in the USB audio driver by moving some large stack elements to the USB audio softc structure. This fixes a double CPU fault when attaching USB audio devices in 10-current for i386 at least. MFC after: 1 week Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Fri Dec 21 21:40:51 2012 (r244566) +++ head/sys/dev/sound/usb/uaudio.c Fri Dec 21 21:41:23 2012 (r244567) @@ -122,6 +122,7 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, def #define MAKE_WORD(h,l) (((h) << 8) | (l)) #define BIT_TEST(bm,bno) (((bm)[(bno) / 8] >> (7 - ((bno) % 8))) & 1) #define UAUDIO_MAX_CHAN(x) (x) +#define MIX(sc) ((sc)->sc_mixer_node) union uaudio_asid { const struct usb_audio_streaming_interface_descriptor *v1; @@ -283,6 +284,7 @@ struct uaudio_softc { struct uaudio_chan sc_play_chan; struct umidi_chan sc_midi_chan; struct uaudio_search_result sc_mixer_clocks; + struct uaudio_mixer_node sc_mixer_node; struct mtx *sc_mixer_lock; struct usb_device *sc_udev; @@ -2325,149 +2327,148 @@ uaudio_mixer_register_sysctl(struct uaud static void uaudio_mixer_controls_create_ftu(struct uaudio_softc *sc) { - struct uaudio_mixer_node mix; int chx; int chy; - memset(&mix, 0, sizeof(mix)); - mix.wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); - mix.wValue[0] = MAKE_WORD(8, 0); - mix.class = UAC_OUTPUT; - mix.type = MIX_UNSIGNED_16; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.name = "effect"; - mix.minval = 0; - mix.maxval = 7; - mix.mul = 7; - mix.nchan = 1; - mix.update[0] = 1; - strlcpy(mix.desc, "Room1,2,3,Hall1,2,Plate,Delay,Echo", sizeof(mix.desc)); - uaudio_mixer_add_ctl_sub(sc, &mix); + memset(&MIX(sc), 0, sizeof(MIX(sc))); + MIX(sc).wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); + MIX(sc).wValue[0] = MAKE_WORD(8, 0); + MIX(sc).class = UAC_OUTPUT; + MIX(sc).type = MIX_UNSIGNED_16; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).name = "effect"; + MIX(sc).minval = 0; + MIX(sc).maxval = 7; + MIX(sc).mul = 7; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + strlcpy(MIX(sc).desc, "Room1,2,3,Hall1,2,Plate,Delay,Echo", sizeof(MIX(sc).desc)); + uaudio_mixer_add_ctl_sub(sc, &MIX(sc)); - memset(&mix, 0, sizeof(mix)); - mix.wIndex = MAKE_WORD(5, sc->sc_mixer_iface_no); + memset(&MIX(sc), 0, sizeof(MIX(sc))); + MIX(sc).wIndex = MAKE_WORD(5, sc->sc_mixer_iface_no); for (chx = 0; chx != 8; chx++) { for (chy = 0; chy != 8; chy++) { - mix.wValue[0] = MAKE_WORD(chx + 1, chy + 1); - mix.type = MIX_SIGNED_16; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.name = "mix_rec"; - mix.nchan = 1; - mix.update[0] = 1; - mix.val_default = 0; - snprintf(mix.desc, sizeof(mix.desc), + MIX(sc).wValue[0] = MAKE_WORD(chx + 1, chy + 1); + MIX(sc).type = MIX_SIGNED_16; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).name = "mix_rec"; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + MIX(sc).val_default = 0; + snprintf(MIX(sc).desc, sizeof(MIX(sc).desc), "AIn%d - Out%d Record Volume", chy + 1, chx + 1); - uaudio_mixer_add_ctl(sc, &mix); + uaudio_mixer_add_ctl(sc, &MIX(sc)); - mix.wValue[0] = MAKE_WORD(chx + 1, chy + 1 + 8); - mix.type = MIX_SIGNED_16; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.name = "mix_play"; - mix.nchan = 1; - mix.update[0] = 1; - mix.val_default = (chx == chy) ? 2 : 0; - snprintf(mix.desc, sizeof(mix.desc), + MIX(sc).wValue[0] = MAKE_WORD(chx + 1, chy + 1 + 8); + MIX(sc).type = MIX_SIGNED_16; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).name = "mix_play"; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + MIX(sc).val_default = (chx == chy) ? 2 : 0; + snprintf(MIX(sc).desc, sizeof(MIX(sc).desc), "DIn%d - Out%d Playback Volume", chy + 1, chx + 1); - uaudio_mixer_add_ctl(sc, &mix); + uaudio_mixer_add_ctl(sc, &MIX(sc)); } } - memset(&mix, 0, sizeof(mix)); - mix.wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); - mix.wValue[0] = MAKE_WORD(2, 0); - mix.class = UAC_OUTPUT; - mix.type = MIX_SIGNED_8; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.name = "effect_vol"; - mix.nchan = 1; - mix.update[0] = 1; - mix.minval = 0; - mix.maxval = 0x7f; - mix.mul = 0x7f; - mix.nchan = 1; - mix.update[0] = 1; - strlcpy(mix.desc, "Effect Volume", sizeof(mix.desc)); - uaudio_mixer_add_ctl_sub(sc, &mix); - - memset(&mix, 0, sizeof(mix)); - mix.wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); - mix.wValue[0] = MAKE_WORD(3, 0); - mix.class = UAC_OUTPUT; - mix.type = MIX_SIGNED_16; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.name = "effect_dur"; - mix.nchan = 1; - mix.update[0] = 1; - mix.minval = 0; - mix.maxval = 0x7f00; - mix.mul = 0x7f00; - mix.nchan = 1; - mix.update[0] = 1; - strlcpy(mix.desc, "Effect Duration", sizeof(mix.desc)); - uaudio_mixer_add_ctl_sub(sc, &mix); - - memset(&mix, 0, sizeof(mix)); - mix.wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); - mix.wValue[0] = MAKE_WORD(4, 0); - mix.class = UAC_OUTPUT; - mix.type = MIX_SIGNED_8; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.name = "effect_fb"; - mix.nchan = 1; - mix.update[0] = 1; - mix.minval = 0; - mix.maxval = 0x7f; - mix.mul = 0x7f; - mix.nchan = 1; - mix.update[0] = 1; - strlcpy(mix.desc, "Effect Feedback Volume", sizeof(mix.desc)); - uaudio_mixer_add_ctl_sub(sc, &mix); + memset(&MIX(sc), 0, sizeof(MIX(sc))); + MIX(sc).wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); + MIX(sc).wValue[0] = MAKE_WORD(2, 0); + MIX(sc).class = UAC_OUTPUT; + MIX(sc).type = MIX_SIGNED_8; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).name = "effect_vol"; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + MIX(sc).minval = 0; + MIX(sc).maxval = 0x7f; + MIX(sc).mul = 0x7f; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + strlcpy(MIX(sc).desc, "Effect Volume", sizeof(MIX(sc).desc)); + uaudio_mixer_add_ctl_sub(sc, &MIX(sc)); + + memset(&MIX(sc), 0, sizeof(MIX(sc))); + MIX(sc).wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); + MIX(sc).wValue[0] = MAKE_WORD(3, 0); + MIX(sc).class = UAC_OUTPUT; + MIX(sc).type = MIX_SIGNED_16; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).name = "effect_dur"; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + MIX(sc).minval = 0; + MIX(sc).maxval = 0x7f00; + MIX(sc).mul = 0x7f00; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + strlcpy(MIX(sc).desc, "Effect Duration", sizeof(MIX(sc).desc)); + uaudio_mixer_add_ctl_sub(sc, &MIX(sc)); + + memset(&MIX(sc), 0, sizeof(MIX(sc))); + MIX(sc).wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); + MIX(sc).wValue[0] = MAKE_WORD(4, 0); + MIX(sc).class = UAC_OUTPUT; + MIX(sc).type = MIX_SIGNED_8; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).name = "effect_fb"; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + MIX(sc).minval = 0; + MIX(sc).maxval = 0x7f; + MIX(sc).mul = 0x7f; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + strlcpy(MIX(sc).desc, "Effect Feedback Volume", sizeof(MIX(sc).desc)); + uaudio_mixer_add_ctl_sub(sc, &MIX(sc)); - memset(&mix, 0, sizeof(mix)); - mix.wIndex = MAKE_WORD(7, sc->sc_mixer_iface_no); + memset(&MIX(sc), 0, sizeof(MIX(sc))); + MIX(sc).wIndex = MAKE_WORD(7, sc->sc_mixer_iface_no); for (chy = 0; chy != 4; chy++) { - mix.wValue[0] = MAKE_WORD(7, chy + 1); - mix.type = MIX_SIGNED_16; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.name = "effect_ret"; - mix.nchan = 1; - mix.update[0] = 1; - snprintf(mix.desc, sizeof(mix.desc), + MIX(sc).wValue[0] = MAKE_WORD(7, chy + 1); + MIX(sc).type = MIX_SIGNED_16; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).name = "effect_ret"; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + snprintf(MIX(sc).desc, sizeof(MIX(sc).desc), "Effect Return %d Volume", chy + 1); - uaudio_mixer_add_ctl(sc, &mix); + uaudio_mixer_add_ctl(sc, &MIX(sc)); } - memset(&mix, 0, sizeof(mix)); - mix.wIndex = MAKE_WORD(5, sc->sc_mixer_iface_no); + memset(&MIX(sc), 0, sizeof(MIX(sc))); + MIX(sc).wIndex = MAKE_WORD(5, sc->sc_mixer_iface_no); for (chy = 0; chy != 8; chy++) { - mix.wValue[0] = MAKE_WORD(9, chy + 1); - mix.type = MIX_SIGNED_16; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.name = "effect_send"; - mix.nchan = 1; - mix.update[0] = 1; - snprintf(mix.desc, sizeof(mix.desc), + MIX(sc).wValue[0] = MAKE_WORD(9, chy + 1); + MIX(sc).type = MIX_SIGNED_16; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).name = "effect_send"; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + snprintf(MIX(sc).desc, sizeof(MIX(sc).desc), "Effect Send AIn%d Volume", chy + 1); - uaudio_mixer_add_ctl(sc, &mix); + uaudio_mixer_add_ctl(sc, &MIX(sc)); - mix.wValue[0] = MAKE_WORD(9, chy + 1); - mix.type = MIX_SIGNED_16; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.name = "effect_send"; - mix.nchan = 1; - mix.update[0] = 1; - snprintf(mix.desc, sizeof(mix.desc), + MIX(sc).wValue[0] = MAKE_WORD(9, chy + 1); + MIX(sc).type = MIX_SIGNED_16; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).name = "effect_send"; + MIX(sc).nchan = 1; + MIX(sc).update[0] = 1; + snprintf(MIX(sc).desc, sizeof(MIX(sc).desc), "Effect Send DIn%d Volume", chy + 1 + 8); - uaudio_mixer_add_ctl(sc, &mix); + uaudio_mixer_add_ctl(sc, &MIX(sc)); } } @@ -2593,8 +2594,6 @@ static void uaudio_mixer_add_mixer(struct uaudio_softc *sc, const struct uaudio_terminal_node *iot, int id) { - struct uaudio_mixer_node mix; - const struct usb_audio_mixer_unit_0 *d0 = iot[id].u.mu_v1; const struct usb_audio_mixer_unit_1 *d1; @@ -2628,11 +2627,11 @@ uaudio_mixer_add_mixer(struct uaudio_sof DPRINTFN(3, "ichs=%d ochs=%d\n", ichs, ochs); - memset(&mix, 0, sizeof(mix)); + memset(&MIX(sc), 0, sizeof(MIX(sc))); - mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); - uaudio_mixer_determine_class(&iot[id], &mix); - mix.type = MIX_SIGNED_16; + MIX(sc).wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); + uaudio_mixer_determine_class(&iot[id], &MIX(sc)); + MIX(sc).type = MIX_SIGNED_16; if (uaudio_mixer_verify_desc(d0, ((ichs * ochs) + 7) / 8) == NULL) return; @@ -2660,11 +2659,11 @@ uaudio_mixer_add_mixer(struct uaudio_sof for (o = 0; o < ochs; o++) { bno = ((p + c) * ochs) + o; if (BIT_TEST(d1->bmControls, bno)) - mix.wValue[mc++] = MAKE_WORD(p + c + 1, o + 1); + MIX(sc).wValue[mc++] = MAKE_WORD(p + c + 1, o + 1); } } - mix.nchan = chs; - uaudio_mixer_add_ctl(sc, &mix); + MIX(sc).nchan = chs; + uaudio_mixer_add_ctl(sc, &MIX(sc)); } p += chs; } @@ -2674,8 +2673,6 @@ static void uaudio20_mixer_add_mixer(struct uaudio_softc *sc, const struct uaudio_terminal_node *iot, int id) { - struct uaudio_mixer_node mix; - const struct usb_audio20_mixer_unit_0 *d0 = iot[id].u.mu_v2; const struct usb_audio20_mixer_unit_1 *d1; @@ -2709,11 +2706,11 @@ uaudio20_mixer_add_mixer(struct uaudio_s DPRINTFN(3, "ichs=%d ochs=%d\n", ichs, ochs); - memset(&mix, 0, sizeof(mix)); + memset(&MIX(sc), 0, sizeof(MIX(sc))); - mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); - uaudio20_mixer_determine_class(&iot[id], &mix); - mix.type = MIX_SIGNED_16; + MIX(sc).wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); + uaudio20_mixer_determine_class(&iot[id], &MIX(sc)); + MIX(sc).type = MIX_SIGNED_16; if (uaudio20_mixer_verify_desc(d0, ((ichs * ochs) + 7) / 8) == NULL) return; @@ -2741,11 +2738,11 @@ uaudio20_mixer_add_mixer(struct uaudio_s for (o = 0; o < ochs; o++) { bno = ((p + c) * ochs) + o; if (BIT_TEST(d1->bmControls, bno)) - mix.wValue[mc++] = MAKE_WORD(p + c + 1, o + 1); + MIX(sc).wValue[mc++] = MAKE_WORD(p + c + 1, o + 1); } } - mix.nchan = chs; - uaudio_mixer_add_ctl(sc, &mix); + MIX(sc).nchan = chs; + uaudio_mixer_add_ctl(sc, &MIX(sc)); } p += chs; } @@ -2756,7 +2753,6 @@ uaudio_mixer_add_selector(struct uaudio_ const struct uaudio_terminal_node *iot, int id) { const struct usb_audio_selector_unit *d = iot[id].u.su_v1; - struct uaudio_mixer_node mix; uint16_t i; DPRINTFN(3, "bUnitId=%d bNrInPins=%d\n", @@ -2765,41 +2761,41 @@ uaudio_mixer_add_selector(struct uaudio_ if (d->bNrInPins == 0) return; - memset(&mix, 0, sizeof(mix)); + memset(&MIX(sc), 0, sizeof(MIX(sc))); - mix.wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); - mix.wValue[0] = MAKE_WORD(0, 0); - uaudio_mixer_determine_class(&iot[id], &mix); - mix.nchan = 1; - mix.type = MIX_SELECTOR; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.minval = 1; - mix.maxval = d->bNrInPins; - mix.name = "selector"; + MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); + MIX(sc).wValue[0] = MAKE_WORD(0, 0); + uaudio_mixer_determine_class(&iot[id], &MIX(sc)); + MIX(sc).nchan = 1; + MIX(sc).type = MIX_SELECTOR; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).minval = 1; + MIX(sc).maxval = d->bNrInPins; + MIX(sc).name = "selector"; i = d->baSourceId[d->bNrInPins]; if (i == 0 || usbd_req_get_string_any(sc->sc_udev, NULL, - mix.desc, sizeof(mix.desc), i) != 0) { - mix.desc[0] = 0; + MIX(sc).desc, sizeof(MIX(sc).desc), i) != 0) { + MIX(sc).desc[0] = 0; } - if (mix.maxval > MAX_SELECTOR_INPUT_PIN) { - mix.maxval = MAX_SELECTOR_INPUT_PIN; + if (MIX(sc).maxval > MAX_SELECTOR_INPUT_PIN) { + MIX(sc).maxval = MAX_SELECTOR_INPUT_PIN; } - mix.mul = (mix.maxval - mix.minval); + MIX(sc).mul = (MIX(sc).maxval - MIX(sc).minval); for (i = 0; i < MAX_SELECTOR_INPUT_PIN; i++) { - mix.slctrtype[i] = SOUND_MIXER_NRDEVICES; + MIX(sc).slctrtype[i] = SOUND_MIXER_NRDEVICES; } - for (i = 0; i < mix.maxval; i++) { - mix.slctrtype[i] = uaudio_mixer_feature_name( - &iot[d->baSourceId[i]], &mix); + for (i = 0; i < MIX(sc).maxval; i++) { + MIX(sc).slctrtype[i] = uaudio_mixer_feature_name( + &iot[d->baSourceId[i]], &MIX(sc)); } - mix.class = 0; /* not used */ + MIX(sc).class = 0; /* not used */ - uaudio_mixer_add_ctl(sc, &mix); + uaudio_mixer_add_ctl(sc, &MIX(sc)); } static void @@ -2807,7 +2803,6 @@ uaudio20_mixer_add_selector(struct uaudi const struct uaudio_terminal_node *iot, int id) { const struct usb_audio20_selector_unit *d = iot[id].u.su_v2; - struct uaudio_mixer_node mix; uint16_t i; DPRINTFN(3, "bUnitId=%d bNrInPins=%d\n", @@ -2816,40 +2811,40 @@ uaudio20_mixer_add_selector(struct uaudi if (d->bNrInPins == 0) return; - memset(&mix, 0, sizeof(mix)); + memset(&MIX(sc), 0, sizeof(MIX(sc))); - mix.wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); - mix.wValue[0] = MAKE_WORD(0, 0); - uaudio20_mixer_determine_class(&iot[id], &mix); - mix.nchan = 1; - mix.type = MIX_SELECTOR; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.minval = 1; - mix.maxval = d->bNrInPins; - mix.name = "selector"; + MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); + MIX(sc).wValue[0] = MAKE_WORD(0, 0); + uaudio20_mixer_determine_class(&iot[id], &MIX(sc)); + MIX(sc).nchan = 1; + MIX(sc).type = MIX_SELECTOR; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).minval = 1; + MIX(sc).maxval = d->bNrInPins; + MIX(sc).name = "selector"; i = d->baSourceId[d->bNrInPins]; if (i == 0 || usbd_req_get_string_any(sc->sc_udev, NULL, - mix.desc, sizeof(mix.desc), i) != 0) { - mix.desc[0] = 0; + MIX(sc).desc, sizeof(MIX(sc).desc), i) != 0) { + MIX(sc).desc[0] = 0; } - if (mix.maxval > MAX_SELECTOR_INPUT_PIN) - mix.maxval = MAX_SELECTOR_INPUT_PIN; + if (MIX(sc).maxval > MAX_SELECTOR_INPUT_PIN) + MIX(sc).maxval = MAX_SELECTOR_INPUT_PIN; - mix.mul = (mix.maxval - mix.minval); + MIX(sc).mul = (MIX(sc).maxval - MIX(sc).minval); for (i = 0; i < MAX_SELECTOR_INPUT_PIN; i++) - mix.slctrtype[i] = SOUND_MIXER_NRDEVICES; + MIX(sc).slctrtype[i] = SOUND_MIXER_NRDEVICES; - for (i = 0; i < mix.maxval; i++) { - mix.slctrtype[i] = uaudio20_mixer_feature_name( - &iot[d->baSourceId[i]], &mix); + for (i = 0; i < MIX(sc).maxval; i++) { + MIX(sc).slctrtype[i] = uaudio20_mixer_feature_name( + &iot[d->baSourceId[i]], &MIX(sc)); } - mix.class = 0; /* not used */ + MIX(sc).class = 0; /* not used */ - uaudio_mixer_add_ctl(sc, &mix); + uaudio_mixer_add_ctl(sc, &MIX(sc)); } static uint32_t @@ -2879,7 +2874,6 @@ uaudio_mixer_add_feature(struct uaudio_s const struct uaudio_terminal_node *iot, int id) { const struct usb_audio_feature_unit *d = iot[id].u.fu_v1; - struct uaudio_mixer_node mix; uint32_t fumask; uint32_t mmask; uint32_t cmask; @@ -2892,7 +2886,7 @@ uaudio_mixer_add_feature(struct uaudio_s if (d->bControlSize == 0) return; - memset(&mix, 0, sizeof(mix)); + memset(&MIX(sc), 0, sizeof(MIX(sc))); nchan = (d->bLength - 7) / d->bControlSize; mmask = uaudio_mixer_feature_get_bmaControls(d, 0); @@ -2913,13 +2907,13 @@ uaudio_mixer_add_feature(struct uaudio_s if (nchan > MIX_MAX_CHAN) { nchan = MIX_MAX_CHAN; } - mix.wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); + MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); i = d->bmaControls[d->bControlSize]; if (i == 0 || usbd_req_get_string_any(sc->sc_udev, NULL, - mix.desc, sizeof(mix.desc), i) != 0) { - mix.desc[0] = 0; + MIX(sc).desc, sizeof(MIX(sc).desc), i) != 0) { + MIX(sc).desc[0] = 0; } for (ctl = 1; ctl <= LOUDNESS_CONTROL; ctl++) { @@ -2930,87 +2924,87 @@ uaudio_mixer_add_feature(struct uaudio_s ctl, fumask); if (mmask & fumask) { - mix.nchan = 1; - mix.wValue[0] = MAKE_WORD(ctl, 0); + MIX(sc).nchan = 1; + MIX(sc).wValue[0] = MAKE_WORD(ctl, 0); } else if (cmask & fumask) { - mix.nchan = nchan - 1; + MIX(sc).nchan = nchan - 1; for (i = 1; i < nchan; i++) { if (uaudio_mixer_feature_get_bmaControls(d, i) & fumask) - mix.wValue[i - 1] = MAKE_WORD(ctl, i); + MIX(sc).wValue[i - 1] = MAKE_WORD(ctl, i); else - mix.wValue[i - 1] = -1; + MIX(sc).wValue[i - 1] = -1; } } else { continue; } - mixernumber = uaudio_mixer_feature_name(&iot[id], &mix); + mixernumber = uaudio_mixer_feature_name(&iot[id], &MIX(sc)); switch (ctl) { case MUTE_CONTROL: - mix.type = MIX_ON_OFF; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.name = "mute"; + MIX(sc).type = MIX_ON_OFF; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).name = "mute"; break; case VOLUME_CONTROL: - mix.type = MIX_SIGNED_16; - mix.ctl = mixernumber; - mix.name = "vol"; + MIX(sc).type = MIX_SIGNED_16; + MIX(sc).ctl = mixernumber; + MIX(sc).name = "vol"; break; case BASS_CONTROL: - mix.type = MIX_SIGNED_8; - mix.ctl = SOUND_MIXER_BASS; - mix.name = "bass"; + MIX(sc).type = MIX_SIGNED_8; + MIX(sc).ctl = SOUND_MIXER_BASS; + MIX(sc).name = "bass"; break; case MID_CONTROL: - mix.type = MIX_SIGNED_8; - mix.ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ - mix.name = "mid"; + MIX(sc).type = MIX_SIGNED_8; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ + MIX(sc).name = "mid"; break; case TREBLE_CONTROL: - mix.type = MIX_SIGNED_8; - mix.ctl = SOUND_MIXER_TREBLE; - mix.name = "treble"; + MIX(sc).type = MIX_SIGNED_8; + MIX(sc).ctl = SOUND_MIXER_TREBLE; + MIX(sc).name = "treble"; break; case GRAPHIC_EQUALIZER_CONTROL: continue; /* XXX don't add anything */ case AGC_CONTROL: - mix.type = MIX_ON_OFF; - mix.ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ - mix.name = "agc"; + MIX(sc).type = MIX_ON_OFF; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ + MIX(sc).name = "agc"; break; case DELAY_CONTROL: - mix.type = MIX_UNSIGNED_16; - mix.ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ - mix.name = "delay"; + MIX(sc).type = MIX_UNSIGNED_16; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ + MIX(sc).name = "delay"; break; case BASS_BOOST_CONTROL: - mix.type = MIX_ON_OFF; - mix.ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ - mix.name = "boost"; + MIX(sc).type = MIX_ON_OFF; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ + MIX(sc).name = "boost"; break; case LOUDNESS_CONTROL: - mix.type = MIX_ON_OFF; - mix.ctl = SOUND_MIXER_LOUD; /* Is this correct ? */ - mix.name = "loudness"; + MIX(sc).type = MIX_ON_OFF; + MIX(sc).ctl = SOUND_MIXER_LOUD; /* Is this correct ? */ + MIX(sc).name = "loudness"; break; default: - mix.type = MIX_UNKNOWN; + MIX(sc).type = MIX_UNKNOWN; break; } - if (mix.type != MIX_UNKNOWN) - uaudio_mixer_add_ctl(sc, &mix); + if (MIX(sc).type != MIX_UNKNOWN) + uaudio_mixer_add_ctl(sc, &MIX(sc)); } } @@ -3019,7 +3013,6 @@ uaudio20_mixer_add_feature(struct uaudio const struct uaudio_terminal_node *iot, int id) { const struct usb_audio20_feature_unit *d = iot[id].u.fu_v2; - struct uaudio_mixer_node mix; uint32_t ctl; uint32_t mmask; uint32_t cmask; @@ -3032,7 +3025,7 @@ uaudio20_mixer_add_feature(struct uaudio if (UGETDW(d->bmaControls[0]) == 0) return; - memset(&mix, 0, sizeof(mix)); + memset(&MIX(sc), 0, sizeof(MIX(sc))); nchan = (d->bLength - 6) / 4; mmask = UGETDW(d->bmaControls[0]); @@ -3049,84 +3042,84 @@ uaudio20_mixer_add_feature(struct uaudio if (nchan > MIX_MAX_CHAN) nchan = MIX_MAX_CHAN; - mix.wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); + MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); i = d->bmaControls[nchan][0]; if (i == 0 || usbd_req_get_string_any(sc->sc_udev, NULL, - mix.desc, sizeof(mix.desc), i) != 0) { - mix.desc[0] = 0; + MIX(sc).desc, sizeof(MIX(sc).desc), i) != 0) { + MIX(sc).desc[0] = 0; } for (ctl = 3; ctl != 0; ctl <<= 2) { - mixernumber = uaudio20_mixer_feature_name(&iot[id], &mix); + mixernumber = uaudio20_mixer_feature_name(&iot[id], &MIX(sc)); switch (ctl) { case (3 << 0): - mix.type = MIX_ON_OFF; - mix.ctl = SOUND_MIXER_NRDEVICES; - mix.name = "mute"; + MIX(sc).type = MIX_ON_OFF; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).name = "mute"; what = MUTE_CONTROL; break; case (3 << 2): - mix.type = MIX_SIGNED_16; - mix.ctl = mixernumber; - mix.name = "vol"; + MIX(sc).type = MIX_SIGNED_16; + MIX(sc).ctl = mixernumber; + MIX(sc).name = "vol"; what = VOLUME_CONTROL; break; case (3 << 4): - mix.type = MIX_SIGNED_8; - mix.ctl = SOUND_MIXER_BASS; - mix.name = "bass"; + MIX(sc).type = MIX_SIGNED_8; + MIX(sc).ctl = SOUND_MIXER_BASS; + MIX(sc).name = "bass"; what = BASS_CONTROL; break; case (3 << 6): - mix.type = MIX_SIGNED_8; - mix.ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ - mix.name = "mid"; + MIX(sc).type = MIX_SIGNED_8; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ + MIX(sc).name = "mid"; what = MID_CONTROL; break; case (3 << 8): - mix.type = MIX_SIGNED_8; - mix.ctl = SOUND_MIXER_TREBLE; - mix.name = "treble"; + MIX(sc).type = MIX_SIGNED_8; + MIX(sc).ctl = SOUND_MIXER_TREBLE; + MIX(sc).name = "treble"; what = TREBLE_CONTROL; break; case (3 << 12): - mix.type = MIX_ON_OFF; - mix.ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ - mix.name = "agc"; + MIX(sc).type = MIX_ON_OFF; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ + MIX(sc).name = "agc"; what = AGC_CONTROL; break; case (3 << 14): - mix.type = MIX_UNSIGNED_16; - mix.ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ - mix.name = "delay"; + MIX(sc).type = MIX_UNSIGNED_16; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ + MIX(sc).name = "delay"; what = DELAY_CONTROL; break; case (3 << 16): - mix.type = MIX_ON_OFF; - mix.ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ - mix.name = "boost"; + MIX(sc).type = MIX_ON_OFF; + MIX(sc).ctl = SOUND_MIXER_NRDEVICES; /* XXXXX */ + MIX(sc).name = "boost"; what = BASS_BOOST_CONTROL; break; case (3 << 18): - mix.type = MIX_ON_OFF; - mix.ctl = SOUND_MIXER_LOUD; /* Is this correct ? */ - mix.name = "loudness"; + MIX(sc).type = MIX_ON_OFF; + MIX(sc).ctl = SOUND_MIXER_LOUD; /* Is this correct ? */ + MIX(sc).name = "loudness"; what = LOUDNESS_CONTROL; break; case (3 << 20): - mix.type = MIX_SIGNED_16; - mix.ctl = mixernumber; - mix.name = "igain"; + MIX(sc).type = MIX_SIGNED_16; + MIX(sc).ctl = mixernumber; + MIX(sc).name = "igain"; what = INPUT_GAIN_CONTROL; break; case (3 << 22): - mix.type = MIX_SIGNED_16; - mix.ctl = mixernumber; - mix.name = "igainpad"; + MIX(sc).type = MIX_SIGNED_16; + MIX(sc).ctl = mixernumber; + MIX(sc).name = "igainpad"; what = INPUT_GAIN_PAD_CONTROL; break; default: @@ -3134,22 +3127,22 @@ uaudio20_mixer_add_feature(struct uaudio } if ((mmask & ctl) == ctl) { - mix.nchan = 1; - mix.wValue[0] = MAKE_WORD(what, 0); + MIX(sc).nchan = 1; + MIX(sc).wValue[0] = MAKE_WORD(what, 0); } else if ((cmask & ctl) == ctl) { - mix.nchan = nchan - 1; + MIX(sc).nchan = nchan - 1; for (i = 1; i < nchan; i++) { if ((UGETDW(d->bmaControls[i]) & ctl) == ctl) - mix.wValue[i - 1] = MAKE_WORD(what, i); + MIX(sc).wValue[i - 1] = MAKE_WORD(what, i); else - mix.wValue[i - 1] = -1; + MIX(sc).wValue[i - 1] = -1; } } else { continue; } - if (mix.type != MIX_UNKNOWN) - uaudio_mixer_add_ctl(sc, &mix); + if (MIX(sc).type != MIX_UNKNOWN) + uaudio_mixer_add_ctl(sc, &MIX(sc)); } } @@ -3159,10 +3152,9 @@ uaudio_mixer_add_processing_updown(struc { const struct usb_audio_processing_unit_0 *d0 = iot[id].u.pu_v1; const struct usb_audio_processing_unit_1 *d1 = - (const void *)(d0->baSourceId + d0->bNrInPins); + (const void *)(d0->baSourceId + d0->bNrInPins); const struct usb_audio_processing_unit_updown *ud = - (const void *)(d1->bmControls + d1->bControlSize); - struct uaudio_mixer_node mix; + (const void *)(d1->bmControls + d1->bControlSize); uint8_t i; if (uaudio_mixer_verify_desc(d0, sizeof(*ud)) == NULL) { @@ -3179,20 +3171,20 @@ uaudio_mixer_add_processing_updown(struc DPRINTF("no mode select\n"); return; } - memset(&mix, 0, sizeof(mix)); + memset(&MIX(sc), 0, sizeof(MIX(sc))); - mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); - mix.nchan = 1; - mix.wValue[0] = MAKE_WORD(UD_MODE_SELECT_CONTROL, 0); - uaudio_mixer_determine_class(&iot[id], &mix); - mix.type = MIX_ON_OFF; /* XXX */ + MIX(sc).wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); + MIX(sc).nchan = 1; + MIX(sc).wValue[0] = MAKE_WORD(UD_MODE_SELECT_CONTROL, 0); + uaudio_mixer_determine_class(&iot[id], &MIX(sc)); + MIX(sc).type = MIX_ON_OFF; /* XXX */ for (i = 0; i < ud->bNrModes; i++) { DPRINTFN(3, "i=%d bm=0x%x\n", i, UGETW(ud->waModes[i])); /* XXX */ } - uaudio_mixer_add_ctl(sc, &mix); + uaudio_mixer_add_ctl(sc, &MIX(sc)); } static void @@ -3201,11 +3193,10 @@ uaudio_mixer_add_processing(struct uaudi { const struct usb_audio_processing_unit_0 *d0 = iot[id].u.pu_v1; const struct usb_audio_processing_unit_1 *d1 = - (const void *)(d0->baSourceId + d0->bNrInPins); - struct uaudio_mixer_node mix; + (const void *)(d0->baSourceId + d0->bNrInPins); uint16_t ptype; - memset(&mix, 0, sizeof(mix)); + memset(&MIX(sc), 0, sizeof(MIX(sc))); ptype = UGETW(d0->wProcessType); @@ -3216,12 +3207,12 @@ uaudio_mixer_add_processing(struct uaudi return; } if (d1->bmControls[0] & UA_PROC_ENABLE_MASK) { - mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); - mix.nchan = 1; - mix.wValue[0] = MAKE_WORD(XX_ENABLE_CONTROL, 0); - uaudio_mixer_determine_class(&iot[id], &mix); - mix.type = MIX_ON_OFF; - uaudio_mixer_add_ctl(sc, &mix); + MIX(sc).wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); + MIX(sc).nchan = 1; + MIX(sc).wValue[0] = MAKE_WORD(XX_ENABLE_CONTROL, 0); + uaudio_mixer_determine_class(&iot[id], &MIX(sc)); + MIX(sc).type = MIX_ON_OFF; + uaudio_mixer_add_ctl(sc, &MIX(sc)); } switch (ptype) { case UPDOWNMIX_PROCESS: @@ -3246,8 +3237,7 @@ uaudio_mixer_add_extension(struct uaudio { const struct usb_audio_extension_unit_0 *d0 = iot[id].u.eu_v1; const struct usb_audio_extension_unit_1 *d1 = - (const void *)(d0->baSourceId + d0->bNrInPins); - struct uaudio_mixer_node mix; + (const void *)(d0->baSourceId + d0->bNrInPins); DPRINTFN(3, "bUnitId=%d bNrInPins=%d\n", d0->bUnitId, d0->bNrInPins); @@ -3260,15 +3250,15 @@ uaudio_mixer_add_extension(struct uaudio } if (d1->bmControls[0] & UA_EXT_ENABLE_MASK) { - memset(&mix, 0, sizeof(mix)); + memset(&MIX(sc), 0, sizeof(MIX(sc))); - mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); - mix.nchan = 1; - mix.wValue[0] = MAKE_WORD(UA_EXT_ENABLE, 0); - uaudio_mixer_determine_class(&iot[id], &mix); - mix.type = MIX_ON_OFF; + MIX(sc).wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); + MIX(sc).nchan = 1; + MIX(sc).wValue[0] = MAKE_WORD(UA_EXT_ENABLE, 0); + uaudio_mixer_determine_class(&iot[id], &MIX(sc)); + MIX(sc).type = MIX_ON_OFF; - uaudio_mixer_add_ctl(sc, &mix); + uaudio_mixer_add_ctl(sc, &MIX(sc)); } } From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 21:49:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 86C9DB89; Fri, 21 Dec 2012 21:49:15 +0000 (UTC) (envelope-from jim.harris@gmail.com) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id 858DF8FC0C; Fri, 21 Dec 2012 21:49:14 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id hn14so3043763wib.3 for ; Fri, 21 Dec 2012 13:49:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=E7q3Pc8HNwr+BNUIoVCopi6Lt7ZBzIEbEaLHYFf6YEQ=; b=XhN3EoqdmNCXiWDmX8bYfpLraoZPjIFoRa5+OQZv3wtDiZJKTAdnScIWhUeViB76/q rxYn0A4Ts4fdf2TRfgCCtdPWn6gZI8ym/40rm437u5UgjZuI4yFXgPs7JZE6Hhkj00OY mOtFw1ZemEo1wS/cu/h2K+e/DFcjLlmRU68JOHX1ktJa+VDc9yuvWM+zH0dnpPweKfP4 OJR5N4yNN7/rG/8xLQenSNQ/lrVAUHWTGsEGkeCup8+H1Qd6CHc8Lp2oNer9F9DEdCRS I2W7PYsuFp0QFQuoicdJ8Xp4CGadgpe56dVBROdm0/hlrtdSe4vnlSPS4H3FAYXOne/i +pWQ== MIME-Version: 1.0 Received: by 10.180.103.136 with SMTP id fw8mr17778853wib.27.1356126553325; Fri, 21 Dec 2012 13:49:13 -0800 (PST) Received: by 10.217.57.4 with HTTP; Fri, 21 Dec 2012 13:49:13 -0800 (PST) In-Reply-To: <201212211424.16934.jhb@freebsd.org> References: <201212211913.qBLJDmpm019837@svn.freebsd.org> <201212211424.16934.jhb@freebsd.org> Date: Fri, 21 Dec 2012 14:49:13 -0700 Message-ID: Subject: Re: svn commit: r244549 - head/sys/dev/nvme From: Jim Harris To: John Baldwin 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 21:49:15 -0000 On Fri, Dec 21, 2012 at 12:24 PM, John Baldwin wrote: > On Friday, December 21, 2012 2:13:48 pm Jim Harris wrote: > > Author: jimharris > > Date: Fri Dec 21 19:13:48 2012 > > New Revision: 244549 > > URL: http://svnweb.freebsd.org/changeset/base/244549 > > > > Log: > > Put kthreads under curproc so they are attached to nvmecontrol rather > > than pid 0. > > > > Sponsored by: Intel > > Hmm, is this really wise? I'm not sure how well the kernel would handle a > kthread belonging to a userland process. You could just have each test > create a new kproc that holds the associated threads for that test instead > perhaps? > > Just so I'm aware, what sorts of problems might you expect if a kthread belongs to a userland process? I'm not opposed to changing this as you suggest, but would like to know for my own understanding since I haven't observed any problems with it on my system. Another benefit of using kproc here though would be to make it more consistent with pre-8.0 behavior (before kthread_create was renamed to kproc_create). From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 22:21:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 760F25DC; Fri, 21 Dec 2012 22:21: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 412C58FC0A; Fri, 21 Dec 2012 22:21:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLML0rI049790; Fri, 21 Dec 2012 22:21:00 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLML0vS049788; Fri, 21 Dec 2012 22:21:00 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201212212221.qBLML0vS049788@svn.freebsd.org> From: Xin LI Date: Fri, 21 Dec 2012 22:21:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244568 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 22:21:00 -0000 Author: delphij Date: Fri Dec 21 22:20:59 2012 New Revision: 244568 URL: http://svnweb.freebsd.org/changeset/base/244568 Log: - Reduce buffer size from LINE_MAX to PATH_MAX, there is no point to store path longer than this. - Fix an unreached case of check against sizeof buf, which in turn leads to an off-by-one nul byte write on the stack. The original condition can never be satisfied because the passed boundary is the maximum value that can be returned, so code was harmless. MFC after: 1 month Modified: head/lib/libc/gen/check_utility_compat.c Modified: head/lib/libc/gen/check_utility_compat.c ============================================================================== --- head/lib/libc/gen/check_utility_compat.c Fri Dec 21 21:41:23 2012 (r244567) +++ head/lib/libc/gen/check_utility_compat.c Fri Dec 21 22:20:59 2012 (r244568) @@ -35,32 +35,28 @@ __FBSDID("$FreeBSD$"); * are threaded, so I'm not concerned about cancellation points or other * niceties. */ +#include + #include #include #include #include -#ifndef LINE_MAX -#define LINE_MAX _POSIX2_LINE_MAX -#endif - #define _PATH_UTIL_COMPAT "/etc/compat-FreeBSD-4-util" #define _ENV_UTIL_COMPAT "_COMPAT_FreeBSD_4" int check_utility_compat(const char *utility) { - char buf[LINE_MAX]; + char buf[PATH_MAX]; char *p, *bp; int len; if ((p = getenv(_ENV_UTIL_COMPAT)) != NULL) { strlcpy(buf, p, sizeof buf); } else { - if ((len = readlink(_PATH_UTIL_COMPAT, buf, sizeof buf)) < 0) + if ((len = readlink(_PATH_UTIL_COMPAT, buf, sizeof(buf) - 1)) < 0) return 0; - if (len > sizeof buf) - len = sizeof buf; buf[len] = '\0'; } if (buf[0] == '\0') From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 22:48:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 820B19C1; Fri, 21 Dec 2012 22:48:13 +0000 (UTC) (envelope-from melifaro@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 4D8148FC0C; Fri, 21 Dec 2012 22:48:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLMmDIY053572; Fri, 21 Dec 2012 22:48:13 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLMmCuN053570; Fri, 21 Dec 2012 22:48:12 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201212212248.qBLMmCuN053570@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Fri, 21 Dec 2012 22:48:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244569 - stable/9/sys/netpfil/ipfw X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 22:48:13 -0000 Author: melifaro Date: Fri Dec 21 22:48:12 2012 New Revision: 244569 URL: http://svnweb.freebsd.org/changeset/base/244569 Log: Merge r241908, r242632 Remove unnecessary chain read lock in ipfw nat 'global' code. Document case when ipfw chain lock must be held while calling ipfw_nat(). Modified: stable/9/sys/netpfil/ipfw/ip_fw_nat.c stable/9/sys/netpfil/ipfw/ip_fw_private.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netpfil/ipfw/ip_fw_nat.c ============================================================================== --- stable/9/sys/netpfil/ipfw/ip_fw_nat.c Fri Dec 21 22:20:59 2012 (r244568) +++ stable/9/sys/netpfil/ipfw/ip_fw_nat.c Fri Dec 21 22:48:12 2012 (r244569) @@ -202,6 +202,13 @@ add_redir_spool_cfg(char *buf, struct cf } } +/* + * ipfw_nat - perform mbuf header translation. + * + * Note V_layer3_chain has to be locked while calling ipfw_nat() in + * 'global' operation mode (t == NULL). + * + */ static int ipfw_nat(struct ip_fw_args *args, struct cfg_nat *t, struct mbuf *m) { @@ -269,7 +276,7 @@ ipfw_nat(struct ip_fw_args *args, struct found = 0; chain = &V_layer3_chain; - IPFW_RLOCK(chain); + IPFW_RLOCK_ASSERT(chain); /* Check every nat entry... */ LIST_FOREACH(t, &chain->nat, _next) { if ((t->mode & PKT_ALIAS_SKIP_GLOBAL) != 0) @@ -282,7 +289,6 @@ ipfw_nat(struct ip_fw_args *args, struct break; } } - IPFW_RUNLOCK(chain); if (found != 1) { /* No instance found, return ignore */ args->m = mcl; Modified: stable/9/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- stable/9/sys/netpfil/ipfw/ip_fw_private.h Fri Dec 21 22:20:59 2012 (r244568) +++ stable/9/sys/netpfil/ipfw/ip_fw_private.h Fri Dec 21 22:48:12 2012 (r244569) @@ -251,6 +251,7 @@ struct sockopt; /* used by tcp_var.h */ rw_destroy(&(_chain)->uh_lock); \ } while (0) +#define IPFW_RLOCK_ASSERT(_chain) rw_assert(&(_chain)->rwmtx, RA_RLOCKED) #define IPFW_WLOCK_ASSERT(_chain) rw_assert(&(_chain)->rwmtx, RA_WLOCKED) #define IPFW_RLOCK(p) rw_rlock(&(p)->rwmtx) From owner-svn-src-all@FreeBSD.ORG Fri Dec 21 23:47:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D37EC467; Fri, 21 Dec 2012 23:47:22 +0000 (UTC) (envelope-from melifaro@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 B4BEF8FC0C; Fri, 21 Dec 2012 23:47:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBLNlMhe063948; Fri, 21 Dec 2012 23:47:22 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBLNlMXI063945; Fri, 21 Dec 2012 23:47:22 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201212212347.qBLNlMXI063945@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Fri, 21 Dec 2012 23:47:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244571 - stable/9/sys/netpfil/ipfw X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 23:47:22 -0000 Author: melifaro Date: Fri Dec 21 23:47:22 2012 New Revision: 244571 URL: http://svnweb.freebsd.org/changeset/base/244571 Log: Merge r238978(approved by luigi), r242631, r242834, r243707 replace inet_ntoa_r with the more standard inet_ntop(). As discussed on -current, inet_ntoa_r() is non standard, has different arguments in userspace and kernel, and almost unused (no clients in userspace, only net/flowtable.c, net/if_llatbl.c, netinet/in_pcb.c, netinet/tcp_subr.c in the kernel) Use unified print_dyn_rule_flags() function for debugging messages instead of hand-made printfs in every place. Simplify sending keepalives. Prepare ipfw_tick() to be used by other consumers. Make ipfw dynamic states operations SMP-ready. * Global IPFW_DYN_LOCK() is changed to per-bucket mutex. * State expiration is done in ipfw_tick every second. * No expiration is done on forwarding path. * hash table resize is done automatically and does not flush all states. * Dynamic UMA zone is now allocated per each VNET * State limiting is now done via UMA(9) api. Modified: stable/9/sys/netpfil/ipfw/ip_fw2.c stable/9/sys/netpfil/ipfw/ip_fw_dynamic.c stable/9/sys/netpfil/ipfw/ip_fw_log.c stable/9/sys/netpfil/ipfw/ip_fw_private.h stable/9/sys/netpfil/ipfw/ip_fw_sockopt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/9/sys/netpfil/ipfw/ip_fw2.c Fri Dec 21 23:12:34 2012 (r244570) +++ stable/9/sys/netpfil/ipfw/ip_fw2.c Fri Dec 21 23:47:22 2012 (r244571) @@ -2038,7 +2038,7 @@ do { \ f->rulenum, f->id); cmd = ACTION_PTR(f); l = f->cmd_len - f->act_ofs; - ipfw_dyn_unlock(); + ipfw_dyn_unlock(q); cmdlen = 0; match = 1; break; @@ -2523,7 +2523,6 @@ ipfw_init(void) { int error = 0; - ipfw_dyn_attach(); /* * Only print out this stuff the first time around, * when called from the sysinit code. @@ -2577,7 +2576,6 @@ ipfw_destroy(void) { ipfw_log_bpf(0); /* uninit */ - ipfw_dyn_detach(); printf("IP firewall unloaded\n"); } @@ -2635,7 +2633,7 @@ vnet_ipfw_init(const void *unused) chain->id = rule->id = 1; IPFW_LOCK_INIT(chain); - ipfw_dyn_init(); + ipfw_dyn_init(chain); /* First set up some values that are compile time options */ V_ipfw_vnet_ready = 1; /* Open for business */ Modified: stable/9/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/9/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Dec 21 23:12:34 2012 (r244570) +++ stable/9/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Dec 21 23:47:22 2012 (r244571) @@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$"); * The lifetime of dynamic rules is regulated by dyn_*_lifetime, * measured in seconds and depending on the flags. * - * The total number of dynamic rules is stored in dyn_count. + * The total number of dynamic rules is equal to UMA zone items count. * The max number of dynamic rules is dyn_max. When we reach * the maximum number of rules we do not create anymore. This is * done to avoid consuming too much memory, but also too much @@ -111,37 +111,33 @@ __FBSDID("$FreeBSD$"); * passes through the firewall. XXX check the latter!!! */ +struct ipfw_dyn_bucket { + struct mtx mtx; /* Bucket protecting lock */ + ipfw_dyn_rule *head; /* Pointer to first rule */ +}; + /* * Static variables followed by global ones */ -static VNET_DEFINE(ipfw_dyn_rule **, ipfw_dyn_v); -static VNET_DEFINE(u_int32_t, dyn_buckets); +static VNET_DEFINE(struct ipfw_dyn_bucket *, ipfw_dyn_v); +static VNET_DEFINE(u_int32_t, dyn_buckets_max); static VNET_DEFINE(u_int32_t, curr_dyn_buckets); static VNET_DEFINE(struct callout, ipfw_timeout); #define V_ipfw_dyn_v VNET(ipfw_dyn_v) -#define V_dyn_buckets VNET(dyn_buckets) +#define V_dyn_buckets_max VNET(dyn_buckets_max) #define V_curr_dyn_buckets VNET(curr_dyn_buckets) #define V_ipfw_timeout VNET(ipfw_timeout) -static uma_zone_t ipfw_dyn_rule_zone; -#ifndef __FreeBSD__ -DEFINE_SPINLOCK(ipfw_dyn_mtx); -#else -static struct mtx ipfw_dyn_mtx; /* mutex guarding dynamic rules */ -#endif +static VNET_DEFINE(uma_zone_t, ipfw_dyn_rule_zone); +#define V_ipfw_dyn_rule_zone VNET(ipfw_dyn_rule_zone) -#define IPFW_DYN_LOCK_INIT() \ - mtx_init(&ipfw_dyn_mtx, "IPFW dynamic rules", NULL, MTX_DEF) -#define IPFW_DYN_LOCK_DESTROY() mtx_destroy(&ipfw_dyn_mtx) -#define IPFW_DYN_LOCK() mtx_lock(&ipfw_dyn_mtx) -#define IPFW_DYN_UNLOCK() mtx_unlock(&ipfw_dyn_mtx) -#define IPFW_DYN_LOCK_ASSERT() mtx_assert(&ipfw_dyn_mtx, MA_OWNED) - -void -ipfw_dyn_unlock(void) -{ - IPFW_DYN_UNLOCK(); -} +#define IPFW_BUCK_LOCK_INIT(b) \ + mtx_init(&(b)->mtx, "IPFW dynamic bucket", NULL, MTX_DEF) +#define IPFW_BUCK_LOCK_DESTROY(b) \ + mtx_destroy(&(b)->mtx) +#define IPFW_BUCK_LOCK(i) mtx_lock(&V_ipfw_dyn_v[(i)].mtx) +#define IPFW_BUCK_UNLOCK(i) mtx_unlock(&V_ipfw_dyn_v[(i)].mtx) +#define IPFW_BUCK_ASSERT(i) mtx_assert(&V_ipfw_dyn_v[(i)].mtx, MA_OWNED) /* * Timeouts for various events in handing dynamic rules. @@ -171,33 +167,42 @@ static VNET_DEFINE(u_int32_t, dyn_short_ static VNET_DEFINE(u_int32_t, dyn_keepalive_interval); static VNET_DEFINE(u_int32_t, dyn_keepalive_period); static VNET_DEFINE(u_int32_t, dyn_keepalive); +static VNET_DEFINE(time_t, dyn_keepalive_last); #define V_dyn_keepalive_interval VNET(dyn_keepalive_interval) #define V_dyn_keepalive_period VNET(dyn_keepalive_period) #define V_dyn_keepalive VNET(dyn_keepalive) +#define V_dyn_keepalive_last VNET(dyn_keepalive_last) -static VNET_DEFINE(u_int32_t, dyn_count); /* # of dynamic rules */ static VNET_DEFINE(u_int32_t, dyn_max); /* max # of dynamic rules */ -#define V_dyn_count VNET(dyn_count) +#define DYN_COUNT uma_zone_get_cur(V_ipfw_dyn_rule_zone) #define V_dyn_max VNET(dyn_max) +static int last_log; /* Log ratelimiting */ + +static void ipfw_dyn_tick(void *vnetx); +static void check_dyn_rules(struct ip_fw_chain *, struct ip_fw *, + int, int, int); #ifdef SYSCTL_NODE +static int sysctl_ipfw_dyn_count(SYSCTL_HANDLER_ARGS); +static int sysctl_ipfw_dyn_max(SYSCTL_HANDLER_ARGS); + SYSBEGIN(f2) SYSCTL_DECL(_net_inet_ip_fw); SYSCTL_VNET_UINT(_net_inet_ip_fw, OID_AUTO, dyn_buckets, - CTLFLAG_RW, &VNET_NAME(dyn_buckets), 0, - "Number of dyn. buckets"); + CTLFLAG_RW, &VNET_NAME(dyn_buckets_max), 0, + "Max number of dyn. buckets"); SYSCTL_VNET_UINT(_net_inet_ip_fw, OID_AUTO, curr_dyn_buckets, CTLFLAG_RD, &VNET_NAME(curr_dyn_buckets), 0, "Current Number of dyn. buckets"); -SYSCTL_VNET_UINT(_net_inet_ip_fw, OID_AUTO, dyn_count, - CTLFLAG_RD, &VNET_NAME(dyn_count), 0, +SYSCTL_VNET_PROC(_net_inet_ip_fw, OID_AUTO, dyn_count, + CTLTYPE_UINT|CTLFLAG_RD, 0, 0, sysctl_ipfw_dyn_count, "IU", "Number of dyn. rules"); -SYSCTL_VNET_UINT(_net_inet_ip_fw, OID_AUTO, dyn_max, - CTLFLAG_RW, &VNET_NAME(dyn_max), 0, +SYSCTL_VNET_PROC(_net_inet_ip_fw, OID_AUTO, dyn_max, + CTLTYPE_UINT|CTLFLAG_RW, 0, 0, sysctl_ipfw_dyn_max, "IU", "Max number of dyn. rules"); SYSCTL_VNET_UINT(_net_inet_ip_fw, OID_AUTO, dyn_ack_lifetime, CTLFLAG_RW, &VNET_NAME(dyn_ack_lifetime), 0, @@ -244,7 +249,7 @@ hash_packet6(struct ipfw_flow_id *id) * and we want to find both in the same bucket. */ static __inline int -hash_packet(struct ipfw_flow_id *id) +hash_packet(struct ipfw_flow_id *id, int buckets) { u_int32_t i; @@ -254,12 +259,16 @@ hash_packet(struct ipfw_flow_id *id) else #endif /* INET6 */ i = (id->dst_ip) ^ (id->src_ip) ^ (id->dst_port) ^ (id->src_port); - i &= (V_curr_dyn_buckets - 1); + i &= (buckets - 1); return i; } -static __inline void -unlink_dyn_rule_print(struct ipfw_flow_id *id) +/** + * Print customizable flow id description via log(9) facility. + */ +static void +print_dyn_rule_flags(struct ipfw_flow_id *id, int dyn_type, int log_flags, + char *prefix, char *postfix) { struct in_addr da; #ifdef INET6 @@ -276,126 +285,25 @@ unlink_dyn_rule_print(struct ipfw_flow_i #endif { da.s_addr = htonl(id->src_ip); - inet_ntoa_r(da, src); + inet_ntop(AF_INET, &da, src, sizeof(src)); da.s_addr = htonl(id->dst_ip); - inet_ntoa_r(da, dst); + inet_ntop(AF_INET, &da, dst, sizeof(dst)); } - printf("ipfw: unlink entry %s %d -> %s %d, %d left\n", - src, id->src_port, dst, id->dst_port, V_dyn_count - 1); + log(log_flags, "ipfw: %s type %d %s %d -> %s %d, %d %s\n", + prefix, dyn_type, src, id->src_port, dst, + id->dst_port, DYN_COUNT, postfix); } -/** - * unlink a dynamic rule from a chain. prev is a pointer to - * the previous one, q is a pointer to the rule to delete, - * head is a pointer to the head of the queue. - * Modifies q and potentially also head. - */ -#define UNLINK_DYN_RULE(prev, head, q) { \ - ipfw_dyn_rule *old_q = q; \ - \ - /* remove a refcount to the parent */ \ - if (q->dyn_type == O_LIMIT) \ - q->parent->count--; \ - DEB(unlink_dyn_rule_print(&q->id);) \ - if (prev != NULL) \ - prev->next = q = q->next; \ - else \ - head = q = q->next; \ - V_dyn_count--; \ - uma_zfree(ipfw_dyn_rule_zone, old_q); } +#define print_dyn_rule(id, dtype, prefix, postfix) \ + print_dyn_rule_flags(id, dtype, LOG_DEBUG, prefix, postfix) #define TIME_LEQ(a,b) ((int)((a)-(b)) <= 0) -/** - * Remove dynamic rules pointing to "rule", or all of them if rule == NULL. - * - * If keep_me == NULL, rules are deleted even if not expired, - * otherwise only expired rules are removed. - * - * The value of the second parameter is also used to point to identify - * a rule we absolutely do not want to remove (e.g. because we are - * holding a reference to it -- this is the case with O_LIMIT_PARENT - * rules). The pointer is only used for comparison, so any non-null - * value will do. - */ -static void -remove_dyn_rule(struct ip_fw *rule, ipfw_dyn_rule *keep_me) -{ - static u_int32_t last_remove = 0; - -#define FORCE (keep_me == NULL) - - ipfw_dyn_rule *prev, *q; - int i, pass = 0, max_pass = 0; - - IPFW_DYN_LOCK_ASSERT(); - - if (V_ipfw_dyn_v == NULL || V_dyn_count == 0) - return; - /* do not expire more than once per second, it is useless */ - if (!FORCE && last_remove == time_uptime) - return; - last_remove = time_uptime; - - /* - * because O_LIMIT refer to parent rules, during the first pass only - * remove child and mark any pending LIMIT_PARENT, and remove - * them in a second pass. - */ -next_pass: - for (i = 0 ; i < V_curr_dyn_buckets ; i++) { - for (prev=NULL, q = V_ipfw_dyn_v[i] ; q ; ) { - /* - * Logic can become complex here, so we split tests. - */ - if (q == keep_me) - goto next; - if (rule != NULL && rule != q->rule) - goto next; /* not the one we are looking for */ - if (q->dyn_type == O_LIMIT_PARENT) { - /* - * handle parent in the second pass, - * record we need one. - */ - max_pass = 1; - if (pass == 0) - goto next; - if (FORCE && q->count != 0 ) { - /* XXX should not happen! */ - printf("ipfw: OUCH! cannot remove rule," - " count %d\n", q->count); - } - } else { - if (!FORCE && - !TIME_LEQ( q->expire, time_uptime )) - goto next; - } - if (q->dyn_type != O_LIMIT_PARENT || !q->count) { - UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q); - continue; - } -next: - prev=q; - q=q->next; - } - } - if (pass++ < max_pass) - goto next_pass; -} - -void -ipfw_remove_dyn_children(struct ip_fw *rule) -{ - IPFW_DYN_LOCK(); - remove_dyn_rule(rule, NULL /* force removal */); - IPFW_DYN_UNLOCK(); -} - /* * Lookup a dynamic rule, locked version. */ static ipfw_dyn_rule * -lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction, +lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int i, int *match_direction, struct tcphdr *tcp) { /* @@ -406,23 +314,17 @@ lookup_dyn_rule_locked(struct ipfw_flow_ #define MATCH_FORWARD 1 #define MATCH_NONE 2 #define MATCH_UNKNOWN 3 - int i, dir = MATCH_NONE; + int dir = MATCH_NONE; ipfw_dyn_rule *prev, *q = NULL; - IPFW_DYN_LOCK_ASSERT(); + IPFW_BUCK_ASSERT(i); - if (V_ipfw_dyn_v == NULL) - goto done; /* not found */ - i = hash_packet(pkt); - for (prev = NULL, q = V_ipfw_dyn_v[i]; q != NULL;) { + for (prev = NULL, q = V_ipfw_dyn_v[i].head; q; prev = q, q = q->next) { if (q->dyn_type == O_LIMIT_PARENT && q->count) - goto next; - if (TIME_LEQ(q->expire, time_uptime)) { /* expire entry */ - UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q); continue; - } + if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT) - goto next; + continue; if (IS_IP6_FLOW_ID(pkt)) { if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.src_ip6) && @@ -455,17 +357,14 @@ lookup_dyn_rule_locked(struct ipfw_flow_ break; } } -next: - prev = q; - q = q->next; } if (q == NULL) goto done; /* q = NULL, not found */ if (prev != NULL) { /* found and not in front */ prev->next = q->next; - q->next = V_ipfw_dyn_v[i]; - V_ipfw_dyn_v[i] = q; + q->next = V_ipfw_dyn_v[i].head; + V_ipfw_dyn_v[i].head = q; } if (pkt->proto == IPPROTO_TCP) { /* update state according to flags */ uint32_t ack; @@ -548,42 +447,108 @@ ipfw_lookup_dyn_rule(struct ipfw_flow_id struct tcphdr *tcp) { ipfw_dyn_rule *q; + int i; + + i = hash_packet(pkt, V_curr_dyn_buckets); - IPFW_DYN_LOCK(); - q = lookup_dyn_rule_locked(pkt, match_direction, tcp); + IPFW_BUCK_LOCK(i); + q = lookup_dyn_rule_locked(pkt, i, match_direction, tcp); if (q == NULL) - IPFW_DYN_UNLOCK(); + IPFW_BUCK_UNLOCK(i); /* NB: return table locked when q is not NULL */ return q; } -static void -realloc_dynamic_table(void) +/* + * Unlock bucket mtx + * @p - pointer to dynamic rule + */ +void +ipfw_dyn_unlock(ipfw_dyn_rule *q) { - IPFW_DYN_LOCK_ASSERT(); + + IPFW_BUCK_UNLOCK(q->bucket); +} + +static int +resize_dynamic_table(struct ip_fw_chain *chain, int nbuckets) +{ + int i, k, nbuckets_old; + ipfw_dyn_rule *q; + struct ipfw_dyn_bucket *dyn_v, *dyn_v_old; + + /* Check if given number is power of 2 and less than 64k */ + if ((nbuckets > 65536) || (!powerof2(nbuckets))) + return 1; + + CTR3(KTR_NET, "%s: resize dynamic hash: %d -> %d", __func__, + V_curr_dyn_buckets, nbuckets); + + /* Allocate and initialize new hash */ + dyn_v = malloc(nbuckets * sizeof(ipfw_dyn_rule), M_IPFW, + M_WAITOK | M_ZERO); + + for (i = 0 ; i < nbuckets; i++) + IPFW_BUCK_LOCK_INIT(&dyn_v[i]); /* - * Try reallocation, make sure we have a power of 2 and do - * not allow more than 64k entries. In case of overflow, - * default to 1024. + * Call upper half lock, as get_map() do to ease + * read-only access to dynamic rules hash from sysctl */ + IPFW_UH_WLOCK(chain); - if (V_dyn_buckets > 65536) - V_dyn_buckets = 1024; - if ((V_dyn_buckets & (V_dyn_buckets-1)) != 0) { /* not a power of 2 */ - V_dyn_buckets = V_curr_dyn_buckets; /* reset */ - return; + /* + * Acquire chain write lock to permit hash access + * for main traffic path without additional locks + */ + IPFW_WLOCK(chain); + + /* Save old values */ + nbuckets_old = V_curr_dyn_buckets; + dyn_v_old = V_ipfw_dyn_v; + + /* Skip relinking if array is not set up */ + if (V_ipfw_dyn_v == NULL) + V_curr_dyn_buckets = 0; + + /* Re-link all dynamic states */ + for (i = 0 ; i < V_curr_dyn_buckets ; i++) { + while (V_ipfw_dyn_v[i].head != NULL) { + /* Remove from current chain */ + q = V_ipfw_dyn_v[i].head; + V_ipfw_dyn_v[i].head = q->next; + + /* Get new hash value */ + k = hash_packet(&q->id, nbuckets); + q->bucket = k; + /* Add to the new head */ + q->next = dyn_v[k].head; + dyn_v[k].head = q; + } } - V_curr_dyn_buckets = V_dyn_buckets; - if (V_ipfw_dyn_v != NULL) - free(V_ipfw_dyn_v, M_IPFW); - for (;;) { - V_ipfw_dyn_v = malloc(V_curr_dyn_buckets * sizeof(ipfw_dyn_rule *), - M_IPFW, M_NOWAIT | M_ZERO); - if (V_ipfw_dyn_v != NULL || V_curr_dyn_buckets <= 2) - break; - V_curr_dyn_buckets /= 2; + + /* Update current pointers/buckets values */ + V_curr_dyn_buckets = nbuckets; + V_ipfw_dyn_v = dyn_v; + + IPFW_WUNLOCK(chain); + + IPFW_UH_WUNLOCK(chain); + + /* Start periodic callout on initial creation */ + if (dyn_v_old == NULL) { + callout_reset_on(&V_ipfw_timeout, hz, ipfw_dyn_tick, curvnet, 0); + return (0); } + + /* Destroy all mutexes */ + for (i = 0 ; i < nbuckets_old ; i++) + IPFW_BUCK_LOCK_DESTROY(&dyn_v_old[i]); + + /* Free old hash */ + free(dyn_v_old, M_IPFW); + + return 0; } /** @@ -597,33 +562,30 @@ realloc_dynamic_table(void) * - "parent" rules for the above (O_LIMIT_PARENT). */ static ipfw_dyn_rule * -add_dyn_rule(struct ipfw_flow_id *id, u_int8_t dyn_type, struct ip_fw *rule) +add_dyn_rule(struct ipfw_flow_id *id, int i, u_int8_t dyn_type, struct ip_fw *rule) { ipfw_dyn_rule *r; - int i; - IPFW_DYN_LOCK_ASSERT(); + IPFW_BUCK_ASSERT(i); - if (V_ipfw_dyn_v == NULL || - (V_dyn_count == 0 && V_dyn_buckets != V_curr_dyn_buckets)) { - realloc_dynamic_table(); - if (V_ipfw_dyn_v == NULL) - return NULL; /* failed ! */ - } - i = hash_packet(id); - - r = uma_zalloc(ipfw_dyn_rule_zone, M_NOWAIT | M_ZERO); + r = uma_zalloc(V_ipfw_dyn_rule_zone, M_NOWAIT | M_ZERO); if (r == NULL) { - printf ("ipfw: sorry cannot allocate state\n"); + if (last_log != time_uptime) { + last_log = time_uptime; + log(LOG_DEBUG, "ipfw: %s: Cannot allocate rule\n", + __func__); + } return NULL; } - /* increase refcount on parent, and set pointer */ + /* + * refcount on parent is already incremented, so + * it is safe to use parent unlocked. + */ if (dyn_type == O_LIMIT) { ipfw_dyn_rule *parent = (ipfw_dyn_rule *)rule; if ( parent->dyn_type != O_LIMIT_PARENT) panic("invalid parent"); - parent->count++; r->parent = parent; rule = parent->rule; } @@ -636,35 +598,9 @@ add_dyn_rule(struct ipfw_flow_id *id, u_ r->count = 0; r->bucket = i; - r->next = V_ipfw_dyn_v[i]; - V_ipfw_dyn_v[i] = r; - V_dyn_count++; - DEB({ - struct in_addr da; -#ifdef INET6 - char src[INET6_ADDRSTRLEN]; - char dst[INET6_ADDRSTRLEN]; -#else - char src[INET_ADDRSTRLEN]; - char dst[INET_ADDRSTRLEN]; -#endif - -#ifdef INET6 - if (IS_IP6_FLOW_ID(&(r->id))) { - ip6_sprintf(src, &r->id.src_ip6); - ip6_sprintf(dst, &r->id.dst_ip6); - } else -#endif - { - da.s_addr = htonl(r->id.src_ip); - inet_ntoa_r(da, src); - da.s_addr = htonl(r->id.dst_ip); - inet_ntoa_r(da, dst); - } - printf("ipfw: add dyn entry ty %d %s %d -> %s %d, total %d\n", - dyn_type, src, r->id.src_port, dst, r->id.dst_port, - V_dyn_count); - }) + r->next = V_ipfw_dyn_v[i].head; + V_ipfw_dyn_v[i].head = r; + DEB(print_dyn_rule(id, dyn_type, "add dyn entry", "total");) return r; } @@ -673,39 +609,40 @@ add_dyn_rule(struct ipfw_flow_id *id, u_ * If the lookup fails, then install one. */ static ipfw_dyn_rule * -lookup_dyn_parent(struct ipfw_flow_id *pkt, struct ip_fw *rule) +lookup_dyn_parent(struct ipfw_flow_id *pkt, int *pindex, struct ip_fw *rule) { ipfw_dyn_rule *q; - int i; + int i, is_v6; - IPFW_DYN_LOCK_ASSERT(); + is_v6 = IS_IP6_FLOW_ID(pkt); + i = hash_packet( pkt, V_curr_dyn_buckets ); + *pindex = i; + IPFW_BUCK_LOCK(i); + for (q = V_ipfw_dyn_v[i].head ; q != NULL ; q=q->next) + if (q->dyn_type == O_LIMIT_PARENT && + rule== q->rule && + pkt->proto == q->id.proto && + pkt->src_port == q->id.src_port && + pkt->dst_port == q->id.dst_port && + ( + (is_v6 && + IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), + &(q->id.src_ip6)) && + IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), + &(q->id.dst_ip6))) || + (!is_v6 && + pkt->src_ip == q->id.src_ip && + pkt->dst_ip == q->id.dst_ip) + ) + ) { + q->expire = time_uptime + V_dyn_short_lifetime; + DEB(print_dyn_rule(pkt, q->dyn_type, + "lookup_dyn_parent found", "");) + return q; + } - if (V_ipfw_dyn_v) { - int is_v6 = IS_IP6_FLOW_ID(pkt); - i = hash_packet( pkt ); - for (q = V_ipfw_dyn_v[i] ; q != NULL ; q=q->next) - if (q->dyn_type == O_LIMIT_PARENT && - rule== q->rule && - pkt->proto == q->id.proto && - pkt->src_port == q->id.src_port && - pkt->dst_port == q->id.dst_port && - ( - (is_v6 && - IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), - &(q->id.src_ip6)) && - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), - &(q->id.dst_ip6))) || - (!is_v6 && - pkt->src_ip == q->id.src_ip && - pkt->dst_ip == q->id.dst_ip) - ) - ) { - q->expire = time_uptime + V_dyn_short_lifetime; - DEB(printf("ipfw: lookup_dyn_parent found 0x%p\n",q);) - return q; - } - } - return add_dyn_rule(pkt, O_LIMIT_PARENT, rule); + /* Add virtual limiting rule */ + return add_dyn_rule(pkt, i, O_LIMIT_PARENT, rule); } /** @@ -718,41 +655,16 @@ int ipfw_install_state(struct ip_fw *rule, ipfw_insn_limit *cmd, struct ip_fw_args *args, uint32_t tablearg) { - static int last_log; ipfw_dyn_rule *q; - struct in_addr da; -#ifdef INET6 - char src[INET6_ADDRSTRLEN + 2], dst[INET6_ADDRSTRLEN + 2]; -#else - char src[INET_ADDRSTRLEN], dst[INET_ADDRSTRLEN]; -#endif - - src[0] = '\0'; - dst[0] = '\0'; + int i; - IPFW_DYN_LOCK(); + DEB(print_dyn_rule(&args->f_id, cmd->o.opcode, "install_state", "");) + + i = hash_packet(&args->f_id, V_curr_dyn_buckets); - DEB( -#ifdef INET6 - if (IS_IP6_FLOW_ID(&(args->f_id))) { - ip6_sprintf(src, &args->f_id.src_ip6); - ip6_sprintf(dst, &args->f_id.dst_ip6); - } else -#endif - { - da.s_addr = htonl(args->f_id.src_ip); - inet_ntoa_r(da, src); - da.s_addr = htonl(args->f_id.dst_ip); - inet_ntoa_r(da, dst); - } - printf("ipfw: %s: type %d %s %u -> %s %u\n", - __func__, cmd->o.opcode, src, args->f_id.src_port, - dst, args->f_id.dst_port); - src[0] = '\0'; - dst[0] = '\0'; - ) + IPFW_BUCK_LOCK(i); - q = lookup_dyn_rule_locked(&args->f_id, NULL, NULL); + q = lookup_dyn_rule_locked(&args->f_id, i, NULL, NULL); if (q != NULL) { /* should never occur */ DEB( @@ -761,26 +673,20 @@ ipfw_install_state(struct ip_fw *rule, i printf("ipfw: %s: entry already present, done\n", __func__); }) - IPFW_DYN_UNLOCK(); + IPFW_BUCK_UNLOCK(i); return (0); } - if (V_dyn_count >= V_dyn_max) - /* Run out of slots, try to remove any expired rule. */ - remove_dyn_rule(NULL, (ipfw_dyn_rule *)1); - - if (V_dyn_count >= V_dyn_max) { - if (last_log != time_uptime) { - last_log = time_uptime; - printf("ipfw: %s: Too many dynamic rules\n", __func__); - } - IPFW_DYN_UNLOCK(); - return (1); /* cannot install, notify caller */ - } + /* + * State limiting is done via uma(9) zone limiting. + * Save pointer to newly-installed rule and reject + * packet if add_dyn_rule() returned NULL. + * Note q is currently set to NULL. + */ switch (cmd->o.opcode) { case O_KEEP_STATE: /* bidir rule */ - add_dyn_rule(&args->f_id, O_KEEP_STATE, rule); + q = add_dyn_rule(&args->f_id, i, O_KEEP_STATE, rule); break; case O_LIMIT: { /* limit number of sessions */ @@ -788,6 +694,7 @@ ipfw_install_state(struct ip_fw *rule, i ipfw_dyn_rule *parent; uint32_t conn_limit; uint16_t limit_mask = cmd->limit_mask; + int pindex; conn_limit = (cmd->conn_limit == IP_FW_TABLEARG) ? tablearg : cmd->conn_limit; @@ -821,67 +728,65 @@ ipfw_install_state(struct ip_fw *rule, i id.src_port = args->f_id.src_port; if (limit_mask & DYN_DST_PORT) id.dst_port = args->f_id.dst_port; - if ((parent = lookup_dyn_parent(&id, rule)) == NULL) { + + /* + * We have to release lock for previous bucket to + * avoid possible deadlock + */ + IPFW_BUCK_UNLOCK(i); + + if ((parent = lookup_dyn_parent(&id, &pindex, rule)) == NULL) { printf("ipfw: %s: add parent failed\n", __func__); - IPFW_DYN_UNLOCK(); + IPFW_BUCK_UNLOCK(pindex); return (1); } if (parent->count >= conn_limit) { - /* See if we can remove some expired rule. */ - remove_dyn_rule(rule, parent); - if (parent->count >= conn_limit) { - if (V_fw_verbose && last_log != time_uptime) { - last_log = time_uptime; -#ifdef INET6 - /* - * XXX IPv6 flows are not - * supported yet. - */ - if (IS_IP6_FLOW_ID(&(args->f_id))) { - char ip6buf[INET6_ADDRSTRLEN]; - snprintf(src, sizeof(src), - "[%s]", ip6_sprintf(ip6buf, - &args->f_id.src_ip6)); - snprintf(dst, sizeof(dst), - "[%s]", ip6_sprintf(ip6buf, - &args->f_id.dst_ip6)); - } else -#endif - { - da.s_addr = - htonl(args->f_id.src_ip); - inet_ntoa_r(da, src); - da.s_addr = - htonl(args->f_id.dst_ip); - inet_ntoa_r(da, dst); - } - log(LOG_SECURITY | LOG_DEBUG, - "ipfw: %d %s %s:%u -> %s:%u, %s\n", - parent->rule->rulenum, - "drop session", - src, (args->f_id.src_port), - dst, (args->f_id.dst_port), - "too many entries"); - } - IPFW_DYN_UNLOCK(); - return (1); + if (V_fw_verbose && last_log != time_uptime) { + last_log = time_uptime; + char sbuf[24]; + last_log = time_uptime; + snprintf(sbuf, sizeof(sbuf), + "%d drop session", + parent->rule->rulenum); + print_dyn_rule_flags(&args->f_id, + cmd->o.opcode, + LOG_SECURITY | LOG_DEBUG, + sbuf, "too many entries"); } + IPFW_BUCK_UNLOCK(pindex); + return (1); + } + /* Increment counter on parent */ + parent->count++; + IPFW_BUCK_UNLOCK(pindex); + + IPFW_BUCK_LOCK(i); + q = add_dyn_rule(&args->f_id, i, O_LIMIT, (struct ip_fw *)parent); + if (q == NULL) { + /* Decrement index and notify caller */ + IPFW_BUCK_UNLOCK(i); + IPFW_BUCK_LOCK(pindex); + parent->count--; + IPFW_BUCK_UNLOCK(pindex); + return (1); } - add_dyn_rule(&args->f_id, O_LIMIT, (struct ip_fw *)parent); break; } default: printf("ipfw: %s: unknown dynamic rule type %u\n", __func__, cmd->o.opcode); - IPFW_DYN_UNLOCK(); - return (1); + } + + if (q == NULL) { + IPFW_BUCK_UNLOCK(i); + return (1); /* Notify caller about failure */ } /* XXX just set lifetime */ - lookup_dyn_rule_locked(&args->f_id, NULL, NULL); + lookup_dyn_rule_locked(&args->f_id, i, NULL, NULL); - IPFW_DYN_UNLOCK(); + IPFW_BUCK_UNLOCK(i); return (0); } @@ -1036,25 +941,117 @@ ipfw_send_pkt(struct mbuf *replyto, stru } /* - * This procedure is only used to handle keepalives. It is invoked - * every dyn_keepalive_period + * Queue keepalive packets for given dynamic rule + */ +static struct mbuf ** +ipfw_dyn_send_ka(struct mbuf **mtailp, ipfw_dyn_rule *q) +{ + struct mbuf *m_rev, *m_fwd; + + m_rev = (q->state & ACK_REV) ? NULL : + ipfw_send_pkt(NULL, &(q->id), q->ack_rev - 1, q->ack_fwd, TH_SYN); + m_fwd = (q->state & ACK_FWD) ? NULL : + ipfw_send_pkt(NULL, &(q->id), q->ack_fwd - 1, q->ack_rev, 0); + + if (m_rev != NULL) { + *mtailp = m_rev; + mtailp = &(*mtailp)->m_nextpkt; + } + if (m_fwd != NULL) { + *mtailp = m_fwd; + mtailp = &(*mtailp)->m_nextpkt; + } + + return (mtailp); +} + +/* + * This procedure is used to perform various maintance + * on dynamic hash list. Currently it is called every second. */ static void -ipfw_tick(void * vnetx) +ipfw_dyn_tick(void * vnetx) { - struct mbuf *m0, *m, *mnext, **mtailp; -#ifdef INET6 - struct mbuf *m6, **m6_tailp; -#endif - int i; - ipfw_dyn_rule *q; + struct ip_fw_chain *chain; + int check_ka = 0; #ifdef VIMAGE struct vnet *vp = vnetx; #endif CURVNET_SET(vp); - if (V_dyn_keepalive == 0 || V_ipfw_dyn_v == NULL || V_dyn_count == 0) - goto done; + + chain = &V_layer3_chain; + + /* Run keepalive checks every keepalive_interval iff ka is enabled */ + if ((V_dyn_keepalive_last + V_dyn_keepalive_interval >= time_uptime) && + (V_dyn_keepalive != 0)) { + V_dyn_keepalive_last = time_uptime; + check_ka = 1; + } + + check_dyn_rules(chain, NULL, RESVD_SET, check_ka, 1); + + callout_reset_on(&V_ipfw_timeout, hz, ipfw_dyn_tick, vnetx, 0); + + CURVNET_RESTORE(); +} + + +/* + * Walk thru all dynamic states doing generic maintance: + * 1) free expired states + * 2) free all states based on deleted rule / set + * 3) send keepalives for states if needed + * + * @chain - pointer to current ipfw rules chain + * @rule - delete all states originated by given rule if != NULL + * @set - delete all states originated by any rule in set @set if != RESVD_SET + * @check_ka - perform checking/sending keepalives + * @timer - indicate call from timer routine. + * + * Timer routine must call this function unlocked to permit + * sending keepalives/resizing table. + * + * Others has to call function with IPFW_UH_WLOCK held. + * Additionally, function assume that dynamic rule/set is + * ALREADY deleted so no new states can be generated by + * 'deleted' rules. + * + * Write lock is needed to ensure that unused parent rules + * are not freed by other instance (see stage 2, 3) + */ +static void +check_dyn_rules(struct ip_fw_chain *chain, struct ip_fw *rule, + int set, int check_ka, int timer) +{ + struct mbuf *m0, *m, *mnext, **mtailp; + struct ip *h; + int i, dyn_count, new_buckets = 0, max_buckets; + int expired = 0, expired_limits = 0, parents = 0, total = 0; + ipfw_dyn_rule *q, *q_prev, *q_next; + ipfw_dyn_rule *exp_head, **exptailp; + ipfw_dyn_rule *exp_lhead, **expltailp; + + KASSERT(V_ipfw_dyn_v != NULL, ("%s: dynamic table not allocated", + __func__)); + + /* Avoid possible LOR */ + KASSERT(!check_ka || timer, ("%s: keepalive check with lock held", + __func__)); + + /* + * Do not perform any checks if we currently have no dynamic states + */ + if (DYN_COUNT == 0) + return; + + /* Expired states */ + exp_head = NULL; + exptailp = &exp_head; + + /* Expired limit states */ + exp_lhead = NULL; + expltailp = &exp_lhead; /* * We make a chain of packets to go out here -- not deferring @@ -1064,99 +1061,255 @@ ipfw_tick(void * vnetx) */ m0 = NULL; mtailp = &m0; -#ifdef INET6 - m6 = NULL; - m6_tailp = &m6; -#endif - IPFW_DYN_LOCK(); + + /* Protect from hash resizing */ + if (timer != 0) + IPFW_UH_WLOCK(chain); + else + IPFW_UH_WLOCK_ASSERT(chain); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 00:23:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7FC24BDF; Sat, 22 Dec 2012 00:23:58 +0000 (UTC) (envelope-from dteske@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 639DB8FC0A; Sat, 22 Dec 2012 00:23:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBM0Nw4T069608; Sat, 22 Dec 2012 00:23:58 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBM0NwWs069607; Sat, 22 Dec 2012 00:23:58 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201212220023.qBM0NwWs069607@svn.freebsd.org> From: Devin Teske Date: Sat, 22 Dec 2012 00:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244573 - stable/9/usr.sbin/sysinstall X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 00:23:58 -0000 Author: dteske Date: Sat Dec 22 00:23:57 2012 New Revision: 244573 URL: http://svnweb.freebsd.org/changeset/base/244573 Log: Fix typo. (fixing them as I find them) Modified: stable/9/usr.sbin/sysinstall/ftp.c Modified: stable/9/usr.sbin/sysinstall/ftp.c ============================================================================== --- stable/9/usr.sbin/sysinstall/ftp.c Sat Dec 22 00:15:44 2012 (r244572) +++ stable/9/usr.sbin/sysinstall/ftp.c Sat Dec 22 00:23:57 2012 (r244573) @@ -107,7 +107,7 @@ try: hostname = variable_get(VAR_FTP_HOST); dir = variable_get(VAR_FTP_DIR); if (!hostname || !dir) { - msgConfirm("Missing FTP host or directory specification. FTP media not initialized,"); + msgConfirm("Missing FTP host or directory specification. FTP media not initialized."); netDown(dev); return FALSE; } From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 01:03:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AF8681DE; Sat, 22 Dec 2012 01:03:24 +0000 (UTC) (envelope-from cognet@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 7B55A8FC16; Sat, 22 Dec 2012 01:03:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBM13OIw075365; Sat, 22 Dec 2012 01:03:24 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBM13Otx075363; Sat, 22 Dec 2012 01:03:24 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201212220103.qBM13Otx075363@svn.freebsd.org> From: Olivier Houchard Date: Sat, 22 Dec 2012 01:03:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244574 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 01:03:24 -0000 Author: cognet Date: Sat Dec 22 01:03:23 2012 New Revision: 244574 URL: http://svnweb.freebsd.org/changeset/base/244574 Log: The VM_MEMATTR_ constants are enumerated, not a bitset. Compare accordingly. Submitted by: Ian Lepore Modified: head/sys/arm/arm/pmap-v6.c head/sys/arm/arm/pmap.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Sat Dec 22 00:23:57 2012 (r244573) +++ head/sys/arm/arm/pmap-v6.c Sat Dec 22 01:03:23 2012 (r244574) @@ -2663,7 +2663,7 @@ do_l2b_alloc: if (!(prot & VM_PROT_EXECUTE) && m) npte |= L2_XN; - if (!(m->md.pv_memattr & VM_MEMATTR_UNCACHEABLE)) + if (m->md.pv_memattr != VM_MEMATTR_UNCACHEABLE) npte |= pte_l2_s_cache_mode; if (m && m == opg) { Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Sat Dec 22 00:23:57 2012 (r244573) +++ head/sys/arm/arm/pmap.c Sat Dec 22 01:03:23 2012 (r244574) @@ -1366,7 +1366,7 @@ pmap_fix_cache(struct vm_page *pg, pmap_ (pv->pv_flags & PVF_NC)) { pv->pv_flags &= ~PVF_NC; - if (!(pg->md.pv_memattr & VM_MEMATTR_UNCACHEABLE)) + if (pg->md.pv_memattr != VM_MEMATTR_UNCACHEABLE) pmap_set_cache_entry(pv, pm, va, 1); continue; } @@ -1376,7 +1376,7 @@ pmap_fix_cache(struct vm_page *pg, pmap_ !pmwc && (pv->pv_flags & PVF_NC)) { pv->pv_flags &= ~(PVF_NC | PVF_MWC); - if (!(pg->md.pv_memattr & VM_MEMATTR_UNCACHEABLE)) + if (pg->md.pv_memattr != VM_MEMATTR_UNCACHEABLE) pmap_set_cache_entry(pv, pm, va, 1); } } @@ -1428,8 +1428,8 @@ pmap_clearbit(struct vm_page *pg, u_int if (!(oflags & maskbits)) { if ((maskbits & PVF_WRITE) && (pv->pv_flags & PVF_NC)) { - if (!(pg->md.pv_memattr & - VM_MEMATTR_UNCACHEABLE)) { + if (pg->md.pv_memattr != + VM_MEMATTR_UNCACHEABLE) { PMAP_LOCK(pm); l2b = pmap_get_l2_bucket(pm, va); ptep = &l2b->l2b_kva[l2pte_index(va)]; @@ -1466,8 +1466,8 @@ pmap_clearbit(struct vm_page *pg, u_int * permission. */ if (maskbits & PVF_WRITE) { - if (!(pg->md.pv_memattr & - VM_MEMATTR_UNCACHEABLE)) + if (pg->md.pv_memattr != + VM_MEMATTR_UNCACHEABLE) npte |= pte_l2_s_cache_mode; pv->pv_flags &= ~(PVF_NC | PVF_MWC); } @@ -3399,7 +3399,7 @@ do_l2b_alloc: (m->oflags & VPO_UNMANAGED) == 0) vm_page_aflag_set(m, PGA_WRITEABLE); } - if (!(m->md.pv_memattr & VM_MEMATTR_UNCACHEABLE)) + if (m->md.pv_memattr != VM_MEMATTR_UNCACHEABLE) npte |= pte_l2_s_cache_mode; if (m && m == opg) { /* From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 01:04:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CEDCB354; Sat, 22 Dec 2012 01:04:29 +0000 (UTC) (envelope-from cognet@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 B3B958FC12; Sat, 22 Dec 2012 01:04:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBM14Tn7075612; Sat, 22 Dec 2012 01:04:29 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBM14Tnc075611; Sat, 22 Dec 2012 01:04:29 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201212220104.qBM14Tnc075611@svn.freebsd.org> From: Olivier Houchard Date: Sat, 22 Dec 2012 01:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244575 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 01:04:29 -0000 Author: cognet Date: Sat Dec 22 01:04:29 2012 New Revision: 244575 URL: http://svnweb.freebsd.org/changeset/base/244575 Log: The manpage states that bus_dmamap_create(9) returns ENOMEM if it can't allocate a map or mapping resources. That seems to imply that any memory allocations it does must use M_NOWAIT and check for NULL. Submitted by: Ian Lepore Modified: head/sys/arm/arm/busdma_machdep.c Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Sat Dec 22 01:03:23 2012 (r244574) +++ head/sys/arm/arm/busdma_machdep.c Sat Dec 22 01:04:29 2012 (r244575) @@ -567,16 +567,24 @@ bus_dmamap_create(bus_dma_tag_t dmat, in bus_dmamap_t map; int error = 0; - map = uma_zalloc_arg(dmamap_zone, dmat, M_WAITOK); + map = uma_zalloc_arg(dmamap_zone, dmat, M_NOWAIT); *mapp = map; + if (map == NULL) + return (ENOMEM); /* * If the tag's segments haven't been allocated yet we need to do it * now, because we can't sleep for resources at map load time. */ - if (dmat->segments == NULL) + if (dmat->segments == NULL) { dmat->segments = malloc(dmat->nsegments * - sizeof(*dmat->segments), M_DEVBUF, M_WAITOK); + sizeof(*dmat->segments), M_DEVBUF, M_NOWAIT); + if (dmat->segments == NULL) { + uma_zfree(dmamap_zone, map); + *mapp = NULL; + return (ENOMEM); + } + } /* * Bouncing might be required if the driver asks for an active From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 01:16:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E21DF54D; Sat, 22 Dec 2012 01:16:28 +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 C60448FC0A; Sat, 22 Dec 2012 01:16:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBM1GSh9077559; Sat, 22 Dec 2012 01:16:28 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBM1GSOf077558; Sat, 22 Dec 2012 01:16:28 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201212220116.qBM1GSOf077558@svn.freebsd.org> From: Adrian Chadd Date: Sat, 22 Dec 2012 01:16:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244576 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 01:16:29 -0000 Author: adrian Date: Sat Dec 22 01:16:28 2012 New Revision: 244576 URL: http://svnweb.freebsd.org/changeset/base/244576 Log: Remove a use of if_start() - instead, use if_transmit() to dispatch the frame. Modified: head/sys/net80211/ieee80211_hostap.c Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Sat Dec 22 01:04:29 2012 (r244575) +++ head/sys/net80211/ieee80211_hostap.c Sat Dec 22 01:16:28 2012 (r244576) @@ -2324,6 +2324,5 @@ ieee80211_recv_pspoll(struct ieee80211_n ifp = vap->iv_ic->ic_ifp; else ifp = vap->iv_ifp; - IF_ENQUEUE(&ifp->if_snd, m); - if_start(ifp); + (void) ifp->if_transmit(ifp, m); } From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 01:17:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 533EB6BF; Sat, 22 Dec 2012 01:17:50 +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 384E98FC13; Sat, 22 Dec 2012 01:17:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBM1HoIp077767; Sat, 22 Dec 2012 01:17:50 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBM1HoUC077766; Sat, 22 Dec 2012 01:17:50 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201212220117.qBM1HoUC077766@svn.freebsd.org> From: Adrian Chadd Date: Sat, 22 Dec 2012 01:17:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244577 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 01:17:50 -0000 Author: adrian Date: Sat Dec 22 01:17:49 2012 New Revision: 244577 URL: http://svnweb.freebsd.org/changeset/base/244577 Log: if_start() is being used here as a way of kick-starting the new queue processing. For if_transmit() style hardware drivers (which none publicly exist yet, for wireless) they will need to still implement if_start() but only to re-start the TX queue. Modified: head/sys/net80211/ieee80211_proto.c Modified: head/sys/net80211/ieee80211_proto.c ============================================================================== --- head/sys/net80211/ieee80211_proto.c Sat Dec 22 01:16:28 2012 (r244576) +++ head/sys/net80211/ieee80211_proto.c Sat Dec 22 01:17:49 2012 (r244577) @@ -1787,6 +1787,11 @@ ieee80211_newstate_cb(void *xvap, int np IF_LOCK(&vap->iv_ifp->if_snd); vap->iv_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; IF_UNLOCK(&vap->iv_ifp->if_snd); + + /* + * XXX Kick-start a VAP queue - this should be a method, + * not if_start()! + */ if_start(vap->iv_ifp); /* bring up any vaps waiting on us */ From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 02:57:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C866E5FA; Sat, 22 Dec 2012 02:57:26 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from smtp5.clear.net.nz (smtp5.clear.net.nz [203.97.33.68]) by mx1.freebsd.org (Postfix) with ESMTP id 843198FC0A; Sat, 22 Dec 2012 02:57:26 +0000 (UTC) Received: from mxin2-orange.clear.net.nz (lb2-srcnat.clear.net.nz [203.97.32.237]) by smtp5.clear.net.nz (CLEAR Net Mail) with ESMTP id <0MFE0085QW7HKA50@smtp5.clear.net.nz>; Sat, 22 Dec 2012 15:57:17 +1300 (NZDT) Received: from 202-0-48-19.paradise.net.nz (HELO localhost) ([202.0.48.19]) by smtpin2.paradise.net.nz with ESMTP; Sat, 22 Dec 2012 15:57:17 +1300 Date: Sat, 22 Dec 2012 15:57:04 +1300 From: Andrew Turner Subject: Re: svn commit: r244562 - in head: contrib/mknod contrib/mtree usr.sbin usr.sbin/nmtree In-reply-to: <201212212100.qBLL01qt037156@svn.freebsd.org> To: Brooks Davis Message-id: <20121222155704.02749d56@fubar.geek.nz> MIME-version: 1.0 X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.6; i386-portbld-freebsd8.1) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Pirate: Arrrr References: <201212212100.qBLL01qt037156@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 02:57:26 -0000 On Fri, 21 Dec 2012 21:00:01 +0000 (UTC) Brooks Davis wrote: > Added: head/usr.sbin/nmtree/Makefile > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is > newly added) +++ head/usr.sbin/nmtree/Makefile Fri Dec 21 > 21:00:00 2012 (r244562) @@ -0,0 +1,26 @@ > +# $FreeBSD$ > + > +.include > + > +.PATH: ${.CURDIR}/../../contrib/mtree > + > +PROG= nmtree > +MAN= nmtree.8 > +SRCS= compare.c crc.c create.c excludes.c getid.c > misc.c mtree.c \ > + spec.c specspec.c verify.c > +LDADD+= -lmd -lutil > + > +CFLAGS+= -I${.CURDIR}/../../contrib/mknod > +.PATH: ${.CURDIR}/../../contrib/mknod > +SRCS+= pack_dev.c > + > +CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd > +LIBNETBSDDIR= ${.OBJDIR}/../../lib/libnetbsd > +LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a > +DPADD+= {LIBNETBSD} This line is missing the $, it should be: DPADD+= ${LIBNETBSD} Andrew From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 04:12:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 53C9F335; Sat, 22 Dec 2012 04:12:00 +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 3982A8FC0A; Sat, 22 Dec 2012 04:12:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBM4C047003882; Sat, 22 Dec 2012 04:12:00 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBM4C02C003881; Sat, 22 Dec 2012 04:12:00 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201212220412.qBM4C02C003881@svn.freebsd.org> From: Andrew Turner Date: Sat, 22 Dec 2012 04:12:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244578 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 04:12:00 -0000 Author: andrew Date: Sat Dec 22 04:11:59 2012 New Revision: 244578 URL: http://svnweb.freebsd.org/changeset/base/244578 Log: Make struct fstate aligned to the same as an int as its pointer is cast to an int pointer in args.c. This fixes an issue with ARM where the struct will be byte aligned but an int pointer must be 4 byte aligned. Modified: head/usr.bin/indent/indent_globs.h Modified: head/usr.bin/indent/indent_globs.h ============================================================================== --- head/usr.bin/indent/indent_globs.h Sat Dec 22 01:17:49 2012 (r244577) +++ head/usr.bin/indent/indent_globs.h Sat Dec 22 04:11:59 2012 (r244578) @@ -213,7 +213,7 @@ struct fstate { char font[4]; char size; int allcaps:1; -}; +} __aligned(sizeof(int)); char *chfont(struct fstate *, struct fstate *, char *); struct fstate From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 04:53:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 02F9F76F; Sat, 22 Dec 2012 04:53:36 +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 DB8938FC0A; Sat, 22 Dec 2012 04:53:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBM4rZiX009694; Sat, 22 Dec 2012 04:53:35 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBM4rZwa009693; Sat, 22 Dec 2012 04:53:35 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201212220453.qBM4rZwa009693@svn.freebsd.org> From: Andrew Turner Date: Sat, 22 Dec 2012 04:53:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244579 - head/usr.sbin/nmtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 04:53:36 -0000 Author: andrew Date: Sat Dec 22 04:53:35 2012 New Revision: 244579 URL: http://svnweb.freebsd.org/changeset/base/244579 Log: Add the missing '$' from the LIBNETBSD variable Modified: head/usr.sbin/nmtree/Makefile Modified: head/usr.sbin/nmtree/Makefile ============================================================================== --- head/usr.sbin/nmtree/Makefile Sat Dec 22 04:11:59 2012 (r244578) +++ head/usr.sbin/nmtree/Makefile Sat Dec 22 04:53:35 2012 (r244579) @@ -17,7 +17,7 @@ SRCS+= pack_dev.c CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd LIBNETBSDDIR= ${.OBJDIR}/../../lib/libnetbsd LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a -DPADD+= {LIBNETBSD} +DPADD+= ${LIBNETBSD} LDADD+= ${LIBNETBSD} nmtree.8: mtree.8 From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 07:47:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E0A4F691; Sat, 22 Dec 2012 07:47:07 +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 C42298FC12; Sat, 22 Dec 2012 07:47:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBM7l7OH034691; Sat, 22 Dec 2012 07:47:07 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBM7l7mU034690; Sat, 22 Dec 2012 07:47:07 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201212220747.qBM7l7mU034690@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 22 Dec 2012 07:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244580 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 07:47:08 -0000 Author: np Date: Sat Dec 22 07:47:07 2012 New Revision: 244580 URL: http://svnweb.freebsd.org/changeset/base/244580 Log: cxgbe(4): Add support for the T440-LP-CR card. This is the 4x10G low profile card with a QSFP+ transceiver. MFC after: 3 days Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sat Dec 22 04:53:35 2012 (r244579) +++ head/sys/dev/cxgbe/t4_main.c Sat Dec 22 07:47:07 2012 (r244580) @@ -371,6 +371,7 @@ struct t4_pciids { {0x4408, "Chelsio T420-CX"}, {0x4409, "Chelsio T420-BT"}, {0x440a, "Chelsio T404-BT"}, + {0x440e, "Chelsio T440-LP-CR"}, }; #ifdef TCP_OFFLOAD From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 09:37:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A6E37510; Sat, 22 Dec 2012 09:37:35 +0000 (UTC) (envelope-from attilio@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 8AB908FC0C; Sat, 22 Dec 2012 09:37:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBM9bZPQ050688; Sat, 22 Dec 2012 09:37:35 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBM9bYQK050680; Sat, 22 Dec 2012 09:37:34 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201212220937.qBM9bYQK050680@svn.freebsd.org> From: Attilio Rao Date: Sat, 22 Dec 2012 09:37:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244582 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 09:37:35 -0000 Author: attilio Date: Sat Dec 22 09:37:34 2012 New Revision: 244582 URL: http://svnweb.freebsd.org/changeset/base/244582 Log: Fixup r240424: On entering KDB backends, the hijacked thread to run interrupt context can still be idlethread. At that point, without the panic condition, it can still happen that idlethread then will try to acquire some locks to carry on some operations. Skip the idlethread check on block/sleep lock operations when KDB is active. Reported by: jh Tested by: jh MFC after: 1 week Modified: head/sys/kern/kern_lock.c head/sys/kern/kern_mutex.c head/sys/kern/kern_rmlock.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Sat Dec 22 07:48:09 2012 (r244581) +++ head/sys/kern/kern_lock.c Sat Dec 22 09:37:34 2012 (r244582) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -477,7 +478,7 @@ __lockmgr_args(struct lock *lk, u_int fl KASSERT((flags & LK_INTERLOCK) == 0 || ilk != NULL, ("%s: LK_INTERLOCK passed without valid interlock @ %s:%d", __func__, file, line)); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("%s: idle thread %p on lockmgr %s @ %s:%d", __func__, curthread, lk->lock_object.lo_name, file, line)); Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Sat Dec 22 07:48:09 2012 (r244581) +++ head/sys/kern/kern_mutex.c Sat Dec 22 09:37:34 2012 (r244582) @@ -210,7 +210,7 @@ __mtx_lock_flags(volatile uintptr_t *c, m = mtxlock2mtx(c); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("mtx_lock() by idle thread %p on sleep mutex %s @ %s:%d", curthread, m->lock_object.lo_name, file, line)); KASSERT(m->mtx_lock != MTX_DESTROYED, @@ -326,7 +326,7 @@ _mtx_trylock_flags_(volatile uintptr_t * m = mtxlock2mtx(c); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("mtx_trylock() by idle thread %p on sleep mutex %s @ %s:%d", curthread, m->lock_object.lo_name, file, line)); KASSERT(m->mtx_lock != MTX_DESTROYED, Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Sat Dec 22 07:48:09 2012 (r244581) +++ head/sys/kern/kern_rmlock.c Sat Dec 22 09:37:34 2012 (r244582) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -494,7 +495,7 @@ void _rm_wlock_debug(struct rmlock *rm, if (SCHEDULER_STOPPED()) return; - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("rm_wlock() by idle thread %p on rmlock %s @ %s:%d", curthread, rm->lock_object.lo_name, file, line)); WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, @@ -539,7 +540,7 @@ _rm_rlock_debug(struct rmlock *rm, struc if (SCHEDULER_STOPPED()) return (1); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("rm_rlock() by idle thread %p on rmlock %s @ %s:%d", curthread, rm->lock_object.lo_name, file, line)); if (!trylock && (rm->lock_object.lo_flags & RM_SLEEPABLE)) Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Sat Dec 22 07:48:09 2012 (r244581) +++ head/sys/kern/kern_rwlock.c Sat Dec 22 09:37:34 2012 (r244582) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include "opt_no_adaptive_rwlocks.h" #include +#include #include #include #include @@ -258,7 +259,7 @@ _rw_wlock_cookie(volatile uintptr_t *c, rw = rwlock2rw(c); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("rw_wlock() by idle thread %p on rwlock %s @ %s:%d", curthread, rw->lock_object.lo_name, file, line)); KASSERT(rw->rw_lock != RW_DESTROYED, @@ -282,7 +283,7 @@ __rw_try_wlock(volatile uintptr_t *c, co rw = rwlock2rw(c); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("rw_try_wlock() by idle thread %p on rwlock %s @ %s:%d", curthread, rw->lock_object.lo_name, file, line)); KASSERT(rw->rw_lock != RW_DESTROYED, @@ -364,7 +365,7 @@ __rw_rlock(volatile uintptr_t *c, const rw = rwlock2rw(c); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("rw_rlock() by idle thread %p on rwlock %s @ %s:%d", curthread, rw->lock_object.lo_name, file, line)); KASSERT(rw->rw_lock != RW_DESTROYED, @@ -558,7 +559,7 @@ __rw_try_rlock(volatile uintptr_t *c, co rw = rwlock2rw(c); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("rw_try_rlock() by idle thread %p on rwlock %s @ %s:%d", curthread, rw->lock_object.lo_name, file, line)); Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Sat Dec 22 07:48:09 2012 (r244581) +++ head/sys/kern/kern_sx.c Sat Dec 22 09:37:34 2012 (r244582) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -249,7 +250,7 @@ _sx_slock(struct sx *sx, int opts, const if (SCHEDULER_STOPPED()) return (0); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("sx_slock() by idle thread %p on sx %s @ %s:%d", curthread, sx->lock_object.lo_name, file, line)); KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, @@ -273,7 +274,7 @@ sx_try_slock_(struct sx *sx, const char if (SCHEDULER_STOPPED()) return (1); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("sx_try_slock() by idle thread %p on sx %s @ %s:%d", curthread, sx->lock_object.lo_name, file, line)); @@ -302,7 +303,7 @@ _sx_xlock(struct sx *sx, int opts, const if (SCHEDULER_STOPPED()) return (0); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("sx_xlock() by idle thread %p on sx %s @ %s:%d", curthread, sx->lock_object.lo_name, file, line)); KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, @@ -328,7 +329,7 @@ sx_try_xlock_(struct sx *sx, const char if (SCHEDULER_STOPPED()) return (1); - KASSERT(!TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("sx_try_xlock() by idle thread %p on sx %s @ %s:%d", curthread, sx->lock_object.lo_name, file, line)); KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 09:51:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C6E96716; Sat, 22 Dec 2012 09:51:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 57FE48FC13; Sat, 22 Dec 2012 09:51:51 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qBM9pmxr019818 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 22 Dec 2012 20:51:49 +1100 Date: Sat, 22 Dec 2012 20:51:47 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Attilio Rao Subject: Re: svn commit: r244582 - head/sys/kern In-Reply-To: <201212220937.qBM9bYQK050680@svn.freebsd.org> Message-ID: <20121222204409.V1410@besplex.bde.org> References: <201212220937.qBM9bYQK050680@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=Zvi1sKHG c=1 sm=1 a=psoCjdI5atsA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=M4roAWbnUW4A:10 a=I82O9co9HvBKwmjKFJcA:9 a=CjuIK1q_8ugA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 09:51:52 -0000 On Sat, 22 Dec 2012, Attilio Rao wrote: > Log: > Fixup r240424: On entering KDB backends, the hijacked thread to run > interrupt context can still be idlethread. At that point, without the > panic condition, it can still happen that idlethread then will try to > acquire some locks to carry on some operations. > > Skip the idlethread check on block/sleep lock operations when KDB is > active. This seems backwards to me. It is an error to go near normal locking code when kdb is active. > Modified: head/sys/kern/kern_lock.c > ============================================================================== > --- head/sys/kern/kern_lock.c Sat Dec 22 07:48:09 2012 (r244581) > +++ head/sys/kern/kern_lock.c Sat Dec 22 09:37:34 2012 (r244582) > @@ -35,6 +35,7 @@ > __FBSDID("$FreeBSD$"); > > #include > +#include > #include > #include > #include > @@ -477,7 +478,7 @@ __lockmgr_args(struct lock *lk, u_int fl > KASSERT((flags & LK_INTERLOCK) == 0 || ilk != NULL, > ("%s: LK_INTERLOCK passed without valid interlock @ %s:%d", > __func__, file, line)); > - KASSERT(!TD_IS_IDLETHREAD(curthread), > + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), > ("%s: idle thread %p on lockmgr %s @ %s:%d", __func__, curthread, > lk->lock_object.lo_name, file, line)); This is backwards from: KASSERT(kdb_active == 0); which makes it fatal for any thread to call here. Of course, bugs in this area are common. Last time I tried checking for them, I only used db_printfs() in places like _mtx_lock_flags(), and had to turn off the printfs since they occurred too often. WIthout assertions to inhibit them, these bugs must be more common now. Bruce From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 09:57:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A73AA06; Sat, 22 Dec 2012 09:57:10 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx1.freebsd.org (Postfix) with ESMTP id 9CC638FC12; Sat, 22 Dec 2012 09:57:09 +0000 (UTC) Received: by mail-la0-f43.google.com with SMTP id z14so6457638lag.30 for ; Sat, 22 Dec 2012 01:57:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=ZZ+VoumboiwTAnguLL3nVqMKadeT2nM3kH2X5uMLsaM=; b=tZWWzsZCVlnKd8aeWM/zMAjj+32WUX4rKm2TBRZ/HB7qahVuKMy8OQxwshNVJgnxeu 3FW+K+jq8tsQzMc3MPvhFTfncsvRY0lmm5UuRsABE7qaRMDrF2SMTDeaDBjGD1hSc7tG HVqaX+QTD9m/vOU1iJZawS3MSOkC56/iy8PvBwUvgTC/5VB0MD67csxZySDfzg+zmRqF 9WUrmafFz0NfO0iU2evvdlbP+R5TLoLbSkOALpofSMlW2oUtcoWMQto4cKSUw9R+FSRB gL4bfURFaM3ieLQv3ZfxdUVWRXFmk8dlRPgFfmtZjIMd6WLRUZia8COMe2WEVzzmRCcf mmKQ== MIME-Version: 1.0 Received: by 10.112.37.200 with SMTP id a8mr6509692lbk.92.1356170227682; Sat, 22 Dec 2012 01:57:07 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.112.84.193 with HTTP; Sat, 22 Dec 2012 01:57:07 -0800 (PST) In-Reply-To: <20121222204409.V1410@besplex.bde.org> References: <201212220937.qBM9bYQK050680@svn.freebsd.org> <20121222204409.V1410@besplex.bde.org> Date: Sat, 22 Dec 2012 10:57:07 +0100 X-Google-Sender-Auth: EM_HwXuzvJRLPtGal7AHu_WxHCk Message-ID: Subject: Re: svn commit: r244582 - head/sys/kern From: Attilio Rao To: Bruce Evans 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 09:57:10 -0000 On Sat, Dec 22, 2012 at 10:51 AM, Bruce Evans wrote: > On Sat, 22 Dec 2012, Attilio Rao wrote: > >> Log: >> Fixup r240424: On entering KDB backends, the hijacked thread to run >> interrupt context can still be idlethread. At that point, without the >> panic condition, it can still happen that idlethread then will try to >> acquire some locks to carry on some operations. >> >> Skip the idlethread check on block/sleep lock operations when KDB is >> active. > > > This seems backwards to me. It is an error to go near normal locking > code when kdb is active. I completely agree, but this is not what happens nowadays with FreeBSD kernel. In my view, KDB should not call into normal code, but in special wrappers which skip locking entirely, in particular because other cpus are stopped, so there is no race going on. However, this requires a big change and as long as this doesn't happen we need to stuck with similar hacks. > > >> Modified: head/sys/kern/kern_lock.c >> >> ============================================================================== >> --- head/sys/kern/kern_lock.c Sat Dec 22 07:48:09 2012 (r244581) >> +++ head/sys/kern/kern_lock.c Sat Dec 22 09:37:34 2012 (r244582) >> @@ -35,6 +35,7 @@ >> __FBSDID("$FreeBSD$"); >> >> #include >> +#include >> #include >> #include >> #include >> @@ -477,7 +478,7 @@ __lockmgr_args(struct lock *lk, u_int fl >> KASSERT((flags & LK_INTERLOCK) == 0 || ilk != NULL, >> ("%s: LK_INTERLOCK passed without valid interlock @ %s:%d", >> __func__, file, line)); >> - KASSERT(!TD_IS_IDLETHREAD(curthread), >> + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), >> ("%s: idle thread %p on lockmgr %s @ %s:%d", __func__, >> curthread, >> lk->lock_object.lo_name, file, line)); > > > This is backwards from: > > KASSERT(kdb_active == 0); > > which makes it fatal for any thread to call here. I do not understand. For kdb_active == 0 it still checks for IDLETHREAD if it is not idlethread it doesn't panic, it panics otherwise, which seems the right to me. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 12:20:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5270A4D0; Sat, 22 Dec 2012 12:20:09 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail36.syd.optusnet.com.au (mail36.syd.optusnet.com.au [211.29.133.76]) by mx1.freebsd.org (Postfix) with ESMTP id D75018FC0A; Sat, 22 Dec 2012 12:20:08 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail36.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qBMCK5ko020370 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 22 Dec 2012 23:20:06 +1100 Date: Sat, 22 Dec 2012 23:20:05 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Attilio Rao Subject: Re: svn commit: r244582 - head/sys/kern In-Reply-To: Message-ID: <20121222230402.P1765@besplex.bde.org> References: <201212220937.qBM9bYQK050680@svn.freebsd.org> <20121222204409.V1410@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=CJhyxmXD c=1 sm=1 a=psoCjdI5atsA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=M4roAWbnUW4A:10 a=I29nFAbqzGM88kPPTRwA:9 a=CjuIK1q_8ugA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 12:20:09 -0000 On Sat, 22 Dec 2012, Attilio Rao wrote: > On Sat, Dec 22, 2012 at 10:51 AM, Bruce Evans wrote: >> On Sat, 22 Dec 2012, Attilio Rao wrote: >> >>> Log: >>> Fixup r240424: On entering KDB backends, the hijacked thread to run >>> interrupt context can still be idlethread. At that point, without the >>> panic condition, it can still happen that idlethread then will try to >>> acquire some locks to carry on some operations. >>> >>> Skip the idlethread check on block/sleep lock operations when KDB is >>> active. >> >> This seems backwards to me. It is an error to go near normal locking >> code when kdb is active. > > I completely agree, but this is not what happens nowadays with FreeBSD kernel. > In my view, KDB should not call into normal code, but in special > wrappers which skip locking entirely, in particular because other cpus > are stopped, so there is no race going on. > However, this requires a big change and as long as this doesn't happen > we need to stuck with similar hacks. But this sort of hack only breaks accidental detection of a bug (maybe the bug causes deadlock or data corruption soon). The type of hack that helps is 'if (kdb_active) skip_locking();' deep in code that shouldn't even be called if kdb is active. Here it is 'if (kdb_active) skip_checking();' >>> Modified: head/sys/kern/kern_lock.c >>> >>> ============================================================================== >>> --- head/sys/kern/kern_lock.c Sat Dec 22 07:48:09 2012 (r244581) >>> +++ head/sys/kern/kern_lock.c Sat Dec 22 09:37:34 2012 (r244582) >>> @@ -35,6 +35,7 @@ >>> __FBSDID("$FreeBSD$"); >>> >>> #include >>> +#include >>> #include >>> #include >>> #include >>> @@ -477,7 +478,7 @@ __lockmgr_args(struct lock *lk, u_int fl >>> KASSERT((flags & LK_INTERLOCK) == 0 || ilk != NULL, >>> ("%s: LK_INTERLOCK passed without valid interlock @ %s:%d", >>> __func__, file, line)); >>> - KASSERT(!TD_IS_IDLETHREAD(curthread), >>> + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), >>> ("%s: idle thread %p on lockmgr %s @ %s:%d", __func__, >>> curthread, >>> lk->lock_object.lo_name, file, line)); >> >> >> This is backwards from: >> >> KASSERT(kdb_active == 0); >> >> which makes it fatal for any thread to call here. > > I do not understand. For kdb_active == 0 it still checks for > IDLETHREAD if it is not idlethread it doesn't panic, it panics > otherwise, which seems the right to me. I just mean that the correct kdb_active KASSERT() is independent of the idlethread one. It should also have a different message. I forgot to provide a message. Bruce From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 12:24:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E375681; Sat, 22 Dec 2012 12:24:34 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by mx1.freebsd.org (Postfix) with ESMTP id 290FC8FC0A; Sat, 22 Dec 2012 12:24:32 +0000 (UTC) Received: by mail-la0-f48.google.com with SMTP id m13so6563094lah.35 for ; Sat, 22 Dec 2012 04:24:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=+rZ/sGQcaoUm28rznp9FZQbzxgRE9yUJD2y5sV3r7K0=; b=Jzl3py/3LuI8/yDH7zky19FBjq1j9cf6MB1+POhozcqiMF8QuoT6G+dVQWcbpo47GL y8cO5Hhg7kPkSZSoE9XdCziEoJ8EztrK23lEP7QHeVMciEaubVZjn/F0+4B+0qVO9pSX okIlwthJL9ZoIm7KpS4a9CWWVmEjRdV6PuQMirMxEvFN/zwW3ZbXXUruw5UXRCHfziNC 9YeGlWzAA815yveyYWnJ2fzoNMX7MMSHozu5uKm+lTJn4FEu4AG/zzBdFwnDxQoYa8Hn EknX0g8fGFM2Ib1qnQSpEu+o9PAqGLa5HwAfpL+x87Tigs2xsmX7/AY/wp6X73in5fC7 vujQ== MIME-Version: 1.0 Received: by 10.152.129.197 with SMTP id ny5mr15211840lab.43.1356179071630; Sat, 22 Dec 2012 04:24:31 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.112.84.193 with HTTP; Sat, 22 Dec 2012 04:24:31 -0800 (PST) In-Reply-To: <20121222230402.P1765@besplex.bde.org> References: <201212220937.qBM9bYQK050680@svn.freebsd.org> <20121222204409.V1410@besplex.bde.org> <20121222230402.P1765@besplex.bde.org> Date: Sat, 22 Dec 2012 13:24:31 +0100 X-Google-Sender-Auth: cjonDreKcTq4D8nJFjruigMMJe0 Message-ID: Subject: Re: svn commit: r244582 - head/sys/kern From: Attilio Rao To: Bruce Evans 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 12:24:34 -0000 On Sat, Dec 22, 2012 at 1:20 PM, Bruce Evans wrote: > On Sat, 22 Dec 2012, Attilio Rao wrote: > >> On Sat, Dec 22, 2012 at 10:51 AM, Bruce Evans >> wrote: >>> >>> On Sat, 22 Dec 2012, Attilio Rao wrote: >>> >>>> Log: >>>> Fixup r240424: On entering KDB backends, the hijacked thread to run >>>> interrupt context can still be idlethread. At that point, without the >>>> panic condition, it can still happen that idlethread then will try to >>>> acquire some locks to carry on some operations. >>>> >>>> Skip the idlethread check on block/sleep lock operations when KDB is >>>> active. >>> >>> >>> This seems backwards to me. It is an error to go near normal locking >>> code when kdb is active. >> >> >> I completely agree, but this is not what happens nowadays with FreeBSD >> kernel. >> In my view, KDB should not call into normal code, but in special >> wrappers which skip locking entirely, in particular because other cpus >> are stopped, so there is no race going on. >> However, this requires a big change and as long as this doesn't happen >> we need to stuck with similar hacks. > > > But this sort of hack only breaks accidental detection of a bug (maybe > the bug causes deadlock or data corruption soon). The type of hack > that helps is 'if (kdb_active) skip_locking();' deep in code that > shouldn't even be called if kdb is active. Here it is 'if (kdb_active) > skip_checking();' I agree, but our kernel relies on this stuff for kdb heavily (see all the duplicate checks around). We need to change that all together. We need to provide lockless version for KDB command. >> >> >> I do not understand. For kdb_active == 0 it still checks for >> IDLETHREAD if it is not idlethread it doesn't panic, it panics >> otherwise, which seems the right to me. > > > I just mean that the correct kdb_active KASSERT() is independent of the > idlethread one. It should also have a different message. I forgot to > provide a message. If you want to use a better message, be my guest. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 13:33:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 420E729B; Sat, 22 Dec 2012 13:33:29 +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 0D79A8FC0A; Sat, 22 Dec 2012 13:33:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBMDXS73085315; Sat, 22 Dec 2012 13:33:28 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBMDXSrj085313; Sat, 22 Dec 2012 13:33:28 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201212221333.qBMDXSrj085313@svn.freebsd.org> From: Jaakko Heinonen Date: Sat, 22 Dec 2012 13:33:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244584 - in head: share/man/man9 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 13:33:29 -0000 Author: jh Date: Sat Dec 22 13:33:28 2012 New Revision: 244584 URL: http://svnweb.freebsd.org/changeset/base/244584 Log: Reject spaces and double quotation marks in device names. devctl(4) and devd(8) can't handle names with such characters properly. PR: bin/144736, kern/161912 Discussed with: imp, kib, pjd Modified: head/share/man/man9/make_dev.9 head/sys/kern/kern_conf.c Modified: head/share/man/man9/make_dev.9 ============================================================================== --- head/share/man/man9/make_dev.9 Sat Dec 22 13:02:03 2012 (r244583) +++ head/share/man/man9/make_dev.9 Sat Dec 22 13:33:28 2012 (r244584) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2011 +.Dd Dec 22, 2012 .Dt MAKE_DEV 9 .Os .Sh NAME @@ -364,6 +364,10 @@ or .Qq .. path component or ends with .Ql / . +.It Bq Er EINVAL +The +.Dv MAKEDEV_CHECKNAME +flag was specified and the provided device name contains invalid characters. .It Bq Er EEXIST The .Dv MAKEDEV_CHECKNAME Modified: head/sys/kern/kern_conf.c ============================================================================== --- head/sys/kern/kern_conf.c Sat Dec 22 13:02:03 2012 (r244583) +++ head/sys/kern/kern_conf.c Sat Dec 22 13:33:28 2012 (r244584) @@ -698,6 +698,13 @@ prep_devname(struct cdev *dev, const cha ; for (to = dev->si_name; *from != '\0'; from++, to++) { + /* + * Spaces and double quotation marks cause + * problems for the devctl(4) protocol. + * Reject names containing those characters. + */ + if (isspace(*from) || *from == '"') + return (EINVAL); /* Treat multiple sequential slashes as single. */ while (from[0] == '/' && from[1] == '/') from++; From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 13:43:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 408A883C; Sat, 22 Dec 2012 13:43:13 +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 0AD8D8FC12; Sat, 22 Dec 2012 13:43:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBMDhCoF086837; Sat, 22 Dec 2012 13:43:12 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBMDhCHa086834; Sat, 22 Dec 2012 13:43:12 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201212221343.qBMDhCHa086834@svn.freebsd.org> From: Jaakko Heinonen Date: Sat, 22 Dec 2012 13:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244585 - in 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 13:43:13 -0000 Author: jh Date: Sat Dec 22 13:43:12 2012 New Revision: 244585 URL: http://svnweb.freebsd.org/changeset/base/244585 Log: Mangle label names containing spaces, non-printable characters '%' or '"'. Mangling is only done for label names read from file system metadata. Encoding resembles URL encoding. For example, the space character becomes %20. Help by: kib Discussed with: imp, kib, pjd Modified: head/UPDATING head/sys/geom/label/g_label.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Dec 22 13:33:28 2012 (r244584) +++ head/UPDATING Sat Dec 22 13:43:12 2012 (r244585) @@ -26,6 +26,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20121222: + GEOM_LABEL now mangles label names read from file system metadata. + Mangling affect labels containing spaces, non-printable characters, + '%' or '"'. Device names in /etc/fstab and other places may need to + be updated. + 20121217: By default, only the 10 most recent kernel dumps will be saved. To restore the previous behaviour (no limit on the number of kernel dumps Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Sat Dec 22 13:33:28 2012 (r244584) +++ head/sys/geom/label/g_label.c Sat Dec 22 13:43:12 2012 (r244585) @@ -34,8 +34,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -138,6 +140,26 @@ g_label_is_name_ok(const char *label) return (1); } +static void +g_label_mangle_name(char *label, size_t size) +{ + struct sbuf *sb; + const u_char *c; + + sb = sbuf_new(NULL, NULL, size, SBUF_FIXEDLEN); + for (c = label; *c != '\0'; c++) { + if (!isprint(*c) || isspace(*c) || *c =='"' || *c == '%') + sbuf_printf(sb, "%%%02X", *c); + else + sbuf_putc(sb, *c); + } + if (sbuf_finish(sb) != 0) + label[0] = '\0'; + else + strlcpy(label, sbuf_data(sb), size); + sbuf_delete(sb); +} + static struct g_geom * g_label_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp, const char *label, const char *dir, off_t mediasize) @@ -323,6 +345,7 @@ g_label_taste(struct g_class *mp, struct continue; g_topology_unlock(); g_labels[i]->ld_taste(cp, label, sizeof(label)); + g_label_mangle_name(label, sizeof(label)); g_topology_lock(); if (label[0] == '\0') continue; From owner-svn-src-all@FreeBSD.ORG Sat Dec 22 14:58:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0439815; Sat, 22 Dec 2012 14:58:33 +0000 (UTC) (envelope-from dim@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 B02F98FC0A; Sat, 22 Dec 2012 14:58:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBMEwX5n097726; Sat, 22 Dec 2012 14:58:33 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBMEwUOr097704; Sat, 22 Dec 2012 14:58:30 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201212221458.qBMEwUOr097704@svn.freebsd.org> From: Dimitry Andric Date: Sat, 22 Dec 2012 14:58:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r244590 - in vendor/llvm/dist: docs include/llvm/MC lib/ExecutionEngine/RuntimeDyld lib/MC lib/Target/Mips lib/Target/Mips/InstPrinter lib/Target/Mips/MCTargetDesc lib/Transforms/Scalar... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 14:58:33 -0000 Author: dim Date: Sat Dec 22 14:58:30 2012 New Revision: 244590 URL: http://svnweb.freebsd.org/changeset/base/244590 Log: Vendor import of llvm tags/RELEASE_32/final r170710 (effectively, 3.2 release): http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_32/final@170710 Added: vendor/llvm/dist/test/CodeGen/Mips/biggot.ll vendor/llvm/dist/test/MC/Mips/xgot.ll Modified: vendor/llvm/dist/docs/ReleaseNotes.html vendor/llvm/dist/include/llvm/MC/MCExpr.h vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h vendor/llvm/dist/lib/MC/MCExpr.cpp vendor/llvm/dist/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsBaseInfo.h vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp vendor/llvm/dist/lib/Target/Mips/Mips64InstrInfo.td vendor/llvm/dist/lib/Target/Mips/MipsCodeEmitter.cpp vendor/llvm/dist/lib/Target/Mips/MipsISelLowering.cpp vendor/llvm/dist/lib/Target/Mips/MipsInstrInfo.td vendor/llvm/dist/lib/Target/Mips/MipsJITInfo.cpp vendor/llvm/dist/lib/Target/Mips/MipsJITInfo.h vendor/llvm/dist/lib/Target/Mips/MipsMCInstLower.cpp vendor/llvm/dist/lib/Transforms/Scalar/SROA.cpp vendor/llvm/dist/test/Transforms/SROA/basictest.ll vendor/llvm/dist/test/Transforms/SROA/big-endian.ll Modified: vendor/llvm/dist/docs/ReleaseNotes.html ============================================================================== --- vendor/llvm/dist/docs/ReleaseNotes.html Sat Dec 22 14:35:46 2012 (r244589) +++ vendor/llvm/dist/docs/ReleaseNotes.html Sat Dec 22 14:58:30 2012 (r244590) @@ -29,12 +29,6 @@

Written by the LLVM Team

-

These are in-progress notes for the upcoming LLVM 3.2 -release.
-You may prefer the -LLVM 3.1 -Release Notes.

-

Introduction @@ -46,7 +40,7 @@ Release Notes.

This document contains the release notes for the LLVM Compiler Infrastructure, release 3.2. Here we describe the status of LLVM, including major improvements from the previous release, improvements in various - subprojects of LLVM, and some of the current users of the code. All LLVM + sub-projects of LLVM, and some of the current users of the code. All LLVM releases may be downloaded from the LLVM releases web site.

@@ -72,11 +66,12 @@ Release Notes.
-

The LLVM 3.2 distribution currently consists of code from the core LLVM - repository, which roughly includes the LLVM optimizers, code generators and - supporting tools, and the Clang repository. In addition to this code, the - LLVM Project includes other sub-projects that are in development. Here we - include updates on these subprojects.

+

The LLVM 3.2 distribution currently consists of production-quality code + from the core LLVM repository, which roughly includes the LLVM optimizers, + code generators and supporting tools, as well as Clang, DragonEgg and + compiler-rt sub-project repositories. In addition to this code, the LLVM + Project includes other sub-projects that are in development. Here we + include updates on these sub-projects.

@@ -90,18 +85,18 @@ Release Notes.

experience through expressive diagnostics, a high level of conformance to language standards, fast compilation, and low memory use. Like LLVM, Clang provides a modular, library-based architecture that makes it suitable for - creating or integrating with other development tools. Clang is considered a - production-quality compiler for C, Objective-C, C++ and Objective-C++ on x86 - (32- and 64-bit), and for Darwin/ARM targets.

+ creating or integrating with other development tools.

In the LLVM 3.2 time-frame, the Clang team has made many improvements. Highlights include:

    -
  • ...
  • +
  • Improvements to Clang's diagnostics
  • +
  • Support for tls_model attribute
  • +
  • Type safety attributes

For more details about the changes to Clang since the 3.1 release, see the - Clang release + Clang 3.2 release notes.

If Clang rejects your code but another compiler accepts it, please take a @@ -129,7 +124,10 @@ Release Notes.

The 3.2 release has the following notable changes:

    -
  • ...
  • +
  • Able to load LLVM plugins such as Polly.
  • +
  • Supports thread-local storage models.
  • +
  • Passes knowledge of variable lifetimes to the LLVM optimizers.
  • +
  • No longer requires GCC to be built with LTO support.
@@ -141,7 +139,8 @@ Release Notes.
-

The new LLVM compiler-rt project + +

The LLVM compiler-rt project is a simple library that provides an implementation of the low-level target-specific hooks required by code generation and other runtime components. For example, when compiling for a 32-bit target, converting a @@ -153,7 +152,11 @@ Release Notes.

The 3.2 release has the following notable changes:

    -
  • ...
  • +
  • ThreadSanitizer (TSan) - data race detector run-time library for C/C++ has been added.
  • +
  • Improvements to AddressSanitizer including: better portability + (OSX, Android NDK), support for cmake based builds, enhanced error reporting and lots of bug fixes.
  • +
  • Added support for A6 'Swift' CPU.
  • +
  • divsi3 function has been enhanced to take advantage of a hardware unsigned divide when it is available.
@@ -174,7 +177,9 @@ Release Notes.

The 3.2 release has the following notable changes:

    -
  • ...
  • +
  • Linux build fixes for clang (see Building LLDB)
  • +
  • Some Linux stability and usability improvements
  • +
  • Switch expression evaluation to use MCJIT (from legacy JIT) on Linux
@@ -193,7 +198,15 @@ Release Notes.

Within the LLVM 3.2 time-frame there were the following highlights:

    -
  • ...
  • +
  • C++11 shared_ptr atomic access API (20.7.2.5) has been implemented.
  • +
  • Applied noexcept and constexpr throughout library.
  • +
  • Improved C++11 conformance in associative container emplace.
  • +
  • Performance improvements in: std::rotate algorithm and I/O.
  • +
  • Operator new/delete and type_infos for exception types moved from libc++ to libc++abi.
  • +
  • Bug fixes in: <atomic>; vector<bool> algorithms, + <future>,<tuple>, + <type_traits>,<fstream>,<istream>, + <iterator>, <condition_variable>,<complex> as well as visibility fixes.
@@ -212,7 +225,7 @@ Release Notes.

The 3.2 release has the following notable changes:

    -
  • ...
  • +
  • Bug fixes only, no functional changes.
@@ -227,16 +240,61 @@ Release Notes.

Polly is an experimental optimizer for data locality and parallelism. It currently provides high-level - loop optimizations and automatic parallelisation (using the OpenMP run time). + loop optimizations and automatic parallelization (using the OpenMP run time). Work in the area of automatic SIMD and accelerator code generation was started.

Within the LLVM 3.2 time-frame there were the following highlights:

    -
  • ...
  • +
  • isl, the integer set library used by Polly, was relicensed under the MIT license.
  • +
  • isl based code generation.
  • +
  • MIT licensed replacement for CLooG (LGPLv2).
  • +
  • Fine grained option handling (separation of core and border computations, control overhead vs. code size).
  • +
  • Support for FORTRAN and Dragonegg.
  • +
  • OpenMP code generation fixes.
  • +
+ + + + +

+Clang Static Analyzer +

+ +
+ +

The Clang Static Analyzer + is an advanced source code analysis tool integrated into Clang that performs + a deep analysis of code to find potential bugs.

+ +

In the LLVM 3.2 release, the static analyzer has made significant improvements + in many areas, with notable highlights such as:

+ +
    +
  • Improved interprocedural analysis within a translation unit (see details below), which greatly amplified the analyzer's ability to find bugs.
  • +
  • New infrastructure to model "well-known" APIs, allowing the analyzer to do a much better job when modeling calls to such functions.
  • +
  • Significant improvements to the APIs to write static analyzer checkers, with a more unified way of representing function/method calls in the checker API. Details can be found in the Building a Checker in 24 hours talk. +
+ +

The release specifically includes notable improvements for Objective-C analysis, including:

+ +
    +
  • Interprocedural analysis for Objective-C methods.
  • +
  • Interprocedural analysis of calls to "blocks".
  • +
  • Precise modeling of GCD APIs such as dispatch_once and friends.
  • +
  • Improved support for recently added Objective-C constructs such as array and dictionary literals.
  • +
+ +

The release specifically includes notable improvements for C++ analysis, including:

+ +
    +
  • Interprocedural analysis for C++ methods (within a translation unit).
  • +
  • More precise modeling of C++ initializers and destructors.
+

Finally, this release includes many small improvements to scan-build, which can be used to drive the analyzer from the command line or a continuous integration system. This includes a directory-traversal issue, which could cause potential security problems in some cases. We would like to acknowledge Tim Brown of Portcullis Computer Security Ltd for reporting this issue.

+
@@ -265,6 +323,19 @@ Release Notes. +

EmbToolkit

+ +
+ +

EmbToolkit provides Linux cross-compiler + toolchain/SDK (GCC/binutils/C library (uclibc,eglibc,musl)), a build system for + package cross-compilation and optionally various root file systems. + It supports ARM and MIPS. There is an ongoing effort to provide a clang+llvm + environment for the 3.2 releases, +

+ +
+

FAUST

@@ -274,7 +345,7 @@ Release Notes. AUdio STream. Its programming model combines two approaches: functional programming and block diagram composition. In addition with the C, C++, Java, JavaScript output formats, the Faust compiler can generate LLVM bitcode, and - works with LLVM 2.7-3.1.

+ works with LLVM 2.7-3.2.

@@ -331,7 +402,11 @@ Release Notes.

OSL was developed by Sony Pictures Imageworks for use in its in-house renderer used for feature film animation and visual effects, and is - distributed as open source software with the "New BSD" license.

+ distributed as open source software with the "New BSD" license. + It has been used for all the shading on such films as The Amazing Spider-Man, + Men in Black III, Hotel Transylvania, and may other films in-progress, + and also has been incorporated into several commercial and open source + rendering products such as Blender, VRay, and Autodesk Beast.

@@ -367,7 +442,7 @@ Release Notes. C++, Fortran and Faust code in Pure programs if the corresponding LLVM-enabled compilers are installed).

-

Pure version 0.54 has been tested and is known to work with LLVM 3.1 (and +

Pure version 0.56 has been tested and is known to work with LLVM 3.2 (and continues to work with older LLVM releases >= 2.5).

@@ -432,7 +507,9 @@ Release Notes.

LLVM 3.2 includes several major changes and big features:

    -
  • ...
  • +
  • Loop Vectorizer.
  • +
  • New implementation of SROA.
  • +
  • New NVPTX back-end (replacing existing PTX back-end) based on NVIDIA sources.
@@ -451,7 +528,10 @@ Release Notes.
  • Thread local variables may have a specified TLS model. See the Language Reference Manual.
  • -
  • ...
  • +
  • 'TYPE_CODE_FUNCTION_OLD' type code and autoupgrade code for old function attributes format has been removed.
  • +
  • Internal representation of the Attributes class has been converted into a pointer to an + opaque object that's uniqued by and stored in the LLVMContext object. + The Attributes class then becomes a thin wrapper around this opaque object.
@@ -489,23 +569,33 @@ Release Notes.
  • The inner most loops must have a single basic block.
  • The number of iterations are known before the loop starts to execute.
  • -
  • The loop counter needs to be incrimented by one.
  • +
  • The loop counter needs to be incremented by one.
  • The loop trip count can be a variable.
  • Loops do not need to start at zero.
  • The induction variable can be used inside the loop.
  • Loop reductions are supported.
  • Arrays with affine access pattern do not need to be marked as 'noalias' and are checked at runtime.
  • -
  • ...

-

SROA - We've re-written SROA to be significantly more powerful. -

+

SROA - We’ve re-written SROA to be significantly more powerful and generate +code which is much more friendly to the rest of the optimization pipeline. +Previously this pass had scaling problems that required it to only operate on +relatively small aggregates, and at times it would mistakenly replace a large +aggregate with a single very large integer in order to make it a scalar SSA +value. The result was a large number of i1024 and i2048 values representing any +small stack buffer. These in turn slowed down many subsequent optimization +paths.

+

The new SROA pass uses a different algorithm that allows it to only promote to +scalars the pieces of the aggregate actively in use. Because of this it doesn’t +require any thresholds. It also always deduces the scalar values from the uses +of the aggregate rather than the specific LLVM type of the aggregate. These +features combine to both optimize more code with the pass but to improve the +compile time of many functions dramatically.

    -
  • Branch weight metadata is preseved through more of the optimizer.
  • -
  • ...
  • +
  • Branch weight metadata is preserved through more of the optimizer.
@@ -524,8 +614,19 @@ Release Notes. Intro to the LLVM MC Project Blog Post.

-
    -
  • ...
  • +
      +
    • Added support for following assembler directives: .ifb, .ifnb, .ifc, + .ifnc, .purgem, .rept and .version (ELF) as well as Darwin specific + .pushsection, .popsection and .previous .
    • +
    • Enhanced handling of .lcomm directive.
    • +
    • MS style inline assembler: added implementation of the offset and TYPE operators.
    • +
    • Targets can specify minimum supported NOP size for NOP padding.
    • +
    • ELF improvements: added support for generating ELF objects on Windows.
    • +
    • MachO improvements: symbol-difference variables are marked as N_ABS, added direct-to-object attribute for data-in-code markers.
    • +
    • Added support for annotated disassembly output for x86 and arm targets.
    • +
    • Arm support has been improved by adding support for ARM TARGET2 relocation + and fixing hadling of ARM-style "$d.*" labels.
    • +
    • Implemented local-exec TLS on PowerPC.
    @@ -550,10 +651,6 @@ Release Notes. infrastructure, which allows us to implement more aggressive algorithms and make it run faster:

    -
      -
    • ...
    • -
    -

    We added new TableGen infrastructure to support bundling for Very Long Instruction Word (VLIW) architectures. TableGen can now automatically generate a deterministic finite automaton from a VLIW @@ -563,6 +660,13 @@ Release Notes.

    We have added a new target independent VLIW packetizer based on the DFA infrastructure to group machine instructions into bundles.

    +

    We have added new TableGen infrastructure to support relationship maps + between instructions. This feature enables TableGen to automatically + construct a set of relation tables and query functions that can be used + to switch between various forms of instructions. For more information, + please refer to + How To Use Instruction Mappings.

    +

    @@ -588,7 +692,7 @@ Release Notes.

    New features and major changes in the X86 target include:

      -
    • ...
    • +
    • Small codegen optimizations, especially for AVX2.
    @@ -603,7 +707,7 @@ Release Notes.

    New features of the ARM target include:

      -
    • ...
    • +
    • Support and performance tuning for the A6 'Swift' CPU.
    @@ -620,7 +724,7 @@ Release Notes. platform specific support for Linux.

    Full support is included for Thumb1, Thumb2 and ARM modes, along with - subtarget and CPU specific extensions for VFP2, VFP3 and NEON.

    + sub-target and CPU specific extensions for VFP2, VFP3 and NEON.

    The assembler is Unified Syntax only (see ARM Architecural Reference Manual for details). While there is some, and growing, support for pre-unfied @@ -640,7 +744,29 @@ Release Notes.

    New features and major changes in the MIPS target include:

      -
    • ...
    • +
    • Integrated assembler support: + MIPS32 works for both PIC and static, known limitation is the PR14456 where + R_MIPS_GPREL16 relocation is generated with the wrong addend. + MIPS64 support is incomplete, for example exception handling is not working.
    • +
    • Support for fast calling convention has been added.
    • +
    • Support for Android MIPS toolchain has been added to clang driver.
    • +
    • Added clang driver support for MIPS N32 ABI through "-mabi=n32" option.
    • +
    • MIPS32 and MIPS64 disassembler has been implemented.
    • +
    • Support for compiling programs with large GOTs (exceeding 64kB in size) has been added + through llc option "-mxgot".
    • +
    • Added experimental support for MIPS32 DSP intrinsics.
    • +
    • Experimental support for MIPS16 with following limitations: only soft float is supported, + C++ exceptions are not supported, large stack frames (> 32000 bytes) are not supported, + direct object code emission is not supported only .s .
    • +
    • Standalone assembler (llvm-mc): implementation is in progress and considered experimental.
    • +
    • All classic JIT and MCJIT tests pass on Little and Big Endian MIPS32 platforms.
    • +
    • Inline asm support: all common constraints and operand modifiers have been implemented.
    • +
    • Added tail call optimization support, use llc option "-enable-mips-tail-calls" + or clang options "-mllvm -enable-mips-tail-calls"to enable it.
    • +
    • Improved register allocation by removing registers $fp, $gp, $ra and $at from the list of reserved registers.
    • +
    • Long branch expansion pass has been implemented, which expands branch + instructions with offsets that do not fit in the 16-bit field.
    • +
    • Cavium Octeon II board is used for testing builds (llvm-mips-linux builder).
    @@ -652,7 +778,6 @@ Release Notes.
    -

      Many fixes and changes across LLVM (and Clang) for better compliance with the 64-bit PowerPC ELF Application Binary Interface, interoperability with GCC, and overall 64-bit PowerPC support. Some highlights include:

      @@ -681,8 +806,28 @@ Release Notes.

      There have also been code generation improvements for both 32- and 64-bit code. Instruction scheduling support for the Freescale e500mc and e5500 cores has been added.

      + +
    + + +

    +PTX/NVPTX Target Improvements +

    + +
    + +

    The PTX back-end has been replaced by the NVPTX back-end, which is based on + the LLVM back-end used by NVIDIA in their CUDA (nvcc) and OpenCL compiler. + Some highlights include:

    +
      +
    • Compatibility with PTX 3.1 and SM 3.5
    • +
    • Support for NVVM intrinsics as defined in the NVIDIA Compiler SDK
    • +
    • Full compatibility with old PTX back-end, with much greater coverage of + LLVM IR
    +

    Please submit any back-end bugs to the LLVM Bugzilla site.

    +
    @@ -693,7 +838,7 @@ Release Notes.
      -
    • ...
    • +
    • Added support for custom names for library functions in TargetLibraryInfo.
    @@ -710,9 +855,11 @@ Release Notes. from the previous release.

      -
    • ...
    • -
    - +
  • llvm-ld and llvm-stub have been removed, llvm-ld functionality can be partially replaced by + llvm-link | opt | {llc | as, llc -filetype=obj} | ld, or fully replaced by Clang.
  • +
  • MCJIT: added support for inline assembly (requires asm parser), added faux remote target execution to lli option '-remote-mcjit'.
  • +
+ @@ -733,10 +880,6 @@ Release Notes.

The TargetData structure has been renamed to DataLayout and moved to VMCore to remove a dependency on Target.

-
    -
  • ...
  • -
- @@ -746,33 +889,22 @@ to remove a dependency on Target.

-

In addition, some tools have changed in this release. Some of the changes - are:

- -
    -
  • ...
  • -
- -
- - - -

-Python Bindings -

- -
- -

Officially supported Python bindings have been added! Feature support is far - from complete. The current bindings support interfaces to:

+

In addition, some tools have changed in this release. Some of the changes are:

    -
  • ...
  • +
  • opt: added support for '-mtriple' option.
  • +
  • llvm-mc : - added '-disassemble' support for '-show-inst' and '-show-encoding' options, added '-edis' option to produce annotated + disassembly output for X86 and ARM targets.
  • +
  • libprofile: allows the profile data file name to be specified by the LLVMPROF_OUTPUT environment variable.
  • +
  • llvm-objdump: has been changed to display available targets, '-arch' option accepts x86 and x86-64 as valid arch names.
  • +
  • llc and opt: added FMA formation from pairs of FADD + FMUL or FSUB + FMUL enabled by option '-enable-excess-fp-precision' or option '-enable-unsafe-fp-math', + option '-fp-contract' controls the creation by optimizations of fused FP by selecting Fast, Standard, or Strict mode.
  • +
  • llc: object file output from llc is no longer considered experimental.
  • +
  • gold plugin: handles Position Independent Executables.
-

@@ -794,7 +926,7 @@ to remove a dependency on Target.

Known problem areas include:

    -
  • The CellSPU, MSP430, PTX and XCore backends are experimental.
  • +
  • The CellSPU, MSP430, and XCore backends are experimental, and the CellSPU backend will be removed in LLVM 3.3.
  • The integrated assembler, disassembler, and JIT is not supported by several targets. If an integrated assembler is not supported, then a @@ -836,7 +968,7 @@ to remove a dependency on Target.

    src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2012-11-20 05:22:44 +0100 (Tue, 20 Nov 2012) $ + Last modified: $Date: 2012-12-19 11:50:28 +0100 (Wed, 19 Dec 2012) $ Modified: vendor/llvm/dist/include/llvm/MC/MCExpr.h ============================================================================== --- vendor/llvm/dist/include/llvm/MC/MCExpr.h Sat Dec 22 14:35:46 2012 (r244589) +++ vendor/llvm/dist/include/llvm/MC/MCExpr.h Sat Dec 22 14:58:30 2012 (r244590) @@ -197,7 +197,11 @@ public: VK_Mips_GOT_PAGE, VK_Mips_GOT_OFST, VK_Mips_HIGHER, - VK_Mips_HIGHEST + VK_Mips_HIGHEST, + VK_Mips_GOT_HI16, + VK_Mips_GOT_LO16, + VK_Mips_CALL_HI16, + VK_Mips_CALL_LO16 }; private: Modified: vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp ============================================================================== --- vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Sat Dec 22 14:35:46 2012 (r244589) +++ vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Sat Dec 22 14:58:30 2012 (r244590) @@ -346,7 +346,7 @@ uint8_t *RuntimeDyldImpl::createStubFunc uint32_t *StubAddr = (uint32_t*)Addr; *StubAddr = 0xe51ff004; // ldr pc,