aboutsummaryrefslogtreecommitdiff
path: root/sftp/ls_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'sftp/ls_unix.go')
-rw-r--r--sftp/ls_unix.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/sftp/ls_unix.go b/sftp/ls_unix.go
new file mode 100644
index 0000000..59ccffd
--- /dev/null
+++ b/sftp/ls_unix.go
@@ -0,0 +1,23 @@
+// +build aix darwin dragonfly freebsd !android,linux netbsd openbsd solaris js
+
+package sftp
+
+import (
+ "os"
+ "syscall"
+)
+
+func lsLinksUIDGID(fi os.FileInfo) (numLinks uint64, uid, gid string) {
+ numLinks = 1
+ uid, gid = "0", "0"
+
+ switch sys := fi.Sys().(type) {
+ case *syscall.Stat_t:
+ numLinks = uint64(sys.Nlink)
+ uid = lsFormatID(sys.Uid)
+ gid = lsFormatID(sys.Gid)
+ default:
+ }
+
+ return numLinks, uid, gid
+}