Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/irix bug for bug emulation of IRIX: on some devic...



details:   https://anonhg.NetBSD.org/src/rev/8660cbba1b1f
branches:  trunk
changeset: 526479:8660cbba1b1f
user:      manu <manu%NetBSD.org@localhost>
date:      Sat May 04 07:45:05 2002 +0000

description:
bug for bug emulation of IRIX: on some device, including
/dev/usemaclone, fchmod returns 0 on faillure, and libc
depends on that behavior.

diffstat:

 sys/compat/irix/irix_fcntl.c       |  51 ++++++++++++++++++++++++++++++++++++-
 sys/compat/irix/irix_syscall.h     |   4 +-
 sys/compat/irix/irix_syscallargs.h |  11 +++++--
 sys/compat/irix/irix_syscalls.c    |   6 ++--
 sys/compat/irix/irix_sysent.c      |  10 +++---
 sys/compat/irix/syscalls.master    |   4 +-
 6 files changed, 69 insertions(+), 17 deletions(-)

diffs (209 lines):

diff -r e750bfe6e8bd -r 8660cbba1b1f sys/compat/irix/irix_fcntl.c
--- a/sys/compat/irix/irix_fcntl.c      Sat May 04 07:40:59 2002 +0000
+++ b/sys/compat/irix/irix_fcntl.c      Sat May 04 07:45:05 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: irix_fcntl.c,v 1.6 2002/04/20 20:38:21 manu Exp $ */
+/*     $NetBSD: irix_fcntl.c,v 1.7 2002/05/04 07:45:07 manu Exp $ */
 
 /*-
  * Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@@ -37,13 +37,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_fcntl.c,v 1.6 2002/04/20 20:38:21 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_fcntl.c,v 1.7 2002/05/04 07:45:07 manu Exp $");
 
 #include <sys/types.h>
 #include <sys/signal.h>
 #include <sys/param.h>
 #include <sys/mount.h>
 #include <sys/proc.h>
+#include <sys/conf.h>
 #include <sys/vnode.h>
 #include <sys/file.h>
 #include <sys/filedesc.h>
@@ -51,9 +52,12 @@
 #include <sys/fcntl.h>
 #include <sys/syscallargs.h>
 
+#include <miscfs/specfs/specdev.h>
+
 #include <compat/irix/irix_types.h>
 #include <compat/irix/irix_signal.h>
 #include <compat/irix/irix_fcntl.h>
+#include <compat/irix/irix_usema.h>
 #include <compat/irix/irix_syscallargs.h>
 
 #include <compat/svr4/svr4_types.h>
@@ -252,3 +256,46 @@
        SCARG(&ft, fd) = fd;
        return sys_ftruncate(p, &ft, retval);
 }
+
+int
+irix_sys_fchmod(p, v, retval)
+       struct proc *p;
+       void *v;
+       register_t *retval;
+{
+       struct irix_sys_fchmod_args /* {
+               syscallarg(int) fd;
+               syscallarg(int) mode;
+       } */ *uap = v;
+       struct sys_fchmod_args cup;
+       struct file *fp;
+       int error;
+       int major, minor;
+       struct vnode *vp;
+
+       SCARG(&cup, fd) = SCARG(uap, fd);
+       SCARG(&cup, mode) = SCARG(uap, mode);
+       error = sys_fchmod(p, &cup, retval);
+
+       /* getvnode() will use the descriptor for us */
+       if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
+               return (error);
+
+       /* 
+        * bug for bug emulation of IRIX: on some device, including
+        * /dev/usemaclone, fchmod returns 0 on faillure, and libc
+        * depends on that behavior.
+        */
+       vp = (struct vnode *)(fp->f_data);
+       if (vp->v_type == VCHR) {
+               major = major(vp->v_specinfo->si_rdev);
+               minor = minor(vp->v_specinfo->si_rdev);
+               /* XXX is there a better way to identify a given driver ? */
+               if (cdevsw[major].d_open == *irix_usemaopen &&
+                   minor == IRIX_USEMACLNDEV_MINOR)
+                       error = 0;
+       }
+
+       FILE_UNUSE(fp, p);
+       return (error);
+}
diff -r e750bfe6e8bd -r 8660cbba1b1f sys/compat/irix/irix_syscall.h
--- a/sys/compat/irix/irix_syscall.h    Sat May 04 07:40:59 2002 +0000
+++ b/sys/compat/irix/irix_syscall.h    Sat May 04 07:45:05 2002 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: irix_syscall.h,v 1.42 2002/04/29 14:40:23 manu Exp $ */
+/* $NetBSD: irix_syscall.h,v 1.43 2002/05/04 07:45:06 manu Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from        NetBSD: syscalls.master,v 1.40 2002/04/28 20:23:22 manu Exp 
+ * created from        NetBSD: syscalls.master,v 1.41 2002/04/29 14:40:23 manu Exp 
  */
 
 /* syscall: "syscall" ret: "int" args: */
diff -r e750bfe6e8bd -r 8660cbba1b1f sys/compat/irix/irix_syscallargs.h
--- a/sys/compat/irix/irix_syscallargs.h        Sat May 04 07:40:59 2002 +0000
+++ b/sys/compat/irix/irix_syscallargs.h        Sat May 04 07:45:05 2002 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: irix_syscallargs.h,v 1.42 2002/04/29 14:40:23 manu Exp $ */
+/* $NetBSD: irix_syscallargs.h,v 1.43 2002/05/04 07:45:07 manu Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from        NetBSD: syscalls.master,v 1.40 2002/04/28 20:23:22 manu Exp 
+ * created from        NetBSD: syscalls.master,v 1.41 2002/04/29 14:40:23 manu Exp 
  */
 
 #ifndef _IRIX_SYS__SYSCALLARGS_H_
@@ -115,6 +115,11 @@
        syscallarg(int) pgid;
 };
 
+struct irix_sys_fchmod_args {
+       syscallarg(int) fd;
+       syscallarg(int) mode;
+};
+
 struct irix_sys_systeminfo_args {
        syscallarg(int) what;
        syscallarg(char *) buf;
@@ -336,7 +341,7 @@
 int    sys_fsync(struct proc *, void *, register_t *);
 int    sys_fchdir(struct proc *, void *, register_t *);
 int    sys___posix_fchown(struct proc *, void *, register_t *);
-int    sys_fchmod(struct proc *, void *, register_t *);
+int    irix_sys_fchmod(struct proc *, void *, register_t *);
 int    irix_sys_systeminfo(struct proc *, void *, register_t *);
 int    irix_sys_xstat(struct proc *, void *, register_t *);
 int    irix_sys_lxstat(struct proc *, void *, register_t *);
diff -r e750bfe6e8bd -r 8660cbba1b1f sys/compat/irix/irix_syscalls.c
--- a/sys/compat/irix/irix_syscalls.c   Sat May 04 07:40:59 2002 +0000
+++ b/sys/compat/irix/irix_syscalls.c   Sat May 04 07:45:05 2002 +0000
@@ -1,14 +1,14 @@
-/* $NetBSD: irix_syscalls.c,v 1.42 2002/04/29 14:40:23 manu Exp $ */
+/* $NetBSD: irix_syscalls.c,v 1.43 2002/05/04 07:45:06 manu Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from        NetBSD: syscalls.master,v 1.40 2002/04/28 20:23:22 manu Exp 
+ * created from        NetBSD: syscalls.master,v 1.41 2002/04/29 14:40:23 manu Exp 
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.42 2002/04/29 14:40:23 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.43 2002/05/04 07:45:06 manu Exp $");
 
 #if defined(_KERNEL_OPT)
 #if defined(_KERNEL_OPT)
diff -r e750bfe6e8bd -r 8660cbba1b1f sys/compat/irix/irix_sysent.c
--- a/sys/compat/irix/irix_sysent.c     Sat May 04 07:40:59 2002 +0000
+++ b/sys/compat/irix/irix_sysent.c     Sat May 04 07:45:05 2002 +0000
@@ -1,14 +1,14 @@
-/* $NetBSD: irix_sysent.c,v 1.42 2002/04/29 14:40:23 manu Exp $ */
+/* $NetBSD: irix_sysent.c,v 1.43 2002/05/04 07:45:07 manu Exp $ */
 
 /*
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from        NetBSD: syscalls.master,v 1.40 2002/04/28 20:23:22 manu Exp 
+ * created from        NetBSD: syscalls.master,v 1.41 2002/04/29 14:40:23 manu Exp 
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.42 2002/04/29 14:40:23 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.43 2002/05/04 07:45:07 manu Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -356,8 +356,8 @@
            sys_nosys },                        /* 151 = unimplemented cachectl */
        { 3, s(struct sys___posix_fchown_args), 0,
            sys___posix_fchown },               /* 152 = fchown */
-       { 2, s(struct sys_fchmod_args), 0,
-           sys_fchmod },                       /* 153 = fchmod */
+       { 2, s(struct irix_sys_fchmod_args), 0,
+           irix_sys_fchmod },                  /* 153 = fchmod */
        { 0, 0, 0,
            sys_nosys },                        /* 154 = unimplemented wait3 */
        { 0, 0, 0,
diff -r e750bfe6e8bd -r 8660cbba1b1f sys/compat/irix/syscalls.master
--- a/sys/compat/irix/syscalls.master   Sat May 04 07:40:59 2002 +0000
+++ b/sys/compat/irix/syscalls.master   Sat May 04 07:45:05 2002 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.41 2002/04/29 14:40:23 manu Exp $
+       $NetBSD: syscalls.master,v 1.42 2002/05/04 07:45:05 manu Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -275,7 +275,7 @@
 151    UNIMPL          cachectl
 152    NOARGS          { int sys___posix_fchown(int fd, int uid, int gid); } \
                            fchown
-153    NOARGS          { int sys_fchmod(int fd, int mode); }
+153    STD             { int irix_sys_fchmod(int fd, int mode); }
 154    UNIMPL          wait3
 155    UNIMPL          socketpair
 156    STD             { long irix_sys_systeminfo(int what, char *buf, \



Home | Main Index | Thread Index | Old Index