diff options
author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2020-06-12 14:37:50 +0000 |
---|---|---|
committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2020-06-12 14:37:50 +0000 |
commit | 462171d9aa00f863df65ac49836c9f3cc7e55a9c (patch) | |
tree | 9012106e2f5fe45422a4c9b769ac0944f5c11220 | |
parent | 599dadca55fb6f7caacad1868a7c63de6e2cb354 (diff) |
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
Notes
Notes:
svn path=/head/; revision=362104
-rw-r--r-- | share/man/man4/linux.4 | 6 | ||||
-rw-r--r-- | sys/compat/linux/linux_mib.c | 4 | ||||
-rw-r--r-- | sys/compat/linux/linux_mib.h | 1 | ||||
-rw-r--r-- | sys/compat/linux/linux_util.c | 3 |
4 files changed, 13 insertions, 1 deletions
diff --git a/share/man/man4/linux.4 b/share/man/man4/linux.4 index 4703bdd3a21e..d865ce5476a5 100644 --- a/share/man/man4/linux.4 +++ b/share/man/man4/linux.4 @@ -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. diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c index 65ca97461b62..9815424aafa4 100644 --- a/sys/compat/linux/linux_mib.c +++ b/sys/compat/linux/linux_mib.c @@ -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, diff --git a/sys/compat/linux/linux_mib.h b/sys/compat/linux/linux_mib.h index d7a13a456125..385ba2ab390f 100644 --- a/sys/compat/linux/linux_mib.h +++ b/sys/compat/linux/linux_mib.h @@ -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; diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c index 54769451d1e5..59fc844e1cbe 100644 --- a/sys/compat/linux/linux_util.c +++ b/sys/compat/linux/linux_util.c @@ -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); |