![]() |
Files | |
file | registry.h |
This file is part of the Xenomai project. | |
file | registry.c |
This file is part of the Xenomai project. | |
Functions | |
int | xnregistry_enter (const char *key, void *objaddr, xnhandle_t *phandle, xnpnode_t *pnode) |
int | xnregistry_bind (const char *key, xnticks_t timeout, xnhandle_t *phandle) |
int | xnregistry_remove (xnhandle_t handle) |
int | xnregistry_remove_safe (xnhandle_t handle, xnticks_t timeout) |
void * | xnregistry_get (xnhandle_t handle) |
u_long | xnregistry_put (xnhandle_t handle) |
void * | xnregistry_fetch (xnhandle_t handle) |
int xnregistry_bind | ( | const char * | key, | |
xnticks_t | timeout, | |||
xnhandle_t * | phandle | |||
) |
Bind to a real-time object.
This service retrieves the registry handle of a given object identified by its key. Unless otherwise specified, this service will block the caller if the object is not registered yet, waiting for such registration to occur.
key | A valid NULL-terminated string which identifies the object to bind to. | |
timeout | The number of clock ticks to wait for the registration to occur (see note). Passing XN_INFINITE causes the caller to block indefinitely until the object is registered. Passing XN_NONBLOCK causes the service to return immediately without waiting if the object is not registered on entry. | |
phandle | A pointer to a memory location which will be written upon success with the generic handle defined by the registry for the retrieved object. Contents of this memory is undefined upon failure. |
Environments:
This service can be called from:
Rescheduling: always unless the request is immediately satisfied or timeout specifies a non-blocking operation.
int xnregistry_enter | ( | const char * | key, | |
void * | objaddr, | |||
xnhandle_t * | phandle, | |||
xnpnode_t * | pnode | |||
) |
Register a real-time object.
This service allocates a new registry slot for an associated object, and indexes it by an alphanumeric key for later retrieval.
key | A valid NULL-terminated string by which the object will be indexed and later retrieved in the registry. Since it is assumed that such key is stored into the registered object, it will *not* be copied but only kept by reference in the registry. | |
objaddr | An opaque pointer to the object to index by key. | |
phandle | A pointer to a generic handle defined by the registry which will uniquely identify the indexed object, until the latter is unregistered using the xnregistry_remove() service. | |
pnode | A pointer to an optional /proc node class descriptor. This structure provides the information needed to export all objects from the given class through the /proc filesystem, under the /proc/xenomai/registry entry. Passing NULL indicates that no /proc support is available for the newly registered object. |
Environments:
This service can be called from:
Rescheduling: possible.
void* xnregistry_fetch | ( | xnhandle_t | handle | ) |
Find a real-time object into the registry.
This service retrieves an object from its handle into the registry and returns the memory address of its descriptor.
handle | The generic handle of the object to fetch. If XNOBJECT_SELF is passed, the object is the calling Xenomai thread. |
This service can be called from:
Rescheduling: never.
void* xnregistry_get | ( | xnhandle_t | handle | ) |
Find and lock a real-time object into the registry.
This service retrieves an object from its handle into the registry and prevents it removal atomically. A locking count is tracked, so that xnregistry_get() and xnregistry_put() must be used in pair.
handle | The generic handle of the object to find and lock. If XNOBJECT_SELF is passed, the object is the calling Xenomai thread. |
This service can be called from:
Rescheduling: never.
u_long xnregistry_put | ( | xnhandle_t | handle | ) |
Unlock a real-time object from the registry.
This service decrements the lock count of a registered object previously locked by a call to xnregistry_get(). The object is actually unlocked from the registry when the locking count falls down to zero, thus waking up any thread currently blocked on xnregistry_remove() for unregistering it.
handle | The generic handle of the object to unlock. If XNOBJECT_SELF is passed, the object is the calling Xenomai thread. |
This service can be called from:
Rescheduling: possible if the lock count falls down to zero and some thread is currently waiting for the object to be unlocked.
int xnregistry_remove | ( | xnhandle_t | handle | ) |
Forcibly unregister a real-time object.
This service forcibly removes an object from the registry. The removal is performed regardless of the current object's locking status.
handle | The generic handle of the object to remove. |
Environments:
This service can be called from:
Rescheduling: never.
int xnregistry_remove_safe | ( | xnhandle_t | handle, | |
xnticks_t | timeout | |||
) |
Unregister an idle real-time object.
This service removes an object from the registry. The caller might sleep as a result of waiting for the target object to be unlocked prior to the removal (see xnregistry_put()).
handle | The generic handle of the object to remove. | |
timeout | If the object is locked on entry, param gives the number of clock ticks to wait for the unlocking to occur (see note). Passing XN_INFINITE causes the caller to block indefinitely until the object is unlocked. Passing XN_NONBLOCK causes the service to return immediately without waiting if the object is locked on entry. |
Environments:
This service can be called from:
Rescheduling: possible if the object to remove is currently locked and the calling context can sleep.