mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Log the PID/TID in root pidns and caller's pidns.
This is to aid debugging. The application logs make more sense wrt caller pidns because the application uses PID numbers from its pidns. Logs like `stat(/pid/PID/status)` are understandable. PiperOrigin-RevId: 542884517
This commit is contained in:
@@ -190,12 +190,18 @@ const (
|
||||
//
|
||||
// Preconditions: The task's owning TaskSet.mu must be locked.
|
||||
func (t *Task) updateInfoLocked() {
|
||||
// Use the task's TID and PID in the root PID namespace for logging.
|
||||
pid := t.tg.pidns.owner.Root.tgids[t.tg]
|
||||
tid := t.tg.pidns.owner.Root.tids[t]
|
||||
t.logPrefix.Store(fmt.Sprintf("[% 4d:% 4d] ", pid, tid))
|
||||
// Log the TID and PID in root pidns and t's pidns.
|
||||
rootPID := t.tg.pidns.owner.Root.tgids[t.tg]
|
||||
rootTID := t.tg.pidns.owner.Root.tids[t]
|
||||
pid := t.tg.pidns.tgids[t.tg]
|
||||
tid := t.tg.pidns.tids[t]
|
||||
if rootPID == pid && rootTID == tid {
|
||||
t.logPrefix.Store(fmt.Sprintf("[% 4d:% 4d] ", pid, tid))
|
||||
} else {
|
||||
t.logPrefix.Store(fmt.Sprintf("[% 4d(%4d):% 4d(%4d)] ", rootPID, pid, rootTID, tid))
|
||||
}
|
||||
|
||||
t.rebuildTraceContext(tid)
|
||||
t.rebuildTraceContext(rootTID)
|
||||
}
|
||||
|
||||
// rebuildTraceContext rebuilds the trace context.
|
||||
|
||||
Reference in New Issue
Block a user