Skip to content

mq_timedsend

Intro

mq_timedsend - Send a message to a message queue, with a timeout.

Description

mq_timedsend is a function used to send a message to a message queue, with a timeout specified. It has the following arguments: a message queue descriptor, a message pointer, the message length, the priority of the message, and a pointer to a timespec struct containing the timeout. Upon a successful call the message is added to the queue, in the order of priority.

The mq_timedsend call is more efficient than mq_send when the timeout is specified as the latter has to check the queue everytime to see if its gotten full, while the former only has to check the timout. However, if no timeout is specified mq_send should be used instead as it's more efficient.

Additionally, if the message queue descriptor is invalid, mq_timedsend will return an error.

Arguments

  • mqdes:mqd_t[K] - File descriptor of the message queue.
  • msg_ptr:const char*[K] - Pointer to the message to be sent.
  • msg_len:size_t[K] - Length of the message.
  • msg_prio:unsigned int[K] - Priority of the message.
  • abs_timeout:const struct timespec*[K] - Pointer to a timespec struct containing the timeout information.

Available Tags

  • K - Originated from kernel-space.

Hooks

mq_timedsend_start

Type

Kprobe

Purpose

Hook the start of mq_timedsend to measure time and latency of this syscall.

mq_timedsend_return

Type

Kretprobe

Purpose

Hook the return of mq_timedsend to measure time and latency of this syscall.

Example Use Case

An example use case of this syscall would be when there is an application that needs to send a message with a certain priority, and there is a time limit on when the message needs to be sent.

Issues

mq_timedsend is only available for Linux 2.6.7 or later.

  • mq_send
  • mq_timedreceive
  • mq_unlink

This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.