Wed Sep 14 03:19:11 2016 UTC ()
Fill old_len which is required by sysctlbyname


(ozaki-r)
diff -r1.4 -r1.5 src/tests/rump/modautoload/t_modautoload.c

cvs diff -r1.4 -r1.5 src/tests/rump/modautoload/t_modautoload.c (expand / switch to unified diff)

--- src/tests/rump/modautoload/t_modautoload.c 2015/12/27 08:21:44 1.4
+++ src/tests/rump/modautoload/t_modautoload.c 2016/09/14 03:19:11 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: t_modautoload.c,v 1.4 2015/12/27 08:21:44 pgoyette Exp $ */ 1/* $NetBSD: t_modautoload.c,v 1.5 2016/09/14 03:19:11 ozaki-r Exp $ */
2 2
3#include <sys/types.h> 3#include <sys/types.h>
4#include <sys/mount.h> 4#include <sys/mount.h>
5#include <sys/module.h> 5#include <sys/module.h>
6#include <sys/dirent.h> 6#include <sys/dirent.h>
7#include <sys/sysctl.h> 7#include <sys/sysctl.h>
8 8
9#include <atf-c.h> 9#include <atf-c.h>
10#include <err.h> 10#include <err.h>
11#include <errno.h> 11#include <errno.h>
12#include <fcntl.h> 12#include <fcntl.h>
13#include <stdio.h> 13#include <stdio.h>
14#include <unistd.h> 14#include <unistd.h>
@@ -36,26 +36,27 @@ mountkernfs(void) @@ -36,26 +36,27 @@ mountkernfs(void)
36 bool old_autoload, new_autoload; 36 bool old_autoload, new_autoload;
37 size_t old_len, new_len; 37 size_t old_len, new_len;
38 int error; 38 int error;
39 39
40 if (!rump_nativeabi_p()) 40 if (!rump_nativeabi_p())
41 atf_tc_skip("host kernel modules not supported"); 41 atf_tc_skip("host kernel modules not supported");
42 42
43 rump_init(); 43 rump_init();
44 44
45 if (rump_sys_mkdir("/kern", 0777) == -1) 45 if (rump_sys_mkdir("/kern", 0777) == -1)
46 atf_tc_fail_errno("mkdir /kern"); 46 atf_tc_fail_errno("mkdir /kern");
47 47
48 new_autoload = true; 48 new_autoload = true;
 49 old_len = sizeof(old_autoload);
49 new_len = sizeof(new_autoload); 50 new_len = sizeof(new_autoload);
50 error = sysctlbyname("kern.module.autoload", 51 error = sysctlbyname("kern.module.autoload",
51 &old_autoload, &old_len, 52 &old_autoload, &old_len,
52 &new_autoload, new_len); 53 &new_autoload, new_len);
53 if (error != 0) 54 if (error != 0)
54 atf_tc_fail_errno("could not enable module autoload"); 55 atf_tc_fail_errno("could not enable module autoload");
55 56
56 if (rump_sys_mount(MOUNT_KERNFS, "/kern", 0, NULL, 0) == -1) 57 if (rump_sys_mount(MOUNT_KERNFS, "/kern", 0, NULL, 0) == -1)
57 atf_tc_fail_errno("could not mount kernfs"); 58 atf_tc_fail_errno("could not mount kernfs");
58} 59}
59 60
60/* 61/*
61 * Why use kernfs here? It talks to plenty of other parts with the 62 * Why use kernfs here? It talks to plenty of other parts with the