svn commit: r321325 - head/sys/kern

2017-07-21 Thread Michael Tuexen
Author: tuexen
Date: Fri Jul 21 07:44:43 2017
New Revision: 321325
URL: https://svnweb.freebsd.org/changeset/base/321325

Log:
  Fix getsockopt() for listening sockets when using SO_SNDBUF, SO_RCVBUF,
  SO_SNDLOWAT, SO_RCVLOWAT. Since r31972 it only worked for non-listening
  sockets.
  
  Sponsored by: Netflix, Inc.

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Fri Jul 21 06:56:06 2017(r321324)
+++ head/sys/kern/uipc_socket.c Fri Jul 21 07:44:43 2017(r321325)
@@ -3020,19 +3020,23 @@ integer:
goto integer;
 
case SO_SNDBUF:
-   optval = so->so_snd.sb_hiwat;
+   optval = SOLISTENING(so) ? so->sol_sbsnd_hiwat :
+   so->so_snd.sb_hiwat;
goto integer;
 
case SO_RCVBUF:
-   optval = so->so_rcv.sb_hiwat;
+   optval = SOLISTENING(so) ? so->sol_sbrcv_hiwat :
+   so->so_rcv.sb_hiwat;
goto integer;
 
case SO_SNDLOWAT:
-   optval = so->so_snd.sb_lowat;
+   optval = SOLISTENING(so) ? so->sol_sbsnd_lowat :
+   so->so_snd.sb_lowat;
goto integer;
 
case SO_RCVLOWAT:
-   optval = so->so_rcv.sb_lowat;
+   optval = SOLISTENING(so) ? so->sol_sbrcv_lowat :
+   so->so_rcv.sb_lowat;
goto integer;
 
case SO_SNDTIMEO:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-07-21 Thread Ngie Cooper

> On Jul 21, 2017, at 00:44, Michael Tuexen  wrote:
> 
> Author: tuexen
> Date: Fri Jul 21 07:44:43 2017
> New Revision: 321325
> URL: https://svnweb.freebsd.org/changeset/base/321325
> 
> Log:
>  Fix getsockopt() for listening sockets when using SO_SNDBUF, SO_RCVBUF,
>  SO_SNDLOWAT, SO_RCVLOWAT. Since r31972 it only worked for non-listening

*r319722

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


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

2017-07-21 Thread Bartek Rutkowski
Author: robak (ports committer)
Date: Fri Jul 21 08:50:22 2017
New Revision: 321326
URL: https://svnweb.freebsd.org/changeset/base/321326

Log:
  Remove stack guard option from hardening menu.
  
  Since kib's change the stack guard is now ON by default,
  this option in hardening menu of bsdinstall is no longer needed.
  
  Submitted by: Bartlomiej Rutkowski 
  Reviewed by:  bapt
  Approved by:  bapt
  MFC after:1 day
  Sponsored by: Pixeware LTD
  Differential Revision:https://reviews.freebsd.org/D11686

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

Modified: head/usr.sbin/bsdinstall/scripts/hardening
==
--- head/usr.sbin/bsdinstall/scripts/hardening  Fri Jul 21 07:44:43 2017
(r321325)
+++ head/usr.sbin/bsdinstall/scripts/hardening  Fri Jul 21 08:50:22 2017
(r321326)
@@ -42,11 +42,10 @@ FEATURES=$( dialog --backtitle "FreeBSD Installer" \
"3 read_msgbuf" "Disable reading kernel message buffer for unprivileged 
users" ${read_msgbuf:-off} \
"4 proc_debug" "Disable process debugging facilities for unprivileged 
users" ${proc_debug:-off} \
"5 random_pid" "Randomize the PID of newly created processes" 
${random_pid:-off} \
-   "6 stack_guard" "Set stack guard buffer size to 2MB" 
${stack_guard:-off} \
-   "7 clear_tmp" "Clean the /tmp filesystem on system startup" 
${clear_tmp:-off} \
-   "8 disable_syslogd" "Disable opening Syslogd network socket (disables 
remote logging)" ${disable_syslogd:-off} \
-   "9 disable_sendmail" "Disable Sendmail service" 
${disable_sendmail:-off} \
-   "10 secure_console" "Enable console password prompt" 
${secure_console:-off} \
+   "6 clear_tmp" "Clean the /tmp filesystem on system startup" 
${clear_tmp:-off} \
+   "7 disable_syslogd" "Disable opening Syslogd network socket (disables 
remote logging)" ${disable_syslogd:-off} \
+   "8 disable_sendmail" "Disable Sendmail service" 
${disable_sendmail:-off} \
+   "9 secure_console" "Enable console password prompt" 
${secure_console:-off} \
 2>&1 1>&3 )
 exec 3>&-
 
@@ -68,9 +67,6 @@ for feature in $FEATURES; do
fi
if [ "$feature" = "random_pid" ]; then
echo kern.randompid=$(jot -r 1 ) >> 
$BSDINSTALL_TMPETC/sysctl.conf.hardening
-   fi
-   if [ "$feature" = "stack_guard" ]; then
-   echo security.bsd.stack_guard_page=512 >> 
$BSDINSTALL_TMPETC/sysctl.conf.hardening
fi
if [ "$feature" = "clear_tmp" ]; then
echo 'clear_tmp_enable="YES"' >> 
$BSDINSTALL_TMPETC/rc.conf.hardening
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321327 - head/usr.bin/ktrace

2017-07-21 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Jul 21 13:27:25 2017
New Revision: 321327
URL: https://svnweb.freebsd.org/changeset/base/321327

Log:
  Use more usual formatting for the EXAMPLES section of ktrace(1).
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.bin/ktrace/ktrace.1

Modified: head/usr.bin/ktrace/ktrace.1
==
--- head/usr.bin/ktrace/ktrace.1Fri Jul 21 08:50:22 2017
(r321326)
+++ head/usr.bin/ktrace/ktrace.1Fri Jul 21 13:27:25 2017
(r321327)
@@ -28,7 +28,7 @@
 .\"@(#)ktrace.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd March 31, 2016
+.Dd July 24, 2017
 .Dt KTRACE 1
 .Os
 .Sh NAME
@@ -148,31 +148,31 @@ and
 .Ar command
 options are mutually exclusive.
 .Sh EXAMPLES
-# trace all kernel operations of process id 34
+Trace all kernel operations of process id 34:
 .Dl $ ktrace -p 34
 .Pp
-# trace all kernel operations of processes in process group 15 and
-# pass the trace flags to all current and future children
+Trace all kernel operations of processes in process group 15 and
+pass the trace flags to all current and future children:
 .Dl $ ktrace -idg 15
 .Pp
-# disable all tracing of process 65
+Disable all tracing of process 65:
 .Dl $ ktrace -cp 65
 .Pp
-# disable tracing signals on process 70 and all current children
+Disable tracing signals on process 70 and all current children:
 .Dl $ ktrace -t s -cdp 70
 .Pp
-# enable tracing of
+Enable tracing of
 .Tn I/O
-on process 67
+on process 67:
 .Dl $ ktrace -ti -p 67
 .Pp
-# run the command "w", tracing only system calls
+Run the command "w", tracing only system calls:
 .Dl $ ktrace -tc w
 .Pp
-# disable all tracing to the file "tracedata"
+Disable all tracing to the file "tracedata":
 .Dl $ ktrace -c -f tracedata
 .Pp
-# disable tracing of all user-owned processes
+Disable tracing of all user-owned processes:
 .Dl $ ktrace -C
 .Sh SEE ALSO
 .Xr kdump 1 ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321328 - head/usr.bin/truss

2017-07-21 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Jul 21 13:50:59 2017
New Revision: 321328
URL: https://svnweb.freebsd.org/changeset/base/321328

Log:
  Use more usual formatting for the EXAMPLES section of truss(1).
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.bin/truss/truss.1

Modified: head/usr.bin/truss/truss.1
==
--- head/usr.bin/truss/truss.1  Fri Jul 21 13:27:25 2017(r321327)
+++ head/usr.bin/truss/truss.1  Fri Jul 21 13:50:59 2017(r321328)
@@ -92,11 +92,13 @@ and
 options are mutually exclusive.)
 .El
 .Sh EXAMPLES
-# Follow the system calls used in echoing "hello"
+Follow the system calls used in echoing "hello":
 .Dl $ truss /bin/echo hello
-# Do the same, but put the output into a file
+.Pp
+Do the same, but put the output into a file:
 .Dl $ truss -o /tmp/truss.out /bin/echo hello
-# Follow an already-running process
+.Pp
+Follow an already-running process:
 .Dl $ truss -p 34
 .Sh SEE ALSO
 .Xr kdump 1 ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321329 - head/usr.bin/truss

2017-07-21 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Jul 21 13:58:51 2017
New Revision: 321329
URL: https://svnweb.freebsd.org/changeset/base/321329

Log:
  Make truss(1) cross-reference dtrace(1) and bump .Dd.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.bin/truss/truss.1

Modified: head/usr.bin/truss/truss.1
==
--- head/usr.bin/truss/truss.1  Fri Jul 21 13:50:59 2017(r321328)
+++ head/usr.bin/truss/truss.1  Fri Jul 21 13:58:51 2017(r321329)
@@ -1,6 +1,6 @@
 .\" $FreeBSD$
 .\"
-.Dd February 23, 2016
+.Dd July 24, 2017
 .Dt TRUSS 1
 .Os
 .Sh NAME
@@ -101,6 +101,7 @@ Do the same, but put the output into a file:
 Follow an already-running process:
 .Dl $ truss -p 34
 .Sh SEE ALSO
+.Xr dtrace 1 ,
 .Xr kdump 1 ,
 .Xr ktrace 1 ,
 .Xr ptrace 2 ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321330 - head/sys/vm

2017-07-21 Thread Ruslan Bukin
Author: br
Date: Fri Jul 21 14:14:47 2017
New Revision: 321330
URL: https://svnweb.freebsd.org/changeset/base/321330

Log:
  Fix style: change spaces to tabs.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/vm/vm_object.h

Modified: head/sys/vm/vm_object.h
==
--- head/sys/vm/vm_object.h Fri Jul 21 13:58:51 2017(r321329)
+++ head/sys/vm/vm_object.h Fri Jul 21 14:14:47 2017(r321330)
@@ -171,11 +171,11 @@ struct vm_object {
 #defineOBJ_FICTITIOUS  0x0001  /* (c) contains fictitious 
pages */
 #defineOBJ_UNMANAGED   0x0002  /* (c) contains unmanaged pages 
*/
 #defineOBJ_POPULATE0x0004  /* pager implements populate() 
*/
-#define OBJ_DEAD   0x0008  /* dead objects (during rundown) */
+#defineOBJ_DEAD0x0008  /* dead objects (during 
rundown) */
 #defineOBJ_NOSPLIT 0x0010  /* dont split this object */
 #defineOBJ_UMTXDEAD0x0020  /* umtx pshared was terminated 
*/
-#define OBJ_PIPWNT 0x0040  /* paging in progress wanted */
-#define OBJ_MIGHTBEDIRTY 0x0100/* object might be dirty, only 
for vnode */
+#defineOBJ_PIPWNT  0x0040  /* paging in progress wanted */
+#defineOBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only 
for vnode */
 #defineOBJ_TMPFS_NODE  0x0200  /* object belongs to tmpfs VREG 
node */
 #defineOBJ_TMPFS_DIRTY 0x0400  /* dirty tmpfs obj */
 #defineOBJ_COLORED 0x1000  /* pg_color is defined */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321331 - head/share/mk

2017-07-21 Thread Ruslan Bukin
Author: br
Date: Fri Jul 21 14:50:32 2017
New Revision: 321331
URL: https://svnweb.freebsd.org/changeset/base/321331

Log:
  Add warning flags for GCC 7.1.0 compiler.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkFri Jul 21 14:14:47 2017(r321330)
+++ head/share/mk/bsd.sys.mkFri Jul 21 14:50:32 2017(r321331)
@@ -145,6 +145,23 @@ CWARNFLAGS+=   -Wno-error=misleading-indentation   
\
-Wno-error=unused-const-variable
 .endif
 
+# GCC 7.1.0
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 70100
+CWARNFLAGS+=   -Wno-error=deprecated   \
+   -Wno-error=pointer-compare  \
+   -Wno-error=format-truncation\
+   -Wno-error=implicit-fallthrough \
+   -Wno-error=expansion-to-defined \
+   -Wno-error=int-in-bool-context  \
+   -Wno-error=bool-operation   \
+   -Wno-error=format-overflow  \
+   -Wno-error=stringop-overflow\
+   -Wno-error=memset-elt-size  \
+   -Wno-error=int-in-bool-context  \
+   -Wno-error=unused-const-variable\
+   -Wno-error=nonnull
+.endif
+
 # How to handle FreeBSD custom printf format specifiers.
 .if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
 FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321332 - in head: lib/librt tests/sys/aio

2017-07-21 Thread Alan Somers
Author: asomers
Date: Fri Jul 21 15:09:24 2017
New Revision: 321332
URL: https://svnweb.freebsd.org/changeset/base/321332

Log:
  Implement SIGEV_THREAD notifications for lio_listio(2)
  
  Our man pages have always indicated that this was supported, but in fact the
  feature was never implemented for lio_listio(2).
  
  Reviewed by:  jhb, kib (earlier version)
  MFC after:20 days
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D11680

Modified:
  head/lib/librt/Symbol.map
  head/lib/librt/aio.c
  head/tests/sys/aio/lio_test.c

Modified: head/lib/librt/Symbol.map
==
--- head/lib/librt/Symbol.map   Fri Jul 21 14:50:32 2017(r321331)
+++ head/lib/librt/Symbol.map   Fri Jul 21 15:09:24 2017(r321332)
@@ -26,6 +26,7 @@ FBSD_1.0 {
 };
 
 FBSD_1.5 {
+   lio_listio;
mq_getfd_np;
timer_oshandle_np;
 };

Modified: head/lib/librt/aio.c
==
--- head/lib/librt/aio.cFri Jul 21 14:50:32 2017(r321331)
+++ head/lib/librt/aio.cFri Jul 21 15:09:24 2017(r321332)
@@ -44,6 +44,7 @@ __weak_reference(__aio_write, aio_write);
 __weak_reference(__aio_return, aio_return);
 __weak_reference(__aio_waitcomplete, aio_waitcomplete);
 __weak_reference(__aio_fsync, aio_fsync);
+__weak_reference(__lio_listio, lio_listio);
 
 typedef void (*aio_func)(union sigval val, struct aiocb *iocb);
 
@@ -53,6 +54,8 @@ extern ssize_t __sys_aio_waitcomplete(struct aiocb **i
 extern ssize_t __sys_aio_return(struct aiocb *iocb);
 extern int __sys_aio_error(struct aiocb *iocb);
 extern int __sys_aio_fsync(int op, struct aiocb *iocb);
+extern int __sys_lio_listio(int mode, struct aiocb * const list[], int nent,
+struct sigevent *sig);
 
 static void
 aio_dispatch(struct sigev_node *sn)
@@ -63,8 +66,8 @@ aio_dispatch(struct sigev_node *sn)
 }
 
 static int
-aio_sigev_alloc(struct aiocb *iocb, struct sigev_node **sn,
-   struct sigevent *saved_ev)
+aio_sigev_alloc(sigev_id_t id, struct sigevent *sigevent,
+struct sigev_node **sn, struct sigevent *saved_ev)
 {
if (__sigev_check_init()) {
/* This might be that thread library is not enabled. */
@@ -72,15 +75,15 @@ aio_sigev_alloc(struct aiocb *iocb, struct sigev_node 
return (-1);
}
 
-   *sn = __sigev_alloc(SI_ASYNCIO, &iocb->aio_sigevent, NULL, 1);
+   *sn = __sigev_alloc(SI_ASYNCIO, sigevent, NULL, 1);
if (*sn == NULL) {
errno = EAGAIN;
return (-1);
}

-   *saved_ev = iocb->aio_sigevent;
-   (*sn)->sn_id = (sigev_id_t)iocb;
-   __sigev_get_sigevent(*sn, &iocb->aio_sigevent, (*sn)->sn_id);
+   *saved_ev = *sigevent;
+   (*sn)->sn_id = id;
+   __sigev_get_sigevent(*sn, sigevent, (*sn)->sn_id);
(*sn)->sn_dispatch = aio_dispatch;
 
__sigev_list_lock();
@@ -102,7 +105,8 @@ aio_io(struct aiocb *iocb, int (*sysfunc)(struct aiocb
return (ret);
}
 
-   ret = aio_sigev_alloc(iocb, &sn, &saved_ev);
+   ret = aio_sigev_alloc((sigev_id_t)iocb, &iocb->aio_sigevent, &sn,
+ &saved_ev);
if (ret)
return (ret);
ret = sysfunc(iocb);
@@ -183,11 +187,38 @@ __aio_fsync(int op, struct aiocb *iocb)
if (iocb->aio_sigevent.sigev_notify != SIGEV_THREAD)
return __sys_aio_fsync(op, iocb);
 
-   ret = aio_sigev_alloc(iocb, &sn, &saved_ev);
+   ret = aio_sigev_alloc((sigev_id_t)iocb, &iocb->aio_sigevent, &sn,
+ &saved_ev);
if (ret)
return (ret);
ret = __sys_aio_fsync(op, iocb);
iocb->aio_sigevent = saved_ev;
+   if (ret != 0) {
+   err = errno;
+   __sigev_list_lock();
+   __sigev_delete_node(sn);
+   __sigev_list_unlock();
+   errno = err;
+   }
+   return (ret);
+}
+
+int
+__lio_listio(int mode, struct aiocb * const list[], int nent,
+struct sigevent *sig)
+{
+   struct sigev_node *sn;
+   struct sigevent saved_ev;
+   int ret, err;
+
+   if (sig == NULL || sig->sigev_notify != SIGEV_THREAD)
+   return (__sys_lio_listio(mode, list, nent, sig));
+
+   ret = aio_sigev_alloc((sigev_id_t)list, sig, &sn, &saved_ev);
+   if (ret)
+   return (ret);
+   ret = __sys_lio_listio(mode, list, nent, sig);
+   *sig = saved_ev;
if (ret != 0) {
err = errno;
__sigev_list_lock();

Modified: head/tests/sys/aio/lio_test.c
==
--- head/tests/sys/aio/lio_test.c   Fri Jul 21 14:50:32 2017
(r321331)
+++ head/tests/sys/aio/lio_test.c   Fri Jul 21 15:09:24 2017
(r321332)
@@ -119,8 +119,

Re: svn commit: r321332 - in head: lib/librt tests/sys/aio

2017-07-21 Thread Alan Somers
PR:  220459

On Fri, Jul 21, 2017 at 9:09 AM, Alan Somers  wrote:
> Author: asomers
> Date: Fri Jul 21 15:09:24 2017
> New Revision: 321332
> URL: https://svnweb.freebsd.org/changeset/base/321332
>
> Log:
>   Implement SIGEV_THREAD notifications for lio_listio(2)
>
>   Our man pages have always indicated that this was supported, but in fact the
>   feature was never implemented for lio_listio(2).
>
>   Reviewed by:  jhb, kib (earlier version)
>   MFC after:20 days
>   Sponsored by: Spectra Logic Corp
>   Differential Revision:https://reviews.freebsd.org/D11680
>
> Modified:
>   head/lib/librt/Symbol.map
>   head/lib/librt/aio.c
>   head/tests/sys/aio/lio_test.c
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r321332 - in head: lib/librt tests/sys/aio

2017-07-21 Thread Ngie Cooper

> On Jul 21, 2017, at 08:11, Alan Somers  wrote:
> 
> PR:  220459
> 
>> On Fri, Jul 21, 2017 at 9:09 AM, Alan Somers  wrote:
>> Author: asomers
>> Date: Fri Jul 21 15:09:24 2017
>> New Revision: 321332
>> URL: https://svnweb.freebsd.org/changeset/base/321332
>> 
>> Log:
>>  Implement SIGEV_THREAD notifications for lio_listio(2)
>> 
>>  Our man pages have always indicated that this was supported, but in fact the
>>  feature was never implemented for lio_listio(2).
>> 
>>  Reviewed by:  jhb, kib (earlier version)
>>  MFC after:20 days
>>  Sponsored by: Spectra Logic Corp
>>  Differential Revision:https://reviews.freebsd.org/D11680
>> 
>> Modified:
>>  head/lib/librt/Symbol.map
>>  head/lib/librt/aio.c
>>  head/tests/sys/aio/lio_test.c

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


Re: svn commit: r321332 - in head: lib/librt tests/sys/aio

2017-07-21 Thread Alan Somers
On Fri, Jul 21, 2017 at 10:06 AM, Ngie Cooper  wrote:
>
>> On Jul 21, 2017, at 08:11, Alan Somers  wrote:
>>
>> PR:  220459
>>
>>> On Fri, Jul 21, 2017 at 9:09 AM, Alan Somers  wrote:
>>> Author: asomers
>>> Date: Fri Jul 21 15:09:24 2017
>>> New Revision: 321332
>>> URL: https://svnweb.freebsd.org/changeset/base/321332
>>>
>>> Log:
>>>  Implement SIGEV_THREAD notifications for lio_listio(2)
>>>
>>>  Our man pages have always indicated that this was supported, but in fact 
>>> the
>>>  feature was never implemented for lio_listio(2).
>>>
>>>  Reviewed by:  jhb, kib (earlier version)
>>>  MFC after:20 days
>>>  Sponsored by: Spectra Logic Corp
>>>  Differential Revision:https://reviews.freebsd.org/D11680
>>>
>>> Modified:
>>>  head/lib/librt/Symbol.map
>>>  head/lib/librt/aio.c
>>>  head/tests/sys/aio/lio_test.c
>
> Thanks so much :)!

You're welcome.  I didn't know you were interested in AIO.  Would you
like me to include you on future code reviews in this area?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321333 - head/lib/libc/tests/sys

2017-07-21 Thread Bryan Drewery
Author: bdrewery
Date: Fri Jul 21 16:14:06 2017
New Revision: 321333
URL: https://svnweb.freebsd.org/changeset/base/321333

Log:
  Properly set userid for truncate_test.
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/sys/Makefile

Modified: head/lib/libc/tests/sys/Makefile
==
--- head/lib/libc/tests/sys/MakefileFri Jul 21 15:09:24 2017
(r321332)
+++ head/lib/libc/tests/sys/MakefileFri Jul 21 16:14:06 2017
(r321333)
@@ -87,7 +87,7 @@ FILESGROUPS+= truncate_test_FILES
 truncate_test_FILES=   truncate_test.root_owned
 truncate_test_FILESDIR=${TESTSDIR}
 truncate_test_FILESMODE= 0600
-truncate_test_FILESOWNER= root
+truncate_test_FILESOWN= root
 truncate_test_FILESGRP= wheel
 truncate_test_FILESPACKAGE=${PACKAGE}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321334 - head/share/mk

2017-07-21 Thread Bryan Drewery
Author: bdrewery
Date: Fri Jul 21 16:14:35 2017
New Revision: 321334
URL: https://svnweb.freebsd.org/changeset/base/321334

Log:
  Respect INSTALL_AS_USER for FILES.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/share/mk/bsd.files.mk

Modified: head/share/mk/bsd.files.mk
==
--- head/share/mk/bsd.files.mk  Fri Jul 21 16:14:06 2017(r321333)
+++ head/share/mk/bsd.files.mk  Fri Jul 21 16:14:35 2017(r321334)
@@ -26,6 +26,10 @@ installfiles: installfiles-${group}
 
 ${group}OWN?=  ${SHAREOWN}
 ${group}GRP?=  ${SHAREGRP}
+.if ${MK_INSTALL_AS_USER} == "yes"
+${group}OWN=   ${SHAREOWN}
+${group}GRP=   ${SHAREGRP}
+.endif
 ${group}MODE?= ${SHAREMODE}
 ${group}DIR?=  ${BINDIR}
 STAGE_SETS+=   ${group:C,[/*],_,g}
@@ -46,6 +50,10 @@ _${group}FILES=
 defined(${group}NAME_${file:T}) || defined(${group}NAME)
 ${group}OWN_${file:T}?=${${group}OWN}
 ${group}GRP_${file:T}?=${${group}GRP}
+.if ${MK_INSTALL_AS_USER} == "yes"
+${group}OWN_${file:T}= ${SHAREOWN}
+${group}GRP_${file:T}= ${SHAREGRP}
+.endif
 ${group}MODE_${file:T}?=   ${${group}MODE}
 ${group}DIR_${file:T}?=${${group}DIR}
 .if defined(${group}NAME)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321335 - in head/sys: amd64/amd64 x86/x86

2017-07-21 Thread Ryan Libby
Author: rlibby
Date: Fri Jul 21 17:11:36 2017
New Revision: 321335
URL: https://svnweb.freebsd.org/changeset/base/321335

Log:
  __pcpu: gcc -Wredundant-decls
  
  Pollution from counter.h made __pcpu visible in amd64/pmap.c.  Delete
  the existing extern decl of __pcpu in amd64/pmap.c and avoid referring
  to that symbol, instead accessing the pcpu region via PCPU_SET macros.
  Also delete an unused extern decl of __pcpu from mp_x86.c.
  
  Reviewed by:  kib
  Approved by:  markj (mentor)
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D11666

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Fri Jul 21 16:14:35 2017(r321334)
+++ head/sys/amd64/amd64/pmap.c Fri Jul 21 17:11:36 2017(r321335)
@@ -274,8 +274,6 @@ pmap_modified_bit(pmap_t pmap)
return (mask);
 }
 
-extern struct pcpu __pcpu[];
-
 #if !defined(DIAGNOSTIC)
 #ifdef __GNUC_GNU_INLINE__
 #define PMAP_INLINE__attribute__((__gnu_inline__)) inline
@@ -1063,8 +1061,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
kernel_pmap->pm_pcids[i].pm_pcid = PMAP_PCID_KERN;
kernel_pmap->pm_pcids[i].pm_gen = 1;
}
-   __pcpu[0].pc_pcid_next = PMAP_PCID_KERN + 1;
-   __pcpu[0].pc_pcid_gen = 1;
+   PCPU_SET(pcid_next, PMAP_PCID_KERN + 1);
+   PCPU_SET(pcid_gen, 1);
/*
 * pcpu area for APs is zeroed during AP startup.
 * pc_pcid_next and pc_pcid_gen are initialized by AP

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Fri Jul 21 16:14:35 2017(r321334)
+++ head/sys/x86/x86/mp_x86.c   Fri Jul 21 17:11:36 2017(r321335)
@@ -90,8 +90,6 @@ int   mcount_lock;
 intmp_naps;/* # of Applications processors */
 intboot_cpu_id = -1;   /* designated BSP */
 
-extern struct pcpu __pcpu[];
-
 /* AP uses this during bootstrap.  Do not staticize.  */
 char *bootSTK;
 int bootAP;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-07-21 Thread Sean Bruno
Author: sbruno
Date: Fri Jul 21 17:42:54 2017
New Revision: 321336
URL: https://svnweb.freebsd.org/changeset/base/321336

Log:
  Do not update stats counter in SWI context.  Defer to the already existing
  admin thread.
  
  Submitted by: Matt Macy 
  Sponsored by: Limelight Networks

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

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Fri Jul 21 17:11:36 2017(r321335)
+++ head/sys/dev/e1000/if_em.c  Fri Jul 21 17:42:54 2017(r321336)
@@ -1663,9 +1663,7 @@ em_if_timer(if_ctx_t ctx, uint16_t qid)
if (qid != 0)
return;
 
-   em_if_update_admin_status(ctx);
-   em_update_stats_counters(adapter);
-
+   iflib_admin_intr_deferred(ctx);
/* Reset LAA into RAR[0] on 82571 */
if ((adapter->hw.mac.type == e1000_82571) &&
e1000_get_laa_state_82571(&adapter->hw))
@@ -1781,6 +1779,7 @@ em_if_update_admin_status(if_ctx_t ctx)
iflib_link_state_change(ctx, LINK_STATE_DOWN, ifp->if_baudrate);
printf("link state changed to down\n");
}
+   em_update_stats_counters(adapter);
 
E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | E1000_IMS_LSC);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321342 - head/contrib/llvm/tools/clang/lib/AST

2017-07-21 Thread Dimitry Andric
Author: dim
Date: Fri Jul 21 17:59:54 2017
New Revision: 321342
URL: https://svnweb.freebsd.org/changeset/base/321342

Log:
  Pull in r295886 from upstream clang trunk (by Richard Smith):
  
PR32034: Evaluate _Atomic(T) in-place when T is a class or array type.
  
This is necessary in order for the evaluation of an _Atomic
initializer for those types to have an associated object, which an
initializer for class or array type needs.
  
  This fixes an assertion when building recent versions of LinuxCNC.
  
  Reported by:  trasz
  PR:   220883
  MFC after:1 week

Modified:
  head/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp

Modified: head/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp
==
--- head/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp  Fri Jul 21 
17:58:06 2017(r321341)
+++ head/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp  Fri Jul 21 
17:59:54 2017(r321342)
@@ -1404,7 +1404,8 @@ static bool EvaluateIntegerOrLValue(const Expr *E, APV
 EvalInfo &Info);
 static bool EvaluateFloat(const Expr *E, APFloat &Result, EvalInfo &Info);
 static bool EvaluateComplex(const Expr *E, ComplexValue &Res, EvalInfo &Info);
-static bool EvaluateAtomic(const Expr *E, APValue &Result, EvalInfo &Info);
+static bool EvaluateAtomic(const Expr *E, const LValue *This, APValue &Result,
+   EvalInfo &Info);
 static bool EvaluateAsRValue(EvalInfo &Info, const Expr *E, APValue &Result);
 
 
//===--===//
@@ -4691,7 +4692,10 @@ class ExprEvaluatorBase (public)
 
 case CK_AtomicToNonAtomic: {
   APValue AtomicVal;
-  if (!EvaluateAtomic(E->getSubExpr(), AtomicVal, Info))
+  // This does not need to be done in place even for class/array types:
+  // atomic-to-non-atomic conversion implies copying the object
+  // representation.
+  if (!Evaluate(AtomicVal, Info, E->getSubExpr()))
 return false;
   return DerivedSuccess(AtomicVal, E);
 }
@@ -9565,10 +9569,11 @@ bool ComplexExprEvaluator::VisitInitListExpr(const Ini
 namespace {
 class AtomicExprEvaluator :
 public ExprEvaluatorBase {
+  const LValue *This;
   APValue &Result;
 public:
-  AtomicExprEvaluator(EvalInfo &Info, APValue &Result)
-  : ExprEvaluatorBaseTy(Info), Result(Result) {}
+  AtomicExprEvaluator(EvalInfo &Info, const LValue *This, APValue &Result)
+  : ExprEvaluatorBaseTy(Info), This(This), Result(Result) {}
 
   bool Success(const APValue &V, const Expr *E) {
 Result = V;
@@ -9578,7 +9583,10 @@ class AtomicExprEvaluator : (public)
   bool ZeroInitialization(const Expr *E) {
 ImplicitValueInitExpr VIE(
 E->getType()->castAs()->getValueType());
-return Evaluate(Result, Info, &VIE);
+// For atomic-qualified class (and array) types in C++, initialize the
+// _Atomic-wrapped subobject directly, in-place.
+return This ? EvaluateInPlace(Result, Info, *This, &VIE)
+: Evaluate(Result, Info, &VIE);
   }
 
   bool VisitCastExpr(const CastExpr *E) {
@@ -9586,15 +9594,17 @@ class AtomicExprEvaluator : (public)
 default:
   return ExprEvaluatorBaseTy::VisitCastExpr(E);
 case CK_NonAtomicToAtomic:
-  return Evaluate(Result, Info, E->getSubExpr());
+  return This ? EvaluateInPlace(Result, Info, *This, E->getSubExpr())
+  : Evaluate(Result, Info, E->getSubExpr());
 }
   }
 };
 } // end anonymous namespace
 
-static bool EvaluateAtomic(const Expr *E, APValue &Result, EvalInfo &Info) {
+static bool EvaluateAtomic(const Expr *E, const LValue *This, APValue &Result,
+   EvalInfo &Info) {
   assert(E->isRValue() && E->getType()->isAtomicType());
-  return AtomicExprEvaluator(Info, Result).Visit(E);
+  return AtomicExprEvaluator(Info, This, Result).Visit(E);
 }
 
 
//===--===//
@@ -9699,8 +9709,17 @@ static bool Evaluate(APValue &Result, EvalInfo &Info, 
 if (!EvaluateVoid(E, Info))
   return false;
   } else if (T->isAtomicType()) {
-if (!EvaluateAtomic(E, Result, Info))
-  return false;
+QualType Unqual = T.getAtomicUnqualifiedType();
+if (Unqual->isArrayType() || Unqual->isRecordType()) {
+  LValue LV;
+  LV.set(E, Info.CurrentCall->Index);
+  APValue &Value = Info.CurrentCall->createTemporary(E, false);
+  if (!EvaluateAtomic(E, &LV, Value, Info))
+return false;
+} else {
+  if (!EvaluateAtomic(E, nullptr, Result, Info))
+return false;
+}
   } else if (Info.getLangOpts().CPlusPlus11) {
 Info.FFDiag(E, diag::note_constexpr_nonliteral) << E->getType();
 return false;
@@ -9725,10 +9744,16 @@ static bool EvaluateInPlace(APValue &Result, EvalInfo 
   if (E->isRValue()) {
 // Evaluate arrays and record types in-place

svn commit: r321347 - head/sys/ufs/ffs

2017-07-21 Thread Konstantin Belousov
Author: kib
Date: Fri Jul 21 18:28:27 2017
New Revision: 321347
URL: https://svnweb.freebsd.org/changeset/base/321347

Log:
  Account for lock recursion when transfering snaplock to the vnode lock
  in ffs_snapremove().
  
  Apparently ffs_snapremove() may be called with the snap lock recursed,
  at least one trace demonstrated this when snapshot vnode was unlinked
  while synced.  It was inactivated from the syncer thread.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/ufs/ffs/ffs_snapshot.c

Modified: head/sys/ufs/ffs/ffs_snapshot.c
==
--- head/sys/ufs/ffs/ffs_snapshot.c Fri Jul 21 18:14:06 2017
(r321346)
+++ head/sys/ufs/ffs/ffs_snapshot.c Fri Jul 21 18:28:27 2017
(r321347)
@@ -1598,7 +1598,7 @@ ffs_snapremove(vp)
struct buf *ibp;
struct fs *fs;
ufs2_daddr_t numblks, blkno, dblk;
-   int error, loc, last;
+   int error, i, last, loc;
struct snapdata *sn;
 
ip = VTOI(vp);
@@ -1618,10 +1618,14 @@ ffs_snapremove(vp)
ip->i_nextsnap.tqe_prev = 0;
VI_UNLOCK(devvp);
lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL);
+   for (i = 0; i < sn->sn_lock.lk_recurse; i++)
+   lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL);
KASSERT(vp->v_vnlock == &sn->sn_lock,
("ffs_snapremove: lost lock mutation")); 
vp->v_vnlock = &vp->v_lock;
VI_LOCK(devvp);
+   while (sn->sn_lock.lk_recurse > 0)
+   lockmgr(&sn->sn_lock, LK_RELEASE, NULL);
lockmgr(&sn->sn_lock, LK_RELEASE, NULL);
try_free_snapdata(devvp);
} else
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321348 - head/sys/ufs/ffs

2017-07-21 Thread Konstantin Belousov
Author: kib
Date: Fri Jul 21 18:36:17 2017
New Revision: 321348
URL: https://svnweb.freebsd.org/changeset/base/321348

Log:
  Unlock correct lock in ffs_snapblkfree().
  
  It is possible for ffs_snapblkfree() to race and lock snaplock while
  the devvp snapdata is instantiated, but no snapshots exist.  In this
  case the loop over snapshots in ffs_snapblkfree() is not executed, and
  the local variable vp is left initialized to NULL.
  
  Unlock using &sn->sn_lock and not vp->v_vnlock.  For the inodes on the
  snapshot list, the locks are same.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/ufs/ffs/ffs_snapshot.c

Modified: head/sys/ufs/ffs/ffs_snapshot.c
==
--- head/sys/ufs/ffs/ffs_snapshot.c Fri Jul 21 18:28:27 2017
(r321347)
+++ head/sys/ufs/ffs/ffs_snapshot.c Fri Jul 21 18:36:17 2017
(r321348)
@@ -1935,7 +1935,7 @@ retry:
 */
if (error != 0 && wkhd != NULL)
softdep_freework(wkhd);
-   lockmgr(vp->v_vnlock, LK_RELEASE, NULL);
+   lockmgr(&sn->sn_lock, LK_RELEASE, NULL);
return (error);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321349 - head/sys/ufs/ffs

2017-07-21 Thread Konstantin Belousov
Author: kib
Date: Fri Jul 21 18:42:35 2017
New Revision: 321349
URL: https://svnweb.freebsd.org/changeset/base/321349

Log:
  Improve publication of the newly allocated snapdata.
  
  For freshly allocated snapdata, Lock sn_lock in advance, so
  si_snapdata readers see the locked snapdata and not race.
  
  For existing snapdata, if the thread was put to sleep waiting for
  sn_lock, re-read si_snapdata.  This either closes the race or makes
  the reliance on LK_DRAIN less important.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/ufs/ffs/ffs_snapshot.c

Modified: head/sys/ufs/ffs/ffs_snapshot.c
==
--- head/sys/ufs/ffs/ffs_snapshot.c Fri Jul 21 18:36:17 2017
(r321348)
+++ head/sys/ufs/ffs/ffs_snapshot.c Fri Jul 21 18:42:35 2017
(r321349)
@@ -2638,8 +2638,8 @@ try_free_snapdata(struct vnode *devvp)
 static struct snapdata *
 ffs_snapdata_acquire(struct vnode *devvp)
 {
-   struct snapdata *nsn;
-   struct snapdata *sn;
+   struct snapdata *nsn, *sn;
+   int error;
 
/*
 * Allocate a free snapdata.  This is done before acquiring the
@@ -2647,23 +2647,37 @@ ffs_snapdata_acquire(struct vnode *devvp)
 * held.
 */
nsn = ffs_snapdata_alloc();
-   /*
-* If there snapshots already exist on this filesystem grab a
-* reference to the shared lock.  Otherwise this is the first
-* snapshot on this filesystem and we need to use our
-* pre-allocated snapdata.
-*/
-   VI_LOCK(devvp);
-   if (devvp->v_rdev->si_snapdata == NULL) {
-   devvp->v_rdev->si_snapdata = nsn;
-   nsn = NULL;
+
+   for (;;) {
+   VI_LOCK(devvp);
+   sn = devvp->v_rdev->si_snapdata;
+   if (sn == NULL) {
+   /*
+* This is the first snapshot on this
+* filesystem and we use our pre-allocated
+* snapdata.  Publish sn with the sn_lock
+* owned by us, to avoid the race.
+*/
+   error = lockmgr(&nsn->sn_lock, LK_EXCLUSIVE |
+   LK_NOWAIT, NULL);
+   if (error != 0)
+   panic("leaked sn, lockmgr error %d", error);
+   sn = devvp->v_rdev->si_snapdata = nsn;
+   VI_UNLOCK(devvp);
+   nsn = NULL;
+   break;
+   }
+
+   /*
+* There is a snapshots which already exists on this
+* filesystem, grab a reference to the common lock.
+*/
+   error = lockmgr(&sn->sn_lock, LK_INTERLOCK |
+   LK_EXCLUSIVE | LK_SLEEPFAIL, VI_MTX(devvp));
+   if (error == 0)
+   break;
}
-   sn = devvp->v_rdev->si_snapdata;
-   /*
-* Acquire the snapshot lock.
-*/
-   lockmgr(&sn->sn_lock,
-   LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY, VI_MTX(devvp));
+
/*
 * Free any unused snapdata.
 */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r321356 - head/usr.bin/top

2017-07-21 Thread Mark Johnston
Author: markj
Date: Fri Jul 21 23:53:48 2017
New Revision: 321356
URL: https://svnweb.freebsd.org/changeset/base/321356

Log:
  Fix top(1) output when zfs.ko is loaded but ZFS is not in use.
  
  Reviewed by:  allanjude
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D11693

Modified:
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Fri Jul 21 23:08:13 2017(r321355)
+++ head/usr.bin/top/machine.c  Fri Jul 21 23:53:48 2017(r321356)
@@ -328,14 +328,15 @@ machine_init(struct statics *statics, char do_unames)
size != sizeof(smpmode))
smpmode = 0;
 
-   size = sizeof(carc_en);
-   if (sysctlbyname("vfs.zfs.compressed_arc_enabled", &carc_en, &size,
-   NULL, 0) == 0 && carc_en == 1)
-   carc_enabled = 1;
size = sizeof(arc_size);
if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arc_size, &size,
NULL, 0) == 0 && arc_size != 0)
arc_enabled = 1;
+   size = sizeof(carc_en);
+   if (arc_enabled &&
+   sysctlbyname("vfs.zfs.compressed_arc_enabled", &carc_en, &size,
+   NULL, 0) == 0 && carc_en == 1)
+   carc_enabled = 1;
 
if (do_unames) {
while ((pw = getpwent()) != NULL) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"