Module Name:    src
Committed By:   pooka
Date:           Sat Jan 22 13:41:22 UTC 2011

Modified Files:
        src/lib/librumpuser: rumpuser_sp.c sp_common.c
        src/sys/rump/include/rump: rumpuser.h
        src/sys/rump/librump/rumpkern: rump.c

Log Message:
In case sys_reboot() was called by a remote client, put the response
in the socket before we shut down.  This way the response to the
syscall travels to the caller and they know things worked correctly
instead of having to just assume.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/librumpuser/rumpuser_sp.c
cvs rdiff -u -r1.24 -r1.25 src/lib/librumpuser/sp_common.c
cvs rdiff -u -r1.63 -r1.64 src/sys/rump/include/rump/rumpuser.h
cvs rdiff -u -r1.219 -r1.220 src/sys/rump/librump/rumpkern/rump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumpuser/rumpuser_sp.c
diff -u src/lib/librumpuser/rumpuser_sp.c:1.36 src/lib/librumpuser/rumpuser_sp.c:1.37
--- src/lib/librumpuser/rumpuser_sp.c:1.36	Fri Jan 14 13:12:14 2011
+++ src/lib/librumpuser/rumpuser_sp.c	Sat Jan 22 13:41:22 2011
@@ -1,4 +1,4 @@
-/*      $NetBSD: rumpuser_sp.c,v 1.36 2011/01/14 13:12:14 pooka Exp $	*/
+/*      $NetBSD: rumpuser_sp.c,v 1.37 2011/01/22 13:41:22 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: rumpuser_sp.c,v 1.36 2011/01/14 13:12:14 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_sp.c,v 1.37 2011/01/22 13:41:22 pooka Exp $");
 
 #include <sys/types.h>
 #include <sys/atomic.h>
@@ -584,7 +584,9 @@
 	    sysnum, spc->spc_pid));
 
 	lwproc_newlwp(spc->spc_pid);
+	spc->spc_syscallreq = rhdr->rsp_reqno;
 	rv = rumpsyscall(sysnum, data, retval);
+	spc->spc_syscallreq = 0;
 	lwproc_release();
 
 	DPRINTF(("rump_sp: got return value %d & %d/%d\n",
@@ -1143,8 +1145,17 @@
 }
 
 void
-rumpuser_sp_fini()
+rumpuser_sp_fini(void *arg)
 {
+	struct spclient *spc = arg;
+	register_t retval[2] = {0, 0};
+
+	/*
+	 * stuff response into the socket, since this process is just
+	 * about to exit
+	 */
+	if (spc && spc->spc_syscallreq)
+		send_syscall_resp(spc, spc->spc_syscallreq, 0, retval);
 
 	if (spclist[0].spc_fd) {
 		parsetab[cleanupidx].cleanup(cleanupsa);

Index: src/lib/librumpuser/sp_common.c
diff -u src/lib/librumpuser/sp_common.c:1.24 src/lib/librumpuser/sp_common.c:1.25
--- src/lib/librumpuser/sp_common.c:1.24	Fri Jan 14 13:12:14 2011
+++ src/lib/librumpuser/sp_common.c	Sat Jan 22 13:41:22 2011
@@ -1,4 +1,4 @@
-/*      $NetBSD: sp_common.c,v 1.24 2011/01/14 13:12:14 pooka Exp $	*/
+/*      $NetBSD: sp_common.c,v 1.25 2011/01/22 13:41:22 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -176,6 +176,7 @@
 	size_t spc_off;
 
 	uint64_t spc_nextreq;
+	uint64_t spc_syscallreq;
 	int spc_ostatus, spc_istatus;
 
 	LIST_HEAD(, prefork) spc_pflist;

Index: src/sys/rump/include/rump/rumpuser.h
diff -u src/sys/rump/include/rump/rumpuser.h:1.63 src/sys/rump/include/rump/rumpuser.h:1.64
--- src/sys/rump/include/rump/rumpuser.h:1.63	Fri Jan 14 13:11:08 2011
+++ src/sys/rump/include/rump/rumpuser.h	Sat Jan 22 13:41:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser.h,v 1.63 2011/01/14 13:11:08 pooka Exp $	*/
+/*	$NetBSD: rumpuser.h,v 1.64 2011/01/22 13:41:22 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -36,7 +36,7 @@
 #include <stdint.h>
 #endif
 
-#define RUMPUSER_VERSION 10
+#define RUMPUSER_VERSION 11
 int rumpuser_getversion(void);
 
 int rumpuser_daemonize_begin(void);
@@ -230,6 +230,6 @@
 int	rumpuser_sp_copyoutstr(void *, const void *, void *, size_t *);
 int	rumpuser_sp_anonmmap(void *, size_t, void **);
 int	rumpuser_sp_raise(void *, int);
-void	rumpuser_sp_fini(void);
+void	rumpuser_sp_fini(void *);
 
 #endif /* _RUMP_RUMPUSER_H_ */

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.219 src/sys/rump/librump/rumpkern/rump.c:1.220
--- src/sys/rump/librump/rumpkern/rump.c:1.219	Wed Jan 12 12:51:21 2011
+++ src/sys/rump/librump/rumpkern/rump.c	Sat Jan 22 13:41:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.219 2011/01/12 12:51:21 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.220 2011/01/22 13:41:22 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.219 2011/01/12 12:51:21 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.220 2011/01/22 13:41:22 pooka Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -498,9 +498,15 @@
 cpu_reboot(int howto, char *bootstr)
 {
 	int ruhow = 0;
+	void *finiarg;
 
 	printf("rump kernel halting...\n");
-	rumpuser_sp_fini();
+
+	if (!RUMP_LOCALPROC_P(curproc))
+		finiarg = curproc->p_vmspace->vm_map.pmap;
+	else
+		finiarg = NULL;
+	rumpuser_sp_fini(finiarg);
 
 	/* dump means we really take the dive here */
 	if ((howto & RB_DUMP) || panicstr) {

Reply via email to