svn commit: r318590 - head/sys/compat/linuxkpi/common/include/asm

2017-05-20 Thread Mark Johnston
Author: markj
Date: Sun May 21 00:06:36 2017
New Revision: 318590
URL: https://svnweb.freebsd.org/changeset/base/318590

Log:
  Add get_cpu() and put_cpu().
  
  MFC after:1 week

Modified:
  head/sys/compat/linuxkpi/common/include/asm/smp.h

Modified: head/sys/compat/linuxkpi/common/include/asm/smp.h
==
--- head/sys/compat/linuxkpi/common/include/asm/smp.h   Sat May 20 23:25:07 
2017(r318589)
+++ head/sys/compat/linuxkpi/common/include/asm/smp.h   Sun May 21 00:06:36 
2017(r318590)
@@ -37,4 +37,12 @@ int  linux_wbinvd_on_all_cpus(void);
 
 #endif
 
+#defineget_cpu() ({\
+   sched_pin();\
+   PCPU_GET(cpuid);\
+})
+
+#defineput_cpu()   \
+   sched_unpin()
+
 #endif /* _ASM_SMP_H_ */
___
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: r318589 - head/usr.sbin/mountd

2017-05-20 Thread Rick Macklem
Author: rmacklem
Date: Sat May 20 23:25:07 2017
New Revision: 318589
URL: https://svnweb.freebsd.org/changeset/base/318589

Log:
  Update the exports.5 man page to reflect the change in default uid/gid
  made by r318262.
  
  This is a content change.

Modified:
  head/usr.sbin/mountd/exports.5

Modified: head/usr.sbin/mountd/exports.5
==
--- head/usr.sbin/mountd/exports.5  Sat May 20 18:16:26 2017
(r318588)
+++ head/usr.sbin/mountd/exports.5  Sat May 20 23:25:07 2017
(r318589)
@@ -28,7 +28,7 @@
 .\" @(#)exports.5  8.3 (Berkeley) 3/29/95
 .\" $FreeBSD$
 .\"
-.Dd August 14, 2014
+.Dd May 20, 2017
 .Dt EXPORTS 5
 .Os
 .Sh NAME
@@ -164,12 +164,12 @@ In the absence of
 .Fl maproot
 and
 .Fl mapall
-options, remote accesses by root will result in using a credential of -2:-2.
+options, remote accesses by root will result in using a credential of 
65534:65533.
 All other users will be mapped to their remote credential.
 If a
 .Fl maproot
 option is given,
-remote access by root will be mapped to that credential instead of -2:-2.
+remote access by root will be mapped to that credential instead of 65534:65533.
 If a
 .Fl mapall
 option is given,
___
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: r318588 - head/usr.sbin/nscd

2017-05-20 Thread Cy Schubert
Author: cy
Date: Sat May 20 18:16:26 2017
New Revision: 318588
URL: https://svnweb.freebsd.org/changeset/base/318588

Log:
  Fix up two assertions following malloc(). vangyzen@ notified me of
  the second one. The first one is fixed as well.
  
  Reported by:  vangyzen@
  MFC after:1 week

Modified:
  head/usr.sbin/nscd/query.c

Modified: head/usr.sbin/nscd/query.c
==
--- head/usr.sbin/nscd/query.c  Sat May 20 18:02:31 2017(r318587)
+++ head/usr.sbin/nscd/query.c  Sat May 20 18:16:26 2017(r318588)
@@ -725,7 +725,7 @@ on_read_request_process(struct query_sta
if (read_response->error_code == -2) {
read_response->data = malloc(
read_response->data_size);
-   assert(read_response != NULL);
+   assert(read_response->data != NULL);
read_response->error_code = cache_read(c_entry,
read_request->cache_key,
read_request->cache_key_size,
@@ -745,7 +745,7 @@ on_read_request_process(struct query_sta
if (read_response->error_code == -2) {
read_response->data = malloc(
read_response->data_size);
-   assert(read_response != NULL);
+   assert(read_response->data != NULL);
read_response->error_code = 
cache_read(neg_c_entry,
read_request->cache_key,
read_request->cache_key_size,
___
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: r318587 - head/contrib/top

2017-05-20 Thread Dag-Erling Smørgrav
Author: des
Date: Sat May 20 18:02:31 2017
New Revision: 318587
URL: https://svnweb.freebsd.org/changeset/base/318587

Log:
  Add -w to usage string.
  
  Reported by:  Jamie Landeg-Jones 
  MFC after:1 week

Modified:
  head/contrib/top/top.c

Modified: head/contrib/top/top.c
==
--- head/contrib/top/top.c  Sat May 20 17:42:58 2017(r318586)
+++ head/contrib/top/top.c  Sat May 20 18:02:31 2017(r318587)
@@ -433,7 +433,7 @@ char *argv[];
  default:
fprintf(stderr,
 "Top version %s\n"
-"Usage: %s [-abCHIijnPqStuvz] [-d count] [-m io | cpu] [-o field] [-s time]\n"
+"Usage: %s [-abCHIijnPqStuvwz] [-d count] [-m io | cpu] [-o field] [-s time]\n"
 "   [-J jail] [-U username] [number]\n",
version_string(), myname);
exit(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: r318586 - head/contrib/dma

2017-05-20 Thread Eric van Gyzen
Author: vangyzen
Date: Sat May 20 17:42:58 2017
New Revision: 318586
URL: https://svnweb.freebsd.org/changeset/base/318586

Log:
  dma.8: fix problems reported by igor and 'mandoc -Tlint'
  
  dma.8:77:contraction:Queue the mail, but [don't] attempt to deliver it.
  dma.8:85:repeated:s [are are] ignored.
  dma.8:87:contraction:[Don't] run in the background.
  dma.8:201:contraction:Use the catch-all alias only if you [don't] want any 
local mail to be
  
  mandoc: dma.8:308:5: WARNING: macro neither callable nor escaped: Sm
  
  MFC after:3 days

Modified:
  head/contrib/dma/dma.8

Modified: head/contrib/dma/dma.8
==
--- head/contrib/dma/dma.8  Sat May 20 17:39:23 2017(r318585)
+++ head/contrib/dma/dma.8  Sat May 20 17:42:58 2017(r318586)
@@ -74,7 +74,7 @@ acts as a compatibility option for sendm
 .It Fl bp
 List all mails currently stored in the mail queue.
 .It Fl bq
-Queue the mail, but don't attempt to deliver it.
+Queue the mail, but do not attempt to deliver it.
 See also the
 .Sq DEFER
 config file setting below.
@@ -82,9 +82,9 @@ config file setting below.
 .Pp
 All other
 .Ar mode Ns
-s are are ignored.
+s are ignored.
 .It Fl D
-Don't run in the background.
+Do not run in the background.
 Useful for debugging.
 .It Fl f Ar sender
 Set sender address (envelope-from) to
@@ -198,7 +198,7 @@ The special name
 .Ql *
 can be used to create a catch-all alias, which gets used if no other
 matching alias is found.
-Use the catch-all alias only if you don't want any local mail to be
+Use the catch-all alias only if you do not want any local mail to be
 delivered.
 .It Ic SPOOLDIR Xo
 (string, default=/var/spool/dma)
@@ -305,7 +305,8 @@ will send all mails as
 setting it to
 .Ql percolator
 will send all mails as
-.Ql Sm off Va username @percolator .
+.Sm off
+.Ql Va username @percolator .
 .Sm on
 .It Ic NULLCLIENT Xo
 .Xc
___
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: r318585 - head/contrib/dma

2017-05-20 Thread Eric van Gyzen
Author: vangyzen
Date: Sat May 20 17:39:23 2017
New Revision: 318585
URL: https://svnweb.freebsd.org/changeset/base/318585

Log:
  dma.8: use the correct name for 'SECURETRANSFER'
  
  The code uses 'SECURETRANS', but the config file uses 'SECURETRANSFER'.
  
  MFC after:3 days

Modified:
  head/contrib/dma/dma.8

Modified: head/contrib/dma/dma.8
==
--- head/contrib/dma/dma.8  Sat May 20 17:33:47 2017(r318584)
+++ head/contrib/dma/dma.8  Sat May 20 17:39:23 2017(r318585)
@@ -30,7 +30,7 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd February 13, 2014
+.Dd May 20, 2017
 .Dt DMA 8
 .Os
 .Sh NAME
@@ -213,7 +213,7 @@ Just stick with the default.
 Path to the
 .Sq auth.conf
 file.
-.It Ic SECURETRANS Xo
+.It Ic SECURETRANSFER Xo
 (boolean, default=commented)
 .Xc
 Uncomment if you want TLS/SSL secured transfer.
@@ -222,7 +222,7 @@ Uncomment if you want TLS/SSL secured tr
 .Xc
 Uncomment if you want to use STARTTLS.
 Only useful together with
-.Sq SECURETRANS .
+.Sq SECURETRANSFER .
 .It Ic OPPORTUNISTIC_TLS Xo
 (boolean, default=commented)
 .Xc
@@ -234,7 +234,7 @@ the outside mail exchangers; in opportun
 be encrypted if the remote server supports STARTTLS, but an unencrypted
 delivery will still be made if the negotiation fails.
 Only useful together with
-.Sq SECURETRANS
+.Sq SECURETRANSFER
 and
 .Sq STARTTLS .
 .It Ic CERTFILE Xo
___
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: r318584 - in head/lib/libthr: . thread

2017-05-20 Thread Eric van Gyzen
Author: vangyzen
Date: Sat May 20 17:33:47 2017
New Revision: 318584
URL: https://svnweb.freebsd.org/changeset/base/318584

Log:
  libthr: Use CLI flags instead of pragmas to disable warnings
  
  People tweaking the build system or compilers tend to look into
  the Makefile and not into the source.  Having some warning controls
  in the Makefile and some in the source code is surprising.
  
  Pragmas have the advantage that they leave the warnings enabled
  for more code, but that advantage isn't very relevant in these cases.
  
  Requested by: kib
  Reviewed by:  kib
  MFC after:3 days
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D10832

Modified:
  head/lib/libthr/Makefile
  head/lib/libthr/thread/thr_stack.c
  head/lib/libthr/thread/thr_symbols.c

Modified: head/lib/libthr/Makefile
==
--- head/lib/libthr/MakefileSat May 20 17:32:30 2017(r318583)
+++ head/lib/libthr/MakefileSat May 20 17:33:47 2017(r318584)
@@ -27,6 +27,12 @@ CFLAGS+=-I${SRCTOP}/libexec/rtld-elf/${M
 CFLAGS+=-I${SRCTOP}/lib/libthread_db
 CFLAGS+=-Winline
 
+CFLAGS.thr_stack.c+=   -Wno-cast-align
+.include 
+.if !(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 40300)
+CFLAGS.thr_symbols.c+= -Wno-missing-variable-declarations
+.endif
+
 .ifndef NO_THREAD_UNWIND_STACK
 CFLAGS+=-fexceptions
 CFLAGS+=-D_PTHREAD_FORCED_UNWIND

Modified: head/lib/libthr/thread/thr_stack.c
==
--- head/lib/libthr/thread/thr_stack.c  Sat May 20 17:32:30 2017
(r318583)
+++ head/lib/libthr/thread/thr_stack.c  Sat May 20 17:33:47 2017
(r318584)
@@ -290,19 +290,6 @@ _thr_stack_alloc(struct pthread_attr *at
return (-1);
 }
 
-/*
- * Disable this warning from clang:
- *
- * cast from 'char *' to
- *'struct stack *' increases required alignment from 1 to 8
- *[-Werror,-Wcast-align]
- * spare_stack = (struct stack *)
- */
-#ifdef __clang__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wcast-align"
-#endif
-
 /* This function must be called with _thread_list_lock held. */
 void
 _thr_stack_free(struct pthread_attr *attr)
@@ -329,7 +316,3 @@ _thr_stack_free(struct pthread_attr *att
attr->stackaddr_attr = NULL;
}
 }
-
-#ifdef __clang__
-#pragma GCC diagnostic pop
-#endif

Modified: head/lib/libthr/thread/thr_symbols.c
==
--- head/lib/libthr/thread/thr_symbols.cSat May 20 17:32:30 2017
(r318583)
+++ head/lib/libthr/thread/thr_symbols.cSat May 20 17:33:47 2017
(r318584)
@@ -37,10 +37,6 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-#ifdef __clang__
-#pragma GCC diagnostic ignored "-Wmissing-variable-declarations"
-#endif
-
 /* A collection of symbols needed by debugger */
 
 /* int _libthr_debug */
___
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: r318583 - head/lib/libthr

2017-05-20 Thread Eric van Gyzen
Author: vangyzen
Date: Sat May 20 17:32:30 2017
New Revision: 318583
URL: https://svnweb.freebsd.org/changeset/base/318583

Log:
  libthr: use default WARNS level of 6
  
  Reviewed by:  kib
  MFC after:3 days
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D10832

Modified:
  head/lib/libthr/Makefile

Modified: head/lib/libthr/Makefile
==
--- head/lib/libthr/MakefileSat May 20 17:32:01 2017(r318582)
+++ head/lib/libthr/MakefileSat May 20 17:32:30 2017(r318583)
@@ -16,7 +16,6 @@ MK_SSP=   no
 
 LIB=thr
 SHLIB_MAJOR= 3
-WARNS?=3
 NO_WTHREAD_SAFETY=1
 CFLAGS+=-DPTHREAD_KERNEL
 CFLAGS+=-I${SRCTOP}/lib/libc/include -I${.CURDIR}/thread \
___
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: r318582 - in head/lib: libc/gen libc/include libthr/thread

2017-05-20 Thread Eric van Gyzen
Author: vangyzen
Date: Sat May 20 17:32:01 2017
New Revision: 318582
URL: https://svnweb.freebsd.org/changeset/base/318582

Log:
  Remove old spinlock_debug code from libc
  
  This no longer seems useful.  Remove it.
  
  This was prompted by a "cast discards volatile qualifier" warning
  in libthr when WARNS=6.
  
  Reviewed by:  kib
  MFC after:3 days
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D10832

Modified:
  head/lib/libc/gen/Symbol.map
  head/lib/libc/gen/_spinlock_stub.c
  head/lib/libc/include/spinlock.h
  head/lib/libthr/thread/thr_init.c
  head/lib/libthr/thread/thr_spinlock.c

Modified: head/lib/libc/gen/Symbol.map
==
--- head/lib/libc/gen/Symbol.mapSat May 20 17:30:48 2017
(r318581)
+++ head/lib/libc/gen/Symbol.mapSat May 20 17:32:01 2017
(r318582)
@@ -485,7 +485,6 @@ FBSDprivate_1.0 {
_pthread_sigmask;
_pthread_testcancel;
_spinlock;
-   _spinlock_debug;
_spinunlock;
_rtld_addr_phdr;
_rtld_atfork_pre;

Modified: head/lib/libc/gen/_spinlock_stub.c
==
--- head/lib/libc/gen/_spinlock_stub.c  Sat May 20 17:30:48 2017
(r318581)
+++ head/lib/libc/gen/_spinlock_stub.c  Sat May 20 17:32:01 2017
(r318582)
@@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
 long _atomic_lock_stub(volatile long *);
 void _spinlock_stub(spinlock_t *);
 void _spinunlock_stub(spinlock_t *);
-void _spinlock_debug_stub(spinlock_t *, char *, int);
 
 __weak_reference(_atomic_lock_stub, _atomic_lock);
 
@@ -48,7 +47,6 @@ _atomic_lock_stub(volatile long *lck __u
return (0L);
 }
 
-__weak_reference(_spinlock, _spinlock_debug);
 #pragma weak _spinlock
 void
 _spinlock(spinlock_t *lck)

Modified: head/lib/libc/include/spinlock.h
==
--- head/lib/libc/include/spinlock.hSat May 20 17:30:48 2017
(r318581)
+++ head/lib/libc/include/spinlock.hSat May 20 17:32:01 2017
(r318582)
@@ -41,21 +41,17 @@
  * Lock structure with room for debugging information.
  */
 struct _spinlock {
-   volatile long   access_lock;
-   volatile long   lock_owner;
-   volatile char   *fname;
-   volatile intlineno;
+   longspare1;
+   longspare2;
+   void*thr_extra;
+   int spare3;
 };
 typedef struct _spinlock spinlock_t;
 
 #define_SPINLOCK_INITIALIZER   { 0, 0, 0, 0 }
 
 #define _SPINUNLOCK(_lck)  _spinunlock(_lck);
-#ifdef _LOCK_DEBUG
-#define_SPINLOCK(_lck) _spinlock_debug(_lck, __FILE__, 
__LINE__)
-#else
 #define_SPINLOCK(_lck) _spinlock(_lck)
-#endif
 
 /*
  * Thread function prototype definitions:
@@ -64,7 +60,6 @@ __BEGIN_DECLS
 long   _atomic_lock(volatile long *);
 void   _spinlock(spinlock_t *);
 void   _spinunlock(spinlock_t *);
-void   _spinlock_debug(spinlock_t *, char *, int);
 __END_DECLS
 
 #endif /* _SPINLOCK_H_ */

Modified: head/lib/libthr/thread/thr_init.c
==
--- head/lib/libthr/thread/thr_init.c   Sat May 20 17:30:48 2017
(r318581)
+++ head/lib/libthr/thread/thr_init.c   Sat May 20 17:32:01 2017
(r318582)
@@ -173,7 +173,6 @@ STATIC_LIB_REQUIRE(_sigtimedwait);
 STATIC_LIB_REQUIRE(_sigwait);
 STATIC_LIB_REQUIRE(_sigwaitinfo);
 STATIC_LIB_REQUIRE(_spinlock);
-STATIC_LIB_REQUIRE(_spinlock_debug);
 STATIC_LIB_REQUIRE(_spinunlock);
 STATIC_LIB_REQUIRE(_thread_init_hack);
 

Modified: head/lib/libthr/thread/thr_spinlock.c
==
--- head/lib/libthr/thread/thr_spinlock.c   Sat May 20 17:30:48 2017
(r318581)
+++ head/lib/libthr/thread/thr_spinlock.c   Sat May 20 17:32:01 2017
(r318582)
@@ -65,7 +65,7 @@ __thr_spinunlock(spinlock_t *lck)
 {
struct spinlock_extra   *_extra;
 
-   _extra = (struct spinlock_extra *)lck->fname;
+   _extra = lck->thr_extra;
THR_UMUTEX_UNLOCK(_get_curthread(), &_extra->lock);
 }
 
@@ -78,9 +78,9 @@ __thr_spinlock(spinlock_t *lck)
PANIC("Spinlock called when not threaded.");
if (!initialized)
PANIC("Spinlocks not initialized.");
-   if (lck->fname == NULL)
+   if (lck->thr_extra == NULL)
init_spinlock(lck);
-   _extra = (struct spinlock_extra *)lck->fname;
+   _extra = lck->thr_extra;
THR_UMUTEX_LOCK(_get_curthread(), &_extra->lock);
 }
 
@@ -90,14 +90,14 @@ init_spinlock(spinlock_t *lck)
struct pthread *curthread = _get_curthread();
 
THR_UMUTEX_LOCK(curthread, _static_lock);
-   if ((lck->fname == NULL) && (spinlock_count < MAX_SPINLOCKS)) {
-   lck->fname = (char *)[spinlock_count];
+   if ((lck->thr_extra == 

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

2017-05-20 Thread Eric van Gyzen
Author: vangyzen
Date: Sat May 20 17:30:48 2017
New Revision: 318581
URL: https://svnweb.freebsd.org/changeset/base/318581

Log:
  libthr: change CHECK_AND_INIT_RWLOCK to an inline function
  
  This was prompted by a compiler warning about 'ret' shadowing
  a local variable in the callers of the macro.
  
  Reviewed by:  kib
  MFC after:3 days
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D10832

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

Modified: head/lib/libthr/thread/thr_rwlock.c
==
--- head/lib/libthr/thread/thr_rwlock.c Sat May 20 17:29:36 2017
(r318580)
+++ head/lib/libthr/thread/thr_rwlock.c Sat May 20 17:30:48 2017
(r318581)
@@ -49,27 +49,42 @@ __weak_reference(_pthread_rwlock_unlock,
 __weak_reference(_pthread_rwlock_wrlock, pthread_rwlock_wrlock);
 __weak_reference(_pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock);
 
-#define CHECK_AND_INIT_RWLOCK  
\
-   if (*rwlock == THR_PSHARED_PTR) {   
\
-   prwlock = __thr_pshared_offpage(rwlock, 0); 
\
-   if (prwlock == NULL)
\
-   return (EINVAL);
\
-   } else if (__predict_false((prwlock = (*rwlock)) <= 
\
-   THR_RWLOCK_DESTROYED)) {
\
-   if (prwlock == THR_RWLOCK_INITIALIZER) {
\
-   int ret;
\
-   ret = init_static(_get_curthread(), rwlock);
\
-   if (ret)
\
-   return (ret);   
\
-   } else if (prwlock == THR_RWLOCK_DESTROYED) {   
\
-   return (EINVAL);
\
-   }   
\
-   prwlock = *rwlock;  
\
-   }
-
-/*
- * Prototypes
- */
+static int init_static(struct pthread *thread, pthread_rwlock_t *rwlock);
+static int init_rwlock(pthread_rwlock_t *rwlock, pthread_rwlock_t *rwlock_out);
+
+static int __always_inline
+check_and_init_rwlock(pthread_rwlock_t *rwlock, pthread_rwlock_t *rwlock_out)
+{
+   if (__predict_false(*rwlock == THR_PSHARED_PTR ||
+   *rwlock <= THR_RWLOCK_DESTROYED))
+   return (init_rwlock(rwlock, rwlock_out));
+   *rwlock_out = *rwlock;
+   return (0);
+}
+
+static int __noinline
+init_rwlock(pthread_rwlock_t *rwlock, pthread_rwlock_t *rwlock_out)
+{
+   pthread_rwlock_t prwlock;
+   int ret;
+
+   if (*rwlock == THR_PSHARED_PTR) {
+   prwlock = __thr_pshared_offpage(rwlock, 0);
+   if (prwlock == NULL)
+   return (EINVAL);
+   } else if ((prwlock = *rwlock) <= THR_RWLOCK_DESTROYED) {
+   if (prwlock == THR_RWLOCK_INITIALIZER) {
+   ret = init_static(_get_curthread(), rwlock);
+   if (ret != 0)
+   return (ret);
+   } else if (prwlock == THR_RWLOCK_DESTROYED) {
+   return (EINVAL);
+   }
+   prwlock = *rwlock;
+   }
+   *rwlock_out = prwlock;
+   return (0);
+}
 
 static int
 rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr)
@@ -148,7 +163,9 @@ rwlock_rdlock_common(pthread_rwlock_t *r
int flags;
int ret;
 
-   CHECK_AND_INIT_RWLOCK
+   ret = check_and_init_rwlock(rwlock, );
+   if (ret != 0)
+   return (ret);
 
if (curthread->rdlock_count) {
/*
@@ -220,7 +237,9 @@ _pthread_rwlock_tryrdlock (pthread_rwloc
int flags;
int ret;
 
-   CHECK_AND_INIT_RWLOCK
+   ret = check_and_init_rwlock(rwlock, );
+   if (ret != 0)
+   return (ret);
 
if (curthread->rdlock_count) {
/*
@@ -253,7 +272,9 @@ _pthread_rwlock_trywrlock (pthread_rwloc
pthread_rwlock_t prwlock;
int ret;
 
-   CHECK_AND_INIT_RWLOCK
+   ret = check_and_init_rwlock(rwlock, );
+   if (ret != 0)
+   return (ret);
 
ret = _thr_rwlock_trywrlock(>lock);
if (ret == 0)
@@ -268,7 +289,9 @@ rwlock_wrlock_common (pthread_rwlock_t *
pthread_rwlock_t prwlock;
int ret;
 
-   CHECK_AND_INIT_RWLOCK
+   ret = check_and_init_rwlock(rwlock, );
+   if (ret != 0)
+   return (ret);
 
/*
 * POSIX said the validity of the abstimeout parameter need

svn commit: r318580 - head/lib/libthr

2017-05-20 Thread Eric van Gyzen
Author: vangyzen
Date: Sat May 20 17:29:36 2017
New Revision: 318580
URL: https://svnweb.freebsd.org/changeset/base/318580

Log:
  libthr: disable thread-safety warnings
  
  These warnings don't make sense for code that implements
  the locking primitives.
  
  Reviewed by:  kib
  MFC after:3 days
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D10832

Modified:
  head/lib/libthr/Makefile

Modified: head/lib/libthr/Makefile
==
--- head/lib/libthr/MakefileSat May 20 17:09:27 2017(r318579)
+++ head/lib/libthr/MakefileSat May 20 17:29:36 2017(r318580)
@@ -17,6 +17,7 @@ MK_SSP=   no
 LIB=thr
 SHLIB_MAJOR= 3
 WARNS?=3
+NO_WTHREAD_SAFETY=1
 CFLAGS+=-DPTHREAD_KERNEL
 CFLAGS+=-I${SRCTOP}/lib/libc/include -I${.CURDIR}/thread \
-I${SRCTOP}/include
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318578 - head/usr.sbin/nscd

2017-05-20 Thread Cy Schubert
Author: cy
Date: Sat May 20 16:58:48 2017
New Revision: 318578
URL: https://svnweb.freebsd.org/changeset/base/318578

Log:
  Fix non-recoverable name resolution failures due to negative cache
  entries never expiring. This patch honours the negative cache timeout.
  
  To test/experience the failure do the following:
  
  1. Edit /etc/ncd.conf to adjust the cache timeouts as follows:
  
positive-time-to-live hosts 30
negative-time-to-live hosts 1
  
  2. Ensure that nsswitch.conf hosts line contains something like:
  
hosts: files cache dns
  
Note that cache must be specified before dns.
  
  3. Start nscd.
  
  4. Run the following command:
  
while true; do nc -z -w 3 www.google.com 80; sleep 5; done
  
  5. While running the command, remove or comment out all nameserver
 statements in /etc/resolv.conf. After a short while you will notice
 non-recoverable name rsolution failures.
  
  6. Uncomment or replace all nameserver statements back into
 /etc/resolv.conf. Take note that name resolution never recovers.
 To recover nscd must be restarted. This patch fixes this.
  
  PR:   207804
  Submitted by: Jov 
  MFC after:1 week

Modified:
  head/usr.sbin/nscd/query.c

Modified: head/usr.sbin/nscd/query.c
==
--- head/usr.sbin/nscd/query.c  Sat May 20 16:47:00 2017(r318577)
+++ head/usr.sbin/nscd/query.c  Sat May 20 16:58:48 2017(r318578)
@@ -743,9 +743,14 @@ on_read_request_process(struct query_sta
_response->data_size);
 
if (read_response->error_code == -2) {
-   read_response->error_code = 0;
-   read_response->data = NULL;
-   read_response->data_size = 0;
+   read_response->data = malloc(
+   read_response->data_size);
+   assert(read_response != NULL);
+   read_response->error_code = 
cache_read(neg_c_entry,
+   read_request->cache_key,
+   read_request->cache_key_size,
+   read_response->data,
+   _response->data_size);
}
}
configuration_unlock_entry(qstate->config_entry, CELT_NEGATIVE);
___
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: r318577 - head/etc/periodic/daily

2017-05-20 Thread Michael Reifenberger
Author: mr
Date: Sat May 20 16:47:00 2017
New Revision: 318577
URL: https://svnweb.freebsd.org/changeset/base/318577

Log:
  Improve time-since-last-scrub calculation.
  This can be needed to compensate anticongestion delays in 410.pkg-audit or 
480.leapfile-ntpd.
  
  PR:   217622
  Submitted by: w...@psr.com
  MFC after:2 weeks

Modified:
  head/etc/periodic/daily/800.scrub-zfs

Modified: head/etc/periodic/daily/800.scrub-zfs
==
--- head/etc/periodic/daily/800.scrub-zfs   Sat May 20 16:12:44 2017
(r318576)
+++ head/etc/periodic/daily/800.scrub-zfs   Sat May 20 16:47:00 2017
(r318577)
@@ -71,7 +71,7 @@ case "$daily_scrub_zfs_enable" in
 
# Now minus last scrub (both in seconds) converted to days.
_scrub_diff=$(expr -e \( $(date +%s) - \
-   $(date -j -f %F.%T ${_last_scrub} +%s) \) / 60 / 60 / 24)
+   $(date -j -v -70M -f %F.%T ${_last_scrub} +%s) \) / 60 / 60 
/ 24)
if [ ${_scrub_diff} -lt ${_pool_threshold} ]; then
echo "   skipping scrubbing of pool '${pool}':"
echo "  last scrubbing is ${_scrub_diff} days ago, 
threshold is set to ${_pool_threshold} days"
___
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: r318575 - head/etc/mtree

2017-05-20 Thread Dimitry Andric
Author: dim
Date: Sat May 20 11:40:37 2017
New Revision: 318575
URL: https://svnweb.freebsd.org/changeset/base/318575

Log:
  After r317383 (removal of NATM), also remove usr/include/dev/utopia from
  BSD.include.dist.

Modified:
  head/etc/mtree/BSD.include.dist

Modified: head/etc/mtree/BSD.include.dist
==
--- head/etc/mtree/BSD.include.dist Sat May 20 11:20:03 2017
(r318574)
+++ head/etc/mtree/BSD.include.dist Sat May 20 11:40:37 2017
(r318575)
@@ -156,8 +156,6 @@
 ..
 usb
 ..
-utopia
-..
 vkbd
 ..
 wi
___
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: r318574 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep

2017-05-20 Thread Ed Maste
Author: emaste
Date: Sat May 20 11:20:03 2017
New Revision: 318574
URL: https://svnweb.freebsd.org/changeset/base/318574

Log:
  bsdgrep: Correct per-line line metadata printing
  
  Metadata printing with -b, -H, or -n flags suffered from a few flaws:
  
  1) -b/offset printing was broken when used in conjunction with -o
  
  2) With -o, bsdgrep did not print metadata for every match/line, just
 the first match of a line
  
  3) There were no tests for this
  
  Address these issues by outputting this data per-match if the -o flag is
  specified, and prior to outputting any matches if -o but not --color,
  since --color alone will not generate a new line of output for every
  iteration over the matches.
  
  To correct -b output, fudge the line offset as we're printing matches.
  
  While here, make sure we're using grep_printline in -A context.  Context
  printing should *never* look at the parsing context, just the line.
  
  The tests included do not pass with gnugrep in base due to it exhibiting
  similar quirky behavior that bsdgrep previously exhibited.
  
  Submitted by: Kyle Evans 
  Reviewed by:  cem
  Differential Revision:https://reviews.freebsd.org/D10580

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
  head/usr.bin/grep/grep.h
  head/usr.bin/grep/queue.c
  head/usr.bin/grep/util.c

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shSat May 20 06:01:09 
2017(r318573)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shSat May 20 11:20:03 
2017(r318574)
@@ -430,7 +430,7 @@ excessive_matches_body()
done
 
atf_check -s exit:0 -x '[ $(grep -o x test.in | wc -l) -eq 4096 ]'
-   #atf_check -s exit:1 -x 'grep -on x test.in | grep -v "1:x"'
+   atf_check -s exit:1 -x 'grep -on x test.in | grep -v "1:x"'
 }
 
 atf_test_case fgrep_sanity
@@ -510,6 +510,39 @@ wv_combo_break_body()
atf_check -s exit:1 grep -v -w "x" test2
 }
 
+atf_test_case ocolor_metadata
+ocolor_metadata_head()
+{
+   atf_set "descr" "Check for -n/-b producing per-line metadata output"
+}
+ocolor_metadata_body()
+{
+   grep_type
+   if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then
+   atf_expect_fail "this test does not pass with GNU grep in base"
+   fi
+
+   printf "xxx\n\nzzz\nfoobarbaz\n" > test1
+   check_expr="^[^:]*[0-9][^:]*:[^:]+$"
+
+   atf_check -o inline:"1:1:xx\n" grep -bon "xx$" test1
+
+   atf_check -o inline:"2:4:\n" grep -bn "yy" test1
+
+   atf_check -o inline:"2:6:yy\n" grep -bon "yy$" test1
+
+   # These checks ensure that grep isn't producing bogus line numbering
+   # in the middle of a line.
+   atf_check -s exit:1 -x \
+   "grep -Eon 'x|y|z|f' test1 | grep -Ev '${check_expr}'"
+
+   atf_check -s exit:1 -x \
+   "grep -En 'x|y|z|f' --color=always test1 | grep -Ev '${check_expr}'"
+
+   atf_check -s exit:1 -x \
+   "grep -Eon 'x|y|z|f' --color=always test1 | grep -Ev 
'${check_expr}'"
+}
+
 atf_test_case grep_nomatch_flags
 grep_nomatch_flags_head()
 {
@@ -628,6 +661,7 @@ atf_init_test_cases()
atf_add_test_case fgrep_sanity
atf_add_test_case egrep_sanity
atf_add_test_case grep_sanity
+   atf_add_test_case ocolor_metadata
atf_add_test_case grep_nomatch_flags
atf_add_test_case binary_flags
atf_add_test_case badcontext

Modified: head/usr.bin/grep/grep.h
==
--- head/usr.bin/grep/grep.hSat May 20 06:01:09 2017(r318573)
+++ head/usr.bin/grep/grep.hSat May 20 11:20:03 2017(r318574)
@@ -90,6 +90,7 @@ struct file {
 };
 
 struct str {
+   off_tboff;
off_toff;
size_t   len;
char*dat;

Modified: head/usr.bin/grep/queue.c
==
--- head/usr.bin/grep/queue.c   Sat May 20 06:01:09 2017(r318573)
+++ head/usr.bin/grep/queue.c   Sat May 20 11:20:03 2017(r318574)
@@ -65,6 +65,7 @@ enqueue(struct str *x)
item->data.dat = grep_malloc(sizeof(char) * x->len);
item->data.len = x->len;
item->data.line_no = x->line_no;
+   item->data.boff = x->boff;
item->data.off = x->off;
memcpy(item->data.dat, x->dat, x->len);
item->data.file = x->file;

Modified: head/usr.bin/grep/util.c
==
--- head/usr.bin/grep/util.cSat May 20 06:01:09 2017(r318573)
+++ head/usr.bin/grep/util.cSat May 20 11:20:03 2017(r318574)
@@ -61,11 +61,12 @@ static bool  first_match = true;
  * other useful bits
  */
 struct parsec {
-   regmatch_t matches[MAX_LINE_MATCHES];   /* Matches 

Re: pkgbase and conf files (was Re: svn commit: r318441 - in head/etc: . cron.d)

2017-05-20 Thread Baptiste Daroussin
On Fri, May 19, 2017 at 10:43:30AM -0700, John Baldwin wrote:
> On Friday, May 19, 2017 06:33:55 PM Baptiste Daroussin wrote:
> > On Fri, May 19, 2017 at 09:17:23AM -0700, John Baldwin wrote:
> > > On Thursday, May 18, 2017 11:24:29 PM Baptiste Daroussin wrote:
> > > I think an upgrade won't bring the file back necessarily (etcupdate warns 
> > > you
> > > that a removed file changed, but it doesn't bring it back, I think a 
> > > similar
> > > strategy might be sensible for pkg as well).
> > 
> > I need to check, I do not remember what I did here and I will certainly add 
> > a
> > regression test for that to ensure this behaviour is always working as 
> > expected.
> 
> One nice "feature" to have in pkg for pkgbase would be a way to ask pkg to 
> restore
> a stock configuration file (perhaps with an option to restore it to an 
> alternate
> directory or filename?)  This would imply that packages would need to keep the
> "pristine" conf files around somewhere.  This would also let you do 'pkg 
> confdiff'
> or the like (as a replacement for 'etcupdate diff')

Yes this is in my TODO list

Bapt


signature.asc
Description: PGP signature