summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2003-01-02 02:19:10 +0000
committeralfred <alfred@FreeBSD.org>2003-01-02 02:19:10 +0000
commit6f979f7e5f34bfa805c879fd818dcd148def2365 (patch)
tree99826f563971bf97a7c515ce2142bc0961221917 /sys/compat
parent0d04e17370ab2b8976dd2c0dcb3d6e9ba061ad5c (diff)
downloadFreeBSD-src-6f979f7e5f34bfa805c879fd818dcd148def2365.zip
FreeBSD-src-6f979f7e5f34bfa805c879fd818dcd148def2365.tar.gz
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
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_ioctl.c2
-rw-r--r--sys/compat/linux/linux_ipc.c5
-rw-r--r--sys/compat/linux/linux_sysctl.c20
-rw-r--r--sys/compat/linux/linux_util.c16
-rw-r--r--sys/compat/linux/linux_util.h11
5 files changed, 42 insertions, 12 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index 186b84c..9f10ba5 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -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));
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c
index f977c57..6dd21eb 100644
--- a/sys/compat/linux/linux_ipc.c
+++ b/sys/compat/linux/linux_ipc.c
@@ -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;
}
}
diff --git a/sys/compat/linux/linux_sysctl.c b/sys/compat/linux/linux_sysctl.c
index 86a8758..699b5d6 100644
--- a/sys/compat/linux/linux_sysctl.c
+++ b/sys/compat/linux/linux_sysctl.c
@@ -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);
diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c
index 7b34586..5bd8c15 100644
--- a/sys/compat/linux/linux_util.c
+++ b/sys/compat/linux/linux_util.c
@@ -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 @@ keeporig:
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");
+}
diff --git a/sys/compat/linux/linux_util.h b/sys/compat/linux/linux_util.h
index bf9cadd..72fe437 100644
--- a/sys/compat/linux/linux_util.h
+++ b/sys/compat/linux/linux_util.h
@@ -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);
}
OpenPOWER on IntegriCloud