mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
kernel: print PID in addition to TID in task log messages
For multithreads processes, it is hard to read logs without knowing task pids. And let's print a decimal return codeo for syscalls. A hex return code are usefull for system calls that return addresses. For other syscalls, the decimal form is more readable. PiperOrigin-RevId: 400035449
This commit is contained in:
@@ -191,9 +191,11 @@ const (
|
||||
//
|
||||
// Preconditions: The task's owning TaskSet.mu must be locked.
|
||||
func (t *Task) updateInfoLocked() {
|
||||
// Use the task's TID in the root PID namespace for logging.
|
||||
// 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] ", tid))
|
||||
t.logPrefix.Store(fmt.Sprintf("[% 4d:% 4d] ", pid, tid))
|
||||
|
||||
t.rebuildTraceContext(tid)
|
||||
}
|
||||
|
||||
|
||||
@@ -610,9 +610,9 @@ func (i *SyscallInfo) printExit(t *kernel.Task, elapsed time.Duration, output []
|
||||
if err == nil {
|
||||
// Fill in the output after successful execution.
|
||||
i.post(t, args, retval, output, LogMaximumSize)
|
||||
rval = fmt.Sprintf("%#x (%v)", retval, elapsed)
|
||||
rval = fmt.Sprintf("%d (%#x) (%v)", retval, retval, elapsed)
|
||||
} else {
|
||||
rval = fmt.Sprintf("%#x errno=%d (%s) (%v)", retval, errno, err, elapsed)
|
||||
rval = fmt.Sprintf("%d (%#x) errno=%d (%s) (%v)", retval, retval, errno, err, elapsed)
|
||||
}
|
||||
|
||||
switch len(output) {
|
||||
|
||||
Reference in New Issue
Block a user