svn commit: r304880 - head/sys/dev/iwm

2016-08-27 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Aug 27 08:34:20 2016
New Revision: 304880
URL: https://svnweb.freebsd.org/changeset/base/304880

Log:
  iwm: add 'command accepted' debug notification (copied from wpi(4)).
  
  Now it should be easier to find out which command causes firmware
  panics when few commands are sent in a short period of time.

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sat Aug 27 02:53:21 2016(r304879)
+++ head/sys/dev/iwm/if_iwm.c   Sat Aug 27 08:34:20 2016(r304880)
@@ -3120,6 +3120,11 @@ iwm_cmd_done(struct iwm_softc *sc, struc
return; /* Not a command ack. */
}
 
+   /* XXX wide commands? */
+   IWM_DPRINTF(sc, IWM_DEBUG_CMD,
+   "cmd notification type 0x%x qid %d idx %d\n",
+   pkt->hdr.code, pkt->hdr.qid, pkt->hdr.idx);
+
data = &ring->data[pkt->hdr.idx];
 
/* If the command was mapped in an mbuf, free it. */
___
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: r304882 - in stable/11: share/man/man9 sys/kern sys/sys

2016-08-27 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 27 09:11:57 2016
New Revision: 304882
URL: https://svnweb.freebsd.org/changeset/base/304882

Log:
  MFC r303425:
  Add callout_when(9).
  
  MFC r303919:
  Fix indentation.

Modified:
  stable/11/share/man/man9/Makefile
  stable/11/share/man/man9/timeout.9
  stable/11/sys/kern/kern_timeout.c
  stable/11/sys/sys/callout.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man9/Makefile
==
--- stable/11/share/man/man9/Makefile   Sat Aug 27 08:51:34 2016
(r304881)
+++ stable/11/share/man/man9/Makefile   Sat Aug 27 09:11:57 2016
(r304882)
@@ -1766,6 +1766,7 @@ MLINKS+=timeout.9 callout.9 \
timeout.9 callout_schedule_sbt_curcpu.9 \
timeout.9 callout_schedule_sbt_on.9 \
timeout.9 callout_stop.9 \
+   timeout.9 callout_when.9 \
timeout.9 untimeout.9
 MLINKS+=ucred.9 cred_update_thread.9 \
ucred.9 crcopy.9 \

Modified: stable/11/share/man/man9/timeout.9
==
--- stable/11/share/man/man9/timeout.9  Sat Aug 27 08:51:34 2016
(r304881)
+++ stable/11/share/man/man9/timeout.9  Sat Aug 27 09:11:57 2016
(r304882)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 4, 2016
+.Dd July 27, 2016
 .Dt TIMEOUT 9
 .Os
 .Sh NAME
@@ -56,6 +56,7 @@
 .Nm callout_schedule_sbt_curcpu ,
 .Nm callout_schedule_sbt_on ,
 .Nm callout_stop ,
+.Nm callout_when ,
 .Nm timeout ,
 .Nm untimeout
 .Nd execute a function after a specified length of time
@@ -91,20 +92,48 @@ struct callout_handle handle = CALLOUT_H
 .Ft int
 .Fn callout_reset "struct callout *c" "int ticks" "timeout_t *func" "void *arg"
 .Ft int
-.Fn callout_reset_curcpu "struct callout *c" "int ticks" "timeout_t *func" \
-"void *arg"
-.Ft int
-.Fn callout_reset_on "struct callout *c" "int ticks" "timeout_t *func" \
-"void *arg" "int cpu"
-.Ft int
-.Fn callout_reset_sbt "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "timeout_t *func" "void *arg" "int flags"
-.Ft int
-.Fn callout_reset_sbt_curcpu "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "timeout_t *func" "void *arg" "int flags"
-.Ft int
-.Fn callout_reset_sbt_on "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "timeout_t *func" "void *arg" "int cpu" "int flags"
+.Fo callout_reset_curcpu
+.Fa "struct callout *c"
+.Fa "int ticks"
+.Fa "timeout_t *func"
+.Fa "void *arg"
+.Fc
+.Ft int
+.Fo callout_reset_on
+.Fa "struct callout *c"
+.Fa "int ticks"
+.Fa "timeout_t *func"
+.Fa "void *arg"
+.Fa "int cpu"
+.Fc
+.Ft int
+.Fo callout_reset_sbt
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "timeout_t *func"
+.Fa "void *arg"
+.Fa "int flags"
+.Fc
+.Ft int
+.Fo callout_reset_sbt_curcpu
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "timeout_t *func"
+.Fa "void *arg"
+.Fa "int flags"
+.Fc
+.Ft int
+.Fo callout_reset_sbt_on
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "timeout_t *func"
+.Fa "void *arg"
+.Fa "int cpu"
+.Fa "int flags"
+.Fc
 .Ft int
 .Fn callout_schedule "struct callout *c" "int ticks"
 .Ft int
@@ -112,16 +141,37 @@ struct callout_handle handle = CALLOUT_H
 .Ft int
 .Fn callout_schedule_on "struct callout *c" "int ticks" "int cpu"
 .Ft int
-.Fn callout_schedule_sbt "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "int flags"
-.Ft int
-.Fn callout_schedule_sbt_curcpu "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "int flags"
-.Ft int
-.Fn callout_schedule_sbt_on "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "int cpu" "int flags"
+.Fo callout_schedule_sbt
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "int flags"
+.Fc
+.Ft int
+.Fo callout_schedule_sbt_curcpu
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "int flags"
+.Fc
+.Ft int
+.Fo callout_schedule_sbt_on
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "int cpu"
+.Fa "int flags"
+.Fc
 .Ft int
 .Fn callout_stop "struct callout *c"
+.Ft sbintime_t
+.Fo callout_when
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t precision"
+.Fa "int flags"
+.Fa "sbintime_t *sbt_res"
+.Fa "sbintime_t *precision_res"
+.Fc
 .Ft struct callout_handle
 .Fn timeout "timeout_t *func" "void *arg" "int ticks"
 .Ft void
@@ -387,6 +437,26 @@ or this value is used as the length of t
 Smaller values
 .Pq which result in larger time intervals
 allow the callout subsystem to aggregate more events in one timer interrupt.
+.It Dv C_PRECALC
+The
+.Fa sbt
+argument specifies the absolute time at which the callout should be run,
+and the
+.Fa pr
+argument specifies the requested precision, which will not be
+adjusted during the scheduling process.
+The
+.Fa sbt
+and
+.Fa pr
+values should be calculated by an earlier call to
+.Fn callout_when
+which uses the user-supplied
+.Fa sbt ,
+.Fa pr ,
+and
+.Fa flags
+values.
 .It Dv C_HARDCLOCK
 A

svn commit: r304883 - in stable/11/sys: ddb kern sys

2016-08-27 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 27 09:23:20 2016
New Revision: 304883
URL: https://svnweb.freebsd.org/changeset/base/304883

Log:
  MFC r303426:
  Rewrite subr_sleepqueue.c use of callouts to not depend on the
  specifics of callout KPI.

Modified:
  stable/11/sys/ddb/db_ps.c
  stable/11/sys/kern/kern_fork.c
  stable/11/sys/kern/kern_kthread.c
  stable/11/sys/kern/kern_thr.c
  stable/11/sys/kern/kern_thread.c
  stable/11/sys/kern/subr_sleepqueue.c
  stable/11/sys/sys/proc.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ddb/db_ps.c
==
--- stable/11/sys/ddb/db_ps.c   Sat Aug 27 09:11:57 2016(r304882)
+++ stable/11/sys/ddb/db_ps.c   Sat Aug 27 09:23:20 2016(r304883)
@@ -375,8 +375,13 @@ DB_SHOW_COMMAND(thread, db_show_thread)
db_printf(" lock: %s  turnstile: %p\n", td->td_lockname,
td->td_blocked);
if (TD_ON_SLEEPQ(td))
-   db_printf(" wmesg: %s  wchan: %p\n", td->td_wmesg,
-   td->td_wchan);
+   db_printf(
+   " wmesg: %s  wchan: %p sleeptimo %lx. %jx (curr %lx. %jx)\n",
+   td->td_wmesg, td->td_wchan,
+   (long)sbttobt(td->td_sleeptimo).sec,
+   (uintmax_t)sbttobt(td->td_sleeptimo).frac,
+   (long)sbttobt(sbinuptime()).sec,
+   (uintmax_t)sbttobt(sbinuptime()).frac);
db_printf(" priority: %d\n", td->td_priority);
db_printf(" container lock: %s (%p)\n", lock->lo_name, lock);
if (td->td_swvoltick != 0) {

Modified: stable/11/sys/kern/kern_fork.c
==
--- stable/11/sys/kern/kern_fork.c  Sat Aug 27 09:11:57 2016
(r304882)
+++ stable/11/sys/kern/kern_fork.c  Sat Aug 27 09:23:20 2016
(r304883)
@@ -472,6 +472,7 @@ do_fork(struct thread *td, struct fork_r
 
bzero(&td2->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
+   td2->td_sleeptimo = 0;
 
bcopy(&td->td_startcopy, &td2->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));

Modified: stable/11/sys/kern/kern_kthread.c
==
--- stable/11/sys/kern/kern_kthread.c   Sat Aug 27 09:11:57 2016
(r304882)
+++ stable/11/sys/kern/kern_kthread.c   Sat Aug 27 09:23:20 2016
(r304883)
@@ -273,6 +273,7 @@ kthread_add(void (*func)(void *), void *
 
bzero(&newtd->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
+   newtd->td_sleeptimo = 0;
bcopy(&oldtd->td_startcopy, &newtd->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));
 

Modified: stable/11/sys/kern/kern_thr.c
==
--- stable/11/sys/kern/kern_thr.c   Sat Aug 27 09:11:57 2016
(r304882)
+++ stable/11/sys/kern/kern_thr.c   Sat Aug 27 09:23:20 2016
(r304883)
@@ -232,6 +232,7 @@ thread_create(struct thread *td, struct 
 
bzero(&newtd->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
+   newtd->td_sleeptimo = 0;
bcopy(&td->td_startcopy, &newtd->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));
newtd->td_proc = td->td_proc;

Modified: stable/11/sys/kern/kern_thread.c
==
--- stable/11/sys/kern/kern_thread.cSat Aug 27 09:11:57 2016
(r304882)
+++ stable/11/sys/kern/kern_thread.cSat Aug 27 09:23:20 2016
(r304883)
@@ -318,7 +318,7 @@ thread_reap(void)
 
/*
 * Don't even bother to lock if none at this instant,
-* we really don't care about the next instant..
+* we really don't care about the next instant.
 */
if (!TAILQ_EMPTY(&zombie_threads)) {
mtx_lock_spin(&zombie_lock);
@@ -383,6 +383,7 @@ thread_free(struct thread *td)
if (td->td_kstack != 0)
vm_thread_dispose(td);
vm_domain_policy_cleanup(&td->td_vm_dom_policy);
+   callout_drain(&td->td_slpcallout);
uma_zfree(thread_zone, td);
 }
 
@@ -580,6 +581,7 @@ thread_wait(struct proc *p)
td->td_cpuset = NULL;
cpu_thread_clean(td);
thread_cow_free(td);
+   callout_drain(&td->td_slpcallout);
thread_reap();  /* check for zombie threads etc. */
 }
 

Modified: stable/11/sys/kern/subr_sleepqueue.c
==
--- stable/11/sys/kern/subr_sleepqueue.cSat Aug 27 09:11:57 2016
(r304882)
+++ stable/11/sys/kern/subr_sleepqueue.cSat Aug 27 09:23:20 2016
(r304883)
@@ -378,6 +378,7 @@ sleepq_set_timeout_sbt(void *wchan, sbin
 {
str

svn commit: r304886 - in head/sys/modules: cloudabi32 cloudabi64

2016-08-27 Thread Ed Schouten
Author: ed
Date: Sat Aug 27 09:50:11 2016
New Revision: 304886
URL: https://svnweb.freebsd.org/changeset/base/304886

Log:
  Properly use MACHINE_CPUARCH for finding cloudabi*_sysvec.c.
  
  The build of the cloudabi32 kernel module currently fails for PC98. In
  the case of PC98, we just want to use the code for i386.
  
  Reported by:  np

Modified:
  head/sys/modules/cloudabi32/Makefile
  head/sys/modules/cloudabi64/Makefile

Modified: head/sys/modules/cloudabi32/Makefile
==
--- head/sys/modules/cloudabi32/MakefileSat Aug 27 09:40:29 2016
(r304885)
+++ head/sys/modules/cloudabi32/MakefileSat Aug 27 09:50:11 2016
(r304886)
@@ -3,7 +3,7 @@
 SYSDIR?=${.CURDIR}/../..
 
 .PATH: ${SYSDIR}/compat/cloudabi32
-.PATH: ${SYSDIR}/${MACHINE}/cloudabi32
+.PATH: ${SYSDIR}/${MACHINE_CPUARCH}/cloudabi32
 
 KMOD=  cloudabi32
 SRCS=  cloudabi32_fd.c cloudabi32_module.c cloudabi32_poll.c \

Modified: head/sys/modules/cloudabi64/Makefile
==
--- head/sys/modules/cloudabi64/MakefileSat Aug 27 09:40:29 2016
(r304885)
+++ head/sys/modules/cloudabi64/MakefileSat Aug 27 09:50:11 2016
(r304886)
@@ -3,7 +3,7 @@
 SYSDIR?=${.CURDIR}/../..
 
 .PATH: ${SYSDIR}/compat/cloudabi64
-.PATH: ${SYSDIR}/${MACHINE}/cloudabi64
+.PATH: ${SYSDIR}/${MACHINE_CPUARCH}/cloudabi64
 
 KMOD=  cloudabi64
 SRCS=  cloudabi64_fd.c cloudabi64_module.c cloudabi64_poll.c \
___
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: r304888 - stable/10/lib/libc/stdio

2016-08-27 Thread Andrey A. Chernov
Author: ache
Date: Sat Aug 27 09:58:06 2016
New Revision: 304888
URL: https://svnweb.freebsd.org/changeset/base/304888

Log:
  MFC r304810
  
  Don't check for __SERR which may stick from one of any previous stdio
  functions.
  __SERR is for user and the rest of stdio code do not check it
  for error sensing internally, only set it.
  In vf(w)printf.c here it is more easy to save __SERR, clear and restore it.

Modified:
  stable/10/lib/libc/stdio/getdelim.c
  stable/10/lib/libc/stdio/vfprintf.c
  stable/10/lib/libc/stdio/vfwprintf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/stdio/getdelim.c
==
--- stable/10/lib/libc/stdio/getdelim.c Sat Aug 27 09:51:57 2016
(r304887)
+++ stable/10/lib/libc/stdio/getdelim.c Sat Aug 27 09:58:06 2016
(r304888)
@@ -125,7 +125,7 @@ getdelim(char ** __restrict linep, size_
 
if (fp->_r <= 0 && __srefill(fp)) {
/* If fp is at EOF already, we just need space for the NUL. */
-   if (__sferror(fp) || expandtofit(linep, 1, linecapp))
+   if (!__sfeof(fp) || expandtofit(linep, 1, linecapp))
goto error;
FUNLOCKFILE(fp);
(*linep)[0] = '\0';
@@ -137,7 +137,7 @@ getdelim(char ** __restrict linep, size_
if (sappend(linep, &linelen, linecapp, fp->_p, fp->_r))
goto error;
if (__srefill(fp)) {
-   if (__sferror(fp))
+   if (!__sfeof(fp))
goto error;
goto done;  /* hit EOF */
}

Modified: stable/10/lib/libc/stdio/vfprintf.c
==
--- stable/10/lib/libc/stdio/vfprintf.c Sat Aug 27 09:51:57 2016
(r304887)
+++ stable/10/lib/libc/stdio/vfprintf.c Sat Aug 27 09:58:06 2016
(r304888)
@@ -364,6 +364,7 @@ __vfprintf(FILE *fp, locale_t locale, co
int nextarg;/* 1-based argument index */
va_list orgap;  /* original argument pointer */
char *convbuf;  /* wide to multibyte conversion result */
+   int savserr;
 
static const char xdigs_lower[16] = "0123456789abcdef";
static const char xdigs_upper[16] = "0123456789ABCDEF";
@@ -460,6 +461,9 @@ __vfprintf(FILE *fp, locale_t locale, co
return (EOF);
}
 
+   savserr = fp->_flags & __SERR;
+   fp->_flags &= ~__SERR;
+
convbuf = NULL;
fmt = (char *)fmt0;
argtable = NULL;
@@ -1031,6 +1035,8 @@ error:
free(convbuf);
if (__sferror(fp))
ret = EOF;
+   else
+   fp->_flags |= savserr;
if ((argtable != NULL) && (argtable != statargtable))
free (argtable);
return (ret);

Modified: stable/10/lib/libc/stdio/vfwprintf.c
==
--- stable/10/lib/libc/stdio/vfwprintf.cSat Aug 27 09:51:57 2016
(r304887)
+++ stable/10/lib/libc/stdio/vfwprintf.cSat Aug 27 09:58:06 2016
(r304888)
@@ -444,6 +444,7 @@ __vfwprintf(FILE *fp, locale_t locale, c
int nextarg;/* 1-based argument index */
va_list orgap;  /* original argument pointer */
wchar_t *convbuf;   /* multibyte to wide conversion result */
+   int savserr;
 
static const char xdigs_lower[16] = "0123456789abcdef";
static const char xdigs_upper[16] = "0123456789ABCDEF";
@@ -536,6 +537,9 @@ __vfwprintf(FILE *fp, locale_t locale, c
return (EOF);
}
 
+   savserr = fp->_flags & __SERR;
+   fp->_flags &= ~__SERR;
+
convbuf = NULL;
fmt = (wchar_t *)fmt0;
argtable = NULL;
@@ -1096,6 +1100,8 @@ error:
free(convbuf);
if (__sferror(fp))
ret = EOF;
+   else
+   fp->_flags |= savserr;
if ((argtable != NULL) && (argtable != statargtable))
free (argtable);
return (ret);
___
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: r304890 - stable/11/lib/libc/stdio

2016-08-27 Thread Andrey A. Chernov
Author: ache
Date: Sat Aug 27 10:00:36 2016
New Revision: 304890
URL: https://svnweb.freebsd.org/changeset/base/304890

Log:
  MFC r304810
  
  Don't check for __SERR which may stick from one of any previous stdio
  functions.
  __SERR is for user and the rest of stdio code do not check it
  for error sensing internally, only set it.
  In vf(w)printf.c here it is more easy to save __SERR, clear and restore it.

Modified:
  stable/11/lib/libc/stdio/getdelim.c
  stable/11/lib/libc/stdio/vfprintf.c
  stable/11/lib/libc/stdio/vfwprintf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/stdio/getdelim.c
==
--- stable/11/lib/libc/stdio/getdelim.c Sat Aug 27 10:00:33 2016
(r304889)
+++ stable/11/lib/libc/stdio/getdelim.c Sat Aug 27 10:00:36 2016
(r304890)
@@ -125,7 +125,7 @@ getdelim(char ** __restrict linep, size_
 
if (fp->_r <= 0 && __srefill(fp)) {
/* If fp is at EOF already, we just need space for the NUL. */
-   if (__sferror(fp) || expandtofit(linep, 1, linecapp))
+   if (!__sfeof(fp) || expandtofit(linep, 1, linecapp))
goto error;
FUNLOCKFILE(fp);
(*linep)[0] = '\0';
@@ -137,7 +137,7 @@ getdelim(char ** __restrict linep, size_
if (sappend(linep, &linelen, linecapp, fp->_p, fp->_r))
goto error;
if (__srefill(fp)) {
-   if (__sferror(fp))
+   if (!__sfeof(fp))
goto error;
goto done;  /* hit EOF */
}

Modified: stable/11/lib/libc/stdio/vfprintf.c
==
--- stable/11/lib/libc/stdio/vfprintf.c Sat Aug 27 10:00:33 2016
(r304889)
+++ stable/11/lib/libc/stdio/vfprintf.c Sat Aug 27 10:00:36 2016
(r304890)
@@ -364,6 +364,7 @@ __vfprintf(FILE *fp, locale_t locale, co
int nextarg;/* 1-based argument index */
va_list orgap;  /* original argument pointer */
char *convbuf;  /* wide to multibyte conversion result */
+   int savserr;
 
static const char xdigs_lower[16] = "0123456789abcdef";
static const char xdigs_upper[16] = "0123456789ABCDEF";
@@ -460,6 +461,9 @@ __vfprintf(FILE *fp, locale_t locale, co
return (EOF);
}
 
+   savserr = fp->_flags & __SERR;
+   fp->_flags &= ~__SERR;
+
convbuf = NULL;
fmt = (char *)fmt0;
argtable = NULL;
@@ -1031,6 +1035,8 @@ error:
free(convbuf);
if (__sferror(fp))
ret = EOF;
+   else
+   fp->_flags |= savserr;
if ((argtable != NULL) && (argtable != statargtable))
free (argtable);
return (ret);

Modified: stable/11/lib/libc/stdio/vfwprintf.c
==
--- stable/11/lib/libc/stdio/vfwprintf.cSat Aug 27 10:00:33 2016
(r304889)
+++ stable/11/lib/libc/stdio/vfwprintf.cSat Aug 27 10:00:36 2016
(r304890)
@@ -444,6 +444,7 @@ __vfwprintf(FILE *fp, locale_t locale, c
int nextarg;/* 1-based argument index */
va_list orgap;  /* original argument pointer */
wchar_t *convbuf;   /* multibyte to wide conversion result */
+   int savserr;
 
static const char xdigs_lower[16] = "0123456789abcdef";
static const char xdigs_upper[16] = "0123456789ABCDEF";
@@ -536,6 +537,9 @@ __vfwprintf(FILE *fp, locale_t locale, c
return (EOF);
}
 
+   savserr = fp->_flags & __SERR;
+   fp->_flags &= ~__SERR;
+
convbuf = NULL;
fmt = (wchar_t *)fmt0;
argtable = NULL;
@@ -1096,6 +1100,8 @@ error:
free(convbuf);
if (__sferror(fp))
ret = EOF;
+   else
+   fp->_flags |= savserr;
if ((argtable != NULL) && (argtable != statargtable))
free (argtable);
return (ret);
___
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: r304891 - head/sys/dev/iwm

2016-08-27 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Aug 27 10:04:48 2016
New Revision: 304891
URL: https://svnweb.freebsd.org/changeset/base/304891

Log:
  iwm: fix few comment typos.

Modified:
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hSat Aug 27 10:00:36 2016
(r304890)
+++ head/sys/dev/iwm/if_iwmreg.hSat Aug 27 10:04:48 2016
(r304891)
@@ -3219,7 +3219,7 @@ enum iwm_sf_scenario {
 #define IWM_SF_SINGLE_UNICAST_AGING_TIMER_DEF 400  /* 0.4 mSec */
 #define IWM_SF_AGG_UNICAST_IDLE_TIMER_DEF 160  /* 150 uSec */
 #define IWM_SF_AGG_UNICAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
-#define IWM_SF_MCAST_IDLE_TIMER_DEF 160/* 150 mSec */
+#define IWM_SF_MCAST_IDLE_TIMER_DEF 160/* 150 uSec */
 #define IWM_SF_MCAST_AGING_TIMER_DEF 400   /* 0.4 mSec */
 #define IWM_SF_BA_IDLE_TIMER_DEF 160   /* 150 uSec */
 #define IWM_SF_BA_AGING_TIMER_DEF 400  /* 0.4 mSec */
@@ -3244,7 +3244,7 @@ enum iwm_sf_scenario {
 
 /**
  * Smart Fifo configuration command.
- * @state: smart fifo state, types listed in iwm_sf_sate.
+ * @state: smart fifo state, types listed in iwm_sf_state.
  * @watermark: Minimum allowed available free space in RXF for transient state.
  * @long_delay_timeouts: aging and idle timer values for each scenario
  * in long delay state.
___
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: r304892 - head/sys/arm64/arm64

2016-08-27 Thread Andrew Turner
Author: andrew
Date: Sat Aug 27 10:30:20 2016
New Revision: 304892
URL: https://svnweb.freebsd.org/changeset/base/304892

Log:
  Print both the kernel read and write translation in DDB when asking for
  a virtual to physical translation. These may be different, e.g. when a
  page is mapped as read-only.
  
  MFC after:1 month
  Sponsored by: ABT Systems Ltd

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

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Sat Aug 27 10:04:48 2016
(r304891)
+++ head/sys/arm64/arm64/machdep.c  Sat Aug 27 10:30:20 2016
(r304892)
@@ -1089,7 +1089,9 @@ DB_SHOW_COMMAND(vtop, db_show_vtop)
 
if (have_addr) {
phys = arm64_address_translate_s1e1r(addr);
-   db_printf("Physical address reg: 0x%016lx\n", phys);
+   db_printf("Physical address reg (read):  0x%016lx\n", phys);
+   phys = arm64_address_translate_s1e1w(addr);
+   db_printf("Physical address reg (write): 0x%016lx\n", phys);
} else
db_printf("show vtop \n");
 }
___
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: r304893 - stable/10/lib/libc/stdio

2016-08-27 Thread Andrey A. Chernov
Author: ache
Date: Sat Aug 27 10:34:01 2016
New Revision: 304893
URL: https://svnweb.freebsd.org/changeset/base/304893

Log:
  MFC r304607,r304641,r304819,r304811
  
  1) Don't forget to set __SERR on __slbexpand() error.
  
  2) Remove "Fast path" from fgetwc()/fputwc() since it can't detect
  encoding errors and ignores them all.
  One of affected encoding example: US-ASCII
  
  3)  Original fgetln() from 44lite return success for line tail errors,
  i.e. partial line, but set __SERR and errno in the same time, which
  is inconsistent.
  Now both OpenBSD and NetBSD return failure, i.e. no line and set error
  indicators for such case, so make our fgetln() and fgetwln()
  (as its wide version) compatible with the rest of *BSD.
  
  PR: 212033

Modified:
  stable/10/lib/libc/stdio/fgetln.c
  stable/10/lib/libc/stdio/fgetwc.c
  stable/10/lib/libc/stdio/fgetwln.c
  stable/10/lib/libc/stdio/fputwc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/stdio/fgetln.c
==
--- stable/10/lib/libc/stdio/fgetln.c   Sat Aug 27 10:30:20 2016
(r304892)
+++ stable/10/lib/libc/stdio/fgetln.c   Sat Aug 27 10:34:01 2016
(r304893)
@@ -139,8 +139,11 @@ fgetln(FILE *fp, size_t *lenp)
(void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
len - off);
off = len;
-   if (__srefill(fp))
-   break;  /* EOF or error: return partial line */
+   if (__srefill(fp)) {
+   if (__sfeof(fp))
+   break;
+   goto error;
+   }
if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL)
continue;
 

Modified: stable/10/lib/libc/stdio/fgetwc.c
==
--- stable/10/lib/libc/stdio/fgetwc.c   Sat Aug 27 10:30:20 2016
(r304892)
+++ stable/10/lib/libc/stdio/fgetwc.c   Sat Aug 27 10:34:01 2016
(r304893)
@@ -79,18 +79,9 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i
size_t nconv;
struct xlocale_ctype *l = XLOCALE_CTYPE(locale);
 
-   if (fp->_r <= 0 && __srefill(fp)) {
-   *nread = 0;
-   return (WEOF);
-   }
-   if (MB_CUR_MAX == 1) {
-   /* Fast path for single-byte encodings. */
-   wc = *fp->_p++;
-   fp->_r--;
-   *nread = 1;
-   return (wc);
-   }
*nread = 0;
+   if (fp->_r <= 0 && __srefill(fp))
+   return (WEOF);
do {
nconv = l->__mbrtowc(&wc, fp->_p, fp->_r, mbs);
if (nconv == (size_t)-1)

Modified: stable/10/lib/libc/stdio/fgetwln.c
==
--- stable/10/lib/libc/stdio/fgetwln.c  Sat Aug 27 10:30:20 2016
(r304892)
+++ stable/10/lib/libc/stdio/fgetwln.c  Sat Aug 27 10:34:01 2016
(r304893)
@@ -56,13 +56,15 @@ fgetwln_l(FILE * __restrict fp, size_t *
while ((wc = __fgetwc(fp, locale)) != WEOF) {
 #defineGROW512
if (len * sizeof(wchar_t) >= fp->_lb._size &&
-   __slbexpand(fp, (len + GROW) * sizeof(wchar_t)))
+   __slbexpand(fp, (len + GROW) * sizeof(wchar_t))) {
+   fp->_flags |= __SERR;
goto error;
+   }
*((wchar_t *)fp->_lb._base + len++) = wc;
if (wc == L'\n')
break;
}
-   if (len == 0)
+   if (len == 0 || (wc == WEOF && !__sfeof(fp)))
goto error;
 
FUNLOCKFILE(fp);
@@ -74,6 +76,7 @@ error:
*lenp = 0;
return (NULL);
 }
+
 wchar_t *
 fgetwln(FILE * __restrict fp, size_t *lenp)
 {

Modified: stable/10/lib/libc/stdio/fputwc.c
==
--- stable/10/lib/libc/stdio/fputwc.c   Sat Aug 27 10:30:20 2016
(r304892)
+++ stable/10/lib/libc/stdio/fputwc.c   Sat Aug 27 10:34:01 2016
(r304893)
@@ -53,19 +53,9 @@ __fputwc(wchar_t wc, FILE *fp, locale_t 
size_t i, len;
struct xlocale_ctype *l = XLOCALE_CTYPE(locale);
 
-   if (MB_CUR_MAX == 1 && wc > 0 && wc <= UCHAR_MAX) {
-   /*
-* Assume single-byte locale with no special encoding.
-* A more careful test would be to check
-* _CurrentRuneLocale->encoding.
-*/
-   *buf = (unsigned char)wc;
-   len = 1;
-   } else {
-   if ((len = l->__wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) 
{
-   fp->_flags |= __SERR;
-   return (WEOF);
-   }
+   if ((len = l->__wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) {
+

svn commit: r304894 - in stable/10/sys: kern sys

2016-08-27 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 27 10:56:04 2016
New Revision: 304894
URL: https://svnweb.freebsd.org/changeset/base/304894

Log:
  MFC r264388 (by davide):
  Define SBT_MAX.
  
  MFC r267896 (by davide):
  Improve r264388.
  
  MFC note.  The SBT_MAX definition already existed on stable/10, but without
  the refinement from r267896.  Also, consumers of SBT_MAX were not converted,
  since r264388 was not merged properly.
  
  Reviewed by:  mav

Modified:
  stable/10/sys/kern/kern_clocksource.c
  stable/10/sys/kern/kern_event.c
  stable/10/sys/kern/kern_timeout.c
  stable/10/sys/kern/sys_generic.c
  stable/10/sys/sys/time.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_clocksource.c
==
--- stable/10/sys/kern/kern_clocksource.c   Sat Aug 27 10:34:01 2016
(r304893)
+++ stable/10/sys/kern/kern_clocksource.c   Sat Aug 27 10:56:04 2016
(r304894)
@@ -211,7 +211,7 @@ handleevents(sbintime_t now, int fake)
} else
state->nextprof = state->nextstat;
if (now >= state->nextcallopt) {
-   state->nextcall = state->nextcallopt = INT64_MAX;
+   state->nextcall = state->nextcallopt = SBT_MAX;
callout_process(now);
}
 
@@ -492,7 +492,7 @@ configtimer(int start)
state = DPCPU_ID_PTR(cpu, timerstate);
state->now = now;
if (!smp_started && cpu != CPU_FIRST())
-   state->nextevent = INT64_MAX;
+   state->nextevent = SBT_MAX;
else
state->nextevent = next;
if (periodic)
@@ -580,8 +580,8 @@ cpu_initclocks_bsp(void)
CPU_FOREACH(cpu) {
state = DPCPU_ID_PTR(cpu, timerstate);
mtx_init(&state->et_hw_mtx, "et_hw_mtx", NULL, MTX_SPIN);
-   state->nextcall = INT64_MAX;
-   state->nextcallopt = INT64_MAX;
+   state->nextcall = SBT_MAX;
+   state->nextcallopt = SBT_MAX;
}
periodic = want_periodic;
/* Grab requested timer or the best of present. */

Modified: stable/10/sys/kern/kern_event.c
==
--- stable/10/sys/kern/kern_event.c Sat Aug 27 10:34:01 2016
(r304893)
+++ stable/10/sys/kern/kern_event.c Sat Aug 27 10:56:04 2016
(r304894)
@@ -1471,7 +1471,7 @@ kqueue_scan(struct kqueue *kq, int maxev
rsbt = tstosbt(*tsp);
if (TIMESEL(&asbt, rsbt))
asbt += tc_tick_sbt;
-   if (asbt <= INT64_MAX - rsbt)
+   if (asbt <= SBT_MAX - rsbt)
asbt += rsbt;
else
asbt = 0;

Modified: stable/10/sys/kern/kern_timeout.c
==
--- stable/10/sys/kern/kern_timeout.c   Sat Aug 27 10:34:01 2016
(r304893)
+++ stable/10/sys/kern/kern_timeout.c   Sat Aug 27 10:56:04 2016
(r304894)
@@ -296,7 +296,7 @@ callout_cpu_init(struct callout_cpu *cc,
for (i = 0; i < callwheelsize; i++)
LIST_INIT(&cc->cc_callwheel[i]);
TAILQ_INIT(&cc->cc_expireq);
-   cc->cc_firstevent = INT64_MAX;
+   cc->cc_firstevent = SBT_MAX;
for (i = 0; i < 2; i++)
cc_cce_cleanup(cc, i);
snprintf(cc->cc_ktr_event_name, sizeof(cc->cc_ktr_event_name),
@@ -569,8 +569,8 @@ callout_cc_add(struct callout *c, struct
 * Inform the eventtimers(4) subsystem there's a new callout
 * that has been inserted, but only if really required.
 */
-   if (INT64_MAX - c->c_time < c->c_precision)
-   c->c_precision = INT64_MAX - c->c_time;
+   if (SBT_MAX - c->c_time < c->c_precision)
+   c->c_precision = SBT_MAX - c->c_time;
sbt = c->c_time + c->c_precision;
if (sbt < cc->cc_firstevent) {
cc->cc_firstevent = sbt;
@@ -961,8 +961,8 @@ callout_reset_sbt_on(struct callout *c, 
to_sbt += tick_sbt;
} else
to_sbt = sbinuptime();
-   if (INT64_MAX - to_sbt < sbt)
-   to_sbt = INT64_MAX;
+   if (SBT_MAX - to_sbt < sbt)
+   to_sbt = SBT_MAX;
else
to_sbt += sbt;
pr = ((C_PRELGET(flags) < 0) ? sbt >> tc_precexp :

Modified: stable/10/sys/kern/sys_generic.c
==
--- stable/10/sys/kern/sys_generic.cSat Aug 27 10:34:01 2016
(r304893)
+++

svn commit: r304895 - head/usr.bin/netstat

2016-08-27 Thread Bruce Evans
Author: bde
Date: Sat Aug 27 11:06:06 2016
New Revision: 304895
URL: https://svnweb.freebsd.org/changeset/base/304895

Log:
  Fix build without INET6 and with gcc.  A function definition was ifdefed
  for INET6, but its protototype was not, and gcc detects the error.

Modified:
  head/usr.bin/netstat/route.c

Modified: head/usr.bin/netstat/route.c
==
--- head/usr.bin/netstat/route.cSat Aug 27 10:56:04 2016
(r304894)
+++ head/usr.bin/netstat/route.cSat Aug 27 11:06:06 2016
(r304895)
@@ -104,7 +104,9 @@ static int ifmap_size;
 static struct timespec uptime;
 
 static const char *netname4(in_addr_t, in_addr_t);
+#ifdef INET6
 static const char *netname6(struct sockaddr_in6 *, struct sockaddr_in6 *);
+#endif
 static void p_rtable_sysctl(int, int);
 static void p_rtentry_sysctl(const char *name, struct rt_msghdr *);
 static int p_sockaddr(const char *name, struct sockaddr *, struct sockaddr *,
___
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: r304896 - stable/11/lib/libc/stdio

2016-08-27 Thread Andrey A. Chernov
Author: ache
Date: Sat Aug 27 11:07:57 2016
New Revision: 304896
URL: https://svnweb.freebsd.org/changeset/base/304896

Log:
  MFC r304607,r304641,r304819,r304811
  
  1) Don't forget to set __SERR on __slbexpand() error.
  
  2) Remove "Fast path" from fgetwc()/fputwc() since it can't detect
  encoding errors and ignores them all.
  One of affected encoding example: US-ASCII
  
  3)  Original fgetln() from 44lite return success for line tail errors,
  i.e. partial line, but set __SERR and errno in the same time, which
  is inconsistent.
  Now both OpenBSD and NetBSD return failure, i.e. no line and set error
  indicators for such case, so make our fgetln() and fgetwln()
  (as its wide version) compatible with the rest of *BSD.
  
  PR: 212033

Modified:
  stable/11/lib/libc/stdio/fgetln.c
  stable/11/lib/libc/stdio/fgetwc.c
  stable/11/lib/libc/stdio/fgetwln.c
  stable/11/lib/libc/stdio/fputwc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/stdio/fgetln.c
==
--- stable/11/lib/libc/stdio/fgetln.c   Sat Aug 27 11:06:06 2016
(r304895)
+++ stable/11/lib/libc/stdio/fgetln.c   Sat Aug 27 11:07:57 2016
(r304896)
@@ -139,8 +139,11 @@ fgetln(FILE *fp, size_t *lenp)
(void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
len - off);
off = len;
-   if (__srefill(fp))
-   break;  /* EOF or error: return partial line */
+   if (__srefill(fp)) {
+   if (__sfeof(fp))
+   break;
+   goto error;
+   }
if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL)
continue;
 

Modified: stable/11/lib/libc/stdio/fgetwc.c
==
--- stable/11/lib/libc/stdio/fgetwc.c   Sat Aug 27 11:06:06 2016
(r304895)
+++ stable/11/lib/libc/stdio/fgetwc.c   Sat Aug 27 11:07:57 2016
(r304896)
@@ -79,18 +79,9 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i
size_t nconv;
struct xlocale_ctype *l = XLOCALE_CTYPE(locale);
 
-   if (fp->_r <= 0 && __srefill(fp)) {
-   *nread = 0;
-   return (WEOF);
-   }
-   if (MB_CUR_MAX == 1) {
-   /* Fast path for single-byte encodings. */
-   wc = *fp->_p++;
-   fp->_r--;
-   *nread = 1;
-   return (wc);
-   }
*nread = 0;
+   if (fp->_r <= 0 && __srefill(fp))
+   return (WEOF);
do {
nconv = l->__mbrtowc(&wc, fp->_p, fp->_r, mbs);
if (nconv == (size_t)-1)

Modified: stable/11/lib/libc/stdio/fgetwln.c
==
--- stable/11/lib/libc/stdio/fgetwln.c  Sat Aug 27 11:06:06 2016
(r304895)
+++ stable/11/lib/libc/stdio/fgetwln.c  Sat Aug 27 11:07:57 2016
(r304896)
@@ -56,13 +56,15 @@ fgetwln_l(FILE * __restrict fp, size_t *
while ((wc = __fgetwc(fp, locale)) != WEOF) {
 #defineGROW512
if (len * sizeof(wchar_t) >= fp->_lb._size &&
-   __slbexpand(fp, (len + GROW) * sizeof(wchar_t)))
+   __slbexpand(fp, (len + GROW) * sizeof(wchar_t))) {
+   fp->_flags |= __SERR;
goto error;
+   }
*((wchar_t *)fp->_lb._base + len++) = wc;
if (wc == L'\n')
break;
}
-   if (len == 0)
+   if (len == 0 || (wc == WEOF && !__sfeof(fp)))
goto error;
 
FUNLOCKFILE(fp);
@@ -74,6 +76,7 @@ error:
*lenp = 0;
return (NULL);
 }
+
 wchar_t *
 fgetwln(FILE * __restrict fp, size_t *lenp)
 {

Modified: stable/11/lib/libc/stdio/fputwc.c
==
--- stable/11/lib/libc/stdio/fputwc.c   Sat Aug 27 11:06:06 2016
(r304895)
+++ stable/11/lib/libc/stdio/fputwc.c   Sat Aug 27 11:07:57 2016
(r304896)
@@ -53,19 +53,9 @@ __fputwc(wchar_t wc, FILE *fp, locale_t 
size_t i, len;
struct xlocale_ctype *l = XLOCALE_CTYPE(locale);
 
-   if (MB_CUR_MAX == 1 && wc > 0 && wc <= UCHAR_MAX) {
-   /*
-* Assume single-byte locale with no special encoding.
-* A more careful test would be to check
-* _CurrentRuneLocale->encoding.
-*/
-   *buf = (unsigned char)wc;
-   len = 1;
-   } else {
-   if ((len = l->__wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) 
{
-   fp->_flags |= __SERR;
-   return (WEOF);
-   }
+   if ((len = l->__wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) {
+

svn commit: r304898 - vendor/llvm/llvm-release_39-r279689

2016-08-27 Thread Dimitry Andric
Author: dim
Date: Sat Aug 27 11:37:44 2016
New Revision: 304898
URL: https://svnweb.freebsd.org/changeset/base/304898

Log:
  Tag llvm release_39 branch r279689.

Added:
  vendor/llvm/llvm-release_39-r279689/
 - copied from r304897, vendor/llvm/dist/
___
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: r304897 - in vendor/llvm/dist: lib/Transforms/Scalar test/Transforms/SCCP

2016-08-27 Thread Dimitry Andric
Author: dim
Date: Sat Aug 27 11:37:22 2016
New Revision: 304897
URL: https://svnweb.freebsd.org/changeset/base/304897

Log:
  Vendor import of llvm release_39 branch r279689:
  https://llvm.org/svn/llvm-project/llvm/branches/release_39@279689

Modified:
  vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp
  vendor/llvm/dist/test/Transforms/SCCP/calltest.ll

Modified: vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp
==
--- vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp Sat Aug 27 11:07:57 
2016(r304896)
+++ vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp Sat Aug 27 11:37:22 
2016(r304897)
@@ -1538,17 +1538,6 @@ static bool tryToReplaceWithConstant(SCC
   return true;
 }
 
-static bool tryToReplaceInstWithConstant(SCCPSolver &Solver, Instruction *Inst,
- bool shouldEraseFromParent) {
-  if (!tryToReplaceWithConstant(Solver, Inst))
-return false;
-
-  // Delete the instruction.
-  if (shouldEraseFromParent)
-Inst->eraseFromParent();
-  return true;
-}
-
 // runSCCP() - Run the Sparse Conditional Constant Propagation algorithm,
 // and return true if the function was modified.
 //
@@ -1597,8 +1586,9 @@ static bool runSCCP(Function &F, const D
   if (Inst->getType()->isVoidTy() || isa(Inst))
 continue;
 
-  if (tryToReplaceInstWithConstant(Solver, Inst,
-   true /* shouldEraseFromParent */)) {
+  if (tryToReplaceWithConstant(Solver, Inst)) {
+if (isInstructionTriviallyDead(Inst))
+  Inst->eraseFromParent();
 // Hey, we just changed something!
 MadeChanges = true;
 ++NumInstRemoved;
@@ -1789,10 +1779,9 @@ static bool runIPSCCP(Module &M, const D
 Instruction *Inst = &*BI++;
 if (Inst->getType()->isVoidTy())
   continue;
-if (tryToReplaceInstWithConstant(
-Solver, Inst,
-!isa(Inst) &&
-!isa(Inst) /* shouldEraseFromParent */)) {
+if (tryToReplaceWithConstant(Solver, Inst)) {
+  if (!isa(Inst) && !isa(Inst))
+Inst->eraseFromParent();
   // Hey, we just changed something!
   MadeChanges = true;
   ++IPNumInstRemoved;

Modified: vendor/llvm/dist/test/Transforms/SCCP/calltest.ll
==
--- vendor/llvm/dist/test/Transforms/SCCP/calltest.ll   Sat Aug 27 11:07:57 
2016(r304896)
+++ vendor/llvm/dist/test/Transforms/SCCP/calltest.ll   Sat Aug 27 11:37:22 
2016(r304897)
@@ -1,12 +1,16 @@
-; RUN: opt < %s -sccp -loop-deletion -simplifycfg -S | not grep br
+; RUN: opt < %s -sccp -loop-deletion -simplifycfg -S | FileCheck %s
 
+declare double @sqrt(double) readnone nounwind
+%empty = type {}
+declare %empty @has_side_effects()
+
+define double @test_0(i32 %param) {
+; CHECK-LABEL: @test_0(
+; CHECK-NOT: br
+entry:
 ; No matter how hard you try, sqrt(1.0) is always 1.0.  This allows the
 ; optimizer to delete this loop.
 
-declare double @sqrt(double)
-
-define double @test(i32 %param) {
-entry:
br label %Loop
 Loop:  ; preds = %Loop, %entry
%I2 = phi i32 [ 0, %entry ], [ %I3, %Loop ] ;  
[#uses=1]
@@ -19,3 +23,9 @@ Exit: ; preds = %Loop
ret double %V
 }
 
+define i32 @test_1() {
+; CHECK-LABEL: @test_1(
+; CHECK: call %empty @has_side_effects()
+  %1 = call %empty @has_side_effects()
+  ret i32 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: r304899 - vendor/clang/clang-release_39-r279689

2016-08-27 Thread Dimitry Andric
Author: dim
Date: Sat Aug 27 11:38:21 2016
New Revision: 304899
URL: https://svnweb.freebsd.org/changeset/base/304899

Log:
  Tag clang release_39 branch r279689.

Added:
  vendor/clang/clang-release_39-r279689/
 - copied from r304898, vendor/clang/dist/
___
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: r304901 - vendor/compiler-rt/compiler-rt-release_39-r279689

2016-08-27 Thread Dimitry Andric
Author: dim
Date: Sat Aug 27 11:38:53 2016
New Revision: 304901
URL: https://svnweb.freebsd.org/changeset/base/304901

Log:
  Tag compiler-rt release_39 branch r279689.

Added:
  vendor/compiler-rt/compiler-rt-release_39-r279689/
 - copied from r304900, vendor/compiler-rt/dist/
___
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: r304900 - in stable/10: share/man/man9 sys/kern sys/sys

2016-08-27 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 27 11:38:37 2016
New Revision: 304900
URL: https://svnweb.freebsd.org/changeset/base/304900

Log:
  MFC r303425:
  Add callout_when(9).
  
  MFC r303919:
  Fix indentation.

Modified:
  stable/10/share/man/man9/Makefile
  stable/10/share/man/man9/timeout.9
  stable/10/sys/kern/kern_timeout.c
  stable/10/sys/sys/callout.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man9/Makefile
==
--- stable/10/share/man/man9/Makefile   Sat Aug 27 11:38:21 2016
(r304899)
+++ stable/10/share/man/man9/Makefile   Sat Aug 27 11:38:37 2016
(r304900)
@@ -1401,6 +1401,7 @@ MLINKS+=timeout.9 callout.9 \
timeout.9 callout_schedule_sbt_curcpu.9 \
timeout.9 callout_schedule_sbt_on.9 \
timeout.9 callout_stop.9 \
+   timeout.9 callout_when.9 \
timeout.9 untimeout.9
 MLINKS+=ucred.9 crcopy.9 \
ucred.9 crdup.9 \

Modified: stable/10/share/man/man9/timeout.9
==
--- stable/10/share/man/man9/timeout.9  Sat Aug 27 11:38:21 2016
(r304899)
+++ stable/10/share/man/man9/timeout.9  Sat Aug 27 11:38:37 2016
(r304900)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 8, 2014
+.Dd July 27, 2016
 .Dt TIMEOUT 9
 .Os
 .Sh NAME
@@ -55,6 +55,7 @@
 .Nm callout_schedule_sbt_curcpu ,
 .Nm callout_schedule_sbt_on ,
 .Nm callout_stop ,
+.Nm callout_when ,
 .Nm timeout ,
 .Nm untimeout
 .Nd execute a function after a specified length of time
@@ -88,20 +89,48 @@ struct callout_handle handle = CALLOUT_H
 .Ft int
 .Fn callout_reset "struct callout *c" "int ticks" "timeout_t *func" "void *arg"
 .Ft int
-.Fn callout_reset_curcpu "struct callout *c" "int ticks" "timeout_t *func" \
-"void *arg"
-.Ft int
-.Fn callout_reset_on "struct callout *c" "int ticks" "timeout_t *func" \
-"void *arg" "int cpu"
-.Ft int
-.Fn callout_reset_sbt "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "timeout_t *func" "void *arg" "int flags"
-.Ft int
-.Fn callout_reset_sbt_curcpu "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "timeout_t *func" "void *arg" "int flags"
-.Ft int
-.Fn callout_reset_sbt_on "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "timeout_t *func" "void *arg" "int cpu" "int flags"
+.Fo callout_reset_curcpu
+.Fa "struct callout *c"
+.Fa "int ticks"
+.Fa "timeout_t *func"
+.Fa "void *arg"
+.Fc
+.Ft int
+.Fo callout_reset_on
+.Fa "struct callout *c"
+.Fa "int ticks"
+.Fa "timeout_t *func"
+.Fa "void *arg"
+.Fa "int cpu"
+.Fc
+.Ft int
+.Fo callout_reset_sbt
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "timeout_t *func"
+.Fa "void *arg"
+.Fa "int flags"
+.Fc
+.Ft int
+.Fo callout_reset_sbt_curcpu
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "timeout_t *func"
+.Fa "void *arg"
+.Fa "int flags"
+.Fc
+.Ft int
+.Fo callout_reset_sbt_on
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "timeout_t *func"
+.Fa "void *arg"
+.Fa "int cpu"
+.Fa "int flags"
+.Fc
 .Ft int
 .Fn callout_schedule "struct callout *c" "int ticks"
 .Ft int
@@ -109,16 +138,37 @@ struct callout_handle handle = CALLOUT_H
 .Ft int
 .Fn callout_schedule_on "struct callout *c" "int ticks" "int cpu"
 .Ft int
-.Fn callout_schedule_sbt "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "int flags"
-.Ft int
-.Fn callout_schedule_sbt_curcpu "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "int flags"
-.Ft int
-.Fn callout_schedule_sbt_on "struct callout *c" "sbintime_t sbt" \
-"sbintime_t pr" "int cpu" "int flags"
+.Fo callout_schedule_sbt
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "int flags"
+.Fc
+.Ft int
+.Fo callout_schedule_sbt_curcpu
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "int flags"
+.Fc
+.Ft int
+.Fo callout_schedule_sbt_on
+.Fa "struct callout *c"
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t pr"
+.Fa "int cpu"
+.Fa "int flags"
+.Fc
 .Ft int
 .Fn callout_stop "struct callout *c"
+.Ft sbintime_t
+.Fo callout_when
+.Fa "sbintime_t sbt"
+.Fa "sbintime_t precision"
+.Fa "int flags"
+.Fa "sbintime_t *sbt_res"
+.Fa "sbintime_t *precision_res"
+.Fc
 .Ft struct callout_handle
 .Fn timeout "timeout_t *func" "void *arg" "int ticks"
 .Ft void
@@ -354,6 +404,26 @@ or this value is used as the length of t
 Smaller values
 .Pq which result in larger time intervals
 allow the callout subsystem to aggregate more events in one timer interrupt.
+.It Dv C_PRECALC
+The
+.Fa sbt
+argument specifies the absolute time at which the callout should be run,
+and the
+.Fa pr
+argument specifies the requested precision, which will not be
+adjusted during the scheduling process.
+The
+.Fa sbt
+and
+.Fa pr
+values should be calculated by an earlier call to
+.Fn callout_when
+which uses the user-supplied
+.Fa sbt ,
+.Fa pr ,
+and
+.Fa flags
+values.
 .It Dv C_HARDCLOCK
 Align the t

svn commit: r304902 - vendor/libc++/libc++-release_39-r279689

2016-08-27 Thread Dimitry Andric
Author: dim
Date: Sat Aug 27 11:39:30 2016
New Revision: 304902
URL: https://svnweb.freebsd.org/changeset/base/304902

Log:
  Tag libc++ release_39 branch r279689.

Added:
  vendor/libc++/libc++-release_39-r279689/
 - copied from r304901, vendor/libc++/dist/
___
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: r304903 - vendor/lld/lld-release_39-r279689

2016-08-27 Thread Dimitry Andric
Author: dim
Date: Sat Aug 27 11:40:11 2016
New Revision: 304903
URL: https://svnweb.freebsd.org/changeset/base/304903

Log:
  Tag lld release_39 branch r279689.

Added:
  vendor/lld/lld-release_39-r279689/
 - copied from r304902, vendor/lld/dist/
___
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: r304904 - vendor/lldb/lldb-release_39-r279689

2016-08-27 Thread Dimitry Andric
Author: dim
Date: Sat Aug 27 11:40:37 2016
New Revision: 304904
URL: https://svnweb.freebsd.org/changeset/base/304904

Log:
  Tag lldb release_39 branch r279689.

Added:
  vendor/lldb/lldb-release_39-r279689/
 - copied from r304903, vendor/lldb/dist/
___
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: r304905 - in stable/10/sys: ddb kern sys

2016-08-27 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 27 11:45:05 2016
New Revision: 304905
URL: https://svnweb.freebsd.org/changeset/base/304905

Log:
  MFC r303426:
  Rewrite subr_sleepqueue.c use of callouts to not depend on the
  specifics of callout KPI.

Modified:
  stable/10/sys/ddb/db_ps.c
  stable/10/sys/kern/kern_fork.c
  stable/10/sys/kern/kern_kthread.c
  stable/10/sys/kern/kern_thr.c
  stable/10/sys/kern/kern_thread.c
  stable/10/sys/kern/subr_sleepqueue.c
  stable/10/sys/sys/proc.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ddb/db_ps.c
==
--- stable/10/sys/ddb/db_ps.c   Sat Aug 27 11:40:37 2016(r304904)
+++ stable/10/sys/ddb/db_ps.c   Sat Aug 27 11:45:05 2016(r304905)
@@ -371,8 +371,13 @@ DB_SHOW_COMMAND(thread, db_show_thread)
db_printf(" lock: %s  turnstile: %p\n", td->td_lockname,
td->td_blocked);
if (TD_ON_SLEEPQ(td))
-   db_printf(" wmesg: %s  wchan: %p\n", td->td_wmesg,
-   td->td_wchan);
+   db_printf(
+   " wmesg: %s  wchan: %p sleeptimo %lx. %jx (curr %lx. %jx)\n",
+   td->td_wmesg, td->td_wchan,
+   (long)sbttobt(td->td_sleeptimo).sec,
+   (uintmax_t)sbttobt(td->td_sleeptimo).frac,
+   (long)sbttobt(sbinuptime()).sec,
+   (uintmax_t)sbttobt(sbinuptime()).frac);
db_printf(" priority: %d\n", td->td_priority);
db_printf(" container lock: %s (%p)\n", lock->lo_name, lock);
 }

Modified: stable/10/sys/kern/kern_fork.c
==
--- stable/10/sys/kern/kern_fork.c  Sat Aug 27 11:40:37 2016
(r304904)
+++ stable/10/sys/kern/kern_fork.c  Sat Aug 27 11:45:05 2016
(r304905)
@@ -470,6 +470,7 @@ do_fork(struct thread *td, int flags, st
bzero(&td2->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
td2->td_su = NULL;
+   td2->td_sleeptimo = 0;
 
bcopy(&td->td_startcopy, &td2->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));

Modified: stable/10/sys/kern/kern_kthread.c
==
--- stable/10/sys/kern/kern_kthread.c   Sat Aug 27 11:40:37 2016
(r304904)
+++ stable/10/sys/kern/kern_kthread.c   Sat Aug 27 11:45:05 2016
(r304905)
@@ -272,6 +272,7 @@ kthread_add(void (*func)(void *), void *
bzero(&newtd->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
newtd->td_su = NULL;
+   newtd->td_sleeptimo = 0;
bcopy(&oldtd->td_startcopy, &newtd->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));
 

Modified: stable/10/sys/kern/kern_thr.c
==
--- stable/10/sys/kern/kern_thr.c   Sat Aug 27 11:40:37 2016
(r304904)
+++ stable/10/sys/kern/kern_thr.c   Sat Aug 27 11:45:05 2016
(r304905)
@@ -229,6 +229,7 @@ thread_create(struct thread *td, struct 
bzero(&newtd->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
newtd->td_su = NULL;
+   newtd->td_sleeptimo = 0;
bcopy(&td->td_startcopy, &newtd->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));
newtd->td_proc = td->td_proc;

Modified: stable/10/sys/kern/kern_thread.c
==
--- stable/10/sys/kern/kern_thread.cSat Aug 27 11:40:37 2016
(r304904)
+++ stable/10/sys/kern/kern_thread.cSat Aug 27 11:45:05 2016
(r304905)
@@ -319,7 +319,7 @@ thread_reap(void)
 
/*
 * Don't even bother to lock if none at this instant,
-* we really don't care about the next instant..
+* we really don't care about the next instant.
 */
if (!TAILQ_EMPTY(&zombie_threads)) {
mtx_lock_spin(&zombie_lock);
@@ -383,6 +383,7 @@ thread_free(struct thread *td)
cpu_thread_free(td);
if (td->td_kstack != 0)
vm_thread_dispose(td);
+   callout_drain(&td->td_slpcallout);
uma_zfree(thread_zone, td);
 }
 
@@ -524,6 +525,7 @@ thread_wait(struct proc *p)
td->td_cpuset = NULL;
cpu_thread_clean(td);
crfree(td->td_ucred);
+   callout_drain(&td->td_slpcallout);
thread_reap();  /* check for zombie threads etc. */
 }
 

Modified: stable/10/sys/kern/subr_sleepqueue.c
==
--- stable/10/sys/kern/subr_sleepqueue.cSat Aug 27 11:40:37 2016
(r304904)
+++ stable/10/sys/kern/subr_sleepqueue.cSat Aug 27 11:45:05 2016
(r304905)
@@ -361,6 +361,7 @@ sleepq_set_timeout_sbt(void *wchan, s

svn commit: r304907 - head/sys/modules

2016-08-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 27 12:41:15 2016
New Revision: 304907
URL: https://svnweb.freebsd.org/changeset/base/304907

Log:
  Do not try to build cloudabi32 for pc98.
  
  Should unbreak tinderbox.

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Sat Aug 27 11:51:08 2016(r304906)
+++ head/sys/modules/Makefile   Sat Aug 27 12:41:15 2016(r304907)
@@ -766,7 +766,7 @@ _epic=  epic
 _igb=  igb
 .endif
 
-.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE} == "i386"
 _cloudabi32=   cloudabi32
 .endif
 .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
___
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: r304908 - in head: lib/libnv lib/libnv/tests sys/conf sys/contrib/libnv

2016-08-27 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Aug 27 13:37:30 2016
New Revision: 304908
URL: https://svnweb.freebsd.org/changeset/base/304908

Log:
  Add cnv API.
  
  cnv API is a set of functions for managing name/value pairs by cookie.
  The cookie can be obtained by nvlist_next(), nvlist_get_parent() or
  nvlist_get_pararr() function. This patch also includes unit tests.
  
  Submitted by: Adam Starak 

Added:
  head/lib/libnv/tests/cnv_tests.cc   (contents, props changed)
  head/sys/contrib/libnv/cnvlist.c   (contents, props changed)
Modified:
  head/lib/libnv/Makefile
  head/lib/libnv/tests/Makefile
  head/sys/conf/files
  head/sys/contrib/libnv/nvlist.c
  head/sys/contrib/libnv/nvlist_impl.h

Modified: head/lib/libnv/Makefile
==
--- head/lib/libnv/Makefile Sat Aug 27 12:41:15 2016(r304907)
+++ head/lib/libnv/Makefile Sat Aug 27 13:37:30 2016(r304908)
@@ -11,7 +11,8 @@ SHLIB_MAJOR= 0
 .PATH: ${.CURDIR}/../../sys/contrib/libnv ${.CURDIR}/../../sys/sys
 CFLAGS+=-I${.CURDIR}/../../sys -I${.CURDIR}
 
-SRCS=  dnvlist.c
+SRCS=  cnvlist.c
+SRCS+= dnvlist.c
 SRCS+= msgio.c
 SRCS+= nvlist.c
 SRCS+= nvpair.c

Modified: head/lib/libnv/tests/Makefile
==
--- head/lib/libnv/tests/Makefile   Sat Aug 27 12:41:15 2016
(r304907)
+++ head/lib/libnv/tests/Makefile   Sat Aug 27 13:37:30 2016
(r304908)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 
 ATF_TESTS_CXX= \
+   cnv_tests\
dnv_tests \
nv_array_tests \
nv_tests \

Added: head/lib/libnv/tests/cnv_tests.cc
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libnv/tests/cnv_tests.cc   Sat Aug 27 13:37:30 2016
(r304908)
@@ -0,0 +1,1509 @@
+/*-
+ * Copyright (c) 2016 Adam Starak 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#definefd_is_valid(fd) (fcntl((fd), F_GETFL) != -1 || errno != EBADF)
+
+/* ATF cnvlist_get tests. */
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_bool);
+ATF_TEST_CASE_BODY(cnvlist_get_bool)
+{
+   nvlist_t *nvl;
+   const char *key;
+   bool value;
+   void *cookie;
+   int type;
+
+   nvl = nvlist_create(0);
+   ATF_REQUIRE(nvl != NULL);
+   ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+   ATF_REQUIRE(nvlist_empty(nvl));
+
+   cookie = NULL;
+   key = "name";
+   value = true;
+
+   nvlist_add_bool(nvl, key, value);
+   ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+   ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+   ATF_REQUIRE_EQ(type, NV_TYPE_BOOL);
+   ATF_REQUIRE(!nvlist_empty(nvl));
+   ATF_REQUIRE(nvlist_exists(nvl, key));
+   ATF_REQUIRE(nvlist_exists_bool(nvl, key));
+
+   ATF_REQUIRE_EQ(cnvlist_get_bool(cookie), value);
+
+   ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+   static_cast(NULL));
+
+   nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_number);
+ATF_TEST_CASE_BODY(cnvlist_get_number)
+{
+   nvlist_t *nvl;
+   const char *key;
+   uint64_t value;
+   void *cookie;
+   int type;
+
+   nvl = nvlist_create(0);
+   ATF_REQUIRE(nvl != NULL);
+   ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+   ATF_REQUIRE(nvlist_empty(nvl));
+
+   cookie = NULL;
+   key = "name";
+   value = 420;
+
+   nvlist_add_number(nvl, key, value);
+   ATF_REQUIRE_EQ(strcmp(key, nvlist_n

svn commit: r304909 - in head: lib/libnv/tests sys/contrib/libnv

2016-08-27 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Aug 27 13:40:27 2016
New Revision: 304909
URL: https://svnweb.freebsd.org/changeset/base/304909

Log:
  Fix style issue in the cnv API.
  Remove unused arguments in a macro.
  Remove unused typedef.

Modified:
  head/lib/libnv/tests/Makefile
  head/lib/libnv/tests/cnv_tests.cc
  head/sys/contrib/libnv/cnvlist.c

Modified: head/lib/libnv/tests/Makefile
==
--- head/lib/libnv/tests/Makefile   Sat Aug 27 13:37:30 2016
(r304908)
+++ head/lib/libnv/tests/Makefile   Sat Aug 27 13:40:27 2016
(r304909)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 ATF_TESTS_CXX= \
-   cnv_tests\
+   cnv_tests \
dnv_tests \
nv_array_tests \
nv_tests \

Modified: head/lib/libnv/tests/cnv_tests.cc
==
--- head/lib/libnv/tests/cnv_tests.cc   Sat Aug 27 13:37:30 2016
(r304908)
+++ head/lib/libnv/tests/cnv_tests.cc   Sat Aug 27 13:40:27 2016
(r304909)
@@ -188,8 +188,9 @@ ATF_TEST_CASE_BODY(cnvlist_get_nvlist)
ATF_REQUIRE(nvlist_exists(nvl, key));
ATF_REQUIRE(nvlist_exists_nvlist(nvl, key));
 
-   /* Assuming nvlist_get_nvlist() is correct check if cnvlist returns the
-* same pointer.
+   /*
+* Assuming nvlist_get_nvlist() is correct check if cnvlist returns
+* the same pointer.
 */
result = cnvlist_get_nvlist(cookie);
ATF_REQUIRE_EQ(result, nvlist_get_nvlist(nvl, key));
@@ -499,7 +500,6 @@ ATF_TEST_CASE_BODY(cnvlist_get_nvlist_ar
 ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_descriptor_array);
 ATF_TEST_CASE_BODY(cnvlist_get_descriptor_array)
 {
-
nvlist_t *nvl;
size_t count, i, nitems;
const int *out_array;
@@ -730,7 +730,6 @@ ATF_TEST_CASE_BODY(cnvlist_take_nvlist)
ATF_REQUIRE(result == value);
 
/* Validate data inside nvlist. */
-
cookie = NULL;
ATF_REQUIRE_EQ(strcmp(subkey, nvlist_next(result, &type, &cookie)), 0);
ATF_REQUIRE_EQ(nvlist_error(value), 0);

Modified: head/sys/contrib/libnv/cnvlist.c
==
--- head/sys/contrib/libnv/cnvlist.cSat Aug 27 13:37:30 2016
(r304908)
+++ head/sys/contrib/libnv/cnvlist.cSat Aug 27 13:40:27 2016
(r304909)
@@ -53,14 +53,15 @@ __FBSDID("$FreeBSD$");
 #include "nvlist_impl.h"
 #include "nvpair_impl.h"
 
-#define CNVLIST_GET(ftype, type, nvtype)   \
+#defineCNVLIST_GET(ftype, type, NVTYPE)
\
 ftype  \
 cnvlist_get_##type(void *cookiep)  \
 {  \
\
-if (nvpair_type(cookiep) != NV_TYPE_##nvtype)  \
-   nvlist_report_missing(NV_TYPE_##nvtype, \
+   if (nvpair_type(cookiep) != NV_TYPE_##NVTYPE) { \
+   nvlist_report_missing(NV_TYPE_##NVTYPE, \
nvpair_name(cookiep));  \
+   }   \
 return (nvpair_get_##type(cookiep));   \
 }
 
@@ -72,17 +73,18 @@ CNVLIST_GET(const nvlist_t *, nvlist, NV
 CNVLIST_GET(int, descriptor, DESCRIPTOR)
 #endif
 
-#undef CNVLIST_GET
+#undef CNVLIST_GET
 
-#define CNVLIST_GET_ARRAY(ftype, type, nvtype) \
+#defineCNVLIST_GET_ARRAY(ftype, type, NVTYPE)  
\
 ftype  \
 cnvlist_get_##type(void *cookiep, size_t *nitemsp) \
 {  \
\
-if (nvpair_type(cookiep) != NV_TYPE_##nvtype)  \
-   nvlist_report_missing(NV_TYPE_##nvtype, \
+   if (nvpair_type(cookiep) != NV_TYPE_##NVTYPE) { \
+   nvlist_report_missing(NV_TYPE_##NVTYPE, \
nvpair_name(cookiep));  \
-return (nvpair_get_##type(cookiep, nitemsp));  \
+   }   \
+   return (nvpair_get_##type(cookiep, nitemsp));   \
 }
 
 CNVLIST_GET_ARRAY(const bool *, bool_array, BOOL_ARRAY)
@@ -93,26 +95,27 @@ CNVLIST_GET_ARRAY(const nvlist_t * const
 CNVLIST_GET_ARRAY(const int *, descriptor_array, DESCRIPTOR_ARRAY)
 #endif
 
-#undef  CNVLIST_GET_ARRAY
+#undef CNVLIST_GET_ARRAY
 
 const void *
 cnvlist_get_binary(void *cookiep, size_t *s

svn commit: r304910 - head/share/man/man9

2016-08-27 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Aug 27 13:47:52 2016
New Revision: 304910
URL: https://svnweb.freebsd.org/changeset/base/304910

Log:
  Introduce cnv man page.
  
  Submitted by: Adam Starak 
  Reviewed by:  cem@, wblock@
  Differential Revision:https://reviews.freebsd.org/D7249

Added:
  head/share/man/man9/cnv.9   (contents, props changed)
Modified:
  head/share/man/man9/Makefile

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileSat Aug 27 13:40:27 2016
(r304909)
+++ head/share/man/man9/MakefileSat Aug 27 13:47:52 2016
(r304910)
@@ -57,6 +57,7 @@ MAN=  accept_filter.9 \
byteorder.9 \
casuword.9 \
cd.9 \
+   cnv.9 \
condvar.9 \
config_intrhook.9 \
contigmalloc.9 \
@@ -617,6 +618,41 @@ MLINKS+=byteorder.9 be16dec.9 \
byteorder.9 le64dec.9 \
byteorder.9 le64enc.9 \
byteorder.9 le64toh.9
+MLINKS+=cnv.9 cnvlist.9 \
+   cnv.9 cnvlist_free_binary.9 \
+   cnv.9 cnvlist_free_bool.9 \
+   cnv.9 cnvlist_free_bool_array.9 \
+   cnv.9 cnvlist_free_descriptor.9 \
+   cnv.9 cnvlist_free_descriptor_array.9 \
+   cnv.9 cnvlist_free_null.9 \
+   cnv.9 cnvlist_free_number.9 \
+   cnv.9 cnvlist_free_number_array.9 \
+   cnv.9 cnvlist_free_nvlist.9 \
+   cnv.9 cnvlist_free_nvlist_array.9 \
+   cnv.9 cnvlist_free_string.9 \
+   cnv.9 cnvlist_free_string_array.9 \
+   cnv.9 cnvlist_get_binary.9 \
+   cnv.9 cnvlist_get_bool.9 \
+   cnv.9 cnvlist_get_bool_array.9 \
+   cnv.9 cnvlist_get_descriptor.9 \
+   cnv.9 cnvlist_get_descriptor_array.9 \
+   cnv.9 cnvlist_get_number.9 \
+   cnv.9 cnvlist_get_number_array.9 \
+   cnv.9 cnvlist_get_nvlist.9 \
+   cnv.9 cnvlist_get_nvlist_array.9 \
+   cnv.9 cnvlist_get_string.9 \
+   cnv.9 cnvlist_get_string_array.9 \
+   cnv.9 cnvlist_take_binary.9 \
+   cnv.9 cnvlist_take_bool.9 \
+   cnv.9 cnvlist_take_bool_array.9 \
+   cnv.9 cnvlist_take_descriptor.9 \
+   cnv.9 cnvlist_take_descriptor_array.9 \
+   cnv.9 cnvlist_take_number.9 \
+   cnv.9 cnvlist_take_number_array.9 \
+   cnv.9 cnvlist_take_nvlist.9 \
+   cnv.9 cnvlist_take_nvlist_array.9 \
+   cnv.9 cnvlist_take_string.9 \
+   cnv.9 cnvlist_take_string_array.9
 MLINKS+=condvar.9 cv_broadcast.9 \
condvar.9 cv_broadcastpri.9 \
condvar.9 cv_destroy.9 \

Added: head/share/man/man9/cnv.9
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man9/cnv.9   Sat Aug 27 13:47:52 2016(r304910)
@@ -0,0 +1,199 @@
+.\"
+.\" Copyright (c) 2016 Adam Starak 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 26, 2016
+.Dt CNV 9
+.Os
+.Sh NAME
+.Nm cnvlist_get,
+.Nm cnvlist_take,
+.Nm cnvlist_free,
+.Nd "API for managing name/value pairs by cookie."
+.Sh LIBRARY
+.Lb libnv
+.Sh SYNOPSIS
+.In sys/cnv.h
+.Ft bool
+.Fn cnvlist_get_bool "void *cookiep"
+.Ft uint64_t
+.Fn cnvlist_get_number "void *cookiep"
+.Ft "const char *"
+.Fn cnvlist_get_string "void *cookiep"
+.Ft "const nvlist_t *"
+.Fn cnvlist_get_nvlist "void *cookiep"
+.Ft "const void *"
+.Fn cnvlist_get_binary "void *cookiep" "size_t *sizep"
+.Ft "const bool *"
+.Fn cnvlist_get_bool_array "void *cookiep" "size_t *nitemsp"
+.Ft "const uint64_t *"
+.Fn cnvlist_get_number_array "void *cookiep" "size_t *nitemsp"
+.Ft "const char * const *"
+.Fn cnvlist_get_string_array "void *cookiep" "size_t *nitem

svn commit: r304911 - head/lib/libc/net

2016-08-27 Thread Andrey A. Chernov
Author: ache
Date: Sat Aug 27 14:43:13 2016
New Revision: 304911
URL: https://svnweb.freebsd.org/changeset/base/304911

Log:
  The formal behavior of qsort is unstable with regard to objects that
  are equal. Unfortunately, RFC 3484 requires that otherwise equal objects
  remain in the order supplied by the DNS server. The present code attempts
  to deal with this by returning -1 for objects that are equal (i.e.,
  returns that the first parameter is less then the second parameter).
  Unfortunately, the qsort API does not state that the first parameter
  passed in is in any particular position in the list.
  
  PR: 212122
  Submitted by:   herbie.robin...@stratus.com
  MFC after:  3 days

Modified:
  head/lib/libc/net/getaddrinfo.c

Modified: head/lib/libc/net/getaddrinfo.c
==
--- head/lib/libc/net/getaddrinfo.c Sat Aug 27 13:47:52 2016
(r304910)
+++ head/lib/libc/net/getaddrinfo.c Sat Aug 27 14:43:13 2016
(r304911)
@@ -224,6 +224,7 @@ struct ai_order {
struct policyqueue *aio_dstpolicy;
struct addrinfo *aio_ai;
int aio_matchlen;
+   int aio_initial_sequence;
 };
 
 static const ns_src default_dns_files[] = {
@@ -708,6 +709,7 @@ reorder(struct addrinfo *sentinel)
aio[i].aio_dstpolicy = match_addrselectpolicy(ai->ai_addr,
  &policyhead);
set_source(&aio[i], &policyhead);
+   aio[i].aio_initial_sequence = i;
}
 
/* perform sorting. */
@@ -1066,6 +1068,23 @@ comp_dst(const void *arg1, const void *a
}
 
/* Rule 10: Otherwise, leave the order unchanged. */
+
+   /* 
+* Note that qsort is unstable; so, we can't return zero and 
+* expect the order to be unchanged.
+* That also means we can't depend on the current position of
+* dst2 being after dst1.  We must enforce the initial order
+* with an explicit compare on the original position.
+* The qsort specification requires that "When the same objects 
+* (consisting of width bytes, irrespective of their current 
+* positions in the array) are passed more than once to the 
+* comparison function, the results shall be consistent with one 
+* another."  
+* In other words, If A < B, then we must also return B > A.
+*/
+   if (dst2->aio_initial_sequence < dst1->aio_initial_sequence)
+   return(1);
+
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: r304912 - head/sys/sys

2016-08-27 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Aug 27 15:22:55 2016
New Revision: 304912
URL: https://svnweb.freebsd.org/changeset/base/304912

Log:
  Add missed header file for cnv.h .
  
  Submitted by: Adam Starak 
  Reported by:  ache@

Added:
  head/sys/sys/cnv.h   (contents, props changed)

Added: head/sys/sys/cnv.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/sys/cnv.h  Sat Aug 27 15:22:55 2016(r304912)
@@ -0,0 +1,113 @@
+/*-
+ * Copyright (c) 2016 Adam Starak 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef_CNV_H_
+#define_CNV_H_
+
+#include 
+
+#ifndef _KERNEL
+#include 
+#include 
+#include 
+#include 
+#endif
+
+#ifndef_NVLIST_T_DECLARED
+#define_NVLIST_T_DECLARED
+struct nvlist;
+
+typedef struct nvlist nvlist_t;
+#endif
+
+__BEGIN_DECLS
+
+/*
+ * The cnvlist_get functions returns value associated with the given cookie.
+ * If it returns a pointer, the pointer represents internal buffer and should
+ * not be freed by the caller.
+ */
+
+boolcnvlist_get_bool(void *cookiep);
+uint64_tcnvlist_get_number(void *cookiep);
+const char *cnvlist_get_string(void *cookiep);
+const nvlist_t *cnvlist_get_nvlist(void *cookiep);
+const void *cnvlist_get_binary(void *cookiep, size_t *sizep);
+const bool *cnvlist_get_bool_array(void *cookiep, size_t *nitemsp);
+const uint64_t *cnvlist_get_number_array(void *cookiep, size_t 
*nitemsp);
+const char * const *cnvlist_get_string_array(void *cookiep, size_t 
*nitemsp);
+const nvlist_t * const *cnvlist_get_nvlist_array(void *cookiep, size_t 
*nitemsp);
+#ifndef _KERNEL
+int cnvlist_get_descriptor(void *cookiep);
+const int  *cnvlist_get_descriptor_array(void *cookiep, size_t 
*nitemsp);
+#endif
+
+
+/*
+ * The cnvlist_take functions returns value associated with the given cookie 
and
+ * remove the given entry from the nvlist.
+ * The caller is responsible for freeing received data.
+ */
+
+bool cnvlist_take_bool(nvlist_t *nvl, void *cookiep);
+uint64_t cnvlist_take_number(nvlist_t *nvl, void *cookiep);
+char*cnvlist_take_string(nvlist_t *nvl, void *cookiep);
+nvlist_t*cnvlist_take_nvlist(nvlist_t *nvl, void *cookiep);
+void*cnvlist_take_binary(nvlist_t *nvl, void *cookiep, 
size_t *sizep);
+bool*cnvlist_take_bool_array(nvlist_t *nvl, void *cookiep, 
size_t *nitemsp);
+uint64_t*cnvlist_take_number_array(nvlist_t *nvl, void 
*cookiep, size_t *nitemsp);
+char   **cnvlist_take_string_array(nvlist_t *nvl, void 
*cookiep, size_t *nitemsp);
+nvlist_t   **cnvlist_take_nvlist_array(nvlist_t *nvl, void 
*cookiep, size_t *nitemsp);
+#ifndef _KERNEL
+int  cnvlist_take_descriptor(nvlist_t *nvl, void *cookiep);
+int *cnvlist_take_descriptor_array(nvlist_t *nvl, void 
*cookiep, size_t *nitemsp);
+#endif
+
+/*
+ * The cnvlist_free functions removes the given name/value pair from the 
nvlist based on cookie
+ * and frees memory associated with it.
+ */
+
+void   cnvlist_free_bool(nvlist_t *nvl, void *cookiep);
+void   cnvlist_free_number(nvlist_t *nvl, void *cookiep);
+void   cnvlist_free_string(nvlist_t *nvl, void *cookiep);
+void   cnvlist_free_nvlist(nvlist_t *nvl, void *cookiep);
+void   cnvlist_free_binary(nvlist_t *nvl, void *cookiep);
+void   cnvlist_free_descriptor(nvlist_t *nvl, void *cookiep);
+void   cnvlist_free_bool_array(nvlist_

Re: svn commit: r304857 - head/sys/netinet/tcp_stacks

2016-08-27 Thread Hiren Panchasara
On 08/27/16 at 01:47P, Lawrence Stewart wrote:
> Pointy hat to: lstewart@
> 
> Apologies all for the breakage, thanks Hiren for fixing and apologies
> also for missing your email. For some reason your reply to my commit did
> not make it to my inbox and was filtered straight to my mailing list
> folder which is annoying - I must have introduced a bug in my
> .procmailrc at some point.

No worries. :-)
> 
> I don't understand why my buildkernel prior to commit succeeded though.
> Is fastpath not build by default?

Yeah, it's not since r301814.

Cheers,
Hiren


pgpqUa1i45yUI.pgp
Description: PGP signature


Re: svn commit: r304911 - head/lib/libc/net

2016-08-27 Thread Brooks Davis
On Sat, Aug 27, 2016 at 02:43:13PM +, Andrey A. Chernov wrote:
> Author: ache
> Date: Sat Aug 27 14:43:13 2016
> New Revision: 304911
> URL: https://svnweb.freebsd.org/changeset/base/304911
> 
> Log:
>   The formal behavior of qsort is unstable with regard to objects that
>   are equal. Unfortunately, RFC 3484 requires that otherwise equal objects
>   remain in the order supplied by the DNS server. The present code attempts
>   to deal with this by returning -1 for objects that are equal (i.e.,
>   returns that the first parameter is less then the second parameter).
>   Unfortunately, the qsort API does not state that the first parameter
>   passed in is in any particular position in the list.

Why not switch to mergesort which is stable by design?

-- Brooks


signature.asc
Description: PGP signature


svn commit: r304915 - head/share/man/man9

2016-08-27 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Aug 27 18:08:25 2016
New Revision: 304915
URL: https://svnweb.freebsd.org/changeset/base/304915

Log:
  Bump date in the man page.

Modified:
  head/share/man/man9/cnv.9

Modified: head/share/man/man9/cnv.9
==
--- head/share/man/man9/cnv.9   Sat Aug 27 16:01:10 2016(r304914)
+++ head/share/man/man9/cnv.9   Sat Aug 27 18:08:25 2016(r304915)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 26, 2016
+.Dd August 27, 2016
 .Dt CNV 9
 .Os
 .Sh NAME
___
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: r304916 - head/sys/kern

2016-08-27 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 27 18:12:42 2016
New Revision: 304916
URL: https://svnweb.freebsd.org/changeset/base/304916

Log:
  Consistently delimit each vnode description block with two blank
  lines.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/kern/vnode_if.src

Modified: head/sys/kern/vnode_if.src
==
--- head/sys/kern/vnode_if.src  Sat Aug 27 18:08:25 2016(r304915)
+++ head/sys/kern/vnode_if.src  Sat Aug 27 18:12:42 2016(r304916)
@@ -59,6 +59,7 @@ vop_islocked {
IN struct vnode *vp;
 };
 
+
 %% lookup  dvp L L L
 %% lookup  vpp - L -
 
@@ -72,6 +73,7 @@ vop_lookup {
IN struct componentname *cnp;
 };
 
+
 %% cachedlookupdvp L L L
 %% cachedlookupvpp - L -
 
@@ -83,6 +85,7 @@ vop_cachedlookup {
IN struct componentname *cnp;
 };
 
+
 %% create  dvp E E E
 %% create  vpp - L -
 %! create  postvop_create_post
@@ -177,12 +180,14 @@ vop_setattr {
IN struct ucred *cred;
 };
 
+
 %% markatime   vp  L L L
 
 vop_markatime {
IN struct vnode *vp;
 };
 
+
 %% readvp  L L L
 %! readpostvop_read_post
 
@@ -642,6 +647,7 @@ vop_allocate {
INOUT off_t *len;
 };
 
+
 %% advise  vp  U U U
 
 vop_advise {
@@ -651,6 +657,7 @@ vop_advise {
IN int advice;
 };
 
+
 %% unp_bindvp  E E E
 
 vop_unp_bind {
@@ -658,6 +665,7 @@ vop_unp_bind {
IN struct socket *socket;
 };
 
+
 %% unp_connect vp  L L L
 
 vop_unp_connect {
@@ -665,30 +673,35 @@ vop_unp_connect {
OUT struct socket **socket;
 };
 
+
 %% unp_detach  vp  = = =
 
 vop_unp_detach {
IN struct vnode *vp;
 };
 
+
 %% is_text vp  L L L
 
 vop_is_text {
IN struct vnode *vp;
 };
 
+
 %% set_textvp  E E E
 
 vop_set_text {
IN struct vnode *vp;
 };
 
+
 %% vop_unset_text  vp  E E E
 
 vop_unset_text {
IN struct vnode *vp;
 };
 
+
 %% get_writecount  vp  L L L
 
 vop_get_writecount {
@@ -696,6 +709,7 @@ vop_get_writecount {
OUT int *writecount;
 };
 
+
 %% add_writecount  vp  E E E
 
 vop_add_writecount {
@@ -703,6 +717,7 @@ vop_add_writecount {
IN int inc;
 };
 
+
 %% fdatasync   vp  L L L
 
 vop_fdatasync {
___
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: r304911 - head/lib/libc/net

2016-08-27 Thread Andrey Chernov
On 27.08.2016 20:37, Brooks Davis wrote:
> On Sat, Aug 27, 2016 at 02:43:13PM +, Andrey A. Chernov wrote:
>> Author: ache
>> Date: Sat Aug 27 14:43:13 2016
>> New Revision: 304911
>> URL: https://svnweb.freebsd.org/changeset/base/304911
>>
>> Log:
>>   The formal behavior of qsort is unstable with regard to objects that
>>   are equal. Unfortunately, RFC 3484 requires that otherwise equal objects
>>   remain in the order supplied by the DNS server. The present code attempts
>>   to deal with this by returning -1 for objects that are equal (i.e.,
>>   returns that the first parameter is less then the second parameter).
>>   Unfortunately, the qsort API does not state that the first parameter
>>   passed in is in any particular position in the list.
> 
> Why not switch to mergesort which is stable by design?

megresort() is 1) slower 2) requires additional memory allocated.



signature.asc
Description: OpenPGP digital signature


svn commit: r304918 - head/sys/cam/ata

2016-08-27 Thread Alexander Motin
Author: mav
Date: Sat Aug 27 19:51:37 2016
New Revision: 304918
URL: https://svnweb.freebsd.org/changeset/base/304918

Log:
  Decode some new ATA commands found in ACS-3.
  
  MFC after:1 week

Modified:
  head/sys/cam/ata/ata_all.c

Modified: head/sys/cam/ata/ata_all.c
==
--- head/sys/cam/ata/ata_all.c  Sat Aug 27 18:51:04 2016(r304917)
+++ head/sys/cam/ata/ata_all.c  Sat Aug 27 19:51:37 2016(r304918)
@@ -88,6 +88,7 @@ ata_op_string(struct ata_cmd *cmd)
}
return "DSM";
case 0x08: return ("DEVICE_RESET");
+   case 0x0b: return ("REQUEST_SENSE_DATA_EXT");
case 0x20: return ("READ");
case 0x24: return ("READ48");
case 0x25: return ("READ_DMA48");
@@ -120,6 +121,12 @@ ata_op_string(struct ata_cmd *cmd)
case 0x47: return ("READ_LOG_DMA_EXT");
case 0x4a: return ("ZAC_MANAGEMENT_IN");
case 0x51: return ("CONFIGURE_STREAM");
+   case 0x57: return ("WRITE_LOG_DMA_EXT");
+   case 0x5b: return ("TRUSTED_NON_DATA");
+   case 0x5c: return ("TRUSTED_RECEIVE");
+   case 0x5d: return ("TRUSTED_RECEIVE_DMA");
+   case 0x5e: return ("TRUSTED_SEND");
+   case 0x5f: return ("TRUSTED_SEND_DMA");
case 0x60: return ("READ_FPDMA_QUEUED");
case 0x61: return ("WRITE_FPDMA_QUEUED");
case 0x63:
@@ -160,9 +167,12 @@ ata_op_string(struct ata_cmd *cmd)
}
return ("SEP_ATTN");
case 0x70: return ("SEEK");
+   case 0x77: return ("SET_DATE_TIME_EXT");
+   case 0x78: return ("ACCESSIBLE_MAX_ADDRESS_CONFIGURATION");
case 0x87: return ("CFA_TRANSLATE_SECTOR");
case 0x90: return ("EXECUTE_DEVICE_DIAGNOSTIC");
case 0x92: return ("DOWNLOAD_MICROCODE");
+   case 0x93: return ("DOWNLOAD_MICROCODE_DMA");
case 0x9a: return ("ZAC_MANAGEMENT_OUT");
case 0xa0: return ("PACKET");
case 0xa1: return ("ATAPI_IDENTIFY");
@@ -180,6 +190,7 @@ ata_op_string(struct ata_cmd *cmd)
}
return ("SMART");
case 0xb1: return ("DEVICE CONFIGURATION");
+   case 0xb4: return ("SANITIZE_DEVICE");
case 0xc0: return ("CFA_ERASE");
case 0xc4: return ("READ_MUL");
case 0xc5: return ("WRITE_MUL");
___
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: r304919 - stable/11/release/doc/en_US.ISO8859-1/relnotes

2016-08-27 Thread Steven Kreuzer
Author: skreuzer (doc,ports committer)
Date: Sat Aug 27 20:08:34 2016
New Revision: 304919
URL: https://svnweb.freebsd.org/changeset/base/304919

Log:
  Document 292120, Update to ELF Tool Chain r3272
  
  Approved by:  re (gjb, implicit, relnotes)

Modified:
  stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Sat Aug 27 
19:51:37 2016(r304918)
+++ stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Sat Aug 27 
20:08:34 2016(r304919)
@@ -466,9 +466,9 @@
patches that add new relocations for &arch.powerpc;
support.
 
-  The
+  The
ELF Tool Chain has been updated to
-   upstream revision r3136.
+   upstream revision r3272.
 
   The texinfo
utility and info pages were removed from
___
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: r304920 - head/contrib/ncurses/ncurses/tinfo

2016-08-27 Thread Dimitry Andric
Author: dim
Date: Sat Aug 27 20:33:19 2016
New Revision: 304920
URL: https://svnweb.freebsd.org/changeset/base/304920

Log:
  In ncurses baudrate definitions, avoid warnings about implicit
  conversions from int to short changing the values.  This applies to
  B38400 and higher, since their values do not fit into a short.
  
  However, since the wrapped values are still unique, and they only serve
  as keys, there is no problem in adding a cast to silence the warnings.
  This also avoids changing the ABI, which would happen if we changed
  NCURSES_OSPEED to int.
  
  Discussed with:   Thomas Dickey
  MFC after:1 week

Modified:
  head/contrib/ncurses/ncurses/tinfo/lib_baudrate.c

Modified: head/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
==
--- head/contrib/ncurses/ncurses/tinfo/lib_baudrate.c   Sat Aug 27 20:08:34 
2016(r304919)
+++ head/contrib/ncurses/ncurses/tinfo/lib_baudrate.c   Sat Aug 27 20:33:19 
2016(r304920)
@@ -94,7 +94,7 @@ struct speed {
 int sp;/* the actual speed */
 };
 
-#define DATA(number) { B##number, number }
+#define DATA(number) { (NCURSES_OSPEED)B##number, number }
 
 static struct speed const speeds[] =
 {
___
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: r304921 - stable/11/usr.sbin/bsdinstall/scripts

2016-08-27 Thread Steven Kreuzer
Author: skreuzer (doc,ports committer)
Date: Sat Aug 27 20:43:52 2016
New Revision: 304921
URL: https://svnweb.freebsd.org/changeset/base/304921

Log:
  MFC r303877:
  
  Write kern.randompid to /etc/sysctl.conf
  
  Approved by:  allanjude

Modified:
  stable/11/usr.sbin/bsdinstall/scripts/hardening

Modified: stable/11/usr.sbin/bsdinstall/scripts/hardening
==
--- stable/11/usr.sbin/bsdinstall/scripts/hardening Sat Aug 27 20:33:19 
2016(r304920)
+++ stable/11/usr.sbin/bsdinstall/scripts/hardening Sat Aug 27 20:43:52 
2016(r304921)
@@ -29,6 +29,7 @@
 : ${DIALOG_OK=0}
 
 echo -n > $BSDINSTALL_TMPETC/rc.conf.hardening
+echo -n > $BSDINSTALL_TMPETC/sysctl.conf.hardening
 
 exec 3>&1
 FEATURES=$( dialog --backtitle "FreeBSD Installer" \
@@ -39,7 +40,7 @@ FEATURES=$( dialog --backtitle "FreeBSD 
"hide_gids" "Hide processes running as other groups" ${hide_gids:-off} \
"read_msgbuf" "Disable reading kernel message buffer for unprivileged 
users" ${read_msgbuf:-off} \
"proc_debug" "Disable process debugging facilities for unprivileged 
users" ${proc_debug:-off} \
-   "random_pid" "Randomize the PID of newly created processes" 
${random_id:-off} \
+   "random_pid" "Randomize the PID of newly created processes" 
${random_pid:-off} \
"stack_guard" "Insert stack guard page ahead of the growable segments" 
${stack_guard:-off} \
"clear_tmp" "Clean the /tmp filesystem on system startup" 
${clear_tmp:-off} \
"disable_syslogd" "Disable opening Syslogd network socket (disables 
remote logging)" ${disable_syslogd:-off} \
@@ -60,7 +61,7 @@ for feature in $FEATURES; do
if [ "$feature" = "proc_debug" ]; then
echo security.bsd.unprivileged_proc_debug=0 >> 
$BSDINSTALL_TMPETC/sysctl.conf.hardening
fi
-   if [ "$feature" = "random_id" ]; then
+   if [ "$feature" = "random_pid" ]; then
echo kern.randompid=$(jot -r 1 ) >> 
$BSDINSTALL_TMPETC/sysctl.conf.hardening
fi
if [ "$feature" = "stack_guard" ]; then
___
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: r304922 - stable/11/sys/vm

2016-08-27 Thread Alan Cox
Author: alc
Date: Sat Aug 27 21:31:00 2016
New Revision: 304922
URL: https://svnweb.freebsd.org/changeset/base/304922

Log:
  MFC r303747,303982
Correct errors and clean up the comments on the active queue scan.
  
Eliminate some unnecessary blank lines.
  
Clean up the comments and code style in and around vm_pageout_cluster().
In particular, fix factual, grammatical, and spelling errors in various
comments, and remove comments that are out of place in this function.

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

Modified: stable/11/sys/vm/vm_pageout.c
==
--- stable/11/sys/vm/vm_pageout.c   Sat Aug 27 20:43:52 2016
(r304921)
+++ stable/11/sys/vm/vm_pageout.c   Sat Aug 27 21:31:00 2016
(r304922)
@@ -355,41 +355,28 @@ vm_pageout_page_lock(vm_page_t m, vm_pag
 }
 
 /*
- * vm_pageout_clean:
- *
- * Clean the page and remove it from the laundry.
- * 
- * We set the busy bit to cause potential page faults on this page to
- * block.  Note the careful timing, however, the busy bit isn't set till
- * late and we cannot do anything that will mess with the page.
+ * Scan for pages at adjacent offsets within the given page's object that are
+ * eligible for laundering, form a cluster of these pages and the given page,
+ * and launder that cluster.
  */
 static int
 vm_pageout_cluster(vm_page_t m)
 {
vm_object_t object;
-   vm_page_t mc[2*vm_pageout_page_count], pb, ps;
-   int pageout_count;
-   int ib, is, page_base;
-   vm_pindex_t pindex = m->pindex;
+   vm_page_t mc[2 * vm_pageout_page_count], p, pb, ps;
+   vm_pindex_t pindex;
+   int ib, is, page_base, pageout_count;
 
-   vm_page_lock_assert(m, MA_OWNED);
+   vm_page_assert_locked(m);
object = m->object;
VM_OBJECT_ASSERT_WLOCKED(object);
+   pindex = m->pindex;
 
/*
-* It doesn't cost us anything to pageout OBJT_DEFAULT or OBJT_SWAP
-* with the new swapper, but we could have serious problems paging
-* out other object types if there is insufficient memory.  
-*
-* Unfortunately, checking free memory here is far too late, so the
-* check has been moved up a procedural level.
-*/
-
-   /*
-* Can't clean the page if it's busy or held.
+* We can't clean the page if it is busy or held.
 */
vm_page_assert_unbusied(m);
-   KASSERT(m->hold_count == 0, ("vm_pageout_clean: page %p is held", m));
+   KASSERT(m->hold_count == 0, ("page %p is held", m));
vm_page_unlock(m);
 
mc[vm_pageout_page_count] = pb = ps = m;
@@ -399,33 +386,23 @@ vm_pageout_cluster(vm_page_t m)
is = 1;
 
/*
-* Scan object for clusterable pages.
-*
-* We can cluster ONLY if: ->> the page is NOT
-* clean, wired, busy, held, or mapped into a
-* buffer, and one of the following:
-* 1) The page is inactive, or a seldom used
-*active page.
-* -or-
-* 2) we force the issue.
+* We can cluster only if the page is not clean, busy, or held, and
+* the page is inactive.
 *
 * During heavy mmap/modification loads the pageout
 * daemon can really fragment the underlying file
-* due to flushing pages out of order and not trying
-* align the clusters (which leave sporatic out-of-order
+* due to flushing pages out of order and not trying to
+* align the clusters (which leaves sporadic out-of-order
 * holes).  To solve this problem we do the reverse scan
 * first and attempt to align our cluster, then do a 
 * forward scan if room remains.
 */
 more:
-   while (ib && pageout_count < vm_pageout_page_count) {
-   vm_page_t p;
-
+   while (ib != 0 && pageout_count < vm_pageout_page_count) {
if (ib > pindex) {
ib = 0;
break;
}
-
if ((p = vm_page_prev(pb)) == NULL || vm_page_busied(p)) {
ib = 0;
break;
@@ -446,18 +423,16 @@ more:
mc[--page_base] = pb = p;
++pageout_count;
++ib;
+
/*
-* alignment boundary, stop here and switch directions.  Do
-* not clear ib.
+* We are at an alignment boundary.  Stop here, and switch
+* directions.  Do not clear ib.
 */
if ((pindex - (ib - 1)) % vm_pageout_page_count == 0)
break;
}
-
while (pageout_count < vm_pageout_page_count && 
pindex + is < object->size) {
-   vm_page_t p;
-
if ((p = vm_page_next(ps)) == NULL || vm_page_busied(p))
  

svn commit: r304923 - stable/11/release/doc/en_US.ISO8859-1/relnotes

2016-08-27 Thread Steven Kreuzer
Author: skreuzer (doc,ports committer)
Date: Sat Aug 27 21:32:56 2016
New Revision: 304923
URL: https://svnweb.freebsd.org/changeset/base/304923

Log:
  Document r299142, Native PCIe Hotplug support
  Document r298166, libucl has been updated to version 0.8.0
  Document r302288, Enable indirect segment I/O by default when running on EC2
  Document r302265, Allow ZFS ARC min / max to be tuned at runtime
  
  Approved by:  re (gjb, implicit, relnotes)

Modified:
  stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Sat Aug 27 
21:31:00 2016(r304922)
+++ stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Sat Aug 27 
21:32:56 2016(r304923)
@@ -602,6 +602,9 @@
   OpenBSM has been
updated to version 1.2 alpha 4.
 
+  libucl has
+   been updated to version 0.8.0.
+
   The NetBSD
Project's &man.libblacklist.3; library and applications
have been ported and integrated into the system.  Packet
@@ -1310,6 +1313,10 @@
 
   Hardware Support
 
+  Native PCI-express HotPlug
+   support is enabled by default on &arch.amd64;, &arch.arm64; and
+   &arch.powerpc;
+
   The &man.asmc.4; driver has been
updated to support the &apple; MacMini 3,1.
 
@@ -1445,6 +1452,9 @@
   The &man.xen.4; driver has been updated
to include support for blkif indirect
segment I/O.
+
+  Indirect segment I/O is enabled by default
+   in the Xen blkfront driver when running on AWS EC2.
 
 
 
@@ -1613,6 +1623,10 @@
sponsor="&ix;, &spectralogic;">The zfsd daemon has been added,
which manages hotspares and replements in drive slots that publish
physical paths.
+
+  The
+   minimum and maximum values for the ZFS adaptive replacement
+   cache can be modified at runtime.
 
 
 
___
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: r304927 - head/sys/kern

2016-08-27 Thread Mateusz Guzik
Author: mjg
Date: Sat Aug 27 22:43:41 2016
New Revision: 304927
URL: https://svnweb.freebsd.org/changeset/base/304927

Log:
  vfs: provide a common exit point in namei for error cases
  
  This shortens the function, adds the SDT_PROBE use for error cases and
  consistenly unrefs rootdir last.
  
  Reviewed by:  kib
  MFC after:2 weeks

Modified:
  head/sys/kern/vfs_lookup.c

Modified: head/sys/kern/vfs_lookup.c
==
--- head/sys/kern/vfs_lookup.c  Sat Aug 27 22:23:10 2016(r304926)
+++ head/sys/kern/vfs_lookup.c  Sat Aug 27 22:43:41 2016(r304927)
@@ -295,21 +295,15 @@ namei(struct nameidata *ndp)
if (error != 0) {
if (dp != NULL)
vrele(dp);
-   vrele(ndp->ni_rootdir);
-   namei_cleanup_cnp(cnp);
-   return (error);
+   goto out;
}
SDT_PROBE3(vfs, namei, lookup, entry, dp, cnp->cn_pnbuf,
cnp->cn_flags);
for (;;) {
ndp->ni_startdir = dp;
error = lookup(ndp);
-   if (error != 0) {
-   vrele(ndp->ni_rootdir);
-   namei_cleanup_cnp(cnp);
-   SDT_PROBE2(vfs, namei, lookup, return, error, NULL);
-   return (error);
-   }
+   if (error != 0)
+   goto out;
/*
 * If not a symbolic link, we're done.
 */
@@ -383,18 +377,16 @@ namei(struct nameidata *ndp)
if (*(cnp->cn_nameptr) == '/') {
vrele(dp);
error = namei_handle_root(ndp, &dp);
-   if (error != 0) {
-   vrele(ndp->ni_rootdir);
-   namei_cleanup_cnp(cnp);
-   return (error);
-   }
+   if (error != 0)
+   goto out;
}
}
-   vrele(ndp->ni_rootdir);
-   namei_cleanup_cnp(cnp);
vput(ndp->ni_vp);
ndp->ni_vp = NULL;
vrele(ndp->ni_dvp);
+out:
+   vrele(ndp->ni_rootdir);
+   namei_cleanup_cnp(cnp);
SDT_PROBE2(vfs, namei, lookup, return, error, NULL);
return (error);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 27 23:03:23 2016
New Revision: 304928
URL: https://svnweb.freebsd.org/changeset/base/304928

Log:
  Do not obliterate errno value in the main thread during ptrace(2) call on x86.
  
  Since ptrace(2) syscall can return -1 for non-error situations, libc
  wrappers set errno to 0 before performing the syscall, as the service
  to the caller.  On both i386 and amd64, the errno symbol was directly
  referenced, which only works correctly in single-threaded process.
  
  Change assembler wrappers for ptrace(2) to get current thread errno
  location by calling __error().  Allow __error interposing, as
  currently allowed in cerror().
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/lib/libc/amd64/sys/ptrace.S
  head/lib/libc/i386/sys/ptrace.S
  head/lib/libc/sys/ptrace.2

Modified: head/lib/libc/amd64/sys/ptrace.S
==
--- head/lib/libc/amd64/sys/ptrace.SSat Aug 27 22:43:41 2016
(r304927)
+++ head/lib/libc/amd64/sys/ptrace.SSat Aug 27 23:03:23 2016
(r304928)
@@ -38,14 +38,16 @@ __FBSDID("$FreeBSD$");
 
 #include "SYS.h"
 
+   .globl  CNAME(__error)
+   .type   CNAME(__error),@function
+
 ENTRY(ptrace)
-   xorl%eax,%eax
 #ifdef PIC
-   movqPIC_GOT(CNAME(errno)),%r8
-   movl%eax,(%r8)
+   callq   PIC_PLT(CNAME(__error))
 #else
-   movl%eax,CNAME(errno)(%rip)
+   callq   CNAME(__error)
 #endif
+   movl$0,(%rax)
mov $SYS_ptrace,%eax
KERNCALL
jb  HIDENAME(cerror)

Modified: head/lib/libc/i386/sys/ptrace.S
==
--- head/lib/libc/i386/sys/ptrace.S Sat Aug 27 22:43:41 2016
(r304927)
+++ head/lib/libc/i386/sys/ptrace.S Sat Aug 27 23:03:23 2016
(r304928)
@@ -38,16 +38,18 @@ __FBSDID("$FreeBSD$");
 
 #include "SYS.h"
 
+   .globl  CNAME(__error)
+   .type   CNAME(__error),@function
+
 ENTRY(ptrace)
-   xorl%eax,%eax
 #ifdef PIC
-PIC_PROLOGUE
-movlPIC_GOT(CNAME(errno)),%edx
-movl%eax,(%edx)
-PIC_EPILOGUE
+   PIC_PROLOGUE
+   callPIC_PLT(CNAME(__error))
+   PIC_EPILOGUE
 #else
-movl%eax,CNAME(errno)
+   callCNAME(__error)
 #endif
+   movl$0,(%eax)
mov $SYS_ptrace,%eax
KERNCALL
jb  HIDENAME(cerror)

Modified: head/lib/libc/sys/ptrace.2
==
--- head/lib/libc/sys/ptrace.2  Sat Aug 27 22:43:41 2016(r304927)
+++ head/lib/libc/sys/ptrace.2  Sat Aug 27 23:03:23 2016(r304928)
@@ -2,7 +2,7 @@
 .\"$NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
 .\"
 .\" This file is in the public domain.
-.Dd July 28, 2016
+.Dd August 28, 2016
 .Dt PTRACE 2
 .Os
 .Sh NAME
@@ -906,7 +906,13 @@ to return
 \-1
 as a non-error value; to disambiguate,
 .Va errno
-can be set to 0 before the call and checked afterwards.
+is set to 0 in the libc wrapper for the
+.Fn ptrace
+system call and
+.Fn ptrace
+callers can reliably check
+.Va errno
+for non-zero value afterwards.
 .Sh ERRORS
 The
 .Fn ptrace
___
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: r304929 - stable/11/release/doc/en_US.ISO8859-1/relnotes

2016-08-27 Thread Steven Kreuzer
Author: skreuzer (doc,ports committer)
Date: Sun Aug 28 00:12:45 2016
New Revision: 304929
URL: https://svnweb.freebsd.org/changeset/base/304929

Log:
  Document r299142, The leap-seconds file has been updated to
leap-seconds.3676752000
  Document r302177, WITH_SYSTEM_COMPILER: Enable by default
  Document r304246, PCIe HotPlug: Detect bridges that are not really
HotPlug capable
  Document r301565, Switch arm64 to use intrng by default
  Document r299781, Support for the Allwinner Reduced Serial Bus (RSB)
  Document r296064, Support for Allwinner A20 HDMI
  Document r299393, Default installation directory for modules is /boot/modules
  Document r303716, Drop SSH1 support
  Document r303719, Disable DSA by default
  Document r297633, RCTL resources for limited filesystem IO
  Document r300723, Mellanox implementation of iSER
  Document r299848, Allow reroot to NFS
  Document r301033, Discovery without attaching support in iscsictl
  Document r299371, camcontrol reprobe
  Document r295212, Add an additional, libucl-based configuration file parser
to ctld
  Document r287842, Change default regulatory domain from DEBUG to FCC in 
ifconfig
  Document r301875, The SIOCSIFALIFETIME_IN6 ioctl has been removed
  
  Approved by:  re (gjb, implicit, relnotes)

Modified:
  stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Sat Aug 27 
23:03:23 2016(r304928)
+++ stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Sun Aug 28 
00:12:45 2016(r304929)
@@ -175,8 +175,15 @@
   The MK_ARM_EABI
&man.src.conf.5; option has been removed.
 
+  The WITH_SYSTEM_COMPILER
+   &man.src.conf.5; option is enabled by default.
+
   The ntp suite
has been updated to version 4.2.8p8.
+
+  The
+  /etc/ntp/leap-seconds
+   has been updated to version 3676752000.
 
 
 
@@ -443,10 +450,11 @@
falling back to the PCI ID database in the &os; base
system.
 
-  The &man.ifconfig.8; utility has been
-   updated to always exit with an error code if an important
-   &man.ioctl.2; fails.
+  By default the &man.ifconfig.8; utility
+   will set the default regulatory domain to FCC
+   on wireless interfaces. As a result, newly created wireless
+   interfaces with default settings will have less chances to
+   violate country-specific regulations.
 
 
 
@@ -458,6 +466,12 @@
   OpenSSH has
been updated to 7.2p2.
 
+  SSHv1 support has been removed from
+   OpenSSH.
+
+  Support for DSA is disabled by default in
+   OpenSSH.
+
   mdocml has
been updated to version 1.12.3.
 
@@ -1030,6 +1044,10 @@
To retain the previous behavior, add
KERN_DEBUGDIR="" to
&man.src.conf.5;.
+
+  &arch.arm64; has been switched over to using
+   INTRNG by default.
 
 
 
@@ -1317,6 +1335,9 @@
support is enabled by default on &arch.amd64;, &arch.arm64; and
&arch.powerpc;
 
+  PCI-express HotPlug support has been
+  enabled for slots with power controllers
+
   The &man.asmc.4; driver has been
updated to support the &apple; MacMini 3,1.
 
@@ -1530,6 +1551,11 @@
interrupts on AXP209 power management integrated circuits have been
added.
 
+  Support for the Allwinner
+   Reduced Serial Bus (RSB) has been added.
+
+  Support for Allwinner A20 HDMI
+   has been added.
 
   
 
@@ -1551,6 +1577,10 @@
&man.ctld.8; utility has been updated to allow controlling
non-iSCSI &man.ctl.4; ports.
 
+  Support
+   for parsing libucl-based configuration files has been added to
+   &man.ctld.8;.
+
   The
&man.autofs.5; subsystem has been updated to include a new
&man.auto.master.5; map, -media, which
@@ -1581,6 +1611,9 @@
Support for managing Shingled Magnetic Recording (SMR) drives
has been added.
 
+  The
+   &man.camcontrol.8; command can manually force updating capacity
+   data after a disk gets resized using the reprobe subcommand.
 
 
 
@@ -1600,6 +1633,13 @@
for the timeo, actimeo,
noac, and proto options
have been added to &man.mount.nfs.8;.
+
+  The Mellanox implementation of iSER (iSCSI
+   Extensions for RDMA) has been imported.
+
+  The ability to discover iSCSI targets without
+   having to attach to a target has been added to the
+   &man.iscsictl.8; command.
 
 
 
@@ -1627,6 +1667,10 @@
   The
minimum and maximum values for the ZFS adaptive replacement
cache can be modified at runtime.
+
+  Four new
+   resources have been added to &man.rctl.8; to allow
+   throttles 

svn commit: r304930 - stable/11/release/doc/en_US.ISO8859-1/relnotes

2016-08-27 Thread Steven Kreuzer
Author: skreuzer (doc,ports committer)
Date: Sun Aug 28 00:21:24 2016
New Revision: 304930
URL: https://svnweb.freebsd.org/changeset/base/304930

Log:
  Remove stale items
  
  Approved by:  re (gjb, implicit, relnotes)

Modified:
  stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Sun Aug 28 
00:12:45 2016(r304929)
+++ stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Sun Aug 28 
00:21:24 2016(r304930)
@@ -201,35 +201,9 @@
to restrict the output to only listing details about a single
device.
 
-  A new flag, onifconsole
-   has been added to /etc/ttys.  This allows
-   the system to provide a login prompt via serial console if the
-   device is an active kernel console, otherwise it is equivalent
-   to off.
-
   Support for displaying VPD for PCI
devices via &man.pciconf.8; has been added.
 
-  &man.ping.8; protects against malicious
-   network packets using the Capsicum framework to drop
-   privileges.
-
-  The &man.ps.1; utility has been
-   updated to include the -J flag, used to
-   filter output by matching &man.jail.8; IDs and names.
-   Additionally, argument 0 can be used to
-   -J to only list processes running on the
-   host system.
-
-  The &man.top.1; utility has been updated
-   to filter by &man.jail.8; ID or name, in followup to the
-   &man.ps.1; change in r265229.
-
-  The &man.pmcstat.8; utility has been
-   updated to include a new flag, -l, which
-   ends event collection after the specified number of
-   seconds.
-
   The &man.ps.1; utility has been updated
to include a new keyword, tracer, which
displays the PID of the tracing
___
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: r304931 - head/lib/libc/amd64/sys

2016-08-27 Thread Konstantin Belousov
Author: kib
Date: Sun Aug 28 00:26:06 2016
New Revision: 304931
URL: https://svnweb.freebsd.org/changeset/base/304931

Log:
  Follow ABI when calling __error from the ptrace(2) wrapper.
  
  In particular, preserve syscall arguments on stack, since callee is
  not required to preserve arg-passing registers.  Align stack.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/lib/libc/amd64/sys/ptrace.S

Modified: head/lib/libc/amd64/sys/ptrace.S
==
--- head/lib/libc/amd64/sys/ptrace.SSun Aug 28 00:21:24 2016
(r304930)
+++ head/lib/libc/amd64/sys/ptrace.SSun Aug 28 00:26:06 2016
(r304931)
@@ -42,11 +42,21 @@ __FBSDID("$FreeBSD$");
.type   CNAME(__error),@function
 
 ENTRY(ptrace)
+   pushq   %rdi/* align stack */
+   pushq   %rdi
+   pushq   %rsi
+   pushq   %rdx
+   pushq   %rcx
 #ifdef PIC
callq   PIC_PLT(CNAME(__error))
 #else
callq   CNAME(__error)
 #endif
+   popq%rcx
+   popq%rdx
+   popq%rsi
+   popq%rdi
+   popq%rdi
movl$0,(%rax)
mov $SYS_ptrace,%eax
KERNCALL
___
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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Andrey Chernov
On 28.08.2016 2:03, Konstantin Belousov wrote:
>   Since ptrace(2) syscall can return -1 for non-error situations, libc
>   wrappers set errno to 0 before performing the syscall, as the service
>   to the caller.

Both C99 and POSIX directly prohibits any standard function to set errno
to 0. ptrace() should either choose other errno to indicate non-error
situation or change return -1 to something 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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Andrey Chernov
On 28.08.2016 3:38, Andrey Chernov wrote:
> On 28.08.2016 2:03, Konstantin Belousov wrote:
>>   Since ptrace(2) syscall can return -1 for non-error situations, libc
>>   wrappers set errno to 0 before performing the syscall, as the service
>>   to the caller.
> 
> Both C99 and POSIX directly prohibits any standard function to set errno
> to 0. ptrace() should either choose other errno to indicate non-error
> situation or change return -1 to something else.
> 
...and don't touch errno.

POSIX: "No function in this volume of POSIX.1-2008 shall set errno to zero."

> On both i386 and amd64, the errno symbol was directly
> referenced, which only works correctly in single-threaded process.

POSIX: "For each thread of a process, the value of errno shall not be
affected by function calls or assignments to errno by other threads."
___
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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Konstantin Belousov
On Sun, Aug 28, 2016 at 03:38:10AM +0300, Andrey Chernov wrote:
> On 28.08.2016 2:03, Konstantin Belousov wrote:
> >   Since ptrace(2) syscall can return -1 for non-error situations, libc
> >   wrappers set errno to 0 before performing the syscall, as the service
> >   to the caller.
> 
> Both C99 and POSIX directly prohibits any standard function to set errno
> to 0. ptrace() should either choose other errno to indicate non-error
> situation or change return -1 to something else.
> 
ptrace(2) is not a standard function.
And, we cannot break ABI for the syscall.
___
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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Andrey Chernov
On 28.08.2016 3:56, Konstantin Belousov wrote:
> On Sun, Aug 28, 2016 at 03:38:10AM +0300, Andrey Chernov wrote:
>> On 28.08.2016 2:03, Konstantin Belousov wrote:
>>>   Since ptrace(2) syscall can return -1 for non-error situations, libc
>>>   wrappers set errno to 0 before performing the syscall, as the service
>>>   to the caller.
>>
>> Both C99 and POSIX directly prohibits any standard function to set errno
>> to 0. ptrace() should either choose other errno to indicate non-error
>> situation or change return -1 to something else.
>>
> ptrace(2) is not a standard function.
> And, we cannot break ABI for the syscall.
> 

C99 statement sounds stricter:
"The value of errno is zero at program startup, but is never set to zero
by any library function. 176)"
And syscall is not different from library function from C99 point of view.

___
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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Andrey Chernov
On 28.08.2016 4:04, Andrey Chernov wrote:
> On 28.08.2016 3:56, Konstantin Belousov wrote:
>> On Sun, Aug 28, 2016 at 03:38:10AM +0300, Andrey Chernov wrote:
>>> On 28.08.2016 2:03, Konstantin Belousov wrote:
   Since ptrace(2) syscall can return -1 for non-error situations, libc
   wrappers set errno to 0 before performing the syscall, as the service
   to the caller.
>>>
>>> Both C99 and POSIX directly prohibits any standard function to set errno
>>> to 0. ptrace() should either choose other errno to indicate non-error
>>> situation or change return -1 to something else.
>>>
>> ptrace(2) is not a standard function.
>>
> 
> C99 statement sounds stricter:
> "The value of errno is zero at program startup, but is never set to zero
> by any library function. 176)"
> And syscall is not different from library function from C99 point of view.
> 

>> And, we cannot break ABI for the syscall.

We can fix already broken (from standards point of view) ABI for the
syscall.

___
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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Konstantin Belousov
On Sun, Aug 28, 2016 at 03:50:04AM +0300, Andrey Chernov wrote:
> On 28.08.2016 3:38, Andrey Chernov wrote:
> > On 28.08.2016 2:03, Konstantin Belousov wrote:
> >>   Since ptrace(2) syscall can return -1 for non-error situations, libc
> >>   wrappers set errno to 0 before performing the syscall, as the service
> >>   to the caller.
> > 
> > Both C99 and POSIX directly prohibits any standard function to set errno
> > to 0. ptrace() should either choose other errno to indicate non-error
> > situation or change return -1 to something else.
> > 
> ...and don't touch errno.
> 
> POSIX: "No function in this volume of POSIX.1-2008 shall set errno to zero."
I am quite curious where ptrace(2) is defined by POSIX.

> 
> > On both i386 and amd64, the errno symbol was directly
> > referenced, which only works correctly in single-threaded process.
> 
> POSIX: "For each thread of a process, the value of errno shall not be
> affected by function calls or assignments to errno by other threads."
And ?  What should the citation add new to the substance
of the code change ?

On Sun, Aug 28, 2016 at 04:04:00AM +0300, Andrey Chernov wrote:
> On 28.08.2016 3:56, Konstantin Belousov wrote:
> > On Sun, Aug 28, 2016 at 03:38:10AM +0300, Andrey Chernov wrote:
> >> On 28.08.2016 2:03, Konstantin Belousov wrote:
> >>>   Since ptrace(2) syscall can return -1 for non-error situations, libc
> >>>   wrappers set errno to 0 before performing the syscall, as the service
> >>>   to the caller.
> >>
> >> Both C99 and POSIX directly prohibits any standard function to set errno
> >> to 0. ptrace() should either choose other errno to indicate non-error
> >> situation or change return -1 to something else.
> >>
> > ptrace(2) is not a standard function.
> > And, we cannot break ABI for the syscall.
> > 
> 
> C99 statement sounds stricter:
> "The value of errno is zero at program startup, but is never set to zero
> by any library function. 176)"
> And syscall is not different from library function from C99 point of view.
Point me to a single line in C99 which mentions ptrace().

Do you understand what did the commit changed, and what it did not ?
Setting errno to zero before the syscall was the existing behaviour
before the change, and I did not modified anything there. But previous
wrapper set errno to zero in main thread even if called from some other
thread, which was the bug fixed.
___
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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Andrey Chernov
On 28.08.2016 4:15, Konstantin Belousov wrote:
>> POSIX: "No function in this volume of POSIX.1-2008 shall set errno to zero."
> I am quite curious where ptrace(2) is defined by POSIX.

POSIX just repeats C99 statement for its own functions, supporting this
rule too, but C99 rule is more general and related to any library functions.

>> POSIX: "For each thread of a process, the value of errno shall not be
>> affected by function calls or assignments to errno by other threads."
> And ?  What should the citation add new to the substance
> of the code change ?

This is for your comment "On both i386 and amd64, the errno symbol was
directly  referenced, which only works correctly in single-threaded
process."

>> C99 statement sounds stricter:
>> "The value of errno is zero at program startup, but is never set to zero
>> by any library function. 176)"
>> And syscall is not different from library function from C99 point of view.
> Point me to a single line in C99 which mentions ptrace().
> 
> Do you understand what did the commit changed, and what it did not ?
> Setting errno to zero before the syscall was the existing behaviour
> before the change, and I did not modified anything there. But previous
> wrapper set errno to zero in main thread even if called from some other
> thread, which was the bug fixed.

If you may notice, I don't blame you and don't say that you introduce
setting errno to 0. I just want to bring your attention to the problem
while you are in that area and familiar with it.


___
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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Andrey Chernov
On 28.08.2016 4:25, Andrey Chernov wrote:
>> Point me to a single line in C99 which mentions ptrace().

Already done: ptrace == "any library function".


___
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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Andrey Chernov
On 28.08.2016 4:37, Andrey Chernov wrote:
> On 28.08.2016 4:25, Andrey Chernov wrote:
>>> Point me to a single line in C99 which mentions ptrace().
> 
> Already done: ptrace == "any library function".

To elaborate it more, C99 does not have finite list of library
functions, but it says about standard libraries in general (not user
libraries), and ptrace() belongs to standard library according to its
manpage:
Standard C Library (libc, -lc)

___
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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Konstantin Belousov
On Sun, Aug 28, 2016 at 04:25:46AM +0300, Andrey Chernov wrote:
> On 28.08.2016 4:15, Konstantin Belousov wrote:
> >> POSIX: "No function in this volume of POSIX.1-2008 shall set errno to 
> >> zero."
> > I am quite curious where ptrace(2) is defined by POSIX.
> 
> POSIX just repeats C99 statement for its own functions, supporting this
> rule too, but C99 rule is more general and related to any library functions.
> 
> >> POSIX: "For each thread of a process, the value of errno shall not be
> >> affected by function calls or assignments to errno by other threads."
> > And ?  What should the citation add new to the substance
> > of the code change ?
> 
> This is for your comment "On both i386 and amd64, the errno symbol was
> directly  referenced, which only works correctly in single-threaded
> process."
I still do not understand what you want to say there. Errno as the
symbol existing in the symbol table of libc, gives 'POSIX errno' value
for the main thread. Preprocessor definition converts C language
accesses to errno into some indirections which result in accesses to
per-thread errno location. The bug in x86 asm code was due to direct
usage of errno.

What POSIX requires from the C-level errno symbol does not define a
semantic for the memory location pointed to by the errno sym-table
symbol.

And amusingly, all other arches did it right, except aarch64 and risc-v
copied from aarch64.  They lack the wrapper at all, I wrote aarch64
ptrace.S already.

> 
> >> C99 statement sounds stricter:
> >> "The value of errno is zero at program startup, but is never set to zero
> >> by any library function. 176)"
> >> And syscall is not different from library function from C99 point of view.
> > Point me to a single line in C99 which mentions ptrace().
> > 
> > Do you understand what did the commit changed, and what it did not ?
> > Setting errno to zero before the syscall was the existing behaviour
> > before the change, and I did not modified anything there. But previous
> > wrapper set errno to zero in main thread even if called from some other
> > thread, which was the bug fixed.
> 
> If you may notice, I don't blame you and don't say that you introduce
> setting errno to 0. I just want to bring your attention to the problem
> while you are in that area and familiar with it.
> 
I know that POSIX requires that POSIX-defined functions did not modified
errno except on error, but it cannot require anything from functions
which are not defined by the standard.  I agree that it would be more
consistent for ptrace(2) to not do that as well, but the behaviour is
already there for 35 years and I do not view the 'consistency' as a serious
reason to break ABI and introduce random failures for innocent consumers
of it.

On Sun, Aug 28, 2016 at 04:37:11AM +0300, Andrey Chernov wrote:
> On 28.08.2016 4:25, Andrey Chernov wrote:
> >> Point me to a single line in C99 which mentions ptrace().
> 
> Already done: ptrace == "any library function".
*Shaking head*

'Library functions' references in the context of C99/C11 are implicitely
limited to the functions defined by the chapter 7 Library of the standard.

To play this sillyness to the end, please answer whether I am allowed to
provide static functions definitions in the libraries headers ? E.g. clause
7.1.2 6 of C11 says:
Any declaration of a library function shall have external linkage.
___
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: r304436 - in head: . sys/netinet

2016-08-27 Thread Adrian Chadd
On 26 August 2016 at 17:46, Slawa Olhovchenkov  wrote:
> On Fri, Aug 26, 2016 at 04:55:34PM -0700, Adrian Chadd wrote:
>
>> Hi,
>>
>> I use the kernel lock profiling debugging,
>
> I am already have 100% utilise all CPU cores, I think this is drop
> performance?
>
>> but you can use dtrace to
>> get an idea:
>>
>> dtrace -n 'lockstat:::adaptive-block { @[stack()] = sum(arg1); }'
>
> How to interpret results (how to distinct lock contention from lock
> cost/overhead (LOCK CMPXCGQ is very expensive))?

well, paste the results? :)

the lock is expensive because it's contended. :)


-a

>> (https://wiki.freebsd.org/DTrace/One-Liners)
>>
>>
>>
>> -adrian
___
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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Andrey Chernov
On 28.08.2016 4:52, Konstantin Belousov wrote:
 POSIX: "For each thread of a process, the value of errno shall not be
 affected by function calls or assignments to errno by other threads."
>>> And ?  What should the citation add new to the substance
>>> of the code change ?
>>
>> This is for your comment "On both i386 and amd64, the errno symbol was
>> directly  referenced, which only works correctly in single-threaded
>> process."
> I still do not understand what you want to say there. Errno as the
> symbol existing in the symbol table of libc, gives 'POSIX errno' value
> for the main thread. Preprocessor definition converts C language
> accesses to errno into some indirections which result in accesses to
> per-thread errno location. The bug in x86 asm code was due to direct
> usage of errno.

This particular quote is not describing a problem, it supports your change.

> I know that POSIX requires that POSIX-defined functions did not modified
> errno except on error, 

POSIX don't say it. You may modify errno to any value besides 0 while
returning success from the function excepting only those functions where
POSIX directly states they can't modify errno. I.e. only 0 is disallowed
in all cases.

> I agree that it would be more
> consistent for ptrace(2) to not do that as well, but the behaviour is
> already there for 35 years and I do not view the 'consistency' as a serious
> reason to break ABI and introduce random failures for innocent consumers
> of it.

How hard it will be to bring ptrace() to what C99 expects? Perhaps now
time is suited well to change some obsoleted things.

>> Already done: ptrace == "any library function".
> *Shaking head*
> 
> 'Library functions' references in the context of C99/C11 are implicitely
> limited to the functions defined by the chapter 7 Library of the standard.

No, they are limited to the libraries described in ISO/IEC International
Standards family which have C standard library among them. C standard
library described in ANSI C standard which is:
ISO/IEC (1999). ISO/IEC 9899:1999(E): Programming Languages.
libc is C standard library with extensions, and C99 directly says about
them:

"conforming implementation may have extensions (including additional
library functions), provided they do not alter the behavior of any
strictly conforming program.3)"

ptrace() is extension (additional library function) so can't set errno
to 0 (it breaks strictly conforming program).

> To play this sillyness to the end, please answer whether I am allowed to
> provide static functions definitions in the libraries headers ? E.g. clause
> 7.1.2 6 of C11 says:
> Any declaration of a library function shall have external linkage.

You can, as long as your static function (i.e. extension) do not alter
the behavior of any strictly conforming program (see the quote above).


___
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: r304932 - head/sys/mips/conf

2016-08-27 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 28 04:03:52 2016
New Revision: 304932
URL: https://svnweb.freebsd.org/changeset/base/304932

Log:
  [mips] QCA955x config file changes to bring things into alignment with the 
other atheros config files.
  
  * ALT_BREAK_TO_DEBUGGER, because we get random breaks when unplugging USB
to serial adapters
  * Build more modules!

Modified:
  head/sys/mips/conf/QCA955X_BASE

Modified: head/sys/mips/conf/QCA955X_BASE
==
--- head/sys/mips/conf/QCA955X_BASE Sun Aug 28 00:26:06 2016
(r304931)
+++ head/sys/mips/conf/QCA955X_BASE Sun Aug 28 04:03:52 2016
(r304932)
@@ -17,7 +17,7 @@ cpu   CPU_MIPS74K
 makeoptionsKERNLOADADDR=0x8005
 optionsHZ=1000
 
-optionsBREAK_TO_DEBUGGER
+#options   BREAK_TO_DEBUGGER
 optionsALT_BREAK_TO_DEBUGGER
 
 # options  BOOTVERBOSE=10
@@ -26,8 +26,7 @@ files "../atheros/files.ar71xx"
 hints  "QCA955X_BASE.hints"
 
 makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols
-# makeoptions  MODULES_OVERRIDE="gpio ar71xx if_gif if_gre if_bridge bridgestp 
usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt 
wlan_amrr ath ath_ahb hwpmc"
-makeoptionsMODULES_OVERRIDE="if_vlan ipfw if_gre if_gif if_bridge 
bridgestp"
+makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap 
if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip 
wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 urtwn 
urtwnfw otus otusfw"
 
 optionsDDB
 optionsKDB
___
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: r304933 - head/sys/mips/conf

2016-08-27 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 28 04:06:36 2016
New Revision: 304933
URL: https://svnweb.freebsd.org/changeset/base/304933

Log:
  [mips] make AR933X boards use ALT_BREAK_TO_DEBUGGER like the rest of the 
Atheros boards.

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

Modified: head/sys/mips/conf/std.AR933X
==
--- head/sys/mips/conf/std.AR933X   Sun Aug 28 04:03:52 2016
(r304932)
+++ head/sys/mips/conf/std.AR933X   Sun Aug 28 04:06:36 2016
(r304933)
@@ -25,6 +25,7 @@ makeoptions   MODULES_OVERRIDE="gpio ar71x
 optionsDDB
 optionsKDB
 optionsALQ
+options ALT_BREAK_TO_DEBUGGER
 
 optionsSCHED_4BSD  #4BSD scheduler
 optionsINET#InterNETworking
___
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: r304935 - head/sys/mips/conf

2016-08-27 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 28 04:07:34 2016
New Revision: 304935
URL: https://svnweb.freebsd.org/changeset/base/304935

Log:
  .. and since others are using wdr3600/wdr4300 right now and are having
  arge issues with spammed interrupts / link issues, flip on ARGE_DEBUG too.

Modified:
  head/sys/mips/conf/TL-WDR4300

Modified: head/sys/mips/conf/TL-WDR4300
==
--- head/sys/mips/conf/TL-WDR4300   Sun Aug 28 04:06:57 2016
(r304934)
+++ head/sys/mips/conf/TL-WDR4300   Sun Aug 28 04:07:34 2016
(r304935)
@@ -24,6 +24,7 @@ options AR71XX_REALMEM=(128*1024
 #deviceiic
 
 # Options required for miiproxy and mdiobus
+optionsARGE_DEBUG
 optionsARGE_MDIO   # Export an MDIO bus separate from arge
 device miiproxy# MDIO bus <-> MII PHY rendezvous
 
___
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: r304934 - head/sys/mips/conf

2016-08-27 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 28 04:06:57 2016
New Revision: 304934
URL: https://svnweb.freebsd.org/changeset/base/304934

Log:
  Since i'm using carambola 2 for more debugging, enable ARGE_DEBUG by default.

Modified:
  head/sys/mips/conf/CARAMBOLA2

Modified: head/sys/mips/conf/CARAMBOLA2
==
--- head/sys/mips/conf/CARAMBOLA2   Sun Aug 28 04:06:36 2016
(r304933)
+++ head/sys/mips/conf/CARAMBOLA2   Sun Aug 28 04:06:57 2016
(r304934)
@@ -31,6 +31,7 @@ options AR71XX_REALMEM=(64*1024*
 #deviceiic
 
 # Options required for miiproxy and mdiobus
+optionsARGE_DEBUG
 optionsARGE_MDIO   # Export an MDIO bus separate from arge
 device miiproxy# MDIO bus <-> MII PHY rendezvous
 
___
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: r304936 - head/sys/mips/conf

2016-08-27 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 28 04:08:04 2016
New Revision: 304936
URL: https://svnweb.freebsd.org/changeset/base/304936

Log:
  Use ALT_BREAK_TO_DEBUGGER as well.

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

Modified: head/sys/mips/conf/std.AR934X
==
--- head/sys/mips/conf/std.AR934X   Sun Aug 28 04:07:34 2016
(r304935)
+++ head/sys/mips/conf/std.AR934X   Sun Aug 28 04:08:04 2016
(r304936)
@@ -25,6 +25,7 @@ makeoptions   MODULES_OVERRIDE="gpio ar71x
 
 optionsDDB
 optionsKDB
+optionsALT_BREAK_TO_DEBUGGER
 optionsALQ
 
 optionsSCHED_4BSD  #4BSD scheduler
___
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: r304937 - head/sys/mips/conf

2016-08-27 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 28 04:08:26 2016
New Revision: 304937
URL: https://svnweb.freebsd.org/changeset/base/304937

Log:
  [mips] migrate the QCA955X_BASE file to std.QCA955X, to bring this in line 
with
  other board defaults.

Added:
  head/sys/mips/conf/std.QCA955X
 - copied, changed from r304936, head/sys/mips/conf/QCA955X_BASE
Deleted:
  head/sys/mips/conf/QCA955X_BASE
Modified:
  head/sys/mips/conf/AP135
  head/sys/mips/conf/DIR-655A1
  head/sys/mips/conf/TL-ARCHERC7V2
  head/sys/mips/conf/TL-WR1043NDv2

Modified: head/sys/mips/conf/AP135
==
--- head/sys/mips/conf/AP135Sun Aug 28 04:08:04 2016(r304936)
+++ head/sys/mips/conf/AP135Sun Aug 28 04:08:26 2016(r304937)
@@ -15,7 +15,7 @@
 #NO_UNIVERSE
 
 # Include the default QCA955x parameters
-include "QCA955X_BASE"
+include "std.QCA955X"
 
 ident   AP135
 

Modified: head/sys/mips/conf/DIR-655A1
==
--- head/sys/mips/conf/DIR-655A1Sun Aug 28 04:08:04 2016
(r304936)
+++ head/sys/mips/conf/DIR-655A1Sun Aug 28 04:08:26 2016
(r304937)
@@ -10,7 +10,7 @@
 #NO_UNIVERSE
 
 # Include the default QCA955x parameters
-include "QCA955X_BASE"
+include "std.QCA955X"
 
 ident   DIR-655A1
 

Modified: head/sys/mips/conf/TL-ARCHERC7V2
==
--- head/sys/mips/conf/TL-ARCHERC7V2Sun Aug 28 04:08:04 2016
(r304936)
+++ head/sys/mips/conf/TL-ARCHERC7V2Sun Aug 28 04:08:26 2016
(r304937)
@@ -15,7 +15,7 @@
 #NO_UNIVERSE
 
 # Include the default QCA955x parameters
-include "QCA955X_BASE"
+include "std.QCA955X"
 
 ident   TL-ARCHERC7V2
 

Modified: head/sys/mips/conf/TL-WR1043NDv2
==
--- head/sys/mips/conf/TL-WR1043NDv2Sun Aug 28 04:08:04 2016
(r304936)
+++ head/sys/mips/conf/TL-WR1043NDv2Sun Aug 28 04:08:26 2016
(r304937)
@@ -10,7 +10,7 @@
 #NO_UNIVERSE
 
 # Include the default QCA955x parameters
-include "QCA955X_BASE"
+include "std.QCA955X"
 
 ident   TL-WR1043NDv2
 

Copied and modified: head/sys/mips/conf/std.QCA955X (from r304936, 
head/sys/mips/conf/QCA955X_BASE)
==
--- head/sys/mips/conf/QCA955X_BASE Sun Aug 28 04:08:04 2016
(r304936, copy source)
+++ head/sys/mips/conf/std.QCA955X  Sun Aug 28 04:08:26 2016
(r304937)
@@ -12,7 +12,7 @@
 #
 
 machine mips mips
-ident  QCA955X_BASE
+#ident std.QCA955X
 cpuCPU_MIPS74K
 makeoptionsKERNLOADADDR=0x8005
 optionsHZ=1000
___
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: r304938 - head/sys/mips/conf

2016-08-27 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 28 04:10:23 2016
New Revision: 304938
URL: https://svnweb.freebsd.org/changeset/base/304938

Log:
  [mips] move AR91XX_BASE to std.AR91XX.

Added:
  head/sys/mips/conf/std.AR91XX
 - copied, changed from r304937, head/sys/mips/conf/AR91XX_BASE
Deleted:
  head/sys/mips/conf/AR91XX_BASE
Modified:
  head/sys/mips/conf/TP-WN1043ND

Modified: head/sys/mips/conf/TP-WN1043ND
==
--- head/sys/mips/conf/TP-WN1043ND  Sun Aug 28 04:08:26 2016
(r304937)
+++ head/sys/mips/conf/TP-WN1043ND  Sun Aug 28 04:10:23 2016
(r304938)
@@ -7,7 +7,7 @@
 #NO_UNIVERSE
 
 # Include the default AR913x parameters common to all AR913x SoC users.
-include "AR91XX_BASE"
+include "std.AR91XX"
 
 ident   TP-WN1043ND
 

Copied and modified: head/sys/mips/conf/std.AR91XX (from r304937, 
head/sys/mips/conf/AR91XX_BASE)
==
--- head/sys/mips/conf/AR91XX_BASE  Sun Aug 28 04:08:26 2016
(r304937, copy source)
+++ head/sys/mips/conf/std.AR91XX   Sun Aug 28 04:10:23 2016
(r304938)
@@ -11,7 +11,7 @@
 #
 
 machine mips mips
-ident  AR91XX_BASE
+#ident std.AR91XX
 cpuCPU_MIPS24K
 makeoptionsKERNLOADADDR=0x8005
 optionsHZ=1000
___
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: r304912 - head/sys/sys

2016-08-27 Thread Adrian Chadd
...

===> lib/libnv (obj,all,install)
In file included from
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libnv/../../sys/contrib/libnv/cnvlist.c:49:0:
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libnv/../../sys/sys/cnv.h:107:6:
error: redundant redeclaration of 'cnvlist_free_descriptor'
[-Werror=redundant-decls]
 void cnvlist_free_descriptor(nvlist_t *nvl, void *cookiep);
  ^
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libnv/../../sys/sys/cnv.h:101:6:
note: previous declaration of 'cnvlist_free_descriptor' was here
 void cnvlist_free_descriptor(nvlist_t *nvl, void *cookiep);
  ^
cc1: all warnings being treated as errors
--- cnvlist.o ---
*** [cnvlist.o] Error code 1

make[4]: stopped in /usr/home/adrian/work/freebsd/head-embedded/src/lib/libnv
1 error



-a


On 27 August 2016 at 08:22, Mariusz Zaborski  wrote:
> Author: oshogbo
> Date: Sat Aug 27 15:22:55 2016
> New Revision: 304912
> URL: https://svnweb.freebsd.org/changeset/base/304912
>
> Log:
>   Add missed header file for cnv.h .
>
>   Submitted by: Adam Starak 
>   Reported by:  ache@
>
> Added:
>   head/sys/sys/cnv.h   (contents, props changed)
>
> Added: head/sys/sys/cnv.h
> ==
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/sys/sys/cnv.h  Sat Aug 27 15:22:55 2016(r304912)
> @@ -0,0 +1,113 @@
> +/*-
> + * Copyright (c) 2016 Adam Starak 
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + *
> + * $FreeBSD$
> + */
> +
> +#ifndef_CNV_H_
> +#define_CNV_H_
> +
> +#include 
> +
> +#ifndef _KERNEL
> +#include 
> +#include 
> +#include 
> +#include 
> +#endif
> +
> +#ifndef_NVLIST_T_DECLARED
> +#define_NVLIST_T_DECLARED
> +struct nvlist;
> +
> +typedef struct nvlist nvlist_t;
> +#endif
> +
> +__BEGIN_DECLS
> +
> +/*
> + * The cnvlist_get functions returns value associated with the given cookie.
> + * If it returns a pointer, the pointer represents internal buffer and should
> + * not be freed by the caller.
> + */
> +
> +boolcnvlist_get_bool(void *cookiep);
> +uint64_tcnvlist_get_number(void *cookiep);
> +const char *cnvlist_get_string(void *cookiep);
> +const nvlist_t *cnvlist_get_nvlist(void *cookiep);
> +const void *cnvlist_get_binary(void *cookiep, size_t *sizep);
> +const bool *cnvlist_get_bool_array(void *cookiep, size_t 
> *nitemsp);
> +const uint64_t *cnvlist_get_number_array(void *cookiep, size_t 
> *nitemsp);
> +const char * const *cnvlist_get_string_array(void *cookiep, size_t 
> *nitemsp);
> +const nvlist_t * const *cnvlist_get_nvlist_array(void *cookiep, size_t 
> *nitemsp);
> +#ifndef _KERNEL
> +int cnvlist_get_descriptor(void *cookiep);
> +const int  *cnvlist_get_descriptor_array(void *cookiep, size_t 
> *nitemsp);
> +#endif
> +
> +
> +/*
> + * The cnvlist_take functions returns value associated with the given cookie 
> and
> + * remove the given entry from the nvlist.
> + * The caller is responsible for freeing received data.
> + */
> +
> +bool cnvlist_take_bool(nvlist_t *nvl, void *cookiep);
> +uint64_t cnvlist_take_number(nvlist_t *nvl, void *cookiep);
> +char*cnvlist_take_string(nvlist_t *nvl, void *cookiep);
> +nvlist_t*cnvlist_take_nvlist(nvlist_t *nvl, void *cookiep);
> +void*cnvlist_take_binary(nvlist_t *nvl, void *cookiep, 
> size_t *sizep);
> +bool*cnvlist_take_bool_array(nvlist_t *nvl, void 
> *cookiep, size_t *nite

Re: svn commit: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Andrey Chernov
On 28.08.2016 5:33, Andrey Chernov wrote:
> "conforming implementation may have extensions (including additional
> library functions), provided they do not alter the behavior of any
> strictly conforming program.3)"
> 
> ptrace() is extension (additional library function) so can't set errno
> to 0 (it breaks strictly conforming program).

Sorry for misguiding in this particular part. I confuse the "strictly
conforming program" with the "conforming program" term used there too.
"Strictly conforming program" can't call ptrace().

In any case our own ptrace(2) manpage suggest to set errno to 0 manually
_before_ ptrace() call and do not relay on ptrace() to do it by itself:

"Some requests can cause ptrace() to return -1 as a non-error value; to
disambiguate, errno can be set to 0 before the call and checked afterwards."

It will be better to stay common policy about errno even for extensions
to not keep exclusions in the mind.

___
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: r304940 - head/sys/dev/uart

2016-08-27 Thread Justin Hibbits
Author: jhibbits
Date: Sun Aug 28 04:40:27 2016
New Revision: 304940
URL: https://svnweb.freebsd.org/changeset/base/304940

Log:
  Fix UART PPS capture mode printing
  
  * Add breaks to prevent fallthrough and printing of multiple modes.
  * Only check the mode, mask out all other bits.

Modified:
  head/sys/dev/uart/uart_core.c

Modified: head/sys/dev/uart/uart_core.c
==
--- head/sys/dev/uart/uart_core.c   Sun Aug 28 04:15:20 2016
(r304939)
+++ head/sys/dev/uart/uart_core.c   Sun Aug 28 04:40:27 2016
(r304940)
@@ -97,15 +97,19 @@ uart_pps_print_mode(struct uart_softc *s
 {
 
device_printf(sc->sc_dev, "PPS capture mode: ");
-   switch(sc->sc_pps_mode) {
+   switch(sc->sc_pps_mode & UART_PPS_SIGNAL_MASK) {
case UART_PPS_DISABLED:
printf("disabled");
+   break;
case UART_PPS_CTS:
printf("CTS");
+   break;
case UART_PPS_DCD:
printf("DCD");
+   break;
default:
printf("invalid");
+   break;
}
if (sc->sc_pps_mode & UART_PPS_INVERT_PULSE)
printf("-Inverted");
___
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: r304941 - head/tools/tools/net80211/wlanwds

2016-08-27 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 28 04:54:02 2016
New Revision: 304941
URL: https://svnweb.freebsd.org/changeset/base/304941

Log:
  [net80211] fix up wlanwds to compile without warnings on clang.

Modified:
  head/tools/tools/net80211/wlanwds/wlanwds.c

Modified: head/tools/tools/net80211/wlanwds/wlanwds.c
==
--- head/tools/tools/net80211/wlanwds/wlanwds.c Sun Aug 28 04:40:27 2016
(r304940)
+++ head/tools/tools/net80211/wlanwds/wlanwds.c Sun Aug 28 04:54:02 2016
(r304941)
@@ -182,7 +182,7 @@ static int
 getparent(const char *ifname, char parent[IFNAMSIZ+1])
 {
char oid[256];
-   int parentlen;
+   size_t parentlen;
 
/* fetch parent interface name */
snprintf(oid, sizeof(oid), "net.wlan.%s.%%parent", ifname+4);
@@ -239,7 +239,7 @@ iswdsvap(int s, const char *ifname)
  * to have already verified this is possible.
  */
 static void
-getbssid(int s, const char *ifname, char bssid[IEEE80211_ADDR_LEN])
+getbssid(int s, const char *ifname, uint8_t bssid[IEEE80211_ADDR_LEN])
 {
struct ieee80211req ireq;
 
@@ -261,7 +261,7 @@ static void
 scanforvaps(int s)
 {
char ifname[IFNAMSIZ+1];
-   char bssid[IEEE80211_ADDR_LEN];
+   uint8_t bssid[IEEE80211_ADDR_LEN];
int i;
 
/* XXX brutal; should just walk sysctl tree */
___
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: r304942 - stable/10/sys/vm

2016-08-27 Thread Alan Cox
Author: alc
Date: Sun Aug 28 05:07:13 2016
New Revision: 304942
URL: https://svnweb.freebsd.org/changeset/base/304942

Log:
  MFC r303982
Correct errors and clean up the comments on the active queue scan.
  
Eliminate some unnecessary blank lines.

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

Modified: stable/10/sys/vm/vm_pageout.c
==
--- stable/10/sys/vm/vm_pageout.c   Sun Aug 28 04:54:02 2016
(r304941)
+++ stable/10/sys/vm/vm_pageout.c   Sun Aug 28 05:07:13 2016
(r304942)
@@ -1399,15 +1399,13 @@ relock_queue:
/*
 * Scan the active queue for pages that can be deactivated.  Update
 * the per-page activity counter and use it to identify deactivation
-* candidates.
+* candidates.  Held pages may be deactivated.
 */
for (m = TAILQ_FIRST(&pq->pq_pl), scanned = 0; m != NULL && (scanned <
min_scan || (page_shortage > 0 && scanned < maxscan)); m = next,
scanned++) {
-
KASSERT(m->queue == PQ_ACTIVE,
("vm_pageout_scan: page %p isn't active", m));
-
next = TAILQ_NEXT(m, plinks.q);
if ((m->flags & PG_MARKER) != 0)
continue;
@@ -1421,8 +1419,8 @@ relock_queue:
}
 
/*
-* The count for pagedaemon pages is done after checking the
-* page for eligibility...
+* The count for page daemon pages is updated after checking
+* the page for eligibility.
 */
PCPU_INC(cnt.v_pdpages);
 
@@ -1435,12 +1433,17 @@ relock_queue:
act_delta += 1;
}
/*
-* Unlocked object ref count check.  Two races are possible.
-* 1) The ref was transitioning to zero and we saw non-zero,
-*the pmap bits will be checked unnecessarily.
-* 2) The ref was transitioning to one and we saw zero. 
-*The page lock prevents a new reference to this page so
-*we need not check the reference bits.
+* Perform an unsynchronized object ref count check.  While
+* the page lock ensures that the page is not reallocated to
+* another object, in particular, one with unmanaged mappings
+* that cannot support pmap_ts_referenced(), two races are,
+* nonetheless, possible:
+* 1) The count was transitioning to zero, but we saw a non-
+*zero value.  pmap_ts_referenced() will return zero
+*because the page is not mapped.
+* 2) The count was transitioning to one, but we saw zero. 
+*This race delays the detection of a new reference.  At
+*worst, we will deactivate and reactivate the page.
 */
if (m->object->ref_count != 0)
act_delta += pmap_ts_referenced(m);
___
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: r304943 - stable/11/sys/kern

2016-08-27 Thread Alan Cox
Author: alc
Date: Sun Aug 28 05:18:39 2016
New Revision: 304943
URL: https://svnweb.freebsd.org/changeset/base/304943

Log:
  MFC r304050
Eliminate two calls to vm_page_xunbusy() that are both unnecessary and
incorrect from the error cases in exec_map_first_page().  They are
unnecessary because we automatically unbusy the page in vm_page_free()
when we remove it from the object.  The calls are incorrect because they
happen after the page is freed, so we might actually unbusy the page
after it has been reallocated to a different object.  (This error was
introduced in r292373.)

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

Modified: stable/11/sys/kern/kern_exec.c
==
--- stable/11/sys/kern/kern_exec.c  Sun Aug 28 05:07:13 2016
(r304942)
+++ stable/11/sys/kern/kern_exec.c  Sun Aug 28 05:18:39 2016
(r304943)
@@ -990,7 +990,6 @@ exec_map_first_page(imgp)
vm_page_lock(ma[0]);
vm_page_free(ma[0]);
vm_page_unlock(ma[0]);
-   vm_page_xunbusy(ma[0]);
VM_OBJECT_WUNLOCK(object);
return (EIO);
}
@@ -1018,7 +1017,6 @@ exec_map_first_page(imgp)
vm_page_lock(ma[i]);
vm_page_free(ma[i]);
vm_page_unlock(ma[i]);
-   vm_page_xunbusy(ma[i]);
}
VM_OBJECT_WUNLOCK(object);
return (EIO);
___
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: r304928 - in head/lib/libc: amd64/sys i386/sys sys

2016-08-27 Thread Bruce Evans

On Sun, 28 Aug 2016, Andrey Chernov wrote:


On 28.08.2016 4:52, Konstantin Belousov wrote:

POSIX: "For each thread of a process, the value of errno shall not be
affected by function calls or assignments to errno by other threads."

And ?  What should the citation add new to the substance
of the code change ?


This is for your comment "On both i386 and amd64, the errno symbol was
directly  referenced, which only works correctly in single-threaded
process."

I still do not understand what you want to say there. Errno as the
symbol existing in the symbol table of libc, gives 'POSIX errno' value
for the main thread. Preprocessor definition converts C language
accesses to errno into some indirections which result in accesses to
per-thread errno location. The bug in x86 asm code was due to direct
usage of errno.


This particular quote is not describing a problem, it supports your change.


I know that POSIX requires that POSIX-defined functions did not modified
errno except on error,


POSIX don't say it. You may modify errno to any value besides 0 while
returning success from the function excepting only those functions where
POSIX directly states they can't modify errno. I.e. only 0 is disallowed
in all cases.


POSIX seems to be very deficient in stating which functions can't modify
errno.  It doesn't say this clearly even for strtol().  C90 and later
C standards say this clearly for strtol() but not many other functions
since not many other functions need this in plain C.  POSIX only says this
indirectly even for strtol() by saying that it defers to the C standard
unless stated otherwise.  But POSIX has many functions that need this
statement, starting with read() with sizes > SSIZE_MAX on implementations
that support such sizes.  (read() is very hard to use if you use such
sizes with it.  v7 had the correct arg type (int) to disallow such sizes.
Now read() is only safe to use by avoiding such sizes.  This is easy to
do in applications but not in libraries.)


I agree that it would be more
consistent for ptrace(2) to not do that as well, but the behaviour is
already there for 35 years and I do not view the 'consistency' as a serious
reason to break ABI and introduce random failures for innocent consumers
of it.


How hard it will be to bring ptrace() to what C99 expects? Perhaps now
time is suited well to change some obsoleted things.


This should be safe to change, since portable applications like gdb can't
assume that the implemementation clobbers errno for them.

Even FreeBSD's man page doesn't document the FreeBSD behaviour.  It
documents, with poor wording, that applications must set errno as usual:

%%%
RETURN VALUES
 Some requests can cause ptrace() to return -1 as a non-error value; to
 disambiguate, errno can be set to 0 before the call and checked
 afterwards.
%%%

The poor wording is just "errno can be set to 0".  It _must_ be set to 0.
Also, the function gurantees to not clobber errno so that this checking
is guaranteed to work.

FreeBSD's man page for strtol says nothing at all about either setting
errno before calls or the C90+ guarantees that make this useful.


"conforming implementation may have extensions (including additional
library functions), provided they do not alter the behavior of any
strictly conforming program.3)"

ptrace() is extension (additional library function) so can't set errno
to 0 (it breaks strictly conforming program).


Use of ptrace() makes a program very far from stricty conforming.  Only
quality of implementation requires ptrace() to follow the usual rules.

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: r304944 - head/sys/contrib/dev/ath/ath_hal/ar9300

2016-08-27 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 28 05:42:03 2016
New Revision: 304944
URL: https://svnweb.freebsd.org/changeset/base/304944

Log:
  [ath_hal] add USB PHY control registers for hornet/AR9330.
  
  Obtained from:linux ath9k

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300phy.h

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300phy.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300phy.h Sun Aug 28 05:18:39 
2016(r304943)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300phy.h Sun Aug 28 05:42:03 
2016(r304944)
@@ -1883,6 +1883,12 @@
 #define AR_PHY_PLL_BB_DPLL4 
AR_PHY_65NM(overlay_0x16180.Osprey.ch0_bb_dpll4)
 
 /*
+ * Wasp/Hornet PHY USB PLL control
+ */
+#define AR_PHY_USB_CTRL1   0x16c84
+#define AR_PHY_USB_CTRL2   0x16c88
+
+/*
  * PMU Register Map
  */
 #define AR_PHY_PMU(_field) offsetof(struct pmu_reg, _field)
___
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"