svn commit: r301167 - head/lib/libcasper/services/cap_grp

2016-06-01 Thread Ed Schouten
Author: ed
Date: Wed Jun  1 20:45:21 2016
New Revision: 301167
URL: https://svnweb.freebsd.org/changeset/base/301167

Log:
  Don't call setgrent() in an unportable way.
  
  For FreeBSD 12, I'm considering updating setgrent() to have a function
  prototype that conforms to POSIX. FreeBSD seems to be the only operating
  system that lets setgrent() return an integer. It's also inconsistent
  with setpwent().
  
  It looks like our libcasper depends on setgrent() returning an integer.
  Get rid of that.
  
  Reviewed by:  oshogbo
  Differential Revision:https://reviews.freebsd.org/D6659

Modified:
  head/lib/libcasper/services/cap_grp/cap_grp.c

Modified: head/lib/libcasper/services/cap_grp/cap_grp.c
==
--- head/lib/libcasper/services/cap_grp/cap_grp.c   Wed Jun  1 20:44:28 
2016(r301166)
+++ head/lib/libcasper/services/cap_grp/cap_grp.c   Wed Jun  1 20:45:21 
2016(r301167)
@@ -703,7 +703,9 @@ grp_setgrent(const nvlist_t *limits __un
 nvlist_t *nvlout __unused)
 {
 
-   return (setgrent() == 0 ? EFAULT : 0);
+   setgrent();
+
+   return (0);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301166 - in head: etc etc/ppp libexec/dma/dmagent share/mk usr.sbin/ppp

2016-06-01 Thread Glen Barber
Author: gjb
Date: Wed Jun  1 20:44:28 2016
New Revision: 301166
URL: https://svnweb.freebsd.org/changeset/base/301166

Log:
  Revert r301137 and r301163, and implement a correct fix
  for the CONFS issue with dma.conf and ppp.conf.
  
  Thank you very much to Bryan Drewery for looking into the
  problem and providing this fix.
  
  Pointyhat:gjb
  Sponsored by: The FreeBSD Foundation

Added:
  head/usr.sbin/ppp/ppp.conf
 - copied unchanged from r301136, head/usr.sbin/ppp/ppp.conf
Deleted:
  head/etc/ppp/
Modified:
  head/etc/Makefile
  head/libexec/dma/dmagent/Makefile
  head/share/mk/bsd.subdir.mk
  head/usr.sbin/ppp/Makefile

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Wed Jun  1 20:39:00 2016(r301165)
+++ head/etc/Makefile   Wed Jun  1 20:44:28 2016(r301166)
@@ -305,14 +305,6 @@ distribution:
 .endif
cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
${MTREE} ${DESTDIR}/etc/mtree
-.if ${MK_PPP} != "no"
-   cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
-   ${PPPCNF} ${DESTDIR}/etc/ppp
-.endif
-.if ${MK_DMAGENT} != "no"
-   cd ${.CURDIR}/../libexec/dma/dmagent; ${INSTALL} -o ${BINOWN} -g 
${BINGRP} -m 644 \
-   dma.conf ${DESTDIR}/etc/dma
-.endif
 .if ${MK_MAIL} != "no"
cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
${ETCMAIL} ${DESTDIR}/etc/mail

Modified: head/libexec/dma/dmagent/Makefile
==
--- head/libexec/dma/dmagent/Makefile   Wed Jun  1 20:39:00 2016
(r301165)
+++ head/libexec/dma/dmagent/Makefile   Wed Jun  1 20:44:28 2016
(r301166)
@@ -18,6 +18,8 @@ SRCS= aliases_parse.y \
spool.c \
util.c
 MAN8=  dma.8
+CONFS= dma.conf
+CONFSDIR=  ${CONFDIR}/dma
 YFLAGS+=   -i
 CLEANFILES=aliases_parse.i
 FILES= mailer.conf

Modified: head/share/mk/bsd.subdir.mk
==
--- head/share/mk/bsd.subdir.mk Wed Jun  1 20:39:00 2016(r301165)
+++ head/share/mk/bsd.subdir.mk Wed Jun  1 20:44:28 2016(r301166)
@@ -72,10 +72,9 @@ DISTRIBUTION?=   base
 distribute: .MAKE
 .for dist in ${DISTRIBUTION}
${_+_}cd ${.CURDIR}; \
-   ${MAKE} install -DNO_SUBDIR DESTDIR=${DISTDIR}/${dist} SHARED=copies
+   ${MAKE} install installconfig -DNO_SUBDIR 
DESTDIR=${DISTDIR}/${dist} SHARED=copies
 .endfor
 .endif
-
 # Convenience targets to run 'build${target}' and 'install${target}' when
 # calling 'make ${target}'.
 .for __target in files includes

Modified: head/usr.sbin/ppp/Makefile
==
--- head/usr.sbin/ppp/Makefile  Wed Jun  1 20:39:00 2016(r301165)
+++ head/usr.sbin/ppp/Makefile  Wed Jun  1 20:44:28 2016(r301166)
@@ -21,6 +21,9 @@ PPP_NO_PAM=
 PPP_NO_RADIUS=
 PPP_NO_SUID=
 .endif
+CONFS= ppp.conf
+CONFSDIR=  ${CONFDIR}/ppp
+CONFSMODE= 600
 
 .if ${MK_ATM} == "no"
 PPP_NO_ATM=

Copied: head/usr.sbin/ppp/ppp.conf (from r301136, head/usr.sbin/ppp/ppp.conf)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/ppp/ppp.conf  Wed Jun  1 20:44:28 2016(r301166, copy 
of r301136, head/usr.sbin/ppp/ppp.conf)
@@ -0,0 +1,37 @@
+#
+# PPP  Sample Configuration File
+# Originally written by Toshiharu OHNO
+# Simplified 5/14/1999 by ws...@cdrom.com
+#
+# See /usr/share/examples/ppp/ for some examples
+#
+# $FreeBSD$
+#
+
+default:
+ set log Phase Chat LCP IPCP CCP tun command
+ ident user-ppp VERSION
+
+ # Ensure that "device" references the correct serial port
+ # for your modem. (cuau0 = COM1, cuau1 = COM2)
+ #
+ set device /dev/cuau1
+
+ set speed 115200
+ set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
+   \"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
+ set timeout 180   # 3 minute idle timer (the default)
+ enable dns# request DNS info (for resolv.conf)
+
+papchap:
+ #
+ # edit the next three lines and replace the items in caps with
+ # the values which have been assigned by your ISP.
+ #
+
+ set phone PHONE_NUM
+ set authname USERNAME
+ set authkey PASSWORD
+
+ set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
+ add default HISADDR   # Add a (sticky) default route
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301165 - head/sys/vm

2016-06-01 Thread Konstantin Belousov
Author: kib
Date: Wed Jun  1 20:39:00 2016
New Revision: 301165
URL: https://svnweb.freebsd.org/changeset/base/301165

Log:
  If the fast path unbusy in vm_page_replace() fails, slow path needs to
  acquire the page lock, which recurses.  Avoid the recursion by reusing
  the code from vm_page_remove() in a new helper
  vm_page_xunbusy_maybelocked().
  
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Wed Jun  1 20:30:31 2016(r301164)
+++ head/sys/vm/vm_page.c   Wed Jun  1 20:39:00 2016(r301165)
@@ -759,6 +759,22 @@ vm_page_trysbusy(vm_page_t m)
}
 }
 
+static void
+vm_page_xunbusy_maybelocked(vm_page_t m)
+{
+   bool lockacq;
+
+   vm_page_assert_xbusied(m);
+
+   lockacq = !mtx_owned(vm_page_lockptr(m));
+   if (lockacq)
+   vm_page_lock(m);
+   vm_page_flash(m);
+   atomic_store_rel_int(&m->busy_lock, VPB_UNBUSIED);
+   if (lockacq)
+   vm_page_unlock(m);
+}
+
 /*
  * vm_page_xunbusy_hard:
  *
@@ -1197,25 +1213,14 @@ void
 vm_page_remove(vm_page_t m)
 {
vm_object_t object;
-   boolean_t lockacq;
 
if ((m->oflags & VPO_UNMANAGED) == 0)
-   vm_page_lock_assert(m, MA_OWNED);
+   vm_page_assert_locked(m);
if ((object = m->object) == NULL)
return;
VM_OBJECT_ASSERT_WLOCKED(object);
-   if (vm_page_xbusied(m)) {
-   lockacq = FALSE;
-   if ((m->oflags & VPO_UNMANAGED) != 0 &&
-   !mtx_owned(vm_page_lockptr(m))) {
-   lockacq = TRUE;
-   vm_page_lock(m);
-   }
-   vm_page_flash(m);
-   atomic_store_rel_int(&m->busy_lock, VPB_UNBUSIED);
-   if (lockacq)
-   vm_page_unlock(m);
-   }
+   if (vm_page_xbusied(m))
+   vm_page_xunbusy_maybelocked(m);
 
/*
 * Now remove from the object's list of backed pages.
@@ -1340,7 +1345,7 @@ vm_page_replace(vm_page_t mnew, vm_objec
TAILQ_REMOVE(&object->memq, mold, listq);
 
mold->object = NULL;
-   vm_page_xunbusy(mold);
+   vm_page_xunbusy_maybelocked(mold);
 
/*
 * The object's resident_page_count does not change because we have
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301164 - stable/10/sys/fs/fuse

2016-06-01 Thread Rick Macklem
Author: rmacklem
Date: Wed Jun  1 20:30:31 2016
New Revision: 301164
URL: https://svnweb.freebsd.org/changeset/base/301164

Log:
  MFC: r300169
  If a local (AF_LOCAL, AF_UNIX) socket creation (bind) is attempted
  on a fuse mounted file system, it will crash. Although it may be
  possible to make this work correctly, this patch avoids the crash
  in the meantime.
  I removed the MPASS(), since panicing for the FIFO case didn't make
  a lot of sense when it returns an error for the others.

Modified:
  stable/10/sys/fs/fuse/fuse_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/fuse/fuse_vnops.c
==
--- stable/10/sys/fs/fuse/fuse_vnops.c  Wed Jun  1 20:06:55 2016
(r301163)
+++ stable/10/sys/fs/fuse/fuse_vnops.c  Wed Jun  1 20:30:31 2016
(r301164)
@@ -335,8 +335,9 @@ fuse_vnop_create(struct vop_create_args 
 
/* XXX: Will we ever want devices ? */
if ((vap->va_type != VREG)) {
-   MPASS(vap->va_type != VFIFO);
-   goto bringup;
+   printf("fuse_vnop_create: unsupported va_type %d\n",
+   vap->va_type);
+   return (EINVAL);
}
debug_printf("parent nid = %ju, mode = %x\n", (uintmax_t)parentnid,
mode);
@@ -364,7 +365,7 @@ fuse_vnop_create(struct vop_create_args 
debug_printf("create: got err=%d from daemon\n", err);
goto out;
}
-bringup:
+
feo = fdip->answ;
 
if ((err = fuse_internal_checkentry(feo, VREG))) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r301163 - in head: etc libexec/dma/dmagent

2016-06-01 Thread Glen Barber
On Wed, Jun 01, 2016 at 01:25:35PM -0700, Bryan Drewery wrote:
> On 6/1/16 1:22 PM, Glen Barber wrote:
> > On Wed, Jun 01, 2016 at 01:13:20PM -0700, Bryan Drewery wrote:
> >> On 6/1/16 1:06 PM, Glen Barber wrote:
> >>> Author: gjb
> >>> Date: Wed Jun  1 20:06:55 2016
> >>> New Revision: 301163
> >>> URL: https://svnweb.freebsd.org/changeset/base/301163
> >>>
> >>> Log:
> >>>   Implement a hack to re-enable installation of the dma.conf.
> >>>   
> >>>   The 'CONFS' entries in share/mk/bsd.confs.mk explicitly check
> >>>   for the 'installconfig', but does not behave properly with the
> >>>   'distribute' target.
> >>>   
> >>
> >> This just moves something out of installconfig, leaving it apparently
> >> still broken.
> >>
> >> Please revert this and r301137 and lets fix this properly.  I'm pretty
> >> surprised by this.
> >>
> > 
> > I'm happy to revert these two commits, they were never intended to be
> > a permanent fix (I probably should have noted that in the commit log).
> > 
> > I'm still wrapping my head around what share/mk/bsd.confs.mk is trying
> > to do, and why it is interfering with installing these files.
> > 
> > Before these are reverted, do you have an idea in mind of a proper fix?
> > 
> 
> What commands are used to generate the snapshots?
> 

In the top-level of the branch, 'make -C release'.

A quick way to produce the base.txz is:

 # make -C release base.txz

Glen



signature.asc
Description: PGP signature


Re: svn commit: r301163 - in head: etc libexec/dma/dmagent

2016-06-01 Thread Bryan Drewery
On 6/1/16 1:22 PM, Glen Barber wrote:
> On Wed, Jun 01, 2016 at 01:13:20PM -0700, Bryan Drewery wrote:
>> On 6/1/16 1:06 PM, Glen Barber wrote:
>>> Author: gjb
>>> Date: Wed Jun  1 20:06:55 2016
>>> New Revision: 301163
>>> URL: https://svnweb.freebsd.org/changeset/base/301163
>>>
>>> Log:
>>>   Implement a hack to re-enable installation of the dma.conf.
>>>   
>>>   The 'CONFS' entries in share/mk/bsd.confs.mk explicitly check
>>>   for the 'installconfig', but does not behave properly with the
>>>   'distribute' target.
>>>   
>>
>> This just moves something out of installconfig, leaving it apparently
>> still broken.
>>
>> Please revert this and r301137 and lets fix this properly.  I'm pretty
>> surprised by this.
>>
> 
> I'm happy to revert these two commits, they were never intended to be
> a permanent fix (I probably should have noted that in the commit log).
> 
> I'm still wrapping my head around what share/mk/bsd.confs.mk is trying
> to do, and why it is interfering with installing these files.
> 
> Before these are reverted, do you have an idea in mind of a proper fix?
> 

What commands are used to generate the snapshots?


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r301163 - in head: etc libexec/dma/dmagent

2016-06-01 Thread Bryan Drewery
On 6/1/16 1:22 PM, Glen Barber wrote:
> On Wed, Jun 01, 2016 at 01:13:20PM -0700, Bryan Drewery wrote:
>> On 6/1/16 1:06 PM, Glen Barber wrote:
>>> Author: gjb
>>> Date: Wed Jun  1 20:06:55 2016
>>> New Revision: 301163
>>> URL: https://svnweb.freebsd.org/changeset/base/301163
>>>
>>> Log:
>>>   Implement a hack to re-enable installation of the dma.conf.
>>>   
>>>   The 'CONFS' entries in share/mk/bsd.confs.mk explicitly check
>>>   for the 'installconfig', but does not behave properly with the
>>>   'distribute' target.
>>>   
>>
>> This just moves something out of installconfig, leaving it apparently
>> still broken.
>>
>> Please revert this and r301137 and lets fix this properly.  I'm pretty
>> surprised by this.
>>
> 
> I'm happy to revert these two commits, they were never intended to be
> a permanent fix (I probably should have noted that in the commit log).
> 
> I'm still wrapping my head around what share/mk/bsd.confs.mk is trying
> to do, and why it is interfering with installing these files.
> 
> Before these are reverted, do you have an idea in mind of a proper fix?
> 

What's the bug?

make distribution works fine.

Just tested
rm -rf /tmp/blah
make distrib-dirs DESTDIR=/tmp/blah
make distribution DESTDIR=/tmp/blah
files present:
-rw-r--r--  1 root  wheel  2163 Jun  1 13:21 /tmp/blah/etc/dma/dma.conf
-rw---  1 root  wheel  1082 Jun  1 13:21 /tmp/blah/etc/ppp/ppp.conf


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r301163 - in head: etc libexec/dma/dmagent

2016-06-01 Thread Glen Barber
On Wed, Jun 01, 2016 at 01:13:20PM -0700, Bryan Drewery wrote:
> On 6/1/16 1:06 PM, Glen Barber wrote:
> > Author: gjb
> > Date: Wed Jun  1 20:06:55 2016
> > New Revision: 301163
> > URL: https://svnweb.freebsd.org/changeset/base/301163
> > 
> > Log:
> >   Implement a hack to re-enable installation of the dma.conf.
> >   
> >   The 'CONFS' entries in share/mk/bsd.confs.mk explicitly check
> >   for the 'installconfig', but does not behave properly with the
> >   'distribute' target.
> >   
> 
> This just moves something out of installconfig, leaving it apparently
> still broken.
> 
> Please revert this and r301137 and lets fix this properly.  I'm pretty
> surprised by this.
> 

I'm happy to revert these two commits, they were never intended to be
a permanent fix (I probably should have noted that in the commit log).

I'm still wrapping my head around what share/mk/bsd.confs.mk is trying
to do, and why it is interfering with installing these files.

Before these are reverted, do you have an idea in mind of a proper fix?

Glen



signature.asc
Description: PGP signature


Re: svn commit: r301163 - in head: etc libexec/dma/dmagent

2016-06-01 Thread Bryan Drewery
On 6/1/16 1:06 PM, Glen Barber wrote:
>   The 'CONFS' entries in share/mk/bsd.confs.mk explicitly check
>   for the 'installconfig', but does not behave properly with the
>   'distribute' target.

It's not checking for 'make installconfig', it is checking if
'installconfig:' exists.

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


Re: svn commit: r301163 - in head: etc libexec/dma/dmagent

2016-06-01 Thread Bryan Drewery
On 6/1/16 1:06 PM, Glen Barber wrote:
> Author: gjb
> Date: Wed Jun  1 20:06:55 2016
> New Revision: 301163
> URL: https://svnweb.freebsd.org/changeset/base/301163
> 
> Log:
>   Implement a hack to re-enable installation of the dma.conf.
>   
>   The 'CONFS' entries in share/mk/bsd.confs.mk explicitly check
>   for the 'installconfig', but does not behave properly with the
>   'distribute' target.
>   

This just moves something out of installconfig, leaving it apparently
still broken.

Please revert this and r301137 and lets fix this properly.  I'm pretty
surprised by this.

>   This seems to be related to the previously-reported issues
>   with files within /etc in the past.
>   
>   Reported by:Ben Woods
>   Sponsored by:   The FreeBSD Foundation
> 
> Modified:
>   head/etc/Makefile
>   head/libexec/dma/dmagent/Makefile
> 
> Modified: head/etc/Makefile
> ==
> --- head/etc/Makefile Wed Jun  1 20:04:24 2016(r301162)
> +++ head/etc/Makefile Wed Jun  1 20:06:55 2016(r301163)
> @@ -309,6 +309,10 @@ distribution:
>   cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
>   ${PPPCNF} ${DESTDIR}/etc/ppp
>  .endif
> +.if ${MK_DMAGENT} != "no"
> + cd ${.CURDIR}/../libexec/dma/dmagent; ${INSTALL} -o ${BINOWN} -g 
> ${BINGRP} -m 644 \
> + dma.conf ${DESTDIR}/etc/dma
> +.endif
>  .if ${MK_MAIL} != "no"
>   cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
>   ${ETCMAIL} ${DESTDIR}/etc/mail
> 
> Modified: head/libexec/dma/dmagent/Makefile
> ==
> --- head/libexec/dma/dmagent/Makefile Wed Jun  1 20:04:24 2016
> (r301162)
> +++ head/libexec/dma/dmagent/Makefile Wed Jun  1 20:06:55 2016
> (r301163)
> @@ -18,8 +18,6 @@ SRCS=   aliases_parse.y \
>   spool.c \
>   util.c
>  MAN8=dma.8
> -CONFS=   dma.conf
> -CONFSDIR=${CONFDIR}/dma
>  YFLAGS+= -i
>  CLEANFILES=  aliases_parse.i
>  FILES=   mailer.conf
> 


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


svn commit: r301163 - in head: etc libexec/dma/dmagent

2016-06-01 Thread Glen Barber
Author: gjb
Date: Wed Jun  1 20:06:55 2016
New Revision: 301163
URL: https://svnweb.freebsd.org/changeset/base/301163

Log:
  Implement a hack to re-enable installation of the dma.conf.
  
  The 'CONFS' entries in share/mk/bsd.confs.mk explicitly check
  for the 'installconfig', but does not behave properly with the
  'distribute' target.
  
  This seems to be related to the previously-reported issues
  with files within /etc in the past.
  
  Reported by:  Ben Woods
  Sponsored by: The FreeBSD Foundation

Modified:
  head/etc/Makefile
  head/libexec/dma/dmagent/Makefile

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Wed Jun  1 20:04:24 2016(r301162)
+++ head/etc/Makefile   Wed Jun  1 20:06:55 2016(r301163)
@@ -309,6 +309,10 @@ distribution:
cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
${PPPCNF} ${DESTDIR}/etc/ppp
 .endif
+.if ${MK_DMAGENT} != "no"
+   cd ${.CURDIR}/../libexec/dma/dmagent; ${INSTALL} -o ${BINOWN} -g 
${BINGRP} -m 644 \
+   dma.conf ${DESTDIR}/etc/dma
+.endif
 .if ${MK_MAIL} != "no"
cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
${ETCMAIL} ${DESTDIR}/etc/mail

Modified: head/libexec/dma/dmagent/Makefile
==
--- head/libexec/dma/dmagent/Makefile   Wed Jun  1 20:04:24 2016
(r301162)
+++ head/libexec/dma/dmagent/Makefile   Wed Jun  1 20:06:55 2016
(r301163)
@@ -18,8 +18,6 @@ SRCS= aliases_parse.y \
spool.c \
util.c
 MAN8=  dma.8
-CONFS= dma.conf
-CONFSDIR=  ${CONFDIR}/dma
 YFLAGS+=   -i
 CLEANFILES=aliases_parse.i
 FILES= mailer.conf
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301162 - head/sys/netpfil/ipfw

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 20:04:24 2016
New Revision: 301162
URL: https://svnweb.freebsd.org/changeset/base/301162

Log:
  Replace constant expressions that contain multiplications by
  fractional floating point values with integer divides.  This will
  eliminate any chance that the compiler will generate code to evaluate
  the expression using floating point at runtime.
  
  Suggested by: bde
  Submitted by: Rasool Al-Saadi 
  MFC after:8 days (with r300779 and r300949)

Modified:
  head/sys/netpfil/ipfw/dn_aqm_pie.c
  head/sys/netpfil/ipfw/dn_aqm_pie.h
  head/sys/netpfil/ipfw/dn_sched_fq_pie.c

Modified: head/sys/netpfil/ipfw/dn_aqm_pie.c
==
--- head/sys/netpfil/ipfw/dn_aqm_pie.c  Wed Jun  1 19:54:17 2016
(r301161)
+++ head/sys/netpfil/ipfw/dn_aqm_pie.c  Wed Jun  1 20:04:24 2016
(r301162)
@@ -244,20 +244,20 @@ calculate_drop_prob(void *x)
p *= (PIE_MAX_PROB << 12) / AQM_TIME_1S;
 
/* auto-tune drop probability */
-   if (prob < (int64_t)(PIE_MAX_PROB * 0.01))
-   p >>= 11 + PIE_FIX_POINT_BITS+12;
-   else if (prob < (int64_t)(PIE_MAX_PROB * 0.1))
-   p >>= 9 + PIE_FIX_POINT_BITS+12;
-   else if (prob < (int64_t)(PIE_MAX_PROB * 0.0001))
-   p >>= 7 + PIE_FIX_POINT_BITS+12;
-   else if (prob < (int64_t)(PIE_MAX_PROB * 0.001))
-   p >>= 5 + PIE_FIX_POINT_BITS+12;
-   elseif (prob < (int64_t)(PIE_MAX_PROB * 0.01))
-   p >>= 3 + PIE_FIX_POINT_BITS+12;
-   else if (prob < (int64_t)(PIE_MAX_PROB * 0.1))
-   p >>= 1 + PIE_FIX_POINT_BITS+12;
+   if (prob < (PIE_MAX_PROB / 100)) /* 0.01 */
+   p >>= 11 + PIE_FIX_POINT_BITS + 12;
+   else if (prob < (PIE_MAX_PROB / 10)) /* 0.1 */
+   p >>= 9 + PIE_FIX_POINT_BITS + 12;
+   else if (prob < (PIE_MAX_PROB / 1)) /* 0.0001 */
+   p >>= 7 + PIE_FIX_POINT_BITS + 12;
+   else if (prob < (PIE_MAX_PROB / 1000)) /* 0.001 */
+   p >>= 5 + PIE_FIX_POINT_BITS + 12;
+   else if (prob < (PIE_MAX_PROB / 100)) /* 0.01 */
+   p >>= 3 + PIE_FIX_POINT_BITS + 12;
+   else if (prob < (PIE_MAX_PROB / 10)) /* 0.1 */
+   p >>= 1 + PIE_FIX_POINT_BITS + 12;
else
-   p >>= PIE_FIX_POINT_BITS+12;
+   p >>= PIE_FIX_POINT_BITS + 12;
 
oldprob = prob;
 

Modified: head/sys/netpfil/ipfw/dn_aqm_pie.h
==
--- head/sys/netpfil/ipfw/dn_aqm_pie.h  Wed Jun  1 19:54:17 2016
(r301161)
+++ head/sys/netpfil/ipfw/dn_aqm_pie.h  Wed Jun  1 20:04:24 2016
(r301162)
@@ -132,11 +132,13 @@ drop_early(struct pie_status *pst, uint3
 * if accu_prob < 0.85 -> enqueue
 * if accu_prob>8.5 ->drop
 * between 0.85 and 8.5 || !De-randomize --> drop on prob
+* 
+* (0.85 = 17/20 ,8.5 = 17/2)
 */
if (pprms->flags & PIE_DERAND_ENABLED) {
-   if(pst->accu_prob < (uint64_t) (PIE_MAX_PROB * 0.85))
+   if(pst->accu_prob < (uint64_t) (PIE_MAX_PROB * 17 / 20))
return ENQUE;
-if( pst->accu_prob >= (uint64_t) (PIE_MAX_PROB * 8.5))
+if( pst->accu_prob >= (uint64_t) (PIE_MAX_PROB * 17 / 2))
return DROP;
}
 

Modified: head/sys/netpfil/ipfw/dn_sched_fq_pie.c
==
--- head/sys/netpfil/ipfw/dn_sched_fq_pie.c Wed Jun  1 19:54:17 2016
(r301161)
+++ head/sys/netpfil/ipfw/dn_sched_fq_pie.c Wed Jun  1 20:04:24 2016
(r301162)
@@ -407,20 +407,20 @@ fq_calculate_drop_prob(void *x)
p *= (PIE_MAX_PROB << 12) / AQM_TIME_1S;
 
/* auto-tune drop probability */
-   if (prob < (int64_t)(PIE_MAX_PROB * 0.01))
-   p >>= 11 + PIE_FIX_POINT_BITS+12;
-   else if (prob < (int64_t)(PIE_MAX_PROB * 0.1))
-   p >>= 9 + PIE_FIX_POINT_BITS+12;
-   else if (prob < (int64_t)(PIE_MAX_PROB * 0.0001))
-   p >>= 7 + PIE_FIX_POINT_BITS+12;
-   else if (prob < (int64_t)(PIE_MAX_PROB * 0.001))
-   p >>= 5 + PIE_FIX_POINT_BITS+12;
-   elseif (prob < (int64_t)(PIE_MAX_PROB * 0.01))
-   p >>= 3 + PIE_FIX_POINT_BITS+12;
-   else if (prob < (int64_t)(PIE_MAX_PROB * 0.1))
-   p >>= 1 + PIE_FIX_POINT_BITS+12;
+   if (prob < (PIE_MAX_PROB / 100)) /* 0.01 */
+   p >>= 11 + PIE_FIX_POINT_BITS + 12;
+   else if (prob < (PIE_MAX_PROB / 10)) /* 0.1 */
+   p >>= 9 + PIE_FIX_POINT_BITS + 12;
+   else if (prob < (PIE_MAX_PROB / 1)) /* 0.0001 */
+   p >>= 7 + PIE_FIX_POINT_BITS + 12;
+   else if (prob < (PIE_MAX_PROB / 1000)) /* 0.001 */
+   p >>= 5 + PIE_FIX_POINT

Re: svn commit: r301131 - head/usr.sbin/tzsetup

2016-06-01 Thread Devin Teske
I think this should have been reviewed first before commit.

1. Changes should be mirrored with "bsdconfig timezone" to keep the two aligned
2. Not all users are unaware of the linkage between /etc/localtime and tzsetup 
and as-such, are left without a way of knowing how to clear the state-change 
from "no localtime file" to instead "localtime file exists" (as now tzsetup 
lacks any interface to unlink localtime as was the option for UTC)

I did not consider the lack of installing the UTC compiled zoneinfo file as a 
bug, because calling that routine with a NULL argument was effective in 
requesting the localtime file be unlinked to return to that state.

Yes, those that are plentifully aware that /etc/localtime is generated after 
running tzsetup will know that you can simply rm it. But there are situations 
such as maybe sudo allowing you to run tzsetup but not allowing you to use rm 
that come to mind which throw a monkey-wrench (aka spanner) in the works for 
even normal folk that may have relied on the functionality to have 
/etc/localtime unlinked by selecting the UTC option at the bottom of the list.
-- 
Devin

> On Jun 1, 2016, at 8:39 AM, Steven Hartland  wrote:
> 
> Author: smh
> Date: Wed Jun  1 15:39:11 2016
> New Revision: 301131
> URL: https://svnweb.freebsd.org/changeset/base/301131
> 
> Log:
>  Fix tzsetup not installing /etc/localtime for UTC
> 
>  If tzsetup UTC is run then it successfully configured the system for UTC
>  including installing /etc/localtime however if the user ran just tzsetup
>  for interactive configuration and select UTC no /etc/localtime was installed
>  which resulted in failures for utilities which require said file.
> 
>  Change set_zone_utc to call install_zoneinfo("UTC") to ensure that
>  /etc/localtime is created for interactive UTC selection.
> 
>  Users who have previously run tzsetup in interactive mode and select UTC
>  can install the missing /etc/localtime by running tzsetup -r.
> 
>  Also correct static miss-match for set_zone_utc.
> 
>  MFC after:   2 weeks
>  Relnotes:Yes
>  Sponsored by:Multiplay
> 
> Modified:
>  head/usr.sbin/tzsetup/tzsetup.c
> 
> Modified: head/usr.sbin/tzsetup/tzsetup.c
> ==
> --- head/usr.sbin/tzsetup/tzsetup.c   Wed Jun  1 15:19:49 2016
> (r301130)
> +++ head/usr.sbin/tzsetup/tzsetup.c   Wed Jun  1 15:39:11 2016
> (r301131)
> @@ -199,6 +199,7 @@ static char *chrootenv = NULL;
> static void   usage(void);
> static intconfirm_zone(const char *filename);
> static intcontinent_country_menu(dialogMenuItem *);
> +static int   install_zoneinfo(const char *zoneinfo);
> static intinstall_zoneinfo_file(const char *zoneinfo_file);
> static intset_zone_multi(dialogMenuItem *);
> static intset_zone_whole_country(dialogMenuItem *);
> @@ -633,13 +634,13 @@ set_zone_menu(dialogMenuItem *dmi)
>   return (DITEM_LEAVE_MENU);
> }
> 
> -int
> +static int
> set_zone_utc(void)
> {
>   if (!confirm_zone(NULL))
>   return (DITEM_FAILURE | DITEM_RECREATE);
> 
> - return (install_zoneinfo_file(NULL));
> + return (install_zoneinfo("UTC"));
> }
> 
> static int
> 

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


svn commit: r301161 - head/share/mk

2016-06-01 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Jun  1 19:54:17 2016
New Revision: 301161
URL: https://svnweb.freebsd.org/changeset/base/301161

Log:
  Fix the library name.
  
  Reviewed by:  bdrewery

Modified:
  head/share/mk/src.libnames.mk

Modified: head/share/mk/src.libnames.mk
==
--- head/share/mk/src.libnames.mk   Wed Jun  1 19:54:05 2016
(r301160)
+++ head/share/mk/src.libnames.mk   Wed Jun  1 19:54:17 2016
(r301161)
@@ -504,7 +504,7 @@ LIBATF_CXXDIR=  ${OBJTOP}/lib/atf/libatf-
 LIBALIASDIR=   ${OBJTOP}/lib/libalias/libalias
 LIBBLOCKSRUNTIMEDIR=   ${OBJTOP}/lib/libblocksruntime
 LIBBSNMPDIR=   ${OBJTOP}/lib/libbsnmp/libbsnmp
-LIBCAP_CASPERDIR=  ${OBJTOP}/lib/libcasper/libcasper
+LIBCASPERDIR=  ${OBJTOP}/lib/libcasper/libcasper
 LIBCAP_DNSDIR= ${OBJTOP}/lib/libcasper/services/cap_dns
 LIBCAP_GRPDIR= ${OBJTOP}/lib/libcasper/services/cap_grp
 LIBCAP_PWDDIR= ${OBJTOP}/lib/libcasper/services/cap_pwd
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301160 - head/bin/ps

2016-06-01 Thread Conrad E. Meyer
Author: cem
Date: Wed Jun  1 19:54:05 2016
New Revision: 301160
URL: https://svnweb.freebsd.org/changeset/base/301160

Log:
  ps(1): Expand variables to match expanded fields
  
  ki_flag and ki_tdflag have been 'long', not 'int', since 2000 and 2005,
  respectively.
  
  Submitted by: Shawn Wills 
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/bin/ps/keyword.c
  head/bin/ps/print.c

Modified: head/bin/ps/keyword.c
==
--- head/bin/ps/keyword.c   Wed Jun  1 19:49:38 2016(r301159)
+++ head/bin/ps/keyword.c   Wed Jun  1 19:54:05 2016(r301160)
@@ -95,7 +95,7 @@ static VAR var[] = {
{"etimes", "ELAPSED", NULL, "elapsed-times", USER, elapseds, 0, CHAR,
NULL, 0},
{"euid", "", "uid", NULL, 0, NULL, 0, CHAR, NULL, 0},
-   {"f", "F", NULL, "flags", 0, kvar, KOFF(ki_flag), INT, "x", 0},
+   {"f", "F", NULL, "flags", 0, kvar, KOFF(ki_flag), LONG, "lx", 0},
{"f2", "F2", NULL, "flags2", 0, kvar, KOFF(ki_flag2), INT, "08x", 0},
{"fib", "FIB", NULL, "fib", 0, kvar, KOFF(ki_fibnum), INT, "d", 0},
{"flags", "", "f", NULL, 0, NULL, 0, CHAR, NULL, 0},

Modified: head/bin/ps/print.c
==
--- head/bin/ps/print.c Wed Jun  1 19:49:38 2016(r301159)
+++ head/bin/ps/print.c Wed Jun  1 19:54:05 2016(r301160)
@@ -211,7 +211,7 @@ logname(KINFO *k, VARENT *ve __unused)
 char *
 state(KINFO *k, VARENT *ve __unused)
 {
-   int flag, tdflags;
+   long flag, tdflags;
char *cp, *buf;
 
buf = malloc(16);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301159 - head/lib/libc/sys

2016-06-01 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Jun  1 19:49:38 2016
New Revision: 301159
URL: https://svnweb.freebsd.org/changeset/base/301159

Log:
  Document behavior of wait introduced in the r286698.
  
  Suggested by: glebius
  Reviewed by:  wblock, bjk
  Differential Revision:https://reviews.freebsd.org/D6080

Modified:
  head/lib/libc/sys/wait.2

Modified: head/lib/libc/sys/wait.2
==
--- head/lib/libc/sys/wait.2Wed Jun  1 18:46:54 2016(r301158)
+++ head/lib/libc/sys/wait.2Wed Jun  1 19:49:38 2016(r301159)
@@ -28,7 +28,7 @@
 .\" @(#)wait.2 8.2 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\"
-.Dd December 3, 2013
+.Dd June 1, 2016
 .Dt WAIT 2
 .Os
 .Sh NAME
@@ -596,6 +596,14 @@ and
 fields of
 .Fa infop
 must be checked against zero to determine if a process reported status.
+.Pp
+.Fn wait
+called with -1 to wait for any child process will ignore a child that is
+referenced by a process descriptor (see
+.Xr pdfork 2 ) .
+Specific processes can still be waited on by specifying the process ID
+or descriptor (see
+.Xr pdwait 4 ) .
 .Sh ERRORS
 The
 .Fn wait
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r301128 - head/sys/dev/urtwn

2016-06-01 Thread Adrian Chadd
[snip]

well, adhoc merges.



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


Re: svn commit: r301128 - head/sys/dev/urtwn

2016-06-01 Thread Adrian Chadd
hi!

Woo! Does this also help with IBSS? (Since we need to see all beacons
so we can do adhoc joins.)


-adrian


On 1 June 2016 at 07:57, Andriy Voskoboinyk  wrote:
> Author: avos
> Date: Wed Jun  1 14:57:53 2016
> New Revision: 301128
> URL: https://svnweb.freebsd.org/changeset/base/301128
>
> Log:
>   urtwn: fix non-ERP BSS detection in HOSTAP mode.
>
>   Receive all beacons in HOSTAP mode; they will give more information about
>   present non-ERP / legacy BSSs (used to choose protection mode).
>
>   Tested with RTL8188CUS (HOSTAP, urtwn) + RTL8821AU (HOSTAP, 11b mode).
>
> Modified:
>   head/sys/dev/urtwn/if_urtwn.c
>
> Modified: head/sys/dev/urtwn/if_urtwn.c
> ==
> --- head/sys/dev/urtwn/if_urtwn.c   Wed Jun  1 14:16:16 2016   
> (r301127)
> +++ head/sys/dev/urtwn/if_urtwn.c   Wed Jun  1 14:57:53 2016
> (r301128)
> @@ -2627,10 +2627,11 @@ urtwn_newstate(struct ieee80211vap *vap,
> if (ic->ic_promisc == 0) {
> reg = urtwn_read_4(sc, R92C_RCR);
>
> -   if (vap->iv_opmode != IEEE80211_M_HOSTAP)
> +   if (vap->iv_opmode != IEEE80211_M_HOSTAP) {
> reg |= R92C_RCR_CBSSID_DATA;
> -   if (vap->iv_opmode != IEEE80211_M_IBSS)
> -   reg |= R92C_RCR_CBSSID_BCN;
> +   if (vap->iv_opmode != IEEE80211_M_IBSS)
> +   reg |= R92C_RCR_CBSSID_BCN;
> +   }
>
> urtwn_write_4(sc, R92C_RCR, reg);
> }
> @@ -4723,7 +4724,8 @@ urtwn_scan_start(struct ieee80211com *ic
>
> URTWN_LOCK(sc);
> /* Receive beacons / probe responses from any BSSID. */
> -   if (ic->ic_opmode != IEEE80211_M_IBSS)
> +   if (ic->ic_opmode != IEEE80211_M_IBSS &&
> +   ic->ic_opmode != IEEE80211_M_HOSTAP)
> urtwn_set_rx_bssid_all(sc, 1);
>
> /* Set gain for scanning. */
> @@ -4738,7 +4740,9 @@ urtwn_scan_end(struct ieee80211com *ic)
>
> URTWN_LOCK(sc);
> /* Restore limitations. */
> -   if (ic->ic_promisc == 0 && ic->ic_opmode != IEEE80211_M_IBSS)
> +   if (ic->ic_promisc == 0 &&
> +   ic->ic_opmode != IEEE80211_M_IBSS &&
> +   ic->ic_opmode != IEEE80211_M_HOSTAP)
> urtwn_set_rx_bssid_all(sc, 0);
>
> /* Set gain under link. */
> @@ -4931,14 +4935,13 @@ urtwn_set_promisc(struct urtwn_softc *sc
> if (vap->iv_state == IEEE80211_S_RUN) {
> switch (vap->iv_opmode) {
> case IEEE80211_M_STA:
> -   mask2 |= R92C_RCR_CBSSID_DATA;
> -   /* FALLTHROUGH */
> -   case IEEE80211_M_HOSTAP:
> mask2 |= R92C_RCR_CBSSID_BCN;
> -   break;
> +   /* FALLTHROUGH */
> case IEEE80211_M_IBSS:
> mask2 |= R92C_RCR_CBSSID_DATA;
> break;
> +   case IEEE80211_M_HOSTAP:
> +   break;
> default:
> device_printf(sc->sc_dev, "%s: undefined opmode %d\n",
> __func__, vap->iv_opmode);
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301158 - head/sys/dev/cxgbe/iw_cxgbe

2016-06-01 Thread Navdeep Parhar
Author: np
Date: Wed Jun  1 18:46:54 2016
New Revision: 301158
URL: https://svnweb.freebsd.org/changeset/base/301158

Log:
  iw_cxgbe: Fix panic that occurs when c4iw_ev_handler tries to acquire
  comp_handler_lock but c4iw_destroy_cq has already freed the CQ memory
  (which is where the lock resides).
  
  Submitted by: Krishnamraju Eraparaju @ Chelsio
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/ev.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/ev.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/ev.cWed Jun  1 18:32:20 2016
(r301157)
+++ head/sys/dev/cxgbe/iw_cxgbe/ev.cWed Jun  1 18:46:54 2016
(r301158)
@@ -194,13 +194,22 @@ int c4iw_ev_handler(struct sge_iq *iq, c
struct c4iw_cq *chp;
unsigned long flag;
 
+   spin_lock_irqsave(&dev->lock, flag);
chp = get_chp(dev, qid);
if (chp) {
+   atomic_inc(&chp->refcnt);
+   spin_unlock_irqrestore(&dev->lock, flag);
+
spin_lock_irqsave(&chp->comp_handler_lock, flag);
(*chp->ibcq.comp_handler)(&chp->ibcq, chp->ibcq.cq_context);
spin_unlock_irqrestore(&chp->comp_handler_lock, flag);
-   } else
+   if (atomic_dec_and_test(&chp->refcnt))
+   wake_up(&chp->wait);
+   } else {
CTR2(KTR_IW_CXGBE, "%s unknown cqid 0x%x", __func__, qid);
+   spin_unlock_irqrestore(&dev->lock, flag);
+   }
+
return 0;
 }
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-06-01 Thread Mateusz Guzik
Author: mjg
Date: Wed Jun  1 18:32:20 2016
New Revision: 301157
URL: https://svnweb.freebsd.org/changeset/base/301157

Log:
  Microoptimize locking primitives by avoiding unnecessary atomic ops.
  
  Inline version of primitives do an atomic op and if it fails they fallback to
  actual primitives, which immediately retry the atomic op.
  
  The obvious optimisation is to check if the lock is free and only then proceed
  to do an atomic op.
  
  Reviewed by:  jhb, vangyzen

Modified:
  head/sys/kern/kern_lock.c
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c
  head/sys/sys/mutex.h
  head/sys/sys/rwlock.h
  head/sys/sys/sx.h

Modified: head/sys/kern/kern_lock.c
==
--- head/sys/kern/kern_lock.c   Wed Jun  1 17:57:56 2016(r301156)
+++ head/sys/kern/kern_lock.c   Wed Jun  1 18:32:20 2016(r301157)
@@ -787,8 +787,10 @@ __lockmgr_args(struct lock *lk, u_int fl
break;
}
 
-   while (!atomic_cmpset_acq_ptr(&lk->lk_lock, LK_UNLOCKED,
-   tid)) {
+   for (;;) {
+   if (lk->lk_lock == LK_UNLOCKED &&
+   atomic_cmpset_acq_ptr(&lk->lk_lock, LK_UNLOCKED, 
tid))
+   break;
 #ifdef HWPMC_HOOKS
PMC_SOFT_CALL( , , lock, failed);
 #endif
@@ -1124,7 +1126,11 @@ __lockmgr_args(struct lock *lk, u_int fl
__func__, iwmesg, file, line);
}
 
-   while (!atomic_cmpset_acq_ptr(&lk->lk_lock, LK_UNLOCKED, tid)) {
+   for (;;) {
+   if (lk->lk_lock == LK_UNLOCKED &&
+   atomic_cmpset_acq_ptr(&lk->lk_lock, LK_UNLOCKED, 
tid))
+   break;
+
 #ifdef HWPMC_HOOKS
PMC_SOFT_CALL( , , lock, failed);
 #endif

Modified: head/sys/kern/kern_mutex.c
==
--- head/sys/kern/kern_mutex.c  Wed Jun  1 17:57:56 2016(r301156)
+++ head/sys/kern/kern_mutex.c  Wed Jun  1 18:32:20 2016(r301157)
@@ -419,7 +419,9 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
all_time -= lockstat_nsecs(&m->lock_object);
 #endif
 
-   while (!_mtx_obtain_lock(m, tid)) {
+   for (;;) {
+   if (m->mtx_lock == MTX_UNOWNED && _mtx_obtain_lock(m, tid))
+   break;
 #ifdef KDTRACE_HOOKS
spin_cnt++;
 #endif
@@ -602,8 +604,9 @@ _mtx_lock_spin_cookie(volatile uintptr_t
 #ifdef KDTRACE_HOOKS
spin_time -= lockstat_nsecs(&m->lock_object);
 #endif
-   while (!_mtx_obtain_lock(m, tid)) {
-
+   for (;;) {
+   if (m->mtx_lock == MTX_UNOWNED && _mtx_obtain_lock(m, tid))
+   break;
/* Give interrupts a chance while we spin. */
spinlock_exit();
while (m->mtx_lock != MTX_UNOWNED) {
@@ -675,7 +678,9 @@ retry:
m->lock_object.lo_name, file, line));
WITNESS_CHECKORDER(&m->lock_object,
opts | LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL);
-   while (!_mtx_obtain_lock(m, tid)) {
+   for (;;) {
+   if (m->mtx_lock == MTX_UNOWNED && _mtx_obtain_lock(m, 
tid))
+   break;
if (m->mtx_lock == tid) {
m->mtx_recurse++;
break;

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Wed Jun  1 17:57:56 2016(r301156)
+++ head/sys/kern/kern_rwlock.c Wed Jun  1 18:32:20 2016(r301157)
@@ -771,7 +771,9 @@ __rw_wlock_hard(volatile uintptr_t *c, u
all_time -= lockstat_nsecs(&rw->lock_object);
state = rw->rw_lock;
 #endif
-   while (!_rw_write_lock(rw, tid)) {
+   for (;;) {
+   if (rw->rw_lock == RW_UNLOCKED && _rw_write_lock(rw, tid))
+   break;
 #ifdef KDTRACE_HOOKS
spin_cnt++;
 #endif

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Wed Jun  1 17:57:56 2016(r301156)
+++ head/sys/kern/kern_sx.c Wed Jun  1 18:32:20 2016(r301157)
@@ -544,7 +544,10 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
all_time -= lockstat_nsecs(&sx->lock_object);
state = sx->sx_lock;
 #endif
-   while (!atomic_cmpset_acq_ptr(&sx->sx_lock, SX_LOCK_UNLOCKED, tid)) {
+   for (;;) {
+   if (sx->sx_lock == SX_LOCK_UNLOCKED &&
+   atomic_cmpset_acq_ptr(&sx->sx_lock, SX_LOCK_UNLOCKED, tid))
+   break;
 #ifdef KDTRACE_HOOKS
spin_cnt++;
 #endif

Modified: hea

svn commit: r301156 - stable/10/usr.sbin/tzsetup

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:57:56 2016
New Revision: 301156
URL: https://svnweb.freebsd.org/changeset/base/301156

Log:
  MFC r300706
  
  Avoid buffer overflow or truncation when constructing path_zoneinfo_file.
  
  Reported by:  Coverity
  CID:  1011160

Modified:
  stable/10/usr.sbin/tzsetup/tzsetup.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/tzsetup/tzsetup.c
==
--- stable/10/usr.sbin/tzsetup/tzsetup.cWed Jun  1 17:47:34 2016
(r301155)
+++ stable/10/usr.sbin/tzsetup/tzsetup.cWed Jun  1 17:57:56 2016
(r301156)
@@ -837,7 +837,9 @@ install_zoneinfo(const char *zoneinfo)
FILE*f;
charpath_zoneinfo_file[MAXPATHLEN];
 
-   sprintf(path_zoneinfo_file, "%s/%s", path_zoneinfo, zoneinfo);
+   if ((size_t)snprintf(path_zoneinfo_file, sizeof(path_zoneinfo_file),
+   "%s/%s", path_zoneinfo, zoneinfo) >= sizeof(path_zoneinfo_file))
+   errx(1, "%s/%s name too long", path_zoneinfo, zoneinfo);
rv = install_zoneinfo_file(path_zoneinfo_file);
 
/* Save knowledge for later */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301155 - stable/10/bin/ed

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:47:34 2016
New Revision: 301155
URL: https://svnweb.freebsd.org/changeset/base/301155

Log:
  MFC r300692
  
  Close the input FILE * in read_file() and the output FILE * in write_file()
  if read_stream() or write_stream() fails to avoid leaking the FILE.
  
  Reported by:  Coverity
  CID:  977702
  Reviewed by:  pfg
  Differential Revision:https://reviews.freebsd.org/D6554

Modified:
  stable/10/bin/ed/io.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/ed/io.c
==
--- stable/10/bin/ed/io.c   Wed Jun  1 17:45:00 2016(r301154)
+++ stable/10/bin/ed/io.c   Wed Jun  1 17:47:34 2016(r301155)
@@ -36,20 +36,24 @@ read_file(char *fn, long n)
 {
FILE *fp;
long size;
-
+   int cs;
 
fp = (*fn == '!') ? popen(fn + 1, "r") : fopen(strip_escapes(fn), "r");
if (fp == NULL) {
fprintf(stderr, "%s: %s\n", fn, strerror(errno));
errmsg = "cannot open input file";
return ERR;
-   } else if ((size = read_stream(fp, n)) < 0)
-   return ERR;
-else if (((*fn == '!') ?  pclose(fp) : fclose(fp)) < 0) {
+   }
+   if ((size = read_stream(fp, n)) < 0) {
+   fprintf(stderr, "%s: %s\n", fn, strerror(errno));
+   errmsg = "error reading input file";
+   }
+   if ((cs = (*fn == '!') ?  pclose(fp) : fclose(fp)) < 0) {
fprintf(stderr, "%s: %s\n", fn, strerror(errno));
errmsg = "cannot close input file";
-   return ERR;
}
+   if (size < 0 || cs < 0)
+   return ERR;
if (!scripted)
fprintf(stdout, "%lu\n", size);
return current_addr - n;
@@ -143,19 +147,24 @@ write_file(char *fn, const char *mode, l
 {
FILE *fp;
long size;
+   int cs;
 
fp = (*fn == '!') ? popen(fn+1, "w") : fopen(strip_escapes(fn), mode);
if (fp == NULL) {
fprintf(stderr, "%s: %s\n", fn, strerror(errno));
errmsg = "cannot open output file";
return ERR;
-   } else if ((size = write_stream(fp, n, m)) < 0)
-   return ERR;
-else if (((*fn == '!') ?  pclose(fp) : fclose(fp)) < 0) {
+   }
+   if ((size = write_stream(fp, n, m)) < 0) {
+   fprintf(stderr, "%s: %s\n", fn, strerror(errno));
+   errmsg = "error writing output file";
+   }
+   if ((cs = (*fn == '!') ?  pclose(fp) : fclose(fp)) < 0) {
fprintf(stderr, "%s: %s\n", fn, strerror(errno));
errmsg = "cannot close output file";
-   return ERR;
}
+   if (size < 0 || cs < 0)
+   return ERR;
if (!scripted)
fprintf(stdout, "%lu\n", size);
return n ? m - n + 1 : 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301154 - stable/10/lib/libfetch

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:45:00 2016
New Revision: 301154
URL: https://svnweb.freebsd.org/changeset/base/301154

Log:
  MFC r300666
  
  Call closedir() before returning from fetchListFile() to avoid a leak.
  
  Reported by:  Coverity
  CID:  1016697

Modified:
  stable/10/lib/libfetch/file.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libfetch/file.c
==
--- stable/10/lib/libfetch/file.c   Wed Jun  1 17:43:04 2016
(r301153)
+++ stable/10/lib/libfetch/file.c   Wed Jun  1 17:45:00 2016
(r301154)
@@ -149,5 +149,6 @@ fetchListFile(struct url *u, const char 
fetch_add_entry(&ue, &size, &len, de->d_name, &us);
}
 
+   closedir(dir);
return (ue);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301153 - stable/10/lib/libfetch

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:43:04 2016
New Revision: 301153
URL: https://svnweb.freebsd.org/changeset/base/301153

Log:
  MFC r300665
  
  Don't leak addrinfo in fetch_bind()
  
  Submitted by: Coverity
  CID:  1225038

Modified:
  stable/10/lib/libfetch/common.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libfetch/common.c
==
--- stable/10/lib/libfetch/common.c Wed Jun  1 17:41:00 2016
(r301152)
+++ stable/10/lib/libfetch/common.c Wed Jun  1 17:43:04 2016
(r301153)
@@ -256,8 +256,11 @@ fetch_bind(int sd, int af, const char *a
if ((err = getaddrinfo(addr, NULL, &hints, &res0)) != 0)
return (-1);
for (res = res0; res; res = res->ai_next)
-   if (bind(sd, res->ai_addr, res->ai_addrlen) == 0)
+   if (bind(sd, res->ai_addr, res->ai_addrlen) == 0) {
+   freeaddrinfo(res0);
return (0);
+   }
+   freeaddrinfo(res0);
return (-1);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301152 - stable/10/lib/libcompat/4.3

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:41:00 2016
New Revision: 301152
URL: https://svnweb.freebsd.org/changeset/base/301152

Log:
  MFC r300664
  
  Fix Coverity CID 978183 Resource leak in rexec().
  
  Close the socket if connect() fails to avoid leaking it.
  
  Reported by:  Coverity
  CID:  978183

Modified:
  stable/10/lib/libcompat/4.3/rexec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libcompat/4.3/rexec.c
==
--- stable/10/lib/libcompat/4.3/rexec.c Wed Jun  1 17:39:03 2016
(r301151)
+++ stable/10/lib/libcompat/4.3/rexec.c Wed Jun  1 17:41:00 2016
(r301152)
@@ -330,6 +330,7 @@ retry:
goto retry;
}
perror(hp->h_name);
+   (void) close(s);
return (-1);
}
if (fd2p == 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301151 - stable/10/lib/libc/gen

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:39:03 2016
New Revision: 301151
URL: https://svnweb.freebsd.org/changeset/base/301151

Log:
  MFC r300662
  
  Fix Coverity CID 1016714 Resource leak in process_file_actions_entry()
  
  Don't leak a file descriptor of _dup2() fails (shouldn't happen).
  
  Reported by:  Coverity
  CID:  1016714

Modified:
  stable/10/lib/libc/gen/posix_spawn.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/gen/posix_spawn.c
==
--- stable/10/lib/libc/gen/posix_spawn.cWed Jun  1 17:37:16 2016
(r301150)
+++ stable/10/lib/libc/gen/posix_spawn.cWed Jun  1 17:39:03 2016
(r301151)
@@ -140,7 +140,7 @@ process_spawnattr(const posix_spawnattr_
 static int
 process_file_actions_entry(posix_spawn_file_actions_entry_t *fae)
 {
-   int fd;
+   int fd, saved_errno;
 
switch (fae->fae_action) {
case FAE_OPEN:
@@ -149,8 +149,11 @@ process_file_actions_entry(posix_spawn_f
if (fd < 0)
return (errno);
if (fd != fae->fae_fildes) {
-   if (_dup2(fd, fae->fae_fildes) == -1)
-   return (errno);
+   if (_dup2(fd, fae->fae_fildes) == -1) {
+   saved_errno = errno;
+   (void)_close(fd);
+   return (saved_errno);
+   }
if (_close(fd) != 0) {
if (errno == EBADF)
return (EBADF);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301150 - stable/10/lib/libc/gen

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:37:16 2016
New Revision: 301150
URL: https://svnweb.freebsd.org/changeset/base/301150

Log:
  MFC r300660
  
  Fix 1016718 Resource leak.
  
  Don't leak a file descriptor if fchdir() fails.
  
  Reported by:  Coverity
  CID:  1016718

Modified:
  stable/10/lib/libc/gen/fts-compat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/gen/fts-compat.c
==
--- stable/10/lib/libc/gen/fts-compat.c Wed Jun  1 17:35:03 2016
(r301149)
+++ stable/10/lib/libc/gen/fts-compat.c Wed Jun  1 17:37:16 2016
(r301150)
@@ -586,8 +586,10 @@ __fts_children_44bsd(sp, instr)
if ((fd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0)
return (NULL);
sp->fts_child = fts_build(sp, instr);
-   if (fchdir(fd))
+   if (fchdir(fd)) {
+   (void)_close(fd);
return (NULL);
+   }
(void)_close(fd);
return (sp->fts_child);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301149 - stable/10/bin/setfacl

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:35:03 2016
New Revision: 301149
URL: https://svnweb.freebsd.org/changeset/base/301149

Log:
  MFC r300649
  
  Fix Coverity CID 1019054 (String not null terminated) in setfacl.
  
  Increase the size of buf[] by one to allow room for a NUL character
  at the end.
  
  Reported by:  Coverity
  CID:  1019054

Modified:
  stable/10/bin/setfacl/file.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/setfacl/file.c
==
--- stable/10/bin/setfacl/file.cWed Jun  1 17:33:02 2016
(r301148)
+++ stable/10/bin/setfacl/file.cWed Jun  1 17:35:03 2016
(r301149)
@@ -43,7 +43,7 @@ acl_t
 get_acl_from_file(const char *filename)
 {
FILE *file;
-   char buf[BUFSIZ];
+   char buf[BUFSIZ+1];
 
if (filename == NULL)
err(1, "(null) filename in get_acl_from_file()");
@@ -61,7 +61,7 @@ get_acl_from_file(const char *filename)
err(1, "fopen() %s failed", filename);
}
 
-   fread(buf, sizeof(buf), (size_t)1, file);
+   fread(buf, sizeof(buf) - 1, (size_t)1, file);
if (ferror(file) != 0) {
fclose(file);
err(1, "error reading from %s", filename);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301148 - stable/10/bin/ps

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:33:02 2016
New Revision: 301148
URL: https://svnweb.freebsd.org/changeset/base/301148

Log:
  MFC r300648
  
  Fix CID 1011370 (Resource leak) in ps.
  
  There is no need to to call strdup() on the value returned by fmt().
  The latter calls fmt_argv() which always returns a dynamically
  allocated string, and calling strdup() on that leaks the memory
  allocated by fmt_argv().  Wave some const magic on ki_args and
  ki_env to make the direct assignment happy.  This requires a tweak
  to the asprintf() case to avoid a const vs. non-const mismatch.
  
  Reported by:  Coverity
  CID:  1011370

Modified:
  stable/10/bin/ps/ps.c
  stable/10/bin/ps/ps.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/ps/ps.c
==
--- stable/10/bin/ps/ps.c   Wed Jun  1 17:30:50 2016(r301147)
+++ stable/10/bin/ps/ps.c   Wed Jun  1 17:33:02 2016(r301148)
@@ -1217,6 +1217,7 @@ fmt(char **(*fn)(kvm_t *, const struct k
 static void
 saveuser(KINFO *ki)
 {
+   char *argsp;
 
if (ki->ki_p->ki_flag & P_INMEM) {
/*
@@ -1235,10 +1236,12 @@ saveuser(KINFO *ki)
if (ki->ki_p->ki_stat == SZOMB)
ki->ki_args = strdup("");
else if (UREADOK(ki) || (ki->ki_p->ki_args != NULL))
-   ki->ki_args = strdup(fmt(kvm_getargv, ki,
-   ki->ki_p->ki_comm, ki->ki_p->ki_tdname, MAXCOMLEN));
-   else
-   asprintf(&ki->ki_args, "(%s)", ki->ki_p->ki_comm);
+   ki->ki_args = fmt(kvm_getargv, ki,
+   ki->ki_p->ki_comm, ki->ki_p->ki_tdname, MAXCOMLEN);
+   else {
+   asprintf(&argsp, "(%s)", ki->ki_p->ki_comm);
+   ki->ki_args = argsp;
+   }
if (ki->ki_args == NULL)
errx(1, "malloc failed");
} else {
@@ -1246,8 +1249,8 @@ saveuser(KINFO *ki)
}
if (needenv) {
if (UREADOK(ki))
-   ki->ki_env = strdup(fmt(kvm_getenvv, ki,
-   (char *)NULL, (char *)NULL, 0));
+   ki->ki_env = fmt(kvm_getenvv, ki,
+   (char *)NULL, (char *)NULL, 0);
else
ki->ki_env = strdup("()");
if (ki->ki_env == NULL)

Modified: stable/10/bin/ps/ps.h
==
--- stable/10/bin/ps/ps.h   Wed Jun  1 17:30:50 2016(r301147)
+++ stable/10/bin/ps/ps.h   Wed Jun  1 17:33:02 2016(r301148)
@@ -42,8 +42,8 @@ typedef struct kinfo_str {
 
 typedef struct kinfo {
struct kinfo_proc *ki_p;/* kinfo_proc structure */
-   char *ki_args;  /* exec args */
-   char *ki_env;   /* environment */
+   const char *ki_args;/* exec args */
+   const char *ki_env; /* environment */
int ki_valid;   /* 1 => uarea stuff valid */
double   ki_pcpu;   /* calculated in main() */
segsz_t  ki_memsize;/* calculated in main() */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301147 - stable/10/bin/mv

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:30:50 2016
New Revision: 301147
URL: https://svnweb.freebsd.org/changeset/base/301147

Log:
  MFC r300643
  
  Close from_fd if malloc() fails to avoid a file descriptor leak.
  
  Reported by:  Coverity
  CID:  1007203

Modified:
  stable/10/bin/mv/mv.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/mv/mv.c
==
--- stable/10/bin/mv/mv.c   Wed Jun  1 17:29:15 2016(r301146)
+++ stable/10/bin/mv/mv.c   Wed Jun  1 17:30:50 2016(r301147)
@@ -285,6 +285,7 @@ fastcopy(const char *from, const char *t
}
if (bp == NULL && (bp = malloc((size_t)blen)) == NULL) {
warnx("malloc(%u) failed", blen);
+   (void)close(from_fd);
return (1);
}
while ((to_fd =
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301146 - stable/10/bin/sh

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:29:15 2016
New Revision: 301146
URL: https://svnweb.freebsd.org/changeset/base/301146

Log:
  MFC r300642
  
  Match the descriptions of the \H and \h prompt string sequences to reality.
  They were swapped.
  
  X-Confirmed by:   jilles

Modified:
  stable/10/bin/sh/sh.1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/sh/sh.1
==
--- stable/10/bin/sh/sh.1   Wed Jun  1 17:22:15 2016(r301145)
+++ stable/10/bin/sh/sh.1   Wed Jun  1 17:29:15 2016(r301146)
@@ -32,7 +32,7 @@
 .\"from: @(#)sh.1  8.6 (Berkeley) 5/4/95
 .\" $FreeBSD$
 .\"
-.Dd November 7, 2014
+.Dd May 24, 2016
 .Dt SH 1
 .Os
 .Sh NAME
@@ -1371,9 +1371,9 @@ may include any of the following formatt
 which are replaced by the given information:
 .Bl -tag -width indent
 .It Li \eH
-The local hostname.
-.It Li \eh
 The fully-qualified hostname.
+.It Li \eh
+The local hostname.
 .It Li \eW
 The final component of the current working directory.
 .It Li \ew
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301145 - in stable/10/usr.sbin/extattr: . tests

2016-06-01 Thread Alan Somers
Author: asomers
Date: Wed Jun  1 17:22:15 2016
New Revision: 301145
URL: https://svnweb.freebsd.org/changeset/base/301145

Log:
  MFC r298483, r298744, r299085, r299087, and r300747 to usr.sbin/extattr
  
  r300747 | asomers | 2016-05-26 08:26:49 -0600 (Thu, 26 May 2016) | 8 lines
  
  rmextattr(8) man page clarifications regarding -qq
  
  r299087 | asomers | 2016-05-04 15:07:30 -0600 (Wed, 04 May 2016) | 13 lines
  
  Fix "getextattr -x" with non-ascii attribute values
  
  extattr/rmextattr.c
  When printing hex output, treat all attribute values as unsigned
  char arrays instead of sign extending them to 32 bit values.
  
  extattr/tests/extattr_test.sh
  Add a regression test
  
  r299085 | asomers | 2016-05-04 14:20:55 -0600 (Wed, 04 May 2016) | 30 lines
  
  Allow setextattr(8) to take attribute values from stdin
  
  Add the -i option to setextattr. This option allow extended attribute data
  to be provided via stdin. Add a -qq option to getextattr, which omits the
  trailing newline. Together these options can be used to work with extended
  attributes whose values are large and/or binary.
  
  usr.sbin/extattr/Makefile:
  Link against libsbuf which is used for processing stdin data.
  
  usr.sbin/extattr/rmextattr.8:
  Document setextattr's -i option, getextattr's -qq option, and remove
  the BUG about setextattr only being useful for strings.
  
  usr.sbin/extattr/rmextattr.c:
  For setextattr operations, buffer attribute data in an sbuf. If -i
  is specified, pull the data from stdin, otherwise from the
  appropriate argurment.
  
  Update usage text and argument validation code for setextattr's -i
  option.
  
  usr.sbin/extattr/tests/extattr_test.sh
  Add tests for -q and -i.
  
  r298744 | asomers | 2016-04-28 09:13:50 -0600 (Thu, 28 Apr 2016) | 11 lines
  
  Add PACKAGE fields to usr.sbin/extattr/tests/Makefile
  
  usr.sbin/extattr/tests/Makefile
  Add boiler plate required by 298107 but omitted by 298483.  These
  two changes passed through CR in parallel.  I think this should get
  the full test suite running in Jenkins again.
  
  r298483 | asomers | 2016-04-22 11:02:47 -0600 (Fri, 22 Apr 2016) | 10 lines
  
  Add ATF tests for usr.sbin/extattr
  
  Add ATF tests for the existing behavior of setextattr, rmextattr, lsextattr,
  and getextattr.
  
  Sponsored by: Spectra Logic Corp

Added:
  stable/10/usr.sbin/extattr/tests/
 - copied from r298483, head/usr.sbin/extattr/tests/
Modified:
  stable/10/usr.sbin/extattr/Makefile
  stable/10/usr.sbin/extattr/rmextattr.8
  stable/10/usr.sbin/extattr/rmextattr.c
  stable/10/usr.sbin/extattr/tests/Makefile
  stable/10/usr.sbin/extattr/tests/extattr_test.sh

Modified: stable/10/usr.sbin/extattr/Makefile
==
--- stable/10/usr.sbin/extattr/Makefile Wed Jun  1 17:20:36 2016
(r301144)
+++ stable/10/usr.sbin/extattr/Makefile Wed Jun  1 17:22:15 2016
(r301145)
@@ -1,8 +1,12 @@
 # $FreeBSD$
 
+.include 
+
 PROG=  rmextattr
 MAN=   rmextattr.8
 
+LDADD= -lsbuf
+
 LINKS+=${BINDIR}/rmextattr ${BINDIR}/getextattr
 LINKS+=${BINDIR}/rmextattr ${BINDIR}/setextattr
 LINKS+=${BINDIR}/rmextattr ${BINDIR}/lsextattr
@@ -11,4 +15,8 @@ MLINKS+=  rmextattr.8 setextattr.8
 MLINKS+=   rmextattr.8 getextattr.8
 MLINKS+=   rmextattr.8 lsextattr.8
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
+
 .include 

Modified: stable/10/usr.sbin/extattr/rmextattr.8
==
--- stable/10/usr.sbin/extattr/rmextattr.8  Wed Jun  1 17:20:36 2016
(r301144)
+++ stable/10/usr.sbin/extattr/rmextattr.8  Wed Jun  1 17:22:15 2016
(r301145)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 30, 2000
+.Dd April 27, 2016
 .Dt RMEXTATTR 8
 .Os
 .Sh NAME
@@ -61,6 +61,12 @@
 .Ar attrname
 .Ar attrvalue
 .Ar filename ...
+.Nm setextattr
+.Fl i
+.Op Fl fhnq
+.Ar attrnamespace
+.Ar attrname
+.Ar filename ...
 .Sh DESCRIPTION
 These
 utilities
@@ -91,6 +97,9 @@ the remaining arguments.
 (No follow.)
 If the file is a symbolic link, perform the operation on the
 link itself rather than the file that the link points to.
+.It Fl i
+(From stdin.)
+Read attribute data from stdin instead of as an argument.
 .It Fl n
 .Dv ( NUL Ns
 -terminate.)
@@ -99,6 +108,7 @@ link itself rather than the file that th
 .It Fl q
 (Quiet.)
 Do not print out the pathname and suppress error messages.
+When given twice, print only the attribute value, with no trailing newline.
 .It Fl s
 (Stringify.)
 Escape nonprinting characters and put quotes around the output.
@@ -109,7 +119,9 @@ Print the output in hexadecimal.
 .Sh EXAMPLES
 .Bd -literal
 setextattr system md5 `md5 -q /boot/kernel/kernel` /boot/kernel/kernel
+md5 -q /boot/kernel/kernel | setextattr -i system md5 /boot/kerne

svn commit: r301144 - stable/10/usr.sbin/ypserv

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:20:36 2016
New Revision: 301144
URL: https://svnweb.freebsd.org/changeset/base/301144

Log:
  MFC r300636
  
  Delay calling yp_malloc_dnsent() until after some additional sanity
  checks to avoid leaking memory on error returns.
  
  Reported by:  Coverity
  CID:  1007416

Modified:
  stable/10/usr.sbin/ypserv/yp_dnslookup.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ypserv/yp_dnslookup.c
==
--- stable/10/usr.sbin/ypserv/yp_dnslookup.cWed Jun  1 17:18:35 2016
(r301143)
+++ stable/10/usr.sbin/ypserv/yp_dnslookup.cWed Jun  1 17:20:36 2016
(r301144)
@@ -489,9 +489,6 @@ yp_async_lookup_addr(struct svc_req *rqs
yp_find_dnsqent(svcudp_get_xid(rqstp->rq_xprt),BY_RPC_XID) != NULL)
return(YP_TRUE);
 
-   if ((q = yp_malloc_dnsent()) == NULL)
-   return(YP_YPERR);
-
switch (af) {
case AF_INET:
if (inet_aton(addr, (struct in_addr *)uaddr) != 1)
@@ -516,6 +513,9 @@ yp_async_lookup_addr(struct svc_req *rqs
return(YP_YPERR);
}
 
+   if ((q = yp_malloc_dnsent()) == NULL)
+   return(YP_YPERR);
+
if (debug)
yp_error("DNS address is: %s", buf);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301143 - stable/10/usr.sbin/ypserv

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:18:35 2016
New Revision: 301143
URL: https://svnweb.freebsd.org/changeset/base/301143

Log:
  MFC r300635
  
  Call free(cur) if strdup(dirp->d_name) fails to avoid a memory leak.
  
  Reported by:  Coverity
  CID:  1007414

Modified:
  stable/10/usr.sbin/ypserv/yp_server.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ypserv/yp_server.c
==
--- stable/10/usr.sbin/ypserv/yp_server.c   Wed Jun  1 17:16:35 2016
(r301142)
+++ stable/10/usr.sbin/ypserv/yp_server.c   Wed Jun  1 17:18:35 2016
(r301143)
@@ -711,6 +711,7 @@ yp_maplist_create(const char *domain)
yp_error("strdup() failed: %s",strerror(errno));
closedir(dird);
yp_maplist_free(yp_maplist);
+   free(cur);
return(NULL);
}
cur->next = yp_maplist;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301142 - stable/10/usr.sbin/acpi/acpidb

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:16:35 2016
New Revision: 301142
URL: https://svnweb.freebsd.org/changeset/base/301142

Log:
  MFC r300633
  
  Fix acpidb CIDs 1011279 (Buffer not null terminated) and 978405 and
  1199380 (Resource leak).
  
  load_dsdt() calls strncpy() to copy a filename and Coverity warns
  that the destination buffer may not be NUL terminated.  Fix this
  by using strlcpy() instead.  If silent truncation occurs, then the
  filename was not valid anyway.
  
  load_dsdt() leaks an fd (CID 978405) and a memory region allocated
  using mmap() (CID 1199380) when it returns.  Fix these by calling
  close() and munmap() as appropriate.
  
  Don't bother fixing the minor memory leak "list", allocated by
  AcGetAllTablesFromFile() (CID 1355191).
  
  Check for truncation when creating the temp file name.
  
  Set a flag to indicate that the temp file should be unlinked.
  Relying on a strcmp() test could delete the input file in contrived
  cases.
  
  Reported by:  Coverity
  CID:  1011279, 978405, 1199380
  Reviewed by:  jkim
  Differential Revision:https://reviews.freebsd.org/D6368

Modified:
  stable/10/usr.sbin/acpi/acpidb/acpidb.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/acpi/acpidb/acpidb.c
==
--- stable/10/usr.sbin/acpi/acpidb/acpidb.c Wed Jun  1 17:13:43 2016
(r301141)
+++ stable/10/usr.sbin/acpi/acpidb/acpidb.c Wed Jun  1 17:16:35 2016
(r301142)
@@ -383,8 +383,7 @@ load_dsdt(const char *dsdtfile)
charfiletmp[PATH_MAX];
u_int8_t*code;
struct stat sb;
-   int fd, fd2;
-   int error;
+   int dounlink, error, fd;
 
fd = open(dsdtfile, O_RDONLY, 0);
if (fd == -1) {
@@ -397,11 +396,13 @@ load_dsdt(const char *dsdtfile)
return (-1);
}
code = mmap(NULL, (size_t)sb.st_size, PROT_READ, MAP_PRIVATE, fd, 
(off_t)0);
+   close(fd);
if (code == NULL) {
perror("mmap");
return (-1);
}
if ((error = AcpiInitializeSubsystem()) != AE_OK) {
+   munmap(code, (size_t)sb.st_size);
return (-1);
}
 
@@ -409,21 +410,30 @@ load_dsdt(const char *dsdtfile)
 * make sure DSDT data contains table header or not.
 */
if (strncmp((char *)code, "DSDT", 4) == 0) {
-   strncpy(filetmp, dsdtfile, sizeof(filetmp));
+   dounlink = 0;
+   strlcpy(filetmp, dsdtfile, sizeof(filetmp));
} else {
+   dounlink = 1;
mode_t  mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
dummy_dsdt_table.Length = sizeof(ACPI_TABLE_HEADER) + 
sb.st_size;
-   snprintf(filetmp, sizeof(filetmp), "%s.tmp", dsdtfile);
-   fd2 = open(filetmp, O_WRONLY | O_CREAT | O_TRUNC, mode);
-   if (fd2 == -1) {
+   if ((size_t)snprintf(filetmp, sizeof(filetmp), "%s.tmp",
+   dsdtfile) > sizeof(filetmp) - 1) {
+   fprintf(stderr, "file name too long\n");
+   munmap(code, (size_t)sb.st_size);
+   return (-1);
+   }
+   fd = open(filetmp, O_WRONLY | O_CREAT | O_TRUNC, mode);
+   if (fd == -1) {
perror("open");
+   munmap(code, (size_t)sb.st_size);
return (-1);
}
-   write(fd2, &dummy_dsdt_table, sizeof(ACPI_TABLE_HEADER));
+   write(fd, &dummy_dsdt_table, sizeof(ACPI_TABLE_HEADER));
 
-   write(fd2, code, sb.st_size);
-   close(fd2);
+   write(fd, code, sb.st_size);
+   close(fd);
}
+   munmap(code, (size_t)sb.st_size);
 
/*
 * Install the virtual machine version of address space handlers.
@@ -484,7 +494,7 @@ load_dsdt(const char *dsdtfile)
AcpiGbl_DebuggerConfiguration = 0;
AcpiDbUserCommands(':', NULL);
 
-   if (strcmp(dsdtfile, filetmp) != 0) {
+   if (dounlink) {
unlink(filetmp);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301141 - stable/10/usr.sbin/acpi/acpidump

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:13:43 2016
New Revision: 301141
URL: https://svnweb.freebsd.org/changeset/base/301141

Log:
  MFC r300632
  
  Fix acpidump CID 1011278 (Buffer not null terminated) and other issues
  
  Coverity reports that a buffer used for temporary file generation
  might not be NUL terminated by strncpy().  This is probably not
  true because the input gets passed through realpath(), but if the
  path name is sufficiently long the name could be truncated and cause
  other problems.  The code for generating the temp file names is
  also overly complex.  Instead of a bunch of calls to strncpy() and
  and strncat(), simplify the code by using snprintf() and add checks
  for unexpected truncation.
  
  The output file created by iasl -d is predictable.  Fix this by
  using  mkdtemp() to create a directory to hold the iasl input and
  output files.
  
  Check the return values of more syscalls.
  
  Reported by:  Coverity
  CID:  1011278
  Reviewed by:  jkim
  Differential Revision:https://reviews.freebsd.org/D6360

Modified:
  stable/10/usr.sbin/acpi/acpidump/acpi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/acpi/acpidump/acpi.c
==
--- stable/10/usr.sbin/acpi/acpidump/acpi.c Wed Jun  1 17:09:50 2016
(r301140)
+++ stable/10/usr.sbin/acpi/acpidump/acpi.c Wed Jun  1 17:13:43 2016
(r301141)
@@ -1465,27 +1465,34 @@ dsdt_save_file(char *outfile, ACPI_TABLE
 void
 aml_disassemble(ACPI_TABLE_HEADER *rsdt, ACPI_TABLE_HEADER *dsdp)
 {
-   char buf[PATH_MAX], tmpstr[PATH_MAX];
+   char buf[PATH_MAX], tmpstr[PATH_MAX], wrkdir[PATH_MAX];
+   const char *iname = "/acpdump.din";
+   const char *oname = "/acpdump.dsl";
const char *tmpdir;
-   char *tmpext;
FILE *fp;
size_t len;
-   int fd;
+   int fd, status;
+   pid_t pid;
 
tmpdir = getenv("TMPDIR");
if (tmpdir == NULL)
tmpdir = _PATH_TMP;
-   strncpy(tmpstr, tmpdir, sizeof(tmpstr));
-   if (realpath(tmpstr, buf) == NULL) {
+   if (realpath(tmpdir, buf) == NULL) {
perror("realpath tmp dir");
return;
}
-   strncpy(tmpstr, buf, sizeof(tmpstr));
-   strncat(tmpstr, "/acpidump.", sizeof(tmpstr) - strlen(buf));
-   len = strlen(tmpstr);
-   tmpext = tmpstr + len;
-   strncpy(tmpext, "XX", sizeof(tmpstr) - len);
-   fd = mkstemp(tmpstr);
+   len = sizeof(wrkdir) - strlen(iname);
+   if ((size_t)snprintf(wrkdir, len, "%s/acpidump.XX", buf) > len-1 ) {
+   fprintf(stderr, "$TMPDIR too long\n");
+   return;
+   }
+   if  (mkdtemp(wrkdir) == NULL) {
+   perror("mkdtemp tmp working dir");
+   return;
+   }
+   assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, iname)
+   <= sizeof(tmpstr) - 1);
+   fd = open(tmpstr, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
if (fd < 0) {
perror("iasl tmp file");
return;
@@ -1494,28 +1501,46 @@ aml_disassemble(ACPI_TABLE_HEADER *rsdt,
close(fd);
 
/* Run iasl -d on the temp file */
-   if (fork() == 0) {
+   if ((pid = fork()) == 0) {
close(STDOUT_FILENO);
if (vflag == 0)
close(STDERR_FILENO);
execl("/usr/sbin/iasl", "iasl", "-d", tmpstr, NULL);
err(1, "exec");
}
-
-   wait(NULL);
-   unlink(tmpstr);
+   if (pid > 0)
+   wait(&status);
+   if (unlink(tmpstr) < 0) {
+   perror("unlink");
+   goto out;
+   }
+   if (pid < 0) {
+   perror("fork");
+   goto out;
+   }
+   if (status != 0) {
+   fprintf(stderr, "iast exit status = %d\n", status);
+   }
 
/* Dump iasl's output to stdout */
-   strncpy(tmpext, "dsl", sizeof(tmpstr) - len);
+   assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, oname)
+   <= sizeof(tmpstr) -1);
fp = fopen(tmpstr, "r");
-   unlink(tmpstr);
+   if (unlink(tmpstr) < 0) {
+   perror("unlink");
+   goto out;
+   }
if (fp == NULL) {
perror("iasl tmp file (read)");
-   return;
+   goto out;
}
while ((len = fread(buf, 1, sizeof(buf), fp)) > 0)
fwrite(buf, 1, len, stdout);
fclose(fp);
+
+out:
+   if (rmdir(wrkdir) < 0)
+   perror("rmdir");
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301140 - stable/10/bin/sh

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 17:09:50 2016
New Revision: 301140
URL: https://svnweb.freebsd.org/changeset/base/301140

Log:
  MFC r300442
  
  Hopefully fix Coverity CID 1008328 (Out-of-bounds write) in /bin/sh.
  
  Replace the magic constant 127 in the loop interation count with
  "PROMPTLEN - 1".
  
  gethostname() is not guaranteed to NUL terminate the destination
  string if it is too short. Decrease the length passed to gethostname()
  by one, and add a NUL at the end of the buffer to make sure the
  following loop to find the end of the name properly terminates.
  
  The default: case is the likely cause of Coverity CID 1008328.  If
  i is 126 at the top of the loop interation where the default case
  is triggered, i will be incremented to 127 by the default case,
  then incremented to 128 at the top of the loop before being compared
  to 127 (PROMPTLENT - 1) and terminating the loop. Then the NUL
  termination code after the loop will write to ps[128].  Fix by
  checking for overflow before incrementing the index and storing the
  second character in the buffer.
  
  These fixes are not guaranteed to satisfy Coverity. The code that
  increments i in the 'h'/'H' and 'w'/'W' cases may be beyond its
  capability to analyze, but the code appears to be safe.
  
  Reported by:  Coverity
  CID:  1008328
  Reviewed by:  jilles, cem
  Differential Revision:https://reviews.freebsd.org/D6482

Modified:
  stable/10/bin/sh/parser.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/sh/parser.c
==
--- stable/10/bin/sh/parser.c   Wed Jun  1 16:56:29 2016(r301139)
+++ stable/10/bin/sh/parser.c   Wed Jun  1 17:09:50 2016(r301140)
@@ -1974,7 +1974,7 @@ getprompt(void *unused __unused)
/*
 * Format prompt string.
 */
-   for (i = 0; (i < 127) && (*fmt != '\0'); i++, fmt++)
+   for (i = 0; (i < PROMPTLEN - 1) && (*fmt != '\0'); i++, fmt++)
if (*fmt == '\\')
switch (*++fmt) {
 
@@ -1987,7 +1987,8 @@ getprompt(void *unused __unused)
case 'h':
case 'H':
ps[i] = '\0';
-   gethostname(&ps[i], PROMPTLEN - i);
+   gethostname(&ps[i], PROMPTLEN - i - 1);
+   ps[PROMPTLEN - 1] = '\0';
/* Skip to end of hostname. */
trim = (*fmt == 'h') ? '.' : '\0';
while ((ps[i] != '\0') && (ps[i] != trim))
@@ -2037,8 +2038,9 @@ getprompt(void *unused __unused)
 * Emit unrecognized formats verbatim.
 */
default:
-   ps[i++] = '\\';
-   ps[i] = *fmt;
+   ps[i] = '\\';
+   if (i < PROMPTLEN - 1)
+   ps[++i] = *fmt;
break;
}
else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-06-01 Thread Don Lewis
On  1 Jun, To: src-committ...@freebsd.org wrote:
> Author: truckman
> Date: Wed Jun  1 16:56:29 2016
> New Revision: 301139
> URL: https://svnweb.freebsd.org/changeset/base/301139
> 
> Log:
>   The (i < PROMPTLEN - 1) test added by r300442 in the code for the default
>   case of \c in the prompt format string is a no-op.  We already passed
>   this test at the top of the loop, and i has not yet been incremented in
>   this path.  Change this test to (i < PROMPTLEN - 2).
>   
>   Reported by:Coverity
>   CID:1008328
>   Reviewed by:cem
>   MFC after:  1 week

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


svn commit: r301139 - head/bin/sh

2016-06-01 Thread Don Lewis
Author: truckman
Date: Wed Jun  1 16:56:29 2016
New Revision: 301139
URL: https://svnweb.freebsd.org/changeset/base/301139

Log:
  The (i < PROMPTLEN - 1) test added by r300442 in the code for the default
  case of \c in the prompt format string is a no-op.  We already passed
  this test at the top of the loop, and i has not yet been incremented in
  this path.  Change this test to (i < PROMPTLEN - 2).
  
  Reported by:  Coverity
  CID:  1008328
  Reviewed by:  cem
  MFC after:1 week

Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==
--- head/bin/sh/parser.cWed Jun  1 16:53:02 2016(r301138)
+++ head/bin/sh/parser.cWed Jun  1 16:56:29 2016(r301139)
@@ -2063,7 +2063,7 @@ getprompt(void *unused __unused)
 */
default:
ps[i] = '\\';
-   if (i < PROMPTLEN - 1)
+   if (i < PROMPTLEN - 2)
ps[++i] = *fmt;
break;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301138 - head/usr.bin/sed

2016-06-01 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Jun  1 16:53:02 2016
New Revision: 301138
URL: https://svnweb.freebsd.org/changeset/base/301138

Log:
  sed(1): Fix a mismatch and sync with the OpenBSD's commit.
  
  This was causing some strange behaviour.
  
  Reported by:  olivier
  Obtained from:OpenBSD (CVS rev. 1.28)

Modified:
  head/usr.bin/sed/process.c

Modified: head/usr.bin/sed/process.c
==
--- head/usr.bin/sed/process.c  Wed Jun  1 16:45:08 2016(r301137)
+++ head/usr.bin/sed/process.c  Wed Jun  1 16:53:02 2016(r301138)
@@ -394,7 +394,7 @@ substitute(struct s_command *cp)
linenum, fname, cp->u.s->maxbref);
}
}
-   if (!regexec_e(re, s, 0, 0, 0, psl))
+   if (!regexec_e(re, ps, 0, 0, 0, psl))
return (0);
 
SS.len = 0; /* Clean substitute space. */
@@ -404,7 +404,7 @@ substitute(struct s_command *cp)
 
do {
/* Copy the leading retained string. */
-   if (n <= 1 && match[0].rm_so - le)
+   if (n <= 1 && (match[0].rm_so > le))
cspace(&SS, s, match[0].rm_so - le, APPEND);
 
/* Skip zero-length matches right after other matches. */
@@ -425,8 +425,8 @@ substitute(struct s_command *cp)
}
 
/* Move past this match. */
-   s += (match[0].rm_eo - le);
-   slen -= (match[0].rm_eo - le);
+   s = ps + match[0].rm_eo;
+   slen = psl - match[0].rm_eo;
le = match[0].rm_eo;
 
/*
@@ -446,7 +446,8 @@ substitute(struct s_command *cp)
} else
lastempty = 0;
 
-   } while (n >= 0 && slen >= 0 && regexec_e(re, ps, 0, 0, le, psl));
+   } while (n >= 0 && slen >= 0 &&
+   regexec_e(re, ps, REG_NOTBOL, 0, le, psl));
 
/* Did not find the requested number of matches. */
if (n > 1)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301137 - in head: etc etc/ppp usr.sbin/ppp

2016-06-01 Thread Glen Barber
Author: gjb
Date: Wed Jun  1 16:45:08 2016
New Revision: 301137
URL: https://svnweb.freebsd.org/changeset/base/301137

Log:
  Revert r289096:
  
  Files listed in 'CONFS' are not properly included in new
  installations (missing from base.txz), for reasons I still
  do not fully understand.
  
  This reverts the change excluding /etc/ppp/ppp.conf from
  a new installation.  /etc/dma/dma.conf is also affected,
  but requires a different solution, still being investigated.
  
  Reported by:  Ben Woods
  Sponsored by: The FreeBSD Foundation

Added:
  head/etc/ppp/
 - copied from r289095, head/etc/ppp/
Deleted:
  head/usr.sbin/ppp/ppp.conf
Modified:
  head/etc/Makefile
  head/usr.sbin/ppp/Makefile

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Wed Jun  1 16:12:26 2016(r301136)
+++ head/etc/Makefile   Wed Jun  1 16:45:08 2016(r301137)
@@ -305,6 +305,10 @@ distribution:
 .endif
cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
${MTREE} ${DESTDIR}/etc/mtree
+.if ${MK_PPP} != "no"
+   cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
+   ${PPPCNF} ${DESTDIR}/etc/ppp
+.endif
 .if ${MK_MAIL} != "no"
cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
${ETCMAIL} ${DESTDIR}/etc/mail

Modified: head/usr.sbin/ppp/Makefile
==
--- head/usr.sbin/ppp/Makefile  Wed Jun  1 16:12:26 2016(r301136)
+++ head/usr.sbin/ppp/Makefile  Wed Jun  1 16:45:08 2016(r301137)
@@ -21,9 +21,6 @@ PPP_NO_PAM=
 PPP_NO_RADIUS=
 PPP_NO_SUID=
 .endif
-CONFS= ppp.conf
-CONFSDIR=  ${CONFDIR}/ppp
-CONFSMODE= 600
 
 .if ${MK_ATM} == "no"
 PPP_NO_ATM=
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299393 - in head: . share/mk

2016-06-01 Thread John Baldwin
On Monday, May 30, 2016 01:21:50 PM Julian Elischer wrote:
> On 27/05/2016 2:28 AM, John Baldwin wrote:
> > On Wednesday, May 25, 2016 03:27:07 PM Hans Petter Selasky wrote:
> >> On 05/11/16 00:32, John Baldwin wrote:
> >>> Author: jhb
> >>> Date: Tue May 10 22:32:23 2016
> >>> New Revision: 299393
> >>> URL: https://svnweb.freebsd.org/changeset/base/299393
> >>>
> >>> Log:
> >>>Change the default installation directory for modules to /boot/modules.
> >>>
> >>>Kernel installs always override KMODDIR when installing modules, so
> >>>this default setting is only used for standalone module builds.  Many
> >>>out-of-tree modules manually override KMODDIR already to avoid placing
> >>>modules in /boot/kernel.  This now makes that behavior the default.
> >>>
> >>>Discussed on:  arch@
> >>>Reviewed by:   imp
> >>>Relnotes:  yes
> >>>
> >> Just a small nit:
> >>
> >> There is a comment in bsd.own.mk which needs updating too:
> >>
> >>> #
> >>> # KMODDIR   Base path for loadable kernel modules
> >>> #   (see kld(4)). [/boot/kernel]
> > Oops, thanks.  Fixed.
> 
> the comment should also mention it does not cover in-tree modules.

Actually, it does.  If you cd /sys/modules/foo and run make install it
installs to this path.  Only buildkernel overrides this explicitly
when installing the modules built together with a kernel.

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


Re: svn commit: r301071 - head/sys/sys

2016-06-01 Thread Konstantin Belousov
On Wed, Jun 01, 2016 at 05:44:47PM +0200, Ed Schouten wrote:
> Hi Bruce,
> 
> 2016-06-01 11:31 GMT+02:00 Bruce Evans :
> >>  - This header file has always depended on pthread_t, pthread_attr_t,
> >>struct timespec, size_t and uid_t. Only as of POSIX 2008, these
> >>dependencies have been states explicitly. They should now be defined.
> >
> > Not always.  POSIX didn't have pthreads or timespecs before about 1993.
> 
> Sure. s/always/for a long time/
> 
> >>  - In our implementation, struct sigevent::sigev_notify_attributes has
> >>type "void *" instead of "pthread_attr_t *". My guess is that this was
> >>done to prevent pulling in the pthread types, but this can easily be
> >>avoided by using the underlying structure types.
> >
> > Not easily, since the tags of the underlying struct types are in the
> > application namespace, at least up to POSIX 2001.
> 
> Yeah, it's quite unfortunate that we use structure types starting with
> 'pthread'. They should have had leading underscores. But in my opinion
> that's not a problem specific to this change; it's a problem with our
> pthread implementation in general.
> 
> >> +#include 
> >
> > This gives the following pollution (which breaks almost everything since
> >  includes this header:
> > - struct tag names pthread*
> > - struct member names state and mutex
> 
> Yes. It would have made so much more sense if a header like
>  would have defined all pthread types as __pthread_t,
> __pthread_mutex_t, etc. That way there would have been a way to expose
> just pthread_t and pthread_attr_t without pulling in the rest.
No, it wouldn't.

Replace the typedefs with the forward-struct names by the void *.
The only other change would be the libthr, where some casts might
be needed.

Use void * directly in signal.h if possible.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301136 - head/lib/libthr/thread

2016-06-01 Thread Conrad E. Meyer
Author: cem
Date: Wed Jun  1 16:12:26 2016
New Revision: 301136
URL: https://svnweb.freebsd.org/changeset/base/301136

Log:
  libthr: Use formatted PANIC()
  
  No functional change, although _thread_printf() may be slightly less 
functional
  or render some values differently from libc snprintf(3).  No ABI change.
  
  Reviewed by:  kib
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D6672

Modified:
  head/lib/libthr/thread/thr_cond.c
  head/lib/libthr/thread/thr_exit.c
  head/lib/libthr/thread/thr_mutex.c

Modified: head/lib/libthr/thread/thr_cond.c
==
--- head/lib/libthr/thread/thr_cond.c   Wed Jun  1 16:11:09 2016
(r301135)
+++ head/lib/libthr/thread/thr_cond.c   Wed Jun  1 16:12:26 2016
(r301136)
@@ -258,7 +258,7 @@ cond_wait_user(struct pthread_cond *cvp,
 
curthread = _get_curthread();
if (curthread->wchan != NULL)
-   PANIC("thread was already on queue.");
+   PANIC("thread %p was already on queue.", curthread);
 
if (cancel)
_thr_testcancel(curthread);

Modified: head/lib/libthr/thread/thr_exit.c
==
--- head/lib/libthr/thread/thr_exit.c   Wed Jun  1 16:11:09 2016
(r301135)
+++ head/lib/libthr/thread/thr_exit.c   Wed Jun  1 16:12:26 2016
(r301136)
@@ -209,13 +209,10 @@ _pthread_exit_mask(void *status, sigset_
struct pthread *curthread = _get_curthread();
 
/* Check if this thread is already in the process of exiting: */
-   if (curthread->cancelling) {
-   char msg[128];
-   snprintf(msg, sizeof(msg), "Thread %p has called "
+   if (curthread->cancelling)
+   PANIC("Thread %p has called "
"pthread_exit() from a destructor. POSIX 1003.1 "
"1996 s16.2.5.2 does not allow this!", curthread);
-   PANIC(msg);
-   }
 
/* Flag this thread as exiting. */
curthread->cancelling = 1;
@@ -312,7 +309,7 @@ exit_thread(void)
 
 #if defined(_PTHREADS_INVARIANTS)
if (THR_IN_CRITICAL(curthread))
-   PANIC("thread exits with resources held!");
+   PANIC("thread %p exits with resources held!", curthread);
 #endif
/*
 * Kernel will do wakeup at the address, so joiner thread

Modified: head/lib/libthr/thread/thr_mutex.c
==
--- head/lib/libthr/thread/thr_mutex.c  Wed Jun  1 16:11:09 2016
(r301135)
+++ head/lib/libthr/thread/thr_mutex.c  Wed Jun  1 16:12:26 2016
(r301136)
@@ -135,13 +135,9 @@ mutex_assert_is_owned(struct pthread_mut
 {
 
 #if defined(_PTHREADS_INVARIANTS)
-   if (__predict_false(m->m_qe.tqe_prev == NULL)) {
-   char msg[128];
-   snprintf(msg, sizeof(msg),
-   "mutex %p own %#x is not on list %p %p",
+   if (__predict_false(m->m_qe.tqe_prev == NULL))
+   PANIC("mutex %p own %#x is not on list %p %p",
m, m->m_lock.m_owner, m->m_qe.tqe_prev, m->m_qe.tqe_next);
-   PANIC(msg);
-   }
 #endif
 }
 
@@ -152,27 +148,20 @@ mutex_assert_not_owned(struct pthread *c
 
 #if defined(_PTHREADS_INVARIANTS)
if (__predict_false(m->m_qe.tqe_prev != NULL ||
-   m->m_qe.tqe_next != NULL)) {
-   char msg[128];
-   snprintf(msg, sizeof(msg),
-   "mutex %p own %#x is on list %p %p",
+   m->m_qe.tqe_next != NULL))
+   PANIC("mutex %p own %#x is on list %p %p",
m, m->m_lock.m_owner, m->m_qe.tqe_prev, m->m_qe.tqe_next);
-   PANIC(msg);
-   }
if (__predict_false(is_robust_mutex(m) &&
(m->m_lock.m_rb_lnk != 0 || m->m_rb_prev != NULL ||
(is_pshared_mutex(m) && curthread->robust_list ==
(uintptr_t)&m->m_lock) ||
(!is_pshared_mutex(m) && curthread->priv_robust_list ==
-   (uintptr_t)&m->m_lock {
-   char msg[128];
-   snprintf(msg, sizeof(msg),
+   (uintptr_t)&m->m_lock
+   PANIC(
 "mutex %p own %#x is on robust linkage %p %p head %p phead %p",
m, m->m_lock.m_owner, (void *)m->m_lock.m_rb_lnk,
m->m_rb_prev, (void *)curthread->robust_list,
(void *)curthread->priv_robust_list);
-   PANIC(msg);
-   }
 #endif
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301135 - head/lib/libthr/thread

2016-06-01 Thread Conrad E. Meyer
Author: cem
Date: Wed Jun  1 16:11:09 2016
New Revision: 301135
URL: https://svnweb.freebsd.org/changeset/base/301135

Log:
  libthr: _thread_vprintf: Enhance support for %p, %#x
  
  No functional change.  No ABI change.
  
  Reviewed by:  kib
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D6672

Modified:
  head/lib/libthr/thread/thr_printf.c

Modified: head/lib/libthr/thread/thr_printf.c
==
--- head/lib/libthr/thread/thr_printf.c Wed Jun  1 16:09:56 2016
(r301134)
+++ head/lib/libthr/thread/thr_printf.c Wed Jun  1 16:11:09 2016
(r301135)
@@ -68,15 +68,19 @@ _thread_vprintf(int fd, const char *fmt,
unsigned long r, u;
int c;
long d;
-   int islong;
+   int islong, isalt;
 
while ((c = *fmt++)) {
+   isalt = 0;
islong = 0;
if (c == '%') {
 next:  c = *fmt++;
if (c == '\0')
return;
switch (c) {
+   case '#':
+   isalt = 1;
+   goto next;
case 'c':
pchar(fd, va_arg(ap, int));
continue;
@@ -87,10 +91,13 @@ next:   c = *fmt++;
islong = 1;
goto next;
case 'p':
+   pstr(fd, "0x");
islong = 1;
case 'd':
case 'u':
case 'x':
+   if (c == 'x' && isalt)
+   pstr(fd, "0x");
r = ((c == 'u') || (c == 'd')) ? 10 : 16;
if (c == 'd') {
if (islong)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301134 - head/lib/libthr/thread

2016-06-01 Thread Conrad E. Meyer
Author: cem
Date: Wed Jun  1 16:09:56 2016
New Revision: 301134
URL: https://svnweb.freebsd.org/changeset/base/301134

Log:
  libthr: Add vprintf variant of _thread_printf, formatted PANIC()
  
  No ABI change.
  
  Reviewed by:  kib
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D6672

Modified:
  head/lib/libthr/thread/thr_exit.c
  head/lib/libthr/thread/thr_printf.c
  head/lib/libthr/thread/thr_private.h

Modified: head/lib/libthr/thread/thr_exit.c
==
--- head/lib/libthr/thread/thr_exit.c   Wed Jun  1 15:56:07 2016
(r301133)
+++ head/lib/libthr/thread/thr_exit.c   Wed Jun  1 16:09:56 2016
(r301134)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #ifdef _PTHREAD_FORCED_UNWIND
 #include 
 #endif
+#include 
 #include 
 #include 
 #include 
@@ -172,18 +173,31 @@ thread_unwind(void)
 #endif
 
 void
-_thread_exit(const char *fname, int lineno, const char *msg)
+_thread_exitf(const char *fname, int lineno, const char *fmt, ...)
 {
+   va_list ap;
 
/* Write an error message to the standard error file descriptor: */
-   _thread_printf(2,
-   "Fatal error '%s' at line %d in file %s (errno = %d)\n",
-   msg, lineno, fname, errno);
+   _thread_printf(STDERR_FILENO, "Fatal error '");
+
+   va_start(ap, fmt);
+   _thread_vprintf(STDERR_FILENO, fmt, ap);
+   va_end(ap);
+
+   _thread_printf(STDERR_FILENO, "' at line %d in file %s (errno = %d)\n",
+   lineno, fname, errno);
 
abort();
 }
 
 void
+_thread_exit(const char *fname, int lineno, const char *msg)
+{
+
+   _thread_exitf(fname, lineno, "%s", msg);
+}
+
+void
 _pthread_exit(void *status)
 {
_pthread_exit_mask(status, NULL);

Modified: head/lib/libthr/thread/thr_printf.c
==
--- head/lib/libthr/thread/thr_printf.c Wed Jun  1 15:56:07 2016
(r301133)
+++ head/lib/libthr/thread/thr_printf.c Wed Jun  1 16:09:56 2016
(r301134)
@@ -52,8 +52,17 @@ static void  pstr(int fd, const char *s);
 void
 _thread_printf(int fd, const char *fmt, ...)
 {
+   va_list ap;
+
+   va_start(ap, fmt);
+   _thread_vprintf(fd, fmt, ap);
+   va_end(ap);
+}
+
+void
+_thread_vprintf(int fd, const char *fmt, va_list ap)
+{
static const char digits[16] = "0123456789abcdef";
-   va_list  ap;
char buf[20];
char *s;
unsigned long r, u;
@@ -61,13 +70,12 @@ _thread_printf(int fd, const char *fmt, 
long d;
int islong;
 
-   va_start(ap, fmt);
while ((c = *fmt++)) {
islong = 0;
if (c == '%') {
 next:  c = *fmt++;
if (c == '\0')
-   goto out;
+   return;
switch (c) {
case 'c':
pchar(fd, va_arg(ap, int));
@@ -111,8 +119,6 @@ next:   c = *fmt++;
}
pchar(fd, c);
}
-out:   
-   va_end(ap);
 }
 
 /*

Modified: head/lib/libthr/thread/thr_private.h
==
--- head/lib/libthr/thread/thr_private.hWed Jun  1 15:56:07 2016
(r301133)
+++ head/lib/libthr/thread/thr_private.hWed Jun  1 16:09:56 2016
(r301134)
@@ -86,7 +86,7 @@ TAILQ_HEAD(mutex_queue, pthread_mutex);
 /*
  * Kernel fatal error handler macro.
  */
-#define PANIC(string)  _thread_exit(__FILE__,__LINE__,string)
+#define PANIC(args...) _thread_exitf(__FILE__, __LINE__, ##args)
 
 /* Output debug messages like this: */
 #define stdout_debug(args...)  _thread_printf(STDOUT_FILENO, ##args)
@@ -778,6 +778,8 @@ void_mutex_leave_robust(struct pthread 
 void   _libpthread_init(struct pthread *) __hidden;
 struct pthread *_thr_alloc(struct pthread *) __hidden;
 void   _thread_exit(const char *, int, const char *) __hidden __dead2;
+void   _thread_exitf(const char *, int, const char *, ...) __hidden __dead2
+   __printflike(3, 4);
 int_thr_ref_add(struct pthread *, struct pthread *, int) __hidden;
 void   _thr_ref_delete(struct pthread *, struct pthread *) __hidden;
 void   _thr_ref_delete_unlocked(struct pthread *, struct pthread *) __hidden;
@@ -789,7 +791,8 @@ void_thr_stack_free(struct pthread_attr
 void   _thr_free(struct pthread *, struct pthread *) __hidden;
 void   _thr_gc(struct pthread *) __hidden;
 void_thread_cleanupspecific(void) __hidden;
-void   _thread_printf(int, const char *, ...) __hidden;
+void   _thread_printf(int, const char *, ...) __hidden __printflike(2, 3);
+void   _thread_vprintf(int, const char *, va_list) __hidden;
 void   _thr_spinlock_init(void) __hidden;
 void   _thr_cancel_enter(struct pthread *) __hidden;
 void   _thr_cancel_

svn commit: r301133 - head/sys/contrib/dev/ath/ath_hal/ar9300

2016-06-01 Thread Adrian Chadd
Author: adrian
Date: Wed Jun  1 15:56:07 2016
New Revision: 301133
URL: https://svnweb.freebsd.org/changeset/base/301133

Log:
  [ath_hal] add azimuth timestamp payload marking for AR9380 and later chips.

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit_ds.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit_ds.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit_ds.cWed Jun  1 
15:47:19 2016(r301132)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit_ds.cWed Jun  1 
15:56:07 2016(r301133)
@@ -614,6 +614,7 @@ ar9300_set_11n_tx_desc(
 (key_ix != HAL_TXKEYIX_INVALID ? SM(key_ix, AR_dest_idx) : 0)
   | SM(type, AR_frame_type)
   | (flags & HAL_TXDESC_NOACK ? AR_no_ack : 0)
+  | (flags & HAL_TXDESC_HWTS ? AR_insert_ts : 0)
   | (flags & HAL_TXDESC_EXT_ONLY ? AR_ext_only : 0)
   | (flags & HAL_TXDESC_EXT_AND_CTL ? AR_ext_and_ctl : 0);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301132 - head/sys/dev/urtwn

2016-06-01 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Jun  1 15:47:19 2016
New Revision: 301132
URL: https://svnweb.freebsd.org/changeset/base/301132

Log:
  urtwn: unbreak CTS-to-self protection mode.
  
  Do not set HWRTSEN bit when CTS-to-self is used; CTS2SELF bit triggers
  CTS frame transmission by itself (and it does not work when HWRTSEN bit
  is set).
  
  Tested with:
   * RTL8188CUS, HOSTAP mode (11g)
   * RTL8188EU, STA mode (11g)

Modified:
  head/sys/dev/urtwn/if_urtwn.c

Modified: head/sys/dev/urtwn/if_urtwn.c
==
--- head/sys/dev/urtwn/if_urtwn.c   Wed Jun  1 15:39:11 2016
(r301131)
+++ head/sys/dev/urtwn/if_urtwn.c   Wed Jun  1 15:47:19 2016
(r301132)
@@ -2956,8 +2956,7 @@ urtwn_tx_data(struct urtwn_softc *sc, st
switch (ic->ic_protmode) {
case IEEE80211_PROT_CTSONLY:
txd->txdw4 |= htole32(
-   R92C_TXDW4_CTS2SELF |
-   R92C_TXDW4_HWRTSEN);
+   R92C_TXDW4_CTS2SELF);
break;
case IEEE80211_PROT_RTSCTS:
txd->txdw4 |= htole32(
@@ -3118,11 +3117,10 @@ urtwn_tx_raw(struct urtwn_softc *sc, str
params->ibp_try0));
}
if (params->ibp_flags & IEEE80211_BPF_RTS)
-   txd->txdw4 |= htole32(R92C_TXDW4_RTSEN);
+   txd->txdw4 |= htole32(R92C_TXDW4_RTSEN | R92C_TXDW4_HWRTSEN);
if (params->ibp_flags & IEEE80211_BPF_CTS)
txd->txdw4 |= htole32(R92C_TXDW4_CTS2SELF);
if (txd->txdw4 & htole32(R92C_TXDW4_RTSEN | R92C_TXDW4_CTS2SELF)) {
-   txd->txdw4 |= htole32(R92C_TXDW4_HWRTSEN);
txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE,
URTWN_RIDX_OFDM24));
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r301071 - head/sys/sys

2016-06-01 Thread Ed Schouten
Hi Bruce,

2016-06-01 11:31 GMT+02:00 Bruce Evans :
>>  - This header file has always depended on pthread_t, pthread_attr_t,
>>struct timespec, size_t and uid_t. Only as of POSIX 2008, these
>>dependencies have been states explicitly. They should now be defined.
>
> Not always.  POSIX didn't have pthreads or timespecs before about 1993.

Sure. s/always/for a long time/

>>  - In our implementation, struct sigevent::sigev_notify_attributes has
>>type "void *" instead of "pthread_attr_t *". My guess is that this was
>>done to prevent pulling in the pthread types, but this can easily be
>>avoided by using the underlying structure types.
>
> Not easily, since the tags of the underlying struct types are in the
> application namespace, at least up to POSIX 2001.

Yeah, it's quite unfortunate that we use structure types starting with
'pthread'. They should have had leading underscores. But in my opinion
that's not a problem specific to this change; it's a problem with our
pthread implementation in general.

>> +#include 
>
> This gives the following pollution (which breaks almost everything since
>  includes this header:
> - struct tag names pthread*
> - struct member names state and mutex

Yes. It would have made so much more sense if a header like
 would have defined all pthread types as __pthread_t,
__pthread_mutex_t, etc. That way there would have been a way to expose
just pthread_t and pthread_attr_t without pulling in the rest.

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301131 - head/usr.sbin/tzsetup

2016-06-01 Thread Steven Hartland
Author: smh
Date: Wed Jun  1 15:39:11 2016
New Revision: 301131
URL: https://svnweb.freebsd.org/changeset/base/301131

Log:
  Fix tzsetup not installing /etc/localtime for UTC
  
  If tzsetup UTC is run then it successfully configured the system for UTC
  including installing /etc/localtime however if the user ran just tzsetup
  for interactive configuration and select UTC no /etc/localtime was installed
  which resulted in failures for utilities which require said file.
  
  Change set_zone_utc to call install_zoneinfo("UTC") to ensure that
  /etc/localtime is created for interactive UTC selection.
  
  Users who have previously run tzsetup in interactive mode and select UTC
  can install the missing /etc/localtime by running tzsetup -r.
  
  Also correct static miss-match for set_zone_utc.
  
  MFC after:2 weeks
  Relnotes: Yes
  Sponsored by: Multiplay

Modified:
  head/usr.sbin/tzsetup/tzsetup.c

Modified: head/usr.sbin/tzsetup/tzsetup.c
==
--- head/usr.sbin/tzsetup/tzsetup.c Wed Jun  1 15:19:49 2016
(r301130)
+++ head/usr.sbin/tzsetup/tzsetup.c Wed Jun  1 15:39:11 2016
(r301131)
@@ -199,6 +199,7 @@ static char *chrootenv = NULL;
 static voidusage(void);
 static int confirm_zone(const char *filename);
 static int continent_country_menu(dialogMenuItem *);
+static int install_zoneinfo(const char *zoneinfo);
 static int install_zoneinfo_file(const char *zoneinfo_file);
 static int set_zone_multi(dialogMenuItem *);
 static int set_zone_whole_country(dialogMenuItem *);
@@ -633,13 +634,13 @@ set_zone_menu(dialogMenuItem *dmi)
return (DITEM_LEAVE_MENU);
 }
 
-int
+static int
 set_zone_utc(void)
 {
if (!confirm_zone(NULL))
return (DITEM_FAILURE | DITEM_RECREATE);
 
-   return (install_zoneinfo_file(NULL));
+   return (install_zoneinfo("UTC"));
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301130 - head/sys/modules

2016-06-01 Thread Bryan Drewery
Author: bdrewery
Date: Wed Jun  1 15:19:49 2016
New Revision: 301130
URL: https://svnweb.freebsd.org/changeset/base/301130

Log:
  Enable filemon on all architectures.
  
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Wed Jun  1 15:08:27 2016(r301129)
+++ head/sys/modules/Makefile   Wed Jun  1 15:19:49 2016(r301130)
@@ -116,7 +116,7 @@ SUBDIR= \
fdc \
fdescfs \
${_fe} \
-   ${_filemon} \
+   filemon \
firewire \
firmware \
fuse \
@@ -549,7 +549,6 @@ _ep=ep
 _et=   et
 _exca= exca
 _fe=   fe
-_filemon=  filemon
 .if ${MK_OFED} != "no" || defined(ALL_MODULES)
 _ibcore=ibcore
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301129 - stable/10/sys/net

2016-06-01 Thread Nick Hibma
Author: n_hibma
Date: Wed Jun  1 15:08:27 2016
New Revision: 301129
URL: https://svnweb.freebsd.org/changeset/base/301129

Log:
  MFC 300670 (slightly adapted for 10-STABLE):
  
  Change net.link.log_promisc_mode_change to a read-only tunable.
  
  PR:   166255
  Submitted by: eugen.grosbein.net
  Obtained from:hselasky

Modified:
  stable/10/sys/net/if.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/if.c
==
--- stable/10/sys/net/if.c  Wed Jun  1 14:57:53 2016(r301128)
+++ stable/10/sys/net/if.c  Wed Jun  1 15:08:27 2016(r301129)
@@ -116,7 +116,8 @@ SYSCTL_INT(_net_link, OID_AUTO, log_link
 /* Log promiscuous mode change events */
 static int log_promisc_mode_change = 1;
 
-SYSCTL_INT(_net_link, OID_AUTO, log_promisc_mode_change, CTLFLAG_RW,
+TUNABLE_INT("net.link.log_promisc_mode_change", &log_promisc_mode_change);
+SYSCTL_INT(_net_link, OID_AUTO, log_promisc_mode_change, CTLFLAG_RDTUN,
&log_promisc_mode_change, 1,
"log promiscuous mode change events");
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301128 - head/sys/dev/urtwn

2016-06-01 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Jun  1 14:57:53 2016
New Revision: 301128
URL: https://svnweb.freebsd.org/changeset/base/301128

Log:
  urtwn: fix non-ERP BSS detection in HOSTAP mode.
  
  Receive all beacons in HOSTAP mode; they will give more information about
  present non-ERP / legacy BSSs (used to choose protection mode).
  
  Tested with RTL8188CUS (HOSTAP, urtwn) + RTL8821AU (HOSTAP, 11b mode).

Modified:
  head/sys/dev/urtwn/if_urtwn.c

Modified: head/sys/dev/urtwn/if_urtwn.c
==
--- head/sys/dev/urtwn/if_urtwn.c   Wed Jun  1 14:16:16 2016
(r301127)
+++ head/sys/dev/urtwn/if_urtwn.c   Wed Jun  1 14:57:53 2016
(r301128)
@@ -2627,10 +2627,11 @@ urtwn_newstate(struct ieee80211vap *vap,
if (ic->ic_promisc == 0) {
reg = urtwn_read_4(sc, R92C_RCR);
 
-   if (vap->iv_opmode != IEEE80211_M_HOSTAP)
+   if (vap->iv_opmode != IEEE80211_M_HOSTAP) {
reg |= R92C_RCR_CBSSID_DATA;
-   if (vap->iv_opmode != IEEE80211_M_IBSS)
-   reg |= R92C_RCR_CBSSID_BCN;
+   if (vap->iv_opmode != IEEE80211_M_IBSS)
+   reg |= R92C_RCR_CBSSID_BCN;
+   }
 
urtwn_write_4(sc, R92C_RCR, reg);
}
@@ -4723,7 +4724,8 @@ urtwn_scan_start(struct ieee80211com *ic
 
URTWN_LOCK(sc);
/* Receive beacons / probe responses from any BSSID. */
-   if (ic->ic_opmode != IEEE80211_M_IBSS)
+   if (ic->ic_opmode != IEEE80211_M_IBSS &&
+   ic->ic_opmode != IEEE80211_M_HOSTAP)
urtwn_set_rx_bssid_all(sc, 1);
 
/* Set gain for scanning. */
@@ -4738,7 +4740,9 @@ urtwn_scan_end(struct ieee80211com *ic)
 
URTWN_LOCK(sc);
/* Restore limitations. */
-   if (ic->ic_promisc == 0 && ic->ic_opmode != IEEE80211_M_IBSS)
+   if (ic->ic_promisc == 0 &&
+   ic->ic_opmode != IEEE80211_M_IBSS &&
+   ic->ic_opmode != IEEE80211_M_HOSTAP)
urtwn_set_rx_bssid_all(sc, 0);
 
/* Set gain under link. */
@@ -4931,14 +4935,13 @@ urtwn_set_promisc(struct urtwn_softc *sc
if (vap->iv_state == IEEE80211_S_RUN) {
switch (vap->iv_opmode) {
case IEEE80211_M_STA:
-   mask2 |= R92C_RCR_CBSSID_DATA;
-   /* FALLTHROUGH */
-   case IEEE80211_M_HOSTAP:
mask2 |= R92C_RCR_CBSSID_BCN;
-   break;
+   /* FALLTHROUGH */
case IEEE80211_M_IBSS:
mask2 |= R92C_RCR_CBSSID_DATA;
break;
+   case IEEE80211_M_HOSTAP:
+   break;
default:
device_printf(sc->sc_dev, "%s: undefined opmode %d\n",
__func__, vap->iv_opmode);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301127 - head/sys/dev/sfxge/common

2016-06-01 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Jun  1 14:16:16 2016
New Revision: 301127
URL: https://svnweb.freebsd.org/changeset/base/301127

Log:
  sfxge(4): cleanup: remove unused variables in common code
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_lic.c
  head/sys/dev/sfxge/common/efx_mcdi.c

Modified: head/sys/dev/sfxge/common/efx_ev.c
==
--- head/sys/dev/sfxge/common/efx_ev.c  Wed Jun  1 14:12:31 2016
(r301126)
+++ head/sys/dev/sfxge/common/efx_ev.c  Wed Jun  1 14:16:16 2016
(r301127)
@@ -349,7 +349,6 @@ efx_ev_qprefetch(
__inefx_evq_t *eep,
__inunsigned int count)
 {
-   efx_nic_t *enp = eep->ee_enp;
unsigned int offset;
 
EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC);

Modified: head/sys/dev/sfxge/common/efx_lic.c
==
--- head/sys/dev/sfxge/common/efx_lic.c Wed Jun  1 14:12:31 2016
(r301126)
+++ head/sys/dev/sfxge/common/efx_lic.c Wed Jun  1 14:16:16 2016
(r301127)
@@ -534,8 +534,6 @@ efx_lic_v1v2_validate_key(
__inuint32_t length
)
 {
-   const efx_lic_ops_t *elop = enp->en_elop;
-   efx_rc_t rc;
uint16_t tlv_type;
uint16_t tlv_length;
 
@@ -658,7 +656,6 @@ efx_lic_v1v2_delete_key(
__out   uint32_t *deltap
)
 {
-   efx_rc_t rc;
uint32_t move_start = offset + length;
uint32_t move_length = end - move_start;
 
@@ -1158,7 +1155,6 @@ efx_lic_v3_validate_key(
)
 {
// Check key is a valid V3 key
-   efx_rc_t rc;
uint8_t key_type;
uint8_t key_length;
 
@@ -1396,8 +1392,6 @@ efx_lic_check_support(
 efx_lic_fini(
__inefx_nic_t *enp)
 {
-   const efx_lic_ops_t *elop = enp->en_elop;
-
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
@@ -1573,7 +1567,6 @@ efx_lic_find_key(
)
 {
const efx_lic_ops_t *elop = enp->en_elop;
-   boolean_t rc;
 
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
@@ -1599,8 +1592,6 @@ efx_lic_validate_key(
 {
const efx_lic_ops_t *elop = enp->en_elop;
boolean_t rc;
-   uint16_t tlv_type;
-   uint16_t tlv_length;
 
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cWed Jun  1 14:12:31 2016
(r301126)
+++ head/sys/dev/sfxge/common/efx_mcdi.cWed Jun  1 14:16:16 2016
(r301127)
@@ -795,7 +795,6 @@ efx_mcdi_get_proxy_handle(
__inefx_mcdi_req_t *emrp,
__out   uint32_t *handlep)
 {
-   efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
efx_rc_t rc;
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301126 - in head/sys/riscv: conf riscv

2016-06-01 Thread Ruslan Bukin
Author: br
Date: Wed Jun  1 14:12:31 2016
New Revision: 301126
URL: https://svnweb.freebsd.org/changeset/base/301126

Log:
  Add support for loadable kernel modules.
  
  Submitted by: Yukishige Shibata 

Modified:
  head/sys/riscv/conf/GENERIC
  head/sys/riscv/riscv/elf_machdep.c

Modified: head/sys/riscv/conf/GENERIC
==
--- head/sys/riscv/conf/GENERIC Wed Jun  1 14:11:40 2016(r301125)
+++ head/sys/riscv/conf/GENERIC Wed Jun  1 14:12:31 2016(r301126)
@@ -23,7 +23,9 @@ ident GENERIC
 
 makeoptionsDEBUG=-g# Build kernel with gdb(1) debug symbols
 # makeoptions  WITH_CTF=1  # Run ctfconvert(1) for DTrace support
-makeoptionsNO_MODULES=1# We don't yet support modules on RISC-V
+
+# FIXME: linker error. "--relax and -r may not be used together"
+makeoptionsWITHOUT_MODULES="usb otusfw mwlfw ispfw mwlfw ralfw rtwnfw 
urtwnfw"
 
 optionsSCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption

Modified: head/sys/riscv/riscv/elf_machdep.c
==
--- head/sys/riscv/riscv/elf_machdep.c  Wed Jun  1 14:11:40 2016
(r301125)
+++ head/sys/riscv/riscv/elf_machdep.c  Wed Jun  1 14:12:31 2016
(r301126)
@@ -1,6 +1,7 @@
 /*-
  * Copyright 1996-1998 John D. Polstra.
  * Copyright (c) 2015 Ruslan Bukin 
+ * Copyright (c) 2016 Yukishige SHibata 
  * All rights reserved.
  *
  * Portions of this software were developed by SRI International and the
@@ -43,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -123,19 +125,380 @@ SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_AN
(sysinit_cfunc_t) elf64_insert_brand_entry,
&freebsd_brand_oinfo);
 
+static int debug_kld;
+SYSCTL_INT(_kern, OID_AUTO, debug_kld,
+  CTLFLAG_RW, &debug_kld, 0,
+  "Activate debug prints in elf_reloc_internal()");
+
+struct type2str_ent {
+   int type;
+   const char* str;
+};
+
 void
 elf64_dump_thread(struct thread *td, void *dst, size_t *off)
 {
 
 }
 
-/* Process one elf relocation with addend. */
+/*
+ * Following 4 functions are used to manupilate bits on 32bit interger value.
+ * FIXME: I implemetend for ease-to-understand rather than for well-optimized.
+ */
+static uint32_t
+gen_bitmask(int msb, int lsb)
+{
+   uint32_t mask;
+
+   if (msb == sizeof(mask) * 8 - 1)
+   mask = ~0;
+   else
+   mask = (1U << (msb + 1)) - 1;
+
+   if (lsb > 0)
+   mask &= ~((1U << lsb) - 1);
+
+   return (mask);
+}
+
+static uint32_t
+extract_bits(uint32_t x, int msb, int lsb)
+{
+   uint32_t mask;
+
+   mask = gen_bitmask(msb, lsb);
+
+   x &= mask;
+   x >>= lsb;
+
+   return (x);
+}
+
+static uint32_t
+insert_bits(uint32_t d, uint32_t s, int msb, int lsb)
+{
+   uint32_t mask;
+
+   mask = gen_bitmask(msb, lsb);
+
+   d &= ~mask;
+
+   s <<= lsb;
+   s &= mask;
+
+   return (d | s);
+}
+
+static uint32_t
+insert_imm(uint32_t insn, uint32_t imm, int imm_msb, int imm_lsb,
+int insn_lsb)
+{
+   int insn_msb;
+   uint32_t v;
+
+   v = extract_bits(imm, imm_msb, imm_lsb);
+   insn_msb = (imm_msb - imm_lsb) + insn_lsb;
+
+   return (insert_bits(insn, v, insn_msb, insn_lsb));
+}
+
+/*
+ * The RISCV ISA is designed so that all of immediate value is
+ * sign-extened.
+ * An immediate value is sometimes generated at runtime by adding
+ * 12bit sign integer and 20bit signed integer. This requests 20bit
+ * immediate value to be ajusted if the MSB of the 12bit immediate
+ * value is asserted (sign extened value is treated as negative value).
+ *
+ * For example, 0x123800 can be calculated by adding upper 20 bit of
+ * 0x124000 and signed-extended 12bit immediate whose bit pattern is
+ * 0x800 as follows;
+ *   0x123800
+ * = 0x123000 + 0x800
+ * = (0x123000 + 0x1000) + (-0x1000 + 0x800)
+ * = (0x123000 + 0x1000) + (0xff...ff800)
+ * = 0x124000+ sign-exntend(0x800)
+ */
+static uint32_t
+calc_hi20_imm(uint32_t value)
+{
+   /*
+* There is the arithmetical hack that can remove conditional
+* statement. But I implement it in straghtforward way.
+*/
+   if ((value & 0x800) != 0)
+   value += 0x1000;
+   return (value & ~0xfff);
+}
+
+static const struct type2str_ent t2s[] = {
+   { R_RISCV_NONE, "R_RISCV_NONE"  },
+   { R_RISCV_64,   "R_RISCV_64"},
+   { R_RISCV_JUMP_SLOT,"R_RISCV_JUMP_SLOT" },
+   { R_RISCV_RELATIVE, "R_RISCV_RELATIVE"  },
+   { R_RISCV_JAL,  "R_RISCV_JAL"   },
+   { R_RISCV_CALL, "R_RISCV_CALL"  },
+   { R_RISCV_PCREL_HI20,   "R_RISCV_PCREL_HI20"},
+   { R_RISC

svn commit: r301125 - head/sys/dev/sfxge/common

2016-06-01 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Jun  1 14:11:40 2016
New Revision: 301125
URL: https://svnweb.freebsd.org/changeset/base/301125

Log:
  sfxge(4): cleanup: add missing space after if keyword
  
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/common/efx_lic.c

Modified: head/sys/dev/sfxge/common/efx_lic.c
==
--- head/sys/dev/sfxge/common/efx_lic.c Wed Jun  1 14:05:32 2016
(r301124)
+++ head/sys/dev/sfxge/common/efx_lic.c Wed Jun  1 14:11:40 2016
(r301125)
@@ -506,7 +506,7 @@ efx_lic_v1v2_find_key(
 
_NOTE(ARGUNUSED(enp))
 
-   if((size_t)buffer_size - offset < EFX_LICENSE_V1V2_HEADER_LENGTH)
+   if ((size_t)buffer_size - offset < EFX_LICENSE_V1V2_HEADER_LENGTH)
goto fail1;
 
tlv_type = __LE_TO_CPU_16(((uint16_t*)&bufferp[offset])[0]);
@@ -548,7 +548,7 @@ efx_lic_v1v2_validate_key(
tlv_type = __LE_TO_CPU_16(((uint16_t*)keyp)[0]);
tlv_length = __LE_TO_CPU_16(((uint16_t*)keyp)[1]);
 
-   if(tlv_length > EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX) {
+   if (tlv_length > EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX) {
goto fail2;
}
if (tlv_type == 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301124 - head/sys/conf

2016-06-01 Thread Ruslan Bukin
Author: br
Date: Wed Jun  1 14:05:32 2016
New Revision: 301124
URL: https://svnweb.freebsd.org/changeset/base/301124

Log:
  Build riscv modules as PIC.
  
  Submitted by: Yukishige Shibata 

Modified:
  head/sys/conf/kmod.mk

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Wed Jun  1 14:03:13 2016(r301123)
+++ head/sys/conf/kmod.mk   Wed Jun  1 14:05:32 2016(r301124)
@@ -130,7 +130,7 @@ CFLAGS+=${DEBUG_FLAGS}
 CFLAGS+=   -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 .endif
 
-.if ${MACHINE_CPUARCH} == "aarch64"
+.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv"
 CFLAGS+=   -fPIC
 .endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301123 - head/sys/dev/sym

2016-06-01 Thread Ruslan Bukin
Author: br
Date: Wed Jun  1 14:03:13 2016
New Revision: 301123
URL: https://svnweb.freebsd.org/changeset/base/301123

Log:
  Add a riscv define.
  
  Submitted by: Yukishige Shibata 

Modified:
  head/sys/dev/sym/sym_hipd.c

Modified: head/sys/dev/sym/sym_hipd.c
==
--- head/sys/dev/sym/sym_hipd.c Wed Jun  1 14:03:07 2016(r301122)
+++ head/sys/dev/sym/sym_hipd.c Wed Jun  1 14:03:13 2016(r301123)
@@ -138,6 +138,8 @@ typedef u_int32_t u32;
 #define MEMORY_BARRIER()   dmb()
 #elif  defined __aarch64__
 #define MEMORY_BARRIER()   dmb(sy)
+#elif  defined __riscv__
+#define MEMORY_BARRIER()   fence()
 #else
 #error "Not supported platform"
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301122 - in head/sys/dev/sfxge: . common

2016-06-01 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Jun  1 14:03:07 2016
New Revision: 301122
URL: https://svnweb.freebsd.org/changeset/base/301122

Log:
  sfxge(4): set moderation in efx_ev_qcreate
  
  This simplifies setting an initial interrupt moderation value, and
  avoids most calls to evx_ev_qmoderate from contexts where MCDI is
  not allowed (MCDI is need for an EVQ timer workaround in a later patch).
  
  Submitted by:   Andy Moreton 
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D6673

Modified:
  head/sys/dev/sfxge/common/ef10_ev.c
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/sfxge_ev.c

Modified: head/sys/dev/sfxge/common/ef10_ev.c
==
--- head/sys/dev/sfxge/common/ef10_ev.c Wed Jun  1 13:43:43 2016
(r301121)
+++ head/sys/dev/sfxge/common/ef10_ev.c Wed Jun  1 14:03:07 2016
(r301122)
@@ -92,8 +92,10 @@ efx_mcdi_init_evq(
__inunsigned int instance,
__inefsys_mem_t *esmp,
__insize_t nevs,
-   __inuint32_t irq)
+   __inuint32_t irq,
+   __inuint32_t us)
 {
+   efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_mcdi_req_t req;
uint8_t payload[
MAX(MC_CMD_INIT_EVQ_IN_LEN(EFX_EVQ_NBUFS(EFX_EVQ_MAXNEVS)),
@@ -141,10 +143,26 @@ efx_mcdi_init_evq(
INIT_EVQ_IN_FLAG_RX_MERGE, 1,
INIT_EVQ_IN_FLAG_TX_MERGE, 1);
 
-   MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_TMR_MODE,
-   MC_CMD_INIT_EVQ_IN_TMR_MODE_DIS);
-   MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_TMR_LOAD, 0);
-   MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_TMR_RELOAD, 0);
+   if (us == 0) {
+   MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_TMR_MODE,
+   MC_CMD_INIT_EVQ_IN_TMR_MODE_DIS);
+   MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_TMR_LOAD, 0);
+   MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_TMR_RELOAD, 0);
+   } else {
+   uint32_t timer_val;
+
+   /* Calculate the timer value in quanta */
+   timer_val = us * 1000 / encp->enc_evq_timer_quantum_ns;
+
+   /* Moderation value is base 0 so we need to deduct 1 */
+   if (timer_val > 0)
+   timer_val--;
+
+   MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_TMR_MODE,
+   MC_CMD_INIT_EVQ_IN_TMR_INT_HLDOFF);
+   MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_TMR_LOAD, timer_val);
+   MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_TMR_RELOAD, timer_val);
+   }
 
MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_COUNT_MODE,
MC_CMD_INIT_EVQ_IN_COUNT_MODE_DIS);
@@ -246,6 +264,7 @@ ef10_ev_qcreate(
__inefsys_mem_t *esmp,
__insize_t n,
__inuint32_t id,
+   __inuint32_t us,
__inefx_evq_t *eep)
 {
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
@@ -266,6 +285,11 @@ ef10_ev_qcreate(
goto fail2;
}
 
+   if (us > encp->enc_evq_timer_max_us) {
+   rc = EINVAL;
+   goto fail3;
+   }
+
/* Set up the handler table */
eep->ee_rx  = ef10_ev_rx;
eep->ee_tx  = ef10_ev_tx;
@@ -280,11 +304,13 @@ ef10_ev_qcreate(
 * Interrupts may be raised for events immediately after the queue is
 * created. See bug58606.
 */
-   if ((rc = efx_mcdi_init_evq(enp, index, esmp, n, irq)) != 0)
-   goto fail3;
+   if ((rc = efx_mcdi_init_evq(enp, index, esmp, n, irq, us)) != 0)
+   goto fail4;
 
return (0);
 
+fail4:
+   EFSYS_PROBE(fail4);
 fail3:
EFSYS_PROBE(fail3);
 fail2:

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Wed Jun  1 13:43:43 2016
(r301121)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Wed Jun  1 14:03:07 2016
(r301122)
@@ -84,6 +84,7 @@ ef10_ev_qcreate(
__inefsys_mem_t *esmp,
__insize_t n,
__inuint32_t id,
+   __inuint32_t us,
__inefx_evq_t *eep);
 
void

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Wed Jun  1 13:43:43 2016
(r301121)
+++ head/sys/dev/sfxge/common/efx.h Wed Jun  1 14:03:07 2016
(r301122)
@@ -1602,6 +1602,7 @@ efx_ev_qcreate(
__inefsys_mem_t *esmp,
__insize_t n,
__inuint32_t id,
+   __inuint32_t us,
__der

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-06-01 Thread Bruce Evans

On Tue, 31 May 2016, Chris Torek wrote:


That was what I was complaining about.  div.c is for C90 (misspelled
"ANSI").


It wasn't misspelled when I wrote it.  :-)  The 1989 ANSI C


:-)


standard was formally ratified in Dec 1989, and the draft was
pretty firm by the time I wrote the code (which I am sure was also
1989, despite the 1990 copyright; we added or updated all the
copyrights at the last minute, for net-2).  ISO's quick adoption,
and hence the name C90, post-date all of that.


The weren't quick enough to be in the same year.  I usually spell the
year as 90, but this can be confusing when discussing the compiler
c89 or the compiler flag -std=c89.  Hmm, old gcc doesn't have -std=c90,
but clang does.



Correct rounding for a
positive divisor is towards minus infinity so that the remainder is
not negative.  This is modulo arithmetic and has good algebraic
properties.  C99 requires rounding minus infinity, at least for positive
divisors, under the extension "reliable integer division".


Did you state this backwards?  For integer divison I see:


Oops.  I seem to have misedited a whole clause.  "towards" is also
missing.


   When integers are divided, the result of the / operator is the
   algebraic quotient with any fractional part discarded.[105] If
   the quotient a/b is representable, the expression (a/b)*b + a%b
   shall equal a; otherwise, the behavior of both a/b and a%b is
   undefined.

which (as footnote 105 notes) is "truncation towards zero", so that
(-1)/2 is 0 and not -1.


In C90,
the rounding is implementation-defined, so it may be correct, but it
is "unreliable" since it can be anything.

In C90, div() is specified as giving "reliable" division, and that is
what the fixups implement.  This now wastes time to change nothing.


Right -- as long as the compiler must meet C99 rules, div.c
can just use the / and % operators.


ache added the ifdef.

I checked that compilers (old gcc and current clang on amd64) don't
auto-inline div().  It is very suitable for inlining without the
fixup.

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


svn commit: r301121 - head/sys/modules

2016-06-01 Thread Ruslan Bukin
Author: br
Date: Wed Jun  1 13:43:43 2016
New Revision: 301121
URL: https://svnweb.freebsd.org/changeset/base/301121

Log:
  Don't build some modules on RISC-V.
  
  Submitted by: Yukishige Shibata 

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Wed Jun  1 12:19:00 2016(r301120)
+++ head/sys/modules/Makefile   Wed Jun  1 13:43:43 2016(r301121)
@@ -499,7 +499,7 @@ _txp=   txp
 
 .if ${MK_SOURCELESS_UCODE} != "no" && ${MACHINE_CPUARCH} != "arm" && \
${MACHINE_ARCH:C/mips(el)?/mips/} != "mips" && \
-   ${MACHINE_ARCH} != "powerpc"
+   ${MACHINE_ARCH} != "powerpc" && ${MACHINE_CPUARCH} != "riscv"
 _cxgbe=cxgbe
 .endif
 
@@ -508,7 +508,8 @@ SUBDIR+=zfs
 .endif
 
 .if ${MACHINE_CPUARCH} != "aarch64" && ${MACHINE_CPUARCH} != "arm" && \
-   ${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "powerpc"
+   ${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "powerpc" && \
+   ${MACHINE_CPUARCH} != "riscv"
 _syscons=  syscons
 _vpo=  vpo
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301120 - head/sys/riscv/conf

2016-06-01 Thread Ruslan Bukin
Author: br
Date: Wed Jun  1 12:19:00 2016
New Revision: 301120
URL: https://svnweb.freebsd.org/changeset/base/301120

Log:
  * Enable KDTRACE options as we support DTrace now.
  * Add bpf device to kernel config.

Modified:
  head/sys/riscv/conf/GENERIC

Modified: head/sys/riscv/conf/GENERIC
==
--- head/sys/riscv/conf/GENERIC Wed Jun  1 12:04:04 2016(r301119)
+++ head/sys/riscv/conf/GENERIC Wed Jun  1 12:19:00 2016(r301120)
@@ -64,8 +64,8 @@ options   AUDIT   # Security event auditi
 optionsCAPABILITY_MODE # Capsicum capability mode
 optionsCAPABILITIES# Capsicum capabilities
 optionsMAC # TrustedBSD MAC Framework
-# options  KDTRACE_FRAME   # Ensure frames are compiled in
-# options  KDTRACE_HOOKS   # Kernel DTrace hooks
+optionsKDTRACE_FRAME   # Ensure frames are compiled in
+optionsKDTRACE_HOOKS   # Kernel DTrace hooks
 # options  VFP # Floating-point support
 optionsRACCT   # Resource accounting framework
 optionsRACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default
@@ -102,4 +102,9 @@ device  md  # Memory "disks"
 device gif # IPv6 and IPv4 tunneling
 device firmware# firmware assist module
 
+# The `bpf' device enables the Berkeley Packet Filter.
+# Be aware of the administrative consequences of enabling this!
+# Note that 'bpf' is required for DHCP.
+device bpf # Berkeley packet filter
+
 optionsFDT
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301119 - head/sys/dev/cxgbe/cxgbei

2016-06-01 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Jun  1 12:04:04 2016
New Revision: 301119
URL: https://svnweb.freebsd.org/changeset/base/301119

Log:
  Reduce the priority of cxgbei(4) driver, so it doesn't get chosen
  by default.  This is a workaround for a too simplistic ICL module
  choosing mechanism.  To use it, specify offload in ctl.conf
  or iscsi.conf.
  
  This fixes a problem where "kldload cxgbei" wedges the iSCSI stack,
  if you don't have a Chelsio card installed, or the endpoints of the
  iSCSI session are not reachable through addresses configured
  on that interface.
  
  Reviewed by:  np@
  MFC after:1 month

Modified:
  head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c

Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
==
--- head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c  Wed Jun  1 11:45:06 2016
(r301118)
+++ head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c  Wed Jun  1 12:04:04 2016
(r301119)
@@ -850,7 +850,7 @@ icl_cxgbei_load(void)
 
refcount_init(&icl_cxgbei_ncons, 0);
 
-   error = icl_register("cxgbei", false, 100, icl_cxgbei_limits,
+   error = icl_register("cxgbei", false, -100, icl_cxgbei_limits,
icl_cxgbei_new_conn);
KASSERT(error == 0, ("failed to register"));
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301118 - head/usr.sbin/ctld

2016-06-01 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Jun  1 11:45:06 2016
New Revision: 301118
URL: https://svnweb.freebsd.org/changeset/base/301118

Log:
  Describe default value for "offload".
  
  MFC after:1 month

Modified:
  head/usr.sbin/ctld/ctl.conf.5

Modified: head/usr.sbin/ctld/ctl.conf.5
==
--- head/usr.sbin/ctld/ctl.conf.5   Wed Jun  1 10:55:22 2016
(r301117)
+++ head/usr.sbin/ctld/ctl.conf.5   Wed Jun  1 11:45:06 2016
(r301118)
@@ -226,6 +226,8 @@ An IPv4 or IPv6 address and port to list
 .It Ic offload Ar driver
 Define iSCSI hardware offload driver to use for this
 .Sy portal-group .
+The default is
+.Qq Ar none .
 .It Ic option Ar name Ar value
 The CTL-specific port options passed to the kernel.
 .It Ic redirect Ar address
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301115 - head/lib/libc/stdlib

2016-06-01 Thread Andrey A. Chernov
Author: ache
Date: Wed Jun  1 10:14:25 2016
New Revision: 301115
URL: https://svnweb.freebsd.org/changeset/base/301115

Log:
  Don't use fixup for C99 and up, the compiler result is already correct.
  
  Suggested by: bde
  
  MFC after:  1 week

Modified:
  head/lib/libc/stdlib/div.c
  head/lib/libc/stdlib/imaxdiv.c
  head/lib/libc/stdlib/ldiv.c
  head/lib/libc/stdlib/lldiv.c

Modified: head/lib/libc/stdlib/div.c
==
--- head/lib/libc/stdlib/div.c  Wed Jun  1 10:14:04 2016(r301114)
+++ head/lib/libc/stdlib/div.c  Wed Jun  1 10:14:25 2016(r301115)
@@ -46,6 +46,7 @@ div(num, denom)
 
r.quot = num / denom;
r.rem = num % denom;
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
/*
 * The ANSI standard says that |r.quot| <= |n/d|, where
 * n/d is to be computed in infinite precision.  In other
@@ -73,5 +74,6 @@ div(num, denom)
r.quot++;
r.rem -= denom;
}
+#endif
return (r);
 }

Modified: head/lib/libc/stdlib/imaxdiv.c
==
--- head/lib/libc/stdlib/imaxdiv.c  Wed Jun  1 10:14:04 2016
(r301114)
+++ head/lib/libc/stdlib/imaxdiv.c  Wed Jun  1 10:14:25 2016
(r301115)
@@ -37,9 +37,11 @@ imaxdiv(intmax_t numer, intmax_t denom)
 
retval.quot = numer / denom;
retval.rem = numer % denom;
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
if (numer >= 0 && retval.rem < 0) {
retval.quot++;
retval.rem -= denom;
}
+#endif
return (retval);
 }

Modified: head/lib/libc/stdlib/ldiv.c
==
--- head/lib/libc/stdlib/ldiv.c Wed Jun  1 10:14:04 2016(r301114)
+++ head/lib/libc/stdlib/ldiv.c Wed Jun  1 10:14:25 2016(r301115)
@@ -48,9 +48,11 @@ ldiv(num, denom)
 
r.quot = num / denom;
r.rem = num % denom;
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
if (num >= 0 && r.rem < 0) {
r.quot++;
r.rem -= denom;
}
+#endif
return (r);
 }

Modified: head/lib/libc/stdlib/lldiv.c
==
--- head/lib/libc/stdlib/lldiv.cWed Jun  1 10:14:04 2016
(r301114)
+++ head/lib/libc/stdlib/lldiv.cWed Jun  1 10:14:25 2016
(r301115)
@@ -37,9 +37,11 @@ lldiv(long long numer, long long denom)
 
retval.quot = numer / denom;
retval.rem = numer % denom;
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
if (numer >= 0 && retval.rem < 0) {
retval.quot++;
retval.rem -= denom;
}
+#endif
return (retval);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301114 - in head: share/man/man9 sys/kern sys/netinet sys/netinet6 sys/sys

2016-06-01 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Jun  1 10:14:04 2016
New Revision: 301114
URL: https://svnweb.freebsd.org/changeset/base/301114

Log:
  The pr_destroy field does not allow us to run the teardown code in a
  specific order.  VNET_SYSUNINITs however are doing exactly that.
  Thus remove the VIMAGE conditional field from the domain(9) protosw
  structure and replace it with VNET_SYSUNINITs.
  This also allows us to change some order and to make the teardown functions
  file local static.
  Also convert divert(4) as it uses the same mechanism ip(4) and ip6(4) use
  internally.
  
  Slightly reshuffle the SI_SUB_* fields in kernel.h and add a new ones, e.g.,
  for pfil consumers (firewalls), partially for this commit and for others
  to come.
  
  Reviewed by:  gnn, tuexen (sctp), jhb (kernel.h)
  Obtained from:projects/vnet
  MFC after:2 weeks
  X-MFC:do not remove pr_destroy
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D6652

Modified:
  head/share/man/man9/domain.9
  head/sys/kern/uipc_domain.c
  head/sys/netinet/in_proto.c
  head/sys/netinet/ip_divert.c
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_var.h
  head/sys/netinet/raw_ip.c
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctp_var.h
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_var.h
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet/udp_var.h
  head/sys/netinet6/in6_proto.c
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/ip6_var.h
  head/sys/sys/kernel.h
  head/sys/sys/protosw.h

Modified: head/share/man/man9/domain.9
==
--- head/share/man/man9/domain.9Wed Jun  1 09:20:52 2016
(r301113)
+++ head/share/man/man9/domain.9Wed Jun  1 10:14:04 2016
(r301114)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 6, 2014
+.Dd June 1, 2016
 .Dt DOMAIN 9
 .Os
 .Sh NAME
@@ -105,7 +105,6 @@ struct protosw {
pr_ctloutput_t *pr_ctloutput;   /* control output (from above) */
 /* utility hooks */
pr_init_t *pr_init;
-   pr_destroy_t *pr_destroy;
pr_fasttimo_t *pr_fasttimo; /* fast timeout (200ms) */
pr_slowtimo_t *pr_slowtimo; /* slow timeout (500ms) */
pr_drain_t *pr_drain;   /* flush any excess space possible */

Modified: head/sys/kern/uipc_domain.c
==
--- head/sys/kern/uipc_domain.c Wed Jun  1 09:20:52 2016(r301113)
+++ head/sys/kern/uipc_domain.c Wed Jun  1 10:14:04 2016(r301114)
@@ -196,11 +196,7 @@ void
 vnet_domain_uninit(void *arg)
 {
struct domain *dp = arg;
-   struct protosw *pr;
 
-   for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
-   if (pr->pr_destroy)
-   (*pr->pr_destroy)();
if (dp->dom_destroy)
(*dp->dom_destroy)();
 }

Modified: head/sys/netinet/in_proto.c
==
--- head/sys/netinet/in_proto.c Wed Jun  1 09:20:52 2016(r301113)
+++ head/sys/netinet/in_proto.c Wed Jun  1 10:14:04 2016(r301114)
@@ -119,9 +119,6 @@ struct protosw inetsw[] = {
.pr_domain =&inetdomain,
.pr_protocol =  IPPROTO_IP,
.pr_init =  ip_init,
-#ifdef VIMAGE
-   .pr_destroy =   ip_destroy,
-#endif
.pr_slowtimo =  ip_slowtimo,
.pr_drain = ip_drain,
.pr_usrreqs =   &nousrreqs
@@ -135,9 +132,6 @@ struct protosw inetsw[] = {
.pr_ctlinput =  udp_ctlinput,
.pr_ctloutput = udp_ctloutput,
.pr_init =  udp_init,
-#ifdef VIMAGE
-   .pr_destroy =   udp_destroy,
-#endif
.pr_usrreqs =   &udp_usrreqs
 },
 {
@@ -149,9 +143,6 @@ struct protosw inetsw[] = {
.pr_ctlinput =  tcp_ctlinput,
.pr_ctloutput = tcp_ctloutput,
.pr_init =  tcp_init,
-#ifdef VIMAGE
-   .pr_destroy =   tcp_destroy,
-#endif
.pr_slowtimo =  tcp_slowtimo,
.pr_drain = tcp_drain,
.pr_usrreqs =   &tcp_usrreqs
@@ -166,9 +157,6 @@ struct protosw inetsw[] = {
.pr_ctlinput =  sctp_ctlinput,
.pr_ctloutput = sctp_ctloutput,
.pr_init =  sctp_init,
-#ifdef VIMAGE
-   .pr_destroy =   sctp_finish,
-#endif
.pr_drain = sctp_drain,
.pr_usrreqs =   &sctp_usrreqs
 },
@@ -193,9 +181,6 @@ struct protosw inetsw[] = {
.pr_ctlinput =  udplite_ctlinput,
.pr_ctloutput = udp_ctloutput,
.pr_init =  udplite_init,
-#ifdef VIMAGE
-   .pr_destroy =   udplite_destroy,
-#endif
.pr_usrreqs =   &udp_usrreqs
 },
 {
@

Re: svn commit: r301071 - head/sys/sys

2016-06-01 Thread Bruce Evans

On Tue, 31 May 2016, Ed Schouten wrote:


Log:
 Improve POSIX conformance of .

 - This header file has always depended on pthread_t, pthread_attr_t,
   struct timespec, size_t and uid_t. Only as of POSIX 2008, these
   dependencies have been states explicitly. They should now be defined.


Not always.  POSIX didn't have pthreads or timespecs before about 1993.


 - In our implementation, struct sigevent::sigev_notify_attributes has
   type "void *" instead of "pthread_attr_t *". My guess is that this was
   done to prevent pulling in the pthread types, but this can easily be
   avoided by using the underlying structure types.


Not easily, since the tags of the underlying struct types are in the
application namespace, at least up to POSIX 2001.


Modified:
 head/sys/sys/signal.h

Modified: head/sys/sys/signal.h
==
--- head/sys/sys/signal.h   Tue May 31 18:45:52 2016(r301070)
+++ head/sys/sys/signal.h   Tue May 31 19:05:41 2016(r301071)
@@ -45,6 +45,23 @@
#include   /* __MINSIGSTKSZ */
#include/* sig_atomic_t; trap codes; sigcontext */

+#if __POSIX_VISIBLE >= 200809
+
+#include 


This gives the following pollution (which breaks almost everything since
 includes this header:
- struct tag names pthread*
- struct member names state and mutex
POSIX could reasonably be unimproved by reserving pthread* but not ordinary
identifiers like state and mutex.


...
@@ -160,6 +177,9 @@ union sigval {
#endif

#if __POSIX_VISIBLE >= 199309
+
+struct pthread_attr;
+


The 1993 version certainly doesn't reserve pthread*.

The 1996 version has a nice table of reserved symbols for every header.
For signal.h, they are just ones with a prefix of sa_, si_, sigev_
and sival_ (these shall not be declared or #defined by the application),
and SIG_, SA_, SI_ and SIGEV_ (these may be used by the application iff
they are #undef'ed before use).  This doesn't proprtly separate optional
things.

A draft 2001 version as a not so nice table.  The rules are now too
tangled to present in a single table, so there are several tables that
are hard to parse.  The first table has sa_, uc_ (new), SIG[A-Z]
(stronger), SIG_[A-Z] (weaker).  Then it has ss_ (new) and sv_ (new)
for XSI only.  Then it has si_, SI_, sigev_, SIGEV_ and sival_ for
RTS only.  The second table has SA_, SIG_[0-9a-z_] (different/weaker),
then massive pollution: BUS_, CLD_, FPE_, ILL_, POLL_, SEGV_, SI_
(now in both tables), SS_, SV_ and TRAP_.

A draft 2007 version is like the 2001 version.  It fixes the sorting
of uc_ and makes RTS non-optional.  In the second table, it moves SS_,
SV_ and TRAP_ under XSI, and moves POLL_ under OBS XSR.

I think pthread is not reserved since it is not in these tables.  Later
versions of POSIX were broken to allow  to be pollutied
with all the symbols in , but I don't want to check what
is in that now.   is slightly simpler in POSIX but much
more polluted than  in FreeBSD.


struct sigevent {
int sigev_notify;   /* Notification type */
int sigev_signo;/* Signal number */
@@ -168,7 +188,7 @@ struct sigevent {
__lwpid_t   _threadid;


Names like _threadid are bogus.  sigev is reserved for uses like this.
Noy using a prefix makes the namespace random.


struct {
void (*_function)(union sigval);
-   void *_attribute; /* pthread_attr_t * */
+   struct pthread_attr **_attribute;


pthread is not reserved.  pthread*_t is only reserved by the general
rule that everything ending in _t is reserved.

This also has indentation errors.


} _sigev_thread;



unsigned short _kevent_flags;


Further bogus names.  At least they use a prefix.


long __spare__[8];


A more bogus name.


@@ -190,6 +210,7 @@ struct sigevent {
#define SIGEV_KEVENT3   /* Generate a kevent. */
#define SIGEV_THREAD_ID 4   /* Send signal to a kernel thread. */


It is correct to used the reserved prefix for our extensions, but this style
is inconsistent with old parts of the file.  In the old parts, we ifdef
out extensions to a fault.   This makes the code hard to read but provides
good documentation of what is portable.


#endif
+
#endif /* __POSIX_VISIBLE >= 199309 */

#if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE



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


svn commit: r301113 - in head/sys: conf dev/hyperv/vmbus dev/hyperv/vmbus/amd64 dev/hyperv/vmbus/i386 modules/hyperv/vmbus

2016-06-01 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jun  1 09:20:52 2016
New Revision: 301113
URL: https://svnweb.freebsd.org/changeset/base/301113

Log:
  hyperv: Rename some cleaned up/almost cleaned up files
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC

Added:
  head/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S
 - copied unchanged from r301112, 
head/sys/dev/hyperv/vmbus/amd64/hv_vector.S
  head/sys/dev/hyperv/vmbus/hyperv.c
 - copied unchanged from r301112, head/sys/dev/hyperv/vmbus/hv_hv.c
  head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S
 - copied unchanged from r301112, head/sys/dev/hyperv/vmbus/i386/hv_vector.S
  head/sys/dev/hyperv/vmbus/vmbus.c
 - copied unchanged from r301112, 
head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/vmbus_et.c
 - copied unchanged from r301112, head/sys/dev/hyperv/vmbus/hv_et.c
Deleted:
  head/sys/dev/hyperv/vmbus/amd64/hv_vector.S
  head/sys/dev/hyperv/vmbus/hv_et.c
  head/sys/dev/hyperv/vmbus/hv_hv.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/i386/hv_vector.S
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/hyperv/vmbus/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Wed Jun  1 08:20:10 2016(r301112)
+++ head/sys/conf/files.amd64   Wed Jun  1 09:20:52 2016(r301113)
@@ -273,12 +273,12 @@ dev/hyperv/utilities/hv_util.c
option
 dev/hyperv/vmbus/hv_channel.c  optionalhyperv
 dev/hyperv/vmbus/hv_channel_mgmt.c optionalhyperv
 dev/hyperv/vmbus/hv_connection.c   optionalhyperv
-dev/hyperv/vmbus/hv_hv.c   optionalhyperv
-dev/hyperv/vmbus/hv_et.c   optionalhyperv
 dev/hyperv/vmbus/hv_ring_buffer.c  optionalhyperv
-dev/hyperv/vmbus/hv_vmbus_drv_freebsd.coptional
hyperv
+dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
-dev/hyperv/vmbus/amd64/hv_vector.S optionalhyperv
+dev/hyperv/vmbus/vmbus.c   optionalhyperv
+dev/hyperv/vmbus/vmbus_et.coptionalhyperv
+dev/hyperv/vmbus/amd64/vmbus_vector.S  optionalhyperv
 dev/nfe/if_nfe.c   optionalnfe pci
 dev/ntb/if_ntb/if_ntb.coptionalif_ntb
 dev/ntb/ntb_hw/ntb_hw.coptionalif_ntb | ntb_hw

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Wed Jun  1 08:20:10 2016(r301112)
+++ head/sys/conf/files.i386Wed Jun  1 09:20:52 2016(r301113)
@@ -248,12 +248,12 @@ dev/hyperv/utilities/hv_util.c
option
 dev/hyperv/vmbus/hv_channel.c  optionalhyperv
 dev/hyperv/vmbus/hv_channel_mgmt.c optionalhyperv
 dev/hyperv/vmbus/hv_connection.c   optionalhyperv
-dev/hyperv/vmbus/hv_hv.c   optionalhyperv
-dev/hyperv/vmbus/hv_et.c   optionalhyperv
 dev/hyperv/vmbus/hv_ring_buffer.c  optionalhyperv
-dev/hyperv/vmbus/hv_vmbus_drv_freebsd.coptional
hyperv
+dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
-dev/hyperv/vmbus/i386/hv_vector.S  optionalhyperv
+dev/hyperv/vmbus/vmbus.c   optionalhyperv
+dev/hyperv/vmbus/vmbus_et.coptionalhyperv
+dev/hyperv/vmbus/i386/vmbus_vector.S   optionalhyperv
 dev/ichwd/ichwd.c  optional ichwd
 dev/if_ndis/if_ndis.c  optional ndis
 dev/if_ndis/if_ndis_pccard.c   optional ndis pccard

Copied: head/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S (from r301112, 
head/sys/dev/hyperv/vmbus/amd64/hv_vector.S)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S  Wed Jun  1 09:20:52 
2016(r301113, copy of r301112, 
head/sys/dev/hyperv/vmbus/amd64/hv_vector.S)
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 2016 Microsoft Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source 

svn commit: r301112 - head/sys/arm64/arm64

2016-06-01 Thread Zbigniew Bodek
Author: zbb
Date: Wed Jun  1 08:20:10 2016
New Revision: 301112
URL: https://svnweb.freebsd.org/changeset/base/301112

Log:
  Return real error value instead of hard-coded ENXIO (fix after r300149)
  
  It is possible to return real error value in case of gic_v3_attach()
  failure instead of hard-coded ENXIO.
  
  Obtained from:Semihalf
  Sponsored by: Cavium

Modified:
  head/sys/arm64/arm64/gic_v3_fdt.c

Modified: head/sys/arm64/arm64/gic_v3_fdt.c
==
--- head/sys/arm64/arm64/gic_v3_fdt.c   Wed Jun  1 08:20:07 2016
(r30)
+++ head/sys/arm64/arm64/gic_v3_fdt.c   Wed Jun  1 08:20:10 2016
(r301112)
@@ -141,11 +141,13 @@ gic_v3_fdt_attach(device_t dev)
xref = OF_xref_from_node(ofw_bus_get_node(dev));
if (intr_pic_register(dev, xref) == NULL) {
device_printf(dev, "could not register PIC\n");
+   err = ENXIO;
goto error;
}
 
if (intr_pic_claim_root(dev, xref, arm_gic_v3_intr, sc,
GIC_LAST_SGI - GIC_FIRST_SGI + 1) != 0) {
+   err = ENXIO;
goto error;
}
 #endif
@@ -172,7 +174,7 @@ error:
/* Failure so free resources */
gic_v3_detach(dev);
 
-   return (ENXIO);
+   return (err);
 }
 
 /* OFW bus interface */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301110 - head/sys/sys

2016-06-01 Thread Ed Schouten
Author: ed
Date: Wed Jun  1 07:45:03 2016
New Revision: 301110
URL: https://svnweb.freebsd.org/changeset/base/301110

Log:
  Define the id_t type as required by POSIX.
  
  It seems that all versions of POSIX that I could find require that
   defines id_t. Define it together with rlim_t. While
  there, move these typedefs closer to the top of the header file, right
  after the includes, which we do in most other header files.

Modified:
  head/sys/sys/resource.h

Modified: head/sys/sys/resource.h
==
--- head/sys/sys/resource.h Wed Jun  1 07:11:54 2016(r301109)
+++ head/sys/sys/resource.h Wed Jun  1 07:45:03 2016(r301110)
@@ -37,6 +37,16 @@
 #include 
 #include 
 
+#ifndef _ID_T_DECLARED
+typedef__id_t  id_t;
+#define_ID_T_DECLARED
+#endif
+
+#ifndef _RLIM_T_DECLARED
+typedef__rlim_trlim_t;
+#define_RLIM_T_DECLARED
+#endif
+
 /*
  * Process priority specifications to get/setpriority.
  */
@@ -136,11 +146,6 @@ static const char *rlimit_ident[RLIM_NLI
 };
 #endif
 
-#ifndef _RLIM_T_DECLARED
-typedef__rlim_trlim_t;
-#define_RLIM_T_DECLARED
-#endif
-
 struct rlimit {
rlim_t  rlim_cur;   /* current (soft) limit */
rlim_t  rlim_max;   /* maximum value for rlim_cur */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301109 - head/sys/dev/hyperv/vmbus

2016-06-01 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jun  1 07:11:54 2016
New Revision: 301109
URL: https://svnweb.freebsd.org/changeset/base/301109

Log:
  hyperv/channel: Only cpu0 is supported as channel target cpu on WIN7
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jun  1 07:03:11 2016
(r301108)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jun  1 07:11:54 2016
(r301109)
@@ -302,6 +302,12 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch
 {
KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu));
 
+   if (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008 ||
+   hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) {
+   /* Only cpu0 is supported */
+   cpu = 0;
+   }
+
chan->target_cpu = cpu;
chan->target_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, cpu);
 
@@ -359,9 +365,7 @@ vmbus_channel_select_defcpu(struct hv_vm
}
}
 
-   if ((hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008) ||
-   (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) ||
-   (!is_perf_channel)) {
+   if (!is_perf_channel) {
/* Stick to cpu0 */
vmbus_channel_cpu_set(channel, 0);
return;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301105 - head/sys/dev/sfxge

2016-06-01 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Jun  1 06:51:19 2016
New Revision: 301105
URL: https://svnweb.freebsd.org/changeset/base/301105

Log:
  sfxge(4): cope with code duplication on SW events composition
  
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision:  https://reviews.freebsd.org/D

Modified:
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_ev.c
  head/sys/dev/sfxge/sfxge_rx.c

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Wed Jun  1 06:18:34 2016(r301104)
+++ head/sys/dev/sfxge/sfxge.h  Wed Jun  1 06:51:19 2016(r301105)
@@ -130,6 +130,26 @@ enum sfxge_sw_ev {
 #defineSFXGE_SW_EV_MAGIC(_sw_ev) \
(SFXGE_MAGIC_RESERVED | ((_sw_ev) << SFXGE_MAGIC_DMAQ_LABEL_WIDTH))
 
+static inline uint16_t
+sfxge_sw_ev_mk_magic(enum sfxge_sw_ev sw_ev, unsigned int label)
+{
+   KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
+   ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != label"));
+   return SFXGE_SW_EV_MAGIC(sw_ev) | label;
+}
+
+static inline uint16_t
+sfxge_sw_ev_rxq_magic(enum sfxge_sw_ev sw_ev, struct sfxge_rxq *rxq)
+{
+   return sfxge_sw_ev_mk_magic(sw_ev, 0);
+}
+
+static inline uint16_t
+sfxge_sw_ev_txq_magic(enum sfxge_sw_ev sw_ev, struct sfxge_txq *txq)
+{
+   return sfxge_sw_ev_mk_magic(sw_ev, txq->type);
+}
+
 enum sfxge_evq_state {
SFXGE_EVQ_UNINITIALIZED = 0,
SFXGE_EVQ_INITIALIZED,

Modified: head/sys/dev/sfxge/sfxge_ev.c
==
--- head/sys/dev/sfxge/sfxge_ev.c   Wed Jun  1 06:18:34 2016
(r301104)
+++ head/sys/dev/sfxge/sfxge_ev.c   Wed Jun  1 06:51:19 2016
(r301105)
@@ -207,7 +207,6 @@ sfxge_ev_rxq_flush_done(void *arg, uint3
struct sfxge_softc *sc;
struct sfxge_rxq *rxq;
unsigned int index;
-   unsigned int label;
uint16_t magic;
 
evq = (struct sfxge_evq *)arg;
@@ -226,11 +225,7 @@ sfxge_ev_rxq_flush_done(void *arg, uint3
}
 
evq = sc->evq[index];
-
-   label = 0;
-   KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
-   ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != level"));
-   magic = SFXGE_SW_EV_MAGIC(SFXGE_SW_EV_RX_QFLUSH_DONE) | label;
+   magic = sfxge_sw_ev_rxq_magic(SFXGE_SW_EV_RX_QFLUSH_DONE, rxq);
 
KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
("evq not started"));
@@ -246,7 +241,6 @@ sfxge_ev_rxq_flush_failed(void *arg, uin
struct sfxge_softc *sc;
struct sfxge_rxq *rxq;
unsigned int index;
-   unsigned int label;
uint16_t magic;
 
evq = (struct sfxge_evq *)arg;
@@ -260,11 +254,7 @@ sfxge_ev_rxq_flush_failed(void *arg, uin
/* Resend a software event on the correct queue */
index = rxq->index;
evq = sc->evq[index];
-
-   label = 0;
-   KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
-   ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != label"));
-   magic = SFXGE_SW_EV_MAGIC(SFXGE_SW_EV_RX_QFLUSH_FAILED) | label;
+   magic = sfxge_sw_ev_rxq_magic(SFXGE_SW_EV_RX_QFLUSH_FAILED, rxq);
 
KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
("evq not started"));
@@ -331,7 +321,6 @@ sfxge_ev_txq_flush_done(void *arg, uint3
struct sfxge_evq *evq;
struct sfxge_softc *sc;
struct sfxge_txq *txq;
-   unsigned int label;
uint16_t magic;
 
evq = (struct sfxge_evq *)arg;
@@ -351,11 +340,7 @@ sfxge_ev_txq_flush_done(void *arg, uint3
 
/* Resend a software event on the correct queue */
evq = sc->evq[txq->evq_index];
-
-   label = txq->type;
-   KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
-   ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != label"));
-   magic = SFXGE_SW_EV_MAGIC(SFXGE_SW_EV_TX_QFLUSH_DONE) | label;
+   magic = sfxge_sw_ev_txq_magic(SFXGE_SW_EV_TX_QFLUSH_DONE, txq);
 
KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
("evq not started"));

Modified: head/sys/dev/sfxge/sfxge_rx.c
==
--- head/sys/dev/sfxge/sfxge_rx.c   Wed Jun  1 06:18:34 2016
(r301104)
+++ head/sys/dev/sfxge/sfxge_rx.c   Wed Jun  1 06:51:19 2016
(r301105)
@@ -175,17 +175,12 @@ sfxge_rx_post_refill(void *arg)
struct sfxge_softc *sc;
unsigned int index;
struct sfxge_evq *evq;
-   unsigned int label;
uint16_t magic;
 
sc = rxq->sc;
index = rxq->index;
evq = sc->evq[index];
-
-   label = 0;
-   KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
-   ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != level"));
-   magic = SFXGE_SW_EV_MAGIC(SFXGE_SW_EV_RX_QREFILL) | label;
+   magic = sfxge_sw_ev_rxq_magic(SFXGE_SW_EV_R

svn commit: r301106 - head/sys/dev/hyperv/vmbus

2016-06-01 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jun  1 06:51:44 2016
New Revision: 301106
URL: https://svnweb.freebsd.org/changeset/base/301106

Log:
  hyperv/vmbus: Redefine event flags.
  
  - Nuke unnecessary union.
  - Avoid convoluted macro indirection.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6671

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/vmbus_reg.h
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jun  1 06:51:19 2016
(r301105)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jun  1 06:51:44 2016
(r301106)
@@ -33,6 +33,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 /*
@@ -713,8 +714,8 @@ hv_vmbus_release_unattached_channels(voi
}
hv_vmbus_free_vmbus_channel(channel);
}
-   bzero(hv_vmbus_g_connection.channels, 
-   sizeof(hv_vmbus_channel*) * HV_CHANNEL_MAX_COUNT);
+   bzero(hv_vmbus_g_connection.channels,
+   sizeof(hv_vmbus_channel*) * VMBUS_CHAN_MAX);
mtx_unlock(&hv_vmbus_g_connection.channel_lock);
 }
 

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==
--- head/sys/dev/hyperv/vmbus/hv_connection.c   Wed Jun  1 06:51:19 2016
(r301105)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c   Wed Jun  1 06:51:44 2016
(r301106)
@@ -39,6 +39,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 /*
@@ -209,8 +210,7 @@ hv_vmbus_connect(void)
M_DEVBUF, M_WAITOK | M_ZERO);
 
hv_vmbus_g_connection.channels = malloc(sizeof(hv_vmbus_channel*) *
-   HV_CHANNEL_MAX_COUNT,
-   M_DEVBUF, M_WAITOK | M_ZERO);
+   VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO);
/*
 * Find the highest vmbus version number we can support.
 */
@@ -292,20 +292,20 @@ hv_vmbus_disconnect(void)
 }
 
 static __inline void
-vmbus_event_flags_proc(unsigned long *event_flags, int flag_cnt)
+vmbus_event_flags_proc(volatile u_long *event_flags, int flag_cnt)
 {
int f;
 
for (f = 0; f < flag_cnt; ++f) {
uint32_t rel_id_base;
-   unsigned long flags;
+   u_long flags;
int bit;
 
if (event_flags[f] == 0)
continue;
 
flags = atomic_swap_long(&event_flags[f], 0);
-   rel_id_base = f << HV_CHANNEL_ULONG_SHIFT;
+   rel_id_base = f << VMBUS_EVTFLAG_SHIFT;
 
while ((bit = ffsl(flags)) != 0) {
struct hv_vmbus_channel *channel;
@@ -331,27 +331,27 @@ vmbus_event_flags_proc(unsigned long *ev
 void
 vmbus_event_proc(struct vmbus_softc *sc, int cpu)
 {
-   hv_vmbus_synic_event_flags *event;
+   struct vmbus_evtflags *eventf;
 
/*
 * On Host with Win8 or above, the event page can be checked directly
 * to get the id of the channel that has the pending interrupt.
 */
-   event = VMBUS_PCPU_GET(sc, event_flag, cpu) + VMBUS_SINT_MESSAGE;
-   vmbus_event_flags_proc(event->flagsul,
-   VMBUS_PCPU_GET(sc, event_flag_cnt, cpu));
+   eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE;
+   vmbus_event_flags_proc(eventf->evt_flags,
+   VMBUS_PCPU_GET(sc, event_flags_cnt, cpu));
 }
 
 void
 vmbus_event_proc_compat(struct vmbus_softc *sc __unused, int cpu)
 {
-   hv_vmbus_synic_event_flags *event;
+   struct vmbus_evtflags *eventf;
 
-   event = VMBUS_PCPU_GET(sc, event_flag, cpu) + VMBUS_SINT_MESSAGE;
-   if (atomic_testandclear_int(&event->flags32[0], 0)) {
+   eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE;
+   if (atomic_testandclear_long(&eventf->evt_flags[0], 0)) {
vmbus_event_flags_proc(
hv_vmbus_g_connection.recv_interrupt_page,
-   HV_MAX_NUM_CHANNELS_SUPPORTED >> HV_CHANNEL_ULONG_SHIFT);
+   VMBUS_CHAN_MAX_COMPAT >> VMBUS_EVTFLAG_SHIFT);
}
 }
 
@@ -414,8 +414,8 @@ vmbus_on_channel_open(const struct hv_vm
volatile int *flag_cnt_ptr;
int flag_cnt;
 
-   flag_cnt = (chan->offer_msg.child_rel_id / HV_CHANNEL_ULONG_LEN) + 1;
-   flag_cnt_ptr = VMBUS_PCPU_PTR(vmbus_get_softc(), event_flag_cnt,
+   flag_cnt = (chan->offer_msg.child_rel_id / VMBUS_EVTFLAG_LEN) + 1;
+   flag_cnt_ptr = VMBUS_PCPU_PTR(vmbus_get_softc(), event_flags_cnt,
chan->target_cpu);
 
for (;;) {

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==

svn commit: r301108 - stable/9/etc/ntp

2016-06-01 Thread Cy Schubert
Author: cy
Date: Wed Jun  1 07:03:11 2016
New Revision: 301108
URL: https://svnweb.freebsd.org/changeset/base/301108

Log:
  MFC r300180:
  
  Update leap-seconds to leap-seconds.3661459200.
  NO leap second will be introduced at the end of June 2016.
  
  Obtained from:ftp://tycho.usno.navy.mil/pub/ntp/.
  See also: http://www.iers.org/SharedDocs/News/EN/BulletinC.html

Modified:
  stable/9/etc/ntp/leap-seconds
Directory Properties:
  stable/9/etc/   (props changed)

Modified: stable/9/etc/ntp/leap-seconds
==
--- stable/9/etc/ntp/leap-seconds   Wed Jun  1 07:03:07 2016
(r301107)
+++ stable/9/etc/ntp/leap-seconds   Wed Jun  1 07:03:11 2016
(r301108)
@@ -130,7 +130,7 @@
 #  Washington, DC
 #  jeffrey.prilla...@usno.navy.mil
 #
-#  Last Update of leap second values:  31 Dec 2015
+#  Last Update of leap second values:  11 Jan 2016
 #
 #  The following line shows this last update date in NTP timestamp 
 #  format. This is the date on which the most recent change to
@@ -138,7 +138,7 @@
 #  be identified by the unique pair of characters in the first two 
 #  columns as shown below.
 #
-#$  3660508800
+#$  3661459200
 #
 #  The data in this file will be updated periodically as new leap 
 #  seconds are announced. In addition to being entered on the line
@@ -170,10 +170,10 @@
 #  current -- the update time stamp, the data and the name of the file 
 #  will not change.
 #
-#  Updated through IERS Bulletin C 50
-#  File expires on:  1 Jun 2016
+#  Updated through IERS Bulletin C 51
+#  File expires on:  1 Dec 2016
 #
-#@ 3673728000
+#@ 3689539200
 #
 2272060800 10  # 1 Jan 1972
 2287785600 11  # 1 Jul 1972
@@ -217,5 +217,5 @@
 #  the hash line is also ignored in the
 #  computation.
 #
-#h 44a44c49 35b22601 a9c7054c 8c56cf57 9b6f6ed5
+#h 63b4df04 0907d94f 2dadb7a1 684f7767 2a372421
 #
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301107 - stable/10/etc/ntp

2016-06-01 Thread Cy Schubert
Author: cy
Date: Wed Jun  1 07:03:07 2016
New Revision: 301107
URL: https://svnweb.freebsd.org/changeset/base/301107

Log:
  MFC r300180:
  
  Update leap-seconds to leap-seconds.3661459200.
  NO leap second will be introduced at the end of June 2016.
  
  Obtained from:ftp://tycho.usno.navy.mil/pub/ntp/.
  See also: http://www.iers.org/SharedDocs/News/EN/BulletinC.html

Modified:
  stable/10/etc/ntp/leap-seconds
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/ntp/leap-seconds
==
--- stable/10/etc/ntp/leap-seconds  Wed Jun  1 06:51:44 2016
(r301106)
+++ stable/10/etc/ntp/leap-seconds  Wed Jun  1 07:03:07 2016
(r301107)
@@ -130,7 +130,7 @@
 #  Washington, DC
 #  jeffrey.prilla...@usno.navy.mil
 #
-#  Last Update of leap second values:  31 Dec 2015
+#  Last Update of leap second values:  11 Jan 2016
 #
 #  The following line shows this last update date in NTP timestamp 
 #  format. This is the date on which the most recent change to
@@ -138,7 +138,7 @@
 #  be identified by the unique pair of characters in the first two 
 #  columns as shown below.
 #
-#$  3660508800
+#$  3661459200
 #
 #  The data in this file will be updated periodically as new leap 
 #  seconds are announced. In addition to being entered on the line
@@ -170,10 +170,10 @@
 #  current -- the update time stamp, the data and the name of the file 
 #  will not change.
 #
-#  Updated through IERS Bulletin C 50
-#  File expires on:  1 Jun 2016
+#  Updated through IERS Bulletin C 51
+#  File expires on:  1 Dec 2016
 #
-#@ 3673728000
+#@ 3689539200
 #
 2272060800 10  # 1 Jan 1972
 2287785600 11  # 1 Jul 1972
@@ -217,5 +217,5 @@
 #  the hash line is also ignored in the
 #  computation.
 #
-#h 44a44c49 35b22601 a9c7054c 8c56cf57 9b6f6ed5
+#h 63b4df04 0907d94f 2dadb7a1 684f7767 2a372421
 #
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301104 - head/cddl/contrib/opensolaris/cmd/zpool

2016-06-01 Thread Allan Jude
Author: allanjude
Date: Wed Jun  1 06:18:34 2016
New Revision: 301104
URL: https://svnweb.freebsd.org/changeset/base/301104

Log:
  Fix missing space in mandoc syntax
  
  Reported by:  rpokala

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7Wed Jun  1 
05:15:11 2016(r301103)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7Wed Jun  1 
06:18:34 2016(r301104)
@@ -478,7 +478,7 @@ When the
 feature is set to
 .Sy enabled ,
 the administrator can turn on the
-.Sysha512
+.Sy sha512
 checksum on any dataset using the
 .Dl # zfs set checksum=sha512 Ar dataset
 command.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301103 - head/sys/dev/bge

2016-06-01 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jun  1 05:15:11 2016
New Revision: 301103
URL: https://svnweb.freebsd.org/changeset/base/301103

Log:
  bge: Force chipid to 5720 A0 for 5717 C0 in an early place
  
  Discussed with:   yongari
  MFC after:1 week
  Sponsored by: Microsoft OSTC

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Wed Jun  1 04:37:43 2016(r301102)
+++ head/sys/dev/bge/if_bge.c   Wed Jun  1 05:15:11 2016(r301103)
@@ -2700,8 +2700,11 @@ bge_chipid(device_t dev)
 * registers.
 */
switch (pci_get_device(dev)) {
-   case BCOM_DEVICEID_BCM5717:
case BCOM_DEVICEID_BCM5717C:
+   /* 5717 C0 seems to belong to 5720 line. */
+   id = BGE_CHIPID_BCM5720_A0;
+   break;
+   case BCOM_DEVICEID_BCM5717:
case BCOM_DEVICEID_BCM5718:
case BCOM_DEVICEID_BCM5719:
case BCOM_DEVICEID_BCM5720:
@@ -2730,8 +2733,6 @@ bge_chipid(device_t dev)
default:
id = pci_read_config(dev, BGE_PCI_PRODID_ASICREV, 4);
}
-   if (id == BGE_CHIPID_BCM5717_C0)
-   id = BGE_CHIPID_BCM5720_A0;
}
return (id);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"