From owner-svn-src-user@FreeBSD.ORG Mon Apr 27 06:40:38 2015 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC9F288E; Mon, 27 Apr 2015 06:40:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7A5C1760; Mon, 27 Apr 2015 06:40:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3R6ecHa051407; Mon, 27 Apr 2015 06:40:38 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3R6eTRC051320; Mon, 27 Apr 2015 06:40:29 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201504270640.t3R6eTRC051320@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 27 Apr 2015 06:40:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r282055 - in user/ngie/more-tests: . bin/ed bin/expr bin/sh lib/libarchive lib/libc/gen lib/libc/nls lib/libc/regex lib/libc/rpc lib/libc/sys lib/libedit lib/msun/man sbin/atm/atmconfig... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2015 06:40:38 -0000 Author: ngie Date: Mon Apr 27 06:40:28 2015 New Revision: 282055 URL: https://svnweb.freebsd.org/changeset/base/282055 Log: MFhead @ r282054 Added: user/ngie/more-tests/share/doc/usd/10.exref/ - copied from r282054, head/share/doc/usd/10.exref/ user/ngie/more-tests/share/doc/usd/11.vitut/ - copied from r282054, head/share/doc/usd/11.vitut/ user/ngie/more-tests/share/doc/usd/12.vi/ - copied from r282054, head/share/doc/usd/12.vi/ user/ngie/more-tests/share/doc/usd/13.viref/ - copied from r282054, head/share/doc/usd/13.viref/ Modified: user/ngie/more-tests/ObsoleteFiles.inc user/ngie/more-tests/bin/ed/ed.1 user/ngie/more-tests/bin/expr/expr.1 user/ngie/more-tests/bin/sh/jobs.c user/ngie/more-tests/lib/libarchive/config_freebsd.h user/ngie/more-tests/lib/libc/gen/getutxent.3 user/ngie/more-tests/lib/libc/gen/nice.3 user/ngie/more-tests/lib/libc/gen/posix_spawn.3 user/ngie/more-tests/lib/libc/gen/posix_spawn_file_actions_addopen.3 user/ngie/more-tests/lib/libc/gen/posix_spawn_file_actions_init.3 user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getflags.3 user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getpgroup.3 user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getschedparam.3 user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getschedpolicy.3 user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getsigdefault.3 user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getsigmask.3 user/ngie/more-tests/lib/libc/gen/posix_spawnattr_init.3 user/ngie/more-tests/lib/libc/nls/catopen.3 user/ngie/more-tests/lib/libc/regex/re_format.7 user/ngie/more-tests/lib/libc/regex/regex.3 user/ngie/more-tests/lib/libc/rpc/rpcbind.3 user/ngie/more-tests/lib/libc/sys/posix_openpt.2 user/ngie/more-tests/lib/libedit/el.c user/ngie/more-tests/lib/msun/man/j0.3 user/ngie/more-tests/lib/msun/man/lgamma.3 user/ngie/more-tests/lib/msun/man/nextafter.3 user/ngie/more-tests/sbin/atm/atmconfig/atmconfig.8 user/ngie/more-tests/sbin/camcontrol/camcontrol.8 user/ngie/more-tests/sbin/ipfw/ipfw2.c user/ngie/more-tests/sbin/ipfw/ipfw2.h user/ngie/more-tests/sbin/ipfw/tables.c user/ngie/more-tests/share/doc/usd/Makefile user/ngie/more-tests/share/man/man4/smb.4 user/ngie/more-tests/sys/amd64/vmm/vmm_instruction_emul.c user/ngie/more-tests/sys/arm/allwinner/std.a10 user/ngie/more-tests/sys/arm/arm/cpufunc.c user/ngie/more-tests/sys/arm/arm/locore-v4.S user/ngie/more-tests/sys/arm/arm/locore-v6.S user/ngie/more-tests/sys/arm/broadcom/bcm2835/bcm2835_mbox.c user/ngie/more-tests/sys/arm/broadcom/bcm2835/std.bcm2836 user/ngie/more-tests/sys/arm/conf/RK3188 user/ngie/more-tests/sys/cddl/dev/profile/profile.c user/ngie/more-tests/sys/dev/cxgbe/t4_main.c user/ngie/more-tests/sys/dev/iicbus/pcf8563.c user/ngie/more-tests/sys/dev/smbus/smb.c user/ngie/more-tests/sys/dev/smbus/smb.h user/ngie/more-tests/sys/dev/smbus/smbconf.h user/ngie/more-tests/sys/dev/smbus/smbus.c user/ngie/more-tests/sys/dev/smbus/smbus.h user/ngie/more-tests/sys/dev/smbus/smbus_if.m user/ngie/more-tests/sys/dev/sound/pcm/dsp.c user/ngie/more-tests/sys/kern/kern_descrip.c user/ngie/more-tests/sys/kern/kern_thr.c user/ngie/more-tests/sys/net/netisr.c user/ngie/more-tests/sys/netinet/ip_ipsec.c user/ngie/more-tests/sys/netinet/libalias/libalias.3 user/ngie/more-tests/sys/netinet/sctp_indata.c user/ngie/more-tests/sys/netinet6/ip6_forward.c user/ngie/more-tests/sys/netinet6/ip6_ipsec.c user/ngie/more-tests/sys/netipsec/ipsec.c user/ngie/more-tests/sys/netipsec/ipsec.h user/ngie/more-tests/sys/netipsec/ipsec_output.c user/ngie/more-tests/sys/netipsec/xform_ah.c user/ngie/more-tests/sys/netipsec/xform_esp.c user/ngie/more-tests/sys/netipsec/xform_ipcomp.c user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_nat.c user/ngie/more-tests/sys/sys/cdefs.h user/ngie/more-tests/usr.bin/hexdump/display.c user/ngie/more-tests/usr.sbin/bluetooth/Makefile user/ngie/more-tests/usr.sbin/smbmsg/smbmsg.c Directory Properties: user/ngie/more-tests/ (props changed) user/ngie/more-tests/lib/libc/ (props changed) user/ngie/more-tests/sbin/ (props changed) user/ngie/more-tests/sbin/ipfw/ (props changed) user/ngie/more-tests/share/ (props changed) user/ngie/more-tests/share/doc/usd/10.exref/exref/ex.rm (props changed) user/ngie/more-tests/share/doc/usd/10.exref/summary/ex.summary (props changed) user/ngie/more-tests/share/doc/usd/11.vitut/edittut.ms (props changed) user/ngie/more-tests/share/doc/usd/12.vi/summary/vi.summary (props changed) user/ngie/more-tests/share/doc/usd/12.vi/vi/vi.chars (props changed) user/ngie/more-tests/share/doc/usd/12.vi/vi/vi.in (props changed) user/ngie/more-tests/share/doc/usd/12.vi/viapwh/vi.apwh.ms (props changed) user/ngie/more-tests/share/doc/usd/13.viref/ex.cmd.roff (props changed) user/ngie/more-tests/share/doc/usd/13.viref/ref.so (props changed) user/ngie/more-tests/share/doc/usd/13.viref/set.opt.roff (props changed) user/ngie/more-tests/share/doc/usd/13.viref/vi.cmd.roff (props changed) user/ngie/more-tests/share/doc/usd/13.viref/vi.ref (props changed) user/ngie/more-tests/share/man/man4/ (props changed) user/ngie/more-tests/sys/ (props changed) user/ngie/more-tests/sys/amd64/vmm/ (props changed) Modified: user/ngie/more-tests/ObsoleteFiles.inc ============================================================================== --- user/ngie/more-tests/ObsoleteFiles.inc Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/ObsoleteFiles.inc Mon Apr 27 06:40:28 2015 (r282055) @@ -56,18 +56,6 @@ OLD_FILES+=usr/include/altq/altq_rmclass OLD_FILES+=usr/include/altq/altq_cbq.h OLD_FILES+=usr/include/altq/altq_rio.h OLD_DIRS+=usr/include/altq -# 20150410 -OLD_FILES+=usr/share/doc/usd/10.exref/paper.ascii.gz -OLD_FILES+=usr/share/doc/usd/10.exref/summary.ascii.gz -OLD_DIRS+=usr/share/doc/usd/10.exref -OLD_FILES+=usr/share/doc/usd/11.edit/paper.ascii.gz -OLD_DIRS+=usr/share/doc/usd/11.edit -OLD_FILES+=usr/share/doc/usd/12.vi/paper.ascii.gz -OLD_FILES+=usr/share/doc/usd/12.vi/summary.ascii.gz -OLD_FILES+=usr/share/doc/usd/12.vi/viapwh.ascii.gz -OLD_DIRS+=usr/share/doc/usd/12.vi -OLD_FILES+=usr/share/doc/usd/13.viref/paper.ascii.gz -OLD_DIRS+=usr/share/doc/usd/13.viref # 20150329 .if ${TARGET_ARCH} == "arm" OLD_FILES+=usr/include/bootconfig.h Modified: user/ngie/more-tests/bin/ed/ed.1 ============================================================================== --- user/ngie/more-tests/bin/ed/ed.1 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/bin/ed/ed.1 Mon Apr 27 06:40:28 2015 (r282055) @@ -738,7 +738,7 @@ It is an error if no substitutions are p lines. The current address is set the last line affected. .Pp -.Ar Re +.Ar \&Re and .Ar replacement may be delimited by any character other than space and newline Modified: user/ngie/more-tests/bin/expr/expr.1 ============================================================================== --- user/ngie/more-tests/bin/expr/expr.1 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/bin/expr/expr.1 Mon Apr 27 06:40:28 2015 (r282055) @@ -90,17 +90,17 @@ Return the evaluation of .Ar expr1 if neither expression evaluates to an empty string or zero; otherwise, returns zero. -.It Ar expr1 Li "{=, >, >=, <, <=, !=}" Ar expr2 +.It Ar expr1 Bro =, >, >=, <, <=, != Brc Ar expr2 Return the results of integer comparison if both arguments are integers; otherwise, returns the results of string comparison using the locale-specific collation sequence. The result of each comparison is 1 if the specified relation is true, or 0 if the relation is false. -.It Ar expr1 Li "{+, -}" Ar expr2 +.It Ar expr1 Bro +, - Brc Ar expr2 Return the results of addition or subtraction of integer-valued arguments. -.It Ar expr1 Li "{*, /, %}" Ar expr2 +.It Ar expr1 Bro *, /, % Brc Ar expr2 Return the results of multiplication, integer division, or remainder of integer-valued arguments. -.It Ar expr1 Li : Ar expr2 +.It Ar expr1 Li \&: Ar expr2 The .Dq Li \&: operator matches Modified: user/ngie/more-tests/bin/sh/jobs.c ============================================================================== --- user/ngie/more-tests/bin/sh/jobs.c Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/bin/sh/jobs.c Mon Apr 27 06:40:28 2015 (r282055) @@ -1057,7 +1057,7 @@ waitforjob(struct job *jp, int *origstat CLEAR_PENDING_INT; } #if JOBS - else if (rootshell && iflag && propagate_int && + else if (rootshell && propagate_int && WIFSIGNALED(status) && WTERMSIG(status) == SIGINT) kill(getpid(), SIGINT); #endif Modified: user/ngie/more-tests/lib/libarchive/config_freebsd.h ============================================================================== --- user/ngie/more-tests/lib/libarchive/config_freebsd.h Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libarchive/config_freebsd.h Mon Apr 27 06:40:28 2015 (r282055) @@ -25,6 +25,8 @@ * $FreeBSD$ */ +#include + /* FreeBSD 5.0 and later have ACL and extattr support. */ #if __FreeBSD__ > 4 #define HAVE_ACL_CREATE_ENTRY 1 @@ -220,6 +222,11 @@ #define HAVE_ZLIB_H 1 #define TIME_WITH_SYS_TIME 1 +#if __FreeBSD_version >= 1100056 +#define HAVE_FUTIMENS 1 +#define HAVE_UTIMENSAT 1 +#endif + /* FreeBSD 4 and earlier lack intmax_t/uintmax_t */ #if __FreeBSD__ < 5 #define intmax_t int64_t Modified: user/ngie/more-tests/lib/libc/gen/getutxent.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/getutxent.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/getutxent.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -475,4 +475,4 @@ They replaced the .In utmp.h interface. .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libc/gen/nice.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/nice.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/nice.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -87,7 +87,7 @@ The function conforms to .St -p1003.1-2008 except for the return value. -This implementation returns 0 upon successful completion but +This implementation returns 0 upon successful completion but the standard requires returning the new nice value, which could be \-1. .Sh HISTORY Modified: user/ngie/more-tests/lib/libc/gen/posix_spawn.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/posix_spawn.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/posix_spawn.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -457,4 +457,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libc/gen/posix_spawn_file_actions_addopen.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/posix_spawn_file_actions_addopen.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/posix_spawn_file_actions_addopen.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -200,4 +200,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libc/gen/posix_spawn_file_actions_init.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/posix_spawn_file_actions_init.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/posix_spawn_file_actions_init.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -101,4 +101,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getflags.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getflags.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getflags.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -108,4 +108,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getpgroup.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getpgroup.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getpgroup.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -93,4 +93,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getschedparam.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getschedparam.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getschedparam.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -97,4 +97,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getschedpolicy.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getschedpolicy.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getschedpolicy.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -95,4 +95,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getsigdefault.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getsigdefault.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getsigdefault.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -95,4 +95,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getsigmask.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getsigmask.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/posix_spawnattr_getsigmask.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -95,4 +95,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libc/gen/posix_spawnattr_init.3 ============================================================================== --- user/ngie/more-tests/lib/libc/gen/posix_spawnattr_init.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/gen/posix_spawnattr_init.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -120,4 +120,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libc/nls/catopen.3 ============================================================================== --- user/ngie/more-tests/lib/libc/nls/catopen.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/nls/catopen.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -94,7 +94,7 @@ An empty string is substituted for undef Path names templates defined in .Ev NLSPATH are separated by colons -.No ( Sq \&: ) . +.Pq Sq \&: . A leading or two adjacent colons is equivalent to specifying %N. .Pp Modified: user/ngie/more-tests/lib/libc/regex/re_format.7 ============================================================================== --- user/ngie/more-tests/lib/libc/regex/re_format.7 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/regex/re_format.7 Mon Apr 27 06:40:28 2015 (r282055) @@ -392,10 +392,12 @@ and .Ql ?\& are ordinary characters, and their functionality can be expressed using bounds -.No ( Ql {1,} +.Po +.Ql {1,} or .Ql {0,1} -respectively). +respectively +.Pc . Also note that .Ql x+ in modern REs is equivalent to Modified: user/ngie/more-tests/lib/libc/regex/regex.3 ============================================================================== --- user/ngie/more-tests/lib/libc/regex/regex.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/regex/regex.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -420,10 +420,12 @@ it should have been the result from the using that .Ft regex_t . The -.Fn ( regerror +.Po +.Fn regerror may be able to supply a more detailed message using information from the -.Ft regex_t . ) +.Ft regex_t . +.Pc The .Fn regerror function Modified: user/ngie/more-tests/lib/libc/rpc/rpcbind.3 ============================================================================== --- user/ngie/more-tests/lib/libc/rpc/rpcbind.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/rpc/rpcbind.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -25,7 +25,7 @@ .Ft bool_t .Fn rpcb_gettime "const char *host" "time_t * timep" .Ft "enum clnt_stat" -.Fn rpcb_rmtcall "const struct netconfig *netconf" "const char *host" "const rpcprog_t prognum, const rpcvers_t versnum" "const rpcproc_t procnum, const xdrproc_t inproc" "const caddr_t in" "const xdrproc_t outproc" "const caddr_t out" "const struct timeval tout, const struct netbuf *svcaddr" +.Fn rpcb_rmtcall "const struct netconfig *netconf" "const char *host" "const rpcprog_t prognum" "const rpcvers_t versnum" "const rpcproc_t procnum" "const xdrproc_t inproc" "const caddr_t in" "const xdrproc_t outproc" "const caddr_t out" "const struct timeval tout" "const struct netbuf *svcaddr" .Ft bool_t .Fn rpcb_set "const rpcprog_t prognum" "const rpcvers_t versnum" "const struct netconfig *netconf" "const struct netbuf *svcaddr" .Ft bool_t Modified: user/ngie/more-tests/lib/libc/sys/posix_openpt.2 ============================================================================== --- user/ngie/more-tests/lib/libc/sys/posix_openpt.2 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libc/sys/posix_openpt.2 Mon Apr 27 06:40:28 2015 (r282055) @@ -137,4 +137,4 @@ is included for compatibility; in opening a terminal does not cause it to become a process's controlling terminal. .Sh AUTHORS -.An Ed Schouten Aq Mt ed@FreeBSD.org +.An \&Ed Schouten Aq Mt ed@FreeBSD.org Modified: user/ngie/more-tests/lib/libedit/el.c ============================================================================== --- user/ngie/more-tests/lib/libedit/el.c Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/libedit/el.c Mon Apr 27 06:40:28 2015 (r282055) @@ -96,7 +96,7 @@ el_init_fd(const char *prog, FILE *fin, */ el->el_flags = 0; #ifdef WIDECHAR - if (setlocale(LC_CTYPE, "") != NULL) { + if (setlocale(LC_CTYPE, NULL) != NULL) { if (strcmp(nl_langinfo(CODESET), "UTF-8") == 0) el->el_flags |= CHARSET_IS_UTF8; } Modified: user/ngie/more-tests/lib/msun/man/j0.3 ============================================================================== --- user/ngie/more-tests/lib/msun/man/j0.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/msun/man/j0.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -98,7 +98,7 @@ The functions .Fn y1 , and .Fn y1f -compute the linearly independent Bessel function of the second kind +compute the linearly independent Bessel function of the second kind of orders 0 and 1 for the positive .Em real value @@ -135,12 +135,12 @@ is \*(Pm0, these routines will generate a divide-by-zero exception and return -\*(If. If .Fa x -is a sufficiently small positive number, then +is a sufficiently small positive number, then .Fn y1 , .Fn y1f , .Fn yn , and -.Fn ynf +.Fn ynf will generate an overflow exception and return -\*(If. .Sh SEE ALSO .Xr math 3 Modified: user/ngie/more-tests/lib/msun/man/lgamma.3 ============================================================================== --- user/ngie/more-tests/lib/msun/man/lgamma.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/msun/man/lgamma.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -124,7 +124,6 @@ are deprecated aliases for and .Fn lgammaf_r , respectively. - .Sh IDIOSYNCRASIES Do not use the expression .Dq Li signgam\(**exp(lgamma(x)) Modified: user/ngie/more-tests/lib/msun/man/nextafter.3 ============================================================================== --- user/ngie/more-tests/lib/msun/man/nextafter.3 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/lib/msun/man/nextafter.3 Mon Apr 27 06:40:28 2015 (r282055) @@ -78,11 +78,11 @@ routines conform to They implement the Nextafter function recommended by .St -ieee754 , with the extension that -.Fn nextafter +0.0, -0.0 +.Fn nextafter "+0.0" "-0.0" returns .Li -0.0 , and -.Fn nextafter -0.0, +0.0 +.Fn nextafter "-0.0" "+0.0" returns .Li +0.0 . .Sh HISTORY Modified: user/ngie/more-tests/sbin/atm/atmconfig/atmconfig.8 ============================================================================== --- user/ngie/more-tests/sbin/atm/atmconfig/atmconfig.8 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/sbin/atm/atmconfig/atmconfig.8 Mon Apr 27 06:40:28 2015 (r282055) @@ -90,7 +90,7 @@ To get a list of options and arguments f .Pp To get a list of common options use: .D1 Nm Ic help Cm options -.Ss The Ic diag Ss Command +.Ss The Ic diag Command The .Ic diag command allows the inspection of the ATM interfaces on the local host @@ -201,7 +201,7 @@ Print traffic parameters: PCR, SCR, MBS, .It Nm Ic diag Cm stats Ar device Print driver specific statistics. .El -.Ss The Ic natm Ss Command +.Ss The Ic natm Command The .Ic natm command is used to change Modified: user/ngie/more-tests/sbin/camcontrol/camcontrol.8 ============================================================================== --- user/ngie/more-tests/sbin/camcontrol/camcontrol.8 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/sbin/camcontrol/camcontrol.8 Mon Apr 27 06:40:28 2015 (r282055) @@ -529,7 +529,7 @@ on the system. .It Ic defects Send the .Tn SCSI -READ DEFECT DATA (10) command (0x37) or the +READ DEFECT DATA (10) command (0x37) or the .Tn SCSI READ DEFECT DATA (12) command (0xB7) to the given device, and print out any combination of: the total number of defects, the primary @@ -563,12 +563,12 @@ drives. .It longblock Print out the list as logical blocks. This option uses a 64-bit block size. -.It bfi +.It bfi Print out the list in bytes from index format. .It extbfi Print out the list in extended bytes from index format. The extended format allows for ranges of blocks to be printed. -.It phys +.It phys Print out the list in physical sector format. Most drives support this format. .It extphys Modified: user/ngie/more-tests/sbin/ipfw/ipfw2.c ============================================================================== --- user/ngie/more-tests/sbin/ipfw/ipfw2.c Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/sbin/ipfw/ipfw2.c Mon Apr 27 06:40:28 2015 (r282055) @@ -375,6 +375,13 @@ static int ipfw_show_config(struct cmdli ipfw_cfg_lheader *cfg, size_t sz, int ac, char **av); static void ipfw_list_tifaces(void); +struct tidx; +static uint16_t pack_object(struct tidx *tstate, char *name, int otype); +static uint16_t pack_table(struct tidx *tstate, char *name); + +static char *table_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx); +static void object_sort_ctlv(ipfw_obj_ctlv *ctlv); + /* * Simple string buffer API. * Used to simplify buffer passing between function and for @@ -2558,6 +2565,7 @@ ipfw_show_config(struct cmdline_opts *co if (cfg->flags & IPFW_CFG_GET_STATIC) { /* We've requested static rules */ if (ctlv->head.type == IPFW_TLV_TBLNAME_LIST) { + object_sort_ctlv(ctlv); fo->tstate = ctlv; readsz += ctlv->head.length; ctlv = (ipfw_obj_ctlv *)((caddr_t)ctlv + @@ -2724,19 +2732,18 @@ struct tidx { }; static uint16_t -pack_table(struct tidx *tstate, char *name) +pack_object(struct tidx *tstate, char *name, int otype) { int i; ipfw_obj_ntlv *ntlv; - if (table_check_name(name) != 0) - return (0); - for (i = 0; i < tstate->count; i++) { if (strcmp(tstate->idx[i].name, name) != 0) continue; if (tstate->idx[i].set != tstate->set) continue; + if (tstate->idx[i].head.type != otype) + continue; return (tstate->idx[i].idx); } @@ -2752,7 +2759,7 @@ pack_table(struct tidx *tstate, char *na ntlv = &tstate->idx[i]; memset(ntlv, 0, sizeof(ipfw_obj_ntlv)); strlcpy(ntlv->name, name, sizeof(ntlv->name)); - ntlv->head.type = IPFW_TLV_TBL_NAME; + ntlv->head.type = otype; ntlv->head.length = sizeof(ipfw_obj_ntlv); ntlv->set = tstate->set; ntlv->idx = ++tstate->counter; @@ -2761,6 +2768,16 @@ pack_table(struct tidx *tstate, char *na return (ntlv->idx); } +static uint16_t +pack_table(struct tidx *tstate, char *name) +{ + + if (table_check_name(name) != 0) + return (0); + + return (pack_object(tstate, name, IPFW_TLV_TBL_NAME)); +} + static void fill_table(ipfw_insn *cmd, char *av, uint8_t opcode, struct tidx *tstate) { @@ -3611,7 +3628,6 @@ compile_rule(char *av[], uint32_t *rbuf, break; } else goto chkarg; - case TOK_QUEUE: action->opcode = O_QUEUE; goto chkarg; @@ -4656,6 +4672,101 @@ done: *rbufsize = (char *)dst - (char *)rule; } +static int +compare_ntlv(const void *_a, const void *_b) +{ + ipfw_obj_ntlv *a, *b; + + a = (ipfw_obj_ntlv *)_a; + b = (ipfw_obj_ntlv *)_b; + + if (a->set < b->set) + return (-1); + else if (a->set > b->set) + return (1); + + if (a->idx < b->idx) + return (-1); + else if (a->idx > b->idx) + return (1); + + if (a->head.type < b->head.type) + return (-1); + else if (a->head.type > b->head.type) + return (1); + + return (0); +} + +/* + * Provide kernel with sorted list of referenced objects + */ +static void +object_sort_ctlv(ipfw_obj_ctlv *ctlv) +{ + + qsort(ctlv + 1, ctlv->count, ctlv->objsize, compare_ntlv); +} + +struct object_kt { + uint16_t uidx; + uint16_t type; +}; +static int +compare_object_kntlv(const void *k, const void *v) +{ + ipfw_obj_ntlv *ntlv; + struct object_kt key; + + key = *((struct object_kt *)k); + ntlv = (ipfw_obj_ntlv *)v; + + if (key.uidx < ntlv->idx) + return (-1); + else if (key.uidx > ntlv->idx) + return (1); + + if (key.type < ntlv->head.type) + return (-1); + else if (key.type > ntlv->head.type) + return (1); + + return (0); +} + +/* + * Finds object name in @ctlv by @idx and @type. + * Uses the following facts: + * 1) All TLVs are the same size + * 2) Kernel implementation provides already sorted list. + * + * Returns table name or NULL. + */ +static char * +object_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx, uint16_t type) +{ + ipfw_obj_ntlv *ntlv; + struct object_kt key; + + key.uidx = idx; + key.type = type; + + ntlv = bsearch(&key, (ctlv + 1), ctlv->count, ctlv->objsize, + compare_object_kntlv); + + if (ntlv != 0) + return (ntlv->name); + + return (NULL); +} + +static char * +table_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx) +{ + + return (object_search_ctlv(ctlv, idx, IPFW_TLV_TBL_NAME)); +} + /* * Adds one or more rules to ipfw chain. * Data layout: @@ -4724,7 +4835,7 @@ ipfw_add(char *av[]) ctlv->count = ts.count; ctlv->objsize = sizeof(ipfw_obj_ntlv); memcpy(ctlv + 1, ts.idx, tlen); - table_sort_ctlv(ctlv); + object_sort_ctlv(ctlv); tstate = ctlv; /* Rule next */ ctlv = (ipfw_obj_ctlv *)((caddr_t)ctlv + ctlv->head.length); Modified: user/ngie/more-tests/sbin/ipfw/ipfw2.h ============================================================================== --- user/ngie/more-tests/sbin/ipfw/ipfw2.h Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/sbin/ipfw/ipfw2.h Mon Apr 27 06:40:28 2015 (r282055) @@ -344,8 +344,6 @@ int fill_ext6hdr(struct _ipfw_insn *cmd, /* tables.c */ struct _ipfw_obj_ctlv; -char *table_search_ctlv(struct _ipfw_obj_ctlv *ctlv, uint16_t idx); -void table_sort_ctlv(struct _ipfw_obj_ctlv *ctlv); int table_check_name(char *tablename); void ipfw_list_ta(int ac, char *av[]); void ipfw_list_values(int ac, char *av[]); Modified: user/ngie/more-tests/sbin/ipfw/tables.c ============================================================================== --- user/ngie/more-tests/sbin/ipfw/tables.c Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/sbin/ipfw/tables.c Mon Apr 27 06:40:28 2015 (r282055) @@ -1937,73 +1937,6 @@ ipfw_list_values(int ac, char *av[]) } int -compare_ntlv(const void *_a, const void *_b) -{ - ipfw_obj_ntlv *a, *b; - - a = (ipfw_obj_ntlv *)_a; - b = (ipfw_obj_ntlv *)_b; - - if (a->set < b->set) - return (-1); - else if (a->set > b->set) - return (1); - - if (a->idx < b->idx) - return (-1); - else if (a->idx > b->idx) - return (1); - - return (0); -} - -int -compare_kntlv(const void *k, const void *v) -{ - ipfw_obj_ntlv *ntlv; - uint16_t key; - - key = *((uint16_t *)k); - ntlv = (ipfw_obj_ntlv *)v; - - if (key < ntlv->idx) - return (-1); - else if (key > ntlv->idx) - return (1); - - return (0); -} - -/* - * Finds table name in @ctlv by @idx. - * Uses the following facts: - * 1) All TLVs are the same size - * 2) Kernel implementation provides already sorted list. - * - * Returns table name or NULL. - */ -char * -table_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx) -{ - ipfw_obj_ntlv *ntlv; - - ntlv = bsearch(&idx, (ctlv + 1), ctlv->count, ctlv->objsize, - compare_kntlv); - - if (ntlv != 0) - return (ntlv->name); - - return (NULL); -} - -void -table_sort_ctlv(ipfw_obj_ctlv *ctlv) -{ - - qsort(ctlv + 1, ctlv->count, ctlv->objsize, compare_ntlv); -} - -int table_check_name(char *tablename) { int c, i, l; Modified: user/ngie/more-tests/share/doc/usd/Makefile ============================================================================== --- user/ngie/more-tests/share/doc/usd/Makefile Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/share/doc/usd/Makefile Mon Apr 27 06:40:28 2015 (r282055) @@ -10,6 +10,10 @@ SUBDIR= title \ 05.dc \ 06.bc \ 07.mail \ + 10.exref \ + 11.vitut \ + 12.vi \ + 13.viref \ 18.msdiffs \ 19.memacros \ 20.meref \ Modified: user/ngie/more-tests/share/man/man4/smb.4 ============================================================================== --- user/ngie/more-tests/share/man/man4/smb.4 Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/share/man/man4/smb.4 Mon Apr 27 06:40:28 2015 (r282055) @@ -1,5 +1,6 @@ .\" Copyright (c) 1998, Nicolas Souchu .\" Copyright (c) 2004, Joerg Wunsch +.\" Copyright (c) 2015, Michael Gmelin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 6, 2009 +.Dd April 25, 2015 .Dt SMB 4 .Os .Sh NAME @@ -36,10 +37,10 @@ .Sh DESCRIPTION The .Em smb -character device driver provides generic i/o to any +character device driver provides generic I/O to any .Xr smbus 4 instance. -In order to control SMB devices, use +To control SMB devices, use .Pa /dev/smb? with the ioctls described below. Any of these ioctl commands takes a pointer to @@ -49,124 +50,145 @@ as its argument. #include struct smbcmd { - char cmd; - int count; - u_char slave; + u_char cmd; + u_char reserved; + u_short op; union { - char byte; - short word; - - char *byte_ptr; - short *word_ptr; - - struct { - short sdata; - short *rdata; - } process; - } data; + char byte; + char buf[2]; + short word; + } wdata; + union { + char byte; + char buf[2]; + short word; + } rdata; + int slave; + char *wbuf; /* use wdata if NULL */ + int wcount; + char *rbuf; /* use rdata if NULL */ + int rcount; }; .Ed .Pp The .Fa slave field is always used, and provides the address of the -SMBus slave device to talk to. +SMBus slave device. The slave address is specified in the seven most significant bits -.Pq i.e. Dq "left-justified" . +.Pq i.e., Dq "left-justified" . The least significant bit of the slave address must be zero. .Pp .Bl -column ".Dv SMB_QUICK_WRITE" -compact .It Em Ioctl Ta Em Description .Pp .It Dv SMB_QUICK_WRITE Ta -The .Em QuickWrite -command just issues the device address with write intent -to the bus, without transferring any data. +does not transfer any data. +It just issues the device address with write intent to the bus. .It Dv SMB_QUICK_READ Ta -The .Em QuickRead -command just issues the device address with read intent -to the bus, without transferring any data. +does not transfer any data. +It just issues the device address with read intent to the bus. .It Dv SMB_SENDB Ta -The .Em SendByte -command sends the byte provided in the +sends the byte provided in .Fa cmd -field to the device. +to the device. .It Dv SMB_RECVB Ta -The .Em ReceiveByte -command reads a single byte from the device which will -be returned in the -.Fa cmd -field. +reads a single byte from the device which is returned in +.Fa cmd . .It Dv SMB_WRITEB Ta -The .Em WriteByte -command first sends the byte from the +first sends the byte from .Fa cmd -field to the device, followed by the byte given in -.Fa data.byte . +to the device, followed by the byte given in +.Fa wdata.byte . .It Dv SMB_WRITEW Ta -The .Em WriteWord -command first sends the byte from the +first sends the byte from .Fa cmd -field to the device, followed by the word given in -.Fa data.word . +to the device, followed by the word given in +.Fa wdata.word . Note that the SMBus byte-order is little-endian by definition. .It Dv SMB_READB Ta -The .Em ReadByte -command first sends the byte from the +first sends the byte from .Fa cmd -field to the device, and then reads one byte of data from +to the device, then reads one byte of data from the device. -The returned data will be stored in the location pointed to by -.Fa data.byte_ptr . +Returned data is stored in +.Fa rdata.byte . .It Dv SMB_READW Ta -The .Em ReadWord -command first sends the byte from the +first sends the byte from .Fa cmd -field to the device, and then reads one word of data from +to the device, then reads one word of data from the device. -The returned data will be stored in the location pointed to by -.Fa data.word_ptr . +Returned data is stored in +.Fa rdata.word . .It Dv SMB_PCALL Ta -The .Em ProcedureCall -command first sends the byte from the +first sends the byte from .Fa cmd -field to the device, followed by the word provided in -.Fa data.process.sdata . -It then reads one word of data from the device, and returns it -in the location pointed to by -.Fa data.process.rdata . +to the device, followed by the word provided in +.Fa wdata.word . +It then reads one word of data from the device and returns it +in +.Fa rdata.word . .It Dv SMB_BWRITE Ta -The .Em BlockWrite -command first sends the byte from the +first sends the byte from .Fa cmd -field to the device, followed by -.Fa count +to the device, followed by +.Fa wcount bytes of data that are taken from the buffer pointed to by -.Fa data.byte_ptr . +.Fa wbuf . The SMBus specification mandates that no more than 32 bytes of -data can be transferred in a single block read or write command. -This value is available in the constant +data can be transferred in a single block read or write command, +but since +.Xr smbus 4 +is also used to access I2C devices, the limit has been increased +to 1024. +This value can be read from the constant .Dv SMB_MAXBLOCKSIZE . .It Dv SMB_BREAD Ta -The .Em BlockRead -command first sends the byte from the +first sends the byte from .Fa cmd -field to the device, and then reads -.Fa count +to the device, then reads +.Fa rcount bytes of data that from the device. -These data will be returned in the buffer pointed to by -.Fa data.byte_ptr . +This data is returned in the buffer pointed to by +.Fa rbuf . +.It Dv SMB_TRANS Ta +.Em Trans +sends an SMB roll-up transaction with flags that also allow it to +be used for (mostly) I2C pass-through and with 10-bit addresses. +This function can be utilized to roll up all of the above functions. +It first sends the byte from +.Fa cmd +to the device, followed by +.Fa wcount +bytes of data that are taken from the buffer pointed to by +.Fa wbuf , +then reads +.Fa rcount +bytes of data that from the device. +This data is returned in the buffer pointed to by +.Fa rbuf . +.Pp +The following flags are allowed in +.Fa op : +.Pp +.Bd -literal -compact +SMB_TRANS_NOSTOP Do not send STOP at end +SMB_TRANS_NOCMD Ignore cmd field (do not tx) +SMB_TRANS_NOCNT Do not tx or rx count field +SMB_TRANS_7BIT Change address mode to 7-bit +SMB_TRANS_10BIT Change address mode to 10-bit +.Ed .El .Pp The @@ -201,4 +223,6 @@ manual page first appeared in .Sh AUTHORS This manual page was written by -.An Nicolas Souchu . +.An Nicolas Souchu +and extended by +.An Michael Gmelin Aq freebsd@grem.de . Modified: user/ngie/more-tests/sys/amd64/vmm/vmm_instruction_emul.c ============================================================================== --- user/ngie/more-tests/sys/amd64/vmm/vmm_instruction_emul.c Mon Apr 27 06:34:51 2015 (r282054) +++ user/ngie/more-tests/sys/amd64/vmm/vmm_instruction_emul.c Mon Apr 27 06:40:28 2015 (r282055) @@ -72,6 +72,7 @@ enum { VIE_OP_TYPE_POP, VIE_OP_TYPE_MOVS, VIE_OP_TYPE_GROUP1, + VIE_OP_TYPE_STOS, VIE_OP_TYPE_LAST }; @@ -146,6 +147,16 @@ static const struct vie_op one_byte_opco .op_type = VIE_OP_TYPE_MOVS, .op_flags = VIE_OP_F_NO_MODRM | VIE_OP_F_NO_GLA_VERIFICATION }, + [0xAA] = { + .op_byte = 0xAA, + .op_type = VIE_OP_TYPE_STOS, + .op_flags = VIE_OP_F_NO_MODRM | VIE_OP_F_NO_GLA_VERIFICATION + }, + [0xAB] = { + .op_byte = 0xAB, + .op_type = VIE_OP_TYPE_STOS, + .op_flags = VIE_OP_F_NO_MODRM | VIE_OP_F_NO_GLA_VERIFICATION + }, [0xC6] = { /* XXX Group 11 extended opcode - not just MOV */ .op_byte = 0xC6, @@ -803,6 +814,68 @@ done: } static int +emulate_stos(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, + struct vm_guest_paging *paging, mem_region_read_t memread, + mem_region_write_t memwrite, void *arg) +{ + int error, opsize, repeat; + uint64_t val; + uint64_t rcx, rdi, rflags; + + opsize = (vie->op.op_byte == 0xAA) ? 1 : vie->opsize; + repeat = vie->repz_present | vie->repnz_present; + + if (repeat) { + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RCX, &rcx); + KASSERT(!error, ("%s: error %d getting rcx", __func__, error)); + + /* + * The count register is %rcx, %ecx or %cx depending on the + * address size of the instruction. + */ + if ((rcx & vie_size2mask(vie->addrsize)) == 0) + return (0); + } + + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RAX, &val); + KASSERT(!error, ("%s: error %d getting rax", __func__, error)); + + error = memwrite(vm, vcpuid, gpa, val, opsize, arg); + if (error) + return (error); + + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RDI, &rdi); + KASSERT(error == 0, ("%s: error %d getting rdi", __func__, error)); + + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, &rflags); + KASSERT(error == 0, ("%s: error %d getting rflags", __func__, error)); + + if (rflags & PSL_D) + rdi -= opsize; + else + rdi += opsize; + + error = vie_update_register(vm, vcpuid, VM_REG_GUEST_RDI, rdi, + vie->addrsize); + KASSERT(error == 0, ("%s: error %d updating rdi", __func__, error)); + + if (repeat) { + rcx = rcx - 1; + error = vie_update_register(vm, vcpuid, VM_REG_GUEST_RCX, + rcx, vie->addrsize); + KASSERT(!error, ("%s: error %d updating rcx", __func__, error)); + + /* + * Repeat the instruction if the count register is not zero. + */ + if ((rcx & vie_size2mask(vie->addrsize)) != 0) + vm_restart_instruction(vm, vcpuid); + } + + return (0); +} + +static int *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Apr 27 06:51:28 2015 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 05878D3B; Mon, 27 Apr 2015 06:51:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFB30186F; Mon, 27 Apr 2015 06:51:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3R6pRfs058389; Mon, 27 Apr 2015 06:51:27 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3R6pRe2058388; Mon, 27 Apr 2015 06:51:27 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201504270651.t3R6pRe2058388@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 27 Apr 2015 06:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r282058 - user/ngie/more-tests X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2015 06:51:28 -0000 Author: ngie Date: Mon Apr 27 06:51:27 2015 New Revision: 282058 URL: https://svnweb.freebsd.org/changeset/base/282058 Log: MFhead @ r282057 Modified: Directory Properties: user/ngie/more-tests/ (props changed) From owner-svn-src-user@FreeBSD.ORG Mon Apr 27 07:02:24 2015 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E629F98; Mon, 27 Apr 2015 07:02:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC0EB1974; Mon, 27 Apr 2015 07:02:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3R72OcS063663; Mon, 27 Apr 2015 07:02:24 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3R72O2t063662; Mon, 27 Apr 2015 07:02:24 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201504270702.t3R72O2t063662@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 27 Apr 2015 07:02:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r282060 - in user/ngie/more-tests: . etc etc/rc.d/tests lib/libc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2015 07:02:25 -0000 Author: ngie Date: Mon Apr 27 07:02:24 2015 New Revision: 282060 URL: https://svnweb.freebsd.org/changeset/base/282060 Log: MFhead @ r282059 Modified: Directory Properties: user/ngie/more-tests/ (props changed) user/ngie/more-tests/etc/ (props changed) user/ngie/more-tests/etc/rc.d/tests/ (props changed) user/ngie/more-tests/lib/libc/ (props changed) From owner-svn-src-user@FreeBSD.ORG Mon Apr 27 08:21:17 2015 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2A2B755B; Mon, 27 Apr 2015 08:21:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19B7D10F7; Mon, 27 Apr 2015 08:21:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3R8LG73000659; Mon, 27 Apr 2015 08:21:16 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3R8LGKq000658; Mon, 27 Apr 2015 08:21:16 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201504270821.t3R8LGKq000658@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 27 Apr 2015 08:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r282069 - user/ngie/more-tests/sys/boot/common X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2015 08:21:17 -0000 Author: ngie Date: Mon Apr 27 08:21:16 2015 New Revision: 282069 URL: https://svnweb.freebsd.org/changeset/base/282069 Log: MFhead @ r282068 Modified: user/ngie/more-tests/sys/boot/common/md.c Directory Properties: user/ngie/more-tests/ (props changed) user/ngie/more-tests/etc/ (props changed) user/ngie/more-tests/sys/ (props changed) user/ngie/more-tests/sys/boot/ (props changed) user/ngie/more-tests/tests/sys/fifo/ (props changed) user/ngie/more-tests/tests/sys/file/ (props changed) user/ngie/more-tests/tests/sys/kern/execve/ (props changed) user/ngie/more-tests/tests/sys/kqueue/ (props changed) Modified: user/ngie/more-tests/sys/boot/common/md.c ============================================================================== --- user/ngie/more-tests/sys/boot/common/md.c Mon Apr 27 08:16:35 2015 (r282068) +++ user/ngie/more-tests/sys/boot/common/md.c Mon Apr 27 08:21:16 2015 (r282069) @@ -27,11 +27,11 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include #include -#include #include "bootstrap.h" From owner-svn-src-user@FreeBSD.ORG Mon Apr 27 09:10:34 2015 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68F386DA; Mon, 27 Apr 2015 09:10:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5664316CA; Mon, 27 Apr 2015 09:10:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3R9AYe4027589; Mon, 27 Apr 2015 09:10:34 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3R9AWX2027580; Mon, 27 Apr 2015 09:10:32 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201504270910.t3R9AWX2027580@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 27 Apr 2015 09:10:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r282077 - in user/ngie/more-tests: etc/mtree sys/netinet sys/netpfil/ipfw tests/sys tests/sys/kern X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2015 09:10:34 -0000 Author: ngie Date: Mon Apr 27 09:10:32 2015 New Revision: 282077 URL: https://svnweb.freebsd.org/changeset/base/282077 Log: MFhead @ r282076 Added: user/ngie/more-tests/tests/sys/kern/mmap_test.c - copied unchanged from r282076, head/tests/sys/kern/mmap_test.c Modified: user/ngie/more-tests/etc/mtree/BSD.tests.dist user/ngie/more-tests/sys/netinet/ip_fw.h user/ngie/more-tests/sys/netpfil/ipfw/ip_fw2.c user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_private.h user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_sockopt.c user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_table.c user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_table.h user/ngie/more-tests/tests/sys/Makefile user/ngie/more-tests/tests/sys/kern/Makefile Directory Properties: user/ngie/more-tests/ (props changed) user/ngie/more-tests/etc/ (props changed) user/ngie/more-tests/sys/ (props changed) user/ngie/more-tests/tests/sys/aio/ (props changed) user/ngie/more-tests/tests/sys/mqueue/ (props changed) Modified: user/ngie/more-tests/etc/mtree/BSD.tests.dist ============================================================================== --- user/ngie/more-tests/etc/mtree/BSD.tests.dist Mon Apr 27 09:06:27 2015 (r282076) +++ user/ngie/more-tests/etc/mtree/BSD.tests.dist Mon Apr 27 09:10:32 2015 (r282077) @@ -366,8 +366,6 @@ .. kqueue .. - mmap - .. mqueue .. netinet Modified: user/ngie/more-tests/sys/netinet/ip_fw.h ============================================================================== --- user/ngie/more-tests/sys/netinet/ip_fw.h Mon Apr 27 09:06:27 2015 (r282076) +++ user/ngie/more-tests/sys/netinet/ip_fw.h Mon Apr 27 09:10:32 2015 (r282077) @@ -40,10 +40,12 @@ #define IPFW_MAX_SETS 32 /* Number of sets supported by ipfw*/ /* - * Default number of ipfw tables. + * Compat values for old clients */ +#ifndef _KERNEL #define IPFW_TABLES_MAX 65535 #define IPFW_TABLES_DEFAULT 128 +#endif /* * Most commands (queue, pipe, tag, untag, limit...) can have a 16-bit @@ -963,7 +965,6 @@ typedef struct _ipfw_ta_info { uint64_t spare1; } ipfw_ta_info; -#define IPFW_OBJTYPE_TABLE 1 typedef struct _ipfw_obj_header { ip_fw3_opheader opheader; /* IP_FW3 opcode */ uint32_t spare; Modified: user/ngie/more-tests/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- user/ngie/more-tests/sys/netpfil/ipfw/ip_fw2.c Mon Apr 27 09:06:27 2015 (r282076) +++ user/ngie/more-tests/sys/netpfil/ipfw/ip_fw2.c Mon Apr 27 09:10:32 2015 (r282077) @@ -2762,6 +2762,10 @@ vnet_ipfw_init(const void *unused) LIST_INIT(&chain->nat); #endif + /* Init shared services hash table */ + ipfw_init_srv(chain); + + ipfw_init_obj_rewriter(); ipfw_init_counters(); /* insert the default rule and create the initial map */ chain->n_rules = 1; @@ -2860,9 +2864,11 @@ vnet_ipfw_uninit(const void *unused) if (reap != NULL) ipfw_reap_rules(reap); vnet_ipfw_iface_destroy(chain); + ipfw_destroy_srv(chain); IPFW_LOCK_DESTROY(chain); ipfw_dyn_uninit(1); /* free the remaining parts */ ipfw_destroy_counters(); + ipfw_destroy_obj_rewriter(); return (0); } Modified: user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_private.h Mon Apr 27 09:06:27 2015 (r282076) +++ user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_private.h Mon Apr 27 09:10:32 2015 (r282077) @@ -264,10 +264,10 @@ struct ip_fw_chain { struct ip_fw **map; /* array of rule ptrs to ease lookup */ uint32_t id; /* ruleset id */ int n_rules; /* number of static rules */ - LIST_HEAD(nat_list, cfg_nat) nat; /* list of nat entries */ void *tablestate; /* runtime table info */ void *valuestate; /* runtime table value info */ int *idxmap; /* skipto array of rules */ + void **srvstate; /* runtime service mappings */ #if defined( __linux__ ) || defined( _WIN32 ) spinlock_t rwmtx; #else @@ -275,10 +275,12 @@ struct ip_fw_chain { #endif int static_len; /* total len of static rules (v0) */ uint32_t gencnt; /* NAT generation count */ + LIST_HEAD(nat_list, cfg_nat) nat; /* list of nat entries */ struct ip_fw *default_rule; struct tables_config *tblcfg; /* tables module data */ void *ifcfg; /* interface module data */ int *idxmap_back; /* standby skipto array of rules */ + struct namedobj_instance *srvmap; /* cfg name->number mappings */ #if defined( __linux__ ) || defined( _WIN32 ) spinlock_t uh_lock; #else @@ -306,16 +308,15 @@ struct table_value { uint64_t refcnt; /* Number of references */ }; -struct namedobj_instance; struct named_object { TAILQ_ENTRY(named_object) nn_next; /* namehash */ TAILQ_ENTRY(named_object) nv_next; /* valuehash */ char *name; /* object name */ - uint8_t type; /* object type */ - uint8_t compat; /* Object name is number */ + uint8_t subtype; /* object subtype within class */ + uint8_t etlv; /* Export TLV id */ + uint16_t spare[2]; uint16_t kidx; /* object kernel index */ - uint16_t uidx; /* userland idx for compat records */ uint32_t set; /* set object belongs to */ uint32_t refcnt; /* number of references */ }; @@ -450,7 +451,7 @@ struct obj_idx { struct rule_check_info { uint16_t flags; /* rule-specific check flags */ - uint16_t table_opcodes; /* count of opcodes referencing table */ + uint16_t object_opcodes; /* num of opcodes referencing objects */ uint16_t urule_numoff; /* offset of rulenum in bytes */ uint8_t version; /* rule version */ uint8_t spare; @@ -507,6 +508,84 @@ struct ip_fw_bcounter0 { (r)->cmd_len * 4 - 4, 8)) #define RULEKSIZE1(r) roundup2((sizeof(struct ip_fw) + (r)->cmd_len*4 - 4), 8) +/* + * Tables/Objects index rewriting code + */ + +/* Default and maximum number of ipfw tables/objects. */ +#define IPFW_TABLES_MAX 65536 +#define IPFW_TABLES_DEFAULT 128 +#define IPFW_OBJECTS_MAX 65536 +#define IPFW_OBJECTS_DEFAULT 128 + +#define CHAIN_TO_SRV(ch) ((ch)->srvmap) + +struct tid_info { + uint32_t set; /* table set */ + uint16_t uidx; /* table index */ + uint8_t type; /* table type */ + uint8_t atype; + uint8_t spare; + int tlen; /* Total TLV size block */ + void *tlvs; /* Pointer to first TLV */ +}; + +/* + * Classifier callback. Checks if @cmd opcode contains kernel object reference. + * If true, returns its index and type. + * Returns 0 if match is found, 1 overwise. + */ +typedef int (ipfw_obj_rw_cl)(ipfw_insn *cmd, uint16_t *puidx, uint8_t *ptype); +/* + * Updater callback. Sets kernel object reference index to @puidx + */ +typedef void (ipfw_obj_rw_upd)(ipfw_insn *cmd, uint16_t puidx); +/* + * Finder callback. Tries to find named object by name (specified via @ti). + * Stores found named object pointer in @pno. + * If object was not found, NULL is stored. + * + * Return 0 if input data was valid. + */ +typedef int (ipfw_obj_fname_cb)(struct ip_fw_chain *ch, + struct tid_info *ti, struct named_object **pno); +/* + * Another finder callback. Tries to findex named object by kernel index. + * + * Returns pointer to named object or NULL. + */ +typedef struct named_object *(ipfw_obj_fidx_cb)(struct ip_fw_chain *ch, + uint16_t kidx); +/* + * Object creator callback. Tries to create object specified by @ti. + * Stores newly-allocated object index in @pkidx. + * + * Returns 0 on success. + */ +typedef int (ipfw_obj_create_cb)(struct ip_fw_chain *ch, struct tid_info *ti, + uint16_t *pkidx); + + +struct opcode_obj_rewrite { + uint32_t opcode; /* Opcode to act upon */ + uint32_t etlv; /* Relevant export TLV id */ + ipfw_obj_rw_cl *classifier; /* Check if rewrite is needed */ + ipfw_obj_rw_upd *update; /* update cmd with new value */ + ipfw_obj_fname_cb *find_byname; /* Find named object by name */ + ipfw_obj_fidx_cb *find_bykidx; /* Find named object by kidx */ + ipfw_obj_create_cb *create_object; /* Create named object */ +}; + +#define IPFW_ADD_OBJ_REWRITER(f, c) do { \ + if ((f) != 0) \ + ipfw_add_obj_rewriter(c, \ + sizeof(c) / sizeof(c[0])); \ + } while(0) +#define IPFW_DEL_OBJ_REWRITER(l, c) do { \ + if ((l) != 0) \ + ipfw_del_obj_rewriter(c, \ + sizeof(c) / sizeof(c[0])); \ + } while(0) /* In ip_fw_iface.c */ int ipfw_iface_init(void); @@ -562,6 +641,7 @@ caddr_t ipfw_get_sopt_header(struct sock sizeof(c) / sizeof(c[0])); \ } while(0) +struct namedobj_instance; typedef void (objhash_cb_t)(struct namedobj_instance *ni, struct named_object *, void *arg); typedef uint32_t (objhash_hash_f)(struct namedobj_instance *ni, void *key, @@ -578,6 +658,8 @@ void ipfw_objhash_bitmap_free(void *idx, void ipfw_objhash_set_hashf(struct namedobj_instance *ni, objhash_hash_f *f); struct named_object *ipfw_objhash_lookup_name(struct namedobj_instance *ni, uint32_t set, char *name); +struct named_object *ipfw_objhash_lookup_name_type(struct namedobj_instance *ni, + uint32_t set, uint32_t type, char *name); struct named_object *ipfw_objhash_lookup_kidx(struct namedobj_instance *ni, uint16_t idx); int ipfw_objhash_same_name(struct namedobj_instance *ni, struct named_object *a, @@ -591,6 +673,25 @@ int ipfw_objhash_free_idx(struct namedob int ipfw_objhash_alloc_idx(void *n, uint16_t *pidx); void ipfw_objhash_set_funcs(struct namedobj_instance *ni, objhash_hash_f *hash_f, objhash_cmp_f *cmp_f); +void ipfw_init_obj_rewriter(void); +void ipfw_destroy_obj_rewriter(void); +void ipfw_add_obj_rewriter(struct opcode_obj_rewrite *rw, size_t count); +int ipfw_del_obj_rewriter(struct opcode_obj_rewrite *rw, size_t count); + +int ipfw_rewrite_rule_uidx(struct ip_fw_chain *chain, + struct rule_check_info *ci); +int ipfw_mark_object_kidx(struct ip_fw_chain *chain, struct ip_fw *rule, + uint32_t *bmask); +int ref_opcode_object(struct ip_fw_chain *ch, ipfw_insn *cmd, struct tid_info *ti, + struct obj_idx *pidx, int *found, int *unresolved); +void unref_oib_objects(struct ip_fw_chain *ch, ipfw_insn *cmd, + struct obj_idx *oib, struct obj_idx *end); +int create_objects_compat(struct ip_fw_chain *ch, ipfw_insn *cmd, + struct obj_idx *oib, struct obj_idx *pidx, struct tid_info *ti); +void update_opcode_kidx(ipfw_insn *cmd, uint16_t idx); +int classify_opcode_kidx(ipfw_insn *cmd, uint16_t *puidx); +void ipfw_init_srv(struct ip_fw_chain *ch); +void ipfw_destroy_srv(struct ip_fw_chain *ch); /* In ip_fw_table.c */ struct table_info; Modified: user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_sockopt.c Mon Apr 27 09:06:27 2015 (r282076) +++ user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_sockopt.c Mon Apr 27 09:10:32 2015 (r282077) @@ -148,6 +148,21 @@ static struct ipfw_sopt_handler scodes[] { IP_FW_DUMP_SOPTCODES, 0, HDIR_GET, dump_soptcodes }, }; +static int +set_legacy_obj_kidx(struct ip_fw_chain *ch, struct ip_fw_rule0 *rule); +struct opcode_obj_rewrite *ipfw_find_op_rw(uint16_t opcode); +static int mark_object_kidx(struct ip_fw_chain *ch, struct ip_fw *rule, + uint32_t *bmask); +static void unref_rule_objects(struct ip_fw_chain *chain, struct ip_fw *rule); +static int export_objhash_ntlv(struct namedobj_instance *ni, uint16_t kidx, + struct sockopt_data *sd); + +/* + * Opcode object rewriter variables + */ +struct opcode_obj_rewrite *ctl3_rewriters; +static size_t ctl3_rsize; + /* * static variables followed by global ones */ @@ -646,17 +661,18 @@ commit_rules(struct ip_fw_chain *chain, struct ip_fw *krule; struct ip_fw **map; /* the new array of pointers */ - /* Check if we need to do table remap */ + /* Check if we need to do table/obj index remap */ tcount = 0; for (ci = rci, i = 0; i < count; ci++, i++) { - if (ci->table_opcodes == 0) + if (ci->object_opcodes == 0) continue; /* - * Rule has some table opcodes. - * Reference & allocate needed tables/ + * Rule has some object opcodes. + * We need to find (and create non-existing) + * kernel objects, and reference existing ones. */ - error = ipfw_rewrite_table_uidx(chain, ci); + error = ipfw_rewrite_rule_uidx(chain, ci); if (error != 0) { /* @@ -674,9 +690,9 @@ commit_rules(struct ip_fw_chain *chain, IPFW_UH_WLOCK(chain); while (ci != rci) { ci--; - if (ci->table_opcodes == 0) + if (ci->object_opcodes == 0) continue; - ipfw_unref_rule_tables(chain,ci->krule); + unref_rule_objects(chain,ci->krule); } IPFW_UH_WUNLOCK(chain); @@ -696,10 +712,10 @@ commit_rules(struct ip_fw_chain *chain, /* Unbind tables */ IPFW_UH_WLOCK(chain); for (ci = rci, i = 0; i < count; ci++, i++) { - if (ci->table_opcodes == 0) + if (ci->object_opcodes == 0) continue; - ipfw_unref_rule_tables(chain, ci->krule); + unref_rule_objects(chain, ci->krule); } IPFW_UH_WUNLOCK(chain); } @@ -759,7 +775,7 @@ ipfw_reap_add(struct ip_fw_chain *chain, IPFW_UH_WLOCK_ASSERT(chain); /* Unlink rule from everywhere */ - ipfw_unref_rule_tables(chain, rule); + unref_rule_objects(chain, rule); *((struct ip_fw **)rule) = *head; *head = rule; @@ -1542,7 +1558,7 @@ check_ipfw_rule_body(ipfw_insn *cmd, int cmdlen != F_INSN_SIZE(ipfw_insn_u32) + 1 && cmdlen != F_INSN_SIZE(ipfw_insn_u32)) goto bad_size; - ci->table_opcodes++; + ci->object_opcodes++; break; case O_IP_FLOW_LOOKUP: if (cmd->arg1 >= V_fw_tables_max) { @@ -1553,7 +1569,7 @@ check_ipfw_rule_body(ipfw_insn *cmd, int if (cmdlen != F_INSN_SIZE(ipfw_insn) && cmdlen != F_INSN_SIZE(ipfw_insn_u32)) goto bad_size; - ci->table_opcodes++; + ci->object_opcodes++; break; case O_MACADDR2: if (cmdlen != F_INSN_SIZE(ipfw_insn_mac)) @@ -1587,7 +1603,7 @@ check_ipfw_rule_body(ipfw_insn *cmd, int case O_XMIT: case O_VIA: if (((ipfw_insn_if *)cmd)->name[0] == '\1') - ci->table_opcodes++; + ci->object_opcodes++; if (cmdlen != F_INSN_SIZE(ipfw_insn_if)) goto bad_size; break; @@ -1631,6 +1647,7 @@ check_ipfw_rule_body(ipfw_insn *cmd, int return EINVAL; if (cmdlen != F_INSN_SIZE(ipfw_insn_nat)) goto bad_size; + ci->object_opcodes++; goto check_action; case O_FORWARD_MAC: /* XXX not implemented yet */ case O_CHECK_STATE: @@ -1788,7 +1805,7 @@ ipfw_getrules(struct ip_fw_chain *chain, l = RULESIZE7(rule); if (bp + l + sizeof(uint32_t) <= ep) { bcopy(rule, bp, l + sizeof(uint32_t)); - error = ipfw_rewrite_table_kidx(chain, + error = set_legacy_obj_kidx(chain, (struct ip_fw_rule0 *)bp); if (error != 0) return (0); @@ -1817,7 +1834,7 @@ ipfw_getrules(struct ip_fw_chain *chain, } dst = (struct ip_fw_rule0 *)bp; export_rule0(rule, dst, l); - error = ipfw_rewrite_table_kidx(chain, dst); + error = set_legacy_obj_kidx(chain, dst); /* * XXX HACK. Store the disable mask in the "next" @@ -1861,6 +1878,34 @@ struct dump_args { }; /* + * Export named object info in instance @ni, identified by @kidx + * to ipfw_obj_ntlv. TLV is allocated from @sd space. + * + * Returns 0 on success. + */ +static int +export_objhash_ntlv(struct namedobj_instance *ni, uint16_t kidx, + struct sockopt_data *sd) +{ + struct named_object *no; + ipfw_obj_ntlv *ntlv; + + no = ipfw_objhash_lookup_kidx(ni, kidx); + KASSERT(no != NULL, ("invalid object kernel index passed")); + + ntlv = (ipfw_obj_ntlv *)ipfw_get_sopt_space(sd, sizeof(*ntlv)); + if (ntlv == NULL) + return (ENOMEM); + + ntlv->head.type = no->etlv; + ntlv->head.length = sizeof(*ntlv); + ntlv->idx = no->kidx; + strlcpy(ntlv->name, no->name, sizeof(ntlv->name)); + + return (0); +} + +/* * Dumps static rules with table TLVs in buffer @sd. * * Returns 0 on success. @@ -1874,6 +1919,7 @@ dump_static_rules(struct ip_fw_chain *ch uint32_t tcount; ipfw_obj_ctlv *ctlv; struct ip_fw *krule; + struct namedobj_instance *ni; caddr_t dst; /* Dump table names first (if any) */ @@ -1891,13 +1937,21 @@ dump_static_rules(struct ip_fw_chain *ch i = 0; tcount = da->tcount; + ni = ipfw_get_table_objhash(chain); while (tcount > 0) { if ((bmask[i / 32] & (1 << (i % 32))) == 0) { i++; continue; } - if ((error = ipfw_export_table_ntlv(chain, i, sd)) != 0) + /* Jump to shared named object bitmask */ + if (i >= IPFW_TABLES_MAX) { + ni = CHAIN_TO_SRV(chain); + i -= IPFW_TABLES_MAX; + bmask += IPFW_TABLES_MAX / 32; + } + + if ((error = export_objhash_ntlv(ni, i, sd)) != 0) return (error); i++; @@ -1929,6 +1983,52 @@ dump_static_rules(struct ip_fw_chain *ch } /* + * Marks every object index used in @rule with bit in @bmask. + * Used to generate bitmask of referenced tables/objects for given ruleset + * or its part. + * + * Returns number of newly-referenced objects. + */ +static int +mark_object_kidx(struct ip_fw_chain *ch, struct ip_fw *rule, + uint32_t *bmask) +{ + int cmdlen, l, count; + ipfw_insn *cmd; + uint16_t kidx; + struct opcode_obj_rewrite *rw; + int bidx; + uint8_t subtype; + + l = rule->cmd_len; + cmd = rule->cmd; + cmdlen = 0; + count = 0; + for ( ; l > 0 ; l -= cmdlen, cmd += cmdlen) { + cmdlen = F_LEN(cmd); + + rw = ipfw_find_op_rw(cmd->opcode); + if (rw == NULL) + continue; + + if (rw->classifier(cmd, &kidx, &subtype) != 0) + continue; + + bidx = kidx / 32; + /* Maintain separate bitmasks for table and non-table objects */ + if (rw->etlv != IPFW_TLV_TBL_NAME) + bidx += IPFW_TABLES_MAX / 32; + + if ((bmask[bidx] & (1 << (kidx % 32))) == 0) + count++; + + bmask[bidx] |= 1 << (kidx % 32); + } + + return (count); +} + +/* * Dumps requested objects data * Data layout (version 0)(current): * Request: [ ipfw_cfg_lheader ] + IPFW_CFG_GET_* flags @@ -1963,9 +2063,9 @@ dump_config(struct ip_fw_chain *chain, i error = 0; bmask = NULL; - /* Allocate needed state */ + /* Allocate needed state. Note we allocate 2xspace mask, for table&srv */ if (hdr->flags & IPFW_CFG_GET_STATIC) - bmask = malloc(IPFW_TABLES_MAX / 8, M_TEMP, M_WAITOK | M_ZERO); + bmask = malloc(IPFW_TABLES_MAX / 4, M_TEMP, M_WAITOK | M_ZERO); IPFW_UH_RLOCK(chain); @@ -1994,7 +2094,8 @@ dump_config(struct ip_fw_chain *chain, i rule = chain->map[i]; da.rsize += RULEUSIZE1(rule) + sizeof(ipfw_obj_tlv); da.rcount++; - da.tcount += ipfw_mark_table_kidx(chain, rule, bmask); + /* Update bitmask of used objects for given range */ + da.tcount += mark_object_kidx(chain, rule, bmask); } /* Add counters if requested */ if (hdr->flags & IPFW_CFG_GET_COUNTERS) { @@ -2064,6 +2165,241 @@ check_object_name(ipfw_obj_ntlv *ntlv) } /* + * Creates non-existent objects referenced by rule. + * + * Return 0 on success. + */ +int +create_objects_compat(struct ip_fw_chain *ch, ipfw_insn *cmd, + struct obj_idx *oib, struct obj_idx *pidx, struct tid_info *ti) +{ + struct opcode_obj_rewrite *rw; + struct obj_idx *p; + uint16_t kidx; + int error; + + /* + * Compatibility stuff: do actual creation for non-existing, + * but referenced objects. + */ + for (p = oib; p < pidx; p++) { + if (p->kidx != 0) + continue; + + ti->uidx = p->uidx; + ti->type = p->type; + ti->atype = 0; + + rw = ipfw_find_op_rw((cmd + p->off)->opcode); + KASSERT(rw != NULL, ("Unable to find handler for op %d", + (cmd + p->off)->opcode)); + + error = rw->create_object(ch, ti, &kidx); + if (error == 0) { + p->kidx = kidx; + continue; + } + + /* + * Error happened. We have to rollback everything. + * Drop all already acquired references. + */ + IPFW_UH_WLOCK(ch); + unref_oib_objects(ch, cmd, oib, pidx); + IPFW_UH_WUNLOCK(ch); + + return (error); + } + + return (error); +} + +/* + * Compatibility function for old ipfw(8) binaries. + * Rewrites table/nat kernel indices with userland ones. + * Convert tables matching '/^\d+$/' to their atoi() value. + * Use number 65535 for other tables. + * + * Returns 0 on success. + */ +static int +set_legacy_obj_kidx(struct ip_fw_chain *ch, struct ip_fw_rule0 *rule) +{ + int cmdlen, error, l; + ipfw_insn *cmd; + uint16_t kidx, uidx; + struct named_object *no; + struct opcode_obj_rewrite *rw; + uint8_t subtype; + char *end; + long val; + + error = 0; + + l = rule->cmd_len; + cmd = rule->cmd; + cmdlen = 0; + for ( ; l > 0 ; l -= cmdlen, cmd += cmdlen) { + cmdlen = F_LEN(cmd); + + rw = ipfw_find_op_rw(cmd->opcode); + if (rw == NULL) + continue; + + /* Check if is index in given opcode */ + if (rw->classifier(cmd, &kidx, &subtype) != 0) + continue; + + /* Try to find referenced kernel object */ + no = rw->find_bykidx(ch, kidx); + if (no == NULL) + continue; + + val = strtol(no->name, &end, 10); + if (*end == '\0' && val < 65535) { + uidx = val; + } else { + + /* + * We are called via legacy opcode. + * Save error and show table as fake number + * not to make ipfw(8) hang. + */ + uidx = 65535; + error = 2; + } + + rw->update(cmd, uidx); + } + + return (error); +} + + +/* + * Unreferences all already-referenced objects in given @cmd rule, + * using information in @oib. + * + * Used to rollback partially converted rule on error. + */ +void +unref_oib_objects(struct ip_fw_chain *ch, ipfw_insn *cmd, struct obj_idx *oib, + struct obj_idx *end) +{ + struct opcode_obj_rewrite *rw; + struct named_object *no; + struct obj_idx *p; + + IPFW_UH_WLOCK_ASSERT(ch); + + for (p = oib; p < end; p++) { + if (p->kidx == 0) + continue; + + rw = ipfw_find_op_rw((cmd + p->off)->opcode); + KASSERT(rw != NULL, ("Unable to find handler for op %d", + (cmd + p->off)->opcode)); + + /* Find & unref by existing idx */ + no = rw->find_bykidx(ch, p->kidx); + KASSERT(no != NULL, ("Ref'd object %d disappeared", p->kidx)); + no->refcnt--; + } +} + +/* + * Remove references from every object used in @rule. + * Used at rule removal code. + */ +static void +unref_rule_objects(struct ip_fw_chain *ch, struct ip_fw *rule) +{ + int cmdlen, l; + ipfw_insn *cmd; + struct named_object *no; + uint16_t kidx; + struct opcode_obj_rewrite *rw; + uint8_t subtype; + + IPFW_UH_WLOCK_ASSERT(ch); + + l = rule->cmd_len; + cmd = rule->cmd; + cmdlen = 0; + for ( ; l > 0 ; l -= cmdlen, cmd += cmdlen) { + cmdlen = F_LEN(cmd); + + rw = ipfw_find_op_rw(cmd->opcode); + if (rw == NULL) + continue; + if (rw->classifier(cmd, &kidx, &subtype) != 0) + continue; + + no = rw->find_bykidx(ch, kidx); + + KASSERT(no != NULL, ("table id %d not found", kidx)); + KASSERT(no->subtype == subtype, + ("wrong type %d (%d) for table id %d", + no->subtype, subtype, kidx)); + KASSERT(no->refcnt > 0, ("refcount for table %d is %d", + kidx, no->refcnt)); + + no->refcnt--; + } +} + + +/* + * Find and reference object (if any) stored in instruction @cmd. + * + * Saves object info in @pidx, sets + * - @found to 1 if object was found and references + * - @unresolved to 1 if object should exists but not found + * + * Returns non-zero value in case of error. + */ +int +ref_opcode_object(struct ip_fw_chain *ch, ipfw_insn *cmd, struct tid_info *ti, + struct obj_idx *pidx, int *found, int *unresolved) +{ + struct named_object *no; + struct opcode_obj_rewrite *rw; + int error; + + *found = 0; + *unresolved = 0; + + /* Check if this opcode is candidate for rewrite */ + rw = ipfw_find_op_rw(cmd->opcode); + if (rw == NULL) + return (0); + + /* Check if we need to rewrite this opcode */ + if (rw->classifier(cmd, &ti->uidx, &ti->type) != 0) + return (0); + + /* Need to rewrite. Save necessary fields */ + pidx->uidx = ti->uidx; + pidx->type = ti->type; + + /* Try to find referenced kernel object */ + error = rw->find_byname(ch, ti, &no); + if (error != 0) + return (error); + if (no == NULL) { + *unresolved = 1; + return (0); + } + + /* Found. bump refcount */ + *found = 1; + no->refcnt++; + pidx->kidx = no->kidx; + + return (0); +} + +/* * Adds one or more rules to ipfw @chain. * Data layout (version 0)(current): * Request: @@ -2315,6 +2651,160 @@ dump_soptcodes(struct ip_fw_chain *chain } /* + * Compares two opcodes. + * Used both in qsort() and bsearch(). + * + * Returns 0 if match is found. + */ +static int +compare_opcodes(const void *_a, const void *_b) +{ + const struct opcode_obj_rewrite *a, *b; + + a = (const struct opcode_obj_rewrite *)_a; + b = (const struct opcode_obj_rewrite *)_b; + + if (a->opcode < b->opcode) + return (-1); + else if (a->opcode > b->opcode) + return (1); + + return (0); +} + +/* + * Finds opcode object rewriter based on @code. + * + * Returns pointer to handler or NULL. + */ +struct opcode_obj_rewrite * +ipfw_find_op_rw(uint16_t opcode) +{ + struct opcode_obj_rewrite *rw, h; + + memset(&h, 0, sizeof(h)); + h.opcode = opcode; + + rw = (struct opcode_obj_rewrite *)bsearch(&h, ctl3_rewriters, + ctl3_rsize, sizeof(h), compare_opcodes); + + return (rw); +} + +int +classify_opcode_kidx(ipfw_insn *cmd, uint16_t *puidx) +{ + struct opcode_obj_rewrite *rw; + uint8_t subtype; + + rw = ipfw_find_op_rw(cmd->opcode); + if (rw == NULL) + return (1); + + return (rw->classifier(cmd, puidx, &subtype)); +} + +void +update_opcode_kidx(ipfw_insn *cmd, uint16_t idx) +{ + struct opcode_obj_rewrite *rw; + + rw = ipfw_find_op_rw(cmd->opcode); + KASSERT(rw != NULL, ("No handler to update opcode %d", cmd->opcode)); + rw->update(cmd, idx); +} + +void +ipfw_init_obj_rewriter() +{ + + ctl3_rewriters = NULL; + ctl3_rsize = 0; +} + +void +ipfw_destroy_obj_rewriter() +{ + + if (ctl3_rewriters != NULL) + free(ctl3_rewriters, M_IPFW); + ctl3_rewriters = NULL; + ctl3_rsize = 0; +} + +/* + * Adds one or more opcode object rewrite handlers to the global array. + * Function may sleep. + */ +void +ipfw_add_obj_rewriter(struct opcode_obj_rewrite *rw, size_t count) +{ + size_t sz; + struct opcode_obj_rewrite *tmp; + + CTL3_LOCK(); + + for (;;) { + sz = ctl3_rsize + count; + CTL3_UNLOCK(); + tmp = malloc(sizeof(*rw) * sz, M_IPFW, M_WAITOK | M_ZERO); + CTL3_LOCK(); + if (ctl3_rsize + count <= sz) + break; + + /* Retry */ + free(tmp, M_IPFW); + } + + /* Merge old & new arrays */ + sz = ctl3_rsize + count; + memcpy(tmp, ctl3_rewriters, ctl3_rsize * sizeof(*rw)); + memcpy(&tmp[ctl3_rsize], rw, count * sizeof(*rw)); + qsort(tmp, sz, sizeof(*rw), compare_opcodes); + /* Switch new and free old */ + if (ctl3_rewriters != NULL) + free(ctl3_rewriters, M_IPFW); + ctl3_rewriters = tmp; + ctl3_rsize = sz; + + CTL3_UNLOCK(); +} + +/* + * Removes one or more object rewrite handlers from the global array. + */ +int +ipfw_del_obj_rewriter(struct opcode_obj_rewrite *rw, size_t count) +{ + size_t sz; + struct opcode_obj_rewrite *tmp, *h; + int i; + + CTL3_LOCK(); + + for (i = 0; i < count; i++) { + tmp = &rw[i]; + h = ipfw_find_op_rw(tmp->opcode); + if (h == NULL) + continue; + + sz = (ctl3_rewriters + ctl3_rsize - (h + 1)) * sizeof(*h); + memmove(h, h + 1, sz); + ctl3_rsize--; + } + + if (ctl3_rsize == 0) { + if (ctl3_rewriters != NULL) + free(ctl3_rewriters, M_IPFW); + ctl3_rewriters = NULL; + } + + CTL3_UNLOCK(); + + return (0); +} + +/* * Compares two sopt handlers (code, version and handler ptr). * Used both as qsort() and bsearch(). * Does not compare handler for latter case. @@ -3150,6 +3640,23 @@ convert_rule_to_8(struct ip_fw_rule0 *ru * */ +void +ipfw_init_srv(struct ip_fw_chain *ch) +{ + + ch->srvmap = ipfw_objhash_create(IPFW_OBJECTS_DEFAULT); + ch->srvstate = malloc(sizeof(void *) * IPFW_OBJECTS_DEFAULT, + M_IPFW, M_WAITOK | M_ZERO); +} + +void +ipfw_destroy_srv(struct ip_fw_chain *ch) +{ + + free(ch->srvstate, M_IPFW); + ipfw_objhash_destroy(ch->srvmap); +} + /* * Allocate new bitmask which can be used to enlarge/shrink * named instance index. @@ -3323,6 +3830,26 @@ ipfw_objhash_lookup_name(struct namedobj return (NULL); } +/* + * Find named object by name, considering also its TLV type. + */ +struct named_object * +ipfw_objhash_lookup_name_type(struct namedobj_instance *ni, uint32_t set, + uint32_t type, char *name) +{ + struct named_object *no; + uint32_t hash; + + hash = ni->hash_f(ni, name, set) % ni->nn_size; + + TAILQ_FOREACH(no, &ni->names[hash], nn_next) { + if (ni->cmp_f(no, name, set) == 0 && no->etlv == type) + return (no); + } + + return (NULL); +} + struct named_object * ipfw_objhash_lookup_kidx(struct namedobj_instance *ni, uint16_t kidx) { Modified: user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_table.c ============================================================================== --- user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_table.c Mon Apr 27 09:06:27 2015 (r282076) +++ user/ngie/more-tests/sys/netpfil/ipfw/ip_fw_table.c Mon Apr 27 09:10:32 2015 (r282077) @@ -89,6 +89,8 @@ struct table_config { struct namedobj_instance *vi; }; +static int find_table_err(struct namedobj_instance *ni, struct tid_info *ti, + struct table_config **tc); static struct table_config *find_table(struct namedobj_instance *ni, struct tid_info *ti); static struct table_config *alloc_table_config(struct ip_fw_chain *ch, @@ -122,7 +124,6 @@ static struct table_algo *find_table_alg static void objheader_to_ti(struct _ipfw_obj_header *oh, struct tid_info *ti); static void ntlv_to_ti(struct _ipfw_obj_ntlv *ntlv, struct tid_info *ti); -static int classify_table_opcode(ipfw_insn *cmd, uint16_t *puidx, uint8_t *ptype); #define CHAIN_TO_NI(chain) (CHAIN_TO_TCFG(chain)->namehash) #define KIDX_TO_TI(ch, k) (&(((struct table_info *)(ch)->tablestate)[k])) @@ -297,7 +298,7 @@ find_ref_table(struct ip_fw_chain *ch, s tc = NULL; if ((tc = find_table(ni, ti)) != NULL) { /* check table type */ - if (tc->no.type != ti->type) + if (tc->no.subtype != ti->type) return (EINVAL); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Apr 27 09:13:12 2015 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B5EF897F; Mon, 27 Apr 2015 09:13:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8CF38177F; Mon, 27 Apr 2015 09:13:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3R9DCee029721; Mon, 27 Apr 2015 09:13:12 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3R9DC9g029720; Mon, 27 Apr 2015 09:13:12 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201504270913.t3R9DC9g029720@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 27 Apr 2015 09:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r282079 - user/ngie/more-tests/tests/sys/mmap X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2015 09:13:12 -0000 Author: ngie Date: Mon Apr 27 09:13:11 2015 New Revision: 282079 URL: https://svnweb.freebsd.org/changeset/base/282079 Log: Remove tests/sys/mmap I changed my mind and integrated it into tests/sys/kern instead of tests/sys/mmap, because the former location made more sense, and there was only 1 test program to account for in the latter (and original) location Deleted: user/ngie/more-tests/tests/sys/mmap/ From owner-svn-src-user@FreeBSD.ORG Mon Apr 27 09:15:37 2015 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 95875AA7; Mon, 27 Apr 2015 09:15:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8350F1796; Mon, 27 Apr 2015 09:15:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3R9FbEt030146; Mon, 27 Apr 2015 09:15:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3R9Fb0k030144; Mon, 27 Apr 2015 09:15:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201504270915.t3R9Fb0k030144@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 27 Apr 2015 09:15:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r282080 - user/ngie/more-tests/tests/sys/aio X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2015 09:15:37 -0000 Author: ngie Date: Mon Apr 27 09:15:36 2015 New Revision: 282080 URL: https://svnweb.freebsd.org/changeset/base/282080 Log: Try and fix filenames to diff reduce with head Added: - copied unchanged from r282079, head/tests/sys/aio/aio_kqueue_test.c - copied unchanged from r282079, head/tests/sys/aio/lio_kqueue_test.c Directory Properties: user/ngie/more-tests/tests/sys/aio/aio_kqueue_test.c (props changed) user/ngie/more-tests/tests/sys/aio/lio_kqueue_test.c (props changed) Deleted: user/ngie/more-tests/tests/sys/aio/aio_kqueue.c user/ngie/more-tests/tests/sys/aio/lio_kqueue.c Copied: user/ngie/more-tests/tests/sys/aio/aio_kqueue_test.c (from r282079, head/tests/sys/aio/aio_kqueue_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ngie/more-tests/tests/sys/aio/aio_kqueue_test.c Mon Apr 27 09:15:36 2015 (r282080, copy of r282079, head/tests/sys/aio/aio_kqueue_test.c) @@ -0,0 +1,207 @@ +/*- + * Copyright (C) 2005 IronPort Systems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Prerequisities: + * - AIO support must be compiled into the kernel (see sys//NOTES for + * more details). + * + * Note: it is a good idea to run this against a physical drive to + * exercise the physio fast path (ie. aio_kqueue /dev/) + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PATH_TEMPLATE "/tmp/aio.XXXXXXXXXX" + +#define MAX 128 +#define MAX_RUNS 300 +/* #define DEBUG */ + +int +main (int argc, char *argv[]) +{ + int fd; + struct aiocb *iocb[MAX], *kq_iocb; + int i, result, run, error, j; + char buffer[32768]; + int kq = kqueue(); + struct kevent ke, kq_returned; + struct timespec ts; + int cancel, pending, tmp_file = 0, failed = 0; + char *file, pathname[sizeof(PATH_TEMPLATE)+1]; + + if (kq < 0) { + perror("No kqeueue\n"); + exit(1); + } + + if (argc == 1) { + strcpy(pathname, PATH_TEMPLATE); + fd = mkstemp(pathname); + file = pathname; + tmp_file = 1; + } else { + file = argv[1]; + fd = open(file, O_RDWR|O_CREAT, 0666); + } + if (fd == -1) + err(1, "Can't open %s\n", file); + + for (run = 0; run < MAX_RUNS; run++){ +#ifdef DEBUG + printf("Run %d\n", run); +#endif + for (i = 0; i < MAX; i++) { + iocb[i] = (struct aiocb *)calloc(1, + sizeof(struct aiocb)); + if (iocb[i] == NULL) + err(1, "calloc"); + } + + pending = 0; + for (i = 0; i < MAX; i++) { + pending++; + iocb[i]->aio_nbytes = sizeof(buffer); + iocb[i]->aio_buf = buffer; + iocb[i]->aio_fildes = fd; + iocb[i]->aio_offset = iocb[i]->aio_nbytes * i * run; + + iocb[i]->aio_sigevent.sigev_notify_kqueue = kq; + iocb[i]->aio_sigevent.sigev_value.sival_ptr = iocb[i]; + iocb[i]->aio_sigevent.sigev_notify = SIGEV_KEVENT; + + result = aio_write(iocb[i]); + if (result != 0) { + perror("aio_write"); + printf("Result %d iteration %d\n", result, i); + exit(1); + } +#ifdef DEBUG + printf("WRITE %d is at %p\n", i, iocb[i]); +#endif + result = rand(); + if (result < RAND_MAX/32) { + if (result > RAND_MAX/64) { + result = aio_cancel(fd, iocb[i]); +#ifdef DEBUG + printf("Cancel %d %p result %d\n", i, iocb[i], result); +#endif + if (result == AIO_CANCELED) { + aio_return(iocb[i]); + iocb[i] = NULL; + pending--; + } + } + } + } + cancel = MAX - pending; + + i = 0; + while (pending) { + + for (;;) { + + bzero(&ke, sizeof(ke)); + bzero(&kq_returned, sizeof(ke)); + ts.tv_sec = 0; + ts.tv_nsec = 1; + result = kevent(kq, NULL, 0, + &kq_returned, 1, &ts); + error = errno; + if (result < 0) + perror("kevent error: "); + kq_iocb = kq_returned.udata; +#ifdef DEBUG + printf("kevent %d %d errno %d return.ident %p " + "return.data %p return.udata %p %p\n", + i, result, error, + kq_returned.ident, kq_returned.data, + kq_returned.udata, + kq_iocb); +#endif + + if (kq_iocb) + break; +#ifdef DEBUG + printf("Try again left %d out of %d %d\n", + pending, MAX, cancel); +#endif + } + + for (j = 0; j < MAX && iocb[j] != kq_iocb; + j++) ; +#ifdef DEBUG + printf("kq_iocb %p\n", kq_iocb); + + printf("Error Result for %d is %d pending %d\n", + j, result, pending); +#endif + result = aio_return(kq_iocb); +#ifdef DEBUG + printf("Return Result for %d is %d\n\n", j, result); +#endif + if (result != sizeof(buffer)) { + printf("FAIL: run %d, operation %d, result %d " + " (errno=%d) should be %zu\n", run, pending, + result, errno, sizeof(buffer)); + failed++; + } else + printf("PASS: run %d, left %d\n", run, + pending - 1); + + free(kq_iocb); + iocb[j] = NULL; + pending--; + i++; + } + + for (i = 0; i < MAX; i++) + free(iocb[i]); + + } + + if (tmp_file) + unlink(pathname); + + if (failed != 0) + printf("FAIL: %d tests failed\n", failed); + else + printf("PASS: All tests passed\n"); + + exit (failed == 0 ? 0 : 1); +} Copied: user/ngie/more-tests/tests/sys/aio/lio_kqueue_test.c (from r282079, head/tests/sys/aio/lio_kqueue_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ngie/more-tests/tests/sys/aio/lio_kqueue_test.c Mon Apr 27 09:15:36 2015 (r282080, copy of r282079, head/tests/sys/aio/lio_kqueue_test.c) @@ -0,0 +1,245 @@ +/*- + * Copyright (C) 2005 IronPort Systems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Note: it is a good idea to run this against a physical drive to + * exercise the physio fast path (ie. lio_kqueue /dev/) + * This will ensure op's counting is correct. It is currently broken. + * + * Also note that LIO & kqueue is not implemented in FreeBSD yet, LIO + * is also broken with respect to op's and some paths. + * + * A patch to make this work is at: + * http://www.ambrisko.com/doug/listio_kqueue/listio_kqueue.patch + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PATH_TEMPLATE "/tmp/aio.XXXXXXXXXX" + +#define LIO_MAX 5 +#define MAX LIO_MAX * 16 +#define MAX_RUNS 300 + +int +main(int argc, char *argv[]){ + int fd; + struct aiocb *iocb[MAX]; + struct aiocb **lio[LIO_MAX], **lio_element, **kq_lio; + int i, result, run, error, j, k; + char buffer[32768]; + int kq = kqueue(); + struct kevent ke, kq_returned; + struct timespec ts; + struct sigevent sig; + time_t time1, time2; + char *file, pathname[sizeof(PATH_TEMPLATE)-1]; + int tmp_file = 0, failed = 0; + + if (kq < 0) { + perror("No kqeueue\n"); + exit(1); + } + + if (argc == 1) { + strcpy(pathname, PATH_TEMPLATE); + fd = mkstemp(pathname); + file = pathname; + tmp_file = 1; + } else { + file = argv[1]; + fd = open(file, O_RDWR|O_CREAT, 0666); + } + if (fd < 0){ + fprintf(stderr, "Can't open %s\n", argv[1]); + perror(""); + exit(1); + } + +#ifdef DEBUG + printf("Hello kq %d fd %d\n", kq, fd); +#endif + + for (run = 0; run < MAX_RUNS; run++){ +#ifdef DEBUG + printf("Run %d\n", run); +#endif + for (j = 0; j < LIO_MAX; j++) { + lio[j] = (struct aiocb **) + malloc(sizeof(struct aiocb *) * MAX/LIO_MAX); + for(i = 0; i < MAX / LIO_MAX; i++) { + k = (MAX / LIO_MAX * j) + i; + lio_element = lio[j]; + lio[j][i] = iocb[k] = (struct aiocb *) + malloc(sizeof(struct aiocb)); + bzero(iocb[k], sizeof(struct aiocb)); + iocb[k]->aio_nbytes = sizeof(buffer); + iocb[k]->aio_buf = buffer; + iocb[k]->aio_fildes = fd; + iocb[k]->aio_offset + = iocb[k]->aio_nbytes * k * (run + 1); + +#ifdef DEBUG + printf("hello iocb[k] %d\n", + iocb[k]->aio_offset); +#endif + iocb[k]->aio_lio_opcode = LIO_WRITE; + } + sig.sigev_notify_kqueue = kq; + sig.sigev_value.sival_ptr = lio[j]; + sig.sigev_notify = SIGEV_KEVENT; + time(&time1); + result = lio_listio(LIO_NOWAIT, lio[j], + MAX / LIO_MAX, &sig); + error = errno; + time(&time2); +#ifdef DEBUG + printf("Time %d %d %d result -> %d\n", + time1, time2, time2-time1, result); +#endif + if (result != 0) { + errno = error; + perror("list_listio"); + printf("FAIL: Result %d iteration %d\n",result, j); + exit(1); + } +#ifdef DEBUG + printf("write %d is at %p\n", j, lio[j]); +#endif + } + + for(i = 0; i < LIO_MAX; i++) { + for(j = LIO_MAX - 1; j >=0; j--) { + if (lio[j]) + break; + } + + for(;;) { + bzero(&ke, sizeof(ke)); + bzero(&kq_returned, sizeof(ke)); + ts.tv_sec = 0; + ts.tv_nsec = 1; +#ifdef DEBUG + printf("FOO lio %d -> %p\n", j, lio[j]); +#endif + EV_SET(&ke, (uintptr_t)lio[j], + EVFILT_LIO, EV_ONESHOT, 0, 0, iocb[j]); + result = kevent(kq, NULL, 0, + &kq_returned, 1, &ts); + error = errno; + if (result < 0) { + perror("kevent error: "); + } + kq_lio = kq_returned.udata; +#ifdef DEBUG + printf("kevent %d %d errno %d return.ident %p " + "return.data %p return.udata %p %p\n", + i, result, error, + kq_returned.ident, kq_returned.data, + kq_returned.udata, + lio[j]); +#endif + + if(kq_lio) + break; +#ifdef DEBUG + printf("Try again\n"); +#endif + } + +#ifdef DEBUG + printf("lio %p\n", lio); +#endif + + for (j = 0; j < LIO_MAX; j++) { + if (lio[j] == kq_lio) { + break; + } + } + if (j == LIO_MAX) { + printf("FAIL:\n"); + exit(1); + } + +#ifdef DEBUG + printf("Error Result for %d is %d\n", j, result); +#endif + if (result < 0) { + printf("FAIL: run %d, operation %d result %d \n", run, LIO_MAX - i -1, result); + failed = 1; + } else { + printf("PASS: run %d, operation %d result %d \n", run, LIO_MAX - i -1, result); + } + for(k = 0; k < MAX / LIO_MAX; k++){ + result = aio_return(kq_lio[k]); +#ifdef DEBUG + printf("Return Resulto for %d %d is %d\n", j, k, result); +#endif + if (result != sizeof(buffer)) { + printf("FAIL: run %d, operation %d sub-opt %d result %d (errno=%d) should be %zu\n", + run, LIO_MAX - i -1, k, result, errno, sizeof(buffer)); + } else { + printf("PASS: run %d, operation %d sub-opt %d result %d\n", + run, LIO_MAX - i -1, k, result); + } + } +#ifdef DEBUG + printf("\n"); +#endif + + for(k = 0; k < MAX / LIO_MAX; k++) { + free(lio[j][k]); + } + free(lio[j]); + lio[j] = NULL; + } + } +#ifdef DEBUG + printf("Done\n"); +#endif + + if (tmp_file) { + unlink(pathname); + } + + if (failed) { + printf("FAIL: Atleast one\n"); + exit(1); + } else { + printf("PASS: All\n"); + exit(0); + } +} From owner-svn-src-user@FreeBSD.ORG Mon Apr 27 13:50:12 2015 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 50F0B3FE; Mon, 27 Apr 2015 13:50:12 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D08116B6; Mon, 27 Apr 2015 13:50:12 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id EFF95B953; Mon, 27 Apr 2015 09:50:10 -0400 (EDT) From: John Baldwin To: Garrett Cooper Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r282079 - user/ngie/more-tests/tests/sys/mmap Date: Mon, 27 Apr 2015 09:31 -0400 Message-ID: <2069493.DCDuT4HIma@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: <201504270913.t3R9DC9g029720@svn.freebsd.org> References: <201504270913.t3R9DC9g029720@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 27 Apr 2015 09:50:11 -0400 (EDT) X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2015 13:50:12 -0000 On Monday, April 27, 2015 09:13:12 AM Garrett Cooper wrote: > Author: ngie > Date: Mon Apr 27 09:13:11 2015 > New Revision: 282079 > URL: https://svnweb.freebsd.org/changeset/base/282079 > > Log: > Remove tests/sys/mmap > > I changed my mind and integrated it into tests/sys/kern instead of > tests/sys/mmap, because the former location made more sense, and there was > only 1 test program to account for in the latter (and original) location > > Deleted: > user/ngie/more-tests/tests/sys/mmap/ Note that technically mmap lives in sys/vm (vm_mmap.c), not sys/kern. :) -- John Baldwin