Rev | Line | |
---|
[9] | 1 |
|
---|
| 2 | #ifndef _MINIX_ENDPOINT_H
|
---|
| 3 | #define _MINIX_ENDPOINT_H 1
|
---|
| 4 |
|
---|
| 5 | #include <minix/sys_config.h>
|
---|
| 6 | #include <minix/com.h>
|
---|
| 7 | #include <limits.h>
|
---|
| 8 |
|
---|
| 9 | /* The point of the padding in 'generation size' is to
|
---|
| 10 | * allow for certain bogus endpoint numbers such as NONE, ANY, etc.
|
---|
| 11 | *
|
---|
| 12 | * The _MAX_MAGIC_PROC is defined by <minix/com.h>. That include
|
---|
| 13 | * file defines some magic process numbers such as ANY and NONE,
|
---|
| 14 | * and must never be a valid endpoint number. Therefore we make sure
|
---|
| 15 | * the generation size is big enough to start the next generation
|
---|
| 16 | * above the highest magic number.
|
---|
| 17 | */
|
---|
| 18 | #define _ENDPOINT_GENERATION_SIZE (NR_TASKS+_MAX_MAGIC_PROC+1)
|
---|
| 19 | #define _ENDPOINT_MAX_GENERATION (INT_MAX/_ENDPOINT_GENERATION_SIZE-1)
|
---|
| 20 |
|
---|
| 21 | /* Generation + Process slot number <-> endpoint. */
|
---|
| 22 | #define _ENDPOINT(g, p) ((g) * _ENDPOINT_GENERATION_SIZE + (p))
|
---|
| 23 | #define _ENDPOINT_G(e) (((e)+NR_TASKS) / _ENDPOINT_GENERATION_SIZE)
|
---|
| 24 | #define _ENDPOINT_P(e) ((((e)+NR_TASKS) % _ENDPOINT_GENERATION_SIZE) - NR_TASKS)
|
---|
| 25 |
|
---|
| 26 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.