Module Name:    src
Committed By:   pooka
Date:           Sat May  1 11:20:21 UTC 2010

Modified Files:
        src/tests/rump/rumpkern: t_modcmd.c

Log Message:
Disable module autoload so that it won't foil our module unload test.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/rump/rumpkern/t_modcmd.c

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

Modified files:

Index: src/tests/rump/rumpkern/t_modcmd.c
diff -u src/tests/rump/rumpkern/t_modcmd.c:1.5 src/tests/rump/rumpkern/t_modcmd.c:1.6
--- src/tests/rump/rumpkern/t_modcmd.c:1.5	Fri Mar  5 18:49:30 2010
+++ src/tests/rump/rumpkern/t_modcmd.c	Sat May  1 11:20:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_modcmd.c,v 1.5 2010/03/05 18:49:30 pooka Exp $	*/
+/*	$NetBSD: t_modcmd.c,v 1.6 2010/05/01 11:20:21 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,6 +29,7 @@
 
 #include <sys/types.h>
 #include <sys/mount.h>
+#include <sys/sysctl.h>
 
 #include <rump/rump.h>
 #include <rump/rump_syscalls.h>
@@ -59,6 +60,58 @@
 	    "a module (vfs/tmpfs) is possible");
 }
 
+static int
+disable_autoload(void)
+{
+	struct sysctlnode q, ans[256];
+	int mib[3];
+	size_t alen;
+	unsigned i;
+	bool no;
+
+	mib[0] = CTL_KERN;
+	mib[1] = CTL_QUERY;
+	alen = sizeof(ans);
+
+	memset(&q, 0, sizeof(q));
+	q.sysctl_flags = SYSCTL_VERSION;
+
+	if (rump_sys___sysctl(mib, 2, ans, &alen, &q, sizeof(q)) == -1)
+		return -1;
+
+	for (i = 0; i < __arraycount(ans); i++)
+		if (strcmp("module", ans[i].sysctl_name) == 0)
+			break;
+	if (i == __arraycount(ans)) {
+		errno = ENOENT;
+		return -1;
+	}
+
+	mib[1] = ans[i].sysctl_num;
+	mib[2] = CTL_QUERY;
+
+	if (rump_sys___sysctl(mib, 3, ans, &alen, &q, sizeof(q)) == -1)
+		return errno;
+
+	for (i = 0; i < __arraycount(ans); i++)
+		if (strcmp("autoload", ans[i].sysctl_name) == 0)
+			break;
+	if (i == __arraycount(ans)) {
+		errno = ENOENT;
+		return -1;
+	}
+
+	mib[2] = ans[i].sysctl_num;
+
+	no = false;
+	alen = 0;
+	if (rump_sys___sysctl(mib, 3, NULL, &alen, &no, sizeof(no)) == -1)
+		return errno;
+
+	return 0;
+
+}
+
 #define TMPFSMODULE "librumpfs_tmpfs.so"
 ATF_TC_BODY(cmsg_modcmd, tc)
 {
@@ -68,6 +121,10 @@
 	int i, rv, loop = 0;
 
 	rump_init();
+
+	if (disable_autoload() == -1)
+		atf_tc_fail_errno("count not disable module autoload");
+
 	memset(&args, 0, sizeof(args));
 	args.ta_version = TMPFS_ARGS_VERSION;
 	args.ta_root_mode = 0777;

Reply via email to