Merge ^/head r319251 through r319479.

This commit is contained in:
Dimitry Andric 2017-06-01 22:59:41 +00:00
commit 4224465e82
272 changed files with 8959 additions and 2519 deletions

View File

@ -150,6 +150,11 @@ OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-x86_
OLD_DIRS+=usr/lib/clang/4.0.0/lib/freebsd
OLD_DIRS+=usr/lib/clang/4.0.0/lib
OLD_DIRS+=usr/lib/clang/4.0.0
# 20170601: old libifconfig and libifc
OLD_FILES+=usr/lib/libifc.a
OLD_FILES+=usr/lib/libifc_p.a
OLD_FILES+=usr/lib/libifconfig.a
OLD_FILES+=usr/lib/libifconfig_p.a
# 20170529: mount.conf(8) -> mount.conf(5)
OLD_FILES+=usr/share/man/man8/mount.conf.8.gz
# 20170525: remove misleading template
@ -228,6 +233,9 @@ OLD_FILES+=usr/share/doc/usd/contents.ascii.gz
OLD_LIBS+=lib/libzfs.so.2
OLD_LIBS+=usr/lib/libarchive.so.6
OLD_LIBS+=usr/lib/libmilter.so.5
OLD_LIBS+=usr/lib32/libzfs.so.2
OLD_LIBS+=usr/lib32/libarchive.so.6
OLD_LIBS+=usr/lib32/libmilter.so.5
# 20170427: NATM configuration support removed
OLD_FILES+=etc/rc.d/atm1
OLD_FILES+=etc/rc.d/atm2

View File

@ -70,7 +70,7 @@ seek_offset(IO *io)
*
* Bail out if the calculation of a file offset would overflow.
*/
if ((io->flags & ISCHR) == 0 && n > OFF_MAX / (ssize_t)sz)
if ((io->flags & ISCHR) == 0 && (n < 0 || n > OFF_MAX / (ssize_t)sz))
errx(1, "seek offsets cannot be larger than %jd",
(intmax_t)OFF_MAX);
else if ((io->flags & ISCHR) != 0 && (uint64_t)n > UINT64_MAX / sz)

View File

@ -1,5 +1,10 @@
# $FreeBSD$
.include <src.opts.mk>
.PATH: ${.CURDIR}/..
ATF_TESTS_SH= dd2_test
NETBSD_ATF_TESTS_SH= dd_test
.include <netbsd-tests.test.mk>

50
bin/dd/tests/dd2_test.sh Executable file
View File

@ -0,0 +1,50 @@
#
# Copyright (c) 2017 Spectra Logic Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD$
atf_test_case seek_overflow
seek_overflow_head() {
atf_set "descr" "dd(1) should reject too-large seek values"
}
seek_overflow_body() {
touch f.in
# Positive tests
seek=`echo "2^63 / 4096 - 1" | bc`
atf_check -s exit:0 -e ignore dd if=f.in of=f.out bs=4096 seek=$seek
# Negative tests
seek=`echo "2^63 / 4096" | bc`
atf_check -s not-exit:0 -e match:"seek offsets cannot be larger than" \
dd if=f.in of=f.out bs=4096 seek=$seek
atf_check -s not-exit:0 -e match:"seek offsets cannot be larger than" \
dd if=f.in of=f.out bs=4096 seek=-1
}
atf_init_test_cases()
{
atf_add_test_case seek_overflow
}

View File

@ -1,3 +1,33 @@
2017-04-30 Thomas E. Dickey <dickey@invisible-island.net>
* test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c, test/btyacc/expr.oxout.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/ok_syntax1.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/rename_debug.c, btyaccpar.c, btyaccpar.skel:
fix another uninitialized variable warning in "make check_make" for btyacc
* test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/ok_syntax1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/calc3.tab.c, btyaccpar.c, btyaccpar.skel, test/yacc/ok_syntax1.tab.c, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/calc3.tab.c, yaccpar.c, defs.h, yaccpar.skel, output.c:
fix some compiler warnings for "make check_make" by adding section init_vars,
which initializes the body_vars for pure-parser configuration.
2017-04-30 Tom.Shields
* output.c:
use YY_NO_LEAKS set in configure --with-no-leaks, in the generated code
2017-04-30 Julien.Ramseier
* main.c, test/yacc/big_l.output:
fix typo in unsupported-flag warning message
2017-04-30 Thomas E. Dickey <dickey@invisible-island.net>
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
2017-03-18 Thomas E. Dickey <dickey@invisible-island.net>
* config.sub: 2017-02-07
* config.guess: 2017-03-05
2017-02-01 Thomas E. Dickey <dickey@invisible-island.net>
* test/btyacc/expr.oxout.error, test/btyacc/expr.oxout.output, test/btyacc/expr.oxout.tab.c, test/btyacc/expr.oxout.tab.h, test/yacc/expr.oxout.error, test/yacc/expr.oxout.output, test/yacc/expr.oxout.tab.c, test/yacc/expr.oxout.tab.h:

View File

@ -1,4 +1,4 @@
MANIFEST for byacc-20170201, version t20170201
MANIFEST for byacc-20170430, version t20170430
--------------------------------------------------------------------------------
MANIFEST this file
ACKNOWLEDGEMENTS original version of byacc - 1993

View File

@ -1 +1 @@
20170201
20170430

View File

@ -2,7 +2,7 @@
* @Id: skel2c,v 1.4 2016/06/07 00:26:09 tom Exp @
*/
/* @Id: btyaccpar.skel,v 1.5 2016/12/02 22:02:28 tom Exp @ */
/* @Id: btyaccpar.skel,v 1.6 2017/04/30 23:40:34 tom Exp @ */
#include "defs.h"
@ -450,6 +450,23 @@ const char *const body_2[] =
" if (yydebug)",
" fprintf(stderr, \"%sdebug[<# of symbols on state stack>]\\n\", YYPREFIX);",
"#endif",
"#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
" memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));",
"#endif",
"",
0
};
const char *const init_vars[] =
{
" yyerrflag = 0;",
" yychar = 0;",
" memset(&yyval, 0, sizeof(yyval));",
" memset(&yylval, 0, sizeof(yylval));",
"#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
" memset(&yyloc, 0, sizeof(yyloc));",
" memset(&yylloc, 0, sizeof(yylloc));",
"#endif",
"",
0
};

View File

@ -1,4 +1,4 @@
/* $Id: btyaccpar.skel,v 1.5 2016/12/02 22:02:28 tom Exp $ */
/* $Id: btyaccpar.skel,v 1.7 2017/05/01 00:13:19 tom Exp $ */
#include "defs.h"
@ -385,6 +385,19 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
%% init_vars
yyerrflag = 0;
yychar = 0;
memset(&yyval, 0, sizeof(yyval));
memset(&yylval, 0, sizeof(yylval));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(&yyloc, 0, sizeof(yyloc));
memset(&yylloc, 0, sizeof(yylloc));
#endif
%% body_3
%%ifdef YYBTYACC

View File

@ -2,7 +2,7 @@
# Attempt to guess a canonical system name.
# Copyright 1992-2017 Free Software Foundation, Inc.
timestamp='2017-01-01'
timestamp='2017-03-05'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -837,10 +837,11 @@ EOF
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
UNAME_PROCESSOR=x86_64 ;;
i386)
UNAME_PROCESSOR=i586 ;;
esac
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
@ -1343,6 +1344,9 @@ EOF
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit ;;
NSX-?:NONSTOP_KERNEL:*:*)
echo nsx-tandem-nsk${UNAME_RELEASE}
exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit ;;

View File

@ -2,7 +2,7 @@
# Configuration validation subroutine script.
# Copyright 1992-2017 Free Software Foundation, Inc.
timestamp='2017-01-01'
timestamp='2017-02-07'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -948,6 +948,9 @@ case $basic_machine in
nsr-tandem)
basic_machine=nsr-tandem
;;
nsx-tandem)
basic_machine=nsx-tandem
;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf

View File

@ -1,4 +1,4 @@
/* $Id: defs.h,v 1.56 2017/02/02 00:44:38 tom Exp $ */
/* $Id: defs.h,v 1.57 2017/04/30 23:29:11 tom Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -307,6 +307,7 @@ extern const char *const hdr_defs[];
extern const char *const hdr_vars[];
extern const char *const body_1[];
extern const char *const body_vars[];
extern const char *const init_vars[];
extern const char *const body_2[];
extern const char *const body_3[];
extern const char *const trailer[];

View File

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.59 2017/02/02 00:44:38 tom Exp $ */
/* $Id: main.c,v 1.60 2017/04/30 20:57:56 Julien.Ramseier Exp $ */
#include <signal.h>
#ifndef _WIN32
@ -266,7 +266,7 @@ setflag(int ch)
#if defined(YYBTYACC)
locations = 1;
#else
unsupported_flag_warning("-B", "reconfigure with --enable-btyacc");
unsupported_flag_warning("-L", "reconfigure with --enable-btyacc");
#endif
break;

View File

@ -1,4 +1,4 @@
/* $Id: output.c,v 1.79 2016/12/02 20:42:38 tom Exp $ */
/* $Id: output.c,v 1.81 2017/04/30 23:23:32 tom Exp $ */
#include "defs.h"
@ -1584,6 +1584,19 @@ output_pure_parser(FILE * fp)
putc_code(fp, '\n');
}
#if defined(YY_NO_LEAKS)
static void
output_no_leaks(FILE * fp)
{
putc_code(fp, '\n');
if (fp == code_file)
++outline;
fputs("#define YY_NO_LEAKS 1\n", fp);
putc_code(fp, '\n');
}
#endif
static void
output_trailing_text(void)
{
@ -1985,6 +1998,9 @@ output(void)
output_prefix(fp);
output_pure_parser(fp);
#if defined(YY_NO_LEAKS)
output_no_leaks(fp);
#endif
output_stored_text(fp);
output_stype(fp);
#if defined(YYBTYACC)
@ -2068,6 +2084,10 @@ output(void)
write_section(code_file, body_vars);
}
write_section(code_file, body_2);
if (pure_parser)
{
write_section(code_file, init_vars);
}
#if defined(YYBTYACC)
if (initial_action)
output_initial_action();

View File

@ -1,8 +1,8 @@
Summary: byacc - public domain Berkeley LALR Yacc parser generator
%define AppProgram byacc
%define AppVersion 20170201
%define AppVersion 20170430
%define UseProgram yacc
# $XTermId: byacc.spec,v 1.33 2017/02/01 09:55:04 tom Exp $
# $XTermId: byacc.spec,v 1.34 2017/04/30 20:55:15 tom Exp $
Name: %{AppProgram}
Version: %{AppVersion}
Release: 1

View File

@ -1,3 +1,9 @@
byacc (20170430) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 30 Apr 2017 16:55:15 -0400
byacc (20170201) unstable; urgency=low
* maintenance updates

View File

@ -1,8 +1,8 @@
Summary: byacc - public domain Berkeley LALR Yacc parser generator
%define AppProgram byacc
%define AppVersion 20170201
%define AppVersion 20170430
%define UseProgram yacc
# $XTermId: mingw-byacc.spec,v 1.15 2017/02/01 09:55:04 tom Exp $
# $XTermId: mingw-byacc.spec,v 1.16 2017/04/30 20:55:15 tom Exp $
Name: %{AppProgram}
Version: %{AppVersion}
Release: 1

View File

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.9 2008/07/24 17:13:00 tonnerre Exp $
#
DISTNAME= byacc-20170201
DISTNAME= byacc-20170430
PKGREVISION= 1
CATEGORIES= devel
MASTER_SITES= ftp://invisible-island.net/byacc/

View File

@ -818,6 +818,18 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
yyerrflag = 0;
yychar = 0;
memset(&yyval, 0, sizeof(yyval));
memset(&yylval, 0, sizeof(yylval));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(&yyloc, 0, sizeof(yyloc));
memset(&yylloc, 0, sizeof(yylloc));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1525,7 +1537,7 @@ case 28:
yyval.vval = yystack.l_mark[-1].vval;
}
break;
#line 1529 "btyacc_calc1.tab.c"
#line 1541 "btyacc_calc1.tab.c"
default:
break;
}

View File

@ -1330,6 +1330,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -2103,7 +2106,7 @@ case 59:
#line 197 "btyacc_demo.y"
{ yyval.code = yystack.l_mark[-1].code; }
break;
#line 2107 "btyacc_demo.tab.c"
#line 2110 "btyacc_demo.tab.c"
default:
break;
}

View File

@ -662,6 +662,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1225,7 +1228,7 @@ case 9:
#line 86 "btyacc_destroy1.y"
{ yyval.nlist = yystack.l_mark[-5].nlist; }
break;
#line 1229 "btyacc_destroy1.tab.c"
#line 1232 "btyacc_destroy1.tab.c"
default:
break;
}

View File

@ -662,6 +662,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1225,7 +1228,7 @@ case 9:
#line 86 "btyacc_destroy2.y"
{ yyval.nlist = yystack.l_mark[-5].nlist; }
break;
#line 1229 "btyacc_destroy2.tab.c"
#line 1232 "btyacc_destroy2.tab.c"
default:
break;
}

View File

@ -662,6 +662,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1225,7 +1228,7 @@ case 9:
#line 89 "btyacc_destroy3.y"
{ yyval.nlist = yystack.l_mark[-5].nlist; }
break;
#line 1229 "btyacc_destroy3.tab.c"
#line 1232 "btyacc_destroy3.tab.c"
default:
break;
}

View File

@ -657,6 +657,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1231,7 +1234,7 @@ case 18:
#line 63 "calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1235 "calc.tab.c"
#line 1238 "calc.tab.c"
default:
break;
}

View File

@ -801,6 +801,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1478,7 +1481,7 @@ case 28:
yyval.vval = yystack.l_mark[-1].vval;
}
break;
#line 1482 "calc1.tab.c"
#line 1485 "calc1.tab.c"
default:
break;
}

View File

@ -670,6 +670,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1244,7 +1247,7 @@ case 18:
#line 70 "calc2.y"
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1248 "calc2.tab.c"
#line 1251 "calc2.tab.c"
default:
break;
}

View File

@ -675,6 +675,18 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
yyerrflag = 0;
yychar = 0;
memset(&yyval, 0, sizeof(yyval));
memset(&yylval, 0, sizeof(yylval));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(&yyloc, 0, sizeof(yyloc));
memset(&yylloc, 0, sizeof(yylloc));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1249,7 +1261,7 @@ case 18:
#line 73 "calc3.y"
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1253 "calc3.tab.c"
#line 1265 "calc3.tab.c"
default:
break;
}

View File

@ -530,6 +530,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1104,7 +1107,7 @@ case 18:
#line 67 "code_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1108 "code_calc.code.c"
#line 1111 "code_calc.code.c"
default:
break;
}

View File

@ -500,6 +500,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;

View File

@ -519,6 +519,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;

View File

@ -619,6 +619,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1189,7 +1192,7 @@ case 13:
#line 75 "err_inherit3.y"
{ yyval.nlist = yystack.l_mark[0].nlist; }
break;
#line 1193 "err_inherit3.tab.c"
#line 1196 "err_inherit3.tab.c"
default:
break;
}

View File

@ -617,6 +617,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1179,7 +1182,7 @@ case 11:
#line 77 "err_inherit4.y"
{ yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[1]; }
break;
#line 1183 "err_inherit4.tab.c"
#line 1186 "err_inherit4.tab.c"
default:
break;
}

View File

@ -518,6 +518,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;

View File

@ -524,6 +524,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;

View File

@ -530,6 +530,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;

View File

@ -527,6 +527,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1045,7 +1048,7 @@ case 1:
#line 9 "err_syntax18.y"
{ yyval = yystack.l_mark[1]; }
break;
#line 1049 "err_syntax18.tab.c"
#line 1052 "err_syntax18.tab.c"
default:
break;
}

View File

@ -522,6 +522,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1040,7 +1043,7 @@ case 1:
#line 12 "err_syntax20.y"
{ yystack.l_mark[-1].rechk = 3; }
break;
#line 1044 "err_syntax20.tab.c"
#line 1047 "err_syntax20.tab.c"
default:
break;
}

View File

@ -523,6 +523,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;

View File

@ -1943,6 +1943,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -2515,7 +2518,7 @@ case 10:
yyyGenIntNode(8,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
yyyAdjustINRC(8,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
break;
#line 2519 "expr.oxout.tab.c"
#line 2522 "expr.oxout.tab.c"
default:
break;
}

View File

@ -1496,6 +1496,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -2684,7 +2687,7 @@ case 114:
yyval.declarator->func_def = FUNC_ANSI;
}
break;
#line 2688 "grammar.tab.c"
#line 2691 "grammar.tab.c"
default:
break;
}

View File

@ -542,6 +542,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1100,7 +1103,7 @@ case 11:
#line 43 "inherit0.y"
{ yyval = yystack.l_mark[0]; }
break;
#line 1104 "inherit0.tab.c"
#line 1107 "inherit0.tab.c"
default:
break;
}

View File

@ -563,6 +563,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1125,7 +1128,7 @@ case 11:
#line 71 "inherit1.y"
{ yyval.nlist = yystack.l_mark[0].nlist; }
break;
#line 1129 "inherit1.tab.c"
#line 1132 "inherit1.tab.c"
default:
break;
}

View File

@ -618,6 +618,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1184,7 +1187,7 @@ case 12:
#line 75 "inherit2.y"
{ yyval.nlist = yystack.l_mark[0].nlist; }
break;
#line 1188 "inherit2.tab.c"
#line 1191 "inherit2.tab.c"
default:
break;
}

View File

@ -698,6 +698,18 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
yyerrflag = 0;
yychar = 0;
memset(&yyval, 0, sizeof(yyval));
memset(&yylval, 0, sizeof(yylval));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(&yyloc, 0, sizeof(yyloc));
memset(&yylloc, 0, sizeof(yylloc));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1272,7 +1284,7 @@ case 18:
#line 101 "ok_syntax1.y"
{ yyval.ival = (*base) * yystack.l_mark[-1].ival + yystack.l_mark[0].ival; }
break;
#line 1276 "ok_syntax1.tab.c"
#line 1288 "ok_syntax1.tab.c"
default:
break;
}

View File

@ -671,6 +671,18 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
yyerrflag = 0;
yychar = 0;
memset(&yyval, 0, sizeof(yyval));
memset(&yylval, 0, sizeof(yylval));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(&yyloc, 0, sizeof(yyloc));
memset(&yylloc, 0, sizeof(yylloc));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1245,7 +1257,7 @@ case 18:
#line 69 "pure_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1249 "pure_calc.tab.c"
#line 1261 "pure_calc.tab.c"
default:
break;
}

View File

@ -539,6 +539,18 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
yyerrflag = 0;
yychar = 0;
memset(&yyval, 0, sizeof(yyval));
memset(&yylval, 0, sizeof(yylval));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(&yyloc, 0, sizeof(yyloc));
memset(&yylloc, 0, sizeof(yylloc));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;

View File

@ -675,6 +675,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1249,7 +1252,7 @@ case 18:
#line 70 "quote_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1253 "quote_calc-s.tab.c"
#line 1256 "quote_calc-s.tab.c"
default:
break;
}

View File

@ -681,6 +681,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1255,7 +1258,7 @@ case 18:
#line 70 "quote_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1259 "quote_calc.tab.c"
#line 1262 "quote_calc.tab.c"
default:
break;
}

View File

@ -675,6 +675,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1249,7 +1252,7 @@ case 18:
#line 70 "quote_calc2.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1253 "quote_calc2-s.tab.c"
#line 1256 "quote_calc2-s.tab.c"
default:
break;
}

View File

@ -681,6 +681,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1255,7 +1258,7 @@ case 18:
#line 70 "quote_calc2.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1259 "quote_calc2.tab.c"
#line 1262 "quote_calc2.tab.c"
default:
break;
}

View File

@ -676,6 +676,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1250,7 +1253,7 @@ case 18:
#line 70 "quote_calc3.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1254 "quote_calc3-s.tab.c"
#line 1257 "quote_calc3-s.tab.c"
default:
break;
}

View File

@ -676,6 +676,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1250,7 +1253,7 @@ case 18:
#line 70 "quote_calc3.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1254 "quote_calc3.tab.c"
#line 1257 "quote_calc3.tab.c"
default:
break;
}

View File

@ -676,6 +676,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1250,7 +1253,7 @@ case 18:
#line 70 "quote_calc4.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1254 "quote_calc4-s.tab.c"
#line 1257 "quote_calc4-s.tab.c"
default:
break;
}

View File

@ -676,6 +676,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1250,7 +1253,7 @@ case 18:
#line 70 "quote_calc4.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1254 "quote_calc4.tab.c"
#line 1257 "quote_calc4.tab.c"
default:
break;
}

View File

@ -386,6 +386,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;

View File

@ -802,6 +802,9 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
@ -1479,7 +1482,7 @@ case 28:
yyval.vval = yystack.l_mark[-1].vval;
}
break;
#line 1483 "varsyntax_calc1.tab.c"
#line 1486 "varsyntax_calc1.tab.c"
default:
break;
}

View File

@ -1,4 +1,4 @@
YACC: w - -B flag unsupported, reconfigure with --enable-btyacc
YACC: w - -L flag unsupported, reconfigure with --enable-btyacc
Usage: YACC [options] filename
Options:

View File

@ -443,6 +443,9 @@ YYPARSE_DECL()
}
#endif
memset(&yyval, 0, sizeof(yyval));
memset(&yylval, 0, sizeof(yylval));
yym = 0;
yyn = 0;
yynerrs = 0;
@ -627,7 +630,7 @@ case 18:
#line 73 "calc3.y"
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 631 "calc3.tab.c"
#line 634 "calc3.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;

View File

@ -467,6 +467,9 @@ YYPARSE_DECL()
}
#endif
memset(&yyval, 0, sizeof(yyval));
memset(&yylval, 0, sizeof(yylval));
yym = 0;
yyn = 0;
yynerrs = 0;
@ -651,7 +654,7 @@ case 18:
#line 101 "ok_syntax1.y"
{ yyval.ival = (*base) * yystack.l_mark[-1].ival + yystack.l_mark[0].ival; }
break;
#line 655 "ok_syntax1.tab.c"
#line 658 "ok_syntax1.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;

View File

@ -439,6 +439,9 @@ YYPARSE_DECL()
}
#endif
memset(&yyval, 0, sizeof(yyval));
memset(&yylval, 0, sizeof(yylval));
yym = 0;
yyn = 0;
yynerrs = 0;
@ -623,7 +626,7 @@ case 18:
#line 69 "pure_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 627 "pure_calc.tab.c"
#line 630 "pure_calc.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;

View File

@ -336,6 +336,9 @@ YYPARSE_DECL()
}
#endif
memset(&yyval, 0, sizeof(yyval));
memset(&yylval, 0, sizeof(yylval));
yym = 0;
yyn = 0;
yynerrs = 0;

View File

@ -2,7 +2,7 @@
* @Id: skel2c,v 1.4 2016/06/07 00:26:09 tom Exp @
*/
/* @Id: yaccpar.skel,v 1.7 2016/06/06 23:35:55 Tom.Shields Exp @ */
/* @Id: yaccpar.skel,v 1.8 2016/12/02 21:44:42 tom Exp @ */
#include "defs.h"
@ -214,6 +214,14 @@ const char *const body_2[] =
0
};
const char *const init_vars[] =
{
" memset(&yyval, 0, sizeof(yyval));",
" memset(&yylval, 0, sizeof(yylval));",
"",
0
};
const char *const body_3[] =
{
" yym = 0;",

View File

@ -1,4 +1,4 @@
/* $Id: yaccpar.skel,v 1.8 2016/12/02 21:44:42 tom Exp $ */
/* $Id: yaccpar.skel,v 1.9 2017/04/30 23:28:17 tom Exp $ */
#include "defs.h"
@ -166,6 +166,10 @@ YYPARSE_DECL()
}
#endif
%% init_vars
memset(&yyval, 0, sizeof(yyval));
memset(&yylval, 0, sizeof(yylval));
%% body_3
yym = 0;
yyn = 0;

View File

@ -663,7 +663,7 @@ poollist(argc, argv)
poolname = NULL;
role = IPL_LOGALL;
while ((c = getopt(argc, argv, "dm:M:N:o:Rt:v")) != -1)
while ((c = getopt(argc, argv, "dm:M:N:o:t:v")) != -1)
switch (c)
{
case 'd' :
@ -690,9 +690,6 @@ poollist(argc, argv)
case 'O' :
pool_fields = parsefields(poolfields, optarg);
break;
case 'R' :
opts |= OPT_NORESOLVE;
break;
case 't' :
type = gettype(optarg, NULL);
if (type == IPLT_NONE) {

View File

@ -360,30 +360,30 @@ edithost(char *pat, char *host)
{
char *res = editedhost;
if (!pat)
pat = strdup("");
while (*pat) {
switch (*pat) {
if (pat) {
while (*pat) {
switch (*pat) {
case '#':
if (*host)
host++;
break;
case '#':
if (*host)
host++;
break;
case '@':
if (*host)
*res++ = *host++;
break;
case '@':
if (*host)
*res++ = *host++;
break;
default:
*res++ = *pat;
break;
default:
*res++ = *pat;
break;
}
if (res == &editedhost[sizeof editedhost - 1]) {
*res = '\0';
return;
}
pat++;
}
if (res == &editedhost[sizeof editedhost - 1]) {
*res = '\0';
return;
}
pat++;
}
if (*host)
(void) strncpy(res, host,

View File

@ -70,7 +70,7 @@ savecore_start()
if savecore -C "${dev}" >/dev/null; then
savecore ${savecore_flags} ${dumpdir} ${dumpdev}
if checkyesno crashinfo_enable; then
${crashinfo_program} -d ${dumpdir}
${crashinfo_program} -b -d ${dumpdir}
fi
sync
else

View File

@ -24,16 +24,17 @@ BUILD_ARCH?= ${MACHINE_ARCH}
# arm (for armv4 and armv5 CPUs) always uses the soft float ABI.
# For all other targets, we stick with 'unknown'.
.if ${TARGET_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
TARGET_ABI= gnueabihf
TARGET_ABI= -gnueabihf
.elif ${TARGET_ARCH:Marm*}
TARGET_ABI= gnueabi
TARGET_ABI= -gnueabi
.else
TARGET_ABI= unknown
TARGET_ABI=
.endif
VENDOR= unknown
OS_VERSION= freebsd12.0
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${TARGET_ABI}-${OS_VERSION}
BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-unknown-${OS_VERSION}
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI}
BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}
CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\"
CFLAGS+= -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\"

View File

@ -609,6 +609,8 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
switch (af) {
case AF_INET:
if (nbuf->len < sizeof(*sin))
return NULL;
sin = nbuf->buf;
if (inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf)
== NULL)
@ -620,6 +622,8 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
break;
#ifdef INET6
case AF_INET6:
if (nbuf->len < sizeof(*sin6))
return NULL;
sin6 = nbuf->buf;
if (inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6)
== NULL)
@ -658,6 +662,10 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr)
port = 0;
sin = NULL;
if (uaddr == NULL)
return NULL;
addrstr = strdup(uaddr);
if (addrstr == NULL)
return NULL;

View File

@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <rpc/rpcb_prot.h>
#include <rpc/rpc_com.h>
#include "un-namespace.h"
bool_t
@ -62,13 +63,13 @@ xdr_rpcb(XDR *xdrs, RPCB *objp)
if (!xdr_rpcvers(xdrs, &objp->r_vers)) {
return (FALSE);
}
if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->r_netid, RPC_MAXDATASIZE)) {
return (FALSE);
}
if (!xdr_string(xdrs, &objp->r_addr, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->r_addr, RPC_MAXDATASIZE)) {
return (FALSE);
}
if (!xdr_string(xdrs, &objp->r_owner, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->r_owner, RPC_MAXDATASIZE)) {
return (FALSE);
}
return (TRUE);
@ -162,19 +163,19 @@ xdr_rpcblist(XDR *xdrs, RPCBLIST **rp)
bool_t
xdr_rpcb_entry(XDR *xdrs, rpcb_entry *objp)
{
if (!xdr_string(xdrs, &objp->r_maddr, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->r_maddr, RPC_MAXDATASIZE)) {
return (FALSE);
}
if (!xdr_string(xdrs, &objp->r_nc_netid, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->r_nc_netid, RPC_MAXDATASIZE)) {
return (FALSE);
}
if (!xdr_u_int32_t(xdrs, &objp->r_nc_semantics)) {
return (FALSE);
}
if (!xdr_string(xdrs, &objp->r_nc_protofmly, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->r_nc_protofmly, RPC_MAXDATASIZE)) {
return (FALSE);
}
if (!xdr_string(xdrs, &objp->r_nc_proto, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->r_nc_proto, RPC_MAXDATASIZE)) {
return (FALSE);
}
return (TRUE);
@ -289,7 +290,7 @@ xdr_rpcb_rmtcallres(XDR *xdrs, struct rpcb_rmtcallres *p)
bool_t dummy;
struct r_rpcb_rmtcallres *objp = (struct r_rpcb_rmtcallres *)(void *)p;
if (!xdr_string(xdrs, &objp->addr, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->addr, RPC_MAXDATASIZE)) {
return (FALSE);
}
if (!xdr_u_int(xdrs, &objp->results.results_len)) {

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <rpc/rpc.h>
#include <rpc/rpc_com.h>
#include "un-namespace.h"
/* Link list of all the stats about getport and getaddr */
@ -63,7 +64,7 @@ xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
if (!xdr_int(xdrs, &objp->failure)) {
return (FALSE);
}
if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
return (FALSE);
}
@ -115,7 +116,7 @@ xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp)
IXDR_PUT_INT32(buf, objp->failure);
IXDR_PUT_INT32(buf, objp->indirect);
}
if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
return (FALSE);
}
pnext = &objp->next;
@ -154,7 +155,7 @@ xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp)
objp->failure = (int)IXDR_GET_INT32(buf);
objp->indirect = (int)IXDR_GET_INT32(buf);
}
if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
return (FALSE);
}
if (!xdr_pointer(xdrs, (char **) pnext,
@ -182,7 +183,7 @@ xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp)
if (!xdr_int(xdrs, &objp->indirect)) {
return (FALSE);
}
if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
return (FALSE);
}
if (!xdr_pointer(xdrs, (char **) pnext,

View File

@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
#include <rpc/rpc.h>
#include <rpc/rpc_com.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include "un-namespace.h"
@ -64,7 +66,6 @@ typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */
*/
#define XDR_FALSE ((long) 0)
#define XDR_TRUE ((long) 1)
#define LASTUNSIGNED ((u_int) 0-1)
/*
* for unit alignment
@ -561,6 +562,7 @@ xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
{
char *sp = *cpp; /* sp is the actual string pointer */
u_int nodesize;
bool_t ret, allocated = FALSE;
/*
* first deal with the length since xdr bytes are counted
@ -584,6 +586,7 @@ xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
}
if (sp == NULL) {
*cpp = sp = mem_alloc(nodesize);
allocated = TRUE;
}
if (sp == NULL) {
warnx("xdr_bytes: out of memory");
@ -592,7 +595,14 @@ xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
/* FALLTHROUGH */
case XDR_ENCODE:
return (xdr_opaque(xdrs, sp, nodesize));
ret = xdr_opaque(xdrs, sp, nodesize);
if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) {
if (allocated == TRUE) {
free(sp);
*cpp = NULL;
}
}
return (ret);
case XDR_FREE:
if (sp != NULL) {
@ -683,6 +693,7 @@ xdr_string(XDR *xdrs, char **cpp, u_int maxsize)
char *sp = *cpp; /* sp is the actual string pointer */
u_int size;
u_int nodesize;
bool_t ret, allocated = FALSE;
/*
* first deal with the length since xdr strings are counted-strings
@ -716,8 +727,10 @@ xdr_string(XDR *xdrs, char **cpp, u_int maxsize)
if (nodesize == 0) {
return (TRUE);
}
if (sp == NULL)
if (sp == NULL) {
*cpp = sp = mem_alloc(nodesize);
allocated = TRUE;
}
if (sp == NULL) {
warnx("xdr_string: out of memory");
return (FALSE);
@ -726,7 +739,14 @@ xdr_string(XDR *xdrs, char **cpp, u_int maxsize)
/* FALLTHROUGH */
case XDR_ENCODE:
return (xdr_opaque(xdrs, sp, size));
ret = xdr_opaque(xdrs, sp, size);
if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) {
if (allocated == TRUE) {
free(sp);
*cpp = NULL;
}
}
return (ret);
case XDR_FREE:
mem_free(sp, nodesize);
@ -744,7 +764,7 @@ xdr_string(XDR *xdrs, char **cpp, u_int maxsize)
bool_t
xdr_wrapstring(XDR *xdrs, char **cpp)
{
return xdr_string(xdrs, cpp, LASTUNSIGNED);
return xdr_string(xdrs, cpp, RPC_MAXDATASIZE);
}
/*

View File

@ -46,8 +46,10 @@ kinfo_getvmobject(int *cntp)
buf = NULL;
for (i = 0; i < 3; i++) {
if (sysctlbyname("vm.objects", NULL, &len, NULL, 0) < 0)
if (sysctlbyname("vm.objects", NULL, &len, NULL, 0) < 0) {
free(buf);
return (NULL);
}
buf = reallocf(buf, len);
if (buf == NULL)
return (NULL);

View File

@ -6221,15 +6221,15 @@ scsiformat(struct cam_device *device, int argc, char **argv,
if ((scsi_get_sks(sense, ccb->csio.sense_len -
ccb->csio.sense_resid, sks) == 0)
&& (quiet == 0)) {
int val;
uint32_t val;
u_int64_t percentage;
val = scsi_2btoul(&sks[1]);
percentage = 10000 * val;
percentage = 10000ull * val;
fprintf(stdout,
"\rFormatting: %ju.%02u %% "
"(%d/%d) done",
"(%u/%d) done",
(uintmax_t)(percentage /
(0x10000 * 100)),
(unsigned)((percentage /

View File

@ -131,8 +131,10 @@ parse_string(FILE *cfile)
error("no memory for string %s.", val);
memcpy(s, val, valsize);
if (!parse_semi(cfile))
if (!parse_semi(cfile)) {
free(s);
return (NULL);
}
return (s);
}
@ -246,9 +248,10 @@ parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max,
char *val, *t;
size_t valsize;
pair c = NULL;
unsigned char *lbufp = NULL;
if (!bufp && *max) {
bufp = malloc(*max * size / 8);
lbufp = bufp = malloc(*max * size / 8);
if (!bufp)
error("can't allocate space for numeric aggregate");
} else
@ -265,6 +268,7 @@ parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max,
parse_warn("too few numbers.");
if (token != SEMI)
skip_to_semi(cfile);
free(lbufp);
return (NULL);
}
token = next_token(&val, cfile);
@ -281,6 +285,7 @@ parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max,
(base != 16 || token != NUMBER_OR_NAME)) {
parse_warn("expecting numeric value.");
skip_to_semi(cfile);
free(lbufp);
return (NULL);
}
/*
@ -302,6 +307,7 @@ parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max,
/* If we had to cons up a list, convert it now. */
if (c) {
free(lbufp);
bufp = malloc(count * size / 8);
if (!bufp)
error("can't allocate space for numeric aggregate.");

View File

@ -2896,6 +2896,11 @@ the packets are dropped.
.Nm
support in-kernel NAT using the kernel version of
.Xr libalias 3 .
The kernel module
.Cm ipfw_nat
should be loaded or kernel should have
.Cm options IPFIREWALL_NAT
to be able use NAT.
.Pp
The nat configuration command is the following:
.Bd -ragged -offset indent

View File

@ -215,6 +215,14 @@ flag to forcibly destroy an
disk that is still in use.
.It Oo Cm no Oc Ns Cm readonly
Enable/disable readonly mode.
.It Oo Cm no Oc Ns Cm verify
For
.Cm vnode
backed devices: enable/disable requesting verification of the
file used for backing store.
The type of verification depends on which security features are available.
One example of verification is testing file integrity with
checksums or cryptographic signatures.
.El
.It Fl u Ar unit
Request a specific unit number or device name for the
@ -298,6 +306,7 @@ gnop create -o 512K md1
mount /dev/md1.nop /mnt
.Ed
.Sh SEE ALSO
.Xr open 2 ,
.Xr md 4 ,
.Xr ffs 7 ,
.Xr gpart 8 ,

View File

@ -193,6 +193,10 @@ main(int argc, char **argv)
mdio.md_options |= MD_RESERVE;
else if (!strcmp(optarg, "noreserve"))
mdio.md_options &= ~MD_RESERVE;
else if (!strcmp(optarg, "verify"))
mdio.md_options |= MD_VERIFY;
else if (!strcmp(optarg, "noverify"))
mdio.md_options &= ~MD_VERIFY;
else
errx(1, "unknown option: %s", optarg);
break;

View File

@ -115,6 +115,7 @@ static struct opt {
{ MNT_NFS4ACLS, "nfsv4acls" },
{ MNT_GJOURNAL, "gjournal" },
{ MNT_AUTOMOUNTED, "automounted" },
{ MNT_VERIFIED, "verified" },
{ 0, NULL }
};

View File

@ -857,6 +857,9 @@ MLINKS+=getenv.9 freeenv.9 \
getenv.9 getenv_quad.9 \
getenv.9 getenv_uint.9 \
getenv.9 getenv_ulong.9 \
getenv.9 kern_getenv.9 \
getenv.9 kern_setenv.9 \
getenv.9 kern_unsetenv.9 \
getenv.9 setenv.9 \
getenv.9 testenv.9 \
getenv.9 unsetenv.9

View File

@ -27,21 +27,21 @@
.\"
.\" $FreeBSD$
.\"
.Dd October 22, 2015
.Dd June 1, 2017
.Dt GETENV 9
.Os
.Sh NAME
.Nm freeenv ,
.Nm getenv ,
.Nm kern_getenv ,
.Nm getenv_int ,
.Nm getenv_long ,
.Nm getenv_string ,
.Nm getenv_quad ,
.Nm getenv_uint ,
.Nm getenv_ulong ,
.Nm setenv ,
.Nm kern_setenv ,
.Nm testenv ,
.Nm unsetenv
.Nm kern_unsetenv
.Nd kernel environment variable functions
.Sh SYNOPSIS
.In sys/param.h
@ -49,7 +49,7 @@
.Ft void
.Fn freeenv "char *env"
.Ft char *
.Fn getenv "const char *name"
.Fn kern_getenv "const char *name"
.Ft int
.Fn getenv_int "const char *name" "int *data"
.Ft int
@ -63,41 +63,41 @@
.Ft int
.Fn getenv_ulong "const char *name" "unsigned long *data"
.Ft int
.Fn setenv "const char *name" "const char *value"
.Fn kern_setenv "const char *name" "const char *value"
.Ft int
.Fn testenv "const char *name"
.Ft int
.Fn unsetenv "const char *name"
.Fn kern_unsetenv "const char *name"
.Sh DESCRIPTION
These functions set, unset, fetch, and parse variables from the kernel's
environment.
.Pp
The
.Fn getenv
.Fn kern_getenv
function obtains the current value of the kernel environment variable
.Fa name
and returns a pointer to the string value.
The caller should not modify the string pointed to by the return value.
The
.Fn getenv
.Fn kern_getenv
function may allocate temporary storage,
so the
.Fn freeenv
function must be called to release any allocated resources when the value
returned by
.Fn getenv
.Fn kern_getenv
is no longer needed.
.Pp
The
.Fn freeenv
function is used to release the resources allocated by a previous call to
.Fn getenv .
.Fn kern_getenv .
The
.Fa env
argument passed to
.Fn freeenv
is the pointer returned by the earlier call to
.Fn getenv .
.Fn kern_getenv .
Like
.Xr free 3 ,
the
@ -107,7 +107,7 @@ argument can be
in which case no action occurs.
.Pp
The
.Fn setenv
.Fn kern_setenv
function inserts or resets the kernel environment variable
.Fa name
to
@ -120,7 +120,7 @@ This function can fail if an internal limit on the number of environment
variables is exceeded.
.Pp
The
.Fn unsetenv
.Fn kern_unsetenv
function deletes the kernel environment variable
.Fa name .
.Pp
@ -196,15 +196,15 @@ characters of its value are copied to the buffer pointed to by
followed by a null character and a non-zero value is returned.
.Sh RETURN VALUES
The
.Fn getenv
.Fn kern_getenv
function returns a pointer to an environment variable's value on success or
.Dv NULL
if the variable does not exist.
.Pp
The
.Fn setenv
.Fn kern_setenv
and
.Fn unsetenv
.Fn kern_unsetenv
functions return zero on success and -1 on failure.
.Pp
The

View File

@ -30,7 +30,7 @@ coresecretary [label="Core Team Secretary\ncore-secretary@FreeBSD.org\nmatthew"]
doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"]
doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\ngjb, blackend,\ngabor, hrs"]
portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"]
portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nadamw, antoine, bdrewery, feld\nmat, rene, swills"]
portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nadamw, antoine, bapt, bdrewery\nfeld, mat, rene, swills"]
portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\nrene"]
re [label="Primary Release Engineering Team\nre@FreeBSD.org\nkib, blackend, jpaetzel, hrs, kensmith"]
secteam [label="Security Team\nsecteam@FreeBSD.org\ndelphij,\ndes, gavin, gjb,\nglebius, remko"]

View File

@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
* Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
* Copyright (c) 2013-2017 Mellanox Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -60,19 +60,24 @@ linux_fget(unsigned int fd)
return (struct linux_file *)file->f_data;
}
extern void linux_file_free(struct linux_file *filp);
static inline void
fput(struct linux_file *filp)
{
if (filp->_file == NULL) {
kfree(filp);
return;
}
if (refcount_release(&filp->_file->f_count)) {
_fdrop(filp->_file, curthread);
kfree(filp);
if (refcount_release(filp->_file == NULL ?
&filp->f_count : &filp->_file->f_count)) {
linux_file_free(filp);
}
}
static inline unsigned int
file_count(struct linux_file *filp)
{
return (filp->_file == NULL ?
filp->f_count : filp->_file->f_count);
}
static inline void
put_unused_fd(unsigned int fd)
{
@ -106,6 +111,10 @@ fd_install(unsigned int fd, struct linux_file *filp)
} else {
filp->_file = file;
finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops);
/* transfer reference count from "filp" to "file" */
while (refcount_release(&filp->f_count) == 0)
refcount_acquire(&file->f_count);
}
/* drop the extra reference */
@ -142,18 +151,18 @@ get_unused_fd_flags(int flags)
return fd;
}
extern struct linux_file *linux_file_alloc(void);
static inline struct linux_file *
alloc_file(int mode, const struct file_operations *fops)
{
struct linux_file *filp;
filp = kzalloc(sizeof(*filp), GFP_KERNEL);
if (filp == NULL)
return (NULL);
filp = linux_file_alloc();
filp->f_op = fops;
filp->f_mode = mode;
return filp;
return (filp);
}
struct fd {
@ -171,7 +180,7 @@ static inline struct fd fdget(unsigned int fd)
return (struct fd){f};
}
#define file linux_file
#define fget linux_fget
#define file linux_file
#define fget(...) linux_fget(__VA_ARGS__)
#endif /* _LINUX_FILE_H_ */

View File

@ -41,6 +41,7 @@
#include <linux/types.h>
#include <linux/wait.h>
#include <linux/semaphore.h>
#include <linux/spinlock.h>
struct module;
struct kiocb;
@ -79,6 +80,16 @@ struct linux_file {
struct selinfo f_selinfo;
struct sigio *f_sigio;
struct vnode *f_vnode;
volatile u_int f_count;
/* kqfilter support */
int f_kqflags;
#define LINUX_KQ_FLAG_HAS_READ (1 << 0)
#define LINUX_KQ_FLAG_HAS_WRITE (1 << 1)
#define LINUX_KQ_FLAG_NEED_READ (1 << 2)
#define LINUX_KQ_FLAG_NEED_WRITE (1 << 3)
/* protects f_selinfo.si_note */
spinlock_t f_kqlock;
};
#define file linux_file
@ -220,6 +231,14 @@ iminor(struct inode *inode)
return (minor(dev2unit(inode->v_rdev)));
}
static inline struct linux_file *
get_file(struct linux_file *f)
{
refcount_acquire(f->_file == NULL ? &f->f_count : &f->_file->f_count);
return (f);
}
static inline struct inode *
igrab(struct inode *inode)
{

View File

@ -75,9 +75,8 @@ struct idr {
SYSINIT(name##_ida_sysinit, SI_SUB_DRIVERS, SI_ORDER_FIRST, \
ida_init, &(name))
#define idr_preload(x) do { } while (0)
#define idr_preload_end() do { } while (0)
void idr_preload(gfp_t gfp_mask);
void idr_preload_end(void);
void *idr_find(struct idr *idp, int id);
void *idr_get_next(struct idr *idp, int *nextid);
int idr_pre_get(struct idr *idp, gfp_t gfp_mask);

View File

@ -48,10 +48,15 @@
__task; \
})
#define in_atomic() ({ \
linux_in_atomic(); \
})
extern int kthread_stop(struct task_struct *);
extern bool kthread_should_stop_task(struct task_struct *);
extern bool kthread_should_stop(void);
extern void linux_kthread_fn(void *);
extern struct task_struct *linux_kthread_setup_and_run(struct thread *, linux_task_fn_t *, void *arg);
extern int linux_in_atomic(void);
#endif /* _LINUX_KTHREAD_H_ */

View File

@ -38,11 +38,9 @@
struct vm_area_struct;
struct task_struct;
struct vmspace;
struct mm_struct {
struct vm_area_struct *mmap;
struct vmspace *vmspace;
atomic_t mm_count;
atomic_t mm_users;
size_t pinned_vm;

View File

@ -43,7 +43,9 @@ typedef struct poll_table_struct {
static inline void
poll_wait(struct linux_file *filp, wait_queue_head_t *wait_address, poll_table *p)
{
selrecord(curthread, &filp->f_selinfo);
/* NOP */
}
extern void linux_poll_wakeup(struct linux_file *);
#endif /* _LINUX_POLL_H_ */

View File

@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
* Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
* Copyright (c) 2013-2017 Mellanox Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -28,8 +28,10 @@
*
* $FreeBSD$
*/
#ifndef _FBSD_PRINTK_H_
#define _FBSD_PRINTK_H_
#ifndef _LINUX_PRINTK_H_
#define _LINUX_PRINTK_H_
#include <linux/kernel.h>
/* GID printing macros */
#define GID_PRINT_FMT "%.4x:%.4x:%.4x:%.4x:%.4x:%.4x:%.4x:%.4x"
@ -38,4 +40,76 @@
htons(((u16 *)gid_raw)[4]), htons(((u16 *)gid_raw)[5]),\
htons(((u16 *)gid_raw)[6]), htons(((u16 *)gid_raw)[7])
#endif /* _FBSD_PRINTK_H */
enum {
DUMP_PREFIX_NONE,
DUMP_PREFIX_ADDRESS,
DUMP_PREFIX_OFFSET
};
static inline void
print_hex_dump(const char *level, const char *prefix_str,
const int prefix_type, const int rowsize, const int groupsize,
const void *buf, size_t len, const bool ascii)
{
typedef const struct { long long value; } __packed *print_64p_t;
typedef const struct { uint32_t value; } __packed *print_32p_t;
typedef const struct { uint16_t value; } __packed *print_16p_t;
const void *buf_old = buf;
int row;
while (len > 0) {
if (level != NULL)
printf("%s", level);
if (prefix_str != NULL)
printf("%s ", prefix_str);
switch (prefix_type) {
case DUMP_PREFIX_ADDRESS:
printf("[%p] ", buf);
break;
case DUMP_PREFIX_OFFSET:
printf("[%p] ", (const char *)((const char *)buf -
(const char *)buf_old));
break;
default:
break;
}
for (row = 0; row != rowsize; row++) {
if (groupsize == 8 && len > 7) {
printf("%016llx ", ((print_64p_t)buf)->value);
buf = (const uint8_t *)buf + 8;
len -= 8;
} else if (groupsize == 4 && len > 3) {
printf("%08x ", ((print_32p_t)buf)->value);
buf = (const uint8_t *)buf + 4;
len -= 4;
} else if (groupsize == 2 && len > 1) {
printf("%04x ", ((print_16p_t)buf)->value);
buf = (const uint8_t *)buf + 2;
len -= 2;
} else if (len > 0) {
printf("%02x ", *(const uint8_t *)buf);
buf = (const uint8_t *)buf + 1;
len--;
} else {
break;
}
}
printf("\n");
}
}
static inline void
print_hex_dump_bytes(const char *prefix_str, const int prefix_type,
const void *buf, size_t len)
{
print_hex_dump(NULL, prefix_str, prefix_type, 16, 1, buf, len, 0);
}
#define printk_ratelimited(...) do { \
static linux_ratelimit_t __ratelimited; \
if (linux_ratelimited(&__ratelimited)) \
printk(__VA_ARGS__); \
} while (0)
#endif /* _LINUX_PRINTK_H_ */

View File

@ -73,8 +73,9 @@ __FBSDID("$FreeBSD$");
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/uaccess.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/kthread.h>
#include <linux/kernel.h>
#include <linux/compat.h>
#include <linux/poll.h>
#include <linux/smp.h>
@ -401,6 +402,77 @@ linux_file_dtor(void *cdp)
kfree(filp);
}
static void
linux_kq_lock(void *arg)
{
spinlock_t *s = arg;
spin_lock(s);
}
static void
linux_kq_unlock(void *arg)
{
spinlock_t *s = arg;
spin_unlock(s);
}
static void
linux_kq_lock_owned(void *arg)
{
#ifdef INVARIANTS
spinlock_t *s = arg;
mtx_assert(&s->m, MA_OWNED);
#endif
}
static void
linux_kq_lock_unowned(void *arg)
{
#ifdef INVARIANTS
spinlock_t *s = arg;
mtx_assert(&s->m, MA_NOTOWNED);
#endif
}
static void
linux_dev_kqfilter_poll(struct linux_file *);
struct linux_file *
linux_file_alloc(void)
{
struct linux_file *filp;
filp = kzalloc(sizeof(*filp), GFP_KERNEL);
/* set initial refcount */
filp->f_count = 1;
/* setup fields needed by kqueue support */
spin_lock_init(&filp->f_kqlock);
knlist_init(&filp->f_selinfo.si_note, &filp->f_kqlock,
linux_kq_lock, linux_kq_unlock,
linux_kq_lock_owned, linux_kq_lock_unowned);
return (filp);
}
void
linux_file_free(struct linux_file *filp)
{
if (filp->_file == NULL) {
kfree(filp);
} else {
/*
* The close method of the character device or file
* will free the linux_file structure:
*/
_fdrop(filp->_file, curthread);
}
}
static int
linux_cdev_pager_populate(vm_object_t vm_obj, vm_pindex_t pidx, int fault_type,
vm_prot_t max_prot, vm_pindex_t *first, vm_pindex_t *last)
@ -472,6 +544,19 @@ static struct rwlock linux_vma_lock;
static TAILQ_HEAD(, vm_area_struct) linux_vma_head =
TAILQ_HEAD_INITIALIZER(linux_vma_head);
static void
linux_cdev_handle_free(struct vm_area_struct *vmap)
{
/* Drop reference on vm_file */
if (vmap->vm_file != NULL)
fput(vmap->vm_file);
/* Drop reference on mm_struct */
mmput(vmap->vm_mm);
kfree(vmap);
}
static struct vm_area_struct *
linux_cdev_handle_insert(void *handle, struct vm_area_struct *vmap)
{
@ -481,20 +566,10 @@ linux_cdev_handle_insert(void *handle, struct vm_area_struct *vmap)
TAILQ_FOREACH(ptr, &linux_vma_head, vm_entry) {
if (ptr->vm_private_data == handle) {
rw_wunlock(&linux_vma_lock);
kfree(vmap);
linux_cdev_handle_free(vmap);
return (NULL);
}
}
/*
* The same VM object might be shared by multiple processes
* and the mm_struct is usually freed when a process exits.
*
* The atomic reference below makes sure the mm_struct is
* available as long as the vmap is in the linux_vma_head.
*/
if (atomic_inc_not_zero(&vmap->vm_mm->mm_users) == 0)
panic("linuxkpi: mm_users is zero\n");
TAILQ_INSERT_TAIL(&linux_vma_head, vmap, vm_entry);
rw_wunlock(&linux_vma_lock);
return (vmap);
@ -503,16 +578,9 @@ linux_cdev_handle_insert(void *handle, struct vm_area_struct *vmap)
static void
linux_cdev_handle_remove(struct vm_area_struct *vmap)
{
if (vmap == NULL)
return;
rw_wlock(&linux_vma_lock);
TAILQ_REMOVE(&linux_vma_head, vmap, vm_entry);
rw_wunlock(&linux_vma_lock);
/* Drop reference on mm_struct */
mmput(vmap->vm_mm);
kfree(vmap);
}
static struct vm_area_struct *
@ -533,20 +601,9 @@ static int
linux_cdev_pager_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot,
vm_ooffset_t foff, struct ucred *cred, u_short *color)
{
const struct vm_operations_struct *vm_ops;
struct vm_area_struct *vmap;
vmap = linux_cdev_handle_find(handle);
MPASS(vmap != NULL);
MPASS(linux_cdev_handle_find(handle) != NULL);
*color = 0;
down_write(&vmap->vm_mm->mmap_sem);
vm_ops = vmap->vm_ops;
if (likely(vm_ops != NULL))
vm_ops->open(vmap);
up_write(&vmap->vm_mm->mmap_sem);
return (0);
}
@ -559,13 +616,19 @@ linux_cdev_pager_dtor(void *handle)
vmap = linux_cdev_handle_find(handle);
MPASS(vmap != NULL);
/*
* Remove handle before calling close operation to prevent
* other threads from reusing the handle pointer.
*/
linux_cdev_handle_remove(vmap);
down_write(&vmap->vm_mm->mmap_sem);
vm_ops = vmap->vm_ops;
if (likely(vm_ops != NULL))
vm_ops->close(vmap);
up_write(&vmap->vm_mm->mmap_sem);
linux_cdev_handle_remove(vmap);
linux_cdev_handle_free(vmap);
}
static struct cdev_pager_ops linux_cdev_pager_ops = {
@ -586,16 +649,21 @@ linux_dev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
ldev = dev->si_drv1;
if (ldev == NULL)
return (ENODEV);
filp = kzalloc(sizeof(*filp), GFP_KERNEL);
filp = linux_file_alloc();
filp->f_dentry = &filp->f_dentry_store;
filp->f_op = ldev->ops;
filp->f_flags = file->f_flag;
vhold(file->f_vnode);
filp->f_vnode = file->f_vnode;
filp->_file = file;
linux_set_current(td);
if (filp->f_op->open) {
error = -filp->f_op->open(file->f_vnode, filp);
if (error) {
vdrop(filp->f_vnode);
kfree(filp);
goto done;
}
@ -603,6 +671,7 @@ linux_dev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
error = devfs_set_cdevpriv(filp, linux_file_dtor);
if (error) {
filp->f_op->release(file->f_vnode, filp);
vdrop(filp->f_vnode);
kfree(filp);
}
done:
@ -622,8 +691,7 @@ linux_dev_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
if ((error = devfs_get_cdevpriv((void **)&filp)) != 0)
return (error);
filp->f_flags = file->f_flag;
devfs_clear_cdevpriv();
devfs_clear_cdevpriv();
return (0);
}
@ -784,6 +852,10 @@ linux_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
current->bsd_ioctl_len = 0;
}
if (error == EWOULDBLOCK)
linux_dev_kqfilter_poll(filp);
else if (error == ERESTARTSYS)
error = ERESTART;
return (error);
}
@ -815,8 +887,13 @@ linux_dev_read(struct cdev *dev, struct uio *uio, int ioflag)
((uint8_t *)uio->uio_iov->iov_base) + bytes;
uio->uio_iov->iov_len -= bytes;
uio->uio_resid -= bytes;
} else
} else {
error = -bytes;
if (error == EWOULDBLOCK)
linux_dev_kqfilter_poll(filp);
else if (error == ERESTARTSYS)
error = ERESTART;
}
} else
error = ENXIO;
@ -851,8 +928,13 @@ linux_dev_write(struct cdev *dev, struct uio *uio, int ioflag)
((uint8_t *)uio->uio_iov->iov_base) + bytes;
uio->uio_iov->iov_len -= bytes;
uio->uio_resid -= bytes;
} else
} else {
error = -bytes;
if (error == EWOULDBLOCK)
linux_dev_kqfilter_poll(filp);
else if (error == ERESTARTSYS)
error = ERESTART;
}
} else
error = ENXIO;
@ -874,9 +956,10 @@ linux_dev_poll(struct cdev *dev, int events, struct thread *td)
file = td->td_fpop;
filp->f_flags = file->f_flag;
linux_set_current(td);
if (filp->f_op->poll)
if (filp->f_op->poll != NULL) {
selrecord(td, &filp->f_selinfo);
revents = filp->f_op->poll(filp, NULL) & events;
else
} else
revents = 0;
return (revents);
@ -884,11 +967,145 @@ linux_dev_poll(struct cdev *dev, int events, struct thread *td)
return (events & (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM));
}
void
linux_poll_wakeup(struct linux_file *filp)
{
/* this function should be NULL-safe */
if (filp == NULL)
return;
selwakeup(&filp->f_selinfo);
spin_lock(&filp->f_kqlock);
filp->f_kqflags |= LINUX_KQ_FLAG_NEED_READ |
LINUX_KQ_FLAG_NEED_WRITE;
/* make sure the "knote" gets woken up */
KNOTE_LOCKED(&filp->f_selinfo.si_note, 1);
spin_unlock(&filp->f_kqlock);
}
static void
linux_dev_kqfilter_detach(struct knote *kn)
{
struct linux_file *filp = kn->kn_hook;
spin_lock(&filp->f_kqlock);
knlist_remove(&filp->f_selinfo.si_note, kn, 1);
spin_unlock(&filp->f_kqlock);
}
static int
linux_dev_kqfilter_read_event(struct knote *kn, long hint)
{
struct linux_file *filp = kn->kn_hook;
mtx_assert(&filp->f_kqlock.m, MA_OWNED);
return ((filp->f_kqflags & LINUX_KQ_FLAG_NEED_READ) ? 1 : 0);
}
static int
linux_dev_kqfilter_write_event(struct knote *kn, long hint)
{
struct linux_file *filp = kn->kn_hook;
mtx_assert(&filp->f_kqlock.m, MA_OWNED);
return ((filp->f_kqflags & LINUX_KQ_FLAG_NEED_WRITE) ? 1 : 0);
}
static struct filterops linux_dev_kqfiltops_read = {
.f_isfd = 1,
.f_detach = linux_dev_kqfilter_detach,
.f_event = linux_dev_kqfilter_read_event,
};
static struct filterops linux_dev_kqfiltops_write = {
.f_isfd = 1,
.f_detach = linux_dev_kqfilter_detach,
.f_event = linux_dev_kqfilter_write_event,
};
static void
linux_dev_kqfilter_poll(struct linux_file *filp)
{
int temp;
spin_lock(&filp->f_kqlock);
temp = (filp->f_kqflags & (LINUX_KQ_FLAG_HAS_READ | LINUX_KQ_FLAG_HAS_WRITE));
filp->f_kqflags &= ~(LINUX_KQ_FLAG_NEED_READ | LINUX_KQ_FLAG_NEED_WRITE);
spin_unlock(&filp->f_kqlock);
if (temp != 0) {
/* get the latest polling state */
temp = filp->f_op->poll(filp, NULL);
if (temp & (POLLIN | POLLOUT)) {
spin_lock(&filp->f_kqlock);
if (temp & POLLIN)
filp->f_kqflags |= LINUX_KQ_FLAG_NEED_READ;
if (temp & POLLOUT)
filp->f_kqflags |= LINUX_KQ_FLAG_NEED_WRITE;
/* make sure the "knote" gets woken up */
KNOTE_LOCKED(&filp->f_selinfo.si_note, 0);
spin_unlock(&filp->f_kqlock);
}
}
}
static int
linux_dev_kqfilter(struct cdev *dev, struct knote *kn)
{
struct linux_file *filp;
struct file *file;
struct thread *td;
int error;
td = curthread;
file = td->td_fpop;
if (dev->si_drv1 == NULL)
return (ENXIO);
if ((error = devfs_get_cdevpriv((void **)&filp)) != 0)
return (error);
filp->f_flags = file->f_flag;
if (filp->f_op->poll == NULL)
return (EINVAL);
spin_lock(&filp->f_kqlock);
switch (kn->kn_filter) {
case EVFILT_READ:
filp->f_kqflags |= LINUX_KQ_FLAG_HAS_READ;
kn->kn_fop = &linux_dev_kqfiltops_read;
kn->kn_hook = filp;
knlist_add(&filp->f_selinfo.si_note, kn, 1);
break;
case EVFILT_WRITE:
filp->f_kqflags |= LINUX_KQ_FLAG_HAS_WRITE;
kn->kn_fop = &linux_dev_kqfiltops_write;
kn->kn_hook = filp;
knlist_add(&filp->f_selinfo.si_note, kn, 1);
break;
default:
error = EINVAL;
break;
}
spin_unlock(&filp->f_kqlock);
if (error == 0) {
linux_set_current(td);
linux_dev_kqfilter_poll(filp);
}
return (error);
}
static int
linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *offset,
vm_size_t size, struct vm_object **object, int nprot)
{
struct vm_area_struct *vmap;
struct mm_struct *mm;
struct linux_file *filp;
struct thread *td;
struct file *file;
@ -908,6 +1125,17 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *offset,
linux_set_current(td);
/*
* The same VM object might be shared by multiple processes
* and the mm_struct is usually freed when a process exits.
*
* The atomic reference below makes sure the mm_struct is
* available as long as the vmap is in the linux_vma_head.
*/
mm = current->mm;
if (atomic_inc_not_zero(&mm->mm_users) == 0)
return (EINVAL);
vmap = kzalloc(sizeof(*vmap), GFP_KERNEL);
vmap->vm_start = 0;
vmap->vm_end = size;
@ -915,8 +1143,8 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *offset,
vmap->vm_pfn = 0;
vmap->vm_flags = vmap->vm_page_prot = nprot;
vmap->vm_ops = NULL;
vmap->vm_file = filp;
vmap->vm_mm = current->mm;
vmap->vm_file = get_file(filp);
vmap->vm_mm = mm;
if (unlikely(down_write_killable(&vmap->vm_mm->mmap_sem))) {
error = EINTR;
@ -926,7 +1154,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *offset,
}
if (error != 0) {
kfree(vmap);
linux_cdev_handle_free(vmap);
return (error);
}
@ -939,7 +1167,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *offset,
vmap->vm_ops->open == NULL ||
vmap->vm_ops->close == NULL ||
vmap->vm_private_data == NULL) {
kfree(vmap);
linux_cdev_handle_free(vmap);
return (EINVAL);
}
@ -952,6 +1180,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *offset,
if (*object == NULL) {
linux_cdev_handle_remove(vmap);
linux_cdev_handle_free(vmap);
return (EINVAL);
}
} else {
@ -963,7 +1192,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *offset,
*object = vm_pager_allocate(OBJT_SG, sg, vmap->vm_len,
nprot, 0, curthread->td_ucred);
kfree(vmap);
linux_cdev_handle_free(vmap);
if (*object == NULL) {
sglist_free(sg);
@ -990,6 +1219,8 @@ struct cdevsw linuxcdevsw = {
.d_ioctl = linux_dev_ioctl,
.d_mmap_single = linux_dev_mmap_single,
.d_poll = linux_dev_poll,
.d_kqfilter = linux_dev_kqfilter,
.d_name = "lkpidev",
};
static int
@ -1033,9 +1264,10 @@ linux_file_poll(struct file *file, int events, struct ucred *active_cred,
filp = (struct linux_file *)file->f_data;
filp->f_flags = file->f_flag;
linux_set_current(td);
if (filp->f_op->poll)
if (filp->f_op->poll != NULL) {
selrecord(td, &filp->f_selinfo);
revents = filp->f_op->poll(filp, NULL) & events;
else
} else
revents = 0;
return (revents);
@ -1657,6 +1889,13 @@ linux_on_each_cpu(void callback(void *), void *data)
return (0);
}
int
linux_in_atomic(void)
{
return ((curthread->td_pflags & TDP_NOFAULTING) != 0);
}
struct linux_cdev *
linux_find_cdev(const char *name, unsigned major, unsigned minor)
{

View File

@ -96,7 +96,6 @@ linux_alloc_current(struct thread *td, int flags)
init_rwsem(&mm->mmap_sem);
atomic_set(&mm->mm_count, 1);
atomic_set(&mm->mm_users, 1);
mm->vmspace = vmspace_acquire_ref(proc);
/* set mm_struct pointer */
ts->mm = mm;
/* clear pointer to not free memory */
@ -119,7 +118,7 @@ linux_get_task_mm(struct task_struct *task)
struct mm_struct *mm;
mm = task->mm;
if (mm != NULL && mm->vmspace != NULL) {
if (mm != NULL) {
atomic_inc(&mm->mm_users);
return (mm);
}
@ -129,8 +128,6 @@ linux_get_task_mm(struct task_struct *task)
void
linux_mm_dtor(struct mm_struct *mm)
{
if (mm->vmspace != NULL)
vmspace_free(mm->vmspace);
free(mm, M_LINUX_CURRENT);
}

View File

@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
* Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
* Copyright (c) 2013-2017 Mellanox Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -46,6 +46,17 @@ __FBSDID("$FreeBSD$");
#include <linux/idr.h>
#include <linux/err.h>
#define MAX_IDR_LEVEL ((MAX_IDR_SHIFT + IDR_BITS - 1) / IDR_BITS)
#define MAX_IDR_FREE (MAX_IDR_LEVEL * 2)
struct linux_idr_cache {
spinlock_t lock;
struct idr_layer *head;
unsigned count;
};
static DPCPU_DEFINE(struct linux_idr_cache, linux_idr_cache);
/*
* IDR Implementation.
*
@ -55,6 +66,96 @@ __FBSDID("$FreeBSD$");
*/
static MALLOC_DEFINE(M_IDR, "idr", "Linux IDR compat");
static struct idr_layer *
idr_preload_dequeue_locked(struct linux_idr_cache *lic)
{
struct idr_layer *retval;
/* check if wrong thread is trying to dequeue */
if (mtx_owned(&lic->lock.m) == 0)
return (NULL);
retval = lic->head;
if (likely(retval != NULL)) {
lic->head = retval->ary[0];
lic->count--;
retval->ary[0] = NULL;
}
return (retval);
}
static void
idr_preload_init(void *arg)
{
int cpu;
CPU_FOREACH(cpu) {
struct linux_idr_cache *lic =
DPCPU_ID_PTR(cpu, linux_idr_cache);
spin_lock_init(&lic->lock);
}
}
SYSINIT(idr_preload_init, SI_SUB_LOCK, SI_ORDER_FIRST, idr_preload_init, NULL);
static void
idr_preload_uninit(void *arg)
{
int cpu;
CPU_FOREACH(cpu) {
struct idr_layer *cacheval;
struct linux_idr_cache *lic =
DPCPU_ID_PTR(cpu, linux_idr_cache);
while (1) {
spin_lock(&lic->lock);
cacheval = idr_preload_dequeue_locked(lic);
spin_unlock(&lic->lock);
if (cacheval == NULL)
break;
free(cacheval, M_IDR);
}
spin_lock_destroy(&lic->lock);
}
}
SYSUNINIT(idr_preload_uninit, SI_SUB_LOCK, SI_ORDER_FIRST, idr_preload_uninit, NULL);
void
idr_preload(gfp_t gfp_mask)
{
struct linux_idr_cache *lic;
struct idr_layer *cacheval;
sched_pin();
lic = &DPCPU_GET(linux_idr_cache);
/* fill up cache */
spin_lock(&lic->lock);
while (lic->count < MAX_IDR_FREE) {
spin_unlock(&lic->lock);
cacheval = malloc(sizeof(*cacheval), M_IDR, M_ZERO | gfp_mask);
spin_lock(&lic->lock);
if (cacheval == NULL)
break;
cacheval->ary[0] = lic->head;
lic->head = cacheval;
lic->count++;
}
}
void
idr_preload_end(void)
{
struct linux_idr_cache *lic;
lic = &DPCPU_GET(linux_idr_cache);
spin_unlock(&lic->lock);
sched_unpin();
}
static inline int
idr_max(struct idr *idr)
{
@ -280,20 +381,32 @@ idr_pre_get(struct idr *idr, gfp_t gfp_mask)
return (1);
}
static inline struct idr_layer *
idr_get(struct idr *idr)
static struct idr_layer *
idr_free_list_get(struct idr *idp)
{
struct idr_layer *il;
il = idr->free;
if (il) {
idr->free = il->ary[0];
if ((il = idp->free) != NULL) {
idp->free = il->ary[0];
il->ary[0] = NULL;
return (il);
}
il = malloc(sizeof(*il), M_IDR, M_ZERO | M_NOWAIT);
if (il != NULL)
return (il);
}
static inline struct idr_layer *
idr_get(struct idr *idp)
{
struct idr_layer *il;
if ((il = idr_free_list_get(idp)) != NULL) {
MPASS(il->bitmap != 0);
} else if ((il = malloc(sizeof(*il), M_IDR, M_ZERO | M_NOWAIT)) != NULL) {
bitmap_fill(&il->bitmap, IDR_SIZE);
} else if ((il = idr_preload_dequeue_locked(&DPCPU_GET(linux_idr_cache))) != NULL) {
bitmap_fill(&il->bitmap, IDR_SIZE);
} else {
return (NULL);
}
return (il);
}

View File

@ -268,7 +268,7 @@ get_user_pages_remote(struct task_struct *task, struct mm_struct *mm,
{
vm_map_t map;
map = &mm->vmspace->vm_map;
map = &task->task_thread->td_proc->p_vmspace->vm_map;
return (linux_get_user_pages_internal(map, start, nr_pages,
!!(gup_flags & FOLL_WRITE), pages));
}

View File

@ -236,7 +236,6 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, ck_epoch_record_t *epoch_re
if (record->cpuid == PCPU_GET(cpuid)) {
bool is_sleeping = 0;
u_char prio = 0;
u_char old_prio;
/*
* Find the lowest priority or sleeping thread which
@ -255,13 +254,10 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, ck_epoch_record_t *epoch_re
pause("W", 1);
thread_lock(td);
} else {
old_prio = td->td_priority;
/* set new thread priority */
sched_prio(td, prio);
/* task switch */
mi_switch(SW_VOL | SWT_RELINQUISH, NULL);
/* restore thread priority */
sched_prio(td, old_prio);
}
} else {
/*
@ -282,6 +278,7 @@ linux_synchronize_rcu(void)
int was_bound;
int old_cpu;
int old_pinned;
u_char old_prio;
if (RCU_SKIP())
return;
@ -301,6 +298,7 @@ linux_synchronize_rcu(void)
old_cpu = PCPU_GET(cpuid);
old_pinned = td->td_pinned;
old_prio = td->td_priority;
td->td_pinned = 0;
was_bound = sched_is_bound(td);
sched_bind(td, old_cpu);
@ -319,6 +317,9 @@ linux_synchronize_rcu(void)
}
/* restore pinned after bind */
td->td_pinned = old_pinned;
/* restore thread priority */
sched_prio(td, old_prio);
thread_unlock(td);
PICKUP_GIANT();

View File

@ -488,6 +488,7 @@ contrib/dev/acpica/components/utilities/utobject.c optional acpi
contrib/dev/acpica/components/utilities/utosi.c optional acpi
contrib/dev/acpica/components/utilities/utownerid.c optional acpi
contrib/dev/acpica/components/utilities/utpredef.c optional acpi
contrib/dev/acpica/components/utilities/utresdecode.c optional acpi acpi_debug
contrib/dev/acpica/components/utilities/utresrc.c optional acpi
contrib/dev/acpica/components/utilities/utstate.c optional acpi
contrib/dev/acpica/components/utilities/utstring.c optional acpi

View File

@ -21,9 +21,10 @@ stripdirs="generate libraries parsers preprocessor tests tools"
stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h \
acefi.h acefiex.h achaiku.h acintel.h aclinux.h aclinuxex.h \
acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h acqnx.h \
acwin.h acwin64.h acwinex.h new_table.txt osbsdtbl.c osefitbl.c \
osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c osunixmap.c \
oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c utprint.c"
acwin.h acwin64.h acwinex.h dspkginit.c new_table.txt \
osbsdtbl.c osefitbl.c osefixf.c osfreebsdtbl.c oslinuxtbl.c \
osunixdir.c osunixmap.c oswindir.c oswintbl.c oswinxf.c \
readme.txt utclib.c utprint.c"
# include files to canonify
src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h \

View File

@ -1,3 +1,133 @@
----------------------------------------
31 May 2017. Summary of changes for version 20170531:
0) ACPI 6.2 support:
The ACPI specification version 6.2 has been released and is available at
http://uefi.org/specifications
This version of ACPICA fully supports the ACPI 6.2 specification. Changes
are summarized below.
New ACPI tables (Table Compiler/Disassembler/Templates):
HMAT (Heterogeneous Memory Attributes Table)
WSMT (Windows SMM Security Mitigation Table)
PPTT (Processor Properties Topology Table)
New subtables for existing ACPI tables:
HEST (New subtable, Arch-deferred machine check)
SRAT (New subtable, Arch-specific affinity structure)
PCCT (New subtables, Extended PCC subspaces (types 3 and 4))
Simple updates for existing ACPI tables:
BGRT (two new flag bits)
HEST (New bit defined for several subtables, GHES_ASSIST)
New Resource Descriptors and Resource macros (Compiler/Disassembler):
PinConfig()
PinFunction()
PinGroup()
PinGroupConfig()
PinGroupFunction()
New type for hardware error notification (section 18.3.2.9)
New predefined names/methods (Compiler/Interpreter):
_HMA (Heterogeneous Memory Attributes)
_LSI (Label Storage Information)
_LSR (Label Storage Read)
_LSW (Label Storage Write)
ASL grammar/macro changes (Compiler):
For() ASL macro, implemented with the AML while operator
Extensions to Concatenate operator
Support for multiple definition blocks in same ASL file
Clarification for Buffer operator
Allow executable AML code underneath all scopes (Devices, etc.)
Clarification/change for the _OSI return value
ASL grammar update for reference operators
Allow a zero-length string for AML filename in DefinitionBlock
Miscellaneous:
New device object notification value
Remove a notify value (0x0C) for graceful shutdown
New UUIDs for processor/cache properties and
physical package property
New _HID, ACPI0014 (Wireless Power Calibration Device)
1) ACPICA kernel-resident subsystem:
Added support to disable ACPI events on hardware-reduced platforms.
Eliminates error messages of the form "Could not enable fixed event". Lv
Zheng
Fixed a problem using Device/Thermal objects with the ObjectType and
DerefOf ASL operators. This support had not been fully/properly
implemented.
Fixed a problem where if a Buffer object containing a resource template
was longer than the actual resource template, an error was generated --
even though the AML is legal. This case has been seen in the field.
Fixed a problem with the header definition of the MADT PCAT_COMPAT flag.
The values for DUAL_PIC and MULTIPLE_APIC were reversed.
Added header file changes for the TPM2 ACPI table. Update to new version
of the TCG specification. Adds a new TPM2 subtable for ARM SMC.
Exported the external interfaces AcpiAcquireMutex and AcpiReleaseMutex.
These interfaces are intended to be used only in conjunction with the
predefined _DLM method (Device Lock Method). "This object appears in a
device scope when AML access to the device must be synchronized with the
OS environment".
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
debug version of the code includes the debug output trace mechanism and
has a much larger code and data size.
Current Release:
Non-Debug Version: 143.1K Code, 60.0K Data, 203.1K Total
Debug Version: 204.0K Code, 84.3K Data, 288.3K Total
Previous Release:
Non-Debug Version: 141.7K Code, 58.5K Data, 200.2K Total
Debug Version: 207.5K Code, 82.7K Data, 290.2K Total
2) iASL Compiler/Disassembler and Tools:
iASL: Fixed a problem where an External() declaration could not refer to
a Field Unit. Erik Schmauss.
Disassembler: Improved support for the Switch/Case operators. This
feature will disassemble AML code back to the original Switch operators
when possible, instead of an If..Else sequence. David Box
iASL and disassembler: Improved the handling of multiple extraneous
parentheses for both ASL input and disassembled ASL output.
Improved the behavior of the iASL compiler and disassembler to detect
improper use of external declarations
Disassembler: Now aborts immediately upon detection of an unknown AML
opcode. The AML parser has no real way to recover from this, and can
result in the creation of an ill-formed parse tree that causes errors
later during the disassembly.
All tools: Fixed a problem where the Unix application OSL did not handle
control-c correctly. For example, a control-c could incorrectly wake the
debugger.
AcpiExec: Improved the Control-C handling and added a handler for
segmentation faults (SIGSEGV). Supports both Windows and Unix-like
environments.
Reduced the verbosity of the generic unix makefiles. Previously, each
compilation displayed the full set of compiler options. This has been
eliminated as the options are easily inspected within the makefiles. Each
compilation now results in a single line of output.
----------------------------------------
03 March 2017. Summary of changes for version 20170303:

View File

@ -531,8 +531,6 @@ AcValidateTableHeader (
if (!AcpiUtValidNameseg (TableHeader.Signature))
{
fprintf (stderr, "Invalid table signature: 0x%8.8X\n",
*ACPI_CAST_PTR (UINT32, TableHeader.Signature));
return (AE_BAD_SIGNATURE);
}

View File

@ -316,11 +316,6 @@ FlGenerateFilename (
*/
NewFilename = UtStringCacheCalloc ((ACPI_SIZE)
strlen (InputFilename) + strlen (Suffix) + 2);
if (!NewFilename)
{
return (NULL);
}
strcpy (NewFilename, InputFilename);
/* Try to find the last dot in the filename */
@ -364,11 +359,6 @@ FlStrdup (
NewString = UtStringCacheCalloc ((ACPI_SIZE) strlen (String) + 1);
if (!NewString)
{
return (NULL);
}
strcpy (NewString, String);
return (NewString);
}

View File

@ -537,7 +537,7 @@ AdDisassembleOneTable (
* the entire tree with the new information (namely, the
* number of arguments per method)
*/
if (AcpiDmGetExternalMethodCount ())
if (AcpiDmGetUnresolvedExternalMethodCount ())
{
Status = AdReparseOneTable (Table, File, OwnerId);
if (ACPI_FAILURE (Status))
@ -553,7 +553,7 @@ AdDisassembleOneTable (
* 1) Convert fixed-offset references to resource descriptors
* to symbolic references (Note: modifies namespace)
*/
AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
AcpiDmConvertParseObjects (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
/* Optional displays */
@ -616,7 +616,7 @@ AdReparseOneTable (
fprintf (stderr,
"\nFound %u external control methods, "
"reparsing with new information\n",
AcpiDmGetExternalMethodCount ());
AcpiDmGetUnresolvedExternalMethodCount ());
/* Reparse, rebuild namespace */
@ -642,7 +642,7 @@ AdReparseOneTable (
/* New namespace, add the external definitions first */
AcpiDmAddExternalsToNamespace ();
AcpiDmAddExternalListToNamespace ();
/* For -ca option: clear the list of comment addresses. */

View File

@ -208,11 +208,16 @@ AcpiDmInspectPossibleArgs (
ACPI_PARSE_OBJECT *Op);
static ACPI_STATUS
AcpiDmResourceDescendingOp (
AcpiDmCommonDescendingOp (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
static ACPI_STATUS
AcpiDmProcessResourceDescriptors (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
/*******************************************************************************
*
@ -395,21 +400,21 @@ AcpiDmCrossReferenceNamespace (
/*******************************************************************************
*
* FUNCTION: AcpiDmConvertResourceIndexes
* FUNCTION: AcpiDmConvertParseObjects
*
* PARAMETERS: ParseTreeRoot - Root of the parse tree
* NamespaceRoot - Root of the internal namespace
*
* RETURN: None
*
* DESCRIPTION: Convert fixed-offset references to resource descriptors to
* symbolic references. Should only be called after namespace has
* been cross referenced.
* DESCRIPTION: Begin parse tree walk to perform conversions needed for
* disassembly. These include resource descriptors and switch/case
* operations.
*
******************************************************************************/
void
AcpiDmConvertResourceIndexes (
AcpiDmConvertParseObjects (
ACPI_PARSE_OBJECT *ParseTreeRoot,
ACPI_NAMESPACE_NODE *NamespaceRoot)
{
@ -443,9 +448,14 @@ AcpiDmConvertResourceIndexes (
Info.Level = 0;
Info.WalkState = WalkState;
AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp,
AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmCommonDescendingOp,
AcpiDmCommonAscendingOp, &Info);
ACPI_FREE (WalkState);
if (AcpiGbl_TempListHead) {
AcpiDmClearTempList();
}
return;
}
@ -737,7 +747,6 @@ AcpiDmLoadDescendingOp (
WalkState = Info->WalkState;
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
ObjectType = OpInfo->ObjectType;
ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
/* Only interested in operators that create new names */
@ -754,7 +763,7 @@ AcpiDmLoadDescendingOp (
{
/* For all named operators, get the new name */
Path = (char *) Op->Named.Path;
Path = Op->Named.Path;
if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
{
@ -875,7 +884,6 @@ AcpiDmXrefDescendingOp (
WalkState = Info->WalkState;
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
ObjectType = OpInfo->ObjectType;
ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
if ((!(OpInfo->Flags & AML_NAMED)) &&
@ -885,25 +893,6 @@ AcpiDmXrefDescendingOp (
{
goto Exit;
}
else if (Op->Common.Parent &&
Op->Common.Parent->Common.AmlOpcode == AML_EXTERNAL_OP)
{
/* External() NamePath */
Path = Op->Common.Value.String;
ObjectType = (ACPI_OBJECT_TYPE) Op->Common.Next->Common.Value.Integer;
if (ObjectType == ACPI_TYPE_METHOD)
{
ParamCount = (UINT32)
Op->Common.Next->Common.Next->Common.Value.Integer;
}
Flags |= ACPI_EXT_RESOLVED_REFERENCE | ACPI_EXT_ORIGIN_FROM_OPCODE;
AcpiDmAddOpToExternalList (Op, Path,
(UINT8) ObjectType, ParamCount, Flags);
goto Exit;
}
/* Get the NamePath from the appropriate place */
@ -924,9 +913,10 @@ AcpiDmXrefDescendingOp (
Path = NextOp->Common.Value.String;
}
}
else if (Op->Common.AmlOpcode == AML_SCOPE_OP)
else if (Op->Common.AmlOpcode == AML_SCOPE_OP ||
Op->Common.AmlOpcode == AML_EXTERNAL_OP)
{
Path = (char *) Op->Named.Path;
Path = Op->Named.Path;
}
}
else if (OpInfo->Flags & AML_CREATE)
@ -1060,21 +1050,59 @@ AcpiDmXrefDescendingOp (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmResourceDescendingOp
* FUNCTION: AcpiDmCommonDescendingOp
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: None
* RETURN: ACPI_STATUS
*
* DESCRIPTION: Process one parse op during symbolic resource index conversion.
* DESCRIPTION: Perform parse tree preprocessing before main disassembly walk.
*
******************************************************************************/
static ACPI_STATUS
AcpiDmResourceDescendingOp (
AcpiDmCommonDescendingOp (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ACPI_STATUS Status;
/* Resource descriptor conversion */
Status = AcpiDmProcessResourceDescriptors (Op, Level, Context);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Switch/Case conversion */
Status = AcpiDmProcessSwitch (Op);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmProcessResourceDescriptors
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: ACPI_STATUS
*
* DESCRIPTION: Convert fixed-offset references to resource descriptors to
* symbolic references. Should only be called after namespace has
* been cross referenced.
*
******************************************************************************/
static ACPI_STATUS
AcpiDmProcessResourceDescriptors (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
@ -1085,7 +1113,6 @@ AcpiDmResourceDescendingOp (
ACPI_OBJECT_TYPE ObjectType;
ACPI_STATUS Status;
WalkState = Info->WalkState;
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
@ -1111,10 +1138,10 @@ AcpiDmResourceDescendingOp (
* If so, convert the reference into a symbolic reference.
*/
AcpiDmCheckResourceReference (Op, WalkState);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmCommonAscendingOp
@ -1135,14 +1162,11 @@ AcpiDmCommonAscendingOp (
void *Context)
{
ACPI_OP_WALK_INFO *Info = Context;
const ACPI_OPCODE_INFO *OpInfo;
ACPI_OBJECT_TYPE ObjectType;
/* Close scope if necessary */
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
ObjectType = OpInfo->ObjectType;
ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
if (AcpiNsOpensScope (ObjectType))
@ -1153,7 +1177,6 @@ AcpiDmCommonAscendingOp (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmInspectPossibleArgs

Some files were not shown because too many files have changed in this diff Show More