Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/osf1 shuffle (sort)



details:   https://anonhg.NetBSD.org/src/rev/1c74831ebd6e
branches:  trunk
changeset: 472699:1c74831ebd6e
user:      cgd <cgd%NetBSD.org@localhost>
date:      Wed May 05 01:51:31 1999 +0000

description:
shuffle (sort)

diffstat:

 sys/compat/osf1/osf1_descrip.c  |  120 +++++++++---------
 sys/compat/osf1/osf1_exec.c     |  150 +++++++++++-----------
 sys/compat/osf1/osf1_file.c     |  264 ++++++++++++++++++++--------------------
 sys/compat/osf1/osf1_generic.c  |   90 ++++++------
 sys/compat/osf1/osf1_ioctl.c    |   14 +-
 sys/compat/osf1/osf1_misc.c     |  166 ++++++++++++------------
 sys/compat/osf1/osf1_mmap.c     |  134 ++++++++++----------
 sys/compat/osf1/osf1_mount.c    |  108 ++++++++--------
 sys/compat/osf1/osf1_prot.c     |   66 +++++-----
 sys/compat/osf1/osf1_resource.c |   86 ++++++------
 sys/compat/osf1/osf1_signal.c   |   64 +++++----
 sys/compat/osf1/osf1_signal.h   |    4 +-
 sys/compat/osf1/osf1_socket.c   |   44 +++---
 sys/compat/osf1/osf1_time.c     |  126 +++++++++---------
 14 files changed, 720 insertions(+), 716 deletions(-)

diffs (truncated from 1800 to 300 lines):

diff -r 05bab5951c7b -r 1c74831ebd6e sys/compat/osf1/osf1_descrip.c
--- a/sys/compat/osf1/osf1_descrip.c    Wed May 05 01:21:37 1999 +0000
+++ b/sys/compat/osf1/osf1_descrip.c    Wed May 05 01:51:31 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_descrip.c,v 1.2 1999/05/04 02:12:15 cgd Exp $ */
+/* $NetBSD: osf1_descrip.c,v 1.3 1999/05/05 01:51:31 cgd Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -84,46 +84,6 @@
 #include <compat/osf1/osf1_syscallargs.h>
 #include <compat/osf1/osf1_cvt.h>
 
-/*
- * Return status information about a file descriptor.
- */
-int
-osf1_sys_fstat(p, v, retval)
-       struct proc *p;
-       void *v;
-       register_t *retval;
-{
-       struct osf1_sys_fstat_args *uap = v;
-       struct filedesc *fdp = p->p_fd;
-       struct file *fp;
-       struct stat ub;
-       struct osf1_stat oub;
-       int error;
-
-       if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles ||
-           (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
-               return (EBADF);
-       switch (fp->f_type) {
-
-       case DTYPE_VNODE:
-               error = vn_stat((struct vnode *)fp->f_data, &ub, p);
-               break;
-
-       case DTYPE_SOCKET:
-               error = soo_stat((struct socket *)fp->f_data, &ub);
-               break;
-
-       default:
-               panic("ofstat");
-               /*NOTREACHED*/
-       }
-       osf1_cvt_stat_from_native(&ub, &oub);
-       if (error == 0)
-               error = copyout((caddr_t)&oub, (caddr_t)SCARG(uap, sb),
-                   sizeof (oub));
-       return (error);
-}
-
 int
 osf1_sys_fcntl(p, v, retval)
        struct proc *p;
@@ -215,20 +175,64 @@
 }
 
 int
-osf1_sys_lseek(p, v, retval)
+osf1_sys_fpathconf(p, v, retval)
+       struct proc *p;
+       void *v;
+       register_t *retval;
+{
+       struct osf1_sys_fpathconf_args *uap = v;
+       struct sys_fpathconf_args a;
+       int error;
+
+       SCARG(&a, fd) = SCARG(uap, fd);
+
+       error = osf1_cvt_pathconf_name_to_native(SCARG(uap, name),
+           &SCARG(&a, name));
+
+       if (error == 0)
+               error = sys_fpathconf(p, &a, retval);
+
+       return (error);
+}
+
+/*
+ * Return status information about a file descriptor.
+ */
+int
+osf1_sys_fstat(p, v, retval)
        struct proc *p;
        void *v;
        register_t *retval;
 {
-       struct osf1_sys_lseek_args *uap = v;
-       struct sys_lseek_args a;
+       struct osf1_sys_fstat_args *uap = v;
+       struct filedesc *fdp = p->p_fd;
+       struct file *fp;
+       struct stat ub;
+       struct osf1_stat oub;
+       int error;
+
+       if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles ||
+           (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
+               return (EBADF);
+       switch (fp->f_type) {
 
-       SCARG(&a, fd) = SCARG(uap, fd);
-       SCARG(&a, pad) = 0;
-       SCARG(&a, offset) = SCARG(uap, offset);
-       SCARG(&a, whence) = SCARG(uap, whence);
+       case DTYPE_VNODE:
+               error = vn_stat((struct vnode *)fp->f_data, &ub, p);
+               break;
+
+       case DTYPE_SOCKET:
+               error = soo_stat((struct socket *)fp->f_data, &ub);
+               break;
 
-       return sys_lseek(p, &a, retval);
+       default:
+               panic("ofstat");
+               /*NOTREACHED*/
+       }
+       osf1_cvt_stat_from_native(&ub, &oub);
+       if (error == 0)
+               error = copyout((caddr_t)&oub, (caddr_t)SCARG(uap, sb),
+                   sizeof (oub));
+       return (error);
 }
 
 int
@@ -248,22 +252,18 @@
 }
 
 int
-osf1_sys_fpathconf(p, v, retval)
+osf1_sys_lseek(p, v, retval)
        struct proc *p;
        void *v;
        register_t *retval;
 {
-       struct osf1_sys_fpathconf_args *uap = v;
-       struct sys_fpathconf_args a;
-       int error;
+       struct osf1_sys_lseek_args *uap = v;
+       struct sys_lseek_args a;
 
        SCARG(&a, fd) = SCARG(uap, fd);
-
-       error = osf1_cvt_pathconf_name_to_native(SCARG(uap, name),
-           &SCARG(&a, name));
+       SCARG(&a, pad) = 0;
+       SCARG(&a, offset) = SCARG(uap, offset);
+       SCARG(&a, whence) = SCARG(uap, whence);
 
-       if (error == 0)
-               error = sys_fpathconf(p, &a, retval);
-
-       return (error);
+       return sys_lseek(p, &a, retval);
 }
diff -r 05bab5951c7b -r 1c74831ebd6e sys/compat/osf1/osf1_exec.c
--- a/sys/compat/osf1/osf1_exec.c       Wed May 05 01:21:37 1999 +0000
+++ b/sys/compat/osf1/osf1_exec.c       Wed May 05 01:51:31 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_exec.c,v 1.8 1999/05/01 02:57:10 cgd Exp $ */
+/* $NetBSD: osf1_exec.c,v 1.9 1999/05/05 01:51:32 cgd Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -145,6 +145,80 @@
        return (error);
 }
 
+/*
+ * copy arguments onto the stack in the normal way, then copy out
+ * any ELF-like AUX entries used by the dynamic loading scheme.
+ */
+static void *
+osf1_copyargs(pack, arginfo, stack, argp)
+       struct exec_package *pack;
+       struct ps_strings *arginfo;
+       void *stack;
+       void *argp;
+{
+       struct proc *p = curproc;                       /* XXX !!! */
+       struct osf1_exec_emul_arg *emul_arg = pack->ep_emul_arg;
+       struct osf1_auxv ai[MAX_AUX_ENTRIES], *a;
+       char *prognameloc, *loadernameloc;
+       size_t len;
+
+       stack = copyargs(pack, arginfo, stack, argp);
+       if (!stack)
+               goto bad;
+
+       a = ai;
+       memset(ai, 0, sizeof ai);
+
+       prognameloc = (char *)stack + sizeof ai;
+       if (copyoutstr(emul_arg->exec_name, prognameloc, MAXPATHLEN + 1, NULL))
+           goto bad;
+       a->a_type = OSF1_AT_EXEC_FILENAME;
+       a->a_un.a_ptr = prognameloc;
+       a++;
+
+       /*
+        * if there's a loader, push additional auxv entries on the stack.
+        */
+       if (emul_arg->flags & OSF1_EXEC_EMUL_FLAGS_HAVE_LOADER) {
+
+               loadernameloc = prognameloc + MAXPATHLEN + 1;
+               if (copyoutstr(emul_arg->loader_name, loadernameloc,
+                   MAXPATHLEN + 1, NULL))
+                       goto bad;
+               a->a_type = OSF1_AT_EXEC_LOADER_FILENAME;
+               a->a_un.a_ptr = loadernameloc;
+               a++;
+
+               a->a_type = OSF1_AT_EXEC_LOADER_FLAGS;
+               a->a_un.a_val = 0;
+                if (pack->ep_vap->va_mode & S_ISUID)
+                        a->a_un.a_val |= OSF1_LDR_EXEC_SETUID_F;
+                if (pack->ep_vap->va_mode & S_ISGID)
+                        a->a_un.a_val |= OSF1_LDR_EXEC_SETGID_F;
+               if (p->p_flag & P_TRACED)
+                        a->a_un.a_val |= OSF1_LDR_EXEC_PTRACE_F;
+               a++;
+       }
+
+       a->a_type = OSF1_AT_NULL;
+       a->a_un.a_val = 0;
+       a++;
+
+       len = (a - ai) * sizeof(struct osf1_auxv);
+       if (copyout(ai, stack, len))
+               goto bad;
+       stack = (caddr_t)stack + len;
+
+out:
+       free(pack->ep_emul_arg, M_TEMP);
+       pack->ep_emul_arg = NULL;
+       return stack;
+
+bad:
+       stack = NULL;
+       goto out;
+}
+
 static int
 osf1_exec_ecoff_dynamic(struct proc *p, struct exec_package *epp)
 {
@@ -269,77 +343,3 @@
        vrele(ldr_vp);
        return (error);
 }
-
-/*
- * copy arguments onto the stack in the normal way, then copy out
- * any ELF-like AUX entries used by the dynamic loading scheme.
- */
-static void *
-osf1_copyargs(pack, arginfo, stack, argp)
-       struct exec_package *pack;
-       struct ps_strings *arginfo;
-       void *stack;
-       void *argp;
-{
-       struct proc *p = curproc;                       /* XXX !!! */
-       struct osf1_exec_emul_arg *emul_arg = pack->ep_emul_arg;
-       struct osf1_auxv ai[MAX_AUX_ENTRIES], *a;
-       char *prognameloc, *loadernameloc;
-       size_t len;
-
-       stack = copyargs(pack, arginfo, stack, argp);
-       if (!stack)
-               goto bad;
-
-       a = ai;
-       memset(ai, 0, sizeof ai);
-
-       prognameloc = (char *)stack + sizeof ai;
-       if (copyoutstr(emul_arg->exec_name, prognameloc, MAXPATHLEN + 1, NULL))
-           goto bad;
-       a->a_type = OSF1_AT_EXEC_FILENAME;
-       a->a_un.a_ptr = prognameloc;
-       a++;
-
-       /*
-        * if there's a loader, push additional auxv entries on the stack.
-        */
-       if (emul_arg->flags & OSF1_EXEC_EMUL_FLAGS_HAVE_LOADER) {
-
-               loadernameloc = prognameloc + MAXPATHLEN + 1;
-               if (copyoutstr(emul_arg->loader_name, loadernameloc,
-                   MAXPATHLEN + 1, NULL))
-                       goto bad;
-               a->a_type = OSF1_AT_EXEC_LOADER_FILENAME;
-               a->a_un.a_ptr = loadernameloc;
-               a++;
-
-               a->a_type = OSF1_AT_EXEC_LOADER_FLAGS;
-               a->a_un.a_val = 0;



Home | Main Index | Thread Index | Old Index