367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
20 lines
1008 B
Python
20 lines
1008 B
Python
"""Select only the owned child's named bs Network thread for passive probes.
|
|
|
|
No thread suspension, client calls, thread-ID guessing or foreign-process access.
|
|
The existing Probe restores hardware registers and forwards genuine signals.
|
|
"""
|
|
from pathlib import Path
|
|
|
|
def network_thread(pid,proc=Path('/proc'),name='bs Network'):
|
|
if name not in ('bs Network','NetThread 0'):raise ValueError('Unverified network thread name')
|
|
candidates=[]
|
|
for task in (proc/str(pid)/'task').iterdir():
|
|
try:
|
|
if task.joinpath('comm').read_text().strip()!=name:continue
|
|
status=dict(line.split(':',1) for line in task.joinpath('status').read_text().splitlines() if ':' in line)
|
|
if int(status['Tgid'].strip())!=pid:raise ValueError('Network thread ownership differs')
|
|
candidates.append(int(task.name))
|
|
except FileNotFoundError:continue
|
|
if len(candidates)!=1:raise ValueError('Require one uniquely named owned network thread')
|
|
return candidates[0]
|