update to new rump lwp/proc interfaces

This commit is contained in:
pooka 2010-09-01 19:41:27 +00:00
parent cd52561abe
commit 2a47331e63
4 changed files with 23 additions and 16 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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 <sys/types.h>
#include <sys/mount.h>
@ -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);