Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/irix Added uname emulation so that IRIX's uname -...
details: https://anonhg.NetBSD.org/src/rev/0971814cc275
branches: trunk
changeset: 537805:0971814cc275
user: manu <manu%NetBSD.org@localhost>
date: Sat Oct 05 23:17:29 2002 +0000
description:
Added uname emulation so that IRIX's uname -s returns IRIX
diffstat:
sys/compat/irix/irix_misc.c | 77 +++++++++++++++++++++++++++++++++++++-
sys/compat/irix/irix_syscall.h | 5 +-
sys/compat/irix/irix_syscallargs.h | 16 ++++++-
sys/compat/irix/irix_syscalls.c | 6 +-
sys/compat/irix/irix_sysent.c | 12 ++--
sys/compat/irix/irix_types.h | 21 +++++++++-
sys/compat/irix/syscalls.master | 6 +-
7 files changed, 125 insertions(+), 18 deletions(-)
diffs (truncated from 302 to 300 lines):
diff -r 5855c249f086 -r 0971814cc275 sys/compat/irix/irix_misc.c
--- a/sys/compat/irix/irix_misc.c Sat Oct 05 23:15:58 2002 +0000
+++ b/sys/compat/irix/irix_misc.c Sat Oct 05 23:17:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_misc.c,v 1.2 2002/05/28 21:15:41 manu Exp $ */
+/* $NetBSD: irix_misc.c,v 1.3 2002/10/05 23:17:29 manu Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,17 +37,25 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_misc.c,v 1.2 2002/05/28 21:15:41 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_misc.c,v 1.3 2002/10/05 23:17:29 manu Exp $");
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/systm.h>
#include <sys/param.h>
+#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
+#include <compat/svr4/svr4_types.h>
+#include <compat/svr4/svr4_lwp.h>
+#include <compat/svr4/svr4_signal.h>
+#include <compat/svr4/svr4_ucontext.h>
+#include <compat/svr4/svr4_utsname.h>
+#include <compat/svr4/svr4_syscallargs.h>
+
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_exec.h>
@@ -80,3 +88,68 @@
else
return sys_setpgid(p, uap, retval);
}
+
+int
+irix_sys_uname(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct irix_sys_uname_args /* {
+ syscallarg(struct irix_utsname *) name;
+ } */ *uap = v;
+ struct irix_utsname sut;
+ char *irix_sysname = "IRIX";
+ char *irix_release = "6.5";
+ char *irix_machine = "IP22"; /* XXX */
+ char *irix_version = "04131232";
+
+ memset(&sut, 0, sizeof(sut));
+
+ strncpy(sut.sysname, irix_sysname, sizeof(sut.sysname));
+ sut.sysname[sizeof(sut.sysname) - 1] = '\0';
+
+ strncpy(sut.nodename, hostname, sizeof(sut.nodename));
+ sut.nodename[sizeof(sut.nodename) - 1] = '\0';
+
+ strncpy(sut.release, irix_release, sizeof(sut.release));
+ sut.release[sizeof(sut.release) - 1] = '\0';
+
+ strncpy(sut.version, irix_version, sizeof(sut.version));
+ sut.version[sizeof(sut.version) - 1] = '\0';
+
+ strncpy(sut.machine, irix_machine, sizeof(sut.machine));
+ sut.machine[sizeof(sut.machine) - 1] = '\0';
+
+ return copyout((caddr_t) &sut, (caddr_t) SCARG(uap, name),
+ sizeof(struct irix_utsname));
+}
+
+int
+irix_sys_utssys(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct irix_sys_utssys_args /* {
+ syscallarg(void *) a1;
+ syscallarg(void *) a2;
+ syscallarg(int) sel;
+ syscallarg(void) a3;
+ } */ *uap = v;
+
+ switch (SCARG(uap, sel)) {
+ case 0: { /* uname(2) */
+ struct irix_sys_uname_args ua;
+ SCARG(&ua, name) = SCARG(uap, a1);
+ return irix_sys_uname(p, &ua, retval);
+ }
+ break;
+
+ default:
+ return(svr4_sys_utssys(p, v, retval));
+ break;
+ }
+
+ return 0;
+}
diff -r 5855c249f086 -r 0971814cc275 sys/compat/irix/irix_syscall.h
--- a/sys/compat/irix/irix_syscall.h Sat Oct 05 23:15:58 2002 +0000
+++ b/sys/compat/irix/irix_syscall.h Sat Oct 05 23:17:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_syscall.h,v 1.48 2002/08/02 23:02:52 manu Exp $ */
+/* $NetBSD: irix_syscall.h,v 1.49 2002/10/05 23:17:29 manu Exp $ */
/*
* System call numbers.
@@ -343,6 +343,9 @@
/* syscall: "systeminfo" ret: "long" args: "int" "char *" "long" */
#define IRIX_SYS_systeminfo 156
+/* syscall: "uname" ret: "int" args: "struct irix_utsname *" */
+#define IRIX_SYS_uname 157
+
/* syscall: "xstat" ret: "int" args: "const int" "const char *" "struct stat *" */
#define IRIX_SYS_xstat 158
diff -r 5855c249f086 -r 0971814cc275 sys/compat/irix/irix_syscallargs.h
--- a/sys/compat/irix/irix_syscallargs.h Sat Oct 05 23:15:58 2002 +0000
+++ b/sys/compat/irix/irix_syscallargs.h Sat Oct 05 23:17:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_syscallargs.h,v 1.48 2002/08/02 23:02:53 manu Exp $ */
+/* $NetBSD: irix_syscallargs.h,v 1.49 2002/10/05 23:17:29 manu Exp $ */
/*
* System call argument lists.
@@ -67,6 +67,13 @@
syscallarg(void *) arg4;
};
+struct irix_sys_utssys_args {
+ syscallarg(void *) a1;
+ syscallarg(void *) a2;
+ syscallarg(int) sel;
+ syscallarg(void *) a3;
+};
+
struct irix_sys_fcntl_args {
syscallarg(int) fd;
syscallarg(int) cmd;
@@ -175,6 +182,10 @@
syscallarg(long) len;
};
+struct irix_sys_uname_args {
+ syscallarg(struct irix_utsname *) name;
+};
+
struct irix_sys_xstat_args {
syscallarg(const int) version;
syscallarg(const char *) path;
@@ -329,7 +340,7 @@
#endif
int irix_sys_ioctl(struct proc *, void *, register_t *);
int irix_sys_sysmp(struct proc *, void *, register_t *);
-int svr4_sys_utssys(struct proc *, void *, register_t *);
+int irix_sys_utssys(struct proc *, void *, register_t *);
int svr4_sys_execve(struct proc *, void *, register_t *);
int sys_umask(struct proc *, void *, register_t *);
int sys_chroot(struct proc *, void *, register_t *);
@@ -398,6 +409,7 @@
int sys___posix_fchown(struct proc *, void *, register_t *);
int sys_fchmod(struct proc *, void *, register_t *);
int irix_sys_systeminfo(struct proc *, void *, register_t *);
+int irix_sys_uname(struct proc *, void *, register_t *);
int irix_sys_xstat(struct proc *, void *, register_t *);
int irix_sys_lxstat(struct proc *, void *, register_t *);
int irix_sys_fxstat(struct proc *, void *, register_t *);
diff -r 5855c249f086 -r 0971814cc275 sys/compat/irix/irix_syscalls.c
--- a/sys/compat/irix/irix_syscalls.c Sat Oct 05 23:15:58 2002 +0000
+++ b/sys/compat/irix/irix_syscalls.c Sat Oct 05 23:17:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_syscalls.c,v 1.48 2002/08/02 23:02:53 manu Exp $ */
+/* $NetBSD: irix_syscalls.c,v 1.49 2002/10/05 23:17:29 manu Exp $ */
/*
* System call names.
@@ -8,7 +8,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.48 2002/08/02 23:02:53 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.49 2002/10/05 23:17:29 manu Exp $");
#if defined(_KERNEL_OPT)
#if defined(_KERNEL_OPT)
@@ -204,7 +204,7 @@
"#154 (unimplemented wait3)", /* 154 = unimplemented wait3 */
"#155 (unimplemented socketpair)", /* 155 = unimplemented socketpair */
"systeminfo", /* 156 = systeminfo */
- "#157 (unimplemented uname)", /* 157 = unimplemented uname */
+ "uname", /* 157 = uname */
"xstat", /* 158 = xstat */
"lxstat", /* 159 = lxstat */
"fxstat", /* 160 = fxstat */
diff -r 5855c249f086 -r 0971814cc275 sys/compat/irix/irix_sysent.c
--- a/sys/compat/irix/irix_sysent.c Sat Oct 05 23:15:58 2002 +0000
+++ b/sys/compat/irix/irix_sysent.c Sat Oct 05 23:17:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_sysent.c,v 1.48 2002/08/02 23:02:54 manu Exp $ */
+/* $NetBSD: irix_sysent.c,v 1.49 2002/10/05 23:17:30 manu Exp $ */
/*
* System call switch table.
@@ -8,7 +8,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.48 2002/08/02 23:02:54 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.49 2002/10/05 23:17:30 manu Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@@ -164,8 +164,8 @@
sys_nosys }, /* 55 = unimplemented uadmin */
{ 5, s(struct irix_sys_sysmp_args), 0,
irix_sys_sysmp }, /* 56 = sysmp */
- { 4, s(struct svr4_sys_utssys_args), 0,
- svr4_sys_utssys }, /* 57 = utssys */
+ { 4, s(struct irix_sys_utssys_args), 0,
+ irix_sys_utssys }, /* 57 = utssys */
{ 0, 0, 0,
sys_nosys }, /* 58 = unimplemented */
{ 3, s(struct svr4_sys_execve_args), 0,
@@ -364,8 +364,8 @@
sys_nosys }, /* 155 = unimplemented socketpair */
{ 3, s(struct irix_sys_systeminfo_args), 0,
irix_sys_systeminfo }, /* 156 = systeminfo */
- { 0, 0, 0,
- sys_nosys }, /* 157 = unimplemented uname */
+ { 1, s(struct irix_sys_uname_args), 0,
+ irix_sys_uname }, /* 157 = uname */
{ 3, s(struct irix_sys_xstat_args), 0,
irix_sys_xstat }, /* 158 = xstat */
{ 3, s(struct irix_sys_lxstat_args), 0,
diff -r 5855c249f086 -r 0971814cc275 sys/compat/irix/irix_types.h
--- a/sys/compat/irix/irix_types.h Sat Oct 05 23:15:58 2002 +0000
+++ b/sys/compat/irix/irix_types.h Sat Oct 05 23:17:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_types.h,v 1.13 2002/06/12 20:33:21 manu Exp $ */
+/* $NetBSD: irix_types.h,v 1.14 2002/10/05 23:17:30 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -175,4 +175,23 @@
char d_name[1];
} irix_dirent64_t;
+/* From IRIX's <sys/utsname.h> */
+#define IRIX_SYS_NMLN 257
+struct irix_utsname {
+ char sysname[IRIX_SYS_NMLN];
+ char nodename[IRIX_SYS_NMLN];
+ char release[IRIX_SYS_NMLN];
+ char version[IRIX_SYS_NMLN];
+ char machine[IRIX_SYS_NMLN];
+ char m_type[IRIX_SYS_NMLN];
+ char base_rel[IRIX_SYS_NMLN];
+ char reserve5[IRIX_SYS_NMLN];
+ char reserve4[IRIX_SYS_NMLN];
+ char reserve3[IRIX_SYS_NMLN];
+ char reserve2[IRIX_SYS_NMLN];
+ char reserve1[IRIX_SYS_NMLN];
+ char reserve0[IRIX_SYS_NMLN];
+};
+
+
#endif /* _IRIX_TYPES_H_ */
diff -r 5855c249f086 -r 0971814cc275 sys/compat/irix/syscalls.master
--- a/sys/compat/irix/syscalls.master Sat Oct 05 23:15:58 2002 +0000
+++ b/sys/compat/irix/syscalls.master Sat Oct 05 23:17:29 2002 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.45 2002/06/12 20:33:21 manu Exp $
+ $NetBSD: syscalls.master,v 1.46 2002/10/05 23:17:30 manu Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -137,7 +137,7 @@
55 UNIMPL uadmin
56 STD { int irix_sys_sysmp(int cmd, void *arg1, void *arg2, \
void *arg3, void *arg4); }
-57 NOARGS { int svr4_sys_utssys(void *a1, void *a2, int sel, \
+57 STD { int irix_sys_utssys(void *a1, void *a2, int sel, \
void *a3); }
58 UNIMPL
59 NOARGS { int svr4_sys_execve(const char *path, char **argp, \
@@ -286,7 +286,7 @@
155 UNIMPL socketpair
156 STD { long irix_sys_systeminfo(int what, char *buf, \
long len); }
-157 UNIMPL uname
+157 STD { int irix_sys_uname(struct irix_utsname *name); }
158 STD { int irix_sys_xstat(const int version, \
Home |
Main Index |
Thread Index |
Old Index