From owner-svn-src-stable-11@freebsd.org Mon Jul 2 07:58:58 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98881FE5CD7; Mon, 2 Jul 2018 07:58:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48AB879512; Mon, 2 Jul 2018 07:58:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25B9F286C; Mon, 2 Jul 2018 07:58:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w627wvdx051049; Mon, 2 Jul 2018 07:58:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w627wvqM051048; Mon, 2 Jul 2018 07:58:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201807020758.w627wvqM051048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 2 Jul 2018 07:58:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335857 - stable/11/sys/amd64/include X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/include X-SVN-Commit-Revision: 335857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2018 07:58:58 -0000 Author: kib Date: Mon Jul 2 07:58:57 2018 New Revision: 335857 URL: https://svnweb.freebsd.org/changeset/base/335857 Log: MFC r335635: Do not leave stray qword on top of stack for interrupts and exceptions without error code. Doing so it mis-aligned the stack. PR: 229222 Modified: stable/11/sys/amd64/include/asmacros.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/asmacros.h ============================================================================== --- stable/11/sys/amd64/include/asmacros.h Mon Jul 2 05:19:44 2018 (r335856) +++ stable/11/sys/amd64/include/asmacros.h Mon Jul 2 07:58:57 2018 (r335857) @@ -185,7 +185,7 @@ movq PCPU(KCR3),%rax movq %rax,%cr3 movq PCPU(RSP0),%rax - subq $PTI_SIZE,%rax + subq $PTI_SIZE - 8 * (1 - \has_err),%rax MOVE_STACKS ((PTI_SIZE / 8) - 1 + \has_err) movq %rax,%rsp popq %rdx From owner-svn-src-stable-11@freebsd.org Mon Jul 2 13:08:29 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05D9D10281B6; Mon, 2 Jul 2018 13:08:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC1CA871D0; Mon, 2 Jul 2018 13:08:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E3E35E3A; Mon, 2 Jul 2018 13:08:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w62D8SeD011668; Mon, 2 Jul 2018 13:08:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w62D8RfE011662; Mon, 2 Jul 2018 13:08:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201807021308.w62D8RfE011662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 2 Jul 2018 13:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335863 - stable/11/usr.sbin/config X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.sbin/config X-SVN-Commit-Revision: 335863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2018 13:08:29 -0000 Author: kevans Date: Mon Jul 2 13:08:27 2018 New Revision: 335863 URL: https://svnweb.freebsd.org/changeset/base/335863 Log: MFC r335642, r335651: config(8) envvar support r335642: config(8): Add `envvar` support envvar allows adding individual environment variables to the kernel's static environment without the overhead of pulling in a full file. envvar in a config looks like: envvar some_var=5 All envvar-provided variables will be added after the env file is processed, so envvar keys that exist in the previous env will be overwritten by whatever value is set here in the kernel configuration directly. As an aside, envvar lines are intentionally tokenized differently from basically every other line. We used a named state when ENVVAR is encountered to gobble up the rest of the line, which will later be cleaned and validated in post-processing by sanitize_envline. This turns out to be the simplest and cleanest way to allow the flexibility that kenv does while not compromising on silly hacks. r335651: config(8): Set envmode if we accept an envvar Modified: stable/11/usr.sbin/config/config.5 stable/11/usr.sbin/config/config.h stable/11/usr.sbin/config/config.y stable/11/usr.sbin/config/lang.l stable/11/usr.sbin/config/main.c stable/11/usr.sbin/config/mkmakefile.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/config/config.5 ============================================================================== --- stable/11/usr.sbin/config/config.5 Mon Jul 2 11:02:27 2018 (r335862) +++ stable/11/usr.sbin/config/config.5 Mon Jul 2 13:08:27 2018 (r335863) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 21, 2016 +.Dd June 22, 2018 .Dt CONFIG 5 .Os .Sh NAME @@ -124,6 +124,20 @@ the compiled-in environment instead, unless the boot e This directive is useful for setting kernel tunables in embedded environments that do not start from .Xr loader 8 . +.\" -------- ENVVAR -------- +.Pp +.It Ic envvar Ar setting +Specifies an individual environment setting to be added to the kernel's +compiled-in environment. +.Ar setting +must be of the form +.Dq Va name=value . +Optional quotes are supported in both name and value. +All environment variables specified with +.Ic envvar +will be set after any +.Ic env +files are included. .\" -------- FILES -------- .Pp .It Ic files Ar filename Modified: stable/11/usr.sbin/config/config.h ============================================================================== --- stable/11/usr.sbin/config/config.h Mon Jul 2 11:02:27 2018 (r335862) +++ stable/11/usr.sbin/config/config.h Mon Jul 2 13:08:27 2018 (r335863) @@ -137,6 +137,13 @@ struct opt_list { SLIST_HEAD(, opt_list) otab; +struct envvar { + char *env_str; + STAILQ_ENTRY(envvar) envvar_next; +}; + +STAILQ_HEAD(envvar_head, envvar) envvars; + struct hint { char *hint_name; STAILQ_ENTRY(hint) hint_next; Modified: stable/11/usr.sbin/config/config.y ============================================================================== --- stable/11/usr.sbin/config/config.y Mon Jul 2 11:02:27 2018 (r335862) +++ stable/11/usr.sbin/config/config.y Mon Jul 2 13:08:27 2018 (r335863) @@ -12,6 +12,7 @@ %token DEVICE %token NODEVICE %token ENV +%token ENVVAR %token EQUALS %token PLUSEQUALS %token HINTS @@ -26,6 +27,7 @@ %token INCLUDE %token FILES +%token ENVLINE %token ID %token NUMBER @@ -191,6 +193,16 @@ Config_spec: env = $2; envmode = 1; } | + ENVVAR ENVLINE { + struct envvar *envvar; + + envvar = (struct envvar *)calloc(1, sizeof (struct envvar)); + if (envvar == NULL) + err(EXIT_FAILURE, "calloc"); + envvar->env_str = $2; + STAILQ_INSERT_TAIL(&envvars, envvar, envvar_next); + envmode = 1; + } | HINTS ID { struct hint *hint; Modified: stable/11/usr.sbin/config/lang.l ============================================================================== --- stable/11/usr.sbin/config/lang.l Mon Jul 2 11:02:27 2018 (r335862) +++ stable/11/usr.sbin/config/lang.l Mon Jul 2 13:08:27 2018 (r335863) @@ -68,6 +68,7 @@ struct kt { { "nodevice", NODEVICE }, { "nodevices", NODEVICE }, { "env", ENV }, + { "envvar", ENVVAR }, { "hints", HINTS }, { "ident", IDENT }, { "machine", ARCH }, /* MACHINE is defined in /sys/param.h */ @@ -103,7 +104,13 @@ int yyerror(const char *); ID [A-Za-z_][-A-Za-z_0-9]* PATH [./][-/.%^A-Za-z_0-9]+ %START TOEOL +%START ENVC %% +[^#\n]* { + BEGIN 0; + yylval.str = strdup(yytext); + return ENVLINE; + } {ID} { int i; @@ -113,6 +120,9 @@ PATH [./][-/.%^A-Za-z_0-9]+ yylval.str = strdup(yytext); return ID; } + /* We'll glom onto the rest of an envvar line */ + if (i == ENVVAR) + BEGIN ENVC; return i; } \\\"[^"]+\\\" { Modified: stable/11/usr.sbin/config/main.c ============================================================================== --- stable/11/usr.sbin/config/main.c Mon Jul 2 11:02:27 2018 (r335862) +++ stable/11/usr.sbin/config/main.c Mon Jul 2 13:08:27 2018 (r335863) @@ -202,6 +202,7 @@ main(int argc, char **argv) STAILQ_INIT(&fntab); STAILQ_INIT(&ftab); STAILQ_INIT(&hints); + STAILQ_INIT(&envvars); if (yyparse()) exit(3); Modified: stable/11/usr.sbin/config/mkmakefile.c ============================================================================== --- stable/11/usr.sbin/config/mkmakefile.c Mon Jul 2 11:02:27 2018 (r335862) +++ stable/11/usr.sbin/config/mkmakefile.c Mon Jul 2 13:08:27 2018 (r335863) @@ -44,6 +44,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -236,6 +237,63 @@ makehints(void) moveifchanged(path("hints.c.new"), path("hints.c")); } +static void +sanitize_envline(char *result, const char *src) +{ + const char *eq; + char c, *dst; + bool leading; + + /* If there is no '=' it's not a well-formed name=value line. */ + if ((eq = strchr(src, '=')) == NULL) { + *result = 0; + return; + } + dst = result; + + /* Copy chars before the '=', skipping any leading spaces/quotes. */ + leading = true; + while (src < eq) { + c = *src++; + if (leading && (isspace(c) || c == '"')) + continue; + *dst++ = c; + leading = false; + } + + /* If it was all leading space, we don't have a well-formed line. */ + if (leading) { + *result = 0; + return; + } + + /* Trim spaces/quotes immediately before the '=', then copy the '='. */ + while (isspace(dst[-1]) || dst[-1] == '"') + --dst; + *dst++ = *src++; + + /* Copy chars after the '=', skipping any leading whitespace. */ + leading = true; + while ((c = *src++) != 0) { + if (leading && (isspace(c) || c == '"')) + continue; + *dst++ = c; + leading = false; + } + + /* If it was all leading space, it's a valid 'var=' (nil value). */ + if (leading) { + *dst = 0; + return; + } + + /* Trim trailing whitespace and quotes. */ + while (isspace(dst[-1]) || dst[-1] == '"') + --dst; + + *dst = 0; +} + /* * Build env.c from the skeleton */ @@ -243,8 +301,8 @@ void makeenv(void) { FILE *ifp, *ofp; - char line[BUFSIZ]; - char *s; + char line[BUFSIZ], result[BUFSIZ], *linep; + struct envvar *envvar; if (env) { ifp = fopen(env, "r"); @@ -263,34 +321,19 @@ makeenv(void) fprintf(ofp, "char static_env[] = {\n"); if (ifp) { while (fgets(line, BUFSIZ, ifp) != NULL) { - /* zap trailing CR and/or LF */ - while ((s = strrchr(line, '\n')) != NULL) - *s = '\0'; - while ((s = strrchr(line, '\r')) != NULL) - *s = '\0'; - /* remove # comments */ - s = strchr(line, '#'); - if (s) - *s = '\0'; - /* remove any whitespace and " characters */ - s = line; - while (*s) { - if (*s == ' ' || *s == '\t' || *s == '"') { - while (*s) { - s[0] = s[1]; - s++; - } - /* start over */ - s = line; - continue; - } - s++; - } + sanitize_envline(result, line); /* anything left? */ - if (*line == '\0') + if (*result == '\0') continue; - fprintf(ofp, "\"%s\\0\"\n", line); + fprintf(ofp, "\"%s\\0\"\n", result); } + } + STAILQ_FOREACH(envvar, &envvars, envvar_next) { + linep = envvar->env_str; + sanitize_envline(result, linep); + if (*result == '\0') + continue; + fprintf(ofp, "\"%s\\0\"\n", result); } fprintf(ofp, "\"\\0\"\n};\n"); if (ifp) From owner-svn-src-stable-11@freebsd.org Mon Jul 2 18:42:12 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89D97103460E for ; Mon, 2 Jul 2018 18:42:12 +0000 (UTC) (envelope-from mail@fbsd.e4m.org) Received: from mail.g66.org (mail.g66.org [85.10.206.112]) by mx1.freebsd.org (Postfix) with ESMTP id E991974C09; Mon, 2 Jul 2018 18:42:11 +0000 (UTC) (envelope-from mail@fbsd.e4m.org) Received: from x590ef8d1.dyn.telefonica.de (x590ef8d1.dyn.telefonica.de [89.14.248.209]) (authenticated bits=128) by mail.g66.org (8.15.2/8.15.2) with ESMTPA id w62IgAF7062374; Mon, 2 Jul 2018 20:42:10 +0200 (CEST) (envelope-from mail@fbsd.e4m.org) Received: from stationary.client ([192.168.128.2]) by gate.local (8.15.2/8.15.2) with ESMTP id w62IgA0o014963; Mon, 2 Jul 2018 20:42:10 +0200 (CEST) (envelope-from mail@fbsd.e4m.org) Received: from submit.client ([127.0.0.1]) by voyager.local (8.15.2/8.15.2) with ESMTP id w62IgAf9003040; Mon, 2 Jul 2018 20:42:10 +0200 (CEST) (envelope-from mail@fbsd.e4m.org) Received: (from user@localhost) by voyager.local (8.15.2/8.15.2/Submit) id w62IgAqH003039; Mon, 2 Jul 2018 20:42:10 +0200 (CEST) (envelope-from mail@fbsd.e4m.org) Date: Mon, 2 Jul 2018 20:42:10 +0200 From: Andre Albsmeier To: Kristof Provost Cc: src-committers@freebsd.org, svn-src-stable-11@freebsd.org, mail@fbsd.e4m.org Subject: Re: svn commit: r335798 - in stable/11: sbin/pfctl share/man/man5 sys/netpfil/pf Message-ID: <20180702184210.GA2998@voyager> References: <201806291646.w5TGkJ6N082672@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201806291646.w5TGkJ6N082672@repo.freebsd.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-Virus-Scanned: clamav-milter 0.100.0 at colo X-Virus-Status: Clean X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2018 18:42:12 -0000 On Fri, 29-Jun-2018 at 16:46:19 +0000, Kristof Provost wrote: > Author: kp > Date: Fri Jun 29 16:46:19 2018 > New Revision: 335798 > URL: https://svnweb.freebsd.org/changeset/base/335798 > > Log: > MFC r335569: > > pf: Support "return" statements in passing rules when they fail. I just filed a PR regarding synproxy issues after this change: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229477 Please check (and feel free to complain if I am talking nonsense ;-)). From owner-svn-src-stable-11@freebsd.org Mon Jul 2 21:20:41 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E4A6FD28F2; Mon, 2 Jul 2018 21:20:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE0687AB1A; Mon, 2 Jul 2018 21:20:40 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FE5D12D84; Mon, 2 Jul 2018 21:20:40 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w62LKeqa066644; Mon, 2 Jul 2018 21:20:40 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w62LKaFi065921; Mon, 2 Jul 2018 21:20:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201807022120.w62LKaFi065921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 2 Jul 2018 21:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335875 - in stable/11: lib/clang lib/clang/include/llvm/Config lib/clang/libllvm share/man/man5 share/mk tools/build/options X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/11: lib/clang lib/clang/include/llvm/Config lib/clang/libllvm share/man/man5 share/mk tools/build/options X-SVN-Commit-Revision: 335875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2018 21:20:41 -0000 Author: dim Date: Mon Jul 2 21:20:36 2018 New Revision: 335875 URL: https://svnweb.freebsd.org/changeset/base/335875 Log: MFC r335558: Add support for selectively enabling LLVM targets This makes it possible, through src.conf(5) settings, to select which LLVM targets you want to build during buildworld. The current list is: * (WITH|WITHOUT)_LLVM_TARGET_AARCH64 * (WITH|WITHOUT)_LLVM_TARGET_ARM * (WITH|WITHOUT)_LLVM_TARGET_MIPS * (WITH|WITHOUT)_LLVM_TARGET_POWERPC * (WITH|WITHOUT)_LLVM_TARGET_SPARC * (WITH|WITHOUT)_LLVM_TARGET_X86 To not influence anything right now, all of these are on by default, in situations where clang is enabled. Selectively turning a few targets off manually should work. Turning on only one target should work too, even if that target does not correspond to the build architecture. (In that case, LLVM_NATIVE_ARCH will not be defined, and you can only use the resulting clang executable for cross-compiling.) I performed a few measurements on one of the FreeBSD.org reference machines, building clang from scratch, with all targets enabled, and with only the x86 target enabled. The latter was ~12% faster in real time (on a 32-core box), and ~14% faster in user time. For a full buildworld the difference will probably be less pronounced, though. Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D11077 Added: stable/11/tools/build/options/WITHOUT_LLVM_TARGET_AARCH64 - copied unchanged from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_AARCH64 stable/11/tools/build/options/WITHOUT_LLVM_TARGET_ARM - copied unchanged from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_ARM stable/11/tools/build/options/WITHOUT_LLVM_TARGET_MIPS - copied unchanged from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_MIPS stable/11/tools/build/options/WITHOUT_LLVM_TARGET_POWERPC - copied unchanged from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_POWERPC stable/11/tools/build/options/WITHOUT_LLVM_TARGET_SPARC - copied unchanged from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_SPARC stable/11/tools/build/options/WITHOUT_LLVM_TARGET_X86 - copied unchanged from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_X86 stable/11/tools/build/options/WITH_LLVM_TARGET_AARCH64 - copied unchanged from r335558, head/tools/build/options/WITH_LLVM_TARGET_AARCH64 stable/11/tools/build/options/WITH_LLVM_TARGET_ARM - copied unchanged from r335558, head/tools/build/options/WITH_LLVM_TARGET_ARM stable/11/tools/build/options/WITH_LLVM_TARGET_MIPS - copied unchanged from r335558, head/tools/build/options/WITH_LLVM_TARGET_MIPS stable/11/tools/build/options/WITH_LLVM_TARGET_POWERPC - copied unchanged from r335558, head/tools/build/options/WITH_LLVM_TARGET_POWERPC stable/11/tools/build/options/WITH_LLVM_TARGET_SPARC - copied unchanged from r335558, head/tools/build/options/WITH_LLVM_TARGET_SPARC stable/11/tools/build/options/WITH_LLVM_TARGET_X86 - copied unchanged from r335558, head/tools/build/options/WITH_LLVM_TARGET_X86 Modified: stable/11/lib/clang/include/llvm/Config/AsmParsers.def stable/11/lib/clang/include/llvm/Config/AsmPrinters.def stable/11/lib/clang/include/llvm/Config/Disassemblers.def stable/11/lib/clang/include/llvm/Config/Targets.def stable/11/lib/clang/include/llvm/Config/llvm-config.h stable/11/lib/clang/libllvm/Makefile stable/11/lib/clang/llvm.build.mk stable/11/share/man/man5/src.conf.5 stable/11/share/mk/src.opts.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/clang/include/llvm/Config/AsmParsers.def ============================================================================== --- stable/11/lib/clang/include/llvm/Config/AsmParsers.def Mon Jul 2 20:56:17 2018 (r335874) +++ stable/11/lib/clang/include/llvm/Config/AsmParsers.def Mon Jul 2 21:20:36 2018 (r335875) @@ -4,11 +4,23 @@ # error Please define the macro LLVM_ASM_PARSER(TargetName) #endif +#ifdef LLVM_TARGET_ENABLE_AARCH64 LLVM_ASM_PARSER(AArch64) +#endif +#ifdef LLVM_TARGET_ENABLE_ARM LLVM_ASM_PARSER(ARM) +#endif +#ifdef LLVM_TARGET_ENABLE_MIPS LLVM_ASM_PARSER(Mips) +#endif +#ifdef LLVM_TARGET_ENABLE_POWERPC LLVM_ASM_PARSER(PowerPC) +#endif +#ifdef LLVM_TARGET_ENABLE_SPARC LLVM_ASM_PARSER(Sparc) +#endif +#ifdef LLVM_TARGET_ENABLE_X86 LLVM_ASM_PARSER(X86) +#endif #undef LLVM_ASM_PARSER Modified: stable/11/lib/clang/include/llvm/Config/AsmPrinters.def ============================================================================== --- stable/11/lib/clang/include/llvm/Config/AsmPrinters.def Mon Jul 2 20:56:17 2018 (r335874) +++ stable/11/lib/clang/include/llvm/Config/AsmPrinters.def Mon Jul 2 21:20:36 2018 (r335875) @@ -4,11 +4,23 @@ # error Please define the macro LLVM_ASM_PRINTER(TargetName) #endif +#ifdef LLVM_TARGET_ENABLE_AARCH64 LLVM_ASM_PRINTER(AArch64) +#endif +#ifdef LLVM_TARGET_ENABLE_ARM LLVM_ASM_PRINTER(ARM) +#endif +#ifdef LLVM_TARGET_ENABLE_MIPS LLVM_ASM_PRINTER(Mips) +#endif +#ifdef LLVM_TARGET_ENABLE_POWERPC LLVM_ASM_PRINTER(PowerPC) +#endif +#ifdef LLVM_TARGET_ENABLE_SPARC LLVM_ASM_PRINTER(Sparc) +#endif +#ifdef LLVM_TARGET_ENABLE_X86 LLVM_ASM_PRINTER(X86) +#endif #undef LLVM_ASM_PRINTER Modified: stable/11/lib/clang/include/llvm/Config/Disassemblers.def ============================================================================== --- stable/11/lib/clang/include/llvm/Config/Disassemblers.def Mon Jul 2 20:56:17 2018 (r335874) +++ stable/11/lib/clang/include/llvm/Config/Disassemblers.def Mon Jul 2 21:20:36 2018 (r335875) @@ -4,11 +4,23 @@ # error Please define the macro LLVM_DISASSEMBLER(TargetName) #endif +#ifdef LLVM_TARGET_ENABLE_AARCH64 LLVM_DISASSEMBLER(AArch64) +#endif +#ifdef LLVM_TARGET_ENABLE_ARM LLVM_DISASSEMBLER(ARM) +#endif +#ifdef LLVM_TARGET_ENABLE_MIPS LLVM_DISASSEMBLER(Mips) +#endif +#ifdef LLVM_TARGET_ENABLE_POWERPC LLVM_DISASSEMBLER(PowerPC) +#endif +#ifdef LLVM_TARGET_ENABLE_SPARC LLVM_DISASSEMBLER(Sparc) +#endif +#ifdef LLVM_TARGET_ENABLE_X86 LLVM_DISASSEMBLER(X86) +#endif #undef LLVM_DISASSEMBLER Modified: stable/11/lib/clang/include/llvm/Config/Targets.def ============================================================================== --- stable/11/lib/clang/include/llvm/Config/Targets.def Mon Jul 2 20:56:17 2018 (r335874) +++ stable/11/lib/clang/include/llvm/Config/Targets.def Mon Jul 2 21:20:36 2018 (r335875) @@ -4,11 +4,23 @@ # error Please define the macro LLVM_TARGET(TargetName) #endif +#ifdef LLVM_TARGET_ENABLE_AARCH64 LLVM_TARGET(AArch64) +#endif +#ifdef LLVM_TARGET_ENABLE_ARM LLVM_TARGET(ARM) +#endif +#ifdef LLVM_TARGET_ENABLE_MIPS LLVM_TARGET(Mips) +#endif +#ifdef LLVM_TARGET_ENABLE_POWERPC LLVM_TARGET(PowerPC) +#endif +#ifdef LLVM_TARGET_ENABLE_SPARC LLVM_TARGET(Sparc) +#endif +#ifdef LLVM_TARGET_ENABLE_X86 LLVM_TARGET(X86) +#endif #undef LLVM_TARGET Modified: stable/11/lib/clang/include/llvm/Config/llvm-config.h ============================================================================== --- stable/11/lib/clang/include/llvm/Config/llvm-config.h Mon Jul 2 20:56:17 2018 (r335874) +++ stable/11/lib/clang/include/llvm/Config/llvm-config.h Mon Jul 2 21:20:36 2018 (r335875) @@ -34,25 +34,25 @@ /* #undef LLVM_HOST_TRIPLE */ /* LLVM architecture name for the native architecture, if available */ -#define LLVM_NATIVE_ARCH X86 +/* #undef LLVM_NATIVE_ARCH */ /* LLVM name for the native AsmParser init function, if available */ -#define LLVM_NATIVE_ASMPARSER LLVMInitializeX86AsmParser +/* #undef LLVM_NATIVE_ASMPARSER */ /* LLVM name for the native AsmPrinter init function, if available */ -#define LLVM_NATIVE_ASMPRINTER LLVMInitializeX86AsmPrinter +/* #undef LLVM_NATIVE_ASMPRINTER */ /* LLVM name for the native Disassembler init function, if available */ -#define LLVM_NATIVE_DISASSEMBLER LLVMInitializeX86Disassembler +/* #undef LLVM_NATIVE_DISASSEMBLER */ /* LLVM name for the native Target init function, if available */ -#define LLVM_NATIVE_TARGET LLVMInitializeX86Target +/* #undef LLVM_NATIVE_TARGET */ /* LLVM name for the native TargetInfo init function, if available */ -#define LLVM_NATIVE_TARGETINFO LLVMInitializeX86TargetInfo +/* #undef LLVM_NATIVE_TARGETINFO */ /* LLVM name for the native target MC init function, if available */ -#define LLVM_NATIVE_TARGETMC LLVMInitializeX86TargetMC +/* #undef LLVM_NATIVE_TARGETMC */ /* Define if this is Unixish platform */ #define LLVM_ON_UNIX 1 Modified: stable/11/lib/clang/libllvm/Makefile ============================================================================== --- stable/11/lib/clang/libllvm/Makefile Mon Jul 2 20:56:17 2018 (r335874) +++ stable/11/lib/clang/libllvm/Makefile Mon Jul 2 21:20:36 2018 (r335875) @@ -7,8 +7,19 @@ LIB= llvm INTERNALLIB= CFLAGS+= -I${.OBJDIR} + +.if ${MK_LLVM_TARGET_AARCH64} == "no" && ${MK_LLVM_TARGET_ARM} == "no" && \ + ${MK_LLVM_TARGET_MIPS} == "no" && ${MK_LLVM_TARGET_POWERPC} == "no" && \ + ${MK_LLVM_TARGET_SPARC} == "no" && ${MK_LLVM_TARGET_X86} == "no" +.error Please enable at least one of: MK_LLVM_TARGET_AARCH64,\ + MK_LLVM_TARGET_ARM, MK_LLVM_TARGET_MIPS, MK_LLVM_TARGET_POWERPC,\ + MK_LLVM_TARGET_SPARC, or MK_LLVM_TARGET_X86 +.endif + .for arch in AArch64 ARM Mips PowerPC Sparc X86 +. if ${MK_LLVM_TARGET_${arch:tu}} != "no" CFLAGS+= -I${LLVM_SRCS}/lib/Target/${arch} +. endif .endfor SRCDIR= lib @@ -784,6 +795,7 @@ SRCS_MIN+= TableGen/StringMatcher.cpp SRCS_MIN+= TableGen/TGLexer.cpp SRCS_MIN+= TableGen/TGParser.cpp SRCS_MIN+= TableGen/TableGenBackend.cpp +.if ${MK_LLVM_TARGET_AARCH64} != "no" SRCS_MIN+= Target/AArch64/AArch64A53Fix835769.cpp SRCS_MIN+= Target/AArch64/AArch64A57FPLoadBalancing.cpp SRCS_MIN+= Target/AArch64/AArch64AdvSIMDScalarPass.cpp @@ -836,6 +848,8 @@ SRCS_MIN+= Target/AArch64/MCTargetDesc/AArch64WinCOFFO SRCS_MIN+= Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp SRCS_MIN+= Target/AArch64/TargetInfo/AArch64TargetInfo.cpp SRCS_MIN+= Target/AArch64/Utils/AArch64BaseInfo.cpp +.endif # MK_LLVM_TARGET_AARCH64 +.if ${MK_LLVM_TARGET_ARM} != "no" SRCS_MIN+= Target/ARM/A15SDOptimizer.cpp SRCS_MIN+= Target/ARM/ARMAsmPrinter.cpp SRCS_MIN+= Target/ARM/ARMBaseInstrInfo.cpp @@ -890,6 +904,8 @@ SRCS_MIN+= Target/ARM/Thumb2InstrInfo.cpp SRCS_MIN+= Target/ARM/Thumb2SizeReduction.cpp SRCS_MIN+= Target/ARM/ThumbRegisterInfo.cpp SRCS_MIN+= Target/ARM/Utils/ARMBaseInfo.cpp +.endif # MK_LLVM_TARGET_ARM +.if ${MK_LLVM_TARGET_MIPS} != "no" SRCS_MIN+= Target/Mips/AsmParser/MipsAsmParser.cpp SRCS_XDW+= Target/Mips/Disassembler/MipsDisassembler.cpp SRCS_MIN+= Target/Mips/InstPrinter/MipsInstPrinter.cpp @@ -940,6 +956,8 @@ SRCS_MIN+= Target/Mips/MipsSubtarget.cpp SRCS_MIN+= Target/Mips/MipsTargetMachine.cpp SRCS_MIN+= Target/Mips/MipsTargetObjectFile.cpp SRCS_MIN+= Target/Mips/TargetInfo/MipsTargetInfo.cpp +.endif # MK_LLVM_TARGET_MIPS +.if ${MK_LLVM_TARGET_POWERPC} != "no" SRCS_MIN+= Target/PowerPC/AsmParser/PPCAsmParser.cpp SRCS_MIN+= Target/PowerPC/Disassembler/PPCDisassembler.cpp SRCS_MIN+= Target/PowerPC/InstPrinter/PPCInstPrinter.cpp @@ -983,6 +1001,8 @@ SRCS_MIN+= Target/PowerPC/PPCVSXCopy.cpp SRCS_MIN+= Target/PowerPC/PPCVSXFMAMutate.cpp SRCS_MIN+= Target/PowerPC/PPCVSXSwapRemoval.cpp SRCS_MIN+= Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp +.endif # MK_LLVM_TARGET_POWERPC +.if ${MK_LLVM_TARGET_SPARC} != "no" SRCS_MIN+= Target/Sparc/AsmParser/SparcAsmParser.cpp SRCS_MIN+= Target/Sparc/DelaySlotFiller.cpp SRCS_XDW+= Target/Sparc/Disassembler/SparcDisassembler.cpp @@ -1007,11 +1027,13 @@ SRCS_MIN+= Target/Sparc/SparcSubtarget.cpp SRCS_MIN+= Target/Sparc/SparcTargetMachine.cpp SRCS_MIN+= Target/Sparc/SparcTargetObjectFile.cpp SRCS_MIN+= Target/Sparc/TargetInfo/SparcTargetInfo.cpp +.endif # MK_LLVM_TARGET_SPARC SRCS_MIN+= Target/Target.cpp SRCS_MIN+= Target/TargetIntrinsicInfo.cpp SRCS_MIN+= Target/TargetLoweringObjectFile.cpp SRCS_MIN+= Target/TargetMachine.cpp SRCS_MIN+= Target/TargetMachineC.cpp +.if ${MK_LLVM_TARGET_X86} != "no" SRCS_MIN+= Target/X86/AsmParser/X86AsmInstrumentation.cpp SRCS_MIN+= Target/X86/AsmParser/X86AsmParser.cpp SRCS_XDW+= Target/X86/Disassembler/X86Disassembler.cpp @@ -1069,6 +1091,7 @@ SRCS_MIN+= Target/X86/X86TargetTransformInfo.cpp SRCS_MIN+= Target/X86/X86VZeroUpper.cpp SRCS_MIN+= Target/X86/X86WinAllocaExpander.cpp SRCS_MIN+= Target/X86/X86WinEHState.cpp +.endif # MK_LLVM_TARGET_X86 SRCS_EXT+= ToolDrivers/llvm-dlltool/DlltoolDriver.cpp SRCS_EXL+= ToolDrivers/llvm-lib/LibDriver.cpp SRCS_MIN+= Transforms/Coroutines/CoroCleanup.cpp @@ -1372,6 +1395,7 @@ ${arch:T}Gen${hdr:H}.inc: ${LLVM_SRCS}/lib/Target/${ar ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td . endfor .endfor +.if ${MK_LLVM_TARGET_AARCH64} != "no" TGHDRS+= AArch64GenAsmMatcher.inc TGHDRS+= AArch64GenAsmWriter.inc TGHDRS+= AArch64GenAsmWriter1.inc @@ -1387,6 +1411,8 @@ TGHDRS+= AArch64GenRegisterBank.inc TGHDRS+= AArch64GenRegisterInfo.inc TGHDRS+= AArch64GenSubtargetInfo.inc TGHDRS+= AArch64GenSystemOperands.inc +.endif # MK_LLVM_TARGET_AARCH64 +.if ${MK_LLVM_TARGET_ARM} != "no" TGHDRS+= ARMGenAsmMatcher.inc TGHDRS+= ARMGenAsmWriter.inc TGHDRS+= ARMGenCallingConv.inc @@ -1401,6 +1427,8 @@ TGHDRS+= ARMGenRegisterBank.inc TGHDRS+= ARMGenRegisterInfo.inc TGHDRS+= ARMGenSubtargetInfo.inc TGHDRS+= ARMGenSystemRegister.inc +.endif # MK_LLVM_TARGET_ARM +.if ${MK_LLVM_TARGET_MIPS} != "no" TGHDRS+= MipsGenAsmMatcher.inc TGHDRS+= MipsGenAsmWriter.inc TGHDRS+= MipsGenCallingConv.inc @@ -1412,6 +1440,8 @@ TGHDRS+= MipsGenMCCodeEmitter.inc TGHDRS+= MipsGenMCPseudoLowering.inc TGHDRS+= MipsGenRegisterInfo.inc TGHDRS+= MipsGenSubtargetInfo.inc +.endif # MK_LLVM_TARGET_MIPS +.if ${MK_LLVM_TARGET_POWERPC} != "no" TGHDRS+= PPCGenAsmMatcher.inc TGHDRS+= PPCGenAsmWriter.inc TGHDRS+= PPCGenCallingConv.inc @@ -1422,6 +1452,8 @@ TGHDRS+= PPCGenInstrInfo.inc TGHDRS+= PPCGenMCCodeEmitter.inc TGHDRS+= PPCGenRegisterInfo.inc TGHDRS+= PPCGenSubtargetInfo.inc +.endif # MK_LLVM_TARGET_POWERPC +.if ${MK_LLVM_TARGET_SPARC} != "no" TGHDRS+= SparcGenAsmMatcher.inc TGHDRS+= SparcGenAsmWriter.inc TGHDRS+= SparcGenCallingConv.inc @@ -1431,6 +1463,8 @@ TGHDRS+= SparcGenInstrInfo.inc TGHDRS+= SparcGenMCCodeEmitter.inc TGHDRS+= SparcGenRegisterInfo.inc TGHDRS+= SparcGenSubtargetInfo.inc +.endif # MK_LLVM_TARGET_SPARC +.if ${MK_LLVM_TARGET_X86} != "no" TGHDRS+= X86GenAsmMatcher.inc TGHDRS+= X86GenAsmWriter.inc TGHDRS+= X86GenAsmWriter1.inc @@ -1444,6 +1478,7 @@ TGHDRS+= X86GenInstrInfo.inc TGHDRS+= X86GenRegisterBank.inc TGHDRS+= X86GenRegisterInfo.inc TGHDRS+= X86GenSubtargetInfo.inc +.endif # MK_LLVM_TARGET_X86 .for dep in ${TGHDRS:C/$/.d/} . if ${MAKE_VERSION} < 20160220 Modified: stable/11/lib/clang/llvm.build.mk ============================================================================== --- stable/11/lib/clang/llvm.build.mk Mon Jul 2 20:56:17 2018 (r335874) +++ stable/11/lib/clang/llvm.build.mk Mon Jul 2 21:20:36 2018 (r335875) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + .ifndef LLVM_SRCS .error Please define LLVM_SRCS before including this file .endif @@ -39,6 +41,52 @@ BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aa CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" CFLAGS+= -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\" CFLAGS+= -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" + +.if ${MK_LLVM_TARGET_AARCH64} != "no" +CFLAGS+= -DLLVM_TARGET_ENABLE_AARCH64 +. if ${MACHINE_CPUARCH} == "aarch64" +LLVM_NATIVE_ARCH= AArch64 +. endif +.endif +.if ${MK_LLVM_TARGET_ARM} != "no" +CFLAGS+= -DLLVM_TARGET_ENABLE_ARM +. if ${MACHINE_CPUARCH} == "arm" +LLVM_NATIVE_ARCH= ARM +. endif +.endif +.if ${MK_LLVM_TARGET_MIPS} != "no" +CFLAGS+= -DLLVM_TARGET_ENABLE_MIPS +. if ${MACHINE_CPUARCH} == "mips" +LLVM_NATIVE_ARCH= Mips +. endif +.endif +.if ${MK_LLVM_TARGET_POWERPC} != "no" +CFLAGS+= -DLLVM_TARGET_ENABLE_POWERPC +. if ${MACHINE_CPUARCH} == "powerpc" +LLVM_NATIVE_ARCH= PowerPC +. endif +.endif +.if ${MK_LLVM_TARGET_SPARC} != "no" +CFLAGS+= -DLLVM_TARGET_ENABLE_SPARC +. if ${MACHINE_CPUARCH} == "sparc64" +LLVM_NATIVE_ARCH= Sparc +. endif +.endif +.if ${MK_LLVM_TARGET_X86} != "no" +CFLAGS+= -DLLVM_TARGET_ENABLE_X86 +. if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +LLVM_NATIVE_ARCH= X86 +. endif +.endif + +.ifdef LLVM_NATIVE_ARCH +CFLAGS+= -DLLVM_NATIVE_ASMPARSER=LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser +CFLAGS+= -DLLVM_NATIVE_ASMPRINTER=LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter +CFLAGS+= -DLLVM_NATIVE_DISASSEMBLER=LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler +CFLAGS+= -DLLVM_NATIVE_TARGET=LLVMInitialize${LLVM_NATIVE_ARCH}Target +CFLAGS+= -DLLVM_NATIVE_TARGETINFO=LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo +CFLAGS+= -DLLVM_NATIVE_TARGETMC=LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC +.endif CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections Modified: stable/11/share/man/man5/src.conf.5 ============================================================================== --- stable/11/share/man/man5/src.conf.5 Mon Jul 2 20:56:17 2018 (r335874) +++ stable/11/share/man/man5/src.conf.5 Mon Jul 2 21:20:36 2018 (r335875) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd April 8, 2018 +.Dd June 22, 2018 .Dt SRC.CONF 5 .Os .Sh NAME @@ -995,6 +995,66 @@ Set to use LLVM's libunwind stack unwinder (instead of .Pp This is a default setting on arm64/aarch64. +.It Va WITHOUT_LLVM_TARGET_AARCH64 +Set to not build LLVM target support for AArch64. +.Pp +This is a default setting on +riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +.It Va WITH_LLVM_TARGET_AARCH64 +Set to build LLVM target support for AArch64. +.Pp +This is a default setting on +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +.It Va WITHOUT_LLVM_TARGET_ARM +Set to not build LLVM target support for ARM. +.Pp +This is a default setting on +riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +.It Va WITH_LLVM_TARGET_ARM +Set to build LLVM target support for ARM. +.Pp +This is a default setting on +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +.It Va WITHOUT_LLVM_TARGET_MIPS +Set to not build LLVM target support for MIPS. +.Pp +This is a default setting on +riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +.It Va WITH_LLVM_TARGET_MIPS +Set to build LLVM target support for MIPS. +.Pp +This is a default setting on +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +.It Va WITHOUT_LLVM_TARGET_POWERPC +Set to not build LLVM target support for PowerPC. +.Pp +This is a default setting on +riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +.It Va WITH_LLVM_TARGET_POWERPC +Set to build LLVM target support for PowerPC. +.Pp +This is a default setting on +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +.It Va WITHOUT_LLVM_TARGET_SPARC +Set to not build LLVM target support for SPARC. +.Pp +This is a default setting on +riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +.It Va WITH_LLVM_TARGET_SPARC +Set to build LLVM target support for SPARC. +.Pp +This is a default setting on +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +.It Va WITHOUT_LLVM_TARGET_X86 +Set to not build LLVM target support for X86. +.Pp +This is a default setting on +riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +.It Va WITH_LLVM_TARGET_X86 +Set to build LLVM target support for X86. +.Pp +This is a default setting on +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITH_LOADER_FIREWIRE Enable firewire support in /boot/loader and /boot/zfsloader on x86. This option is a nop on all other platforms. Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Mon Jul 2 20:56:17 2018 (r335874) +++ stable/11/share/mk/src.opts.mk Mon Jul 2 21:20:36 2018 (r335875) @@ -236,17 +236,23 @@ __TT=${MACHINE} ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386") # Clang is enabled, and will be installed as the default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC LLD +__DEFAULT_YES_OPTIONS+=LLVM_TARGET_AARCH64 LLVM_TARGET_ARM LLVM_TARGET_MIPS +__DEFAULT_YES_OPTIONS+=LLVM_TARGET_POWERPC LLVM_TARGET_SPARC LLVM_TARGET_X86 __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX .elif ${COMPILER_FEATURES:Mc++11} && ${__T} != "riscv64" && ${__T} != "sparc64" # If an external compiler that supports C++11 is used as ${CC} and Clang # supports the target, then Clang is enabled but GCC is installed as the # default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX +__DEFAULT_YES_OPTIONS+=LLVM_TARGET_AARCH64 LLVM_TARGET_ARM LLVM_TARGET_MIPS +__DEFAULT_YES_OPTIONS+=LLVM_TARGET_POWERPC LLVM_TARGET_SPARC LLVM_TARGET_X86 __DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC LLD .else # Everything else disables Clang, and uses GCC instead. __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC LLD +__DEFAULT_NO_OPTIONS+=LLVM_TARGET_AARCH64 LLVM_TARGET_ARM LLVM_TARGET_MIPS +__DEFAULT_NO_OPTIONS+=LLVM_TARGET_POWERPC LLVM_TARGET_SPARC LLVM_TARGET_X86 .endif # In-tree binutils/gcc are older versions without modern architecture support. .if ${__T} == "aarch64" || ${__T} == "riscv64" Copied: stable/11/tools/build/options/WITHOUT_LLVM_TARGET_AARCH64 (from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_AARCH64) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LLVM_TARGET_AARCH64 Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_AARCH64) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build LLVM target support for AArch64. Copied: stable/11/tools/build/options/WITHOUT_LLVM_TARGET_ARM (from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_ARM) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LLVM_TARGET_ARM Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_ARM) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build LLVM target support for ARM. Copied: stable/11/tools/build/options/WITHOUT_LLVM_TARGET_MIPS (from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_MIPS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LLVM_TARGET_MIPS Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_MIPS) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build LLVM target support for MIPS. Copied: stable/11/tools/build/options/WITHOUT_LLVM_TARGET_POWERPC (from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_POWERPC) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LLVM_TARGET_POWERPC Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_POWERPC) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build LLVM target support for PowerPC. Copied: stable/11/tools/build/options/WITHOUT_LLVM_TARGET_SPARC (from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_SPARC) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LLVM_TARGET_SPARC Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_SPARC) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build LLVM target support for SPARC. Copied: stable/11/tools/build/options/WITHOUT_LLVM_TARGET_X86 (from r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_X86) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LLVM_TARGET_X86 Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITHOUT_LLVM_TARGET_X86) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build LLVM target support for X86. Copied: stable/11/tools/build/options/WITH_LLVM_TARGET_AARCH64 (from r335558, head/tools/build/options/WITH_LLVM_TARGET_AARCH64) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LLVM_TARGET_AARCH64 Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITH_LLVM_TARGET_AARCH64) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build LLVM target support for AArch64. Copied: stable/11/tools/build/options/WITH_LLVM_TARGET_ARM (from r335558, head/tools/build/options/WITH_LLVM_TARGET_ARM) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LLVM_TARGET_ARM Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITH_LLVM_TARGET_ARM) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build LLVM target support for ARM. Copied: stable/11/tools/build/options/WITH_LLVM_TARGET_MIPS (from r335558, head/tools/build/options/WITH_LLVM_TARGET_MIPS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LLVM_TARGET_MIPS Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITH_LLVM_TARGET_MIPS) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build LLVM target support for MIPS. Copied: stable/11/tools/build/options/WITH_LLVM_TARGET_POWERPC (from r335558, head/tools/build/options/WITH_LLVM_TARGET_POWERPC) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LLVM_TARGET_POWERPC Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITH_LLVM_TARGET_POWERPC) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build LLVM target support for PowerPC. Copied: stable/11/tools/build/options/WITH_LLVM_TARGET_SPARC (from r335558, head/tools/build/options/WITH_LLVM_TARGET_SPARC) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LLVM_TARGET_SPARC Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITH_LLVM_TARGET_SPARC) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build LLVM target support for SPARC. Copied: stable/11/tools/build/options/WITH_LLVM_TARGET_X86 (from r335558, head/tools/build/options/WITH_LLVM_TARGET_X86) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LLVM_TARGET_X86 Mon Jul 2 21:20:36 2018 (r335875, copy of r335558, head/tools/build/options/WITH_LLVM_TARGET_X86) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build LLVM target support for X86. From owner-svn-src-stable-11@freebsd.org Tue Jul 3 14:40:20 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BCFB1025D11; Tue, 3 Jul 2018 14:40:20 +0000 (UTC) (envelope-from robak@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1733983FA7; Tue, 3 Jul 2018 14:40:20 +0000 (UTC) (envelope-from robak@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4C661D5ED; Tue, 3 Jul 2018 14:40:19 +0000 (UTC) (envelope-from robak@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w63EeJHq000707; Tue, 3 Jul 2018 14:40:19 GMT (envelope-from robak@FreeBSD.org) Received: (from robak@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w63EeJYx000704; Tue, 3 Jul 2018 14:40:19 GMT (envelope-from robak@FreeBSD.org) Message-Id: <201807031440.w63EeJYx000704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: robak set sender to robak@FreeBSD.org using -f From: Bartek Rutkowski Date: Tue, 3 Jul 2018 14:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335890 - in stable/11/lib/libutil: . tests X-SVN-Group: stable-11 X-SVN-Commit-Author: robak X-SVN-Commit-Paths: in stable/11/lib/libutil: . tests X-SVN-Commit-Revision: 335890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2018 14:40:20 -0000 Author: robak (ports committer) Date: Tue Jul 3 14:40:19 2018 New Revision: 335890 URL: https://svnweb.freebsd.org/changeset/base/335890 Log: MFC r327317: humanize_number(3): fix math edge case in rounding large numbers Fix for remainder overflow, when in rare cases adding remainder to divider exceeded 1 and turned the total to 1000 in final formatting, taking up the space for the unit character. The fix continues the division of the original number if the above case happens -- added the appropriate check to the for loop performing the division. This lowers the value shown, to make it fit into the buffer space provided (1.0M for 4+1 character buffer, as used by ls). Add test case for the reported bug and extend test program to support providing buffer length (ls -lh uses 5, tests hard-coded 4). PR: 224498 Modified: stable/11/lib/libutil/humanize_number.3 stable/11/lib/libutil/humanize_number.c stable/11/lib/libutil/tests/humanize_number_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libutil/humanize_number.3 ============================================================================== --- stable/11/lib/libutil/humanize_number.3 Tue Jul 3 14:32:15 2018 (r335889) +++ stable/11/lib/libutil/humanize_number.3 Tue Jul 3 14:40:19 2018 (r335890) @@ -200,3 +200,9 @@ The .Dv HN_IEC_PREFIXES flag was introduced in .Fx 9.0 . +.Sh CAVEATS +For numbers greater than 999 using buffer length of 4 and less can cause +rounding errors. +When using +.Dv HN_IEC_PREFIXES +the same error occurs for buffer length of 5 or less. Modified: stable/11/lib/libutil/humanize_number.c ============================================================================== --- stable/11/lib/libutil/humanize_number.c Tue Jul 3 14:32:15 2018 (r335889) +++ stable/11/lib/libutil/humanize_number.c Tue Jul 3 14:40:19 2018 (r335890) @@ -143,7 +143,8 @@ humanize_number(char *buf, size_t len, int64_t quotien */ for (i = 0; (quotient >= max || (quotient == max - 1 && - remainder >= divisordeccut)) && i < maxscale; i++) { + (remainder >= divisordeccut || remainder >= + divisor / 2))) && i < maxscale; i++) { remainder = quotient % divisor; quotient /= divisor; } Modified: stable/11/lib/libutil/tests/humanize_number_test.c ============================================================================== --- stable/11/lib/libutil/tests/humanize_number_test.c Tue Jul 3 14:32:15 2018 (r335889) +++ stable/11/lib/libutil/tests/humanize_number_test.c Tue Jul 3 14:40:19 2018 (r335890) @@ -49,333 +49,337 @@ static struct { int64_t num; int flags; int scale; + size_t buflen; } test_args[] = { /* tests 0-13 test 1000 suffixes */ - { 2, "0 ", (int64_t)0L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "1 k", (int64_t)500L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "1 M", (int64_t)500*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "1 G", (int64_t)500*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "1 T", (int64_t)500*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "1 P", (int64_t)500*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "1 E", (int64_t)500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 2, "1 ", (int64_t)1L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "2 k", (int64_t)1500L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "2 M", (int64_t)1500*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "2 G", (int64_t)1500*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "2 T", (int64_t)1500*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "2 P", (int64_t)1500*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "2 E", (int64_t)1500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, + { 2, "0 ", (int64_t)0L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "1 k", (int64_t)500L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "1 M", (int64_t)500*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "1 G", (int64_t)500*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "1 T", (int64_t)500*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "1 P", (int64_t)500*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "1 E", (int64_t)500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 2, "1 ", (int64_t)1L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "2 k", (int64_t)1500L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "2 M", (int64_t)1500*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "2 G", (int64_t)1500*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "2 T", (int64_t)1500*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "2 P", (int64_t)1500*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "2 E", (int64_t)1500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, /* tests 14-27 test 1024 suffixes */ - { 2, "0 ", (int64_t)0L, 0, HN_AUTOSCALE }, - { 3, "1 K", (int64_t)512L, 0, HN_AUTOSCALE }, - { 3, "1 M", (int64_t)512*1024L, 0, HN_AUTOSCALE }, - { 3, "1 G", (int64_t)512*1024*1024L, 0, HN_AUTOSCALE }, - { 3, "1 T", (int64_t)512*1024*1024*1024L, 0, HN_AUTOSCALE }, - { 3, "1 P", (int64_t)512*1024*1024*1024*1024L, 0, HN_AUTOSCALE }, - { 3, "1 E", (int64_t)512*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE }, - { 2, "1 ", (int64_t)1L, 0, HN_AUTOSCALE }, - { 3, "2 K", (int64_t)1536L, 0, HN_AUTOSCALE }, - { 3, "2 M", (int64_t)1536*1024L, 0, HN_AUTOSCALE }, - { 3, "2 G", (int64_t)1536*1024*1024L, 0, HN_AUTOSCALE }, - { 3, "2 T", (int64_t)1536*1024*1024*1024L, 0, HN_AUTOSCALE }, - { 3, "2 P", (int64_t)1536*1024*1024*1024*1024L, 0, HN_AUTOSCALE }, - { 3, "2 E", (int64_t)1536*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE }, + { 2, "0 ", (int64_t)0L, 0, HN_AUTOSCALE, 4 }, + { 3, "1 K", (int64_t)512L, 0, HN_AUTOSCALE, 4 }, + { 3, "1 M", (int64_t)512*1024L, 0, HN_AUTOSCALE, 4 }, + { 3, "1 G", (int64_t)512*1024*1024L, 0, HN_AUTOSCALE, 4 }, + { 3, "1 T", (int64_t)512*1024*1024*1024L, 0, HN_AUTOSCALE, 4 }, + { 3, "1 P", (int64_t)512*1024*1024*1024*1024L, 0, HN_AUTOSCALE, 4 }, + { 3, "1 E", (int64_t)512*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE, 4 }, + { 2, "1 ", (int64_t)1L, 0, HN_AUTOSCALE, 4 }, + { 3, "2 K", (int64_t)1536L, 0, HN_AUTOSCALE, 4 }, + { 3, "2 M", (int64_t)1536*1024L, 0, HN_AUTOSCALE, 4 }, + { 3, "2 G", (int64_t)1536*1024*1024L, 0, HN_AUTOSCALE, 4 }, + { 3, "2 T", (int64_t)1536*1024*1024*1024L, 0, HN_AUTOSCALE, 4 }, + { 3, "2 P", (int64_t)1536*1024*1024*1024*1024L, 0, HN_AUTOSCALE, 4 }, + { 3, "2 E", (int64_t)1536*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE, 4 }, /* tests 28-37 test rounding */ - { 3, "0 M", (int64_t)500*1000L-1, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "1 M", (int64_t)500*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "1 M", (int64_t)1000*1000L + 500*1000L-1, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "2 M", (int64_t)1000*1000L + 500*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 3, "0 K", (int64_t)512L-1, 0, HN_AUTOSCALE }, - { 3, "1 K", (int64_t)512L, 0, HN_AUTOSCALE }, - { 3, "0 M", (int64_t)512*1024L-1, 0, HN_AUTOSCALE }, - { 3, "1 M", (int64_t)512*1024L, 0, HN_AUTOSCALE }, - { 3, "1 M", (int64_t)1024*1024L + 512*1024L-1, 0, HN_AUTOSCALE }, - { 3, "2 M", (int64_t)1024*1024L + 512*1024L, 0, HN_AUTOSCALE }, + { 3, "0 M", (int64_t)500*1000L-1, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "1 M", (int64_t)500*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "1 M", (int64_t)1000*1000L + 500*1000L-1, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "2 M", (int64_t)1000*1000L + 500*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 4 }, + { 3, "0 K", (int64_t)512L-1, 0, HN_AUTOSCALE, 4 }, + { 3, "1 K", (int64_t)512L, 0, HN_AUTOSCALE, 4 }, + { 3, "0 M", (int64_t)512*1024L-1, 0, HN_AUTOSCALE, 4 }, + { 3, "1 M", (int64_t)512*1024L, 0, HN_AUTOSCALE, 4 }, + { 3, "1 M", (int64_t)1024*1024L + 512*1024L-1, 0, HN_AUTOSCALE, 4 }, + { 3, "2 M", (int64_t)1024*1024L + 512*1024L, 0, HN_AUTOSCALE, 4 }, /* tests 38-61 test specific scale factors with 1000 divisor */ - { 3, "0 k", (int64_t)0L, HN_DIVISOR_1000, 1 }, - { 3, "1 k", (int64_t)500L, HN_DIVISOR_1000, 1 }, - { 3, "0 M", (int64_t)500L, HN_DIVISOR_1000, 2 }, - { 3, "1 M", (int64_t)500*1000L, HN_DIVISOR_1000, 2 }, - { 3, "0 G", (int64_t)500*1000L, HN_DIVISOR_1000, 3 }, - { 3, "1 G", (int64_t)500*1000*1000L, HN_DIVISOR_1000, 3 }, - { 3, "0 T", (int64_t)500*1000*1000L, HN_DIVISOR_1000, 4 }, - { 3, "1 T", (int64_t)500*1000*1000*1000L, HN_DIVISOR_1000, 4 }, - { 3, "0 P", (int64_t)500*1000*1000*1000L, HN_DIVISOR_1000, 5 }, - { 3, "1 P", (int64_t)500*1000*1000*1000*1000L, HN_DIVISOR_1000, 5 }, - { 3, "0 E", (int64_t)500*1000*1000*1000*1000L, HN_DIVISOR_1000, 6 }, - { 3, "1 E", (int64_t)500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 6 }, - { 3, "0 k", (int64_t)1L, HN_DIVISOR_1000, 1 }, - { 3, "2 k", (int64_t)1500L, HN_DIVISOR_1000, 1 }, - { 3, "0 M", (int64_t)1500L, HN_DIVISOR_1000, 2 }, - { 3, "2 M", (int64_t)1500*1000L, HN_DIVISOR_1000, 2 }, - { 3, "0 G", (int64_t)1500*1000L, HN_DIVISOR_1000, 3 }, - { 3, "2 G", (int64_t)1500*1000*1000L, HN_DIVISOR_1000, 3 }, - { 3, "0 T", (int64_t)1500*1000*1000L, HN_DIVISOR_1000, 4 }, - { 3, "2 T", (int64_t)1500*1000*1000*1000L, HN_DIVISOR_1000, 4 }, - { 3, "0 P", (int64_t)1500*1000*1000*1000L, HN_DIVISOR_1000, 5 }, - { 3, "2 P", (int64_t)1500*1000*1000*1000*1000L, HN_DIVISOR_1000, 5 }, - { 3, "0 E", (int64_t)1500*1000*1000*1000*1000L, HN_DIVISOR_1000, 6 }, - { 3, "2 E", (int64_t)1500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 6 }, + { 3, "0 k", (int64_t)0L, HN_DIVISOR_1000, 1, 4 }, + { 3, "1 k", (int64_t)500L, HN_DIVISOR_1000, 1, 4 }, + { 3, "0 M", (int64_t)500L, HN_DIVISOR_1000, 2, 4 }, + { 3, "1 M", (int64_t)500*1000L, HN_DIVISOR_1000, 2, 4 }, + { 3, "0 G", (int64_t)500*1000L, HN_DIVISOR_1000, 3, 4 }, + { 3, "1 G", (int64_t)500*1000*1000L, HN_DIVISOR_1000, 3, 4 }, + { 3, "0 T", (int64_t)500*1000*1000L, HN_DIVISOR_1000, 4, 4 }, + { 3, "1 T", (int64_t)500*1000*1000*1000L, HN_DIVISOR_1000, 4, 4 }, + { 3, "0 P", (int64_t)500*1000*1000*1000L, HN_DIVISOR_1000, 5, 4 }, + { 3, "1 P", (int64_t)500*1000*1000*1000*1000L, HN_DIVISOR_1000, 5, 4 }, + { 3, "0 E", (int64_t)500*1000*1000*1000*1000L, HN_DIVISOR_1000, 6, 4 }, + { 3, "1 E", (int64_t)500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 6, 4 }, + { 3, "0 k", (int64_t)1L, HN_DIVISOR_1000, 1, 4 }, + { 3, "2 k", (int64_t)1500L, HN_DIVISOR_1000, 1, 4 }, + { 3, "0 M", (int64_t)1500L, HN_DIVISOR_1000, 2, 4 }, + { 3, "2 M", (int64_t)1500*1000L, HN_DIVISOR_1000, 2, 4 }, + { 3, "0 G", (int64_t)1500*1000L, HN_DIVISOR_1000, 3, 4 }, + { 3, "2 G", (int64_t)1500*1000*1000L, HN_DIVISOR_1000, 3, 4 }, + { 3, "0 T", (int64_t)1500*1000*1000L, HN_DIVISOR_1000, 4, 4 }, + { 3, "2 T", (int64_t)1500*1000*1000*1000L, HN_DIVISOR_1000, 4, 4 }, + { 3, "0 P", (int64_t)1500*1000*1000*1000L, HN_DIVISOR_1000, 5, 4 }, + { 3, "2 P", (int64_t)1500*1000*1000*1000*1000L, HN_DIVISOR_1000, 5, 4 }, + { 3, "0 E", (int64_t)1500*1000*1000*1000*1000L, HN_DIVISOR_1000, 6, 4 }, + { 3, "2 E", (int64_t)1500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 6, 4 }, /* tests 62-85 test specific scale factors with 1024 divisor */ - { 3, "0 K", (int64_t)0L, 0, 1 }, - { 3, "1 K", (int64_t)512L, 0, 1 }, - { 3, "0 M", (int64_t)512L, 0, 2 }, - { 3, "1 M", (int64_t)512*1024L, 0, 2 }, - { 3, "0 G", (int64_t)512*1024L, 0, 3 }, - { 3, "1 G", (int64_t)512*1024*1024L, 0, 3 }, - { 3, "0 T", (int64_t)512*1024*1024L, 0, 4 }, - { 3, "1 T", (int64_t)512*1024*1024*1024L, 0, 4 }, - { 3, "0 P", (int64_t)512*1024*1024*1024L, 0, 5 }, - { 3, "1 P", (int64_t)512*1024*1024*1024*1024L, 0, 5 }, - { 3, "0 E", (int64_t)512*1024*1024*1024*1024L, 0, 6 }, - { 3, "1 E", (int64_t)512*1024*1024*1024*1024*1024L, 0, 6 }, - { 3, "0 K", (int64_t)1L, 0, 1 }, - { 3, "2 K", (int64_t)1536L, 0, 1 }, - { 3, "0 M", (int64_t)1536L, 0, 2 }, - { 3, "2 M", (int64_t)1536*1024L, 0, 2 }, - { 3, "0 G", (int64_t)1536*1024L, 0, 3 }, - { 3, "2 G", (int64_t)1536*1024*1024L, 0, 3 }, - { 3, "0 T", (int64_t)1536*1024*1024L, 0, 4 }, - { 3, "2 T", (int64_t)1536*1024*1024*1024L, 0, 4 }, - { 3, "0 P", (int64_t)1536*1024*1024*1024L, 0, 5 }, - { 3, "2 P", (int64_t)1536*1024*1024*1024*1024L, 0, 5 }, - { 3, "0 E", (int64_t)1536*1024*1024*1024*1024L, 0, 6 }, - { 3, "2 E", (int64_t)1536*1024*1024*1024*1024*1024L, 0, 6 }, + { 3, "0 K", (int64_t)0L, 0, 1, 4 }, + { 3, "1 K", (int64_t)512L, 0, 1, 4 }, + { 3, "0 M", (int64_t)512L, 0, 2, 4 }, + { 3, "1 M", (int64_t)512*1024L, 0, 2, 4 }, + { 3, "0 G", (int64_t)512*1024L, 0, 3, 4 }, + { 3, "1 G", (int64_t)512*1024*1024L, 0, 3, 4 }, + { 3, "0 T", (int64_t)512*1024*1024L, 0, 4, 4 }, + { 3, "1 T", (int64_t)512*1024*1024*1024L, 0, 4, 4 }, + { 3, "0 P", (int64_t)512*1024*1024*1024L, 0, 5, 4 }, + { 3, "1 P", (int64_t)512*1024*1024*1024*1024L, 0, 5, 4 }, + { 3, "0 E", (int64_t)512*1024*1024*1024*1024L, 0, 6, 4 }, + { 3, "1 E", (int64_t)512*1024*1024*1024*1024*1024L, 0, 6, 4 }, + { 3, "0 K", (int64_t)1L, 0, 1, 4 }, + { 3, "2 K", (int64_t)1536L, 0, 1, 4 }, + { 3, "0 M", (int64_t)1536L, 0, 2, 4 }, + { 3, "2 M", (int64_t)1536*1024L, 0, 2, 4 }, + { 3, "0 G", (int64_t)1536*1024L, 0, 3, 4 }, + { 3, "2 G", (int64_t)1536*1024*1024L, 0, 3, 4 }, + { 3, "0 T", (int64_t)1536*1024*1024L, 0, 4, 4 }, + { 3, "2 T", (int64_t)1536*1024*1024*1024L, 0, 4, 4 }, + { 3, "0 P", (int64_t)1536*1024*1024*1024L, 0, 5, 4 }, + { 3, "2 P", (int64_t)1536*1024*1024*1024*1024L, 0, 5, 4 }, + { 3, "0 E", (int64_t)1536*1024*1024*1024*1024L, 0, 6, 4 }, + { 3, "2 E", (int64_t)1536*1024*1024*1024*1024*1024L, 0, 6, 4 }, /* tests 86-99 test invalid specific scale values of < 0 or >= 7 with and without HN_DIVISOR_1000 set */ /* all should return errors with new code; with old, the latter 3 are instead processed as if having AUTOSCALE and/or GETSCALE set */ - { -1, "", (int64_t)1L, 0, 7 }, - { -1, "", (int64_t)1L, HN_DIVISOR_1000, 7 }, - { -1, "", (int64_t)1L, 0, 1000 }, - { -1, "", (int64_t)1L, HN_DIVISOR_1000, 1000 }, - { -1, "", (int64_t)0L, 0, 1000*1000 }, - { -1, "", (int64_t)0L, HN_DIVISOR_1000, 1000*1000 }, - { -1, "", (int64_t)0L, 0, INT_MAX }, - { -1, "", (int64_t)0L, HN_DIVISOR_1000, INT_MAX }, + { -1, "", (int64_t)1L, 0, 7, 4 }, + { -1, "", (int64_t)1L, HN_DIVISOR_1000, 7, 4 }, + { -1, "", (int64_t)1L, 0, 1000, 4 }, + { -1, "", (int64_t)1L, HN_DIVISOR_1000, 1000, 4 }, + { -1, "", (int64_t)0L, 0, 1000*1000, 4 }, + { -1, "", (int64_t)0L, HN_DIVISOR_1000, 1000*1000, 4 }, + { -1, "", (int64_t)0L, 0, INT_MAX, 4 }, + { -1, "", (int64_t)0L, HN_DIVISOR_1000, INT_MAX, 4 }, /* Negative scale values are not handled well by the existing library routine - should report as error */ /* all should return errors with new code, fail assertion with old */ - { -1, "", (int64_t)1L, 0, -1 }, - { -1, "", (int64_t)1L, HN_DIVISOR_1000, -1 }, - { -1, "", (int64_t)1L, 0, -1000 }, - { -1, "", (int64_t)1L, HN_DIVISOR_1000, -1000 }, + { -1, "", (int64_t)1L, 0, -1, 4 }, + { -1, "", (int64_t)1L, HN_DIVISOR_1000, -1, 4 }, + { -1, "", (int64_t)1L, 0, -1000, 4 }, + { -1, "", (int64_t)1L, HN_DIVISOR_1000, -1000, 4 }, /* __INT_MIN doesn't print properly, skipped. */ - { -1, "", (int64_t)1L, 0, -__INT_MAX }, - { -1, "", (int64_t)1L, HN_DIVISOR_1000, -__INT_MAX }, + { -1, "", (int64_t)1L, 0, -__INT_MAX, 4 }, + { -1, "", (int64_t)1L, HN_DIVISOR_1000, -__INT_MAX, 4 }, /* tests for scale == 0, without autoscale */ /* tests 100-114 test scale 0 with 1000 divisor - print first N digits */ - { 2, "0 ", (int64_t)0L, HN_DIVISOR_1000, 0 }, - { 2, "1 ", (int64_t)1L, HN_DIVISOR_1000, 0 }, - { 3, "10 ", (int64_t)10L, HN_DIVISOR_1000, 0 }, - { 3, "0 M", (int64_t)150L, HN_DIVISOR_1000, HN_NOSPACE }, - { 3, "0 M", (int64_t)500L, HN_DIVISOR_1000, HN_NOSPACE }, - { 3, "0 M", (int64_t)999L, HN_DIVISOR_1000, HN_NOSPACE }, - { 4, "150", (int64_t)150L, HN_DIVISOR_1000, 0 }, - { 4, "500", (int64_t)500L, HN_DIVISOR_1000, 0 }, - { 4, "999", (int64_t)999L, HN_DIVISOR_1000, 0 }, - { 5, "100", (int64_t)1000L, HN_DIVISOR_1000, 0 }, - { 5, "150", (int64_t)1500L, HN_DIVISOR_1000, 0 }, - { 7, "500", (int64_t)500*1000L, HN_DIVISOR_1000, 0 }, - { 8, "150", (int64_t)1500*1000L, HN_DIVISOR_1000, 0 }, - { 10, "500", (int64_t)500*1000*1000L, HN_DIVISOR_1000, 0 }, - { 11, "150", (int64_t)1500*1000*1000L, HN_DIVISOR_1000, 0 }, + { 2, "0 ", (int64_t)0L, HN_DIVISOR_1000, 0, 4 }, + { 2, "1 ", (int64_t)1L, HN_DIVISOR_1000, 0, 4 }, + { 3, "10 ", (int64_t)10L, HN_DIVISOR_1000, 0, 4 }, + { 3, "0 M", (int64_t)150L, HN_DIVISOR_1000, HN_NOSPACE, 4 }, + { 3, "0 M", (int64_t)500L, HN_DIVISOR_1000, HN_NOSPACE, 4 }, + { 3, "0 M", (int64_t)999L, HN_DIVISOR_1000, HN_NOSPACE, 4 }, + { 4, "150", (int64_t)150L, HN_DIVISOR_1000, 0, 4 }, + { 4, "500", (int64_t)500L, HN_DIVISOR_1000, 0, 4 }, + { 4, "999", (int64_t)999L, HN_DIVISOR_1000, 0, 4 }, + { 5, "100", (int64_t)1000L, HN_DIVISOR_1000, 0, 4 }, + { 5, "150", (int64_t)1500L, HN_DIVISOR_1000, 0, 4 }, + { 7, "500", (int64_t)500*1000L, HN_DIVISOR_1000, 0, 4 }, + { 8, "150", (int64_t)1500*1000L, HN_DIVISOR_1000, 0, 4 }, + { 10, "500", (int64_t)500*1000*1000L, HN_DIVISOR_1000, 0, 4 }, + { 11, "150", (int64_t)1500*1000*1000L, HN_DIVISOR_1000, 0, 4 }, /* tests 115-126 test scale 0 with 1024 divisor - print first N digits */ - { 2, "0 ", (int64_t)0L, 0, 0 }, - { 2, "1 ", (int64_t)1L, 0, 0 }, - { 3, "10 ", (int64_t)10L, 0, 0 }, - { 4, "150", (int64_t)150L, 0, 0 }, - { 4, "500", (int64_t)500L, 0, 0 }, - { 4, "999", (int64_t)999L, 0, 0 }, - { 5, "100", (int64_t)1000L, 0, 0 }, - { 5, "150", (int64_t)1500L, 0, 0 }, - { 7, "500", (int64_t)500*1000L, 0, 0 }, - { 8, "150", (int64_t)1500*1000L, 0, 0 }, - { 10, "500", (int64_t)500*1000*1000L, 0, 0 }, - { 11, "150", (int64_t)1500*1000*1000L, 0, 0 }, + { 2, "0 ", (int64_t)0L, 0, 0, 4 }, + { 2, "1 ", (int64_t)1L, 0, 0, 4 }, + { 3, "10 ", (int64_t)10L, 0, 0, 4 }, + { 4, "150", (int64_t)150L, 0, 0, 4 }, + { 4, "500", (int64_t)500L, 0, 0, 4 }, + { 4, "999", (int64_t)999L, 0, 0, 4 }, + { 5, "100", (int64_t)1000L, 0, 0, 4 }, + { 5, "150", (int64_t)1500L, 0, 0, 4 }, + { 7, "500", (int64_t)500*1000L, 0, 0, 4 }, + { 8, "150", (int64_t)1500*1000L, 0, 0, 4 }, + { 10, "500", (int64_t)500*1000*1000L, 0, 0, 4 }, + { 11, "150", (int64_t)1500*1000*1000L, 0, 0, 4 }, + /* Test case for rounding of edge numbers around 999.5+, see PR224498. + * Require buflen >= 5 */ + { 4, "1.0M", (int64_t)1023500, HN_DECIMAL|HN_B|HN_NOSPACE, HN_AUTOSCALE, 5 }, + /* Test boundary cases for very large positive/negative number formatting */ /* Explicit scale, divisor 1024 */ - /* XXX = requires length 5 (buflen 6) for some cases*/ - /* KLUDGE - test loop below will bump length 5 up to 5 */ - { 3, "8 E", INT64_MAX, 0, 6 }, - { 4, "-8 E", -INT64_MAX, 0, 6 }, - { 3, "0 E", (int64_t)92*1024*1024*1024*1024*1024L, 0, 6 }, - { 3, "0 E", -(int64_t)92*1024*1024*1024*1024*1024L, 0, 6 }, - { 3, "0 E", (int64_t)82*1024*1024*1024*1024*1024L, 0, 6 }, - { 3, "0 E", -(int64_t)82*1024*1024*1024*1024*1024L, 0, 6 }, - { 3, "0 E", (int64_t)81*1024*1024*1024*1024*1024L, 0, 6 }, - { 3, "0 E", -(int64_t)81*1024*1024*1024*1024*1024L, 0, 6 }, - { 4, "92 P", (int64_t)92*1024*1024*1024*1024*1024L, 0, 5 }, - { 5, "-92 P", -(int64_t)92*1024*1024*1024*1024*1024L, 0, 5 }, - { 4, "82 P", (int64_t)82*1024*1024*1024*1024*1024L, 0, 5 }, - { 5, "-82 P", -(int64_t)82*1024*1024*1024*1024*1024L, 0, 5 }, - { 4, "81 P", (int64_t)81*1024*1024*1024*1024*1024L, 0, 5 }, - { 5, "-81 P", -(int64_t)81*1024*1024*1024*1024*1024L, 0, 5 }, + /* Requires buflen >= 6 */ + { 3, "8 E", INT64_MAX, 0, 6, 6 }, + { 4, "-8 E", -INT64_MAX, 0, 6, 6 }, + { 3, "0 E", (int64_t)92*1024*1024*1024*1024*1024L, 0, 6, 6 }, + { 3, "0 E", -(int64_t)92*1024*1024*1024*1024*1024L, 0, 6, 6 }, + { 3, "0 E", (int64_t)82*1024*1024*1024*1024*1024L, 0, 6, 6 }, + { 3, "0 E", -(int64_t)82*1024*1024*1024*1024*1024L, 0, 6, 6 }, + { 3, "0 E", (int64_t)81*1024*1024*1024*1024*1024L, 0, 6, 6 }, + { 3, "0 E", -(int64_t)81*1024*1024*1024*1024*1024L, 0, 6, 6 }, + { 4, "92 P", (int64_t)92*1024*1024*1024*1024*1024L, 0, 5, 6 }, + { 5, "-92 P", -(int64_t)92*1024*1024*1024*1024*1024L, 0, 5, 6 }, + { 4, "82 P", (int64_t)82*1024*1024*1024*1024*1024L, 0, 5, 6 }, + { 5, "-82 P", -(int64_t)82*1024*1024*1024*1024*1024L, 0, 5, 6 }, + { 4, "81 P", (int64_t)81*1024*1024*1024*1024*1024L, 0, 5, 6 }, + { 5, "-81 P", -(int64_t)81*1024*1024*1024*1024*1024L, 0, 5, 6 }, /* Explicit scale, divisor 1000 */ - { 3, "9 E", INT64_MAX, HN_DIVISOR_1000, 6 }, - { 4, "-9 E", -INT64_MAX, HN_DIVISOR_1000, 6 }, - { 3, "0 E", (int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 6 }, - { 3, "0 E", -(int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 6 }, - { 3, "0 E", (int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 6 }, - { 3, "0 E", -(int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 6 }, - { 4, "92 P", (int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 5 }, - { 5, "-92 P", -(int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 5 }, - { 4, "91 P", (int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 5 }, - { 5, "-91 P", -(int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 5 }, + { 3, "9 E", INT64_MAX, HN_DIVISOR_1000, 6, 6 }, + { 4, "-9 E", -INT64_MAX, HN_DIVISOR_1000, 6, 6 }, + { 3, "0 E", (int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 6, 6 }, + { 3, "0 E", -(int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 6, 6 }, + { 3, "0 E", (int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 6, 6 }, + { 3, "0 E", -(int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 6, 6 }, + { 4, "92 P", (int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 5, 6 }, + { 5, "-92 P", -(int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 5, 6 }, + { 4, "91 P", (int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 5, 6 }, + { 5, "-91 P", -(int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 5, 6 }, /* Autoscale, divisor 1024 */ - { 3, "8 E", INT64_MAX, 0, HN_AUTOSCALE }, - { 4, "-8 E", -INT64_MAX, 0, HN_AUTOSCALE }, - { 4, "92 P", (int64_t)92*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE }, - { 5, "-92 P", -(int64_t)92*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE }, - { 4, "82 P", (int64_t)82*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE }, - { 5, "-82 P", -(int64_t)82*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE }, - { 4, "81 P", (int64_t)81*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE }, - { 5, "-81 P", -(int64_t)81*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE }, + { 3, "8 E", INT64_MAX, 0, HN_AUTOSCALE, 6 }, + { 4, "-8 E", -INT64_MAX, 0, HN_AUTOSCALE, 6 }, + { 4, "92 P", (int64_t)92*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE, 6 }, + { 5, "-92 P", -(int64_t)92*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE, 6 }, + { 4, "82 P", (int64_t)82*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE, 6 }, + { 5, "-82 P", -(int64_t)82*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE, 6 }, + { 4, "81 P", (int64_t)81*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE, 6 }, + { 5, "-81 P", -(int64_t)81*1024*1024*1024*1024*1024L, 0, HN_AUTOSCALE, 6 }, /* Autoscale, divisor 1000 */ - { 3, "9 E", INT64_MAX, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 4, "-9 E", -INT64_MAX, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 4, "92 P", (int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "-92 P", -(int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 4, "91 P", (int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "-91 P", -(int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, HN_AUTOSCALE }, + { 3, "9 E", INT64_MAX, HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 4, "-9 E", -INT64_MAX, HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 4, "92 P", (int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "-92 P", -(int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 4, "91 P", (int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "-91 P", -(int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, /* 0 scale, divisor 1024 */ - { 12, "skdj", INT64_MAX, 0, 0 }, - { 21, "-9223", -INT64_MAX, 0, 0 }, - { 19, "10358", (int64_t)92*1024*1024*1024*1024*1024L, 0, 0 }, - { 20, "-1035", -(int64_t)92*1024*1024*1024*1024*1024L, 0, 0 }, - { 18, "92323", (int64_t)82*1024*1024*1024*1024*1024L, 0, 0 }, - { 19, "-9232", -(int64_t)82*1024*1024*1024*1024*1024L, 0, 0 }, - { 18, "91197", (int64_t)81*1024*1024*1024*1024*1024L, 0, 0 }, - { 19, "-9119", -(int64_t)81*1024*1024*1024*1024*1024L, 0, 0 }, + { 12, "skdj", INT64_MAX, 0, 0, 6 }, + { 21, "-9223", -INT64_MAX, 0, 0, 6 }, + { 19, "10358", (int64_t)92*1024*1024*1024*1024*1024L, 0, 0, 6 }, + { 20, "-1035", -(int64_t)92*1024*1024*1024*1024*1024L, 0, 0, 6 }, + { 18, "92323", (int64_t)82*1024*1024*1024*1024*1024L, 0, 0, 6 }, + { 19, "-9232", -(int64_t)82*1024*1024*1024*1024*1024L, 0, 0, 6 }, + { 18, "91197", (int64_t)81*1024*1024*1024*1024*1024L, 0, 0, 6 }, + { 19, "-9119", -(int64_t)81*1024*1024*1024*1024*1024L, 0, 0, 6 }, /* 0 scale, divisor 1000 */ /* XXX - why does this fail? */ - { -1, "", INT64_MAX, HN_DIVISOR_1000, 0 }, - { 21, "-9223", -INT64_MAX, HN_DIVISOR_1000, 0 }, - { 19, "10358", (int64_t)92*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0 }, - { 20, "-1035", -(int64_t)92*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0 }, - { 18, "92323", (int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0 }, - { 19, "-9232", -(int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0 }, + { -1, "", INT64_MAX, HN_DIVISOR_1000, 0, 6 }, + { 21, "-9223", -INT64_MAX, HN_DIVISOR_1000, 0, 6 }, + { 19, "10358", (int64_t)92*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0, 6 }, + { 20, "-1035", -(int64_t)92*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0, 6 }, + { 18, "92323", (int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0, 6 }, + { 19, "-9232", -(int64_t)82*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0, 6 }, /* Expected to pass */ - { 18, "91197", (int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0 }, - { 19, "-9119", -(int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0 }, + { 18, "91197", (int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0, 6 }, + { 19, "-9119", -(int64_t)81*1024*1024*1024*1024*1024L, HN_DIVISOR_1000, 0, 6 }, /* Need to implement tests for GETSCALE */ -/* { ?, "", (int64_t)0L, HN_DIVISOR_1000, HN_GETSCALE }, +/* { ?, "", (int64_t)0L, HN_DIVISOR_1000, HN_GETSCALE, 6 }, ... */ /* Tests for HN_DECIMAL */ /* Positive, Autoscale */ - { 5, "500 k", (int64_t)500*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "994 k", (int64_t)994*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "995 k", (int64_t)995*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "999 k", (int64_t)999*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "1.0 M", (int64_t)1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "1.5 M", (int64_t)1500*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "1.9 M", (int64_t)1949*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "2.0 M", (int64_t)1950*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "9.9 M", (int64_t)9949*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 4, "10 M", (int64_t)9950*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "500 M", (int64_t)500*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "994 M", (int64_t)994*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "995 M", (int64_t)995*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "999 M", (int64_t)999*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, + { 5, "500 k", (int64_t)500*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "994 k", (int64_t)994*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "995 k", (int64_t)995*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "999 k", (int64_t)999*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "1.0 M", (int64_t)1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "1.5 M", (int64_t)1500*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "1.9 M", (int64_t)1949*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "2.0 M", (int64_t)1950*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "9.9 M", (int64_t)9949*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 4, "10 M", (int64_t)9950*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "500 M", (int64_t)500*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "994 M", (int64_t)994*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "995 M", (int64_t)995*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "999 M", (int64_t)999*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, - { 5, "500 K", (int64_t)500*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "994 K", (int64_t)994*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "995 K", (int64_t)995*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "999 K", (int64_t)999*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "1.0 M", (int64_t)1000*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "1.0 M", (int64_t)1018*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "1.0 M", (int64_t)1019*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "1.5 M", (int64_t)1536*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "1.9 M", (int64_t)1996*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "2.0 M", (int64_t)1997*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "2.0 M", (int64_t)2047*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "2.0 M", (int64_t)2048*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "2.0 M", (int64_t)2099*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "2.1 M", (int64_t)2100*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "9.9 M", (int64_t)10188*1024L, HN_DECIMAL, HN_AUTOSCALE }, + { 5, "500 K", (int64_t)500*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "994 K", (int64_t)994*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "995 K", (int64_t)995*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "999 K", (int64_t)999*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "1.0 M", (int64_t)1000*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "1.0 M", (int64_t)1018*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "1.0 M", (int64_t)1019*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "1.5 M", (int64_t)1536*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "1.9 M", (int64_t)1996*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "2.0 M", (int64_t)1997*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "2.0 M", (int64_t)2047*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "2.0 M", (int64_t)2048*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "2.0 M", (int64_t)2099*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "2.1 M", (int64_t)2100*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "9.9 M", (int64_t)10188*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, /* XXX - shouldn't the following two be "10. M"? */ - { 4, "10 M", (int64_t)10189*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 4, "10 M", (int64_t)10240*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "500 M", (int64_t)500*1024*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "994 M", (int64_t)994*1024*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "995 M", (int64_t)995*1024*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "999 M", (int64_t)999*1024*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "1.0 G", (int64_t)1000*1024*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "1.0 G", (int64_t)1023*1024*1024L, HN_DECIMAL, HN_AUTOSCALE }, + { 4, "10 M", (int64_t)10189*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 4, "10 M", (int64_t)10240*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "500 M", (int64_t)500*1024*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "994 M", (int64_t)994*1024*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "995 M", (int64_t)995*1024*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "999 M", (int64_t)999*1024*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "1.0 G", (int64_t)1000*1024*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "1.0 G", (int64_t)1023*1024*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, /* Negative, Autoscale - should pass */ - { 6, "-1.5 ", -(int64_t)1500*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 6, "-1.9 ", -(int64_t)1949*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 6, "-9.9 ", -(int64_t)9949*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, + { 6, "-1.5 ", -(int64_t)1500*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 6, "-1.9 ", -(int64_t)1949*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 6, "-9.9 ", -(int64_t)9949*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, - { 6, "-1.5 ", -(int64_t)1536*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 6, "-1.9 ", -(int64_t)1949*1024L, HN_DECIMAL, HN_AUTOSCALE }, - { 6, "-9.7 ", -(int64_t)9949*1024L, HN_DECIMAL, HN_AUTOSCALE }, + { 6, "-1.5 ", -(int64_t)1536*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 6, "-1.9 ", -(int64_t)1949*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 6, "-9.7 ", -(int64_t)9949*1024L, HN_DECIMAL, HN_AUTOSCALE, 6 }, /* Positive/negative, at maximum scale */ - { 5, "500 P", (int64_t)500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "1.9 E", (int64_t)1949*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "8.9 E", (int64_t)8949*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE }, - { 5, "9.2 E", INT64_MAX, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, + { 5, "500 P", (int64_t)500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "1.9 E", (int64_t)1949*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "8.9 E", (int64_t)8949*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 5, "9.2 E", INT64_MAX, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, /* Negatives work with latest rev only: */ - { 6, "-9.2 ", -INT64_MAX, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, - { 6, "-8.9 ", -(int64_t)8949*1000*1000*1000*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE }, + { 6, "-9.2 ", -INT64_MAX, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, + { 6, "-8.9 ", -(int64_t)8949*1000*1000*1000*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, HN_AUTOSCALE, 6 }, - { 5, "8.0 E", INT64_MAX, HN_DECIMAL, HN_AUTOSCALE }, - { 5, "7.9 E", INT64_MAX-(int64_t)100*1024*1024*1024*1024*1024LL, HN_DECIMAL, HN_AUTOSCALE }, - { 6, "-8.0 ", -INT64_MAX, HN_DECIMAL, HN_AUTOSCALE }, - { 6, "-7.9 ", -INT64_MAX+(int64_t)100*1024*1024*1024*1024*1024LL, HN_DECIMAL, HN_AUTOSCALE }, + { 5, "8.0 E", INT64_MAX, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 5, "7.9 E", INT64_MAX-(int64_t)100*1024*1024*1024*1024*1024LL, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 6, "-8.0 ", -INT64_MAX, HN_DECIMAL, HN_AUTOSCALE, 6 }, + { 6, "-7.9 ", -INT64_MAX+(int64_t)100*1024*1024*1024*1024*1024LL, HN_DECIMAL, HN_AUTOSCALE, 6 }, /* Positive, Fixed scales */ - { 5, "500 k", (int64_t)500*1000L, HN_DECIMAL|HN_DIVISOR_1000, 1 }, - { 5, "0.5 M", (int64_t)500*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2 }, - { 5, "949 k", (int64_t)949*1000L, HN_DECIMAL|HN_DIVISOR_1000, 1 }, - { 5, "0.9 M", (int64_t)949*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2 }, - { 5, "950 k", (int64_t)950*1000L, HN_DECIMAL|HN_DIVISOR_1000, 1 }, - { 5, "1.0 M", (int64_t)950*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2 }, - { 5, "999 k", (int64_t)999*1000L, HN_DECIMAL|HN_DIVISOR_1000, 1 }, - { 5, "1.0 M", (int64_t)999*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2 }, - { 5, "1.5 M", (int64_t)1500*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2 }, - { 5, "1.9 M", (int64_t)1949*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2 }, - { 5, "2.0 M", (int64_t)1950*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2 }, - { 5, "9.9 M", (int64_t)9949*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2 }, - { 4, "10 M", (int64_t)9950*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2 }, - { 5, "500 M", (int64_t)500*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2 }, - { 5, "0.5 G", (int64_t)500*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, 3 }, - { 5, "999 M", (int64_t)999*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2 }, - { 5, "1.0 G", (int64_t)999*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, 3 }, + { 5, "500 k", (int64_t)500*1000L, HN_DECIMAL|HN_DIVISOR_1000, 1, 6 }, + { 5, "0.5 M", (int64_t)500*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2, 6 }, + { 5, "949 k", (int64_t)949*1000L, HN_DECIMAL|HN_DIVISOR_1000, 1, 6 }, + { 5, "0.9 M", (int64_t)949*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2, 6 }, + { 5, "950 k", (int64_t)950*1000L, HN_DECIMAL|HN_DIVISOR_1000, 1, 6 }, + { 5, "1.0 M", (int64_t)950*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2, 6 }, + { 5, "999 k", (int64_t)999*1000L, HN_DECIMAL|HN_DIVISOR_1000, 1, 6 }, + { 5, "1.0 M", (int64_t)999*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2, 6 }, + { 5, "1.5 M", (int64_t)1500*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2, 6 }, + { 5, "1.9 M", (int64_t)1949*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2, 6 }, + { 5, "2.0 M", (int64_t)1950*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2, 6 }, + { 5, "9.9 M", (int64_t)9949*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2, 6 }, + { 4, "10 M", (int64_t)9950*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2, 6 }, + { 5, "500 M", (int64_t)500*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2, 6 }, + { 5, "0.5 G", (int64_t)500*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, 3, 6 }, + { 5, "999 M", (int64_t)999*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, 2, 6 }, + { 5, "1.0 G", (int64_t)999*1000*1000L, HN_DECIMAL|HN_DIVISOR_1000, 3, 6 }, /* Positive/negative, at maximum scale */ - { 5, "500 P", (int64_t)500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 5 }, - { 5, "1.0 E", (int64_t)500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 6 }, - { 5, "1.9 E", (int64_t)1949*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 6 }, - { 5, "8.9 E", (int64_t)8949*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 6 }, - { 5, "9.2 E", INT64_MAX, HN_DECIMAL|HN_DIVISOR_1000, 6 }, + { 5, "500 P", (int64_t)500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 5, 6 }, + { 5, "1.0 E", (int64_t)500*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 6, 6 }, + { 5, "1.9 E", (int64_t)1949*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 6, 6 }, + { 5, "8.9 E", (int64_t)8949*1000*1000*1000*1000*1000L, HN_DIVISOR_1000, 6, 6 }, + { 5, "9.2 E", INT64_MAX, HN_DECIMAL|HN_DIVISOR_1000, 6, 6 }, /* HN_DECIMAL + binary + fixed scale cases not completed */ - { 5, "512 K", (int64_t)512*1024L, HN_DECIMAL, 1 }, - { 5, "0.5 M", (int64_t)512*1024L, HN_DECIMAL, 2 }, + { 5, "512 K", (int64_t)512*1024L, HN_DECIMAL, 1, 6 }, + { 5, "0.5 M", (int64_t)512*1024L, HN_DECIMAL, 2, 6 }, /* Negative, Fixed scales */ /* Not yet added, but should work with latest rev */ @@ -439,9 +443,9 @@ static struct { } flags[] = { { HN_AUTOSCALE, "HN_AUTOSCALE" }, { HN_GETSCALE, "HN_GETSCALE" }, - { HN_DIVISOR_1000, "HN_DIVISOR_1000"}, - { HN_B, "HN_B"}, - { HN_DECIMAL, "HN_DECIMAL"}, + { HN_DIVISOR_1000, "HN_DIVISOR_1000" }, + { HN_B, "HN_B" }, + { HN_DECIMAL, "HN_DECIMAL" }, }; static const char *separator = "|"; @@ -496,13 +500,14 @@ main(int argc, char * const argv[]) { char *buf; char *flag_str, *scale_str; - size_t buflen, errcnt, i, skipped, tested; + size_t blen, buflen, errcnt, i, skipped, tested; int r; int includeNegScale; int includeExabyteTests; int verbose; - buflen = 4; + buf = NULL; + buflen = 0; includeNegScale = 0; includeExabyteTests = 0; verbose = 0; @@ -510,7 +515,6 @@ main(int argc, char * const argv[]) read_options(argc, argv, &buflen, &includeNegScale, &includeExabyteTests, &verbose); - buf = malloc(buflen); errcnt = 0; tested = 0; skipped = 0; @@ -520,16 +524,8 @@ main(int argc, char * const argv[]) printf("1..%zu\n", nitems(test_args)); for (i = 0; i < nitems(test_args); i++) { - /* KLUDGE */ - if (test_args[i].num == INT64_MAX && buflen == 4) { - /* Start final tests which require buffer of 6 */ - free(buf); - buflen = 6; - buf = malloc(buflen); - if (verbose) - printf("Buffer length increased to %zu\n", - buflen); - } + blen = (buflen > 0) ? buflen : test_args[i].buflen; + buf = realloc(buf, blen); if (test_args[i].scale < 0 && ! includeNegScale) { skipped++; @@ -542,7 +538,7 @@ main(int argc, char * const argv[]) continue; } - r = humanize_number(buf, buflen, test_args[i].num, "", + r = humanize_number(buf, blen, test_args[i].num, "", test_args[i].scale, test_args[i].flags); flag_str = str_flags(test_args[i].flags, "[no flags]"); scale_str = str_scale(test_args[i].scale); @@ -553,7 +549,7 @@ main(int argc, char * const argv[]) "buflen: %zu, got: %d + \"%s\", " "expected %d + \"%s\"; num = %jd, " "scale = %s, flags= %s.\n", - i, buflen, r, buf, test_args[i].retval, + i, blen, r, buf, test_args[i].retval, test_args[i].res, (intmax_t)test_args[i].num, scale_str, flag_str); @@ -565,10 +561,10 @@ main(int argc, char * const argv[]) if (verbose) printf("result mismatch on index %zu, got: " "\"%s\", expected \"%s\"; num = %jd, " - "scale = %s, flags= %s.\n", + "buflen: %zu, scale = %s, flags= %s.\n", i, buf, test_args[i].res, (intmax_t)test_args[i].num, - scale_str, flag_str); + blen, scale_str, flag_str); else printf("not ok %zu # buf \"%s\" != \"%s\"\n", i + 1, buf, test_args[i].res); @@ -577,15 +573,15 @@ main(int argc, char * const argv[]) if (verbose) printf("successful result on index %zu, " "returned %d, got: \"%s\"; num = %jd, " - "scale = %s, flags= %s.\n", - i, r, buf, - (intmax_t)test_args[i].num, - scale_str, flag_str); + "buflen = %zd, scale = %s, flags= %s.\n", + i, r, buf, (intmax_t)test_args[i].num, + blen, scale_str, flag_str); else printf("ok %zu\n", i + 1); } tested++; } + free(buf); if (verbose) printf("total errors: %zu/%zu tests, %zu skipped\n", errcnt, From owner-svn-src-stable-11@freebsd.org Wed Jul 4 03:22:45 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 948C71026E85; Wed, 4 Jul 2018 03:22:45 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4684181AD7; Wed, 4 Jul 2018 03:22:45 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 279AC25468; Wed, 4 Jul 2018 03:22:45 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w643Mj36096716; Wed, 4 Jul 2018 03:22:45 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w643Mjrn096715; Wed, 4 Jul 2018 03:22:45 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201807040322.w643Mjrn096715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Wed, 4 Jul 2018 03:22:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335926 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 335926 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 03:22:45 -0000 Author: dteske Date: Wed Jul 4 03:22:44 2018 New Revision: 335926 URL: https://svnweb.freebsd.org/changeset/base/335926 Log: MFC SVN r335750: Fix typo in top-level Makefile Submitted by: Ben Widawsky Sponsored by: Smule, Inc. Differential Revision: https://reviews.freebsd.org/P186 Modified: stable/11/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile ============================================================================== --- stable/11/Makefile Wed Jul 4 03:02:53 2018 (r335925) +++ stable/11/Makefile Wed Jul 4 03:22:44 2018 (r335926) @@ -181,7 +181,7 @@ _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} MK_AU # We often need to use the tree's version of make to build it. # Choices add to complexity though. # We cannot blindly use a make which may not be the one we want -# so be exlicit - until all choice is removed. +# so be explicit - until all choice is removed. WANT_MAKE= bmake .if !empty(.MAKE.MODE:Mmeta) # 20160604 - support missing-meta,missing-filemon and performance improvements From owner-svn-src-stable-11@freebsd.org Wed Jul 4 13:56:02 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 435B11038DE4; Wed, 4 Jul 2018 13:56:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D52D97C4F2; Wed, 4 Jul 2018 13:56:01 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B62804014; Wed, 4 Jul 2018 13:56:01 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w64Du1vi018466; Wed, 4 Jul 2018 13:56:01 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w64Du16B018465; Wed, 4 Jul 2018 13:56:01 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807041356.w64Du16B018465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 4 Jul 2018 13:56:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335946 - stable/11/sys/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/conf X-SVN-Commit-Revision: 335946 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 13:56:02 -0000 Author: ian Date: Wed Jul 4 13:56:01 2018 New Revision: 335946 URL: https://svnweb.freebsd.org/changeset/base/335946 Log: MFC r335486: Add a note about using option VERBOSE_SYSINIT=0 to get the verbose code compiled in but disabled by default. Modified: stable/11/sys/conf/NOTES Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Wed Jul 4 13:52:13 2018 (r335945) +++ stable/11/sys/conf/NOTES Wed Jul 4 13:56:01 2018 (r335946) @@ -2910,7 +2910,9 @@ options IFMEDIA_DEBUG # enable debugging in net/if_me # # Make the SYSINIT process performed by mi_startup() verbose. This is very # useful when porting to a new architecture. If DDB is also enabled, this -# will print function names instead of addresses. +# will print function names instead of addresses. If defined with a value +# of zero, the verbose code is compiled-in but disabled by default, and can +# be enabled with the debug.verbose_sysinit=1 tunable. options VERBOSE_SYSINIT ##################################################################### From owner-svn-src-stable-11@freebsd.org Wed Jul 4 13:57:50 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 514A61039953; Wed, 4 Jul 2018 13:57:50 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 037427C6B5; Wed, 4 Jul 2018 13:57:50 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8CB74017; Wed, 4 Jul 2018 13:57:49 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w64DvnIB018575; Wed, 4 Jul 2018 13:57:49 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w64DvnF8018574; Wed, 4 Jul 2018 13:57:49 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807041357.w64DvnF8018574@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 4 Jul 2018 13:57:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335947 - stable/11/lib/libc/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/lib/libc/sys X-SVN-Commit-Revision: 335947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 13:57:50 -0000 Author: ian Date: Wed Jul 4 13:57:49 2018 New Revision: 335947 URL: https://svnweb.freebsd.org/changeset/base/335947 Log: MFC r335489: Add some words clarifying that rename(2) does nothing when the 'from' and 'to' args are the same file. Wording borrowed from POSIX.1-2017, but the freebsd code to implement this behavior was added in 2002 (r103180). Modified: stable/11/lib/libc/sys/rename.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/rename.2 ============================================================================== --- stable/11/lib/libc/sys/rename.2 Wed Jul 4 13:56:01 2018 (r335946) +++ stable/11/lib/libc/sys/rename.2 Wed Jul 4 13:57:49 2018 (r335947) @@ -28,7 +28,7 @@ .\" @(#)rename.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 15, 2017 +.Dd June 21, 2018 .Dt RENAME 2 .Os .Sh NAME @@ -75,6 +75,15 @@ If the final component of is a symbolic link, the symbolic link is renamed, not the file or directory to which it points. +.Pp +If +.Fa from +and +.Fa to +resolve to the same directory entry, or to different directory +entries for the same existing file, +.Fn rename +returns success without taking any further action. .Pp The .Fn renameat From owner-svn-src-stable-11@freebsd.org Wed Jul 4 14:01:57 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD7BF1039E8B; Wed, 4 Jul 2018 14:01:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6FA187CAB2; Wed, 4 Jul 2018 14:01:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 518D2408C; Wed, 4 Jul 2018 14:01:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w64E1v6s020661; Wed, 4 Jul 2018 14:01:57 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w64E1vfZ020660; Wed, 4 Jul 2018 14:01:57 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807041401.w64E1vfZ020660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 4 Jul 2018 14:01:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335948 - stable/11/etc/rc.d X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/etc/rc.d X-SVN-Commit-Revision: 335948 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 14:01:58 -0000 Author: ian Date: Wed Jul 4 14:01:56 2018 New Revision: 335948 URL: https://svnweb.freebsd.org/changeset/base/335948 Log: MFC r335575, r335786-r335787 r335575: Use 'mv -f' in rc.d/ntpd to avoid spuriously halting the boot. The final 'mv' to install a fetched leap-list file can fail (due to a readonly fs, or schg flags, for example), and that leads to mv(1) prompting the user, stopping the boot process. Instead, use mv -f to supress the prompting, and if verbose mode is on, emit a warning that the existing file cannot be replaced. PR: 219255 r335786: Rename variable ntp_tmp_leapfile to have a leading underbar, to distinguish it from variables with similar names which are set in rc.conf. This will make more sense as the script grows more similar-name local variables in some upcoming changes. r335787: When being verbose about various leapfile versions, also mention expiration. The expiration date is actually more of a version number than the version date, because expiration changes twice a year, whereas the version only changes when actual leap second events occur (except in USNO leapfiles, which inappropriately bump the version with every expiration date change). Modified: stable/11/etc/rc.d/ntpd Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/ntpd ============================================================================== --- stable/11/etc/rc.d/ntpd Wed Jul 4 13:57:49 2018 (r335947) +++ stable/11/etc/rc.d/ntpd Wed Jul 4 14:01:56 2018 (r335948) @@ -20,7 +20,7 @@ fetch_cmd="ntpd_fetch_leapfile" needfetch_cmd="ntpd_needfetch_leapfile" start_precmd="ntpd_precmd" -ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list" +_ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list" load_rc_config $name @@ -56,7 +56,7 @@ ntpd_precmd() ( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" ) fi ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift - ln -fs "${ntpd_chrootdir}${ntp_tmp_leapfile}" ${ntp_tmp_leapfile} + ln -fs "${ntpd_chrootdir}${_ntp_tmp_leapfile}" ${_ntp_tmp_leapfile} # Change run_rc_commands()'s internal copy of $ntpd_flags # @@ -106,8 +106,8 @@ ntpd_needfetch_leapfile() { ntp_expiry_src=$(get_ntp_leapfile_expiry $ntp_src_leapfile) ntp_ver_no_db=$(get_ntp_leapfile_ver $ntp_db_leapfile) ntp_expiry_db=$(get_ntp_leapfile_expiry $ntp_db_leapfile) - $verbose ntp_src_leapfile version is $ntp_ver_no_src - $verbose ntp_db_leapfile version is $ntp_ver_no_db + $verbose ntp_src_leapfile version is $ntp_ver_no_src expires $ntp_expiry_src + $verbose ntp_db_leapfile version is $ntp_ver_no_db expires $ntp_expiry_db if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" -o \ "$ntp_ver_no_src" -eq "$ntp_ver_no_db" -a \ @@ -140,15 +140,16 @@ ntpd_fetch_leapfile() { if ntpd_needfetch_leapfile ; then for url in $ntp_leapfile_sources ; do $verbose fetching $url - fetch $ntp_leapfile_fetch_opts -o $ntp_tmp_leapfile $url && break + fetch $ntp_leapfile_fetch_opts -o $_ntp_tmp_leapfile $url && break done - ntp_ver_no_tmp=$(get_ntp_leapfile_ver $ntp_tmp_leapfile) - ntp_expiry_tmp=$(get_ntp_leapfile_expiry $ntp_tmp_leapfile) + ntp_ver_no_tmp=$(get_ntp_leapfile_ver $_ntp_tmp_leapfile) + ntp_expiry_tmp=$(get_ntp_leapfile_expiry $_ntp_tmp_leapfile) if [ "$ntp_expiry_tmp" -gt "$ntp_expiry_db" -o \ "$ntp_expiry_tmp" -eq "$ntp_expiry_db" -a \ "$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" ]; then $verbose using $url as $ntp_db_leapfile - mv $ntp_tmp_leapfile $ntp_db_leapfile + mv -f $_ntp_tmp_leapfile $ntp_db_leapfile || + $verbose "warning: cannot replace $ntp_db_leapfile (read-only fs?)" else $verbose using existing $ntp_db_leapfile fi From owner-svn-src-stable-11@freebsd.org Wed Jul 4 14:04:24 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4221B103A228; Wed, 4 Jul 2018 14:04:24 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E70027CF65; Wed, 4 Jul 2018 14:04:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AED5941E0; Wed, 4 Jul 2018 14:04:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w64E4NOu023925; Wed, 4 Jul 2018 14:04:23 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w64E4NjY023924; Wed, 4 Jul 2018 14:04:23 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807041404.w64E4NjY023924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 4 Jul 2018 14:04:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335949 - stable/11/etc X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/etc X-SVN-Commit-Revision: 335949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 14:04:24 -0000 Author: ian Date: Wed Jul 4 14:04:23 2018 New Revision: 335949 URL: https://svnweb.freebsd.org/changeset/base/335949 Log: MFC r335595-r335596 r335595: Modernize usage of "restrict" keyword in ntp.conf It is no longer necessary to specify a -4/-6 flag on any ntp.conf keyword. The address type is inferred from the address itself as necessary. "restrict default" statements always apply to both address families regardless of any -4/-6 flag that may be present. So this change just tidies up our default config by removing the redundant restrict -6 statement and comment, and by removing the -6 flag from the restrict keyword that allows access from localhost. This change was inspired by the patches provided in PRs 201803 and 210245, and included some contrib/ntp code inspection to verify that the -4/-6 keywords are basically no-ops in all contexts now. PR: 201803 210245 Differential Revision: https://reviews.freebsd.org/D15974 r335596: Fix a comment; the ntp leaplist file is updated periodically, but not weekly (it's only updated when a check shows it's within 30 days of expiring). PR: 207138 Modified: stable/11/etc/ntp.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/ntp.conf ============================================================================== --- stable/11/etc/ntp.conf Wed Jul 4 14:01:56 2018 (r335948) +++ stable/11/etc/ntp.conf Wed Jul 4 14:04:23 2018 (r335949) @@ -62,15 +62,13 @@ pool 0.freebsd.pool.ntp.org iburst # See http://support.ntp.org/bin/view/Support/AccessRestrictions # for more information. # -restrict default limited kod nomodify notrap noquery nopeer -restrict -6 default limited kod nomodify notrap noquery nopeer -restrict source limited kod nomodify notrap noquery +restrict default limited kod nomodify notrap noquery nopeer +restrict source limited kod nomodify notrap noquery # # Alternatively, the following rules would block all unauthorized access. # #restrict default ignore -#restrict -6 default ignore # # In this case, all remote NTP time servers also need to be explicitly # allowed or they would not be able to exchange time information with @@ -85,7 +83,7 @@ restrict source limited kod nomodify notrap noquer # # The following settings allow unrestricted access from the localhost restrict 127.0.0.1 -restrict -6 ::1 +restrict ::1 # # If a server loses sync with all upstream servers, NTP clients @@ -101,6 +99,6 @@ restrict -6 ::1 # See http://support.ntp.org/bin/view/Support/ConfiguringNTP#Section_6.14. # for documentation regarding leapfile. Updates to the file can be obtained # from ftp://time.nist.gov/pub/ or ftp://tycho.usno.navy.mil/pub/ntp/. -# Use either leapfile in /etc/ntp or weekly updated leapfile in /var/db. +# Use either leapfile in /etc/ntp or periodically updated leapfile in /var/db. #leapfile "/etc/ntp/leap-seconds" leapfile "/var/db/ntpd.leap-seconds.list" From owner-svn-src-stable-11@freebsd.org Wed Jul 4 18:01:54 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CEA5102A86F; Wed, 4 Jul 2018 18:01:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B2C508AF0B; Wed, 4 Jul 2018 18:01:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93D3368C7; Wed, 4 Jul 2018 18:01:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w64I1rjM047867; Wed, 4 Jul 2018 18:01:53 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w64I1r1Y047866; Wed, 4 Jul 2018 18:01:53 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201807041801.w64I1r1Y047866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 4 Jul 2018 18:01:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335964 - stable/11/lib/libutil/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/lib/libutil/tests X-SVN-Commit-Revision: 335964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 18:01:54 -0000 Author: emaste Date: Wed Jul 4 18:01:53 2018 New Revision: 335964 URL: https://svnweb.freebsd.org/changeset/base/335964 Log: MFC r306098 (br): Use kqueue(2) instead of select(2). This helps to ensure we will not lose SIGINT sent by parent to child. PR: 212562, 228492 Modified: stable/11/lib/libutil/tests/pidfile_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libutil/tests/pidfile_test.c ============================================================================== --- stable/11/lib/libutil/tests/pidfile_test.c Wed Jul 4 17:18:35 2018 (r335963) +++ stable/11/lib/libutil/tests/pidfile_test.c Wed Jul 4 18:01:53 2018 (r335964) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -43,8 +44,8 @@ __FBSDID("$FreeBSD$"); #include /* - * We need a signal handler so kill(2) will interrupt our child's - * select(2) instead of killing it. + * We need a signal handler so kill(2) will interrupt the child + * instead of killing it. */ static void signal_handler(int sig) @@ -129,7 +130,9 @@ common_test_pidfile_child(const char *fn, int parent_o struct pidfh *pf = NULL; pid_t other = 0, pid = 0; int fd[2], serrno, status; + struct kevent event, ke; char ch; + int kq; unlink(fn); if (pipe(fd) != 0) @@ -166,10 +169,20 @@ common_test_pidfile_child(const char *fn, int parent_o if (pf == NULL) _exit(1); if (pidfile_write(pf) != 0) - _exit(1); + _exit(2); + kq = kqueue(); + if (kq == -1) + _exit(3); + EV_SET(&ke, SIGINT, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL); + /* Attach event to the kqueue. */ + if (kevent(kq, &ke, 1, NULL, 0, NULL) != 0) + _exit(4); + /* Inform the parent we are ready to receive SIGINT */ if (write(fd[1], "*", 1) != 1) - _exit(1); - select(0, 0, 0, 0, 0); + _exit(5); + /* Wait for SIGINT received */ + if (kevent(kq, NULL, 0, &event, 1, NULL) != 1) + _exit(6); _exit(0); } // parent From owner-svn-src-stable-11@freebsd.org Thu Jul 5 15:27:39 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 431581033341; Thu, 5 Jul 2018 15:27:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E760182730; Thu, 5 Jul 2018 15:27:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE5C31BBAD; Thu, 5 Jul 2018 15:27:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w65FRcfe007923; Thu, 5 Jul 2018 15:27:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w65FRcgA007922; Thu, 5 Jul 2018 15:27:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201807051527.w65FRcgA007922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 5 Jul 2018 15:27:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335984 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 335984 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2018 15:27:39 -0000 Author: kevans Date: Thu Jul 5 15:27:38 2018 New Revision: 335984 URL: https://svnweb.freebsd.org/changeset/base/335984 Log: MFC r335479, r335509 MFC r335479: subr_hints: simplify a little bit Some complexity exists in these bits that isn't needed. The sysctl handler, upon change to '2', runs through the current set of hints and sets them in the kenv. However, this isn't at all necessary if we're pulling hints from the kenv, static or dynamic, as the former will get added to the latter in init_dynamic_kenv (see: kern_environment.c). We can reduce this configuration to just adding static_hints to the kenv if we were previously using them. The changes in res_find are minimal and based on the observation that once use_kenv gets set to '1' it will never be reset to '0', and it gets set to '1' as soon as we hit fallback mode. Later work will refactor res_find a little bit and eliminate this now-local, because it's become clear that there's some funkiness revolving around use_kenv=1 and it being used to imply that we're certainly looking at the dynamic_kenv. MFC r335509: subr_hints: Fix acpi unit hinting (at the very least) The refactoring in r335479 overlooked the fact that the dynamic kenv can also be switched to if hintmode == 0. This is problematic because the checkmethod bits are only ever ran once, but it worked previously because the use_kenv was a global state and the first lookup would enable it if occurring after the dynamic environment has been setup. Extending our local definition of use_kenv to include all non-STATIC hintmodes as long as the dynamic_kenv is setup fixes this. We still have potential issues if the dynamic kenv comes up while we're doing an anchored search through the environment, but this is not much of a concern right now because: 1.) The dynamic environment comes up super early in boot, just after kmem 2.) This is going to get rewritten to provide a safer mechanism for the anchored searches, ensuring that we continue using the same environment chain (dynamic env or static fallback) for all anchored search invocations Modified: stable/11/sys/kern/subr_hints.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_hints.c ============================================================================== --- stable/11/sys/kern/subr_hints.c Thu Jul 5 14:12:56 2018 (r335983) +++ stable/11/sys/kern/subr_hints.c Thu Jul 5 15:27:38 2018 (r335984) @@ -35,12 +35,15 @@ __FBSDID("$FreeBSD$"); #include #include +#define HINTMODE_KENV 0 +#define HINTMODE_STATIC 1 +#define HINTMODE_FALLBACK 2 + /* * Access functions for device resources. */ static int checkmethod = 1; -static int use_kenv; static char *hintp; /* @@ -54,10 +57,8 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) { const char *cp; char *line, *eq; - int eqidx, error, from_kenv, i, value; + int eqidx, error, i, value; - from_kenv = 0; - cp = kern_envp; value = hintmode; /* Fetch candidate for new hintmode value */ @@ -65,47 +66,33 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) if (error || req->newptr == NULL) return (error); - if (value != 2) + if (value != HINTMODE_FALLBACK) /* Only accept swithing to hintmode 2 */ return (EINVAL); - /* Migrate from static to dynamic hints */ - switch (hintmode) { - case 0: - if (dynamic_kenv) { - /* - * Already here. But assign hintmode to 2, to not - * check it in the future. - */ - hintmode = 2; - return (0); - } - from_kenv = 1; - cp = kern_envp; - break; - case 1: - cp = static_hints; - break; - case 2: - /* Nothing to do, hintmode already 2 */ + /* + * The rest of the sysctl handler is just making sure that our + * environment is consistent with the world we've already seen. + * If we came from kenv at all, then we have nothing to do: static + * kenv will get merged into dynamic kenv as soon as kmem becomes + * available, dynamic kenv is the environment we'd be setting these + * things in anyways. Therefore, we have nothing left to do unless + * we came from a static hints configuration. + */ + if (hintmode != HINTMODE_STATIC) { + hintmode = value; return (0); } - while (cp) { - i = strlen(cp); - if (i == 0) - break; - if (from_kenv) { - if (strncmp(cp, "hint.", 5) != 0) - /* kenv can have not only hints */ - continue; - } + cp = static_hints; + while (cp && *cp != '\0') { eq = strchr(cp, '='); if (eq == NULL) /* Bad hint value */ continue; eqidx = eq - cp; + i = strlen(cp); line = malloc(i+1, M_TEMP, M_WAITOK); strcpy(line, cp); line[eqidx] = '\0'; @@ -115,7 +102,6 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) } hintmode = value; - use_kenv = 1; return (0); } @@ -135,7 +121,7 @@ res_find(int *line, int *startln, { int n = 0, hit, i = 0; char r_name[32]; - int r_unit; + int r_unit, use_kenv = (hintmode != HINTMODE_STATIC && dynamic_kenv); char r_resname[32]; char r_value[128]; const char *s, *cp; @@ -145,13 +131,13 @@ res_find(int *line, int *startln, hintp = NULL; switch (hintmode) { - case 0: /* loader hints in environment only */ + case HINTMODE_KENV: /* loader hints in environment only */ break; - case 1: /* static hints only */ + case HINTMODE_STATIC: /* static hints only */ hintp = static_hints; checkmethod = 0; break; - case 2: /* fallback mode */ + case HINTMODE_FALLBACK: /* fallback mode */ if (dynamic_kenv) { mtx_lock(&kenv_lock); cp = kenvp[0]; From owner-svn-src-stable-11@freebsd.org Thu Jul 5 15:36:50 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CE3C103407B; Thu, 5 Jul 2018 15:36:50 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D11E682F17; Thu, 5 Jul 2018 15:36:49 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B21FF1BD57; Thu, 5 Jul 2018 15:36:49 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w65FanNT013150; Thu, 5 Jul 2018 15:36:49 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w65FanUN013149; Thu, 5 Jul 2018 15:36:49 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201807051536.w65FanUN013149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 5 Jul 2018 15:36:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335986 - stable/11/sbin/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sbin/ipfw X-SVN-Commit-Revision: 335986 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2018 15:36:50 -0000 Author: ae Date: Thu Jul 5 15:36:49 2018 New Revision: 335986 URL: https://svnweb.freebsd.org/changeset/base/335986 Log: MFC r335759: Remove extra "ipfw" from example. Modified: stable/11/sbin/ipfw/ipfw.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw.8 ============================================================================== --- stable/11/sbin/ipfw/ipfw.8 Thu Jul 5 15:34:16 2018 (r335985) +++ stable/11/sbin/ipfw/ipfw.8 Thu Jul 5 15:36:49 2018 (r335986) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 9, 2018 +.Dd June 28, 2018 .Dt IPFW 8 .Os .Sh NAME @@ -3829,9 +3829,9 @@ In the following example per-interface firewall is cre .Dl "ipfw table OUT add vlan20 22000" .Dl "ipfw table OUT add vlan30 23000" .Dl ".." -.Dl "ipfw add 100 ipfw setfib tablearg ip from any to any recv 'table(IN)' in" -.Dl "ipfw add 200 ipfw skipto tablearg ip from any to any recv 'table(IN)' in" -.Dl "ipfw add 300 ipfw skipto tablearg ip from any to any xmit 'table(OUT)' out" +.Dl "ipfw add 100 setfib tablearg ip from any to any recv 'table(IN)' in" +.Dl "ipfw add 200 skipto tablearg ip from any to any recv 'table(IN)' in" +.Dl "ipfw add 300 skipto tablearg ip from any to any xmit 'table(OUT)' out" .Pp The following example illustrate usage of flow tables: .Pp From owner-svn-src-stable-11@freebsd.org Thu Jul 5 16:12:49 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABB8110388F3; Thu, 5 Jul 2018 16:12:49 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5EEE88506E; Thu, 5 Jul 2018 16:12:49 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 414071C3D1; Thu, 5 Jul 2018 16:12:49 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w65GCnBh033333; Thu, 5 Jul 2018 16:12:49 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w65GCnfE033332; Thu, 5 Jul 2018 16:12:49 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807051612.w65GCnfE033332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 5 Jul 2018 16:12:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335991 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 335991 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2018 16:12:49 -0000 Author: ian Date: Thu Jul 5 16:12:48 2018 New Revision: 335991 URL: https://svnweb.freebsd.org/changeset/base/335991 Log: MFC r333255, r333260 r333255: Make reading imx6 gpio pins work correctly whether the pin is in open-drain mode or not. An earlier attempt to make this work was done in r320456, by always reading the pad status register (PSR) instead of the data register. But it turns out the values in PSR only reflect the electrical level of an output pin if the pad is configured with the SION (Set Input On) bit in the pinmux config, and most output gpio pads are not configured that way. So now a gpio read is done by returning the value from the data register, which works right whether the pin is configured for input or output, unless the pin has been set for OPENDRAIN mode, in which case the PSR is read instead. For this to work, the pin must also be configured with SION turned on in the fdt pinmux data, which is a reasonable thing to require for the unusual case of reading an open-drain output pin. r333260: Properly support the GPIO_PIN_PRESET_{LOW,HIGH} options when configuring a gpio pin. If neither of the options is specified, pre-set the pin's output value to the pin's current input value, to achieve glitch-free transitions to output mode on pins that are pulled up or down at reset or via fdt pinctrl data. Modified: stable/11/sys/arm/freescale/imx/imx_gpio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_gpio.c Thu Jul 5 16:03:03 2018 (r335990) +++ stable/11/sys/arm/freescale/imx/imx_gpio.c Thu Jul 5 16:12:48 2018 (r335991) @@ -507,21 +507,41 @@ static void imx51_gpio_pin_configure(struct imx51_gpio_softc *sc, struct gpio_pin *pin, unsigned int flags) { - u_int newflags; + u_int newflags, pad; mtx_lock_spin(&sc->sc_mtx); /* - * Manage input/output; other flags not supported yet. + * Manage input/output; other flags not supported yet (maybe not ever, + * since we have no connection to the pad config registers from here). * + * When setting a pin to output, honor the PRESET_[LOW,HIGH] flags if + * present. Otherwise, for glitchless transistions on pins with pulls, + * read the current state of the pad and preset the DR register to drive + * the current value onto the pin before enabling the pin for output. + * * Note that changes to pin->gp_flags must be acccumulated in newflags * and stored with a single writeback to gp_flags at the end, to enable - * unlocked reads of that value elsewhere. + * unlocked reads of that value elsewhere. This is only about unlocked + * access to gp_flags from elsewhere; we still use locking in this + * function to protect r-m-w access to the hardware registers. */ if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { newflags = pin->gp_flags & ~(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); if (flags & GPIO_PIN_OUTPUT) { + if (flags & GPIO_PIN_PRESET_LOW) { + pad = 0; + } else if (flags & GPIO_PIN_PRESET_HIGH) { + pad = 1; + } else { + if (flags & GPIO_PIN_OPENDRAIN) + pad = READ4(sc, IMX_GPIO_PSR_REG); + else + pad = READ4(sc, IMX_GPIO_DR_REG); + pad = (pad >> pin->gp_pin) & 1; + } newflags |= GPIO_PIN_OUTPUT; + SET4(sc, IMX_GPIO_DR_REG, (pad << pin->gp_pin)); SET4(sc, IMX_GPIO_OE_REG, (1U << pin->gp_pin)); } else { newflags |= GPIO_PIN_INPUT; @@ -645,7 +665,20 @@ imx51_gpio_pin_get(device_t dev, uint32_t pin, unsigne if (pin >= sc->gpio_npins) return (EINVAL); - *val = (READ4(sc, IMX_GPIO_PSR_REG) >> pin) & 1; + /* + * Normally a pin set for output can be read by reading the DR reg which + * indicates what value is being driven to that pin. The exception is + * pins configured for open-drain mode, in which case we have to read + * the pad status register in case the pin is being driven externally. + * Doing so requires that the SION bit be configured in pinmux, which + * isn't the case for most normal gpio pins, so only try to read via PSR + * if the OPENDRAIN flag is set, and it's the user's job to correctly + * configure SION along with open-drain output mode for those pins. + */ + if (sc->gpio_pins[pin].gp_flags & GPIO_PIN_OPENDRAIN) + *val = (READ4(sc, IMX_GPIO_PSR_REG) >> pin) & 1; + else + *val = (READ4(sc, IMX_GPIO_DR_REG) >> pin) & 1; return (0); } @@ -680,7 +713,7 @@ imx51_gpio_pin_access_32(device_t dev, uint32_t first_ sc = device_get_softc(dev); if (orig_pins != NULL) - *orig_pins = READ4(sc, IMX_GPIO_PSR_REG); + *orig_pins = READ4(sc, IMX_GPIO_DR_REG); if ((clear_pins | change_pins) != 0) { mtx_lock_spin(&sc->sc_mtx); @@ -706,7 +739,7 @@ imx51_gpio_pin_config_32(device_t dev, uint32_t first_ return (EINVAL); drclr = drset = oeclr = oeset = 0; - pads = READ4(sc, IMX_GPIO_PSR_REG); + pads = READ4(sc, IMX_GPIO_DR_REG); for (i = 0; i < num_pins; ++i) { bit = 1u << i; From owner-svn-src-stable-11@freebsd.org Thu Jul 5 16:15:17 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9DCD1038CE5; Thu, 5 Jul 2018 16:15:17 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9035385448; Thu, 5 Jul 2018 16:15:17 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 727401C3D8; Thu, 5 Jul 2018 16:15:17 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w65GFHPB033767; Thu, 5 Jul 2018 16:15:17 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w65GFHAE033766; Thu, 5 Jul 2018 16:15:17 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807051615.w65GFHAE033766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 5 Jul 2018 16:15:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335992 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 335992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2018 16:15:18 -0000 Author: ian Date: Thu Jul 5 16:15:17 2018 New Revision: 335992 URL: https://svnweb.freebsd.org/changeset/base/335992 Log: MFC r335283: Build LOCAL_LIB_DIRS along with system lib dirs, rather than building them in parallel with LOCAL_DIRS and all the other system post-libs stuff. Modified: stable/11/Makefile.inc1 Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Thu Jul 5 16:12:48 2018 (r335991) +++ stable/11/Makefile.inc1 Thu Jul 5 16:15:17 2018 (r335992) @@ -234,6 +234,17 @@ X${BINUTIL}?= ${${BINUTIL}} SUBDIR= ${SUBDIR_OVERRIDE} .else SUBDIR= lib libexec +# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR +# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and +# LOCAL_LIB_DIRS=foo/lib to behave as expected. +.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|} +_REDUNDANT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} +.endfor +.for _DIR in ${LOCAL_LIB_DIRS} +.if ${_DIR} == ".WAIT" || (empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)) +SUBDIR+= ${_DIR} +.endif +.endfor .if !defined(NO_ROOT) && (make(installworld) || make(install)) # Ensure libraries are installed before progressing. SUBDIR+=.WAIT @@ -269,17 +280,6 @@ SUBDIR+= tests # the LOCAL_DIRS and LOCAL_LIB_DIRS lists as needed. .for _DIR in ${LOCAL_DIRS} .if ${_DIR} == ".WAIT" || exists(${.CURDIR}/${_DIR}/Makefile) -SUBDIR+= ${_DIR} -.endif -.endfor -# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR -# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and -# LOCAL_LIB_DIRS=foo/lib to behave as expected. -.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|} -_REDUNDANT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} -.endfor -.for _DIR in ${LOCAL_LIB_DIRS} -.if ${_DIR} == ".WAIT" || (empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)) SUBDIR+= ${_DIR} .endif .endfor From owner-svn-src-stable-11@freebsd.org Fri Jul 6 19:10:15 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69A551046782; Fri, 6 Jul 2018 19:10:15 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3091E91A89; Fri, 6 Jul 2018 19:10:14 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECEB34D45; Fri, 6 Jul 2018 19:10:13 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w66JAD6L060783; Fri, 6 Jul 2018 19:10:13 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w66JABL0060771; Fri, 6 Jul 2018 19:10:11 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201807061910.w66JABL0060771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Fri, 6 Jul 2018 19:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r336040 - in stable/11: lib/libugidfw sbin/ipfw usr.bin/cpuset usr.bin/sockstat X-SVN-Group: stable-11 X-SVN-Commit-Author: jamie X-SVN-Commit-Paths: in stable/11: lib/libugidfw sbin/ipfw usr.bin/cpuset usr.bin/sockstat X-SVN-Commit-Revision: 336040 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2018 19:10:15 -0000 Author: jamie Date: Fri Jul 6 19:10:11 2018 New Revision: 336040 URL: https://svnweb.freebsd.org/changeset/base/336040 Log: MFC r335921: Allow jail names (not just IDs) to be specified for: cpuset(1), ipfw(8), sockstat(1), ugidfw(8) These are the last of the jail-aware userland utilities that didn't work with names. PR: 229266 Differential Revision: D16047 Modified: stable/11/lib/libugidfw/ugidfw.c stable/11/sbin/ipfw/Makefile stable/11/sbin/ipfw/ipfw.8 stable/11/sbin/ipfw/ipfw2.c stable/11/usr.bin/cpuset/Makefile stable/11/usr.bin/cpuset/cpuset.1 stable/11/usr.bin/cpuset/cpuset.c stable/11/usr.bin/sockstat/Makefile stable/11/usr.bin/sockstat/sockstat.1 stable/11/usr.bin/sockstat/sockstat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libugidfw/ugidfw.c ============================================================================== --- stable/11/lib/libugidfw/ugidfw.c Fri Jul 6 19:10:07 2018 (r336039) +++ stable/11/lib/libugidfw/ugidfw.c Fri Jul 6 19:10:11 2018 (r336040) @@ -32,9 +32,11 @@ */ #include #include +#include #include #include #include +#include #include #include @@ -598,16 +600,45 @@ bsde_parse_gidrange(char *spec, gid_t *min, gid_t *max } static int +bsde_get_jailid(const char *name, size_t buflen, char *errstr) +{ + char *ep; + int jid; + struct iovec jiov[4]; + + /* Copy jail_getid(3) instead of messing with library dependancies */ + jid = strtoul(name, &ep, 10); + if (*name && !*ep) + return jid; + jiov[0].iov_base = __DECONST(char *, "name"); + jiov[0].iov_len = sizeof("name"); + jiov[1].iov_len = strlen(name) + 1; + jiov[1].iov_base = alloca(jiov[1].iov_len); + strcpy(jiov[1].iov_base, name); + if (errstr && buflen) { + jiov[2].iov_base = __DECONST(char *, "errmsg"); + jiov[2].iov_len = sizeof("errmsg"); + jiov[3].iov_base = errstr; + jiov[3].iov_len = buflen; + errstr[0] = 0; + jid = jail_get(jiov, 4, 0); + if (jid < 0 && !errstr[0]) + snprintf(errstr, buflen, "jail_get: %s", + strerror(errno)); + } else + jid = jail_get(jiov, 2, 0); + return jid; +} + +static int bsde_parse_subject(int argc, char *argv[], struct mac_bsdextended_subject *subject, size_t buflen, char *errstr) { int not_seen, flags; int current, neg, nextnot; - char *endp; uid_t uid_min, uid_max; gid_t gid_min, gid_max; int jid = 0; - long value; current = 0; flags = 0; @@ -666,13 +697,9 @@ bsde_parse_subject(int argc, char *argv[], snprintf(errstr, buflen, "one jail only"); return (-1); } - value = strtol(argv[current+1], &endp, 10); - if (*endp != '\0') { - snprintf(errstr, buflen, "invalid jid: '%s'", - argv[current+1]); + jid = bsde_get_jailid(argv[current+1], buflen, errstr); + if (jid < 0) return (-1); - } - jid = value; flags |= MBS_PRISON_DEFINED; if (nextnot) { neg ^= MBS_PRISON_DEFINED; Modified: stable/11/sbin/ipfw/Makefile ============================================================================== --- stable/11/sbin/ipfw/Makefile Fri Jul 6 19:10:07 2018 (r336039) +++ stable/11/sbin/ipfw/Makefile Fri Jul 6 19:10:11 2018 (r336040) @@ -13,7 +13,7 @@ SRCS+= altq.c CFLAGS+=-DPF .endif -LIBADD= util +LIBADD= jail util MAN= ipfw.8 .include Modified: stable/11/sbin/ipfw/ipfw.8 ============================================================================== --- stable/11/sbin/ipfw/ipfw.8 Fri Jul 6 19:10:07 2018 (r336039) +++ stable/11/sbin/ipfw/ipfw.8 Fri Jul 6 19:10:11 2018 (r336040) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 28, 2018 +.Dd July 3, 2018 .Dt IPFW 8 .Os .Sh NAME @@ -1535,10 +1535,10 @@ Matches all TCP or UDP packets sent by or received for A .Ar group may be specified by name or number. -.It Cm jail Ar prisonID +.It Cm jail Ar jail Matches all TCP or UDP packets sent by or received for the -jail whos prison ID is -.Ar prisonID . +jail whose ID or name is +.Ar jail . .It Cm icmptypes Ar types Matches ICMP packets whose ICMP type is in the list .Ar types . Modified: stable/11/sbin/ipfw/ipfw2.c ============================================================================== --- stable/11/sbin/ipfw/ipfw2.c Fri Jul 6 19:10:07 2018 (r336039) +++ stable/11/sbin/ipfw/ipfw2.c Fri Jul 6 19:10:11 2018 (r336040) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -4581,13 +4582,12 @@ read_options: case TOK_JAIL: NEED1("jail requires argument"); { - char *end; int jid; cmd->opcode = O_JAIL; - jid = (int)strtol(*av, &end, 0); - if (jid < 0 || *end != '\0') - errx(EX_DATAERR, "jail requires prison ID"); + jid = jail_getid(*av); + if (jid < 0) + errx(EX_DATAERR, "%s", jail_errmsg); cmd32->d[0] = (uint32_t)jid; cmd->len |= F_INSN_SIZE(ipfw_insn_u32); av++; Modified: stable/11/usr.bin/cpuset/Makefile ============================================================================== --- stable/11/usr.bin/cpuset/Makefile Fri Jul 6 19:10:07 2018 (r336039) +++ stable/11/usr.bin/cpuset/Makefile Fri Jul 6 19:10:11 2018 (r336040) @@ -2,4 +2,6 @@ PROG= cpuset +LIBADD= jail + .include Modified: stable/11/usr.bin/cpuset/cpuset.1 ============================================================================== --- stable/11/usr.bin/cpuset/cpuset.1 Fri Jul 6 19:10:07 2018 (r336039) +++ stable/11/usr.bin/cpuset/cpuset.1 Fri Jul 6 19:10:11 2018 (r336040) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2018 +.Dd July 3, 2018 .Dt CPUSET 1 .Os .Sh NAME @@ -48,11 +48,11 @@ .Nm .Op Fl c .Op Fl l Ar cpu-list -.Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq +.Op Fl j Ar jail | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq .Nm .Fl g .Op Fl cir -.Op Fl d Ar domain | Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq +.Op Fl d Ar domain | Fl j Ar jail | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq .Sh DESCRIPTION The .Nm @@ -63,7 +63,7 @@ about processor binding, sets, and available processor .Nm requires a target to modify or query. The target may be specified as a command, process id, thread id, a -cpuset id, an irq, a jail id, or a NUMA domain. +cpuset id, an irq, a jail, or a NUMA domain. Using .Fl g the target's set id or mask may be queried. @@ -121,8 +121,8 @@ the id of the target. When used with the .Fl g option print the id rather than the valid mask of the target. -.It Fl j Ar jailid -Specifies a jail id as the target of the operation. +.It Fl j Ar jail +Specifies a jail id or name as the target of the operation. .It Fl l Ar cpu-list Specifies a list of CPUs to apply to a target. Specification may include Modified: stable/11/usr.bin/cpuset/cpuset.c ============================================================================== --- stable/11/usr.bin/cpuset/cpuset.c Fri Jul 6 19:10:07 2018 (r336039) +++ stable/11/usr.bin/cpuset/cpuset.c Fri Jul 6 19:10:11 2018 (r336040) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -233,7 +234,9 @@ main(int argc, char *argv[]) case 'j': jflag = 1; which = CPU_WHICH_JAIL; - id = atoi(optarg); + id = jail_getid(optarg); + if (id < 0) + errx(EXIT_FAILURE, "%s", jail_errmsg); break; case 'l': lflag = 1; Modified: stable/11/usr.bin/sockstat/Makefile ============================================================================== --- stable/11/usr.bin/sockstat/Makefile Fri Jul 6 19:10:07 2018 (r336039) +++ stable/11/usr.bin/sockstat/Makefile Fri Jul 6 19:10:11 2018 (r336040) @@ -2,4 +2,6 @@ PROG= sockstat +LIBADD= jail + .include Modified: stable/11/usr.bin/sockstat/sockstat.1 ============================================================================== --- stable/11/usr.bin/sockstat/sockstat.1 Fri Jul 6 19:10:07 2018 (r336039) +++ stable/11/usr.bin/sockstat/sockstat.1 Fri Jul 6 19:10:11 2018 (r336040) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 27, 2015 +.Dd July 3, 2018 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -58,8 +58,8 @@ Show (IPv6) sockets. .It Fl c Show connected sockets. -.It Fl j Ar jid -Show only sockets belonging to the specified jail ID. +.It Fl j Ar jail +Show only sockets belonging to the specified jail ID or name. .It Fl L Only show Internet sockets if the local and foreign addresses are not in the loopback network prefix Modified: stable/11/usr.bin/sockstat/sockstat.c ============================================================================== --- stable/11/usr.bin/sockstat/sockstat.c Fri Jul 6 19:10:07 2018 (r336039) +++ stable/11/usr.bin/sockstat/sockstat.c Fri Jul 6 19:10:11 2018 (r336040) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1181,7 +1182,9 @@ main(int argc, char *argv[]) opt_c = 1; break; case 'j': - opt_j = atoi(optarg); + opt_j = jail_getid(optarg); + if (opt_j < 0) + errx(1, "%s", jail_errmsg); break; case 'L': opt_L = 1; From owner-svn-src-stable-11@freebsd.org Sat Jul 7 11:38:45 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73BBE1039DEB; Sat, 7 Jul 2018 11:38:45 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 277B271B4E; Sat, 7 Jul 2018 11:38:45 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A11616D72; Sat, 7 Jul 2018 11:38:45 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w67Bci6T069612; Sat, 7 Jul 2018 11:38:44 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w67BciGF069611; Sat, 7 Jul 2018 11:38:44 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201807071138.w67BciGF069611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sat, 7 Jul 2018 11:38:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r336058 - stable/11/usr.sbin/syslogd X-SVN-Group: stable-11 X-SVN-Commit-Author: ed X-SVN-Commit-Paths: stable/11/usr.sbin/syslogd X-SVN-Commit-Revision: 336058 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2018 11:38:45 -0000 Author: ed Date: Sat Jul 7 11:38:44 2018 New Revision: 336058 URL: https://svnweb.freebsd.org/changeset/base/336058 Log: MFC r335861: Restore the order in which RFC 3164 messages with fac/pri are formatted. The refactoring of the syslogd code to format messages using iovecs slightly altered the output of syslogd by placing the facility/priority after the hostname, as opposed to printing it right before. This change reverts the behaviour to be consistent with how it was before. PR: 229457 Modified: stable/11/usr.sbin/syslogd/syslogd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/11/usr.sbin/syslogd/syslogd.c Sat Jul 7 11:18:26 2018 (r336057) +++ stable/11/usr.sbin/syslogd/syslogd.c Sat Jul 7 11:38:44 2018 (r336058) @@ -1871,8 +1871,6 @@ fprintlog_rfc3164(struct filed *f, const char *hostnam /* Message written to files. */ iovlist_append(&il, timebuf); iovlist_append(&il, " "); - iovlist_append(&il, hostname); - iovlist_append(&il, " "); if (LogFacPri) { iovlist_append(&il, "<"); @@ -1916,6 +1914,9 @@ fprintlog_rfc3164(struct filed *f, const char *hostnam iovlist_append(&il, "> "); } + + iovlist_append(&il, hostname); + iovlist_append(&il, " "); break; } From owner-svn-src-stable-11@freebsd.org Sat Jul 7 11:39:21 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C41B1039F27; Sat, 7 Jul 2018 11:39:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C048671C99; Sat, 7 Jul 2018 11:39:20 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1AC716D74; Sat, 7 Jul 2018 11:39:20 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w67BdKVp069698; Sat, 7 Jul 2018 11:39:20 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w67BdKDI069697; Sat, 7 Jul 2018 11:39:20 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201807071139.w67BdKDI069697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sat, 7 Jul 2018 11:39:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r336059 - stable/11/usr.sbin/syslogd X-SVN-Group: stable-11 X-SVN-Commit-Author: ed X-SVN-Commit-Paths: stable/11/usr.sbin/syslogd X-SVN-Commit-Revision: 336059 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2018 11:39:21 -0000 Author: ed Date: Sat Jul 7 11:39:20 2018 New Revision: 336059 URL: https://svnweb.freebsd.org/changeset/base/336059 Log: MFC r335862: Document that syslogd -v has no effect when RFC 5424 mode is enabled. The variable it sets, LogFacPri, is only used in the RFC 3164 formatting codepath. PR: 229457 Modified: stable/11/usr.sbin/syslogd/syslogd.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/syslogd/syslogd.8 ============================================================================== --- stable/11/usr.sbin/syslogd/syslogd.8 Sat Jul 7 11:38:44 2018 (r336058) +++ stable/11/usr.sbin/syslogd/syslogd.8 Sat Jul 7 11:39:20 2018 (r336059) @@ -28,7 +28,7 @@ .\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd April 15, 2018 +.Dd July 2, 2018 .Dt SYSLOGD 8 .Os .Sh NAME @@ -348,6 +348,10 @@ logged with each locally-written message. If specified more than once, the names of the facility and priority are logged with each locally-written message. +.Pp +This option only affects the formatting of RFC 3164 messages. +Messages formatted according to RFC 5424 always include a +facility/priority number. .El .Pp The From owner-svn-src-stable-11@freebsd.org Sat Jul 7 14:46:03 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34B90102774D; Sat, 7 Jul 2018 14:46:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA96B7A95E; Sat, 7 Jul 2018 14:46:02 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B83EA18C5C; Sat, 7 Jul 2018 14:46:02 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w67Ek2nw068267; Sat, 7 Jul 2018 14:46:02 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w67Ek2HU068266; Sat, 7 Jul 2018 14:46:02 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201807071446.w67Ek2HU068266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sat, 7 Jul 2018 14:46:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r336064 - stable/11/sys/netpfil/pf X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/sys/netpfil/pf X-SVN-Commit-Revision: 336064 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2018 14:46:03 -0000 Author: kp Date: Sat Jul 7 14:46:02 2018 New Revision: 336064 URL: https://svnweb.freebsd.org/changeset/base/336064 Log: MFC r335816: pfsync: Fix state sync during initial bulk update States learned via pfsync from a peer with the same ruleset checksum were not getting assigned to rules like they should because pfsync_in_upd() wasn't passing the PFSYNC_SI_CKSUM flag along to pfsync_state_import. PR: 229092 Submitted by: Kajetan Staszkiewicz Obtained from: OpenBSD Sponsored by: InnoGames GmbH Modified: stable/11/sys/netpfil/pf/if_pfsync.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/pf/if_pfsync.c ============================================================================== --- stable/11/sys/netpfil/pf/if_pfsync.c Sat Jul 7 13:37:44 2018 (r336063) +++ stable/11/sys/netpfil/pf/if_pfsync.c Sat Jul 7 14:46:02 2018 (r336064) @@ -865,7 +865,7 @@ pfsync_in_upd(struct pfsync_pkt *pkt, struct mbuf *m, st = pf_find_state_byid(sp->id, sp->creatorid); if (st == NULL) { /* insert the update */ - if (pfsync_state_import(sp, 0)) + if (pfsync_state_import(sp, pkt->flags)) V_pfsyncstats.pfsyncs_badstate++; continue; } From owner-svn-src-stable-11@freebsd.org Sat Jul 7 17:58:22 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05B77103C658; Sat, 7 Jul 2018 17:58:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AEA9E832DB; Sat, 7 Jul 2018 17:58:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 905661AB11; Sat, 7 Jul 2018 17:58:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w67HwLg5067728; Sat, 7 Jul 2018 17:58:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w67HwLIB067726; Sat, 7 Jul 2018 17:58:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807071758.w67HwLIB067726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 7 Jul 2018 17:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r336071 - in stable/11/sys: amd64/amd64 arm64/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 arm64/arm64 X-SVN-Commit-Revision: 336071 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2018 17:58:22 -0000 Author: markj Date: Sat Jul 7 17:58:20 2018 New Revision: 336071 URL: https://svnweb.freebsd.org/changeset/base/336071 Log: MFC r335580: Re-count available PV entries after reclaiming a PV chunk. Modified: stable/11/sys/amd64/amd64/pmap.c stable/11/sys/arm64/arm64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Sat Jul 7 17:25:09 2018 (r336070) +++ stable/11/sys/amd64/amd64/pmap.c Sat Jul 7 17:58:20 2018 (r336071) @@ -3483,8 +3483,9 @@ reserve_pv_entries(pmap_t pmap, int needed, struct rwl { struct pch new_tail; struct pv_chunk *pc; - int avail, free; vm_page_t m; + int avail, free; + bool reclaimed; PMAP_LOCK_ASSERT(pmap, MA_OWNED); KASSERT(lockp != NULL, ("reserve_pv_entries: lockp is NULL")); @@ -3512,13 +3513,14 @@ retry: if (avail >= needed) break; } - for (; avail < needed; avail += _NPCPV) { + for (reclaimed = false; avail < needed; avail += _NPCPV) { m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) goto retry; + reclaimed = true; } PV_STAT(atomic_add_int(&pc_chunk_count, 1)); PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); @@ -3531,6 +3533,14 @@ retry: TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); + + /* + * The reclaim might have freed a chunk from the current pmap. + * If that chunk contained available entries, we need to + * re-count the number of available entries. + */ + if (reclaimed) + goto retry; } if (!TAILQ_EMPTY(&new_tail)) { mtx_lock(&pv_chunks_mutex); Modified: stable/11/sys/arm64/arm64/pmap.c ============================================================================== --- stable/11/sys/arm64/arm64/pmap.c Sat Jul 7 17:25:09 2018 (r336070) +++ stable/11/sys/arm64/arm64/pmap.c Sat Jul 7 17:58:20 2018 (r336071) @@ -2108,8 +2108,9 @@ reserve_pv_entries(pmap_t pmap, int needed, struct rwl { struct pch new_tail; struct pv_chunk *pc; - int avail, free; vm_page_t m; + int avail, free; + bool reclaimed; PMAP_LOCK_ASSERT(pmap, MA_OWNED); KASSERT(lockp != NULL, ("reserve_pv_entries: lockp is NULL")); @@ -2132,13 +2133,14 @@ retry: if (avail >= needed) break; } - for (; avail < needed; avail += _NPCPV) { + for (reclaimed = false; avail < needed; avail += _NPCPV) { m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) goto retry; + reclaimed = true; } PV_STAT(atomic_add_int(&pc_chunk_count, 1)); PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); @@ -2151,6 +2153,14 @@ retry: TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); + + /* + * The reclaim might have freed a chunk from the current pmap. + * If that chunk contained available entries, we need to + * re-count the number of available entries. + */ + if (reclaimed) + goto retry; } if (!TAILQ_EMPTY(&new_tail)) { mtx_lock(&pv_chunks_mutex);