summaryrefslogtreecommitdiff
path: root/libaio-0.3.109/harness/cases/common-7-8.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2009-10-09 18:17:02 +0000
committer <>2013-09-20 15:53:04 +0000
commite6a27c468cae77ce26f6aa924b22bd39055892fe (patch)
tree5799c05ec62d99e582db411ed0fe5ffd2ba519db /libaio-0.3.109/harness/cases/common-7-8.h
downloadlibaio-tarball-e6a27c468cae77ce26f6aa924b22bd39055892fe.tar.gz
Imported from /home/lorry/working-area/delta_libaio-tarball/libaio_0.3.109.orig.tar.gz.HEADlibaio_0.3.109.origmaster
Diffstat (limited to 'libaio-0.3.109/harness/cases/common-7-8.h')
-rw-r--r--libaio-0.3.109/harness/cases/common-7-8.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/libaio-0.3.109/harness/cases/common-7-8.h b/libaio-0.3.109/harness/cases/common-7-8.h
new file mode 100644
index 0000000..fc54bbf
--- /dev/null
+++ b/libaio-0.3.109/harness/cases/common-7-8.h
@@ -0,0 +1,38 @@
+/* common-7-8.h
+*/
+#include "aio_setup.h"
+
+#include <errno.h>
+#include <unistd.h>
+
+#define SIZE 512
+
+int test_main(void)
+{
+ char *buf;
+ int rwfd;
+ int status = 0, res;
+ long long limit;
+
+ rwfd = open(FILENAME, O_RDWR|O_CREAT, 0600); assert(rwfd != -1);
+ res = ftruncate(rwfd, 0); assert(res == 0);
+ buf = malloc(SIZE); assert(buf != NULL);
+ memset(buf, 0, SIZE);
+
+ limit = LIMIT;
+
+ SET_RLIMIT(limit);
+
+ status |= attempt_rw(rwfd, buf, SIZE, limit-SIZE, WRITE, SIZE);
+ status |= attempt_rw(rwfd, buf, SIZE, limit-SIZE, READ, SIZE);
+
+ status |= attempt_rw(rwfd, buf, SIZE, 1+limit-SIZE, WRITE, SIZE-1);
+ status |= attempt_rw(rwfd, buf, SIZE, 1+limit-SIZE, READ, SIZE-1);
+
+ status |= attempt_rw(rwfd, buf, SIZE, limit, WRITE, -EFBIG);
+ status |= attempt_rw(rwfd, buf, SIZE, limit, READ, 0);
+ status |= attempt_rw(rwfd, buf, 0, limit, WRITE, 0);
+
+ return status;
+}
+