Self returns a process for the current process.
()
| 75 | |
| 76 | // Self returns a process for the current process. |
| 77 | func (fs FS) Self() (Proc, error) { |
| 78 | p, err := os.Readlink(fs.proc.Path("self")) |
| 79 | if err != nil { |
| 80 | return Proc{}, err |
| 81 | } |
| 82 | pid, err := strconv.Atoi(strings.ReplaceAll(p, string(fs.proc), "")) |
| 83 | if err != nil { |
| 84 | return Proc{}, err |
| 85 | } |
| 86 | return fs.Proc(pid) |
| 87 | } |
| 88 | |
| 89 | // NewProc returns a process for the given pid. |
| 90 | // |