aboutsummaryrefslogtreecommitdiff
path: root/tests/fcntl-misc/src.c
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-07-20 10:20:09 +0300
committermax99x <max99x@gmail.com>2011-07-21 02:48:24 +0300
commit10ca04685b6e0ec0e8089fbe859e0085d8020622 (patch)
treee256b40bfbf8324e73c977b82c36cc4a227f7be5 /tests/fcntl-misc/src.c
parent278416d5426493959216d46279d3c40f91f33f81 (diff)
Implemented <fcntl.h>.
Diffstat (limited to 'tests/fcntl-misc/src.c')
-rw-r--r--tests/fcntl-misc/src.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/fcntl-misc/src.c b/tests/fcntl-misc/src.c
new file mode 100644
index 00000000..73734969
--- /dev/null
+++ b/tests/fcntl-misc/src.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main() {
+ struct stat s;
+ int f = open("/test", O_RDONLY, 0777);
+
+ printf("posix_fadvise: %d\n", posix_fadvise(f, 3, 2, POSIX_FADV_DONTNEED));
+ printf("errno: %d\n", errno);
+ printf("\n");
+ errno = 0;
+
+ printf("posix_fallocate: %d\n", posix_fallocate(f, 3, 2));
+ printf("errno: %d\n", errno);
+ stat("/test", &s);
+ printf("st_size: %d\n", s.st_size);
+ memset(&s, 0, sizeof s);
+ printf("\n");
+ errno = 0;
+
+ printf("posix_fallocate2: %d\n", posix_fallocate(f, 3, 7));
+ printf("errno: %d\n", errno);
+ stat("/test", &s);
+ printf("st_size: %d\n", s.st_size);
+ memset(&s, 0, sizeof s);
+
+ return 0;
+}