Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/regress/sys/kern/write_append This functionality is tested i...
details: https://anonhg.NetBSD.org/src/rev/18964251c403
branches: trunk
changeset: 782584:18964251c403
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Wed Nov 07 17:14:02 2012 +0000
description:
This functionality is tested in tests/fs/vfs/t_io
diffstat:
regress/sys/kern/write_append/Makefile | 15 ------------
regress/sys/kern/write_append/write_append.c | 34 ----------------------------
2 files changed, 0 insertions(+), 49 deletions(-)
diffs (57 lines):
diff -r b259e362219d -r 18964251c403 regress/sys/kern/write_append/Makefile
--- a/regress/sys/kern/write_append/Makefile Wed Nov 07 16:52:01 2012 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-# $NetBSD: Makefile,v 1.1 2008/08/27 06:40:13 christos Exp $
-
-NOMAN= # defined
-
-PROG= write_append
-WARNS?= 4
-
-regress:
- @if ${.OBJDIR}/${PROG} 2> /dev/null; then \
- echo "PASSED"; \
- else \
- echo "FAILED"; \
- fi
-
-.include <bsd.prog.mk>
diff -r b259e362219d -r 18964251c403 regress/sys/kern/write_append/write_append.c
--- a/regress/sys/kern/write_append/write_append.c Wed Nov 07 16:52:01 2012 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#include <err.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-static const char fn[] = "/tmp/write-test.txt";
-static const char str[] = "Test write() append\n";
-static size_t len = sizeof(str) - 1;
-
-int
-main(void)
-{
- int fd;
- off_t off;
-
- if ((fd = open(fn, O_CREAT | O_RDWR, 0600)) == -1)
- err(1, "Cannot open `%s'", fn);
- if (write(fd, str, len) != (ssize_t)len)
- err(1, "Write failed");
- if (close(fd) == -1)
- err(1, "Close failed");
- if ((fd = open(fn, O_WRONLY | O_APPEND)) == -1)
- err(1, "Cannot open `%s'", fn);
- if ((off = lseek(fd, (off_t) 0, SEEK_SET)) != (off_t)0)
- err(1, "Seek failed");
- if (write(fd, str, 0) != 0)
- err(1, "Write failed");
- if ((off = lseek(fd, (off_t) 0, SEEK_CUR)) != (off_t)0)
- errx(1, "bad seek offset %lld\n", (long long)off);
- if (close(fd) == -1)
- err(1, "Close failed");
- if (unlink(fn) == -1)
- err(1, "Unlink failed");
- return 0;
-}
Home |
Main Index |
Thread Index |
Old Index