From owner-svn-src-head@freebsd.org Fri Jun 12 14:37:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22C5733C5A4; Fri, 12 Jun 2020 14:37:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k3H407x7z4bjF; Fri, 12 Jun 2020 14:37:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA265B2BC; Fri, 12 Jun 2020 14:37:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CEbpDJ020244; Fri, 12 Jun 2020 14:37:51 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CEbpku020240; Fri, 12 Jun 2020 14:37:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006121437.05CEbpku020240@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 12 Jun 2020 14:37:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362104 - in head: share/man/man4 sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: share/man/man4 sys/compat/linux X-SVN-Commit-Revision: 362104 X-SVN-Commit-Repository: base 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.33 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: Fri, 12 Jun 2020 14:37:52 -0000 Author: trasz Date: Fri Jun 12 14:37:50 2020 New Revision: 362104 URL: https://svnweb.freebsd.org/changeset/base/362104 Log: Add compat.linux.debug sysctl, to make it possible to silence down the debug messages. While here, clean up some variable naming. Reviewed by: bcr (manpages), emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25230 Modified: head/share/man/man4/linux.4 head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_mib.h head/sys/compat/linux/linux_util.c Modified: head/share/man/man4/linux.4 ============================================================================== --- head/share/man/man4/linux.4 Fri Jun 12 14:31:19 2020 (r362103) +++ head/share/man/man4/linux.4 Fri Jun 12 14:37:50 2020 (r362104) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 10, 2020 +.Dd June 12, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -95,6 +95,10 @@ variables and .Xr loader 8 tunables: .Bl -tag -width indent +.It Va compat.linux.debug +Enable debugging messages. +Set to 0 to silence them. +Defaults to 1. .It Va compat.linux.default_openfiles Default soft openfiles resource limit for Linux applications. Set to -1 to disable the limit. Modified: head/sys/compat/linux/linux_mib.c ============================================================================== --- head/sys/compat/linux/linux_mib.c Fri Jun 12 14:31:19 2020 (r362103) +++ head/sys/compat/linux/linux_mib.c Fri Jun 12 14:37:50 2020 (r362104) @@ -63,6 +63,10 @@ static unsigned linux_osd_jail_slot; SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Linux mode"); +int linux_debug = 1; +SYSCTL_INT(_compat_linux, OID_AUTO, debug, CTLFLAG_RWTUN, + &linux_debug, 0, "Log warnings from linux(4); or 0 to disable"); + int linux_default_openfiles = 1024; SYSCTL_INT(_compat_linux, OID_AUTO, default_openfiles, CTLFLAG_RWTUN, &linux_default_openfiles, 0, Modified: head/sys/compat/linux/linux_mib.h ============================================================================== --- head/sys/compat/linux/linux_mib.h Fri Jun 12 14:31:19 2020 (r362103) +++ head/sys/compat/linux/linux_mib.h Fri Jun 12 14:37:50 2020 (r362104) @@ -62,6 +62,7 @@ int linux_kernver(struct thread *td); #define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) +extern int linux_debug; extern int linux_default_openfiles; extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; Modified: head/sys/compat/linux/linux_util.c ============================================================================== --- head/sys/compat/linux/linux_util.c Fri Jun 12 14:31:19 2020 (r362103) +++ head/sys/compat/linux/linux_util.c Fri Jun 12 14:37:50 2020 (r362104) @@ -91,6 +91,9 @@ linux_msg(const struct thread *td, const char *fmt, .. va_list ap; struct proc *p; + if (linux_debug == 0) + return; + p = td->td_proc; printf("linux: pid %d (%s): ", (int)p->p_pid, p->p_comm); va_start(ap, fmt);