From ce0d6d2fc96715086e3af330fc0372852650d911 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Mon, 17 Nov 2003 23:11:35 +0000 Subject: [PATCH] added CTX_USER2KERNEL() and CTX_KERNEL2USER() macros to transform ctx from user into kernel type and vice versa git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/branches/SYSCALL_SWITCH@392 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/lib/vserver-internal.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/util-vserver/lib/vserver-internal.h b/util-vserver/lib/vserver-internal.h index 0bc887f..28f4e8e 100644 --- a/util-vserver/lib/vserver-internal.h +++ b/util-vserver/lib/vserver-internal.h @@ -70,7 +70,19 @@ # define CALL_VC_V11(F,...) CALL_VC_NOOP #endif - + // gcc does not optimize it; disable it for now, since ctx_t is an uint32_t +#if 0 +# define CTX_KERNEL2USER(X) (((X)==(uint32_t)(-1)) ? VC_NOCTX : \ + ((X)==(uint32_t)(-2)) ? VC_SAMECTX : \ + (X)) + +# define CTX_USER2KERNEL(X) (((X)==VC_NOCTX) ? (uint32_t)(-1) : \ + ((X)==VC_SAMECTX) ? (uint32_t)(-2) : \ + (X)) +#else +# define CTX_USER2KERNEL(X) (X) +# define CTX_KERNEL2USER(X) (X) +#endif #ifdef __cplusplus extern "C" { -- 1.8.1.5