Report a bug
		
				If you spot a problem with this page, click here to create a Bugzilla issue.
		
			Improve this page
		
			Quickly fork, edit online, and submit a pull request for this page.
			Requires a signed-in GitHub account. This works well for small changes.
			If you'd like to make larger changes you may want to consider using
			a local clone.
		
	core.sys.posix.mqueue
D header file for Posix Message Queues
Defines external functions required to manage Posix Message Queues
 mq_open(3)          open a message queue
 mq_close(3)         close a message queue
 mq_unlink(3)        remove a message queue
 mq_send(3)          send a message
 mq_receive(3)       receive a message
 mq_timedsend(3)     send a message with a timeout (linux specific)
 mq_timedreceive(3)  receive a message with a timeout (linux specific)
 mq_getattr(3)       get message queue attributes
 mq_setattr(3)       set message queue attributes
 mq_notify(3)        register asynchronous notify
License: 
Authors: 
Andreas Bok Andersen, Mathias Lang
Standards: 
POSIX.1-2001.
See Also: 
Source core/sys/posix/mqueue.d
- aliasmqd_t= int;
- Message queue descriptor.
- structmq_attr;
- Used in getting and setting the attributes of a message queue.- c_longmq_flags;
- Message queue flags.
- c_longmq_maxmsg;
- Maximum number of messages.
- c_longmq_msgsize;
- Maximum message size.
- c_longmq_curmsgs;
- Number of messages currently queued.
 
- nothrow @nogc mqd_tmq_open(const(char)*name, intoflag, ...);
- Establish connection between a process and a message queuename.Note Linux prototypes are: mqd_t mq_open (const(char)* name, int oflag); mqd_t mq_open (const(char)* name, int oflag, mode_t mode, mq_attr* attr); Parameters:const(char)* nameName of the message queue to open. int oflagdetermines the type of access used. If O_CREAT is on oflag, the third argument is taken as a mode_t, the mode of the created message queue. If O_CREAT is onoflag, the fourth argument is taken as a pointer to a `mq_attr' (message queue attributes). If the fourth argument is null, default attributes are used.... varargs matching the function prototypes Returns:Message queue descriptor or (mqd_t) -1 on error.
- nothrow @nogc intmq_close(mqd_tmqdes);
- Closes the message queue descriptor mqdes.Parameters:mqd_t mqdesMessage queue descriptor to close. Returns:On success mq_close() returns 0; on error, -1 is returned, with errno set to indicate the error.
- nothrow @nogc intmq_getattr(mqd_tmqdes, mq_attr*mqstat);
- Query status and attributes of message queuemqdes.Parameters:mqd_t mqdesMessage queue descriptor. mq_attr* mqstatBuffer to fill with the message queue's attributes. Returns:On success mq_getattr() return 0; on error, -1 is returned, with errno set to indicate the error.
- nothrow @nogc intmq_unlink(const(char)*name);
- Remove the specified message queuename.Parameters:const(char)* nameName of the queue to remove. Returns:On success mq_unlink() returns 0; on error, -1 is returned, with errno set to indicate the error.
- nothrow @nogc intmq_notify(mqd_tmqdes, const(sigevent)*notification);
- Register for notification when a message is availableParameters:mqd_t mqdesMessage queue descriptor. const(sigevent)* notificationSee man 3 mq_notifyfor details.Returns:On success mq_notify() returns 0; on error, -1 is returned, with errno set to indicate the error.
- nothrow @nogc ssize_tmq_receive(mqd_tmqdes, char*msg_ptr, size_tmsg_len, uint*msg_prio);
- Receive the oldest message with the highest priority the message queueParameters:mqd_t mqdesMessage queue descriptor. char* msg_ptrBuffer to write the message to size_t msg_lenSize of the buffer provided as msg_ptr. Must be greater than the mq_msgsize attribute of the queue.uint* msg_prioIf not null, set to the priority of this message. Returns:On success, mq_receive() returns the number of bytes in the received message; on error, -1 is returned, with errno set to indicate the error
- nothrow @nogc ssize_tmq_timedreceive(mqd_tmqdes, char*msg_ptr, size_tmsg_len, uint*msg_prio, const(timespec)*abs_timeout);
- Receive the oldest message with the highest priority the message queue, wait up to a certain timeout.Parameters:mqd_t mqdesMessage queue descriptor. char* msg_ptrBuffer to write the message to size_t msg_lenSize of the buffer provided as msg_ptr. Must be greater than the mq_msgsize attribute of the queue.uint* msg_prioIf not null, set to the priority of this message. const(timespec)* abs_timeoutSpecify a ceiling on the time to block if the queue is empty. Returns:On success, mq_receive() returns the number of bytes in the received message; on error, -1 is returned, with errno set to indicate the error
- nothrow @nogc intmq_send(mqd_tmqdes, const(char)*msg_ptr, size_tmsg_len, uintmsg_prio);
- Add a message to a message queue.Parameters:mqd_t mqdesMessage queue descriptor. const(char)* msg_ptrBuffer to read the message from size_t msg_lenSize of the message provided via msg_ptr. Must be lower or equal to the mq_msgsize attribute of the queue.uint msg_prioPriority of this message. Returns:On success, mq_send() return zero; on error, -1 is returned, with errno set to indicate the error.
- nothrow @nogc intmq_timedsend(mqd_tmqdes, const(char)*msg_ptr, size_tmsg_len, uintmsg_prio, const(timespec)*abs_timeout);
- Add a message to a message queue, block up to a certain time if the queue is full.Parameters:mqd_t mqdesMessage queue descriptor. const(char)* msg_ptrBuffer to read the message from size_t msg_lenSize of the message provided via msg_ptr. Must be lower or equal to the mq_msgsize attribute of the queue.uint msg_prioPriority of this message. const(timespec)* abs_timeoutSpecify a ceiling on the time to block if the queue is empty. Returns:On success, mq_timedsend() return zero; on error, -1 is returned, with errno set to indicate the error.
Copyright © 1999-2025 by the D Language Foundation | Page generated by
Ddoc on Mon Mar 31 10:27:47 2025