summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-05-06 19:44:49 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-05-06 19:44:49 +0200
commit3298139e65d5132c8895923b251f4fe84b2b2568 (patch)
tree9c6fda0f0c7bfe1a8ce7074067c54c096ecb10d1
parentde371d3b8c49034c32fb9010eb295742c952b8b9 (diff)
downloadpython-linuxnamespaces-3298139e65d5132c8895923b251f4fe84b2b2568.tar.gz
syscalls: allow logging of syscalls
-rw-r--r--linuxnamespaces/syscalls.py6
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(