Manual Pages for Linux CentOS command on man mq_send
MyWebUniversity

Manual Pages for Linux CentOS command on man mq_send

MQSEND(3) Linux Programmer's Manual MQSEND(3)

NAME

mqsend, mqtimedsend - send a message to a message queue SYNOPSIS

#include int mqsend(mqdt mqdes, const char *msgptr, sizet msglen, unsigned msgprio);

#include

#include int mqtimedsend(mqdt mqdes, const char *msgptr, sizet msglen, unsigned msgprio, const struct timespec *abstimeout);

Link with -lrt. Feature Test Macro Requirements for glibc (see featuretestmacros(7)): mqtimedsend(): XOPENSOURCE >= 600 || POSIXCSOURCE >= 200112L DESCRIPTION mqsend() adds the message pointed to by msgptr to the message queue referred to by the descriptor mqdes. The msglen argument specifies the length of the message pointed to by msgptr; this length must be

less than or equal to the queue's mqmsgsize attribute. Zero-length messages are allowed. The msgprio argument is a nonnegative integer that specifies the pri‐ ority of this message. Messages are placed on the queue in decreasing order of priority, with newer messages of the same priority being placed after older messages with the same priority. If the message queue is already full (i.e., the number of messages on the queue equals the queue's mqmaxmsg attribute), then, by default, mqsend() blocks until sufficient space becomes available to allow the message to be queued, or until the call is interrupted by a signal han‐ dler. If the ONONBLOCK flag is enabled for the message queue descrip‐ tion, then the call instead fails immediately with the error EAGAIN. mqtimedsend() behaves just like mqsend(), except that if the queue is full and the ONONBLOCK flag is not enabled for the message queue description, then abstimeout points to a structure which specifies a ceiling on the time for which the call will block. This ceiling is an

absolute timeout in seconds and nanoseconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC), and it is specified in the following structure: struct timespec { timet tvsec; /* seconds */ long tvnsec; /* nanoseconds */ }; If the message queue is full, and the timeout has already expired by the time of the call, mqtimedsend() returns immediately. RETURN VALUE

On success, mqsend() and mqtimedsend() return zero; on error, -1 is returned, with errno set to indicate the error. ERRORS EAGAIN The queue was full, and the ONONBLOCK flag was set for the mes‐ sage queue description referred to by mqdes. EBADF The descriptor specified in mqdes was invalid. EINTR The call was interrupted by a signal handler; see signal(7). EINVAL The call would have blocked, and abstimeout was invalid, either because tvsec was less than zero, or because tvnsec was less than zero or greater than 1000 million. EMSGSIZE msglen was greater than the mqmsgsize attribute of the message queue. ETIMEDOUT The call timed out before a message could be transferred. ATTRIBUTES For an explanation of the terms used in this section, see attributes(7). ┌──────────────────────────┬───────────────┬─────────┐ │Interface │ Attribute │ Value │ ├──────────────────────────┼───────────────┼─────────┤

│mqsend(), mqtimedsend() │ Thread safety │ MT-Safe │ └──────────────────────────┴───────────────┴─────────┘ CONFORMING TO

POSIX.1-2001. NOTES On Linux, mqtimedsend() is a system call, and mqsend() is a library function layered on top of that system call. SEE ALSO mqclose(3), mqgetattr(3), mqnotify(3), mqopen(3), mqreceive(3), mqunlink(3), mqoverview(7), time(7) COLOPHON

This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can

be found at http://www.kernel.org/doc/man-pages/.

Linux 2010-09-20 MQSEND(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™