diff options
author | Helmut Grohne <helmut@subdivi.de> | 2024-05-06 19:44:49 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2024-05-06 19:44:49 +0200 |
commit | 3298139e65d5132c8895923b251f4fe84b2b2568 (patch) | |
tree | 9c6fda0f0c7bfe1a8ce7074067c54c096ecb10d1 | |
parent | de371d3b8c49034c32fb9010eb295742c952b8b9 (diff) | |
download | python-linuxnamespaces-3298139e65d5132c8895923b251f4fe84b2b2568.tar.gz |
syscalls: allow logging of syscalls
-rw-r--r-- | linuxnamespaces/syscalls.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/linuxnamespaces/syscalls.py b/linuxnamespaces/syscalls.py index d9d37eb..986238c 100644 --- a/linuxnamespaces/syscalls.py +++ b/linuxnamespaces/syscalls.py @@ -10,12 +10,16 @@ import ctypes import dataclasses import enum import errno +import logging import os import typing from .atlocation import AtFlags, AtLocation, AtLocationLike, PathConvertible +logger = logging.getLogger(__name__) + + LIBC_SO = ctypes.CDLL(None, use_errno=True) @@ -363,7 +367,9 @@ def call_libc(funcname: str, *args: typing.Any) -> int: the function returns an integer that is non-negative on success. On failure, an OSError with errno is raised. """ + logger.debug("calling libc function %s%r", funcname, args) ret: int = LIBC_SO[funcname](*args) + logger.debug("%s returned %d", funcname, ret) if ret < 0: err = ctypes.get_errno() raise OSError( |