svn commit: r322453 - head/share/mk

2017-08-12 Thread Warner Losh
Author: imp
Date: Sun Aug 13 04:10:47 2017
New Revision: 322453
URL: https://svnweb.freebsd.org/changeset/base/322453

Log:
  We don't use ARM_ARCH_6 in the tree, and haven't for a long long
  time. Remove it from here. As far as I could tell, nothing in ports
  use it (either __ARM_ARCH or __ARM_ARCH_6__ is used in all the
  apatches). We do have a define for _ARM_ARCH_6, but it's mostly unused
  (and will remain, since it isn't in this file).

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

Modified: head/share/mk/bsd.cpu.mk
==
--- head/share/mk/bsd.cpu.mkSun Aug 13 01:23:13 2017(r322452)
+++ head/share/mk/bsd.cpu.mkSun Aug 13 04:10:47 2017(r322453)
@@ -111,10 +111,9 @@ _CPUCFLAGS = -march=armv5te -D__XSCALE__
 .  elif ${CPUTYPE:M*soft*} != ""
 _CPUCFLAGS = -mfloat-abi=softfp
 .  elif ${CPUTYPE} == "armv6"
-# Not sure we still need ARM_ARCH_6=1 here.
-_CPUCFLAGS = -march=${CPUTYPE} -DARM_ARCH_6=1
+_CPUCFLAGS = -march=${CPUTYPE}
 .  elif ${CPUTYPE} == "cortexa"
-_CPUCFLAGS = -march=armv7 -DARM_ARCH_6=1 -mfpu=vfp
+_CPUCFLAGS = -march=armv7 -mfpu=vfp
 .  elif ${CPUTYPE:Marmv[4567]*} != ""
 # Handle all the armvX types that FreeBSD runs:
 #  armv4, armv4t, armv5, armv5te, armv6, armv6t2, armv7, armv7-a, armv7ve
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322451 - in head/lib/libcasper: services/tests tests

2017-08-12 Thread Ngie Cooper
Author: ngie
Date: Sun Aug 13 01:08:37 2017
New Revision: 322451
URL: https://svnweb.freebsd.org/changeset/base/322451

Log:
  TESTSDIR isn't required; remove it
  
  MFC after:1 week
  MFC with: r322450

Modified:
  head/lib/libcasper/services/tests/Makefile
  head/lib/libcasper/tests/Makefile

Modified: head/lib/libcasper/services/tests/Makefile
==
--- head/lib/libcasper/services/tests/Makefile  Sun Aug 13 01:04:44 2017
(r322450)
+++ head/lib/libcasper/services/tests/Makefile  Sun Aug 13 01:08:37 2017
(r322451)
@@ -1,7 +1,5 @@
 # $FreeBSD$
 
-TESTSDIR=  ${TESTSBASE}/lib/libcasper/services
-
 .PATH: ${SRCTOP}/tests
 KYUAFILE=  yes
 

Modified: head/lib/libcasper/tests/Makefile
==
--- head/lib/libcasper/tests/Makefile   Sun Aug 13 01:04:44 2017
(r322450)
+++ head/lib/libcasper/tests/Makefile   Sun Aug 13 01:08:37 2017
(r322451)
@@ -1,7 +1,5 @@
 # $FreeBSD$
 
-TESTSDIR=  ${TESTSBASE}/lib/libcasper
-
 .PATH: ${SRCTOP}/tests
 KYUAFILE=  yes
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322450 - in head/lib/libcasper: . services services/tests tests

2017-08-12 Thread Ngie Cooper
Author: ngie
Date: Sun Aug 13 01:04:44 2017
New Revision: 322450
URL: https://svnweb.freebsd.org/changeset/base/322450

Log:
  Integrate the tests moved in r305626 in to the FreeBSD test suite
  
  The reachover Kyuafiles were never added, and thus the tests were installed
  as standalone tests, and not integrated into the full suite.
  
  MFC after:1 week
  MFC with: r305626, 305629, r307863, r322447, r322448, r322449

Added:
  head/lib/libcasper/services/tests/
  head/lib/libcasper/services/tests/Makefile
 - copied, changed from r322439, head/tests/etc/Makefile
  head/lib/libcasper/tests/
  head/lib/libcasper/tests/Makefile
 - copied, changed from r322439, head/tests/etc/Makefile
Modified:
  head/lib/libcasper/Makefile
  head/lib/libcasper/services/Makefile

Modified: head/lib/libcasper/Makefile
==
--- head/lib/libcasper/Makefile Sun Aug 13 00:56:43 2017(r322449)
+++ head/lib/libcasper/Makefile Sun Aug 13 01:04:44 2017(r322450)
@@ -3,6 +3,8 @@
 SUBDIR=libcasper
 SUBDIR+=   services
 
+SUBDIR.${MK_TESTS}+=   tests
+
 SUBDIR_PARALLEL=
 
 .include 

Modified: head/lib/libcasper/services/Makefile
==
--- head/lib/libcasper/services/MakefileSun Aug 13 00:56:43 2017
(r322449)
+++ head/lib/libcasper/services/MakefileSun Aug 13 01:04:44 2017
(r322450)
@@ -6,6 +6,8 @@ SUBDIR+=cap_pwd
 SUBDIR+=   cap_random
 SUBDIR+=   cap_sysctl
 
+SUBDIR.${MK_TESTS}+=   tests
+
 SUBDIR_PARALLEL=
 
 .include 

Copied and modified: head/lib/libcasper/services/tests/Makefile (from r322439, 
head/tests/etc/Makefile)
==
--- head/tests/etc/Makefile Sat Aug 12 21:20:51 2017(r322439, copy 
source)
+++ head/lib/libcasper/services/tests/Makefile  Sun Aug 13 01:04:44 2017
(r322450)
@@ -1,12 +1,8 @@
 # $FreeBSD$
 
-.include 
+TESTSDIR=  ${TESTSBASE}/lib/libcasper/services
 
-TESTSDIR=  ${TESTSBASE}/etc
-
 .PATH: ${SRCTOP}/tests
 KYUAFILE=  yes
-
-SUBDIR+=   rc.d
 
 .include 

Copied and modified: head/lib/libcasper/tests/Makefile (from r322439, 
head/tests/etc/Makefile)
==
--- head/tests/etc/Makefile Sat Aug 12 21:20:51 2017(r322439, copy 
source)
+++ head/lib/libcasper/tests/Makefile   Sun Aug 13 01:04:44 2017
(r322450)
@@ -1,12 +1,8 @@
 # $FreeBSD$
 
-.include 
+TESTSDIR=  ${TESTSBASE}/lib/libcasper
 
-TESTSDIR=  ${TESTSBASE}/etc
-
 .PATH: ${SRCTOP}/tests
 KYUAFILE=  yes
-
-SUBDIR+=   rc.d
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322449 - head/lib/libcasper/services/cap_dns/tests

2017-08-12 Thread Ngie Cooper
Author: ngie
Date: Sun Aug 13 00:56:43 2017
New Revision: 322449
URL: https://svnweb.freebsd.org/changeset/base/322449

Log:
  Use hardcoded IPv4/IPv6 addresses for google-public-dns-a.google.com instead
  of freefall.freebsd.org to unbreak the DNS tests
  
  The address allocations for freefall.freebsd.org have changed in the past 4 
years.
  Use a more stable set of hardcoded addresses for now to make the tests succeed
  reliably.
  
  The hostname should be resolved dynamically instead of hardcoding the 
addresses in
  the future. This is just a bandaid.
  
  MFC after:1 week

Modified:
  head/lib/libcasper/services/cap_dns/tests/dns_test.c

Modified: head/lib/libcasper/services/cap_dns/tests/dns_test.c
==
--- head/lib/libcasper/services/cap_dns/tests/dns_test.cSun Aug 13 
00:14:08 2017(r322448)
+++ head/lib/libcasper/services/cap_dns/tests/dns_test.cSun Aug 13 
00:56:43 2017(r322449)
@@ -297,32 +297,26 @@ runtest(cap_channel_t *capdns)
freeaddrinfo(aic);
}
 
-   /*
-* 8.8.178.135 is IPv4 address of freefall.freebsd.org
-* as of 27 October 2013.
-*/
-   inet_pton(AF_INET, "8.8.178.135", );
+   /* XXX: hardcoded addresses for "google-public-dns-a.google.com". */
+#defineGOOGLE_DNS_IPV4 "8.8.8.8"
+#defineGOOGLE_DNS_IPV6 "2001:4860:4860::"
+
+   inet_pton(AF_INET, GOOGLE_DNS_IPV4, );
hps = gethostbyaddr(, sizeof(ip4), AF_INET);
if (hps == NULL)
-   fprintf(stderr, "Unable to resolve %s.\n", "8.8.178.135");
+   fprintf(stderr, "Unable to resolve %s.\n", GOOGLE_DNS_IPV4);
hpc = cap_gethostbyaddr(capdns, , sizeof(ip4), AF_INET);
if (hostent_compare(hps, hpc))
result |= GETHOSTBYADDR_AF_INET;
 
-   /*
-* 2001:1900:2254:206c::16:87 is IPv6 address of freefall.freebsd.org
-* as of 27 October 2013.
-*/
-   inet_pton(AF_INET6, "2001:1900:2254:206c::16:87", );
+   inet_pton(AF_INET6, GOOGLE_DNS_IPV6, );
hps = gethostbyaddr(, sizeof(ip6), AF_INET6);
if (hps == NULL) {
-   fprintf(stderr, "Unable to resolve %s.\n",
-   "2001:1900:2254:206c::16:87");
+   fprintf(stderr, "Unable to resolve %s.\n", GOOGLE_DNS_IPV6);
}
hpc = cap_gethostbyaddr(capdns, , sizeof(ip6), AF_INET6);
if (hostent_compare(hps, hpc))
result |= GETHOSTBYADDR_AF_INET6;
-
return (result);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r322418 - head/lib/msun/src

2017-08-12 Thread Ryan Libby
On Sat, Aug 12, 2017 at 2:53 PM, Ngie Cooper (yaneurabeya)
 wrote:
[...]
> Here are the full gamut of definitions for LDBL_MAX_EXP. It seems 
> that sparc64 isn’t the only architecture using this pattern:
>
> $ grep -r DBL_MAX_EXP sys/*/include
> sys/arm/include/float.h:#define DBL_MAX_EXP 1024
> sys/arm/include/float.h:#define LDBL_MAX_EXPDBL_MAX_EXP
> sys/arm64/include/float.h:#define   DBL_MAX_EXP 1024
> sys/arm64/include/float.h:#define   LDBL_MAX_EXP(+16384)
> sys/mips/include/float.h:#defineDBL_MAX_EXP 1024
> sys/mips/include/float.h:#defineLDBL_MAX_EXPDBL_MAX_EXP
> sys/powerpc/include/float.h:#define DBL_MAX_EXP 1024
> sys/powerpc/include/float.h:#define LDBL_MAX_EXPDBL_MAX_EXP
> sys/riscv/include/float.h:#define   DBL_MAX_EXP 1024
> sys/riscv/include/float.h:#define   LDBL_MAX_EXP(+16384)
> sys/sparc64/include/float.h:#define DBL_MAX_EXP 1024
> sys/sparc64/include/float.h:#define LDBL_MAX_EXP(+16384)
> sys/x86/include/float.h:#define DBL_MAX_EXP 1024
> sys/x86/include/float.h:#define LDBL_MAX_EXP16384
>
> It might also be an inconsistency with how clang vs gcc [4.2.1] 
> handles __CONCAT, and what -std= flags are passed to ${CC} in the Makefile, 
> since the implementation is predicated by whether or not it’s C++ or __STDC__ 
> is defined. There might be an update that we can grab from NetBSD (since the 
> macro originated there).
> I don’t understand [right now] why the (+foo) form is used *shrugs*.

Yeah, unsure.  Aesthetically it mirrors the declaration for the macros
with negative values such as LDBL_MIN_EXP (where the parentheses do have
a functional purpose), but in sys/*/include/{_limits.h,_stdint.h} by
comparison we don't have parens around the positive values.

Anyway maybe the macro pasting method is just too fragile of a hack.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r322448 - head/lib/libcasper/services/cap_sysctl/tests

2017-08-12 Thread Ngie Cooper
Author: ngie
Date: Sun Aug 13 00:14:08 2017
New Revision: 322448
URL: https://svnweb.freebsd.org/changeset/base/322448

Log:
  Make root-privileges a requirement for the test
  
  Some of the testcases try to manipulate sysctls that require root privileges,
  e.g., "kern.sync_on_panic". Make root-privileges a hard requirement so the
  tests don't raise false positives due to privilege issues when calling
  sysctlbyname(3) on writable sysctls.
  
  MFC after:1 week

Modified:
  head/lib/libcasper/services/cap_sysctl/tests/Makefile

Modified: head/lib/libcasper/services/cap_sysctl/tests/Makefile
==
--- head/lib/libcasper/services/cap_sysctl/tests/Makefile   Sun Aug 13 
00:04:50 2017(r322447)
+++ head/lib/libcasper/services/cap_sysctl/tests/Makefile   Sun Aug 13 
00:14:08 2017(r322448)
@@ -8,4 +8,6 @@ LIBADD+=nv
 
 WARNS?=3
 
+TEST_METADATA.sysctl_test+=required_user="root"
+
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322447 - in head/lib/libcasper/services: cap_dns/tests cap_grp/tests cap_pwd/tests cap_sysctl/tests

2017-08-12 Thread Ngie Cooper
Author: ngie
Date: Sun Aug 13 00:04:50 2017
New Revision: 322447
URL: https://svnweb.freebsd.org/changeset/base/322447

Log:
  Fix result printing
  
  - Flushing stdout prevents the buffer from being printed twice, fixing
issues with stdout printing out the testplan, etc, twice.
  - Don't print out raw source/line numbers; hide them behind comments.
  
  MFC after:1 week

Modified:
  head/lib/libcasper/services/cap_dns/tests/dns_test.c
  head/lib/libcasper/services/cap_grp/tests/grp_test.c
  head/lib/libcasper/services/cap_pwd/tests/pwd_test.c
  head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c

Modified: head/lib/libcasper/services/cap_dns/tests/dns_test.c
==
--- head/lib/libcasper/services/cap_dns/tests/dns_test.cSat Aug 12 
23:40:01 2017(r322446)
+++ head/lib/libcasper/services/cap_dns/tests/dns_test.cSun Aug 13 
00:04:50 2017(r322447)
@@ -52,18 +52,20 @@ static int ntest = 1;
 
 #define CHECK(expr) do {   \
if ((expr)) \
-   printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
+   printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__);   \
else\
-   printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
+   printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
+   fflush(stdout); \
ntest++;\
 } while (0)
 #define CHECKX(expr) do {  \
if ((expr)) {   \
-   printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
+   printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__);   \
} else {\
-   printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
+   printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
exit(1);\
}   \
+   fflush(stdout); \
ntest++;\
 } while (0)
 
@@ -332,6 +334,7 @@ main(void)
int families[2];
 
printf("1..91\n");
+   fflush(stdout);
 
capcas = cap_init();
CHECKX(capcas != NULL);

Modified: head/lib/libcasper/services/cap_grp/tests/grp_test.c
==
--- head/lib/libcasper/services/cap_grp/tests/grp_test.cSat Aug 12 
23:40:01 2017(r322446)
+++ head/lib/libcasper/services/cap_grp/tests/grp_test.cSun Aug 13 
00:04:50 2017(r322447)
@@ -52,6 +52,7 @@ static int ntest = 1;
printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
else\
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
+   fflush(stdout); \
ntest++;\
 } while (0)
 #define CHECKX(expr) do {  \
@@ -61,6 +62,7 @@ static int ntest = 1;
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
exit(1);\
}   \
+   fflush(stdout); \
ntest++;\
 } while (0)
 
@@ -1524,6 +1526,7 @@ main(void)
cap_channel_t *capcas, *capgrp;
 
printf("1..199\n");
+   fflush(stdout);
 
capcas = cap_init();
CHECKX(capcas != NULL);

Modified: head/lib/libcasper/services/cap_pwd/tests/pwd_test.c
==
--- head/lib/libcasper/services/cap_pwd/tests/pwd_test.cSat Aug 12 
23:40:01 2017(r322446)
+++ head/lib/libcasper/services/cap_pwd/tests/pwd_test.cSun Aug 13 
00:04:50 2017(r322447)
@@ -49,18 +49,20 @@ static int ntest = 1;
 
 #define CHECK(expr) do {   \
if ((expr)) \
-   printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
+   printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__);   \
else\
-   printf("not ok %d %s:%u\n", ntest, 

svn commit: r322445 - head/lib/ncurses/ncurses

2017-08-12 Thread Ngie Cooper
Author: ngie
Date: Sat Aug 12 22:20:08 2017
New Revision: 322445
URL: https://svnweb.freebsd.org/changeset/base/322445

Log:
  Hide `sccsid` under #if 0, per example in style(9)
  
  This fixes a -Wunused warning with gcc 6.3.0/7.0.0.
  
  MFC after:1 week

Modified:
  head/lib/ncurses/ncurses/termcap.c

Modified: head/lib/ncurses/ncurses/termcap.c
==
--- head/lib/ncurses/ncurses/termcap.c  Sat Aug 12 22:14:09 2017
(r322444)
+++ head/lib/ncurses/ncurses/termcap.c  Sat Aug 12 22:20:08 2017
(r322445)
@@ -59,9 +59,11 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#if 0
 #ifndef lint
 static const char sccsid[] = "@(#)termcap.c8.1 (Berkeley) 6/4/93";
 #endif /* not lint */
+#endif
 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322443 - head/sys/dev/nvme

2017-08-12 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sat Aug 12 22:13:06 2017
New Revision: 322443
URL: https://svnweb.freebsd.org/changeset/base/322443

Log:
  Move NVME controller shutdown from being called as part of module unloading
  to being called through the newbus DEVICE_SHUTDOWN() path. This ensures that
  the NVME controller gets shut down before the device and bus disappear
  and prevents data corruption on shutdown on at least Samsung EVO 960 SSDs.
  
  PR:   kern/211852
  Reviewed by:  imp
  MFC after:2 weeks

Modified:
  head/sys/dev/nvme/nvme.c

Modified: head/sys/dev/nvme/nvme.c
==
--- head/sys/dev/nvme/nvme.cSat Aug 12 22:12:09 2017(r322442)
+++ head/sys/dev/nvme/nvme.cSat Aug 12 22:13:06 2017(r322443)
@@ -58,6 +58,7 @@ MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocati
 static intnvme_probe(device_t);
 static intnvme_attach(device_t);
 static intnvme_detach(device_t);
+static intnvme_shutdown(device_t);
 static intnvme_modevent(module_t mod, int type, void *arg);
 
 static devclass_t nvme_devclass;
@@ -67,6 +68,7 @@ static device_method_t nvme_pci_methods[] = {
DEVMETHOD(device_probe, nvme_probe),
DEVMETHOD(device_attach,nvme_attach),
DEVMETHOD(device_detach,nvme_detach),
+   DEVMETHOD(device_shutdown,  nvme_shutdown),
{ 0, 0 }
 };
 
@@ -179,22 +181,15 @@ nvme_unload(void)
 {
 }
 
-static void
-nvme_shutdown(void)
+static int
+nvme_shutdown(device_t dev)
 {
-   device_t*devlist;
struct nvme_controller  *ctrlr;
-   int dev, devcount;
 
-   if (devclass_get_devices(nvme_devclass, , ))
-   return;
+   ctrlr = DEVICE2SOFTC(dev);
+   nvme_ctrlr_shutdown(ctrlr);
 
-   for (dev = 0; dev < devcount; dev++) {
-   ctrlr = DEVICE2SOFTC(devlist[dev]);
-   nvme_ctrlr_shutdown(ctrlr);
-   }
-
-   free(devlist, M_TEMP);
+   return (0);
 }
 
 static int
@@ -207,9 +202,6 @@ nvme_modevent(module_t mod, int type, void *arg)
break;
case MOD_UNLOAD:
nvme_unload();
-   break;
-   case MOD_SHUTDOWN:
-   nvme_shutdown();
break;
default:
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r322418 - head/lib/msun/src

2017-08-12 Thread Ngie Cooper (yaneurabeya)

> On Aug 12, 2017, at 14:45, Ngie Cooper (yaneurabeya)  
> wrote:
> 
>> 
>> On Aug 12, 2017, at 10:55, Ryan Libby  wrote:
> 
> …
> 
>> A few possible quick fixes:
>> 
>> - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP
>>  definitions from (+16384) to 16384.
>> 
>> - Change HALF_LDBL_MAX from
>> #define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L)
>>  to
>> #if LDBL_MAX_EXP != 0x4000
>> #error "Unsupported long double format"
>> #endif
>> #define HALF_LDBL_MAX 0x0.8p16384L
>> 
>> - Change the HALF_LDBL_MAX constant to a variable constructed with
>>  LD80C(), I think with
>> LD80C(0x8000, 16383, 5.9486574767861588254e+4931L)
>>  but this also requires #error for LDBL_MAX_EXP != 0x4000, so not
>>  really any better than the above.
>> 
>> I think I will back the patch out for now and go back to review.
> 
> The issue is an inconsistency with how LDBL_MAX_EXP is defined in the MD 
> headers:

* is an -> is due to an

> $ grep -r LDBL_MAX_EXP sys/sparc64/
> sys/sparc64/include/float.h:#define LDBL_MAX_EXP(+16384)
> $ grep -r LDBL_MAX_EXP sys/x86/
> sys/x86/include/float.h:#define LDBL_MAX_EXP16384

Here are the full gamut of definitions for LDBL_MAX_EXP. It seems that 
sparc64 isn’t the only architecture using this pattern:

$ grep -r DBL_MAX_EXP sys/*/include
sys/arm/include/float.h:#define DBL_MAX_EXP 1024
sys/arm/include/float.h:#define LDBL_MAX_EXPDBL_MAX_EXP
sys/arm64/include/float.h:#define   DBL_MAX_EXP 1024
sys/arm64/include/float.h:#define   LDBL_MAX_EXP(+16384)
sys/mips/include/float.h:#defineDBL_MAX_EXP 1024
sys/mips/include/float.h:#defineLDBL_MAX_EXPDBL_MAX_EXP
sys/powerpc/include/float.h:#define DBL_MAX_EXP 1024
sys/powerpc/include/float.h:#define LDBL_MAX_EXPDBL_MAX_EXP
sys/riscv/include/float.h:#define   DBL_MAX_EXP 1024
sys/riscv/include/float.h:#define   LDBL_MAX_EXP(+16384)
sys/sparc64/include/float.h:#define DBL_MAX_EXP 1024
sys/sparc64/include/float.h:#define LDBL_MAX_EXP(+16384)
sys/x86/include/float.h:#define DBL_MAX_EXP 1024
sys/x86/include/float.h:#define LDBL_MAX_EXP16384

It might also be an inconsistency with how clang vs gcc [4.2.1] handles 
__CONCAT, and what -std= flags are passed to ${CC} in the Makefile, since the 
implementation is predicated by whether or not it’s C++ or __STDC__ is defined. 
There might be an update that we can grab from NetBSD (since the macro 
originated there).
I don’t understand [right now] why the (+foo) form is used *shrugs*.
Cheers,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r322418 - head/lib/msun/src

2017-08-12 Thread Ngie Cooper (yaneurabeya)

> On Aug 12, 2017, at 10:55, Ryan Libby  wrote:

…

> A few possible quick fixes:
> 
> - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP
>   definitions from (+16384) to 16384.
> 
> - Change HALF_LDBL_MAX from
> #define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L)
>   to
> #if LDBL_MAX_EXP != 0x4000
> #error "Unsupported long double format"
> #endif
> #define HALF_LDBL_MAX 0x0.8p16384L
> 
> - Change the HALF_LDBL_MAX constant to a variable constructed with
>   LD80C(), I think with
> LD80C(0x8000, 16383, 5.9486574767861588254e+4931L)
>   but this also requires #error for LDBL_MAX_EXP != 0x4000, so not
>   really any better than the above.
> 
> I think I will back the patch out for now and go back to review.

The issue is an inconsistency with how LDBL_MAX_EXP is defined in the MD 
headers:

$ grep -r LDBL_MAX_EXP sys/sparc64/
sys/sparc64/include/float.h:#define LDBL_MAX_EXP(+16384)
$ grep -r LDBL_MAX_EXP sys/x86/
sys/x86/include/float.h:#define LDBL_MAX_EXP16384

Cheers,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r322441 - head/share/mk

2017-08-12 Thread Ngie Cooper
Author: ngie
Date: Sat Aug 12 21:26:46 2017
New Revision: 322441
URL: https://svnweb.freebsd.org/changeset/base/322441

Log:
  Delete trailing whitespace
  
  MFC after:1 month

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

Modified: head/share/mk/bsd.cpu.mk
==
--- head/share/mk/bsd.cpu.mkSat Aug 12 21:23:33 2017(r322440)
+++ head/share/mk/bsd.cpu.mkSat Aug 12 21:26:46 2017(r322441)
@@ -399,7 +399,7 @@ CFLAGS_NO_SIMD= -mno-mmx -mno-sse
 .endif
 CFLAGS_NO_SIMD += ${CFLAGS_NO_SIMD.${COMPILER_TYPE}}
 
-# Add in any architecture-specific CFLAGS.  
+# Add in any architecture-specific CFLAGS.
 # These come from make.conf or the command line or the environment.
 CFLAGS += ${CFLAGS.${MACHINE_ARCH}}
 CXXFLAGS += ${CXXFLAGS.${MACHINE_ARCH}}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322440 - head/usr.sbin/bluetooth/bthidd

2017-08-12 Thread Vladimir Kondratyev
Author: wulf
Date: Sat Aug 12 21:23:33 2017
New Revision: 322440
URL: https://svnweb.freebsd.org/changeset/base/322440

Log:
  bthidd(8): Add support for Apple's magic mouse
  
  Note: Mouse's bthidd.conf record should contain vendor and device IDs
  to make proper device detection. If it does not contain IDs,
  regenerate record with "Query" command of recent bthidcontrol(8).
  
  Submitted by: Dirk Engling 
  Reviewed by:  emax
  Approved by:  bapt (mentor), gonzo (mentor)
  Differential Revision:https://reviews.freebsd.org/D3702

Modified:
  head/usr.sbin/bluetooth/bthidd/bthidd.h
  head/usr.sbin/bluetooth/bthidd/hid.c
  head/usr.sbin/bluetooth/bthidd/server.c
  head/usr.sbin/bluetooth/bthidd/session.c

Modified: head/usr.sbin/bluetooth/bthidd/bthidd.h
==
--- head/usr.sbin/bluetooth/bthidd/bthidd.h Sat Aug 12 21:20:51 2017
(r322439)
+++ head/usr.sbin/bluetooth/bthidd/bthidd.h Sat Aug 12 21:23:33 2017
(r322440)
@@ -60,6 +60,7 @@ struct bthid_session
int32_t  ctrl;  /* control channel */
int32_t  intr;  /* interrupt channel */
int32_t  vkbd;  /* virual keyboard */
+   void*ctx;   /* product specific dev state */
bdaddr_t bdaddr;/* remote bdaddr */
uint16_t state; /* session state */
 #define CLOSED 0
@@ -86,6 +87,7 @@ bthid_session_p   session_by_bdaddr(bthid_server_p srv, 
 bthid_session_psession_by_fd(bthid_server_p srv, int32_t fd);
 void   session_close(bthid_session_p s);
 
+void   hid_initialise   (bthid_session_p s);
 int32_thid_control  (bthid_session_p s, uint8_t *data, 
int32_t len);
 int32_thid_interrupt(bthid_session_p s, uint8_t *data, 
int32_t len);
 

Modified: head/usr.sbin/bluetooth/bthidd/hid.c
==
--- head/usr.sbin/bluetooth/bthidd/hid.cSat Aug 12 21:20:51 2017
(r322439)
+++ head/usr.sbin/bluetooth/bthidd/hid.cSat Aug 12 21:23:33 2017
(r322440)
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -50,6 +51,50 @@
 #include "kbd.h"
 
 /*
+ * Inoffical and unannounced report ids for Apple Mice and trackpad
+ */
+#define TRACKPAD_REPORT_ID 0x28
+#define AMM_REPORT_ID  0x29
+#define BATT_STAT_REPORT_ID0x30
+#define BATT_STRENGTH_REPORT_ID0x47
+#define SURFACE_REPORT_ID  0x61
+
+/*
+ * Apple magic mouse (AMM) specific device state
+ */
+#define AMM_MAX_BUTTONS 16
+struct apple_state {
+   int y   [AMM_MAX_BUTTONS];
+   int button_state;
+};
+
+#define MAGIC_MOUSE(D) (((D)->vendor_id == 0x5ac) && ((D)->product_id == 
0x30d))
+#define AMM_BASIC_BLOCK   5
+#define AMM_FINGER_BLOCK  8
+#define AMM_VALID_REPORT(L) (((L) >= AMM_BASIC_BLOCK) && \
+((L) <= 16*AMM_FINGER_BLOCK+ AMM_BASIC_BLOCK) && \
+((L)  % AMM_FINGER_BLOCK) == AMM_BASIC_BLOCK)
+#define AMM_WHEEL_SPEED 100
+
+/*
+ * Probe for per-device initialisation
+ */
+void
+hid_initialise(bthid_session_p s)
+{
+   hid_device_p hid_device = get_hid_device(>bdaddr);
+
+   if (hid_device && MAGIC_MOUSE(hid_device)) {
+   /* Magic report to enable trackpad on Apple's Magic Mouse */
+   static uint8_t rep[] = {0x53, 0xd7, 0x01};
+
+   if ((s->ctx = calloc(1, sizeof(struct apple_state))) == NULL)
+   return;
+   write(s->ctrl, rep, 3);
+   }
+}
+
+/*
  * Process data from control channel
  */
 
@@ -369,6 +414,91 @@ hid_interrupt(bthid_session_p s, uint8_t *data, int32_
}
}
hid_end_parse(d);
+
+   /*
+* Apple adheres to no standards and sends reports it does
+* not introduce in its hid descriptor for its magic mouse.
+* Handle those reports here.
+*/
+   if (MAGIC_MOUSE(hid_device) && s->ctx) {
+   struct apple_state *c = (struct apple_state *)s->ctx;
+   int firm = 0, middle = 0;
+   int16_t v;
+
+   data++, len--;  /* Chomp report_id */
+
+   if (report_id != AMM_REPORT_ID || !AMM_VALID_REPORT(len))
+   goto check_middle_button;
+
+   /*
+* The basics. When touches are detected, no normal mouse
+* reports are sent. Collect clicks and dx/dy
+*/
+   if (data[2] & 1)
+   mouse_butt |= 0x1;
+   if (data[2] & 2)
+   mouse_butt |= 0x4;
+
+   if ((v = data[0] + ((data[2] & 0x0C) << 6)))
+   mouse_x += ((int16_t)(v << 6)) >> 6, mevents++;
+  

svn commit: r322439 - in head/usr.sbin/bluetooth: bthidcontrol bthidd

2017-08-12 Thread Vladimir Kondratyev
Author: wulf
Date: Sat Aug 12 21:20:51 2017
New Revision: 322439
URL: https://svnweb.freebsd.org/changeset/base/322439

Log:
  bthidd(8): Add support for vendor_id, product_id and version.
  
  Extend bthidd.conf format to store vendor and product IDs of remote
  Bluetooth HID devices to make possible implementation of device
  specific quirks inside bthidd(8).
  Add support for querying of this information from device's SDP records
  with bthidcontrol(8) "Query" command.
  
  Submitted by: Dirk Engling 
  Reviewed by:  emax
  Approved by:  bapt (mentor), gonzo (mentor)
  Differential Revision:https://reviews.freebsd.org/D3702

Modified:
  head/usr.sbin/bluetooth/bthidcontrol/sdp.c
  head/usr.sbin/bluetooth/bthidd/bthid_config.h
  head/usr.sbin/bluetooth/bthidd/bthidd.conf.sample
  head/usr.sbin/bluetooth/bthidd/lexer.l
  head/usr.sbin/bluetooth/bthidd/parser.y

Modified: head/usr.sbin/bluetooth/bthidcontrol/sdp.c
==
--- head/usr.sbin/bluetooth/bthidcontrol/sdp.c  Sat Aug 12 19:17:48 2017
(r322438)
+++ head/usr.sbin/bluetooth/bthidcontrol/sdp.c  Sat Aug 12 21:20:51 2017
(r322439)
@@ -47,7 +47,20 @@ static int32_t hid_sdp_parse_protocol_descriptor_list
 static int32_t hid_sdp_parse_hid_descriptor(sdp_attr_p a);
 static int32_t hid_sdp_parse_boolean   (sdp_attr_p a);
 
+/*
+ * Hard coded attibute IDs taken from the
+ * DEVICE IDENTIFICATION PROFILE SPECIFICATION V13 p.12
+ */
+
+#define SDP_ATTR_DEVICE_ID_SERVICE_VENDORID  0x0201
+#define SDP_ATTR_DEVICE_ID_SERVICE_PRODUCTID 0x0202
+#define SDP_ATTR_DEVICE_ID_SERVICE_VERSION   0x0203
+#define SDP_ATTR_DEVICE_ID_RANGE SDP_ATTR_RANGE( \
+ SDP_ATTR_DEVICE_ID_SERVICE_VENDORID, SDP_ATTR_DEVICE_ID_SERVICE_VERSION )
+
 static uint16_tservice = 
SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE;
+static uint16_tservice_devid = 
SDP_SERVICE_CLASS_PNP_INFORMATION;
+static uint32_tattrs_devid   = SDP_ATTR_DEVICE_ID_RANGE;
 
 static uint32_tattrs[] = {
 SDP_ATTR_RANGE(SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST,
@@ -85,27 +98,34 @@ static uint8_t  buffer[nvalues][512];
return (((e) == 0)? 0 : -1);\
 }
 
+static void
+hid_init_return_values() {
+   int i;
+   for (i = 0; i < nvalues; i ++) {
+   values[i].flags = SDP_ATTR_INVALID;
+   values[i].attr = 0;
+   values[i].vlen = sizeof(buffer[i]);
+   values[i].value = buffer[i];
+   }
+}
+
 static int32_t
 hid_sdp_query(bdaddr_t const *local, struct hid_device *hd, int32_t *error)
 {
void*ss = NULL;
-   uint8_t *hid_descriptor = NULL;
+   uint8_t *hid_descriptor = NULL, *v;
int32_t  i, control_psm = -1, interrupt_psm = -1,
 reconnect_initiate = -1,
 normally_connectable = 0, battery_power = 0,
-hid_descriptor_length = -1;
+hid_descriptor_length = -1, type;
+   int16_t  vendor_id = 0, product_id = 0, version = 0;
 
if (local == NULL)
local = NG_HCI_BDADDR_ANY;
if (hd == NULL)
hid_sdp_query_exit(EINVAL);
 
-   for (i = 0; i < nvalues; i ++) {
-   values[i].flags = SDP_ATTR_INVALID;
-   values[i].attr = 0;
-   values[i].vlen = sizeof(buffer[i]);
-   values[i].value = buffer[i];
-   }
+   hid_init_return_values();
 
if ((ss = sdp_open(local, >bdaddr)) == NULL)
hid_sdp_query_exit(ENOMEM);
@@ -114,9 +134,6 @@ hid_sdp_query(bdaddr_t const *local, struct hid_device
if (sdp_search(ss, 1, , nattrs, attrs, nvalues, values) != 0)
 hid_sdp_query_exit(sdp_error(ss));
 
-sdp_close(ss);
-ss = NULL;
-
for (i = 0; i < nvalues; i ++) {
if (values[i].flags != SDP_ATTR_OK)
continue;
@@ -151,11 +168,51 @@ hid_sdp_query(bdaddr_t const *local, struct hid_device
}
}
 
+   hid_init_return_values();
+
+   if (sdp_search(ss, 1, _devid, 1, _devid, nvalues, values) 
!= 0)
+hid_sdp_query_exit(sdp_error(ss));
+
+sdp_close(ss);
+ss = NULL;
+
+   /* If search is successful, scan through return vals */
+   for (i = 0; i < 3; i ++ ) {
+   if (values[i].flags == SDP_ATTR_INVALID )
+   continue;
+
+   /* Expecting tag + uint16_t on all 3 attributes */
+   if (values[i].vlen != 3)
+   continue;
+
+   /* Make sure, we're reading a uint16_t */
+   v = values[i].value;
+   SDP_GET8(type, v);
+   if (type != SDP_DATA_UINT16 )
+   continue;
+
+   switch (values[i].attr) {
+   case 

Re: svn commit: r322437 - in head/sys/arm64: arm64 include

2017-08-12 Thread John Baldwin
On Saturday, August 12, 2017 06:42:55 PM John Baldwin wrote:
> Author: jhb
> Date: Sat Aug 12 18:42:54 2017
> New Revision: 322437
> URL: https://svnweb.freebsd.org/changeset/base/322437
> 
> Log:
>   Reliably enable debug exceptions on all CPUs.
>   
>   Previously, debug exceptions were only enabled on the boot CPU if
>   DDB was enabled in the dbg_monitor_init() function.  APs also called
>   this function, but since mp_machdep.c doesn't include opt_ddb.h, the
>   APs ended up calling an empty stub defined in 
>   instead of the real function.  Also, if DDB was not enabled in the kernel,
>   the boot CPU would not enable debug exceptions.
>   
>   Fix this by adding a new dbg_init() function that always clears the OS
>   lock to enable debug exceptions which the boot CPU and the APs call.
>   This function also calls dbg_monitor_init() to enable hardware breakpoints
>   from DDB on all CPUs if DDB is enabled.  Eventually base support for
>   hardware breakpoints/watchpoints will need to move out of the DDB-only
>   debug_monitor.c for use by userland debuggers.
>   
>   Reviewed by:andrew
>   Differential Revision:  https://reviews.freebsd.org/D12001

In particular, this fixes single stepping of userland processes when the
process is running on a CPU other than CPU 0.

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


svn commit: r322438 - in head: bin/sh/tests bin/sh/tests/invocation etc/mtree

2017-08-12 Thread Jilles Tjoelker
Author: jilles
Date: Sat Aug 12 19:17:48 2017
New Revision: 322438
URL: https://svnweb.freebsd.org/changeset/base/322438

Log:
  sh: Add tests for sh -c that already pass.
  
  PR:   220587
  Submitted by: Ryan Moeller

Added:
  head/bin/sh/tests/invocation/
  head/bin/sh/tests/invocation/Makefile   (contents, props changed)
  head/bin/sh/tests/invocation/sh-ac1.0   (contents, props changed)
  head/bin/sh/tests/invocation/sh-c1.0   (contents, props changed)
  head/bin/sh/tests/invocation/sh-ca1.0   (contents, props changed)
  head/bin/sh/tests/invocation/sh-fca1.0   (contents, props changed)
Modified:
  head/bin/sh/tests/Makefile
  head/etc/mtree/BSD.tests.dist

Modified: head/bin/sh/tests/Makefile
==
--- head/bin/sh/tests/Makefile  Sat Aug 12 18:42:54 2017(r322437)
+++ head/bin/sh/tests/Makefile  Sat Aug 12 19:17:48 2017(r322438)
@@ -6,6 +6,7 @@ TESTS_SUBDIRS+= builtins
 TESTS_SUBDIRS+=errors
 TESTS_SUBDIRS+=execution
 TESTS_SUBDIRS+=expansion
+TESTS_SUBDIRS+=invocation
 TESTS_SUBDIRS+=parameters
 TESTS_SUBDIRS+=parser
 TESTS_SUBDIRS+=set-e

Added: head/bin/sh/tests/invocation/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/invocation/Makefile   Sat Aug 12 19:17:48 2017
(r322438)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+PACKAGE=   tests
+
+TESTSDIR=  ${TESTSBASE}/bin/sh/${.CURDIR:T}
+
+.PATH: ${.CURDIR:H}
+ATF_TESTS_SH=  functional_test
+
+${PACKAGE}FILES+=  sh-ac1.0
+${PACKAGE}FILES+=  sh-c1.0
+${PACKAGE}FILES+=  sh-ca1.0
+${PACKAGE}FILES+=  sh-fca1.0
+
+.include 

Added: head/bin/sh/tests/invocation/sh-ac1.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/invocation/sh-ac1.0   Sat Aug 12 19:17:48 2017
(r322438)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+# Test that attached options before c are processed
+
+case `${SH} -ac 'echo $-:$0' moo` in
+*a*:moo) true ;;
+*) false ;;
+esac

Added: head/bin/sh/tests/invocation/sh-c1.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/invocation/sh-c1.0Sat Aug 12 19:17:48 2017
(r322438)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+# Test that -c executes command_string with the given name and arg
+
+${SH} -c 'echo $0 $@' moo foo | grep -qx -- "moo foo"

Added: head/bin/sh/tests/invocation/sh-ca1.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/invocation/sh-ca1.0   Sat Aug 12 19:17:48 2017
(r322438)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+# Test that attached options after c are processed
+
+case `${SH} -ca 'echo $-:$0' moo` in
+*a*:moo) true ;;
+*) false ;;
+esac

Added: head/bin/sh/tests/invocation/sh-fca1.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/invocation/sh-fca1.0  Sat Aug 12 19:17:48 2017
(r322438)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+# Test that attached options before and after c are processed
+
+case `${SH} -fca 'echo $-:$-:$0:$@' foo -bar` in
+*f*:*a*:foo:-bar) true ;;
+*) false ;;
+esac

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Sat Aug 12 18:42:54 2017
(r322437)
+++ head/etc/mtree/BSD.tests.dist   Sat Aug 12 19:17:48 2017
(r322438)
@@ -39,6 +39,8 @@
 ..
 expansion
 ..
+invocation
+..
 parameters
 ..
 parser
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322437 - in head/sys/arm64: arm64 include

2017-08-12 Thread John Baldwin
Author: jhb
Date: Sat Aug 12 18:42:54 2017
New Revision: 322437
URL: https://svnweb.freebsd.org/changeset/base/322437

Log:
  Reliably enable debug exceptions on all CPUs.
  
  Previously, debug exceptions were only enabled on the boot CPU if
  DDB was enabled in the dbg_monitor_init() function.  APs also called
  this function, but since mp_machdep.c doesn't include opt_ddb.h, the
  APs ended up calling an empty stub defined in 
  instead of the real function.  Also, if DDB was not enabled in the kernel,
  the boot CPU would not enable debug exceptions.
  
  Fix this by adding a new dbg_init() function that always clears the OS
  lock to enable debug exceptions which the boot CPU and the APs call.
  This function also calls dbg_monitor_init() to enable hardware breakpoints
  from DDB on all CPUs if DDB is enabled.  Eventually base support for
  hardware breakpoints/watchpoints will need to move out of the DDB-only
  debug_monitor.c for use by userland debuggers.
  
  Reviewed by:  andrew
  Differential Revision:https://reviews.freebsd.org/D12001

Modified:
  head/sys/arm64/arm64/debug_monitor.c
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/arm64/mp_machdep.c
  head/sys/arm64/include/machdep.h

Modified: head/sys/arm64/arm64/debug_monitor.c
==
--- head/sys/arm64/arm64/debug_monitor.cSat Aug 12 18:38:18 2017
(r322436)
+++ head/sys/arm64/arm64/debug_monitor.cSat Aug 12 18:42:54 2017
(r322437)
@@ -453,15 +453,12 @@ dbg_monitor_init(void)
 {
u_int i;
 
-   /* Clear OS lock */
-   WRITE_SPECIALREG(OSLAR_EL1, 0);
-
/* Find out many breakpoints and watchpoints we can use */
dbg_watchpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 20) & 0xf) + 
1;
dbg_breakpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 12) & 0xf) + 
1;
 
if (bootverbose && PCPU_GET(cpuid) == 0) {
-   db_printf("%d watchpoints and %d breakpoints supported\n",
+   printf("%d watchpoints and %d breakpoints supported\n",
dbg_watchpoint_num, dbg_breakpoint_num);
}
 

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Sat Aug 12 18:38:18 2017
(r322436)
+++ head/sys/arm64/arm64/machdep.c  Sat Aug 12 18:42:54 2017
(r322437)
@@ -1051,11 +1051,24 @@ initarm(struct arm64_bootparams *abp)
mutex_init();
init_param2(physmem);
 
-   dbg_monitor_init();
+   dbg_init();
kdb_init();
pan_enable();
 
early_boot = 0;
+}
+
+void
+dbg_init(void)
+{
+
+   /* Clear OS lock */
+   WRITE_SPECIALREG(OSLAR_EL1, 0);
+
+   /* This permits DDB to use debug registers for watchpoints. */
+   dbg_monitor_init();
+
+   /* TODO: Eventually will need to initialize debug registers here. */
 }
 
 #ifdef DDB

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Sat Aug 12 18:38:18 2017
(r322436)
+++ head/sys/arm64/arm64/mp_machdep.c   Sat Aug 12 18:42:54 2017
(r322437)
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -272,7 +271,7 @@ init_secondary(uint64_t cpu)
vfp_init();
 #endif
 
-   dbg_monitor_init();
+   dbg_init();
pan_enable();
 
/* Enable interrupts */

Modified: head/sys/arm64/include/machdep.h
==
--- head/sys/arm64/include/machdep.hSat Aug 12 18:38:18 2017
(r322436)
+++ head/sys/arm64/include/machdep.hSat Aug 12 18:42:54 2017
(r322437)
@@ -48,6 +48,7 @@ extern enum arm64_bus arm64_bus_method;
 extern vm_paddr_t physmap[];
 extern u_int physmap_idx;
 
+void dbg_init(void);
 void initarm(struct arm64_bootparams *);
 extern void (*pagezero)(void *);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-08-12 Thread John Baldwin
Author: jhb
Date: Sat Aug 12 18:38:18 2017
New Revision: 322436
URL: https://svnweb.freebsd.org/changeset/base/322436

Log:
  Don't panic for PT_GETFPREGS.
  
  Only fetch the VFP state from the CPU if the thread whose registers are
  being requested is the current thread.  If a stopped thread's registers
  are being fetched by a debugger, the saved state in the PCB is already
  valid.
  
  Reviewed by:  andrew
  MFC after:1 week

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

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Sat Aug 12 18:28:02 2017
(r322435)
+++ head/sys/arm64/arm64/machdep.c  Sat Aug 12 18:38:18 2017
(r322436)
@@ -222,7 +222,8 @@ fill_fpregs(struct thread *td, struct fpreg *regs)
 * If we have just been running VFP instructions we will
 * need to save the state to memcpy it below.
 */
-   vfp_save_state(td, pcb);
+   if (td == curthread)
+   vfp_save_state(td, pcb);
 
KASSERT(pcb->pcb_fpusaved == >pcb_fpustate,
("Called fill_fpregs while the kernel is using the VFP"));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322435 - head/lib/msun/src

2017-08-12 Thread Ryan Libby
Author: rlibby
Date: Sat Aug 12 18:28:02 2017
New Revision: 322435
URL: https://svnweb.freebsd.org/changeset/base/322435

Log:
  Revert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches
  
  Either need a different way to spell HALF_LDBL_MAX, or a different way
  to spell LDBL_MAX_EXP, or a different approach.
  
  Reported by:  ian

Modified:
  head/lib/msun/src/catrigl.c
  head/lib/msun/src/math_private.h
  head/lib/msun/src/s_csqrtl.c

Modified: head/lib/msun/src/catrigl.c
==
--- head/lib/msun/src/catrigl.c Sat Aug 12 18:11:41 2017(r322434)
+++ head/lib/msun/src/catrigl.c Sat Aug 12 18:28:02 2017(r322435)
@@ -307,7 +307,7 @@ clog_for_large_values(long double complex z)
ay = t;
}
 
-   if (ax >= HALF_LDBL_MAX)
+   if (ax > LDBL_MAX / 2)
return (CMPLXL(logl(hypotl(x / m_e, y / m_e)) + 1,
atan2l(y, x)));
 

Modified: head/lib/msun/src/math_private.h
==
--- head/lib/msun/src/math_private.hSat Aug 12 18:11:41 2017
(r322434)
+++ head/lib/msun/src/math_private.hSat Aug 12 18:28:02 2017
(r322435)
@@ -272,15 +272,6 @@ do {   
\
 #defineLD80C(m, ex, v) { .e = (v), }
 #endif
 
-/*
- * XXX LDBL_MAX is broken on i386.  If the precise value of LDBL_MAX is not
- * needed, this may be worked around by instead referring to a proxy, such
- * as HALF_LDBL_MAX, below.  HALF_LDBL_MAX is approximately LDBL_MAX / 2,
- * actually just greater than.  Note that 2 * HALF_LDBL_MAX will always
- * overflow to infinity, regardless of the precision and rounding modes.
- */
-#defineHALF_LDBL_MAX   __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L)
-
 #ifdef FLT_EVAL_METHOD
 /*
  * Attempt to get strict C99 semantics for assignment with non-C99 compilers.

Modified: head/lib/msun/src/s_csqrtl.c
==
--- head/lib/msun/src/s_csqrtl.cSat Aug 12 18:11:41 2017
(r322434)
+++ head/lib/msun/src/s_csqrtl.cSat Aug 12 18:28:02 2017
(r322435)
@@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
 #pragmaSTDC CX_LIMITED_RANGE   ON
 
 /* We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)). */
-#defineTHRESH  (HALF_LDBL_MAX / 1.207106781186547524400844362104849L)
+#defineTHRESH  (LDBL_MAX / 2.414213562373095048801688724209698L)
 
 long double complex
 csqrtl(long double complex z)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322434 - head/share/mk

2017-08-12 Thread Li-Wen Hsu
Author: lwhsu (ports committer)
Date: Sat Aug 12 18:11:41 2017
New Revision: 322434
URL: https://svnweb.freebsd.org/changeset/base/322434

Log:
  Re-remove excess / for installing SYMLINKS
  
  This excess / was introduced in r280129, and fixed in r295230, but got
  re-introduced while merging another branch in r298107.
  
  Approved by:  gjb
  Differential Revision:https://reviews.freebsd.org/D11995

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

Modified: head/share/mk/bsd.links.mk
==
--- head/share/mk/bsd.links.mk  Sat Aug 12 17:50:22 2017(r322433)
+++ head/share/mk/bsd.links.mk  Sat Aug 12 18:11:41 2017(r322434)
@@ -20,5 +20,5 @@ _installlinks:
 .endfor
 .for s t in ${SYMLINKS}
@${ECHO} "${t} -> ${s}" ;\
-   ${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}/${t}
+   ${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}${t}
 .endfor
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r322418 - head/lib/msun/src

2017-08-12 Thread Ryan Libby
On Sat, Aug 12, 2017 at 9:57 AM, Ryan Libby  wrote:
> On Sat, Aug 12, 2017 at 9:26 AM, Ian Lepore  wrote:
>> On Fri, 2017-08-11 at 22:41 +, Ryan Libby wrote:
>>> Author: rlibby
>>> Date: Fri Aug 11 22:41:24 2017
>>> New Revision: 322418
>>> URL: https://svnweb.freebsd.org/changeset/base/322418
>>>
>>> Log:
>>>   lib/msun: avoid referring to broken LDBL_MAX
>>>
>>>   LDBL_MAX is broken on i386:
>>>   https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September
>>> /000288.html
>>>
>>>   Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
>>>   for some time, and newer versions of gcc are now warning that the
>>>   "floating constant exceeds range of 'long double'".  Avoid this by
>>>   referring to half the value of LDBL_MAX instead.
>>>
>>>   Reviewed by:bde
>>>   Approved by:markj (mentor)
>>>   Sponsored by:   Dell EMC Isilon
>>>
>>
>> I now get this error when building toolchain for sparc:
>>
>> cc -isystem 
>> /b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/include
>>  -L/b/staging/freebsd/head/obj/sparc64.spar
>> c64/b/staging/freebsd/head/src/tmp/usr/lib 
>> -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/lib
>>  --sysroot=/b/
>> staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp 
>> -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/
>> src/tmp/usr/bin -fPIC -DPIC -g -O2 -pipe 
>> -I/b/staging/freebsd/head/src/lib/msun/ld128 
>> -I/b/staging/freebsd/head/src/lib/msun/sparc64 -I/b/sta
>> ging/freebsd/head/src/lib/msun/src 
>> -I/b/staging/freebsd/head/src/lib/libc/include  
>> -I/b/staging/freebsd/head/src/lib/libc/sparc64   -MD  -MF.
>> depend.catrigl.pico -MTcatrigl.pico -std=gnu99 -fstack-protector-strong 
>> -Wsystem-headers -Werror -Wno-pointer-sign -Wno-unknown-pragmas -
>> c /b/staging/freebsd/head/src/lib/msun/src/catrigl.c -o catrigl.pico
>> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting 
>> "0x0.8p" and "(" does not give a valid preprocessing token
>> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: exponent 
>> has no digits
>> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting ")" 
>> and "L" does not give a valid preprocessing token
>> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c: In function 
>> 'clog_for_large_values':
>> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310: error: expected ')' 
>> before 'L'
>> *** [catrigl.pico] Error code 1
>
> Thanks, I see it.  It also shows up on the sparc64 ci build [1].  Let me
> see if I can find a quick fix, else I guess we can just back it out for
> now.
>
> [1] https://ci.freebsd.org/job/FreeBSD-head-sparc64-build/2534/

A few possible quick fixes:

 - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP
   definitions from (+16384) to 16384.

 - Change HALF_LDBL_MAX from
#define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L)
   to
#if LDBL_MAX_EXP != 0x4000
#error "Unsupported long double format"
#endif
#define HALF_LDBL_MAX 0x0.8p16384L

 - Change the HALF_LDBL_MAX constant to a variable constructed with
   LD80C(), I think with
LD80C(0x8000, 16383, 5.9486574767861588254e+4931L)
   but this also requires #error for LDBL_MAX_EXP != 0x4000, so not
   really any better than the above.

I think I will back the patch out for now and go back to review.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-08-12 Thread Sevan Janiyan
Author: sevan (doc committer)
Date: Sat Aug 12 17:46:50 2017
New Revision: 322432
URL: https://svnweb.freebsd.org/changeset/base/322432

Log:
  Add missing header.
  S_IRUSR is defined in sys/stat.h
  
  PR:   209229
  Submitted by: 
  Approved by:  bcr (mentor)
  MFC after:5 days
  Differential Revision:https://reviews.freebsd.org/D12007

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

Modified: head/lib/libc/sys/shmget.2
==
--- head/lib/libc/sys/shmget.2  Sat Aug 12 17:39:32 2017(r322431)
+++ head/lib/libc/sys/shmget.2  Sat Aug 12 17:46:50 2017(r322432)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 17, 2010
+.Dd August 12, 2017
 .Dt SHMGET 2
 .Os
 .Sh NAME
@@ -35,6 +35,7 @@
 .Lb libc
 .Sh SYNOPSIS
 .In sys/types.h
+.In sys/stat.h
 .In sys/ipc.h
 .In sys/shm.h
 .Ft int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322431 - head/sys/dev/iicbus

2017-08-12 Thread Ian Lepore
Author: ian
Date: Sat Aug 12 17:39:32 2017
New Revision: 322431
URL: https://svnweb.freebsd.org/changeset/base/322431

Log:
  Bid for the device with BUS_PROBE_GENERIC, because this is very much a
  generic driver with minimal feature support for a large number of chips.
  More featureful per-chip drivers might exist (especially out-of-tree) and
  those should win the bidding even if they use BUS_PROBE_DEFAULT.

Modified:
  head/sys/dev/iicbus/nxprtc.c

Modified: head/sys/dev/iicbus/nxprtc.c
==
--- head/sys/dev/iicbus/nxprtc.cSat Aug 12 17:07:32 2017
(r322430)
+++ head/sys/dev/iicbus/nxprtc.cSat Aug 12 17:39:32 2017
(r322431)
@@ -702,7 +702,7 @@ nxprtc_probe(device_t dev)
 #endif
device_set_desc(dev, desc_strings[chiptype]);
 
-   return (BUS_PROBE_DEFAULT);
+   return (BUS_PROBE_GENERIC);
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322429 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk

2017-08-12 Thread Warner Losh
Author: imp
Date: Sat Aug 12 17:07:27 2017
New Revision: 322429
URL: https://svnweb.freebsd.org/changeset/base/322429

Log:
  Make _TO_CPUARCH macro for ARCH to CPUARCH conversions
  
  Consolidate all the regular expressions to convert from MACHINE_ARCH
  to MACHINE_CPUARCH into a variable and use that variable in preference
  to the almost identical copies in the tree (which should have been
  identical).
  
  Differential Revision: https://reviews.freebsd.org/D11986

Modified:
  head/Makefile
  head/gnu/usr.bin/binutils/Makefile.inc0
  head/gnu/usr.bin/cc/Makefile.tgt
  head/gnu/usr.bin/gdb/Makefile.inc
  head/gnu/usr.bin/gdb/libgdb/Makefile
  head/share/mk/sys.mk

Modified: head/Makefile
==
--- head/Makefile   Sat Aug 12 15:51:46 2017(r322428)
+++ head/Makefile   Sat Aug 12 17:07:27 2017(r322429)
@@ -245,12 +245,17 @@ _MAKE+=   MK_META_MODE=no
 .endif # !exists(/dev/filemon) && !defined(NO_FILEMON)
 .endif # !defined(_CAN_USE_META_MODE)
 
-# Guess machine architecture from machine type, and vice versa.
+# Guess target architecture from target type, and vice versa, based on
+# historic FreeBSD practice of tending to have TARGET == TARGET_ARCH
+# expanding to TARGET == TARGET_CPUARCH in recent times, with known
+# exceptions.
 .if !defined(TARGET_ARCH) && defined(TARGET)
+# T->TA mapping is usually TARGET with arm64 the odd man out
 _TARGET_ARCH=  ${TARGET:S/arm64/aarch64/}
 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
 ${TARGET_ARCH} != ${MACHINE_ARCH}
-_TARGET=   
${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/powerpcspe/powerpc/:C/riscv64(sf)?/riscv/}
+# TA->T mapping is accidentally CPUARCH with aarch64 the odd man out
+_TARGET=   ${TARGET_ARCH:${__TO_CPUARCH}:C/aarch64/arm64/}
 .endif
 .if defined(TARGET) && !defined(_TARGET)
 _TARGET=${TARGET}

Modified: head/gnu/usr.bin/binutils/Makefile.inc0
==
--- head/gnu/usr.bin/binutils/Makefile.inc0 Sat Aug 12 15:51:46 2017
(r322428)
+++ head/gnu/usr.bin/binutils/Makefile.inc0 Sat Aug 12 17:07:27 2017
(r322429)
@@ -7,7 +7,7 @@
 VERSION=   "2.17.50 [FreeBSD] 2007-07-03"
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/cc/Makefile.tgt
==
--- head/gnu/usr.bin/cc/Makefile.tgtSat Aug 12 15:51:46 2017
(r322428)
+++ head/gnu/usr.bin/cc/Makefile.tgtSat Aug 12 17:07:27 2017
(r322429)
@@ -4,7 +4,7 @@
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv64/}
+TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/gdb/Makefile.inc
==
--- head/gnu/usr.bin/gdb/Makefile.inc   Sat Aug 12 15:51:46 2017
(r322428)
+++ head/gnu/usr.bin/gdb/Makefile.inc   Sat Aug 12 17:07:27 2017
(r322429)
@@ -23,7 +23,7 @@ OBJ_RL= ${OBJTOP}/gnu/lib/libreadline/readline
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/gdb/libgdb/Makefile
==
--- head/gnu/usr.bin/gdb/libgdb/MakefileSat Aug 12 15:51:46 2017
(r322428)
+++ head/gnu/usr.bin/gdb/libgdb/MakefileSat Aug 12 17:07:27 2017
(r322429)
@@ -4,7 +4,7 @@
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/share/mk/sys.mk
==
--- head/share/mk/sys.mkSat Aug 12 15:51:46 2017(r322428)
+++ head/share/mk/sys.mkSat Aug 12 17:07:27 2017(r322429)
@@ -8,12 +8,13 @@ unix  ?=  We run FreeBSD, not UNIX.
 #
 # MACHINE_CPUARCH defines a collection of MACHINE_ARCH.  Machines with
 # the same MACHINE_ARCH can run each other's binaries, so it necessarily
-# has word 

svn commit: r322430 - head/share/mk

2017-08-12 Thread Warner Losh
Author: imp
Date: Sat Aug 12 17:07:32 2017
New Revision: 322430
URL: https://svnweb.freebsd.org/changeset/base/322430

Log:
  arm*hf is no longer a thing, remove it from the conversion now that it's easy.
  
  Submitted by: andyt@

Modified:
  head/share/mk/sys.mk

Modified: head/share/mk/sys.mk
==
--- head/share/mk/sys.mkSat Aug 12 17:07:27 2017(r322429)
+++ head/share/mk/sys.mkSat Aug 12 17:07:32 2017(r322430)
@@ -13,7 +13,7 @@ unix  ?=  We run FreeBSD, not UNIX.
 # and/or endian.  This is called MACHINE_CPU in NetBSD, but that's used
 # for something different in FreeBSD.
 #
-__TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/
+__TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/
 MACHINE_CPUARCH=${MACHINE_ARCH:${__TO_CPUARCH}}
 .endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r322418 - head/lib/msun/src

2017-08-12 Thread Ryan Libby
On Sat, Aug 12, 2017 at 9:26 AM, Ian Lepore  wrote:
> On Fri, 2017-08-11 at 22:41 +, Ryan Libby wrote:
>> Author: rlibby
>> Date: Fri Aug 11 22:41:24 2017
>> New Revision: 322418
>> URL: https://svnweb.freebsd.org/changeset/base/322418
>>
>> Log:
>>   lib/msun: avoid referring to broken LDBL_MAX
>>
>>   LDBL_MAX is broken on i386:
>>   https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September
>> /000288.html
>>
>>   Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
>>   for some time, and newer versions of gcc are now warning that the
>>   "floating constant exceeds range of 'long double'".  Avoid this by
>>   referring to half the value of LDBL_MAX instead.
>>
>>   Reviewed by:bde
>>   Approved by:markj (mentor)
>>   Sponsored by:   Dell EMC Isilon
>>
>
> I now get this error when building toolchain for sparc:
>
> cc -isystem 
> /b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/include
>  -L/b/staging/freebsd/head/obj/sparc64.spar
> c64/b/staging/freebsd/head/src/tmp/usr/lib 
> -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/lib
>  --sysroot=/b/
> staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp 
> -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/
> src/tmp/usr/bin -fPIC -DPIC -g -O2 -pipe 
> -I/b/staging/freebsd/head/src/lib/msun/ld128 
> -I/b/staging/freebsd/head/src/lib/msun/sparc64 -I/b/sta
> ging/freebsd/head/src/lib/msun/src 
> -I/b/staging/freebsd/head/src/lib/libc/include  
> -I/b/staging/freebsd/head/src/lib/libc/sparc64   -MD  -MF.
> depend.catrigl.pico -MTcatrigl.pico -std=gnu99 -fstack-protector-strong 
> -Wsystem-headers -Werror -Wno-pointer-sign -Wno-unknown-pragmas -
> c /b/staging/freebsd/head/src/lib/msun/src/catrigl.c -o catrigl.pico
> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting 
> "0x0.8p" and "(" does not give a valid preprocessing token
> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: exponent has 
> no digits
> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting ")" 
> and "L" does not give a valid preprocessing token
> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c: In function 
> 'clog_for_large_values':
> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310: error: expected ')' 
> before 'L'
> *** [catrigl.pico] Error code 1

Thanks, I see it.  It also shows up on the sparc64 ci build [1].  Let me
see if I can find a quick fix, else I guess we can just back it out for
now.

[1] https://ci.freebsd.org/job/FreeBSD-head-sparc64-build/2534/
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r322418 - head/lib/msun/src

2017-08-12 Thread Ian Lepore
On Fri, 2017-08-11 at 22:41 +, Ryan Libby wrote:
> Author: rlibby
> Date: Fri Aug 11 22:41:24 2017
> New Revision: 322418
> URL: https://svnweb.freebsd.org/changeset/base/322418
> 
> Log:
>   lib/msun: avoid referring to broken LDBL_MAX
>   
>   LDBL_MAX is broken on i386:
>   https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September
> /000288.html
>   
>   Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
>   for some time, and newer versions of gcc are now warning that the
>   "floating constant exceeds range of 'long double'".  Avoid this by
>   referring to half the value of LDBL_MAX instead.
>   
>   Reviewed by:bde
>   Approved by:markj (mentor)
>   Sponsored by:   Dell EMC Isilon
> 

I now get this error when building toolchain for sparc:

cc -isystem 
/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/include
 -L/b/staging/freebsd/head/obj/sparc64.spar
c64/b/staging/freebsd/head/src/tmp/usr/lib 
-B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/lib
 --sysroot=/b/
staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp 
-B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/
src/tmp/usr/bin -fPIC -DPIC -g -O2 -pipe 
-I/b/staging/freebsd/head/src/lib/msun/ld128 
-I/b/staging/freebsd/head/src/lib/msun/sparc64 -I/b/sta
ging/freebsd/head/src/lib/msun/src 
-I/b/staging/freebsd/head/src/lib/libc/include  
-I/b/staging/freebsd/head/src/lib/libc/sparc64   -MD  -MF.
depend.catrigl.pico -MTcatrigl.pico -std=gnu99 -fstack-protector-strong 
-Wsystem-headers -Werror -Wno-pointer-sign -Wno-unknown-pragmas -
c /b/staging/freebsd/head/src/lib/msun/src/catrigl.c -o catrigl.pico
/b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting 
"0x0.8p" and "(" does not give a valid preprocessing token
/b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: exponent has 
no digits
/b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting ")" 
and "L" does not give a valid preprocessing token
/b/staging/freebsd/head/src/lib/msun/src/catrigl.c: In function 
'clog_for_large_values':
/b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310: error: expected ')' 
before 'L'
*** [catrigl.pico] Error code 1

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


Re: svn commit: r322427 - in head/lib/libc: stdlib string tests/string

2017-08-12 Thread Conrad Meyer
On Sat, Aug 12, 2017 at 8:18 AM, Konstantin Belousov  wrote:
> Author: kib
> Date: Sat Aug 12 15:18:17 2017
> New Revision: 322427
> URL: https://svnweb.freebsd.org/changeset/base/322427
>
> Log:
>   Improve standard compliance for memset_s() and abort_handler_s().
>
>   abort_handler_s() currently simply calls abort(), though the standard
>   specifies more: "Writes an implementation-defined message to stderr
>   which must include the string pointed to by msg and calls abort()."
>
>   memset_s() is missing error condition "n > smax", and does not invoke
>   the constraint handler after filling the buffer: "following errors are
>   detected at runtime and call the currently installed constraint
>   handler function after storing ch in every location of the destination
>   range [dest, dest+destsz) if dest and destsz are themselves valid",
>   one of the errors is "n > smax" itself.
>
>   Submitted by: Yuri Pankov 
>   MFC after:1 week
>   Differential revision:https://reviews.freebsd.org/D11991

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


svn commit: r322428 - head/usr.bin/mkesdb

2017-08-12 Thread Sevan Janiyan
Author: sevan (doc committer)
Date: Sat Aug 12 15:51:46 2017
New Revision: 322428
URL: https://svnweb.freebsd.org/changeset/base/322428

Log:
  Set usage() to show -d flag
  mkesdb supports the -d flag for enabling debug mode, as documented in the 
manual.
  
  PR:   209865
  Submitted by: Maya Rashish 
  Reviewed by:  imp
  Approved by:  bcr (mentor)
  Obtained from:NetBSD
  MFC after:7 days
  Differential Revision:https://reviews.freebsd.org/D11987

Modified:
  head/usr.bin/mkesdb/yacc.y

Modified: head/usr.bin/mkesdb/yacc.y
==
--- head/usr.bin/mkesdb/yacc.y  Sat Aug 12 15:18:17 2017(r322427)
+++ head/usr.bin/mkesdb/yacc.y  Sat Aug 12 15:51:46 2017(r322428)
@@ -278,8 +278,8 @@ usage(void)
 {
errx(EXIT_FAILURE,
"usage:\n"
-   "\t%s [-o outfile] [infile]\n"
-   "\t%s -m [-o outfile] [infile]",
+   "\t%s [-d] [-o outfile] [infile]\n"
+   "\t%s -m [-d] [-o outfile] [infile]",
getprogname(), getprogname());
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322427 - in head/lib/libc: stdlib string tests/string

2017-08-12 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 12 15:18:17 2017
New Revision: 322427
URL: https://svnweb.freebsd.org/changeset/base/322427

Log:
  Improve standard compliance for memset_s() and abort_handler_s().
  
  abort_handler_s() currently simply calls abort(), though the standard
  specifies more: "Writes an implementation-defined message to stderr
  which must include the string pointed to by msg and calls abort()."
  
  memset_s() is missing error condition "n > smax", and does not invoke
  the constraint handler after filling the buffer: "following errors are
  detected at runtime and call the currently installed constraint
  handler function after storing ch in every location of the destination
  range [dest, dest+destsz) if dest and destsz are themselves valid",
  one of the errors is "n > smax" itself.
  
  Submitted by: Yuri Pankov 
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D11991

Modified:
  head/lib/libc/stdlib/set_constraint_handler_s.c
  head/lib/libc/string/memset_s.c
  head/lib/libc/tests/string/memset_s_test.c

Modified: head/lib/libc/stdlib/set_constraint_handler_s.c
==
--- head/lib/libc/stdlib/set_constraint_handler_s.c Sat Aug 12 14:58:09 
2017(r322426)
+++ head/lib/libc/stdlib/set_constraint_handler_s.c Sat Aug 12 15:18:17 
2017(r322427)
@@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include "un-namespace.h"
 #include "libc_private.h"
 
@@ -81,10 +83,14 @@ __throw_constraint_handler_s(const char * restrict msg
 }
 
 void
-abort_handler_s(const char * restrict msg __unused,
-void * restrict ptr __unused, errno_t error __unused)
+abort_handler_s(const char * restrict msg, void * restrict ptr __unused,
+errno_t error __unused)
 {
+   static const char ahs[] = "abort_handler_s : ";
 
+   (void) _write(STDERR_FILENO, ahs, sizeof(ahs) - 1);
+   (void) _write(STDERR_FILENO, msg, strlen(msg));
+   (void) _write(STDERR_FILENO, "\n", 1);
abort();
 }
 

Modified: head/lib/libc/string/memset_s.c
==
--- head/lib/libc/string/memset_s.c Sat Aug 12 14:58:09 2017
(r322426)
+++ head/lib/libc/string/memset_s.c Sat Aug 12 15:18:17 2017
(r322427)
@@ -42,7 +42,7 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n)
volatile unsigned char *dst;
 
ret = EINVAL;
-   lim = smax;
+   lim = n < smax ? n : smax;
v = (unsigned char)c;
dst = (unsigned char *)s;
if (s == NULL) {
@@ -53,11 +53,14 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n)
} else if (n > RSIZE_MAX) {
__throw_constraint_handler_s("memset_s : n > RSIZE_MAX", ret);
} else {
-   if (n < smax)
-   lim = n;
while (lim > 0)
dst[--lim] = v;
-   ret = 0;
+   if (n > smax) {
+   __throw_constraint_handler_s("memset_s : n > smax",
+   ret);
+   } else {
+   ret = 0;
+   }
}
return (ret);
 }

Modified: head/lib/libc/tests/string/memset_s_test.c
==
--- head/lib/libc/tests/string/memset_s_test.c  Sat Aug 12 14:58:09 2017
(r322426)
+++ head/lib/libc/tests/string/memset_s_test.c  Sat Aug 12 15:18:17 2017
(r322427)
@@ -109,13 +109,18 @@ ATF_TC_BODY(n_lt_smax, tc)
assert(b[2] == 3);
 }
 
-/* n > smax */
+/* n > smax, handler */
 ATF_TC_WITHOUT_HEAD(n_gt_smax);
 ATF_TC_BODY(n_gt_smax, tc)
 {
char b[3] = {1, 2, 3};
 
-   assert(memset_s([0], 1, 9, 3) == 0);
+   e = 0;
+   m = NULL;
+   set_constraint_handler_s(h);
+   assert(memset_s([0], 1, 9, 3) != 0);
+   assert(e > 0);
+   assert(strcmp(m, "memset_s : n > smax") == 0);
assert(b[0] == 9);
assert(b[1] == 2);
assert(b[2] == 3);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322426 - head/lib/libc/string

2017-08-12 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 12 14:58:09 2017
New Revision: 322426
URL: https://svnweb.freebsd.org/changeset/base/322426

Log:
  Fix indent.
  
  Submitted by: Yuri Pankov 
  MFC after:3 days

Modified:
  head/lib/libc/string/memset_s.c

Modified: head/lib/libc/string/memset_s.c
==
--- head/lib/libc/string/memset_s.c Sat Aug 12 14:02:19 2017
(r322425)
+++ head/lib/libc/string/memset_s.c Sat Aug 12 14:58:09 2017
(r322426)
@@ -49,7 +49,7 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n)
__throw_constraint_handler_s("memset_s : s is NULL", ret);
} else if (smax > RSIZE_MAX) {
__throw_constraint_handler_s("memset_s : smax > RSIZE_MAX",
-ret);
+   ret);
} else if (n > RSIZE_MAX) {
__throw_constraint_handler_s("memset_s : n > RSIZE_MAX", ret);
} else {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322425 - in head/sys/dev/cxgbe: . common

2017-08-12 Thread Navdeep Parhar
Author: np
Date: Sat Aug 12 14:02:19 2017
New Revision: 322425
URL: https://svnweb.freebsd.org/changeset/base/322425

Log:
  cxgbe(4): Save the last reported link parameters and compare them with
  the current state to determine whether to generate a link-state change
  notification.  This fixes a bug introduced in r321063 that caused the
  driver to sometimes skip these notifications.
  
  Reported by:  Jason Eggleston @ LLNW
  MFC after:3 days
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hSat Aug 12 12:17:38 2017
(r322424)
+++ head/sys/dev/cxgbe/adapter.hSat Aug 12 14:02:19 2017
(r322425)
@@ -287,6 +287,7 @@ struct port_info {
uint8_t  rx_chan_map;   /* rx MPS channel bitmap */
 
struct link_config link_cfg;
+   struct link_config old_link_cfg;
 
struct timeval last_refreshed;
struct port_stats stats;
@@ -1124,8 +1125,8 @@ extern device_method_t cxgbe_methods[];
 int t4_os_find_pci_capability(struct adapter *, int);
 int t4_os_pci_save_state(struct adapter *);
 int t4_os_pci_restore_state(struct adapter *);
-void t4_os_portmod_changed(struct port_info *, int, int, struct link_config *);
-void t4_os_link_changed(struct port_info *, struct link_config *);
+void t4_os_portmod_changed(struct port_info *);
+void t4_os_link_changed(struct port_info *);
 void t4_iterate(void (*)(struct adapter *, void *), void *);
 void t4_init_devnames(struct adapter *);
 void t4_add_adapter(struct adapter *);

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==
--- head/sys/dev/cxgbe/common/t4_hw.c   Sat Aug 12 12:17:38 2017
(r322424)
+++ head/sys/dev/cxgbe/common/t4_hw.c   Sat Aug 12 14:02:19 2017
(r322425)
@@ -7715,7 +7715,7 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6
int i, old_ptype, old_mtype;
int chan = G_FW_PORT_CMD_PORTID(be32_to_cpu(p->op_to_portid));
struct port_info *pi = NULL;
-   struct link_config *lc, old_lc;
+   struct link_config *lc, *old_lc;
 
for_each_port(adap, i) {
pi = adap2pinfo(adap, i);
@@ -7724,19 +7724,20 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6
}
 
lc = >link_cfg;
-   old_lc = *lc;
+   old_lc = >old_link_cfg;
old_ptype = pi->port_type;
old_mtype = pi->mod_type;
 
handle_port_info(pi, >u.info);
if (old_ptype != pi->port_type || old_mtype != pi->mod_type) {
-   t4_os_portmod_changed(pi, old_ptype, old_mtype,
-   _lc);
+   t4_os_portmod_changed(pi);
}
-   if (old_lc.link_ok != lc->link_ok ||
-   old_lc.speed != lc->speed ||
-   old_lc.fc != lc->fc) {
-   t4_os_link_changed(pi, _lc);
+   if (old_lc->link_ok != lc->link_ok ||
+   old_lc->speed != lc->speed ||
+   old_lc->fec != lc->fec ||
+   old_lc->fc != lc->fc) {
+   t4_os_link_changed(pi);
+   *old_lc = *lc;
}
} else {
CH_WARN_RATELIMIT(adap, "Unknown firmware reply %d\n", opcode);

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cSat Aug 12 12:17:38 2017
(r322424)
+++ head/sys/dev/cxgbe/t4_main.cSat Aug 12 14:02:19 2017
(r322425)
@@ -4335,7 +4335,8 @@ cxgbe_uninit_synchronized(struct vi_info *vi)
pi->link_cfg.link_ok = 0;
pi->link_cfg.speed = 0;
pi->link_cfg.link_down_rc = 255;
-   t4_os_link_changed(pi, NULL);
+   t4_os_link_changed(pi);
+   pi->old_link_cfg = pi->link_cfg;
 
return (0);
 }
@@ -9274,8 +9275,7 @@ t4_os_pci_restore_state(struct adapter *sc)
 }
 
 void
-t4_os_portmod_changed(struct port_info *pi, int old_ptype, int old_mtype,
-struct link_config *old_lc)
+t4_os_portmod_changed(struct port_info *pi)
 {
struct vi_info *vi;
struct ifnet *ifp;
@@ -9312,7 +9312,7 @@ t4_os_portmod_changed(struct port_info *pi, int old_pt
 }
 
 void
-t4_os_link_changed(struct port_info *pi, struct link_config *old_lc)
+t4_os_link_changed(struct port_info *pi)
 {
struct vi_info *vi;
struct ifnet *ifp;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to 

svn commit: r322424 - head/usr.bin/units

2017-08-12 Thread Sevan Janiyan
Author: sevan (doc committer)
Date: Sat Aug 12 12:17:38 2017
New Revision: 322424
URL: https://svnweb.freebsd.org/changeset/base/322424

Log:
  Correct the -H longopt equivillant
  
  PR:   209876
  Submitted by: 
  Approved by:  bcr (mentor)
  Differential Revision:https://reviews.freebsd.org/D11988

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

Modified: head/usr.bin/units/units.1
==
--- head/usr.bin/units/units.1  Sat Aug 12 10:22:18 2017(r322423)
+++ head/usr.bin/units/units.1  Sat Aug 12 12:17:38 2017(r322424)
@@ -1,5 +1,5 @@
 .\" $FreeBSD$
-.Dd July 4, 2014
+.Dd August 12, 2017
 .Dt UNITS 1
 .Os
 .Sh NAME
@@ -18,7 +18,7 @@ The following options are available:
 Show an overview of options
 .It Fl f Ar filename \ , Fl -file Ar filename
 Specify the name of the units data file to load.
-.It Fl H Ar filename \ , Fl -historyfile Ar filename
+.It Fl H Ar filename \ , Fl -history Ar filename
 Ignored, for compatibility with GNU units.
 .It Fl e , Fl -exponential
 Behave as if -o '%6e' was typed.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"