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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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


pgpchIWM8G0ds.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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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"