Re: svn commit: r343111 - in head: cddl/lib/libdtrace contrib/libc++/include contrib/libxo/tests/gettext contrib/libxo/tests/gettext/po/pig_latin contrib/openbsm/libbsm contrib/openbsm/sys/bsm lib/lib

2019-01-16 Thread Charlie Li via svn-src-head
On 17/01/2019 01:35, Kirk McKusick wrote:
> Modified: head/contrib/libc++/include/errno.h
> ==
> --- head/contrib/libc++/include/errno.h   Thu Jan 17 06:34:39 2019
> (r343110)
> +++ head/contrib/libc++/include/errno.h   Thu Jan 17 06:35:45 2019
> (r343111)
> @@ -33,49 +33,72 @@ Macros:
>  
>  #ifdef __cplusplus
>  
> -#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
> +#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) || !defined(EINTEGRITY)
>  
>  #ifdef ELAST
>  
>  static const int __elast1 = ELAST+1;
>  static const int __elast2 = ELAST+2;
> +static const int __elast2 = ELAST+3;
>  
>  #else
>  
>  static const int __elast1 = 104;
>  static const int __elast2 = 105;
> +static const int __elast2 = 106;
>  
>  #endif
>  
> -#ifdef ENOTRECOVERABLE
> +#if !defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && !defined(EINTEGRITY)
> +#define ENOTRECOVERABLE __elast1
> +#define EOWNERDEAD __elast2
> +#define EINTEGRITY __elast3
> +#ifdef ELAST
> +#undef ELAST
> +#define ELAST EINTEGRITY
>  
> +#elif !defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && 
> defined(EINTEGRITY)
> +#define ENOTRECOVERABLE __elast1
> +#define EOWNERDEAD __elast2
> +#ifdef ELAST
> +#undef ELAST
> +#define ELAST EOWNERDEAD
> +
> +#elif !defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && 
> !defined(EINTEGRITY)
>  #define EOWNERDEAD __elast1
> +#define EINTEGRITY __elast2
> +#ifdef ELAST
> +#undef ELAST
> +#define ELAST EINTEGRITY
>  
> +#elif !defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && defined(EINTEGRITY)
> +#define EOWNERDEAD __elast1
>  #ifdef ELAST
>  #undef ELAST
>  #define ELAST EOWNERDEAD
> -#endif
>  
> -#elif defined(EOWNERDEAD)
> +#elif defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && 
> !defined(EINTEGRITY)
> +#define ENOTRECOVERABLE __elast1
> +#define EINTEGRITY __elast2
> +#ifdef ELAST
> +#undef ELAST
> +#define ELAST EINTEGRITY
>  
> +#elif defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && defined(EINTEGRITY)
>  #define ENOTRECOVERABLE __elast1
>  #ifdef ELAST
>  #undef ELAST
>  #define ELAST ENOTRECOVERABLE
> -#endif
>  
> -#else  // defined(EOWNERDEAD)
> -
> -#define EOWNERDEAD __elast1
> -#define ENOTRECOVERABLE __elast2
> +#elif defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && !defined(EINTEGRITY)
> +#define EINTEGRITY __elast1
>  #ifdef ELAST
>  #undef ELAST
> -#define ELAST ENOTRECOVERABLE
> -#endif
> +#define ELAST EINTEGRITY
>  
> -#endif  // defined(EOWNERDEAD)
> +#endif // !defined(OWNERDEAD) && !defined(NOTRECOVERABLE) && 
> !defined(INTEGRITY)
>  
> -#endif  // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
> +#endif // !defined(OWNERDEAD) || !defined(NOTRECOVERABLE) || 
> !defined(INTEGRITY)
>  
>  //  supply errno values likely to be missing, particularly on Windows
>  
> @@ -391,6 +414,10 @@ static const int __elast2 = 105;
>  
>  #ifndef EMLINK
>  #define EMLINK 9979
> +#endif
> +
> +#ifndef EINTEGRITY
> +#define EINTEGRITY 9980
>  #endif
>  
>  #endif // __cplusplus
> 
The build errors out as Clang complains about all of these conditional
directives being unterminated.

--- algorithm.o ---
In file included from /usr/src/contrib/libc++/src/algorithm.cpp:11:
In file included from /usr/src/contrib/libc++/include/random:1646:
In file included from /usr/src/contrib/libc++/include/istream:163:
In file included from /usr/src/contrib/libc++/include/ostream:138:
In file included from /usr/src/contrib/libc++/include/ios:216:
In file included from /usr/src/contrib/libc++/include/__locale:18:
In file included from /usr/src/contrib/libc++/include/mutex:191:
In file included from /usr/src/contrib/libc++/include/__mutex_base:16:
In file included from /usr/src/contrib/libc++/include/system_error:146:
In file included from /usr/src/contrib/libc++/include/__errc:106:
In file included from /usr/src/contrib/libc++/include/cerrno:27:
/usr/src/contrib/libc++/include/errno.h:70:2: error: unterminated
conditional directive
#ifdef ELAST
 ^
/usr/src/contrib/libc++/include/errno.h:63:2: error: unterminated
conditional directive
#ifdef ELAST
 ^
/usr/src/contrib/libc++/include/errno.h:56:2: error: unterminated
conditional directive
#ifdef ELAST
 ^
/usr/src/contrib/libc++/include/errno.h:52:2: error: unterminated
conditional directive
#if !defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) &&
!defined(EINTEGRITY)
 ^
/usr/src/contrib/libc++/include/errno.h:36:2: error: unterminated
conditional directive
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) ||
!defined(EINTEGRITY)
 ^
/usr/src/contrib/libc++/include/errno.h:34:2: error: unterminated
conditional directive
#ifdef __cplusplus
 ^
/usr/src/contrib/libc++/include/errno.h:11:2: error: unterminated
conditional directive
#ifndef _LIBCPP_ERRNO_H
 ^
In file included from /usr/src/contrib/libc++/src/algorithm.cpp:11:
In file included from /usr/src/contrib/libc++/include/random:1646:
In file included from /usr/src/contrib/libc++/include/istream:163:
In file 

Re: svn commit: r343111 - in head: cddl/lib/libdtrace contrib/libc++/include contrib/libxo/tests/gettext contrib/libxo/tests/gettext/po/pig_latin contrib/openbsm/libbsm contrib/openbsm/sys/bsm lib/lib

2019-01-16 Thread Oliver Pinter
On Thursday, January 17, 2019, Kirk McKusick  wrote:

> Author: mckusick
> Date: Thu Jan 17 06:35:45 2019
> New Revision: 343111
> URL: https://svnweb.freebsd.org/changeset/base/343111
>
> Log:
>   Create new EINTEGRITY error with message "Integrity check failed".
>
>   An integrity check such as a check-hash or a cross-correlation failed.
>   The integrity error falls between EINVAL that identifies errors in
>   parameters to a system call and EIO that identifies errors with the
>   underlying storage media. EINTEGRITY is typically raised by intermediate
>   kernel layers such as a filesystem or an in-kernel GEOM subsystem when
>   they detect inconsistencies. Uses include allowing the mount(8) command
>   to return a different exit value to automate the running of fsck(8)
>   during a system boot.
>
>   These changes make no use of the new error, they just add it. Later
>   commits will be made for the use of the new error number and it will
>   be added to additional manual pages as appropriate.
>
>   Reviewed by:gnn, dim, brueffer, imp
>   Discussed with: kib, cem, emaste, ed, jilles
>   Differential Revision: https://reviews.freebsd.org/D18765
>
> Modified:
>   head/cddl/lib/libdtrace/errno.d
>   head/contrib/libc++/include/__errc
>   head/contrib/libc++/include/errno.h
>   head/contrib/libxo/tests/gettext/po/pig_latin/strerror.po
>   head/contrib/libxo/tests/gettext/strerror.pot
>   head/contrib/openbsm/libbsm/bsm_errno.c
>   head/contrib/openbsm/sys/bsm/audit_errno.h
>   head/lib/libc/gen/errlst.c
>   head/lib/libc/nls/C.msg
>   head/lib/libc/sys/intro.2
>   head/stand/liblua/lerrno.c
>   head/sys/bsm/audit_errno.h
>   head/sys/compat/cloudabi/cloudabi_errno.c
>   head/sys/compat/linux/linux_errno.inc
>   head/sys/security/audit/bsm_errno.c
>   head/sys/sys/errno.h
>
> Modified: head/cddl/lib/libdtrace/errno.d
> 
> ==
> --- head/cddl/lib/libdtrace/errno.d Thu Jan 17 06:34:39 2019
> (r343110)
> +++ head/cddl/lib/libdtrace/errno.d Thu Jan 17 06:35:45 2019
> (r343111)
> @@ -225,7 +225,9 @@ inline int ENOTRECOVERABLE = 95;
>  #pragma D binding "1.13" ENOTRECOVERABLE
>  inline int EOWNERDEAD = 96;
>  #pragma D binding "1.13" EOWNERDEAD
> -inline int ELAST = 96;
> +inline int EINTEGRITY = 96;
> +#pragma D binding "1.13" EINTEGRITY
> +inline int ELAST = 97;
>  #pragma D binding "1.0" ELAST
>  inline int ERESTART = -1;
>  #pragma D binding "1.0" ERESTART
> @@ -340,6 +342,7 @@ inline string strerror[int errno] =
> errno == ECAPMODE ? "Not permitted in capability mode"
> :
> errno == ENOTRECOVERABLE ?  "State not recoverable" :
> errno == EOWNERDEAD ?   "Previous owner died" :
> +   errno == EINTEGRITY ?   "Integrity check failed" :
> errno == ERESTART ? "restart syscall" :
> errno == EJUSTRETURN ?  "don't modify regs, just return" :
> errno == ENOIOCTL ? "ioctl not handled by this layer" :
>
> Modified: head/contrib/libc++/include/__errc
> 
> ==
> --- head/contrib/libc++/include/__errc  Thu Jan 17 06:34:39 2019
> (r343110)
> +++ head/contrib/libc++/include/__errc  Thu Jan 17 06:35:45 2019
> (r343111)
> @@ -46,6 +46,7 @@ enum class errc
>  identifier_removed, // EIDRM
>  illegal_byte_sequence,  // EILSEQ
>  inappropriate_io_control_operation, // ENOTTY
> +integrity_check_failed, // EINTEGRITY
>  interrupted,// EINTR
>  invalid_argument,   // EINVAL
>  invalid_seek,   // ESPIPE
> @@ -143,6 +144,7 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc)
>  identifier_removed  = EIDRM,
>  illegal_byte_sequence   = EILSEQ,
>  inappropriate_io_control_operation  = ENOTTY,
> +integrity_check_failed  = EINTEGRITY,
>  interrupted = EINTR,
>  invalid_argument= EINVAL,
>  invalid_seek= ESPIPE,
>
> Modified: head/contrib/libc++/include/errno.h
> 
> ==
> --- head/contrib/libc++/include/errno.h Thu Jan 17 06:34:39 2019
> (r343110)
> +++ head/contrib/libc++/include/errno.h Thu Jan 17 06:35:45 2019
> (r343111)
> @@ -33,49 +33,72 @@ Macros:
>
>  #ifdef __cplusplus
>
> -#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
> +#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) ||
> !defined(EINTEGRITY)
>
>  #ifdef ELAST
>
>  static const int __elast1 = ELAST+1;
>  static const int __elast2 = ELAST+2;
> +static const int __elast2 = ELAST+3;


I think this should be __elast3


>
>  #else
>
>  static const int __elast1 = 104;
>  static const int __elast2 = 105;
> +static const int __elast2 = 106;


And here too


>
>  #endif
>
> -#ifdef 

svn commit: r343111 - in head: cddl/lib/libdtrace contrib/libc++/include contrib/libxo/tests/gettext contrib/libxo/tests/gettext/po/pig_latin contrib/openbsm/libbsm contrib/openbsm/sys/bsm lib/libc...

2019-01-16 Thread Kirk McKusick
Author: mckusick
Date: Thu Jan 17 06:35:45 2019
New Revision: 343111
URL: https://svnweb.freebsd.org/changeset/base/343111

Log:
  Create new EINTEGRITY error with message "Integrity check failed".
  
  An integrity check such as a check-hash or a cross-correlation failed.
  The integrity error falls between EINVAL that identifies errors in
  parameters to a system call and EIO that identifies errors with the
  underlying storage media. EINTEGRITY is typically raised by intermediate
  kernel layers such as a filesystem or an in-kernel GEOM subsystem when
  they detect inconsistencies. Uses include allowing the mount(8) command
  to return a different exit value to automate the running of fsck(8)
  during a system boot.
  
  These changes make no use of the new error, they just add it. Later
  commits will be made for the use of the new error number and it will
  be added to additional manual pages as appropriate.
  
  Reviewed by:gnn, dim, brueffer, imp
  Discussed with: kib, cem, emaste, ed, jilles
  Differential Revision: https://reviews.freebsd.org/D18765

Modified:
  head/cddl/lib/libdtrace/errno.d
  head/contrib/libc++/include/__errc
  head/contrib/libc++/include/errno.h
  head/contrib/libxo/tests/gettext/po/pig_latin/strerror.po
  head/contrib/libxo/tests/gettext/strerror.pot
  head/contrib/openbsm/libbsm/bsm_errno.c
  head/contrib/openbsm/sys/bsm/audit_errno.h
  head/lib/libc/gen/errlst.c
  head/lib/libc/nls/C.msg
  head/lib/libc/sys/intro.2
  head/stand/liblua/lerrno.c
  head/sys/bsm/audit_errno.h
  head/sys/compat/cloudabi/cloudabi_errno.c
  head/sys/compat/linux/linux_errno.inc
  head/sys/security/audit/bsm_errno.c
  head/sys/sys/errno.h

Modified: head/cddl/lib/libdtrace/errno.d
==
--- head/cddl/lib/libdtrace/errno.d Thu Jan 17 06:34:39 2019
(r343110)
+++ head/cddl/lib/libdtrace/errno.d Thu Jan 17 06:35:45 2019
(r343111)
@@ -225,7 +225,9 @@ inline int ENOTRECOVERABLE = 95;
 #pragma D binding "1.13" ENOTRECOVERABLE
 inline int EOWNERDEAD = 96;
 #pragma D binding "1.13" EOWNERDEAD
-inline int ELAST = 96;
+inline int EINTEGRITY = 96;
+#pragma D binding "1.13" EINTEGRITY
+inline int ELAST = 97;
 #pragma D binding "1.0" ELAST
 inline int ERESTART = -1;
 #pragma D binding "1.0" ERESTART
@@ -340,6 +342,7 @@ inline string strerror[int errno] =
errno == ECAPMODE ? "Not permitted in capability mode" :
errno == ENOTRECOVERABLE ?  "State not recoverable" :
errno == EOWNERDEAD ?   "Previous owner died" :
+   errno == EINTEGRITY ?   "Integrity check failed" :
errno == ERESTART ? "restart syscall" :
errno == EJUSTRETURN ?  "don't modify regs, just return" :
errno == ENOIOCTL ? "ioctl not handled by this layer" :

Modified: head/contrib/libc++/include/__errc
==
--- head/contrib/libc++/include/__errc  Thu Jan 17 06:34:39 2019
(r343110)
+++ head/contrib/libc++/include/__errc  Thu Jan 17 06:35:45 2019
(r343111)
@@ -46,6 +46,7 @@ enum class errc
 identifier_removed, // EIDRM
 illegal_byte_sequence,  // EILSEQ
 inappropriate_io_control_operation, // ENOTTY
+integrity_check_failed, // EINTEGRITY
 interrupted,// EINTR
 invalid_argument,   // EINVAL
 invalid_seek,   // ESPIPE
@@ -143,6 +144,7 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc)
 identifier_removed  = EIDRM,
 illegal_byte_sequence   = EILSEQ,
 inappropriate_io_control_operation  = ENOTTY,
+integrity_check_failed  = EINTEGRITY,
 interrupted = EINTR,
 invalid_argument= EINVAL,
 invalid_seek= ESPIPE,

Modified: head/contrib/libc++/include/errno.h
==
--- head/contrib/libc++/include/errno.h Thu Jan 17 06:34:39 2019
(r343110)
+++ head/contrib/libc++/include/errno.h Thu Jan 17 06:35:45 2019
(r343111)
@@ -33,49 +33,72 @@ Macros:
 
 #ifdef __cplusplus
 
-#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
+#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) || !defined(EINTEGRITY)
 
 #ifdef ELAST
 
 static const int __elast1 = ELAST+1;
 static const int __elast2 = ELAST+2;
+static const int __elast2 = ELAST+3;
 
 #else
 
 static const int __elast1 = 104;
 static const int __elast2 = 105;
+static const int __elast2 = 106;
 
 #endif
 
-#ifdef ENOTRECOVERABLE
+#if !defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && !defined(EINTEGRITY)
+#define ENOTRECOVERABLE __elast1
+#define EOWNERDEAD __elast2
+#define EINTEGRITY __elast3
+#ifdef ELAST
+#undef ELAST
+#define ELAST EINTEGRITY
 
+#elif !defined(EOWNERDEAD) && 

svn commit: r343110 - head/tools/build/mk

2019-01-16 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Jan 17 06:34:39 2019
New Revision: 343110
URL: https://svnweb.freebsd.org/changeset/base/343110

Log:
  Fix conditional obsolete files entry for WITHOUT_EXAMPLES
  
  Add all the files under /usr/share/examples to the MK_EXAMPLES
  section. OLD_DIRS entries are not removed if they're not empty so
  prior to this change WITHOUT_EXAMPLES didn't have significant effect
  on the updated system.
  
  PR:   228484
  Submitted by: Dmitry Wagin  (original patch)
  MFC after:1 week

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jan 17 06:22:14 
2019(r343109)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jan 17 06:34:39 
2019(r343110)
@@ -2303,22 +2303,274 @@ OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/ee.cat
 .endif
 
 .if ${MK_EXAMPLES} == no
+OLD_FILES+=usr/share/examples/BSD_daemon/FreeBSD.pfa
+OLD_FILES+=usr/share/examples/BSD_daemon/README
+OLD_FILES+=usr/share/examples/BSD_daemon/beastie.eps
+OLD_FILES+=usr/share/examples/BSD_daemon/beastie.fig
+OLD_FILES+=usr/share/examples/BSD_daemon/eps.patch
+OLD_FILES+=usr/share/examples/BSD_daemon/poster.sh
+OLD_FILES+=usr/share/examples/FreeBSD_version/FreeBSD_version.c
+OLD_FILES+=usr/share/examples/FreeBSD_version/Makefile
+OLD_FILES+=usr/share/examples/FreeBSD_version/README
+OLD_FILES+=usr/share/examples/IPv6/USAGE
+OLD_FILES+=usr/share/examples/bhyve/vmrun.sh
+OLD_FILES+=usr/share/examples/bootforth/README
+OLD_FILES+=usr/share/examples/bootforth/boot.4th
+OLD_FILES+=usr/share/examples/bootforth/frames.4th
+OLD_FILES+=usr/share/examples/bootforth/loader.rc
+OLD_FILES+=usr/share/examples/bootforth/menu.4th
+OLD_FILES+=usr/share/examples/bootforth/menuconf.4th
+OLD_FILES+=usr/share/examples/bootforth/screen.4th
+OLD_FILES+=usr/share/examples/bsdconfig/add_some_packages.sh
+OLD_FILES+=usr/share/examples/bsdconfig/browse_packages_http.sh
+OLD_FILES+=usr/share/examples/bsdconfig/bsdconfigrc
+OLD_FILES+=usr/share/examples/csh/dot.cshrc
+OLD_FILES+=usr/share/examples/diskless/ME
+OLD_FILES+=usr/share/examples/diskless/README.BOOTP
+OLD_FILES+=usr/share/examples/diskless/README.TEMPLATING
+OLD_FILES+=usr/share/examples/diskless/clone_root
+OLD_FILES+=usr/share/examples/dma/mailer.conf
+OLD_FILES+=usr/share/examples/drivers/README
+OLD_FILES+=usr/share/examples/drivers/make_device_driver.sh
+OLD_FILES+=usr/share/examples/drivers/make_pseudo_driver.sh
+OLD_FILES+=usr/share/examples/dwatch/profile_template
+OLD_FILES+=usr/share/examples/etc/README.examples
+OLD_FILES+=usr/share/examples/etc/bsd-style-copyright
+OLD_FILES+=usr/share/examples/etc/group
+OLD_FILES+=usr/share/examples/etc/login.access
+OLD_FILES+=usr/share/examples/etc/make.conf
+OLD_FILES+=usr/share/examples/etc/rc.bsdextended
+OLD_FILES+=usr/share/examples/etc/rc.firewall
+OLD_FILES+=usr/share/examples/etc/rc.sendmail
+OLD_FILES+=usr/share/examples/etc/termcap.small
+OLD_FILES+=usr/share/examples/etc/wpa_supplicant.conf
+OLD_FILES+=usr/share/examples/find_interface/Makefile
+OLD_FILES+=usr/share/examples/find_interface/README
+OLD_FILES+=usr/share/examples/find_interface/find_interface.c
+OLD_FILES+=usr/share/examples/hast/ucarp.sh
+OLD_FILES+=usr/share/examples/hast/ucarp_down.sh
+OLD_FILES+=usr/share/examples/hast/ucarp_up.sh
+OLD_FILES+=usr/share/examples/hast/vip-down.sh
+OLD_FILES+=usr/share/examples/hast/vip-up.sh
+OLD_FILES+=usr/share/examples/hostapd/hostapd.conf
+OLD_FILES+=usr/share/examples/hostapd/hostapd.eap_user
+OLD_FILES+=usr/share/examples/hostapd/hostapd.wpa_psk
+OLD_FILES+=usr/share/examples/indent/indent.pro
+OLD_FILES+=usr/share/examples/ipfilter/BASIC.NAT
+OLD_FILES+=usr/share/examples/ipfilter/BASIC_1.FW
+OLD_FILES+=usr/share/examples/ipfilter/BASIC_2.FW
+OLD_FILES+=usr/share/examples/ipfilter/README
+OLD_FILES+=usr/share/examples/ipfilter/example.1
+OLD_FILES+=usr/share/examples/ipfilter/example.10
+OLD_FILES+=usr/share/examples/ipfilter/example.11
+OLD_FILES+=usr/share/examples/ipfilter/example.12
+OLD_FILES+=usr/share/examples/ipfilter/example.13
+OLD_FILES+=usr/share/examples/ipfilter/example.14
+OLD_FILES+=usr/share/examples/ipfilter/example.2
+OLD_FILES+=usr/share/examples/ipfilter/example.3
+OLD_FILES+=usr/share/examples/ipfilter/example.4
+OLD_FILES+=usr/share/examples/ipfilter/example.5
+OLD_FILES+=usr/share/examples/ipfilter/example.6
+OLD_FILES+=usr/share/examples/ipfilter/example.7
+OLD_FILES+=usr/share/examples/ipfilter/example.8
+OLD_FILES+=usr/share/examples/ipfilter/example.9
+OLD_FILES+=usr/share/examples/ipfilter/example.sr
+OLD_FILES+=usr/share/examples/ipfilter/examples.txt
+OLD_FILES+=usr/share/examples/ipfilter/firewall
+OLD_FILES+=usr/share/examples/ipfilter/firewall.1
+OLD_FILES+=usr/share/examples/ipfilter/firewall.2
+OLD_FILES+=usr/share/examples/ipfilter/ftp-proxy

svn commit: r343109 - head/tools/build/mk

2019-01-16 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Jan 17 06:22:14 2019
New Revision: 343109
URL: https://svnweb.freebsd.org/changeset/base/343109

Log:
  Add optional obsolete files for the installworld without sendmail
  
  Add two more entries for WITHOUT_SENDMAIL install. The /var/spool/clientmqueue
  entry would be deleted only if there are no files/dirs in it, so the
  content generated during previous lifecycle of the system is safe
  
  PR:   228484
  Submitted by: Dmitry Wagin 
  MFC after:1 week

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jan 17 05:15:25 
2019(r343108)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jan 17 06:22:14 
2019(r343109)
@@ -7354,6 +7354,7 @@ OLD_FILES+=usr/share/man/man8/rtquery.8.gz
 .endif
 
 .if ${MK_SENDMAIL} == no
+OLD_FILES+=etc/mtree/BSD.sendmail.dist
 OLD_FILES+=etc/newsyslog.conf.d/sendmail.conf
 OLD_FILES+=etc/periodic/daily/150.clean-hoststat
 OLD_FILES+=etc/periodic/daily/440.status-mailq
@@ -7592,6 +7593,7 @@ OLD_FILES+=usr/share/sendmail/cf/siteconfig/uucp.ucbva
 OLD_DIRS+=usr/share/sendmail/cf/siteconfig
 OLD_DIRS+=usr/share/sendmail/cf
 OLD_DIRS+=usr/share/sendmail
+OLD_DIRS+=var/spool/clientmqueue
 .endif
 
 .if ${MK_SERVICESDB} == no
___
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: r343107 - head/sys/kern

2019-01-16 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 17 04:51:05 2019
New Revision: 343107
URL: https://svnweb.freebsd.org/changeset/base/343107

Log:
  Re-wrap long line after r341827.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/kern/kern_fork.c

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Wed Jan 16 22:29:34 2019(r343106)
+++ head/sys/kern/kern_fork.c   Thu Jan 17 04:51:05 2019(r343107)
@@ -882,7 +882,9 @@ fork1(struct thread *td, struct fork_req *fr)
 * processes; don't let root exceed the limit.
 */
nprocs_new = atomic_fetchadd_int(, 1) + 1;
-   if ((nprocs_new >= maxproc - 10 && priv_check_cred(td->td_ucred, 
PRIV_MAXPROC) != 0) || nprocs_new >= maxproc) {
+   if ((nprocs_new >= maxproc - 10 &&
+   priv_check_cred(td->td_ucred, PRIV_MAXPROC) != 0) ||
+   nprocs_new >= maxproc) {
error = EAGAIN;
sx_xlock(_lock);
if (ppsratecheck(, , 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: r343108 - head/sys/amd64/vmm/intel

2019-01-16 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 17 05:15:25 2019
New Revision: 343108
URL: https://svnweb.freebsd.org/changeset/base/343108

Log:
  Trim whitespace at EoL, use tabs instead of spaces for indent.
  
  PR:  235004
  Submitted by: Jose Luis Duran 
  MFC after:3 days

Modified:
  head/sys/amd64/vmm/intel/vmx.c

Modified: head/sys/amd64/vmm/intel/vmx.c
==
--- head/sys/amd64/vmm/intel/vmx.c  Thu Jan 17 04:51:05 2019
(r343107)
+++ head/sys/amd64/vmm/intel/vmx.c  Thu Jan 17 05:15:25 2019
(r343108)
@@ -81,7 +81,7 @@ __FBSDID("$FreeBSD$");
(PROCBASED_INT_WINDOW_EXITING   |   \
 PROCBASED_NMI_WINDOW_EXITING)
 
-#definePROCBASED_CTLS_ONE_SETTING  
\
+#definePROCBASED_CTLS_ONE_SETTING  
\
(PROCBASED_SECONDARY_CONTROLS   |   \
 PROCBASED_MWAIT_EXITING|   \
 PROCBASED_MONITOR_EXITING  |   \
@@ -428,7 +428,7 @@ vmx_allow_x2apic_msrs(struct vmx *vmx)
 
for (i = 0; i < 8; i++)
error += guest_msr_ro(vmx, MSR_APIC_TMR0 + i);
-   
+
for (i = 0; i < 8; i++)
error += guest_msr_ro(vmx, MSR_APIC_IRR0 + i);
 
@@ -576,7 +576,7 @@ vmx_disable(void *arg __unused)
 static int
 vmx_cleanup(void)
 {
-   
+
if (pirvec >= 0)
lapic_ipi_free(pirvec);
 
@@ -1097,7 +1097,7 @@ static int
 vmx_handle_cpuid(struct vm *vm, int vcpu, struct vmxctx *vmxctx)
 {
int handled, func;
-   
+
func = vmxctx->guest_rax;
 
handled = x86_emulate_cpuid(vm, vcpu,
@@ -3096,7 +3096,7 @@ vmx_get_intr_shadow(struct vmx *vmx, int vcpu, int run
uint64_t gi;
int error;
 
-   error = vmcs_getreg(>vmcs[vcpu], running, 
+   error = vmcs_getreg(>vmcs[vcpu], running,
VMCS_IDENT(VMCS_GUEST_INTERRUPTIBILITY), );
*retval = (gi & HWINTR_BLOCKING) ? 1 : 0;
return (error);
@@ -3140,8 +3140,8 @@ vmx_shadow_reg(int reg)
switch (reg) {
case VM_REG_GUEST_CR0:
shreg = VMCS_CR0_SHADOW;
-break;
-case VM_REG_GUEST_CR4:
+   break;
+   case VM_REG_GUEST_CR4:
shreg = VMCS_CR4_SHADOW;
break;
default:
@@ -3212,7 +3212,7 @@ vmx_setreg(void *arg, int vcpu, int reg, uint64_t val)
if (shadow > 0) {
/*
 * Store the unmodified value in the shadow
-*/ 
+*/
error = vmcs_setreg(>vmcs[vcpu], running,
VMCS_IDENT(shadow), val);
}
@@ -3395,7 +3395,7 @@ vmx_setcap(void *arg, int vcpu, int type, int val)
}
}
 
-return (retval);
+   return (retval);
 }
 
 struct vlapic_vtx {
@@ -3698,7 +3698,7 @@ vmx_vlapic_init(void *arg, int vcpuid)
struct vmx *vmx;
struct vlapic *vlapic;
struct vlapic_vtx *vlapic_vtx;
-   
+
vmx = arg;
 
vlapic = malloc(sizeof(struct vlapic_vtx), M_VLAPIC, M_WAITOK | M_ZERO);
___
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: r343106 - in head/sys/dev/usb: . quirk

2019-01-16 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jan 16 22:29:34 2019
New Revision: 343106
URL: https://svnweb.freebsd.org/changeset/base/343106

Log:
  [usb] Add quirk for SmartG2 USB memory key
  
  PR:   167001
  Submitted by: Daan Vreeken [PA4DAN] 
  MFC after:1 week

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==
--- head/sys/dev/usb/quirk/usb_quirk.c  Wed Jan 16 21:59:18 2019
(r343105)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Wed Jan 16 22:29:34 2019
(r343106)
@@ -498,6 +498,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(VIALABS, USB30SATABRIDGE, 0x, 0x, 
UQ_MSC_NO_SYNC_CACHE),
USB_QUIRK(QUALCOMMINC, ZTE_MF730M, 0x, 0x, UQ_MSC_NO_GETMAXLUN,
UQ_MSC_NO_INQUIRY, UQ_CFG_INDEX_0),
+   USB_QUIRK(SMART2, G2MEMKEY, 0x, 0x, UQ_MSC_NO_INQUIRY),
/* Non-standard USB MIDI devices */
USB_QUIRK(ROLAND, UM1, 0x, 0x, UQ_AU_VENDOR_CLASS),
USB_QUIRK(ROLAND, SC8850, 0x, 0x, UQ_AU_VENDOR_CLASS),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsWed Jan 16 21:59:18 2019(r343105)
+++ head/sys/dev/usb/usbdevsWed Jan 16 22:29:34 2019(r343106)
@@ -561,6 +561,7 @@ vendor NETAC0x0dd8  Netac
 vendor SITECOMEU   0x0df6  Sitecom Europe
 vendor MOBILEACTION0x0df7  Mobile Action
 vendor AMIGO   0x0e0b  Amigo Technology
+vendor SMART2  0x0e39  Smart Modular Technologies
 vendor SPEEDDRAGON 0x0e55  Speed Dragon Multimedia
 vendor HAWKING 0x0e66  Hawking
 vendor FOSSIL  0x0e67  Fossil, Inc
@@ -4372,6 +4373,9 @@ product SKANHEX SX_520Z   0x5200  SX 520z Camera
 
 /* Smart Technologies products */
 product SMART PL2303   0x2303  Serial adapter
+
+/* Smart Modular Technologies products */
+product SMART2 G2MEMKEY0x1700  G2 Memory Key
 
 /* SmartBridges products */
 product SMARTBRIDGES SMARTLINK 0x0001  SmartLink USB Ethernet
___
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: r343105 - head/lib/libedit

2019-01-16 Thread Jilles Tjoelker
Author: jilles
Date: Wed Jan 16 21:59:18 2019
New Revision: 343105
URL: https://svnweb.freebsd.org/changeset/base/343105

Log:
  libedit: Avoid out of bounds read in 'bind' command
  
  This is CVS revision 1.31 from NetBSD lib/libedit/chartype.c:
  Make sure that argv is NULL terminated since functions like tty_stty rely
  on it to be so (Gerry Swinslow)
  
  This broke when the wide-character support was enabled in libedit. The
  conversion from multibyte to wide-character did not supply the apparently
  expected terminating NULL in the new argv array.
  
  PR:   233343
  Submitted by: Yuichiro NAITO
  Obtained from:NetBSD
  MFC after:1 week

Modified:
  head/lib/libedit/chartype.c

Modified: head/lib/libedit/chartype.c
==
--- head/lib/libedit/chartype.c Wed Jan 16 21:13:50 2019(r343104)
+++ head/lib/libedit/chartype.c Wed Jan 16 21:59:18 2019(r343105)
@@ -157,7 +157,7 @@ ct_decode_argv(int argc, const char *argv[], ct_buffer
if (ct_conv_wbuff_resize(conv, bufspace + CT_BUFSIZ) == -1)
return NULL;
 
-   wargv = el_malloc((size_t)argc * sizeof(*wargv));
+   wargv = el_malloc((size_t)(argc + 1) * sizeof(*wargv));
 
for (i = 0, p = conv->wbuff; i < argc; ++i) {
if (!argv[i]) {   /* don't pass null pointers to mbstowcs */
@@ -175,6 +175,7 @@ ct_decode_argv(int argc, const char *argv[], ct_buffer
bufspace -= (size_t)bytes;
p += bytes;
}
+   wargv[i] = NULL;
 
return wargv;
 }
___
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: r343104 - head/sys/arm/mv

2019-01-16 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jan 16 21:13:50 2019
New Revision: 343104
URL: https://svnweb.freebsd.org/changeset/base/343104

Log:
  [mv] Fix invalid condition in fdt_fixup_ranges
  
  Add parentheses to perform assignment before comparison. The prior
  condition worked because fdt_parent_addr_cells returns 1 for the DTB
  on which fdt_fixup_ranges is called and accidentally par_addr_cells
  ends up to be set to the same value.
  
  PR:   210705
  Submitted by: David Binderman 
  MFC after:1 week

Modified:
  head/sys/arm/mv/mv_common.c

Modified: head/sys/arm/mv/mv_common.c
==
--- head/sys/arm/mv/mv_common.c Wed Jan 16 20:46:39 2019(r343103)
+++ head/sys/arm/mv/mv_common.c Wed Jan 16 21:13:50 2019(r343104)
@@ -2935,7 +2935,7 @@ fdt_fixup_ranges(phandle_t root)
/* Fix-up SoC ranges according to real fdt_immr_pa */
if ((node = fdt_find_compatible(root, "simple-bus", 1)) != 0) {
if (fdt_addrsize_cells(node, _cells, _cells) == 0 &&
-   (par_addr_cells = fdt_parent_addr_cells(node) <= 2)) {
+   ((par_addr_cells = fdt_parent_addr_cells(node)) <= 2)) {
tuple_size = sizeof(pcell_t) * (par_addr_cells +
   addr_cells + size_cells);
len = OF_getprop(node, "ranges", ranges,
___
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: r343103 - head/contrib/ipfilter

2019-01-16 Thread Cy Schubert
Author: cy
Date: Wed Jan 16 20:46:39 2019
New Revision: 343103
URL: https://svnweb.freebsd.org/changeset/base/343103

Log:
  Remove redundant ipfilter version of pcap-bpf.h. As of r214535 it was
  no longer needed.
  
  MFC after:1 week

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


svn commit: r343101 - head/sys/kern

2019-01-16 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jan 16 20:20:38 2019
New Revision: 343101
URL: https://svnweb.freebsd.org/changeset/base/343101

Log:
  Fix mistake in r343030: move nswbuf calculation back to
  kern_vfs_bio_buffer_alloc(), because in init_param2() nbuf
  isn't really initialized yet.
  
  Pointed out by:   bde

Modified:
  head/sys/kern/subr_param.c
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/subr_param.c
==
--- head/sys/kern/subr_param.c  Wed Jan 16 20:14:16 2019(r343100)
+++ head/sys/kern/subr_param.c  Wed Jan 16 20:20:38 2019(r343101)
@@ -291,10 +291,7 @@ init_param2(long physpages)
 * Physical buffers are pre-allocated buffers (struct buf) that
 * are used as temporary holders for I/O, such as paging I/O.
 */
-   nswbuf = min(nbuf / 4, 256);
TUNABLE_INT_FETCH("kern.nswbuf", );
-   if (nswbuf < NSWBUF_MIN)
-   nswbuf = NSWBUF_MIN;
 
/*
 * The default for maxpipekva is min(1/64 of the kernel address space,

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Wed Jan 16 20:14:16 2019(r343100)
+++ head/sys/kern/vfs_bio.c Wed Jan 16 20:20:38 2019(r343101)
@@ -1124,6 +1124,12 @@ kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est)
nbuf = buf_sz / BKVASIZE;
}
 
+   if (nswbuf == 0) {
+   nswbuf = min(nbuf / 4, 256);
+   if (nswbuf < NSWBUF_MIN)
+   nswbuf = NSWBUF_MIN;
+   }
+
/*
 * Reserve space for the buffer cache buffers
 */
___
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: r343100 - head/sys/vm

2019-01-16 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jan 16 20:14:16 2019
New Revision: 343100
URL: https://svnweb.freebsd.org/changeset/base/343100

Log:
  Do not reserve KVA for paging bufs in vm_ksubmap_init(), since now
  they allocate it in pbuf_init(). This should have been done together
  with r343030.

Modified:
  head/sys/vm/vm_init.c
  head/sys/vm/vm_kern.h
  head/sys/vm/vm_pager.c

Modified: head/sys/vm/vm_init.c
==
--- head/sys/vm/vm_init.c   Wed Jan 16 19:20:14 2019(r343099)
+++ head/sys/vm/vm_init.c   Wed Jan 16 20:14:16 2019(r343100)
@@ -221,11 +221,9 @@ again:
panic("startup: table size inconsistency");
 
/*
-* Allocate the clean map to hold all of the paging and I/O virtual
-* memory.
+* Allocate the clean map to hold all of I/O virtual memory.
 */
-   size = (long)nbuf * BKVASIZE + (long)nswbuf * MAXPHYS +
-   (long)bio_transient_maxcnt * MAXPHYS;
+   size = (long)nbuf * BKVASIZE + (long)bio_transient_maxcnt * MAXPHYS;
kmi->clean_sva = firstaddr = kva_alloc(size);
kmi->clean_eva = firstaddr + size;
 
@@ -240,13 +238,6 @@ again:
kmi->buffer_eva = kmi->buffer_sva + size;
vmem_init(buffer_arena, "buffer arena", kmi->buffer_sva, size,
PAGE_SIZE, (mp_ncpus > 4) ? BKVASIZE * 8 : 0, 0);
-   firstaddr += size;
-
-   /*
-* Now swap kva.
-*/
-   swapbkva = firstaddr;
-   size = (long)nswbuf * MAXPHYS;
firstaddr += size;
 
/*

Modified: head/sys/vm/vm_kern.h
==
--- head/sys/vm/vm_kern.h   Wed Jan 16 19:20:14 2019(r343099)
+++ head/sys/vm/vm_kern.h   Wed Jan 16 20:14:16 2019(r343100)
@@ -74,7 +74,6 @@ extern struct vmem *kmem_arena;
 extern struct vmem *buffer_arena;
 extern struct vmem *transient_arena;
 extern struct vmem *memguard_arena;
-extern vm_offset_t swapbkva;
 extern u_long vm_kmem_size;
 extern u_int exec_map_entries;
 extern u_int exec_map_entry_size;

Modified: head/sys/vm/vm_pager.c
==
--- head/sys/vm/vm_pager.c  Wed Jan 16 19:20:14 2019(r343099)
+++ head/sys/vm/vm_pager.c  Wed Jan 16 20:14:16 2019(r343100)
@@ -163,16 +163,6 @@ struct pagerops *pagertab[] = {
, /* OBJT_MGTDEVICE */
 };
 
-/*
- * Kernel address space for mapping pages.
- * Used by pagers where KVAs are needed for IO.
- *
- * XXX needs to be large enough to support the number of pending async
- * cleaning requests (NPENDINGIO == 64) * the maximum swap cluster size
- * (MAXPHYS == 64k) if you want to get the most efficiency.
- */
-vm_offset_t swapbkva;  /* swap buffers kva */
-
 void
 vm_pager_init(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"


Re: svn commit: r343058 - in head/sys: compat/linuxkpi/common/src vm

2019-01-16 Thread Ian Lepore
On Tue, 2019-01-15 at 12:33 -0800, Gleb Smirnoff wrote:
> On Tue, Jan 15, 2019 at 01:20:14PM -0700, Ian Lepore wrote:
> I> On Tue, 2019-01-15 at 12:06 -0800, Gleb Smirnoff wrote:
> I> > On Tue, Jan 15, 2019 at 01:46:23PM -0600, Justin Hibbits wrote:
> I> > J> Why not #include counter.h in the relevant vm_machdep.c files
> I> > instead?
> I> > 
> I> > This also is ugly :( Not sure more or less. Probably less, but I
> I> > urged to plug all possible compilation failures at a time.
> I> > 
> I> > What is ugly is that most files just need counter_u64_t size,
> I> > and they don't use counter(9) KPI.
> I> > 
> I> > The fact that vm_machdep or Linux KPI want to look into internal
> I> > type uma_zone_t is also ugly.
> I> > 
> I> 
> I> Isn't the usual fix for this problem to create a __counter_u64_t
> in
> I> sys/types.h and use it in places where including the full header
> file
> I> is undesirable for some reason?
> 
> I'm inclined to this solution. Do you want to sign up as reviewer? :)
> 

I can barely keep up with reading all my freebsd-related email these
days, I'd better not commit to a review that I may not actually get
around to.  :/

-- Ian

___
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: r343095 - head/sys/arm/allwinner

2019-01-16 Thread Kyle Evans
Author: kevans
Date: Wed Jan 16 14:42:33 2019
New Revision: 343095
URL: https://svnweb.freebsd.org/changeset/base/343095

Log:
  awg: Move MAC soft reset to awg_init_locked to avoid soft reset timeout
  
  From NetBSD: Since the MAC can get stuck in reset state with no link, ignore
  reset timeouts and continue with initializing the device.
  
  Fixes "soft reset timeout" issue at boot with no network cable plugged in.
  
  awg_init may be called multiple times throughout normal interface usage, so
  the tx/rx descriptor base address registers must be written after each MAC
  reset and are moved as such.
  
  This problem has been observed on FreeBSD, H3/H2+ devices with an internal
  PHY (includes OrangePi R1, OrangePi One at least).
  
  Reviewed by:  manu, ganbold
  Obtained from:NetBSD
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D18844

Modified:
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Wed Jan 16 12:33:06 2019
(r343094)
+++ head/sys/arm/allwinner/if_awg.c Wed Jan 16 14:42:33 2019
(r343095)
@@ -750,6 +750,31 @@ awg_disable_intr(struct awg_softc *sc)
WR4(sc, EMAC_INT_EN, 0);
 }
 
+static int
+awg_reset(struct awg_softc *sc)
+{
+   int retry;
+
+   /* Soft reset all registers and logic */
+   WR4(sc, EMAC_BASIC_CTL_1, BASIC_CTL_SOFT_RST);
+
+   /* Wait for soft reset bit to self-clear */
+   for (retry = SOFT_RST_RETRY; retry > 0; retry--) {
+   if ((RD4(sc, EMAC_BASIC_CTL_1) & BASIC_CTL_SOFT_RST) == 0)
+   break;
+   DELAY(10);
+   }
+   if (retry == 0) {
+   device_printf(sc->dev, "soft reset timed out\n");
+#ifdef AWG_DEBUG
+   awg_dump_regs(sc->dev);
+#endif
+   return (ETIMEDOUT);
+   }
+
+   return (0);
+}
+
 static void
 awg_init_locked(struct awg_softc *sc)
 {
@@ -765,6 +790,12 @@ awg_init_locked(struct awg_softc *sc)
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
return;
 
+   awg_reset(sc);
+
+   /* Write transmit and receive descriptor base address registers */
+   WR4(sc, EMAC_TX_DMA_LIST, sc->tx.desc_ring_paddr);
+   WR4(sc, EMAC_RX_DMA_LIST, sc->rx.desc_ring_paddr);
+
awg_setup_rxfilter(sc);
 
/* Configure DMA burst length and priorities */
@@ -1653,40 +1684,6 @@ awg_phy_reset(device_t dev)
return (0);
 }
 
-static int
-awg_reset(device_t dev)
-{
-   struct awg_softc *sc;
-   int retry;
-
-   sc = device_get_softc(dev);
-
-   /* Reset PHY if necessary */
-   if (awg_phy_reset(dev) != 0) {
-   device_printf(dev, "failed to reset PHY\n");
-   return (ENXIO);
-   }
-
-   /* Soft reset all registers and logic */
-   WR4(sc, EMAC_BASIC_CTL_1, BASIC_CTL_SOFT_RST);
-
-   /* Wait for soft reset bit to self-clear */
-   for (retry = SOFT_RST_RETRY; retry > 0; retry--) {
-   if ((RD4(sc, EMAC_BASIC_CTL_1) & BASIC_CTL_SOFT_RST) == 0)
-   break;
-   DELAY(10);
-   }
-   if (retry == 0) {
-   device_printf(dev, "soft reset timed out\n");
-#ifdef AWG_DEBUG
-   awg_dump_regs(dev);
-#endif
-   return (ETIMEDOUT);
-   }
-
-   return (0);
-}
-
 static void
 awg_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
 {
@@ -1840,10 +1837,6 @@ awg_setup_dma(device_t dev)
bus_dmamap_sync(sc->rx.desc_tag, sc->rx.desc_map,
BUS_DMASYNC_PREWRITE);
 
-   /* Write transmit and receive descriptor base address registers */
-   WR4(sc, EMAC_TX_DMA_LIST, sc->tx.desc_ring_paddr);
-   WR4(sc, EMAC_RX_DMA_LIST, sc->rx.desc_ring_paddr);
-
return (0);
 }
 
@@ -1888,10 +1881,12 @@ awg_attach(device_t dev)
/* Read MAC address before resetting the chip */
awg_get_eaddr(dev, eaddr);
 
-   /* Soft reset EMAC core */
-   error = awg_reset(dev);
-   if (error != 0)
+   /* Reset PHY if necessary */
+   error = awg_phy_reset(dev);
+   if (error != 0) {
+   device_printf(dev, "failed to reset PHY\n");
return (error);
+   }
 
/* Setup DMA descriptors */
error = awg_setup_dma(dev);
___
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: r343093 - in head: include lib/libc/gen libexec/rtld-elf

2019-01-16 Thread Konstantin Belousov
On Wed, Jan 16, 2019 at 12:12:40PM +, Dag-Erling Smørgrav wrote:
> Author: des
> Date: Wed Jan 16 12:12:40 2019
> New Revision: 343093
> URL: https://svnweb.freebsd.org/changeset/base/343093
> 
> Log:
>   Implement dlopenat(3).
>   
>   MFC after:  3 weeks
> 
> Modified:
>   head/include/dlfcn.h
>   head/lib/libc/gen/dlopen.3
>   head/libexec/rtld-elf/rtld.c
> 
It is non-functional:
- The new symbol is not exported from rtld, so it cannot be referenced
  at runtime.
- libc does not provide stubs for static linker and statically linked
  binaries, so nothing can be linked against it.

That said, why is it useful to have this function when we already have
fdlopen(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: r343094 - head/sys/dev/iwn

2019-01-16 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Jan 16 12:33:06 2019
New Revision: 343094
URL: https://svnweb.freebsd.org/changeset/base/343094

Log:
  iwn(4): (partially) rewrite A-MPDU Tx path
  
  Generic Tx stats fixes:
  - do not try to parse "aggregation status" for single frames; send them
  to iwn_tx_done() instead;
  - try to attach mbuf / node reference pair to reported BA events;
  allows to fix reported status for ieee80211_tx_complete() and ifnet counters
  (previously all A-MPDU frames were counted as failed - see PR 210211);
  requires few more firmware bug workarounds;
  - preserve short / long retry counters for wlan_amrr(4)
  (disabled for now - causes significant performance degradation).
  - Add new IWN_DEBUG_AMPDU debug category.
  - Add one more check into iwn_tx_data() to prevent aggregation ring
  overflow.
  - Workaround 'seqno % 256' != 'current Tx slot' case (until D9195 is not
  in the tree).
  - Improve watchdog timer updates (previously watchdog check was omitted
  when at least one frame was transmitted).
  - Stop Tx when memory leak in currently used ring was detected (unlikely
  to happen).
  - Few other minor fixes.
  
  Was previously tested with:
   - Intel 6205, STA mode (Tx aggregation behaves much better now).
   - Intel 4965AGN, STA mode (still unstable).
  
  PR:   192641, 210211
  Reviewed by:  adrian, dhw
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D10728

Modified:
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwn_debug.h
  head/sys/dev/iwn/if_iwnreg.h
  head/sys/dev/iwn/if_iwnvar.h

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Wed Jan 16 12:12:40 2019(r343093)
+++ head/sys/dev/iwn/if_iwn.c   Wed Jan 16 12:33:06 2019(r343094)
@@ -168,6 +168,7 @@ static int  iwn_alloc_tx_ring(struct iwn_softc *, struc
int);
 static voidiwn_reset_tx_ring(struct iwn_softc *, struct iwn_tx_ring *);
 static voidiwn_free_tx_ring(struct iwn_softc *, struct iwn_tx_ring *);
+static voidiwn_check_tx_ring(struct iwn_softc *, int);
 static voidiwn5000_ict_reset(struct iwn_softc *);
 static int iwn_read_eeprom(struct iwn_softc *,
uint8_t macaddr[IEEE80211_ADDR_LEN]);
@@ -199,6 +200,8 @@ static void iwn_calib_timeout(void *);
 static voidiwn_rx_phy(struct iwn_softc *, struct iwn_rx_desc *);
 static voidiwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
+static voidiwn_agg_tx_complete(struct iwn_softc *, struct iwn_tx_ring *,
+   int, int, int);
 static voidiwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *);
 static voidiwn5000_rx_calib_results(struct iwn_softc *,
struct iwn_rx_desc *);
@@ -207,10 +210,13 @@ static void   iwn4965_tx_done(struct iwn_softc *, 
struct
struct iwn_rx_data *);
 static voidiwn5000_tx_done(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
+static voidiwn_adj_ampdu_ptr(struct iwn_softc *, struct iwn_tx_ring *);
 static voidiwn_tx_done(struct iwn_softc *, struct iwn_rx_desc *, int, int,
uint8_t);
-static voidiwn_ampdu_tx_done(struct iwn_softc *, int, int, int, int, int,
-   void *);
+static int iwn_ampdu_check_bitmap(uint64_t, int, int);
+static int iwn_ampdu_index_check(struct iwn_softc *, struct iwn_tx_ring *,
+   uint64_t, int, int);
+static voidiwn_ampdu_tx_done(struct iwn_softc *, int, int, int, void *);
 static voidiwn_cmd_done(struct iwn_softc *, struct iwn_rx_desc *);
 static voidiwn_notif_intr(struct iwn_softc *);
 static voidiwn_wakeup_intr(struct iwn_softc *);
@@ -2075,6 +2081,8 @@ iwn_reset_tx_ring(struct iwn_softc *sc, struct iwn_tx_
ieee80211_free_node(data->ni);
data->ni = NULL;
}
+   data->remapped = 0;
+   data->long_retries = 0;
}
/* Clear TX descriptors. */
memset(ring->desc, 0, ring->desc_dma.size);
@@ -2114,6 +2122,42 @@ iwn_free_tx_ring(struct iwn_softc *sc, struct iwn_tx_r
 }
 
 static void
+iwn_check_tx_ring(struct iwn_softc *sc, int qid)
+{
+   struct iwn_tx_ring *ring = >txq[qid];
+
+   KASSERT(ring->queued >= 0, ("%s: ring->queued (%d) for queue %d < 0!",
+   __func__, ring->queued, qid));
+
+   if (qid >= sc->firstaggqueue) {
+   struct iwn_ops *ops = >ops;
+   struct ieee80211_tx_ampdu *tap = sc->qid2tap[qid];
+
+   if (ring->queued == 0 && !IEEE80211_AMPDU_RUNNING(tap)) {
+   uint16_t ssn = tap->txa_start & 0xfff;
+   uint8_t tid = tap->txa_tid;
+   int *res = tap->txa_private;
+
+   iwn_nic_lock(sc);
+   

svn commit: r343093 - in head: include lib/libc/gen libexec/rtld-elf

2019-01-16 Thread Dag-Erling Smørgrav
Author: des
Date: Wed Jan 16 12:12:40 2019
New Revision: 343093
URL: https://svnweb.freebsd.org/changeset/base/343093

Log:
  Implement dlopenat(3).
  
  MFC after:3 weeks

Modified:
  head/include/dlfcn.h
  head/lib/libc/gen/dlopen.3
  head/libexec/rtld-elf/rtld.c

Modified: head/include/dlfcn.h
==
--- head/include/dlfcn.hWed Jan 16 12:11:29 2019(r343092)
+++ head/include/dlfcn.hWed Jan 16 12:12:40 2019(r343093)
@@ -120,6 +120,7 @@ void*dlopen(const char *, int);
 void   *dlsym(void * __restrict, const char * __restrict);
 
 #if __BSD_VISIBLE
+void   *dlopenat(int, const char *, int);
 void   *fdlopen(int, int);
 int dladdr(const void * __restrict, Dl_info * __restrict);
 dlfunc_t dlfunc(void * __restrict, const char * __restrict);

Modified: head/lib/libc/gen/dlopen.3
==
--- head/lib/libc/gen/dlopen.3  Wed Jan 16 12:11:29 2019(r343092)
+++ head/lib/libc/gen/dlopen.3  Wed Jan 16 12:12:40 2019(r343093)
@@ -32,11 +32,12 @@
 .\" @(#) dlopen.3 1.6 90/01/31 SMI
 .\" $FreeBSD$
 .\"
-.Dd January 2, 2019
+.Dd January 15, 2019
 .Dt DLOPEN 3
 .Os
 .Sh NAME
 .Nm dlopen ,
+.Nm dlopenat ,
 .Nm fdlopen ,
 .Nm dlsym ,
 .Nm dlvsym ,
@@ -51,6 +52,8 @@
 .Ft void *
 .Fn dlopen "const char *path" "int mode"
 .Ft void *
+.Fn dlopenat "int fd" "const char *path" "int mode"
+.Ft void *
 .Fn fdlopen "int fd" "int mode"
 .Ft void *
 .Fn dlsym "void * restrict handle" "const char * restrict symbol"
@@ -169,6 +172,24 @@ If
 fails, it returns a null pointer, and sets an error condition which may
 be interrogated with
 .Fn dlerror .
+.Pp
+The
+.Fn dlopenat
+function is equivalent to
+.Fn dlopen
+except in the case where the path specifies a relative path.
+In this case the file to be opened is determined relative to the
+directory associated with the file descriptor fd instead of the
+current working directory.
+If
+.Fn dlopenat
+is passed the special value
+.Dv AT_FDCWD
+in the
+.Fa fd
+parameter, the current working directory is used and the behavior is
+identical to a call to
+.Fn dlopen .
 .Pp
 The
 .Fn fdlopen

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cWed Jan 16 12:11:29 2019
(r343092)
+++ head/libexec/rtld-elf/rtld.cWed Jan 16 12:12:40 2019
(r343093)
@@ -93,8 +93,8 @@ static void digest_dynamic(Obj_Entry *, int);
 static Obj_Entry *digest_phdr(const Elf_Phdr *, int, caddr_t, const char *);
 static Obj_Entry *dlcheck(void *);
 static int dlclose_locked(void *, RtldLockState *);
-static Obj_Entry *dlopen_object(const char *name, int fd, Obj_Entry *refobj,
-int lo_flags, int mode, RtldLockState *lockstate);
+static Obj_Entry *dlopen_object(int, const char *name, int fd,
+Obj_Entry *refobj, int lo_flags, int mode, RtldLockState *lockstate);
 static Obj_Entry *do_load_object(int, const char *, char *, struct stat *, 
int);
 static int do_search_info(const Obj_Entry *obj, int, struct dl_serinfo *);
 static bool donelist_check(DoneList *, const Obj_Entry *);
@@ -118,7 +118,7 @@ static void load_filtees(Obj_Entry *, int flags, RtldL
 static void unload_filtees(Obj_Entry *, RtldLockState *);
 static int load_needed_objects(Obj_Entry *, int);
 static int load_preload_objects(void);
-static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int);
+static Obj_Entry *load_object(int, const char *, int, const Obj_Entry *, int);
 static void map_stacks_exec(RtldLockState *);
 static int obj_disable_relro(Obj_Entry *);
 static int obj_enforce_relro(Obj_Entry *);
@@ -147,7 +147,7 @@ static int relocate_objects(Obj_Entry *, bool, Obj_Ent
 static int resolve_object_ifunc(Obj_Entry *, bool, int, RtldLockState *);
 static int rtld_dirname(const char *, char *);
 static int rtld_dirname_abs(const char *, char *);
-static void *rtld_dlopen(const char *name, int fd, int mode);
+static void *rtld_dlopen(int, const char *name, int fd, int mode);
 static void rtld_exit(void);
 static char *search_library_path(const char *, const char *, const char *,
 int *);
@@ -231,6 +231,7 @@ extern Elf_Dyn _DYNAMIC;
 int dlclose(void *) __exported;
 char *dlerror(void) __exported;
 void *dlopen(const char *, int) __exported;
+void *dlopenat(int, const char *, int) __exported;
 void *fdlopen(int, int) __exported;
 void *dlsym(void *, const char *) __exported;
 dlfunc_t dlfunc(void *, const char *) __exported;
@@ -2292,8 +2293,8 @@ load_filtee1(Obj_Entry *obj, Needed_Entry *needed, int
 {
 
 for (; needed != NULL; needed = needed->next) {
-   needed->obj = dlopen_object(obj->strtab + needed->name, -1, obj,
- flags, ((ld_loadfltr || obj->z_loadfltr) ? RTLD_NOW : RTLD_LAZY) |
+   needed->obj = dlopen_object(AT_FDCWD, obj->strtab + needed->name, -1,
+ obj, flags, 

svn commit: r343092 - in head/sys/dev/rtwn: rtl8192c rtl8812a

2019-01-16 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Jan 16 12:11:29 2019
New Revision: 343092
URL: https://svnweb.freebsd.org/changeset/base/343092

Log:
  rtwn(4): clear 'basic' rate bit before calculating RTS/CTS rate.
  
  Rate tables have this bit set to indicate minimal set of basic rates;
  however, it overlappes with MCS bit, so rate2ridx() will treat them as
  an 11n rate.
  
  Due to the current rates setup the issue can be reproduced only
  in 5GHz band with 11n / protection enabled.
  
  Tested with RTL8821AU, HOSTAP mode.
  
  MFC after:5 days

Modified:
  head/sys/dev/rtwn/rtl8192c/r92c_tx.c
  head/sys/dev/rtwn/rtl8812a/r12a_tx.c

Modified: head/sys/dev/rtwn/rtl8192c/r92c_tx.c
==
--- head/sys/dev/rtwn/rtl8192c/r92c_tx.cWed Jan 16 12:04:29 2019
(r343091)
+++ head/sys/dev/rtwn/rtl8192c/r92c_tx.cWed Jan 16 12:11:29 2019
(r343092)
@@ -103,7 +103,7 @@ r92c_tx_protection(struct rtwn_softc *sc, struct r92c_
rate = rtwn_ctl_mcsrate(ic->ic_rt, ridx);
else
rate = ieee80211_ctl_rate(ic->ic_rt, ridx2rate[ridx]);
-   ridx = rate2ridx(rate);
+   ridx = rate2ridx(IEEE80211_RV(rate));
 
txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, ridx));
/* RTS rate fallback limit (max). */

Modified: head/sys/dev/rtwn/rtl8812a/r12a_tx.c
==
--- head/sys/dev/rtwn/rtl8812a/r12a_tx.cWed Jan 16 12:04:29 2019
(r343091)
+++ head/sys/dev/rtwn/rtl8812a/r12a_tx.cWed Jan 16 12:11:29 2019
(r343092)
@@ -111,7 +111,7 @@ r12a_tx_protection(struct rtwn_softc *sc, struct r12a_
rate = rtwn_ctl_mcsrate(ic->ic_rt, ridx);
else
rate = ieee80211_ctl_rate(ic->ic_rt, ridx2rate[ridx]);
-   ridx = rate2ridx(rate);
+   ridx = rate2ridx(IEEE80211_RV(rate));
 
txd->txdw4 |= htole32(SM(R12A_TXDW4_RTSRATE, ridx));
/* RTS rate fallback limit (max). */
___
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: r343089 - head/sys/netinet

2019-01-16 Thread Michael Tuexen
Author: tuexen
Date: Wed Jan 16 11:33:47 2019
New Revision: 343089
URL: https://svnweb.freebsd.org/changeset/base/343089

Log:
  Limit the user-controllable amount of memory the kernel allocates
  via IPPROTO_SCTP level socket options.
  
  This issue was found by running syzkaller.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_constants.h
==
--- head/sys/netinet/sctp_constants.h   Wed Jan 16 10:33:51 2019
(r343088)
+++ head/sys/netinet/sctp_constants.h   Wed Jan 16 11:33:47 2019
(r343089)
@@ -983,6 +983,9 @@ __FBSDID("$FreeBSD$");
 uint8_t *)&(a)->s_addr)[0] == 169) && \
  (((uint8_t *)&(a)->s_addr)[1] == 254))
 
+/* Maximum size of optval for IPPROTO_SCTP level socket options. */
+#define SCTP_SOCKET_OPTION_LIMIT (64 * 1024)
+
 
 #if defined(_KERNEL)
 #define SCTP_GETTIME_TIMEVAL(x) (getmicrouptime(x))

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Wed Jan 16 10:33:51 2019
(r343088)
+++ head/sys/netinet/sctp_usrreq.c  Wed Jan 16 11:33:47 2019
(r343089)
@@ -6828,6 +6828,10 @@ sctp_ctloutput(struct socket *so, struct sockopt *sopt
return (error);
}
optsize = sopt->sopt_valsize;
+   if (optsize > SCTP_SOCKET_OPTION_LIMIT) {
+   SCTP_LTRACE_ERR_RET(so->so_pcb, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, ENOBUFS);
+   return (ENOBUFS);
+   }
if (optsize) {
SCTP_MALLOC(optval, void *, optsize, SCTP_M_SOCKOPT);
if (optval == NULL) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343088 - in head/sys/dev: rtwn/usb usb

2019-01-16 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Jan 16 10:33:51 2019
New Revision: 343088
URL: https://svnweb.freebsd.org/changeset/base/343088

Log:
  rtwn_usb(4): add new USB id for RTL8821AU
  
  Reported by:  Mike Tancsa 
  Tested by:Mike Tancsa 
  MFC after:3 days

Modified:
  head/sys/dev/rtwn/usb/rtwn_usb_attach.h
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.h
==
--- head/sys/dev/rtwn/usb/rtwn_usb_attach.h Wed Jan 16 06:10:55 2019
(r343087)
+++ head/sys/dev/rtwn/usb/rtwn_usb_attach.h Wed Jan 16 10:33:51 2019
(r343088)
@@ -156,7 +156,8 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = {
RTWN_RTL8821AU_DEV(EDIMAX,  EW7811UTC_2),
RTWN_RTL8821AU_DEV(HAWKING, HD65U),
RTWN_RTL8821AU_DEV(MELCO,   WIU2433DM),
-   RTWN_RTL8821AU_DEV(NETGEAR, A6100)
+   RTWN_RTL8821AU_DEV(NETGEAR, A6100),
+   RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU)
 #undef RTWN_RTL8821AU_DEV
 };
 

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsWed Jan 16 06:10:55 2019(r343087)
+++ head/sys/dev/usb/usbdevsWed Jan 16 10:33:51 2019(r343088)
@@ -3957,6 +3957,7 @@ product REALTEK RTL8187B_20x8198  RTL8187B 
Wireless Ad
 product REALTEK RTL87120x8712  RTL8712
 product REALTEK RTL87130x8713  RTL8713
 product REALTEK RTL8188CU_COMBO0x8754  RTL8188CU
+product REALTEK RTL8821AU  0xa811  RTL8821AU
 product REALTEK RTL8723BU  0xb720  RTL8723BU
 product REALTEK RTL8192SU  0xc512  RTL8192SU
 product REALTEK RTL8812AU  0x8812  RTL8812AU Wireless Adapter
___
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: r343058 - in head/sys: compat/linuxkpi/common/src vm

2019-01-16 Thread Bruce Evans

On Tue, 15 Jan 2019, Gleb Smirnoff wrote:


On Tue, Jan 15, 2019 at 01:46:23PM -0600, Justin Hibbits wrote:
J> Why not #include counter.h in the relevant vm_machdep.c files instead?

This also is ugly :( Not sure more or less. Probably less, but I
urged to plug all possible compilation failures at a time.


It is better, but it is a bug if vm_machdep.c files include uma's internal
header.  Perhaps Justin meant vm files other than vm_machdep.c.  The
only non-uma ones in vm/* chummy with uma's internals are memguard.c and
vm_page.c.


What is ugly is that most files just need counter_u64_t size,
and they don't use counter(9) KPI.

The fact that vm_machdep or Linux KPI want to look into internal
type uma_zone_t is also ugly.


This is a bug in uma.  style(9) forbids using typedefs for struct types
and pointers to struct types, since these are usually just foot shooting.
They usually give the opposite of opaque types, since the header that
declarers them usually also declares lots of pollution and often declares
the internals of the types that are supposed to be opaque.

I, partially fixed this in my version about 15 years ago:

XX Index: uma.h
XX ===
XX RCS file: /home/ncvs/src/sys/vm/uma.h,v
XX retrieving revision 1.18
XX diff -u -2 -r1.18 uma.h
XX --- uma.h1 Jun 2004 01:36:26 -   1.18
XX +++ uma.h1 Jun 2004 08:52:15 -
XX @@ -25,17 +25,21 @@
XX   *
XX   * $FreeBSD: src/sys/vm/uma.h,v 1.18 2004/06/01 01:36:26 bmilekic Exp $
XX - *
XX   */
XX 
XX +#ifndef _VM_UMA_H_

XX +#define _VM_UMA_H_
XX +
XX  /*
XX   * uma.h - External definitions for the Universal Memory Allocator
XX - *
XX -*/
XX + */
XX 
XX -#ifndef VM_UMA_H

XX -#define VM_UMA_H
XX +#include 
XX 
XX -#include 		/* For NULL */

XX -#include/* For M_* */
XX +/* Shared with . */
XX +#define M_NOWAIT0x0001  /* do not block */
XX +#define M_WAITOK0x0002  /* do not block */
XX +#define M_ZERO  0x0100  /* bzero the allocation */
XX +#define M_NOVM  0x0200  /* don't ask VM for pages */
XX +#define M_USE_RESERVE   0x0400  /* can alloc out of reserve 
memory */
XX 
XX  /* User visable parameters */


uma.h has grosser pollution for NULL and M_*.  I don't like lots of little
headers like sys/_null.h, but it may as well be used when it exists.

Replicating the definitions of M_* is easier than replicating the definition
of NULL.

XX @@ -44,7 +48,6 @@
XX  /* Types and type defs */
XX 
XX -struct uma_zone;

XX  /* Opaque type used as a handle to the zone */
XX -typedef struct uma_zone * uma_zone_t;
XX +typedef struct uma_zone * uma_zone_t;   /* XXX actually non-opaque. */
XX 
XX  /*


I didn't completely fix this.  The full fix would remove the typedef.

XX @@ -254,6 +257,8 @@
XX   *  returned if the zone is empty or the ctor failed.
XX   */
XX -
XX +#ifndef _UMA_ZALLOC_ARG_DECLARED
XX  void *uma_zalloc_arg(uma_zone_t zone, void *arg, int flags);
XX +#define _UMA_ZALLOC_ARG_DECLARED
XX +#endif
XX 
XX  /*

XX @@ -282,6 +287,8 @@
XX   *  Nothing.
XX   */
XX -
XX +#ifndef _UMA_ZFREE_ARG_DECLARED
XX  void uma_zfree_arg(uma_zone_t zone, void *item, void *arg);
XX +#define _UMA_ZFREE_ARG_DECLARED
XX +#endif
XX 
XX  /*


These ifdefs fix the largest source of pollution.  The declarations are
repeated in  so that mbuf.h doesn't need to include .
These functions aren't even inline, so calling them in inline functions
in mbuf.h (and inlining these functions) is especially useless.  I also
fixed mbuf.h to not include .

 and  are among the few files that I completed
removal of pollution in 20-25 years ago.  Now they are much more polluted
than when I started cleaning them.

mbuf.h now includes: sys/param.h, sys/systm.h (_KERNEL only),
sys/queue.h (this is not considered pollution, and I didn't clean it),
sys/_lock.h, sys/_mutex.h, machine/_limits.h (the last 3 are needed
for too much inlining, but are not considered pollution).

malloc.h now includes (in bogus order): sys/queue.h, sys/systm.h,
vm/uma.h and its nested pollution (last 2 _KERNEL only), sys/lock.h
(WITNESS only), sys/sdt.h (_KERNEL only, and not in the suckage section).

XX @@ -504,3 +511,3 @@
XX  u_int32_t *uma_find_refcnt(uma_zone_t zone, void *item);
XX 
XX -#endif

XX +#endif /* !_VM_UMA_H_ */

The patch is for a 2004 version.  The current version starts with the same
bugs and ends with 2 bugs in the fix for the missing comment.

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"