diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-01-16 15:41:58 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-01-16 15:42:57 +0200 |
| commit | faf3710ec1024810d0255f6356cd0a9d12d2cf9b (patch) | |
| tree | 8a9fd697608b92cfd1f44966e534f1989e80cfda /include/apos | |
| parent | d96dbf6384ef19fb3b43d315663936f43110eade (diff) | |
| download | kmi-faf3710ec1024810d0255f6356cd0a9d12d2cf9b.tar.gz kmi-faf3710ec1024810d0255f6356cd0a9d12d2cf9b.zip | |
make process ids signed
+ Unlikely to ever run into billions of threads, and this keeps in line
with stuff like Linux. Also allows C to relatively painlessly
implement hashmaps of pids, if neccessary.
Diffstat (limited to 'include/apos')
| -rw-r--r-- | include/apos/tcb.h | 4 | ||||
| -rw-r--r-- | include/apos/types.h | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/include/apos/tcb.h b/include/apos/tcb.h index 9f10e2f..8f3be3d 100644 --- a/include/apos/tcb.h +++ b/include/apos/tcb.h @@ -133,7 +133,9 @@ struct tcb { */ id_t rid; - /** Thread ID. */ + /** Thread ID. @note all ids associated with threads use a signed type, + * but are always larger than zero. This is mirroring Linux behavior, + * and signed types are probably large enough. */ id_t tid; /** \todo implement cpu_id to hardware cpu ID translation, first in diff --git a/include/apos/types.h b/include/apos/types.h index e06ccd0..431d551 100644 --- a/include/apos/types.h +++ b/include/apos/types.h @@ -441,8 +441,11 @@ typedef int32_t ssize_t; /** Status, used with codes in \ref status_codes. */ typedef int_fast8_t stat_t; -/** ID of something. */ -typedef uint_fast32_t id_t; +/** ID of something. @todo should this be signed? Linux etc seems to assume it + * is with pids */ +typedef int_fast32_t id_t; + +#define ID_MAX INT_FAST32_MAX /** Memory region flags. */ typedef uint_fast16_t vmflags_t; |
