#!/usr/bin/env python3
"""Disable Transparent Huge Pages then exec the given command.

QEMU's madvise(MADV_HUGEPAGE) on guest RAM can trigger THP compaction
that hangs for 30+ seconds on large NUMA systems. This wrapper disables
THP via prctl(PR_SET_THP_DISABLE) before exec'ing QEMU.
"""
import ctypes, os, sys

libc = ctypes.CDLL("libc.so.6")
libc.prctl(41, 1, 0, 0, 0)  # PR_SET_THP_DISABLE = 41
os.execvp(sys.argv[1], sys.argv[1:])
