libosmocore 1.10.0.63-d25f
Osmocom core library
|
Write queue for writing Message buffers to sockets/fds. More...
Files | |
file | write_queue.h |
Generic write queue implementation. | |
file | write_queue.c |
Data Structures | |
struct | osmo_wqueue |
write queue instance More... | |
Functions | |
void | osmo_wqueue_init (struct osmo_wqueue *queue, int max_length) |
Initialize a osmo_wqueue structure. More... | |
void | osmo_wqueue_clear (struct osmo_wqueue *queue) |
Clear a osmo_wqueue. More... | |
int | osmo_wqueue_enqueue (struct osmo_wqueue *queue, struct msgb *data) |
Enqueue a new Message buffers into a write queue. More... | |
int | osmo_wqueue_enqueue_quiet (struct osmo_wqueue *queue, struct msgb *data) |
Enqueue a new Message buffers into a write queue (without logging full queue events) More... | |
size_t | osmo_wqueue_set_maxlen (struct osmo_wqueue *queue, unsigned int len) |
Update write queue length & drop excess messages. More... | |
int | osmo_wqueue_bfd_cb (struct osmo_fd *fd, unsigned int what) |
Select loop function for write queue handling. More... | |
Write queue for writing Message buffers to sockets/fds.
int osmo_wqueue_bfd_cb | ( | struct osmo_fd * | fd, |
unsigned int | what | ||
) |
Select loop function for write queue handling.
[in] | fd | osmocom file descriptor |
[in] | what | bit-mask of events that have happened |
This function is provided so that it can be registered with the select loop abstraction code (osmo_fd::cb).
References osmo_wqueue::bfd, container_of, osmo_wqueue::current_length, osmo_wqueue::except_cb, llist_add(), llist_empty(), msg, osmo_wqueue::msg_queue, msgb_dequeue_count(), msgb_free(), OSMO_FD_EXCEPT, OSMO_FD_READ, OSMO_FD_WRITE, osmo_wqueue::read_cb, osmo_fd::when, and osmo_wqueue::write_cb.
Referenced by osmo_tundev_alloc(), and osmo_wqueue_init().
void osmo_wqueue_clear | ( | struct osmo_wqueue * | queue | ) |
Clear a osmo_wqueue.
[in] | queue | Write queue to be cleared |
This function will clear (remove/release) all messages in it.
References osmo_wqueue::bfd, osmo_wqueue::current_length, llist_empty(), msg, osmo_wqueue::msg_queue, msgb_dequeue(), msgb_free(), and osmo_fd::when.
Referenced by log_target_destroy(), osmo_tundev_close(), and tundev_ifupdown_ind_cb().
int osmo_wqueue_enqueue | ( | struct osmo_wqueue * | queue, |
struct msgb * | data | ||
) |
Enqueue a new Message buffers into a write queue.
[in] | queue | Write queue to be used |
[in] | data | to-be-enqueued message buffer |
References osmo_wqueue::current_length, data, DLGLOBAL, LOGL_ERROR, LOGP, osmo_wqueue::max_length, and osmo_wqueue_enqueue_quiet().
Referenced by osmo_tundev_send().
int osmo_wqueue_enqueue_quiet | ( | struct osmo_wqueue * | queue, |
struct msgb * | data | ||
) |
Enqueue a new Message buffers into a write queue (without logging full queue events)
[in] | queue | Write queue to be used |
[in] | data | to-be-enqueued message buffer |
References osmo_wqueue::bfd, osmo_wqueue::current_length, data, osmo_wqueue::max_length, osmo_wqueue::msg_queue, msgb_enqueue_count(), OSMO_FD_WRITE, and osmo_fd::when.
Referenced by _file_raw_output(), and osmo_wqueue_enqueue().
void osmo_wqueue_init | ( | struct osmo_wqueue * | queue, |
int | max_length | ||
) |
Initialize a osmo_wqueue structure.
[in] | queue | Write queue to operate on |
[in] | max_length | Maximum length of write queue |
References osmo_wqueue::bfd, osmo_fd::cb, osmo_wqueue::current_length, osmo_wqueue::except_cb, INIT_LLIST_HEAD, osmo_wqueue::max_length, osmo_wqueue::msg_queue, osmo_wqueue_bfd_cb(), osmo_wqueue::read_cb, and osmo_wqueue::write_cb.
Referenced by log_target_create_file(), log_target_file_switch_to_wqueue(), and osmo_tundev_alloc().
size_t osmo_wqueue_set_maxlen | ( | struct osmo_wqueue * | queue, |
unsigned int | len | ||
) |
Update write queue length & drop excess messages.
[in] | queue | linked list header of message queue |
[in] | len | new max. wqueue length |
Messages beyond the new maximum message queue size will be dropped.
References osmo_wqueue::current_length, len(), osmo_wqueue::max_length, msg, osmo_wqueue::msg_queue, msgb_dequeue_count(), and msgb_free().