Files
WoW-Hybrid-gateway/ops/engine_observation_thread.py
praxisandClaude Fable 5.2 8a24c445b0 Content pipeline and operator tools
367 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

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]