MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / getProcessNameWithContext

Function getProcessNameWithContext

agent/utils/websocket/process_data.go:386–396  ·  view source on GitHub ↗
(ctx context.Context, pid int32)

Source from the content-addressed store, hash-verified

384}
385
386func getProcessNameWithContext(ctx context.Context, pid int32) (string, error) {
387 data, err := os.ReadFile(fmt.Sprintf("/proc/%d/comm", pid))
388 if err == nil && len(data) > 0 {
389 return strings.TrimSpace(string(data)), nil
390 }
391 p, err := process.NewProcessWithContext(ctx, pid)
392 if err != nil {
393 return "", err
394 }
395 return p.Name()
396}
397
398func getConnectionType(connType uint32, family uint32) string {
399 switch {

Callers 1

getNetConnectionsFunction · 0.85

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected