2 #ifndef _MINIX_ENDPOINT_H
3 #define _MINIX_ENDPOINT_H 1
5 #include <minix/sys_config.h>
8 #include <minix/type.h>
10 /* The point of the padding in 'generation size' is to
11 * allow for certain bogus endpoint numbers such as NONE, ANY, etc.
13 * The _MAX_MAGIC_PROC is defined by <minix/com.h>. That include
14 * file defines some magic process numbers such as ANY and NONE,
15 * and must never be a valid endpoint number. Therefore we make sure
16 * the generation size is big enough to start the next generation
17 * above the highest magic number.
19 #define _ENDPOINT_GENERATION_SIZE (MAX_NR_TASKS+_MAX_MAGIC_PROC+1)
20 #define _ENDPOINT_MAX_GENERATION (INT_MAX/_ENDPOINT_GENERATION_SIZE-1)
22 /* Generation + Process slot number <-> endpoint. */
23 #define _ENDPOINT(g, p) ((endpoint_t)((g) * _ENDPOINT_GENERATION_SIZE + (p)))
24 #define _ENDPOINT_G(e) (((e)+MAX_NR_TASKS) / _ENDPOINT_GENERATION_SIZE)
25 #define _ENDPOINT_P(e) \
26 ((((e)+MAX_NR_TASKS) % _ENDPOINT_GENERATION_SIZE) - MAX_NR_TASKS)