From 6019598fdb9d223beec7da5848cf950ca90e85e7 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 24 May 2020 23:46:41 +0200 Subject: contrib: collect getdents stuff in getdents-debug folder --- contrib/getdents_c/getdents.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 contrib/getdents_c/getdents.c (limited to 'contrib/getdents_c/getdents.c') diff --git a/contrib/getdents_c/getdents.c b/contrib/getdents_c/getdents.c deleted file mode 100644 index 98c2346..0000000 --- a/contrib/getdents_c/getdents.c +++ /dev/null @@ -1,39 +0,0 @@ -// See ../getdents/getdents.go for some info on why -// this exists. - -#include -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - if(argc < 2) { - printf("Usage: %s PATH\n", argv[0]); - printf("Run getdents(2) on PATH\n"); - exit(1); - } - - const char *path = argv[1]; - int fd = open(path, O_RDONLY); - if (fd == -1) { - perror("open"); - exit(1); - } - - char tmp[10000]; - int sum = 0; - for ( ; ; ) { - int n = syscall(SYS_getdents64, fd, tmp, sizeof(tmp)); - printf("getdents64 fd%d: n=%d, errno=%d\n", fd, n, errno); - if (n <= 0) { - printf("total %d bytes\n", sum); - break; - } - sum += n; - } -} -- cgit v1.2.3