1 /* $NetBSD: t_renamerace.c,v 1.5 2009/04/14 10:19:39 pooka Exp $ */
4 * Modified for rump and atf from a program supplied
5 * by Nicolas Joly in kern/40948
19 #include <rump/rump.h>
20 #include <rump/rump_syscalls.h>
22 #include <fs/tmpfs/tmpfs_args.h>
24 #include "../../h_macros.h"
27 ATF_TC_HEAD(renamerace
, tc
)
29 atf_tc_set_md_var(tc
, "descr", "rename(2) race against files "
30 "unlinked mid-operation, kern/41128");
39 fd
= rump_sys_open("/rename.test1",
40 O_WRONLY
|O_CREAT
|O_TRUNC
, 0666);
41 rump_sys_unlink("/rename.test1");
52 rump_sys_rename("/rename.test1", "/rename.test2");
57 ATF_TC_BODY(renamerace
, tc
)
59 struct tmpfs_args args
;
62 memset(&args
, 0, sizeof(args
));
63 args
.ta_version
= TMPFS_ARGS_VERSION
;
64 args
.ta_root_mode
= 0777;
67 if (rump_sys_mount(MOUNT_TMPFS
, "/", 0, &args
, sizeof(args
)) == -1)
68 atf_tc_fail_errno("could not mount tmpfs");
70 pthread_create(&pt1
, NULL
, w1
, NULL
);
71 pthread_create(&pt2
, NULL
, w2
, NULL
);
78 ATF_TP_ADD_TC(tp
, renamerace
);