1 /* Simple test program for O_APPEND writes (checked by append_reader.c)
3 * Contributed by hatakeyama@bsd.tnes.nec.co.jp
11 #include <sys/param.h>
13 int main(int argc, char **argv)
15 char file[MAXPATHLEN];
16 int fd, i, iterations;
21 iterations = atoi(argv[1]);
23 sprintf(file, "testfile.%d", getpid());
25 if ((fd = open(file, O_CREAT | O_RDWR | O_APPEND, 0600)) == -1) {
26 perror("couldn't open");
30 for (i = 0; i < iterations;i++) {
31 if (write(fd, &i, sizeof(i)) != sizeof(i)) {
32 perror("couldn't write");