From owner-svn-src-head@FreeBSD.ORG Sun Dec 16 00:20:17 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 01:00:41 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 04:07:35 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 04:36:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B4EB81D6 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 537568FC0C for ; Sun, 16 Dec 2012 04:36:43 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so5924317vba.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=NkmBFkIGuQZ4R9bmHHn8VHCcoTqlld8lQEcW9VLb9E09EZwXLtKAErDNVulSYjhtKM gAVyxJ08xQkeBN1yi/s3IrGKHnqkiT4HmsSMrmKkv4TxCWUijFni+oO9zCZsysuMnz1s vpxor5vV8XjhE+Q18Qc/2kR+QDrxknrluN/stgqBaBIBG2lBH0D0IqFk6NZ3D3sQwGrY p0KEf8gWPUhiVWpJOwz28Rb+IxlrkmuBp0aWEfSLp8jSR0UhLh+io6lme3Kk3zX3ihCq LuQVShQKCsv4Ti8viLq3+iXmcmnaCgHi9wFaQbEU2OLJbeNyg31zQb+QCXOG0YNp9jt8 +AZA== 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: ALoCoQm+s/1CY9JNdhV0NybJ8EUwIdGfoOvCAItJkgKEvpKxJwqzIGBTXImtpUrS3Uy5F/ZIR6RP Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 05:01:16 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 07:45:51 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 08:06:10 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 08:09:47 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 09:10:29 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 09:59:39 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 13:56:38 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 14:14:19 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 14:24:59 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 14:37:26 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 14:53:28 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 17:23:15 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 18:49:52 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 19:17:03 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 20:43:30 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 20:54:07 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 22:59:26 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 22:59:59 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 23:00:14 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 23:04:32 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 23:06:13 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 23:09:28 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 23:29:57 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 23:32:22 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Dec 16 23:47:00 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Mon Dec 17 00:31:56 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 00:34:08 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 03:05:52 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 06:01:58 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 09:36:44 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 10:10:14 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 10:12:13 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 10:38:51 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 10:48:11 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 10:51:23 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 11:31:58 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 11:47:41 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 12:50:06 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 12:57:37 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 13:16:57 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 14:36:57 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 16:40:06 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 19:17:10 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 20:55:34 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 21:09:45 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 21:16:52 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 21:16:57 2012 Return-Path: Delivered-To: svn-src-head@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:35 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 21:21:47 2012 Return-Path: Delivered-To: svn-src-head@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: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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 21:47:38 2012 Return-Path: Delivered-To: svn-src-head@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: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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 22:12:47 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 22:02:56 2012 Return-Path: Delivered-To: svn-src-head@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:39 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Dec 17 22:23:57 2012 Return-Path: Delivered-To: svn-src-head@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:45 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Tue Dec 18 00:00:08 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 00:25:51 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 01:17:08 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 04:44:36 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 05:40:28 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 05:45:30 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 06:37:23 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 07:26:56 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 07:27:51 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 07:35:02 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 07:36:46 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 08:09:45 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 08:14:16 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 08:24:39 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 08:28:50 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 08:41:24 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 08:44:59 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 08:53:08 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 09:27:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7707CCAA 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 D02508FC15 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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 09:50:47 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 09:51:47 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 10:08:01 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 11:30:55 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 12:36:19 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F3B5DC31 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 4E3198FC17 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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 12:37:53 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A6E8FE98 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 EECAA8FC15 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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 13:13:09 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 14:46:33 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 16:11:14 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 16:15:21 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 16:16:17 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 16:37:27 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 18:34:37 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 20:02:54 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 20:44:52 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 20:45:02 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 20:47:24 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 21:02:39 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 20:45:11 2012 Return-Path: Delivered-To: svn-src-head@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:37 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 21:13:04 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 21:42:46 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 21:50:49 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 22:10:41 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 22:18:55 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 23:27:19 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 22:31:48 2012 Return-Path: Delivered-To: svn-src-head@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:46:14 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 22:41:22 2012 Return-Path: Delivered-To: svn-src-head@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:46:14 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Dec 18 22:45:26 2012 Return-Path: Delivered-To: svn-src-head@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:46:14 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Wed Dec 19 00:24:32 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 04:18:22 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 05:07:27 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 09:55:13 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 10:57:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 84BF45E2 for ; Wed, 19 Dec 2012 10:57:47 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) by mx1.freebsd.org (Postfix) with ESMTP id E5A748FC0C for ; Wed, 19 Dec 2012 10:57:46 +0000 (UTC) Received: by mail-lb0-f171.google.com with SMTP id gf7so1603885lbb.16 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=d3uWGahHyMqsEFRoP8PXxk+l72GaPKqWv4zl84c+KjOMx0SPrZParmWaDjWF3SqdQZ UAQzmwydZ8haKseSi6znjReCbLKTFP61q/zXTgm06S3sUn4I/00cZH2CTwW6EcvuMZ9j fv/N1PEXdZO3Ix0gyao1CaaXthvgKJ/zpkReO5xIt9AaerFn8jIWpyRdBsF9g9UUidnv IOybFRc117+Jm7rP1bNkKMBtwWZwo+6e2/3geanUThiso06Yfpixb0LBScwOyRjH5S5w laGPyP54v7FBp/KUg7ZZJwm7uVMrTJ1MDyGP7ILbKgAJAOFWhnezkCawA9ZgsJqqkjEL FsLw== 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: ALoCoQm2l8T1Y4kCxupvTA34dftt606tkCRd+YDoIBxn2Nf8LE715CTiCUJyRzi15no8fWUK5kp5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 10:59:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2996A7E3 for ; Wed, 19 Dec 2012 10:59:56 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com [209.85.215.49]) by mx1.freebsd.org (Postfix) with ESMTP id 868FA8FC17 for ; Wed, 19 Dec 2012 10:59:55 +0000 (UTC) Received: by mail-la0-f49.google.com with SMTP id r15so1434222lag.8 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=QjYi8Y55Q8RgewxGaWWvzhM23fLultN1WlJ4bRMo/q2sNw1/XHMjya6O/0PS7jkl+K oKu/pqcX1eyqhUipR5WJE8EI+E5SOpkhro7uH0pMYAuMNI92bqis0ztlFn4QTCPQ1EGM k12xbkbocI+IaKgL9sZI0Gv1pKsoVI0v3zubsnalKtZWCxB1wObCtoSI4j9XWZ5q6d9x h8nELMZcyBgBn+Kt9gHyHqHGYKXE9fawwDoCiECOjzQWDgj278m5NjfbDGZ/ZoEvCREM MfXy9oEji2XqIYi9ANpoxJ9Ex5psaF6ZkLBH3p9iKVwWpXLj284g4DivNhO+gusS90Y9 0lJg== 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: ALoCoQkkhg1/o/HZlPCY5LWL+PZsmbZPjgM3d+I1YH0zPohhnVeYj+mCk1h/pmxw7GmEG4vGf2lI Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 11:04:11 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 12:00:10 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 12:10:15 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 12:12:53 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 12:14:08 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 12:52:34 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 15:03:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3D8A014E for ; Wed, 19 Dec 2012 15:03:04 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com [209.85.215.45]) by mx1.freebsd.org (Postfix) with ESMTP id A44278FC16 for ; Wed, 19 Dec 2012 15:03:03 +0000 (UTC) Received: by mail-la0-f45.google.com with SMTP id p9so1540224laa.32 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=Ry9Eyf/gsA6ng8ezwWypv3ZHKy5Ggf/2k5r5tY4uCBNFJNQjQbJ0uh5+IobzrX3bXm ++FyT90oxOUl8BoCnVi9OMadsnskGv89Tv48t6Vnty/o++et4KRCNzCt+JCVQgG1YWZ/ YNYBjRTHRAssSRoYDtEMHIQuRy4Q46i4HsIUvSjQuUYIOSL5X8FFIwQm/w8FC9d9HNbW 0g/4Qpij60DbJGtRIb8yD1okgNB51GdvGckAk4l1zXGAKOtDwsOAn7xAX08j+TmyL7kU KGcdN/FfVBbpPH+CXcT21ZOgRmlB0gt4MKu+u+sv57fLOoseWOI+hL3pr+9fa4zmTRVV 6P3Q== 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: ALoCoQm4iwJhIUpyli0raz/tA3v3sjefDvXGe+qu+X2pMHbUP0LwokhvofTKMTNEsGHdl9NqDNJK Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 15:37:43 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 15:52:51 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 15:56:51 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 16:23:22 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 17:02:08 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 17:08:50 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 17:28:18 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 17:37:19 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 19:04:22 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 19:16:33 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 19:37:07 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 19:42:03 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 20:08:07 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 20:10:01 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 20:20:08 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 20:33:17 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 21:00:23 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 21:04:22 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 21:08:27 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 21:10:15 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 21:12:29 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 22:07:39 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 21:59:31 2012 Return-Path: Delivered-To: svn-src-head@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:24:45 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 22:02:11 2012 Return-Path: Delivered-To: svn-src-head@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:24:52 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 22:28:54 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 22:31:01 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 22:37:16 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 22:44:31 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 23:40:02 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 23:59:49 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Thu Dec 20 00:06:25 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Wed Dec 19 22:52:22 2012 Return-Path: Delivered-To: svn-src-head@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:10:16 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 22:59:08 2012 Return-Path: Delivered-To: svn-src-head@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:38 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 23:21:53 2012 Return-Path: Delivered-To: svn-src-head@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:45 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Dec 19 23:59:27 2012 Return-Path: Delivered-To: svn-src-head@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:45 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Thu Dec 20 00:34:55 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 00:35:27 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 00:38:08 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 00:50:04 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 00:57:25 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 02:22:37 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 03:33:34 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 00:26:58 2012 Return-Path: Delivered-To: svn-src-head@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:54:49 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 04:32:06 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 04:47:32 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 05:02:13 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 11:39:20 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 16:21:03 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 17:14:11 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 17:38:15 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 18:13:38 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 18:38:03 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 19:51:33 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 20:18:28 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 22:07:48 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 22:26:04 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 22:30:41 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 23:18:37 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Dec 20 23:21:21 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Fri Dec 21 01:19:49 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 01:31:56 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 02:07:48 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 02:18:11 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 04:28:06 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 04:44:41 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 04:47:08 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 05:22:15 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 10:09:45 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 10:09:46 -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-head@FreeBSD.ORG Fri Dec 21 11:59:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 771AAB2A for ; Fri, 21 Dec 2012 11:59:25 +0000 (UTC) (envelope-from vinaymba4@gmail.com) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx1.freebsd.org (Postfix) with ESMTP id 3F8F28FC0A for ; Fri, 21 Dec 2012 11:59:25 +0000 (UTC) Received: by mail-pa0-f50.google.com with SMTP id hz10so2793215pad.9 for ; Fri, 21 Dec 2012 03:59:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:reply-to:from:to:subject:date:mime-version :content-type:x-mailer:thread-index:x-mimeole; bh=f5NX+VM+MuVSw6mgZzNzZ1tYWVNZ2WhER1xKP7v9R6I=; b=tU6tbuB/FHTM4JnBJNA62UNiMsfcGtGkxjRixEEIir5765XcOjSjZsfdtOFgfD3PTj +DaeaqBMA9L22U4rb9Jzj3wnfotLBYkI4Ao/Gd5Xz3p4+Ynjg4fbJOGMtp+9IC5f1ki/ Mh8smtKmzJYVxZ6/yBlymUBnK2a6Vy6p5Ef23ahdERLUyRlb9YmKL1MVZIqRginC+Gx8 gJD+asIb3yNHpg829rWb0liIZtmgYrHPduncEaLcWI0OMygXbEoPR5mYNk8BnL89WVxf CJfSIOFcJENs5xN6A9L7GQEqSTeTsC+Pk5NV2kMifl1lgGeM4WBOosRBRzklTKvmdIi2 1IVg== X-Received: by 10.68.232.201 with SMTP id tq9mr39091389pbc.12.1356091159388; Fri, 21 Dec 2012 03:59:19 -0800 (PST) Received: from infoicone44de9 ([122.177.228.13]) by mx.google.com with ESMTPS id s5sm7272616pay.31.2012.12.21.03.59.17 (version=SSLv3 cipher=OTHER); Fri, 21 Dec 2012 03:59:18 -0800 (PST) Message-ID: <50d44f16.c553420a.6f53.3ebf@mx.google.com> From: "Vinay" To: Subject: Web Design Proposal!!! Date: Fri, 21 Dec 2012 17:25:42 +0530 MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: Ac3fcbWVPlcqgbAOTC+NSO1g4pPqrQ== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: vinaymba4@gmail.com List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 11:59:25 -0000 Hello, I am Vinay, Business Development Consultant. I was on your website. I have analyzed your website. Would you be interested in a possible redesign of the site or additional features that might benefit the overall usability and user experience which usually leads to better sales of your services. We would be happy to help execute Web Design & Software Development projects on a white label basis for you. Our aim is to be the best in service and as such we offer a premium service at very competitive prices than what it might be in house. We have a three tier quality check system so No compromise on quality! We provide Web Design & Development to a number of agencies, and establishments and have expertise in- Developing highly effective corporate websites, flash designs, E- Commerce/Online Web Stores to name a few. PHP, MySQL, .NET, Joomla, Wordpress, Perl, Drupal, ASP, JSP, HTML, CSS. Design- Flash, Photoshop, Corel E-Commerce - OS Commerce, Zen Cart, Virtue Mart, Pay Pal , Fedex and any checkout payment gateway systems. Do let me know if you are interested and I would be happy to share our Methodologies, past work details and client Testimonials and Prices. Kind Regards, Vinay Business Development Consultant From owner-svn-src-head@FreeBSD.ORG Fri Dec 21 12:11:50 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 12:37:29 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 13:14:13 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 14:17:40 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 15:15:35 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 15:52:11 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 15:54:16 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 16:58:50 2012 Return-Path: Delivered-To: svn-src-head@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:40 +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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 18:58:22 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 19:13:49 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 19:26:21 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 19:28:18 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 19:45:47 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 20:01:14 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 20:11:43 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 20:21:57 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Devin Teske List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 20:29:29 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 20:36:13 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 20:37:41 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 20:46:59 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 21:00:01 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 21:03:35 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 21:33:48 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 21:41:23 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 21:49:15 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Dec 21 22:21:00 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Sat Dec 22 01:03:24 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 01:04:29 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 01:16:28 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 01:17:50 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 02:57:26 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 04:12:00 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 04:53:36 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 07:47:07 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 09:37:35 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 09:51:52 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 09:57:10 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 12:20:09 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 12:24:34 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 13:33:29 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 13:43:13 2012 Return-Path: Delivered-To: svn-src-head@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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Dec 22 15:13:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 97AF71AC; Sat, 22 Dec 2012 15:13:17 +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 7CBF68FC13; Sat, 22 Dec 2012 15:13: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 qBMFDHFN000658; Sat, 22 Dec 2012 15:13:17 GMT (envelope-from matthew@svn.freebsd.org) Received: (from matthew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBMFDHBS000657; Sat, 22 Dec 2012 15:13:17 GMT (envelope-from matthew@svn.freebsd.org) Message-Id: <201212221513.qBMFDHBS000657@svn.freebsd.org> From: Matthew Seaman Date: Sat, 22 Dec 2012 15:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244594 - 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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 15:13:17 -0000 Author: matthew (ports committer) Date: Sat Dec 22 15:13:16 2012 New Revision: 244594 URL: http://svnweb.freebsd.org/changeset/base/244594 Log: Switch from 'pkg -n' to 'pkg -N' as the test for pkgn activation status. '-n' is already used extensively elsewhere in pkgng (to mean 'dry-run') and this reduces the potential confusion Submitted by: eadler 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 Sat Dec 22 15:01:29 2012 (r244593) +++ head/usr.sbin/pkg/pkg.c Sat Dec 22 15:13:16 2012 (r244594) @@ -453,11 +453,11 @@ main(__unused int argc, char *argv[]) if (access(pkgpath, X_OK) == -1) { /* - * To allow 'pkg -n' to be used as a reliable test for whether + * 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) { + if ( argv[1] != NULL && strcmp(argv[1], "-N") == 0) { printf("%s", "pkg is not installed\n"); exit(EXIT_FAILURE); } From owner-svn-src-head@FreeBSD.ORG Sat Dec 22 18:57:39 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 85188D2C; Sat, 22 Dec 2012 18:57:39 +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 B31D98FC12; Sat, 22 Dec 2012 18:57:38 +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 qBMIvbpr078978; Sat, 22 Dec 2012 12:57:37 -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 qBMIvbAa078977; Sat, 22 Dec 2012 12:57:37 -0600 (CST) (envelope-from brooks) Date: Sat, 22 Dec 2012 12:57:37 -0600 From: Brooks Davis To: Andrew Turner Subject: Re: svn commit: r244579 - head/usr.sbin/nmtree Message-ID: <20121222185737.GB47912@lor.one-eyed-alien.net> References: <201212220453.qBM4rZwa009693@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LyciRD1jyfeSSjG0" Content-Disposition: inline In-Reply-To: <201212220453.qBM4rZwa009693@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 18:57:39 -0000 --LyciRD1jyfeSSjG0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 22, 2012 at 04:53:35AM +0000, Andrew Turner wrote: > Author: andrew > Date: Sat Dec 22 04:53:35 2012 > New Revision: 244579 > URL: http://svnweb.freebsd.org/changeset/base/244579 >=20 > Log: > Add the missing '$' from the LIBNETBSD variable Thanks! -- Brooks --LyciRD1jyfeSSjG0 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFQ1gKhXY6L6fI4GtQRAkRwAKCWm9f3I5PfjGtfjVIR79z5J1nI/ACgyTKP zn3EiSw4FSCFZnRUv8HWCKI= =ASFq -----END PGP SIGNATURE----- --LyciRD1jyfeSSjG0-- From owner-svn-src-head@FreeBSD.ORG Sat Dec 22 20:16:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C668EC8E; Sat, 22 Dec 2012 20:16:21 +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 A9E028FC15; Sat, 22 Dec 2012 20:16: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 qBMKGLX9045024; Sat, 22 Dec 2012 20:16:21 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBMKGLnl045023; Sat, 22 Dec 2012 20:16:21 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201212222016.qBMKGLnl045023@svn.freebsd.org> From: Dimitry Andric Date: Sat, 22 Dec 2012 20:16:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244598 - head/contrib/llvm/lib/Transforms/Scalar X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 20:16:21 -0000 Author: dim Date: Sat Dec 22 20:16:21 2012 New Revision: 244598 URL: http://svnweb.freebsd.org/changeset/base/244598 Log: Pull in r170353 from upstream llvm trunk: Fix another SROA crasher, PR14601. This was a silly oversight, we weren't pruning allocas which were used by variable-length memory intrinsics from the set that could be widened and promoted as integers. Fix that. This should fix the following assertion failure: Assertion failed: (CanSROA), function visitUsers, file /usr/src/lib/clang/libllvmscalaropts/../../../contrib/llvm/lib/Transforms/Scalar/SROA.cpp, line 2395. Reported by: gerald Modified: head/contrib/llvm/lib/Transforms/Scalar/SROA.cpp Modified: head/contrib/llvm/lib/Transforms/Scalar/SROA.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Scalar/SROA.cpp Sat Dec 22 20:05:42 2012 (r244597) +++ head/contrib/llvm/lib/Transforms/Scalar/SROA.cpp Sat Dec 22 20:16:21 2012 (r244598) @@ -2224,7 +2224,7 @@ static bool isIntegerWideningViable(cons !canConvertValue(TD, ValueTy, AllocaTy)) return false; } else if (MemIntrinsic *MI = dyn_cast(I->U->getUser())) { - if (MI->isVolatile()) + if (MI->isVolatile() || !isa(MI->getLength())) return false; if (MemTransferInst *MTI = dyn_cast(I->U->getUser())) { const AllocaPartitioning::MemTransferOffsets &MTO From owner-svn-src-head@FreeBSD.ORG Sat Dec 22 20:46:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 06E6D211; Sat, 22 Dec 2012 20:46:47 +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 DF6298FC0A; Sat, 22 Dec 2012 20:46: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 qBMKkkER049292; Sat, 22 Dec 2012 20:46:46 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBMKkkcJ049291; Sat, 22 Dec 2012 20:46:46 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201212222046.qBMKkkcJ049291@svn.freebsd.org> From: Dimitry Andric Date: Sat, 22 Dec 2012 20:46:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244600 - head/contrib/binutils/bfd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 20:46:47 -0000 Author: dim Date: Sat Dec 22 20:46:46 2012 New Revision: 244600 URL: http://svnweb.freebsd.org/changeset/base/244600 Log: Fix a bug in ld --gc-sections: it strips out .note sections, while it should never do so. This can cause global constructors and destructors to not be executed at run-time, resulting in crashes and other strange behaviour. Reported by: rene MFC after: 1 week Modified: head/contrib/binutils/bfd/elflink.c Modified: head/contrib/binutils/bfd/elflink.c ============================================================================== --- head/contrib/binutils/bfd/elflink.c Sat Dec 22 20:35:45 2012 (r244599) +++ head/contrib/binutils/bfd/elflink.c Sat Dec 22 20:46:46 2012 (r244600) @@ -10584,6 +10584,7 @@ elf_gc_sweep (bfd *abfd, struct bfd_link { /* Keep debug and special sections. */ if ((o->flags & (SEC_DEBUGGING | SEC_LINKER_CREATED)) != 0 + || elf_section_data (o)->this_hdr.sh_type == SHT_NOTE || (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0) o->gc_mark = 1; From owner-svn-src-head@FreeBSD.ORG Sat Dec 22 21:00:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3B2E85E7; Sat, 22 Dec 2012 21:00:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id E264C8FC0A; Sat, 22 Dec 2012 21:00:38 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:84e5:2627:88f9:e626] (unknown [IPv6:2001:7b8:3a7:0:84e5:2627:88f9:e626]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 061B85C5A; Sat, 22 Dec 2012 22:00:38 +0100 (CET) Message-ID: <50D61F79.3070705@FreeBSD.org> Date: Sat, 22 Dec 2012 22:00:41 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20121128 Thunderbird/18.0 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r244600 - head/contrib/binutils/bfd References: <201212222046.qBMKkkcJ049291@svn.freebsd.org> In-Reply-To: <201212222046.qBMKkkcJ049291@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 21:00:39 -0000 On 2012-12-22 21:46, Dimitry Andric wrote: > Author: dim > Date: Sat Dec 22 20:46:46 2012 > New Revision: 244600 > URL: http://svnweb.freebsd.org/changeset/base/244600 > > Log: > Fix a bug in ld --gc-sections: it strips out .note sections, while it > should never do so. This can cause global constructors and destructors > to not be executed at run-time, resulting in crashes and other strange > behaviour. Sample program: #include class Foo { public: Foo() { std::cout << "Foo::Foo()" << std::endl; } ~Foo() { std::cout << "Foo::~Foo()" << std::endl; } }; Foo foo; int main(void) { std::cout << "main()" << std::endl; return 0; } Compiling this normally is fine: $ c++ gctest.cpp -o gctest $ ./gctest Foo::Foo() main() Foo::~Foo() $ readelf -n gctest Notes at offset 0x0000014c with length 0x00000030: Owner Data size Description FreeBSD 0x00000004 NT_VERSION (version) FreeBSD 0x00000004 NT_ARCH (architecture) Linking with --gc-sections makes it crash: $ c++ gctest.cpp -o gctest -Wl,--gc-sections $ ./gctest Segmentation fault (core dumped) $ readelf -n gctest [...no output...] From owner-svn-src-head@FreeBSD.ORG Sat Dec 22 21:32:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6F41BA29; Sat, 22 Dec 2012 21:32:14 +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 5296E8FC0A; Sat, 22 Dec 2012 21:32: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 qBMLWENd059362; Sat, 22 Dec 2012 21:32:14 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBMLWDMm059351; Sat, 22 Dec 2012 21:32:13 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201212222132.qBMLWDMm059351@svn.freebsd.org> From: Martin Matuska Date: Sat, 22 Dec 2012 21:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244601 - in head/contrib/xz: . po src/common src/liblzma/api/lzma src/liblzma/simple src/xz X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 21:32:14 -0000 Author: mm Date: Sat Dec 22 21:32:12 2012 New Revision: 244601 URL: http://svnweb.freebsd.org/changeset/base/244601 Log: MFV r244559: Update contrib/xz to version 5.0.4 MFC after: 2 weeks Modified: head/contrib/xz/AUTHORS head/contrib/xz/ChangeLog head/contrib/xz/README head/contrib/xz/THANKS head/contrib/xz/po/de.po head/contrib/xz/po/fr.po head/contrib/xz/po/it.po head/contrib/xz/po/pl.po head/contrib/xz/src/common/sysdefs.h head/contrib/xz/src/liblzma/api/lzma/version.h head/contrib/xz/src/liblzma/simple/simple_coder.c head/contrib/xz/src/liblzma/simple/simple_private.h head/contrib/xz/src/xz/args.c head/contrib/xz/src/xz/coder.c head/contrib/xz/src/xz/message.c head/contrib/xz/src/xz/xz.1 Directory Properties: head/contrib/xz/ (props changed) Modified: head/contrib/xz/AUTHORS ============================================================================== --- head/contrib/xz/AUTHORS Sat Dec 22 20:46:46 2012 (r244600) +++ head/contrib/xz/AUTHORS Sat Dec 22 21:32:12 2012 (r244601) @@ -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: head/contrib/xz/ChangeLog ============================================================================== --- head/contrib/xz/ChangeLog Sat Dec 22 20:46:46 2012 (r244600) +++ head/contrib/xz/ChangeLog Sat Dec 22 21:32:12 2012 (r244601) @@ -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: head/contrib/xz/README ============================================================================== --- head/contrib/xz/README Sat Dec 22 20:46:46 2012 (r244600) +++ head/contrib/xz/README Sat Dec 22 21:32:12 2012 (r244601) @@ -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: head/contrib/xz/THANKS ============================================================================== --- head/contrib/xz/THANKS Sat Dec 22 20:46:46 2012 (r244600) +++ head/contrib/xz/THANKS Sat Dec 22 21:32:12 2012 (r244601) @@ -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: head/contrib/xz/po/de.po ============================================================================== --- head/contrib/xz/po/de.po Sat Dec 22 20:46:46 2012 (r244600) +++ head/contrib/xz/po/de.po Sat Dec 22 21:32:12 2012 (r244601) @@ -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-head@FreeBSD.ORG Sat Dec 22 23:21:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19E8ED77; Sat, 22 Dec 2012 23:21:18 +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 E8C328FC13; Sat, 22 Dec 2012 23:21: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 qBMNLHIG075544; Sat, 22 Dec 2012 23:21:17 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBMNLHGo075542; Sat, 22 Dec 2012 23:21:17 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201212222321.qBMNLHGo075542@svn.freebsd.org> From: Rick Macklem Date: Sat, 22 Dec 2012 23:21:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244604 - 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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 23:21:18 -0000 Author: rmacklem Date: Sat Dec 22 23:21:17 2012 New Revision: 244604 URL: http://svnweb.freebsd.org/changeset/base/244604 Log: It was reported via email that some sshds create kerberos credential cache files with names other than /tmp/krb5cc_. The gssd daemon does not know how to find these credential caches. This patch implements a new option "-s" that does a search for credential cache files, using roughly the same algorithm as the gssd daemon for Linux uses. The gssd behaviour is only changed if the new "-s" option is specified. It also implements two other new options related to the "-s" option. Reported by: Piete.Brooks at cl.cam.ac.uk, Herbert Poeckl Tested by: Herbert Poeckl (admin at ist.tugraz.at), Illias A. Marinos MFC after: 2 weeks Modified: head/usr.sbin/gssd/gssd.c Modified: head/usr.sbin/gssd/gssd.c ============================================================================== --- head/usr.sbin/gssd/gssd.c Sat Dec 22 22:27:57 2012 (r244603) +++ head/usr.sbin/gssd/gssd.c Sat Dec 22 23:21:17 2012 (r244604) @@ -35,7 +35,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -64,8 +66,12 @@ int gss_resource_count; uint32_t gss_next_id; uint32_t gss_start_time; int debug_level; +static char ccfile_dirlist[PATH_MAX + 1], ccfile_substring[NAME_MAX + 1]; +static char pref_realm[1024]; static void gssd_load_mech(void); +static int find_ccache_file(const char *, uid_t, char *); +static int is_a_valid_tgt_cache(const char *, uid_t, int *, time_t *); extern void gssd_1(struct svc_req *rqstp, SVCXPRT *transp); extern int gssd_syscall(char *path); @@ -82,14 +88,45 @@ main(int argc, char **argv) int fd, oldmask, ch, debug; SVCXPRT *xprt; + /* + * Initialize the credential cache file name substring and the + * search directory list. + */ + strlcpy(ccfile_substring, "krb5cc_", sizeof(ccfile_substring)); + ccfile_dirlist[0] = '\0'; + pref_realm[0] = '\0'; debug = 0; - while ((ch = getopt(argc, argv, "d")) != -1) { + while ((ch = getopt(argc, argv, "ds:c:r:")) != -1) { switch (ch) { case 'd': debug_level++; break; + case 's': + /* + * Set the directory search list. This enables use of + * find_ccache_file() to search the directories for a + * suitable credentials cache file. + */ + strlcpy(ccfile_dirlist, optarg, sizeof(ccfile_dirlist)); + break; + case 'c': + /* + * Specify a non-default credential cache file + * substring. + */ + strlcpy(ccfile_substring, optarg, + sizeof(ccfile_substring)); + break; + case 'r': + /* + * Set the preferred realm for the credential cache tgt. + */ + strlcpy(pref_realm, optarg, sizeof(pref_realm)); + break; default: - fprintf(stderr, "usage: %s [-d]\n", argv[0]); + fprintf(stderr, + "usage: %s [-d] [-s dir-list] [-c file-substring]" + " [-r preferred-realm]\n", argv[0]); exit(1); break; } @@ -267,13 +304,52 @@ gssd_init_sec_context_1_svc(init_sec_con gss_cred_id_t cred = GSS_C_NO_CREDENTIAL; gss_ctx_id_t ctx = GSS_C_NO_CONTEXT; gss_name_t name = GSS_C_NO_NAME; - char ccname[strlen("FILE:/tmp/krb5cc_") + 6 + 1]; + char ccname[PATH_MAX + 5 + 1], *cp, *cp2; + int gotone; - snprintf(ccname, sizeof(ccname), "FILE:/tmp/krb5cc_%d", - (int) argp->uid); + memset(result, 0, sizeof(*result)); + if (ccfile_dirlist[0] != '\0' && argp->cred == 0) { + /* + * For the "-s" case and no credentials provided as an + * argument, search the directory list for an appropriate + * credential cache file. If the search fails, return failure. + */ + gotone = 0; + cp = ccfile_dirlist; + do { + cp2 = strchr(cp, ':'); + if (cp2 != NULL) + *cp2 = '\0'; + gotone = find_ccache_file(cp, argp->uid, ccname); + if (gotone != 0) + break; + if (cp2 != NULL) + *cp2++ = ':'; + cp = cp2; + } while (cp != NULL && *cp != '\0'); + if (gotone == 0) { + result->major_status = GSS_S_CREDENTIALS_EXPIRED; + return (TRUE); + } + } else { + /* + * If there wasn't a "-s" option or the credentials have + * been provided as an argument, do it the old way. + * When credentials are provided, the uid should be root. + */ + if (argp->cred != 0 && argp->uid != 0) { + if (debug_level == 0) + syslog(LOG_ERR, "gss_init_sec_context:" + " cred for non-root"); + else + fprintf(stderr, "gss_init_sec_context:" + " cred for non-root\n"); + } + snprintf(ccname, sizeof(ccname), "FILE:/tmp/krb5cc_%d", + (int) argp->uid); + } setenv("KRB5CCNAME", ccname, TRUE); - memset(result, 0, sizeof(*result)); if (argp->cred) { cred = gssd_find_resource(argp->cred); if (!cred) { @@ -296,7 +372,6 @@ gssd_init_sec_context_1_svc(init_sec_con } } - memset(result, 0, sizeof(*result)); result->major_status = gss_init_sec_context(&result->minor_status, cred, &ctx, name, argp->mech_type, argp->req_flags, argp->time_req, argp->input_chan_bindings, @@ -516,13 +591,53 @@ gssd_acquire_cred_1_svc(acquire_cred_arg { gss_name_t desired_name = GSS_C_NO_NAME; gss_cred_id_t cred; - char ccname[strlen("FILE:/tmp/krb5cc_") + 6 + 1]; + char ccname[PATH_MAX + 5 + 1], *cp, *cp2; + int gotone; - snprintf(ccname, sizeof(ccname), "FILE:/tmp/krb5cc_%d", - (int) argp->uid); + memset(result, 0, sizeof(*result)); + if (ccfile_dirlist[0] != '\0' && argp->desired_name == 0) { + /* + * For the "-s" case and no name provided as an + * argument, search the directory list for an appropriate + * credential cache file. If the search fails, return failure. + */ + gotone = 0; + cp = ccfile_dirlist; + do { + cp2 = strchr(cp, ':'); + if (cp2 != NULL) + *cp2 = '\0'; + gotone = find_ccache_file(cp, argp->uid, ccname); + if (gotone != 0) + break; + if (cp2 != NULL) + *cp2++ = ':'; + cp = cp2; + } while (cp != NULL && *cp != '\0'); + if (gotone == 0) { + result->major_status = GSS_S_CREDENTIALS_EXPIRED; + return (TRUE); + } + } else { + /* + * If there wasn't a "-s" option or the name has + * been provided as an argument, do it the old way. + * When a name is provided, it will normally exist in the + * default keytab file and the uid will be root. + */ + if (argp->desired_name != 0 && argp->uid != 0) { + if (debug_level == 0) + syslog(LOG_ERR, "gss_acquire_cred:" + " principal_name for non-root"); + else + fprintf(stderr, "gss_acquire_cred:" + " principal_name for non-root\n"); + } + snprintf(ccname, sizeof(ccname), "FILE:/tmp/krb5cc_%d", + (int) argp->uid); + } setenv("KRB5CCNAME", ccname, TRUE); - memset(result, 0, sizeof(*result)); if (argp->desired_name) { desired_name = gssd_find_resource(argp->desired_name); if (!desired_name) { @@ -631,3 +746,172 @@ gssd_1_freeresult(SVCXPRT *transp, xdrpr return (TRUE); } + +/* + * Search a directory for the most likely candidate to be used as the + * credential cache for a uid. If successful, return 1 and fill the + * file's path id into "rpath". Otherwise, return 0. + */ +static int +find_ccache_file(const char *dirpath, uid_t uid, char *rpath) +{ + DIR *dirp; + struct dirent *dp; + struct stat sb; + time_t exptime, oexptime; + int gotone, len, rating, orating; + char namepath[PATH_MAX + 5 + 1]; + char retpath[PATH_MAX + 5 + 1]; + + dirp = opendir(dirpath); + if (dirp == NULL) + return (0); + gotone = 0; + orating = 0; + oexptime = 0; + while ((dp = readdir(dirp)) != NULL) { + len = snprintf(namepath, sizeof(namepath), "%s/%s", dirpath, + dp->d_name); + if (len < sizeof(namepath) && + strstr(dp->d_name, ccfile_substring) != NULL && + lstat(namepath, &sb) >= 0 && + sb.st_uid == uid && + S_ISREG(sb.st_mode)) { + len = snprintf(namepath, sizeof(namepath), "FILE:%s/%s", + dirpath, dp->d_name); + if (len < sizeof(namepath) && + is_a_valid_tgt_cache(namepath, uid, &rating, + &exptime) != 0) { + if (gotone == 0 || rating > orating || + (rating == orating && exptime > oexptime)) { + orating = rating; + oexptime = exptime; + strcpy(retpath, namepath); + gotone = 1; + } + } + } + } + closedir(dirp); + if (gotone != 0) { + strcpy(rpath, retpath); + return (1); + } + return (0); +} + +/* + * Try to determine if the file is a valid tgt cache file. + * Check that the file has a valid tgt for a principal. + * If it does, return 1, otherwise return 0. + * It also returns a "rating" and the expiry time for the TGT, when found. + * This "rating" is higher based on heuristics that make it more + * likely to be the correct credential cache file to use. It can + * be used by the caller, along with expiry time, to select from + * multiple credential cache files. + */ +static int +is_a_valid_tgt_cache(const char *filepath, uid_t uid, int *retrating, + time_t *retexptime) +{ + krb5_context context; + krb5_principal princ; + krb5_ccache ccache; + krb5_error_code retval; + krb5_cc_cursor curse; + krb5_creds krbcred; + int gotone, orating, rating, ret; + struct passwd *pw; + char *cp, *cp2, *pname; + time_t exptime; + + /* Find a likely name for the uid principal. */ + pw = getpwuid(uid); + + /* + * Do a bunch of krb5 library stuff to try and determine if + * this file is a credentials cache with an appropriate TGT + * in it. + */ + retval = krb5_init_context(&context); + if (retval != 0) + return (0); + retval = krb5_cc_resolve(context, filepath, &ccache); + if (retval != 0) { + krb5_free_context(context); + return (0); + } + ret = 0; + orating = 0; + exptime = 0; + retval = krb5_cc_start_seq_get(context, ccache, &curse); + if (retval == 0) { + while ((retval = krb5_cc_next_cred(context, ccache, &curse, + &krbcred)) == 0) { + gotone = 0; + rating = 0; + retval = krb5_unparse_name(context, krbcred.server, + &pname); + if (retval == 0) { + cp = strchr(pname, '/'); + if (cp != NULL) { + *cp++ = '\0'; + if (strcmp(pname, "krbtgt") == 0 && + krbcred.times.endtime > time(NULL) + ) { + gotone = 1; + /* + * Test to see if this is a + * tgt for cross-realm auth. + * Rate it higher, if it is not. + */ + cp2 = strchr(cp, '@'); + if (cp2 != NULL) { + *cp2++ = '\0'; + if (strcmp(cp, cp2) == + 0) + rating++; + } + } + } + free(pname); + } + if (gotone != 0) { + retval = krb5_unparse_name(context, + krbcred.client, &pname); + if (retval == 0) { + cp = strchr(pname, '@'); + if (cp != NULL) { + *cp++ = '\0'; + if (pw != NULL && strcmp(pname, + pw->pw_name) == 0) + rating++; + if (strchr(pname, '/') == NULL) + rating++; + if (pref_realm[0] != '\0' && + strcmp(cp, pref_realm) == 0) + rating++; + } + } + free(pname); + if (rating > orating) { + orating = rating; + exptime = krbcred.times.endtime; + } else if (rating == orating && + krbcred.times.endtime > exptime) + exptime = krbcred.times.endtime; + ret = 1; + } + krb5_free_cred_contents(context, &krbcred); + } + krb5_cc_end_seq_get(context, ccache, &curse); + } + krb5_cc_close(context, ccache); + krb5_free_context(context); + if (ret != 0) { + *retrating = orating; + *retexptime = exptime; + } + return (ret); +} + From owner-svn-src-head@FreeBSD.ORG Sat Dec 22 23:34:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 956FA1C5; Sat, 22 Dec 2012 23:34:29 +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 5F0A58FC12; Sat, 22 Dec 2012 23:34: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 qBMNYTC4077397; Sat, 22 Dec 2012 23:34:29 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBMNYT1Y077396; Sat, 22 Dec 2012 23:34:29 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201212222334.qBMNYT1Y077396@svn.freebsd.org> From: Rick Macklem Date: Sat, 22 Dec 2012 23:34:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244605 - 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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 23:34:29 -0000 Author: rmacklem Date: Sat Dec 22 23:34:28 2012 New Revision: 244605 URL: http://svnweb.freebsd.org/changeset/base/244605 Log: Document the new gssd daemon options added by r244604. This is a content change. MFC after: 2 weeks Modified: head/usr.sbin/gssd/gssd.8 Modified: head/usr.sbin/gssd/gssd.8 ============================================================================== --- head/usr.sbin/gssd/gssd.8 Sat Dec 22 23:21:17 2012 (r244604) +++ head/usr.sbin/gssd/gssd.8 Sat Dec 22 23:34:28 2012 (r244605) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 5, 2008 +.Dd December 22, 2012 .Dt GSSD 8 .Os .Sh NAME @@ -34,6 +34,9 @@ .Sh SYNOPSIS .Nm .Op Fl d +.Op Fl s Ar dir-list +.Op Fl c Ar file-substring +.Op Fl r Ar preferred-realm .Sh DESCRIPTION The .Nm @@ -46,6 +49,29 @@ Run in debug mode. In this mode, .Nm will not fork when it starts. +.It Fl s Ar dir-list +Look for an appropriate credential cache file in this list of directories. +The list should be full pathnames from root, separated by ':' characters. +Usually this list will simply be "/tmp". +Without this option, the +.Nm +daemon assumes that the credential cache file is called /tmp/krb5cc_, +where is the effective uid for the RPC caller. +.It Fl c Ar file-substring +Set a file-substring for the credential cache file names. +Only files with this substring embedded in their names will be +selected as candidates when the +.Fl s +has been specified. +If not specified, it defaults to "krb5cc_". +.It Fl r Ar preferred-realm +Set a preferred Kerberos realm for the search of the directory list for +a credentials cache file. +When set, files with TGT credentials for this realm will be selected over +other credential files. +This option is only meaningful when the +.Fl s +option has been specified. .El .Sh FILES .Bl -tag -width ".Pa /etc/krb5.keytab" -compact