I use the ctypes module to make some ptrace system calls on Linux, which actually work pretty well. But if I get an error, I want to provide useful information. Therefore, I make a call to the get_errno () function that returns errno, but I did not find any function or something else that interprets the errno value and gives me an associated error message.
Am I missing something? Is there a ctypes based solution?
Here is my setup:
import logging from ctypes import get_errno, cdll from ctypes.util import find_library, errno
Example:
return_code = libc.ptrace(PTRACE_ATTACH, pid, None, None) if return_code == -1: errno = get_errno() error_msg =
source share