//go:build linux package server import "syscall" // Filesystem magic numbers (linux/magic.h) for kernel pseudo filesystems that // a folder picker must never list. var specialFilesystemMagic = map[int64]struct{}{ 0x9fa0: {}, // proc 0x62656572: {}, // sysfs 0x1cd1: {}, // devpts 0x64626720: {}, // debugfs 0x74726163: {}, // tracefs 0x27e0eb: {}, // cgroup 0x63677270: {}, // cgroup2 0xf97cff8c: {}, // selinuxfs 0x73636673: {}, // securityfs 0xcafe4a11: {}, // bpf 0x65735546: {}, // fuse control } // specialFilesystem reports whether path lives on a kernel pseudo filesystem. func specialFilesystem(path string) bool { var stat syscall.Statfs_t if err := syscall.Statfs(path, &stat); err != nil { return false } _, ok := specialFilesystemMagic[int64(stat.Type)] return ok }