dm_mqueue Module

Module for inter-process communication (IPC) and message passing through POSIX message queues. Has to be linked with -lrt.


Uses

  • module~~dm_mqueue~~UsesGraph module~dm_mqueue dm_mqueue module~dm_error dm_error module~dm_mqueue->module~dm_error module~dm_id dm_id module~dm_mqueue->module~dm_id module~dm_kind dm_kind module~dm_mqueue->module~dm_kind module~dm_log dm_log module~dm_mqueue->module~dm_log module~dm_observ dm_observ module~dm_mqueue->module~dm_observ module~dm_type dm_type module~dm_mqueue->module~dm_type unix unix module~dm_mqueue->unix module~dm_error->module~dm_kind module~dm_ascii dm_ascii module~dm_error->module~dm_ascii iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env module~dm_log->module~dm_error module~dm_log->module~dm_id module~dm_log->module~dm_kind module~dm_log->module~dm_observ module~dm_node dm_node module~dm_log->module~dm_node module~dm_sensor dm_sensor module~dm_log->module~dm_sensor module~dm_target dm_target module~dm_log->module~dm_target module~dm_time dm_time module~dm_log->module~dm_time module~dm_uuid dm_uuid module~dm_log->module~dm_uuid module~dm_observ->module~dm_error module~dm_observ->module~dm_id module~dm_observ->module~dm_kind module~dm_observ->module~dm_node module~dm_request dm_request module~dm_observ->module~dm_request module~dm_response dm_response module~dm_observ->module~dm_response module~dm_observ->module~dm_sensor module~dm_observ->module~dm_target module~dm_observ->module~dm_time module~dm_util dm_util module~dm_observ->module~dm_util module~dm_observ->module~dm_uuid module~dm_node->module~dm_id module~dm_node->module~dm_kind module~dm_request->module~dm_error module~dm_request->module~dm_id module~dm_request->module~dm_kind module~dm_request->module~dm_response module~dm_request->module~dm_time module~dm_request->module~dm_util module~dm_string dm_string module~dm_request->module~dm_string module~dm_response->module~dm_error module~dm_response->module~dm_id module~dm_response->module~dm_kind module~dm_response->module~dm_util module~dm_sensor->module~dm_id module~dm_sensor->module~dm_kind module~dm_sensor->module~dm_node module~dm_target->module~dm_id module~dm_target->module~dm_kind module~dm_target->module~dm_util module~dm_time->module~dm_error module~dm_time->module~dm_kind module~dm_time->module~dm_util module~dm_util->module~dm_error module~dm_util->module~dm_kind module~dm_string->module~dm_error module~dm_string->module~dm_kind

Used by

  • module~~dm_mqueue~~UsedByGraph module~dm_mqueue dm_mqueue module~dm_mqueue_util dm_mqueue_util module~dm_mqueue_util->module~dm_mqueue module~dmpack dmpack module~dmpack->module~dm_mqueue module~dmpack->module~dm_mqueue_util

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: MQUEUE_MODE = int(o'0644')

Default permissions (octal).

integer, public, parameter :: MQUEUE_NAME_LEN = ID_LEN+1

Maximum message queue identifier length.

integer, public, parameter :: MQUEUE_MAX_MSG = 10

Maximum number of messages in queue.

integer, public, parameter :: MQUEUE_RDONLY = 0

Read-only access.

integer, public, parameter :: MQUEUE_WRONLY = 1

Write-only access.

integer, public, parameter :: MQUEUE_RDWR = 2

Read/write access.


Interfaces

public interface dm_mqueue_open

Generic message queue open function.

  • private function mqueue_open_raw(mqueue, name, max_msg, msg_size, access, mode, create, exclusive, blocking) result(rc)

    Opens POSIX message queue of given name.

    The function returns the following error codes:

    • E_INVALID if name is empty or starts with /.
    • E_MQUEUE if system call to open the queue failed.

    Arguments

    Type IntentOptional Attributes Name
    type(mqueue_type), intent(out) :: mqueue

    Message queue type.

    character(len=*), intent(in) :: name

    Message queue name (without leading /).

    integer, intent(in) :: max_msg

    Maximum number of messages in queue.

    integer, intent(in) :: msg_size

    Message size.

    integer, intent(in), optional :: access

    Access type (MQUEUE_RDONLY, MQUEUE_WRONLY, MQUEUE_RDWR).

    integer, intent(in), optional :: mode

    Access permissions.

    logical, intent(in), optional :: create

    Creates message queue if true.

    logical, intent(in), optional :: exclusive

    Opens message queue exclusively if true.

    logical, intent(in), optional :: blocking

    Blocking access if true.

    Return Value integer

  • private function mqueue_open_type(mqueue, type, name, access, blocking) result(rc)

    Opens message queue for reading/writing logs or observations (in blocking mode by default).

    The function returns the following error codes:

    • E_INVALID if type is invalid, name is empty, or name starts with /.
    • E_MQUEUE if system call to open the queue failed.

    Arguments

    Type IntentOptional Attributes Name
    type(mqueue_type), intent(out) :: mqueue

    Message queue type.

    integer, intent(in) :: type

    Data type (TYPE_LOG, TYPE_OBSERV).

    character(len=*), intent(in) :: name

    Message queue name (without leading /).

    integer, intent(in) :: access

    MQUEUE_RDONLY, MQUEUE_WRONLY, MQUEUE_RDWR.

    logical, intent(in), optional :: blocking

    Blocking access if true.

    Return Value integer

public interface dm_mqueue_read

Generic message queue read function.

  • private function mqueue_read_log(mqueue, log, timeout) result(rc)

    Receives log from message queue. The received message shall not be larger than parameter LOG_SIZE. Returns E_MQUEUE on error.

    Arguments

    Type IntentOptional Attributes Name
    type(mqueue_type), intent(inout) :: mqueue

    Message queue type.

    type(log_type), intent(out) :: log

    Log type.

    integer(kind=i8), intent(in), optional :: timeout

    Timeout in seconds.

    Return Value integer

  • private function mqueue_read_observ(mqueue, observ, timeout) result(rc)

    Receives observation from message queue. The received message shall not be larger than parameter OBSERV_SIZE. Returns E_MQUEUE on error.

    Arguments

    Type IntentOptional Attributes Name
    type(mqueue_type), intent(inout) :: mqueue

    Message queue type.

    type(observ_type), intent(out) :: observ

    Observation type.

    integer(kind=i8), intent(in), optional :: timeout

    Timeout in seconds.

    Return Value integer

  • private function mqueue_read_raw(mqueue, buffer, priority, timeout) result(rc)

    Receives message from message queue and returns data in buffer. The buffer size must equal the message size. Returns E_MQUEUE on error.

    Arguments

    Type IntentOptional Attributes Name
    type(mqueue_type), intent(inout) :: mqueue

    Message queue type.

    character(len=*), intent(inout) :: buffer

    Byte buffer.

    integer, intent(out), optional :: priority

    Message priority.

    integer(kind=i8), intent(in), optional :: timeout

    Timeout in seconds.

    Return Value integer

public interface dm_mqueue_write

Generic message queue write function.

  • private function mqueue_write_log(mqueue, log) result(rc)

    Sends log message to message queue. Returns E_MQUEUE on error.

    Arguments

    Type IntentOptional Attributes Name
    type(mqueue_type), intent(inout) :: mqueue

    Message queue type.

    type(log_type), intent(inout) :: log

    Log type.

    Return Value integer

  • private function mqueue_write_observ(mqueue, observ) result(rc)

    Sends observation to message queue. Returns E_MQUEUE on error.

    Arguments

    Type IntentOptional Attributes Name
    type(mqueue_type), intent(inout) :: mqueue

    Message queue type.

    type(observ_type), intent(inout) :: observ

    Observation type.

    Return Value integer

  • private function mqueue_write_raw(mqueue, buffer, priority) result(rc)

    Sends log to message queue. Returns E_MQUEUE on error.

    Arguments

    Type IntentOptional Attributes Name
    type(mqueue_type), intent(inout) :: mqueue

    Message queue type.

    character(len=*), intent(inout) :: buffer

    Byte buffer

    integer, intent(in), optional :: priority

    Priority

    Return Value integer


Derived Types

type, public ::  mqueue_type

Opaque POSIX message queue type.


Functions

public function dm_mqueue_attributes(mqueue, flags, max_msg, msg_size, cur_msgs) result(rc)

Returns message queue attributes.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mqueue_type), intent(inout) :: mqueue

Message queue type.

integer(kind=i8), intent(out), optional :: flags

Flags.

integer(kind=i8), intent(out), optional :: max_msg

Maximum number of messages in queue.

integer(kind=i8), intent(out), optional :: msg_size

Message size.

integer(kind=i8), intent(out), optional :: cur_msgs

Current number of messages in queue.

Return Value integer

public function dm_mqueue_close(mqueue) result(rc)

Closes message queue.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mqueue_type), intent(inout) :: mqueue

Message queue type.

Return Value integer

public function dm_mqueue_unlink(mqueue) result(rc)

Deletes POSIX message queue.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mqueue_type), intent(inout) :: mqueue

Message queue type.

Return Value integer