1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

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
This commit is contained in:
Dmitry Chagin 2019-05-13 18:24:29 +00:00
parent caaad8736e
commit c5156c7785
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347538
21 changed files with 14 additions and 1176 deletions

View File

@ -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)

View File

@ -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, sigset_t *mask)
/* 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);
}

View File

@ -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)

View File

@ -133,11 +133,6 @@ linux_execve(struct thread *td, struct linux_execve_args *args)
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_select_args *args)
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 *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_sigaction_args *args)
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_sigsuspend_args *args)
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_sigsuspend_args *uap)
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 *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_sigaltstack_args *uap)
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);

View File

@ -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, sigset_t *mask)
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, sigset_t *mask)
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 *mask)
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_sigreturn_args *args)
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_sigreturn_args *args)
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_sigreturn_args *args)
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);
@ -869,11 +825,6 @@ 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)
{

View File

@ -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)

View File

@ -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;

View File

@ -76,10 +76,7 @@ linux_creat(struct thread *td, struct linux_creat_args *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 *path, int l_flags, int mod
}
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_args *args)
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 *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_args *args)
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_getdents_args *args)
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_getdents64_args *args)
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_args *args)
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_args *args)
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_faccessat_args *args)
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_args *args)
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_unlinkat_args *args)
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 *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 *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_fchmodat_args *args)
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 *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_args *args)
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 *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_args *args)
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_renameat_args *args)
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_args *args)
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_symlinkat_args *args)
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_readlink_args *args)
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_readlinkat_args *args)
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_truncate_args *args)
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_truncate64_args *args)
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 *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_args *args)
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 *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_args *args)
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 *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_fchownat_args *args)
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_args *args)
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 *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);
@ -1630,11 +1463,6 @@ linux_pipe2(struct thread *td, struct linux_pipe2_args *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);

View File

@ -74,11 +74,6 @@ linux_fork(struct thread *td, struct linux_fork_args *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 *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_args *args)
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_args *args)
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_args *args)
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_clone_args *args)
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_clone_args *args)
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_clone_args *args)
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!");
}
/*

View File

@ -65,11 +65,6 @@ linux_getcwd(struct thread *td, struct linux_getcwd_args *args)
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.
*/

View File

@ -238,12 +238,7 @@ linux_ioctl_hdio(struct thread *td, struct linux_ioctl_args *args)
*/
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 linux_termios *lios)
{
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");
}
#endif
lios->c_iflag = 0;
if (bios->c_iflag & IGNBRK)
lios->c_iflag |= LINUX_IGNBRK;
@ -525,19 +507,6 @@ bsd_to_linux_termios(struct termios *bios, struct linux_termios *lios)
lios->c_cc[i] = LINUX_POSIX_VDISABLE;
}
lios->c_line = 0;
#ifdef DEBUG
if (ldebug(ioctl)) {
printf("LINUX: LINUX termios structure (output):\n");
printf("i=%08x o=%08x c=%08x l=%08x line=%d\n",
lios->c_iflag, lios->c_oflag, lios->c_cflag,
lios->c_lflag, (int)lios->c_line);
printf("c_cc ");
for (i=0; i<LINUX_NCCS; i++)
printf("%02x ", lios->c_cc[i]);
printf("\n");
}
#endif
}
static void
@ -545,19 +514,6 @@ linux_to_bsd_termios(struct linux_termios *lios, struct termios *bios)
{
int i;
#ifdef DEBUG
if (ldebug(ioctl)) {
printf("LINUX: LINUX termios structure (input):\n");
printf("i=%08x o=%08x c=%08x l=%08x line=%d\n",
lios->c_iflag, lios->c_oflag, lios->c_cflag,
lios->c_lflag, (int)lios->c_line);
printf("c_cc ");
for (i=0; i<LINUX_NCCS; i++)
printf("%02x ", lios->c_cc[i]);
printf("\n");
}
#endif
bios->c_iflag = 0;
if (lios->c_iflag & LINUX_IGNBRK)
bios->c_iflag |= IGNBRK;
@ -667,19 +623,6 @@ linux_to_bsd_termios(struct linux_termios *lios, struct termios *bios)
bios->c_ispeed = bios->c_ospeed =
linux_to_bsd_speed(lios->c_cflag & LINUX_CBAUD, sptab);
#ifdef DEBUG
if (ldebug(ioctl)) {
printf("LINUX: BSD termios structure (output):\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");
}
#endif
}
static void
@ -2367,10 +2310,6 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
case LINUX_SIOCSPGRP:
case LINUX_SIOCGIFCOUNT:
/* these ioctls don't take an interface name */
#ifdef DEBUG
printf("%s(): ioctl %d\n", __func__,
args->cmd & 0xffff);
#endif
break;
case LINUX_SIOCGIFFLAGS:
@ -2392,10 +2331,6 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
error = copyin((void *)args->arg, lifname, LINUX_IFNAMSIZ);
if (error != 0)
return (error);
#ifdef DEBUG
printf("%s(): ioctl %d on %.*s\n", __func__,
args->cmd & 0xffff, LINUX_IFNAMSIZ, lifname);
#endif
memset(ifname, 0, sizeof(ifname));
ifp = ifname_linux_to_bsd(td, lifname, ifname);
if (ifp == NULL)
@ -2409,10 +2344,6 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
error = copyout(ifname, (void *)args->arg, IFNAMSIZ);
if (error != 0)
return (error);
#ifdef DEBUG
printf("%s(): %s translated to %s\n", __func__,
lifname, ifname);
#endif
break;
default:
@ -2555,9 +2486,6 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
/* restore the original interface name */
copyout(lifname, (void *)args->arg, LINUX_IFNAMSIZ);
#ifdef DEBUG
printf("%s(): returning %d\n", __func__, error);
#endif
return (error);
}
@ -3613,12 +3541,6 @@ linux_ioctl(struct thread *td, struct linux_ioctl_args *args)
struct linux_ioctl_handler_element *he;
int error, cmd;
#ifdef DEBUG
if (ldebug(ioctl))
printf(ARGS(ioctl, "%d, %04lx, *"), args->fd,
(unsigned long)args->cmd);
#endif
error = fget(td, args->fd, &cap_ioctl_rights, &fp);
if (error != 0)
return (error);

View File

@ -200,10 +200,6 @@ linux_alarm(struct thread *td, struct linux_alarm_args *args)
u_int secs;
int error;
#ifdef DEBUG
if (ldebug(alarm))
printf(ARGS(alarm, "%u"), args->secs);
#endif
secs = args->secs;
/*
* Linux alarm() is always successful. Limit secs to INT32_MAX / 2
@ -235,10 +231,6 @@ linux_brk(struct thread *td, struct linux_brk_args *args)
struct vmspace *vm = td->td_proc->p_vmspace;
uintptr_t new, old;
#ifdef DEBUG
if (ldebug(brk))
printf(ARGS(brk, "%p"), (void *)(uintptr_t)args->dsend);
#endif
old = (uintptr_t)vm->vm_daddr + ctob(vm->vm_dsize);
new = (uintptr_t)args->dsend;
if ((caddr_t)new > vm->vm_daddr && !kern_break(td, &new))
@ -271,11 +263,6 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
LCONVPATHEXIST(td, args->library, &library);
#ifdef DEBUG
if (ldebug(uselib))
printf(ARGS(uselib, "%s"), library);
#endif
a_out = NULL;
vp = NULL;
locked = false;
@ -416,9 +403,6 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
* (what a waste).
*/
if (file_offset & PAGE_MASK) {
#ifdef DEBUG
printf("uselib: Non page aligned binary %lu\n", file_offset);
#endif
/* Map text+data read/write/execute */
/* a_entry is the load address and is page aligned */
@ -441,9 +425,6 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
goto cleanup;
}
} else {
#ifdef DEBUG
printf("uselib: Page aligned binary %lu\n", file_offset);
#endif
/*
* for QMAGIC, a_entry is 20 bytes beyond the load address
* to skip the executable header
@ -470,10 +451,7 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
vm_map_unlock(map);
textset = false;
}
#ifdef DEBUG
printf("mem=%08lx = %08lx %08lx\n", (long)vmaddr, ((long *)vmaddr)[0],
((long *)vmaddr)[1]);
#endif
if (bss_size != 0) {
/* Calculate BSS start address */
vmaddr = trunc_page(a_out->a_entry) + a_out->a_text +
@ -516,13 +494,6 @@ linux_select(struct thread *td, struct linux_select_args *args)
struct timeval tv0, tv1, utv, *tvp;
int error;
#ifdef DEBUG
if (ldebug(select))
printf(ARGS(select, "%d, %p, %p, %p, %p"), args->nfds,
(void *)args->readfds, (void *)args->writefds,
(void *)args->exceptfds, (void *)args->timeout);
#endif
/*
* Store current time for computation of the amount of
* time left.
@ -532,11 +503,6 @@ linux_select(struct thread *td, struct linux_select_args *args)
goto select_out;
utv.tv_sec = ltv.tv_sec;
utv.tv_usec = ltv.tv_usec;
#ifdef DEBUG
if (ldebug(select))
printf(LMSG("incoming timeout (%jd/%ld)"),
(intmax_t)utv.tv_sec, utv.tv_usec);
#endif
if (itimerfix(&utv)) {
/*
@ -559,11 +525,6 @@ linux_select(struct thread *td, struct linux_select_args *args)
error = kern_select(td, args->nfds, args->readfds, args->writefds,
args->exceptfds, tvp, LINUX_NFDBITS);
#ifdef DEBUG
if (ldebug(select))
printf(LMSG("real select returns %d"), error);
#endif
if (error)
goto select_out;
@ -582,11 +543,6 @@ linux_select(struct thread *td, struct linux_select_args *args)
timevalclear(&utv);
} else
timevalclear(&utv);
#ifdef DEBUG
if (ldebug(select))
printf(LMSG("outgoing timeout (%jd/%ld)"),
(intmax_t)utv.tv_sec, utv.tv_usec);
#endif
ltv.tv_sec = utv.tv_sec;
ltv.tv_usec = utv.tv_usec;
if ((error = copyout(&ltv, args->timeout, sizeof(ltv))))
@ -594,10 +550,6 @@ linux_select(struct thread *td, struct linux_select_args *args)
}
select_out:
#ifdef DEBUG
if (ldebug(select))
printf(LMSG("select_out -> %d"), error);
#endif
return (error);
}
#endif
@ -609,15 +561,6 @@ linux_mremap(struct thread *td, struct linux_mremap_args *args)
size_t len;
int error = 0;
#ifdef DEBUG
if (ldebug(mremap))
printf(ARGS(mremap, "%p, %08lx, %08lx, %08lx"),
(void *)(uintptr_t)args->addr,
(unsigned long)args->old_len,
(unsigned long)args->new_len,
(unsigned long)args->flags);
#endif
if (args->flags & ~(LINUX_MREMAP_FIXED | LINUX_MREMAP_MAYMOVE)) {
td->td_retval[0] = 0;
return (EINVAL);
@ -670,11 +613,6 @@ linux_time(struct thread *td, struct linux_time_args *args)
l_time_t tm;
int error;
#ifdef DEBUG
if (ldebug(time))
printf(ARGS(time, "*"));
#endif
microtime(&tv);
tm = tv.tv_sec;
if (args->tm && (error = copyout(&tm, args->tm, sizeof(tm))))
@ -713,11 +651,6 @@ linux_times(struct thread *td, struct linux_times_args *args)
struct proc *p;
int error;
#ifdef DEBUG
if (ldebug(times))
printf(ARGS(times, "*"));
#endif
if (args->buf != NULL) {
p = td->td_proc;
PROC_LOCK(p);
@ -750,11 +683,6 @@ linux_newuname(struct thread *td, struct linux_newuname_args *args)
char osrelease[LINUX_MAX_UTSNAME];
char *p;
#ifdef DEBUG
if (ldebug(newuname))
printf(ARGS(newuname, "*"));
#endif
linux_get_osname(td, osname);
linux_get_osrelease(td, osrelease);
@ -790,11 +718,6 @@ linux_utime(struct thread *td, struct linux_utime_args *args)
LCONVPATHEXIST(td, args->fname, &fname);
#ifdef DEBUG
if (ldebug(utime))
printf(ARGS(utime, "%s, *"), fname);
#endif
if (args->times) {
if ((error = copyin(args->times, &lut, sizeof lut))) {
LFREEPATH(fname);
@ -826,11 +749,6 @@ linux_utimes(struct thread *td, struct linux_utimes_args *args)
LCONVPATHEXIST(td, args->fname, &fname);
#ifdef DEBUG
if (ldebug(utimes))
printf(ARGS(utimes, "%s, *"), fname);
#endif
if (args->tptr != NULL) {
if ((error = copyin(args->tptr, ltv, sizeof ltv))) {
LFREEPATH(fname);
@ -871,11 +789,6 @@ linux_utimensat(struct thread *td, struct linux_utimensat_args *args)
dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
#ifdef DEBUG
if (ldebug(utimensat))
printf(ARGS(utimensat, "%d, *"), dfd);
#endif
if (args->flags & ~LINUX_AT_SYMLINK_NOFOLLOW)
return (EINVAL);
@ -955,11 +868,6 @@ linux_futimesat(struct thread *td, struct linux_futimesat_args *args)
dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
LCONVPATHEXIST_AT(td, args->filename, &fname, dfd);
#ifdef DEBUG
if (ldebug(futimesat))
printf(ARGS(futimesat, "%s, *"), fname);
#endif
if (args->utimes != NULL) {
if ((error = copyin(args->utimes, ltv, sizeof ltv))) {
LFREEPATH(fname);
@ -1010,12 +918,6 @@ linux_waitpid(struct thread *td, struct linux_waitpid_args *args)
{
struct linux_wait4_args wait4_args;
#ifdef DEBUG
if (ldebug(waitpid))
printf(ARGS(waitpid, "%d, %p, %d"),
args->pid, (void *)args->status, args->options);
#endif
wait4_args.pid = args->pid;
wait4_args.status = args->status;
wait4_args.options = args->options;
@ -1031,12 +933,6 @@ linux_wait4(struct thread *td, struct linux_wait4_args *args)
int error, options;
struct rusage ru, *rup;
#ifdef DEBUG
if (ldebug(wait4))
printf(ARGS(wait4, "%d, %p, %d, %p"),
args->pid, (void *)args->status, args->options,
(void *)args->rusage);
#endif
if (args->options & ~(LINUX_WUNTRACED | LINUX_WNOHANG |
LINUX_WCONTINUED | __WCLONE | __WNOTHREAD | __WALL))
return (EINVAL);
@ -1126,12 +1022,6 @@ linux_mknod(struct thread *td, struct linux_mknod_args *args)
LCONVPATHCREAT(td, args->path, &path);
#ifdef DEBUG
if (ldebug(mknod))
printf(ARGS(mknod, "%s, %d, %ju"), path, args->mode,
(uintmax_t)args->dev);
#endif
switch (args->mode & S_IFMT) {
case S_IFIFO:
case S_IFSOCK:
@ -1177,11 +1067,6 @@ linux_mknodat(struct thread *td, struct linux_mknodat_args *args)
dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
LCONVPATHCREAT_AT(td, args->filename, &path, dfd);
#ifdef DEBUG
if (ldebug(mknodat))
printf(ARGS(mknodat, "%s, %d, %d"), path, args->mode, args->dev);
#endif
switch (args->mode & S_IFMT) {
case S_IFIFO:
case S_IFSOCK:
@ -1226,11 +1111,6 @@ linux_personality(struct thread *td, struct linux_personality_args *args)
struct proc *p = td->td_proc;
uint32_t old;
#ifdef DEBUG
if (ldebug(personality))
printf(ARGS(personality, "%u"), args->per);
#endif
PROC_LOCK(p);
pem = pem_find(p);
old = pem->persona;
@ -1260,12 +1140,6 @@ linux_setitimer(struct thread *td, struct linux_setitimer_args *uap)
struct l_itimerval ls;
struct itimerval aitv, oitv;
#ifdef DEBUG
if (ldebug(setitimer))
printf(ARGS(setitimer, "%p, %p"),
(void *)uap->itv, (void *)uap->oitv);
#endif
if (uap->itv == NULL) {
uap->itv = uap->oitv;
return (linux_getitimer(td, (struct linux_getitimer_args *)uap));
@ -1275,14 +1149,6 @@ linux_setitimer(struct thread *td, struct linux_setitimer_args *uap)
if (error != 0)
return (error);
B2L_ITIMERVAL(&aitv, &ls);
#ifdef DEBUG
if (ldebug(setitimer)) {
printf("setitimer: value: sec: %jd, usec: %ld\n",
(intmax_t)aitv.it_value.tv_sec, aitv.it_value.tv_usec);
printf("setitimer: interval: sec: %jd, usec: %ld\n",
(intmax_t)aitv.it_interval.tv_sec, aitv.it_interval.tv_usec);
}
#endif
error = kern_setitimer(td, uap->which, &aitv, &oitv);
if (error != 0 || uap->oitv == NULL)
return (error);
@ -1298,10 +1164,6 @@ linux_getitimer(struct thread *td, struct linux_getitimer_args *uap)
struct l_itimerval ls;
struct itimerval aitv;
#ifdef DEBUG
if (ldebug(getitimer))
printf(ARGS(getitimer, "%p"), (void *)uap->itv);
#endif
error = kern_getitimer(td, uap->which, &aitv);
if (error != 0)
return (error);
@ -1430,12 +1292,6 @@ linux_setrlimit(struct thread *td, struct linux_setrlimit_args *args)
u_int which;
int error;
#ifdef DEBUG
if (ldebug(setrlimit))
printf(ARGS(setrlimit, "%d, %p"),
args->resource, (void *)args->rlim);
#endif
if (args->resource >= LINUX_RLIM_NLIMITS)
return (EINVAL);
@ -1460,12 +1316,6 @@ linux_old_getrlimit(struct thread *td, struct linux_old_getrlimit_args *args)
struct rlimit bsd_rlim;
u_int which;
#ifdef DEBUG
if (ldebug(old_getrlimit))
printf(ARGS(old_getrlimit, "%d, %p"),
args->resource, (void *)args->rlim);
#endif
if (args->resource >= LINUX_RLIM_NLIMITS)
return (EINVAL);
@ -1501,12 +1351,6 @@ linux_getrlimit(struct thread *td, struct linux_getrlimit_args *args)
struct rlimit bsd_rlim;
u_int which;
#ifdef DEBUG
if (ldebug(getrlimit))
printf(ARGS(getrlimit, "%d, %p"),
args->resource, (void *)args->rlim);
#endif
if (args->resource >= LINUX_RLIM_NLIMITS)
return (EINVAL);
@ -1529,12 +1373,6 @@ linux_sched_setscheduler(struct thread *td,
struct thread *tdt;
int error, policy;
#ifdef DEBUG
if (ldebug(sched_setscheduler))
printf(ARGS(sched_setscheduler, "%d, %d, %p"),
args->pid, args->policy, (const void *)args->param);
#endif
switch (args->policy) {
case LINUX_SCHED_OTHER:
policy = SCHED_OTHER;
@ -1569,11 +1407,6 @@ linux_sched_getscheduler(struct thread *td,
struct thread *tdt;
int error, policy;
#ifdef DEBUG
if (ldebug(sched_getscheduler))
printf(ARGS(sched_getscheduler, "%d"), args->pid);
#endif
tdt = linux_tdfind(td, args->pid, -1);
if (tdt == NULL)
return (ESRCH);
@ -1601,11 +1434,6 @@ linux_sched_get_priority_max(struct thread *td,
{
struct sched_get_priority_max_args bsd;
#ifdef DEBUG
if (ldebug(sched_get_priority_max))
printf(ARGS(sched_get_priority_max, "%d"), args->policy);
#endif
switch (args->policy) {
case LINUX_SCHED_OTHER:
bsd.policy = SCHED_OTHER;
@ -1628,11 +1456,6 @@ linux_sched_get_priority_min(struct thread *td,
{
struct sched_get_priority_min_args bsd;
#ifdef DEBUG
if (ldebug(sched_get_priority_min))
printf(ARGS(sched_get_priority_min, "%d"), args->policy);
#endif
switch (args->policy) {
case LINUX_SCHED_OTHER:
bsd.policy = SCHED_OTHER;
@ -1665,11 +1488,6 @@ linux_reboot(struct thread *td, struct linux_reboot_args *args)
{
struct reboot_args bsd_args;
#ifdef DEBUG
if (ldebug(reboot))
printf(ARGS(reboot, "0x%x"), args->cmd);
#endif
if (args->magic1 != REBOOT_MAGIC1)
return (EINVAL);
@ -1718,10 +1536,6 @@ int
linux_getpid(struct thread *td, struct linux_getpid_args *args)
{
#ifdef DEBUG
if (ldebug(getpid))
printf(ARGS(getpid, ""));
#endif
td->td_retval[0] = td->td_proc->p_pid;
return (0);
@ -1732,11 +1546,6 @@ linux_gettid(struct thread *td, struct linux_gettid_args *args)
{
struct linux_emuldata *em;
#ifdef DEBUG
if (ldebug(gettid))
printf(ARGS(gettid, ""));
#endif
em = em_find(td);
KASSERT(em != NULL, ("gettid: emuldata not found.\n"));
@ -1750,11 +1559,6 @@ int
linux_getppid(struct thread *td, struct linux_getppid_args *args)
{
#ifdef DEBUG
if (ldebug(getppid))
printf(ARGS(getppid, ""));
#endif
td->td_retval[0] = kern_getppid(td);
return (0);
}
@ -1763,11 +1567,6 @@ int
linux_getgid(struct thread *td, struct linux_getgid_args *args)
{
#ifdef DEBUG
if (ldebug(getgid))
printf(ARGS(getgid, ""));
#endif
td->td_retval[0] = td->td_ucred->cr_rgid;
return (0);
}
@ -1776,11 +1575,6 @@ int
linux_getuid(struct thread *td, struct linux_getuid_args *args)
{
#ifdef DEBUG
if (ldebug(getuid))
printf(ARGS(getuid, ""));
#endif
td->td_retval[0] = td->td_ucred->cr_ruid;
return (0);
}
@ -1791,11 +1585,6 @@ linux_getsid(struct thread *td, struct linux_getsid_args *args)
{
struct getsid_args bsd;
#ifdef DEBUG
if (ldebug(getsid))
printf(ARGS(getsid, "%i"), args->pid);
#endif
bsd.pid = args->pid;
return (sys_getsid(td, &bsd));
}
@ -1813,11 +1602,6 @@ linux_getpriority(struct thread *td, struct linux_getpriority_args *args)
struct getpriority_args bsd_args;
int error;
#ifdef DEBUG
if (ldebug(getpriority))
printf(ARGS(getpriority, "%i, %i"), args->which, args->who);
#endif
bsd_args.which = args->which;
bsd_args.who = args->who;
error = sys_getpriority(td, &bsd_args);
@ -1830,11 +1614,6 @@ linux_sethostname(struct thread *td, struct linux_sethostname_args *args)
{
int name[2];
#ifdef DEBUG
if (ldebug(sethostname))
printf(ARGS(sethostname, "*, %i"), args->len);
#endif
name[0] = CTL_KERN;
name[1] = KERN_HOSTNAME;
return (userland_sysctl(td, name, 2, 0, 0, 0, args->hostname,
@ -1846,11 +1625,6 @@ linux_setdomainname(struct thread *td, struct linux_setdomainname_args *args)
{
int name[2];
#ifdef DEBUG
if (ldebug(setdomainname))
printf(ARGS(setdomainname, "*, %i"), args->len);
#endif
name[0] = CTL_KERN;
name[1] = KERN_NISDOMAINNAME;
return (userland_sysctl(td, name, 2, 0, 0, 0, args->name,
@ -1861,11 +1635,6 @@ int
linux_exit_group(struct thread *td, struct linux_exit_group_args *args)
{
#ifdef DEBUG
if (ldebug(exit_group))
printf(ARGS(exit_group, "%i"), args->error_code);
#endif
LINUX_CTR2(exit_group, "thread(%d) (%d)", td->td_tid,
args->error_code);
@ -1916,11 +1685,6 @@ linux_capget(struct thread *td, struct linux_capget_args *uap)
u32s = 2;
break;
default:
#ifdef DEBUG
if (ldebug(capget))
printf(LMSG("invalid capget capability version 0x%x"),
luch.version);
#endif
luch.version = _LINUX_CAPABILITY_VERSION_1;
error = copyout(&luch, uap->hdrp, sizeof(luch));
if (error)
@ -1968,11 +1732,6 @@ linux_capset(struct thread *td, struct linux_capset_args *uap)
u32s = 2;
break;
default:
#ifdef DEBUG
if (ldebug(capset))
printf(LMSG("invalid capset capability version 0x%x"),
luch.version);
#endif
luch.version = _LINUX_CAPABILITY_VERSION_1;
error = copyout(&luch, uap->hdrp, sizeof(luch));
if (error)
@ -2011,13 +1770,6 @@ linux_prctl(struct thread *td, struct linux_prctl_args *args)
char comm[LINUX_MAX_COMM_LEN];
int pdeath_signal;
#ifdef DEBUG
if (ldebug(prctl))
printf(ARGS(prctl, "%d, %ju, %ju, %ju, %ju"), args->option,
(uintmax_t)args->arg2, (uintmax_t)args->arg3,
(uintmax_t)args->arg4, (uintmax_t)args->arg5);
#endif
switch (args->option) {
case LINUX_PR_SET_PDEATHSIG:
if (!LINUX_SIG_VALID(args->arg2))
@ -2103,11 +1855,6 @@ linux_sched_setparam(struct thread *td,
struct thread *tdt;
int error;
#ifdef DEBUG
if (ldebug(sched_setparam))
printf(ARGS(sched_setparam, "%d, *"), uap->pid);
#endif
error = copyin(uap->param, &sched_param, sizeof(sched_param));
if (error)
return (error);
@ -2129,11 +1876,6 @@ linux_sched_getparam(struct thread *td,
struct thread *tdt;
int error;
#ifdef DEBUG
if (ldebug(sched_getparam))
printf(ARGS(sched_getparam, "%d, *"), uap->pid);
#endif
tdt = linux_tdfind(td, uap->pid, -1);
if (tdt == NULL)
return (ESRCH);
@ -2156,11 +1898,6 @@ linux_sched_getaffinity(struct thread *td,
int error;
struct thread *tdt;
#ifdef DEBUG
if (ldebug(sched_getaffinity))
printf(ARGS(sched_getaffinity, "%d, %d, *"), args->pid,
args->len);
#endif
if (args->len < sizeof(cpuset_t))
return (EINVAL);
@ -2187,11 +1924,6 @@ linux_sched_setaffinity(struct thread *td,
{
struct thread *tdt;
#ifdef DEBUG
if (ldebug(sched_setaffinity))
printf(ARGS(sched_setaffinity, "%d, %d, *"), args->pid,
args->len);
#endif
if (args->len < sizeof(cpuset_t))
return (EINVAL);
@ -2220,12 +1952,6 @@ linux_prlimit64(struct thread *td, struct linux_prlimit64_args *args)
int flags;
int error;
#ifdef DEBUG
if (ldebug(prlimit64))
printf(ARGS(prlimit64, "%d, %d, %p, %p"), args->pid,
args->resource, (void *)args->new, (void *)args->old);
#endif
if (args->resource >= LINUX_RLIM_NLIMITS)
return (EINVAL);
@ -2412,70 +2138,6 @@ linux_ppoll(struct thread *td, struct linux_ppoll_args *args)
return (error);
}
#if defined(DEBUG) || defined(KTR)
/* XXX: can be removed when every ldebug(...) and KTR stuff are removed. */
#ifdef COMPAT_LINUX32
#define L_MAXSYSCALL LINUX32_SYS_MAXSYSCALL
#else
#define L_MAXSYSCALL LINUX_SYS_MAXSYSCALL
#endif
u_char linux_debug_map[howmany(L_MAXSYSCALL, sizeof(u_char))];
static int
linux_debug(int syscall, int toggle, int global)
{
if (global) {
char c = toggle ? 0 : 0xff;
memset(linux_debug_map, c, sizeof(linux_debug_map));
return (0);
}
if (syscall < 0 || syscall >= L_MAXSYSCALL)
return (EINVAL);
if (toggle)
clrbit(linux_debug_map, syscall);
else
setbit(linux_debug_map, syscall);
return (0);
}
#undef L_MAXSYSCALL
/*
* Usage: sysctl linux.debug=<syscall_nr>.<0/1>
*
* E.g.: sysctl linux.debug=21.0
*
* As a special case, syscall "all" will apply to all syscalls globally.
*/
#define LINUX_MAX_DEBUGSTR 16
int
linux_sysctl_debug(SYSCTL_HANDLER_ARGS)
{
char value[LINUX_MAX_DEBUGSTR], *p;
int error, sysc, toggle;
int global = 0;
value[0] = '\0';
error = sysctl_handle_string(oidp, value, LINUX_MAX_DEBUGSTR, req);
if (error || req->newptr == NULL)
return (error);
for (p = value; *p != '\0' && *p != '.'; p++);
if (*p == '\0')
return (EINVAL);
*p++ = '\0';
sysc = strtol(value, NULL, 0);
toggle = strtol(p, NULL, 0);
if (strcmp(value, "all") == 0)
global = 1;
error = linux_debug(sysc, toggle, global);
return (error);
}
#endif /* DEBUG || KTR */
int
linux_sched_rr_get_interval(struct thread *td,
struct linux_sched_rr_get_interval_args *uap)

View File

@ -156,6 +156,4 @@ int linux_set_upcall_kse(struct thread *td, register_t stack);
int linux_set_cloned_tls(struct thread *td, void *desc);
struct thread *linux_tdfind(struct thread *, lwpid_t, pid_t);
int linux_sysctl_debug(SYSCTL_HANDLER_ARGS);
#endif /* _LINUX_MISC_H_ */

View File

@ -146,12 +146,6 @@ linux_signal(struct thread *td, struct linux_signal_args *args)
l_sigaction_t nsa, osa;
int error;
#ifdef DEBUG
if (ldebug(signal))
printf(ARGS(signal, "%d, %p"),
args->sig, (void *)(uintptr_t)args->handler);
#endif
nsa.lsa_handler = args->handler;
nsa.lsa_flags = LINUX_SA_ONESHOT | LINUX_SA_NOMASK;
LINUX_SIGEMPTYSET(nsa.lsa_mask);
@ -169,13 +163,6 @@ linux_rt_sigaction(struct thread *td, struct linux_rt_sigaction_args *args)
l_sigaction_t nsa, osa;
int error;
#ifdef DEBUG
if (ldebug(rt_sigaction))
printf(ARGS(rt_sigaction, "%ld, %p, %p, %ld"),
(long)args->sig, (void *)args->act,
(void *)args->oact, (long)args->sigsetsize);
#endif
if (args->sigsetsize != sizeof(l_sigset_t))
return (EINVAL);
@ -239,11 +226,6 @@ linux_sigprocmask(struct thread *td, struct linux_sigprocmask_args *args)
l_sigset_t set, oset;
int error;
#ifdef DEBUG
if (ldebug(sigprocmask))
printf(ARGS(sigprocmask, "%d, *, *"), args->how);
#endif
if (args->mask != NULL) {
error = copyin(args->mask, &mask, sizeof(l_osigset_t));
if (error)
@ -271,13 +253,6 @@ linux_rt_sigprocmask(struct thread *td, struct linux_rt_sigprocmask_args *args)
l_sigset_t set, oset;
int error;
#ifdef DEBUG
if (ldebug(rt_sigprocmask))
printf(ARGS(rt_sigprocmask, "%d, %p, %p, %ld"),
args->how, (void *)args->mask,
(void *)args->omask, (long)args->sigsetsize);
#endif
if (args->sigsetsize != sizeof(l_sigset_t))
return (EINVAL);
@ -305,11 +280,6 @@ linux_sgetmask(struct thread *td, struct linux_sgetmask_args *args)
struct proc *p = td->td_proc;
l_sigset_t mask;
#ifdef DEBUG
if (ldebug(sgetmask))
printf(ARGS(sgetmask, ""));
#endif
PROC_LOCK(p);
bsd_to_linux_sigset(&td->td_sigmask, &mask);
PROC_UNLOCK(p);
@ -324,11 +294,6 @@ linux_ssetmask(struct thread *td, struct linux_ssetmask_args *args)
l_sigset_t lset;
sigset_t bset;
#ifdef DEBUG
if (ldebug(ssetmask))
printf(ARGS(ssetmask, "%08lx"), (unsigned long)args->mask);
#endif
PROC_LOCK(p);
bsd_to_linux_sigset(&td->td_sigmask, &lset);
td->td_retval[0] = lset.__mask;
@ -350,11 +315,6 @@ linux_sigpending(struct thread *td, struct linux_sigpending_args *args)
l_sigset_t lset;
l_osigset_t mask;
#ifdef DEBUG
if (ldebug(sigpending))
printf(ARGS(sigpending, "*"));
#endif
PROC_LOCK(p);
bset = p->p_siglist;
SIGSETOR(bset, td->td_siglist);
@ -380,11 +340,6 @@ linux_rt_sigpending(struct thread *td, struct linux_rt_sigpending_args *args)
return (EINVAL);
/* NOT REACHED */
#ifdef DEBUG
if (ldebug(rt_sigpending))
printf(ARGS(rt_sigpending, "*"));
#endif
PROC_LOCK(p);
bset = p->p_siglist;
SIGSETOR(bset, td->td_siglist);
@ -410,10 +365,6 @@ linux_rt_sigtimedwait(struct thread *td,
l_siginfo_t linfo;
ksiginfo_t info;
#ifdef DEBUG
if (ldebug(rt_sigtimedwait))
printf(ARGS(rt_sigtimedwait, "*"));
#endif
if (args->sigsetsize != sizeof(l_sigset_t))
return (EINVAL);
@ -425,12 +376,6 @@ linux_rt_sigtimedwait(struct thread *td,
if (args->timeout) {
if ((error = copyin(args->timeout, &ltv, sizeof(ltv))))
return (error);
#ifdef DEBUG
if (ldebug(rt_sigtimedwait))
printf(LMSG("linux_rt_sigtimedwait: "
"incoming timeout (%jd/%jd)\n"),
(intmax_t)ltv.tv_sec, (intmax_t)ltv.tv_usec);
#endif
tv.tv_sec = (long)ltv.tv_sec;
tv.tv_usec = (suseconds_t)ltv.tv_usec;
if (itimerfix(&tv)) {
@ -446,22 +391,11 @@ linux_rt_sigtimedwait(struct thread *td,
}
if (tv.tv_sec < 0)
timevalclear(&tv);
#ifdef DEBUG
if (ldebug(rt_sigtimedwait))
printf(LMSG("linux_rt_sigtimedwait: "
"converted timeout (%jd/%ld)\n"),
(intmax_t)tv.tv_sec, tv.tv_usec);
#endif
}
TIMEVAL_TO_TIMESPEC(&tv, &ts);
tsa = &ts;
}
error = kern_sigtimedwait(td, bset, &info, tsa);
#ifdef DEBUG
if (ldebug(rt_sigtimedwait))
printf(LMSG("linux_rt_sigtimedwait: "
"sigtimedwait returning (%d)\n"), error);
#endif
if (error)
return (error);
@ -486,11 +420,6 @@ linux_kill(struct thread *td, struct linux_kill_args *args)
int signum;
} */ tmp;
#ifdef DEBUG
if (ldebug(kill))
printf(ARGS(kill, "%d, %d"), args->pid, args->signum);
#endif
/*
* Allow signal 0 as a means to check for privileges
*/
@ -535,12 +464,6 @@ linux_tgkill(struct thread *td, struct linux_tgkill_args *args)
ksiginfo_t ksi;
int sig;
#ifdef DEBUG
if (ldebug(tgkill))
printf(ARGS(tgkill, "%d, %d, %d"),
args->tgid, args->pid, args->sig);
#endif
if (args->pid <= 0 || args->tgid <=0)
return (EINVAL);
@ -578,10 +501,6 @@ linux_tkill(struct thread *td, struct linux_tkill_args *args)
ksiginfo_t ksi;
int sig;
#ifdef DEBUG
if (ldebug(tkill))
printf(ARGS(tkill, "%i, %i"), args->tid, args->sig);
#endif
if (args->tid <= 0)
return (EINVAL);

View File

@ -185,11 +185,6 @@ linux_newstat(struct thread *td, struct linux_newstat_args *args)
LCONVPATHEXIST(td, args->path, &path);
#ifdef DEBUG
if (ldebug(newstat))
printf(ARGS(newstat, "%s, *"), path);
#endif
error = linux_kern_stat(td, path, UIO_SYSSPACE, &buf);
LFREEPATH(path);
if (error)
@ -206,11 +201,6 @@ linux_newlstat(struct thread *td, struct linux_newlstat_args *args)
LCONVPATHEXIST(td, args->path, &path);
#ifdef DEBUG
if (ldebug(newlstat))
printf(ARGS(newlstat, "%s, *"), path);
#endif
error = linux_kern_lstat(td, path, UIO_SYSSPACE, &sb);
LFREEPATH(path);
if (error)
@ -225,11 +215,6 @@ linux_newfstat(struct thread *td, struct linux_newfstat_args *args)
struct stat buf;
int error;
#ifdef DEBUG
if (ldebug(newfstat))
printf(ARGS(newfstat, "%d, *"), args->fd);
#endif
error = kern_fstat(td, args->fd, &buf);
translate_fd_major_minor(td, args->fd, &buf);
if (!error)
@ -276,10 +261,6 @@ linux_stat(struct thread *td, struct linux_stat_args *args)
LCONVPATHEXIST(td, args->path, &path);
#ifdef DEBUG
if (ldebug(stat))
printf(ARGS(stat, "%s, *"), path);
#endif
error = linux_kern_stat(td, path, UIO_SYSSPACE, &buf);
if (error) {
LFREEPATH(path);
@ -298,10 +279,6 @@ linux_lstat(struct thread *td, struct linux_lstat_args *args)
LCONVPATHEXIST(td, args->path, &path);
#ifdef DEBUG
if (ldebug(lstat))
printf(ARGS(lstat, "%s, *"), path);
#endif
error = linux_kern_lstat(td, path, UIO_SYSSPACE, &buf);
if (error) {
LFREEPATH(path);
@ -411,10 +388,6 @@ linux_statfs(struct thread *td, struct linux_statfs_args *args)
LCONVPATHEXIST(td, args->path, &path);
#ifdef DEBUG
if (ldebug(statfs))
printf(ARGS(statfs, "%s, *"), path);
#endif
bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
error = kern_statfs(td, path, UIO_SYSSPACE, bsd_statfs);
LFREEPATH(path);
@ -459,10 +432,6 @@ linux_statfs64(struct thread *td, struct linux_statfs64_args *args)
LCONVPATHEXIST(td, args->path, &path);
#ifdef DEBUG
if (ldebug(statfs64))
printf(ARGS(statfs64, "%s, *"), path);
#endif
bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
error = kern_statfs(td, path, UIO_SYSSPACE, bsd_statfs);
LFREEPATH(path);
@ -481,10 +450,6 @@ linux_fstatfs64(struct thread *td, struct linux_fstatfs64_args *args)
struct statfs *bsd_statfs;
int error;
#ifdef DEBUG
if (ldebug(fstatfs64))
printf(ARGS(fstatfs64, "%d, *"), args->fd);
#endif
if (args->bufsize != sizeof(struct l_statfs64))
return (EINVAL);
@ -506,10 +471,6 @@ linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
struct statfs *bsd_statfs;
int error;
#ifdef DEBUG
if (ldebug(fstatfs))
printf(ARGS(fstatfs, "%d, *"), args->fd);
#endif
bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
error = kern_fstatfs(td, args->fd, bsd_statfs);
if (error == 0)
@ -532,10 +493,6 @@ struct l_ustat
int
linux_ustat(struct thread *td, struct linux_ustat_args *args)
{
#ifdef DEBUG
if (ldebug(ustat))
printf(ARGS(ustat, "%ju, *"), (uintmax_t)args->dev);
#endif
return (EOPNOTSUPP);
}
@ -586,11 +543,6 @@ linux_stat64(struct thread *td, struct linux_stat64_args *args)
LCONVPATHEXIST(td, args->filename, &filename);
#ifdef DEBUG
if (ldebug(stat64))
printf(ARGS(stat64, "%s, *"), filename);
#endif
error = linux_kern_stat(td, filename, UIO_SYSSPACE, &buf);
LFREEPATH(filename);
if (error)
@ -607,11 +559,6 @@ linux_lstat64(struct thread *td, struct linux_lstat64_args *args)
LCONVPATHEXIST(td, args->filename, &filename);
#ifdef DEBUG
if (ldebug(lstat64))
printf(ARGS(lstat64, "%s, *"), args->filename);
#endif
error = linux_kern_lstat(td, filename, UIO_SYSSPACE, &sb);
LFREEPATH(filename);
if (error)
@ -625,11 +572,6 @@ linux_fstat64(struct thread *td, struct linux_fstat64_args *args)
struct stat buf;
int error;
#ifdef DEBUG
if (ldebug(fstat64))
printf(ARGS(fstat64, "%d, *"), args->fd);
#endif
error = kern_fstat(td, args->fd, &buf);
translate_fd_major_minor(td, args->fd, &buf);
if (!error)
@ -653,11 +595,6 @@ linux_fstatat64(struct thread *td, struct linux_fstatat64_args *args)
dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
LCONVPATHEXIST_AT(td, args->pathname, &path, dfd);
#ifdef DEBUG
if (ldebug(fstatat64))
printf(ARGS(fstatat64, "%i, %s, %i"), args->dfd, path, args->flag);
#endif
error = linux_kern_statat(td, flag, dfd, path, UIO_SYSSPACE, &buf);
if (!error)
error = stat64_copyout(&buf, args->statbuf);
@ -683,11 +620,6 @@ linux_newfstatat(struct thread *td, struct linux_newfstatat_args *args)
dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
LCONVPATHEXIST_AT(td, args->pathname, &path, dfd);
#ifdef DEBUG
if (ldebug(newfstatat))
printf(ARGS(newfstatat, "%i, %s, %i"), args->dfd, path, args->flag);
#endif
error = linux_kern_statat(td, flag, dfd, path, UIO_SYSSPACE, &buf);
if (error == 0)
error = newstat_copyout(&buf, args->statbuf);

View File

@ -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 LINUX_SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE)

View File

@ -106,11 +106,6 @@ linux_execve(struct thread *td, struct linux_execve_args *args)
LCONVPATHEXIST(td, args->path, &newpath);
#ifdef DEBUG
if (ldebug(execve))
printf(ARGS(execve, "%s"), newpath);
#endif
error = exec_copyin_args(&eargs, newpath, UIO_SYSSPACE,
args->argp, args->envp);
free(newpath, M_TEMP);
@ -256,11 +251,6 @@ linux_old_select(struct thread *td, struct linux_old_select_args *args)
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);
@ -283,7 +273,7 @@ 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 failed!");
} else {
idx = info.entry_number;
@ -292,7 +282,7 @@ linux_set_cloned_tls(struct thread *td, void *desc)
* in the set_thread_area() syscall
*/
if (idx != 6 && idx != 3) {
printf(LMSG("resetting idx!"));
linux_msg(td, "set_cloned_tls resetting idx!");
idx = 3;
}
@ -302,25 +292,13 @@ linux_set_cloned_tls(struct thread *td, void *desc)
info.entry_number = 3;
error = copyout(&info, desc, sizeof(struct l_user_desc));
if (error)
printf(LMSG("copyout failed!"));
linux_msg(td, "set_cloned_tls copyout 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, 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_def32, sd.sd_gran);
#endif
/* set %gs */
td->td_pcb->pcb_gsd = sd;
td->td_pcb->pcb_gs = GSEL(GUGS_SEL, SEL_UPL);
@ -348,13 +326,6 @@ int
linux_mmap2(struct thread *td, struct linux_mmap2_args *args)
{
#ifdef DEBUG
if (ldebug(mmap2))
printf(ARGS(mmap2, "%p, %d, %d, 0x%08x, %d, %d"),
(void *)args->addr, args->len, args->prot,
args->flags, args->fd, args->pgoff);
#endif
return (linux_mmap_common(td, args->addr, args->len, args->prot,
args->flags, args->fd, (uint64_t)(uint32_t)args->pgoff *
PAGE_SIZE));
@ -370,13 +341,6 @@ linux_mmap(struct thread *td, struct linux_mmap_args *args)
if (error)
return (error);
#ifdef DEBUG
if (ldebug(mmap))
printf(ARGS(mmap, "%p, %d, %d, 0x%08x, %d, %d"),
(void *)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));
@ -474,7 +438,7 @@ linux_modify_ldt(struct thread *td, struct linux_modify_ldt_args *uap)
}
if (error == EOPNOTSUPP) {
printf("linux: modify_ldt needs kernel option USER_LDT\n");
linux_msg(td, "modify_ldt needs kernel option USER_LDT");
error = ENOSYS;
}
@ -488,12 +452,6 @@ linux_sigaction(struct thread *td, struct linux_sigaction_args *args)
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)
@ -530,11 +488,6 @@ linux_sigsuspend(struct thread *td, struct linux_sigsuspend_args *args)
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);
@ -548,12 +501,6 @@ linux_rt_sigsuspend(struct thread *td, struct linux_rt_sigsuspend_args *uap)
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);
@ -571,11 +518,6 @@ linux_pause(struct thread *td, struct linux_pause_args *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);
@ -589,11 +531,6 @@ linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap)
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)
@ -619,12 +556,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));
}
@ -641,20 +572,6 @@ linux_set_thread_area(struct thread *td, struct linux_set_thread_area_args *args
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\n"),
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
idx = info.entry_number;
/*
* Semantics of Linux version: every thread in the system has array of
@ -703,20 +620,6 @@ linux_set_thread_area(struct thread *td, struct linux_set_thread_area_args *args
}
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, 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_def32,
sd.sd_gran);
#endif
/* this is taken from i386 version of cpu_set_user_tls() */
critical_enter();
/* set %gs */
@ -738,11 +641,6 @@ linux_get_thread_area(struct thread *td, struct linux_get_thread_area_args *args
struct l_desc_struct desc;
struct segment_descriptor sd;
#ifdef DEBUG
if (ldebug(get_thread_area))
printf(ARGS(get_thread_area, "%p"), args->desc);
#endif
error = copyin(args->desc, &info, sizeof(struct l_user_desc));
if (error)
return (error);

View File

@ -77,19 +77,6 @@ __FBSDID("$FreeBSD$");
MODULE_VERSION(linux, 1);
#if defined(DEBUG)
SYSCTL_PROC(_compat_linux, OID_AUTO, debug, CTLTYPE_STRING | CTLFLAG_RW, 0, 0,
linux_sysctl_debug, "A", "Linux 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
#define LINUX_SYS_linux_sendsig 0
#define LINUX_PS_STRINGS (LINUX_USRSTACK - sizeof(struct ps_strings))
static int linux_szsigcode;
@ -395,11 +382,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
regs = td->td_frame;
oonstack = sigonstack(regs->tf_esp);
#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)) {
@ -456,23 +438,11 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
frame.sf_sc.uc_mcontext.sc_cr2 = (register_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%x, 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);
}
@ -526,12 +496,6 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
regs = td->td_frame;
oonstack = sigonstack(regs->tf_esp);
#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)) {
@ -621,10 +585,6 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args)
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
@ -704,10 +664,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args)
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
@ -767,11 +723,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args)
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%x, mask: 0x%x"),
ss.ss_flags, ss.ss_sp, ss.ss_size, context->sc_mask);
#endif
(void)kern_sigaltstack(td, &ss, NULL);
return (EJUSTRETURN);

View File

@ -80,13 +80,4 @@ ${VDSO}.so: linux${SFX}_locore.o
linux${SFX}_genassym.o: offset.inc
${CC} -c ${CFLAGS:N-flto:N-fno-common} ${.IMPSRC}
.if !defined(KERNBUILDDIR)
.if defined(KTR)
CFLAGS+= -DKTR
.endif
.if defined(DEBUG)
CFLAGS+= -DDEBUG
.endif
.endif
.include <bsd.kmod.mk>

View File

@ -55,13 +55,4 @@ linux_support.o: assym.inc linux_assym.h
linux_genassym.o: offset.inc
${CC} -c ${CFLAGS:N-flto:N-fno-common} ${.IMPSRC}
.if !defined(KERNBUILDDIR)
.if defined(DEBUG)
CFLAGS+=-DDEBUG
.endif
.if defined(KTR)
CFLAGS+=-DKTR
.endif
.endif
.include <bsd.kmod.mk>

View File

@ -15,13 +15,4 @@ EXPORT_SYMS+= linux_ioctl_unregister_handler
EXPORT_SYMS+= linux_get_osname
EXPORT_SYMS+= linux_get_osrelease
.if !defined(KERNBUILDDIR)
.if defined(DEBUG)
CFLAGS+=-DDEBUG
.endif
.if defined(KTR)
CFLAGS+=-DKTR
.endif
.endif
.include <bsd.kmod.mk>