From 2a47331e63ec96edebbd96cc0f8b95c50ecc5bd3 Mon Sep 17 00:00:00 2001 From: pooka Date: Wed, 1 Sep 2010 19:41:27 +0000 Subject: [PATCH] update to new rump lwp/proc interfaces --- tests/fs/common/fstest_puffs.c | 8 +++----- tests/fs/tmpfs/t_renamerace.c | 9 ++++++--- tests/fs/vfs/t_renamerace.c | 12 ++++++++---- tests/syscall/t_cmsg.c | 10 ++++++---- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/tests/fs/common/fstest_puffs.c b/tests/fs/common/fstest_puffs.c index 0ca4ce9887d0..73dd5c4bcd6c 100644 --- a/tests/fs/common/fstest_puffs.c +++ b/tests/fs/common/fstest_puffs.c @@ -1,4 +1,4 @@ -/* $NetBSD: fstest_puffs.c,v 1.2 2010/07/30 16:15:05 pooka Exp $ */ +/* $NetBSD: fstest_puffs.c,v 1.3 2010/09/01 19:41:27 pooka Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -72,8 +72,7 @@ readshovel(void *arg) phdr = (void *)buf; preq = (void *)buf; - /* use static thread id */ - rump_pub_lwp_alloc_and_switch(0, 10); + rump_pub_lwproc_newlwp(0); for (;;) { ssize_t n; @@ -114,8 +113,7 @@ writeshovel(void *arg) size_t toread; int comfd, puffsfd; - /* use static thread id */ - rump_pub_lwp_alloc_and_switch(0, 11); + rump_pub_lwproc_newlwp(0); comfd = args->pta_servfd; puffsfd = args->pta_rumpfd; diff --git a/tests/fs/tmpfs/t_renamerace.c b/tests/fs/tmpfs/t_renamerace.c index 7cf7659aa3d5..4eae50152ccf 100644 --- a/tests/fs/tmpfs/t_renamerace.c +++ b/tests/fs/tmpfs/t_renamerace.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_renamerace.c,v 1.8 2010/07/14 21:39:31 pooka Exp $ */ +/* $NetBSD: t_renamerace.c,v 1.9 2010/09/01 19:41:27 pooka Exp $ */ /* * Modified for rump and atf from a program supplied @@ -33,13 +33,14 @@ ATF_TC_HEAD(renamerace2, tc) } static volatile int quittingtime = 0; +static pid_t wrkpid; static void * r2w1(void *arg) { int fd; - rump_pub_lwp_alloc_and_switch(0, 0); + rump_pub_lwproc_newlwp(wrkpid); fd = rump_sys_open("/file", O_CREAT | O_RDWR, 0777); if (fd == -1) @@ -61,7 +62,7 @@ r2w2(void *arg) { int fd; - rump_pub_lwp_alloc_and_switch(0, 0); + rump_pub_lwproc_newlwp(wrkpid); while (!quittingtime) { fd = rump_sys_open("/dir/file1", O_RDWR); @@ -104,6 +105,8 @@ ATF_TC_BODY(renamerace2, tc) if (rump_sys_mkdir("/dir", 0777) == -1) atf_tc_fail_errno("cannot create directory"); + RZ(rump_pub_lwproc_newproc()); + RL(wrkpid = rump_sys_getpid()); pthread_create(&pt[0], NULL, r2w1, NULL); pthread_create(&pt[1], NULL, r2w2, NULL); diff --git a/tests/fs/vfs/t_renamerace.c b/tests/fs/vfs/t_renamerace.c index 4fc32e149bb6..cc6807a8cdbe 100644 --- a/tests/fs/vfs/t_renamerace.c +++ b/tests/fs/vfs/t_renamerace.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_renamerace.c,v 1.11 2010/08/26 18:06:44 pooka Exp $ */ +/* $NetBSD: t_renamerace.c,v 1.12 2010/09/01 19:41:28 pooka Exp $ */ /* * Modified for rump and atf from a program supplied @@ -25,13 +25,14 @@ #include "../../h_macros.h" static volatile int quittingtime; +pid_t wrkpid; static void * w1(void *arg) { int fd; - rump_pub_lwp_alloc_and_switch(0, 10); + rump_pub_lwproc_newlwp(wrkpid); while (!quittingtime) { fd = rump_sys_open("rename.test1", @@ -49,7 +50,7 @@ static void * w1_dirs(void *arg) { - rump_pub_lwp_alloc_and_switch(0, 10); + rump_pub_lwproc_newlwp(wrkpid); while (!quittingtime) { if (rump_sys_mkdir("rename.test1", 0777) == -1) @@ -64,7 +65,7 @@ static void * w2(void *arg) { - rump_pub_lwp_alloc_and_switch(0, 11); + rump_pub_lwproc_newlwp(wrkpid); while (!quittingtime) { rump_sys_rename("rename.test1", "rename.test2"); @@ -123,6 +124,9 @@ renamerace_dirs(const atf_tc_t *tc, const char *mp) FSTYPE_MSDOS(tc)) atf_tc_expect_signal(-1, "PR kern/43626"); + RZ(rump_pub_lwproc_newproc()); + RL(wrkpid = rump_sys_getpid()); + RL(rump_sys_chdir(mp)); pthread_create(&pt1, NULL, w1_dirs, NULL); pthread_create(&pt2, NULL, w2, NULL); diff --git a/tests/syscall/t_cmsg.c b/tests/syscall/t_cmsg.c index c4f60c3d2d7e..3e8a6a6695ca 100644 --- a/tests/syscall/t_cmsg.c +++ b/tests/syscall/t_cmsg.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_cmsg.c,v 1.14 2010/08/27 10:03:14 pgoyette Exp $ */ +/* $NetBSD: t_cmsg.c,v 1.15 2010/09/01 19:41:28 pooka Exp $ */ #include #include @@ -92,7 +92,8 @@ ATF_TC_BODY(cmsg_sendfd, tc) rump_init(); /* create first (non-proc0) process to be used in test */ - l1 = rump_pub_newproc_switch(); + RZ(rump_pub_lwproc_newproc()); + l1 = rump_pub_lwproc_curlwp(); /* create unix socket and bind it to a path */ memset(&sun, 0, sizeof(sun)); @@ -108,7 +109,8 @@ ATF_TC_BODY(cmsg_sendfd, tc) atf_tc_fail_errno("socket 1 listen"); /* create second process for test */ - l2 = rump_pub_newproc_switch(); + RZ(rump_pub_lwproc_newproc()); + l2 = rump_pub_lwproc_curlwp(); /* connect to unix domain socket */ memset(&sun, 0, sizeof(sun)); @@ -157,7 +159,7 @@ ATF_TC_BODY(cmsg_sendfd, tc) *(int *)CMSG_DATA(cmp) = -1; /* switch back to original proc */ - rump_pub_lwp_switch(l1); + rump_pub_lwproc_switch(l1); /* accept connection and read fd */ sl = sizeof(sun);