summaryrefslogtreecommitdiff
path: root/contrib/getdents
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-05-24 23:46:41 +0200
committerJakob Unterwurzacher2020-05-24 23:46:41 +0200
commit6019598fdb9d223beec7da5848cf950ca90e85e7 (patch)
treebf2a6ee2241b4dd1b5331d0514cafd455d9a1b4a /contrib/getdents
parent71c0481f0e42c6bf1749dde8a30d9a6b728e83a0 (diff)
contrib: collect getdents stuff in getdents-debug folder
Diffstat (limited to 'contrib/getdents')
-rw-r--r--contrib/getdents/.gitignore1
-rw-r--r--contrib/getdents/getdents.go75
2 files changed, 0 insertions, 76 deletions
diff --git a/contrib/getdents/.gitignore b/contrib/getdents/.gitignore
deleted file mode 100644
index 6dae481..0000000
--- a/contrib/getdents/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/getdents
diff --git a/contrib/getdents/getdents.go b/contrib/getdents/getdents.go
deleted file mode 100644
index a70692a..0000000
--- a/contrib/getdents/getdents.go
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-Small tool to try to debug unix.Getdents problems on CIFS mounts
-( https://github.com/rfjakob/gocryptfs/issues/483 )
-
-Example output:
-
-$ while sleep 1 ; do ./getdents /mnt/synology/public/tmp/g1 ; done
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=3192, err=<nil>
-unix.Getdents fd3: n=0, err=<nil>
-total 24072 bytes
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=-1, err=no such file or directory
-total 16704 bytes
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=4176, err=<nil>
-unix.Getdents fd3: n=3192, err=<nil>
-unix.Getdents fd3: n=0, err=<nil>
-total 24072 bytes
-*/
-
-package main
-
-import (
- "flag"
- "fmt"
- "log"
- "os"
-
- "golang.org/x/sys/unix"
-)
-
-const (
- myName = "getdents"
-)
-
-func main() {
- flag.Usage = func() {
- fmt.Fprintf(os.Stderr, "Usage: %s PATH\n", myName)
- fmt.Fprintf(os.Stderr, "Run getdents(2) on PATH\n")
- os.Exit(1)
- }
- flag.Parse()
- if flag.NArg() != 1 {
- flag.Usage()
- }
- path := flag.Arg(0)
-
- fd, err := unix.Open(path, unix.O_RDONLY, 0)
- if err != nil {
- log.Fatalf("unix.Open returned err=%v", err)
- }
-
- tmp := make([]byte, 10000)
- sum := 0
- for {
- n, err := unix.Getdents(fd, tmp)
- fmt.Printf("unix.Getdents fd%d: n=%d, err=%v\n", fd, n, err)
- if n <= 0 {
- fmt.Printf("total %d bytes\n", sum)
- break
- }
- sum += n
- }
-}