Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 38 lines (28 sloc) 0.76 kB
5c75bce @anttikantee An implementation of the rump kernel hypercall interface for the Linu…
anttikantee authored
1 /*
2 * Mount the kernfs file system inside the rump kernel and read
3 * version info from it. It should be the same as the one displayed
4 * as part of a verbose boot.
5 */
6
7 #include <linux/kernel.h>
8 #include <linux/bug.h>
9
10 #include <rump/rump.h>
11 #include <rump/rump_syscalls.h>
12
13 void rumpkern_demo(void);
14
15 void
16 rumpkern_demo(void)
17 {
18 char buf[256];
19 ssize_t nn;
20 int fd, rv;
21
22 printk(KERN_INFO "reading rump kernel version from kernfs/version:\n");
23 rv = rump_sys_mkdir("/mnt", 0777);
24 BUG_ON(rv == -1);
25
26 rv = rump_sys_mount("kernfs", "/mnt", 0, NULL, 0);
27 BUG_ON(rv == -1);
28
29 fd = rump_sys_open("/mnt/version", RUMP_O_RDONLY, 0);
30 BUG_ON(rv == -1);
31
32 nn = rump_sys_read(fd, buf, sizeof(buf));
33 BUG_ON(nn < 1);
34 buf[nn] = '\0';
35
36 printk(KERN_INFO "%s", buf);
37 }
Something went wrong with that request. Please try again.