[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Date: Thu, 27 Mar 2008 16:24:27 +0100
- From: Thomas.Doerfler at embedded-brains.de (Thomas Dörfler)
- Subject: Invalid rtems_id?
Joel Sherrill schrieb:
> An invalid ID or an invalid ID check or both?
> I would lean to both.
Yes, I think we need a value to initialize application variables, and we
need a method to detect, whether a ID is valid. A typical use would be
to check, whether a ID holding variable has yet been initialized, or the
corresponding OS object has yet been created.
> But I think that technically, I would say that an id with
> 0xffff0000 is more reliably invalid. That would let us
> max out the api, class, and node portions of the id
> with an index of 0 which is never valid except in the
> case of RTEMS_SELF which is 0x0.
In that aspect, it is a bit of a shame that we can't use the value "0x0"
as the "invalid ID". In many situations you can use uninitialied global
variables and find out, whether they hold valid data. The C standard
guarantees, that an uninitialized global pointer variable holds a NULL
pointer, which is used as a "invalid" placeholder. If the same where
true for RTEMS object IDs, things like the "task_id" arrays in the
testsuite would hold invalid IDs by default (and not the "RTEMS_SELF"
So my proposal would be to define the invalid ID to be 0x0, and
RTEMS_SELF as 0xffff0000 (0r 0xff00):
#define RTEMS_INVALID_ID 0x0
#define RTEMS_SELF 0xffff0000
Any comments on that?
embedded brains GmbH
Thomas Doerfler Obere Lagerstr. 30
D-82178 Puchheim Germany
Tel. : +49-89-18 90 80 79-2
Fax : +49-89-18 90 80 79-9
email: Thomas.Doerfler at embedded-brains.de
PGP public key available on request
Diese Nachricht ist keine gesch?ftliche Mitteilung im Sinne des EHUG.