Subject: LWP'ifying compat_irix
To: None <port-sgimips@netbsd.org>
From: Rafal Boni <rafal.boni@eDial.com>
List: port-sgimips
Date: 01/21/2003 19:39:54
Here's my 90% attempt at LPW'ifying compat_irix; it's not complete because
I wasn't sure what to do with the share group/prctl stuff.  I'll look at
that a bit more and will send anything I have on, but help would be very
much appreciated.

Thanks to Scott Taylor for pointing out that this was b0rken...

--rafal

Index: arch/mips/include/svr4_machdep.h
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/include/svr4_machdep.h,v
retrieving revision 1.2
diff -u -p -r1.2 svr4_machdep.h
--- arch/mips/include/svr4_machdep.h	2002/03/05 14:12:30	1.2
+++ arch/mips/include/svr4_machdep.h	2003/01/22 00:28:03
@@ -74,8 +74,8 @@ typedef struct svr4_mcontext {
 } svr4_mcontext_t;
 
 #ifdef _KERNEL
-int svr4_setmcontext(struct proc *, svr4_mcontext_t *, unsigned long);
-void *svr4_getmcontext(struct proc *, svr4_mcontext_t *, unsigned long *);
+int svr4_setmcontext(struct lwp *, svr4_mcontext_t *, unsigned long);
+void *svr4_getmcontext(struct lwp *, svr4_mcontext_t *, unsigned long *);
 #endif
 
 
Index: arch/mips/mips/svr4_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/mips/svr4_machdep.c,v
retrieving revision 1.4
diff -u -p -r1.4 svr4_machdep.c
--- arch/mips/mips/svr4_machdep.c	2003/01/17 23:36:18	1.4
+++ arch/mips/mips/svr4_machdep.c	2003/01/22 00:28:03
@@ -75,8 +75,8 @@
  * XXX This should be filled later 
  */
 int
-svr4_setmcontext(p, mc, flags)
-	struct proc *p;
+svr4_setmcontext(l, mc, flags)
+	struct lwp *l;
 	svr4_mcontext_t *mc;
 	unsigned long flags;
 {
@@ -85,8 +85,8 @@ svr4_setmcontext(p, mc, flags)
 }
 
 void *  
-svr4_getmcontext(p, mc, flags)
-	struct proc *p;
+svr4_getmcontext(l, mc, flags)
+	struct lwp *l;
 	svr4_mcontext_t *mc;
 	unsigned long *flags;
 {    
Index: compat/irix/irix_dirent.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_dirent.c,v
retrieving revision 1.7
diff -u -p -r1.7 irix_dirent.c
--- compat/irix/irix_dirent.c	2002/03/09 13:32:12	1.7
+++ compat/irix/irix_dirent.c	2003/01/22 00:28:13
@@ -71,8 +71,8 @@ __KERNEL_RCSID(0, "$NetBSD: irix_dirent.
 #define SVR4_NAMEOFF(dp)       ((char *)&(dp)->d_name - (char *)dp)
 
 int
-irix_sys_ngetdents(p, v, retval)
-	struct proc *p;
+irix_sys_ngetdents(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -82,6 +82,7 @@ irix_sys_ngetdents(p, v, retval)
 		syscallarg(unsigned short) nbyte;
 		syscallarg(int *) eof;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	struct dirent *bdp;
 	struct vnode *vp;
 	caddr_t inp, buf;	/* BSD-format */
@@ -200,8 +201,8 @@ out1:
 }
 
 int
-irix_sys_getdents(p, v, retval)
-	struct proc *p;
+irix_sys_getdents(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -218,7 +219,7 @@ irix_sys_getdents(p, v, retval)
 	SCARG(&cup, nbyte) = SCARG(uap, nbyte);
 	SCARG(&cup, eof) = NULL;
 
-	return irix_sys_ngetdents(p, (void *)&cup, retval);
+	return irix_sys_ngetdents(l, (void *)&cup, retval);
 }
 
 
@@ -227,8 +228,8 @@ irix_sys_getdents(p, v, retval)
  * 32 bit versions (only 3 lines of diff)
  */
 int
-irix_sys_ngetdents64(p, v, retval)
-	struct proc *p;
+irix_sys_ngetdents64(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -239,6 +240,7 @@ irix_sys_ngetdents64(p, v, retval)
 		syscallarg(int *) eof;
 	} */ *uap = v;
 	struct dirent *bdp;
+	struct proc *p = l->l_proc;
 	struct vnode *vp;
 	caddr_t inp, buf;	/* BSD-format */
 	int len, reclen;	/* BSD-format */
@@ -352,8 +354,8 @@ out1:
 }
 
 int
-irix_sys_getdents64(p, v, retval)
-	struct proc *p;
+irix_sys_getdents64(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -370,5 +372,5 @@ irix_sys_getdents64(p, v, retval)
 	SCARG(&cup, nbyte) = SCARG(uap, nbyte);
 	SCARG(&cup, eof) = NULL;
 
-	return irix_sys_ngetdents64(p, (void *)&cup, retval);
+	return irix_sys_ngetdents64(l, (void *)&cup, retval);
 }
Index: compat/irix/irix_exec.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_exec.c,v
retrieving revision 1.26
diff -u -p -r1.26 irix_exec.c
--- compat/irix/irix_exec.c	2002/11/30 13:18:13	1.26
+++ compat/irix/irix_exec.c	2003/01/22 00:28:13
@@ -111,12 +111,12 @@ const struct emul emul_irix = {
  * set registers on exec for N32 applications 
  */
 void
-irix_n32_setregs(p, pack, stack)
-	struct proc *p;
+irix_n32_setregs(l, pack, stack)
+	struct lwp *l;
 	struct exec_package *pack;
 	u_long stack;
 {
-	struct frame *f = (struct frame *)p->p_md.md_regs;
+	struct frame *f = (struct frame *)l->l_md.md_regs;
 	
 	/* Enable 64 bit instructions (eg: sd) */
 	f->f_regs[SR] |= MIPS3_SR_UX; 
Index: compat/irix/irix_exec.h
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_exec.h,v
retrieving revision 1.16
diff -u -p -r1.16 irix_exec.h
--- compat/irix/irix_exec.h	2002/11/30 13:18:13	1.16
+++ compat/irix/irix_exec.h	2003/01/22 00:28:13
@@ -104,7 +104,7 @@ int irix_elf64_probe __P((struct proc *,
     char *, vaddr_t *));
 #endif
 
-void irix_n32_setregs __P((struct proc *, struct exec_package *, u_long));
+void irix_n32_setregs __P((struct lwp *, struct exec_package *, u_long));
 
 extern const struct emul emul_irix;
 extern const struct emul emul_irix;
Index: compat/irix/irix_fcntl.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_fcntl.c,v
retrieving revision 1.11
diff -u -p -r1.11 irix_fcntl.c
--- compat/irix/irix_fcntl.c	2003/01/18 07:44:50	1.11
+++ compat/irix/irix_fcntl.c	2003/01/22 00:28:13
@@ -69,13 +69,13 @@ __KERNEL_RCSID(0, "$NetBSD: irix_fcntl.c
 #include <compat/svr4/svr4_fcntl.h>
 #include <compat/svr4/svr4_syscallargs.h>
 
-static int fd_truncate __P((struct proc *, int, int, off_t, register_t *));
+static int fd_truncate __P((struct lwp *, int, int, off_t, register_t *));
 static int bsd_to_irix_fcntl_flags __P((int));
 static int irix_to_bsd_fcntl_flags __P((int));
 
 int
-irix_sys_lseek64(p, v, retval)
-	struct proc *p;
+irix_sys_lseek64(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -106,12 +106,12 @@ irix_sys_lseek64(p, v, retval)
 	SCARG(&cup, offset) = SCARG(uap, offset);
 	SCARG(&cup, whence) = SCARG(uap, whence);
 
-	return sys_lseek(p, (void *)&cup, retval);
+	return sys_lseek(l, (void *)&cup, retval);
 }
 
 int
-irix_sys_fcntl(p, v, retval)
-	struct proc *p;
+irix_sys_fcntl(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -133,7 +133,7 @@ irix_sys_fcntl(p, v, retval)
 		if ((error = copyin(SCARG(uap, arg), &fl, sizeof(fl))) != 0)
 			return error;
 
-		return fd_truncate(p, SCARG(uap, fd), 
+		return fd_truncate(l, SCARG(uap, fd), 
 		    fl.l_whence, fl.l_start, retval);
 		break;
 	}
@@ -145,7 +145,7 @@ irix_sys_fcntl(p, v, retval)
 		if ((error = copyin(SCARG(uap, arg), &fl, sizeof(fl))) != 0)
 			return error;
 
-		return fd_truncate(p, SCARG(uap, fd), 
+		return fd_truncate(l, SCARG(uap, fd), 
 		    fl.l_whence, fl.l_start, retval);
 		break;
 	}
@@ -162,7 +162,7 @@ irix_sys_fcntl(p, v, retval)
 		SCARG(&cup, fd) = SCARG(uap, fd);
 		SCARG(&cup, cmd) = F_GETFL;
 		SCARG(&cup, arg) = SCARG(uap, arg);
-		if ((error = sys_fcntl(p, &cup, retval)) != 0)
+		if ((error = sys_fcntl(l, &cup, retval)) != 0)
 			return error;
 		*retval = bsd_to_irix_fcntl_flags(*retval);
 		return 0;
@@ -180,7 +180,7 @@ irix_sys_fcntl(p, v, retval)
 		SCARG(&cup, arg) = 
 		    (char *)irix_to_bsd_fcntl_flags((int)SCARG(uap, arg));
 		SCARG(&cup, cmd) = F_SETFL;
-		return sys_fcntl(p, &cup, retval);
+		return sys_fcntl(l, &cup, retval);
 		break;
 
 	case SVR4_F_DUPFD:
@@ -235,17 +235,18 @@ irix_sys_fcntl(p, v, retval)
 	SCARG(&cup, fd) = SCARG(uap, fd);
 	SCARG(&cup, cmd) = cmd;
 	SCARG(&cup, arg) = SCARG(uap, arg);
-	return svr4_sys_fcntl(p, &cup, retval);
+	return svr4_sys_fcntl(l, &cup, retval);
 }
 	
 static int
-fd_truncate(p, fd, whence, start, retval)
-	struct proc *p;
+fd_truncate(l, fd, whence, start, retval)
+	struct lwp *l;
 	int fd;
 	int whence;
 	off_t start;
 	register_t *retval;
 {	
+	struct proc *p = l->l_proc;
 	struct filedesc *fdp = p->p_fd;
 	struct file *fp;
 	struct vnode *vp;
@@ -281,12 +282,12 @@ fd_truncate(p, fd, whence, start, retval
 	}
 
 	SCARG(&ft, fd) = fd;
-	return sys_ftruncate(p, &ft, retval);
+	return sys_ftruncate(l, &ft, retval);
 }
 
 int
-irix_sys_open(p, v, retval)
-	struct proc *p;
+irix_sys_open(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -296,13 +297,14 @@ irix_sys_open(p, v, retval)
 		syscallarg(mode_t) mode;
 	} */ *uap = v;
 	extern const struct cdevsw irix_usema_cdevsw;
+	struct proc *p = l->l_proc;
 	int error;
 	int fd;
 	struct file *fp;
 	struct vnode *vp;
 	struct vnode *nvp;
 
-	if ((error = svr4_sys_open(p, v, retval)) != 0)
+	if ((error = svr4_sys_open(l, v, retval)) != 0)
 		return error;
 
 	fd = (int)*retval;
Index: compat/irix/irix_ioctl.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_ioctl.c,v
retrieving revision 1.5
diff -u -p -r1.5 irix_ioctl.c
--- compat/irix/irix_ioctl.c	2002/10/05 21:29:02	1.5
+++ compat/irix/irix_ioctl.c	2003/01/22 00:28:13
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: irix_ioctl.c
 #include <sys/ioctl.h>
 #include <sys/vnode.h>
 #include <sys/types.h>
+#include <sys/sa.h>
 #include <sys/syscallargs.h>
 #include <sys/conf.h>
 
@@ -71,8 +72,8 @@ __KERNEL_RCSID(0, "$NetBSD: irix_ioctl.c
 #include <compat/irix/irix_syscallargs.h>
 
 int
-irix_sys_ioctl(p, v, retval)
-	struct proc *p;
+irix_sys_ioctl(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -82,6 +83,7 @@ irix_sys_ioctl(p, v, retval)
 		syscallarg(caddr_t) data;
 	} */ *uap = v;
 	extern const struct cdevsw irix_usema_cdevsw;
+	struct proc *p = l->l_proc;
 	u_long	cmd;
 	caddr_t data;
 	struct file *fp;
@@ -185,7 +187,7 @@ out:
 		break;
 
 	default: /* Fallback to the standard SVR4 ioctl's */
-		error = svr4_sys_ioctl(p, v, retval);
+		error = svr4_sys_ioctl(l, v, retval);
 		break;
 	}
 
Index: compat/irix/irix_misc.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_misc.c,v
retrieving revision 1.4
diff -u -p -r1.4 irix_misc.c
--- compat/irix/irix_misc.c	2002/11/09 09:03:58	1.4
+++ compat/irix/irix_misc.c	2003/01/22 00:28:13
@@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: irix_misc.c,
 #include <sys/kernel.h>
 #include <sys/proc.h>
 #include <sys/mount.h>
-
+#include <sys/sa.h>
 #include <sys/syscallargs.h>
 
 #include <compat/svr4/svr4_types.h>
@@ -67,8 +67,8 @@ __KERNEL_RCSID(0, "$NetBSD: irix_misc.c,
  * Maybe consider moving this to sys/compat/common/compat_util.c?
  */
 int
-irix_sys_setpgrp(p, v, retval)
-	struct proc *p; 
+irix_sys_setpgrp(l, v, retval)
+	struct lwp *l; 
 	void *v;
 	register_t *retval;
 {
@@ -76,6 +76,7 @@ irix_sys_setpgrp(p, v, retval)
 		syscallarg(int) pid;
 		syscallarg(int) pgid;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
  
 	/*
 	 * difference to our setpgid call is to include backwards  
@@ -85,16 +86,16 @@ irix_sys_setpgrp(p, v, retval)
 	 */
 	if (!SCARG(uap, pgid) &&
 	    (!SCARG(uap, pid) || SCARG(uap, pid) == p->p_pid))
-		return sys_setsid(p, uap, retval);
+		return sys_setsid(l, uap, retval);
 	else
-		return sys_setpgid(p, uap, retval);
+		return sys_setpgid(l, uap, retval);
 }
 
 #define BUF_SIZE 16
 
 int
-irix_sys_uname(p, v, retval)
-	struct proc *p;
+irix_sys_uname(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -128,8 +129,8 @@ irix_sys_uname(p, v, retval)
 }
 
 int
-irix_sys_utssys(p, v, retval)
-	struct proc *p;
+irix_sys_utssys(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -144,12 +145,12 @@ irix_sys_utssys(p, v, retval)
 	case 0: {	/* uname(2)  */
 		struct irix_sys_uname_args ua;
 		SCARG(&ua, name) = SCARG(uap, a1);
-		return irix_sys_uname(p, &ua, retval);
+		return irix_sys_uname(l, &ua, retval);
 	}
 	break;
 
 	default:
-		return(svr4_sys_utssys(p, v, retval));
+		return(svr4_sys_utssys(l, v, retval));
 	break;	
 	}
 
Index: compat/irix/irix_mman.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_mman.c,v
retrieving revision 1.7
diff -u -p -r1.7 irix_mman.c
--- compat/irix/irix_mman.c	2002/11/30 12:28:26	1.7
+++ compat/irix/irix_mman.c	2003/01/22 00:28:13
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: irix_mman.c,
 #include <sys/mount.h>
 #include <sys/lock.h>
 #include <sys/systm.h>
+#include <sys/sa.h>
 #include <sys/syscallargs.h>
 
 #include <compat/svr4/svr4_types.h>
@@ -70,12 +71,12 @@ __KERNEL_RCSID(0, "$NetBSD: irix_mman.c,
 #include <compat/irix/irix_exec.h>
 #include <compat/irix/irix_syscallargs.h>
 
-static int irix_mmap __P((struct proc *, void *, size_t, int , 
+static int irix_mmap __P((struct lwp *, void *, size_t, int , 
 		int, int, off_t, register_t *)); 
 
 int
-irix_sys_mmap(p, v, retval)
-	struct proc *p;
+irix_sys_mmap(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -88,14 +89,14 @@ irix_sys_mmap(p, v, retval)
 		syscallarg(irix_off_t) pos; 
 	} */ *uap = v;
 
-	return irix_mmap(p, SCARG(uap, addr), SCARG(uap, len), 
+	return irix_mmap(l, SCARG(uap, addr), SCARG(uap, len), 
 	    SCARG(uap, prot), SCARG(uap, flags), SCARG(uap, fd), 
 	    SCARG(uap, pos), retval);
 }
 
 int
-irix_sys_mmap64(p, v, retval)
-	struct proc *p;
+irix_sys_mmap64(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -108,14 +109,15 @@ irix_sys_mmap64(p, v, retval)
 		syscallarg(int) pad1;
 		syscallarg(irix_off64_t) pos; 
 	} */ *uap = v;
-	return irix_mmap(p, SCARG(uap, addr), SCARG(uap, len), 
+
+	return irix_mmap(l, SCARG(uap, addr), SCARG(uap, len), 
 	    SCARG(uap, prot), SCARG(uap, flags), SCARG(uap, fd), 
 	    SCARG(uap, pos), retval);
 }
 
 static int
-irix_mmap(p, addr, len, prot, flags, fd, pos, retval)
-	struct proc *p;
+irix_mmap(l, addr, len, prot, flags, fd, pos, retval)
+	struct lwp *l;
 	void *addr;
 	size_t len;
 	int prot;
@@ -124,6 +126,7 @@ irix_mmap(p, addr, len, prot, flags, fd,
 	off_t pos;
 	register_t *retval;
 {
+	struct proc *p = l->l_proc;
 	struct sys_mmap_args cup;
 	int bsd_flags = 0;
 	int error = 0;
@@ -226,21 +229,21 @@ out:
 
 	/* A private mapping that should not be visible to the share group */
 	if (flags & IRIX_MAP_LOCAL) {
-		if ((error = sys_mmap(p, &cup, retval)) != 0)
+		if ((error = sys_mmap(l, &cup, retval)) != 0)
 			return error;
 		addr = (void *)*retval;
 		irix_isrr_insert((vaddr_t)addr, len, IRIX_ISRR_PRIVATE, p);
 		return 0;
 	}
 		
-	IRIX_VM_SYNC(p, error = sys_mmap(p, &cup, retval));
+	IRIX_VM_SYNC(p, error = sys_mmap(l, &cup, retval));
 	return error;
 }
 
 
 int 
-irix_sys_munmap(p, v, retval)
-	struct proc *p;
+irix_sys_munmap(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -248,9 +251,10 @@ irix_sys_munmap(p, v, retval)
 		syscallarg(void *) addr;
 		syscallarg(size_t) len;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	int error;
 
-	IRIX_VM_SYNC(p, error = sys_munmap(p, v, retval));
+	IRIX_VM_SYNC(p, error = sys_munmap(l, v, retval));
 	if (error == 0)
 		irix_isrr_insert((vaddr_t)SCARG(uap, addr), 
 		    SCARG(uap, len), IRIX_ISRR_SHARED, p);
@@ -259,39 +263,42 @@ irix_sys_munmap(p, v, retval)
 }
 
 int 
-irix_sys_break(p, v, retval)
-	struct proc *p;
+irix_sys_break(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
+	struct proc *p = l->l_proc;
 	int error;
 
-	IRIX_VM_SYNC(p, error = svr4_sys_break(p, v, retval));
+	IRIX_VM_SYNC(p, error = svr4_sys_break(l, v, retval));
 	return error;
 }
 
 #ifdef SYSVSHM 
 int 
-irix_sys_shmsys(p, v, retval)
-	struct proc *p;
+irix_sys_shmsys(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
+	struct proc *p = l->l_proc;
 	int error;
 
-	IRIX_VM_SYNC(p, error = svr4_sys_shmsys(p, v, retval));
+	IRIX_VM_SYNC(p, error = svr4_sys_shmsys(l, v, retval));
 	return error;
 }
 #endif
 
 int 
-irix_sys_mprotect(p, v, retval)
-	struct proc *p;
+irix_sys_mprotect(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
+	struct proc *p = l->l_proc;
 	int error;
 
-	IRIX_VM_SYNC(p, error = sys_mprotect(p, v, retval));
+	IRIX_VM_SYNC(p, error = sys_mprotect(l, v, retval));
 	return error;
 }
Index: compat/irix/irix_mount.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_mount.c,v
retrieving revision 1.4
diff -u -p -r1.4 irix_mount.c
--- compat/irix/irix_mount.c	2002/03/16 20:43:52	1.4
+++ compat/irix/irix_mount.c	2003/01/22 00:28:13
@@ -57,8 +57,8 @@ __KERNEL_RCSID(0, "$NetBSD: irix_mount.c
 #include <compat/irix/irix_syscallargs.h>
 
 int
-irix_sys_getmountid(p, v, retval)
-	struct proc *p;
+irix_sys_getmountid(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -66,6 +66,7 @@ irix_sys_getmountid(p, v, retval)
 		syscallarg(const char *) path;
 		syscallarg(irix_mountid_t *) buf;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 	struct ucred *cred = crget();
 	struct vnode *vp;
Index: compat/irix/irix_prctl.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_prctl.c,v
retrieving revision 1.19
diff -u -p -r1.19 irix_prctl.c
--- compat/irix/irix_prctl.c	2002/10/23 21:30:46	1.19
+++ compat/irix/irix_prctl.c	2003/01/22 00:28:14
@@ -79,7 +79,7 @@ struct irix_sproc_child_args {
 }; 
 static void irix_sproc_child __P((struct irix_sproc_child_args *));
 static int irix_sproc __P((void *, unsigned int, void *, caddr_t, size_t, 
-    pid_t, struct proc *, register_t *));
+    pid_t, struct lwp *, register_t *));
 static struct irix_shared_regions_rec *irix_isrr_create __P((vaddr_t, 
     vsize_t, int));
 #ifdef DEBUG_IRIX
@@ -88,8 +88,8 @@ static void irix_isrr_debug __P((struct 
 static void irix_isrr_cleanup __P((struct proc *));
 
 int
-irix_sys_prctl(p, v, retval)
-	struct proc *p;
+irix_sys_prctl(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -97,6 +97,7 @@ irix_sys_prctl(p, v, retval)
 		syscallarg(int) option;
 		syscallarg(void *) arg1;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	int option = SCARG(uap, option);
 
 #ifdef DEBUG_IRIX
@@ -207,8 +208,8 @@ irix_sys_prctl(p, v, retval)
 
 
 int
-irix_sys_pidsprocsp(p, v, retval)
-	struct proc *p;
+irix_sys_pidsprocsp(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -220,17 +221,17 @@ irix_sys_pidsprocsp(p, v, retval)
 		syscallarg(irix_size_t) len;
 		syscallarg(irix_pid_t) pid;
 	} */ *uap = v;
-	
+
 	/* pid is ignored for now */
 	printf("Warning: unsupported pid argument to IRIX sproc\n");
 
 	return irix_sproc(SCARG(uap, entry), SCARG(uap, inh), SCARG(uap, arg),
-	    SCARG(uap, sp), SCARG(uap, len), SCARG(uap, pid), p, retval);
+	    SCARG(uap, sp), SCARG(uap, len), SCARG(uap, pid), l, retval);
 }
 
 int
-irix_sys_sprocsp(p, v, retval)
-	struct proc *p;
+irix_sys_sprocsp(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -243,12 +244,12 @@ irix_sys_sprocsp(p, v, retval)
 	} */ *uap = v;
 
 	return irix_sproc(SCARG(uap, entry), SCARG(uap, inh), SCARG(uap, arg),
-	    SCARG(uap, sp), SCARG(uap, len), 0, p, retval);
+	    SCARG(uap, sp), SCARG(uap, len), 0, l, retval);
 }
 
 int
-irix_sys_sproc(p, v, retval)
-	struct proc *p;
+irix_sys_sproc(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -257,23 +258,25 @@ irix_sys_sproc(p, v, retval)
 		syscallarg(unsigned) inh;
 		syscallarg(void *) arg;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 
 	return irix_sproc(SCARG(uap, entry), SCARG(uap, inh), SCARG(uap, arg),
-	    NULL, p->p_rlimit[RLIMIT_STACK].rlim_cur, 0, p, retval);
+	    NULL, p->p_rlimit[RLIMIT_STACK].rlim_cur, 0, l, retval);
 }
 
 
 static int 
-irix_sproc(entry, inh, arg, sp, len, pid, p, retval)
+irix_sproc(entry, inh, arg, sp, len, pid, l, retval)
 	void *entry;
 	unsigned int inh;
 	void *arg;
 	caddr_t sp;
 	size_t len;
 	pid_t pid;
-	struct proc *p;
+	struct lwp *l;
 	register_t *retval;
 {
+	struct proc *p = l->l_proc;
 	int bsd_flags = 0;
 	struct exec_vmcmd vmc;
 	int error;
@@ -389,7 +392,7 @@ irix_sproc(entry, inh, arg, sp, len, pid
 		ied->ied_shareaddr = 1;
 	}
 
-	if ((error = fork1(p, bsd_flags, SIGCHLD, (void *)sp, len, 
+	if ((error = fork1(l, bsd_flags, SIGCHLD, (void *)sp, len, 
 	    (void *)irix_sproc_child, (void *)isc, retval, &p2)) != 0)
 		return error;
 
@@ -550,8 +553,8 @@ irix_sproc_child(isc)
 }
 
 int
-irix_sys_procblk(p, v, retval)
-	struct proc *p;
+irix_sys_procblk(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -560,6 +563,8 @@ irix_sys_procblk(p, v, retval)
 		syscallarg(pid_t) pid;
 		syscallarg(int) count;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
+
 	int cmd = SCARG(uap, cmd);
 	struct irix_emuldata *ied;
 	struct irix_emuldata *iedp;
@@ -619,7 +624,7 @@ irix_sys_procblk(p, v, retval)
 		 */
 		if ((isg = ied->ied_share_group) == NULL) {
 			SCARG(&cup, pid) = SCARG(uap, pid);
-			return irix_sys_procblk(p, &cup, retval);
+			return irix_sys_procblk(l, &cup, retval);
 		}
 
 		(void)lockmgr(&isg->isg_lock, LK_SHARED, NULL);
Index: compat/irix/irix_resource.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_resource.c,v
retrieving revision 1.1
diff -u -p -r1.1 irix_resource.c
--- compat/irix/irix_resource.c	2002/06/14 20:33:11	1.1
+++ compat/irix/irix_resource.c	2003/01/22 00:28:14
@@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: irix_resourc
 #include <sys/proc.h>
 #include <sys/systm.h>
 #include <sys/resource.h>
+#include <sys/sa.h>
 #include <sys/syscallargs.h>
 
 #include <compat/common/compat_util.h>
@@ -96,8 +97,8 @@ irix_to_native_resource(irix_res)
 }
 
 int
-irix_sys_getrlimit(p, v, retval)
-	struct proc *p;
+irix_sys_getrlimit(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -105,6 +106,7 @@ irix_sys_getrlimit(p, v, retval)
 		syscallarg(int) resource;
 		syscallarg(struct irix_rlimit *) rlp;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 	struct sys_getrlimit_args cup;
 	struct rlimit rlp;
@@ -114,7 +116,7 @@ irix_sys_getrlimit(p, v, retval)
 	SCARG(&cup, which) = irix_to_native_resource(SCARG(uap, resource));
 	SCARG(&cup, rlp) = stackgap_alloc(p, &sg, sizeof(struct rlimit)); 
 	
-	if ((error = sys_getrlimit(p, &cup, retval)) != 0)
+	if ((error = sys_getrlimit(l, &cup, retval)) != 0)
 		return error;
 
 	if ((error = copyin(SCARG(&cup, rlp), &rlp, sizeof(rlp))) != 0)
@@ -137,8 +139,8 @@ irix_sys_getrlimit(p, v, retval)
 }
 
 int
-irix_sys_getrlimit64(p, v, retval)
-	struct proc *p;
+irix_sys_getrlimit64(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -146,6 +148,7 @@ irix_sys_getrlimit64(p, v, retval)
 		syscallarg(int) resource;
 		syscallarg(struct irix_rlimit64 *) rlp;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 	struct sys_getrlimit_args cup;
 	struct rlimit rlp;
@@ -155,7 +158,7 @@ irix_sys_getrlimit64(p, v, retval)
 	SCARG(&cup, which) = irix_to_native_resource(SCARG(uap, resource));
 	SCARG(&cup, rlp) = stackgap_alloc(p, &sg, sizeof(struct rlimit)); 
 	
-	if ((error = sys_getrlimit(p, &cup, retval)) != 0)
+	if ((error = sys_getrlimit(l, &cup, retval)) != 0)
 		return error;
 
 	if ((error = copyin(SCARG(&cup, rlp), &rlp, sizeof(rlp))) != 0)
@@ -178,8 +181,8 @@ irix_sys_getrlimit64(p, v, retval)
 }
 
 int
-irix_sys_setrlimit(p, v, retval)
-	struct proc *p;
+irix_sys_setrlimit(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -187,6 +190,7 @@ irix_sys_setrlimit(p, v, retval)
 		syscallarg(int) resource;
 		syscallarg(struct irix_rlimit *) rlp;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 	struct sys_setrlimit_args cup;
 	struct rlimit rlp;
@@ -212,15 +216,15 @@ irix_sys_setrlimit(p, v, retval)
 	if ((error = copyout(&rlp, (void *)SCARG(&cup, rlp), sizeof(rlp))) != 0)
 		return error;
 
-	if ((error = sys_setrlimit(p, &cup, retval)) != 0)
+	if ((error = sys_setrlimit(l, &cup, retval)) != 0)
 		return error;
 
 	return 0;
 }
 
 int
-irix_sys_setrlimit64(p, v, retval)
-	struct proc *p;
+irix_sys_setrlimit64(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -228,6 +232,7 @@ irix_sys_setrlimit64(p, v, retval)
 		syscallarg(int) resource;
 		syscallarg(struct irix_rlimit64 *) rlp;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 	struct sys_setrlimit_args cup;
 	struct rlimit rlp;
@@ -253,7 +258,7 @@ irix_sys_setrlimit64(p, v, retval)
 	if ((error = copyout(&rlp, (void *)SCARG(&cup, rlp), sizeof(rlp))) != 0)
 		return error;
 
-	if ((error = sys_setrlimit(p, &cup, retval)) != 0)
+	if ((error = sys_setrlimit(l, &cup, retval)) != 0)
 		return error;
 
 	return 0;
Index: compat/irix/irix_signal.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_signal.c,v
retrieving revision 1.23
diff -u -p -r1.23 irix_signal.c
--- compat/irix/irix_signal.c	2003/01/18 07:44:51	1.23
+++ compat/irix/irix_signal.c	2003/01/22 00:28:14
@@ -77,11 +77,11 @@ static int irix_wait_siginfo __P((struct
 static void irix_signal_siginfo __P((struct irix_irix5_siginfo *, 
     int, u_long, caddr_t));
 static void irix_set_ucontext __P((struct irix_ucontext*, sigset_t *, 
-    int, struct proc *));
+    int, struct lwp *));
 static void irix_set_sigcontext __P((struct irix_sigcontext*, sigset_t *, 
-    int, struct proc *));
-static void irix_get_ucontext __P((struct irix_ucontext*, struct proc *));
-static void irix_get_sigcontext __P((struct irix_sigcontext*, struct proc *));
+    int, struct lwp *));
+static void irix_get_ucontext __P((struct irix_ucontext*, struct lwp *));
+static void irix_get_sigcontext __P((struct irix_sigcontext*, struct lwp *));
 
 #define irix_sigmask(n)	 (1 << (((n) - 1) & 31))
 #define irix_sigword(n)	 (((n) - 1) >> 5) 
@@ -265,7 +265,8 @@ irix_sendsig(sig, mask, code)
 	sigset_t *mask;
 	u_long code;
 {
-	struct proc *p = curlwp;
+	struct lwp *l = curlwp;
+	struct proc *p = l->l_proc;
 	void *sp;
 	struct frame *f;
 	int onstack;
@@ -273,7 +274,7 @@ irix_sendsig(sig, mask, code)
 	sig_t catcher = SIGACTION(p, sig).sa_handler;
 	struct irix_sigframe sf;
  
-	f = (struct frame *)p->p_md.md_regs;
+	f = (struct frame *)l->l_md.md_regs;
 #ifdef DEBUG_IRIX
 	printf("irix_sendsig()\n");
 	printf("catcher = %p, sig = %d, code = 0x%lx\n",
@@ -307,11 +308,11 @@ irix_sendsig(sig, mask, code)
 	 */
 	bzero(&sf, sizeof(sf));
 	if (SIGACTION(p, sig).sa_flags & SA_SIGINFO) {
-		irix_set_ucontext(&sf.isf_ctx.iss.iuc, mask, code, p);
+		irix_set_ucontext(&sf.isf_ctx.iss.iuc, mask, code, l);
 		irix_signal_siginfo(&sf.isf_ctx.iss.iis, sig, 
 		    code, (caddr_t)f->f_regs[BADVADDR]);
 	} else {
-		irix_set_sigcontext(&sf.isf_ctx.isc, mask, code, p);
+		irix_set_sigcontext(&sf.isf_ctx.isc, mask, code, l);
 	}
 	
 	/*
@@ -332,7 +333,7 @@ irix_sendsig(sig, mask, code)
 #ifdef DEBUG_IRIX
 		printf("irix_sendsig: stack trashed\n");
 #endif /* DEBUG_IRIX */
-		sigexit(p, SIGILL);
+		sigexit(l, SIGILL);
 		/* NOTREACHED */
 	}
 
@@ -387,19 +388,20 @@ irix_sendsig(sig, mask, code)
 }
 
 static void 
-irix_set_sigcontext (scp, mask, code, p)
+irix_set_sigcontext (scp, mask, code, l)
 	struct irix_sigcontext *scp;
 	sigset_t *mask;
 	int code;
-	struct proc *p;
+	struct lwp *l;
 {
+	struct proc *p = l->l_proc;
 	int i;
 	struct frame *f;
 
 #ifdef DEBUG_IRIX
 	printf("irix_set_sigcontext()\n");
 #endif
-	f = (struct frame *)p->p_md.md_regs;
+	f = (struct frame *)l->l_md.md_regs;
 	/*
 	 * Build stack frame for signal trampoline.
 	 */
@@ -420,17 +422,17 @@ irix_set_sigcontext (scp, mask, code, p)
 	 * Save the floating-pointstate, if necessary, then copy it. 
 	 */
 #ifndef SOFTFLOAT
-	scp->isc_ownedfp = p->p_md.md_flags & MDP_FPUSED;
+	scp->isc_ownedfp = l->l_md.md_flags & MDP_FPUSED;
 	if (scp->isc_ownedfp) {
 		/* if FPU has current state, save it first */
-		if (p == fpcurlwp)
-			savefpregs(p);
-		(void)memcpy(&scp->isc_fpregs, &p->p_addr->u_pcb.pcb_fpregs,
+		if (l == fpcurlwp)
+			savefpregs(l);
+		(void)memcpy(&scp->isc_fpregs, &l->l_addr->u_pcb.pcb_fpregs,
 		    sizeof(scp->isc_fpregs));
-		scp->isc_fpc_csr = p->p_addr->u_pcb.pcb_fpregs.r_regs[32];
+		scp->isc_fpc_csr = l->l_addr->u_pcb.pcb_fpregs.r_regs[32];
 	}
 #else
-	(void)memcpy(&scp->isc_fpregs, &p->p_addr->u_pcb.pcb_fpregs,
+	(void)memcpy(&scp->isc_fpregs, &l->l_addr->u_pcb.pcb_fpregs,
 	    sizeof(scp->isc_fpregs));
 #endif 
 	/*
@@ -443,18 +445,19 @@ irix_set_sigcontext (scp, mask, code, p)
 }
 
 void 
-irix_set_ucontext(ucp, mask, code, p)
+irix_set_ucontext(ucp, mask, code, l)
 	struct irix_ucontext *ucp;
 	sigset_t *mask;
 	int code;
-	struct proc *p;
+	struct lwp *l;
 {
+	struct proc *p = l->l_proc;
 	struct frame *f;
 
 #ifdef DEBUG_IRIX
 	printf("irix_set_ucontext()\n");
 #endif
-	f = (struct frame *)p->p_md.md_regs;
+	f = (struct frame *)l->l_md.md_regs;
 	/*
 	 * Save general purpose registers
 	 */
@@ -471,19 +474,19 @@ irix_set_ucontext(ucp, mask, code, p)
 	 * Save the floating-pointstate, if necessary, then copy it. 
 	 */
 #ifndef SOFTFLOAT
-	if (p->p_md.md_flags & MDP_FPUSED) {
+	if (l->l_md.md_flags & MDP_FPUSED) {
 		/* if FPU has current state, save it first */
-		if (p == fpcurlwp)
-			savefpregs(p);
+		if (l == fpcurlwp)
+			savefpregs(l);
 		(void)memcpy(&ucp->iuc_mcontext.svr4___fpregs, 
-		    &p->p_addr->u_pcb.pcb_fpregs, 
+		    &l->l_addr->u_pcb.pcb_fpregs, 
 		    sizeof(ucp->iuc_mcontext.svr4___fpregs));
 		ucp->iuc_mcontext.svr4___fpregs.svr4___fp_csr = 
-		    p->p_addr->u_pcb.pcb_fpregs.r_regs[32];
+		    l->l_addr->u_pcb.pcb_fpregs.r_regs[32];
 	}
 #else
 	(void)memcpy(&ucp->iuc_mcontext.svr4___fpregs, 
-	    &p->p_addr->u_pcb.pcb_fpregs, 
+	    &l->l_addr->u_pcb.pcb_fpregs, 
 	    sizeof(ucp->iuc_mcontext.svr4___fpregs));
 #endif 
 	/* 
@@ -511,8 +514,8 @@ irix_set_ucontext(ucp, mask, code, p)
 }
 
 int      
-irix_sys_sigreturn(p, v, retval)
-	struct proc *p;
+irix_sys_sigreturn(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {       
@@ -545,35 +548,36 @@ irix_sys_sigreturn(p, v, retval)
 		    sizeof(ksf.isf_ctx))) != 0)
 			return error;
 
-		irix_get_ucontext(&ksf.isf_ctx.iss.iuc, p);
+		irix_get_ucontext(&ksf.isf_ctx.iss.iuc, l);
 	} else {
 		if ((error = copyin(usf, &ksf.isf_ctx.isc, 
 		    sizeof(ksf.isf_ctx))) != 0)
 			return error;
 
-		irix_get_sigcontext(&ksf.isf_ctx.isc, p);
+		irix_get_sigcontext(&ksf.isf_ctx.isc, l);
 	}
 
 #ifdef DEBUG_IRIX
 	printf("irix_sys_sigreturn(): returning [PC=%p SP=%p SR=0x%08lx]\n",
-	    (void *)((struct frame *)(p->p_md.md_regs))->f_regs[PC], 
-	    (void *)((struct frame *)(p->p_md.md_regs))->f_regs[SP], 
-	    ((struct frame *)(p->p_md.md_regs))->f_regs[SR]);
+	    (void *)((struct frame *)(l->l_md.md_regs))->f_regs[PC], 
+	    (void *)((struct frame *)(l->l_md.md_regs))->f_regs[SP], 
+	    ((struct frame *)(l->l_md.md_regs))->f_regs[SR]);
 #endif
 
 	return EJUSTRETURN;
 }
 
 static void
-irix_get_ucontext(ucp, p)
+irix_get_ucontext(ucp, l)
 	struct irix_ucontext *ucp;
-	struct proc *p;
+	struct lwp *l;
 {
+	struct proc *p = l->l_proc;
 	struct frame *f;
 	sigset_t mask;
 
 	/* Restore the register context. */
-	f = (struct frame *)p->p_md.md_regs;
+	f = (struct frame *)l->l_md.md_regs;
 
 	if (ucp->iuc_flags & IRIX_UC_CPU) {
 		(void)memcpy(&f->f_regs, &ucp->iuc_mcontext.svr4___gregs, 
@@ -591,17 +595,17 @@ irix_get_ucontext(ucp, p)
 #ifndef SOFTFLOAT
 		/* Disable the FPU to fault in FP registers. */
 		f->f_regs[SR] &= ~MIPS_SR_COP_1_BIT;
-		if (p == fpcurlwp) 
-			fpcurlwp = (struct proc *)0;
-		(void)memcpy(&p->p_addr->u_pcb.pcb_fpregs, 
+		if (l == fpcurlwp) 
+			fpcurlwp = NULL;
+		(void)memcpy(&l->l_addr->u_pcb.pcb_fpregs, 
 		    &ucp->iuc_mcontext.svr4___fpregs,
-		    sizeof(p->p_addr->u_pcb.pcb_fpregs));
-		p->p_addr->u_pcb.pcb_fpregs.r_regs[32] = 
+		    sizeof(l->l_addr->u_pcb.pcb_fpregs));
+		l->l_addr->u_pcb.pcb_fpregs.r_regs[32] = 
 		     ucp->iuc_mcontext.svr4___fpregs.svr4___fp_csr;
 #else	
-		(void)memcpy(&p->p_addr->u_pcb.pcb_fpregs, 
+		(void)memcpy(&l->l_addr->u_pcb.pcb_fpregs, 
 		    &ucp->iuc_mcontext.svr4___fpregs,
-		    sizeof(p->p_addr->u_pcb.pcb_fpregs));
+		    sizeof(l->l_addr->u_pcb.pcb_fpregs));
 #endif
 	}
 
@@ -636,16 +640,17 @@ irix_get_ucontext(ucp, p)
 }
 
 static void
-irix_get_sigcontext(scp, p) 
+irix_get_sigcontext(scp, l) 
 	struct irix_sigcontext *scp;
-	struct proc *p;
+	struct lwp *l;
 {
+	struct proc *p = l->l_proc;
 	int i;
 	struct frame *f;
 	sigset_t mask;
 
 	/* Restore the register context. */
-	f = (struct frame *)p->p_md.md_regs;
+	f = (struct frame *)l->l_md.md_regs;
 
 	for (i = 1; i < 32; i++) /* restore gpr1 to gpr31 */
 		f->f_regs[i] = scp->isc_regs[i];
@@ -657,15 +662,15 @@ irix_get_sigcontext(scp, p) 
 	if (scp->isc_ownedfp) {
 		/* Disable the FPU to fault in FP registers. */
 		f->f_regs[SR] &= ~MIPS_SR_COP_1_BIT;
-		if (p == fpcurlwp) 
-			fpcurlwp = (struct proc *)0;
-		(void)memcpy(&p->p_addr->u_pcb.pcb_fpregs, &scp->isc_fpregs,
+		if (l == fpcurlwp) 
+			fpcurlwp = NULL;
+		(void)memcpy(&l->l_addr->u_pcb.pcb_fpregs, &scp->isc_fpregs,
 		    sizeof(scp->isc_fpregs));
-		p->p_addr->u_pcb.pcb_fpregs.r_regs[32] = scp->isc_fpc_csr;
+		l->l_addr->u_pcb.pcb_fpregs.r_regs[32] = scp->isc_fpc_csr;
 	}
 #else	
-	(void)memcpy(&p->p_addr->u_pcb.pcb_fpregs, &scp->isc_fpregs,
-	    sizeof(p->p_addr->u_pcb.pcb_fpregs));
+	(void)memcpy(&l->l_addr->u_pcb.pcb_fpregs, &scp->isc_fpregs,
+	    sizeof(l->l_addr->u_pcb.pcb_fpregs));
 #endif
 
 	/* Restore signal stack. */
@@ -684,8 +689,8 @@ irix_get_sigcontext(scp, p) 
 
 
 int
-irix_sys_sginap(p, v, retval)
-	struct proc *p;
+irix_sys_sginap(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -715,19 +720,20 @@ irix_sys_sginap(p, v, retval)
  * XXX Untested. Expect bugs and security problems here 
  */
 int 
-irix_sys_getcontext(p, v, retval)
-	struct proc *p;
+irix_sys_getcontext(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
 	struct irix_sys_getcontext_args /* {
 		syscallarg(struct irix_ucontext *) ucp;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	struct frame *f;
 	struct irix_ucontext kucp;
 	int i, error;
 
-	f = (struct frame *)p->p_md.md_regs;
+	f = (struct frame *)l->l_md.md_regs;
 
 	kucp.iuc_flags = IRIX_UC_ALL;
 	kucp.iuc_link = NULL;		/* XXX */
@@ -758,14 +764,15 @@ irix_sys_getcontext(p, v, retval)
  * XXX Untested. Expect bugs and security problems here 
  */
 int 
-irix_sys_setcontext(p, v, retval)
-	struct proc *p;
+irix_sys_setcontext(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
 	struct irix_sys_setcontext_args /* {
 		syscallarg(struct irix_ucontext *) ucp;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	struct frame *f;
 	struct irix_ucontext kucp;
 	int i, error;
@@ -774,7 +781,7 @@ irix_sys_setcontext(p, v, retval)
 	if (error)
 		goto out;
 
-	f = (struct frame *)p->p_md.md_regs;
+	f = (struct frame *)l->l_md.md_regs;
 
 	if (kucp.iuc_flags & IRIX_UC_SIGMASK)
 		irix_to_native_sigset(&kucp.iuc_sigmask, 
@@ -818,8 +825,8 @@ out:
  * from svr4_misc.c, or push the irix_irix5_siginfo into svr4_siginfo.h
  */
 int 
-irix_sys_waitsys(p, v, retval)
-	struct proc *p;
+irix_sys_waitsys(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -830,6 +837,7 @@ irix_sys_waitsys(p, v, retval)
 		syscallarg(int) options;
 		syscallarg(struct rusage *) ru;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	int nfound, error, s;
 	struct proc *q, *t;
 
@@ -977,8 +985,8 @@ loop:
 }
 
 int 
-irix_sys_sigprocmask(p, v, retval)
-	struct proc *p;
+irix_sys_sigprocmask(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -987,6 +995,7 @@ irix_sys_sigprocmask(p, v, retval)
 		syscallarg(irix_sigset_t *) set;
 		syscallarg(irix_sigset_t *) oset;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	struct svr4_sys_sigprocmask_args cup;
 	int error;
 	sigset_t *obss;
@@ -1014,12 +1023,12 @@ irix_sys_sigprocmask(p, v, retval)
 
 		SCARG(&cup, how) = SVR4_SIG_SETMASK;
 	}
-	return svr4_sys_sigprocmask(p, &cup, retval);
+	return svr4_sys_sigprocmask(l, &cup, retval);
 }
 
 int
-irix_sys_sigaction(p, v, retval)
-	struct proc *p;
+irix_sys_sigaction(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -1029,6 +1038,7 @@ irix_sys_sigaction(p, v, retval)
 		syscallarg(struct svr4_sigaction *) osa;
 		syscallarg(void *) sigtramp;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	int signum;
 	struct svr4_sys_sigaction_args cup;
 	struct irix_emuldata *ied;
@@ -1085,5 +1095,5 @@ irix_sys_sigaction(p, v, retval)
 	SCARG(&cup, nsa) = SCARG(uap, nsa);
 	SCARG(&cup, osa) = SCARG(uap, osa);
 
-	return svr4_sys_sigaction(p, &cup, retval);
+	return svr4_sys_sigaction(l, &cup, retval);
 }
Index: compat/irix/irix_stat.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_stat.c,v
retrieving revision 1.6
diff -u -p -r1.6 irix_stat.c
--- compat/irix/irix_stat.c	2003/01/18 07:44:51	1.6
+++ compat/irix/irix_stat.c	2003/01/22 00:28:14
@@ -128,8 +128,8 @@ bsd_to_irix_stat64(bsp, isp)
 }
 
 int
-irix_sys_xstat(p, v, retval)
-	struct proc *p;
+irix_sys_xstat(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -138,6 +138,7 @@ irix_sys_xstat(p, v, retval)
 		syscallarg(const char *) path;
 		syscallarg(struct stat *) buf;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	struct sys___stat13_args cup;
 	struct stat st;
 	caddr_t sg = stackgap_init(p, 0);
@@ -147,7 +148,7 @@ irix_sys_xstat(p, v, retval)
 	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
 	SCARG(&cup, path) = SCARG(uap, path);
 
-	if ((error = sys___stat13(p, &cup, retval)) != 0)
+	if ((error = sys___stat13(l, &cup, retval)) != 0)
 		return error;
 
 	if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0)
@@ -185,8 +186,8 @@ irix_sys_xstat(p, v, retval)
 }
 
 int
-irix_sys_lxstat(p, v, retval)
-	struct proc *p;
+irix_sys_lxstat(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -195,6 +196,7 @@ irix_sys_lxstat(p, v, retval)
 		syscallarg(const char *) path;
 		syscallarg(struct stat *) buf;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	struct sys___lstat13_args cup;
 	struct stat st;
 	caddr_t sg = stackgap_init(p, 0);
@@ -204,7 +206,7 @@ irix_sys_lxstat(p, v, retval)
 	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
 	SCARG(&cup, path) = SCARG(uap, path);
 
-	if ((error = sys___lstat13(p, &cup, retval)) != 0)
+	if ((error = sys___lstat13(l, &cup, retval)) != 0)
 		return error;
 
 	if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0)
@@ -242,8 +244,8 @@ irix_sys_lxstat(p, v, retval)
 }
 
 int
-irix_sys_fxstat(p, v, retval)
-	struct proc *p;
+irix_sys_fxstat(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -252,6 +254,7 @@ irix_sys_fxstat(p, v, retval)
 		syscallarg(const int) fd;
 		syscallarg(struct stat *) buf;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	struct sys___fstat13_args cup;
 	struct stat st;
 	int error;
@@ -260,7 +263,7 @@ irix_sys_fxstat(p, v, retval)
 	SCARG(&cup, sb) = stackgap_alloc(p, &sg, sizeof(struct stat));
 	SCARG(&cup, fd) = SCARG(uap, fd);
 
-	if ((error = sys___fstat13(p, &cup, retval)) != 0)
+	if ((error = sys___fstat13(l, &cup, retval)) != 0)
 		return error;
 
 	if ((error = copyin(SCARG(&cup, sb), &st, sizeof st)) != 0)
Index: compat/irix/irix_swap.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_swap.c,v
retrieving revision 1.8
diff -u -p -r1.8 irix_swap.c
--- compat/irix/irix_swap.c	2003/01/18 07:44:51	1.8
+++ compat/irix/irix_swap.c	2003/01/22 00:28:14
@@ -66,8 +66,8 @@ __KERNEL_RCSID(0, "$NetBSD: irix_swap.c,
 extern struct lock swap_syscall_lock;
 
 int
-irix_sys_swapctl(p, v, retval)
-	struct proc *p;
+irix_sys_swapctl(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -111,7 +111,7 @@ irix_sys_swapctl(p, v, retval)
 		SCARG(&cup, arg) = isr.sr_name;
 		SCARG(&cup, misc) = 
 		    (SCARG(uap, cmd) == IRIX_SC_SGIADD) ? isr.sr_pri : 0;
-		return sys_swapctl(p, &cup, retval);
+		return sys_swapctl(l, &cup, retval);
 		break;
 	}
 
@@ -120,7 +120,7 @@ irix_sys_swapctl(p, v, retval)
 		SCARG(&cup, cmd) = SWAP_NSWAP;
 		SCARG(&cup, arg) = NULL;
 		SCARG(&cup, misc) = 0;
-		return sys_swapctl(p, &cup, retval);
+		return sys_swapctl(l, &cup, retval);
 		break;
 
 	case IRIX_SC_LIST: { /* Get swap list */
@@ -197,7 +197,7 @@ bad:
 		SCARG(&cup, cmd) = SWAP_NSWAP;
 		SCARG(&cup, arg) = NULL;
 		SCARG(&cup, misc) = 0;
-		if ((error = sys_swapctl(p, &cup, (register_t *)&entries)) != 0)
+		if ((error = sys_swapctl(l, &cup, (register_t *)&entries)) != 0)
 			return error;
 
 		sep = (struct swapent *)malloc(
Index: compat/irix/irix_sysmp.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_sysmp.c,v
retrieving revision 1.8
diff -u -p -r1.8 irix_sysmp.c
--- compat/irix/irix_sysmp.c	2002/04/20 21:25:01	1.8
+++ compat/irix/irix_sysmp.c	2003/01/22 00:28:14
@@ -69,8 +69,8 @@ extern struct loadavg averunnable;
 extern long irix_kernel_var[32];
 
 int
-irix_sys_sysmp(p, v, retval)
-	struct proc *p;
+irix_sys_sysmp(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -81,6 +81,7 @@ irix_sys_sysmp(p, v, retval)
 		syscallarg(void *) arg3;
 		syscallarg(void *) arg4;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	int cmd = SCARG(uap, cmd);
 	int error = 0;
 	caddr_t sg = stackgap_init(p, 0);
Index: compat/irix/irix_syssgi.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_syssgi.c,v
retrieving revision 1.34
diff -u -p -r1.34 irix_syssgi.c
--- compat/irix/irix_syssgi.c	2003/01/18 07:44:51	1.34
+++ compat/irix/irix_syssgi.c	2003/01/22 00:28:14
@@ -88,12 +88,12 @@ void	ELFNAME(load_psection)(struct exec_
 
 static int irix_syssgi_mapelf __P((int, Elf_Phdr *, int, 
     struct proc *, register_t *));
-static int irix_syssgi_sysconf __P((int name, struct proc *, register_t *));
-static int irix_syssgi_pathconf __P((char *, int, struct proc *, register_t *));
+static int irix_syssgi_sysconf __P((int name, struct lwp *, register_t *));
+static int irix_syssgi_pathconf __P((char *, int, struct lwp *, register_t *));
 
 int
-irix_sys_syssgi(p, v, retval)
-	struct proc *p;
+irix_sys_syssgi(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -105,6 +105,7 @@ irix_sys_syssgi(p, v, retval)
 		syscallarg(void *) arg4;                                        
 		syscallarg(void *) arg5;                                        
 	} */ *uap = v;  
+	struct proc *p = l->l_proc;
 	int request = SCARG(uap, request);
 	void *arg1, *arg2, *arg3; 
 
@@ -121,7 +122,7 @@ irix_sys_syssgi(p, v, retval)
 
 		SCARG(&cup, gidsetsize) = (int)SCARG(uap, arg1);
 		SCARG(&cup, gidset) = (gid_t *)SCARG(uap, arg2);
-		return (sys_setgroups(p, &cup, retval));
+		return (sys_setgroups(l, &cup, retval));
 		break;
 	}
 
@@ -130,19 +131,19 @@ irix_sys_syssgi(p, v, retval)
 
 		SCARG(&cup, gidsetsize) = (int)SCARG(uap, arg1);
 		SCARG(&cup, gidset) = (gid_t *)SCARG(uap, arg2);
-		return (sys_getgroups(p, &cup, retval));
+		return (sys_getgroups(l, &cup, retval));
 		break;
 	}
 
 	case IRIX_SGI_SETSID: 	/* Set session ID: setsid(2) */
-		return (sys_setsid(p, NULL, retval)); 
+		return (sys_setsid(l, NULL, retval)); 
 		break;
 
 	case IRIX_SGI_GETSID: {	/* Get session ID: getsid(2) */
 		struct sys_getsid_args cup;
 
 		SCARG(&cup, pid) = (pid_t)SCARG(uap, arg1); 
-		return (sys_getsid(p, &cup, retval)); 
+		return (sys_getsid(l, &cup, retval)); 
 		break;
 	}
 
@@ -150,7 +151,7 @@ irix_sys_syssgi(p, v, retval)
 		struct sys_getpgid_args cup;
 
 		SCARG(&cup, pid) = (pid_t)SCARG(uap, arg1); 
-		return (sys_getpgid(p, &cup, retval)); 
+		return (sys_getpgid(l, &cup, retval)); 
 		break;
 	}
 
@@ -159,13 +160,13 @@ irix_sys_syssgi(p, v, retval)
 
 		SCARG(&cup, pid) = (pid_t)SCARG(uap, arg1); 
 		SCARG(&cup, pgid) = (pid_t)SCARG(uap, arg2); 
-		return (sys_setpgid(p, &cup, retval)); 
+		return (sys_setpgid(l, &cup, retval)); 
 		break;
 	}
 
 	case IRIX_SGI_PATHCONF: /* Get file limits: pathconf(3) */ 
 		return irix_syssgi_pathconf((char *)SCARG(uap, arg1),
-		    (int)SCARG(uap, arg2), p, retval);
+		    (int)SCARG(uap, arg2), l, retval);
 		break;
 
 	case IRIX_SGI_RUSAGE: {	/* BSD getrusage(2) */
@@ -173,7 +174,7 @@ irix_sys_syssgi(p, v, retval)
 
 		SCARG(&cup, who) = (int)SCARG(uap, arg1);
 		SCARG(&cup, rusage) = (struct rusage *)SCARG(uap, arg2);
-		return sys_getrusage(p, &cup, retval);
+		return sys_getrusage(l, &cup, retval);
 		break;
 	}
 
@@ -263,7 +264,7 @@ irix_sys_syssgi(p, v, retval)
 
 	case IRIX_SGI_SYSCONF:		/* POSIX sysconf */
 		arg1 = SCARG(uap, arg1); /* system variable name */
-		return irix_syssgi_sysconf((int)arg1, p, retval);	
+		return irix_syssgi_sysconf((int)arg1, l, retval);	
 		break;
 
 	case IRIX_SGI_SATCTL:		/* control audit stream */
@@ -456,11 +457,12 @@ bad:
 
 
 static int
-irix_syssgi_sysconf(name, p, retval)
+irix_syssgi_sysconf(name, l, retval)
 	int name;
-	struct proc *p;
+	struct lwp *l;
 	register_t *retval;
 {
+	struct proc *p = l->l_proc;
 	int error = 0;
 	int mib[2], value;
 	int len = sizeof(value);
@@ -533,14 +535,14 @@ irix_syssgi_sysconf(name, p, retval)
 	SCARG(&cup, new) = NULL;
 	SCARG(&cup, newlen) = 0;
 
-	return sys___sysctl(p, &cup, retval);
+	return sys___sysctl(l, &cup, retval);
 }
 
 static int 
-irix_syssgi_pathconf(path, name, p, retval)
+irix_syssgi_pathconf(path, name, l, retval)
 	char *path;
 	int name;
-	struct proc *p;
+	struct lwp *l;
 	register_t *retval;
 {
 	struct sys_pathconf_args cup;
@@ -575,5 +577,5 @@ irix_syssgi_pathconf(path, name, p, retv
 	}
 	SCARG(&cup, path) = path;
 	SCARG(&cup, name) = bname;
-	return sys_pathconf(p, &cup, retval);
+	return sys_pathconf(l, &cup, retval);
 }
Index: compat/irix/irix_systeminfo.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_systeminfo.c,v
retrieving revision 1.6
diff -u -p -r1.6 irix_systeminfo.c
--- compat/irix/irix_systeminfo.c	2003/01/18 07:44:52	1.6
+++ compat/irix/irix_systeminfo.c	2003/01/22 00:28:14
@@ -77,8 +77,8 @@ char irix_si_version[128] = "04131232";
 #define BUF_SIZE 16
 
 int
-irix_sys_systeminfo(p, v, retval)
-	struct proc *p;
+irix_sys_systeminfo(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -87,6 +87,7 @@ irix_sys_systeminfo(p, v, retval)
 		syscallarg(char *) buf;
 		syscallarg(long) len;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	const char *str = NULL;
 	char strbuf[BUF_SIZE + 1];
 	int error;
@@ -161,7 +162,7 @@ irix_sys_systeminfo(p, v, retval)
 
 	case SVR4_MIPS_SI_SERIAL: /* Unimplemented yet */
 	default:
-		return svr4_sys_systeminfo(p, v, retval);
+		return svr4_sys_systeminfo(l, v, retval);
 		break;
 	}
 
Index: compat/irix/irix_usema.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_usema.c,v
retrieving revision 1.8
diff -u -p -r1.8 irix_usema.c
--- compat/irix/irix_usema.c	2002/10/23 09:12:54	1.8
+++ compat/irix/irix_usema.c	2003/01/22 00:28:15
@@ -405,8 +405,8 @@ IRIX_USEMA_VNOP_WRAP(fcntl)
  * but it is closely related to it.
  */
 int
-irix_sys_usync_cntl(p, v, retval)
-	struct proc *p;
+irix_sys_usync_cntl(l, v, retval)
+	struct lwp *l;
 	void *v;
 	register_t *retval;
 {
@@ -414,6 +414,7 @@ irix_sys_usync_cntl(p, v, retval)
 		syscallarg(int) cmd;
 		syscallarg(void *) arg;
 	} */ *uap = v;
+	struct proc *p = l->l_proc;
 	int error;
 	struct irix_usync_arg iua;
 	struct irix_usema_rec *iur;

----
Rafal Boni                                               rafal.boni@eDial.com
 PGP key C7D3024C, print EA49 160D F5E4 C46A 9E91  524E 11E0 7133 C7D3 024C