RTEMS CPU Kit with SuperCore  4.11.3
Files | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Object Handler
Collaboration diagram for Object Handler:

Files

file  objectallocate.c
 Allocate Object.
 
file  objectapimaximumclass.c
 Object API Maximum Class.
 
file  objectclose.c
 Close Object.
 
file  objectextendinformation.c
 Extend Set of Objects.
 
file  objectfree.c
 Free Object.
 
file  objectgetinfo.c
 Get Object Information.
 
file  objectgetisr.c
 Object Get Isr Disable.
 
file  objectgetnext.c
 Get Pointer to Next Object that is Active.
 
file  objectgetnoprotection.c
 Get Object without Dispatching Protection.
 
file  objectinitializeinformation.c
 Initialize Object Information.
 
file  objectnametoidstring.c
 Object ID to Name.
 
file  objectsetname.c
 Set Objects Name.
 

Data Structures

union  Objects_Name
 The following type defines the control block used to manage object names. More...
 
struct  Objects_Control
 The following defines the Object Control Block used to manage each object local to this node. More...
 
struct  Objects_Information
 The following defines the structure for the information used to manage each class of objects. More...
 

Macros

#define OBJECTS_INDEX_START_BIT   0U
 This is the bit position of the starting bit of the index portion of the object Id.
 
#define OBJECTS_NODE_START_BIT   16U
 This is the bit position of the starting bit of the node portion of the object Id.
 
#define OBJECTS_API_START_BIT   24U
 This is the bit position of the starting bit of the API portion of the object Id.
 
#define OBJECTS_CLASS_START_BIT   27U
 This is the bit position of the starting bit of the class portion of the object Id.
 
#define OBJECTS_INDEX_MASK   (Objects_Id)0x0000ffffU
 This mask is used to extract the index portion of an object Id.
 
#define OBJECTS_NODE_MASK   (Objects_Id)0x00ff0000U
 This mask is used to extract the node portion of an object Id.
 
#define OBJECTS_API_MASK   (Objects_Id)0x07000000U
 This mask is used to extract the API portion of an object Id.
 
#define OBJECTS_CLASS_MASK   (Objects_Id)0xf8000000U
 This mask is used to extract the class portion of an object Id.
 
#define OBJECTS_INDEX_VALID_BITS   (Objects_Id)0x0000ffffU
 This mask represents the bits that is used to ensure no extra bits are set after shifting to extract the index portion of an object Id.
 
#define OBJECTS_NODE_VALID_BITS   (Objects_Id)0x000000ffU
 This mask represents the bits that is used to ensure no extra bits are set after shifting to extract the node portion of an object Id.
 
#define OBJECTS_API_VALID_BITS   (Objects_Id)0x00000007U
 This mask represents the bits that is used to ensure no extra bits are set after shifting to extract the API portion of an object Id.
 
#define OBJECTS_CLASS_VALID_BITS   (Objects_Id)0x0000001fU
 This mask represents the bits that is used to ensure no extra bits are set after shifting to extract the class portion of an object Id.
 
#define OBJECTS_UNLIMITED_OBJECTS   0x80000000U
 Mask to enable unlimited objects. More...
 
#define OBJECTS_ID_INITIAL_INDEX   (0)
 This is the lowest value for the index portion of an object Id.
 
#define OBJECTS_ID_FINAL_INDEX   (0xffffU)
 This is the highest value for the index portion of an object Id.
 
#define OBJECTS_APIS_LAST   OBJECTS_POSIX_API
 This macro is used to generically specify the last API index. More...
 
#define OBJECTS_ID_NONE   0
 No object can have this ID.
 
#define OBJECTS_ID_OF_SELF   ((Objects_Id) 0)
 The following defines the constant which may be used with _Objects_Get to manipulate the calling task.
 
#define OBJECTS_SEARCH_ALL_NODES   0
 The following constant is used to specify that a name to ID search should search through all nodes.
 
#define OBJECTS_SEARCH_OTHER_NODES   0x7FFFFFFE
 The following constant is used to specify that a name to ID search should search through all nodes except the current node.
 
#define OBJECTS_SEARCH_LOCAL_NODE   0x7FFFFFFF
 The following constant is used to specify that a name to ID search should search only on this node.
 
#define OBJECTS_WHO_AM_I   0
 The following constant is used to specify that a name to ID search is being asked for the ID of the currently executing task.
 
#define OBJECTS_ID_INITIAL(_api, _class, _node)   _Objects_Build_id( (_api), (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
 This macros calculates the lowest ID for the specified api, class, and node.
 
#define OBJECTS_ID_FINAL   ((Objects_Id)~0)
 This macro specifies the highest object ID value.
 
#define _Objects_Build_name(_C1, _C2, _C3, _C4)
 This macro is used to build a thirty-two bit style name from four characters. More...
 
#define _Objects_Maximum_per_allocation(maximum)   ((Objects_Maximum) ((maximum) & ~OBJECTS_UNLIMITED_OBJECTS))
 
#define OBJECTS_INTERNAL_CLASSES_LAST   OBJECTS_INTERNAL_MUTEXES
 This macro is used to generically specify the last API index. More...
 
#define OBJECTS_RTEMS_CLASSES_LAST   OBJECTS_RTEMS_BARRIERS
 This macro is used to generically specify the last API index. More...
 
#define OBJECTS_POSIX_CLASSES_LAST   OBJECTS_POSIX_RWLOCKS
 This macro is used to generically specify the last API index. More...
 
#define _Objects_Local_node   ((uint16_t)1)
 The following is referenced to the node number of the local node.
 
#define _Objects_Maximum_nodes   1
 The following is referenced to the number of nodes in the system.
 
#define OBJECTS_NAME_ERRORS_FIRST   OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL
 This macro defines the first entry in the Objects_Name_or_id_lookup_errors enumerated list.
 
#define OBJECTS_NAME_ERRORS_LAST   OBJECTS_INVALID_NODE
 This macro defines the last entry in the Objects_Name_or_id_lookup_errors enumerated list.
 

Typedefs

typedef uint32_t Objects_Id
 The following type defines the control block used to manage object IDs. More...
 
typedef uint16_t Objects_Maximum
 This type is used to store the maximum number of allowed objects of each type.
 
typedef bool(* Objects_Name_comparators) (void *, void *, uint16_t)
 Functions which compare names are prototyped like this.
 
typedef void(* Objects_Thread_queue_Extract_callout) (void *)
 The following type defines the callout used when a local task is extracted from a remote thread queue (i.e. More...
 

Enumerations

enum  Objects_APIs {
  OBJECTS_NO_API = 0, OBJECTS_INTERNAL_API = 1, OBJECTS_CLASSIC_API = 2, OBJECTS_POSIX_API = 3,
  OBJECTS_FAKE_OBJECTS_API = 7
}
 This enumerated type is used in the class field of the object ID.
 
enum  Objects_Internal_API { OBJECTS_INTERNAL_NO_CLASS = 0, OBJECTS_INTERNAL_THREADS = 1, OBJECTS_INTERNAL_MUTEXES = 2 }
 This enumerated type is used in the class field of the object ID for RTEMS internal object classes.
 
enum  Objects_Classic_API {
  OBJECTS_CLASSIC_NO_CLASS = 0, OBJECTS_RTEMS_TASKS = 1, OBJECTS_RTEMS_TIMERS = 2, OBJECTS_RTEMS_SEMAPHORES = 3,
  OBJECTS_RTEMS_MESSAGE_QUEUES = 4, OBJECTS_RTEMS_PARTITIONS = 5, OBJECTS_RTEMS_REGIONS = 6, OBJECTS_RTEMS_PORTS = 7,
  OBJECTS_RTEMS_PERIODS = 8, OBJECTS_RTEMS_EXTENSIONS = 9, OBJECTS_RTEMS_BARRIERS = 10
}
 This enumerated type is used in the class field of the object ID for the RTEMS Classic API.
 
enum  Objects_POSIX_API {
  OBJECTS_POSIX_NO_CLASS = 0, OBJECTS_POSIX_THREADS = 1, OBJECTS_POSIX_KEYS = 2, OBJECTS_POSIX_INTERRUPTS = 3,
  OBJECTS_POSIX_MESSAGE_QUEUE_FDS = 4, OBJECTS_POSIX_MESSAGE_QUEUES = 5, OBJECTS_POSIX_MUTEXES = 6, OBJECTS_POSIX_SEMAPHORES = 7,
  OBJECTS_POSIX_CONDITION_VARIABLES = 8, OBJECTS_POSIX_TIMERS = 9, OBJECTS_POSIX_BARRIERS = 10, OBJECTS_POSIX_SPINLOCKS = 11,
  OBJECTS_POSIX_RWLOCKS = 12
}
 This enumerated type is used in the class field of the object ID for the POSIX API.
 
enum  Objects_Fake_objects_API { OBJECTS_FAKE_OBJECTS_NO_CLASS = 0, OBJECTS_FAKE_OBJECTS_SCHEDULERS = 1 }
 
enum  Objects_Locations { OBJECTS_LOCAL = 0, OBJECTS_ERROR = 1 }
 This enumerated type lists the locations which may be returned by _Objects_Get. More...
 
enum  Objects_Name_or_id_lookup_errors {
  OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL, OBJECTS_INVALID_NAME, OBJECTS_INVALID_ADDRESS, OBJECTS_INVALID_ID,
  OBJECTS_INVALID_NODE
}
 This function implements the common portion of the object identification directives. More...
 

Functions

RTEMS_INLINE_ROUTINE Objects_APIs _Objects_Get_API (Objects_Id id)
 This function returns the API portion of the ID. More...
 
RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_class (Objects_Id id)
 This function returns the class portion of the ID. More...
 
RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_node (Objects_Id id)
 This function returns the node portion of the ID. More...
 
RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Get_index (Objects_Id id)
 This function returns the index portion of the ID. More...
 
RTEMS_INLINE_ROUTINE Objects_Id _Objects_Build_id (Objects_APIs the_api, uint16_t the_class, uint8_t node, uint16_t index)
 This function builds an object's id from the processor node and index values specified. More...
 
RTEMS_INLINE_ROUTINE bool _Objects_Is_unlimited (uint32_t maximum)
 Returns if the object maximum specifies unlimited objects. More...
 
void _Objects_Extend_information (Objects_Information *information)
 This function extends an object class information record. More...
 
void _Objects_Shrink_information (Objects_Information *information)
 Shrink an object class information record. More...
 
void _Objects_Initialize_information (Objects_Information *information, Objects_APIs the_api, uint16_t the_class, uint32_t maximum, uint16_t size, bool is_string, uint32_t maximum_name_length)
 Initialize object Information. More...
 
unsigned int _Objects_API_maximum_class (uint32_t api)
 Object API Maximum Class. More...
 
Objects_Control_Objects_Allocate_unprotected (Objects_Information *information)
 Allocates an object without locking the allocator mutex. More...
 
Objects_Control_Objects_Allocate (Objects_Information *information)
 Allocates an object. More...
 
void _Objects_Free (Objects_Information *information, Objects_Control *the_object)
 Frees an object. More...
 
Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32 (Objects_Information *information, uint32_t name, uint32_t node, Objects_Id *id)
 Converts an object name to an Id. More...
 
Objects_Name_or_id_lookup_errors _Objects_Id_to_name (Objects_Id id, Objects_Name *name)
 Implements the common portion of the object Id to name directives. More...
 
Objects_Control_Objects_Get (Objects_Information *information, Objects_Id id, Objects_Locations *location)
 Maps object ids to object control blocks. More...
 
Objects_Control_Objects_Get_isr_disable (Objects_Information *information, Objects_Id id, Objects_Locations *location, ISR_lock_Context *lock_context)
 Maps object ids to object control blocks. More...
 
Objects_Control_Objects_Get_no_protection (Objects_Information *information, Objects_Id id, Objects_Locations *location)
 Maps object ids to object control blocks. More...
 
Objects_Control_Objects_Get_next (Objects_Information *information, Objects_Id id, Objects_Locations *location_p, Objects_Id *next_id_p)
 Like _Objects_Get, but is used to find "next" open object. More...
 
Objects_Information_Objects_Get_information (Objects_APIs the_api, uint16_t the_class)
 Get object information. More...
 
Objects_Information_Objects_Get_information_id (Objects_Id id)
 Get information of an object from an ID. More...
 
char * _Objects_Get_name_as_string (Objects_Id id, size_t length, char *name)
 Gets object name in the form of a C string. More...
 
bool _Objects_Set_name (Objects_Information *information, Objects_Control *the_object, const char *name)
 Set objects name. More...
 
void _Objects_Namespace_remove (Objects_Information *information, Objects_Control *the_object)
 Removes object from namespace. More...
 
void _Objects_Close (Objects_Information *information, Objects_Control *the_object)
 Close object. More...
 
Objects_Maximum _Objects_Active_count (const Objects_Information *information)
 Returns the count of active objects. More...
 
RTEMS_INLINE_ROUTINE bool _Objects_Is_api_valid (uint32_t the_api)
 This function returns true if the api is valid. More...
 
RTEMS_INLINE_ROUTINE bool _Objects_Is_local_node (uint32_t node)
 This function returns true if the node is of the local object, and false otherwise. More...
 
RTEMS_INLINE_ROUTINE bool _Objects_Is_local_id (Objects_Id id)
 This function returns true if the id is of a local object, and false otherwise. More...
 
RTEMS_INLINE_ROUTINE bool _Objects_Are_ids_equal (Objects_Id left, Objects_Id right)
 This function returns true if left and right are equal, and false otherwise. More...
 
RTEMS_INLINE_ROUTINE Objects_Control_Objects_Get_local_object (Objects_Information *information, uint16_t index)
 This function returns a pointer to the local_table object referenced by the index. More...
 
RTEMS_INLINE_ROUTINE void _Objects_Set_local_object (Objects_Information *information, uint32_t index, Objects_Control *the_object)
 This function sets the pointer to the local_table object referenced by the index. More...
 
RTEMS_INLINE_ROUTINE void _Objects_Invalidate_Id (Objects_Information *information, Objects_Control *the_object)
 This function sets the pointer to the local_table object referenced by the index to a NULL so the object Id is invalid after this call. More...
 
RTEMS_INLINE_ROUTINE void _Objects_Open (Objects_Information *information, Objects_Control *the_object, Objects_Name name)
 This function places the_object control pointer and object name in the Local Pointer and Local Name Tables, respectively. More...
 
RTEMS_INLINE_ROUTINE void _Objects_Open_u32 (Objects_Information *information, Objects_Control *the_object, uint32_t name)
 This function places the_object control pointer and object name in the Local Pointer and Local Name Tables, respectively. More...
 
RTEMS_INLINE_ROUTINE void _Objects_Open_string (Objects_Information *information, Objects_Control *the_object, const char *name)
 This function places the_object control pointer and object name in the Local Pointer and Local Name Tables, respectively. More...
 
RTEMS_INLINE_ROUTINE void _Objects_Put (Objects_Control *the_object)
 Puts back an object obtained with _Objects_Get(). More...
 
RTEMS_INLINE_ROUTINE void _Objects_Put_without_thread_dispatch (Objects_Control *the_object)
 Puts back an object obtained with _Objects_Get(). More...
 
RTEMS_INLINE_ROUTINE void _Objects_Allocator_lock (void)
 Locks the object allocator mutex. More...
 
RTEMS_INLINE_ROUTINE void _Objects_Allocator_unlock (void)
 Unlocks the object allocator mutex. More...
 

Variables

SCORE_EXTERN Objects_Information ** _Objects_Information_table [OBJECTS_APIS_LAST+1]
 The following is the list of information blocks per API for each object class. More...
 

Detailed Description

Macro Definition Documentation

◆ _Objects_Build_name

#define _Objects_Build_name (   _C1,
  _C2,
  _C3,
  _C4 
)
Value:
( (uint32_t)(_C1) << 24 | \
(uint32_t)(_C2) << 16 | \
(uint32_t)(_C3) << 8 | \
(uint32_t)(_C4) )

This macro is used to build a thirty-two bit style name from four characters.

The most significant byte will be the character _C1.

Parameters
[in]_C1is the first character of the name
[in]_C2is the second character of the name
[in]_C3is the third character of the name
[in]_C4is the fourth character of the name

◆ OBJECTS_APIS_LAST

#define OBJECTS_APIS_LAST   OBJECTS_POSIX_API

This macro is used to generically specify the last API index.

Referenced by _Objects_Is_api_valid(), and rtems_iterate_over_all_threads().

◆ OBJECTS_INTERNAL_CLASSES_LAST

#define OBJECTS_INTERNAL_CLASSES_LAST   OBJECTS_INTERNAL_MUTEXES

This macro is used to generically specify the last API index.

◆ OBJECTS_POSIX_CLASSES_LAST

#define OBJECTS_POSIX_CLASSES_LAST   OBJECTS_POSIX_RWLOCKS

This macro is used to generically specify the last API index.

◆ OBJECTS_RTEMS_CLASSES_LAST

#define OBJECTS_RTEMS_CLASSES_LAST   OBJECTS_RTEMS_BARRIERS

This macro is used to generically specify the last API index.

◆ OBJECTS_UNLIMITED_OBJECTS

#define OBJECTS_UNLIMITED_OBJECTS   0x80000000U

Mask to enable unlimited objects.

This is used in the configuration table when specifying the number of configured objects.

Referenced by _Objects_Is_unlimited().

Typedef Documentation

◆ Objects_Id

typedef uint32_t Objects_Id

The following type defines the control block used to manage object IDs.

The format is as follows (0=LSB):

Bits 0 .. 15 = index (up to 65535 objects of a type) Bits 16 .. 23 = node (up to 255 nodes) Bits 24 .. 26 = API (up to 7 API classes) Bits 27 .. 31 = class (up to 31 object types per API)

◆ Objects_Thread_queue_Extract_callout

typedef void( * Objects_Thread_queue_Extract_callout) (void *)

The following type defines the callout used when a local task is extracted from a remote thread queue (i.e.

it's proxy must extracted from the remote queue).

Enumeration Type Documentation

◆ Objects_Locations

This enumerated type lists the locations which may be returned by _Objects_Get.

These codes indicate the success of locating an object with the specified ID.

◆ Objects_Name_or_id_lookup_errors

This function implements the common portion of the object identification directives.

This directive returns the object id associated with name. If more than one object of this class is named name, then the object to which the id belongs is arbitrary. Node indicates the extent of the search for the id of the object named name. If the object class supports global objects, then the search can be limited to a particular node or allowed to encompass all nodes.

Function Documentation

◆ _Objects_Active_count()

Objects_Maximum _Objects_Active_count ( const Objects_Information information)

Returns the count of active objects.

Parameters
[in]informationThe object information table.
Return values
Thecount of active objects.

References _Assert, _Chain_Node_count_unprotected(), Objects_Information::Inactive, and Objects_Information::maximum.

◆ _Objects_Allocate()

Objects_Control* _Objects_Allocate ( Objects_Information information)

Allocates an object.

This function locks the object allocator mutex via _Objects_Allocator_lock(). The caller must later unlock the object allocator mutex via _Objects_Allocator_unlock(). The caller must unlock the mutex in any case, even if the allocation failed due to resource shortage.

A typical object allocation code looks like this:

rtems_status_code some_create( rtems_id *id )
{
Some_Control *some;
// The object allocator mutex protects the executing thread from
// asynchronous thread restart and deletion.
some = (Some_Control *) _Objects_Allocate( &_Some_Information );
if ( some != NULL ) {
_Some_Initialize( some );
} else {
}
return sc;
}
Parameters
[in]informationThe object information block.
Return values
NULLNo object available.
objectThe allocated object.
See also
_Objects_Free().

Referenced by _Barrier_Allocate(), _Dual_ported_memory_Allocate(), _Partition_Allocate(), _POSIX_Barrier_Allocate(), _POSIX_Condition_variables_Allocate(), _POSIX_Keys_Allocate(), _POSIX_Message_queue_Allocate(), _POSIX_Message_queue_Allocate_fd(), _POSIX_Mutex_Allocate(), _POSIX_RWLock_Allocate(), _POSIX_Spinlock_Allocate(), _POSIX_Timer_Allocate(), _Rate_monotonic_Allocate(), _Region_Allocate(), _Semaphore_Allocate(), and _Timer_Allocate().

◆ _Objects_Allocate_unprotected()

Objects_Control* _Objects_Allocate_unprotected ( Objects_Information information)

Allocates an object without locking the allocator mutex.

This function can be called in two contexts

  • the executing thread is the owner of the object allocator mutex, or
  • in case the system state is not up, e.g. during sequential system initialization.
Parameters
[in]informationThe object information block.
Return values
NULLNo object available.
objectThe allocated object.
See also
_Objects_Allocate() and _Objects_Free().

References _Assert.

Referenced by _API_Mutex_Allocate().

◆ _Objects_Allocator_lock()

RTEMS_INLINE_ROUTINE void _Objects_Allocator_lock ( void  )

Locks the object allocator mutex.

While holding the allocator mutex the executing thread is protected from asynchronous thread restart and deletion.

The usage of the object allocator mutex with the thread life protection makes it possible to allocate and free objects without thread dispatching disabled. The usage of a unified workspace and unlimited objects may lead to heap fragmentation. Thus the execution time of the _Objects_Allocate() function may increase during system run-time.

See also
_Objects_Allocator_unlock() and _Objects_Allocate().

Referenced by pthread_barrier_destroy(), pthread_cond_destroy(), pthread_rwlock_destroy(), pthread_spin_destroy(), rtems_barrier_delete(), rtems_extension_delete(), rtems_message_queue_delete(), rtems_partition_delete(), rtems_port_delete(), rtems_rate_monotonic_delete(), rtems_region_delete(), rtems_semaphore_delete(), rtems_timer_delete(), and timer_delete().

◆ _Objects_Allocator_unlock()

RTEMS_INLINE_ROUTINE void _Objects_Allocator_unlock ( void  )

Unlocks the object allocator mutex.

In case the mutex is fully unlocked, then this function restores the previous thread life protection state and thus may not return if the executing thread was restarted or deleted in the mean-time.

Referenced by pthread_cond_init(), pthread_key_create(), rtems_barrier_create(), rtems_rate_monotonic_create(), rtems_semaphore_create(), and rtems_timer_create().

◆ _Objects_API_maximum_class()

unsigned int _Objects_API_maximum_class ( uint32_t  api)

Object API Maximum Class.

This function returns the highest numeric value of a valid API for the specified api.

Parameters
[in]apiis the API of interest
Return values
Apositive integer on success and 0 otherwise.

Referenced by rtems_object_api_maximum_class().

◆ _Objects_Are_ids_equal()

RTEMS_INLINE_ROUTINE bool _Objects_Are_ids_equal ( Objects_Id  left,
Objects_Id  right 
)

This function returns true if left and right are equal, and false otherwise.

Parameters
[in]leftis the Id on the left hand side of the comparison
[in]rightis the Id on the right hand side of the comparison
Returns
This method returns true if the specified object IDs are equal and false otherwise.

Referenced by _Objects_MP_Close(), _Thread_Get(), _Thread_Get_interrupt_disable(), rtems_task_get_note(), and rtems_task_set_note().

◆ _Objects_Build_id()

RTEMS_INLINE_ROUTINE Objects_Id _Objects_Build_id ( Objects_APIs  the_api,
uint16_t  the_class,
uint8_t  node,
uint16_t  index 
)

This function builds an object's id from the processor node and index values specified.

Parameters
[in]the_apiindicates the API associated with this Id.
[in]the_classindicates the class of object. It is specific to the_api.
[in]nodeis the node where this object resides.
[in]indexis the instance number of this object.
Returns
This method returns an object Id constructed from the arguments.

◆ _Objects_Close()

void _Objects_Close ( Objects_Information information,
Objects_Control the_object 
)

Close object.

This function removes the_object control pointer and object name in the Local Pointer and Local Name Tables.

Parameters
[in]informationpoints to an Object Information Table
[in]the_objectis a pointer to an object

References _Objects_Invalidate_Id(), and _Objects_Namespace_remove().

Referenced by _POSIX_Message_queue_Delete(), and _POSIX_Semaphore_Delete().

◆ _Objects_Extend_information()

void _Objects_Extend_information ( Objects_Information information)

This function extends an object class information record.

Parameters
[in]informationpoints to an object class information block.

◆ _Objects_Free()

void _Objects_Free ( Objects_Information information,
Objects_Control the_object 
)

Frees an object.

Appends the object to the chain of inactive objects.

Parameters
[in]informationThe object information block.
[in]the_objectThe object to free.
See also
_Objects_Allocate().

A typical object deletion code looks like this:

rtems_status_code some_delete( rtems_id id )
{
Some_Control *some;
// The object allocator mutex protects the executing thread from
// asynchronous thread restart and deletion.
// This will disable thread dispatching, so this starts a thread dispatch
// critical section.
some = (Semaphore_Control *)
_Objects_Get( &_Some_Information, id, &location );
switch ( location ) {
case OBJECTS_LOCAL:
// After the object close an object get with this identifier will
// fail.
_Objects_Close( &_Some_Information, &some->Object );
_Some_Delete( some );
// This enables thread dispatching, so the thread dispatch critical
// section ends here.
_Objects_Put( &some->Object );
// Thread dispatching is enabled. The object free is only protected
// by the object allocator mutex.
_Objects_Free( &_Some_Information, &some->Object );
break;
default:
break;
}
return sc;
}

References _Assert, _Chain_Append_unprotected(), Objects_Information::allocation_size, Objects_Information::auto_extend, Objects_Information::Inactive, and Objects_Control::Node.

Referenced by _Dual_ported_memory_Free(), _Message_queue_Free(), _Partition_Free(), _POSIX_Keys_Free(), _POSIX_Message_queue_Free(), _POSIX_Message_queue_Free_fd(), _POSIX_Spinlock_Free(), _POSIX_Threads_Free(), _POSIX_Timer_Free(), _Rate_monotonic_Free(), _RTEMS_tasks_Free(), _Semaphore_Free(), and _Timer_Free().

◆ _Objects_Get()

Objects_Control* _Objects_Get ( Objects_Information information,
Objects_Id  id,
Objects_Locations location 
)

Maps object ids to object control blocks.

This function maps object ids to object control blocks. If id corresponds to a local object, then it returns the_object control pointer which maps to id and location is set to OBJECTS_LOCAL. If the object class supports global objects and the object id is global and resides on a remote node, then location is set to OBJECTS_REMOTE, and the_object is undefined. Otherwise, location is set to OBJECTS_ERROR and the_object is undefined.

Parameters
[in]informationpoints to an object class information block.
[in]idis the Id of the object whose name we are locating.
[in]locationwill contain an indication of success or failure.
Return values
Thismethod returns one of the values from the Objects_Name_or_id_lookup_errors enumeration to indicate successful or failure. On success id will contain the Id of the requested object.
Note
_Objects_Get returns with dispatching disabled for local and remote objects. _Objects_Get_isr_disable returns with dispatching disabled for remote objects and interrupts for local objects.

Referenced by _Barrier_Get(), _Dual_ported_memory_Get(), _Message_queue_Get(), _Partition_Get(), _POSIX_Barrier_Get(), _POSIX_Keys_Get(), _POSIX_Message_queue_Get(), _POSIX_Semaphore_Get(), _POSIX_Spinlock_Get(), _POSIX_Timer_Get(), _Rate_monotonic_Get(), _Semaphore_Get(), _Timer_Get(), and rtems_object_set_name().

◆ _Objects_Get_API()

RTEMS_INLINE_ROUTINE Objects_APIs _Objects_Get_API ( Objects_Id  id)

This function returns the API portion of the ID.

Parameters
[in]idis the object Id to be processed.
Returns
This method returns an object Id constructed from the arguments.

References OBJECTS_API_START_BIT, and OBJECTS_API_VALID_BITS.

Referenced by _Objects_Get_information_id(), and _Objects_Id_to_name().

◆ _Objects_Get_class()

RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_class ( Objects_Id  id)

This function returns the class portion of the ID.

Parameters
[in]idis the object Id to be processed

References OBJECTS_CLASS_START_BIT, and OBJECTS_CLASS_VALID_BITS.

Referenced by _Objects_Get_information_id().

◆ _Objects_Get_index()

RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Get_index ( Objects_Id  id)

This function returns the index portion of the ID.

Parameters
[in]idis the Id to be processed
Returns
This method returns the class portion of the specified object ID.

References OBJECTS_INDEX_START_BIT, and OBJECTS_INDEX_VALID_BITS.

Referenced by _Objects_Get_next(), and _Objects_Invalidate_Id().

◆ _Objects_Get_information()

Objects_Information* _Objects_Get_information ( Objects_APIs  the_api,
uint16_t  the_class 
)

Get object information.

This function return the information structure given an the API and Class. This can be done independent of the existence of any objects created by the API.

Parameters
[in]the_apiindicates the API for the information we want
[in]the_classindicates the Class for the information we want
Return values
Thismethod returns a pointer to the Object Information Table for the class of objects which corresponds to this object ID.

Referenced by _Objects_Get_information_id().

◆ _Objects_Get_information_id()

Objects_Information* _Objects_Get_information_id ( Objects_Id  id)

Get information of an object from an ID.

This function return the information structure given an id of an object.

Parameters
[in]idis the object ID to get the information from
Return values
Thismethod returns a pointer to the Object Information Table for the class of objects which corresponds to this object ID.

References _Objects_Get_API(), _Objects_Get_class(), and _Objects_Get_information().

Referenced by _RTEMS_tasks_Free(), and rtems_object_set_name().

◆ _Objects_Get_isr_disable()

Objects_Control* _Objects_Get_isr_disable ( Objects_Information information,
Objects_Id  id,
Objects_Locations location,
ISR_lock_Context lock_context 
)

Maps object ids to object control blocks.

This function maps object ids to object control blocks. If id corresponds to a local object, then it returns the_object control pointer which maps to id and location is set to OBJECTS_LOCAL. If the object class supports global objects and the object id is global and resides on a remote node, then location is set to OBJECTS_REMOTE, and the_object is undefined. Otherwise, location is set to OBJECTS_ERROR and the_object is undefined.

Parameters
[in]informationpoints to an object class information block.
[in]idis the Id of the object whose name we are locating.
[in]locationwill contain an indication of success or failure.
[in]lock_contextis the previous interrupt state being turned.
Return values
Thismethod returns one of the values from the Objects_Name_or_id_lookup_errors enumeration to indicate successful or failure. On success name will contain the name of the requested object.
Note
_Objects_Get returns with dispatching disabled for local and remote objects. _Objects_Get_isr_disable returns with dispatchng disabled for remote objects and interrupts for local objects.

Referenced by _Semaphore_Get_interrupt_disable().

◆ _Objects_Get_local_object()

RTEMS_INLINE_ROUTINE Objects_Control* _Objects_Get_local_object ( Objects_Information information,
uint16_t  index 
)

This function returns a pointer to the local_table object referenced by the index.

Parameters
[in]informationpoints to an Object Information Table
[in]indexis the index of the object the caller wants to access
Returns
This method returns a pointer to a local object or NULL if the index is invalid and RTEMS_DEBUG is enabled.

◆ _Objects_Get_name_as_string()

char* _Objects_Get_name_as_string ( Objects_Id  id,
size_t  length,
char *  name 
)

Gets object name in the form of a C string.

This method objects the name of an object and returns its name in the form of a C string. It attempts to be careful about overflowing the user's string and about returning unprintable characters.

Parameters
[in]idis the object to obtain the name of
[in]lengthindicates the length of the caller's buffer
[in]namepoints a string which will be filled in.
Return values
Thismethod returns name or NULL on error. *name will contain the name if successful.

◆ _Objects_Get_next()

Objects_Control* _Objects_Get_next ( Objects_Information information,
Objects_Id  id,
Objects_Locations location_p,
Objects_Id next_id_p 
)

Like _Objects_Get, but is used to find "next" open object.

Parameters
[in]informationpoints to an object class information block.
[in]idis the Id of the object whose name we are locating.
[in]location_pwill contain an indication of success or failure.
[in]next_id_pis the Id of the next object we will look at.
Return values
Thismethod returns the pointer to the object located or NULL on error.

References _Objects_Get_index(), Objects_Information::maximum, Objects_Information::minimum_id, and OBJECTS_ID_INITIAL_INDEX.

◆ _Objects_Get_no_protection()

Objects_Control* _Objects_Get_no_protection ( Objects_Information information,
Objects_Id  id,
Objects_Locations location 
)

Maps object ids to object control blocks.

This function maps object ids to object control blocks. If id corresponds to a local object, then it returns the_object control pointer which maps to id and location is set to OBJECTS_LOCAL. If the object class supports global objects and the object id is global and resides on a remote node, then location is set to OBJECTS_REMOTE, and the_object is undefined. Otherwise, location is set to OBJECTS_ERROR and the_object is undefined.

Parameters
[in]informationpoints to an object class information block.
[in]idis the Id of the object whose name we are locating.
[in]locationwill contain an indication of success or failure.
Return values
Thismethod returns one of the values from the Objects_Name_or_id_lookup_errors enumeration to indicate successful or failure. On success id will contain the Id of the requested object.
Note
_Objects_Get returns with dispatching disabled for local and remote objects. _Objects_Get_isr_disable returns with dispatching disabled for remote objects and interrupts for local objects.

Referenced by _Region_Get().

◆ _Objects_Get_node()

RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_node ( Objects_Id  id)

This function returns the node portion of the ID.

Parameters
[in]idis the object Id to be processed
Returns
This method returns the node portion of an object ID.

References OBJECTS_NODE_START_BIT, and OBJECTS_NODE_VALID_BITS.

Referenced by _Objects_Is_local_id(), _Objects_MP_Close(), _Objects_MP_Is_remote(), and _Objects_MP_Open().

◆ _Objects_Id_to_name()

Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( Objects_Id  id,
Objects_Name name 
)

Implements the common portion of the object Id to name directives.

This function implements the common portion of the object Id to name directives. This function returns the name associated with object id.

Parameters
[in]idis the Id of the object whose name we are locating.
[in]namewill contain the name of the object, if found.
Return values
Thismethod returns one of the values from the Objects_Name_or_id_lookup_errors enumeration to indicate successful or failure. On success name will contain the name of the requested object.
Note
This function currently does not support string names.

References _Objects_Get_API(), _Objects_Is_api_valid(), _Thread_Get_executing(), Objects_Control::id, Thread_Control::Object, and OBJECTS_ID_OF_SELF.

◆ _Objects_Initialize_information()

void _Objects_Initialize_information ( Objects_Information information,
Objects_APIs  the_api,
uint16_t  the_class,
uint32_t  maximum,
uint16_t  size,
bool  is_string,
uint32_t  maximum_name_length 
)

Initialize object Information.

This function initializes an object class information record. SUPPORTS_GLOBAL is true if the object class supports global objects, and false otherwise. Maximum indicates the number of objects required in this class and size indicates the size in bytes of each control block for this object class. The name length and string designator are also set. In addition, the class may be a task, therefore this information is also included.

Parameters
[in]informationpoints to an object class information block.
[in]the_apiindicates the API associated with this information block.
[in]the_classindicates the class of object being managed by this information block. It is specific to the_api.
[in]maximumis the maximum number of instances of this object class which may be concurrently active.
[in]sizeis the size of the data structure for this class.
[in]is_stringis true if this object uses string style names.
[in]maximum_name_lengthis the maximum length of object names.

Referenced by _API_Mutex_Initialization(), _Barrier_Manager_initialization(), _Dual_ported_memory_Manager_initialization(), _Extension_Manager_initialization(), _Message_queue_Manager_initialization(), _Partition_Manager_initialization(), _POSIX_Barrier_Manager_initialization(), _POSIX_Condition_variables_Manager_initialization(), _POSIX_Key_Manager_initialization(), _POSIX_Message_queue_Manager_initialization(), _POSIX_Mutex_Manager_initialization(), _POSIX_RWLock_Manager_initialization(), _POSIX_Semaphore_Manager_initialization(), _POSIX_Spinlock_Manager_initialization(), _POSIX_Threads_Manager_initialization(), _POSIX_Timer_Manager_initialization(), _Rate_monotonic_Manager_initialization(), _Region_Manager_initialization(), _RTEMS_tasks_Manager_initialization(), _Semaphore_Manager_initialization(), and _Timer_Manager_initialization().

◆ _Objects_Invalidate_Id()

RTEMS_INLINE_ROUTINE void _Objects_Invalidate_Id ( Objects_Information information,
Objects_Control the_object 
)

This function sets the pointer to the local_table object referenced by the index to a NULL so the object Id is invalid after this call.

Parameters
[in]informationpoints to an Object Information Table
[in]the_objectis the local object pointer
Note
This routine is ONLY to be called in places where the index portion of the Id is known to be good. This is OK since it is normally called from object create/init or delete/destroy operations.

References _Assert, _Objects_Get_index(), _Objects_Set_local_object(), and Objects_Control::id.

Referenced by _Objects_Close().

◆ _Objects_Is_api_valid()

RTEMS_INLINE_ROUTINE bool _Objects_Is_api_valid ( uint32_t  the_api)

This function returns true if the api is valid.

Parameters
[in]the_apiis the api portion of an object ID.
Returns
This method returns true if the specified api value is valid and false otherwise.

References OBJECTS_APIS_LAST.

Referenced by _Objects_Id_to_name(), and rtems_object_api_minimum_class().

◆ _Objects_Is_local_id()

RTEMS_INLINE_ROUTINE bool _Objects_Is_local_id ( Objects_Id  id)

This function returns true if the id is of a local object, and false otherwise.

Parameters
[in]idis an object ID
Returns
This method returns true if the specified object Id is local and false otherwise.
Note
On a single processor configuration, this always returns true.

References _Objects_Get_node(), and _Objects_Is_local_node().

Referenced by _CORE_barrier_Release().

◆ _Objects_Is_local_node()

RTEMS_INLINE_ROUTINE bool _Objects_Is_local_node ( uint32_t  node)

This function returns true if the node is of the local object, and false otherwise.

Parameters
[in]nodeis the node number and corresponds to the node number portion of an object ID.
Returns
This method returns true if the specified node is the local node and false otherwise.

Referenced by _Objects_Is_local_id(), and _Objects_MP_Is_remote().

◆ _Objects_Is_unlimited()

RTEMS_INLINE_ROUTINE bool _Objects_Is_unlimited ( uint32_t  maximum)

Returns if the object maximum specifies unlimited objects.

Parameters
[in]maximumThe object maximum specification.
Return values
trueUnlimited objects are available.
falseThe object count is fixed.

References OBJECTS_UNLIMITED_OBJECTS.

◆ _Objects_Name_to_id_u32()

Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32 ( Objects_Information information,
uint32_t  name,
uint32_t  node,
Objects_Id id 
)

Converts an object name to an Id.

This method converts an object name to an Id. It performs a look up using the object information block for this object class.

Parameters
[in]informationpoints to an object class information block.
[in]nameis the name of the object to find.
[in]nodeis the set of nodes to search.
[in]idwill contain the Id if the search is successful.
Return values
Thismethod returns one of the values from the Objects_Name_or_id_lookup_errors enumeration to indicate successful or failure. On success id will contain the Id of the requested object.

◆ _Objects_Namespace_remove()

void _Objects_Namespace_remove ( Objects_Information information,
Objects_Control the_object 
)

Removes object from namespace.

This function removes the_object from the namespace.

Parameters
[in]informationpoints to an Object Information Table.
[in]the_objectis a pointer to an object.

References _Workspace_Free(), Objects_Control::name, and Objects_Name::name_u32.

Referenced by _Objects_Close(), _POSIX_Message_queue_Namespace_remove(), and _POSIX_Semaphore_Namespace_remove().

◆ _Objects_Open()

RTEMS_INLINE_ROUTINE void _Objects_Open ( Objects_Information information,
Objects_Control the_object,
Objects_Name  name 
)

This function places the_object control pointer and object name in the Local Pointer and Local Name Tables, respectively.

Parameters
[in]informationpoints to an Object Information Table
[in]the_objectis a pointer to an object
[in]nameis the name of the object to make accessible

References _Assert, and Objects_Control::name.

Referenced by rtems_barrier_create(), rtems_rate_monotonic_create(), rtems_semaphore_create(), and rtems_timer_create().

◆ _Objects_Open_string()

RTEMS_INLINE_ROUTINE void _Objects_Open_string ( Objects_Information information,
Objects_Control the_object,
const char *  name 
)

This function places the_object control pointer and object name in the Local Pointer and Local Name Tables, respectively.

Parameters
[in]informationpoints to an Object Information Table
[in]the_objectis a pointer to an object
[in]nameis the name of the object to make accessible

References Objects_Control::name.

◆ _Objects_Open_u32()

RTEMS_INLINE_ROUTINE void _Objects_Open_u32 ( Objects_Information information,
Objects_Control the_object,
uint32_t  name 
)

This function places the_object control pointer and object name in the Local Pointer and Local Name Tables, respectively.

Parameters
[in]informationpoints to an Object Information Table
[in]the_objectis a pointer to an object
[in]nameis the name of the object to make accessible

References Objects_Control::name, and Objects_Name::name_u32.

Referenced by _API_Mutex_Allocate(), and pthread_key_create().

◆ _Objects_Put()

RTEMS_INLINE_ROUTINE void _Objects_Put ( Objects_Control the_object)

Puts back an object obtained with _Objects_Get().

This function decrements the thread dispatch disable level. The _Thread_Dispatch() is called if the level reaches zero.

References _Thread_Enable_dispatch().

Referenced by _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch().

◆ _Objects_Put_without_thread_dispatch()

RTEMS_INLINE_ROUTINE void _Objects_Put_without_thread_dispatch ( Objects_Control the_object)

Puts back an object obtained with _Objects_Get().

This function decrements the thread dispatch disable level. The _Thread_Dispatch() is not called if the level reaches zero, thus a thread dispatch will not take place immediately on the current processor.

References _Thread_Unnest_dispatch().

◆ _Objects_Set_local_object()

RTEMS_INLINE_ROUTINE void _Objects_Set_local_object ( Objects_Information information,
uint32_t  index,
Objects_Control the_object 
)

This function sets the pointer to the local_table object referenced by the index.

Parameters
[in]informationpoints to an Object Information Table
[in]indexis the index of the object the caller wants to access
[in]the_objectis the local object pointer
Note
This routine is ONLY to be called in places where the index portion of the Id is known to be good. This is OK since it is normally called from object create/init or delete/destroy operations.

Referenced by _Objects_Invalidate_Id().

◆ _Objects_Set_name()

bool _Objects_Set_name ( Objects_Information information,
Objects_Control the_object,
const char *  name 
)

Set objects name.

This method sets the object name to either a copy of a string or up to the first four characters of the string based upon whether this object class uses strings for names.

Parameters
[in]informationpoints to the object information structure
[in]the_objectis the object to operate upon
[in]nameis a pointer to the name to use
Return values
Ifsuccessful, true is returned. Otherwise false is returned.

◆ _Objects_Shrink_information()

void _Objects_Shrink_information ( Objects_Information information)

Shrink an object class information record.

This function shrink an object class information record. The object's name and object space are released. The local_table etc block does not shrink. The InActive list needs to be scanned to find the objects are remove them.

Parameters
[in]informationpoints to an object class information block.

Variable Documentation

◆ _Objects_Information_table

SCORE_EXTERN Objects_Information** _Objects_Information_table[OBJECTS_APIS_LAST+1]

The following is the list of information blocks per API for each object class.

From the ID, we can go to one of these information blocks, and obtain a pointer to the appropriate object control block.

Referenced by _POSIX_API_Initialize(), _RTEMS_API_Initialize(), and rtems_iterate_over_all_threads().