FileDescriptorTargets returns the targets of all file descriptors of a process. If a file descriptor is not a symlink to a file (like a socket), that value will be the empty string.
()
| 223 | // FileDescriptorTargets returns the targets of all file descriptors of a process. |
| 224 | // If a file descriptor is not a symlink to a file (like a socket), that value will be the empty string. |
| 225 | func (p Proc) FileDescriptorTargets() ([]string, error) { |
| 226 | names, err := p.fileDescriptors() |
| 227 | if err != nil { |
| 228 | return nil, err |
| 229 | } |
| 230 | |
| 231 | targets := make([]string, len(names)) |
| 232 | |
| 233 | for i, name := range names { |
| 234 | target, err := os.Readlink(p.path("fd", name)) |
| 235 | if err == nil { |
| 236 | targets[i] = target |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | return targets, nil |
| 241 | } |
| 242 | |
| 243 | // FileDescriptorsLen returns the number of currently open file descriptors of |
| 244 | // a process. |