LF OS
Hobby operating system for amd64 with high ambitions
Loading...
Searching...
No Matches
mq.h File Reference

(7c4d7d1 userspace/term: change eyecandy inclusion to use objcopy instead of xxd)

#include <allocator.h>
#include <stdint.h>
#include <stdbool.h>
#include <message_passing.h>
+ Include dependency graph for mq.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef uint64_t mq_id_t
 
typedef void(* mq_notifier) (mq_id_t mq)
 

Functions

void init_mq (allocator_t *alloc)
 
mq_id_t mq_create (allocator_t *alloc)
 
void mq_destroy (mq_id_t mq)
 
uint64_t mq_push (mq_id_t mq, struct Message *message)
 
uint64_t mq_pop (mq_id_t mq, struct Message *message)
 
uint64_t mq_peek (mq_id_t mq, struct Message *message)
 
uint64_t mq_notify_teardown (mq_id_t mq, mq_notifier notifier)
 

Typedef Documentation

◆ mq_id_t

typedef uint64_t mq_id_t

Definition at line 9 of file mq.h.

◆ mq_notifier

typedef void(* mq_notifier) (mq_id_t mq)

Definition at line 11 of file mq.h.

Function Documentation

◆ init_mq()

void init_mq ( allocator_t alloc)

Definition at line 65 of file mq.c.

References alloc, mqs, and tpa_new().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mq_create()

mq_id_t mq_create ( allocator_t alloc)

Definition at line 69 of file mq.c.

References alloc, MessageQueue::max_items, mq, mqs, new_flexarray(), next_mq, panic_message(), and tpa_set().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mq_destroy()

void mq_destroy ( mq_id_t  mq)

Definition at line 93 of file mq.c.

References MessageQueue::alloc, allocator::dealloc, delete_flexarray(), MessageQueue::first_page, flexarray_get(), flexarray_length(), mq, mqs, MessageQueuePage::next, MessageQueue::notify_teardown, tpa_get(), and tpa_set().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mq_notify_teardown()

uint64_t mq_notify_teardown ( mq_id_t  mq,
mq_notifier  notifier 
)

Definition at line 242 of file mq.c.

References EEXIST, ENOENT, flexarray_append(), flexarray_get(), flexarray_length(), mq, mqs, MessageQueue::notify_teardown, and tpa_get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mq_peek()

uint64_t mq_peek ( mq_id_t  mq,
struct Message message 
)

Definition at line 218 of file mq.c.

References EMSGSIZE, ENOENT, ENOMSG, MessageQueue::first_page, MessageQueue::items, memcpy(), mq, mqs, MT_Invalid, MessageQueuePage::pop_position, Message::size, tpa_get(), and Message::type.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mq_pop()

uint64_t mq_pop ( mq_id_t  mq,
struct Message message 
)

Definition at line 190 of file mq.c.

References MessageQueue::alloc, MessageQueuePage::bytes, MessageQueue::bytes, allocator::dealloc, error, MessageQueue::first_page, MessageQueuePage::items, MessageQueue::items, MessageQueue::last_page, mq, mq_peek(), mqs, MessageQueuePage::next, MessageQueuePage::pop_position, Message::size, and tpa_get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mq_push()

uint64_t mq_push ( mq_id_t  mq,
struct Message message 
)

Definition at line 144 of file mq.c.

References MessageQueuePage::allocated, MessageQueue::average_message_size, MessageQueuePage::bytes, MessageQueue::bytes, ENOENT, ENOMEM, MessageQueuePage::items, MessageQueue::items, MessageQueue::last_page, MessageQueue::max_bytes, MessageQueue::max_items, memcpy(), message, wait_data::message_queue, mq, mq_alloc_page(), mqs, MessageQueuePage::push_position, scheduler_waitable_done(), Message::size, tpa_get(), and wait_reason_message.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: