Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/syscall Since rumpfs has supported file system sockets...



details:   https://anonhg.NetBSD.org/src/rev/f211377a3db6
branches:  trunk
changeset: 749330:f211377a3db6
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Nov 26 17:33:23 2009 +0000

description:
Since rumpfs has supported file system sockets for quite a while
now, we don't need tmpfs here.  But, rumpfs doesn't support regular
files, so pass a pipe descriptor instead of an open file fd.

diffstat:

 tests/syscall/Makefile |   4 ++--
 tests/syscall/t_cmsg.c |  32 ++++++++------------------------
 2 files changed, 10 insertions(+), 26 deletions(-)

diffs (94 lines):

diff -r b98fb4a264f3 -r f211377a3db6 tests/syscall/Makefile
--- a/tests/syscall/Makefile    Thu Nov 26 17:29:34 2009 +0000
+++ b/tests/syscall/Makefile    Thu Nov 26 17:33:23 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 2009/11/25 16:17:11 pooka Exp $
+# $NetBSD: Makefile,v 1.8 2009/11/26 17:33:23 pooka Exp $
 
 .include <bsd.own.mk>
 
@@ -7,7 +7,7 @@
 TESTS_C+=      t_cmsg
 
 LDADD+=        -lrumpnet_local -lrumpnet_net -lrumpnet
-LDADD+=        -lrumpfs_tmpfs -lrumpvfs -lrump -lrumpuser -lpthread
+LDADD+=        -lrumpvfs -lrump -lrumpuser -lpthread
 
 WARNS=         4
 
diff -r b98fb4a264f3 -r f211377a3db6 tests/syscall/t_cmsg.c
--- a/tests/syscall/t_cmsg.c    Thu Nov 26 17:29:34 2009 +0000
+++ b/tests/syscall/t_cmsg.c    Thu Nov 26 17:33:23 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_cmsg.c,v 1.11 2009/11/06 15:28:21 pooka Exp $        */
+/*     $NetBSD: t_cmsg.c,v 1.12 2009/11/26 17:33:23 pooka Exp $        */
 
 #include <sys/types.h>
 #include <sys/mount.h>
@@ -8,8 +8,6 @@
 #include <rump/rump.h>
 #include <rump/rump_syscalls.h>
 
-#include <fs/tmpfs/tmpfs_args.h>
-
 #include <atf-c.h>
 #include <fcntl.h>
 #include <err.h>
@@ -84,25 +82,14 @@
        char buf[128];
        struct cmsghdr *cmp;
        struct msghdr msg;
-       struct tmpfs_args args;
        struct sockaddr_un sun;
        struct lwp *l1, *l2;
        struct iovec iov;
        socklen_t sl;
        int s1, s2, sgot;
-       int rfd, fd, storage;
-
-       memset(&args, 0, sizeof(args));
-       args.ta_version = TMPFS_ARGS_VERSION;
-       args.ta_root_mode = 0777;
+       int rfd, fd[2], storage;
 
        rump_init();
-       /*
-        * mount tmpfs as root -- rump root file system does not support
-        * unix domain sockets.
-        */
-       if (rump_sys_mount(MOUNT_TMPFS, "/", 0, &args, sizeof(args)) == -1)
-               atf_tc_fail_errno("mount tmpfs");
 
        /* create first (non-proc0) process to be used in test */
        l1 = rump_pub_newproc_switch();
@@ -133,16 +120,13 @@
        if (rump_sys_connect(s2, (struct sockaddr *)&sun, SUN_LEN(&sun)) == -1)
                atf_tc_fail_errno("socket 2 connect");
 
-       /* open a file and write stuff to it */
-       fd = rump_sys_open("/foobie", O_RDWR | O_CREAT, 0777);
-       if (fd == -1)
-               atf_tc_fail_errno("can't open file");
+       /* open a pipe and write stuff to it */
+       if (rump_sys_pipe(fd) == -1)
+               atf_tc_fail_errno("can't open pipe");
 #define MAGICSTRING "duam xnaht"
-       if (rump_sys_write(fd, MAGICSTRING, sizeof(MAGICSTRING)) !=
+       if (rump_sys_write(fd[1], MAGICSTRING, sizeof(MAGICSTRING)) !=
            sizeof(MAGICSTRING))
-               atf_tc_fail_errno("file write"); /* XXX: errno */
-       /* reset offset */
-       rump_sys_lseek(fd, 0, SEEK_SET);
+               atf_tc_fail_errno("pipe write"); /* XXX: errno */
 
        cmp = malloc(CMSG_LEN(sizeof(int)));
 
@@ -159,7 +143,7 @@
        msg.msg_namelen = 0;
        msg.msg_control = cmp;
        msg.msg_controllen = CMSG_LEN(sizeof(int));
-       *(int *)CMSG_DATA(cmp) = fd;
+       *(int *)CMSG_DATA(cmp) = fd[0];
 
        /* pass the fd */
        if (rump_sys_sendmsg(s2, &msg, 0) == -1)



Home | Main Index | Thread Index | Old Index