package main
import (
"fmt"
"io/ioutil"
"log"
"os"
)
func main() {
filess, _ := ioutil.ReadDir("/proc/")
for _, f2 := range filess {
//fmt.Println("--------------------------" + f2.Name() + "----------------------------------")
files, err := ioutil.ReadDir("/proc/" + f2.Name() + "/fd")
if err != nil {
log.Fatal(err)
}
for _, f := range files {
var path = "/proc/" + f2.Name() + "/fd/" + f.Name()
var lnkPath, _ = os.Readlink(path)
fmt.Println(lnkPath)
//var stat syscall.Stat_t
//
//err = syscall.Stat(path, &stat)
//typ := stat.Mode & syscall.S_IFMT
//if typ == syscall.S_IFIFO {
// fmt.Println("pipe")
//}
//if typ == syscall.S_IFCHR {
// fmt.Println("chr")
//}
//if typ == syscall.S_IFSOCK {
// fmt.Println("sock")
//}
//fmt.Println(stat.Mode)
}
//fmt.Println("--------------------------" + f2.Name() + "----------------------------------")
}
}