#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include "compat.h"
#ifdef VC_ENABLE_API_COMPAT
# include "getctx-compat.hc"
#include "vserver-internal.h"
#include "internal.h"
-#include <unistd.h>
#include <sys/types.h>
-ctx_t
+xid_t
vc_X_getctx(pid_t pid)
{
- if (pid==0) pid=getpid();
-
- CALL_VC(CALL_VC_COMPAT(vc_X_getctx, pid),
- CALL_VC_LEGACY(vc_X_getctx, pid));
+#ifndef NDEBUG
+ if (!getenv("VC_BE_VALGRIND_FRIENDLY"))
+#endif
+ CALL_VC(CALL_VC_COMPAT(vc_X_getctx, pid),
+ CALL_VC_LEGACY(vc_X_getctx, pid));
+#ifndef NDEBUG
+ else
+ return vc_X_getctx_legacy(pid);
+#endif
}