svn commit: r317727 - head/sys/mips/conf

2017-05-02 Thread Adrian Chadd
Author: adrian
Date: Wed May  3 05:45:43 2017
New Revision: 317727
URL: https://svnweb.freebsd.org/changeset/base/317727

Log:
  [mips] default AR933x/AR934x to include mips24k hwpmc and limit umtx chain 
memory wastage.
  
  Tested:
  
  * AR933x SoC (Carambola2)
  * AR934x SoC (TP-Link WDR3600)

Modified:
  head/sys/mips/conf/CARAMBOLA2
  head/sys/mips/conf/std.AR933X
  head/sys/mips/conf/std.AR934X

Modified: head/sys/mips/conf/CARAMBOLA2
==
--- head/sys/mips/conf/CARAMBOLA2   Wed May  3 05:33:15 2017
(r317726)
+++ head/sys/mips/conf/CARAMBOLA2   Wed May  3 05:45:43 2017
(r317727)
@@ -24,6 +24,8 @@ hints   "CARAMBOLA2.hints"
 # Board memory - 64MB
 options AR71XX_REALMEM=(64*1024*1024)
 
+optionsEARLY_PRINTF
+
 # i2c GPIO bus
 #devicegpioiic
 #deviceiicbb

Modified: head/sys/mips/conf/std.AR933X
==
--- head/sys/mips/conf/std.AR933X   Wed May  3 05:33:15 2017
(r317726)
+++ head/sys/mips/conf/std.AR933X   Wed May  3 05:45:43 2017
(r317727)
@@ -20,7 +20,7 @@ files "../atheros/files.ar71xx"
 hints  "AR933X_BASE.hints"
 
 makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols
-makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap 
if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip 
wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn 
rtwn_usb rtwnfw otus otusfw"
+makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap 
if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip 
wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn 
rtwn_usb rtwnfw otus otusfw hwpmc_mips24k"
 
 optionsDDB
 optionsKDB
@@ -51,10 +51,10 @@ options VM_KMEM_SIZE_SCALE=1
 optionsNBUF=128
 
 # Limit UMTX hash size
-# options  UMTX_NUM_CHAINS=64
+optionsUMTX_CHAINS=64
 
 # PMC
-#options   HWPMC_HOOKS
+optionsHWPMC_HOOKS
 #devicehwpmc
 #devicehwpmc_mips24k
 

Modified: head/sys/mips/conf/std.AR934X
==
--- head/sys/mips/conf/std.AR934X   Wed May  3 05:33:15 2017
(r317726)
+++ head/sys/mips/conf/std.AR934X   Wed May  3 05:45:43 2017
(r317727)
@@ -20,7 +20,7 @@ files "../atheros/files.ar71xx"
 hints  "AR934X_BASE.hints"
 
 makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols
-makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap 
if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip 
wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn 
rtwn_usb rtwnfw otus otusfw"
+makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap 
if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip 
wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn 
rtwn_usb rtwnfw otus otusfw hwpmc_mips24k"
 # makeoptions  MODULES_OVERRIDE=""
 
 optionsDDB
@@ -47,10 +47,10 @@ options NO_SYSCTL_DESCR
 optionsNBUF=128
 
 # Limit UMTX hash size
-# options  UMTX_NUM_CHAINS=64
+optionsUMTX_CHAINS=64
 
 # PMC
-#options   HWPMC_HOOKS
+optionsHWPMC_HOOKS
 #devicehwpmc
 #devicehwpmc_mips24k
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317726 - head/sys/cam

2017-05-02 Thread Scott Long
Author: scottl
Date: Wed May  3 05:33:15 2017
New Revision: 317726
URL: https://svnweb.freebsd.org/changeset/base/317726

Log:
  Fix an unsafe malloc usage with sbufs.
  
  Reported by:  ken
  Sponsored by: Netflix

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Wed May  3 04:42:35 2017(r317725)
+++ head/sys/cam/cam_periph.c   Wed May  3 05:33:15 2017(r317726)
@@ -643,8 +643,9 @@ cam_periph_invalidate(struct cam_periph 
CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n"));
if ((periph->flags & CAM_PERIPH_ANNOUNCED) && !rebooting) {
struct sbuf sb;
+   char buffer[160];
 
-   sbuf_new(, NULL, 160, SBUF_FIXEDLEN);
+   sbuf_new(, buffer, 160, SBUF_FIXEDLEN);
xpt_denounce_periph_sbuf(periph, );
sbuf_finish();
sbuf_putbuf();
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r301198 - head/sys/dev/xen/netfront

2017-05-02 Thread Colin Percival
On 06/02/16 04:16, Roger Pau Monné wrote:
> Author: royger
> Date: Thu Jun  2 11:16:35 2016
> New Revision: 301198
> URL: https://svnweb.freebsd.org/changeset/base/301198

I think this commit is responsible for panics I'm seeing in EC2 on T2 family
instances.  Every time a DHCP request is made, we call into xn_ifinit_locked
(not sure why -- something to do with making the interface promiscuous?) and
hit this code

> @@ -1760,7 +1715,7 @@ xn_ifinit_locked(struct netfront_info *n
>   xn_alloc_rx_buffers(rxq);
>   rxq->ring.sring->rsp_event = rxq->ring.rsp_cons + 1;
>   if (RING_HAS_UNCONSUMED_RESPONSES(>ring))
> - taskqueue_enqueue(rxq->tq, >intrtask);
> + xn_rxeof(rxq);
>   XN_RX_UNLOCK(rxq);
>   }

but under high traffic volumes I think a separate thread can already be
running in xn_rxeof, having dropped the RX lock while it passes a packet
up the stack.  This would result in two different threads trying to process
the same set of responses from the ring, with (unsurprisingly) bad results.

I'm not 100% sure that this is what's causing the panic, but it's definitely
happening under high traffic conditions immediately after xn_ifinit_locked is
called, so I think my speculation is well-founded.

There are a few things I don't understand here:
1. Why DHCP requests are resulting in calls into xn_ifinit_locked.
2. Why the calls into xn_ifinit_locked are only happening on T2 instances
and not on any of the other EC2 instances I've tried.
3. Why xn_ifinit_locked is consuming ring responses.
so I'm not sure what the solution is, but hopefully someone who knows this
code better will be able to help...

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r317723 - head/sys/net

2017-05-02 Thread Alexander Motin
Author: mav
Date: Wed May  3 02:54:11 2017
New Revision: 317723
URL: https://svnweb.freebsd.org/changeset/base/317723

Log:
  Fix r317696 build without debug.
  
  MFC after:2 weeks

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Wed May  3 02:37:44 2017(r317722)
+++ head/sys/net/if_lagg.c  Wed May  3 02:54:11 2017(r317723)
@@ -1533,10 +1533,9 @@ lagg_setmulti(struct lagg_port *lp)
 static int
 lagg_clrmulti(struct lagg_port *lp)
 {
-   struct lagg_softc *sc = lp->lp_softc;
struct lagg_mc *mc;
 
-   LAGG_WLOCK_ASSERT(sc);
+   LAGG_WLOCK_ASSERT(lp->lp_softc);
while ((mc = SLIST_FIRST(>lp_mc_head)) != NULL) {
SLIST_REMOVE(>lp_mc_head, mc, lagg_mc, mc_entries);
if (mc->mc_ifma && lp->lp_detaching == 0)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317715 - head/sbin/ifconfig

2017-05-02 Thread Alan Somers
Author: asomers
Date: Wed May  3 01:46:39 2017
New Revision: 317715
URL: https://svnweb.freebsd.org/changeset/base/317715

Log:
  ifconfig displays ND6_IFF_NO_DAD as "IGNORELOOP"
  
  PR:   218958
  Reviewed by:  kristof
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D10543

Modified:
  head/sbin/ifconfig/af_nd6.c

Modified: head/sbin/ifconfig/af_nd6.c
==
--- head/sbin/ifconfig/af_nd6.c Wed May  3 01:06:56 2017(r317714)
+++ head/sbin/ifconfig/af_nd6.c Wed May  3 01:46:39 2017(r317715)
@@ -57,8 +57,7 @@ static const char rcsid[] =
 #defineMAX_SYSCTL_TRY  5
 #defineND6BITS "\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \
"\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \
-   "\007NO_RADR\010NO_PREFER_IFACE\011IGNORELOOP\012NO_DAD" \
-   "\020DEFAULTIF"
+   "\007NO_RADR\010NO_PREFER_IFACE\011NO_DAD\020DEFAULTIF"
 
 static int isnd6defif(int);
 void setnd6flags(const char *, int, int, const struct afswtch *);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317713 - head/tests/sys/geom/class/mirror

2017-05-02 Thread Mark Johnston
Author: markj
Date: Tue May  2 23:31:39 2017
New Revision: 317713
URL: https://svnweb.freebsd.org/changeset/base/317713

Log:
  Add regression tests for r317712 and r306743.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Added:
  head/tests/sys/geom/class/mirror/8_test.sh   (contents, props changed)
  head/tests/sys/geom/class/mirror/9_test.sh   (contents, props changed)
Modified:
  head/tests/sys/geom/class/mirror/Makefile

Added: head/tests/sys/geom/class/mirror/8_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/geom/class/mirror/8_test.sh  Tue May  2 23:31:39 2017
(r317713)
@@ -0,0 +1,53 @@
+#!/bin/sh
+# $FreeBSD$
+
+# Regression test for r317712.
+
+. `dirname $0`/conf.sh
+
+echo 1..1
+
+ddbs=2048
+m1=`mktemp $base.XX` || exit 1
+m2=`mktemp $base.XX` || exit 1
+
+dd if=/dev/zero of=$m1 bs=$ddbs count=1024 >/dev/null 2>&1
+dd if=/dev/zero of=$m2 bs=$ddbs count=1024 >/dev/null 2>&1
+
+us0=$(mdconfig -t vnode -f $m1) || exit 1
+us1=$(mdconfig -t vnode -f $m2) || exit 1
+
+gmirror label $name /dev/$us0 /dev/$us1 || exit 1
+devwait
+
+# Ensure that the mirrors are marked dirty, and then disconnect them.
+# We need to have the gmirror provider open when destroying the MDs since
+# gmirror will automatically mark the mirrors clean when the provider is 
closed.
+exec 9>/dev/mirror/$name
+dd if=/dev/zero bs=$ddbs count=1 >&9 2>/dev/null
+mdconfig -d -u ${us0#md} -o force || exit 1
+mdconfig -d -u ${us1#md} -o force || exit 1
+exec 9>&-
+
+dd if=/dev/random of=$m1 bs=$ddbs count=1 conv=notrunc >/dev/null 2>&1
+us0=$(attach_md -t vnode -f $m1) || exit 1
+devwait # This will take kern.geom.mirror.timeout seconds.
+
+# Re-attach the second mirror and wait for it to synchronize.
+us1=$(attach_md -t vnode -f $m2) || exit 1
+while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do
+sleep 1
+done
+
+# Verify the two mirrors are identical. Destroy the gmirror first so that
+# the mirror metadata is wiped; otherwise the metadata blocks will fail
+# the comparison. It would be nice to do this with a "gmirror verify"
+# command instead.
+gmirror destroy $name
+if cmp -s ${m1} ${m2}; then
+echo "ok 1"
+else
+echo "not ok 1"
+fi
+
+rm -f $m1 $m2

Added: head/tests/sys/geom/class/mirror/9_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/geom/class/mirror/9_test.sh  Tue May  2 23:31:39 2017
(r317713)
@@ -0,0 +1,62 @@
+#!/bin/sh
+# $FreeBSD$
+
+# Regression test for r306743.
+
+. `dirname $0`/conf.sh
+
+echo 1..1
+
+ddbs=2048
+m1=`mktemp $base.XX` || exit 1
+m2=`mktemp $base.XX` || exit 1
+m3=`mktemp $base.XX` || exit 1
+
+dd if=/dev/zero of=$m1 bs=$ddbs count=1024 >/dev/null 2>&1
+dd if=/dev/zero of=$m2 bs=$ddbs count=1024 >/dev/null 2>&1
+dd if=/dev/zero of=$m3 bs=$ddbs count=1024 >/dev/null 2>&1
+
+us0=$(attach_md -t vnode -f $m1) || exit 1
+us1=$(attach_md -t vnode -f $m2) || exit 1
+us2=$(attach_md -t vnode -f $m3) || exit 1
+
+gmirror label $name /dev/$us0 /dev/$us1 || exit 1
+devwait
+
+# Break one of the mirrors by forcing a single metadata write error.
+# When dd closes the mirror provider, gmirror will attempt to mark the mirrors
+# clean, and will kick one of the mirrors out upon hitting the error.
+sysctl debug.fail_point.g_mirror_metadata_write='1*return(5)' || exit 1
+dd if=/dev/random of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1
+sysctl debug.fail_point.g_mirror_metadata_write='off' || exit 1
+
+# Replace the broken mirror, and then stop the gmirror.
+gmirror forget $name || exit 1
+gmirror insert $name /dev/$us2 || exit 1
+while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do
+sleep 1
+done
+gmirror stop $name || exit 1
+
+# Restart the gmirror on the original two mirrors. One of them is broken,
+# so we should end up with a degraded gmirror.
+gmirror activate $name /dev/$us0 /dev/$us1 || exit 1
+devwait
+dd if=/dev/random of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1
+
+# Re-add the replacement mirror and verify the two mirrors are synchronized.
+# Destroy the gmirror first so that the mirror metadata is wiped; otherwise
+# the metadata blocks will fail the comparison. It would be nice to do this
+# with a "gmirror verify" command instead.
+gmirror activate $name /dev/$us2 || exit 1
+while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do
+sleep 1
+done
+gmirror destroy $name || exit 1
+if cmp -s $m1 $m3; then
+echo "ok 1"
+else
+echo "not ok 1"
+fi
+
+rm -f $m1 $m2 $m3

Modified: head/tests/sys/geom/class/mirror/Makefile
==
--- head/tests/sys/geom/class/mirror/Makefile   Tue May  2 23:29:42 2017
(r317712)
+++ head/tests/sys/geom/class/mirror/Makefile   Tue 

svn commit: r317712 - head/sys/geom/mirror

2017-05-02 Thread Mark Johnston
Author: markj
Date: Tue May  2 23:29:42 2017
New Revision: 317712
URL: https://svnweb.freebsd.org/changeset/base/317712

Log:
  Synchronize unclean mirrors before adding them to a running gmirror.
  
  During gmirror startup, if component mirrors are found to be dirty as is
  typical after a system crash, the mirrors are synchronized to the mirror
  with highest priority. However if a gmirror starts without all of its
  mirrors present, for example because of some transient delays during
  tasting, the remaining mirrors must be synchronized before they may become
  active.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/geom/mirror/g_mirror.c

Modified: head/sys/geom/mirror/g_mirror.c
==
--- head/sys/geom/mirror/g_mirror.c Tue May  2 22:57:27 2017
(r317711)
+++ head/sys/geom/mirror/g_mirror.c Tue May  2 23:29:42 2017
(r317712)
@@ -2225,7 +2225,9 @@ g_mirror_determine_state(struct g_mirror
sc = disk->d_softc;
if (sc->sc_syncid == disk->d_sync.ds_syncid) {
if ((disk->d_flags &
-   G_MIRROR_DISK_FLAG_SYNCHRONIZING) == 0) {
+   G_MIRROR_DISK_FLAG_SYNCHRONIZING) == 0 &&
+   (g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) == 0 ||
+(disk->d_flags & G_MIRROR_DISK_FLAG_DIRTY) == 0)) {
/* Disk does not need synchronization. */
state = G_MIRROR_DISK_STATE_ACTIVE;
} else {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317709 - head/usr.bin/csplit

2017-05-02 Thread Pedro Giffuni

Very interesting ...

On 2/5/2017 16:56, Jilles Tjoelker wrote:

Author: jilles
Date: Tue May  2 21:56:20 2017
New Revision: 317709
URL: https://svnweb.freebsd.org/changeset/base/317709

Log:
   csplit: Fix check of fputs() return value, making csplit work again.
   
   As of r295638, fputs() returns the number of bytes written (if not more than

   INT_MAX). This broke csplit completely, since csplit assumed only success
   only for the return value 0.
  


Actually r295631 explains better why the change was made.

I now checked with opengrok and it appears only csplit was hit.

Thanks!

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


svn commit: r317710 - head/contrib/netbsd-tests/lib/libc/rpc

2017-05-02 Thread Brooks Davis
Author: brooks
Date: Tue May  2 22:14:55 2017
New Revision: 317710
URL: https://svnweb.freebsd.org/changeset/base/317710

Log:
  Remove expected failure now that it was fixed in r317660.
  
  PR:   211804
  Reviewed by:  ngie
  Obtained from:CheriBSD
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10576

Modified:
  head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c

Modified: head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
==
--- head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c  Tue May  2 21:56:20 
2017(r317709)
+++ head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c  Tue May  2 22:14:55 
2017(r317710)
@@ -325,10 +325,6 @@ ATF_TC_HEAD(raw, tc)
 
 ATF_TC_BODY(raw, tc)
 {
-#ifdef __FreeBSD__
-   atf_tc_expect_fail("fails with: clnt_call: "
-   "RPC: Can't decode result -- PR # 211804");
-#endif
rawtest(NULL);
 
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Ngie Cooper
On Tue, May 2, 2017 at 12:45 PM, Konstantin Belousov
 wrote:

...

>  .Fx .
>  .Pp
>  .Ss Type sizes
> +If not explicitely mentioned, sizes are in bytes.

*explicitly

> +.Pp
>  On all supported architectures,
>  .Bl -column -offset -indent "long long" "Size"
>  .It Sy Type Ta Sy Size
> @@ -47,8 +49,10 @@ On all supported architectures,
>  .It float Ta 4
>  .It double Ta 8
>  .El
> -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
> sizeof(long double)" "Sy sizeof(time_t)"
> -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
> sizeof(time_t)
> +.Pp
> +Machine-dependent type sizes:
> +.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" 
> "Sy time_t"
> +.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
>  .It amd64   Ta 8 Ta 16 Ta 8
>  .It arm Ta 4 Ta  8 Ta 8
>  .It armeb   Ta 4 Ta  8 Ta 8
> @@ -69,6 +73,9 @@ On all supported architectures,
>  .It riscv   Ta 8 Ta 16 Ta 8
>  .It sparc64 Ta 8 Ta 16 Ta 8
>  .El
> +.Pp
> +.Sy time_t
> +is always signed, it is 64-bits everywere except on i386 and 32-bit powerpc.

*everywhere

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


svn commit: r317709 - head/usr.bin/csplit

2017-05-02 Thread Jilles Tjoelker
Author: jilles
Date: Tue May  2 21:56:20 2017
New Revision: 317709
URL: https://svnweb.freebsd.org/changeset/base/317709

Log:
  csplit: Fix check of fputs() return value, making csplit work again.
  
  As of r295638, fputs() returns the number of bytes written (if not more than
  INT_MAX). This broke csplit completely, since csplit assumed only success
  only for the return value 0.
  
  PR:   213510
  Submitted by: J.R. Oldroyd
  MFC after:1 week
  Relnotes: yes

Modified:
  head/usr.bin/csplit/csplit.c

Modified: head/usr.bin/csplit/csplit.c
==
--- head/usr.bin/csplit/csplit.cTue May  2 21:33:27 2017
(r317708)
+++ head/usr.bin/csplit/csplit.cTue May  2 21:56:20 2017
(r317709)
@@ -195,7 +195,7 @@ main(int argc, char *argv[])
/* Copy the rest into a new file. */
if (!feof(infile)) {
ofp = newfile();
-   while ((p = get_line()) != NULL && fputs(p, ofp) == 0)
+   while ((p = get_line()) != NULL && fputs(p, ofp) != EOF)
;
if (!sflag)
printf("%jd\n", (intmax_t)ftello(ofp));
@@ -392,7 +392,7 @@ do_rexp(const char *expr)
/* Read and output lines until we get a match. */
first = 1;
while ((p = get_line()) != NULL) {
-   if (fputs(p, ofp) != 0)
+   if (fputs(p, ofp) == EOF)
break;
if (!first && regexec(, p, 0, NULL, 0) == 0)
break;
@@ -453,7 +453,7 @@ do_lineno(const char *expr)
while (lineno + 1 != lastline) {
if ((p = get_line()) == NULL)
errx(1, "%ld: out of range", lastline);
-   if (fputs(p, ofp) != 0)
+   if (fputs(p, ofp) == EOF)
break;
}
if (!sflag)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317708 - head/share/man/man7

2017-05-02 Thread Justin Hibbits
Author: jhibbits
Date: Tue May  2 21:33:27 2017
New Revision: 317708
URL: https://svnweb.freebsd.org/changeset/base/317708

Log:
  Add powerpcspe to arch(7)
  
  Reviewed by:  emaste

Modified:
  head/share/man/man7/arch.7

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Tue May  2 21:20:27 2017(r317707)
+++ head/share/man/man7/arch.7  Tue May  2 21:33:27 2017(r317708)
@@ -65,6 +65,7 @@ On all supported architectures,
 .It mips64elhf  Ta 8 Ta  8 Ta 8
 .It mips64hfTa 8 Ta  8 Ta 8
 .It powerpc Ta 4 Ta  8 Ta 4
+.It powerpcspe  Ta 4 Ta  8 Ta 4
 .It powerpc64   Ta 8 Ta  8 Ta 8
 .It riscv   Ta 8 Ta 16 Ta 8
 .It sparc64 Ta 8 Ta 16 Ta 8
@@ -88,6 +89,7 @@ On all supported architectures,
 .It mips64elhf  Ta little Ta   signed
 .It mips64hfTa bigTa   signed
 .It powerpc Ta bigTa unsigned
+.It powerpcspe  Ta bigTa unsigned
 .It powerpc64   Ta bigTa unsigned
 .It riscv   Ta little Ta   signed
 .It sparc64 Ta bigTa   signed
@@ -111,6 +113,7 @@ On all supported architectures,
 .It mips64elhf  Ta 4K
 .It mips64hfTa 4K
 .It powerpc Ta 4K
+.It powerpcspe  Ta 4K
 .It powerpc64   Ta 4K
 .It riscv   Ta 4K
 .It sparc64 Ta 8K
@@ -134,6 +137,7 @@ On all supported architectures,
 .It mips64elhf  Ta hard Ta identical to double
 .It mips64hfTa hard Ta identical to double
 .It powerpc Ta hard Ta hard, double precision
+.It powerpcspe  Ta hard Ta hard, double precision
 .It powerpc64   Ta hard Ta hard, double precision
 .It riscv64 Ta hard Ta hard, double precision
 .It riscv64sf   Ta soft Ta soft, double precision
@@ -180,6 +184,7 @@ Architecture-specific macros:
 .It mips64elhf  Ta Dv __mips__, Dv __mips_n64
 .It mips64hfTa Dv __mips__, Dv __MIPSEB__, Dv __mips_n64
 .It powerpc Ta Dv __powerpc__
+.It powerpcspe  Ta Dv __powerpc__, Dv __SPE__
 .It powerpc64   Ta Dv __powerpc__, Dv __powerpc64__
 .It riscv   Ta Dv __riscv__, Dv __riscv64
 .It sparc64 Ta Dv __sparc64__
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317707 - head/lib/libc/regex

2017-05-02 Thread Brooks Davis
Author: brooks
Date: Tue May  2 21:20:27 2017
New Revision: 317707
URL: https://svnweb.freebsd.org/changeset/base/317707

Log:
  Correct an out-of-bounds read in regcomp when the RE is bad.
  
  When passed the invalid regular expression "a**", the error is
  eventually detected and seterr() is called. It sets p->error
  appropriatly and p->next and p->end to nuls which is a never used char
  nuls[10] which is zeros due to .bss initialization. Unfortunatly,
  p_ere_exp() and p_simp_re() both have fall through cases where they set
  the error, decrement p->next and access it which means a read from what
  ever .bss variable comes before nuls.
  
  Found with regex_test:repet_multi and CHERI bounds checking.
  
  Reviewed by:  ngie, pfg, emaste
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D10541

Modified:
  head/lib/libc/regex/regcomp.c

Modified: head/lib/libc/regex/regcomp.c
==
--- head/lib/libc/regex/regcomp.c   Tue May  2 21:09:07 2017
(r317706)
+++ head/lib/libc/regex/regcomp.c   Tue May  2 21:20:27 2017
(r317707)
@@ -444,6 +444,8 @@ p_ere_exp(struct parse *p)
(void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
/* FALLTHROUGH */
default:
+   if (p->error != 0)
+   return;
p->next--;
wc = WGETNEXT();
ordinary(p, wc);
@@ -651,6 +653,8 @@ p_simp_re(struct parse *p,
(void)REQUIRE(starordinary, REG_BADRPT);
/* FALLTHROUGH */
default:
+   if (p->error != 0)
+   return(0);  /* Definitely not $... */
p->next--;
wc = WGETNEXT();
ordinary(p, wc);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317706 - head/usr.bin/proccontrol

2017-05-02 Thread Brooks Davis
On Tue, May 02, 2017 at 09:09:07PM +, Brooks Davis wrote:
> Author: brooks
> Date: Tue May  2 21:09:07 2017
> New Revision: 317706
> URL: https://svnweb.freebsd.org/changeset/base/317706
> 
> Log:
>   Use MAN= rather than MK_MAN=no to not install a manpage.

With this change, the only remaining ordinary users of MK_MAN=no is
lib/ncurses/ncurses/Makefile where it's set when building libncursesw
(wide).  I'd argue this case is wrong as there are wide-character
specific manpages and they should be installed with the correct library.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r317706 - head/usr.bin/proccontrol

2017-05-02 Thread Brooks Davis
Author: brooks
Date: Tue May  2 21:09:07 2017
New Revision: 317706
URL: https://svnweb.freebsd.org/changeset/base/317706

Log:
  Use MAN= rather than MK_MAN=no to not install a manpage.
  
  MFC after:1 week

Modified:
  head/usr.bin/proccontrol/Makefile

Modified: head/usr.bin/proccontrol/Makefile
==
--- head/usr.bin/proccontrol/Makefile   Tue May  2 21:08:38 2017
(r317705)
+++ head/usr.bin/proccontrol/Makefile   Tue May  2 21:09:07 2017
(r317706)
@@ -2,6 +2,6 @@
 
 PROG=   proccontrol
 WARNS?=6
-MK_MAN=no
+MAN=
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317705 - head/usr.bin/grep

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 21:08:38 2017
New Revision: 317705
URL: https://svnweb.freebsd.org/changeset/base/317705

Log:
  bsdgrep: avoid use of magic number for REG_NOSPEC
  
  Submitted by: Kyle Evans 
  Differential Revision:https://reviews.freebsd.org/D10420

Modified:
  head/usr.bin/grep/grep.c

Modified: head/usr.bin/grep/grep.c
==
--- head/usr.bin/grep/grep.cTue May  2 20:44:06 2017(r317704)
+++ head/usr.bin/grep/grep.cTue May  2 21:08:38 2017(r317705)
@@ -716,8 +716,13 @@ main(int argc, char *argv[])
case GREP_BASIC:
break;
case GREP_FIXED:
-   /* XXX: header mess, REG_LITERAL not defined in gnu/regex.h */
-   cflags |= 0020;
+#if defined(REG_NOSPEC)
+   cflags |= REG_NOSPEC;
+#elif defined(REG_LITERAL)
+   cflags |= REG_LITERAL;
+#else
+   errx(2, "literal expressions not supported at compile time");
+#endif
break;
case GREP_EXTENDED:
cflags |= REG_EXTENDED;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317704 - head/usr.bin/grep/regex

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 20:44:06 2017
New Revision: 317704
URL: https://svnweb.freebsd.org/changeset/base/317704

Log:
  bsdgrep: fix escape map building for multibyte strings
  
  In BSD grep, fix escape map building in the regex parser. It was
  previously using memory not explicitly initialized, and the MBS escape
  map was being built based on a version of the pattern with escapes
  already parsed out.
  
  This is Kyle's change, but I restored the broken style that already
  exists in this file.
  
  Submitted by: Kyle Evans 
  Reviewed by:  cem, Kyle Evans (my style changes)
  Differential Revision:https://reviews.freebsd.org/D10098

Modified:
  head/usr.bin/grep/regex/tre-fastmatch.c

Modified: head/usr.bin/grep/regex/tre-fastmatch.c
==
--- head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 20:39:33 2017
(r317703)
+++ head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 20:44:06 2017
(r317704)
@@ -98,6 +98,18 @@ static int   fastcmp(const fastmatch_t *fg
 fg->pattern[siz] = '\0';   \
   }\
 
+#define CONV_MBS_PAT(src, dest, destsz)
\
+  {\
+destsz = wcstombs(NULL, src, 0);   \
+if (destsz == (size_t)-1)  \
+  return REG_BADPAT;   \
+dest = malloc(destsz + 1); \
+if (dest == NULL)  \
+  return REG_ESPACE;   \
+wcstombs(dest, src, destsz);   \
+dest[destsz] = '\0';   \
+  }\
+
 #define IS_OUT_OF_BOUNDS   \
   ((!fg->reversed  \
 ? ((type == STR_WIDE) ? ((j + fg->wlen) > len) \
@@ -723,15 +735,29 @@ badpat:
}
 
   escaped = false;
-  for (unsigned int i = 0; i < fg->len; i++)
-   if (fg->pattern[i] == '\\')
- escaped = !escaped;
-   else if (fg->pattern[i] == '.' && fg->escmap && escaped)
+  char *_checkpat = NULL;
+  size_t _checklen = 0;
+  unsigned int escofs = 0;
+  /*
+   * Make a copy here of the original pattern, because fg->pattern has
+   * already been stripped of all escape sequences in the above processing.
+   * This is necessary if we wish to later treat fg->escmap as an actual,
+   * functional replacement of fg->wescmap.
+   */
+  CONV_MBS_PAT(pat, _checkpat, _checklen);
+  for (unsigned int i = 0; i < n; i++)
+   if (_checkpat[i] == '\\')
+ {
+   escaped = !escaped;
+   if (escaped)
+ ++escofs;
+ }
+   else if (_checkpat[i] == '.' && fg->escmap != NULL && escaped)
  {
-   fg->escmap[i] = true;
+   fg->escmap[i - escofs] = true;
escaped = false;
  }
-   else if (fg->pattern[i] == '.' && !escaped)
+   else if (_checkpat[i] == '.' && !escaped)
  {
hasdot = i;
if (firstdot == -1)
@@ -739,6 +765,7 @@ badpat:
  }
else
  escaped = false;
+  free(_checkpat);
 }
 #else
   SAVE_PATTERN(tmp, pos, fg->pattern, fg->len);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Konstantin Belousov
On Tue, May 02, 2017 at 02:36:24PM -0600, Ian Lepore wrote:
> On Tue, 2017-05-02 at 22:45 +0300, Konstantin Belousov wrote:
> > +is always signed, it is 64-bits everywere except on i386 and 32-bit
> > powerpc.
> 
> s/everywere/everywhere/

Fixed, thank you.

diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
index 1ce397a303e..7cb05ea5271 100644
--- a/share/man/man7/arch.7
+++ b/share/man/man7/arch.7
@@ -37,6 +37,8 @@ Differences between CPU architectures and platforms supported 
by
 .Fx .
 .Pp
 .Ss Type sizes
+If not explicitely mentioned, sizes are in bytes.
+.Pp
 On all supported architectures,
 .Bl -column -offset -indent "long long" "Size"
 .It Sy Type Ta Sy Size
@@ -47,8 +49,10 @@ On all supported architectures,
 .It float Ta 4
 .It double Ta 8
 .El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)" "Sy sizeof(time_t)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.Pp
+Machine-dependent type sizes:
+.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy 
time_t"
+.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
 .It amd64   Ta 8 Ta 16 Ta 8
 .It arm Ta 4 Ta  8 Ta 8
 .It armeb   Ta 4 Ta  8 Ta 8
@@ -69,6 +73,9 @@ On all supported architectures,
 .It riscv   Ta 8 Ta 16 Ta 8
 .It sparc64 Ta 8 Ta 16 Ta 8
 .El
+.Pp
+.Sy time_t
+is always signed, it is 64-bits everywhere except on i386 and 32-bit powerpc.
 .Ss Endianness and Char Signedness
 .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char 
Signedness"
 .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317703 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep usr.bin/grep/tests

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 20:39:33 2017
New Revision: 317703
URL: https://svnweb.freebsd.org/changeset/base/317703

Log:
  bsdgrep: fix -w flag matching with an empty pattern
  
  -w flag matching with an empty pattern was generally 'broken', allowing
  matches to occur on any line whether or not it actually matches -w
  criteria.
  
  This fix required a good amount of refactoring to address.  procline()
  is altered to *only* process the line and return whether it was a match
  or not, necessary to be able to short-circuit the whole function in case
  of this matchall flag. -m flag handling is moved out as well because it
  suffers from the same fate as context handling if we bypass any actual
  pattern matching.
  
  The matching context (matches, mostly) didn't previously exist outside
  of procline(), so we go ahead and create context object for file
  processing bits to pass around.  grep_printline() was created due to
  this, for the scenarios where the matches don't actually matter and we
  just want to print a line or two, a la flushing the context queue and
  no -o or --color specified.
  
  Damage from this broken behavior would have been mitigated by the fact
  that it is unlikely users would invoke grep -w with an empty pattern.
  
  This was identified while checking PR 105221 for problems it this may
  cause in BSD grep, but PR 105221 is *not* a report of this behavior.
  
  Submitted by: Kyle Evans 
  Differential Revision:https://reviews.freebsd.org/D10433

Added:
  head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in   (contents, props 
changed)
  head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out   (contents, props 
changed)
  head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out   (contents, props 
changed)
  head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out   (contents, props 
changed)
Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
  head/usr.bin/grep/grep.c
  head/usr.bin/grep/grep.h
  head/usr.bin/grep/queue.c
  head/usr.bin/grep/tests/Makefile
  head/usr.bin/grep/util.c

Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in   Tue May  2 
20:39:33 2017(r317703)
@@ -0,0 +1,10 @@
+monkey
+banana
+apple
+fruit
+monkey
+banna
+apple
+fruit
+apple
+monkey

Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out  Tue May  2 
20:39:33 2017(r317703)
@@ -0,0 +1,9 @@
+monkey
+banana
+apple
+fruit
+monkey
+banna
+--
+apple
+monkey

Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out  Tue May  2 
20:39:33 2017(r317703)
@@ -0,0 +1,9 @@
+monkey
+banana
+apple
+fruit
+monkey
+banna
+apple
+fruit
+apple

Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out  Tue May  2 
20:39:33 2017(r317703)
@@ -0,0 +1,8 @@
+apple
+fruit
+--
+banna
+apple
+fruit
+apple
+monkey

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue May  2 20:38:10 
2017(r317702)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue May  2 20:39:33 
2017(r317703)
@@ -171,6 +171,12 @@ context_body()
atf_check -o file:d_context_b.out grep -A3 tilt d_context_a.in
atf_check -o file:d_context_c.out grep -B4 Whig d_context_a.in
atf_check -o file:d_context_d.out grep -C1 pig d_context_a.in 
d_context_b.in
+   atf_check -o file:d_context_e.out \
+   grep -E -C1 '(banana|monkey)' d_context_e.in
+   atf_check -o file:d_context_f.out \
+   grep -Ev -B2 '(banana|monkey|fruit)' d_context_e.in
+   atf_check -o file:d_context_g.out \
+   grep -Ev -A1 '(banana|monkey|fruit)' d_context_e.in
 }
 
 atf_test_case file_exp
@@ -386,6 +392,32 @@ zerolen_body()
atf_check -o inline:"Eggs\nCheese\n" grep -v -e "^$" test1
 }
 
+atf_test_case wflag_emptypat
+wflag_emptypat_head()
+{
+   atf_set "descr" "Check for proper handling of -w with an empty pattern 
(PR 105221)"
+}
+wflag_emptypat_body()
+{
+   grep_type
+   if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then
+   atf_expect_fail 

svn commit: r317702 - in head/sys: conf dev/cxgbe dev/cxgbe/common modules/cxgbe/if_cxgbe

2017-05-02 Thread Navdeep Parhar
Author: np
Date: Tue May  2 20:38:10 2017
New Revision: 317702
URL: https://svnweb.freebsd.org/changeset/base/317702

Log:
  cxgbe(4): Support routines for Tx traffic scheduling.
  
  - Create a new file, t4_sched.c, and move all of the code related to
traffic management from t4_main.c and t4_sge.c to this file.
  - Track both Channel Rate Limiter (ch_rl) and Class Rate Limiter (cl_rl)
parameters in the PF driver.
  - Initialize all the cl_rl limiters with somewhat arbitrary default
rates and provide routines to update them on the fly.
  - Provide routines to reserve and release traffic classes.
  
  MFC after:1 month
  Sponsored by: Chelsio Communications

Added:
  head/sys/dev/cxgbe/t4_sched.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/t4_vf.c
  head/sys/modules/cxgbe/if_cxgbe/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue May  2 20:08:04 2017(r317701)
+++ head/sys/conf/files Tue May  2 20:38:10 2017(r317702)
@@ -1331,6 +1331,8 @@ dev/cxgbe/t4_main.c   optional cxgbe pci 
compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_netmap.c  optional cxgbe pci \
compile-with "${NORMAL_C} -I$S/dev/cxgbe"
+dev/cxgbe/t4_sched.c   optional cxgbe pci \
+   compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_sge.c optional cxgbe pci \
compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_l2t.c optional cxgbe pci \

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hTue May  2 20:08:04 2017
(r317701)
+++ head/sys/dev/cxgbe/adapter.hTue May  2 20:38:10 2017
(r317702)
@@ -231,15 +231,36 @@ struct vi_info {
uint8_t hw_addr[ETHER_ADDR_LEN]; /* factory MAC address, won't change */
 };
 
+struct tx_ch_rl_params {
+   enum fw_sched_params_rate ratemode; /* %port (REL) or kbps (ABS) */
+   uint32_t maxrate;
+};
+
 enum {
-   /* tx_sched_class flags */
-   TX_SC_OK= (1 << 0), /* Set up in hardware, active. */
+   TX_CLRL_REFRESH = (1 << 0), /* Need to update hardware state. */
+   TX_CLRL_ERROR   = (1 << 1), /* Error, hardware state unknown. */
 };
 
-struct tx_sched_class {
+struct tx_cl_rl_params {
int refcount;
-   int flags;
-   struct t4_sched_class_params params;
+   u_int flags;
+   enum fw_sched_params_rate ratemode; /* %port REL or ABS value */
+   enum fw_sched_params_unit rateunit; /* kbps or pps (when ABS) */
+   enum fw_sched_params_mode mode; /* aggr or per-flow */
+   uint32_t maxrate;
+   uint16_t pktsize;
+};
+
+/* Tx scheduler parameters for a channel/port */
+struct tx_sched_params {
+   /* Channel Rate Limiter */
+   struct tx_ch_rl_params ch_rl;
+
+   /* Class WRR */
+   /* XXX */
+
+   /* Class Rate Limiter */
+   struct tx_cl_rl_params cl_rl[];
 };
 
 struct port_info {
@@ -251,7 +272,7 @@ struct port_info {
int up_vis;
int uld_vis;
 
-   struct tx_sched_class *tc;  /* traffic classes for this channel */
+   struct tx_sched_params *sched_params;
 
struct mtx pi_lock;
char lockname[16];
@@ -825,6 +846,9 @@ struct adapter {
 
struct memwin memwin[NUM_MEMWIN];   /* memory windows */
 
+   struct mtx tc_lock;
+   struct task tc_task;
+
const char *last_op;
const void *last_op_thr;
int last_op_flags;
@@ -1106,8 +1130,6 @@ int t4_detach_common(device_t);
 int t4_filter_rpl(struct sge_iq *, const struct rss_header *, struct mbuf *);
 int t4_map_bars_0_and_4(struct adapter *);
 int t4_map_bar_2(struct adapter *);
-int t4_set_sched_class(struct adapter *, struct t4_sched_params *);
-int t4_set_sched_queue(struct adapter *, struct t4_sched_queue *);
 int t4_setup_intr_handlers(struct adapter *);
 void t4_sysctls(struct adapter *);
 int begin_synchronized_op(struct adapter *, struct vi_info *, int, char *);
@@ -1168,6 +1190,15 @@ int t4_set_tracer(struct adapter *, stru
 int t4_trace_pkt(struct sge_iq *, const struct rss_header *, struct mbuf *);
 int t5_trace_pkt(struct sge_iq *, const struct rss_header *, struct mbuf *);
 
+/* t4_sched.c */
+int t4_set_sched_class(struct adapter *, struct t4_sched_params *);
+int t4_set_sched_queue(struct adapter *, struct t4_sched_queue *);
+int t4_init_tx_sched(struct adapter *);
+int t4_free_tx_sched(struct adapter *);
+void t4_update_tx_sched(struct adapter *);
+int t4_reserve_cl_rl_kbps(struct adapter *, int, u_int, int *);
+void t4_release_cl_rl_kbps(struct adapter *, int, int);
+
 static inline struct wrqe *
 

Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Ian Lepore
On Tue, 2017-05-02 at 22:45 +0300, Konstantin Belousov wrote:
> +is always signed, it is 64-bits everywere except on i386 and 32-bit
> powerpc.

s/everywere/everywhere/

-- Ian

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


svn commit: r317701 - head/usr.bin/grep/regex

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 20:08:04 2017
New Revision: 317701
URL: https://svnweb.freebsd.org/changeset/base/317701

Log:
  bsdgrep: correct test sense from r317700
  
  Kyle's change in review D10098 was correct. I introduced the error when
  extracting a portion of that change.

Modified:
  head/usr.bin/grep/regex/tre-fastmatch.c

Modified: head/usr.bin/grep/regex/tre-fastmatch.c
==
--- head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 19:56:42 2017
(r317700)
+++ head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 20:08:04 2017
(r317701)
@@ -715,7 +715,7 @@ badpat:
   if (fg->wescmap != NULL)
{
  fg->escmap = calloc(fg->len, sizeof(bool));
- if (fg->escmap != NULL)
+ if (fg->escmap == NULL)
{
  tre_free_fast(fg);
  return REG_ESPACE;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317700 - head/usr.bin/grep/regex

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 19:56:42 2017
New Revision: 317700
URL: https://svnweb.freebsd.org/changeset/base/317700

Log:
  bsdgrep: use calloc where appropriate in grep's tre-fastmatch
  
  Also apply style(9) to a related NULL check.
  
  Submitted by: Kyle Evans  (D10098)

Modified:
  head/usr.bin/grep/regex/tre-fastmatch.c

Modified: head/usr.bin/grep/regex/tre-fastmatch.c
==
--- head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 19:30:42 2017
(r317699)
+++ head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 19:56:42 2017
(r317700)
@@ -630,7 +630,7 @@ tre_compile_fast(fastmatch_t *fg, const 
if (escaped)
  {
if (!_escmap)
- _escmap = malloc(n * sizeof(bool));
+ _escmap = calloc(n, sizeof(bool));
if (!_escmap)
  {
free(tmp);
@@ -714,8 +714,8 @@ badpat:
 {
   if (fg->wescmap != NULL)
{
- fg->escmap = malloc(fg->len * sizeof(bool));
- if (!fg->escmap)
+ fg->escmap = calloc(fg->len, sizeof(bool));
+ if (fg->escmap != NULL)
{
  tre_free_fast(fg);
  return REG_ESPACE;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Konstantin Belousov
On Wed, May 03, 2017 at 04:41:52AM +1000, Bruce Evans wrote:
> It would be good to mention that the type of time_t is signed somewhere.
> There is a whole column for the signedess of char in another table.
> Signedness can be given consisely using some markup like -8 or 8- for
> signed.  The scale (often bytes or bits) could be given similarly.  E.g,
> 8-B could mean signed 8 bits and 80.b could mean 80 bits floating pint.
> 
> The Page Size table says "Page Sizes" redundantly in 1 column but doesn't
> gives units, and depends on everyone knowing that 4K is real K and bytes.
I added a note at the very beginning, saying that sizes are in bytes.
For time_t, I added a short narration besides the table data.

> 
> The Floating Point table already doesn't say "sizeof()" in the header but
[omited, I do not want to change the scope of the fix]

diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
index 1ce397a303e..ad1abccc2e5 100644
--- a/share/man/man7/arch.7
+++ b/share/man/man7/arch.7
@@ -37,6 +37,8 @@ Differences between CPU architectures and platforms supported 
by
 .Fx .
 .Pp
 .Ss Type sizes
+If not explicitely mentioned, sizes are in bytes.
+.Pp
 On all supported architectures,
 .Bl -column -offset -indent "long long" "Size"
 .It Sy Type Ta Sy Size
@@ -47,8 +49,10 @@ On all supported architectures,
 .It float Ta 4
 .It double Ta 8
 .El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)" "Sy sizeof(time_t)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.Pp
+Machine-dependent type sizes:
+.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy 
time_t"
+.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
 .It amd64   Ta 8 Ta 16 Ta 8
 .It arm Ta 4 Ta  8 Ta 8
 .It armeb   Ta 4 Ta  8 Ta 8
@@ -69,6 +73,9 @@ On all supported architectures,
 .It riscv   Ta 8 Ta 16 Ta 8
 .It sparc64 Ta 8 Ta 16 Ta 8
 .El
+.Pp
+.Sy time_t
+is always signed, it is 64-bits everywere except on i386 and 32-bit powerpc.
 .Ss Endianness and Char Signedness
 .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char 
Signedness"
 .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317696 - head/sys/net

2017-05-02 Thread Alexander Motin
Author: mav
Date: Tue May  2 19:09:11 2017
New Revision: 317696
URL: https://svnweb.freebsd.org/changeset/base/317696

Log:
  Introduce sleepable locks into if_lagg.
  
  Before this change if_lagg was using nonsleepable rmlocks to protect its
  internal state.  This patch introduces another sx lock to protect code
  paths that require sleeping, while still uses old rmlock to protect hot
  nonsleepable data paths.
  
  This change allows to remove taskqueue decoupling used before to change
  interface addresses without holding the lock.  Instead it uses sx lock to
  protect direct if_ioctl() calls.
  
  As another bonus, the new code synchronizes enabled capabilities of member
  interfaces, and allows to control them with ifconfig laggX, that was
  impossible before.  This part should fix interoperation with if_bridge,
  that may need to disable some capabilities, such as TXCSUM or LRO, to allow
  bridging with noncapable interfaces.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D10514

Modified:
  head/sys/net/if_lagg.c
  head/sys/net/if_lagg.h

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Tue May  2 18:40:41 2017(r317695)
+++ head/sys/net/if_lagg.c  Tue May  2 19:09:11 2017(r317696)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -99,10 +100,7 @@ static VNET_DEFINE(struct if_clone *, la
 #defineV_lagg_cloner   VNET(lagg_cloner)
 static const char laggname[] = "lagg";
 
-static voidlagg_lladdr(struct lagg_softc *, uint8_t *);
 static voidlagg_capabilities(struct lagg_softc *);
-static voidlagg_port_lladdr(struct lagg_port *, uint8_t *, lagg_llqtype);
-static voidlagg_port_setlladdr(void *, int);
 static int lagg_port_create(struct lagg_softc *, struct ifnet *);
 static int lagg_port_destroy(struct lagg_port *, int);
 static struct mbuf *lagg_input(struct ifnet *, struct mbuf *);
@@ -124,8 +122,9 @@ static int  lagg_snd_tag_alloc(struct ifn
union if_snd_tag_alloc_params *,
struct m_snd_tag **);
 #endif
-static int lagg_ether_setmulti(struct lagg_softc *);
-static int lagg_ether_cmdmulti(struct lagg_port *, int);
+static int lagg_setmulti(struct lagg_port *);
+static int lagg_clrmulti(struct lagg_port *);
+static int lagg_setcaps(struct lagg_port *, int cap);
 static int lagg_setflag(struct lagg_port *, int, int,
int (*func)(struct ifnet *, int));
 static int lagg_setflags(struct lagg_port *, int status);
@@ -317,6 +316,7 @@ static void
 lagg_proto_attach(struct lagg_softc *sc, lagg_proto pr)
 {
 
+   LAGG_XLOCK_ASSERT(sc);
KASSERT(sc->sc_proto == LAGG_PROTO_NONE, ("%s: sc %p has proto",
__func__, sc));
 
@@ -333,8 +333,8 @@ lagg_proto_detach(struct lagg_softc *sc)
 {
lagg_proto pr;
 
+   LAGG_XLOCK_ASSERT(sc);
LAGG_WLOCK_ASSERT(sc);
-
pr = sc->sc_proto;
sc->sc_proto = LAGG_PROTO_NONE;
 
@@ -433,15 +433,14 @@ lagg_register_vlan(void *arg, struct ifn
 {
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
-   struct rm_priotracker tracker;
 
if (ifp->if_softc !=  arg)   /* Not our event */
return;
 
-   LAGG_RLOCK(sc, );
+   LAGG_SLOCK(sc);
SLIST_FOREACH(lp, >sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
-   LAGG_RUNLOCK(sc, );
+   LAGG_SUNLOCK(sc);
 }
 
 /*
@@ -453,15 +452,14 @@ lagg_unregister_vlan(void *arg, struct i
 {
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
-   struct rm_priotracker tracker;
 
if (ifp->if_softc !=  arg)   /* Not our event */
return;
 
-   LAGG_RLOCK(sc, );
+   LAGG_SLOCK(sc);
SLIST_FOREACH(lp, >sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
-   LAGG_RUNLOCK(sc, );
+   LAGG_SUNLOCK(sc);
 }
 
 static int
@@ -477,7 +475,10 @@ lagg_clone_create(struct if_clone *ifc, 
free(sc, M_DEVBUF);
return (ENOSPC);
}
+   LAGG_LOCK_INIT(sc);
+   LAGG_SX_INIT(sc);
 
+   LAGG_XLOCK(sc);
if (V_def_use_flowid)
sc->sc_opts |= LAGG_OPT_USE_FLOWID;
sc->flowid_shift = V_def_flowid_shift;
@@ -487,9 +488,7 @@ lagg_clone_create(struct if_clone *ifc, 
 
lagg_proto_attach(sc, LAGG_PROTO_DEFAULT);
 
-   LAGG_LOCK_INIT(sc);
SLIST_INIT(>sc_ports);
-   TASK_INIT(>sc_lladdr_task, 0, lagg_port_setlladdr, sc);
 
/* Initialise pseudo media types */
ifmedia_init(>sc_media, 0, lagg_media_change,
@@ -527,6 +526,7 @@ lagg_clone_create(struct if_clone *ifc, 
LAGG_LIST_LOCK();
SLIST_INSERT_HEAD(_lagg_list, sc, 

Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Ed Maste wrote:


On 2 May 2017 at 12:35, Bruce Evans  wrote:


-current man can't handle macros like "Sy" with -width or some other
things including the things used above.  This causes it to produce
excessive column spacing.  The formatting is bad enough without this
(verbose headers but all columns except "Architecture" have only 1-2
digits).  -current man just considers "Sy " as literal and increases
the column spacing by 3, giving a spacing of 7 columns instead of 4,
where we really want a negative number but 2 would work OK.


We discussed this in review D7261. I created arch.7 with ".Sy based on
an example from FreeBSD 10's mdoc(7). In D7261 I noted that there were
existing man pages with both ".Sy and "Sy .


All examples in at least FreeBSD-5's mdoc(7) use ".Sy" if it is the first
macro in a ``subsection''.  "Sy" is used more often but not as the first
macro.  Typically after '.It'.


Do you believe we should remove them altogether?


I think you mean "all of them in .Bl and similar macros".  I don't like
removing features that once worked.  Someone might be using them.  I
only noticed that I was using this one when it stopped working :-).

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


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Wed, May 03, 2017 at 02:35:17AM +1000, Bruce Evans wrote:

On Tue, 2 May 2017, Konstantin Belousov wrote:


Log:
 Document time_t size.

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Tue May  2 14:52:28 2017(r317680)
+++ head/share/man/man7/arch.7  Tue May  2 14:52:35 2017(r317681)
@@ -47,27 +47,27 @@ On all supported architectures,
.It float Ta 4
.It double Ta 8
.El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long 
double)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double)
...
+.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long 
double)" "Sy sizeof(time_t)"
+.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.It amd64   Ta 8 Ta 16 Ta 8
+.It arm Ta 4 Ta  8 Ta 8


Verbose types mess up the formatting of man pages too.

The header is obviously too long.  -current man misformats it to 91 columns
on 80-column terminals.  FreeBSD-5 man respects COLUMNS, but mangles the
header more completely to do this (1).


I removed excessive sizeof(), which fixed width.


Hmm.  It leaves no mention of the scale.  More below.


diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
index 1ce397a303e..73552d60209 100644
--- a/share/man/man7/arch.7
+++ b/share/man/man7/arch.7
@@ -47,8 +47,10 @@ On all supported architectures,
.It float Ta 4
.It double Ta 8
.El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long 
double)" "Sy sizeof(time_t)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.Pp
+Machine-depended type's sizes:
+.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy 
time_t"
+.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t


Remove the buggy Sy's too.


.It amd64   Ta 8 Ta 16 Ta 8
.It arm Ta 4 Ta  8 Ta 8
.It armeb   Ta 4 Ta  8 Ta 8


It would be good to mention that the type of time_t is signed somewhere.
There is a whole column for the signedess of char in another table.
Signedness can be given consisely using some markup like -8 or 8- for
signed.  The scale (often bytes or bits) could be given similarly.  E.g,
8-B could mean signed 8 bits and 80.b could mean 80 bits floating pint.

The Page Size table says "Page Sizes" redundantly in 1 column but doesn't
gives units, and depends on everyone knowing that 4K is real K and bytes.

The Floating Point table already doesn't say "sizeof()" in the header but
gives a lot of details including units in some cases in the values.  The
long double in the table that you changed would be better placed in the
FP table, except it is short of space too.  The size info for a long double
on {amd64,i386} is in 2 tables in different incomplete forms:
- first table gives sizes {16, 12} with no mention of either sizes or units;
  these are object sizes in bytes
- second table gives values {80, 80} with no mention of sizes but mention of
  bits; these are the unpadded object/register sizes (not really available
  in C), expressed in different units.  This column in the table is mostly
  about the precision.  It says "double precision" in some places, "identical
  to double" in others, and "quad precision" for arm64 and sparc64 ("hard"
  for sparc64 is broken.  sparc64 can have either, but the default is soft
  since hard it is rearely or never implemented in hardware and is emulated
  even more slowly by doing it softly in trap handlers).  The 80's for
  amd64 and i386 are don't give the precision like the others.  The precision
  is 64 bits, and the 80-bit size is not really available in C.

  Better table entries would be something like

  (hard | soft), (8 | 10 | 12 | 16) bytes, (53 | 64 | 113) bit precision

  or for the longest case "hard, 16 bytes, 113 bit precision".  There is
  just enough space for this after removing the Sy's.  I don't like the
  duplication in this.  So better go back to "identical to double" where
  it applies, and apply it more.  Double is described as just hard or soft
  with no mention that the precision is always 53 bits (this should be
  in the ealier table of MI sizes).  Long double is then the same on some
  arches.

arm64 doesn't have an _fpmath.h for it in libc, so I don't see how it
can have the soft quad precision claimed in the table.  Similarly in
msun/arm/Makefile.inc.

riscv has an _fpmath.h stating quad precision, but isn't in any table in
arch.7.  This _fpmath.h seems quite buggy, with inconsistent commenting
out and macros not matching the struct, so I don't see how it can work
either.  msun/riscv/Makefile.inc claims 113 bits, and the struct is
consistent with this,  but the macros consistent with this are commented
out, so I don't see how it can compile.

aarch64 is like riscv except its _fpmath.h seems to be 

svn commit: r317695 - head/sys/vm

2017-05-02 Thread Konstantin Belousov
Author: kib
Date: Tue May  2 18:40:41 2017
New Revision: 317695
URL: https://svnweb.freebsd.org/changeset/base/317695

Log:
  Emulate pre-r317061 ABI.
  
  This restores 32bit-sized accesses to vmcnt sysctls, making old
  binaries like top(1), systat(8) and reboot(8) mostly functional on
  newer kernel.
  
  Reviewed by:  bde
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/vm/vm_meter.c

Modified: head/sys/vm/vm_meter.c
==
--- head/sys/vm/vm_meter.c  Tue May  2 18:37:11 2017(r317694)
+++ head/sys/vm/vm_meter.c  Tue May  2 18:40:41 2017(r317695)
@@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, 
"VM meter vm stats");
 SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");
 
+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t val;
+#ifdef COMPAT_FREEBSD11
+   uint32_t val32;
+#endif
+
+   val = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(val32)) {
+   val32 = val;/* truncate */
+   return (SYSCTL_OUT(req, , sizeof(val32)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(val)));
+}
+
 #defineVM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
 #defineVM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, 
descr)
 #defineVM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, 
descr)
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317694 - head/contrib/netbsd-tests/usr.bin/grep

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 18:37:11 2017
New Revision: 317694
URL: https://svnweb.freebsd.org/changeset/base/317694

Log:
  bsdgrep: revise test case which will soon become a failure
  
  Work in progress (D10315) is going to make egrep_empty_invalid an
  actually invalid regex, to be consistent with the equivalent BRE "{"
  behavior, when using regex(3).
  
  Any non-0 exit value is acceptable, depending on how the installed grep
  interprets the expression. GNU grep interprets it as non-matching, and
  in the future BSD grep will interpret it is an error.
  
  Submitted by: Kyle Evans 
  Reviewed by:  cem, ngie
  Differential Revision:https://reviews.freebsd.org/D10572`

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue May  2 18:31:26 
2017(r317693)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue May  2 18:37:11 
2017(r317694)
@@ -369,7 +369,7 @@ egrep_empty_invalid_head()
 }
 egrep_empty_invalid_body()
 {
-   atf_check -s exit:1 egrep '{' /dev/null
+   atf_check -e ignore -s not-exit:0 egrep '{' /dev/null
 }
 
 atf_test_case zerolen
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Konstantin Belousov
On Tue, May 02, 2017 at 02:04:09PM -0400, Ed Maste wrote:
> > +Machine-depended type's sizes:
> 
> Probably "Machine-dependent type sizes"

Sure.

diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
index 1ce397a303e..f30dfbb8145 100644
--- a/share/man/man7/arch.7
+++ b/share/man/man7/arch.7
@@ -47,8 +47,10 @@ On all supported architectures,
 .It float Ta 4
 .It double Ta 8
 .El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)" "Sy sizeof(time_t)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.Pp
+Machine-dependent type sizes:
+.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy 
time_t"
+.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
 .It amd64   Ta 8 Ta 16 Ta 8
 .It arm Ta 4 Ta  8 Ta 8
 .It armeb   Ta 4 Ta  8 Ta 8
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Ed Maste
On 2 May 2017 at 12:35, Bruce Evans  wrote:
>
> -current man can't handle macros like "Sy" with -width or some other
> things including the things used above.  This causes it to produce
> excessive column spacing.  The formatting is bad enough without this
> (verbose headers but all columns except "Architecture" have only 1-2
> digits).  -current man just considers "Sy " as literal and increases
> the column spacing by 3, giving a spacing of 7 columns instead of 4,
> where we really want a negative number but 2 would work OK.

We discussed this in review D7261. I created arch.7 with ".Sy based on
an example from FreeBSD 10's mdoc(7). In D7261 I noted that there were
existing man pages with both ".Sy and "Sy .

Do you believe we should remove them altogether?

On 2 May 2017 at 13:44, Konstantin Belousov  wrote:
>
> I removed excessive sizeof(), which fixed width.
>
> diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
> index 1ce397a303e..73552d60209 100644
> --- a/share/man/man7/arch.7
> +++ b/share/man/man7/arch.7
> @@ -47,8 +47,10 @@ On all supported architectures,
>  .It float Ta 4
>  .It double Ta 8
>  .El
> -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
> sizeof(long double)" "Sy sizeof(time_t)"
> -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
> sizeof(time_t)
> +.Pp
> +Machine-depended type's sizes:

Probably "Machine-dependent type sizes"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Wed, May 03, 2017 at 01:31:10AM +1000, Bruce Evans wrote:



On Tue, 2 May 2017, Konstantin Belousov wrote:
I also thought of changing the scale when the values get high.  The values
would increase slower above about 2G instead of stabilizing at 4G-1.
This is basically floating point and too complicated since nothing would
understand it.

Which counters wrap faster than a reasonable refresh interval of 1-10
seconds (which should be shorter if wrapping is a problem)?

Things like various counters for pages freed due to a reason can.  E.g.
freed due to the process exit is the counter which I saw changing fast.


4 billion page operations/second or 10 is impossible. It is difficult
to even increment a register to count events that fast.


Wire counts might fluctuate relatively quickly, but I think that wiring
is slower.  Unwiring might be fast.


The need to zero pages before reuse limits the speed.


I just noticed that this sysctl is r/o (I thought I was preserving support
for resetting 64-bit counters using a 32-bit size in my fix in
sysctl_handle_counter_64().  That function has the dubious feature of not
checking the size, so it allows writes of any length (0 to SIZE_MAX,
possibly larger than the user data) to reset the counter to zero.)

The r/o misfeature goes back to at least FreeBSD-3.  64-bit counters need
resetting less than 32-bit ones, and it is more useful to ever reset them
since they can hold the full counts since boot time, but there is no reason
to limit resetting them now that the low-level code supports it.  Is there
already a better atomic reset of all vm stats?


I do not see why vmstat counters ever need to be reset.  I do not think
that truncating the value to present small values to 32bit readers is
a reasonable cause.


It would be mostly for presenting a consistent set of values.


diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..b4666a400b2 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");

+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t val;
+#ifdef COMPAT_FREEBSD11
+   uint32_t val32;
+#endif
+
+   val = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(val32)) {
+   val32 = val;/* truncate */
+   return (SYSCTL_OUT(req, , sizeof(val32)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(val)));
+}
+
#define VM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
#define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr)
#define VM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, descr)


OK.

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


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Konstantin Belousov
On Wed, May 03, 2017 at 02:35:17AM +1000, Bruce Evans wrote:
> On Tue, 2 May 2017, Konstantin Belousov wrote:
> 
> > Log:
> >  Document time_t size.
> >
> > Modified: head/share/man/man7/arch.7
> > ==
> > --- head/share/man/man7/arch.7  Tue May  2 14:52:28 2017
> > (r317680)
> > +++ head/share/man/man7/arch.7  Tue May  2 14:52:35 2017
> > (r317681)
> > @@ -47,27 +47,27 @@ On all supported architectures,
> > .It float Ta 4
> > .It double Ta 8
> > .El
> > -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
> > sizeof(long double)"
> > -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double)
> > ...
> > +.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
> > sizeof(long double)" "Sy sizeof(time_t)"
> > +.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
> > sizeof(time_t)
> > +.It amd64   Ta 8 Ta 16 Ta 8
> > +.It arm Ta 4 Ta  8 Ta 8
> 
> Verbose types mess up the formatting of man pages too.
> 
> The header is obviously too long.  -current man misformats it to 91 columns
> on 80-column terminals.  FreeBSD-5 man respects COLUMNS, but mangles the
> header more completely to do this (1).

I removed excessive sizeof(), which fixed width.

diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
index 1ce397a303e..73552d60209 100644
--- a/share/man/man7/arch.7
+++ b/share/man/man7/arch.7
@@ -47,8 +47,10 @@ On all supported architectures,
 .It float Ta 4
 .It double Ta 8
 .El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)" "Sy sizeof(time_t)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.Pp
+Machine-depended type's sizes:
+.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy 
time_t"
+.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
 .It amd64   Ta 8 Ta 16 Ta 8
 .It arm Ta 4 Ta  8 Ta 8
 .It armeb   Ta 4 Ta  8 Ta 8
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317632 - head/sys

2017-05-02 Thread Ngie Cooper (yaneurabeya)

> On May 1, 2017, at 09:34, Warner Losh  wrote:
> 
> On Mon, May 1, 2017 at 10:30 AM, Rodney W. Grimes
>  wrote:
>>> Author: ngie
>>> Date: Mon May  1 05:59:52 2017
>>> New Revision: 317632
>>> URL: https://svnweb.freebsd.org/changeset/base/317632
>>> 
>>> Log:
>>>  Fix "make cscope-clean" when .OBJDIR already exists
>>> 
>>>  The cscope generated files are always put in .CURDIR .
>> 
>> If this is writing to src dir then it should be fixed,
>> or have we abandoned all hope of readonly src tree?
> 
> This is only for the cscope target, which isn't part of the normal build.
> 
> readonly src tree works great still….

Hi Rod,
I can’t personally vouch for readonly src trees working in all cases, 
but readonly src trees work well for installation purposes (I use readonly obj 
and src trees at work when installing over NFS).
As Warner noted, “make cscope” is a developer target that aids with 
building the cscope database in a consistent manner. It doesn’t conform to the 
existing “norms” of build targets in the tree; changing the behavior doesn’t 
seem prudent at this point in time because it would violate POLA.
Thanks!
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r317631 - head/sys

2017-05-02 Thread Ngie Cooper (yaneurabeya)

> On May 1, 2017, at 09:28, Rodney W. Grimes  
> wrote:
> 
>> Author: ngie
>> Date: Mon May  1 05:54:33 2017
>> New Revision: 317631
>> URL: https://svnweb.freebsd.org/changeset/base/317631
>> 
>> Log:
>>  Fix "make cscope" after r317411
> 
> This commit is disconnect netnatm module from build
> 
> ?  Mixed 2 commit messages perhaps?

No, it was intentional (I made the readers read between the lines as to 
why this commit was necessary, so mea culpa).
r317411 removed sys/netatm, which broke the “make cscope” target, as it 
tried to iterate down that directory with find and failed.
Thanks!
-Ngie

$ svn log -c r317411

r317411 | brooks | 2017-04-25 10:00:08 -0700 (Tue, 25 Apr 2017) | 4 lines

Remove directories made empty by NATM, EISA, and IEEE488 removals.

Reported by:ak

$ svn diff -c r317411 --summarize
D   sbin/atm/atmconfig
D   sbin/atm
D   sys/netnatm
D   sys/dev/eisa
D   sys/dev/fatm
D   sys/dev/hatm
D   sys/dev/patm/genrtab
D   sys/dev/patm
D   sys/dev/ahb
D   sys/dev/ieee488
D   sys/dev/en
D   sys/dev/utopia
D   sys/modules/fatm
D   sys/modules/hatm
D   sys/modules/patm
D   sys/modules/ahb
D   sys/modules/en
D   sys/modules/utopia
D   sys/modules/aic7xxx/ahc/ahc_eisa
D   sys/modules/netgraph/atm/atm
D   usr.sbin/bsnmpd/modules/snmp_atm


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r317682 - head/sbin/ipfw

2017-05-02 Thread Andrey V. Elsukov
Author: ae
Date: Tue May  2 17:16:24 2017
New Revision: 317682
URL: https://svnweb.freebsd.org/changeset/base/317682

Log:
  Add `ipfw table all destroy` support.
  
  PR:   212669
  MFC after:1 week

Modified:
  head/sbin/ipfw/ipfw.8
  head/sbin/ipfw/tables.c

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Tue May  2 14:52:35 2017(r317681)
+++ head/sbin/ipfw/ipfw.8   Tue May  2 17:16:24 2017(r317682)
@@ -50,7 +50,9 @@ in-kernel NAT.
 .Nm
 .Oo Cm set Ar N Oc Cm table Ar name Cm create Ar create-options
 .Nm
-.Oo Cm set Ar N Oc Cm table Ar name Cm destroy
+.Oo Cm set Ar N Oc Cm table
+.Brq Ar name | all
+.Cm destroy
 .Nm
 .Oo Cm set Ar N Oc Cm table Ar name Cm modify Ar modify-options
 .Nm

Modified: head/sbin/ipfw/tables.c
==
--- head/sbin/ipfw/tables.c Tue May  2 14:52:35 2017(r317681)
+++ head/sbin/ipfw/tables.c Tue May  2 17:16:24 2017(r317682)
@@ -54,6 +54,7 @@ static int table_swap(ipfw_obj_header *o
 static int table_get_info(ipfw_obj_header *oh, ipfw_xtable_info *i);
 static int table_show_info(ipfw_xtable_info *i, void *arg);
 
+static int table_destroy_one(ipfw_xtable_info *i, void *arg);
 static int table_flush_one(ipfw_xtable_info *i, void *arg);
 static int table_show_one(ipfw_xtable_info *i, void *arg);
 static int table_do_get_list(ipfw_xtable_info *i, ipfw_obj_header **poh);
@@ -132,7 +133,7 @@ lookup_host (char *host, struct in_addr 
  * This one handles all table-related commands
  * ipfw table NAME create ...
  * ipfw table NAME modify ...
- * ipfw table NAME destroy
+ * ipfw table {NAME | all} destroy
  * ipfw table NAME swap NAME
  * ipfw table NAME lock
  * ipfw table NAME unlock
@@ -200,6 +201,7 @@ ipfw_table_handler(int ac, char *av[])
case TOK_INFO:
case TOK_DETAIL:
case TOK_FLUSH:
+   case TOK_DESTROY:
break;
default:
if (is_all != 0)
@@ -223,13 +225,21 @@ ipfw_table_handler(int ac, char *av[])
table_modify(, ac, av);
break;
case TOK_DESTROY:
-   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);
+   if (is_all == 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);
+   } else {
+   error = tables_foreach(table_destroy_one, , 1);
+   if (error != 0)
+   err(EX_OSERR,
+   "failed to destroy tables list");
+   }
break;
case TOK_FLUSH:
if (is_all == 0) {
@@ -567,6 +577,22 @@ table_destroy(ipfw_obj_header *oh)
return (0);
 }
 
+static int
+table_destroy_one(ipfw_xtable_info *i, void *arg)
+{
+   ipfw_obj_header *oh;
+
+   oh = (ipfw_obj_header *)arg;
+   table_fill_ntlv(>ntlv, i->tablename, i->set, 1);
+   if (table_destroy(oh) != 0) {
+   if (co.do_quiet == 0)
+   warn("failed to destroy table(%s) in set %u",
+   i->tablename, i->set);
+   return (-1);
+   }
+   return (0);
+}
+
 /*
  * Flushes given table specified by @oh->ntlv.
  * Returns 0 on success.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Konstantin Belousov
On Wed, May 03, 2017 at 01:31:10AM +1000, Bruce Evans wrote:
> 
> 
> On Tue, 2 May 2017, Konstantin Belousov wrote:
> I also thought of changing the scale when the values get high.  The values
> would increase slower above about 2G instead of stabilizing at 4G-1.
> This is basically floating point and too complicated since nothing would
> understand it.
> 
> Which counters wrap faster than a reasonable refresh interval of 1-10
> seconds (which should be shorter if wrapping is a problem)?
Things like various counters for pages freed due to a reason can.  E.g.
freed due to the process exit is the counter which I saw changing fast.

Wire counts might fluctuate relatively quickly, but I think that wiring
is slower.  Unwiring might be fast.

> Style:
> - redundant cast.  Especially not needed with the commit.  Compilers might
>warn about this since they don't trust programmers, but don't because
>implicit downwards conversions are used often.
> - comment not indented
> 
> I would also omit the ifdefs, and rename 'out' to out64, and may rename
> 'out*' to val*.
Ok.

> I just noticed that this sysctl is r/o (I thought I was preserving support
> for resetting 64-bit counters using a 32-bit size in my fix in
> sysctl_handle_counter_64().  That function has the dubious feature of not
> checking the size, so it allows writes of any length (0 to SIZE_MAX,
> possibly larger than the user data) to reset the counter to zero.)
> 
> The r/o misfeature goes back to at least FreeBSD-3.  64-bit counters need
> resetting less than 32-bit ones, and it is more useful to ever reset them
> since they can hold the full counts since boot time, but there is no reason
> to limit resetting them now that the low-level code supports it.  Is there
> already a better atomic reset of all vm stats?

I do not see why vmstat counters ever need to be reset.  I do not think
that truncating the value to present small values to 32bit readers is
a reasonable cause.

diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..b4666a400b2 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
 SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");
 
+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t val;
+#ifdef COMPAT_FREEBSD11
+   uint32_t val32;
+#endif
+
+   val = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(val32)) {
+   val32 = val;/* truncate */
+   return (SYSCTL_OUT(req, , sizeof(val32)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(val)));
+}
+
 #defineVM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
 #defineVM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, 
descr)
 #defineVM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, 
descr)
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


Log:
 Document time_t size.

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Tue May  2 14:52:28 2017(r317680)
+++ head/share/man/man7/arch.7  Tue May  2 14:52:35 2017(r317681)
@@ -47,27 +47,27 @@ On all supported architectures,
.It float Ta 4
.It double Ta 8
.El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long 
double)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double)
...
+.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long 
double)" "Sy sizeof(time_t)"
+.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.It amd64   Ta 8 Ta 16 Ta 8
+.It arm Ta 4 Ta  8 Ta 8


Verbose types mess up the formatting of man pages too.

The header is obviously too long.  -current man misformats it to 91 columns
on 80-column terminals.  FreeBSD-5 man respects COLUMNS, but mangles the
header more completely to do this (1).

-current man can't handle macros like "Sy" with -width or some other
things including the things used above.  This causes it to produce
excessive column spacing.  The formatting is bad enough without this
(verbose headers but all columns except "Architecture" have only 1-2
digits).  -current man just considers "Sy " as literal and increases
the column spacing by 3, giving a spacing of 7 columns instead of 4,
where we really want a negative number but 2 would work OK.

Also, these Sy's have syntax errors.  They really are literals, since
they are not preceded by a dot.  With -current man, dots would unimprove
the formatting further by producing an extra column for each dot.
Perhaps that is why it is already left out (it might break other lists).
The syntax is something like ".Sy ... Architecture" where other macros
in "..." don't need (and shouldn't have?) dots.

Removing all 4 Sy's only reduces the column widths by 3*3, so the total
width to 82.  There is a different problem before the first collumn.
The Sy's are already not present in the previous -column directive,
and this might what causes different leading indentation for the
previous list.  But I didn't touch the Sy's in the later -column
directions, and all the following first columns line up with this one.

(1) gnu man/groff splits the long line in the middle of 'long double',
long before the new problem with time_t.  Before that, it produces the
same wrong separation of 7 columns.  It then prints a long line, with
87 blanks to misformat "double)" 1 line and 7 columns into the next
(in the middle of nowhere under "Architecture"), then a further 7 columns
to sizeof(time_t) in the middle of nowhere.  It prints a diagnostic
about not being able to split the long line.

Gnu man/groff does understand .Sy, but treats Sy as literal.  Changing the
Sy's to .Sy's doesn't work any better than removing them in this list,
but it improves all the other lists.

The formatting for the first list can be fixed by changing '-indent' in
it to 'indent' to match the other list.  This [-]indent controls
indentation in ways that I don't understand, but experiment shows that
the '-' in it gives an unwanted extra column of indentation, and adding
more minus signs gives more indentation.  The minus sign is only used
for the first list.

We really want outdentation.  I tried ++indent for that, but it gave
the same indentation as --indent.

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


Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Bruce Evans



On Tue, 2 May 2017, Konstantin Belousov wrote:


On Tue, May 02, 2017 at 11:31:21PM +1000, Bruce Evans wrote:

On Tue, 2 May 2017, Konstantin Belousov wrote:

ENOMEM is, of course, the situation which I want to avoid.


Then you have to return no error, but truncate the value instead of
clamping.  Anything else is incompatible.

I do not quite agree with the truncation part, bit I do not think that
it is too important. As I noted before, IMO the absolute numbers for
the counters have more values than per-interval diffs displayed by e.g.
systat. But if truncating causes less disagreement than clamping, lets
do truncation.


This is better.

I also thought of changing the scale when the values get high.  The values
would increase slower above about 2G instead of stabilizing at 4G-1.
This is basically floating point and too complicated since nothing would
understand it.

Which counters wrap faster than a reasonable refresh interval of 1-10
seconds (which should be shorter if wrapping is a problem)?


diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..6266ef670a6 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");

+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t out;
+#ifdef COMPAT_FREEBSD11
+   uint32_t out32;
+#endif
+
+   out = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(out32)) {
+   out32 = (uint32_t)out; /* truncate */


Style:
- redundant cast.  Especially not needed with the commit.  Compilers might
  warn about this since they don't trust programmers, but don't because
  implicit downwards conversions are used often.
- comment not indented

I would also omit the ifdefs, and rename 'out' to out64, and may rename
'out*' to val*.


+   return (SYSCTL_OUT(req, , sizeof(out32)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(out)));
+}
+
#define VM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
#define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr)
#define VM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, descr)


I just noticed that this sysctl is r/o (I thought I was preserving support
for resetting 64-bit counters using a 32-bit size in my fix in
sysctl_handle_counter_64().  That function has the dubious feature of not
checking the size, so it allows writes of any length (0 to SIZE_MAX,
possibly larger than the user data) to reset the counter to zero.)

The r/o misfeature goes back to at least FreeBSD-3.  64-bit counters need
resetting less than 32-bit ones, and it is more useful to ever reset them
since they can hold the full counts since boot time, but there is no reason
to limit resetting them now that the low-level code supports it.  Is there
already a better atomic reset of all vm stats?

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


svn commit: r317680 - head/sys/cam/scsi

2017-05-02 Thread Kenneth D. Merry
Author: ken
Date: Tue May  2 14:52:28 2017
New Revision: 317680
URL: https://svnweb.freebsd.org/changeset/base/317680

Log:
  Add the SCSI SSC Manufacturer assigned serial number VPD page.
  
  This is current as of SSC-5r03.
  
  Submitted by: Sam Klopsch
  MFC after:3 days

Modified:
  head/sys/cam/scsi/scsi_sa.h

Modified: head/sys/cam/scsi/scsi_sa.h
==
--- head/sys/cam/scsi/scsi_sa.h Tue May  2 13:47:15 2017(r317679)
+++ head/sys/cam/scsi/scsi_sa.h Tue May  2 14:52:28 2017(r317680)
@@ -487,6 +487,19 @@ struct scsi_medium_type_data {
 };
 
 /*
+ * Manufacturer-assigned Serial Number VPD page.
+ * Current as of SSC-5r03, 28 September 2016.
+ */
+struct scsi_vpd_mfg_serial_number
+{
+   u_int8_t device;
+   u_int8_t page_code;
+#defineSVPD_MFG_SERIAL_NUMBER_PAGE_CODE 0xB1
+   u_int8_t page_length[2];
+   u_int8_t mfg_serial_num[];
+};
+
+/*
  * Security Protocol Specific values for the Tape Data Encryption protocol
  * (0x20) used with SECURITY PROTOCOL IN.  See below for values used with
  * SECURITY PROTOCOL OUT.  Current as of SSC4r03.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Konstantin Belousov
Author: kib
Date: Tue May  2 14:52:35 2017
New Revision: 317681
URL: https://svnweb.freebsd.org/changeset/base/317681

Log:
  Document time_t size.
  
  Reviewed by:  emaste, imp, vangyzen
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D10568

Modified:
  head/share/man/man7/arch.7

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Tue May  2 14:52:28 2017(r317680)
+++ head/share/man/man7/arch.7  Tue May  2 14:52:35 2017(r317681)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 21, 2017
+.Dd May 2, 2017
 .Dt ARCH 7
 .Os
 .Sh NAME
@@ -47,27 +47,27 @@ On all supported architectures,
 .It float Ta 4
 .It double Ta 8
 .El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double)
-.It amd64   Ta 8 Ta 16
-.It arm Ta 4 Ta  8
-.It armeb   Ta 4 Ta  8
-.It armv6   Ta 4 Ta  8
-.It arm64   Ta 8 Ta 16
-.It i386Ta 4 Ta 12
-.It mipsTa 4 Ta  8
-.It mipsel  Ta 4 Ta  8
-.It mipselhfTa 4 Ta  8
-.It mipshf  Ta 4 Ta  8
-.It mipsn32 Ta 4 Ta  8
-.It mips64  Ta 8 Ta  8
-.It mips64elTa 8 Ta  8
-.It mips64elhf  Ta 8 Ta  8
-.It mips64hfTa 8 Ta  8
-.It powerpc Ta 4 Ta  8
-.It powerpc64   Ta 8 Ta  8
-.It riscv   Ta 8 Ta 16
-.It sparc64 Ta 8 Ta 16
+.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)" "Sy sizeof(time_t)"
+.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.It amd64   Ta 8 Ta 16 Ta 8
+.It arm Ta 4 Ta  8 Ta 8
+.It armeb   Ta 4 Ta  8 Ta 8
+.It armv6   Ta 4 Ta  8 Ta 8
+.It arm64   Ta 8 Ta 16 Ta 8
+.It i386Ta 4 Ta 12 Ta 4
+.It mipsTa 4 Ta  8 Ta 8
+.It mipsel  Ta 4 Ta  8 Ta 8
+.It mipselhfTa 4 Ta  8 Ta 8
+.It mipshf  Ta 4 Ta  8 Ta 8
+.It mipsn32 Ta 4 Ta  8 Ta 8
+.It mips64  Ta 8 Ta  8 Ta 8
+.It mips64elTa 8 Ta  8 Ta 8
+.It mips64elhf  Ta 8 Ta  8 Ta 8
+.It mips64hfTa 8 Ta  8 Ta 8
+.It powerpc Ta 4 Ta  8 Ta 4
+.It powerpc64   Ta 8 Ta  8 Ta 8
+.It riscv   Ta 8 Ta 16 Ta 8
+.It sparc64 Ta 8 Ta 16 Ta 8
 .El
 .Ss Endianness and Char Signedness
 .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char 
Signedness"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Konstantin Belousov
On Tue, May 02, 2017 at 11:31:21PM +1000, Bruce Evans wrote:
> On Tue, 2 May 2017, Konstantin Belousov wrote:
> > ENOMEM is, of course, the situation which I want to avoid.
> 
> Then you have to return no error, but truncate the value instead of
> clamping.  Anything else is incompatible.
I do not quite agree with the truncation part, bit I do not think that
it is too important. As I noted before, IMO the absolute numbers for
the counters have more values than per-interval diffs displayed by e.g.
systat. But if truncating causes less disagreement than clamping, lets
do truncation.

diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..6266ef670a6 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
 SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");
 
+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t out;
+#ifdef COMPAT_FREEBSD11
+   uint32_t out32;
+#endif
+
+   out = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(out32)) {
+   out32 = (uint32_t)out; /* truncate */
+   return (SYSCTL_OUT(req, , sizeof(out32)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(out)));
+}
+
 #defineVM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
 #defineVM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, 
descr)
 #defineVM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, 
descr)
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317679 - head/usr.bin/grep/nls

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 13:47:15 2017
New Revision: 317679
URL: https://svnweb.freebsd.org/changeset/base/317679

Log:
  bsdgrep: correct nls usage data after r317049
  
  r317049 added -z/--null-data to BSD grep but missed the update to nls
  catalogs.
  
  Submitted by: Kyle Evans 
  Differential Revision:https://reviews.freebsd.org/D10456

Modified:
  head/usr.bin/grep/nls/C.msg
  head/usr.bin/grep/nls/es_ES.ISO8859-1.msg
  head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg
  head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg
  head/usr.bin/grep/nls/ja_JP.SJIS.msg
  head/usr.bin/grep/nls/ja_JP.UTF-8.msg
  head/usr.bin/grep/nls/ja_JP.eucJP.msg
  head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg
  head/usr.bin/grep/nls/ru_RU.KOI8-R.msg
  head/usr.bin/grep/nls/uk_UA.UTF-8.msg
  head/usr.bin/grep/nls/zh_CN.UTF-8.msg

Modified: head/usr.bin/grep/nls/C.msg
==
--- head/usr.bin/grep/nls/C.msg Tue May  2 13:38:20 2017(r317678)
+++ head/usr.bin/grep/nls/C.msg Tue May  2 13:47:15 2017(r317679)
@@ -5,7 +5,7 @@ $quote "
 1 "(standard input)"
 2 "cannot read bzip2 compressed file"
 3 "unknown %s option"
-4 "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n"
+4 "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A num] [-B num] [-C[num]]\n"
 5 "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n"
 6 "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n"
 7 "\t[--null] [pattern] [file ...]\n"

Modified: head/usr.bin/grep/nls/es_ES.ISO8859-1.msg
==
--- head/usr.bin/grep/nls/es_ES.ISO8859-1.msg   Tue May  2 13:38:20 2017
(r317678)
+++ head/usr.bin/grep/nls/es_ES.ISO8859-1.msg   Tue May  2 13:47:15 2017
(r317679)
@@ -5,7 +5,7 @@ $quote "
 1 "(entrada est�ndar)"
 2 "no se puede leer el fichero comprimido bzip2"
 3 "opci�n desconocida de %s"
-4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A no] [-B no] [-C[no]]\n"
+4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A no] [-B no] [-C[no]]\n"
 5 "\t[-e pauta] [-f fichero] [--binary-files=valor] [--color=cuando]\n"
 6 "\t[--context[=no]] [--directories=acci�n] [--label] [--line-buffered]\n"
 7 "\t[--null] [pauta] [fichero ...]\n"

Modified: head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg
==
--- head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg   Tue May  2 13:38:20 2017
(r317678)
+++ head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg   Tue May  2 13:47:15 2017
(r317679)
@@ -5,7 +5,7 @@ $quote "
 1 "(entrada est�ndar)"
 2 "non se pode ler o ficheiro comprimido bzip2"
 3 "opci�n desco�ecida de %s"
-4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A no] [-B no] [-C[no]]\n"
+4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A no] [-B no] [-C[no]]\n"
 5 "\t[-e pauta] [-f ficheiro] [--binary-files=valor] [--color=cando]\n"
 6 "\t[--context[=no]] [--directories=acci�n] [--label] [--line-buffered]\n"
 7 "\t[--null] [pauta] [ficheiro ...]\n"

Modified: head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg
==
--- head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg   Tue May  2 13:38:20 2017
(r317678)
+++ head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg   Tue May  2 13:47:15 2017
(r317679)
@@ -5,7 +5,7 @@ $quote "
 1 "(szabv�nyos bemenet)"
 2 "bzip2 t�m�r�tett f�jl nem olvashat�"
 3 "ismeretlen %s opci�"
-4 "haszn�lat: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A sz�m] [-B sz�m] 
[-C[sz�m]]\n"
+4 "haszn�lat: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A sz�m] [-B sz�m] 
[-C[sz�m]]\n"
 5 "\t[-e minta] [-f f�jl] [--binary-files=�rt�k] [--color=mikor]\n"
 6 "\t[--context[=sz�m]] [--directories=m�velet] [--label] [--line-buffered]\n"
 7 "\t[--null] [minta] [f�jl ...]\n"

Modified: head/usr.bin/grep/nls/ja_JP.SJIS.msg
==
--- head/usr.bin/grep/nls/ja_JP.SJIS.msgTue May  2 13:38:20 2017
(r317678)
+++ head/usr.bin/grep/nls/ja_JP.SJIS.msgTue May  2 13:47:15 2017
(r317679)
@@ -5,7 +5,7 @@ $quote "
 1 "(�W��)"
 2 "bzip2 ���k�t�@�C�ǂݍ��ނ��Ƃ��ł��܂���"
 3 "%s �I�v�V�̎w���l�Ɍ��肪�܂�"
-4 "�g: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A ] [-B ] 
[-C[]]\n"
+4 "�g: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A ] [-B ] 
[-C[]]\n"
 5 "\t[-e �p�^�[��] [-f �t�@�C] [--binary-files=�l] [--color=�l]\n"
 6 "\t[--context[=]] [--directories=] [--label] [--line-buffered]\n"
 7 "\t[--null] [�p�^�[��] [�t�@�C ...]\n"

Modified: head/usr.bin/grep/nls/ja_JP.UTF-8.msg
==
--- head/usr.bin/grep/nls/ja_JP.UTF-8.msg   Tue May  2 13:38:20 2017
(r317678)
+++ head/usr.bin/grep/nls/ja_JP.UTF-8.msg   Tue May  2 13:47:15 2017
(r317679)
@@ -5,7 

svn commit: r317678 - in head/usr.bin/grep: . nls

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 13:38:20 2017
New Revision: 317678
URL: https://svnweb.freebsd.org/changeset/base/317678

Log:
  bsdgrep: Add GNU compatible version string indicator
  
  As reported in r218614 it's useful to have an indication of whether or not
  BSD grep was built with GNU_GREP_COMPAT.
  
  Submitted by: Kyle Evans 
  Reported by:  mandree
  Differential Revision:https://reviews.freebsd.org/D10451

Modified:
  head/usr.bin/grep/Makefile
  head/usr.bin/grep/grep.c
  head/usr.bin/grep/nls/C.msg
  head/usr.bin/grep/nls/es_ES.ISO8859-1.msg
  head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg
  head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg
  head/usr.bin/grep/nls/ja_JP.SJIS.msg
  head/usr.bin/grep/nls/ja_JP.UTF-8.msg
  head/usr.bin/grep/nls/ja_JP.eucJP.msg
  head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg
  head/usr.bin/grep/nls/ru_RU.KOI8-R.msg
  head/usr.bin/grep/nls/uk_UA.UTF-8.msg
  head/usr.bin/grep/nls/zh_CN.UTF-8.msg

Modified: head/usr.bin/grep/Makefile
==
--- head/usr.bin/grep/Makefile  Tue May  2 10:13:50 2017(r317677)
+++ head/usr.bin/grep/Makefile  Tue May  2 13:38:20 2017(r317678)
@@ -82,7 +82,7 @@ CFLAGS+= -DWITHOUT_BZIP2
 .endif
 
 .if ${MK_GNU_GREP_COMPAT} != "no"
-CFLAGS+= -I${DESTDIR}/usr/include/gnu
+CFLAGS+= -I${DESTDIR}/usr/include/gnu -DWITH_GNU
 LIBADD+=   gnuregex
 .endif
 

Modified: head/usr.bin/grep/grep.c
==
--- head/usr.bin/grep/grep.cTue May  2 10:13:50 2017(r317677)
+++ head/usr.bin/grep/grep.cTue May  2 13:38:20 2017(r317678)
@@ -74,6 +74,7 @@ const char*errstr[] = {
 /* 7*/ "\t[--null] [pattern] [file ...]\n",
 /* 8*/ "Binary file %s matches\n",
 /* 9*/ "%s (BSD grep) %s\n",
+/* 10*/"%s (BSD grep, GNU compatible) %s\n",
 };
 
 /* Flags passed to regcomp() and regexec() */
@@ -596,7 +597,11 @@ main(int argc, char *argv[])
filebehave = FILE_MMAP;
break;
case 'V':
+#ifdef WITH_GNU
+   printf(getstr(10), getprogname(), VERSION);
+#else
printf(getstr(9), getprogname(), VERSION);
+#endif
exit(0);
case 'v':
vflag = true;

Modified: head/usr.bin/grep/nls/C.msg
==
--- head/usr.bin/grep/nls/C.msg Tue May  2 10:13:50 2017(r317677)
+++ head/usr.bin/grep/nls/C.msg Tue May  2 13:38:20 2017(r317678)
@@ -11,3 +11,4 @@ $quote "
 7 "\t[--null] [pattern] [file ...]\n"
 8 "Binary file %s matches\n"
 9 "%s (BSD grep) %s\n"
+10 "%s (BSD grep, GNU compatible) %s\n"

Modified: head/usr.bin/grep/nls/es_ES.ISO8859-1.msg
==
--- head/usr.bin/grep/nls/es_ES.ISO8859-1.msg   Tue May  2 10:13:50 2017
(r317677)
+++ head/usr.bin/grep/nls/es_ES.ISO8859-1.msg   Tue May  2 13:38:20 2017
(r317678)
@@ -11,3 +11,4 @@ $quote "
 7 "\t[--null] [pauta] [fichero ...]\n"
 8 "fichero binario %s se ajusta\n"
 9 "%s (BSD grep) %s\n"
+10 "%s (BSD grep, GNU compatible) %s\n"

Modified: head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg
==
--- head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg   Tue May  2 10:13:50 2017
(r317677)
+++ head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg   Tue May  2 13:38:20 2017
(r317678)
@@ -11,3 +11,4 @@ $quote "
 7 "\t[--null] [pauta] [ficheiro ...]\n"
 8 "ficheiro binario %s conforma\n"
 9 "%s (BSD grep) %s\n"
+10 "%s (BSD grep, GNU compatible) %s\n"

Modified: head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg
==
--- head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg   Tue May  2 10:13:50 2017
(r317677)
+++ head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg   Tue May  2 13:38:20 2017
(r317678)
@@ -11,3 +11,4 @@ $quote "
 7 "\t[--null] [minta] [f�jl ...]\n"
 8 "%s bin�ris f�jl illeszkedik\n"
 9 "%s (BSD grep) %s\n"
+10 "%s (BSD grep, GNU compatible) %s\n"

Modified: head/usr.bin/grep/nls/ja_JP.SJIS.msg
==
--- head/usr.bin/grep/nls/ja_JP.SJIS.msgTue May  2 10:13:50 2017
(r317677)
+++ head/usr.bin/grep/nls/ja_JP.SJIS.msgTue May  2 13:38:20 2017
(r317678)
@@ -11,3 +11,4 @@ $quote "
 7 "\t[--null] [�p�^�[��] [�t�@�C ...]\n"
 8 "�o�C�i���t�@�C�� %s �Ƀ}�b�`���܂���\n"
 9 "%s (BSD grep) %s\n"
+10 "%s (BSD grep, GNU compatible) %s\n"

Modified: head/usr.bin/grep/nls/ja_JP.UTF-8.msg
==
--- head/usr.bin/grep/nls/ja_JP.UTF-8.msg   Tue May  2 10:13:50 2017
(r317677)
+++ head/usr.bin/grep/nls/ja_JP.UTF-8.msg   Tue May  

Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Tue, May 02, 2017 at 09:25:40PM +1000, Bruce Evans wrote:

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote:

XX Index: subr_counter.c
XX ===
XX --- subr_counter.c   (revision 317604)
XX +++ subr_counter.c   (working copy)
XX @@ -78,11 +78,15 @@
XX  sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS)
XX  {
XX  uint64_t out;
XX +uint32_t out32;
XX  int error;
XX
XX  out = counter_u64_fetch(*(counter_u64_t *)arg1);
XX
XX -error = SYSCTL_OUT(req, , sizeof(uint64_t));
XX +if (req->oldlen == 4 && (out32 = out) == out)
XX +error = SYSCTL_OUT(req, , sizeof(out32));
XX +else
XX +error = SYSCTL_OUT(req, , sizeof(out));
XX
XX  if (error || !req->newptr)
XX  return (error);

This does the minimum necessary to fix the current problem.

This works until the counters become too large for a u_int.  There
could be an option to get truncation with no error, but that would
require an API change, so applications should be required to do the
truncation for themself if that is what they want.


Yes, this is approximately what I consider to be enough fix, but with
some details which I do not like and which did not worked well on my
test machine with enough memory to generate lot of increments.

Below is what I consider to be good enough.  I will proceed with this
version unless very strong objections appear.


I prefer my version.  It is the same as for sysctl_bufspace(), except
for simplifications and bug fixes that are easier because the types
are unsigned.

Your version is especially broken for the case of a lot of increments.

You consider the 'differentiators' as the main users, but I only want
systat and top to not abort, I have no intent of making them work
for updated counters if overflown.  Instead, I want something human-visible
so that person looking at raw counters values using old tools detected the
failure.


Clamping doesn't work for that either.  Truncating either just works using
differences like it has done for 30 years or so, or gives weirder values
that clamping.

Arguably, the API is that the counters may wrap, and applications must
handle this as well as possible by sampling them more often than they
wrap, so that only the initial values might be wrong.  Applications should
also have attempt to guess when the initial values are wrong, and print
hints about this that are more visible than printing blindly wrapped
value.


Clamping breaks many cases in systat -v which just needs unsigned counters
to calculate small differences.  Not many counters overflow faster than
the refresh interval in systat or top.  These cases used to appear to
work perfectly for most counters when the kernel did blind truncations.
Clamping breaks the API.  Not returing ENOMEM breaks the API.

In my version, this is handled as specified by the API by truncating and
returning ENOMEM.  Then:
- top sees the ENOMEM and mishandles it by aborting
- systat sees the ENOMEM (and also sees a short count, if it has the newer
   breakage of hard-coding 64-bit counters instead of u_int ones, and is
   run on a kernel with u_int counters) and mishandles it better by
   printing an error message but not aborting.  Thus it appears to work
   just as well as when the kernel did blind truncation, except for the
   error message.

ENOMEM is, of course, the situation which I want to avoid.


Then you have to return no error, but truncate the value instead of
clamping.  Anything else is incompatible.

To find the buggy applications, it is better to return a new errno, not
ENOMEM.  EOVERFLOW resulted in top aborting with a useful error message.


...
+   out = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(uint32_t)) {


sizeof(uint32_t) is an obfuscated spelling of '4'.  The size is already
hard-coded in '32'.  This depends on sizeof(char) being 1.  It is, and
won't change.  POSIX started specifying this in 2001, and the mere
existence of uint8_t probably requires 8-bit chars since u_char must
be the smallest type of an object.  This depends on the size of a u_int
being 32 bits/4 bytes in the old ABI.  This won't change, and is already
hard-coded as 32, as it must be because sizeof(u_int) may change.

I prefer the sizeof over 4.


sizeof is really bloated when you handle all the sizes as in my larger
patch.  The basic sizes are 1, 2, 4 and 8 bytes (and possibly a larger
intmax_t), and it is a detail that the sizes in the integer types are
in bits.  However, once we have set up the variables to match the sizes
in bytes, it is not so bad to use sizeof(var) instead of sizeof(typename).
The size is then hard-coded in only 1 place.  That works here too:
use sizeof(out32).


+   out1 = 0x;
+   if (out < out1)
+   

Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Konstantin Belousov
On Tue, May 02, 2017 at 09:25:40PM +1000, Bruce Evans wrote:
> On Tue, 2 May 2017, Konstantin Belousov wrote:
> 
> > On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote:
> >> XX Index: subr_counter.c
> >> XX ===
> >> XX --- subr_counter.c  (revision 317604)
> >> XX +++ subr_counter.c  (working copy)
> >> XX @@ -78,11 +78,15 @@
> >> XX  sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS)
> >> XX  {
> >> XX uint64_t out;
> >> XX +   uint32_t out32;
> >> XX int error;
> >> XX
> >> XX out = counter_u64_fetch(*(counter_u64_t *)arg1);
> >> XX
> >> XX -   error = SYSCTL_OUT(req, , sizeof(uint64_t));
> >> XX +   if (req->oldlen == 4 && (out32 = out) == out)
> >> XX +   error = SYSCTL_OUT(req, , sizeof(out32));
> >> XX +   else
> >> XX +   error = SYSCTL_OUT(req, , sizeof(out));
> >> XX
> >> XX if (error || !req->newptr)
> >> XX return (error);
> >>
> >> This does the minimum necessary to fix the current problem.
> >>
> >> This works until the counters become too large for a u_int.  There
> >> could be an option to get truncation with no error, but that would
> >> require an API change, so applications should be required to do the
> >> truncation for themself if that is what they want.
> >
> > Yes, this is approximately what I consider to be enough fix, but with
> > some details which I do not like and which did not worked well on my
> > test machine with enough memory to generate lot of increments.
> >
> > Below is what I consider to be good enough.  I will proceed with this
> > version unless very strong objections appear.
> 
> I prefer my version.  It is the same as for sysctl_bufspace(), except
> for simplifications and bug fixes that are easier because the types
> are unsigned.
> 
> Your version is especially broken for the case of a lot of increments.
You consider the 'differentiators' as the main users, but I only want
systat and top to not abort, I have no intent of making them work
for updated counters if overflown.  Instead, I want something human-visible
so that person looking at raw counters values using old tools detected the 
failure.

> 
> Clamping breaks many cases in systat -v which just needs unsigned counters
> to calculate small differences.  Not many counters overflow faster than
> the refresh interval in systat or top.  These cases used to appear to
> work perfectly for most counters when the kernel did blind truncations.
> Clamping breaks the API.  Not returing ENOMEM breaks the API.
> 
> In my version, this is handled as specified by the API by truncating and
> returning ENOMEM.  Then:
> - top sees the ENOMEM and mishandles it by aborting
> - systat sees the ENOMEM (and also sees a short count, if it has the newer
>breakage of hard-coding 64-bit counters instead of u_int ones, and is
>run on a kernel with u_int counters) and mishandles it better by
>printing an error message but not aborting.  Thus it appears to work
>just as well as when the kernel did blind truncation, except for the
>error message.
ENOMEM is, of course, the situation which I want to avoid.

> 
> Clamping would be difficult for the application to handle even if an
> error is returned.  This would be like the situation for clamping for
> strtoul(), but worse since it changes the API.  Many applications don't
> understand how to handle errno for strtoul(), but they do do a bogus
> check of the clamped value.  For sysctl(), clamping is not part of
> the API now, so applications shouldn't check for the clamped values.
> Ones that work with deltas like systat -v would see the counters stop
> incrementing when the clamped value is reached, while truncated values
> allow them to continue to appear to work perfectly.
> 
> > diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
> > index 5f4cd46ab1e..93d5161de89 100644
> > --- a/sys/vm/vm_meter.c
> > +++ b/sys/vm/vm_meter.c
> > @@ -266,8 +266,29 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, 
> > CTLFLAG_RW, 0,
> > "VM meter vm stats");
> > SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc 
> > stats");
> >
> > +static int
> > +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
> > +{
> > +   uint64_t out;
> > +#ifdef COMPAT_FREEBSD11
> > +   uint32_t out1;
> > +#endif
> 
> The extra wrapper and the ifdef limit the damage from the API change.
> Otherwise, I don't like them.
> 
> I prefer my variable name out32 to the nondescript out1.  ('out' should
> also be renamed out64, but I wanted to keep the diffs small.)
Changed to the out32 name.

> 
> > +
> > +   out = counter_u64_fetch(*(counter_u64_t *)arg1);
> > +#ifdef COMPAT_FREEBSD11
> > +   if (req->oldlen == sizeof(uint32_t)) {
> 
> sizeof(uint32_t) is an obfuscated spelling of '4'.  The size is already
> hard-coded in '32'.  This depends on sizeof(char) being 1.  It is, and
> won't change.  POSIX started specifying this in 2001, and the 

Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Tue, May 02, 2017 at 12:02:32PM +0200, Hans Petter Selasky wrote:

On 05/02/17 11:55, Konstantin Belousov wrote:

+   out1 = 0x;


Nitpicking:

Should this be written: 0xU ??


No, 0xU should be written 0x except in very delicate code
which needs it to have type precisely u_int (and u_int has at least 32
bits, else the constant would still not be u_int).


Compiler must do it on its own.  The constant is not representable as
int so it is auto-promoted to unsigned int, if fitting.


It doesn't really matter here, but we must make too many assumptions and
do too many type analyses to see that it doesn't matter (or too see that
either 0x or 0xU is correct or needed, but plain
0x usually works better since it lets the compiler decide).

Here you assume <= 32-bit ints for simplicity (otherwise, 0x would
be int).  POSIX and practice also requires >= 32-bit ints.  So ints are
assumed to be precisely 32 bits, and then 0x is just a better
spelling of 0xU.

Here we only need that the constant is non-negative.  Its type is
irrelevant, so it would be a style bug to force the type to unsigned or
larger (with < 32-bit ints) using a U suffix.  All integer constants
are non-negative.  We could even spell the constant in decimal here.
It would then have type int64_t.  Spelling it in hex makes its value
clearer and allows its type to be unsigned.

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


Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote:

XX Index: subr_counter.c
XX ===
XX --- subr_counter.c   (revision 317604)
XX +++ subr_counter.c   (working copy)
XX @@ -78,11 +78,15 @@
XX  sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS)
XX  {
XX  uint64_t out;
XX +uint32_t out32;
XX  int error;
XX
XX  out = counter_u64_fetch(*(counter_u64_t *)arg1);
XX
XX -error = SYSCTL_OUT(req, , sizeof(uint64_t));
XX +if (req->oldlen == 4 && (out32 = out) == out)
XX +error = SYSCTL_OUT(req, , sizeof(out32));
XX +else
XX +error = SYSCTL_OUT(req, , sizeof(out));
XX
XX  if (error || !req->newptr)
XX  return (error);

This does the minimum necessary to fix the current problem.

This works until the counters become too large for a u_int.  There
could be an option to get truncation with no error, but that would
require an API change, so applications should be required to do the
truncation for themself if that is what they want.


Yes, this is approximately what I consider to be enough fix, but with
some details which I do not like and which did not worked well on my
test machine with enough memory to generate lot of increments.

Below is what I consider to be good enough.  I will proceed with this
version unless very strong objections appear.


I prefer my version.  It is the same as for sysctl_bufspace(), except
for simplifications and bug fixes that are easier because the types
are unsigned.

Your version is especially broken for the case of a lot of increments.

Clamping breaks many cases in systat -v which just needs unsigned counters
to calculate small differences.  Not many counters overflow faster than
the refresh interval in systat or top.  These cases used to appear to
work perfectly for most counters when the kernel did blind truncations.
Clamping breaks the API.  Not returing ENOMEM breaks the API.

In my version, this is handled as specified by the API by truncating and
returning ENOMEM.  Then:
- top sees the ENOMEM and mishandles it by aborting
- systat sees the ENOMEM (and also sees a short count, if it has the newer
  breakage of hard-coding 64-bit counters instead of u_int ones, and is
  run on a kernel with u_int counters) and mishandles it better by
  printing an error message but not aborting.  Thus it appears to work
  just as well as when the kernel did blind truncation, except for the
  error message.

Clamping would be difficult for the application to handle even if an
error is returned.  This would be like the situation for clamping for
strtoul(), but worse since it changes the API.  Many applications don't
understand how to handle errno for strtoul(), but they do do a bogus
check of the clamped value.  For sysctl(), clamping is not part of
the API now, so applications shouldn't check for the clamped values.
Ones that work with deltas like systat -v would see the counters stop
incrementing when the clamped value is reached, while truncated values
allow them to continue to appear to work perfectly.


diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..93d5161de89 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,29 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");

+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t out;
+#ifdef COMPAT_FREEBSD11
+   uint32_t out1;
+#endif


The extra wrapper and the ifdef limit the damage from the API change.
Otherwise, I don't like them.

I prefer my variable name out32 to the nondescript out1.  ('out' should
also be renamed out64, but I wanted to keep the diffs small.)


+
+   out = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(uint32_t)) {


sizeof(uint32_t) is an obfuscated spelling of '4'.  The size is already
hard-coded in '32'.  This depends on sizeof(char) being 1.  It is, and
won't change.  POSIX started specifying this in 2001, and the mere
existence of uint8_t probably requires 8-bit chars since u_char must
be the smallest type of an object.  This depends on the size of a u_int
being 32 bits/4 bytes in the old ABI.  This won't change, and is already
hard-coded as 32, as it must be because sizeof(u_int) may change.


+   out1 = 0x;
+   if (out < out1)
+   out1 = out;


This does the clamping.  Clamping is probably better expressed as:

out1 = MIN(out, 0x)


+   return (SYSCTL_OUT(req, , sizeof(uint32_t)));


Here sizeof(uint32_t) is an obfuscated spelling of sizeof(out1).  I think
the sizeof() is justified in this case, to limit the hard-coding to of
sizes to 1 place.  Truncation by assigment to the destination variable also
helps limit this
 

Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Konstantin Belousov
On Tue, May 02, 2017 at 12:02:32PM +0200, Hans Petter Selasky wrote:
> On 05/02/17 11:55, Konstantin Belousov wrote:
> > +   out1 = 0x;
> 
> Nitpicking:
> 
> Should this be written: 0xU ??

Compiler must do it on its own.  The constant is not representable as
int so it is auto-promoted to unsigned int, if fitting.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Hans Petter Selasky

On 05/02/17 11:55, Konstantin Belousov wrote:

+   out1 = 0x;


Nitpicking:

Should this be written: 0xU ??

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


Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Konstantin Belousov
On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote:
> XX Index: subr_counter.c
> XX ===
> XX --- subr_counter.c (revision 317604)
> XX +++ subr_counter.c (working copy)
> XX @@ -78,11 +78,15 @@
> XX  sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS)
> XX  {
> XXuint64_t out;
> XX +  uint32_t out32;
> XXint error;
> XX 
> XXout = counter_u64_fetch(*(counter_u64_t *)arg1);
> XX 
> XX -  error = SYSCTL_OUT(req, , sizeof(uint64_t));
> XX +  if (req->oldlen == 4 && (out32 = out) == out)
> XX +  error = SYSCTL_OUT(req, , sizeof(out32));
> XX +  else
> XX +  error = SYSCTL_OUT(req, , sizeof(out));
> XX 
> XXif (error || !req->newptr)
> XXreturn (error);
> 
> This does the minimum necessary to fix the current problem.
> 
> This works until the counters become too large for a u_int.  There
> could be an option to get truncation with no error, but that would
> require an API change, so applications should be required to do the
> truncation for themself if that is what they want.

Yes, this is approximately what I consider to be enough fix, but with
some details which I do not like and which did not worked well on my
test machine with enough memory to generate lot of increments.

Below is what I consider to be good enough.  I will proceed with this
version unless very strong objections appear.

diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..93d5161de89 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,29 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
 SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");
 
+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t out;
+#ifdef COMPAT_FREEBSD11
+   uint32_t out1;
+#endif
+
+   out = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(uint32_t)) {
+   out1 = 0x;
+   if (out < out1)
+   out1 = out;
+   return (SYSCTL_OUT(req, , sizeof(uint32_t)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(uint64_t)));
+}
+
 #defineVM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
 #defineVM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, 
descr)
 #defineVM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, 
descr)
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"