89_Static_assert(
sizeof(
struct MessageQueue) %
sizeof(
void *) == 0,
90 "MessageQueue structure must end correctly aligned for storing "
103 size_t elementCount);
117 AllocatorCapability heapCapability,
120 size_t elementCount);
227int __cheri_compartment(
"message_queue")
229 AllocatorCapability heapCapability,
232 size_t elementCount);
250int __cheri_compartment(
"message_queue")
252 AllocatorCapability heapCapability,
261int __cheri_compartment(
"message_queue")
272int __cheri_compartment(
"message_queue")
284int __cheri_compartment(
"message_queue")
295int __cheri_compartment(
"message_queue")
309int __cheri_compartment(
"message_queue")
339int __cheri_compartment(
"message_queue")
352int __cheri_compartment(
"message_queue")
387static inline int __attribute__((
388 deprecated(
"Restricted handles have been replaced by permissions on queue "
389 "capabilities, controlled with queue_permissions_and")))
391 AllocatorCapability heapCapability,
408static inline int __attribute__((
409 deprecated(
"Restricted handles have been replaced by permissions on queue "
410 "capabilities, controlled with queue_permissions_and")))
412 AllocatorCapability heapCapability,
CHERIoT RTOS heap allocator interface.
This file provides interfaces to the multi-waiter system.
int __cheri_libcall queue_send(TimeoutArgument timeout, struct MessageQueue *handle, const void *src)
Send a message to the queue specified by handle.
int queue_send_multiple_sealed(TimeoutArgument timeout, CHERI_SEALED(struct MessageQueue *) handle, const void *src, size_t count)
Send multiple messages via a sealed queue endpoint.
int __cheri_libcall queue_send_multiple(TimeoutArgument timeout, struct MessageQueue *handle, const void *src, size_t count)
Send multiple messages to the queue specified by handle.
int queue_destroy_sealed(TimeoutArgument timeout, AllocatorCapability heapCapability, CHERI_SEALED(struct MessageQueue *) queueHandle)
Destroy a queue.
static CHERI_SEALED(struct MessageQueue *) queue_permissions_and(CHERI_SEALED(struct MessageQueue *) handle
Returns a copy of handle with a subset of permissions.
int __cheri_libcall queue_destroy(AllocatorCapability heapCapability, struct MessageQueue *handle)
Destroys a queue.
int queue_create_sealed(TimeoutArgument timeout, AllocatorCapability heapCapability, CHERI_SEALED(struct MessageQueue *) *outQueue, size_t elementSize, size_t elementCount)
Allocate a new message queue that is managed by the message queue compartment.
int __cheriot_libcall queue_stop(struct MessageQueue *handle)
Stops the queue.
int __cheri_libcall queue_create(TimeoutArgument timeout, AllocatorCapability heapCapability, struct MessageQueue **outQueue, size_t elementSize, size_t elementCount)
Allocates space for a queue using heapCapability and stores a handle to it via outQueue.
int queue_receive_sealed(TimeoutArgument timeout, CHERI_SEALED(struct MessageQueue *) handle, void *dst)
Receive a message via a sealed queue endpoint.
static int queue_receive_handle_create_sealed(TimeoutArgument timeout, AllocatorCapability heapCapability, CHERI_SEALED(struct MessageQueue *) handle, CHERI_SEALED(struct MessageQueue *) *outHandle)
Convert a queue handle returned from queue_create_sealed into one that can be used only for receiving...
int __cheri_libcall queue_items_remaining(struct MessageQueue *handle, size_t *items)
Returns the number of items in the queue specified by handle via items.
int __cheri_libcall queue_receive(TimeoutArgument timeout, struct MessageQueue *handle, void *dst)
Receive a message over a queue specified by handle.
int queue_items_remaining_sealed(CHERI_SEALED(struct MessageQueue *) handle, size_t *items)
Returns, via items, the number of items in the queue specified by handle.
int __cheri_libcall queue_reset(TimeoutArgument timeout, struct MessageQueue *queue)
Reset a queue to its initial state.
int queue_send_sealed(TimeoutArgument timeout, CHERI_SEALED(struct MessageQueue *) handle, const void *src)
Send a message via a sealed queue endpoint.
void __cheri_libcall multiwaiter_queue_send_init(struct EventWaiterSource *source, struct MessageQueue *handle)
Initialise an event waiter source so that it will wait for the queue to be ready to send.
ssize_t __cheri_libcall queue_allocation_size(size_t elementSize, size_t elementCount)
Returns the allocation size needed for a queue with the specified number and size of elements.
int queue_receive_multiple_sealed(TimeoutArgument timeout, CHERI_SEALED(struct MessageQueue *) handle, void *dst, size_t count)
Receive multiple messages via a sealed queue endpoint.
static int queue_permissions(CHERI_SEALED(struct MessageQueue *) handle)
Returns the permissions held by this message queue handle.
int multiwaiter_queue_receive_init_sealed(struct EventWaiterSource *source, handle)
Initialise an event waiter source as in multiwaiter_queue_receive_init, using a sealed queue endpoint...
void __cheri_libcall multiwaiter_queue_receive_init(struct EventWaiterSource *source, struct MessageQueue *handle)
Initialise an event waiter source so that it will wait for the queue to be ready to receive.
static int queue_send_handle_create_sealed(TimeoutArgument timeout, AllocatorCapability heapCapability, CHERI_SEALED(struct MessageQueue *) handle, CHERI_SEALED(struct MessageQueue *) *outHandle)
Convert a queue handle returned from queue_create_sealed into one that can be used only for sending.
MessageQueuePermission
Permissions on message queue handles.
@ MessageQueuePermitReceive
This handle may be used to receive messages.
@ MessageQueuePermitDestroy
This handle may be used to deallocate the queue.
@ MessageQueuePermitSend
This handle may be used to send messages.
int __cheri_libcall queue_receive_multiple(TimeoutArgument timeout, struct MessageQueue *handle, void *dst, size_t count)
Receive multiple messages to the queue specified by handle.
int multiwaiter_queue_send_init_sealed(struct EventWaiterSource *source, handle)
Initialise an event waiter source as in multiwaiter_queue_send_init, using a sealed queue endpoint.
Structure describing a change to the set of managed event sources for an event waiter.
Structure representing a queue.
size_t queueSize
The size of the queue.
size_t elementSize
The size of one element in this queue.
_Atomic(uint32_t) producer
The producer counter.
_Atomic(uint32_t) consumer
The consumer counter.
This file contains the types used for timeouts across scheduler APIs.
APIs for dealing with type-safe opaque handles (sealed objects).
static int token_permissions_get(CHERI_SEALED(void *) object)
Returns the user permissions bitmap for the sealed object.
token_permissions_and(CHERI_SEALED(T *) object, int permissions)
Mask the user permissions of a sealed object.