From owner-svn-src-all@FreeBSD.ORG Fri Dec 31 22:49:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC21E106564A; Fri, 31 Dec 2010 22:49:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9190A8FC08; Fri, 31 Dec 2010 22:49:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBVMnDWZ091087; Fri, 31 Dec 2010 22:49:13 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBVMnDUE091085; Fri, 31 Dec 2010 22:49:13 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201012312249.oBVMnDUE091085@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Fri, 31 Dec 2010 22:49:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216861 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Dec 2010 22:49:13 -0000 Author: bz Date: Fri Dec 31 22:49:13 2010 New Revision: 216861 URL: http://svn.freebsd.org/changeset/base/216861 Log: Mfp4 CH177924: Add and export constants of array sizes of jail parameters as compiled into the kernel. This is the least intrusive way to allow kvm to read the (sparse) arrays independent of the options the kernel was compiled with. Reviewed by: jhb (originally) MFC after: 1 week Sponsored by: The FreeBSD Foundation Sponsored by: CK Software GmbH Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Fri Dec 31 22:18:41 2010 (r216860) +++ head/sys/kern/kern_jail.c Fri Dec 31 22:49:13 2010 (r216861) @@ -140,7 +140,9 @@ static int prison_restrict_ip6(struct pr #define PD_LIST_XLOCKED 0x10 /* - * Parameter names corresponding to PR_* flag values + * Parameter names corresponding to PR_* flag values. Size values are for kvm + * as we cannot figure out the size of a sparse array, or an array without a + * terminating entry. */ static char *pr_flag_names[] = { [0] = "persist", @@ -151,6 +153,7 @@ static char *pr_flag_names[] = { [8] = "ip6.saddrsel", #endif }; +const size_t pr_flag_names_size = sizeof(pr_flag_names); static char *pr_flag_nonames[] = { [0] = "nopersist", @@ -161,6 +164,7 @@ static char *pr_flag_nonames[] = { [8] = "ip6.nosaddrsel", #endif }; +const size_t pr_flag_nonames_size = sizeof(pr_flag_nonames); struct jailsys_flags { const char *name; @@ -178,6 +182,7 @@ struct jailsys_flags { { "ip6", PR_IP6_USER | PR_IP6_DISABLE, PR_IP6_USER }, #endif }; +const size_t pr_flag_jailsys_size = sizeof(pr_flag_jailsys); static char *pr_allow_names[] = { "allow.set_hostname", @@ -188,6 +193,7 @@ static char *pr_allow_names[] = { "allow.quotas", "allow.socket_af", }; +const size_t pr_allow_names_size = sizeof(pr_allow_names); static char *pr_allow_nonames[] = { "allow.noset_hostname", @@ -198,6 +204,7 @@ static char *pr_allow_nonames[] = { "allow.noquotas", "allow.nosocket_af", }; +const size_t pr_allow_nonames_size = sizeof(pr_allow_nonames); #define JAIL_DEFAULT_ALLOW PR_ALLOW_SET_HOSTNAME #define JAIL_DEFAULT_ENFORCE_STATFS 2