From owner-svn-src-head@freebsd.org Tue May 2 18:40:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B467ED5A5A5; Tue, 2 May 2017 18:40:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 851D417E0; Tue, 2 May 2017 18:40:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42Ief0K003550; Tue, 2 May 2017 18:40:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42Ief5R003549; Tue, 2 May 2017 18:40:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201705021840.v42Ief5R003549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 2 May 2017 18:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317695 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 18:40:42 -0000 Author: kib Date: Tue May 2 18:40:41 2017 New Revision: 317695 URL: https://svnweb.freebsd.org/changeset/base/317695 Log: Emulate pre-r317061 ABI. This restores 32bit-sized accesses to vmcnt sysctls, making old binaries like top(1), systat(8) and reboot(8) mostly functional on newer kernel. Reviewed by: bde Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/vm_meter.c Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Tue May 2 18:37:11 2017 (r317694) +++ head/sys/vm/vm_meter.c Tue May 2 18:40:41 2017 (r317695) @@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, "VM meter vm stats"); SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); +static int +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS) +{ + uint64_t val; +#ifdef COMPAT_FREEBSD11 + uint32_t val32; +#endif + + val = counter_u64_fetch(*(counter_u64_t *)arg1); +#ifdef COMPAT_FREEBSD11 + if (req->oldlen == sizeof(val32)) { + val32 = val; /* truncate */ + return (SYSCTL_OUT(req, &val32, sizeof(val32))); + } +#endif + return (SYSCTL_OUT(req, &val, sizeof(val))); +} + #define VM_STATS(parent, var, descr) \ - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr)