add test cases

This commit is contained in:
Tomoki Shirasawa
2018-06-07 10:04:33 +09:00
parent f148863586
commit 6602cf442c
10 changed files with 951 additions and 0 deletions

38
test/840/C840T04.c Normal file
View File

@@ -0,0 +1,38 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
int
main(int argc, char **argv)
{
int fd;
void *p;
long l;
fd = open("rpf.data", O_RDONLY);
if (fd == -1) {
perror("open(rpf.data)");
exit(1);
}
p = mmap(NULL, 512*1024*1024, PROT_READ, MAP_PRIVATE, fd, 0);
if (p == (void *)-1) {
perror("mmap");
exit(1);
}
close(fd);
fd = open("rpf.out", O_WRONLY|O_CREAT|O_TRUNC, 0600);
if (fd == -1) {
perror("open(fpt.out)");
exit(1);
}
l = write(fd, p, 512*1024*1024);
printf("write=%ld\n", l);
close(fd);
munmap(p, 512*1024*1024);
exit(0);
}