svn commit: r347538 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux modules/linux modules/linux64 modules/linux_common

Dmitry Chagin dchagin at FreeBSD.org
Mon May 13 18:24:32 UTC 2019


Author: dchagin
Date: Mon May 13 18:24:29 2019
New Revision: 347538
URL: https://svnweb.freebsd.org/changeset/base/347538

Log:
  Linuxulator depends on a fundamental kernel settings such as SMP. Many
  of them listed in opt_global.h which is not generated while building
  modules outside of a kernel and such modules never match real cofigured
  kernel.
  
  So, we should prevent our users from building obviously defective modules.
  
  Therefore, remove the root cause of the building of modules outside of a
  kernel - the possibility of building modules with DEBUG or KTR flags.
  And remove all of DEBUG printfs as it is incomplete and in threaded
  programms not informative, also a half of system call does not have DEBUG
  printf. For debuging Linux programms we have dtrace, ktr and ktrace ability.
  
  PR:		222861
  Reviewed by:	trasz
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D20178

Modified:
  head/sys/amd64/linux/linux.h
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux.h
  head/sys/amd64/linux32/linux32_machdep.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/arm64/linux/linux.h
  head/sys/arm64/linux/linux_sysvec.c
  head/sys/compat/linux/linux_file.c
  head/sys/compat/linux/linux_fork.c
  head/sys/compat/linux/linux_getcwd.c
  head/sys/compat/linux/linux_ioctl.c
  head/sys/compat/linux/linux_misc.c
  head/sys/compat/linux/linux_misc.h
  head/sys/compat/linux/linux_signal.c
  head/sys/compat/linux/linux_stats.c
  head/sys/i386/linux/linux.h
  head/sys/i386/linux/linux_machdep.c
  head/sys/i386/linux/linux_sysvec.c
  head/sys/modules/linux/Makefile
  head/sys/modules/linux64/Makefile
  head/sys/modules/linux_common/Makefile

Modified: head/sys/amd64/linux/linux.h
==============================================================================
--- head/sys/amd64/linux/linux.h	Mon May 13 18:14:20 2019	(r347537)
+++ head/sys/amd64/linux/linux.h	Mon May 13 18:24:29 2019	(r347538)
@@ -37,15 +37,6 @@
 
 #define	LINUX_LEGACY_SYSCALLS
 
-/*
- * debugging support
- */
-extern u_char linux_debug_map[];
-#define	ldebug(name)	isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
-#define	ARGS(nm, fmt)	"linux(%ld/%ld): "#nm"("fmt")\n",			\
-			(long)td->td_proc->p_pid, (long)td->td_tid
-#define	LMSG(fmt)	"linux(%ld/%ld): "fmt"\n",				\
-			(long)td->td_proc->p_pid, (long)td->td_tid
 #define	LINUX_DTRACE	linuxulator
 
 #define	PTRIN(v)	(void *)(v)

Modified: head/sys/amd64/linux/linux_sysvec.c
==============================================================================
--- head/sys/amd64/linux/linux_sysvec.c	Mon May 13 18:14:20 2019	(r347537)
+++ head/sys/amd64/linux/linux_sysvec.c	Mon May 13 18:24:29 2019	(r347538)
@@ -86,20 +86,6 @@ __FBSDID("$FreeBSD$");
 
 MODULE_VERSION(linux64, 1);
 
-#if defined(DEBUG)
-SYSCTL_PROC(_compat_linux, OID_AUTO, debug,
-	    CTLTYPE_STRING | CTLFLAG_RW,
-	    0, 0, linux_sysctl_debug, "A",
-	    "Linux 64 debugging control");
-#endif
-
-/*
- * Allow the sendsig functions to use the ldebug() facility even though they
- * are not syscalls themselves.  Map them to syscall 0.  This is slightly less
- * bogus than using ldebug(sigreturn).
- */
-#define	LINUX_SYS_linux_rt_sendsig	0
-
 const char *linux_kplatform;
 static int linux_szsigcode;
 static vm_object_t linux_shared_page_obj;
@@ -645,9 +631,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse
 
 	/* Copy the sigframe out to the user's stack. */
 	if (copyout(&sf, sfp, sizeof(*sfp)) != 0) {
-#ifdef DEBUG
-		printf("process %ld has trashed its stack\n", (long)p->p_pid);
-#endif
 		PROC_LOCK(p);
 		sigexit(td, SIGILL);
 	}

Modified: head/sys/amd64/linux32/linux.h
==============================================================================
--- head/sys/amd64/linux32/linux.h	Mon May 13 18:14:20 2019	(r347537)
+++ head/sys/amd64/linux32/linux.h	Mon May 13 18:24:29 2019	(r347538)
@@ -40,15 +40,6 @@
 
 #define	LINUX_LEGACY_SYSCALLS
 
-/*
- * debugging support
- */
-extern u_char linux_debug_map[];
-#define	ldebug(name)	isclr(linux_debug_map, LINUX32_SYS_linux_ ## name)
-#define	ARGS(nm, fmt)	"linux(%ld/%ld): "#nm"("fmt")\n",			\
-			(long)td->td_proc->p_pid, (long)td->td_tid
-#define	LMSG(fmt)	"linux(%ld/%ld): "fmt"\n",				\
-			(long)td->td_proc->p_pid, (long)td->td_tid
 #define	LINUX_DTRACE	linuxulator32
 
 #define	LINUX32_MAXUSER		((1ul << 32) - PAGE_SIZE)

Modified: head/sys/amd64/linux32/linux32_machdep.c
==============================================================================
--- head/sys/amd64/linux32/linux32_machdep.c	Mon May 13 18:14:20 2019	(r347537)
+++ head/sys/amd64/linux32/linux32_machdep.c	Mon May 13 18:24:29 2019	(r347538)
@@ -133,11 +133,6 @@ linux_execve(struct thread *td, struct linux_execve_ar
 
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(execve))
-		printf(ARGS(execve, "%s"), path);
-#endif
-
 	error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE,
 	    args->argp, args->envp);
 	free(path, M_TEMP);
@@ -382,11 +377,6 @@ linux_old_select(struct thread *td, struct linux_old_s
 	struct linux_select_args newsel;
 	int error;
 
-#ifdef DEBUG
-	if (ldebug(old_select))
-		printf(ARGS(old_select, "%p"), args->ptr);
-#endif
-
 	error = copyin(args->ptr, &linux_args, sizeof(linux_args));
 	if (error)
 		return (error);
@@ -410,29 +400,19 @@ linux_set_cloned_tls(struct thread *td, void *desc)
 
 	error = copyin(desc, &info, sizeof(struct l_user_desc));
 	if (error) {
-		printf(LMSG("copyin failed!"));
+		linux_msg(td, "set_cloned_tls copyin info failed!");
 	} else {
+
 		/* We might copy out the entry_number as GUGS32_SEL. */
 		info.entry_number = GUGS32_SEL;
 		error = copyout(&info, desc, sizeof(struct l_user_desc));
 		if (error)
-			printf(LMSG("copyout failed!"));
+			linux_msg(td, "set_cloned_tls copyout info failed!");
 
 		a[0] = LINUX_LDT_entry_a(&info);
 		a[1] = LINUX_LDT_entry_b(&info);
 
 		memcpy(&sd, &a, sizeof(a));
-#ifdef DEBUG
-		if (ldebug(clone))
-			printf("Segment created in clone with "
-			    "CLONE_SETTLS: lobase: %x, hibase: %x, "
-			    "lolimit: %x, hilimit: %x, type: %i, "
-			    "dpl: %i, p: %i, xx: %i, long: %i, "
-			    "def32: %i, gran: %i\n", sd.sd_lobase,
-			    sd.sd_hibase, sd.sd_lolimit, sd.sd_hilimit,
-			    sd.sd_type, sd.sd_dpl, sd.sd_p, sd.sd_xx,
-			    sd.sd_long, sd.sd_def32, sd.sd_gran);
-#endif
 		pcb = td->td_pcb;
 		pcb->pcb_gsbase = (register_t)info.base_addr;
 		td->td_frame->tf_gs = GSEL(GUGS32_SEL, SEL_UPL);
@@ -461,13 +441,6 @@ int
 linux_mmap2(struct thread *td, struct linux_mmap2_args *args)
 {
 
-#ifdef DEBUG
-	if (ldebug(mmap2))
-		printf(ARGS(mmap2, "0x%08x, %d, %d, 0x%08x, %d, %d"),
-		    args->addr, args->len, args->prot,
-		    args->flags, args->fd, args->pgoff);
-#endif
-
 	return (linux_mmap_common(td, PTROUT(args->addr), args->len, args->prot,
 		args->flags, args->fd, (uint64_t)(uint32_t)args->pgoff *
 		PAGE_SIZE));
@@ -483,13 +456,6 @@ linux_mmap(struct thread *td, struct linux_mmap_args *
 	if (error)
 		return (error);
 
-#ifdef DEBUG
-	if (ldebug(mmap))
-		printf(ARGS(mmap, "0x%08x, %d, %d, 0x%08x, %d, %d"),
-		    linux_args.addr, linux_args.len, linux_args.prot,
-		    linux_args.flags, linux_args.fd, linux_args.pgoff);
-#endif
-
 	return (linux_mmap_common(td, linux_args.addr, linux_args.len,
 	    linux_args.prot, linux_args.flags, linux_args.fd,
 	    (uint32_t)linux_args.pgoff));
@@ -526,12 +492,6 @@ linux_sigaction(struct thread *td, struct linux_sigact
 	l_sigaction_t act, oact;
 	int error;
 
-#ifdef DEBUG
-	if (ldebug(sigaction))
-		printf(ARGS(sigaction, "%d, %p, %p"),
-		    args->sig, (void *)args->nsa, (void *)args->osa);
-#endif
-
 	if (args->nsa != NULL) {
 		error = copyin(args->nsa, &osa, sizeof(l_osigaction_t));
 		if (error)
@@ -568,11 +528,6 @@ linux_sigsuspend(struct thread *td, struct linux_sigsu
 	sigset_t sigmask;
 	l_sigset_t mask;
 
-#ifdef DEBUG
-	if (ldebug(sigsuspend))
-		printf(ARGS(sigsuspend, "%08lx"), (unsigned long)args->mask);
-#endif
-
 	LINUX_SIGEMPTYSET(mask);
 	mask.__mask = args->mask;
 	linux_to_bsd_sigset(&mask, &sigmask);
@@ -586,12 +541,6 @@ linux_rt_sigsuspend(struct thread *td, struct linux_rt
 	sigset_t sigmask;
 	int error;
 
-#ifdef DEBUG
-	if (ldebug(rt_sigsuspend))
-		printf(ARGS(rt_sigsuspend, "%p, %d"),
-		    (void *)uap->newset, uap->sigsetsize);
-#endif
-
 	if (uap->sigsetsize != sizeof(l_sigset_t))
 		return (EINVAL);
 
@@ -609,11 +558,6 @@ linux_pause(struct thread *td, struct linux_pause_args
 	struct proc *p = td->td_proc;
 	sigset_t sigmask;
 
-#ifdef DEBUG
-	if (ldebug(pause))
-		printf(ARGS(pause, ""));
-#endif
-
 	PROC_LOCK(p);
 	sigmask = td->td_sigmask;
 	PROC_UNLOCK(p);
@@ -627,11 +571,6 @@ linux_sigaltstack(struct thread *td, struct linux_siga
 	l_stack_t lss;
 	int error;
 
-#ifdef DEBUG
-	if (ldebug(sigaltstack))
-		printf(ARGS(sigaltstack, "%p, %p"), uap->uss, uap->uoss);
-#endif
-
 	if (uap->uss != NULL) {
 		error = copyin(uap->uss, &lss, sizeof(l_stack_t));
 		if (error)
@@ -657,12 +596,6 @@ int
 linux_ftruncate64(struct thread *td, struct linux_ftruncate64_args *args)
 {
 
-#ifdef DEBUG
-	if (ldebug(ftruncate64))
-		printf(ARGS(ftruncate64, "%u, %jd"), args->fd,
-		    (intmax_t)args->length);
-#endif
-
 	return (kern_ftruncate(td, args->fd, args->length));
 }
 
@@ -743,15 +676,6 @@ linux_set_thread_area(struct thread *td,
 	if (error)
 		return (error);
 
-#ifdef DEBUG
-	if (ldebug(set_thread_area))
-		printf(ARGS(set_thread_area, "%i, %x, %x, %i, %i, %i, "
-		    "%i, %i, %i"), info.entry_number, info.base_addr,
-		    info.limit, info.seg_32bit, info.contents,
-		    info.read_exec_only, info.limit_in_pages,
-		    info.seg_not_present, info.useable);
-#endif
-
 	/*
 	 * Semantics of Linux version: every thread in the system has array
 	 * of three TLS descriptors. 1st is GLIBC TLS, 2nd is WINE, 3rd unknown.
@@ -805,25 +729,6 @@ linux_set_thread_area(struct thread *td,
 	}
 
 	memcpy(&sd, &a, sizeof(a));
-#ifdef DEBUG
-	if (ldebug(set_thread_area))
-		printf("Segment created in set_thread_area: "
-		    "lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, "
-		    "type: %i, dpl: %i, p: %i, xx: %i, long: %i, "
-		    "def32: %i, gran: %i\n",
-		    sd.sd_lobase,
-		    sd.sd_hibase,
-		    sd.sd_lolimit,
-		    sd.sd_hilimit,
-		    sd.sd_type,
-		    sd.sd_dpl,
-		    sd.sd_p,
-		    sd.sd_xx,
-		    sd.sd_long,
-		    sd.sd_def32,
-		    sd.sd_gran);
-#endif
-
 	pcb = td->td_pcb;
 	pcb->pcb_gsbase = (register_t)info.base_addr;
 	set_pcb_flags(pcb, PCB_32BIT);

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- head/sys/amd64/linux32/linux32_sysvec.c	Mon May 13 18:14:20 2019	(r347537)
+++ head/sys/amd64/linux32/linux32_sysvec.c	Mon May 13 18:24:29 2019	(r347538)
@@ -91,14 +91,6 @@ __FBSDID("$FreeBSD$");
 
 MODULE_VERSION(linux, 1);
 
-/*
- * Allow the sendsig functions to use the ldebug() facility even though they
- * are not syscalls themselves.  Map them to syscall 0.  This is slightly less
- * bogus than using ldebug(sigreturn).
- */
-#define	LINUX32_SYS_linux_rt_sendsig	0
-#define	LINUX32_SYS_linux_sendsig	0
-
 const char *linux_kplatform;
 static int linux_szsigcode;
 static vm_object_t linux_shared_page_obj;
@@ -286,11 +278,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse
 	regs = td->td_frame;
 	oonstack = sigonstack(regs->tf_rsp);
 
-#ifdef DEBUG
-	if (ldebug(rt_sendsig))
-		printf(ARGS(rt_sendsig, "%p, %d, %p, %u"),
-		    catcher, sig, (void*)mask, code);
-#endif
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) && !oonstack &&
 	    SIGISMEMBER(psp->ps_sigonstack, sig)) {
@@ -349,23 +336,11 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse
 	frame.sf_sc.uc_mcontext.sc_cr2    = (u_int32_t)(uintptr_t)ksi->ksi_addr;
 	frame.sf_sc.uc_mcontext.sc_trapno = bsd_to_linux_trapcode(code);
 
-#ifdef DEBUG
-	if (ldebug(rt_sendsig))
-		printf(LMSG("rt_sendsig flags: 0x%x, sp: %p, ss: 0x%lx, mask: 0x%x"),
-		    frame.sf_sc.uc_stack.ss_flags, td->td_sigstk.ss_sp,
-		    td->td_sigstk.ss_size, frame.sf_sc.uc_mcontext.sc_mask);
-#endif
-
 	if (copyout(&frame, fp, sizeof(frame)) != 0) {
 		/*
 		 * Process has trashed its stack; give it an illegal
 		 * instruction to halt it in its tracks.
 		 */
-#ifdef DEBUG
-		if (ldebug(rt_sendsig))
-			printf(LMSG("rt_sendsig: bad stack %p, oonstack=%x"),
-			    fp, oonstack);
-#endif
 		PROC_LOCK(p);
 		sigexit(td, SIGILL);
 	}
@@ -423,12 +398,6 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t
 	regs = td->td_frame;
 	oonstack = sigonstack(regs->tf_rsp);
 
-#ifdef DEBUG
-	if (ldebug(sendsig))
-		printf(ARGS(sendsig, "%p, %d, %p, %u"),
-		    catcher, sig, (void*)mask, code);
-#endif
-
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) && !oonstack &&
 	    SIGISMEMBER(psp->ps_sigonstack, sig)) {
@@ -521,10 +490,6 @@ linux_sigreturn(struct thread *td, struct linux_sigret
 
 	regs = td->td_frame;
 
-#ifdef DEBUG
-	if (ldebug(sigreturn))
-		printf(ARGS(sigreturn, "%p"), (void *)args->sfp);
-#endif
 	/*
 	 * The trampoline code hands us the sigframe.
 	 * It is unsafe to keep track of it ourselves, in the event that a
@@ -606,10 +571,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_
 
 	regs = td->td_frame;
 
-#ifdef DEBUG
-	if (ldebug(rt_sigreturn))
-		printf(ARGS(rt_sigreturn, "%p"), (void *)args->ucp);
-#endif
 	/*
 	 * The trampoline code hands us the ucontext.
 	 * It is unsafe to keep track of it ourselves, in the event that a
@@ -674,11 +635,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_
 	ss.ss_size = lss->ss_size;
 	ss.ss_flags = linux_to_bsd_sigaltstack(lss->ss_flags);
 
-#ifdef DEBUG
-	if (ldebug(rt_sigreturn))
-		printf(LMSG("rt_sigret flags: 0x%x, sp: %p, ss: 0x%lx, mask: 0x%x"),
-		    ss.ss_flags, ss.ss_sp, ss.ss_size, context->sc_mask);
-#endif
 	(void)kern_sigaltstack(td, &ss, NULL);
 
 	return (EJUSTRETURN);
@@ -868,11 +824,6 @@ SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxssiz, CTLFL
 static u_long	linux32_maxvmem = LINUX32_MAXVMEM;
 SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxvmem, CTLFLAG_RW,
     &linux32_maxvmem, 0, "");
-
-#if defined(DEBUG)
-SYSCTL_PROC(_compat_linux32, OID_AUTO, debug, CTLTYPE_STRING | CTLFLAG_RW, 0, 0,
-    linux_sysctl_debug, "A", "Linux debugging control");
-#endif
 
 static void
 linux32_fixlimit(struct rlimit *rl, int which)

Modified: head/sys/arm64/linux/linux.h
==============================================================================
--- head/sys/arm64/linux/linux.h	Mon May 13 18:14:20 2019	(r347537)
+++ head/sys/arm64/linux/linux.h	Mon May 13 18:24:29 2019	(r347538)
@@ -34,14 +34,6 @@
 #include <compat/linux/linux.h>
 #include <arm64/linux/linux_syscall.h>
 
-/* Debugging support */
-#define DEBUG
-extern u_char linux_debug_map[];
-#define	ldebug(name)	isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
-#define	ARGS(nm, fmt)	"linux(%ld/%ld): "#nm"("fmt")\n",			\
-			(long)td->td_proc->p_pid, (long)td->td_tid
-#define	LMSG(fmt)	"linux(%ld/%ld): "fmt"\n",				\
-			(long)td->td_proc->p_pid, (long)td->td_tid
 #define	LINUX_DTRACE	linuxulator
 
 #define	PTRIN(v)	(void *)(v)

Modified: head/sys/arm64/linux/linux_sysvec.c
==============================================================================
--- head/sys/arm64/linux/linux_sysvec.c	Mon May 13 18:14:20 2019	(r347537)
+++ head/sys/arm64/linux/linux_sysvec.c	Mon May 13 18:24:29 2019	(r347538)
@@ -59,11 +59,6 @@ __FBSDID("$FreeBSD$");
 
 MODULE_VERSION(linux64elf, 1);
 
-#if defined(DEBUG)
-SYSCTL_PROC(_compat_linux, OID_AUTO, debug, CTLTYPE_STRING | CTLFLAG_RW, 0, 0,
-    linux_sysctl_debug, "A", "64-bit Linux debugging control");
-#endif
-
 const char *linux_kplatform;
 static int linux_szsigcode;
 static vm_object_t linux_shared_page_obj;

Modified: head/sys/compat/linux/linux_file.c
==============================================================================
--- head/sys/compat/linux/linux_file.c	Mon May 13 18:14:20 2019	(r347537)
+++ head/sys/compat/linux/linux_file.c	Mon May 13 18:24:29 2019	(r347538)
@@ -76,10 +76,7 @@ linux_creat(struct thread *td, struct linux_creat_args
 	int error;
 
 	LCONVPATHEXIST(td, args->path, &path);
-#ifdef DEBUG
-	if (ldebug(creat))
-		printf(ARGS(creat, "%s, %d"), path, args->mode);
-#endif
+
 	error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE,
 	    O_WRONLY | O_CREAT | O_TRUNC, args->mode);
 	LFREEPATH(path);
@@ -165,14 +162,6 @@ linux_common_open(struct thread *td, int dirfd, char *
 	}
 
 done:
-#ifdef DEBUG
-#ifdef LINUX_LEGACY_SYSCALLS
-	if (ldebug(open))
-#else
-	if (ldebug(openat))
-#endif
-		printf(LMSG("open returns error %d"), error);
-#endif
 	LFREEPATH(path);
 	return (error);
 }
@@ -188,11 +177,7 @@ linux_openat(struct thread *td, struct linux_openat_ar
 		LCONVPATH_AT(td, args->filename, &path, 1, dfd);
 	else
 		LCONVPATH_AT(td, args->filename, &path, 0, dfd);
-#ifdef DEBUG
-	if (ldebug(openat))
-		printf(ARGS(openat, "%i, %s, 0x%x, 0x%x"), args->dfd,
-		    path, args->flags, args->mode);
-#endif
+
 	return (linux_common_open(td, dfd, path, args->flags, args->mode));
 }
 
@@ -206,11 +191,7 @@ linux_open(struct thread *td, struct linux_open_args *
 		LCONVPATHCREAT(td, args->path, &path);
 	else
 		LCONVPATHEXIST(td, args->path, &path);
-#ifdef DEBUG
-	if (ldebug(open))
-		printf(ARGS(open, "%s, 0x%x, 0x%x"),
-		    path, args->flags, args->mode);
-#endif
+
 	return (linux_common_open(td, AT_FDCWD, path, args->flags, args->mode));
 }
 #endif
@@ -219,11 +200,6 @@ int
 linux_lseek(struct thread *td, struct linux_lseek_args *args)
 {
 
-#ifdef DEBUG
-	if (ldebug(lseek))
-		printf(ARGS(lseek, "%d, %ld, %d"),
-		    args->fdes, (long)args->off, args->whence);
-#endif
 	return (kern_lseek(td, args->fdes, args->off, args->whence));
 }
 
@@ -234,11 +210,6 @@ linux_llseek(struct thread *td, struct linux_llseek_ar
 	int error;
 	off_t off;
 
-#ifdef DEBUG
-	if (ldebug(llseek))
-		printf(ARGS(llseek, "%d, %d:%d, %d"),
-		    args->fd, args->ohigh, args->olow, args->whence);
-#endif
 	off = (args->olow) | (((off_t) args->ohigh) << 32);
 
 	error = kern_lseek(td, args->fd, off, args->whence);
@@ -327,10 +298,6 @@ linux_getdents(struct thread *td, struct linux_getdent
 	int buflen, error;
 	size_t retval;
 
-#ifdef DEBUG
-	if (ldebug(getdents))
-		printf(ARGS(getdents, "%d, *, %d"), args->fd, args->count);
-#endif
 	buflen = min(args->count, MAXBSIZE);
 	buf = malloc(buflen, M_TEMP, M_WAITOK);
 
@@ -408,10 +375,6 @@ linux_getdents64(struct thread *td, struct linux_getde
 	int buflen, error;
 	size_t retval;
 
-#ifdef DEBUG
-	if (ldebug(getdents64))
-		uprintf(ARGS(getdents64, "%d, *, %d"), args->fd, args->count);
-#endif
 	buflen = min(args->count, MAXBSIZE);
 	buf = malloc(buflen, M_TEMP, M_WAITOK);
 
@@ -483,10 +446,6 @@ linux_readdir(struct thread *td, struct linux_readdir_
 	struct l_dirent *linux_dirent;
 	int buflen, error;
 
-#ifdef DEBUG
-	if (ldebug(readdir))
-		printf(ARGS(readdir, "%d, *"), args->fd);
-#endif
 	buflen = LINUX_RECLEN(LINUX_NAME_MAX);
 	buf = malloc(buflen, M_TEMP, M_WAITOK);
 
@@ -539,10 +498,6 @@ linux_access(struct thread *td, struct linux_access_ar
 
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(access))
-		printf(ARGS(access, "%s, %d"), path, args->amode);
-#endif
 	error = kern_accessat(td, AT_FDCWD, path, UIO_SYSSPACE, 0,
 	    args->amode);
 	LFREEPATH(path);
@@ -564,11 +519,6 @@ linux_faccessat(struct thread *td, struct linux_facces
 	dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
 	LCONVPATHEXIST_AT(td, args->filename, &path, dfd);
 
-#ifdef DEBUG
-	if (ldebug(faccessat))
-		printf(ARGS(access, "%s, %d"), path, args->amode);
-#endif
-
 	error = kern_accessat(td, dfd, path, UIO_SYSSPACE, 0, args->amode);
 	LFREEPATH(path);
 
@@ -585,11 +535,6 @@ linux_unlink(struct thread *td, struct linux_unlink_ar
 
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(unlink))
-		printf(ARGS(unlink, "%s"), path);
-#endif
-
 	error = kern_funlinkat(td, AT_FDCWD, path, FD_NONE, UIO_SYSSPACE, 0, 0);
 	if (error == EPERM) {
 		/* Introduce POSIX noncompliant behaviour of Linux */
@@ -617,11 +562,6 @@ linux_unlinkat(struct thread *td, struct linux_unlinka
 	dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
 	LCONVPATHEXIST_AT(td, args->pathname, &path, dfd);
 
-#ifdef DEBUG
-	if (ldebug(unlinkat))
-		printf(ARGS(unlinkat, "%s"), path);
-#endif
-
 	if (args->flag & LINUX_AT_REMOVEDIR)
 		error = kern_frmdirat(td, dfd, path, FD_NONE, UIO_SYSSPACE, 0);
 	else
@@ -644,10 +584,6 @@ linux_chdir(struct thread *td, struct linux_chdir_args
 
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(chdir))
-		printf(ARGS(chdir, "%s"), path);
-#endif
 	error = kern_chdir(td, path, UIO_SYSSPACE);
 	LFREEPATH(path);
 	return (error);
@@ -662,10 +598,6 @@ linux_chmod(struct thread *td, struct linux_chmod_args
 
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(chmod))
-		printf(ARGS(chmod, "%s, %d"), path, args->mode);
-#endif
 	error = kern_fchmodat(td, AT_FDCWD, path, UIO_SYSSPACE,
 	    args->mode, 0);
 	LFREEPATH(path);
@@ -682,11 +614,6 @@ linux_fchmodat(struct thread *td, struct linux_fchmoda
 	dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
 	LCONVPATHEXIST_AT(td, args->filename, &path, dfd);
 
-#ifdef DEBUG
-	if (ldebug(fchmodat))
-		printf(ARGS(fchmodat, "%s, %d"), path, args->mode);
-#endif
-
 	error = kern_fchmodat(td, dfd, path, UIO_SYSSPACE, args->mode, 0);
 	LFREEPATH(path);
 	return (error);
@@ -701,10 +628,6 @@ linux_mkdir(struct thread *td, struct linux_mkdir_args
 
 	LCONVPATHCREAT(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(mkdir))
-		printf(ARGS(mkdir, "%s, %d"), path, args->mode);
-#endif
 	error = kern_mkdirat(td, AT_FDCWD, path, UIO_SYSSPACE, args->mode);
 	LFREEPATH(path);
 	return (error);
@@ -720,10 +643,6 @@ linux_mkdirat(struct thread *td, struct linux_mkdirat_
 	dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
 	LCONVPATHCREAT_AT(td, args->pathname, &path, dfd);
 
-#ifdef DEBUG
-	if (ldebug(mkdirat))
-		printf(ARGS(mkdirat, "%s, %d"), path, args->mode);
-#endif
 	error = kern_mkdirat(td, dfd, path, UIO_SYSSPACE, args->mode);
 	LFREEPATH(path);
 	return (error);
@@ -738,10 +657,6 @@ linux_rmdir(struct thread *td, struct linux_rmdir_args
 
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(rmdir))
-		printf(ARGS(rmdir, "%s"), path);
-#endif
 	error = kern_frmdirat(td, AT_FDCWD, path, FD_NONE, UIO_SYSSPACE, 0);
 	LFREEPATH(path);
 	return (error);
@@ -761,10 +676,6 @@ linux_rename(struct thread *td, struct linux_rename_ar
 		return (error);
 	}
 
-#ifdef DEBUG
-	if (ldebug(rename))
-		printf(ARGS(rename, "%s, %s"), from, to);
-#endif
 	error = kern_renameat(td, AT_FDCWD, from, AT_FDCWD, to, UIO_SYSSPACE);
 	LFREEPATH(from);
 	LFREEPATH(to);
@@ -788,10 +699,6 @@ linux_renameat(struct thread *td, struct linux_renamea
 		return (error);
 	}
 
-#ifdef DEBUG
-	if (ldebug(renameat))
-		printf(ARGS(renameat, "%s, %s"), from, to);
-#endif
 	error = kern_renameat(td, olddfd, from, newdfd, to, UIO_SYSSPACE);
 	LFREEPATH(from);
 	LFREEPATH(to);
@@ -813,10 +720,6 @@ linux_symlink(struct thread *td, struct linux_symlink_
 		return (error);
 	}
 
-#ifdef DEBUG
-	if (ldebug(symlink))
-		printf(ARGS(symlink, "%s, %s"), path, to);
-#endif
 	error = kern_symlinkat(td, path, AT_FDCWD, to, UIO_SYSSPACE);
 	LFREEPATH(path);
 	LFREEPATH(to);
@@ -839,11 +742,6 @@ linux_symlinkat(struct thread *td, struct linux_symlin
 		return (error);
 	}
 
-#ifdef DEBUG
-	if (ldebug(symlinkat))
-		printf(ARGS(symlinkat, "%s, %s"), path, to);
-#endif
-
 	error = kern_symlinkat(td, path, dfd, to, UIO_SYSSPACE);
 	LFREEPATH(path);
 	LFREEPATH(to);
@@ -859,11 +757,6 @@ linux_readlink(struct thread *td, struct linux_readlin
 
 	LCONVPATHEXIST(td, args->name, &name);
 
-#ifdef DEBUG
-	if (ldebug(readlink))
-		printf(ARGS(readlink, "%s, %p, %d"), name, (void *)args->buf,
-		    args->count);
-#endif
 	error = kern_readlinkat(td, AT_FDCWD, name, UIO_SYSSPACE,
 	    args->buf, UIO_USERSPACE, args->count);
 	LFREEPATH(name);
@@ -880,12 +773,6 @@ linux_readlinkat(struct thread *td, struct linux_readl
 	dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
 	LCONVPATHEXIST_AT(td, args->path, &name, dfd);
 
-#ifdef DEBUG
-	if (ldebug(readlinkat))
-		printf(ARGS(readlinkat, "%s, %p, %d"), name, (void *)args->buf,
-		    args->bufsiz);
-#endif
-
 	error = kern_readlinkat(td, dfd, name, UIO_SYSSPACE, args->buf,
 	    UIO_USERSPACE, args->bufsiz);
 	LFREEPATH(name);
@@ -900,11 +787,6 @@ linux_truncate(struct thread *td, struct linux_truncat
 
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(truncate))
-		printf(ARGS(truncate, "%s, %ld"), path, (long)args->length);
-#endif
-
 	error = kern_truncate(td, path, UIO_SYSSPACE, args->length);
 	LFREEPATH(path);
 	return (error);
@@ -919,11 +801,6 @@ linux_truncate64(struct thread *td, struct linux_trunc
 
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(truncate64))
-		printf(ARGS(truncate64, "%s, %jd"), path, args->length);
-#endif
-
 	error = kern_truncate(td, path, UIO_SYSSPACE, args->length);
 	LFREEPATH(path);
 	return (error);
@@ -952,10 +829,6 @@ linux_link(struct thread *td, struct linux_link_args *
 		return (error);
 	}
 
-#ifdef DEBUG
-	if (ldebug(link))
-		printf(ARGS(link, "%s, %s"), path, to);
-#endif
 	error = kern_linkat(td, AT_FDCWD, AT_FDCWD, path, to, UIO_SYSSPACE,
 	    FOLLOW);
 	LFREEPATH(path);
@@ -983,12 +856,6 @@ linux_linkat(struct thread *td, struct linux_linkat_ar
 		return (error);
 	}
 
-#ifdef DEBUG
-	if (ldebug(linkat))
-		printf(ARGS(linkat, "%i, %s, %i, %s, %i"), args->olddfd, path,
-			args->newdfd, to, args->flag);
-#endif
-
 	follow = (args->flag & LINUX_AT_SYMLINK_FOLLOW) == 0 ? NOFOLLOW :
 	    FOLLOW;
 	error = kern_linkat(td, olddfd, newdfd, path, to, UIO_SYSSPACE, follow);
@@ -1110,12 +977,6 @@ linux_mount(struct thread *td, struct linux_mount_args
 	if (error != 0)
 		goto out;
 
-#ifdef DEBUG
-	if (ldebug(mount))
-		printf(ARGS(mount, "%s, %s, %s"),
-		    fstypename, mntfromname, mntonname);
-#endif
-
 	if (strcmp(fstypename, "ext2") == 0) {
 		strcpy(fstypename, "ext2fs");
 	} else if (strcmp(fstypename, "proc") == 0) {
@@ -1424,11 +1285,6 @@ int
 linux_fcntl(struct thread *td, struct linux_fcntl_args *args)
 {
 
-#ifdef DEBUG
-	if (ldebug(fcntl))
-		printf(ARGS(fcntl, "%d, %08x, *"), args->fd, args->cmd);
-#endif
-
 	return (fcntl_common(td, args));
 }
 
@@ -1441,11 +1297,6 @@ linux_fcntl64(struct thread *td, struct linux_fcntl64_
 	struct linux_fcntl_args fcntl_args;
 	int error;
 
-#ifdef DEBUG
-	if (ldebug(fcntl64))
-		printf(ARGS(fcntl64, "%d, %08x, *"), args->fd, args->cmd);
-#endif
-
 	switch (args->cmd) {
 	case LINUX_F_GETLK64:
 		error = copyin((void *)args->arg, &linux_flock,
@@ -1495,10 +1346,6 @@ linux_chown(struct thread *td, struct linux_chown_args
 
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(chown))
-		printf(ARGS(chown, "%s, %d, %d"), path, args->uid, args->gid);
-#endif
 	error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, args->uid,
 	    args->gid, 0);
 	LFREEPATH(path);
@@ -1518,11 +1365,6 @@ linux_fchownat(struct thread *td, struct linux_fchowna
 	dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD :  args->dfd;
 	LCONVPATHEXIST_AT(td, args->filename, &path, dfd);
 
-#ifdef DEBUG
-	if (ldebug(fchownat))
-		printf(ARGS(fchownat, "%s, %d, %d"), path, args->uid, args->gid);
-#endif
-
 	flag = (args->flag & LINUX_AT_SYMLINK_NOFOLLOW) == 0 ? 0 :
 	    AT_SYMLINK_NOFOLLOW;
 	error = kern_fchownat(td, dfd, path, UIO_SYSSPACE, args->uid, args->gid,
@@ -1540,10 +1382,6 @@ linux_lchown(struct thread *td, struct linux_lchown_ar
 
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(lchown))
-		printf(ARGS(lchown, "%s, %d, %d"), path, args->uid, args->gid);
-#endif
 	error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, args->uid,
 	    args->gid, AT_SYMLINK_NOFOLLOW);
 	LFREEPATH(path);
@@ -1605,11 +1443,6 @@ linux_pipe(struct thread *td, struct linux_pipe_args *
 	int fildes[2];
 	int error;
 
-#ifdef DEBUG
-	if (ldebug(pipe))
-		printf(ARGS(pipe, "*"));
-#endif
-
 	error = kern_pipe(td, fildes, 0, NULL, NULL);
 	if (error != 0)
 		return (error);
@@ -1629,11 +1462,6 @@ linux_pipe2(struct thread *td, struct linux_pipe2_args
 {
 	int fildes[2];
 	int error, flags;
-
-#ifdef DEBUG
-	if (ldebug(pipe2))
-		printf(ARGS(pipe2, "*, %d"), args->flags);
-#endif
 
 	if ((args->flags & ~(LINUX_O_NONBLOCK | LINUX_O_CLOEXEC)) != 0)
 		return (EINVAL);

Modified: head/sys/compat/linux/linux_fork.c
==============================================================================
--- head/sys/compat/linux/linux_fork.c	Mon May 13 18:14:20 2019	(r347537)
+++ head/sys/compat/linux/linux_fork.c	Mon May 13 18:24:29 2019	(r347538)
@@ -74,11 +74,6 @@ linux_fork(struct thread *td, struct linux_fork_args *
 	struct proc *p2;
 	struct thread *td2;
 
-#ifdef DEBUG
-	if (ldebug(fork))
-		printf(ARGS(fork, ""));
-#endif
-
 	bzero(&fr, sizeof(fr));
 	fr.fr_flags = RFFDG | RFPROC | RFSTOPPED;
 	fr.fr_procp = &p2;
@@ -110,11 +105,6 @@ linux_vfork(struct thread *td, struct linux_vfork_args
 	struct proc *p2;
 	struct thread *td2;
 
-#ifdef DEBUG
-	if (ldebug(vfork))
-		printf(ARGS(vfork, ""));
-#endif
-
 	bzero(&fr, sizeof(fr));
 	fr.fr_flags = RFFDG | RFPROC | RFMEM | RFPPWAIT | RFSTOPPED;
 	fr.fr_procp = &p2;
@@ -149,14 +139,6 @@ linux_clone_proc(struct thread *td, struct linux_clone
 	int exit_signal;
 	struct linux_emuldata *em;
 
-#ifdef DEBUG
-	if (ldebug(clone)) {
-		printf(ARGS(clone, "flags %x, stack %p, parent tid: %p, "
-		    "child tid: %p"), (unsigned)args->flags,
-		    args->stack, args->parent_tidptr, args->child_tidptr);
-	}
-#endif
-
 	exit_signal = args->flags & 0x000000ff;
 	if (LINUX_SIG_VALID(exit_signal)) {
 		exit_signal = linux_to_bsd_signal(exit_signal);
@@ -212,7 +194,7 @@ linux_clone_proc(struct thread *td, struct linux_clone
 		error = copyout(&p2->p_pid, args->parent_tidptr,
 		    sizeof(p2->p_pid));
 		if (error)
-			printf(LMSG("copyout failed!"));
+			linux_msg(td, "copyout p_pid failed!");
 	}
 
 	PROC_LOCK(p2);
@@ -240,13 +222,6 @@ linux_clone_proc(struct thread *td, struct linux_clone
 		sx_xunlock(&proctree_lock);
 	}
 
-#ifdef DEBUG
-	if (ldebug(clone))
-		printf(LMSG("clone: successful rfork to %d, "
-		    "stack %p sig = %d"), (int)p2->p_pid, args->stack,
-		    exit_signal);
-#endif
-
 	/*
 	 * Make this runnable after we are finished with it.
 	 */
@@ -268,14 +243,6 @@ linux_clone_thread(struct thread *td, struct linux_clo
 	struct proc *p;
 	int error;
 
-#ifdef DEBUG
-	if (ldebug(clone)) {
-		printf(ARGS(clone, "thread: flags %x, stack %p, parent tid: %p, "
-		    "child tid: %p"), (unsigned)args->flags,
-		    args->stack, args->parent_tidptr, args->child_tidptr);
-	}
-#endif
-
 	LINUX_CTR4(clone_thread, "thread(%d) flags %x ptid %p ctid %p",
 	    td->td_tid, (unsigned)args->flags,
 	    args->parent_tidptr, args->child_tidptr);
@@ -360,12 +327,6 @@ linux_clone_thread(struct thread *td, struct linux_clo
 
 	tidhash_add(newtd);
 
-#ifdef DEBUG
-	if (ldebug(clone))
-		printf(ARGS(clone, "successful clone to %d, stack %p"),
-		(int)newtd->td_tid, args->stack);
-#endif
-
 	LINUX_CTR2(clone_thread, "thread(%d) successful clone to %d",
 	    td->td_tid, newtd->td_tid);
 
@@ -373,7 +334,7 @@ linux_clone_thread(struct thread *td, struct linux_clo
 		error = copyout(&newtd->td_tid, args->parent_tidptr,
 		    sizeof(newtd->td_tid));
 		if (error)
-			printf(LMSG("clone_thread: copyout failed!"));
+			linux_msg(td, "clone_thread: copyout td_tid failed!");
 	}
 
 	/*

Modified: head/sys/compat/linux/linux_getcwd.c
==============================================================================
--- head/sys/compat/linux/linux_getcwd.c	Mon May 13 18:14:20 2019	(r347537)
+++ head/sys/compat/linux/linux_getcwd.c	Mon May 13 18:24:29 2019	(r347538)
@@ -65,11 +65,6 @@ linux_getcwd(struct thread *td, struct linux_getcwd_ar
 	char *path;
 	int error, lenused;
 
-#ifdef DEBUG
-	if (ldebug(getcwd))
-		printf(ARGS(getcwd, "%p, %ld"), args->buf, (long)args->bufsize);
-#endif
-
 	/*
 	 * Linux returns ERANGE instead of EINVAL.
 	 */

Modified: head/sys/compat/linux/linux_ioctl.c
==============================================================================
--- head/sys/compat/linux/linux_ioctl.c	Mon May 13 18:14:20 2019	(r347537)
+++ head/sys/compat/linux/linux_ioctl.c	Mon May 13 18:24:29 2019	(r347538)
@@ -238,12 +238,7 @@ linux_ioctl_hdio(struct thread *td, struct linux_ioctl
 		 */
 		bytespercyl = (off_t) sectorsize * fwheads * fwsectors;
 		fwcylinders = mediasize / bytespercyl;
-#if defined(DEBUG)
-		linux_msg(td, "HDIO_GET_GEO: mediasize %jd, c/h/s %d/%d/%d, "
-			  "bpc %jd",
-			  (intmax_t)mediasize, fwcylinders, fwheads, fwsectors,
-			  (intmax_t)bytespercyl);
-#endif
+
 		if ((args->cmd & 0xffff) == LINUX_HDIO_GET_GEO) {
 			struct linux_hd_geometry hdg;
 
@@ -404,19 +399,6 @@ bsd_to_linux_termios(struct termios *bios, struct linu
 {
 	int i;
 
-#ifdef DEBUG
-	if (ldebug(ioctl)) {
-		printf("LINUX: BSD termios structure (input):\n");
-		printf("i=%08x o=%08x c=%08x l=%08x ispeed=%d ospeed=%d\n",
-		    bios->c_iflag, bios->c_oflag, bios->c_cflag, bios->c_lflag,
-		    bios->c_ispeed, bios->c_ospeed);
-		printf("c_cc ");
-		for (i=0; i<NCCS; i++)
-			printf("%02x ", bios->c_cc[i]);
-		printf("\n");

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list