Handle fork1/forkall on uw, handle rfork1,rforkall,rexecve and ssisys on uw non-stop-clusters
diff --git a/ChangeLog b/ChangeLog
index 1908378..2d44a46 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-04-18  John Hughes <john@Calva.COM>
+
+  * configure.in: test for sys/nscsys.h, the non-stop clusters includes.
+  * process.c: handle rfork{1,all} and rexecve calls on non-stop clusters.
+  * syscall.c: treat rfork{1,all} and fork{1,all} as fork like calls.
+    Treat rexecve as an exec.
+  * system.c: decode arguments to ssisys call on nsc systems.
+  * svr4/dummy.h, svr4/syscall.h: now we handle rfork{1,all}, ssisys and
+    rexecve calls.
+
 2001-04-12  Wichert Akkerman <wakkerma@debian.org>
 
   * process.c: fix cast for powerpc code
diff --git a/configure.in b/configure.in
index d5cfcf0..1e8d2d8 100644
--- a/configure.in
+++ b/configure.in
@@ -163,7 +163,7 @@
 AC_CHECK_LIB(nsl, main)
 fi
 AC_CHECK_FUNCS(sigaction strerror strsignal pread sys_siglist _sys_siglist getdents mctl putpmsg prctl sendmsg inet_ntop if_indextoname)
-AC_CHECK_HEADERS(sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h asm/sigcontext.h ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h linux/icmp.h linux/in6.h sys/uio.h sys/aio.h linux/netlink.h linux/if_packet.h poll.h sys/poll.h sys/vfs.h netinet/tcp.h netinet/udp.h asm/sysmips.h linux/utsname.h)
+AC_CHECK_HEADERS(sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h asm/sigcontext.h ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h linux/icmp.h linux/in6.h sys/uio.h sys/aio.h linux/netlink.h linux/if_packet.h poll.h sys/poll.h sys/vfs.h netinet/tcp.h netinet/udp.h asm/sysmips.h linux/utsname.h sys/nscsys.h)
 AC_DECL_SYS_ERRLIST
 AC_DECL_SYS_SIGLIST
 AC_DECL__SYS_SIGLIST
diff --git a/process.c b/process.c
index 13dd69a..76d0deb 100644
--- a/process.c
+++ b/process.c
@@ -366,6 +366,26 @@
 	return 0;
 }
 
+#if UNIXWARE > 2
+
+int
+sys_rfork(tcp)
+struct tcb *tcp;
+{
+	if (entering(tcp)) {
+		tprintf ("%ld", tcp->u_arg[0]);
+	}
+	else {
+		if (getrval2(tcp)) {
+			tcp->auxstr = "child process";
+			return RVAL_UDECIMAL | RVAL_STR;
+		}
+	}
+	return 0;
+}
+
+#endif
+
 int
 internal_fork(tcp)
 struct tcb *tcp;
@@ -1185,6 +1205,20 @@
 	return 0;
 }
 
+#if UNIXWARE > 2
+
+int sys_rexecve(tcp)
+struct tcb *tcp;
+{
+	if (entering (tcp)) {
+		sys_execve (tcp);
+		tprintf (", %ld", tcp->u_arg[3]);
+	}
+	return 0;
+}
+
+#endif
+
 int
 internal_exec(tcp)
 struct tcb *tcp;
diff --git a/svr4/dummy.h b/svr4/dummy.h
index 616e86a..011d547 100644
--- a/svr4/dummy.h
+++ b/svr4/dummy.h
@@ -185,12 +185,8 @@
 #define sys_xsetsockaddr printargs
 #define sys_dshmsys printargs
 #define sys_invlpg printargs
-#define sys_rfork1 printargs
-#define sys_rforkall printargs
-#define sys_rexecve printargs
 #define sys_migrate printargs
 #define sys_kill3 printargs
-#define sys_ssisys printargs
 #define sys_xbindresvport printargs
 #define sys_lwp_sema_trywait printargs
 #define sys_tsolsys printargs
@@ -235,6 +231,13 @@
 #define sys_sleep sys_alarm
 #define sys_fork1 sys_fork
 #define sys_forkall sys_fork
+#if UNIXWARE > 2
+#define sys_rfork1 sys_rfork
+#define sys_rforkall sys_rfork
+#ifndef HAVE_SYS_NSCSYS_H
+#define sys_ssisys printargs
+#endif
+#endif
 
 /* aio */
 #define sys_aionotify printargs
diff --git a/svr4/syscall.h b/svr4/syscall.h
index 21cf8d3..22b55f1 100644
--- a/svr4/syscall.h
+++ b/svr4/syscall.h
@@ -326,6 +326,9 @@
 extern int sys_xgetsockopt ();
 extern int sys_xsetsockopt ();
 extern int sys_xshutdown ();
+extern int sys_rfork ();
+extern int sys_ssisys ();
+extern int sys_rexecve ();
 #endif
 #endif /* !MIPS */
 
diff --git a/syscall.c b/syscall.c
index 39cc026..be988df 100644
--- a/syscall.c
+++ b/syscall.c
@@ -578,6 +578,18 @@
 #ifdef SYS_vfork
 	case SYS_vfork:
 #endif
+#ifdef SYS_fork1
+	case SYS_fork1:
+#endif
+#ifdef SYS_forkall
+	case SYS_forkall:
+#endif
+#ifdef SYS_rfork1
+	case SYS_rfork1:
+#endif
+#ifdef SYS_rforkall
+	case SYS_rforkall:
+#endif
 		internal_fork(tcp);
 		break;
 #ifdef SYS_clone
@@ -591,6 +603,9 @@
 #ifdef SYS_execve
 	case SYS_execve:
 #endif
+#ifdef SYS_rexecve
+	case SYS_rexecve:
+#endif
 		internal_exec(tcp);
 		break;
 
@@ -879,6 +894,18 @@
 #ifdef SYS_vfork
 			    || scno == SYS_vfork
 #endif /* SYS_vfork */
+#ifdef SYS_fork1
+			    || scno == SYS_fork1
+#endif /* SYS_fork1 */
+#ifdef SYS_forkall
+			    || scno == SYS_forkall
+#endif /* SYS_forkall */
+#ifdef SYS_rfork1
+			    || scno == SYS_rfork1
+#endif /* SYS_fork1 */
+#ifdef SYS_rforkall
+			    || scno == SYS_rforkall
+#endif /* SYS_rforkall */
 			    ) {
 				/* We are returning in the child, fake it. */
 				tcp->status.PR_WHY = PR_SYSENTRY;
diff --git a/system.c b/system.c
index d1ee494..da0aa14 100644
--- a/system.c
+++ b/system.c
@@ -2008,6 +2008,95 @@
 	return 0;
 }
 
+#ifdef HAVE_SYS_NSCSYS_H
+
+#include <sys/nscsys.h>
+
+static struct xlat ssi_cmd [] = {
+	{ SSISYS_BADOP,	"SSISYS_BADOP"	},
+	{ SSISYS_LDLVL_INIT,"SSISYS_LDLVL_INIT"},
+	{ SSISYS_LDLVL_GETVEC,"SSISYS_LDLVL_GETVEC"},
+	{ SSISYS_LDLVL_PUTVEC,"SSISYS_LDLVL_PUTVEC"},
+	{ SSISYS_LDLVL_PUTRCMDS,"SSISYS_LDLVL_PUTRCMDS"},
+	{ SSISYS_LDLVL_SETREXEC,"SSISYS_LDLVL_SETREXEC"},
+	{ SSISYS_CMS_CLUSTERID,"SSISYS_CMS_CLUSTERID"},
+	{ SSISYS_CFS_STATVFS,"SSISYS_CFS_STATVFS"},
+	{ SSISYS_NODE_GETNUM,"SSISYS_NODE_GETNUM"},
+	{ SSISYS_NODE_TABLE,"SSISYS_NODE_TABLE"},
+	{ SSISYS_NODE_DOWN,"SSISYS_NODE_DOWN"},
+	{ SSISYS_RECLAIM_CHILD,"SSISYS_RECLAIM_CHILD"},
+	{ SSISYS_IPC_GETINFO,"SSISYS_IPC_GETINFO"},
+	{ SSISYS_ICS_TEST,"SSISYS_ICS_TEST"},
+	{ SSISYS_NODE_PID,"SSISYS_NODE_PID"},
+	{ SSISYS_ISLOCAL,"SSISYS_ISLOCAL"},
+	{ SSISYS_CFS_ISSTACKED,"SSISYS_CFS_ISSTACKED"},
+	{ SSISYS_DNET_SYNC,"SSISYS_DNET_SYNC"},
+	{ SSISYS_CFS_WAIT_MODE,"SSISYS_CFS_WAIT_MODE"},
+	{ SSISYS_CFS_UMOUNT,"SSISYS_CFS_UMOUNT"},
+	{ SSISYS_LLSTAT,"SSISYS_LLSTAT"	},
+	{ SSISYS_LTS_PERFTEST,"SSISYS_LTS_PERFTEST"},
+	{ SSISYS_LTS_CONFIG,"SSISYS_LTS_CONFIG"},
+	{ SSISYS_SNET_PERFTEST,"SSISYS_SNET_PERFTEST"},
+	{ SSISYS_IGNORE_HALFUP,"SSISYS_IGNORE_HALFUP"},
+	{ SSISYS_NODE_ROOTDEV,"SSISYS_NODE_ROOTDEV"},
+	{ SSISYS_GET_PRIMARY,"SSISYS_GET_PRIMARY"},
+	{ SSISYS_GET_SECONDARY,"SSISYS_GET_SECONDARY"},
+	{ SSISYS_GET_ROOTDISK,"SSISYS_GET_ROOTDISK"},
+	{ SSISYS_CLUSTERNODE_NUM,"SSISYS_CLUSTERNODE_NUM"},
+	{ SSISYS_CLUSTER_MEMBERSHIP,"SSISYS_CLUSTER_MEMBERSHIP"},
+	{ SSISYS_CLUSTER_DETAILEDTRANS,"SSISYS_CLUSTER_DETAILEDTRANS"},
+	{ SSISYS_CLUSTERNODE_INFO,"SSISYS_CLUSTERNODE_INFO"},
+	{ SSISYS_CLUSTERNODE_SETINFO,"SSISYS_CLUSTERNODE_SETINFO"},
+	{ SSISYS_CLUSTERNODE_AVAIL,"SSISYS_CLUSTERNODE_AVAIL"},
+	{ SSISYS_CLUSTER_MAXNODES,"SSISYS_CLUSTER_MAXNODES"},
+	{ SSISYS_SET_MEMPRIO,"SSISYS_SET_MEMPRIO"},
+	{ SSISYS_GET_USERS,"SSISYS_GET_USERS"},
+	{ SSISYS_FORCE_ROOT_NODE,"SSISYS_FORCE_ROOT_NODE"},
+	{ SSISYS_CVIP_SET,"SSISYS_CVIP_SET"},
+	{ SSISYS_CVIP_GET,"SSISYS_CVIP_GET"},
+	{ SSISYS_GET_NODE_COUNTS,"SSISYS_GET_NODE_COUNTS"},
+	{ SSISYS_GET_TRANSPORT,"SSISYS_GET_TRANSPORT"},
+	{ 0,		NULL		},
+};
+
+int sys_ssisys (tcp)
+struct tcb *tcp;
+{
+	struct ssisys_iovec iov;
+	
+	if (entering (tcp)) {
+		if (tcp->u_arg[1] != sizeof iov ||
+		    umove (tcp, tcp->u_arg[0], &iov) < 0)
+		{
+			tprintf ("%#lx, %ld", tcp->u_arg[0], tcp->u_arg[1]);
+			return 0;
+		}
+		tprintf ("{id=");
+		printxval(ssi_cmd, iov.tio_id.id_cmd, "SSISYS_???");
+		tprintf (":%d", iov.tio_id.id_ver);
+		switch (iov.tio_id.id_cmd) {
+		    default:
+			if (iov.tio_udatainlen) {
+				tprintf (", in=[/* %d bytes */]",
+					 iov.tio_udatainlen);
+			}
+		}
+	}
+	else {
+		switch (iov.tio_id.id_cmd) {
+		    default:
+			if (iov.tio_udataoutlen) {
+				tprintf (", out=[/* %d bytes */]",
+					 iov.tio_udataoutlen);
+			}
+		}
+		tprintf ("}, %ld", tcp->u_arg[1]);
+	}
+	return 0;
+}
+
+#endif
+
 #endif /* UNIXWARE > 2 */
 
 #ifdef MIPS