Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Aug 2020 12:51:20 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364667 - in stable/12: share/man/man4 sys/compat/linux
Message-ID:  <202008241251.07OCpKa2037166@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Mon Aug 24 12:51:20 2020
New Revision: 364667
URL: https://svnweb.freebsd.org/changeset/base/364667

Log:
  MFC r362104:
  
  Add compat.linux.debug sysctl, to make it possible to silence down
  the debug messages. While here, clean up some variable naming.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/12/share/man/man4/linux.4
  stable/12/sys/compat/linux/linux_mib.c
  stable/12/sys/compat/linux/linux_mib.h
  stable/12/sys/compat/linux/linux_util.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/linux.4
==============================================================================
--- stable/12/share/man/man4/linux.4	Mon Aug 24 12:49:51 2020	(r364666)
+++ stable/12/share/man/man4/linux.4	Mon Aug 24 12:51:20 2020	(r364667)
@@ -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: stable/12/sys/compat/linux/linux_mib.c
==============================================================================
--- stable/12/sys/compat/linux/linux_mib.c	Mon Aug 24 12:49:51 2020	(r364666)
+++ stable/12/sys/compat/linux/linux_mib.c	Mon Aug 24 12:51:20 2020	(r364667)
@@ -62,6 +62,10 @@ static unsigned linux_osd_jail_slot;
 
 SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 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: stable/12/sys/compat/linux/linux_mib.h
==============================================================================
--- stable/12/sys/compat/linux/linux_mib.h	Mon Aug 24 12:49:51 2020	(r364666)
+++ stable/12/sys/compat/linux/linux_mib.h	Mon Aug 24 12:51:20 2020	(r364667)
@@ -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: stable/12/sys/compat/linux/linux_util.c
==============================================================================
--- stable/12/sys/compat/linux/linux_util.c	Mon Aug 24 12:49:51 2020	(r364666)
+++ stable/12/sys/compat/linux/linux_util.c	Mon Aug 24 12:51:20 2020	(r364667)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008241251.07OCpKa2037166>