svn commit: r303655 - head/sys/kern

2016-08-01 Thread Mateusz Guzik
Author: mjg
Date: Tue Aug  2 03:05:59 2016
New Revision: 303655
URL: https://svnweb.freebsd.org/changeset/base/303655

Log:
  locks: fix compilation for KDTRACE_HOOKS && !ADAPTIVE_* case
  
  Reported by:  Michael Butler 

Modified:
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_mutex.c
==
--- head/sys/kern/kern_mutex.c  Tue Aug  2 02:32:00 2016(r303654)
+++ head/sys/kern/kern_mutex.c  Tue Aug  2 03:05:59 2016(r303655)
@@ -452,8 +452,10 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
if (SCHEDULER_STOPPED())
return;
 
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_MUTEXES)
lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, NULL);
 #endif
m = mtxlock2mtx(c);
 

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Tue Aug  2 02:32:00 2016(r303654)
+++ head/sys/kern/kern_rwlock.c Tue Aug  2 03:05:59 2016(r303655)
@@ -396,8 +396,10 @@ __rw_rlock(volatile uintptr_t *c, const 
if (SCHEDULER_STOPPED())
return;
 
-#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS)
lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, NULL);
 #endif
rw = rwlock2rw(c);
 
@@ -782,8 +784,10 @@ __rw_wlock_hard(volatile uintptr_t *c, u
if (SCHEDULER_STOPPED())
return;
 
-#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS)
lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, NULL);
 #endif
rw = rwlock2rw(c);
 

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Tue Aug  2 02:32:00 2016(r303654)
+++ head/sys/kern/kern_sx.c Tue Aug  2 03:05:59 2016(r303655)
@@ -554,8 +554,10 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
if (SCHEDULER_STOPPED())
return (0);
 
-#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX)
lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, NULL);
 #endif
 
/* If we already hold an exclusive lock, then recurse. */
@@ -861,8 +863,10 @@ _sx_slock_hard(struct sx *sx, int opts, 
if (SCHEDULER_STOPPED())
return (0);
 
-#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX)
lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, NULL);
 #endif
 #ifdef KDTRACE_HOOKS
state = sx->sx_lock;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303650 - head/sys/opencrypto

2016-08-01 Thread Conrad Meyer
That would be difficult, as this is completely dead code in base.  It
could be accessed through the /dev/crypto device by a port, however.
You haven't convinced me there is a security issue.

Cheers,
Conrad

On Mon, Aug 1, 2016 at 4:58 PM, Shawn Webb  wrote:
> Adding CTurt to see if he wants to take a stab at writing a PoC exploit.
> It'd be cool for an offensive researcher to determine if it's simply a
> DoS. But regardless, a security fix is a security fix. All
> currently-supported branches really should be updated.
>
> Thanks,
>
> Shawn
>
> On Mon, Aug 01, 2016 at 04:41:02PM -0700, Conrad Meyer wrote:
>> Hey Shawn,
>>
>> I don't think this is security-related despite being a bug in
>> crypto-adjacent code.  At best it's a DoS, I think.
>>
>> Cheers,
>> Conrad
>>
>> On Mon, Aug 1, 2016 at 4:15 PM, Shawn Webb  
>> wrote:
>> > -BEGIN PGP SIGNED MESSAGE-
>> > Hash: SHA512
>> >
>> >
>> >
>> > On August 1, 2016 6:57:03 PM EDT, "Conrad E. Meyer"  
>> > wrote:
>> >>Author: cem
>> >>Date: Mon Aug  1 22:57:03 2016
>> >>New Revision: 303650
>> >>URL: https://svnweb.freebsd.org/changeset/base/303650
>> >>
>> >>Log:
>> >>  opencrypto AES-ICM: Fix heap corruption typo
>> >>
>> >>This error looks like it was a simple copy-paste typo in the original
>> >>commit
>> >>  for this code (r275732).
>> >>
>> >>  PR:  204009
>> >>  Reported by: Chang-Hsien Tsai 
>> >>  Sponsored by:EMC / Isilon Storage
>> >
>> > Since cem@ refuses to MFC even security fixes, can someone with a commit 
>> > bit please MFC this within normal security-related MFC timeframe? 
>> > Additionally, does a security advisory need to be sent out? CC'ing 
>> > secteam@.
>> >
>> > Thanks,
>> >
>> > Shawn
>> >
>> > - --
>> > Sent from my Android device with K-9 Mail. Please excuse my brevity.
>> > -BEGIN PGP SIGNATURE-
>> > Version: APG v1.1.1
>> >
>> > iQI/BAEBCgApBQJXn9ggIhxTaGF3biBXZWJiIDxzaGF3bkBzaGF3bndlYmIuaW5m
>> > bz4ACgkQaoRlj1JFbu4Ypg//XLLOHX3y5ULHSEqEQ6tgUjQiR+9ADYKX1Zza3ghI
>> > FsHEr7O8yi31jb8EJ9+oOiZOHxjAfLP+ezwNoa9xRUQu0IoTcCLU6PzCzHv2viaa
>> > UZ+ae5xbB48i89o2ZshGTKgtwAzkCOhNkvPaAmS2yu14Xg+2CbhY2mCR+qdnAnMS
>> > cUU4dTsqTI+cHQoE2ehzDst/ABSaBZa2XZKxFp3EeTb3r2bNAvh72zMv6ethU8Ht
>> > 5VE7ZyRfQBpObZVcmSy6Sg8+vyjTRE4pdiajSqs3kIitPvxljwukMQ6DcdHCnJPx
>> > IlOTXnM1wd7iHSwNTP8jniemOR4QrrQ3fEwglsnjp2t45ZnWi46LhfoekOinX42v
>> > x7f+XWhcw0/oCF34q0rQ/YxFr0OcammmPMqjYKy7dlk2H6FSk9jnqh19lXu+qZP6
>> > UzlUS+IHHn7o0OaV9Tflsey7/24hFjEVAHFKZxsG7VzKaSjri6aJ8p2Mr2D1o1os
>> > rEMF15pV2d9l7tIFN0FigqmffZswpTbk+uNNHc8rg+Tq7QV1fhceTgLLXRfqlpq8
>> > ES/Y3Epr22KCCEhftQw3fqC1XpOpn5CUc3svJx7llXWYc/c7RdxGDNSujFF3IARk
>> > 741mx0N/ZkrcXZ/u/zk5+gMmS7NxhQXNk3QueRTIlqZv7e9GdlaYAPMZxQZKQKm3
>> > +YQ=
>> > =B3c1
>> > -END PGP SIGNATURE-
>> >
>> >
>
> --
> Shawn Webb
> Cofounder and Security Engineer
> HardenedBSD
>
> GPG Key ID:  0x6A84658F52456EEE
> GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303652 - head/sys/kern

2016-08-01 Thread Mateusz Guzik
Author: mjg
Date: Tue Aug  2 00:15:08 2016
New Revision: 303652
URL: https://svnweb.freebsd.org/changeset/base/303652

Log:
  locks: fix up ifdef guards introduced in r303643
  
  Both sx and rwlocks had copy-pasted ADAPTIVE_MUTEXES instead of the correct
  define.
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Mon Aug  1 23:07:31 2016(r303651)
+++ head/sys/kern/kern_rwlock.c Tue Aug  2 00:15:08 2016(r303652)
@@ -383,7 +383,7 @@ __rw_rlock(volatile uintptr_t *c, const 
int contested = 0;
 #endif
uintptr_t v;
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
struct lock_delay_arg lda;
 #endif
 #ifdef KDTRACE_HOOKS
@@ -396,7 +396,7 @@ __rw_rlock(volatile uintptr_t *c, const 
if (SCHEDULER_STOPPED())
return;
 
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
lock_delay_arg_init(, _delay);
 #endif
rw = rwlock2rw(c);
@@ -769,7 +769,7 @@ __rw_wlock_hard(volatile uintptr_t *c, u
uint64_t waittime = 0;
int contested = 0;
 #endif
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
struct lock_delay_arg lda;
 #endif
 #ifdef KDTRACE_HOOKS
@@ -782,7 +782,7 @@ __rw_wlock_hard(volatile uintptr_t *c, u
if (SCHEDULER_STOPPED())
return;
 
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
lock_delay_arg_init(, _delay);
 #endif
rw = rwlock2rw(c);

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Mon Aug  1 23:07:31 2016(r303651)
+++ head/sys/kern/kern_sx.c Tue Aug  2 00:15:08 2016(r303652)
@@ -541,7 +541,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
int contested = 0;
 #endif
int error = 0;
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
struct lock_delay_arg lda;
 #endif
 #ifdef KDTRACE_HOOKS
@@ -554,7 +554,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
if (SCHEDULER_STOPPED())
return (0);
 
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
lock_delay_arg_init(, _delay);
 #endif
 
@@ -848,7 +848,7 @@ _sx_slock_hard(struct sx *sx, int opts, 
 #endif
uintptr_t x;
int error = 0;
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
struct lock_delay_arg lda;
 #endif
 #ifdef KDTRACE_HOOKS
@@ -861,7 +861,7 @@ _sx_slock_hard(struct sx *sx, int opts, 
if (SCHEDULER_STOPPED())
return (0);
 
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
lock_delay_arg_init(, _delay);
 #endif
 #ifdef KDTRACE_HOOKS
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303650 - head/sys/opencrypto

2016-08-01 Thread Conrad Meyer
Hey Shawn,

I don't think this is security-related despite being a bug in
crypto-adjacent code.  At best it's a DoS, I think.

Cheers,
Conrad

On Mon, Aug 1, 2016 at 4:15 PM, Shawn Webb  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
>
>
>
> On August 1, 2016 6:57:03 PM EDT, "Conrad E. Meyer"  wrote:
>>Author: cem
>>Date: Mon Aug  1 22:57:03 2016
>>New Revision: 303650
>>URL: https://svnweb.freebsd.org/changeset/base/303650
>>
>>Log:
>>  opencrypto AES-ICM: Fix heap corruption typo
>>
>>This error looks like it was a simple copy-paste typo in the original
>>commit
>>  for this code (r275732).
>>
>>  PR:  204009
>>  Reported by: Chang-Hsien Tsai 
>>  Sponsored by:EMC / Isilon Storage
>
> Since cem@ refuses to MFC even security fixes, can someone with a commit bit 
> please MFC this within normal security-related MFC timeframe? Additionally, 
> does a security advisory need to be sent out? CC'ing secteam@.
>
> Thanks,
>
> Shawn
>
> - --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
> -BEGIN PGP SIGNATURE-
> Version: APG v1.1.1
>
> iQI/BAEBCgApBQJXn9ggIhxTaGF3biBXZWJiIDxzaGF3bkBzaGF3bndlYmIuaW5m
> bz4ACgkQaoRlj1JFbu4Ypg//XLLOHX3y5ULHSEqEQ6tgUjQiR+9ADYKX1Zza3ghI
> FsHEr7O8yi31jb8EJ9+oOiZOHxjAfLP+ezwNoa9xRUQu0IoTcCLU6PzCzHv2viaa
> UZ+ae5xbB48i89o2ZshGTKgtwAzkCOhNkvPaAmS2yu14Xg+2CbhY2mCR+qdnAnMS
> cUU4dTsqTI+cHQoE2ehzDst/ABSaBZa2XZKxFp3EeTb3r2bNAvh72zMv6ethU8Ht
> 5VE7ZyRfQBpObZVcmSy6Sg8+vyjTRE4pdiajSqs3kIitPvxljwukMQ6DcdHCnJPx
> IlOTXnM1wd7iHSwNTP8jniemOR4QrrQ3fEwglsnjp2t45ZnWi46LhfoekOinX42v
> x7f+XWhcw0/oCF34q0rQ/YxFr0OcammmPMqjYKy7dlk2H6FSk9jnqh19lXu+qZP6
> UzlUS+IHHn7o0OaV9Tflsey7/24hFjEVAHFKZxsG7VzKaSjri6aJ8p2Mr2D1o1os
> rEMF15pV2d9l7tIFN0FigqmffZswpTbk+uNNHc8rg+Tq7QV1fhceTgLLXRfqlpq8
> ES/Y3Epr22KCCEhftQw3fqC1XpOpn5CUc3svJx7llXWYc/c7RdxGDNSujFF3IARk
> 741mx0N/ZkrcXZ/u/zk5+gMmS7NxhQXNk3QueRTIlqZv7e9GdlaYAPMZxQZKQKm3
> +YQ=
> =B3c1
> -END PGP SIGNATURE-
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303650 - head/sys/opencrypto

2016-08-01 Thread Shawn Webb
Adding CTurt to see if he wants to take a stab at writing a PoC exploit.
It'd be cool for an offensive researcher to determine if it's simply a
DoS. But regardless, a security fix is a security fix. All
currently-supported branches really should be updated.

Thanks,

Shawn

On Mon, Aug 01, 2016 at 04:41:02PM -0700, Conrad Meyer wrote:
> Hey Shawn,
> 
> I don't think this is security-related despite being a bug in
> crypto-adjacent code.  At best it's a DoS, I think.
> 
> Cheers,
> Conrad
> 
> On Mon, Aug 1, 2016 at 4:15 PM, Shawn Webb  wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA512
> >
> >
> >
> > On August 1, 2016 6:57:03 PM EDT, "Conrad E. Meyer"  
> > wrote:
> >>Author: cem
> >>Date: Mon Aug  1 22:57:03 2016
> >>New Revision: 303650
> >>URL: https://svnweb.freebsd.org/changeset/base/303650
> >>
> >>Log:
> >>  opencrypto AES-ICM: Fix heap corruption typo
> >>
> >>This error looks like it was a simple copy-paste typo in the original
> >>commit
> >>  for this code (r275732).
> >>
> >>  PR:  204009
> >>  Reported by: Chang-Hsien Tsai 
> >>  Sponsored by:EMC / Isilon Storage
> >
> > Since cem@ refuses to MFC even security fixes, can someone with a commit 
> > bit please MFC this within normal security-related MFC timeframe? 
> > Additionally, does a security advisory need to be sent out? CC'ing secteam@.
> >
> > Thanks,
> >
> > Shawn
> >
> > - --
> > Sent from my Android device with K-9 Mail. Please excuse my brevity.
> > -BEGIN PGP SIGNATURE-
> > Version: APG v1.1.1
> >
> > iQI/BAEBCgApBQJXn9ggIhxTaGF3biBXZWJiIDxzaGF3bkBzaGF3bndlYmIuaW5m
> > bz4ACgkQaoRlj1JFbu4Ypg//XLLOHX3y5ULHSEqEQ6tgUjQiR+9ADYKX1Zza3ghI
> > FsHEr7O8yi31jb8EJ9+oOiZOHxjAfLP+ezwNoa9xRUQu0IoTcCLU6PzCzHv2viaa
> > UZ+ae5xbB48i89o2ZshGTKgtwAzkCOhNkvPaAmS2yu14Xg+2CbhY2mCR+qdnAnMS
> > cUU4dTsqTI+cHQoE2ehzDst/ABSaBZa2XZKxFp3EeTb3r2bNAvh72zMv6ethU8Ht
> > 5VE7ZyRfQBpObZVcmSy6Sg8+vyjTRE4pdiajSqs3kIitPvxljwukMQ6DcdHCnJPx
> > IlOTXnM1wd7iHSwNTP8jniemOR4QrrQ3fEwglsnjp2t45ZnWi46LhfoekOinX42v
> > x7f+XWhcw0/oCF34q0rQ/YxFr0OcammmPMqjYKy7dlk2H6FSk9jnqh19lXu+qZP6
> > UzlUS+IHHn7o0OaV9Tflsey7/24hFjEVAHFKZxsG7VzKaSjri6aJ8p2Mr2D1o1os
> > rEMF15pV2d9l7tIFN0FigqmffZswpTbk+uNNHc8rg+Tq7QV1fhceTgLLXRfqlpq8
> > ES/Y3Epr22KCCEhftQw3fqC1XpOpn5CUc3svJx7llXWYc/c7RdxGDNSujFF3IARk
> > 741mx0N/ZkrcXZ/u/zk5+gMmS7NxhQXNk3QueRTIlqZv7e9GdlaYAPMZxQZKQKm3
> > +YQ=
> > =B3c1
> > -END PGP SIGNATURE-
> >
> >

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r303650 - head/sys/opencrypto

2016-08-01 Thread Shawn Webb
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512



On August 1, 2016 6:57:03 PM EDT, "Conrad E. Meyer"  wrote:
>Author: cem
>Date: Mon Aug  1 22:57:03 2016
>New Revision: 303650
>URL: https://svnweb.freebsd.org/changeset/base/303650
>
>Log:
>  opencrypto AES-ICM: Fix heap corruption typo
>
>This error looks like it was a simple copy-paste typo in the original
>commit
>  for this code (r275732).
>
>  PR:  204009
>  Reported by: Chang-Hsien Tsai 
>  Sponsored by:EMC / Isilon Storage

Since cem@ refuses to MFC even security fixes, can someone with a commit bit 
please MFC this within normal security-related MFC timeframe? Additionally, 
does a security advisory need to be sent out? CC'ing secteam@.

Thanks,

Shawn

- --
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-BEGIN PGP SIGNATURE-
Version: APG v1.1.1

iQI/BAEBCgApBQJXn9ggIhxTaGF3biBXZWJiIDxzaGF3bkBzaGF3bndlYmIuaW5m
bz4ACgkQaoRlj1JFbu4Ypg//XLLOHX3y5ULHSEqEQ6tgUjQiR+9ADYKX1Zza3ghI
FsHEr7O8yi31jb8EJ9+oOiZOHxjAfLP+ezwNoa9xRUQu0IoTcCLU6PzCzHv2viaa
UZ+ae5xbB48i89o2ZshGTKgtwAzkCOhNkvPaAmS2yu14Xg+2CbhY2mCR+qdnAnMS
cUU4dTsqTI+cHQoE2ehzDst/ABSaBZa2XZKxFp3EeTb3r2bNAvh72zMv6ethU8Ht
5VE7ZyRfQBpObZVcmSy6Sg8+vyjTRE4pdiajSqs3kIitPvxljwukMQ6DcdHCnJPx
IlOTXnM1wd7iHSwNTP8jniemOR4QrrQ3fEwglsnjp2t45ZnWi46LhfoekOinX42v
x7f+XWhcw0/oCF34q0rQ/YxFr0OcammmPMqjYKy7dlk2H6FSk9jnqh19lXu+qZP6
UzlUS+IHHn7o0OaV9Tflsey7/24hFjEVAHFKZxsG7VzKaSjri6aJ8p2Mr2D1o1os
rEMF15pV2d9l7tIFN0FigqmffZswpTbk+uNNHc8rg+Tq7QV1fhceTgLLXRfqlpq8
ES/Y3Epr22KCCEhftQw3fqC1XpOpn5CUc3svJx7llXWYc/c7RdxGDNSujFF3IARk
741mx0N/ZkrcXZ/u/zk5+gMmS7NxhQXNk3QueRTIlqZv7e9GdlaYAPMZxQZKQKm3
+YQ=
=B3c1
-END PGP SIGNATURE-

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303651 - head/sys/net

2016-08-01 Thread Conrad E. Meyer
Author: cem
Date: Mon Aug  1 23:07:31 2016
New Revision: 303651
URL: https://svnweb.freebsd.org/changeset/base/303651

Log:
  rtentry: Initialize rt_mtx with MTX_NEW
  
  The "rtentry" zone does not use UMA_ZONE_ZINIT, so it is invalid to assume the
  mutex's memory will be zero.  Without MTX_NEW, garbage backing memory may
  trigger the "re-initializing a mutex" assertion.
  
  PR:   200991
  Submitted by: Chang-Hsien Tsai 

Modified:
  head/sys/net/route.h

Modified: head/sys/net/route.h
==
--- head/sys/net/route.hMon Aug  1 22:57:03 2016(r303650)
+++ head/sys/net/route.hMon Aug  1 23:07:31 2016(r303651)
@@ -360,7 +360,7 @@ struct rt_addrinfo {
 || (ifp)->if_link_state == LINK_STATE_UP)
 
 #defineRT_LOCK_INIT(_rt) \
-   mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK)
+   mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK | MTX_NEW)
 #defineRT_LOCK(_rt)mtx_lock(&(_rt)->rt_mtx)
 #defineRT_UNLOCK(_rt)  mtx_unlock(&(_rt)->rt_mtx)
 #defineRT_LOCK_DESTROY(_rt)mtx_destroy(&(_rt)->rt_mtx)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303643 - in head/sys: kern sys

2016-08-01 Thread Mateusz Guzik
On Mon, Aug 01, 2016 at 09:48:37PM +, Mateusz Guzik wrote:
>   Implement trivial backoff for locking primitives.
>   
[..]
>   For simplicity, this first thouch implementation only modifies spinning
>   loops where the lock owner is running. spin mutexes and thread lock were
>   not modified.
>   

What maybe I should have noted in the commit message.

This is a perfectly MFCable and much needed band-aid, which will later
be extended to cover the rest of the loops and other primitives.

There are several approaches which give better results but are also
significantly more complicated to implement. Until a suitable approach
is worked out and tested, the work here hopefully helps enough.

-- 
Mateusz Guzik 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303650 - head/sys/opencrypto

2016-08-01 Thread Conrad E. Meyer
Author: cem
Date: Mon Aug  1 22:57:03 2016
New Revision: 303650
URL: https://svnweb.freebsd.org/changeset/base/303650

Log:
  opencrypto AES-ICM: Fix heap corruption typo
  
  This error looks like it was a simple copy-paste typo in the original commit
  for this code (r275732).
  
  PR:   204009
  Reported by:  Chang-Hsien Tsai 
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/opencrypto/xform_aes_icm.c

Modified: head/sys/opencrypto/xform_aes_icm.c
==
--- head/sys/opencrypto/xform_aes_icm.c Mon Aug  1 22:53:28 2016
(r303649)
+++ head/sys/opencrypto/xform_aes_icm.c Mon Aug  1 22:57:03 2016
(r303650)
@@ -65,7 +65,7 @@ struct enc_xform enc_xform_aes_icm = {
aes_icm_crypt,
aes_icm_crypt,
aes_icm_setkey,
-   rijndael128_zerokey,
+   aes_icm_zerokey,
aes_icm_reinit,
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303648 - head/sys/ddb

2016-08-01 Thread Conrad E. Meyer
Author: cem
Date: Mon Aug  1 22:41:50 2016
New Revision: 303648
URL: https://svnweb.freebsd.org/changeset/base/303648

Log:
  Fix ddb "show proc" to show full arguments
  
  PR:   200052
  Submitted by: Chang-Hsien Tsai 

Modified:
  head/sys/ddb/db_ps.c

Modified: head/sys/ddb/db_ps.c
==
--- head/sys/ddb/db_ps.cMon Aug  1 22:39:51 2016(r303647)
+++ head/sys/ddb/db_ps.cMon Aug  1 22:41:50 2016(r303648)
@@ -440,9 +440,16 @@ DB_SHOW_COMMAND(proc, db_show_proc)
p->p_leader);
if (p->p_sysent != NULL)
db_printf(" ABI: %s\n", p->p_sysent->sv_name);
-   if (p->p_args != NULL)
-   db_printf(" arguments: %.*s\n", (int)p->p_args->ar_length,
-   p->p_args->ar_args);
+   if (p->p_args != NULL) {
+   db_printf(" arguments: ");
+   for (i = 0; i < (int)p->p_args->ar_length; i++) {
+   if (p->p_args->ar_args[i] == '\0')
+   db_printf(" ");
+   else
+   db_printf("%c", p->p_args->ar_args[i]);
+   }
+   db_printf("\n");
+   }
db_printf(" threads: %d\n", p->p_numthreads);
FOREACH_THREAD_IN_PROC(p, td) {
dumpthread(p, td, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303647 - in head/sys/dev/cxgbe: . iw_cxgbe

2016-08-01 Thread John Baldwin
Author: jhb
Date: Mon Aug  1 22:39:51 2016
New Revision: 303647
URL: https://svnweb.freebsd.org/changeset/base/303647

Log:
  Store the offset of the KDOORBELL and GTS registers in the softc.
  
  VF devices use a different register layout than PF devices.  Storing
  the offset in a value in the softc allows code to be shared between the
  PF and VF drivers.
  
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D7389

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/iw_cxgbe/cq.c
  head/sys/dev/cxgbe/iw_cxgbe/qp.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_netmap.c
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hMon Aug  1 22:22:11 2016
(r303646)
+++ head/sys/dev/cxgbe/adapter.hMon Aug  1 22:39:51 2016
(r303647)
@@ -781,6 +781,8 @@ struct adapter {
struct sge_rxq *rxq;
struct sge_nm_rxq *nm_rxq;
} __aligned(CACHE_LINE_SIZE) *irq;
+   int sge_gts_reg;
+   int sge_kdoorbell_reg;
 
bus_dma_tag_t dmat; /* Parent DMA tag */
 

Modified: head/sys/dev/cxgbe/iw_cxgbe/cq.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cq.cMon Aug  1 22:22:11 2016
(r303646)
+++ head/sys/dev/cxgbe/iw_cxgbe/cq.cMon Aug  1 22:39:51 2016
(r303647)
@@ -172,7 +172,7 @@ create_cq(struct c4iw_rdev *rdev, struct
 
cq->gen = 1;
cq->gts = (void *)((unsigned long)rman_get_virtual(sc->regs_res) +
-   MYPF_REG(SGE_PF_GTS));
+   sc->sge_gts_reg);
cq->rdev = rdev;
 
if (user) {

Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/qp.cMon Aug  1 22:22:11 2016
(r303646)
+++ head/sys/dev/cxgbe/iw_cxgbe/qp.cMon Aug  1 22:39:51 2016
(r303647)
@@ -182,9 +182,9 @@ static int create_qp(struct c4iw_rdev *r
pci_unmap_addr_set(>rq, mapping, wq->rq.dma_addr);
 
wq->db = (void *)((unsigned long)rman_get_virtual(sc->regs_res) +
-   MYPF_REG(SGE_PF_KDOORBELL));
+   sc->sge_kdoorbell_reg);
wq->gts = (void *)((unsigned long)rman_get_virtual(rdev->adap->regs_res)
-  + MYPF_REG(SGE_PF_GTS));
+  + sc->sge_gts_reg);
if (user) {
wq->sq.udb = 
(u64)((char*)rman_get_virtual(rdev->adap->udbs_res) +
(wq->sq.qid << rdev->qpshift));

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cMon Aug  1 22:22:11 2016
(r303646)
+++ head/sys/dev/cxgbe/t4_main.cMon Aug  1 22:39:51 2016
(r303647)
@@ -697,6 +697,8 @@ t4_attach(device_t dev)
sc->params.pci.mps = 128 << ((v & PCIEM_CTL_MAX_PAYLOAD) >> 5);
}
 
+   sc->sge_gts_reg = MYPF_REG(A_SGE_PF_GTS);
+   sc->sge_kdoorbell_reg = MYPF_REG(A_SGE_PF_KDOORBELL);
sc->traceq = -1;
mtx_init(>ifp_lock, sc->ifp_lockname, 0, MTX_DEF);
snprintf(sc->ifp_lockname, sizeof(sc->ifp_lockname), "%s tracer",

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Mon Aug  1 22:22:11 2016
(r303646)
+++ head/sys/dev/cxgbe/t4_netmap.c  Mon Aug  1 22:39:51 2016
(r303647)
@@ -204,7 +204,7 @@ alloc_nm_rxq_hwq(struct vi_info *vi, str
}
}
 
-   t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS),
+   t4_write_reg(sc, sc->sge_gts_reg,
V_INGRESSQID(nm_rxq->iq_cntxt_id) |
V_SEINTARM(V_QINTR_TIMER_IDX(holdoff_tmr_idx)));
 
@@ -364,7 +364,7 @@ cxgbe_netmap_on(struct adapter *sc, stru
MPASS((j & 7) == 0);
j /= 8; /* driver pidx to hardware pidx */
wmb();
-   t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL),
+   t4_write_reg(sc, sc->sge_kdoorbell_reg,
nm_rxq->fl_db_val | V_PIDX(j));
 
atomic_cmpset_int(>nm_state, NM_OFF, NM_ON);
@@ -537,7 +537,7 @@ ring_nm_txq_db(struct adapter *sc, struc
break;
 
case DOORBELL_KDB:
-   t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL),
+   t4_write_reg(sc, sc->sge_kdoorbell_reg,
V_QID(nm_txq->cntxt_id) | V_PIDX(n));
break;
}
@@ -818,7 +818,7 @@ cxgbe_netmap_rxsync(struct netmap_kring 
}
if (++dbinc == 8 && n >= 32) {
wmb();
-   t4_write_reg(sc, 

svn commit: r303646 - head/sys/ofed/drivers/infiniband/ulp/ipoib

2016-08-01 Thread Mark Johnston
Author: markj
Date: Mon Aug  1 22:22:11 2016
New Revision: 303646
URL: https://svnweb.freebsd.org/changeset/base/303646

Log:
  ipoib: Bound the number of egress mbufs buffered during pathrec lookups.
  
  In pathological situations where the master subnet manager becomes
  unresponsive for an extended period, we may otherwise end up queuing all
  of the system's mbufs while waiting for a response to a path record lookup.
  
  This addresses the same issue as commit 1e85b806f9 in Linux.
  
  Reviewed by:  cem, ngie
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
==
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug  1 
22:19:23 2016(r303645)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug  1 
22:22:11 2016(r303646)
@@ -660,7 +660,13 @@ ipoib_unicast_send(struct mbuf *mb, stru
new_path = 1;
}
if (path) {
-   _IF_ENQUEUE(>queue, mb);
+   if (_IF_QLEN(>queue) < IPOIB_MAX_PATH_REC_QUEUE)
+   _IF_ENQUEUE(>queue, mb);
+   else {
+   if_inc_counter(priv->dev, IFCOUNTER_OERRORS, 1);
+   m_freem(mb);
+   }
+
if (!path->query && path_rec_start(priv, path)) {
spin_unlock_irqrestore(>lock, flags);
if (new_path)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303645 - head/sys/dev/pci

2016-08-01 Thread John Baldwin
Author: jhb
Date: Mon Aug  1 22:19:23 2016
New Revision: 303645
URL: https://svnweb.freebsd.org/changeset/base/303645

Log:
  Disable PCI hotplug support for slots with power controllers.
  
  After further review of the spec, I do not think the current HotPlug
  code handles slots with power controllers correctly.  In particular,
  the power state of the slot is to be inferred from other events, not
  from examining the state of the power control bit in SLOT_CTL.  For now,
  disable PCI hotplug support on such slots.
  
  PR:   211081
  Tested by:Jeffrey E Pieper 
  MFC after:3 days

Modified:
  head/sys/dev/pci/pci_pci.c

Modified: head/sys/dev/pci/pci_pci.c
==
--- head/sys/dev/pci/pci_pci.c  Mon Aug  1 21:49:35 2016(r303644)
+++ head/sys/dev/pci/pci_pci.c  Mon Aug  1 22:19:23 2016(r303645)
@@ -932,6 +932,13 @@ pcib_probe_hotplug(struct pcib_softc *sc
sc->pcie_link_cap = pcie_read_config(dev, PCIER_LINK_CAP, 4);
sc->pcie_slot_cap = pcie_read_config(dev, PCIER_SLOT_CAP, 4);
 
+   /*
+* XXX: Handling of slots with a power controller needs to be
+* reexamined.  Ignore hotplug on such slots for now.
+*/
+   if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_PCP)
+   return;
+   
if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC)
sc->flags |= PCIB_HOTPLUG;
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303643 - in head/sys: kern sys

2016-08-01 Thread Mateusz Guzik
Author: mjg
Date: Mon Aug  1 21:48:37 2016
New Revision: 303643
URL: https://svnweb.freebsd.org/changeset/base/303643

Log:
  Implement trivial backoff for locking primitives.
  
  All current spinning loops retry an atomic op the first chance they get,
  which leads to performance degradation under load.
  
  One classic solution to the problem consists of delaying the test to an
  extent. This implementation has a trivial linear increment and a random
  factor for each attempt.
  
  For simplicity, this first thouch implementation only modifies spinning
  loops where the lock owner is running. spin mutexes and thread lock were
  not modified.
  
  Current parameters are autotuned on boot based on mp_cpus.
  
  Autotune factors are very conservative and are subject to change later.
  
  Reviewed by:  kib, jhb
  Tested by:pho
  MFC after:1 week

Modified:
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c
  head/sys/kern/subr_lock.c
  head/sys/sys/lock.h

Modified: head/sys/kern/kern_mutex.c
==
--- head/sys/kern/kern_mutex.c  Mon Aug  1 21:28:34 2016(r303642)
+++ head/sys/kern/kern_mutex.c  Mon Aug  1 21:48:37 2016(r303643)
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -138,6 +139,37 @@ struct lock_class lock_class_mtx_spin = 
 #endif
 };
 
+#ifdef ADAPTIVE_MUTEXES
+static SYSCTL_NODE(_debug, OID_AUTO, mtx, CTLFLAG_RD, NULL, "mtx debugging");
+
+static struct lock_delay_config mtx_delay = {
+   .initial= 1000,
+   .step   = 500,
+   .min= 100,
+   .max= 5000,
+};
+
+SYSCTL_INT(_debug_mtx, OID_AUTO, delay_initial, CTLFLAG_RW, _delay.initial,
+0, "");
+SYSCTL_INT(_debug_mtx, OID_AUTO, delay_step, CTLFLAG_RW, _delay.step,
+0, "");
+SYSCTL_INT(_debug_mtx, OID_AUTO, delay_min, CTLFLAG_RW, _delay.min,
+0, "");
+SYSCTL_INT(_debug_mtx, OID_AUTO, delay_max, CTLFLAG_RW, _delay.max,
+0, "");
+
+static void
+mtx_delay_sysinit(void *dummy)
+{
+
+   mtx_delay.initial = mp_ncpus * 25;
+   mtx_delay.step = (mp_ncpus * 25) / 2;
+   mtx_delay.min = mp_ncpus * 5;
+   mtx_delay.max = mp_ncpus * 25 * 10;
+}
+LOCK_DELAY_SYSINIT(mtx_delay_sysinit);
+#endif
+
 /*
  * System-wide mutexes
  */
@@ -408,8 +440,10 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
int contested = 0;
uint64_t waittime = 0;
 #endif
+#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+   struct lock_delay_arg lda;
+#endif
 #ifdef KDTRACE_HOOKS
-   u_int spin_cnt = 0;
u_int sleep_cnt = 0;
int64_t sleep_time = 0;
int64_t all_time = 0;
@@ -418,6 +452,9 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
if (SCHEDULER_STOPPED())
return;
 
+#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, _delay);
+#endif
m = mtxlock2mtx(c);
 
if (mtx_owned(m)) {
@@ -451,7 +488,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
if (m->mtx_lock == MTX_UNOWNED && _mtx_obtain_lock(m, tid))
break;
 #ifdef KDTRACE_HOOKS
-   spin_cnt++;
+   lda.spin_cnt++;
 #endif
 #ifdef ADAPTIVE_MUTEXES
/*
@@ -471,12 +508,8 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
"spinning", "lockname:\"%s\"",
m->lock_object.lo_name);
while (mtx_owner(m) == owner &&
-   TD_IS_RUNNING(owner)) {
-   cpu_spinwait();
-#ifdef KDTRACE_HOOKS
-   spin_cnt++;
-#endif
-   }
+   TD_IS_RUNNING(owner))
+   lock_delay();
KTR_STATE0(KTR_SCHED, "thread",
sched_tdname((struct thread *)tid),
"running");
@@ -570,7 +603,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
/*
 * Only record the loops spinning and not sleeping. 
 */
-   if (spin_cnt > sleep_cnt)
+   if (lda.spin_cnt > sleep_cnt)
LOCKSTAT_RECORD1(adaptive__spin, m, all_time - sleep_time);
 #endif
 }

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Mon Aug  1 21:28:34 2016(r303642)
+++ head/sys/kern/kern_rwlock.c Mon Aug  1 21:48:37 2016(r303643)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -65,15 +66,6 @@ PMC_SOFT_DECLARE( , , lock, failed);
  */
 #definerwlock2rw(c)(__containerof(c, struct rwlock, rw_lock))
 
-#ifdef ADAPTIVE_RWLOCKS
-static 

svn commit: r303641 - stable/11/sys/vm

2016-08-01 Thread Alan Cox
Author: alc
Date: Mon Aug  1 21:21:26 2016
New Revision: 303641
URL: https://svnweb.freebsd.org/changeset/base/303641

Log:
  MFC r303356 and r303465
Remove any mention of cache (PG_CACHE) pages from the comments in
vm_pageout_scan().  That function has not cached pages since r284376.
  
  Approved by:  re (kib)

Modified:
  stable/11/sys/vm/vm_pageout.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/vm_pageout.c
==
--- stable/11/sys/vm/vm_pageout.c   Mon Aug  1 21:21:21 2016
(r303640)
+++ stable/11/sys/vm/vm_pageout.c   Mon Aug  1 21:21:26 2016
(r303641)
@@ -872,7 +872,7 @@ unlock_mp:
  * vm_pageout_scan does the dirty work for the pageout daemon.
  *
  * pass 0 - Update active LRU/deactivate pages
- * pass 1 - Move inactive to cache or free
+ * pass 1 - Free inactive pages
  * pass 2 - Launder dirty pages
  */
 static void
@@ -915,8 +915,7 @@ vm_pageout_scan(struct vm_domain *vmd, i
addl_page_shortage = 0;
 
/*
-* Calculate the number of pages we want to either free or move
-* to the cache.
+* Calculate the number of pages that we want to free.
 */
if (pass > 0) {
deficit = atomic_readandclear_int(_pageout_deficit);
@@ -943,11 +942,10 @@ vm_pageout_scan(struct vm_domain *vmd, i
vnodes_skipped = 0;
 
/*
-* Start scanning the inactive queue for pages we can move to the
-* cache or free.  The scan will stop when the target is reached or
-* we have scanned the entire inactive queue.  Note that m->act_count
-* is not used to form decisions for the inactive queue, only for the
-* active queue.
+* Start scanning the inactive queue for pages that we can free.  The
+* scan will stop when we reach the target or we have scanned the
+* entire queue.  (Note that m->act_count is not used to make
+* decisions for the inactive queue, only for the active queue.)
 */
pq = >vmd_pagequeues[PQ_INACTIVE];
maxscan = pq->pq_cnt;
@@ -1072,10 +1070,9 @@ unlock_page:
/*
 * If the page appears to be clean at the machine-independent
 * layer, then remove all of its mappings from the pmap in
-* anticipation of placing it onto the cache queue.  If,
-* however, any of the page's mappings allow write access,
-* then the page may still be modified until the last of those
-* mappings are removed.
+* anticipation of freeing it.  If, however, any of the page's
+* mappings allow write access, then the page may still be
+* modified until the last of those mappings are removed.
 */
if (object->ref_count != 0) {
vm_page_test_dirty(m);
@@ -1171,8 +1168,8 @@ relock_queues:
 
 #if !defined(NO_SWAPPING)
/*
-* Wakeup the swapout daemon if we didn't cache or free the targeted
-* number of pages. 
+* Wakeup the swapout daemon if we didn't free the targeted number of
+* pages.
 */
if (vm_swap_enabled && page_shortage > 0)
vm_req_vmdaemon(VM_SWAP_NORMAL);
@@ -1180,7 +1177,7 @@ relock_queues:
 
/*
 * Wakeup the sync daemon if we skipped a vnode in a writeable object
-* and we didn't cache or free enough pages.
+* and we didn't free enough pages.
 */
if (vnodes_skipped > 0 && page_shortage > vm_cnt.v_free_target -
vm_cnt.v_free_min)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303639 - in vendor-sys/acpica/dist: . generate/unix/acpibin generate/unix/acpidump generate/unix/acpiexamples generate/unix/acpiexec generate/unix/acpihelp generate/unix/acpinames gene...

2016-08-01 Thread Jung-uk Kim
Author: jkim
Date: Mon Aug  1 21:20:41 2016
New Revision: 303639
URL: https://svnweb.freebsd.org/changeset/base/303639

Log:
  Import ACPICA 20160729.

Added:
  vendor-sys/acpica/dist/source/compiler/aslhelpers.y   (contents, props 
changed)
  vendor-sys/acpica/dist/source/compiler/aslkeywords.y   (contents, props 
changed)
  vendor-sys/acpica/dist/source/compiler/aslprimaries.y   (contents, props 
changed)
  vendor-sys/acpica/dist/source/include/platform/acgccex.h   (contents, props 
changed)
  vendor-sys/acpica/dist/source/tools/acpihelp/ahgrammar.c   (contents, props 
changed)
Deleted:
  vendor-sys/acpica/dist/source/include/platform/acwinex.h
  vendor-sys/acpica/dist/source/os_specific/service_layers/osefitbl.c
  vendor-sys/acpica/dist/source/os_specific/service_layers/osefixf.c
  vendor-sys/acpica/dist/source/os_specific/service_layers/oslibcfs.c
Modified:
  vendor-sys/acpica/dist/changes.txt
  vendor-sys/acpica/dist/generate/unix/acpibin/Makefile
  vendor-sys/acpica/dist/generate/unix/acpidump/Makefile
  vendor-sys/acpica/dist/generate/unix/acpiexamples/Makefile
  vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile
  vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile
  vendor-sys/acpica/dist/generate/unix/acpinames/Makefile
  vendor-sys/acpica/dist/generate/unix/acpisrc/Makefile
  vendor-sys/acpica/dist/generate/unix/acpixtract/Makefile
  vendor-sys/acpica/dist/generate/unix/iasl/Makefile
  vendor-sys/acpica/dist/source/common/acfileio.c
  vendor-sys/acpica/dist/source/common/acgetline.c
  vendor-sys/acpica/dist/source/common/adisasm.c
  vendor-sys/acpica/dist/source/common/ahtable.c
  vendor-sys/acpica/dist/source/common/cmfsize.c
  vendor-sys/acpica/dist/source/common/dmtable.c
  vendor-sys/acpica/dist/source/common/dmtables.c
  vendor-sys/acpica/dist/source/common/dmtbdump.c
  vendor-sys/acpica/dist/source/common/dmtbinfo.c
  vendor-sys/acpica/dist/source/common/getopt.c
  vendor-sys/acpica/dist/source/compiler/aslcompiler.h
  vendor-sys/acpica/dist/source/compiler/aslcstyle.y
  vendor-sys/acpica/dist/source/compiler/aslmain.c
  vendor-sys/acpica/dist/source/compiler/asloptions.c
  vendor-sys/acpica/dist/source/compiler/aslparser.y
  vendor-sys/acpica/dist/source/compiler/aslresources.y
  vendor-sys/acpica/dist/source/compiler/aslrules.y
  vendor-sys/acpica/dist/source/compiler/asltokens.y
  vendor-sys/acpica/dist/source/compiler/asltypes.y
  vendor-sys/acpica/dist/source/compiler/dtcompiler.h
  vendor-sys/acpica/dist/source/compiler/dttable.c
  vendor-sys/acpica/dist/source/compiler/dttemplate.h
  vendor-sys/acpica/dist/source/compiler/dtutils.c
  vendor-sys/acpica/dist/source/components/debugger/dbfileio.c
  vendor-sys/acpica/dist/source/components/tables/tbfadt.c
  vendor-sys/acpica/dist/source/components/tables/tbutils.c
  vendor-sys/acpica/dist/source/components/tables/tbxface.c
  vendor-sys/acpica/dist/source/components/tables/tbxfload.c
  vendor-sys/acpica/dist/source/components/tables/tbxfroot.c
  vendor-sys/acpica/dist/source/components/utilities/utbuffer.c
  vendor-sys/acpica/dist/source/components/utilities/utdebug.c
  vendor-sys/acpica/dist/source/components/utilities/utinit.c
  vendor-sys/acpica/dist/source/components/utilities/utpredef.c
  vendor-sys/acpica/dist/source/components/utilities/utprint.c
  vendor-sys/acpica/dist/source/components/utilities/uttrack.c
  vendor-sys/acpica/dist/source/components/utilities/utxface.c
  vendor-sys/acpica/dist/source/components/utilities/utxfinit.c
  vendor-sys/acpica/dist/source/include/acapps.h
  vendor-sys/acpica/dist/source/include/acclib.h
  vendor-sys/acpica/dist/source/include/acconfig.h
  vendor-sys/acpica/dist/source/include/acdisasm.h
  vendor-sys/acpica/dist/source/include/acglobal.h
  vendor-sys/acpica/dist/source/include/acpiosxf.h
  vendor-sys/acpica/dist/source/include/acpixf.h
  vendor-sys/acpica/dist/source/include/actables.h
  vendor-sys/acpica/dist/source/include/actbl.h
  vendor-sys/acpica/dist/source/include/actypes.h
  vendor-sys/acpica/dist/source/include/acutils.h
  vendor-sys/acpica/dist/source/include/platform/accygwin.h
  vendor-sys/acpica/dist/source/include/platform/acdragonfly.h
  vendor-sys/acpica/dist/source/include/platform/acefi.h
  vendor-sys/acpica/dist/source/include/platform/acefiex.h
  vendor-sys/acpica/dist/source/include/platform/acenv.h
  vendor-sys/acpica/dist/source/include/platform/acenvex.h
  vendor-sys/acpica/dist/source/include/platform/acfreebsd.h
  vendor-sys/acpica/dist/source/include/platform/acgcc.h
  vendor-sys/acpica/dist/source/include/platform/achaiku.h
  vendor-sys/acpica/dist/source/include/platform/acintel.h
  vendor-sys/acpica/dist/source/include/platform/aclinux.h
  vendor-sys/acpica/dist/source/include/platform/aclinuxex.h
  vendor-sys/acpica/dist/source/include/platform/acmsvc.h
  vendor-sys/acpica/dist/source/include/platform/acmsvcex.h
  vendor-sys/acpica/dist/source/include/platform/acnetbsd.h
  vendor-sys/acpica/dist/source/include/platform/acos2.h
  

svn commit: r303638 - head/sys/dev/e1000

2016-08-01 Thread Sean Bruno
Author: sbruno
Date: Mon Aug  1 21:19:51 2016
New Revision: 303638
URL: https://svnweb.freebsd.org/changeset/base/303638

Log:
  r293331 mistakingly failed to add an assignment of paddr to the rxbuf
  but only in the NETMAP code.  This lead to the NETMAP code paths
  passing nothing up to userland.
  
  Submitted by: Ad Schellevis 
  Reported by:  Franco Fichtner 
  MFC after:1 day

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Mon Aug  1 20:54:54 2016(r303637)
+++ head/sys/dev/e1000/if_em.c  Mon Aug  1 21:19:51 2016(r303638)
@@ -4392,6 +4392,7 @@ em_setup_receive_ring(struct rx_ring *rx
 
addr = PNMB(na, slot + si, );
netmap_load_map(na, rxr->rxtag, rxbuf->map, addr);
+   rxbuf->paddr = paddr;
em_setup_rxdesc(>rx_base[j], rxbuf);
continue;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303637 - head/sys/geom

2016-08-01 Thread Andrey V. Elsukov
Author: ae
Date: Mon Aug  1 20:54:54 2016
New Revision: 303637
URL: https://svnweb.freebsd.org/changeset/base/303637

Log:
  Do not invoke resize event if initial disk size is zero. Some disks
  report the size only after first opening.  And due to the events are
  asynchronous, some consumers can receive this event too late and
  this confuses them. This partially restores previous behaviour, and
  at the same time this should fix the problem, when already opened
  provider loses resize event.
  
  PR:   211028
  MFC after:3 weeks

Modified:
  head/sys/geom/geom_disk.c

Modified: head/sys/geom/geom_disk.c
==
--- head/sys/geom/geom_disk.c   Mon Aug  1 20:29:09 2016(r303636)
+++ head/sys/geom/geom_disk.c   Mon Aug  1 20:54:54 2016(r303637)
@@ -142,7 +142,14 @@ g_disk_access(struct g_provider *pp, int
pp->stripeoffset = dp->d_stripeoffset;
pp->stripesize = dp->d_stripesize;
dp->d_flags |= DISKFLAG_OPEN;
-   g_resize_provider(pp, dp->d_mediasize);
+   /*
+* Do not invoke resize event when initial size was zero.
+* Some disks report its size only after first opening.
+*/
+   if (pp->mediasize == 0)
+   pp->mediasize = dp->d_mediasize;
+   else
+   g_resize_provider(pp, dp->d_mediasize);
} else if ((pp->acr + pp->acw + pp->ace) > 0 && (r + w + e) == 0) {
if (dp->d_close != NULL) {
error = dp->d_close(dp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303636 - head/sys/ofed/drivers/infiniband/core

2016-08-01 Thread Mark Johnston
Author: markj
Date: Mon Aug  1 20:29:09 2016
New Revision: 303636
URL: https://svnweb.freebsd.org/changeset/base/303636

Log:
  MFV be9130cc9: "IB/cma: Check for GID on listening devices first"
  
  This is an optimization that improves IB connection setup times.
  
  Discussed with:   hselasky
  Obtained from:Linux
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/ofed/drivers/infiniband/core/cma.c

Modified: head/sys/ofed/drivers/infiniband/core/cma.c
==
--- head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug  1 20:27:11 2016
(r303635)
+++ head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug  1 20:29:09 2016
(r303636)
@@ -479,7 +479,8 @@ err:
 }
 EXPORT_SYMBOL(rdma_find_cmid_laddr);
 
-static int cma_acquire_dev(struct rdma_id_private *id_priv)
+static int cma_acquire_dev(struct rdma_id_private *id_priv,
+  struct rdma_id_private *listen_id_priv)
 {
struct rdma_dev_addr *dev_addr = _priv->id.route.addr.dev_addr;
struct cma_device *cma_dev;
@@ -499,8 +500,30 @@ static int cma_acquire_dev(struct rdma_i
 
memcpy(, dev_addr->src_dev_addr +
   rdma_addr_gid_offset(dev_addr), sizeof gid);
+   if (listen_id_priv &&
+   rdma_port_get_link_layer(listen_id_priv->id.device,
+listen_id_priv->id.port_num) == dev_ll) {
+   cma_dev = listen_id_priv->cma_dev;
+   port = listen_id_priv->id.port_num;
+   if (rdma_node_get_transport(cma_dev->device->node_type) == 
RDMA_TRANSPORT_IB &&
+   rdma_port_get_link_layer(cma_dev->device, port) == 
IB_LINK_LAYER_ETHERNET)
+   ret = ib_find_cached_gid(cma_dev->device, _gid,
+_port, NULL);
+   else
+   ret = ib_find_cached_gid(cma_dev->device, ,
+_port, NULL);
+
+   if (!ret && (port  == found_port)) {
+   id_priv->id.port_num = found_port;
+   goto out;
+   }
+   }
list_for_each_entry(cma_dev, _list, list) {
-   for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port)
+   for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port) {
+   if (listen_id_priv &&
+   listen_id_priv->cma_dev == cma_dev &&
+   listen_id_priv->id.port_num == port)
+   continue;
if (rdma_port_get_link_layer(cma_dev->device, port) == 
dev_ll) {
if 
(rdma_node_get_transport(cma_dev->device->node_type) == RDMA_TRANSPORT_IB &&
rdma_port_get_link_layer(cma_dev->device, 
port) == IB_LINK_LAYER_ETHERNET)
@@ -514,6 +537,7 @@ static int cma_acquire_dev(struct rdma_i
} else if (ret == 1)
break;
}
+   }
}
 
 out:
@@ -1423,7 +1447,7 @@ static int cma_req_handler(struct ib_cm_
}
 
mutex_lock_nested(_id->handler_mutex, SINGLE_DEPTH_NESTING);
-   ret = cma_acquire_dev(conn_id);
+   ret = cma_acquire_dev(conn_id, listen_id);
if (ret)
goto err2;
 
@@ -1656,7 +1680,7 @@ static int iw_conn_req_handler(struct iw
goto out;
}
 
-   ret = cma_acquire_dev(conn_id);
+   ret = cma_acquire_dev(conn_id, listen_id);
if (ret) {
mutex_unlock(_id->handler_mutex);
rdma_destroy_id(new_cm_id);
@@ -2218,7 +2242,7 @@ static void addr_handler(int status, str
memcpy(_priv->id.route.addr.src_addr, src_addr,
   ip_addr_size(src_addr));
if (!status && !id_priv->cma_dev)
-   status = cma_acquire_dev(id_priv);
+   status = cma_acquire_dev(id_priv, NULL);
 
if (status) {
if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_RESOLVED,
@@ -2744,7 +2768,7 @@ int rdma_bind_addr(struct rdma_cm_id *id
if (ret)
goto err1;
 
-   ret = cma_acquire_dev(id_priv);
+   ret = cma_acquire_dev(id_priv, NULL);
if (ret)
goto err1;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303635 - head/sys/ofed/drivers/infiniband/core

2016-08-01 Thread Mark Johnston
Author: markj
Date: Mon Aug  1 20:27:11 2016
New Revision: 303635
URL: https://svnweb.freebsd.org/changeset/base/303635

Log:
  MFV 29f27e847: "IB/cma: Use cached gids"
  
  This addresses a regression from an earlier upstream change which caused
  cma_acquire_dev() to bypass the port GID cache and instead query the HCA
  for each entry in its GID table. These queries can become extremely slow on
  multiport devices, which has a negative impact on connection setup times.
  
  Discussed with:   hselasky
  Obtained from:Linux
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/ofed/drivers/infiniband/core/cma.c

Modified: head/sys/ofed/drivers/infiniband/core/cma.c
==
--- head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug  1 20:02:59 2016
(r303634)
+++ head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug  1 20:27:11 2016
(r303635)
@@ -485,7 +485,7 @@ static int cma_acquire_dev(struct rdma_i
struct cma_device *cma_dev;
union ib_gid gid, iboe_gid;
int ret = -ENODEV;
-   u8 port;
+   u8 port, found_port;
enum rdma_link_layer dev_ll = dev_addr->dev_type == ARPHRD_INFINIBAND ?
IB_LINK_LAYER_INFINIBAND : IB_LINK_LAYER_ETHERNET;
 
@@ -500,21 +500,20 @@ static int cma_acquire_dev(struct rdma_i
memcpy(, dev_addr->src_dev_addr +
   rdma_addr_gid_offset(dev_addr), sizeof gid);
list_for_each_entry(cma_dev, _list, list) {
-   for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port) {
+   for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port)
if (rdma_port_get_link_layer(cma_dev->device, port) == 
dev_ll) {
if 
(rdma_node_get_transport(cma_dev->device->node_type) == RDMA_TRANSPORT_IB &&
rdma_port_get_link_layer(cma_dev->device, 
port) == IB_LINK_LAYER_ETHERNET)
-   ret = find_gid_port(cma_dev->device, 
_gid, port);
+   ret = 
ib_find_cached_gid(cma_dev->device, _gid, _port, NULL);
else
-   ret = find_gid_port(cma_dev->device, 
, port);
+   ret = 
ib_find_cached_gid(cma_dev->device, , _port, NULL);
 
-   if (!ret) {
+   if (!ret && (port == found_port)) {
id_priv->id.port_num = port;
goto out;
} else if (ret == 1)
-   break;
-   }
-   }
+   break;
+   }
}
 
 out:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303634 - in stable/11: contrib/gcc/config/arm gnu/lib/libgcc

2016-08-01 Thread Ed Maste
Author: emaste
Date: Mon Aug  1 20:02:59 2016
New Revision: 303634
URL: https://svnweb.freebsd.org/changeset/base/303634

Log:
  MFC r303396: rename ARM's libunwind.S to to avoid conflict with llvm libunwind
  
  llvm libunwind includes a libunwind.cpp, but on ARM libunwind.S is found
  first in .PATH. Rename the latter one, since it is not going to be
  updated again.
  
  Approved by:  re (kib)

Added:
  stable/11/contrib/gcc/config/arm/libunwind-arm.S
 - copied unchanged from r303396, 
head/contrib/gcc/config/arm/libunwind-arm.S
Deleted:
  stable/11/contrib/gcc/config/arm/libunwind.S
Modified:
  stable/11/gnu/lib/libgcc/Makefile
Directory Properties:
  stable/11/   (props changed)

Copied: stable/11/contrib/gcc/config/arm/libunwind-arm.S (from r303396, 
head/contrib/gcc/config/arm/libunwind-arm.S)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/contrib/gcc/config/arm/libunwind-arm.SMon Aug  1 20:02:59 
2016(r303634, copy of r303396, 
head/contrib/gcc/config/arm/libunwind-arm.S)
@@ -0,0 +1,136 @@
+/* Support functions for the unwinder.
+   Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+   This file is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option) any
+   later version.
+
+   In addition to the permissions in the GNU General Public License, the
+   Free Software Foundation gives you unlimited permission to link the
+   compiled version of this file into combinations with other programs,
+   and to distribute those combinations without any restriction coming
+   from the use of this file.  (The General Public License restrictions
+   do apply in other respects; for example, they cover modification of
+   the file, and distribution when not linked into a combine
+   executable.)
+
+   This file is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; see the file COPYING.  If not, write to
+   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+#include 
+
+/* Allow the use of VFP instructions */
+#if __ARM_ARCH >= 7
+.fpu   vfp
+#endif
+
+#ifndef __symbian__
+
+#include "lib1funcs.asm"
+
+.macro UNPREFIX name
+   .global SYM (\name)
+   EQUIV SYM (\name), SYM (__\name)
+.endm
+
+/* r0 points to a 16-word block.  Upload these values to the actual core
+   state.  */
+ARM_FUNC_START restore_core_regs
+   /* We must use sp as the base register when restoring sp.  Push the
+  last 3 registers onto the top of the current stack to achieve
+  this.  */
+   add r1, r0, #52
+   ldmia r1, {r3, r4, r5}  /* {sp, lr, pc}.  */
+#ifdef __INTERWORKING__
+   /* Restore pc into ip.  */
+   mov r2, r5
+   stmfd sp!, {r2, r3, r4}
+#else
+   stmfd sp!, {r3, r4, r5}
+#endif
+   /* Don't bother restoring ip.  */
+   ldmia r0, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp}
+   /* Pop the three registers we pushed earlier.  */
+#ifdef __INTERWORKING__
+   ldmfd sp, {ip, sp, lr}
+   bx ip
+#else
+   ldmfd sp, {sp, lr, pc}
+#endif
+   FUNC_END restore_core_regs
+   UNPREFIX restore_core_regs
+
+/* Load VFP registers d0-d15 from the address in r0.  */
+ARM_FUNC_START gnu_Unwind_Restore_VFP
+   /* Use the generic coprocessor form so that gas doesn't complain
+  on soft-float targets.  */
+#if __ARM_ARCH >= 7
+   fldmiax r0, {d0-d15}
+#else
+   ldc   p11,cr0,[r0],{0x21} /* fldmiax r0, {d0-d15} */
+#endif
+   RET
+
+/* Store VFR regsters d0-d15 to the address in r0.  */
+ARM_FUNC_START gnu_Unwind_Save_VFP
+   /* Use the generic coprocessor form so that gas doesn't complain
+  on soft-float targets.  */
+#if __ARM_ARCH >= 7
+   fstmiax r0, {d0-d15}
+#else
+   stc   p11,cr0,[r0],{0x21} /* fstmiax r0, {d0-d15} */
+#endif
+   RET
+
+/* Wrappers to save core registers, then call the real routine.   */
+
+.macro  UNWIND_WRAPPER name nargs
+   ARM_FUNC_START \name
+   /* Create a phase2_vrs structure.  */
+   /* Split reg push in two to ensure the correct value for sp.  */
+   stmfd sp!, {sp, lr, pc}
+   stmfd sp!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp, ip}
+   
+   /* Demand-save flags, plus an extra word for alignment.  */
+   mov r3, #0
+   stmfd sp!, {r2, r3}
+
+   /* Point r1 at the block.  Pass r[0..nargs) unchanged.  */
+   add r\nargs, sp, #4
+#if defined(__thumb__)
+   /* Switch back to thumb mode to 

svn commit: r303633 - stable/10/sys/dev/vt

2016-08-01 Thread Ed Maste
Author: emaste
Date: Mon Aug  1 19:53:18 2016
New Revision: 303633
URL: https://svnweb.freebsd.org/changeset/base/303633

Log:
  MFC r303338: vt: lock Giant around kbd calls in CONS_GETINFO
  
  Note that keyboards are stored in an array and are not freed (just
  "unregistered" by clearing some fields) so a race would be limited to
  obtaining stale information about an unregistered keyboard.
  
  Reported by:  CTurt

Modified:
  stable/10/sys/dev/vt/vt_core.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/vt/vt_core.c
==
--- stable/10/sys/dev/vt/vt_core.c  Mon Aug  1 19:50:28 2016
(r303632)
+++ stable/10/sys/dev/vt/vt_core.c  Mon Aug  1 19:53:18 2016
(r303633)
@@ -2183,9 +2183,11 @@ skip_thunk:
return (EINVAL);
 
if (vw == vd->vd_curwindow) {
+   mtx_lock();
kbd = kbd_get_keyboard(vd->vd_keyboard);
if (kbd != NULL)
vt_save_kbd_state(vw, kbd);
+   mtx_unlock();
}
 
vi->m_num = vd->vd_curwindow->vw_number + 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303632 - stable/11/sys/dev/vt

2016-08-01 Thread Ed Maste
Author: emaste
Date: Mon Aug  1 19:50:28 2016
New Revision: 303632
URL: https://svnweb.freebsd.org/changeset/base/303632

Log:
  MFC r303338:   vt: lock Giant around kbd calls in CONS_GETINFO
  
  Note that keyboards are stored in an array and are not freed (just
  "unregistered" by clearing some fields) so a race would be limited to
  obtaining stale information about an unregistered keyboard.
  
  Reported by:  CTurt
  Approved by:  re (gjb, kib)

Modified:
  stable/11/sys/dev/vt/vt_core.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/vt/vt_core.c
==
--- stable/11/sys/dev/vt/vt_core.c  Mon Aug  1 19:49:42 2016
(r303631)
+++ stable/11/sys/dev/vt/vt_core.c  Mon Aug  1 19:50:28 2016
(r303632)
@@ -2228,9 +2228,11 @@ skip_thunk:
return (EINVAL);
 
if (vw == vd->vd_curwindow) {
+   mtx_lock();
kbd = kbd_get_keyboard(vd->vd_keyboard);
if (kbd != NULL)
vt_save_kbd_state(vw, kbd);
+   mtx_unlock();
}
 
vi->m_num = vd->vd_curwindow->vw_number + 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303631 - head/usr.sbin/bsdinstall/scripts

2016-08-01 Thread Dimitry Andric
Author: dim
Date: Mon Aug  1 19:49:42 2016
New Revision: 303631
URL: https://svnweb.freebsd.org/changeset/base/303631

Log:
  Fix non-functional bsdinstall services dialog.
  
  The most recent version of bsdinstall does not seem to respect any of
  the checkboxes in the "Choose the services you would like to be started
  at boot" dialog.  None of the chosen services end up in the rc.conf file
  that is installed onto the target system.
  
  This is caused by the bsdinstall/scripts/hardening script, which
  implements the new hardening options dialog.  The script starts by
  overwriting the previously written rc.conf.services file:
  
  echo -n > $BSDINSTALL_TMPETC/rc.conf.services
  
  which is obviously incorrect.  It should clear out rc.conf.hardening
  instead.
  
  Reviewed by:  allanjude
  PR:   211506
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D7387

Modified:
  head/usr.sbin/bsdinstall/scripts/hardening

Modified: head/usr.sbin/bsdinstall/scripts/hardening
==
--- head/usr.sbin/bsdinstall/scripts/hardening  Mon Aug  1 19:37:43 2016
(r303630)
+++ head/usr.sbin/bsdinstall/scripts/hardening  Mon Aug  1 19:49:42 2016
(r303631)
@@ -28,7 +28,7 @@
 
 : ${DIALOG_OK=0}
 
-echo -n > $BSDINSTALL_TMPETC/rc.conf.services
+echo -n > $BSDINSTALL_TMPETC/rc.conf.hardening
 
 exec 3>&1
 FEATURES=$( dialog --backtitle "FreeBSD Installer" \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303630 - in head/sys: boot/zfs cddl/boot/zfs

2016-08-01 Thread Allan Jude
Author: allanjude
Date: Mon Aug  1 19:37:43 2016
New Revision: 303630
URL: https://svnweb.freebsd.org/changeset/base/303630

Log:
  Make boot code and loader check for unsupported ZFS feature flags
  
  OpenZFS uses feature flags instead of a zpool version number to track
  features since the split from Oracle. In addition to avoiding confusion
  on ZFS vs OpenZFS version numbers, this also allows features to be added
  to different operating systems that use OpenZFS in different order.
  
  The previous zfs boot code (gptzfsboot) and loader (zfsloader) blindly
  tries to read the pool, and if failed provided only a vague error message.
  
  With this change, both the boot code and loader check the MOS features
  list in the ZFS label and compare it against the list of features that
  the loader supports. If any unsupported feature is active, the pool is
  not considered as a candidate for booting, and a helpful diagnostic
  message is printed to the screen. Features that are merely enabled via
  zpool upgrade, but not in use, do not block booting from the pool.
  
  Submitted by: Toomas Soome 
  Reviewed by:  delphij, mav
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D6857

Modified:
  head/sys/boot/zfs/libzfs.h
  head/sys/boot/zfs/zfs.c
  head/sys/boot/zfs/zfsimpl.c
  head/sys/cddl/boot/zfs/zfsimpl.h

Modified: head/sys/boot/zfs/libzfs.h
==
--- head/sys/boot/zfs/libzfs.h  Mon Aug  1 19:24:01 2016(r303629)
+++ head/sys/boot/zfs/libzfs.h  Mon Aug  1 19:37:43 2016(r303630)
@@ -65,7 +65,7 @@ int   zfs_probe_dev(const char *devname, u
 intzfs_list(const char *name);
 void   init_zfs_bootenv(char *currdev);
 intzfs_bootenv(const char *name);
-intzfs_belist_add(const char *name);
+intzfs_belist_add(const char *name, uint64_t __unused);
 intzfs_set_env(void);
 
 extern struct devsw zfs_dev;

Modified: head/sys/boot/zfs/zfs.c
==
--- head/sys/boot/zfs/zfs.c Mon Aug  1 19:24:01 2016(r303629)
+++ head/sys/boot/zfs/zfs.c Mon Aug  1 19:37:43 2016(r303630)
@@ -801,7 +801,7 @@ zfs_bootenv(const char *name)
 }
 
 int
-zfs_belist_add(const char *name)
+zfs_belist_add(const char *name, uint64_t value __unused)
 {
 
/* Skip special datasets that start with a $ character */

Modified: head/sys/boot/zfs/zfsimpl.c
==
--- head/sys/boot/zfs/zfsimpl.c Mon Aug  1 19:24:01 2016(r303629)
+++ head/sys/boot/zfs/zfsimpl.c Mon Aug  1 19:37:43 2016(r303630)
@@ -1473,12 +1473,12 @@ zap_lookup(const spa_t *spa, const dnode
  * the directory contents.
  */
 static int
-mzap_list(const dnode_phys_t *dnode, int (*callback)(const char *))
+mzap_list(const dnode_phys_t *dnode, int (*callback)(const char *, uint64_t))
 {
const mzap_phys_t *mz;
const mzap_ent_phys_t *mze;
size_t size;
-   int chunks, i;
+   int chunks, i, rc;
 
/*
 * Microzap objects use exactly one block. Read the whole
@@ -1490,9 +1490,11 @@ mzap_list(const dnode_phys_t *dnode, int
 
for (i = 0; i < chunks; i++) {
mze = >mz_chunk[i];
-   if (mze->mze_name[0])
-   //printf("%-32s 0x%jx\n", mze->mze_name, 
(uintmax_t)mze->mze_value);
-   callback(mze->mze_name);
+   if (mze->mze_name[0]) {
+   rc = callback(mze->mze_name, mze->mze_value);
+   if (rc != 0)
+   return (rc);
+   }
}
 
return (0);
@@ -1503,12 +1505,12 @@ mzap_list(const dnode_phys_t *dnode, int
  * the directory header.
  */
 static int
-fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const 
char *))
+fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const 
char *, uint64_t))
 {
int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT;
zap_phys_t zh = *(zap_phys_t *) zap_scratch;
fat_zap_t z;
-   int i, j;
+   int i, j, rc;
 
if (zh.zap_magic != ZAP_MAGIC)
return (EIO);
@@ -1566,14 +1568,16 @@ fzap_list(const spa_t *spa, const dnode_
value = fzap_leaf_value(, zc);
 
//printf("%s 0x%jx\n", name, (uintmax_t)value);
-   callback((const char *)name);
+   rc = callback((const char *)name, value);
+   if (rc != 0)
+   return (rc);
}
}
 
return (0);
 }
 
-static int zfs_printf(const char *name)
+static int zfs_printf(const char *name, uint64_t value __unused)
 {
 
printf("%s\n", name);
@@ -1868,7 +1872,7 @@ zfs_list_dataset(const spa_t *spa, uint6
 }
 
 int

svn commit: r303629 - head/usr.bin/indent

2016-08-01 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Aug  1 19:24:01 2016
New Revision: 303629
URL: https://svnweb.freebsd.org/changeset/base/303629

Log:
  indent: Avoid using values of pointers that refer to deallocated space.
  
  For now maintain the local style in this file.
  
  Reviewed by:  jilles
  
  Reference:
  
https://github.com/pstef/freebsd_indent/commit/9099a9f17bc5f579514a4c1f5cf3df6624c6
  
  Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
  Submitted by: Piotr Stefaniak

Modified:
  head/usr.bin/indent/indent_globs.h

Modified: head/usr.bin/indent/indent_globs.h
==
--- head/usr.bin/indent/indent_globs.h  Mon Aug  1 17:51:35 2016
(r303628)
+++ head/usr.bin/indent/indent_globs.h  Mon Aug  1 19:24:01 2016
(r303629)
@@ -57,41 +57,46 @@ FILE   *output; /* the output file 
 #define CHECK_SIZE_CODE \
if (e_code >= l_code) { \
int nsize = l_code-s_code+400; \
+   int code_len = e_code-s_code; \
codebuf = (char *) realloc(codebuf, nsize); \
if (codebuf == NULL) \
err(1, NULL); \
-   e_code = codebuf + (e_code-s_code) + 1; \
+   e_code = codebuf + code_len + 1; \
l_code = codebuf + nsize - 5; \
s_code = codebuf + 1; \
}
 #define CHECK_SIZE_COM \
if (e_com >= l_com) { \
int nsize = l_com-s_com+400; \
+   int com_len = e_com - s_com; \
+   int blank_pos = last_bl - s_com; \
combuf = (char *) realloc(combuf, nsize); \
if (combuf == NULL) \
err(1, NULL); \
-   e_com = combuf + (e_com-s_com) + 1; \
-   last_bl = combuf + (last_bl-s_com) + 1; \
+   e_com = combuf + com_len + 1; \
+   last_bl = combuf + blank_pos + 1; \
l_com = combuf + nsize - 5; \
s_com = combuf + 1; \
}
 #define CHECK_SIZE_LAB \
if (e_lab >= l_lab) { \
int nsize = l_lab-s_lab+400; \
+   int label_len = e_lab - s_lab; \
labbuf = (char *) realloc(labbuf, nsize); \
if (labbuf == NULL) \
err(1, NULL); \
-   e_lab = labbuf + (e_lab-s_lab) + 1; \
+   e_lab = labbuf + label_len + 1; \
l_lab = labbuf + nsize - 5; \
s_lab = labbuf + 1; \
}
 #define CHECK_SIZE_TOKEN \
if (e_token >= l_token) { \
int nsize = l_token-s_token+400; \
+   int token_len = e_token - s_token; \
tokenbuf = (char *) realloc(tokenbuf, nsize); \
if (tokenbuf == NULL) \
err(1, NULL); \
-   e_token = tokenbuf + (e_token-s_token) + 1; \
+   e_token = tokenbuf + token_len + 1; \
l_token = tokenbuf + nsize - 5; \
s_token = tokenbuf + 1; \
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303503 - head/sys/kern

2016-08-01 Thread John Baldwin
On Saturday, July 30, 2016 10:38:34 AM Bruce Evans wrote:
> On Fri, 29 Jul 2016, John Baldwin wrote:
> 
> > Log:
> >  Don't treat NOCPU as a valid CPU to CPU_ISSET.
> >
> >  If a thread is created bound to a cpuset it might already be bound before
> >  it's very first timeslice, and td_lastcpu will be NOCPU in that case.
> >
> >  MFC after: 1 week
> 
> Thanks.  Did you get this from your mail queue on 2016/05/08?

No. :(  I will go back and check that mail to see what else I missed.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303628 - in stable/11: share/man/man4 sys/conf sys/contrib/dev/iwm sys/dev/iwm sys/modules/iwmfw sys/modules/iwmfw/iwm3160fw sys/modules/iwmfw/iwm7260fw sys/modules/iwmfw/iwm7265fw sys...

2016-08-01 Thread Sean Bruno
Author: sbruno
Date: Mon Aug  1 17:51:35 2016
New Revision: 303628
URL: https://svnweb.freebsd.org/changeset/base/303628

Log:
  MFC r303322,303326,303327,303345,303413,303416,303418,303557
  
  Update iwm(4) and iwmfw(4) to current in order to stabilize and improve
  functionality.
  
  Approved by:re (gjb)

Added:
  stable/11/sys/contrib/dev/iwm/iwm-3160-16.fw.uu
 - copied unchanged from r303322, head/sys/contrib/dev/iwm/iwm-3160-16.fw.uu
  stable/11/sys/contrib/dev/iwm/iwm-7260-16.fw.uu
 - copied unchanged from r303322, head/sys/contrib/dev/iwm/iwm-7260-16.fw.uu
  stable/11/sys/contrib/dev/iwm/iwm-7265-16.fw.uu
 - copied unchanged from r303322, head/sys/contrib/dev/iwm/iwm-7265-16.fw.uu
  stable/11/sys/contrib/dev/iwm/iwm-8000C-16.fw.uu
 - copied unchanged from r303322, 
head/sys/contrib/dev/iwm/iwm-8000C-16.fw.uu
  stable/11/sys/modules/iwmfw/iwm8000Cfw/
 - copied from r303322, head/sys/modules/iwmfw/iwm8000Cfw/
Modified:
  stable/11/share/man/man4/iwm.4
  stable/11/share/man/man4/iwmfw.4
  stable/11/sys/conf/files
  stable/11/sys/contrib/dev/iwm/iwm-3160-9.fw.uu
  stable/11/sys/contrib/dev/iwm/iwm-7260-9.fw.uu
  stable/11/sys/contrib/dev/iwm/iwm-7265-9.fw.uu
  stable/11/sys/dev/iwm/if_iwm.c
  stable/11/sys/dev/iwm/if_iwm_led.c
  stable/11/sys/dev/iwm/if_iwm_led.h
  stable/11/sys/dev/iwm/if_iwm_mac_ctxt.c
  stable/11/sys/dev/iwm/if_iwm_pcie_trans.c
  stable/11/sys/dev/iwm/if_iwm_phy_ctxt.c
  stable/11/sys/dev/iwm/if_iwm_phy_db.c
  stable/11/sys/dev/iwm/if_iwm_power.c
  stable/11/sys/dev/iwm/if_iwm_scan.c
  stable/11/sys/dev/iwm/if_iwm_scan.h
  stable/11/sys/dev/iwm/if_iwm_time_event.c
  stable/11/sys/dev/iwm/if_iwm_util.c
  stable/11/sys/dev/iwm/if_iwm_util.h
  stable/11/sys/dev/iwm/if_iwmreg.h
  stable/11/sys/dev/iwm/if_iwmvar.h
  stable/11/sys/modules/iwmfw/Makefile
  stable/11/sys/modules/iwmfw/iwm3160fw/Makefile
  stable/11/sys/modules/iwmfw/iwm7260fw/Makefile
  stable/11/sys/modules/iwmfw/iwm7265fw/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/iwm.4
==
--- stable/11/share/man/man4/iwm.4  Mon Aug  1 17:25:07 2016
(r303627)
+++ stable/11/share/man/man4/iwm.4  Mon Aug  1 17:51:35 2016
(r303628)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 1, 2015
+.Dd July 26, 2016
 .Dt IWM 4
 .Os
 .Sh NAME
@@ -48,6 +48,7 @@ Choose one from:
 .Cd "device iwm3160fw"
 .Cd "device iwm7260fw"
 .Cd "device iwm7265fw"
+.Cd "device iwm8000Cfw"
 .Ed
 .Pp
 Or you can use
@@ -65,6 +66,7 @@ if_iwm_load="YES"
 iwm3160fw_load="YES"
 iwm7260fw_load="YES"
 iwm7265fw_load="YES"
+iwm8000Cfw_load="YES"
 .Ed
 .Sh DESCRIPTION
 The
@@ -73,8 +75,10 @@ driver provides support for:
 .Pp
 .Bl -tag -width Ds -offset indent -compact
 .It Intel Dual Band Wireless AC 3160
+.It Intel Dual Band Wireless AC 3165
 .It Intel Dual Band Wireless AC 7260
 .It Intel Dual Band Wireless AC 7265
+.It Intel Dual Band Wireless AC 8260
 .El
 .Pp
 .Nm

Modified: stable/11/share/man/man4/iwmfw.4
==
--- stable/11/share/man/man4/iwmfw.4Mon Aug  1 17:25:07 2016
(r303627)
+++ stable/11/share/man/man4/iwmfw.4Mon Aug  1 17:51:35 2016
(r303628)
@@ -22,7 +22,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 28, 2015
+.Dd July 26, 2016
 .Dt IWMFW 4
 .Os
 .Sh NAME
@@ -45,6 +45,7 @@ of the following:
 .Cd "device iwm3160fw"
 .Cd "device iwm7260fw"
 .Cd "device iwm7265fw"
+.Cd "device iwm8000Cfw"
 .Ed
 .Pp
 Alternatively, to load the driver as a
@@ -54,10 +55,11 @@ module at boot time, place the following
 iwm3160fw_load="YES"
 iwm7260fw_load="YES"
 iwm7265fw_load="YES"
+iwm8000Cfw_load="YES"
 .Ed
 .Sh DESCRIPTION
 This module provides access to firmware sets for the
-Intel Dual Band Wireless WiFi 3160, 7260 and 7265 series of
+Intel Dual Band Wireless WiFi 3160, 3165, 7260, 7265 and 8260 series of
 IEEE 802.11n/11ac adapters.
 It may be
 statically linked into the kernel, or loaded as a module.

Modified: stable/11/sys/conf/files
==
--- stable/11/sys/conf/filesMon Aug  1 17:25:07 2016(r303627)
+++ stable/11/sys/conf/filesMon Aug  1 17:51:35 2016(r303628)
@@ -1732,7 +1732,7 @@ iwm3160fw.fwo optional iwm3160fw | iwm
no-implicit-rule\
clean   "iwm3160fw.fwo"
 iwm3160.fw optional iwm3160fw | iwmfw  \
-   dependency  "$S/contrib/dev/iwm/iwm-3160-9.fw.uu" \
+   dependency  "$S/contrib/dev/iwm/iwm-3160-16.fw.uu" \
compile-with"${NORMAL_FW}"  \
no-obj no-implicit-rule \
clean   "iwm3160.fw"
@@ -1746,7 +1746,7 @@ iwm7260fw.fwo optional iwm7260fw | iwm
 

svn commit: r303627 - head/sys/vm

2016-08-01 Thread Alan Cox
Author: alc
Date: Mon Aug  1 17:25:07 2016
New Revision: 303627
URL: https://svnweb.freebsd.org/changeset/base/303627

Log:
  Restore the historical behavior of "sysctl vm.swap_idle_enabled=1".  Prior
  to r254304, we had separate functions for reclamation and laundering
  (vm_pageout_scan) versus updating usage information, i.e., "reference
  bits", on active pages (vm_pageout_page_stats), and we only performed
  vm_req_vmdaemon(VM_SWAP_IDLE) if vm_pages_needed was true.  However, since
  r254303, if vm_swap_idle_enabled was "1", we have performed
  vm_req_vmdaemon(VM_SWAP_IDLE) regardless of whether we are short of free
  pages.  This was unintended and too aggressive, so I suspect no one uses
  this feature.  With this change, we restore the historical behavior and
  only perform vm_req_vmdaemon(VM_SWAP_IDLE) when we are short of free
  pages.
  
  Reviewed by:  kib, markj

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cMon Aug  1 17:02:21 2016(r303626)
+++ head/sys/vm/vm_pageout.cMon Aug  1 17:25:07 2016(r303627)
@@ -1289,9 +1289,10 @@ relock_queue:
vm_pagequeue_unlock(pq);
 #if !defined(NO_SWAPPING)
/*
-* Idle process swapout -- run once per second.
+* Idle process swapout -- run once per second when we are reclaiming
+* pages.
 */
-   if (vm_swap_idle_enabled) {
+   if (vm_swap_idle_enabled && pass > 0) {
static long lsec;
if (time_second != lsec) {
vm_req_vmdaemon(VM_SWAP_IDLE);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303626 - in head/sys: netinet netinet6

2016-08-01 Thread Andrew Gallatin
Author: gallatin
Date: Mon Aug  1 17:02:21 2016
New Revision: 303626
URL: https://svnweb.freebsd.org/changeset/base/303626

Log:
  Rework IPV6 TCP path MTU discovery to match IPv4
  
  - Re-write tcp_ctlinput6() to closely mimic the IPv4 tcp_ctlinput()
  
  - Now that tcp_ctlinput6() updates t_maxseg, we can allow ip6_output()
to send TCP packets without looking at the tcp host cache for every
single transmit.
  
  - Make the icmp6 code mimic the IPv4 code & avoid returning
PRC_HOSTDEAD because it is so expensive.
  
  Without these changes in place, every TCP6 pmtu discovery or host
  unreachable ICMP resulted in a call to in6_pcbnotify() which walks the
  tcbinfo table with the write lock held.  Because the tcbinfo table is
  shared between IPv4 and IPv6, this causes huge scalabilty issues on
  servers with lots of (~100K) TCP connections, to the point where even
  a small percent of IPv6 traffic had a disproportionate impact on
  overall throughput.
  
  Reviewed by:  bz, rrs, ae (all earlier versions), lstewart (in Netflix's tree)
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D7272

Modified:
  head/sys/netinet/tcp_subr.c
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Mon Aug  1 16:40:42 2016(r303625)
+++ head/sys/netinet/tcp_subr.c Mon Aug  1 17:02:21 2016(r303626)
@@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #ifdef INET6
+#include 
 #include 
 #include 
 #include 
@@ -2040,72 +2041,146 @@ tcp_ctlinput(int cmd, struct sockaddr *s
 void
 tcp6_ctlinput(int cmd, struct sockaddr *sa, void *d)
 {
-   struct tcphdr th;
+   struct in6_addr *dst;
+   struct tcphdr *th;
struct inpcb *(*notify)(struct inpcb *, int) = tcp_notify;
struct ip6_hdr *ip6;
struct mbuf *m;
+   struct inpcb *inp;
+   struct tcpcb *tp;
+   struct icmp6_hdr *icmp6;
struct ip6ctlparam *ip6cp = NULL;
const struct sockaddr_in6 *sa6_src = NULL;
-   int off;
-   struct tcp_portonly {
-   u_int16_t th_sport;
-   u_int16_t th_dport;
-   } *thp;
+   struct in_conninfo inc;
+   tcp_seq icmp_tcp_seq;
+   unsigned int mtu;
+   unsigned int off;
+
 
if (sa->sa_family != AF_INET6 ||
sa->sa_len != sizeof(struct sockaddr_in6))
return;
 
-   if (cmd == PRC_MSGSIZE)
-   notify = tcp_mtudisc_notify;
-   else if (!PRC_IS_REDIRECT(cmd) &&
-((unsigned)cmd >= PRC_NCMDS || inet6ctlerrmap[cmd] == 0))
-   return;
-
/* if the parameter is from icmp6, decode it. */
if (d != NULL) {
ip6cp = (struct ip6ctlparam *)d;
+   icmp6 = ip6cp->ip6c_icmp6;
m = ip6cp->ip6c_m;
ip6 = ip6cp->ip6c_ip6;
off = ip6cp->ip6c_off;
sa6_src = ip6cp->ip6c_src;
+   dst = ip6cp->ip6c_finaldst;
} else {
m = NULL;
ip6 = NULL;
off = 0;/* fool gcc */
sa6_src = _any;
+   dst = NULL;
}
 
-   if (ip6 != NULL) {
-   struct in_conninfo inc;
-   /*
-* XXX: We assume that when IPV6 is non NULL,
-* M and OFF are valid.
-*/
+   if (cmd == PRC_MSGSIZE)
+   notify = tcp_mtudisc_notify;
+   else if (V_icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB ||
+   cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) &&
+   ip6 != NULL)
+   notify = tcp_drop_syn_sent;
 
-   /* check if we can safely examine src and dst ports */
-   if (m->m_pkthdr.len < off + sizeof(*thp))
-   return;
+   /*
+* Hostdead is ugly because it goes linearly through all PCBs.
+* XXX: We never get this from ICMP, otherwise it makes an
+* excellent DoS attack on machines with many connections.
+*/
+   else if (cmd == PRC_HOSTDEAD)
+   ip6 = NULL;
+   else if ((unsigned)cmd >= PRC_NCMDS || inet6ctlerrmap[cmd] == 0)
+   return;
 
-   bzero(, sizeof(th));
-   m_copydata(m, off, sizeof(*thp), (caddr_t));
+   if (ip6 == NULL) {
+   in6_pcbnotify(_tcbinfo, sa, 0,
+ (const struct sockaddr *)sa6_src,
+ 0, cmd, NULL, notify);
+   return;
+   }
 
-   in6_pcbnotify(_tcbinfo, sa, th.th_dport,
-   (struct sockaddr *)ip6cp->ip6c_src,
-   th.th_sport, cmd, NULL, notify);
+   /* Check if we can safely get the ports from the tcp hdr */
+   if (m == NULL ||
+   (m->m_pkthdr.len <
+   

Re: svn commit: r303522 - head/sys/dev/cxgbe

2016-08-01 Thread Bruce Simpson

On 01/08/16 17:49, Ian Lepore wrote:
...

In addition, the strerror() output for ENOTTY says nothing about a
typewriter, the text is "Inappropriate ioctl for device."


If that semantic gap has already been plugged, ignore my message.

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303522 - head/sys/dev/cxgbe

2016-08-01 Thread Ian Lepore
On Mon, 2016-08-01 at 16:38 +0100, Bruce Simpson wrote:
> "Yes, I know it's not a typewriter. Why is this command not working?"
> 
> Perhaps this errno code should be aliased... and strerror() massaged
> in 
> places... assuming we strictly follow the POSIX.
> 

It's not clear just what point you're trying to make.

ENOTTY has a special meaning as a return value from an ioctl call in
some contexts (it specifically means the called routine did not handle
the command and other routines hooked into the ioctl call chain may be
able to do the job).

In addition, the strerror() output for ENOTTY says nothing about a
typewriter, the text is "Inappropriate ioctl for device."

-- Ian

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303586 - head/bin/sh

2016-08-01 Thread Ian Lepore
On Sun, 2016-07-31 at 13:43 +, Alexey Dokuchaev wrote:
> On Sun, Jul 31, 2016 at 01:11:34PM +, Jilles Tjoelker wrote:
> > New Revision: 303586
> > URL: https://svnweb.freebsd.org/changeset/base/303586
> > 
> > Log:
> >   sh: Fix a clang warning.
> >   
> >   Submitted by: bdrewery
> > 
> > Modified:
> >   head/bin/sh/expand.c
> > 
> > Modified: head/bin/sh/expand.c
> > ===
> > ===
> > --- head/bin/sh/expand.cSun Jul 31 12:59:10 2016(r3
> > 03585)
> > +++ head/bin/sh/expand.cSun Jul 31 13:11:34 2016(r3
> > 03586)
> > @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in
> > if (--in.nleft < 0) {
> > if (in.fd < 0)
> > break;
> > -   while ((i = read(in.fd, buf, sizeof buf))
> > < 0 && errno == EINTR);
> > +   while ((i = read(in.fd, buf, sizeof buf))
> > < 0 && errno == EINTR)
> > +   ;
> 
> `continue;' would be even better; some tools might barf at stray
> semicolon.
> 
> ./danfe
> 

I strongly agree that the right way to do an empty loop is to use
"continue;" on a line by itself.  Unfortunately, what style(9) suggests
by way of example is a single semicolon on a line by itself with a
comment of "/* nothing */" to the right on the same line.  Ick.

-- Ian
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303625 - head/usr.bin/indent

2016-08-01 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Aug  1 16:40:42 2016
New Revision: 303625
URL: https://svnweb.freebsd.org/changeset/base/303625

Log:
  indent(1): Use a dash in the license headers.
  
  Use of the canonical dash avoids indent(1) from reformatting the
  license headers.

Modified:
  head/usr.bin/indent/args.c
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/indent.h
  head/usr.bin/indent/indent_codes.h
  head/usr.bin/indent/indent_globs.h
  head/usr.bin/indent/io.c
  head/usr.bin/indent/lexi.c
  head/usr.bin/indent/parse.c
  head/usr.bin/indent/pr_comment.c

Modified: head/usr.bin/indent/args.c
==
--- head/usr.bin/indent/args.c  Mon Aug  1 16:39:40 2016(r303624)
+++ head/usr.bin/indent/args.c  Mon Aug  1 16:40:42 2016(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cMon Aug  1 16:39:40 2016
(r303624)
+++ head/usr.bin/indent/indent.cMon Aug  1 16:40:42 2016
(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1976 Board of Trustees of the University of Illinois.
  * Copyright (c) 1980, 1993

Modified: head/usr.bin/indent/indent.h
==
--- head/usr.bin/indent/indent.hMon Aug  1 16:39:40 2016
(r303624)
+++ head/usr.bin/indent/indent.hMon Aug  1 16:40:42 2016
(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2001 Jens Schweikhardt
  * All rights reserved.
  *

Modified: head/usr.bin/indent/indent_codes.h
==
--- head/usr.bin/indent/indent_codes.h  Mon Aug  1 16:39:40 2016
(r303624)
+++ head/usr.bin/indent/indent_codes.h  Mon Aug  1 16:40:42 2016
(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/indent_globs.h
==
--- head/usr.bin/indent/indent_globs.h  Mon Aug  1 16:39:40 2016
(r303624)
+++ head/usr.bin/indent/indent_globs.h  Mon Aug  1 16:40:42 2016
(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/io.c
==
--- head/usr.bin/indent/io.cMon Aug  1 16:39:40 2016(r303624)
+++ head/usr.bin/indent/io.cMon Aug  1 16:40:42 2016(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/lexi.c
==
--- head/usr.bin/indent/lexi.c  Mon Aug  1 16:39:40 2016(r303624)
+++ head/usr.bin/indent/lexi.c  Mon Aug  1 16:40:42 2016(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/parse.c
==
--- head/usr.bin/indent/parse.c Mon Aug  1 16:39:40 2016(r303624)
+++ head/usr.bin/indent/parse.c Mon Aug  1 16:40:42 2016(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/pr_comment.c
==
--- head/usr.bin/indent/pr_comment.cMon Aug  1 16:39:40 2016
(r303624)
+++ head/usr.bin/indent/pr_comment.cMon Aug  1 16:40:42 2016
(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303624 - stable/11/usr.bin/cpuset

2016-08-01 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug  1 16:39:40 2016
New Revision: 303624
URL: https://svnweb.freebsd.org/changeset/base/303624

Log:
  MFC r303520
  
  Fix markup for -j in cpuset(1) synopsis
  
  Approved by:  re (kib)
  Sponsored by: Dell Inc.

Modified:
  stable/11/usr.bin/cpuset/cpuset.1
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/cpuset/cpuset.1
==
--- stable/11/usr.bin/cpuset/cpuset.1   Mon Aug  1 16:29:32 2016
(r303623)
+++ stable/11/usr.bin/cpuset/cpuset.1   Mon Aug  1 16:39:40 2016
(r303624)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 8, 2015
+.Dd August 1, 2016
 .Dt CPUSET 1
 .Os
 .Sh NAME
@@ -52,7 +52,7 @@
 .Nm
 .Fl g
 .Op Fl cir
-.Op Fl d Ar domain | j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | 
Fl x Ar irq
+.Op Fl d Ar domain | Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar 
setid | Fl x Ar irq
 .Sh DESCRIPTION
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303623 - in head/sys/mips: broadcom conf

2016-08-01 Thread Landon J. Fuller
Author: landonf
Date: Mon Aug  1 16:29:32 2016
New Revision: 303623
URL: https://svnweb.freebsd.org/changeset/base/303623

Log:
  [mips/broadcom] Fetch UART console configuration from CFE.
  
  Relying on the boot loader console configuration allows us to use a
  common set of device hints for all SENTRY5 devices.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D7376

Modified:
  head/sys/mips/broadcom/uart_cpu_chipc.c
  head/sys/mips/conf/SENTRY5.hints

Modified: head/sys/mips/broadcom/uart_cpu_chipc.c
==
--- head/sys/mips/broadcom/uart_cpu_chipc.c Mon Aug  1 16:29:04 2016
(r303622)
+++ head/sys/mips/broadcom/uart_cpu_chipc.c Mon Aug  1 16:29:32 2016
(r303623)
@@ -47,6 +47,12 @@ __FBSDID("$FreeBSD$");
 
 #include "bcm_socinfo.h"
 
+#ifdef CFE
+#include 
+#include 
+#include 
+#endif
+
 bus_space_tag_t uart_bus_space_io;
 bus_space_tag_t uart_bus_space_mem;
 
@@ -61,7 +67,7 @@ uart_cpu_eqres(struct uart_bas *b1, stru
 }
 
 static int
-uart_cpu_init(struct uart_devinfo *di, int uart, int baudrate)
+uart_cpu_init(struct uart_devinfo *di, u_int uart, int baudrate)
 {
struct bcm_socinfo  *socinfo;
 
@@ -83,6 +89,44 @@ uart_cpu_init(struct uart_devinfo *di, i
return (0);
 }
 
+#ifdef CFE
+static int
+uart_getenv_cfe(int devtype, struct uart_devinfo *di)
+{
+   chardevice[sizeof("uartXX")];
+   int baud, fd, len;
+   int ret;
+   u_int   uart;
+
+   /* CFE only vends console configuration */
+   if (devtype != UART_DEV_CONSOLE)
+   return (ENODEV);
+
+   /* Fetch console device */
+   ret = cfe_getenv("BOOT_CONSOLE", device, sizeof(device));
+   if (ret != CFE_OK)
+   return (ENXIO);
+
+   /* Parse serial console unit. Fails on non-uart devices.  */
+   if (sscanf(device, "uart%u", ) != 1)
+   return (ENXIO);
+
+   /* Fetch device handle */
+   fd = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE);
+   if (fd < 0)
+   return (ENXIO);
+
+   /* Fetch serial configuration */
+   ret = cfe_ioctl(fd, IOCTL_SERIAL_GETSPEED, (unsigned char *),
+   sizeof(baud), , 0); 
+   if (ret != CFE_OK)
+   baud = CHIPC_UART_BAUDRATE;
+
+   /* Initialize device info */
+   return (uart_cpu_init(di, uart, baud));
+}
+#endif /* CFE */
+
 int
 uart_cpu_getdev(int devtype, struct uart_devinfo *di)
 {
@@ -91,12 +135,18 @@ uart_cpu_getdev(int devtype, struct uart
uart_bus_space_io = NULL;
uart_bus_space_mem = mips_bus_space_generic;
 
-   /* Check the environment. */
+#ifdef CFE
+   /* Check the CFE environment */
+   if (uart_getenv_cfe(devtype, di) == 0)
+   return (0);
+#endif /* CFE */
+
+   /* Check the kernel environment. */
if (uart_getenv(devtype, di, chipc_uart_class) == 0)
return (0);
 
/* Scan the device hints for the first matching device */
-   for (int i = 0; i < CHIPC_UART_MAX; i++) {
+   for (u_int i = 0; i < CHIPC_UART_MAX; i++) {
if (resource_int_value("uart", i, "flags", ))
continue;
 

Modified: head/sys/mips/conf/SENTRY5.hints
==
--- head/sys/mips/conf/SENTRY5.hintsMon Aug  1 16:29:04 2016
(r303622)
+++ head/sys/mips/conf/SENTRY5.hintsMon Aug  1 16:29:32 2016
(r303623)
@@ -2,6 +2,3 @@
 hint.bhnd.0.at="nexus0"
 hint.bhnd.0.maddr="0x1800" 
 hint.bhnd.0.msize="0x0010"
-
-# console on uart1
-hint.uart.1.flags="0x10"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303622 - in head/sys: arm/arm conf

2016-08-01 Thread Andrew Turner
Author: andrew
Date: Mon Aug  1 16:29:04 2016
New Revision: 303622
URL: https://svnweb.freebsd.org/changeset/base/303622

Log:
  Split out the FDT parts of the GICv2 interrupt controller driver. This will
  allow us to add an ACPI attachment for arm64.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D7307

Added:
  head/sys/arm/arm/gic.h   (contents, props changed)
  head/sys/arm/arm/gic_fdt.c
 - copied, changed from r303614, head/sys/arm/arm/gic.c
Modified:
  head/sys/arm/arm/gic.c
  head/sys/conf/files.arm
  head/sys/conf/files.arm64

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Mon Aug  1 16:26:08 2016(r303621)
+++ head/sys/arm/arm/gic.c  Mon Aug  1 16:29:04 2016(r303622)
@@ -62,17 +62,15 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
-#include 
 #include 
 
+#include 
+
 #ifdef INTRNG
 #include "pic_if.h"
 #include "msi_if.h"
 #endif
 
-#define GIC_DEBUG_SPURIOUS
-
 /* We are using GICv2 register naming */
 
 /* Distributor Registers */
@@ -102,12 +100,6 @@ __FBSDID("$FreeBSD$");
 #define GICC_ABPR  0x001C  /* v1 ICCABPR */
 #define GICC_IIDR  0x00FC  /* v1 ICCIIDR*/
 
-#defineGIC_FIRST_SGI0  /* Irqs 0-15 are SGIs/IPIs. */
-#defineGIC_LAST_SGI15
-#defineGIC_FIRST_PPI   16  /* Irqs 16-31 are private (per 
*/
-#defineGIC_LAST_PPI31  /* core) peripheral interrupts. 
*/
-#defineGIC_FIRST_SPI   32  /* Irqs 32+ are shared 
peripherals. */
-
 /* TYPER Registers */
 #defineGICD_TYPER_SECURITYEXT  0x400
 #defineGIC_SUPPORT_SECEXT(_sc) \
@@ -141,58 +133,26 @@ struct gic_irqsrc {
 };
 
 static u_int gic_irq_cpu;
-static int arm_gic_intr(void *);
 static int arm_gic_bind_intr(device_t dev, struct intr_irqsrc *isrc);
 
 #ifdef SMP
 static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
 static u_int sgi_first_unused = GIC_FIRST_SGI;
 #endif
-#endif
 
-#ifdef INTRNG
-struct arm_gic_range {
-   uint64_t bus;
-   uint64_t host;
-   uint64_t size;
-};
-
-struct arm_gic_devinfo {
-   struct ofw_bus_devinfo  obdinfo;
-   struct resource_listrl;
-};
-#endif
-
-struct arm_gic_softc {
-   device_tgic_dev;
-#ifdef INTRNG
-   void *  gic_intrhand;
-   struct gic_irqsrc * gic_irqs;
-#endif
-   struct resource *   gic_res[3];
-   bus_space_tag_t gic_c_bst;
-   bus_space_tag_t gic_d_bst;
-   bus_space_handle_t  gic_c_bsh;
-   bus_space_handle_t  gic_d_bsh;
-   uint8_t ver;
-   struct mtx  mutex;
-   uint32_tnirqs;
-   uint32_ttyper;
-#ifdef GIC_DEBUG_SPURIOUS
-   uint32_tlast_irq[MAXCPU];
-#endif
-
-#ifdef INTRNG
-   /* FDT child data */
-   pcell_t addr_cells;
-   pcell_t size_cells;
-   int nranges;
-   struct arm_gic_range *  ranges;
-#endif
-};
-
-#ifdef INTRNG
 #define GIC_INTR_ISRC(sc, irq) (>gic_irqs[irq].gi_isrc)
+#else /* !INTRNG */
+static struct ofw_compat_data compat_data[] = {
+   {"arm,gic", true},  /* Non-standard, used in FreeBSD dts. */
+   {"arm,gic-400", true},
+   {"arm,cortex-a15-gic",  true},
+   {"arm,cortex-a9-gic",   true},
+   {"arm,cortex-a7-gic",   true},
+   {"arm,arm11mp-gic", true},
+   {"brcm,brahma-b15-gic", true},
+   {"qcom,msm-qgic2",  true},
+   {NULL,  false}
+};
 #endif
 
 static struct resource_spec arm_gic_spec[] = {
@@ -225,31 +185,6 @@ static int gic_config_irq(int irq, enum 
 static void gic_post_filter(void *);
 #endif
 
-static struct ofw_compat_data compat_data[] = {
-   {"arm,gic", true},  /* Non-standard, used in FreeBSD dts. */
-   {"arm,gic-400", true},
-   {"arm,cortex-a15-gic",  true},
-   {"arm,cortex-a9-gic",   true},
-   {"arm,cortex-a7-gic",   true},
-   {"arm,arm11mp-gic", true},
-   {"brcm,brahma-b15-gic", true},
-   {"qcom,msm-qgic2",  true},
-   {NULL,  false}
-};
-
-static int
-arm_gic_probe(device_t dev)
-{
-
-   if (!ofw_bus_status_okay(dev))
-   return (ENXIO);
-
-   if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data)
-   return (ENXIO);
-   device_set_desc(dev, "ARM Generic Interrupt Controller");
-   return (BUS_PROBE_DEFAULT);
-}
-
 #ifdef INTRNG
 static inline void
 gic_irq_unmask(struct arm_gic_softc *sc, u_int irq)
@@ -427,16 +362,6 @@ gic_decode_fdt(phandle_t iparent, pcell_
 #endif
 
 #ifdef INTRNG
-static inline intptr_t

svn commit: r303621 - head/sys/dev/cfe

2016-08-01 Thread Landon J. Fuller
Author: landonf
Date: Mon Aug  1 16:26:08 2016
New Revision: 303621
URL: https://svnweb.freebsd.org/changeset/base/303621

Log:
  Sync CFE interface with upstream cfe-1.4.2 release.
  
  Approved by:  adrian (mentor)
  Obtained from:
https://www.broadcom.com/support/communications-processors
  Differential Revision:https://reviews.freebsd.org/D7375

Modified:
  head/sys/dev/cfe/cfe_api.c
  head/sys/dev/cfe/cfe_api.h
  head/sys/dev/cfe/cfe_api_int.h
  head/sys/dev/cfe/cfe_error.h
  head/sys/dev/cfe/cfe_ioctl.h

Modified: head/sys/dev/cfe/cfe_api.c
==
--- head/sys/dev/cfe/cfe_api.c  Mon Aug  1 16:24:46 2016(r303620)
+++ head/sys/dev/cfe/cfe_api.c  Mon Aug  1 16:26:08 2016(r303621)
@@ -1,5 +1,4 @@
-/* $NetBSD: cfe_api.c,v 1.5 2005/12/11 12:18:07 christos Exp $ */
-/* from: SiByte Id: cfe_api.c,v 1.16 2002/07/09 23:29:11 cgd Exp $ */
+/* from: Broadcom Id: cfe_api.c,v 1.18 2006/08/24 02:13:56 binh Exp $ */
 
 /*-
  * Copyright 2000, 2001, 2002
@@ -177,6 +176,27 @@ cfe_enumenv(int idx, char *name, int nam
 }
 #endif /* CFE_API_enumenv || CFE_API_ALL */
 
+#if defined(CFE_API_enumdev) || defined(CFE_API_ALL)
+int
+cfe_enumdev(int idx, char *name, int namelen)
+{
+cfe_xiocb_t xiocb;
+
+xiocb.xiocb_fcode = CFE_CMD_DEV_ENUM;
+xiocb.xiocb_status = 0;
+xiocb.xiocb_handle = 0;
+xiocb.xiocb_flags = 0;
+xiocb.xiocb_psize = sizeof(xiocb_envbuf_t);
+xiocb.plist.xiocb_envbuf.enum_idx = idx;
+xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name);
+xiocb.plist.xiocb_envbuf.name_length = namelen;
+
+cfe_iocb_dispatch();
+
+return xiocb.xiocb_status;
+}
+#endif /* CFE_API_enumdev || CFE_API_ALL */
+
 #if defined(CFE_API_enummem) || defined(CFE_API_ALL)
 int
 cfe_enummem(int idx, int flags, cfe_xuint_t *start, cfe_xuint_t *length,

Modified: head/sys/dev/cfe/cfe_api.h
==
--- head/sys/dev/cfe/cfe_api.h  Mon Aug  1 16:24:46 2016(r303620)
+++ head/sys/dev/cfe/cfe_api.h  Mon Aug  1 16:26:08 2016(r303621)
@@ -1,5 +1,4 @@
-/* $NetBSD: cfe_api.h,v 1.3 2003/02/07 17:38:48 cgd Exp $ */
-/* from: SiByte Id: cfe_api.h,v 1.29 2002/07/09 23:29:11 cgd Exp $ */
+/* from: Broadcom Id: cfe_api.h,v 1.31 2006/08/24 02:13:56 binh Exp $ */
 
 /*-
  * Copyright 2000, 2001, 2002
@@ -154,6 +153,7 @@ int64_t cfe_getticks(void);
 #define cfe_cpu_start(a,b,c,d,e)   __cfe_cpu_start(a,b,c,d,e)
 #define cfe_cpu_stop(a)__cfe_cpu_stop(a)
 #define cfe_enumenv(a,b,d,e,f) __cfe_enumenv(a,b,d,e,f)
+#define cfe_enumdev(a,b,c) __cfe_enumdev(a,b,c)
 #define cfe_enummem(a,b,c,d,e) __cfe_enummem(a,b,c,d,e)
 #define cfe_exit(a,b)  __cfe_exit(a,b)
 #define cfe_flushcache(a)  __cfe_cacheflush(a)
@@ -176,6 +176,7 @@ int cfe_close(int handle);
 int cfe_cpu_start(int cpu, void (*fn)(void), long sp, long gp, long a1);
 int cfe_cpu_stop(int cpu);
 int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen);
+int cfe_enumdev(int idx, char *name, int namelen);
 int cfe_enummem(int idx, int flags, uint64_t *start, uint64_t *length,
uint64_t *type);
 int cfe_exit(int warm,int status);

Modified: head/sys/dev/cfe/cfe_api_int.h
==
--- head/sys/dev/cfe/cfe_api_int.h  Mon Aug  1 16:24:46 2016
(r303620)
+++ head/sys/dev/cfe/cfe_api_int.h  Mon Aug  1 16:26:08 2016
(r303621)
@@ -1,5 +1,4 @@
-/* $NetBSD: cfe_api_int.h,v 1.2 2003/02/07 17:38:48 cgd Exp $ */
-/* from: SiByte Id: cfe_api_int.h,v 1.21 2002/07/09 23:29:11 cgd Exp $ */
+/* from: Broadcom Id: cfe_api_int.h,v 1.22 2003/02/07 17:27:56 cgd Exp $ */
 
 /*-
  * Copyright 2000, 2001, 2002

Modified: head/sys/dev/cfe/cfe_error.h
==
--- head/sys/dev/cfe/cfe_error.hMon Aug  1 16:24:46 2016
(r303620)
+++ head/sys/dev/cfe/cfe_error.hMon Aug  1 16:26:08 2016
(r303621)
@@ -1,5 +1,4 @@
-/* $NetBSD: cfe_error.h,v 1.2 2003/02/07 17:38:48 cgd Exp $ */
-/* from: SiByte Id: cfe_error.h,v 1.2 2002/07/09 19:37:52 cgd Exp $ */
+/* from: Broadcom Id: cfe_error.h,v 1.3 2003/02/07 17:27:56 cgd Exp $ */
 
 /*-
  * Copyright 2000, 2001, 2002

Modified: head/sys/dev/cfe/cfe_ioctl.h
==
--- head/sys/dev/cfe/cfe_ioctl.hMon Aug  1 16:24:46 2016
(r303620)
+++ head/sys/dev/cfe/cfe_ioctl.hMon Aug  1 16:26:08 2016
(r303621)
@@ -1,14 +1,13 @@
-/* $NetBSD: cfe_ioctl.h,v 1.2 2003/02/07 17:52:08 cgd Exp $ */
-
 /*-
- * Copyright 2000, 2001
+ * Copyright 2000, 2001, 2002, 2003
  * Broadcom Corporation. All rights reserved.
  *
- * This software is furnished under license and may be used and copied only

svn commit: r303620 - stable/11/share/man/man9

2016-08-01 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug  1 16:24:46 2016
New Revision: 303620
URL: https://svnweb.freebsd.org/changeset/base/303620

Log:
  MFC r303519
  
  Fix two return types in the cpuset(9) and bitset(9) man pages
  
  The *_FFS() and *_COUNT() functions return int, not size_t.
  
  Approved by:  re (gjb)
  Sponsored by: Dell Inc.

Modified:
  stable/11/share/man/man9/bitset.9
  stable/11/share/man/man9/cpuset.9
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man9/bitset.9
==
--- stable/11/share/man/man9/bitset.9   Mon Aug  1 16:18:01 2016
(r303619)
+++ stable/11/share/man/man9/bitset.9   Mon Aug  1 16:24:46 2016
(r303620)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 20, 2015
+.Dd August 1, 2016
 .Dt BITSET 9
 .Os
 .Sh NAME
@@ -77,9 +77,9 @@
 .Fn BIT_EMPTY "const SETSIZE" "struct STRUCTNAME *bitset"
 .Ft bool
 .Fn BIT_ISFULLSET "const SETSIZE" "struct STRUCTNAME *bitset"
-.Ft size_t
+.Ft int
 .Fn BIT_FFS "const SETSIZE" "struct STRUCTNAME *bitset"
-.Ft size_t
+.Ft int
 .Fn BIT_COUNT "const SETSIZE" "struct STRUCTNAME *bitset"
 .\"
 .Ft bool

Modified: stable/11/share/man/man9/cpuset.9
==
--- stable/11/share/man/man9/cpuset.9   Mon Aug  1 16:18:01 2016
(r303619)
+++ stable/11/share/man/man9/cpuset.9   Mon Aug  1 16:24:46 2016
(r303620)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 20, 2015
+.Dd August 1, 2016
 .Dt CPUSET 9
 .Os
 .Sh NAME
@@ -75,9 +75,9 @@
 .Fn CPU_EMPTY "cpuset_t *cpuset"
 .Ft bool
 .Fn CPU_ISFULLSET "cpuset_t *cpuset"
-.Ft size_t
+.Ft int
 .Fn CPU_FFS "cpuset_t *cpuset"
-.Ft size_t
+.Ft int
 .Fn CPU_COUNT "cpuset_t *cpuset"
 .\"
 .Ft bool
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303619 - stable/11/contrib/libcxxrt

2016-08-01 Thread Ed Maste
Author: emaste
Date: Mon Aug  1 16:18:01 2016
New Revision: 303619
URL: https://svnweb.freebsd.org/changeset/base/303619

Log:
  iMFC r303400: libcxxrt: fix demangling of wchar_t
  
  'wchar_t' is 7 characters long, not 6. r303297 (MFC'd in r303398) fixed
  this in libelftc, but not the second copy of this file that we have in
  libcxxrt.
  
  PR:   208661
  Approved by:  re (gjb)

Modified:
  stable/11/contrib/libcxxrt/libelftc_dem_gnu3.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/libcxxrt/libelftc_dem_gnu3.c
==
--- stable/11/contrib/libcxxrt/libelftc_dem_gnu3.c  Mon Aug  1 16:16:48 
2016(r303618)
+++ stable/11/contrib/libcxxrt/libelftc_dem_gnu3.c  Mon Aug  1 16:18:01 
2016(r303619)
@@ -2842,7 +2842,7 @@ again:
 
case 'w':
/* wchar_t */
-   if (!cpp_demangle_push_str(ddata, "wchar_t", 6))
+   if (!cpp_demangle_push_str(ddata, "wchar_t", 7))
goto clean;
++ddata->cur;
goto rtn;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303618 - stable/10/contrib/libcxxrt

2016-08-01 Thread Ed Maste
Author: emaste
Date: Mon Aug  1 16:16:48 2016
New Revision: 303618
URL: https://svnweb.freebsd.org/changeset/base/303618

Log:
  MFC r303400: libcxxrt: fix demangling of wchar_t
  
  'wchar_t' is 7 characters long, not 6. r303297 fixed this (in head) in
  libelftc, but not the second copy of this file that we have in libcxxrt.
  
  PR:   208661

Modified:
  stable/10/contrib/libcxxrt/libelftc_dem_gnu3.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/libcxxrt/libelftc_dem_gnu3.c
==
--- stable/10/contrib/libcxxrt/libelftc_dem_gnu3.c  Mon Aug  1 16:03:20 
2016(r303617)
+++ stable/10/contrib/libcxxrt/libelftc_dem_gnu3.c  Mon Aug  1 16:16:48 
2016(r303618)
@@ -2842,7 +2842,7 @@ again:
 
case 'w':
/* wchar_t */
-   if (!cpp_demangle_push_str(ddata, "wchar_t", 6))
+   if (!cpp_demangle_push_str(ddata, "wchar_t", 7))
goto clean;
++ddata->cur;
goto rtn;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Pedro Giffuni



On 08/01/16 01:08, Bruce Evans wrote:

On Sun, 31 Jul 2016, Xin Li wrote:


On 7/31/16 14:36, Pedro F. Giffuni wrote:


Log:
  indent(1): replace function call to bzero with memset.

  Reference:

https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235


  Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
  Submitted by:Piotr Stefaniak

Modified:
  head/usr.bin/indent/io.c

Modified: head/usr.bin/indent/io.c
==

--- head/usr.bin/indent/io.cSun Jul 31 21:29:10 2016(r303599)
+++ head/usr.bin/indent/io.cSun Jul 31 21:36:40 2016(r303600)
@@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char *
 const char *s = s0;
 int sizedelta = 0;

-bzero(f, sizeof *f);
+memset(f, 0, sizeof(struct fstate));

   ^  This is much more error-prone
than sizeof(*f) IMHO.


I also prefer bzero().



bzero --> memset changes are done to ease portability ...

On another BSD such replacements were done for performance but then
they discovered it was their bzero that was broken.


Removal of the space after sizeof is another regression.  KNF disallows
the space, but indent's style is very far from KNF.  It isn't clear if
indent's style is to require the space, since old versions of indent
never used sizeof(typename), and 'sizeof object' requires the space.
Regressions started in r93440 with sizeof(object) in an nitems() expansion.


OK ... that was in 2002.
We are using nitems() now, which undoes the portability meant to be 
brought by memset. OTOH, using sys/param.h is implicit permission

to use nitems() and may involve other portability issues already.
Can't keep everybody happy.

Pedro.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303617 - stable/11/contrib/llvm/projects/libunwind/src

2016-08-01 Thread Ed Maste
Author: emaste
Date: Mon Aug  1 16:03:20 2016
New Revision: 303617
URL: https://svnweb.freebsd.org/changeset/base/303617

Log:
  MFC r303521: libunwind: correct return code in unwinding trace log message
  
  Approved by:  re (gjb)

Modified:
  stable/11/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp
==
--- stable/11/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp  Mon Aug 
 1 15:49:50 2016(r303616)
+++ stable/11/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp  Mon Aug 
 1 16:03:20 2016(r303617)
@@ -572,7 +572,7 @@ static _Unwind_Reason_Code unwind_phase2
 unw_get_reg(cursor, UNW_REG_SP, );
 if (unw_get_proc_info(cursor, ) != UNW_ESUCCESS) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info "
- "failed => _URC_FATAL_PHASE1_ERROR\n",
+ "failed => _URC_FATAL_PHASE2_ERROR\n",
  static_cast(exception_object));
   return _URC_FATAL_PHASE2_ERROR;
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Pedro Giffuni



On 08/01/16 10:24, Piotr Stefaniak wrote:

On 2016-08-01 08:08, Bruce Evans wrote:

On Sun, 31 Jul 2016, Xin Li wrote:


On 7/31/16 14:36, Pedro F. Giffuni wrote:



-bzero(f, sizeof *f);
+memset(f, 0, sizeof(struct fstate));

   ^  This is much more error-prone
than sizeof(*f) IMHO.


I also prefer bzero().


I hope this is merely a preference and not a hard rule, because I'm of
the opinion that the memset()-based equivalent of bzero() has fewer
portability consequences, which is worth paying attention to. Please
consider the fact that NetBSD has done this replacement.



It is a preference, not a hard rule.

In general, replacing bzero with memset is seen as a portability
enhancement but bzero is not going away from FreeBSD and replacing it
is not a priority.


I do agree that replacing the expression with the type name was a
regression; it was my mistake.


Removal of the space after sizeof is another regression.  KNF disallows
the space, but indent's style is very far from KNF.  It isn't clear if
indent's style is to require the space, since old versions of indent
never used sizeof(typename), and 'sizeof object' requires the space.


I was specifically asked in the D6966 differential review to adhere to
style(9). I have changed both my own code submitted for review and the
rest of style violations of this kind as a separate patch
(https://github.com/pstef/freebsd_indent/commit/a2befd74fa54c91d96a38317e90d38ef17682f4b).
I had expected the style fixes to get committed before the change in
r303600, in belief that doing so would render possible complaints as the
one quoted above as not relevant anymore.



The idea is that new code should try to adhere to style(9) but it is
not an obligation to do so if the codebase already uses a different
style.


Regressions started in r93440 with sizeof(object) in an nitems() expansion.
The style of this is very different from an nitems() expansion in r1590.
There was 1 more sizeof(object) and 1 sizeof(int).  This is the first
sizeof(typename) where 'sizeof object' cannot be used for technical
reasons.

KNF also requires parentheses for sizeof(object).  Then the space is
unnecessary and disallowed.


On a more general note, I imagined we're heading towards slowly changing
indent(1)'s code to make it more style(9)-compliant (not least because
it's tempting to imagine indent(1) being able to re-indent itself in
accordance with style(9) at some point) but right now I'm confused as to
what style decisions in the patches I submit are expected of me.



You are doing a great job!

In the case of indent, while it would be desirable to move it all to 
KNF, that involves way too many cosmetic changes that have no use.


Reviewers can get things wrong, and in general it is up to the
committer, IMO, style cleanups are generally very low priority.
It is preferable to have smaller to-the-point changes than style
issues mixed with effective code changes.

Going out of your way to clean indent style --> KNF is a waste of time.
IMHO, of course.

Pedro.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303616 - stable/11/sys/modules

2016-08-01 Thread Ed Maste
Author: emaste
Date: Mon Aug  1 15:49:50 2016
New Revision: 303616
URL: https://svnweb.freebsd.org/changeset/base/303616

Log:
  MFC r303282: avoid building otusfw when WITHOUT_SOURCELESS_UCODE set
  
  PR:   204748
  Approved by:  re (kib)

Modified:
  stable/11/sys/modules/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/modules/Makefile
==
--- stable/11/sys/modules/Makefile  Mon Aug  1 13:38:48 2016
(r303615)
+++ stable/11/sys/modules/Makefile  Mon Aug  1 15:49:50 2016
(r303616)
@@ -278,7 +278,7 @@ SUBDIR= \
${_nxge} \
oce \
otus \
-   otusfw \
+   ${_otusfw} \
ow \
${_padlock} \
${_padlock_rng} \
@@ -493,6 +493,7 @@ _fatm=  fatm
 _fxp=  fxp
 _ispfw=ispfw
 _mwlfw=mwlfw
+_otusfw=   otusfw
 _ralfw=ralfw
 _rtwnfw=   rtwnfw
 _urtwnfw=  urtwnfw
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303574 - head/sys/dev/gpio

2016-08-01 Thread Bruce Simpson

On 31/07/16 07:24, Adrian Chadd wrote:

  [gpioled] add support for inverting the LED polarity.
  No, this isn't a star trek science joke - sometimes LEDs are wired
  up to be active low, so this is needed.


Actually, just about every bit of hardware I have interacted with on 
that level recently lights on low.

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303522 - head/sys/dev/cxgbe

2016-08-01 Thread Bruce Simpson

"Yes, I know it's not a typewriter. Why is this command not working?"

Perhaps this errno code should be aliased... and strerror() massaged in 
places... assuming we strictly follow the POSIX.

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Pedro Giffuni



On 08/01/16 00:28, Xin Li wrote:



On 7/31/16 14:36, Pedro F. Giffuni wrote:

Author: pfg
Date: Sun Jul 31 21:36:40 2016
New Revision: 303600
URL: https://svnweb.freebsd.org/changeset/base/303600

Log:
  indent(1): replace function call to bzero with memset.

  Reference:
  
https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235

  Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
  Submitted by: Piotr Stefaniak

Modified:
  head/usr.bin/indent/io.c

Modified: head/usr.bin/indent/io.c
==
--- head/usr.bin/indent/io.cSun Jul 31 21:29:10 2016(r303599)
+++ head/usr.bin/indent/io.cSun Jul 31 21:36:40 2016(r303600)
@@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char *
 const char *s = s0;
 int sizedelta = 0;

-bzero(f, sizeof *f);
+memset(f, 0, sizeof(struct fstate));

^  This is much more error-prone
than sizeof(*f) IMHO.

Cheers,


Does this look better?

Cheers,

Pedro.
Index: usr.bin/indent/io.c
===
--- usr.bin/indent/io.c	(revision 303615)
+++ usr.bin/indent/io.c	(working copy)
@@ -629,7 +629,7 @@
 const char *s = s0;
 int sizedelta = 0;
 
-memset(f, 0, sizeof(struct fstate));
+memset(f, '\0', sizeof(*f));
 while (*s) {
 	if (isdigit(*s))
 	f->size = f->size * 10 + *s - '0';
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Piotr Stefaniak
On 2016-08-01 08:08, Bruce Evans wrote:
> On Sun, 31 Jul 2016, Xin Li wrote:
>
>> On 7/31/16 14:36, Pedro F. Giffuni wrote:

>>> -bzero(f, sizeof *f);
>>> +memset(f, 0, sizeof(struct fstate));
>>^  This is much more error-prone
>> than sizeof(*f) IMHO.
>
> I also prefer bzero().

I hope this is merely a preference and not a hard rule, because I'm of 
the opinion that the memset()-based equivalent of bzero() has fewer 
portability consequences, which is worth paying attention to. Please 
consider the fact that NetBSD has done this replacement.

I do agree that replacing the expression with the type name was a 
regression; it was my mistake.

> Removal of the space after sizeof is another regression.  KNF disallows
> the space, but indent's style is very far from KNF.  It isn't clear if
> indent's style is to require the space, since old versions of indent
> never used sizeof(typename), and 'sizeof object' requires the space.

I was specifically asked in the D6966 differential review to adhere to 
style(9). I have changed both my own code submitted for review and the 
rest of style violations of this kind as a separate patch 
(https://github.com/pstef/freebsd_indent/commit/a2befd74fa54c91d96a38317e90d38ef17682f4b).
 
I had expected the style fixes to get committed before the change in 
r303600, in belief that doing so would render possible complaints as the 
one quoted above as not relevant anymore.

> Regressions started in r93440 with sizeof(object) in an nitems() expansion.
> The style of this is very different from an nitems() expansion in r1590.
> There was 1 more sizeof(object) and 1 sizeof(int).  This is the first
> sizeof(typename) where 'sizeof object' cannot be used for technical
> reasons.
>
> KNF also requires parentheses for sizeof(object).  Then the space is
> unnecessary and disallowed.

On a more general note, I imagined we're heading towards slowly changing 
indent(1)'s code to make it more style(9)-compliant (not least because 
it's tempting to imagine indent(1) being able to re-indent itself in 
accordance with style(9) at some point) but right now I'm confused as to 
what style decisions in the patches I submit are expected of me.

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303615 - head/sbin/ipfw

2016-08-01 Thread Andrey V. Elsukov
Author: ae
Date: Mon Aug  1 13:38:48 2016
New Revision: 303615
URL: https://svnweb.freebsd.org/changeset/base/303615

Log:
  An old tables implementation had all tables preallocated,
  so when user did `ipfw table N flush` it always worked, but now
  when table N doesn't exist the kernel returns ESRCH error.
  This isn't fatal error for flush and destroy commands. Do not
  call err(3) when errno is equal to ESRCH. Also warn only when
  quiet mode isn't enabled. This fixes a regression in behavior,
  when old rules are loaded from file.
  Also use correct value for switch in the table_swap().
  
  Reported by:  Kevin Oberman
  MFC after:3 days

Modified:
  head/sbin/ipfw/tables.c

Modified: head/sbin/ipfw/tables.c
==
--- head/sbin/ipfw/tables.c Mon Aug  1 12:17:44 2016(r303614)
+++ head/sbin/ipfw/tables.c Mon Aug  1 13:38:48 2016(r303615)
@@ -225,18 +225,30 @@ ipfw_table_handler(int ac, char *av[])
table_modify(, ac, av);
break;
case TOK_DESTROY:
-   if (table_destroy() != 0)
+   if (table_destroy() == 0)
+   break;
+   if (errno != ESRCH)
err(EX_OSERR, "failed to destroy table %s", tablename);
+   /* ESRCH isn't fatal, warn if not quiet mode */
+   if (co.do_quiet == 0)
+   warn("failed to destroy table %s", tablename);
break;
case TOK_FLUSH:
if (is_all == 0) {
-   if ((error = table_flush()) != 0)
+   if ((error = table_flush()) == 0)
+   break;
+   if (errno != ESRCH)
err(EX_OSERR, "failed to flush table %s info",
tablename);
+   /* ESRCH isn't fatal, warn if not quiet mode */
+   if (co.do_quiet == 0)
+   warn("failed to flush table %s info",
+   tablename);
} else {
error = tables_foreach(table_flush_one, , 1);
if (error != 0)
err(EX_OSERR, "failed to flush tables list");
+   /* XXX: we ignore errors here */
}
break;
case TOK_SWAP:
@@ -593,14 +605,14 @@ table_do_swap(ipfw_obj_header *oh, char 
 static int
 table_swap(ipfw_obj_header *oh, char *second)
 {
-   int error;
 
if (table_check_name(second) != 0)
errx(EX_USAGE, "table name %s is invalid", second);
 
-   error = table_do_swap(oh, second);
+   if (table_do_swap(oh, second) == 0)
+   return (0);
 
-   switch (error) {
+   switch (errno) {
case EINVAL:
errx(EX_USAGE, "Unable to swap table: check types");
case EFBIG:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303614 - in head/sys/arm64: arm64 include

2016-08-01 Thread Andrew Turner
Author: andrew
Date: Mon Aug  1 12:17:44 2016
New Revision: 303614
URL: https://svnweb.freebsd.org/changeset/base/303614

Log:
  Add a kernel variable to let the user to select their preferred order
  between ACPI and FDT. This will be needed on machines with both, e.g. the
  SoftIron Overdrive 3000. The kernel will accept one or more comma separated
  values of either 'acpi' or 'fdt'. Any other values are skipped.
  
  To set it the user can either set it on the loader command line, or
  in loader.conf e.g. in loader.conf:
  kern.cfg.order=acpi,fdt
  
  This will try using ACPI then FDT. If none of the selected options work the
  kernel tries to use one to get the serial console, then panics.
  
  Reviewed by:  emaste (earlier version)
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D7274

Modified:
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/arm64/mp_machdep.c
  head/sys/arm64/arm64/nexus.c
  head/sys/arm64/include/machdep.h

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Mon Aug  1 12:14:21 2016
(r303613)
+++ head/sys/arm64/arm64/machdep.c  Mon Aug  1 12:17:44 2016
(r303614)
@@ -25,6 +25,7 @@
  *
  */
 
+#include "opt_acpi.h"
 #include "opt_platform.h"
 #include "opt_ddb.h"
 
@@ -82,11 +83,19 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+#ifdef DEV_ACPI
+#include 
+#include 
+#endif
+
 #ifdef FDT
 #include 
 #include 
 #endif
 
+
+enum arm64_bus arm64_bus_method = ARM64_BUS_NONE;
+
 struct pcpu __pcpu[MAXCPU];
 
 static struct trapframe proc0_tf;
@@ -802,6 +811,61 @@ try_load_dtb(caddr_t kmdp)
 }
 #endif
 
+static bool
+bus_probe(void)
+{
+   bool has_acpi, has_fdt;
+   char *order, *env;
+
+   has_acpi = has_fdt = false;
+
+#ifdef FDT
+   has_fdt = (OF_peer(0) != 0);
+#endif
+#ifdef DEV_ACPI
+   has_acpi = (acpi_find_table(ACPI_SIG_SPCR) != 0);
+#endif
+
+   env = kern_getenv("kern.cfg.order");
+   if (env != NULL) {
+   order = env;
+   while (order != NULL) {
+   if (has_acpi &&
+   strncmp(order, "acpi", 4) == 0 &&
+   (order[4] == ',' || order[4] == '\0')) {
+   arm64_bus_method = ARM64_BUS_ACPI;
+   break;
+   }
+   if (has_fdt &&
+   strncmp(order, "fdt", 3) == 0 &&
+   (order[3] == ',' || order[3] == '\0')) {
+   arm64_bus_method = ARM64_BUS_FDT;
+   break;
+   }
+   order = strchr(order, ',');
+   }
+   freeenv(env);
+
+   /* If we set the bus method it is valid */
+   if (arm64_bus_method != ARM64_BUS_NONE)
+   return (true);
+   }
+   /* If no order or an invalid order was set use the default */
+   if (arm64_bus_method == ARM64_BUS_NONE) {
+   if (has_fdt)
+   arm64_bus_method = ARM64_BUS_FDT;
+   else if (has_acpi)
+   arm64_bus_method = ARM64_BUS_ACPI;
+   }
+
+   /*
+* If no option was set the default is valid, otherwise we are
+* setting one to get cninit() working, then calling panic to tell
+* the user about the invalid bus setup.
+*/
+   return (env == NULL);
+}
+
 static void
 cache_setup(void)
 {
@@ -849,6 +913,7 @@ initarm(struct arm64_bootparams *abp)
vm_offset_t lastaddr;
caddr_t kmdp;
vm_paddr_t mem_len;
+   bool valid;
int i;
 
/* Set the module data location */
@@ -921,8 +986,14 @@ initarm(struct arm64_bootparams *abp)
 
devmap_bootstrap(0, NULL);
 
+   valid = bus_probe();
+
cninit();
 
+   if (!valid)
+   panic("Invalid bus configuration: %s",
+   kern_getenv("kern.cfg.order"));
+
init_proc0(abp->kern_stack);
msgbufinit(msgbufp, msgbufsize);
mutex_init();

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Mon Aug  1 12:14:21 2016
(r303613)
+++ head/sys/arm64/arm64/mp_machdep.c   Mon Aug  1 12:17:44 2016
(r303614)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #ifdef VFP
@@ -90,13 +91,6 @@ boolean_t ofw_cpu_reg(phandle_t node, u_
 
 extern struct pcpu __pcpu[];
 
-static enum {
-   CPUS_UNKNOWN,
-#ifdef FDT
-   CPUS_FDT,
-#endif
-} cpu_enum_method;
-
 static device_identify_t arm64_cpu_identify;
 static device_probe_t arm64_cpu_probe;
 static device_attach_t arm64_cpu_attach;
@@ 

svn commit: r303613 - head/share/man/man4

2016-08-01 Thread Julian Elischer
Author: julian
Date: Mon Aug  1 12:14:21 2016
New Revision: 303613
URL: https://svnweb.freebsd.org/changeset/base/303613

Log:
  Man page for the new checksum netgraph module.
  
  PR:   206186
  Submitted by: Dmitry Vagin 
  MFC after: 1 month

Added:
  head/share/man/man4/ng_checksum.4   (contents, props changed)

Added: head/share/man/man4/ng_checksum.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/ng_checksum.4   Mon Aug  1 12:14:21 2016
(r303613)
@@ -0,0 +1,141 @@
+.\" Copyright (c) 2015 Dmitry Vagin 
+.\" 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$
+.\"
+.Dd October 29, 2015
+.Dt NG_CHECKSUM 4
+.Os
+.Sh NAME
+.Nm ng_checksum
+.Nd IP checksum node type
+.Sh SYNOPSIS
+.In netgraph/ng_checksum.h
+.Sh DESCRIPTION
+The
+.Nm checksum
+node can calculate and prepare for calculation in hardware
+IPv4 header, TCP, UDP checksum.
+.Sh HOOKS
+This node type has two hooks:
+.Bl -tag -width ".Va out"
+.It Va in
+Packets received on this hook are processed according to settings specified
+in config and then forwarded to
+.Ar out
+hook, if it exists and connected. Otherwise they are reflected back to the
+.Ar in
+hook.
+.It Va out
+Packets received on this hook are forwarded to
+.Ar in
+hook without any changes.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_CHECKSUM_SETDLT Pq Ic setdlt
+Sets data link type on the
+.Va in
+hook. Currently, supported types are
+.Cm DLT_RAW
+(raw IP datagrams) and
+.Cm DLT_EN10MB
+(Ethernet). DLT_ definitions can be found in
+.In net/bpf.h
+header. Currently used values are
+.Cm DLT_EN10MB
+= 1 and
+.Cm DLT_RAW
+= 12.
+.It Dv NGM_CHECKSUM_GETDLT Pq Ic getdlt
+This control message obtains data link type on the
+.Va in
+hook.
+.It Dv NGM_CHECKSUM_SETCONFIG Pq Ic setconfig
+Sets node configuration. The following
+.Vt "struct ng_checksum_config"
+must be supplied as an argument:
+.Bd -literal -offset 4n
+struct ng_checksum_config {
+   uint64_tcsum_flags;
+   uint64_tcsum_offload;
+};
+.Ed
+.Pp
+The
+.Va csum_flags
+can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 
and CSUM_UDP_IPV6
+(other values are ignored) for instructing node need calculate the 
corresponding checksum.
+.Pp
+The
+.Va csum_offload
+can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 
and CSUM_UDP_IPV6
+(other values are ignored) for instructing node what checksum can calculate in 
hardware.
+.Pp
+Also processed any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 
and CSUM_UDP_IPV6 sets before on mbuf.
+.It Dv NGM_CHECKSUM_GETCONFIG Pq Ic getconfig
+This control message obtains current node configuration,
+returned as
+.Vt "struct ng_checksum_config" .
+.It Dv NGM_CHECKSUM_GET_STATS Pq Ic getstats
+Returns node statistics as a
+.Vt "struct ng_checksum_stats" .
+.It Dv NGM_CHECKSUM_CLR_STATS Pq Ic clrstats
+Clear node statistics.
+.It Dv NGM_CHECKSUM_GETCLR_STATS Pq Ic getclrstats
+This command is identical to
+.Dv NGM_CHECKSUM_GET_STATS ,
+except that the statistics are also atomically cleared.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh EXAMPLES
+.Xr ngctl 8
+script:
+.Bd -literal -offset 4n
+/usr/sbin/ngctl -f- <<-SEQ
+   msg checksum-1: "setdlt 1"
+   ngctl msg checksum-1: "setconfig { csum_flags=0 csum_offload=6 }"
+.Ed
+.Pp
+Set data link type to
+.Cm 

svn commit: r303612 - in head/sys: modules/netgraph/checksum netgraph

2016-08-01 Thread Julian Elischer
Author: julian
Date: Mon Aug  1 12:09:04 2016
New Revision: 303612
URL: https://svnweb.freebsd.org/changeset/base/303612

Log:
  netgraph module for reconstructing checksums
  
  PR:   206108
  Submitted by: Dmitry Vagin  daemon.ham...@ya.ru
  MFC after:1 month

Added:
  head/sys/modules/netgraph/checksum/
  head/sys/modules/netgraph/checksum/Makefile   (contents, props changed)
  head/sys/netgraph/ng_checksum.c   (contents, props changed)
  head/sys/netgraph/ng_checksum.h   (contents, props changed)

Added: head/sys/modules/netgraph/checksum/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/netgraph/checksum/Makefile Mon Aug  1 12:09:04 2016
(r303612)
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+.include 
+
+KMOD=  ng_checksum
+SRCS=  ng_checksum.c opt_inet.h opt_inet6.h
+
+#.if !defined(KERNBUILDDIR)
+#
+#.if ${MK_INET_SUPPORT} != "no"
+#opt_inet.h:
+#  echo "#define INET 1" > ${.TARGET}
+#.endif
+#.if ${MK_INET6_SUPPORT} != "no"
+#opt_inet6.h:
+#  echo "#define INET6 1" > ${.TARGET}
+#.endif
+#.endif
+
+.include 

Added: head/sys/netgraph/ng_checksum.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/netgraph/ng_checksum.c Mon Aug  1 12:09:04 2016
(r303612)
@@ -0,0 +1,729 @@
+/*-
+ * Copyright (c) 2015 Dmitry Vagin 
+ * 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$");
+
+#include "opt_inet.h"
+#include "opt_inet6.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+/* private data */
+struct ng_checksum_priv {
+   hook_p in;
+   hook_p out;
+   uint8_t dlt;/* DLT_XXX from bpf.h */
+   struct ng_checksum_config *conf;
+   struct ng_checksum_stats stats;
+};
+
+typedef struct ng_checksum_priv *priv_p;
+
+/* Netgraph methods */
+static ng_constructor_tng_checksum_constructor;
+static ng_rcvmsg_t ng_checksum_rcvmsg;
+static ng_shutdown_t   ng_checksum_shutdown;
+static ng_newhook_tng_checksum_newhook;
+static ng_rcvdata_tng_checksum_rcvdata;
+static ng_disconnect_t ng_checksum_disconnect;
+
+#define ERROUT(x) { error = (x); goto done; }
+
+static const struct ng_parse_struct_field ng_checksum_config_type_fields[]
+   = NG_CHECKSUM_CONFIG_TYPE;
+static const struct ng_parse_type ng_checksum_config_type = {
+   _parse_struct_type,
+   _checksum_config_type_fields
+};
+
+static const struct ng_parse_struct_field ng_checksum_stats_fields[]
+   = NG_CHECKSUM_STATS_TYPE;
+static const struct ng_parse_type ng_checksum_stats_type = {
+   _parse_struct_type,
+   _checksum_stats_fields
+};
+
+static const struct ng_cmdlist ng_checksum_cmdlist[] = {
+   {
+   NGM_CHECKSUM_COOKIE,
+   NGM_CHECKSUM_GETDLT,
+   "getdlt",
+   NULL,
+   _parse_uint8_type
+   },
+   {
+   NGM_CHECKSUM_COOKIE,
+   NGM_CHECKSUM_SETDLT,
+   "setdlt",
+   _parse_uint8_type,
+   NULL
+   },
+   {
+   NGM_CHECKSUM_COOKIE,
+   NGM_CHECKSUM_GETCONFIG,
+   "getconfig",
+   NULL,
+   _checksum_config_type
+   },
+   {
+   NGM_CHECKSUM_COOKIE,
+   NGM_CHECKSUM_SETCONFIG,
+   

svn commit: r303611 - head/sys/netgraph

2016-08-01 Thread Julian Elischer
Author: julian
Date: Mon Aug  1 11:34:12 2016
New Revision: 303611
URL: https://svnweb.freebsd.org/changeset/base/303611

Log:
  slite style changes. There is an incoming patch that rewrites a
  lot of this module and I want to get the style and whitespace changes in
  a separate commit (or maybe more).
  
  PR: 206185
  Submitted by: Dmitry Vagin
  MFC after:1 month

Modified:
  head/sys/netgraph/ng_patch.c
  head/sys/netgraph/ng_patch.h

Modified: head/sys/netgraph/ng_patch.c
==
--- head/sys/netgraph/ng_patch.cMon Aug  1 10:36:58 2016
(r303610)
+++ head/sys/netgraph/ng_patch.cMon Aug  1 11:34:12 2016
(r303611)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2010 by Maxim Ignatenko 
+ * Copyright (c) 2010  Maxim Ignatenko 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -50,11 +50,12 @@ static int
 ng_patch_config_getlen(const struct ng_parse_type *type,
 const u_char *start, const u_char *buf)
 {
-   const struct ng_patch_config *p;
+   const struct ng_patch_config *conf;
 
-   p = (const struct ng_patch_config *)(buf -
+   conf = (const struct ng_patch_config *)(buf -
offsetof(struct ng_patch_config, ops));
-   return (p->count);
+
+   return (conf->count);
 }
 
 static const struct ng_parse_struct_field ng_patch_op_type_fields[]
@@ -64,13 +65,13 @@ static const struct ng_parse_type ng_pat
_patch_op_type_fields
 };
 
-static const struct ng_parse_array_info ng_patch_confarr_info = {
+static const struct ng_parse_array_info ng_patch_ops_array_info = {
_patch_op_type,
_patch_config_getlen
 };
-static const struct ng_parse_type ng_patch_confarr_type = {
+static const struct ng_parse_type ng_patch_ops_array_type = {
_parse_array_type,
-   _patch_confarr_info
+   _patch_ops_array_info
 };
 
 static const struct ng_parse_struct_field ng_patch_config_type_fields[]
@@ -137,6 +138,7 @@ static struct ng_type typestruct = {
.disconnect =   ng_patch_disconnect,
.cmdlist =  ng_patch_cmdlist,
 };
+
 NETGRAPH_INIT(patch, );
 
 union patch_val {
@@ -146,6 +148,7 @@ union patch_val {
uint64_tv8;
 };
 
+/* private data */
 struct ng_patch_priv {
hook_p  in;
hook_p  out;

Modified: head/sys/netgraph/ng_patch.h
==
--- head/sys/netgraph/ng_patch.hMon Aug  1 10:36:58 2016
(r303610)
+++ head/sys/netgraph/ng_patch.hMon Aug  1 11:34:12 2016
(r303611)
@@ -57,7 +57,7 @@ enum {
NG_PATCH_MODE_DIV = 5,
NG_PATCH_MODE_NEG = 6,
NG_PATCH_MODE_AND = 7,
-   NG_PATCH_MODE_OR = 8,
+   NG_PATCH_MODE_OR  = 8,
NG_PATCH_MODE_XOR = 9,
NG_PATCH_MODE_SHL = 10,
NG_PATCH_MODE_SHR = 11
@@ -66,16 +66,16 @@ enum {
 struct ng_patch_op {
uint64_tvalue;
uint32_toffset;
-   uint16_tlength; /* 1,2,4 or 8 (bytes) */
+   uint16_tlength; /* 1, 2, 4 or 8 (bytes) */
uint16_tmode;
 };
 
-#defineNG_PATCH_OP_TYPE_INFO   {   \
-   { "value",  _parse_uint64_type   },  \
-   { "offset", _parse_uint32_type   },  \
-   { "length", _parse_uint16_type   },  \
-   { "mode",   _parse_uint16_type   },  \
-   { NULL } \
+#defineNG_PATCH_OP_TYPE_INFO { \
+   { "value",  _parse_uint64_type   },  \
+   { "offset", _parse_uint32_type   },  \
+   { "length", _parse_uint16_type   },  \
+   { "mode",   _parse_uint16_type   },  \
+   { NULL }\
 }
 
 struct ng_patch_config {
@@ -84,11 +84,11 @@ struct ng_patch_config {
struct ng_patch_op ops[];
 };
 
-#defineNG_PATCH_CONFIG_TYPE_INFO   {   \
-   { "count",  _parse_uint32_type   },  \
-   { "csum_flags", _parse_uint32_type   },  \
-   { "ops",_patch_confarr_type  },  \
-   { NULL } \
+#defineNG_PATCH_CONFIG_TYPE_INFO { 
\
+   { "count",  _parse_uint32_type   },  \
+   { "csum_flags", _parse_uint64_type   },  \
+   { "ops",_patch_ops_array_type},  
\
+   { NULL }\
 }
 
 struct ng_patch_stats {
@@ -97,11 +97,11 @@ struct ng_patch_stats {
uint64_tdropped;
 };
 
-#defineNG_PATCH_STATS_TYPE_INFO {  \
-   { "received",   _parse_uint64_type   },  \
-   { "patched",_parse_uint64_type   },  \
-   

svn commit: r303610 - head/sys/arm64/include

2016-08-01 Thread Andrew Turner
Author: andrew
Date: Mon Aug  1 10:36:58 2016
New Revision: 303610
URL: https://svnweb.freebsd.org/changeset/base/303610

Log:
  Add the fields for the PAR_EL1 register. This is used when performing an
  address lookup with the AT instructions.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/include/armreg.h

Modified: head/sys/arm64/include/armreg.h
==
--- head/sys/arm64/include/armreg.h Mon Aug  1 06:59:35 2016
(r303609)
+++ head/sys/arm64/include/armreg.h Mon Aug  1 10:36:58 2016
(r303610)
@@ -312,6 +312,27 @@
 #defineMAIR_ATTR_MASK(idx) (0xff << ((n)* 8))
 #defineMAIR_ATTR(attr, idx) ((attr) << ((idx) * 8))
 
+/* PAR_EL1 - Physical Address Register */
+#definePAR_F_SHIFT 0
+#definePAR_F   (0x1 << PAR_F_SHIFT)
+#definePAR_SUCCESS(x)  (((x) & PAR_F) == 0)
+/* When PAR_F == 0 (success) */
+#definePAR_SH_SHIFT7
+#definePAR_SH_MASK (0x3 << PAR_SH_SHIFT)
+#definePAR_NS_SHIFT9
+#definePAR_NS_MASK (0x3 << PAR_NS_SHIFT)
+#definePAR_PA_SHIFT12
+#definePAR_PA_MASK 0xf000
+#definePAR_ATTR_SHIFT  56
+#definePAR_ATTR_MASK   (0xff << PAR_ATTR_SHIFT)
+/* When PAR_F == 1 (aborted) */
+#definePAR_FST_SHIFT   1
+#definePAR_FST_MASK(0x3f << PAR_FST_SHIFT)
+#definePAR_PTW_SHIFT   8
+#definePAR_PTW_MASK(0x1 << PAR_PTW_SHIFT)
+#definePAR_S_SHIFT 9
+#definePAR_S_MASK  (0x1 << PAR_S_SHIFT)
+
 /* SCTLR_EL1 - System Control Register */
 #defineSCTLR_RES0  0xc8222400  /* Reserved, write 0 */
 #defineSCTLR_RES1  0x30d00800  /* Reserved, write 1 */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303609 - stable/10/sys/conf

2016-08-01 Thread Garrett Cooper
Author: ngie
Date: Mon Aug  1 06:59:35 2016
New Revision: 303609
URL: https://svnweb.freebsd.org/changeset/base/303609

Log:
  MFC r288071:
  
  - arm64 change was omitted due to lack of architecture support
  - ia64 change was added as the architecture was removed from ^/head
  
  Sponsored by: EMC / Isilon Storage Division
  
  r288071 (by emaste):
  
  Move kbd.c to main sys/conf/files list
  
  It is (optionally) used on all architectures.

Modified:
  stable/10/sys/conf/files
  stable/10/sys/conf/files.amd64
  stable/10/sys/conf/files.arm
  stable/10/sys/conf/files.i386
  stable/10/sys/conf/files.ia64
  stable/10/sys/conf/files.mips
  stable/10/sys/conf/files.pc98
  stable/10/sys/conf/files.powerpc
  stable/10/sys/conf/files.sparc64
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/files
==
--- stable/10/sys/conf/filesMon Aug  1 06:56:32 2016(r303608)
+++ stable/10/sys/conf/filesMon Aug  1 06:59:35 2016(r303609)
@@ -1782,6 +1782,7 @@ dev/jme/if_jme.c  optional jme pci
 dev/joy/joy.c  optional joy
 dev/joy/joy_isa.c  optional joy isa
 dev/joy/joy_pccard.c   optional joy pccard
+dev/kbd/kbd.c  optional atkbd | pckbd | sc | ukbd | vt
 dev/kbdmux/kbdmux.coptional kbdmux
 dev/ksyms/ksyms.c  optional ksyms
 dev/le/am7990.coptional le

Modified: stable/10/sys/conf/files.amd64
==
--- stable/10/sys/conf/files.amd64  Mon Aug  1 06:56:32 2016
(r303608)
+++ stable/10/sys/conf/files.amd64  Mon Aug  1 06:59:35 2016
(r303609)
@@ -281,7 +281,6 @@ dev/hyperv/vmbus/vmbus.c
optionalhyp
 dev/hyperv/vmbus/vmbus_et.coptionalhyperv
 dev/hyperv/vmbus/amd64/hyperv_machdep.coptional
hyperv
 dev/hyperv/vmbus/amd64/vmbus_vector.S  optionalhyperv
-dev/kbd/kbd.c  optionalatkbd | sc | ukbd | vt
 dev/lindev/full.c  optionallindev
 dev/lindev/lindev.coptionallindev
 dev/nfe/if_nfe.c   optionalnfe pci

Modified: stable/10/sys/conf/files.arm
==
--- stable/10/sys/conf/files.armMon Aug  1 06:56:32 2016
(r303608)
+++ stable/10/sys/conf/files.armMon Aug  1 06:59:35 2016
(r303609)
@@ -66,7 +66,6 @@ crypto/blowfish/bf_enc.c  optionalcrypto
 crypto/des/des_enc.c   optionalcrypto | ipsec | netsmb
 dev/fb/fb.coptionalsc
 dev/hwpmc/hwpmc_arm.c  optionalhwpmc
-dev/kbd/kbd.c  optionalsc | vt
 dev/syscons/scgfbrndr.coptionalsc
 dev/syscons/scterm-teken.c optionalsc
 dev/syscons/scvtb.coptionalsc

Modified: stable/10/sys/conf/files.i386
==
--- stable/10/sys/conf/files.i386   Mon Aug  1 06:56:32 2016
(r303608)
+++ stable/10/sys/conf/files.i386   Mon Aug  1 06:59:35 2016
(r303609)
@@ -274,7 +274,6 @@ dev/ipmi/ipmi_smbios.c  optional ipmi
 dev/ipmi/ipmi_ssif.c   optional ipmi smbus
 dev/ipmi/ipmi_pci.coptional ipmi pci
 dev/ipmi/ipmi_linux.c  optional ipmi compat_linux
-dev/kbd/kbd.c  optional atkbd | sc | ukbd | vt
 dev/le/if_le_isa.c optional le isa
 dev/lindev/full.c  optional lindev
 dev/lindev/lindev.coptional lindev

Modified: stable/10/sys/conf/files.ia64
==
--- stable/10/sys/conf/files.ia64   Mon Aug  1 06:56:32 2016
(r303608)
+++ stable/10/sys/conf/files.ia64   Mon Aug  1 06:59:35 2016
(r303609)
@@ -52,7 +52,6 @@ dev/fb/fb.c   optionalfb | vga
 dev/fb/vga.c   optionalvga
 dev/hwpmc/hwpmc_ia64.c optionalhwpmc
 dev/io/iodev.c optionalio
-dev/kbd/kbd.c  optionalatkbd | sc | ukbd
 dev/syscons/scterm-teken.c optionalsc
 dev/syscons/scvgarndr.coptionalsc vga
 dev/syscons/scvtb.coptionalsc

Modified: stable/10/sys/conf/files.mips
==
--- stable/10/sys/conf/files.mips   Mon Aug  1 06:56:32 2016
(r303608)
+++ stable/10/sys/conf/files.mips   Mon Aug  1 06:59:35 2016
(r303609)
@@ -68,7 +68,6 @@ dev/cfe/cfe_env.c optionalcfe_env
 
 # syscons support
 dev/fb/fb.c 

svn commit: r303606 - stable/11/sys/kern

2016-08-01 Thread Konstantin Belousov
Author: kib
Date: Mon Aug  1 06:34:55 2016
New Revision: 303606
URL: https://svnweb.freebsd.org/changeset/base/303606

Log:
  MFC r302614:
  Revive the check, disabled in r197963.
  
  MFC r302999:
  On first exec after vfork(), call signotify() to handle pending
  reenabled signals.
  
  Approved by:  re (delphij)

Modified:
  stable/11/sys/kern/kern_exec.c
  stable/11/sys/kern/subr_trap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_exec.c
==
--- stable/11/sys/kern/kern_exec.c  Mon Aug  1 05:09:11 2016
(r303605)
+++ stable/11/sys/kern/kern_exec.c  Mon Aug  1 06:34:55 2016
(r303606)
@@ -759,6 +759,8 @@ interpret:
if (p->p_flag & P_PPWAIT) {
p->p_flag &= ~(P_PPWAIT | P_PPTRACE);
cv_broadcast(>p_pwait);
+   /* STOPs are no longer ignored, arrange for AST */
+   signotify(td);
}
 
/*

Modified: stable/11/sys/kern/subr_trap.c
==
--- stable/11/sys/kern/subr_trap.c  Mon Aug  1 05:09:11 2016
(r303605)
+++ stable/11/sys/kern/subr_trap.c  Mon Aug  1 06:34:55 2016
(r303606)
@@ -101,17 +101,29 @@ userret(struct thread *td, struct trapfr
 td->td_name);
KASSERT((p->p_flag & P_WEXIT) == 0,
("Exiting process returns to usermode"));
-#if 0
 #ifdef DIAGNOSTIC
-   /* Check that we called signotify() enough. */
-   PROC_LOCK(p);
-   thread_lock(td);
-   if (SIGPENDING(td) && ((td->td_flags & TDF_NEEDSIGCHK) == 0 ||
-   (td->td_flags & TDF_ASTPENDING) == 0))
-   printf("failed to set signal flags properly for ast()\n");
-   thread_unlock(td);
-   PROC_UNLOCK(p);
-#endif
+   /*
+* Check that we called signotify() enough.  For
+* multi-threaded processes, where signal distribution might
+* change due to other threads changing sigmask, the check is
+* racy and cannot be performed reliably.
+* If current process is vfork child, indicated by P_PPWAIT, then
+* issignal() ignores stops, so we block the check to avoid
+* classifying pending signals.
+*/
+   if (p->p_numthreads == 1) {
+   PROC_LOCK(p);
+   thread_lock(td);
+   if ((p->p_flag & P_PPWAIT) == 0) {
+   KASSERT(!SIGPENDING(td) || (td->td_flags &
+   (TDF_NEEDSIGCHK | TDF_ASTPENDING)) ==
+   (TDF_NEEDSIGCHK | TDF_ASTPENDING),
+   ("failed to set signal flags for ast p %p "
+   "td %p fl %x", p, td, td->td_flags));
+   }
+   thread_unlock(td);
+   PROC_UNLOCK(p);
+   }
 #endif
 #ifdef KTRACE
KTRUSERRET(td);
@@ -265,6 +277,29 @@ ast(struct trapframe *framep)
 #endif
}
 
+#ifdef DIAGNOSTIC
+   if (p->p_numthreads == 1 && (flags & TDF_NEEDSIGCHK) == 0) {
+   PROC_LOCK(p);
+   thread_lock(td);
+   /*
+* Note that TDF_NEEDSIGCHK should be re-read from
+* td_flags, since signal might have been delivered
+* after we cleared td_flags above.  This is one of
+* the reason for looping check for AST condition.
+* See comment in userret() about P_PPWAIT.
+*/
+   if ((p->p_flag & P_PPWAIT) == 0) {
+   KASSERT(!SIGPENDING(td) || (td->td_flags &
+   (TDF_NEEDSIGCHK | TDF_ASTPENDING)) ==
+   (TDF_NEEDSIGCHK | TDF_ASTPENDING),
+   ("failed2 to set signal flags for ast p %p td %p "
+   "fl %x %x", p, td, flags, td->td_flags));
+   }
+   thread_unlock(td);
+   PROC_UNLOCK(p);
+   }
+#endif
+
/*
 * Check for signals. Unlocked reads of p_pendingcnt or
 * p_siglist might cause process-directed signal to be handled
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r303607 - stable/10/sys/kern

2016-08-01 Thread Konstantin Belousov
Author: kib
Date: Mon Aug  1 06:35:35 2016
New Revision: 303607
URL: https://svnweb.freebsd.org/changeset/base/303607

Log:
  MFC r302614:
  Revive the check, disabled in r197963.
  
  MFC r302999:
  On first exec after vfork(), call signotify() to handle pending
  reenabled signals.

Modified:
  stable/10/sys/kern/kern_exec.c
  stable/10/sys/kern/subr_trap.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_exec.c
==
--- stable/10/sys/kern/kern_exec.c  Mon Aug  1 06:34:55 2016
(r303606)
+++ stable/10/sys/kern/kern_exec.c  Mon Aug  1 06:35:35 2016
(r303607)
@@ -751,6 +751,8 @@ interpret:
if (p->p_flag & P_PPWAIT) {
p->p_flag &= ~(P_PPWAIT | P_PPTRACE);
cv_broadcast(>p_pwait);
+   /* STOPs are no longer ignored, arrange for AST */
+   signotify(td);
}
 
/*

Modified: stable/10/sys/kern/subr_trap.c
==
--- stable/10/sys/kern/subr_trap.c  Mon Aug  1 06:34:55 2016
(r303606)
+++ stable/10/sys/kern/subr_trap.c  Mon Aug  1 06:35:35 2016
(r303607)
@@ -108,17 +108,29 @@ userret(struct thread *td, struct trapfr
 td->td_name);
KASSERT((p->p_flag & P_WEXIT) == 0,
("Exiting process returns to usermode"));
-#if 0
 #ifdef DIAGNOSTIC
-   /* Check that we called signotify() enough. */
-   PROC_LOCK(p);
-   thread_lock(td);
-   if (SIGPENDING(td) && ((td->td_flags & TDF_NEEDSIGCHK) == 0 ||
-   (td->td_flags & TDF_ASTPENDING) == 0))
-   printf("failed to set signal flags properly for ast()\n");
-   thread_unlock(td);
-   PROC_UNLOCK(p);
-#endif
+   /*
+* Check that we called signotify() enough.  For
+* multi-threaded processes, where signal distribution might
+* change due to other threads changing sigmask, the check is
+* racy and cannot be performed reliably.
+* If current process is vfork child, indicated by P_PPWAIT, then
+* issignal() ignores stops, so we block the check to avoid
+* classifying pending signals.
+*/
+   if (p->p_numthreads == 1) {
+   PROC_LOCK(p);
+   thread_lock(td);
+   if ((p->p_flag & P_PPWAIT) == 0) {
+   KASSERT(!SIGPENDING(td) || (td->td_flags &
+   (TDF_NEEDSIGCHK | TDF_ASTPENDING)) ==
+   (TDF_NEEDSIGCHK | TDF_ASTPENDING),
+   ("failed to set signal flags for ast p %p "
+   "td %p fl %x", p, td, td->td_flags));
+   }
+   thread_unlock(td);
+   PROC_UNLOCK(p);
+   }
 #endif
 #ifdef KTRACE
KTRUSERRET(td);
@@ -268,6 +280,29 @@ ast(struct trapframe *framep)
 #endif
}
 
+#ifdef DIAGNOSTIC
+   if (p->p_numthreads == 1 && (flags & TDF_NEEDSIGCHK) == 0) {
+   PROC_LOCK(p);
+   thread_lock(td);
+   /*
+* Note that TDF_NEEDSIGCHK should be re-read from
+* td_flags, since signal might have been delivered
+* after we cleared td_flags above.  This is one of
+* the reason for looping check for AST condition.
+* See comment in userret() about P_PPWAIT.
+*/
+   if ((p->p_flag & P_PPWAIT) == 0) {
+   KASSERT(!SIGPENDING(td) || (td->td_flags &
+   (TDF_NEEDSIGCHK | TDF_ASTPENDING)) ==
+   (TDF_NEEDSIGCHK | TDF_ASTPENDING),
+   ("failed2 to set signal flags for ast p %p td %p "
+   "fl %x %x", p, td, flags, td->td_flags));
+   }
+   thread_unlock(td);
+   PROC_UNLOCK(p);
+   }
+#endif
+
/*
 * Check for signals. Unlocked reads of p_pendingcnt or
 * p_siglist might cause process-directed signal to be handled
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Bruce Evans

On Sun, 31 Jul 2016, Xin Li wrote:


On 7/31/16 14:36, Pedro F. Giffuni wrote:


Log:
  indent(1): replace function call to bzero with memset.

  Reference:
  
https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235

  Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
  Submitted by: Piotr Stefaniak

Modified:
  head/usr.bin/indent/io.c

Modified: head/usr.bin/indent/io.c
==
--- head/usr.bin/indent/io.cSun Jul 31 21:29:10 2016(r303599)
+++ head/usr.bin/indent/io.cSun Jul 31 21:36:40 2016(r303600)
@@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char *
 const char *s = s0;
 int sizedelta = 0;

-bzero(f, sizeof *f);
+memset(f, 0, sizeof(struct fstate));

   ^  This is much more error-prone
than sizeof(*f) IMHO.


I also prefer bzero().

Removal of the space after sizeof is another regression.  KNF disallows
the space, but indent's style is very far from KNF.  It isn't clear if
indent's style is to require the space, since old versions of indent
never used sizeof(typename), and 'sizeof object' requires the space.
Regressions started in r93440 with sizeof(object) in an nitems() expansion.
The style of this is very different from an nitems() expansion in r1590.
There was 1 more sizeof(object) and 1 sizeof(int).  This is the first
sizeof(typename) where 'sizeof object' cannot be used for technical
reasons.

KNF also requires parentheses for sizeof(object).  Then the space is
unnecessary and disallowed.

Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303586 - head/bin/sh

2016-08-01 Thread Warner Losh
On Sun, Jul 31, 2016 at 11:51 PM, Bruce Evans  wrote:
> On Sun, 31 Jul 2016, Warner Losh wrote:
>
>> On Sun, Jul 31, 2016 at 2:16 PM, Jilles Tjoelker  wrote:
>>>
>>> On Sun, Jul 31, 2016 at 01:43:16PM +, Alexey Dokuchaev wrote:

 On Sun, Jul 31, 2016 at 01:11:34PM +, Jilles Tjoelker wrote:
>
> New Revision: 303586
> URL: https://svnweb.freebsd.org/changeset/base/303586
>>>
>>>
> Log:
>   sh: Fix a clang warning.
>>>
>>>
>   Submitted by: bdrewery
>>>
>>>
> Modified:
>   head/bin/sh/expand.c
>>>
>>>
> Modified: head/bin/sh/expand.c
>
> ==
> --- head/bin/sh/expand.cSun Jul 31 12:59:10 2016(r303585)
> +++ head/bin/sh/expand.cSun Jul 31 13:11:34 2016(r303586)
> @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in
> if (--in.nleft < 0) {
> if (in.fd < 0)
> break;
> -   while ((i = read(in.fd, buf, sizeof buf)) < 0 &&
> errno == EINTR);
> +   while ((i = read(in.fd, buf, sizeof buf)) < 0 &&
> errno == EINTR)
> +   ;
>>>
>>>
 `continue;' would be even better; some tools might barf at stray
 semicolon.
>>>
>>>
>>> Both continue; and ; (the latter with and without comment) occur in the
>>> source tree many times. I don't really like a continue that does nothing
>>> because it is at the end of a loop, so I prefer to make this whitespace
>>> change only (there are two more instances in bin/sh). I think a sole
>>> semicolon on a line is conspicuous enough that nothing additional is
>>> required.
>>
>>
>> For humans, yes. For picky tools that warn about strange constructs, no.
>> Clang may be happy, but there's many other tools that expect you to
>> declare
>> an 'empty' while loop with continue. This tradition has dated back to
>> at least the
>> late 80's...
>
>
> Buggy tools.  I thought that programmers used the stand-alone semicolon
> since that is shorter and clearer.

It cannot be on the same line though.

> The stand-alone semicolon is bad if it is misformatted.  'while(foo());'
> is shorter and unclearer.  A C parser must ignore whitespace, so you
> need a tool like indent that sort of understands whitespace to disallow
> while(foo()); but accept 'while (foo())\n\t;'.  It is not far from full
> indent(1) and insisting on the correct number of \t's before the semicolon.

A C parser doesn't completely ignore the whitespace if it doesn't warn
in both cases...

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303586 - head/bin/sh

2016-08-01 Thread Bruce Evans

On Sun, 31 Jul 2016, Warner Losh wrote:


On Sun, Jul 31, 2016 at 2:16 PM, Jilles Tjoelker  wrote:

On Sun, Jul 31, 2016 at 01:43:16PM +, Alexey Dokuchaev wrote:

On Sun, Jul 31, 2016 at 01:11:34PM +, Jilles Tjoelker wrote:

New Revision: 303586
URL: https://svnweb.freebsd.org/changeset/base/303586



Log:
  sh: Fix a clang warning.



  Submitted by: bdrewery



Modified:
  head/bin/sh/expand.c



Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cSun Jul 31 12:59:10 2016(r303585)
+++ head/bin/sh/expand.cSun Jul 31 13:11:34 2016(r303586)
@@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in
if (--in.nleft < 0) {
if (in.fd < 0)
break;
-   while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == 
EINTR);
+   while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == 
EINTR)
+   ;



`continue;' would be even better; some tools might barf at stray semicolon.


Both continue; and ; (the latter with and without comment) occur in the
source tree many times. I don't really like a continue that does nothing
because it is at the end of a loop, so I prefer to make this whitespace
change only (there are two more instances in bin/sh). I think a sole
semicolon on a line is conspicuous enough that nothing additional is
required.


For humans, yes. For picky tools that warn about strange constructs, no.
Clang may be happy, but there's many other tools that expect you to declare
an 'empty' while loop with continue. This tradition has dated back to
at least the
late 80's...


Buggy tools.  I thought that programmers used the stand-alone semicolon
since that is shorter and clearer.

The stand-alone semicolon is bad if it is misformatted.  'while(foo());'
is shorter and unclearer.  A C parser must ignore whitespace, so you
need a tool like indent that sort of understands whitespace to disallow
while(foo()); but accept 'while (foo())\n\t;'.  It is not far from full
indent(1) and insisting on the correct number of \t's before the semicolon.

Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Xin Li


On 7/31/16 14:36, Pedro F. Giffuni wrote:
> Author: pfg
> Date: Sun Jul 31 21:36:40 2016
> New Revision: 303600
> URL: https://svnweb.freebsd.org/changeset/base/303600
> 
> Log:
>   indent(1): replace function call to bzero with memset.
>   
>   Reference:
>   
> https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235
>   
>   Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
>   Submitted by:   Piotr Stefaniak
> 
> Modified:
>   head/usr.bin/indent/io.c
> 
> Modified: head/usr.bin/indent/io.c
> ==
> --- head/usr.bin/indent/io.c  Sun Jul 31 21:29:10 2016(r303599)
> +++ head/usr.bin/indent/io.c  Sun Jul 31 21:36:40 2016(r303600)
> @@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char *
>  const char *s = s0;
>  int sizedelta = 0;
>  
> -bzero(f, sizeof *f);
> +memset(f, 0, sizeof(struct fstate));
^  This is much more error-prone
than sizeof(*f) IMHO.

Cheers,



signature.asc
Description: OpenPGP digital signature