Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/osf1 mprotect() and access()



details:   https://anonhg.NetBSD.org/src/rev/9327a7f4fe7b
branches:  trunk
changeset: 472393:9327a7f4fe7b
user:      cgd <cgd%NetBSD.org@localhost>
date:      Thu Apr 29 02:08:58 1999 +0000

description:
mprotect() and access()

diffstat:

 sys/compat/osf1/osf1_misc.c |  61 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 60 insertions(+), 1 deletions(-)

diffs (86 lines):

diff -r dde2eb6f3aae -r 9327a7f4fe7b sys/compat/osf1/osf1_misc.c
--- a/sys/compat/osf1/osf1_misc.c       Thu Apr 29 02:06:50 1999 +0000
+++ b/sys/compat/osf1/osf1_misc.c       Thu Apr 29 02:08:58 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_misc.c,v 1.32 1999/04/28 06:01:51 cgd Exp $ */
+/* $NetBSD: osf1_misc.c,v 1.33 1999/04/29 02:08:58 cgd Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -75,6 +75,8 @@
 #include <sys/exec.h>
 #include <sys/vnode.h>
 #include <sys/socketvar.h>
+#include <sys/resource.h>
+#include <sys/resourcevar.h>
 #include <vm/vm.h>                             /* XXX UVM headers are Cool */
 #include <uvm/uvm.h>                           /* XXX see mmap emulation */
 
@@ -377,6 +379,28 @@
 }
 
 int
+osf1_sys_mprotect(p, v, retval)
+       struct proc *p;
+       void *v;
+       register_t *retval;
+{
+       struct osf1_sys_mprotect_args *uap = v;
+       struct sys_mprotect_args a;
+       unsigned long leftovers;
+
+       SCARG(&a, addr) = SCARG(uap, addr);
+       SCARG(&a, len) = SCARG(uap, len);
+
+       /* translate prot */
+       SCARG(&a, prot) = emul_flags_translate(osf1_mmap_prot_xtab,
+           SCARG(uap, prot), &leftovers);
+       if (leftovers != 0)
+               return (EINVAL);
+
+       return sys_mprotect(p, &a, retval);
+}
+
+int
 osf1_sys_usleep_thread(p, v, retval)
        struct proc *p;
        void *v;
@@ -1405,3 +1429,38 @@
 
        return (error);
 }
+
+const struct emul_flags_xtab osf1_access_flags_xtab[] = {
+#if 0 /* pseudo-flag */
+    {  OSF1_F_OK,              OSF1_F_OK,              F_OK            },
+#endif
+    {  OSF1_X_OK,              OSF1_X_OK,              X_OK            },
+    {  OSF1_W_OK,              OSF1_W_OK,              W_OK            },
+    {  OSF1_R_OK,              OSF1_R_OK,              R_OK            },
+    {  0                                                               }
+};
+
+int
+osf1_sys_access(p, v, retval)
+       struct proc *p;
+       void *v;
+       register_t *retval;
+{
+       struct osf1_sys_access_args *uap = v;
+       struct sys_access_args a;
+       unsigned long leftovers;
+       caddr_t sg;
+
+       sg = stackgap_init(p->p_emul);
+       OSF1_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+
+       SCARG(&a, path) = SCARG(uap, path);
+
+       /* translate opt */
+       SCARG(&a, flags) = emul_flags_translate(osf1_access_flags_xtab,
+           SCARG(uap, flags), &leftovers);
+       if (leftovers != 0)
+               return (EINVAL);
+
+       return sys_access(p, &a, retval);
+}



Home | Main Index | Thread Index | Old Index