added CTX_USER2KERNEL() and CTX_KERNEL2USER() macros to transform ctx
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Mon, 17 Nov 2003 23:11:35 +0000 (23:11 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Mon, 17 Nov 2003 23:11:35 +0000 (23:11 +0000)
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

index 0bc887f..28f4e8e 100644 (file)
 #  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" {