endpoint.h

Go to the documentation of this file.
00001 
00002 #ifndef _MINIX_ENDPOINT_H
00003 #define _MINIX_ENDPOINT_H 1
00004 
00005 #include <minix/sys_config.h>
00006 #include <minix/com.h>
00007 #include <limits.h>
00008 
00009 /* The point of the padding in 'generation size' is to 
00010  * allow for certain bogus endpoint numbers such as NONE, ANY, etc.
00011  *
00012  * The _MAX_MAGIC_PROC is defined by <minix/com.h>. That include
00013  * file defines some magic process numbers such as ANY and NONE,
00014  * and must never be a valid endpoint number. Therefore we make sure
00015  * the generation size is big enough to start the next generation
00016  * above the highest magic number.
00017  */
00018 #define _ENDPOINT_GENERATION_SIZE (NR_TASKS+_MAX_MAGIC_PROC+1)
00019 #define _ENDPOINT_MAX_GENERATION  (INT_MAX/_ENDPOINT_GENERATION_SIZE-1)
00020 
00021 /* Generation + Process slot number <-> endpoint. */
00022 #define _ENDPOINT(g, p) ((g) * _ENDPOINT_GENERATION_SIZE + (p))
00023 #define _ENDPOINT_G(e) (((e)+NR_TASKS) / _ENDPOINT_GENERATION_SIZE)
00024 #define _ENDPOINT_P(e) ((((e)+NR_TASKS) % _ENDPOINT_GENERATION_SIZE) - NR_TASKS)
00025 
00026 #endif

Generated on Fri Apr 14 22:57:20 2006 for minix by  doxygen 1.4.6