Add function linux_msg() for regulating output from the linux emulation

code, make the emulator use it.

Rename unsupported_msg() to unimplemented_syscall().  Rename some arguments
for clarity

Fixup grammar.

Requested by: bde
This commit is contained in:
Alfred Perlstein 2003-01-02 02:19:10 +00:00
parent 82e10e2428
commit e15583ce20
5 changed files with 42 additions and 12 deletions

View File

@ -2395,7 +2395,7 @@ linux_ioctl(struct thread *td, struct linux_ioctl_args *args)
}
fdrop(fp, td);
printf("linux: 'ioctl' fd=%d, cmd=0x%x ('%c',%d) not implemented\n",
linux_msg(td, "ioctl fd=%d, cmd=0x%x ('%c',%d) is not implemented",
args->fd, (int)(args->cmd & 0xffff),
(int)(args->cmd & 0xff00) >> 8, (int)(args->cmd & 0xff));

View File

@ -556,7 +556,7 @@ linux_semctl(struct thread *td, struct linux_semctl_args *args)
case LINUX_SETALL:
/* FALLTHROUGH */
default:
uprintf("linux: 'ipc' typ=%d not implemented\n",
linux_msg(td, "ipc type %d is not implemented",
args->cmd & ~LINUX_IPC_64);
return EINVAL;
}
@ -783,8 +783,7 @@ linux_shmctl(struct thread *td, struct linux_shmctl_args *args)
case LINUX_SHM_LOCK:
case LINUX_SHM_UNLOCK:
default:
uprintf("linux: 'ipc' typ=%d not implemented\n",
args->cmd & ~LINUX_IPC_64);
linux_msg(td, "ipc typ=%d not implemented", args->cmd & ~LINUX_IPC_64);
return EINVAL;
}
}

View File

@ -35,10 +35,13 @@
#include <sys/proc.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/sbuf.h>
#include <machine/../linux/linux.h>
#include <machine/../linux/linux_proto.h>
#include <compat/linux/linux_util.h>
#define LINUX_CTL_KERN 1
#define LINUX_CTL_VM 2
#define LINUX_CTL_NET 3
@ -78,6 +81,7 @@ int
linux_sysctl(struct thread *td, struct linux_sysctl_args *args)
{
struct l___sysctl_args la;
struct sbuf *sb;
l_int *mib;
int error, i;
@ -113,10 +117,18 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args)
break;
}
printf("linux: sysctl: unhandled name=");
for (i = 0; i < la.nlen; i++)
printf("%c%d", (i) ? ',' : '{', mib[i]);
printf("}\n");
sb = sbuf_new(NULL, NULL, 20 + la.nlen * 5, SBUF_AUTOEXTEND);
if (sb == NULL) {
linux_msg(td, "sysctl is not implemented");
} else {
sbuf_printf(sb, "sysctl ");
for (i = 0; i < la.nlen; i++)
sbuf_printf(sb, "%c%d", (i) ? ',' : '{', mib[i]);
sbuf_printf(sb, "} is not implemented");
sbuf_finish(sb);
linux_msg(td, "%s", sbuf_data(sb));
sbuf_delete(sb);
}
free(mib, M_TEMP);
return (ENOTDIR);

View File

@ -37,6 +37,8 @@
#include <sys/malloc.h>
#include <sys/vnode.h>
#include <machine/stdarg.h>
#include <compat/linux/linux_util.h>
const char linux_emul_path[] = "/compat/linux";
@ -200,3 +202,17 @@ linux_emul_convpath(td, path, pathseg, pbuf, cflag)
bcopy(ptr, buf, len);
return error;
}
void
linux_msg(const struct thread *td, const char *fmt, ...)
{
va_list ap;
struct proc *p;
p = td->td_proc;
printf("linux: pid %d (%s): ", (int)p->p_pid, p->p_comm);
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
printf("\n");
}

View File

@ -45,6 +45,7 @@
#include <machine/vmparam.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/syslog.h>
#include <sys/cdefs.h>
#include <sys/uio.h>
@ -108,16 +109,18 @@ int linux_emul_find(struct thread *, caddr_t *, char *, char **, int);
int \
linux_ ## s(struct thread *p, struct linux_ ## s ## _args *args) \
{ \
return (unsupported_msg(p, #s)); \
return (unimplemented_syscall(p, #s)); \
} \
struct __hack
void linux_msg(const struct thread *td, const char *fmt, ...)
__printflike(2, 3);
static __inline int
unsupported_msg(struct thread *td, const char *fname)
unimplemented_syscall(struct thread *td, const char *syscallname)
{
printf("linux: syscall %s is obsoleted or not implemented pid %ld "
"(%s)\n", fname, (long)td->td_proc->p_pid, td->td_proc->p_comm);
linux_msg(td, "syscall %s not implemented", syscallname);
return (ENOSYS);
}