Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/irix Implemented irix_sys_xstat(). This duplicate...
details: https://anonhg.NetBSD.org/src/rev/6da6132bdf01
branches: trunk
changeset: 518952:6da6132bdf01
user: manu <manu%NetBSD.org@localhost>
date: Sat Dec 08 18:08:04 2001 +0000
description:
Implemented irix_sys_xstat(). This duplicates some code already present
for svr4 compat, maybe these should be merged..
diffstat:
sys/compat/irix/files.irix | 3 +-
sys/compat/irix/irix_exec.c | 6 +-
sys/compat/irix/irix_stat.c | 175 +++++++++++++++++++++++++++++++++++++
sys/compat/irix/irix_syscall.h | 7 +-
sys/compat/irix/irix_syscallargs.h | 11 +-
sys/compat/irix/irix_syscalls.c | 8 +-
sys/compat/irix/irix_sysent.c | 10 +-
sys/compat/irix/irix_types.h | 99 ++++++++++++++++++++-
sys/compat/irix/syscalls.master | 5 +-
9 files changed, 304 insertions(+), 20 deletions(-)
diffs (truncated from 485 to 300 lines):
diff -r 26545990edcc -r 6da6132bdf01 sys/compat/irix/files.irix
--- a/sys/compat/irix/files.irix Sat Dec 08 15:01:41 2001 +0000
+++ b/sys/compat/irix/files.irix Sat Dec 08 18:08:04 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.irix,v 1.7 2001/12/08 11:17:37 manu Exp $
+# $NetBSD: files.irix,v 1.8 2001/12/08 18:08:04 manu Exp $
#
file arch/mips/mips/irix_syscall.c compat_irix
@@ -8,6 +8,7 @@
file compat/irix/irix_exec_elf32.c compat_irix & exec_elf32
file compat/irix/irix_prctl.c compat_irix
file compat/irix/irix_signal.c compat_irix
+file compat/irix/irix_stat.c compat_irix
file compat/irix/irix_sysent.c compat_irix
file compat/irix/irix_syssgi.c compat_irix
file compat/irix/irix_sysmp.c compat_irix
diff -r 26545990edcc -r 6da6132bdf01 sys/compat/irix/irix_exec.c
--- a/sys/compat/irix/irix_exec.c Sat Dec 08 15:01:41 2001 +0000
+++ b/sys/compat/irix/irix_exec.c Sat Dec 08 18:08:04 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_exec.c,v 1.7 2001/12/08 11:17:37 manu Exp $ */
+/* $NetBSD: irix_exec.c,v 1.8 2001/12/08 18:08:04 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.7 2001/12/08 11:17:37 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.8 2001/12/08 18:08:04 manu Exp $");
#ifndef ELFSIZE
#define ELFSIZE 32 /* XXX should die */
@@ -182,7 +182,7 @@
printf("irix_probe()\n");
#endif
if ((error = ELFNAME2(irix,mipsopt_signature)(p, epp, eh)) != 0)
- return error;
+ /* return error; */ error = 0;
if (itp[0]) {
if ((error = emul_find(p, NULL, epp->ep_esch->es_emul->e_path,
diff -r 26545990edcc -r 6da6132bdf01 sys/compat/irix/irix_stat.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/irix/irix_stat.c Sat Dec 08 18:08:04 2001 +0000
@@ -0,0 +1,175 @@
+/* $NetBSD: irix_stat.c,v 1.1 2001/12/08 18:08:04 manu Exp $ */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Emmanuel Dreyfus.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: irix_stat.c,v 1.1 2001/12/08 18:08:04 manu Exp $");
+
+#include <sys/errno.h>
+#include <sys/types.h>
+#include <sys/signal.h>
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/mount.h>
+#include <sys/stdint.h>
+#include <sys/stat.h>
+#include <sys/systm.h>
+#include <sys/syscallargs.h>
+
+#include <compat/common/compat_util.h>
+
+#include <compat/svr4/svr4_types.h>
+
+#include <compat/irix/irix_types.h>
+#include <compat/irix/irix_syscall.h>
+#include <compat/irix/irix_syscallargs.h>
+
+static void bsd_to_irix_stat __P((struct stat *, struct irix_stat *));
+static void bsd_to_irix_stat64 __P((struct stat *, struct irix_stat64 *));
+
+static void
+bsd_to_irix_stat(bsp, isp)
+ struct stat *bsp;
+ struct irix_stat *isp;
+{
+ memset(isp, 0, sizeof(*isp));
+ isp->ist_dev = bsp->st_dev; /* XXX translate it */
+ isp->ist_ino = bsp->st_ino;
+ isp->ist_mode = bsp->st_mode; /* XXX translate it */
+ isp->ist_nlink = bsp->st_nlink;
+ isp->ist_uid = bsp->st_uid;
+ isp->ist_gid = bsp->st_gid;
+ isp->ist_rdev = bsp->st_rdev; /* XXX translate it */
+ isp->ist_size = bsp->st_size;
+ isp->ist_atim.tv_sec = bsp->st_atimespec.tv_sec;
+ isp->ist_atim.tv_nsec = bsp->st_atimespec.tv_nsec;
+ isp->ist_mtim.tv_sec = bsp->st_mtimespec.tv_sec;
+ isp->ist_mtim.tv_nsec = bsp->st_mtimespec.tv_nsec;
+ isp->ist_ctim.tv_sec = bsp->st_ctimespec.tv_sec;
+ isp->ist_ctim.tv_nsec = bsp->st_ctimespec.tv_nsec;
+ isp->ist_size = bsp->st_size;
+ isp->ist_blocks = bsp->st_blocks;
+ isp->ist_blksize = bsp->st_blksize;
+ strcpy(isp->ist_fstype, "unknown");
+
+ return;
+}
+
+static void
+bsd_to_irix_stat64(bsp, isp)
+ struct stat *bsp;
+ struct irix_stat64 *isp;
+{
+ memset(isp, 0, sizeof(*isp));
+ isp->ist_dev = bsp->st_dev; /* XXX translate it */
+ isp->ist_ino = bsp->st_ino;
+ isp->ist_mode = bsp->st_mode; /* XXX translate it */
+ isp->ist_nlink = bsp->st_nlink;
+ isp->ist_uid = bsp->st_uid;
+ isp->ist_gid = bsp->st_gid;
+ isp->ist_rdev = bsp->st_rdev; /* XXX translate it */
+ isp->ist_size = bsp->st_size;
+ isp->ist_atim.tv_sec = bsp->st_atimespec.tv_sec;
+ isp->ist_atim.tv_nsec = bsp->st_atimespec.tv_nsec;
+ isp->ist_mtim.tv_sec = bsp->st_mtimespec.tv_sec;
+ isp->ist_mtim.tv_nsec = bsp->st_mtimespec.tv_nsec;
+ isp->ist_ctim.tv_sec = bsp->st_ctimespec.tv_sec;
+ isp->ist_ctim.tv_nsec = bsp->st_ctimespec.tv_nsec;
+ isp->ist_size = bsp->st_size;
+ isp->ist_blocks = bsp->st_blocks;
+ isp->ist_blksize = bsp->st_blksize;
+ strcpy(isp->ist_fstype, "unknown");
+
+ return;
+}
+
+int
+irix_sys_xstat(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct irix_sys_xstat_args /* {
+ syscallarg(const int) version;
+ syscallarg(const char *) path;
+ syscallarg(struct stat *) buf;
+ } */ *uap = v;
+ struct sys___stat13_args cup;
+ struct stat st;
+ caddr_t sg = stackgap_init(p->p_emul);
+ int error;
+
+ SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat));
+ CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+ SCARG(&cup, path) = SCARG(uap, path);
+
+ if ((error = sys___stat13(p, &cup, retval)) != 0)
+ return error;
+
+ if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0)
+ return error;
+
+
+ switch (SCARG(uap, version)) {
+ case IRIX__STAT_VER: {
+ struct irix_stat ist;
+
+ bsd_to_irix_stat(&st, &ist);
+ if ((error = copyout(&ist, SCARG(uap, buf),
+ sizeof (struct irix_stat))) != 0)
+ return error;
+ break;
+ }
+ case IRIX__STAT64_VER: {
+ struct irix_stat64 ist;
+
+ bsd_to_irix_stat64(&st, &ist);
+ if ((error = copyout(&ist, SCARG(uap, buf),
+ sizeof (struct irix_stat64))) != 0)
+ return error;
+ break;
+ }
+ case IRIX__R3_STAT_VER:
+ default:
+ printf("Warning: unimplemented irix_sys_xstat() version %d\n",
+ SCARG(uap, version));
+ return EINVAL;
+ break;
+ }
+
+ return 0;
+}
diff -r 26545990edcc -r 6da6132bdf01 sys/compat/irix/irix_syscall.h
--- a/sys/compat/irix/irix_syscall.h Sat Dec 08 15:01:41 2001 +0000
+++ b/sys/compat/irix/irix_syscall.h Sat Dec 08 18:08:04 2001 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: irix_syscall.h,v 1.8 2001/12/08 11:17:37 manu Exp $ */
+/* $NetBSD: irix_syscall.h,v 1.9 2001/12/08 18:08:04 manu Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.6 2001/12/02 09:23:59 manu Exp
+ * created from NetBSD: syscalls.master,v 1.7 2001/12/08 11:17:37 manu Exp
*/
/* syscall: "syscall" ret: "int" args: */
@@ -185,6 +185,9 @@
/* syscall: "mmap" ret: "void *" args: "void *" "svr4_size_t" "int" "int" "int" "svr4_off_t" */
#define IRIX_SYS_mmap 134
+/* syscall: "xstat" ret: "int" args: "const int" "const char *" "struct stat *" */
+#define IRIX_SYS_xstat 158
+
/* syscall: "sigaction" ret: "int" args: "int" "const struct svr4_sigaction *" "struct svr4_sigaction *" */
#define IRIX_SYS_sigaction 162
diff -r 26545990edcc -r 6da6132bdf01 sys/compat/irix/irix_syscallargs.h
--- a/sys/compat/irix/irix_syscallargs.h Sat Dec 08 15:01:41 2001 +0000
+++ b/sys/compat/irix/irix_syscallargs.h Sat Dec 08 18:08:04 2001 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: irix_syscallargs.h,v 1.8 2001/12/08 11:17:37 manu Exp $ */
+/* $NetBSD: irix_syscallargs.h,v 1.9 2001/12/08 18:08:04 manu Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.6 2001/12/02 09:23:59 manu Exp
+ * created from NetBSD: syscalls.master,v 1.7 2001/12/08 11:17:37 manu Exp
*/
#ifndef _IRIX_SYS__SYSCALLARGS_H_
@@ -197,6 +197,12 @@
syscallarg(svr4_off_t) pos;
};
+struct irix_sys_xstat_args {
+ syscallarg(const int) version;
+ syscallarg(const char *) path;
+ syscallarg(struct stat *) buf;
+};
+
struct svr4_sys_sigaction_args {
syscallarg(int) signum;
syscallarg(const struct svr4_sigaction *) nsa;
@@ -286,6 +292,7 @@
int irix_sys_sigreturn(struct proc *, void *, register_t *);
int irix_sys_prctl(struct proc *, void *, register_t *);
int svr4_sys_mmap(struct proc *, void *, register_t *);
+int irix_sys_xstat(struct proc *, void *, register_t *);
int svr4_sys_sigaction(struct proc *, void *, register_t *);
int svr4_sys_sigpending(struct proc *, void *, register_t *);
int svr4_sys_sigprocmask(struct proc *, void *, register_t *);
diff -r 26545990edcc -r 6da6132bdf01 sys/compat/irix/irix_syscalls.c
--- a/sys/compat/irix/irix_syscalls.c Sat Dec 08 15:01:41 2001 +0000
+++ b/sys/compat/irix/irix_syscalls.c Sat Dec 08 18:08:04 2001 +0000
@@ -1,14 +1,14 @@
-/* $NetBSD: irix_syscalls.c,v 1.8 2001/12/08 11:17:37 manu Exp $ */
+/* $NetBSD: irix_syscalls.c,v 1.9 2001/12/08 18:08:04 manu Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.6 2001/12/02 09:23:59 manu Exp
+ * created from NetBSD: syscalls.master,v 1.7 2001/12/08 11:17:37 manu Exp
*/
Home |
Main Index |
Thread Index |
Old Index