Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/chs-ubc2]: src/sys/compat Update from trunk.
details: https://anonhg.NetBSD.org/src/rev/c0f088eb219e
branches: chs-ubc2
changeset: 471430:c0f088eb219e
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon Aug 02 21:54:17 1999 +0000
description:
Update from trunk.
diffstat:
sys/compat/svr4/svr4_exec.h | 9 +-
sys/compat/svr4/svr4_misc.c | 25 ++++----
sys/compat/ultrix/syscalls.master | 6 +-
sys/compat/ultrix/ultrix_flock.h | 12 ++++
sys/compat/ultrix/ultrix_misc.c | 114 +++++++++++++++++++++++++++++++++++++-
5 files changed, 145 insertions(+), 21 deletions(-)
diffs (281 lines):
diff -r 65cc766c3728 -r c0f088eb219e sys/compat/svr4/svr4_exec.h
--- a/sys/compat/svr4/svr4_exec.h Mon Aug 02 21:53:31 1999 +0000
+++ b/sys/compat/svr4/svr4_exec.h Mon Aug 02 21:54:17 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_exec.h,v 1.11.8.1 1999/06/21 01:09:52 thorpej Exp $ */
+/* $NetBSD: svr4_exec.h,v 1.11.8.2 1999/08/02 21:54:17 thorpej Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -49,7 +49,8 @@
* The following is horrible; there must be a better way. I need to
* play with brk(2) a bit more.
*/
-#ifdef i386
+
+#ifdef __i386__
/*
* I cannot load the interpreter after the data segment because brk(2)
* breaks. I have to load it somewhere before. Programs start at
@@ -65,7 +66,7 @@
#define SVR4_INTERP_ADDR 0x01000000
#endif
-#ifdef sparc
+#ifdef __sparc__
/*
* Here programs load at 0x00010000, so I load the interpreter far after
* the end of the data segment.
@@ -74,7 +75,7 @@
#endif
#ifndef SVR4_INTERP_ADDR
-# define SVR4_INTERP_ADDR 0
+# define SVR4_INTERP_ADDR ELFDEFNNAME(NO_ADDR)
#endif
void svr4_setregs __P((struct proc *, struct exec_package *, u_long));
diff -r 65cc766c3728 -r c0f088eb219e sys/compat/svr4/svr4_misc.c
--- a/sys/compat/svr4/svr4_misc.c Mon Aug 02 21:53:31 1999 +0000
+++ b/sys/compat/svr4/svr4_misc.c Mon Aug 02 21:54:17 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_misc.c,v 1.75.4.1 1999/06/21 01:09:52 thorpej Exp $ */
+/* $NetBSD: svr4_misc.c,v 1.75.4.2 1999/08/02 21:54:17 thorpej Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -891,18 +891,22 @@
svr4_pfind(pid)
pid_t pid;
{
- struct proc *p;
+ struct proc *p = NULL;
+
+ proclist_lock_read();
/* look in the live processes */
if ((p = pfind(pid)) != NULL)
- return p;
+ goto out;
/* look in the zombies */
for (p = zombproc.lh_first; p != 0; p = p->p_list.le_next)
if (p->p_pid == pid)
- return p;
+ goto out;
- return NULL;
+ out:
+ proclist_unlock_read();
+ return p;
}
@@ -1117,8 +1121,7 @@
register_t *retval;
{
struct svr4_sys_waitsys_args *uap = v;
- int nfound;
- int error;
+ int nfound, error, s;
struct proc *q, *t;
@@ -1195,7 +1198,9 @@
*/
leavepgrp(q);
+ s = proclist_lock_write();
LIST_REMOVE(q, p_list); /* off zombproc */
+ proclist_unlock_write(s);
LIST_REMOVE(q, p_sibling);
@@ -1218,12 +1223,6 @@
if (q->p_textvp)
vrele(q->p_textvp);
- /*
- * Give machine-dependent layer a chance
- * to free anything that cpu_exit couldn't
- * release while still running in process context.
- */
- cpu_wait(q);
pool_put(&proc_pool, q);
nprocs--;
return 0;
diff -r 65cc766c3728 -r c0f088eb219e sys/compat/ultrix/syscalls.master
--- a/sys/compat/ultrix/syscalls.master Mon Aug 02 21:53:31 1999 +0000
+++ b/sys/compat/ultrix/syscalls.master Mon Aug 02 21:54:17 1999 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.30 1999/02/09 20:30:38 christos Exp $
+ $NetBSD: syscalls.master,v 1.30.4.1 1999/08/02 21:55:13 thorpej Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -119,7 +119,7 @@
66 NOARGS { int sys_vfork(void); }
67 OBSOL vread
68 OBSOL vwrite
-69 NOARGS { int sys_sbrk(int incr); }
+69 NOARGS { int sys_sbrk(intptr_t incr); }
70 NOARGS { int sys_sstk(int incr); }
71 STD { int ultrix_sys_mmap(caddr_t addr, size_t len, \
int prot, u_int flags, int fd, long pos); }
@@ -150,7 +150,7 @@
89 NOARGS { int compat_43_sys_getdtablesize(void); }
90 NOARGS { int sys_dup2(u_int from, u_int to); }
91 UNIMPL getdopt
-92 NOARGS { int sys_fcntl(int fd, int cmd, void *arg); }
+92 STD { int ultrix_sys_fcntl(int fd, int cmd, void *arg); }
93 STD { int ultrix_sys_select(u_int nd, fd_set *in, fd_set *ou, \
fd_set *ex, struct timeval *tv); }
94 UNIMPL setdopt
diff -r 65cc766c3728 -r c0f088eb219e sys/compat/ultrix/ultrix_flock.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/ultrix/ultrix_flock.h Mon Aug 02 21:54:17 1999 +0000
@@ -0,0 +1,12 @@
+/* $NetBSD: ultrix_flock.h,v 1.1.2.2 1999/08/02 21:55:14 thorpej Exp $ */
+
+struct ultrix_flock {
+ short l_type;
+#define ULTRIX_F_RDLCK 1
+#define ULTRIX_F_WRLCK 2
+#define ULTRIX_F_UNLCK 3
+ short l_whence;
+ long l_start;
+ long l_len;
+ int l_pid;
+};
diff -r 65cc766c3728 -r c0f088eb219e sys/compat/ultrix/ultrix_misc.c
--- a/sys/compat/ultrix/ultrix_misc.c Mon Aug 02 21:53:31 1999 +0000
+++ b/sys/compat/ultrix/ultrix_misc.c Mon Aug 02 21:54:17 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ultrix_misc.c,v 1.50.4.1 1999/06/21 01:10:16 thorpej Exp $ */
+/* $NetBSD: ultrix_misc.c,v 1.50.4.2 1999/08/02 21:55:14 thorpej Exp $ */
/*
* Copyright (c) 1995, 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -139,6 +139,10 @@
#include <sys/conf.h> /* iszerodev() */
#include <sys/socketvar.h> /* sosetopt() */
+#include <compat/ultrix/ultrix_flock.h>
+
+static int ultrix_to_bsd_flock __P((struct ultrix_flock *, struct flock *));
+static void bsd_to_ultrix_flock __P((struct flock *, struct ultrix_flock *));
extern struct sysent ultrix_sysent[];
extern char *ultrix_syscallnames[];
@@ -787,3 +791,111 @@
return (EOPNOTSUPP);
#endif /* SYSVSHM */
}
+
+static int
+ultrix_to_bsd_flock(ufl, fl)
+ struct ultrix_flock *ufl;
+ struct flock *fl;
+{
+
+ fl->l_start = ufl->l_start;
+ fl->l_len = ufl->l_len;
+ fl->l_pid = ufl->l_pid;
+ fl->l_whence = ufl->l_whence;
+
+ switch (ufl->l_type) {
+ case ULTRIX_F_RDLCK:
+ fl->l_type = F_RDLCK;
+ break;
+ case ULTRIX_F_WRLCK:
+ fl->l_type = F_WRLCK;
+ break;
+ case ULTRIX_F_UNLCK:
+ fl->l_type = F_UNLCK;
+ break;
+ default:
+ return (EINVAL);
+ }
+
+ return (0);
+}
+
+static void
+bsd_to_ultrix_flock(fl, ufl)
+ struct flock *fl;
+ struct ultrix_flock *ufl;
+{
+
+ ufl->l_start = fl->l_start;
+ ufl->l_len = fl->l_len;
+ ufl->l_pid = fl->l_pid;
+ ufl->l_whence = fl->l_whence;
+
+ switch (fl->l_type) {
+ case F_RDLCK:
+ ufl->l_type = ULTRIX_F_RDLCK;
+ break;
+ case F_WRLCK:
+ ufl->l_type = ULTRIX_F_WRLCK;
+ break;
+ case F_UNLCK:
+ ufl->l_type = ULTRIX_F_UNLCK;
+ break;
+ }
+}
+
+int
+ultrix_sys_fcntl(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct ultrix_sys_fcntl_args *uap = v;
+ int error;
+ struct ultrix_flock ufl;
+ struct flock fl, *flp;
+ caddr_t sg;
+ struct sys_fcntl_args *args, fca;
+
+ switch (SCARG(uap, cmd)) {
+ case F_GETLK:
+ case F_SETLK:
+ case F_SETLKW:
+ error = copyin(SCARG(uap, arg), &ufl, sizeof(ufl));
+ if (error)
+ return (error);
+ error = ultrix_to_bsd_flock(&ufl, &fl);
+ if (error)
+ return (error);
+ sg = stackgap_init(p->p_emul);
+ flp = (struct flock *)stackgap_alloc(&sg, sizeof(*flp));
+ error = copyout(&fl, flp, sizeof(*flp));
+ if (error)
+ return (error);
+
+ SCARG(&fca, fd) = SCARG(uap, fd);
+ SCARG(&fca, cmd) = SCARG(uap, cmd);
+ SCARG(&fca, arg) = flp;
+ args = &fca;
+ break;
+ default:
+ args = v;
+ break;
+ }
+
+ error = sys_fcntl(p, args, retval);
+ if (error)
+ return (error);
+
+ switch (SCARG(uap, cmd)) {
+ case F_GETLK:
+ error = copyin(flp, &fl, sizeof(fl));
+ if (error)
+ return (error);
+ bsd_to_ultrix_flock(&fl, &ufl);
+ error = copyout(&ufl, SCARG(uap, arg), sizeof(ufl));
+ break;
+ }
+
+ return (error);
+}
Home |
Main Index |
Thread Index |
Old Index