svn commit: r342810 - head/usr.sbin/powerd

2019-01-05 Thread Andriy Voskoboinyk
Author: avos
Date: Sun Jan  6 02:39:03 2019
New Revision: 342810
URL: https://svnweb.freebsd.org/changeset/base/342810

Log:
  powerd(8): allow to force a method of battery state query
  
  This change allows to determine power source via sysctl or /dev/apm
  when devd(8) is running (used by default).
  
  Based on patch from PR; other changes on top of it:
  - '-f' (force) -> '-s' (source) parameter renaming;
  - allow 'apm' -> 'devd' transition when '-s devd' is set
  (if APM is enabled);
  - man page update.
  
  Checked on amd64 with -s devd / sysctl and apm
  (an extra build with forced USE_APM define set was done)
  
  PR:   125707
  Submitted by: Konstantin Stepanov 
  Reviewed by:  bcr, imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D18742

Modified:
  head/usr.sbin/powerd/powerd.8
  head/usr.sbin/powerd/powerd.c

Modified: head/usr.sbin/powerd/powerd.8
==
--- head/usr.sbin/powerd/powerd.8   Sun Jan  6 02:17:18 2019
(r342809)
+++ head/usr.sbin/powerd/powerd.8   Sun Jan  6 02:39:03 2019
(r342810)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 4, 2013
+.Dd January 6, 2019
 .Dt POWERD 8
 .Os
 .Sh NAME
@@ -41,6 +41,7 @@
 .Op Fl p Ar ival
 .Op Fl P Ar pidfile
 .Op Fl r Ar percent
+.Op Fl s Ar source
 .Op Fl v
 .Sh DESCRIPTION
 The
@@ -117,6 +118,14 @@ The default is
 Specifies the CPU load percent level where adaptive
 mode should consider the CPU running and increase performance.
 The default is 75% or higher.
+.It Fl s Ar source
+Enforces method for AC line state refresh; by default, it is chosen
+automatically.
+The set of valid methods is
+.Cm sysctl , devd
+and
+.Cm apm
+(i386 only).
 .It Fl v
 Verbose mode.
 Messages about power changes will be printed to stdout and

Modified: head/usr.sbin/powerd/powerd.c
==
--- head/usr.sbin/powerd/powerd.c   Sun Jan  6 02:17:18 2019
(r342809)
+++ head/usr.sbin/powerd/powerd.c   Sun Jan  6 02:39:03 2019
(r342810)
@@ -113,14 +113,16 @@ static intvflag;
 
 static volatile sig_atomic_t exit_requested;
 static power_src_t acline_status;
-static enum {
+typedef enum {
ac_none,
ac_sysctl,
ac_acpi_devd,
 #ifdef USE_APM
ac_apm,
 #endif
-} acline_mode;
+} acline_mode_t;
+static acline_mode_t acline_mode;
+static acline_mode_t acline_mode_user = ac_none;
 #ifdef USE_APM
 static int apm_fd = -1;
 #endif
@@ -286,21 +288,28 @@ get_freq_id(int freq, int *freqs, int numfreqs)
 static void
 acline_init(void)
 {
+   int skip_source_check;
+
acline_mib_len = 4;
acline_status = SRC_UNKNOWN;
+   skip_source_check = (acline_mode_user == ac_none ||
+acline_mode_user == ac_acpi_devd);
 
-   if (sysctlnametomib(ACPIAC, acline_mib, _mib_len) == 0) {
+   if ((skip_source_check || acline_mode_user == ac_sysctl) &&
+   sysctlnametomib(ACPIAC, acline_mib, _mib_len) == 0) {
acline_mode = ac_sysctl;
if (vflag)
warnx("using sysctl for AC line status");
 #ifdef __powerpc__
-   } else if (sysctlnametomib(PMUAC, acline_mib, _mib_len) == 0) {
+   } else if ((skip_source_check || acline_mode_user == ac_sysctl) &&
+  sysctlnametomib(PMUAC, acline_mib, _mib_len) == 0) {
acline_mode = ac_sysctl;
if (vflag)
warnx("using sysctl for AC line status");
 #endif
 #ifdef USE_APM
-   } else if ((apm_fd = open(APMDEV, O_RDONLY)) >= 0) {
+   } else if ((skip_source_check || acline_mode_user == ac_apm) &&
+  (apm_fd = open(APMDEV, O_RDONLY)) >= 0) {
if (vflag)
warnx("using APM for AC line status");
acline_mode = ac_apm;
@@ -360,7 +369,17 @@ acline_read(void)
}
 #endif
/* try to (re)connect to devd */
-   if (acline_mode == ac_sysctl) {
+#ifdef USE_APM
+   if ((acline_mode == ac_sysctl &&
+   (acline_mode_user == ac_none ||
+acline_mode_user == ac_acpi_devd)) ||
+   (acline_mode == ac_apm &&
+acline_mode_user == ac_acpi_devd)) {
+#else
+   if (acline_mode == ac_sysctl &&
+   (acline_mode_user == ac_none ||
+acline_mode_user == ac_acpi_devd)) {
+#endif
struct timeval now;
 
gettimeofday(, NULL);
@@ -426,6 +445,21 @@ parse_mode(char *arg, int *mode, int ch)
 }
 
 static void
+parse_acline_mode(char *arg, int ch)
+{
+   if (strcmp(arg, "sysctl") == 0)
+   acline_mode_user = ac_sysctl;
+   else if (strcmp(arg, "devd") == 0)
+   acline_mode_user = ac_acpi_devd;
+#ifdef USE_APM
+   else if (strcmp(arg, "apm") == 0)
+   acline_mode_user = ac_apm;
+#endif
+   else
+   

svn commit: r342808 - in stable/11: . contrib/mdocml lib lib/libbe sbin sbin/bectl share/mk sys/amd64/conf tools/build/mk usr.sbin/config

2019-01-05 Thread Kyle Evans
Author: kevans
Date: Sun Jan  6 02:15:09 2019
New Revision: 342808
URL: https://svnweb.freebsd.org/changeset/base/342808

Log:
  Revert r342807, mistakenly including libbe(3)/bectl(8) MFC

Deleted:
  stable/11/lib/libbe/
  stable/11/sbin/bectl/
Modified:
  stable/11/Makefile.inc1
  stable/11/ObsoleteFiles.inc
  stable/11/contrib/mdocml/lib.in
  stable/11/lib/Makefile
  stable/11/sbin/Makefile
  stable/11/share/mk/bsd.libnames.mk
  stable/11/share/mk/src.libnames.mk
  stable/11/sys/amd64/conf/GENERIC
  stable/11/sys/amd64/conf/MINIMAL
  stable/11/tools/build/mk/OptionalObsoleteFiles.inc
  stable/11/usr.sbin/config/config.y
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/Makefile.inc1
==
--- stable/11/Makefile.inc1 Sun Jan  6 02:13:16 2019(r342807)
+++ stable/11/Makefile.inc1 Sun Jan  6 02:15:09 2019(r342808)
@@ -2144,7 +2144,7 @@ _prebuild_libs=   ${_kerberos5_lib_libasn1} \
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
${_cddl_lib_libuutil} \
${_cddl_lib_libavl} \
-   ${_cddl_lib_libzfs_core} ${_cddl_lib_libzfs} \
+   ${_cddl_lib_libzfs_core} \
${_cddl_lib_libctf} \
lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
${_secure_lib_libcrypto} ${_lib_libldns} \
@@ -2213,15 +2213,7 @@ _cddl_lib_libavl= cddl/lib/libavl
 _cddl_lib_libuutil= cddl/lib/libuutil
 .if ${MK_ZFS} != "no"
 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
-_cddl_lib_libzfs= cddl/lib/libzfs
-
 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
-
-cddl/lib/libzfs__L: cddl/lib/libzfs_core__L lib/msun__L lib/libutil__L
-cddl/lib/libzfs__L: lib/libthr__L lib/libmd__L lib/libz__L cddl/lib/libumem__L
-cddl/lib/libzfs__L: cddl/lib/libuutil__L cddl/lib/libavl__L lib/libgeom__L
-
-lib/libbe__L: cddl/lib/libzfs__L
 .endif
 _cddl_lib_libctf= cddl/lib/libctf
 _cddl_lib= cddl/lib

Modified: stable/11/ObsoleteFiles.inc
==
--- stable/11/ObsoleteFiles.inc Sun Jan  6 02:13:16 2019(r342807)
+++ stable/11/ObsoleteFiles.inc Sun Jan  6 02:15:09 2019(r342808)
@@ -38,8 +38,6 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
-# 20181115: libbe(3) SHLIBDIR fixed to reflect correct location
-OLD_LIBS+=usr/lib/libbe.so.1
 # 20180812: move of libmlx5.so.1 and libibverbs.so.1
 OLD_LIBS+=usr/lib/libmlx5.so.1
 OLD_LIBS+=usr/lib/libibverbs.so.1

Modified: stable/11/contrib/mdocml/lib.in
==
--- stable/11/contrib/mdocml/lib.in Sun Jan  6 02:13:16 2019
(r342807)
+++ stable/11/contrib/mdocml/lib.in Sun Jan  6 02:15:09 2019
(r342808)
@@ -28,7 +28,6 @@ LINE("lib80211",  "802.11 Wireless Network Management L
 LINE("libarchive", "Streaming Archive Library (libarchive, \\-larchive)")
 LINE("libarm", "ARM Architecture Library (libarm, \\-larm)")
 LINE("libarm32",   "ARM32 Architecture Library (libarm32, \\-larm32)")
-LINE("libbe",  "Boot Environment Library (libbe, \\-lbe)")
 LINE("libbluetooth",   "Bluetooth Library (libbluetooth, \\-lbluetooth)")
 LINE("libbsm", "Basic Security Module Library (libbsm, \\-lbsm)")
 LINE("libc",   "Standard C\\~Library (libc, \\-lc)")

Modified: stable/11/lib/Makefile
==
--- stable/11/lib/Makefile  Sun Jan  6 02:13:16 2019(r342807)
+++ stable/11/lib/Makefile  Sun Jan  6 02:15:09 2019(r342808)
@@ -289,7 +289,6 @@ _libproc=   libproc
 _librtld_db=   librtld_db
 .endif
 SUBDIR.${MK_OFED}+=ofed
-SUBDIR.${MK_ZFS}+= libbe
 
 .if ${MK_OPENSSL} != "no"
 _libmp=libmp

Modified: stable/11/sbin/Makefile
==
--- stable/11/sbin/Makefile Sun Jan  6 02:13:16 2019(r342807)
+++ stable/11/sbin/Makefile Sun Jan  6 02:15:09 2019(r342808)
@@ -87,7 +87,6 @@ SUBDIR.${MK_PF}+= pfctl
 SUBDIR.${MK_PF}+=  pflogd
 SUBDIR.${MK_QUOTAS}+=  quotacheck
 SUBDIR.${MK_ROUTED}+=  routed
-SUBDIR.${MK_ZFS}+= bectl
 SUBDIR.${MK_ZFS}+= zfsbootcfg
 
 SUBDIR.${MK_TESTS}+=   tests

Modified: stable/11/share/mk/bsd.libnames.mk
==
--- stable/11/share/mk/bsd.libnames.mk  Sun Jan  6 02:13:16 2019
(r342807)
+++ stable/11/share/mk/bsd.libnames.mk  Sun Jan  6 02:15:09 2019
(r342808)
@@ -21,7 +21,6 @@ LIBASN1?= ${DESTDIR}${LIBDIR_BASE}/libasn1.a
 LIBATM?=   ${DESTDIR}${LIBDIR_BASE}/libatm.a
 LIBAUDITD?=${DESTDIR}${LIBDIR_BASE}/libauditd.a
 LIBAVL?=   ${DESTDIR}${LIBDIR_BASE}/libavl.a
-LIBBE?=${DESTDIR}${LIBDIR_BASE}/libbe.a
 LIBBEGEMOT?=   

svn commit: r342809 - stable/11/usr.sbin/config

2019-01-05 Thread Kyle Evans
Author: kevans
Date: Sun Jan  6 02:17:18 2019
New Revision: 342809
URL: https://svnweb.freebsd.org/changeset/base/342809

Log:
  MFC r342362-r342363: config(8) duplicate option handling
  
  r342362:
  config(8): Allow duplicate options to be specified
  
  config(8)'s option handling has been written to allow duplicate options; if
  the value changes, then the latest value is used and an informative message
  is printed to stderr like so:
  
  /usr/src/sys/amd64/conf/TEST: option "VERBOSE_SYSINIT" redefined from 0 to 1
  
  Currently, this is only a possibility for cpu types, MAXUSERS, and
  MACHINE_ARCH. Anything else duplicated in a config file will use the first
  value set and error about duplicated options on subsequent appearances,
  which is arguably unfriendly since one could specify:
  
  include GENERIC
  nooptions VERBOSE_SYSINIT
  options VERBOSE_SYSINIT
  
  to redefine the value later anyways.
  
  Reported by:  mmacy
  
  r342363:
  config(8): Remove all instances of an option when opting out
  
  Quick follow-up to r342362: options can appear multiple times now, so
  clean up all of them as needed. For non-OPTIONS options, this has no effect
  since they're already de-duplicated.

Modified:
  stable/11/usr.sbin/config/config.y
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/config/config.y
==
--- stable/11/usr.sbin/config/config.y  Sun Jan  6 02:15:09 2019
(r342808)
+++ stable/11/usr.sbin/config/config.y  Sun Jan  6 02:17:18 2019
(r342809)
@@ -97,7 +97,7 @@ static void newdev(char *name);
 static void newfile(char *name);
 static void newenvvar(char *name, bool is_file);
 static void rmdev_schedule(struct device_head *dh, char *name);
-static void newopt(struct opt_head *list, char *name, char *value, int append);
+static void newopt(struct opt_head *list, char *name, char *value, int append, 
int dupe);
 static void rmopt_schedule(struct opt_head *list, char *name);
 
 static char *
@@ -210,7 +210,7 @@ System_spec:
  ;
 
 System_id:
-   Save_id { newopt(, ns("KERNEL"), $1, 0); };
+   Save_id { newopt(, ns("KERNEL"), $1, 0, 0); };
 
 System_parameter_list:
  System_parameter_list ID
@@ -230,13 +230,13 @@ NoOpt_list:
;
 Option:
Save_id {
-   newopt(, $1, NULL, 0);
+   newopt(, $1, NULL, 0, 1);
if (strchr($1, '=') != NULL)
errx(1, "%s:%d: The `=' in options should not be "
"quoted", yyfile, yyline);
  } |
Save_id EQUALS Opt_value {
-   newopt(, $1, $3, 0);
+   newopt(, $1, $3, 0, 1);
  } ;
 
 NoOption:
@@ -264,10 +264,10 @@ Mkopt_list:
;
 
 Mkoption:
-   Save_id { newopt(, $1, ns(""), 0); } |
-   Save_id EQUALS { newopt(, $1, ns(""), 0); } |
-   Save_id EQUALS Opt_value { newopt(, $1, $3, 0); } |
-   Save_id PLUSEQUALS Opt_value { newopt(, $1, $3, 1); } ;
+   Save_id { newopt(, $1, ns(""), 0, 0); } |
+   Save_id EQUALS { newopt(, $1, ns(""), 0, 0); } |
+   Save_id EQUALS Opt_value { newopt(, $1, $3, 0, 0); } |
+   Save_id PLUSEQUALS Opt_value { newopt(, $1, $3, 1, 0); } ;
 
 Dev:
ID { $$ = $1; }
@@ -293,7 +293,7 @@ NoDev_list:
 
 Device:
Dev {
-   newopt(, devopt($1), ns("1"), 0);
+   newopt(, devopt($1), ns("1"), 0, 0);
/* and the device part */
newdev($1);
}
@@ -430,7 +430,7 @@ findopt(struct opt_head *list, char *name)
  * Add an option to the list of options.
  */
 static void
-newopt(struct opt_head *list, char *name, char *value, int append)
+newopt(struct opt_head *list, char *name, char *value, int append, int dupe)
 {
struct opt *op, *op2;
 
@@ -443,7 +443,7 @@ newopt(struct opt_head *list, char *name, char *value,
}
 
op2 = findopt(list, name);
-   if (op2 != NULL && !append) {
+   if (op2 != NULL && !append && !dupe) {
fprintf(stderr,
"WARNING: duplicate option `%s' encountered.\n", name);
return;
@@ -456,9 +456,15 @@ newopt(struct opt_head *list, char *name, char *value,
op->op_ownfile = 0;
op->op_value = value;
if (op2 != NULL) {
-   while (SLIST_NEXT(op2, op_append) != NULL)
-   op2 = SLIST_NEXT(op2, op_append);
-   SLIST_NEXT(op2, op_append) = op;
+   if (append) {
+   while (SLIST_NEXT(op2, op_append) != NULL)
+   op2 = SLIST_NEXT(op2, op_append);
+   SLIST_NEXT(op2, op_append) = op;
+   } else {
+   while (SLIST_NEXT(op2, op_next) != NULL)
+   op2 = SLIST_NEXT(op2, op_next);
+   SLIST_NEXT(op2, op_next) = op;
+

svn commit: r342807 - in stable/11: . contrib/mdocml lib lib/libbe sbin sbin/bectl share/mk sys/amd64/conf tools/build/mk usr.sbin/config

2019-01-05 Thread Kyle Evans
Author: kevans
Date: Sun Jan  6 02:13:16 2019
New Revision: 342807
URL: https://svnweb.freebsd.org/changeset/base/342807

Log:
  MFC r342362-r342363: config(8) duplicate option handling
  
  r342362:
  config(8): Allow duplicate options to be specified
  
  config(8)'s option handling has been written to allow duplicate options; if
  the value changes, then the latest value is used and an informative message
  is printed to stderr like so:
  
  /usr/src/sys/amd64/conf/TEST: option "VERBOSE_SYSINIT" redefined from 0 to 1
  
  Currently, this is only a possibility for cpu types, MAXUSERS, and
  MACHINE_ARCH. Anything else duplicated in a config file will use the first
  value set and error about duplicated options on subsequent appearances,
  which is arguably unfriendly since one could specify:
  
  include GENERIC
  nooptions VERBOSE_SYSINIT
  options VERBOSE_SYSINIT
  
  to redefine the value later anyways.
  
  Reported by:  mmacy
  
  r342363:
  config(8): Remove all instances of an option when opting out
  
  Quick follow-up to r342362: options can appear multiple times now, so
  clean up all of them as needed. For non-OPTIONS options, this has no effect
  since they're already de-duplicated.

Added:
  stable/11/lib/libbe/
 - copied from r337664, head/lib/libbe/
  stable/11/lib/libbe/Makefile
 - copied, changed from r337995, head/lib/libbe/Makefile
  stable/11/sbin/bectl/
 - copied from r337664, head/sbin/bectl/
Modified:
  stable/11/Makefile.inc1
  stable/11/ObsoleteFiles.inc
  stable/11/contrib/mdocml/lib.in
  stable/11/lib/Makefile
  stable/11/lib/libbe/be.c
  stable/11/lib/libbe/be.h
  stable/11/lib/libbe/be_access.c
  stable/11/lib/libbe/be_error.c
  stable/11/lib/libbe/be_info.c
  stable/11/lib/libbe/libbe.3
  stable/11/sbin/Makefile
  stable/11/sbin/bectl/Makefile
  stable/11/sbin/bectl/bectl.8
  stable/11/sbin/bectl/bectl.c
  stable/11/sbin/bectl/bectl_jail.c
  stable/11/sbin/bectl/bectl_list.c
  stable/11/share/mk/bsd.libnames.mk
  stable/11/share/mk/src.libnames.mk
  stable/11/sys/amd64/conf/GENERIC
  stable/11/sys/amd64/conf/MINIMAL
  stable/11/tools/build/mk/OptionalObsoleteFiles.inc
  stable/11/usr.sbin/config/config.y
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/Makefile.inc1
==
--- stable/11/Makefile.inc1 Sun Jan  6 02:12:55 2019(r342806)
+++ stable/11/Makefile.inc1 Sun Jan  6 02:13:16 2019(r342807)
@@ -2144,7 +2144,7 @@ _prebuild_libs=   ${_kerberos5_lib_libasn1} \
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
${_cddl_lib_libuutil} \
${_cddl_lib_libavl} \
-   ${_cddl_lib_libzfs_core} \
+   ${_cddl_lib_libzfs_core} ${_cddl_lib_libzfs} \
${_cddl_lib_libctf} \
lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
${_secure_lib_libcrypto} ${_lib_libldns} \
@@ -2213,7 +2213,15 @@ _cddl_lib_libavl= cddl/lib/libavl
 _cddl_lib_libuutil= cddl/lib/libuutil
 .if ${MK_ZFS} != "no"
 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
+_cddl_lib_libzfs= cddl/lib/libzfs
+
 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
+
+cddl/lib/libzfs__L: cddl/lib/libzfs_core__L lib/msun__L lib/libutil__L
+cddl/lib/libzfs__L: lib/libthr__L lib/libmd__L lib/libz__L cddl/lib/libumem__L
+cddl/lib/libzfs__L: cddl/lib/libuutil__L cddl/lib/libavl__L lib/libgeom__L
+
+lib/libbe__L: cddl/lib/libzfs__L
 .endif
 _cddl_lib_libctf= cddl/lib/libctf
 _cddl_lib= cddl/lib

Modified: stable/11/ObsoleteFiles.inc
==
--- stable/11/ObsoleteFiles.inc Sun Jan  6 02:12:55 2019(r342806)
+++ stable/11/ObsoleteFiles.inc Sun Jan  6 02:13:16 2019(r342807)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20181115: libbe(3) SHLIBDIR fixed to reflect correct location
+OLD_LIBS+=usr/lib/libbe.so.1
 # 20180812: move of libmlx5.so.1 and libibverbs.so.1
 OLD_LIBS+=usr/lib/libmlx5.so.1
 OLD_LIBS+=usr/lib/libibverbs.so.1

Modified: stable/11/contrib/mdocml/lib.in
==
--- stable/11/contrib/mdocml/lib.in Sun Jan  6 02:12:55 2019
(r342806)
+++ stable/11/contrib/mdocml/lib.in Sun Jan  6 02:13:16 2019
(r342807)
@@ -28,6 +28,7 @@ LINE("lib80211",  "802.11 Wireless Network Management L
 LINE("libarchive", "Streaming Archive Library (libarchive, \\-larchive)")
 LINE("libarm", "ARM Architecture Library (libarm, \\-larm)")
 LINE("libarm32",   "ARM32 Architecture Library (libarm32, \\-larm32)")
+LINE("libbe",  "Boot Environment Library (libbe, \\-lbe)")
 LINE("libbluetooth",   "Bluetooth Library (libbluetooth, \\-lbluetooth)")
 LINE("libbsm", "Basic Security Module Library (libbsm, \\-lbsm)")
 LINE("libc",   "Standard C\\~Library (libc, \\-lc)")

Modified: 

svn commit: r342806 - stable/12/usr.sbin/config

2019-01-05 Thread Kyle Evans
Author: kevans
Date: Sun Jan  6 02:12:55 2019
New Revision: 342806
URL: https://svnweb.freebsd.org/changeset/base/342806

Log:
  MFC r342362-r342363: config(8) duplicate option handling
  
  r342362:
  config(8): Allow duplicate options to be specified
  
  config(8)'s option handling has been written to allow duplicate options; if
  the value changes, then the latest value is used and an informative message
  is printed to stderr like so:
  
  /usr/src/sys/amd64/conf/TEST: option "VERBOSE_SYSINIT" redefined from 0 to 1
  
  Currently, this is only a possibility for cpu types, MAXUSERS, and
  MACHINE_ARCH. Anything else duplicated in a config file will use the first
  value set and error about duplicated options on subsequent appearances,
  which is arguably unfriendly since one could specify:
  
  include GENERIC
  nooptions VERBOSE_SYSINIT
  options VERBOSE_SYSINIT
  
  to redefine the value later anyways.
  
  Reported by:  mmacy
  
  r342363:
  config(8): Remove all instances of an option when opting out
  
  Quick follow-up to r342362: options can appear multiple times now, so
  clean up all of them as needed. For non-OPTIONS options, this has no effect
  since they're already de-duplicated.

Modified:
  stable/12/usr.sbin/config/config.y
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/config/config.y
==
--- stable/12/usr.sbin/config/config.y  Sun Jan  6 01:39:01 2019
(r342805)
+++ stable/12/usr.sbin/config/config.y  Sun Jan  6 02:12:55 2019
(r342806)
@@ -99,7 +99,7 @@ static void newdev(char *name);
 static void newfile(char *name);
 static void newenvvar(char *name, bool is_file);
 static void rmdev_schedule(struct device_head *dh, char *name);
-static void newopt(struct opt_head *list, char *name, char *value, int append);
+static void newopt(struct opt_head *list, char *name, char *value, int append, 
int dupe);
 static void rmopt_schedule(struct opt_head *list, char *name);
 
 static char *
@@ -212,7 +212,7 @@ System_spec:
  ;
 
 System_id:
-   Save_id { newopt(, ns("KERNEL"), $1, 0); };
+   Save_id { newopt(, ns("KERNEL"), $1, 0, 0); };
 
 System_parameter_list:
  System_parameter_list ID
@@ -232,13 +232,13 @@ NoOpt_list:
;
 Option:
Save_id {
-   newopt(, $1, NULL, 0);
+   newopt(, $1, NULL, 0, 1);
if (strchr($1, '=') != NULL)
errx(1, "%s:%d: The `=' in options should not be "
"quoted", yyfile, yyline);
  } |
Save_id EQUALS Opt_value {
-   newopt(, $1, $3, 0);
+   newopt(, $1, $3, 0, 1);
  } ;
 
 NoOption:
@@ -266,10 +266,10 @@ Mkopt_list:
;
 
 Mkoption:
-   Save_id { newopt(, $1, ns(""), 0); } |
-   Save_id EQUALS { newopt(, $1, ns(""), 0); } |
-   Save_id EQUALS Opt_value { newopt(, $1, $3, 0); } |
-   Save_id PLUSEQUALS Opt_value { newopt(, $1, $3, 1); } ;
+   Save_id { newopt(, $1, ns(""), 0, 0); } |
+   Save_id EQUALS { newopt(, $1, ns(""), 0, 0); } |
+   Save_id EQUALS Opt_value { newopt(, $1, $3, 0, 0); } |
+   Save_id PLUSEQUALS Opt_value { newopt(, $1, $3, 1, 0); } ;
 
 Dev:
ID { $$ = $1; }
@@ -295,7 +295,7 @@ NoDev_list:
 
 Device:
Dev {
-   newopt(, devopt($1), ns("1"), 0);
+   newopt(, devopt($1), ns("1"), 0, 0);
/* and the device part */
newdev($1);
}
@@ -432,7 +432,7 @@ findopt(struct opt_head *list, char *name)
  * Add an option to the list of options.
  */
 static void
-newopt(struct opt_head *list, char *name, char *value, int append)
+newopt(struct opt_head *list, char *name, char *value, int append, int dupe)
 {
struct opt *op, *op2;
 
@@ -445,7 +445,7 @@ newopt(struct opt_head *list, char *name, char *value,
}
 
op2 = findopt(list, name);
-   if (op2 != NULL && !append) {
+   if (op2 != NULL && !append && !dupe) {
fprintf(stderr,
"WARNING: duplicate option `%s' encountered.\n", name);
return;
@@ -458,9 +458,15 @@ newopt(struct opt_head *list, char *name, char *value,
op->op_ownfile = 0;
op->op_value = value;
if (op2 != NULL) {
-   while (SLIST_NEXT(op2, op_append) != NULL)
-   op2 = SLIST_NEXT(op2, op_append);
-   SLIST_NEXT(op2, op_append) = op;
+   if (append) {
+   while (SLIST_NEXT(op2, op_append) != NULL)
+   op2 = SLIST_NEXT(op2, op_append);
+   SLIST_NEXT(op2, op_append) = op;
+   } else {
+   while (SLIST_NEXT(op2, op_next) != NULL)
+   op2 = SLIST_NEXT(op2, op_next);
+   SLIST_NEXT(op2, op_next) = op;
+

svn commit: r342805 - head/libexec/rc

2019-01-05 Thread Kyle Evans
Author: kevans
Date: Sun Jan  6 01:39:01 2019
New Revision: 342805
URL: https://svnweb.freebsd.org/changeset/base/342805

Log:
  rc.subr: Fix typo
  
  Originally intended as 'in case in needs to be re-invoked', but it was later
  decided (by myself) that 're-invoke itself' makes it more clear that the
  script is expected to use this in a way.
  
  Reported by:  Jose Luis Duran (jlduran @ github)
  X-MFC-With:   r342792

Modified:
  head/libexec/rc/rc.subr

Modified: head/libexec/rc/rc.subr
==
--- head/libexec/rc/rc.subr Sun Jan  6 00:59:55 2019(r342804)
+++ head/libexec/rc/rc.subr Sun Jan  6 01:39:01 2019(r342805)
@@ -887,8 +887,8 @@ check_startmsgs()
 #  by $flags from the environment.
 #  This variable may be changed by the precmd method.
 #
-#   rc_service  Path to the service being executed, in case it needs to
-#   re-invoked.
+#   rc_service  Path to the service being executed, in case the service
+#   needs to re-invoke itself.
 #
 #  rc_pid  PID of command (if appropriate)
 #
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r342793 - in head: . share/mk stand/efi/boot1 stand/efi/libefi stand/efi/loader stand/i386 stand/i386/loader stand/libsa stand/sparc64 stand/sparc64/loader stand/userboot/userboot tool

2019-01-05 Thread Enji Cooper


> On Jan 5, 2019, at 14:45, Matt Macy  wrote:
> 
> Author: mmacy
> Date: Sat Jan  5 22:45:20 2019
> New Revision: 342793
> URL: https://svnweb.freebsd.org/changeset/base/342793
> 
> Log:
>  MK_ZFS -> {MK_ZFS|MK_LOADER_ZFS}, this is so we can diable userland / kernel
>  ZFS but keep the boot-loaders when using ZoL port.

Hiya!
Things might have changed in this area since I last checked, but does 
something like this require src.conf.5 to be regenerated?
Thanks so much!
-Enji
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342804 - in stable/11/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys

2019-01-05 Thread Konstantin Belousov
Author: kib
Date: Sun Jan  6 00:59:55 2019
New Revision: 342804
URL: https://svnweb.freebsd.org/changeset/base/342804

Log:
  MFC r342628, r342670 (by cem):
  Fix linux_destroy_dev() behaviour when there are still files open from
  the destroying cdev.
  
  Also bump __FreeBSD_version since struct linux_cdev size on i386 increased
  (this is unmergeable r342629 on HEAD).

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/cdev.h
  stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
  stable/11/sys/sys/param.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/cdev.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/cdev.h   Sun Jan  6 
00:55:23 2019(r342803)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/cdev.h   Sun Jan  6 
00:59:55 2019(r342804)
@@ -52,7 +52,8 @@ struct linux_cdev {
struct cdev *cdev;
dev_t   dev;
const struct file_operations *ops;
-   atomic_long_t   refs;
+   u_int   refs;
+   u_int   siref;
 };
 
 static inline void
@@ -61,7 +62,7 @@ cdev_init(struct linux_cdev *cdev, const struct file_o
 
kobject_init(>kobj, _cdev_static_ktype);
cdev->ops = ops;
-   atomic_long_set(>refs, 0);
+   cdev->refs = 1;
 }
 
 static inline struct linux_cdev *
@@ -70,8 +71,8 @@ cdev_alloc(void)
struct linux_cdev *cdev;
 
cdev = kzalloc(sizeof(struct linux_cdev), M_WAITOK);
-   if (cdev)
-   kobject_init(>kobj, _cdev_ktype);
+   kobject_init(>kobj, _cdev_ktype);
+   cdev->refs = 1;
return (cdev);
 }
 

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:55:23 2019(r342803)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:59:55 2019(r342804)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -100,6 +101,7 @@ MALLOC_DEFINE(M_KMALLOC, "linux", "Linux kmalloc compa
 #undef cdev
 #defineRB_ROOT(head)   (head)->rbh_root
 
+static void linux_cdev_deref(struct linux_cdev *ldev);
 static struct vm_area_struct *linux_cdev_handle_find(void *handle);
 
 struct kobject linux_class_root;
@@ -691,6 +693,52 @@ zap_vma_ptes(struct vm_area_struct *vma, unsigned long
return (0);
 }
 
+static struct file_operations dummy_ldev_ops = {
+   /* XXXKIB */
+};
+
+static struct linux_cdev dummy_ldev = {
+   .ops = _ldev_ops,
+};
+
+#defineLDEV_SI_DTR 0x0001
+#defineLDEV_SI_REF 0x0002
+
+static void
+linux_get_fop(struct linux_file *filp, const struct file_operations **fop,
+struct linux_cdev **dev)
+{
+   struct linux_cdev *ldev;
+   u_int siref;
+
+   ldev = filp->f_cdev;
+   *fop = filp->f_op;
+   if (ldev != NULL) {
+   for (siref = ldev->siref;;) {
+   if ((siref & LDEV_SI_DTR) != 0) {
+   ldev = _ldev;
+   siref = ldev->siref;
+   *fop = ldev->ops;
+   MPASS((ldev->siref & LDEV_SI_DTR) == 0);
+   } else if (atomic_fcmpset_int(>siref, ,
+   siref + LDEV_SI_REF)) {
+   break;
+   }
+   }
+   }
+   *dev = ldev;
+}
+
+static void
+linux_drop_fop(struct linux_cdev *ldev)
+{
+
+   if (ldev == NULL)
+   return;
+   MPASS((ldev->siref & ~LDEV_SI_DTR) != 0);
+   atomic_subtract_int(>siref, LDEV_SI_REF);
+}
+
 #defineOPW(fp,td,code) ({  \
struct file *__fpop;\
__typeof(code) __retval;\
@@ -703,10 +751,12 @@ zap_vma_ptes(struct vm_area_struct *vma, unsigned long
 })
 
 static int
-linux_dev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file 
*file)
+linux_dev_fdopen(struct cdev *dev, int fflags, struct thread *td,
+struct file *file)
 {
struct linux_cdev *ldev;
struct linux_file *filp;
+   const struct file_operations *fop;
int error;
 
ldev = dev->si_drv1;
@@ -718,20 +768,17 @@ linux_dev_fdopen(struct cdev *dev, int fflags, struct 
filp->f_flags = file->f_flag;
filp->f_vnode = file->f_vnode;
filp->_file = file;
+   refcount_acquire(>refs);
filp->f_cdev = ldev;
 
linux_set_current(td);
+   linux_get_fop(filp, , );
 
-   /* get a reference on the Linux character device */
-   if (atomic_long_add_unless(>refs, 1, -1L) == 0) {
-   kfree(filp);
-   return (EINVAL);
-   }
-
-   if 

svn commit: r342803 - in stable/11/sys/compat/linuxkpi/common: include/linux src

2019-01-05 Thread Konstantin Belousov
Author: kib
Date: Sun Jan  6 00:55:23 2019
New Revision: 342803
URL: https://svnweb.freebsd.org/changeset/base/342803

Log:
  MFC r342627:
  Implement zap_vma_ptes() for managed device objects.

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/mm.h
  stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/mm.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/mm.h Sun Jan  6 
00:54:08 2019(r342802)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/mm.h Sun Jan  6 
00:55:23 2019(r342803)
@@ -180,12 +180,8 @@ apply_to_page_range(struct mm_struct *mm, unsigned lon
return (-ENOTSUP);
 }
 
-static inline int
-zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
-unsigned long size)
-{
-   return (-ENOTSUP);
-}
+int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
+unsigned long size);
 
 static inline int
 remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:54:08 2019(r342802)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:55:23 2019(r342803)
@@ -672,6 +672,25 @@ static struct cdev_pager_ops linux_cdev_pager_ops[2] =
   },
 };
 
+int
+zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
+unsigned long size)
+{
+   vm_object_t obj;
+   vm_page_t m;
+
+   obj = vma->vm_obj;
+   if (obj == NULL || (obj->flags & OBJ_UNMANAGED) != 0)
+   return (-ENOTSUP);
+   VM_OBJECT_RLOCK(obj);
+   for (m = vm_page_find_least(obj, OFF_TO_IDX(address));
+   m != NULL && m->pindex < OFF_TO_IDX(address + size);
+   m = TAILQ_NEXT(m, listq))
+   pmap_remove_all(m);
+   VM_OBJECT_RUNLOCK(obj);
+   return (0);
+}
+
 #defineOPW(fp,td,code) ({  \
struct file *__fpop;\
__typeof(code) __retval;\
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342802 - stable/11/sys/compat/linuxkpi/common/src

2019-01-05 Thread Konstantin Belousov
Author: kib
Date: Sun Jan  6 00:54:08 2019
New Revision: 342802
URL: https://svnweb.freebsd.org/changeset/base/342802

Log:
  MFC r342625, r342631:
  Use IDX_TO_OFF().

Modified:
  stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:52:53 2019(r342801)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:54:08 2019(r342802)
@@ -538,7 +538,7 @@ linux_cdev_pager_populate(vm_object_t vm_obj, vm_pinde
struct vm_fault vmf;
 
/* fill out VM fault structure */
-   vmf.virtual_address = (void *)((uintptr_t)pidx << PAGE_SHIFT);
+   vmf.virtual_address = (void *)(uintptr_t)IDX_TO_OFF(pidx);
vmf.flags = (fault_type & VM_PROT_WRITE) ? FAULT_FLAG_WRITE : 0;
vmf.pgoff = 0;
vmf.page = NULL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342801 - in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys

2019-01-05 Thread Konstantin Belousov
Author: kib
Date: Sun Jan  6 00:52:53 2019
New Revision: 342801
URL: https://svnweb.freebsd.org/changeset/base/342801

Log:
  MFC r342628, r342670 (by cem):
  Fix linux_destroy_dev() behaviour when there are still files open from
  the destroying cdev.
  
  Also bump __FreeBSD_version since struct linux_cdev size on i386 increased
  (this is unmergeable r342629 on HEAD).

Modified:
  stable/12/sys/compat/linuxkpi/common/include/linux/cdev.h
  stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
  stable/12/sys/sys/param.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/cdev.h
==
--- stable/12/sys/compat/linuxkpi/common/include/linux/cdev.h   Sun Jan  6 
00:45:41 2019(r342800)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/cdev.h   Sun Jan  6 
00:52:53 2019(r342801)
@@ -52,7 +52,8 @@ struct linux_cdev {
struct cdev *cdev;
dev_t   dev;
const struct file_operations *ops;
-   atomic_long_t   refs;
+   u_int   refs;
+   u_int   siref;
 };
 
 static inline void
@@ -61,7 +62,7 @@ cdev_init(struct linux_cdev *cdev, const struct file_o
 
kobject_init(>kobj, _cdev_static_ktype);
cdev->ops = ops;
-   atomic_long_set(>refs, 0);
+   cdev->refs = 1;
 }
 
 static inline struct linux_cdev *
@@ -70,8 +71,8 @@ cdev_alloc(void)
struct linux_cdev *cdev;
 
cdev = kzalloc(sizeof(struct linux_cdev), M_WAITOK);
-   if (cdev)
-   kobject_init(>kobj, _cdev_ktype);
+   kobject_init(>kobj, _cdev_ktype);
+   cdev->refs = 1;
return (cdev);
 }
 

Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:45:41 2019(r342800)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:52:53 2019(r342801)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -100,6 +101,7 @@ MALLOC_DEFINE(M_KMALLOC, "linux", "Linux kmalloc compa
 #undef cdev
 #defineRB_ROOT(head)   (head)->rbh_root
 
+static void linux_cdev_deref(struct linux_cdev *ldev);
 static struct vm_area_struct *linux_cdev_handle_find(void *handle);
 
 struct kobject linux_class_root;
@@ -691,6 +693,52 @@ zap_vma_ptes(struct vm_area_struct *vma, unsigned long
return (0);
 }
 
+static struct file_operations dummy_ldev_ops = {
+   /* XXXKIB */
+};
+
+static struct linux_cdev dummy_ldev = {
+   .ops = _ldev_ops,
+};
+
+#defineLDEV_SI_DTR 0x0001
+#defineLDEV_SI_REF 0x0002
+
+static void
+linux_get_fop(struct linux_file *filp, const struct file_operations **fop,
+struct linux_cdev **dev)
+{
+   struct linux_cdev *ldev;
+   u_int siref;
+
+   ldev = filp->f_cdev;
+   *fop = filp->f_op;
+   if (ldev != NULL) {
+   for (siref = ldev->siref;;) {
+   if ((siref & LDEV_SI_DTR) != 0) {
+   ldev = _ldev;
+   siref = ldev->siref;
+   *fop = ldev->ops;
+   MPASS((ldev->siref & LDEV_SI_DTR) == 0);
+   } else if (atomic_fcmpset_int(>siref, ,
+   siref + LDEV_SI_REF)) {
+   break;
+   }
+   }
+   }
+   *dev = ldev;
+}
+
+static void
+linux_drop_fop(struct linux_cdev *ldev)
+{
+
+   if (ldev == NULL)
+   return;
+   MPASS((ldev->siref & ~LDEV_SI_DTR) != 0);
+   atomic_subtract_int(>siref, LDEV_SI_REF);
+}
+
 #defineOPW(fp,td,code) ({  \
struct file *__fpop;\
__typeof(code) __retval;\
@@ -703,10 +751,12 @@ zap_vma_ptes(struct vm_area_struct *vma, unsigned long
 })
 
 static int
-linux_dev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file 
*file)
+linux_dev_fdopen(struct cdev *dev, int fflags, struct thread *td,
+struct file *file)
 {
struct linux_cdev *ldev;
struct linux_file *filp;
+   const struct file_operations *fop;
int error;
 
ldev = dev->si_drv1;
@@ -718,20 +768,17 @@ linux_dev_fdopen(struct cdev *dev, int fflags, struct 
filp->f_flags = file->f_flag;
filp->f_vnode = file->f_vnode;
filp->_file = file;
+   refcount_acquire(>refs);
filp->f_cdev = ldev;
 
linux_set_current(td);
+   linux_get_fop(filp, , );
 
-   /* get a reference on the Linux character device */
-   if (atomic_long_add_unless(>refs, 1, -1L) == 0) {
-   kfree(filp);
-   return (EINVAL);
-   }
-
-   if 

svn commit: r342800 - in stable/12/sys/compat/linuxkpi/common: include/linux src

2019-01-05 Thread Konstantin Belousov
Author: kib
Date: Sun Jan  6 00:45:41 2019
New Revision: 342800
URL: https://svnweb.freebsd.org/changeset/base/342800

Log:
  MFC r342627:
  Implement zap_vma_ptes() for managed device objects.

Modified:
  stable/12/sys/compat/linuxkpi/common/include/linux/mm.h
  stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/mm.h
==
--- stable/12/sys/compat/linuxkpi/common/include/linux/mm.h Sun Jan  6 
00:44:32 2019(r342799)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/mm.h Sun Jan  6 
00:45:41 2019(r342800)
@@ -180,12 +180,8 @@ apply_to_page_range(struct mm_struct *mm, unsigned lon
return (-ENOTSUP);
 }
 
-static inline int
-zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
-unsigned long size)
-{
-   return (-ENOTSUP);
-}
+int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
+unsigned long size);
 
 static inline int
 remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,

Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:44:32 2019(r342799)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:45:41 2019(r342800)
@@ -672,6 +672,25 @@ static struct cdev_pager_ops linux_cdev_pager_ops[2] =
   },
 };
 
+int
+zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
+unsigned long size)
+{
+   vm_object_t obj;
+   vm_page_t m;
+
+   obj = vma->vm_obj;
+   if (obj == NULL || (obj->flags & OBJ_UNMANAGED) != 0)
+   return (-ENOTSUP);
+   VM_OBJECT_RLOCK(obj);
+   for (m = vm_page_find_least(obj, OFF_TO_IDX(address));
+   m != NULL && m->pindex < OFF_TO_IDX(address + size);
+   m = TAILQ_NEXT(m, listq))
+   pmap_remove_all(m);
+   VM_OBJECT_RUNLOCK(obj);
+   return (0);
+}
+
 #defineOPW(fp,td,code) ({  \
struct file *__fpop;\
__typeof(code) __retval;\
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342799 - stable/12/sys/compat/linuxkpi/common/src

2019-01-05 Thread Konstantin Belousov
Author: kib
Date: Sun Jan  6 00:44:32 2019
New Revision: 342799
URL: https://svnweb.freebsd.org/changeset/base/342799

Log:
  MFC r342625, r342631:
  Use IDX_TO_OFF().

Modified:
  stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:40:31 2019(r342798)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Sun Jan  6 
00:44:32 2019(r342799)
@@ -538,7 +538,7 @@ linux_cdev_pager_populate(vm_object_t vm_obj, vm_pinde
struct vm_fault vmf;
 
/* fill out VM fault structure */
-   vmf.virtual_address = (void *)((uintptr_t)pidx << PAGE_SHIFT);
+   vmf.virtual_address = (void *)(uintptr_t)IDX_TO_OFF(pidx);
vmf.flags = (fault_type & VM_PROT_WRITE) ? FAULT_FLAG_WRITE : 0;
vmf.pgoff = 0;
vmf.page = NULL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342797 - stable/11/sys/vm

2019-01-05 Thread Konstantin Belousov
Author: kib
Date: Sun Jan  6 00:38:28 2019
New Revision: 342797
URL: https://svnweb.freebsd.org/changeset/base/342797

Log:
  MFC r342630:
  Add 'v' modifier to the ddb 'show pginfo' command to display vm_page
  backing the provided kernel virtual address.

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

Modified: stable/11/sys/vm/vm_page.c
==
--- stable/11/sys/vm/vm_page.c  Sun Jan  6 00:37:14 2019(r342796)
+++ stable/11/sys/vm/vm_page.c  Sun Jan  6 00:38:28 2019(r342797)
@@ -3893,7 +3893,7 @@ DB_SHOW_COMMAND(pageq, vm_page_print_pageq_info)
 DB_SHOW_COMMAND(pginfo, vm_page_print_pginfo)
 {
vm_page_t m;
-   boolean_t phys;
+   boolean_t phys, virt;
 
if (!have_addr) {
db_printf("show pginfo addr\n");
@@ -3901,7 +3901,10 @@ DB_SHOW_COMMAND(pginfo, vm_page_print_pginfo)
}
 
phys = strchr(modif, 'p') != NULL;
-   if (phys)
+   virt = strchr(modif, 'v') != NULL;
+   if (virt)
+   m = PHYS_TO_VM_PAGE(pmap_kextract(addr));
+   else if (phys)
m = PHYS_TO_VM_PAGE(addr);
else
m = (vm_page_t)addr;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342798 - stable/12/sys/i386/i386

2019-01-05 Thread Konstantin Belousov
Author: kib
Date: Sun Jan  6 00:40:31 2019
New Revision: 342798
URL: https://svnweb.freebsd.org/changeset/base/342798

Log:
  MFC r342739:
  Fix typo in r342710.

Modified:
  stable/12/sys/i386/i386/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/i386/i386/pmap.c
==
--- stable/12/sys/i386/i386/pmap.c  Sun Jan  6 00:38:28 2019
(r342797)
+++ stable/12/sys/i386/i386/pmap.c  Sun Jan  6 00:40:31 2019
(r342798)
@@ -569,7 +569,7 @@ pmap_cold(void)
 /*
  * Bootstrap the system enough to run with virtual memory.
  *
- * On the i386 this is called after pmap_cold() created intial
+ * On the i386 this is called after pmap_cold() created initial
  * kernel page table and enabled paging, and just syncs the pmap
  * module with what has already been done.
  */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342796 - stable/12/sys/vm

2019-01-05 Thread Konstantin Belousov
Author: kib
Date: Sun Jan  6 00:37:14 2019
New Revision: 342796
URL: https://svnweb.freebsd.org/changeset/base/342796

Log:
  MFC r342630:
  Add 'v' modifier to the ddb 'show pginfo' command to display vm_page
  backing the provided kernel virtual address.

Modified:
  stable/12/sys/vm/vm_page.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/vm_page.c
==
--- stable/12/sys/vm/vm_page.c  Sun Jan  6 00:34:43 2019(r342795)
+++ stable/12/sys/vm/vm_page.c  Sun Jan  6 00:37:14 2019(r342796)
@@ -4493,7 +4493,7 @@ DB_SHOW_COMMAND(pageq, vm_page_print_pageq_info)
 DB_SHOW_COMMAND(pginfo, vm_page_print_pginfo)
 {
vm_page_t m;
-   boolean_t phys;
+   boolean_t phys, virt;
 
if (!have_addr) {
db_printf("show pginfo addr\n");
@@ -4501,7 +4501,10 @@ DB_SHOW_COMMAND(pginfo, vm_page_print_pginfo)
}
 
phys = strchr(modif, 'p') != NULL;
-   if (phys)
+   virt = strchr(modif, 'v') != NULL;
+   if (virt)
+   m = PHYS_TO_VM_PAGE(pmap_kextract(addr));
+   else if (phys)
m = PHYS_TO_VM_PAGE(addr);
else
m = (vm_page_t)addr;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342795 - stable/12/sys/net

2019-01-05 Thread Konstantin Belousov
Author: kib
Date: Sun Jan  6 00:34:43 2019
New Revision: 342795
URL: https://svnweb.freebsd.org/changeset/base/342795

Log:
  MFC r342711:
  Fix typo, use boolean operator instead of bit-wise.

Modified:
  stable/12/sys/net/iflib.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/iflib.c
==
--- stable/12/sys/net/iflib.c   Sun Jan  6 00:32:14 2019(r342794)
+++ stable/12/sys/net/iflib.c   Sun Jan  6 00:34:43 2019(r342795)
@@ -1640,7 +1640,7 @@ iflib_txsd_alloc(iflib_txq_t txq)
(uintmax_t)sctx->isc_tx_maxsize, nsegments, 
(uintmax_t)sctx->isc_tx_maxsegsize);
goto fail;
}
-   if ((if_getcapabilities(ctx->ifc_ifp) & IFCAP_TSO) &
+   if ((if_getcapabilities(ctx->ifc_ifp) & IFCAP_TSO) &&
(err = bus_dma_tag_create(bus_get_dma_tag(dev),
   1, 0,/* alignment, bounds */
   BUS_SPACE_MAXADDR,   /* lowaddr */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342794 - in stable: 10/contrib/ipfilter 11/contrib/ipfilter 12/contrib/ipfilter

2019-01-05 Thread Cy Schubert
Author: cy
Date: Sun Jan  6 00:32:14 2019
New Revision: 342794
URL: https://svnweb.freebsd.org/changeset/base/342794

Log:
  MFC r342605:
  
  TCP_PAWS_IDLE is does not exist in NetBSD and illumos. In FreeBSD
  TCP_PAWS_IDLE is defined in netinet/tcp_seq.h, however this header
  isn't included explicitly or implicitly at this point therefore
  as far ipfilter is concerned TCP_PAWS_IDLE is not defined. Remove
  the #ifdef and include netinet/tcp.h unconditionally.

Modified:
  stable/12/contrib/ipfilter/ipf.h
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/ipfilter/ipf.h
  stable/11/contrib/ipfilter/ipf.h
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)

Modified: stable/12/contrib/ipfilter/ipf.h
==
--- stable/12/contrib/ipfilter/ipf.hSat Jan  5 22:45:20 2019
(r342793)
+++ stable/12/contrib/ipfilter/ipf.hSun Jan  6 00:32:14 2019
(r342794)
@@ -47,9 +47,7 @@ struct file;
 #include 
 #include 
 #include 
-#ifndefTCP_PAWS_IDLE   /* IRIX */
 # include 
-#endif
 #include 
 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342794 - in stable: 10/contrib/ipfilter 11/contrib/ipfilter 12/contrib/ipfilter

2019-01-05 Thread Cy Schubert
Author: cy
Date: Sun Jan  6 00:32:14 2019
New Revision: 342794
URL: https://svnweb.freebsd.org/changeset/base/342794

Log:
  MFC r342605:
  
  TCP_PAWS_IDLE is does not exist in NetBSD and illumos. In FreeBSD
  TCP_PAWS_IDLE is defined in netinet/tcp_seq.h, however this header
  isn't included explicitly or implicitly at this point therefore
  as far ipfilter is concerned TCP_PAWS_IDLE is not defined. Remove
  the #ifdef and include netinet/tcp.h unconditionally.

Modified:
  stable/10/contrib/ipfilter/ipf.h
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/ipfilter/ipf.h
  stable/12/contrib/ipfilter/ipf.h
Directory Properties:
  stable/11/   (props changed)
  stable/12/   (props changed)

Modified: stable/10/contrib/ipfilter/ipf.h
==
--- stable/10/contrib/ipfilter/ipf.hSat Jan  5 22:45:20 2019
(r342793)
+++ stable/10/contrib/ipfilter/ipf.hSun Jan  6 00:32:14 2019
(r342794)
@@ -49,9 +49,7 @@ struct file;
 #include 
 #include 
 #include 
-#ifndefTCP_PAWS_IDLE   /* IRIX */
 # include 
-#endif
 #include 
 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342794 - in stable: 10/contrib/ipfilter 11/contrib/ipfilter 12/contrib/ipfilter

2019-01-05 Thread Cy Schubert
Author: cy
Date: Sun Jan  6 00:32:14 2019
New Revision: 342794
URL: https://svnweb.freebsd.org/changeset/base/342794

Log:
  MFC r342605:
  
  TCP_PAWS_IDLE is does not exist in NetBSD and illumos. In FreeBSD
  TCP_PAWS_IDLE is defined in netinet/tcp_seq.h, however this header
  isn't included explicitly or implicitly at this point therefore
  as far ipfilter is concerned TCP_PAWS_IDLE is not defined. Remove
  the #ifdef and include netinet/tcp.h unconditionally.

Modified:
  stable/11/contrib/ipfilter/ipf.h
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/ipfilter/ipf.h
  stable/12/contrib/ipfilter/ipf.h
Directory Properties:
  stable/10/   (props changed)
  stable/12/   (props changed)

Modified: stable/11/contrib/ipfilter/ipf.h
==
--- stable/11/contrib/ipfilter/ipf.hSat Jan  5 22:45:20 2019
(r342793)
+++ stable/11/contrib/ipfilter/ipf.hSun Jan  6 00:32:14 2019
(r342794)
@@ -47,9 +47,7 @@ struct file;
 #include 
 #include 
 #include 
-#ifndefTCP_PAWS_IDLE   /* IRIX */
 # include 
-#endif
 #include 
 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342793 - in head: . share/mk stand/efi/boot1 stand/efi/libefi stand/efi/loader stand/i386 stand/i386/loader stand/libsa stand/sparc64 stand/sparc64/loader stand/userboot/userboot tools...

2019-01-05 Thread Matt Macy
Author: mmacy
Date: Sat Jan  5 22:45:20 2019
New Revision: 342793
URL: https://svnweb.freebsd.org/changeset/base/342793

Log:
  MK_ZFS -> {MK_ZFS|MK_LOADER_ZFS}, this is so we can diable userland / kernel
  ZFS but keep the boot-loaders when using ZoL port.
  
  MFC after: 1 week
  Reviewed by: rgrimes
  Differential Revision: https://reviews.freebsd.org/D18739

Added:
  head/tools/build/options/WITHOUT_LOADER_ZFS   (contents, props changed)
Modified:
  head/.gitattributes
  head/share/mk/src.opts.mk
  head/stand/efi/boot1/Makefile
  head/stand/efi/libefi/Makefile
  head/stand/efi/loader/Makefile
  head/stand/i386/Makefile
  head/stand/i386/loader/Makefile
  head/stand/libsa/Makefile
  head/stand/sparc64/Makefile
  head/stand/sparc64/loader/Makefile
  head/stand/userboot/userboot/Makefile
  head/tools/build/options/WITHOUT_ZFS

Modified: head/.gitattributes
==
--- head/.gitattributes Sat Jan  5 21:23:25 2019(r342792)
+++ head/.gitattributes Sat Jan  5 22:45:20 2019(r342793)
@@ -3,3 +3,4 @@
 *.cpp  diff=cpp
 *.hpp  diff=cpp
 *.py   diff=python
+. svn-properties=svn:keywords=tools/build/options/WITHOUT_LOADER_ZFS

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Sat Jan  5 21:23:25 2019(r342792)
+++ head/share/mk/src.opts.mk   Sat Jan  5 22:45:20 2019(r342793)
@@ -191,6 +191,7 @@ __DEFAULT_YES_OPTIONS = \
 WIRELESS \
 WPA_SUPPLICANT_EAPOL \
 ZFS \
+LOADER_ZFS \
 ZONEINFO
 
 __DEFAULT_NO_OPTIONS = \
@@ -451,6 +452,7 @@ MK_SOURCELESS_UCODE:= no
 
 .if ${MK_CDDL} == "no"
 MK_ZFS:=   no
+MK_LOADER_ZFS:=no
 MK_CTF:=   no
 .endif
 

Modified: head/stand/efi/boot1/Makefile
==
--- head/stand/efi/boot1/Makefile   Sat Jan  5 21:23:25 2019
(r342792)
+++ head/stand/efi/boot1/Makefile   Sat Jan  5 22:45:20 2019
(r342793)
@@ -25,7 +25,7 @@ CWARNFLAGS.zfs_module.c += -Wno-unused-function
 
 # architecture-specific loader code
 SRCS=  boot1.c self_reloc.c start.S ufs_module.c
-.if ${MK_ZFS} != "no"
+.if ${MK_LOADER_ZFS} != "no"
 SRCS+= zfs_module.c
 CFLAGS.zfs_module.c+=  -I${ZFSSRC}
 CFLAGS.zfs_module.c+=  -I${SYSDIR}/cddl/boot/zfs

Modified: head/stand/efi/libefi/Makefile
==
--- head/stand/efi/libefi/Makefile  Sat Jan  5 21:23:25 2019
(r342792)
+++ head/stand/efi/libefi/Makefile  Sat Jan  5 22:45:20 2019
(r342793)
@@ -44,7 +44,7 @@ CFLAGS+= -fPIC -mno-red-zone
 .endif
 CFLAGS+= -I${EFIINC}
 CFLAGS+= -I${EFIINCMD}
-.if ${MK_ZFS} != "no"
+.if ${MK_LOADER_ZFS} != "no"
 CFLAGS+=   -I${ZFSSRC}
 CFLAGS+=   -DEFI_ZFS_BOOT
 .endif

Modified: head/stand/efi/loader/Makefile
==
--- head/stand/efi/loader/Makefile  Sat Jan  5 21:23:25 2019
(r342792)
+++ head/stand/efi/loader/Makefile  Sat Jan  5 22:45:20 2019
(r342793)
@@ -26,7 +26,7 @@ SRCS= autoload.c \
vers.c
 
 CFLAGS+=   -I${.CURDIR}/../loader
-.if ${MK_ZFS} != "no"
+.if ${MK_LOADER_ZFS} != "no"
 CFLAGS+=   -I${ZFSSRC}
 CFLAGS+=   -DEFI_ZFS_BOOT
 HAVE_ZFS=  yes

Modified: head/stand/i386/Makefile
==
--- head/stand/i386/MakefileSat Jan  5 21:23:25 2019(r342792)
+++ head/stand/i386/MakefileSat Jan  5 22:45:20 2019(r342793)
@@ -20,6 +20,6 @@ SUBDIR.yes+=  pxeldr
 SUBDIR.yes+=   kgzldr
 .endif
 
-SUBDIR.${MK_ZFS}+= zfsboot gptzfsboot
+SUBDIR.${MK_LOADER_ZFS}+=  zfsboot gptzfsboot
 
 .include 

Modified: head/stand/i386/loader/Makefile
==
--- head/stand/i386/loader/Makefile Sat Jan  5 21:23:25 2019
(r342792)
+++ head/stand/i386/loader/Makefile Sat Jan  5 22:45:20 2019
(r342793)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-HAVE_ZFS=  ${MK_ZFS}
+HAVE_ZFS=  ${MK_LOADER_ZFS}
 
 LOADER_NET_SUPPORT?=   yes
 LOADER_NFS_SUPPORT?=   yes
@@ -64,7 +64,7 @@ ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
 ${LOADER}.bin: ${LOADER}.sym
strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC}
 
-.if ${MK_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
+.if ${MK_LOADER_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
 LINKS+=${BINDIR}/${LOADER} ${BINDIR}/zfsloader
 .endif
 .if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}

Modified: head/stand/libsa/Makefile
==
--- head/stand/libsa/Makefile   Sat Jan  5 21:23:25 2019(r342792)
+++ head/stand/libsa/Makefile   Sat Jan  5 22:45:20 2019

svn commit: r342792 - in head: libexec/rc share/man/man8

2019-01-05 Thread Kyle Evans
Author: kevans
Date: Sat Jan  5 21:23:25 2019
New Revision: 342792
URL: https://svnweb.freebsd.org/changeset/base/342792

Log:
  rc.subr: Provide rc_service variable for service scripts
  
  Some rc scripts in ports (e.g. uwsgi, apache, openvpn) allow for
  'application profiles' that usually require the rc script to be invoked
  again for each active profile. Because there's no consistent way to
  determine the path because it differs between manual/service(8) invocations
  and /etc/rc invocations, this leads to patterns like these:
  
  - www/uwsgi hardcodes the script path
  - security/openvpn guesses either $_file or $0 based on $0 = /etc/rc
  
  Instead of forcing rc scripts to guess, provide an rc_service variable to
  the scripts that gets set appropriately both for direct execution or when a
  script is being executed via run_rc_script (e.g. /etc/rc).
  
  This is our analog of an OpenRC variable with the same name, different case
  (RC_SERVICE).
  
  PR:   234614
  Reported by:  koobs
  Reviewed by:  dteske, jilles
  MFC after:3 days

Modified:
  head/libexec/rc/rc.subr
  head/share/man/man8/rc.subr.8

Modified: head/libexec/rc/rc.subr
==
--- head/libexec/rc/rc.subr Sat Jan  5 21:07:49 2019(r342791)
+++ head/libexec/rc/rc.subr Sat Jan  5 21:23:25 2019(r342792)
@@ -52,6 +52,14 @@ ID="/usr/bin/id"
 IDCMD="if [ -x $ID ]; then $ID -un; fi"
 PS="/bin/ps -ww"
 JID=0
+# rc_service provides the path to the service script that we are executing.
+# This is not being set here in an execution context, necessarily, so it's
+# really just a reasonable guess, and it will get overwritten later if
+# we are executing from some other means than direct execution by service(8)
+# or manual invocation of the service script.  The prime example of this is
+# during system startup, all rc scripts will be invoked via /etc/rc, so
+# run_rc_script will overwrite rc_service with the file being sourced.
+rc_service="$0"
 
 #
 #  functions
@@ -879,6 +887,9 @@ check_startmsgs()
 #  by $flags from the environment.
 #  This variable may be changed by the precmd method.
 #
+#   rc_service  Path to the service being executed, in case it needs to
+#   re-invoked.
+#
 #  rc_pid  PID of command (if appropriate)
 #
 #  rc_fast Not empty if "fast" was provided (q.v.)
@@ -1382,6 +1393,7 @@ run_rc_script()
required_vars
eval unset ${_arg}_cmd ${_arg}_precmd ${_arg}_postcmd
 
+   rc_service="$_file"
case "$_file" in
/etc/rc.d/*.sh) # no longer allowed in the base
warn "Ignoring old-style startup script $_file"

Modified: head/share/man/man8/rc.subr.8
==
--- head/share/man/man8/rc.subr.8   Sat Jan  5 21:07:49 2019
(r342791)
+++ head/share/man/man8/rc.subr.8   Sat Jan  5 21:23:25 2019
(r342792)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 7, 2018
+.Dd January 5, 2019
 .Dt RC.SUBR 8
 .Os
 .Sh NAME
@@ -771,7 +771,7 @@ The following variables are available to the methods
 as well as after
 .Ic run_rc_command
 has completed:
-.Bl -tag -width ".Va rc_flags" -offset indent
+.Bl -tag -width ".Va rc_service" -offset indent
 .It Va rc_arg
 Argument provided to
 .Ic run_rc_command ,
@@ -785,6 +785,8 @@ unless overridden by the environment variable
 This variable may be changed by the
 .Ar argument Ns Va _precmd
 method.
+.It Va rc_service
+Path to the service script being executed, in case it needs to re-invoke 
itself.
 .It Va rc_pid
 PID of
 .Va command
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342791 - head/sys/sys

2019-01-05 Thread Joerg Wunsch
Author: joerg
Date: Sat Jan  5 21:07:49 2019
New Revision: 342791
URL: https://svnweb.freebsd.org/changeset/base/342791

Log:
  Fix an old typo in the element status display bits:
  
  INEAB -> INENAB (import is eNabled)
  
  Note that this kernel definition is exported into chio(1), and used
  for element display there.
  
  MFC after:1 week

Modified:
  head/sys/sys/chio.h

Modified: head/sys/sys/chio.h
==
--- head/sys/sys/chio.h Sat Jan  5 19:35:10 2019(r342790)
+++ head/sys/sys/chio.h Sat Jan  5 21:07:49 2019(r342791)
@@ -266,7 +266,7 @@ struct changer_set_voltag_request {
 
 
 #defineCESTATUS_BITS   \
-   "\20\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
+   "\20\6INENAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
 
 #defineCHIOMOVE_IOW('c', 0x01, struct changer_move)
 #defineCHIOEXCHANGE_IOW('c', 0x02, struct changer_exchange)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r342774 - head/sys/conf

2019-01-05 Thread Enji Cooper

> On Jan 4, 2019, at 10:38, Andrew Gallatin  wrote:
> 
> Author: gallatin
> Date: Fri Jan  4 18:38:27 2019
> New Revision: 342774
> URL: https://svnweb.freebsd.org/changeset/base/342774
> 
> Log:
>  Limit git history searches in newvers.sh
> 
>  newvers.sh takes upwards of 4-5 seconds to complete on trees checked
>  out from github, due to searching the entire history for non-existent
>  git-svn metadata. Similarly, if one does not check out notes, we
>  again search the entire history for notes. That makes newvers.sh very
>  slow for many github users.
> 
>  To fix this in a fair way, limit the history search to the last 10K
>  commits: if you're more than 10K commits out of sync, then you've
>  forked the project, and our SVN rev is no longer very important to you.
> 
>  Due to how git implements --grep in conjunction with -n, --grep has been
>  removed for performance reasons (git does not seem to limit its search
>  to the -n limit in this case, and takes just as long as it did with no
>  limit).

Wonderful — thank you Andrew :)!!
-Enji
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342790 - stable/10/sys/dev/e1000

2019-01-05 Thread Marius Strobl
Author: marius
Date: Sat Jan  5 19:35:10 2019
New Revision: 342790
URL: https://svnweb.freebsd.org/changeset/base/342790

Log:
  MFC: r336610 (partial), r339207, r339267
  
  - Or in the DMA coalescing Rx threshold so the other bits set in E1000_DMACR
remain intact as intended in igb_init_dmac(). [1]
  
  - Fix igb corrupting checksums with BPF and VLAN
In stable/11, this merely syncs the code with head as the problem was
introduced with r311849 in the latter and then fixed by r339207 with
a different approach than the code used pre-r311849 and in stable/11.
  
  - Use mbuf defines to construct csum offload masks rather than literals
  
  MF11: r340148
  
  Don't use 9k jumbo clusters
  
  Reported by:  Coverity
  CID:  1304929 [1]

Modified:
  stable/10/sys/dev/e1000/if_em.c
  stable/10/sys/dev/e1000/if_igb.c
  stable/10/sys/dev/e1000/if_lem.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/e1000/if_em.c
==
--- stable/10/sys/dev/e1000/if_em.c Sat Jan  5 19:32:48 2019
(r342789)
+++ stable/10/sys/dev/e1000/if_em.c Sat Jan  5 19:35:10 2019
(r342790)
@@ -1435,10 +1435,15 @@ em_init_locked(struct adapter *adapter)
*/
if (adapter->hw.mac.max_frame_size <= 2048)
adapter->rx_mbuf_sz = MCLBYTES;
+#ifndef CONTIGMALLOC_WORKS
+   else
+   adapter->rx_mbuf_sz = MJUMPAGESIZE;
+#else
else if (adapter->hw.mac.max_frame_size <= 4096)
adapter->rx_mbuf_sz = MJUMPAGESIZE;
else
adapter->rx_mbuf_sz = MJUM9BYTES;
+#endif
 
/* Prepare receive descriptors and buffers */
if (em_setup_receive_structures(adapter)) {

Modified: stable/10/sys/dev/e1000/if_igb.c
==
--- stable/10/sys/dev/e1000/if_igb.cSat Jan  5 19:32:48 2019
(r342789)
+++ stable/10/sys/dev/e1000/if_igb.cSat Jan  5 19:35:10 2019
(r342790)
@@ -1309,10 +1309,15 @@ igb_init_locked(struct adapter *adapter)
*/
if (adapter->max_frame_size <= 2048)
adapter->rx_mbuf_sz = MCLBYTES;
+#ifndef CONTIGMALLOC_WORKS
+   else
+   adapter->rx_mbuf_sz = MJUMPAGESIZE;
+#else
else if (adapter->max_frame_size <= 4096)
adapter->rx_mbuf_sz = MJUMPAGESIZE;
else
adapter->rx_mbuf_sz = MJUM9BYTES;
+#endif
 
/* Prepare receive descriptors and buffers */
if (igb_setup_receive_structures(adapter)) {
@@ -2857,7 +2862,7 @@ igb_init_dmac(struct adapter *adapter, u32 pba)
dmac = pba - 10;
reg = E1000_READ_REG(hw, E1000_DMACR);
reg &= ~E1000_DMACR_DMACTHR_MASK;
-   reg = ((dmac << E1000_DMACR_DMACTHR_SHIFT)
+   reg |= ((dmac << E1000_DMACR_DMACTHR_SHIFT)
& E1000_DMACR_DMACTHR_MASK);
 
/* transition to L0x or L1 if available..*/
@@ -3807,7 +3812,6 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
int ehdrlen, ip_hlen = 0;
u16 etype;
u8  ipproto = 0;
-   int offload = TRUE;
int ctxd = txr->next_avail_desc;
u16 vtag = 0;
 
@@ -3815,9 +3819,6 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
if (mp->m_pkthdr.csum_flags & CSUM_TSO)
return (igb_tso_setup(txr, mp, cmd_type_len, olinfo_status));
 
-   if ((mp->m_pkthdr.csum_flags & CSUM_OFFLOAD) == 0)
-   offload = FALSE;
-
/* Indicate the whole packet as payload when not doing TSO */
*olinfo_status |= mp->m_pkthdr.len << E1000_ADVTXD_PAYLEN_SHIFT;
 
@@ -3832,8 +3833,9 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
if (mp->m_flags & M_VLANTAG) {
vtag = htole16(mp->m_pkthdr.ether_vtag);
vlan_macip_lens |= (vtag << E1000_ADVTXD_VLAN_SHIFT);
-   } else if (offload == FALSE) /* ... no offload to do */
+   } else if ((mp->m_pkthdr.csum_flags & CSUM_OFFLOAD) == 0) {
return (0);
+   }
 
/*
 * Determine where frame payload starts.
@@ -3867,7 +3869,6 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_IPV6;
break;
default:
-   offload = FALSE;
break;
}
 
@@ -3877,38 +3878,40 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
switch (ipproto) {
case IPPROTO_TCP:
 #if __FreeBSD_version >= 100
-   if (mp->m_pkthdr.csum_flags & (CSUM_IP_TCP | 
CSUM_IP6_TCP))
+   if (mp->m_pkthdr.csum_flags & (CSUM_IP_TCP | 
CSUM_IP6_TCP)) {
 #else
-   if (mp->m_pkthdr.csum_flags & CSUM_TCP)
+   if 

svn commit: r342789 - stable/11/sys/dev/e1000

2019-01-05 Thread Marius Strobl
Author: marius
Date: Sat Jan  5 19:32:48 2019
New Revision: 342789
URL: https://svnweb.freebsd.org/changeset/base/342789

Log:
  MFC: r336610 (partial), r339207, r339267
  
  - Or in the DMA coalescing Rx threshold so the other bits set in E1000_DMACR
remain intact as intended in igb_init_dmac(). [1]
  
  - Fix igb corrupting checksums with BPF and VLAN
In stable/11, this merely syncs the code with head as the problem was
introduced with r311849 in the latter and then fixed by r339207 with
a different approach than the code used pre-r311849 and in stable/11.
  
  - Use mbuf defines to construct csum offload masks rather than literals
  
  Reported by:  Coverity
  CID:  1304929 [1]

Modified:
  stable/11/sys/dev/e1000/if_em.h
  stable/11/sys/dev/e1000/if_igb.c
  stable/11/sys/dev/e1000/if_lem.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/e1000/if_em.h
==
--- stable/11/sys/dev/e1000/if_em.h Sat Jan  5 16:05:39 2019
(r342788)
+++ stable/11/sys/dev/e1000/if_em.h Sat Jan  5 19:32:48 2019
(r342789)
@@ -277,7 +277,7 @@
 #define EM_MSIX_LINK   0x0100 /* For 82574 use */
 #define ETH_ZLEN   60
 #define ETH_ADDR_LEN   6
-#define CSUM_OFFLOAD   7   /* Offload bits in mbuf flag */
+#define CSUM_OFFLOAD   (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP) /* 
Offload bits in mbuf flag */
 
 /*
  * 82574 has a nonstandard address for EIAC

Modified: stable/11/sys/dev/e1000/if_igb.c
==
--- stable/11/sys/dev/e1000/if_igb.cSat Jan  5 16:05:39 2019
(r342788)
+++ stable/11/sys/dev/e1000/if_igb.cSat Jan  5 19:32:48 2019
(r342789)
@@ -2957,7 +2957,7 @@ igb_init_dmac(struct adapter *adapter, u32 pba)
dmac = pba - 10;
reg = E1000_READ_REG(hw, E1000_DMACR);
reg &= ~E1000_DMACR_DMACTHR_MASK;
-   reg = ((dmac << E1000_DMACR_DMACTHR_SHIFT)
+   reg |= ((dmac << E1000_DMACR_DMACTHR_SHIFT)
& E1000_DMACR_DMACTHR_MASK);
 
/* transition to L0x or L1 if available..*/
@@ -3908,7 +3908,6 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
int ehdrlen, ip_hlen = 0;
u16 etype;
u8  ipproto = 0;
-   int offload = TRUE;
int ctxd = txr->next_avail_desc;
u16 vtag = 0;
 
@@ -3916,9 +3915,6 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
if (mp->m_pkthdr.csum_flags & CSUM_TSO)
return (igb_tso_setup(txr, mp, cmd_type_len, olinfo_status));
 
-   if ((mp->m_pkthdr.csum_flags & CSUM_OFFLOAD) == 0)
-   offload = FALSE;
-
/* Indicate the whole packet as payload when not doing TSO */
*olinfo_status |= mp->m_pkthdr.len << E1000_ADVTXD_PAYLEN_SHIFT;
 
@@ -3933,8 +3929,9 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
if (mp->m_flags & M_VLANTAG) {
vtag = htole16(mp->m_pkthdr.ether_vtag);
vlan_macip_lens |= (vtag << E1000_ADVTXD_VLAN_SHIFT);
-   } else if (offload == FALSE) /* ... no offload to do */
+   } else if ((mp->m_pkthdr.csum_flags & CSUM_OFFLOAD) == 0) {
return (0);
+   }
 
/*
 * Determine where frame payload starts.
@@ -3968,7 +3965,6 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_IPV6;
break;
default:
-   offload = FALSE;
break;
}
 
@@ -3978,38 +3974,40 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
switch (ipproto) {
case IPPROTO_TCP:
 #if __FreeBSD_version >= 100
-   if (mp->m_pkthdr.csum_flags & (CSUM_IP_TCP | 
CSUM_IP6_TCP))
+   if (mp->m_pkthdr.csum_flags & (CSUM_IP_TCP | 
CSUM_IP6_TCP)) {
 #else
-   if (mp->m_pkthdr.csum_flags & CSUM_TCP)
+   if (mp->m_pkthdr.csum_flags & CSUM_TCP) {
 #endif
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP;
+   *olinfo_status |= E1000_TXD_POPTS_TXSM << 8;
+   }
break;
case IPPROTO_UDP:
 #if __FreeBSD_version >= 100
-   if (mp->m_pkthdr.csum_flags & (CSUM_IP_UDP | 
CSUM_IP6_UDP))
+   if (mp->m_pkthdr.csum_flags & (CSUM_IP_UDP | 
CSUM_IP6_UDP)) {
 #else
-   if (mp->m_pkthdr.csum_flags & CSUM_UDP)
+   if (mp->m_pkthdr.csum_flags & CSUM_UDP) {
 #endif
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_UDP;
+   *olinfo_status |= 

svn commit: r342788 - in head: sbin/rtsol usr.sbin/rtsold

2019-01-05 Thread Mark Johnston
Author: markj
Date: Sat Jan  5 16:05:39 2019
New Revision: 342788
URL: https://svnweb.freebsd.org/changeset/base/342788

Log:
  Capsicumize rtsol(8) and rtsold(8).
  
  These programs parse ND6 Router Advertisement messages; rtsold(8) has
  required an SA, SA-14:20.rtsold, for a bug in this code.  Thus, they
  are good candidates for sandboxing.
  
  The approach taken is to run the main executable in capability mode
  and use Casper services to provide functionality that cannot be
  implemented within the sandbox.  In particular, several custom services
  were required.
  
  - A Casper service is used to send Router Solicitation messages on a
raw ICMP6 socket.  Initially I took the approach of creating a
socket for each interface upon startup, and connect(2)ing it to
the all-routers multicast group for the interface.  This permits
the use of sendmsg(2) in capability mode, but only works if the
interface's link is up when rtsol(d) starts.  So, instead, the
rtsold.sendmsg service is used to transmit RS messages on behalf
of the main process.  One could alternately define a service
which simply creates and connects a socket for each destination
address, and returns the socket to the sandboxed process.  However,
to implement rtsold's -m option we also need to read the ND6 default
router list, and this cannot be done in capability mode.
  - rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
options in received RA messages.  A Casper service is used to
fork and exec resolvconf(8), and to reap the child process.
  - A service is used to determine whether a given interface's
link-local address is useable (i.e., not duplicated or undergoing
DAD).  This information is supplied by getifaddrs(3), which reads
a sysctl not available in capability mode.  The SIOCGIFCONF socket
ioctl provides equivalent information and can be used in capability
mode, but I decided against it for now because of some limitations
of that interface.
  
  In addition to these new services, cap_syslog(3) is used to send
  messages to syslogd.
  
  Reviewed by:  oshogbo
  Tested by:bz (previous versions)
  MFC after:2 months
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D17572

Added:
  head/usr.sbin/rtsold/cap_llflags.c   (contents, props changed)
  head/usr.sbin/rtsold/cap_script.c   (contents, props changed)
  head/usr.sbin/rtsold/cap_sendmsg.c   (contents, props changed)
Deleted:
  head/usr.sbin/rtsold/probe.c
Modified:
  head/sbin/rtsol/Makefile
  head/usr.sbin/rtsold/Makefile
  head/usr.sbin/rtsold/dump.c
  head/usr.sbin/rtsold/if.c
  head/usr.sbin/rtsold/rtsock.c
  head/usr.sbin/rtsold/rtsol.c
  head/usr.sbin/rtsold/rtsold.c
  head/usr.sbin/rtsold/rtsold.h

Modified: head/sbin/rtsol/Makefile
==
--- head/sbin/rtsol/MakefileSat Jan  5 15:28:20 2019(r342787)
+++ head/sbin/rtsol/MakefileSat Jan  5 16:05:39 2019(r342788)
@@ -18,10 +18,24 @@
 
 PACKAGE=runtime
 PROG=  rtsol
-SRCS=  rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
+SRCS=  cap_llflags.c \
+   cap_script.c \
+   cap_sendmsg.c \
+   dump.c \
+   if.c \
+   rtsol.c \
+   rtsold.c \
+   rtsock.c
 MAN=
+LIBADD=util
 
-WARNS?=3
-CFLAGS+= -DSMALL
+.include 
+
+.if ${MK_DYNAMICROOT} == "no"
+.warning ${PROG} built without libcasper support
+.elif ${MK_CASPER} != "no" && !defined(RESCUE)
+CFLAGS+= -DWITH_CASPER
+LIBADD+= cap_syslog casper nv
+.endif
 
 .include 

Modified: head/usr.sbin/rtsold/Makefile
==
--- head/usr.sbin/rtsold/Makefile   Sat Jan  5 15:28:20 2019
(r342787)
+++ head/usr.sbin/rtsold/Makefile   Sat Jan  5 16:05:39 2019
(r342788)
@@ -17,8 +17,22 @@
 PROG=  rtsold
 MAN=   rtsold.8
 MLINKS=rtsold.8 rtsol.8
-SRCS=  rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
+SRCS=  cap_llflags.c \
+   cap_script.c \
+   cap_sendmsg.c \
+   dump.c \
+   if.c \
+   rtsock.c \
+   rtsol.c \
+   rtsold.c
 
-WARNS?=3
+LIBADD= util
+
+.include 
+
+.if ${MK_CASPER} != "no"
+CFLAGS+= -DWITH_CASPER
+LIBADD+= casper cap_syslog nv
+.endif
 
 .include 

Added: head/usr.sbin/rtsold/cap_llflags.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/rtsold/cap_llflags.c  Sat Jan  5 16:05:39 2019
(r342788)
@@ -0,0 +1,157 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2018 The FreeBSD Foundation
+ *
+ * This software was developed by Mark Johnston under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following 

svn commit: r342787 - head/sys/dev/tws

2019-01-05 Thread Mark Johnston
Author: markj
Date: Sat Jan  5 15:28:20 2019
New Revision: 342787
URL: https://svnweb.freebsd.org/changeset/base/342787

Log:
  Add a bounds check to the tws(4) passthrough ioctl handler.
  
  tws_passthru() was doing a copyin of a user-specified request
  without validating its length, so a malicious request could overrun
  the buffer.  By default, the tws(4) device file is only accessible
  as root.
  
  admbug:   825
  Reported by:  Anonymous of the Shellphish Grill Team
  Reviewed by:  delphij
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D18536

Modified:
  head/sys/dev/tws/tws_user.c

Modified: head/sys/dev/tws/tws_user.c
==
--- head/sys/dev/tws/tws_user.c Sat Jan  5 15:09:50 2019(r342786)
+++ head/sys/dev/tws/tws_user.c Sat Jan  5 15:28:20 2019(r342787)
@@ -92,9 +92,13 @@ tws_passthru(struct tws_softc *sc, void *buf)
 struct tws_request *req;
 struct tws_ioctl_no_data_buf *ubuf = (struct tws_ioctl_no_data_buf *)buf;
 int error;
+u_int32_t buffer_length;
 u_int16_t lun4;
 
-
+buffer_length = roundup2(ubuf->driver_pkt.buffer_length, 512);
+if ( buffer_length > TWS_MAX_IO_SIZE ) {
+return(EINVAL);
+}
 if ( tws_get_state(sc) != TWS_ONLINE) {
 return(EBUSY);
 }
@@ -118,7 +122,7 @@ tws_passthru(struct tws_softc *sc, void *buf)
 }
 } while(1);
 
-req->length = (ubuf->driver_pkt.buffer_length + 511) & ~511;
+req->length = buffer_length;
 TWS_TRACE_DEBUG(sc, "datal,rid", req->length, req->request_id);
 if ( req->length ) {
 req->data = sc->ioctl_data_mem;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342786 - stable/12/share/man/man3

2019-01-05 Thread Mark Johnston
Author: markj
Date: Sat Jan  5 15:09:50 2019
New Revision: 342786
URL: https://svnweb.freebsd.org/changeset/base/342786

Log:
  MFC r342688:
  Typo.

Modified:
  stable/12/share/man/man3/timeradd.3
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man3/timeradd.3
==
--- stable/12/share/man/man3/timeradd.3 Sat Jan  5 07:20:00 2019
(r342785)
+++ stable/12/share/man/man3/timeradd.3 Sat Jan  5 15:09:50 2019
(r342786)
@@ -94,7 +94,7 @@ structure is defined in
 as:
 .Bd -literal
 struct timespec {
-   time_t tv_nsec; /* seconds */
+   time_t tv_sec;  /* seconds */
long   tv_nsec; /* and nanoseconds */
 };
 .Ed
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"