IDOfTask returns the TID assigned to the given task in PID namespace ns. If the task is not visible in that namespace, IDOfTask returns 0. (This return value is significant in some cases, e.g. getppid() is documented as returning 0 if the caller's parent is in an ancestor namespace and consequently
(t *Task)
| 316 | // consequently not visible to the caller.) If the task is nil, IDOfTask returns |
| 317 | // 0. |
| 318 | func (ns *PIDNamespace) IDOfTask(t *Task) ThreadID { |
| 319 | ns.owner.mu.RLock() |
| 320 | id := ns.tids[t] |
| 321 | ns.owner.mu.RUnlock() |
| 322 | return id |
| 323 | } |
| 324 | |
| 325 | // IDOfThreadGroup returns the TID assigned to tg's leader in PID namespace ns. |
| 326 | // If the task is not visible in that namespace, IDOfThreadGroup returns 0. |