gcc/libphobos/libdruntime/core/sys/posix/mqueue.d
Iain Buclaw 8da8c7d337 d: Merge upstream dmd, druntime 4ca4140e58, phobos 454dff14d.
D front-end changes:

	- Import dmd v2.103.0-beta.1.
	- Using `alias this' for classes has been deprecated.
	- The feature `-fpreview=dip25` is now enabled by default.
	- The compile-time traits `isVirtualFunction' and
	  `getVirtualFunctions' have been deprecated.

D runtime changes:

	- Import druntime v2.103.0-beta.1.

Phobos changes:

	- Import phobos v2.103.0-beta.1.
	- Updated unicode grapheme walking updated to conform to Unicode
	  version 15.
	- Improved friendliness of error messages when instantiating
	  `std.algorithm.iteration.joiner' and
	  `std.algorithm.sorting.sort' with wrong inputs.

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 4ca4140e58.
	* dmd/VERSION: Bump version to v2.103.0-beta.1.
	* Make-lang.in (D_FRONTEND_OBJS): Add d/errorsink.o.
	* d-ctfloat.cc (CTFloat::sprint): Update signature for new front-end
	interface.
	* d-frontend.cc (getTypeInfoType): Likewise.
	* d-lang.cc (d_handle_option): Remove handling of -fpreview=dip25 and
	-frevert=dip25.
	(d_post_options): Remove enabling of sealed references language
	feature when scoped pointers is enabled.
	* d-tree.h (create_typeinfo): Update signature.
	* decl.cc (DeclVisitor::finish_vtable): Update for new front-end
	interface.
	(DeclVisitor::visit (VarDeclaration *)): Likewise.
	(DeclVisitor::visit (FuncDeclaration *)): Check skipCodegen to see if
	front-end explicitly requested not to generate code.
	* expr.cc (ExprVisitor::visit (NewExp *)): Update for new front-end
	interface.
	* lang.opt (fpreview=dip25): Remove.
	(frevert=dip25): Remove.
	* modules.cc (layout_moduleinfo_fields): Update for new front-end
	interface.
	(layout_moduleinfo): Likewise.
	* runtime.def (NEWCLASS): Remove.
	* toir.cc (IRVisitor::visit (IfStatement *)): Don't generate IR for if
	statement list when condition is `__ctfe'.
	* typeinfo.cc (create_typeinfo): Add generate parameter.
	* types.cc (layout_aggregate_members): Update for new front-end
	interface.

libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime 4ca4140e58.
	* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add core/factory.d.
	* libdruntime/Makefile.in: Regenerate.
	* src/MERGE: Merge upstream phobos 454dff14d.
	* testsuite/libphobos.hash/test_hash.d: Update test.
	* testsuite/libphobos.shared/finalize.d: Update test.
	* libdruntime/core/factory.d: New file.

gcc/testsuite/ChangeLog:

	* gdc.dg/torture/simd23084.d: New test.
	* gdc.dg/torture/simd23085.d: New test.
	* gdc.dg/torture/simd23218.d: New test.
2023-03-16 17:29:57 +01:00

222 lines
6.9 KiB
D

/**
* 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
*
* Copyright: Copyright (c) 2016 sociomantic labs. All rights reserved
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Andreas Bok Andersen, Mathias Lang
* Standards: POSIX.1-2001.
* See_Also: $(HTTP pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html, Standard)
* Source: $(DRUNTIMESRC core/sys/posix/mqueue.d)
*/
module core.sys.posix.mqueue;
import core.sys.posix.config;
import core.sys.posix.signal;
import core.sys.posix.time;
version (Posix):
version (CRuntime_Glibc):
extern (C):
@nogc nothrow:
/// Message queue descriptor.
alias int mqd_t;
/**
* Used in getting and setting the attributes of a message queue.
*/
struct mq_attr
{
/// Message queue flags.
c_long mq_flags;
/// Maximum number of messages.
c_long mq_maxmsg;
/// Maximum message size.
c_long mq_msgsize;
/// Number of messages currently queued.
c_long mq_curmsgs;
}
/**
* Establish connection between a process and a message queue `name`.
*
* 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);
*
* Params:
* name = Name of the message queue to open.
* oflag = determines 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 on `oflag`, 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.
*/
mqd_t mq_open(const(char)* name, int oflag, ...);
/**
* Closes the message queue descriptor mqdes.
*
* Params:
* mqdes = Message queue descriptor to close.
*
* Returns:
* On success mq_close() returns 0; on error, -1 is returned, with errno
* set to indicate the error.
*/
int mq_close (mqd_t mqdes);
/**
* Query status and attributes of message queue `mqdes`.
*
* Params:
* mqdes = Message queue descriptor.
* mqstat = Buffer 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.
*/
int mq_getattr (mqd_t mqdes, mq_attr* mqstat);
/*
* Set attributes associated with message queue `mqdes`
*
* Params:
* mqdes = Message queue descriptor.
* newstat = non-null pointer to fill with attributes for `mqdes`.
* oldstat = if not `null` it is filled with the old attributes.
*
* Returns:
* On success mq_setattr() return 0; on error, -1 is returned, with errno
* set to indicate the error.
*/
int mq_setattr (mqd_t mqdes, const(mq_attr)* newstat, mq_attr* oldstat);
/**
* Remove the specified message queue `name`.
*
* Params:
* name = Name of the queue to remove.
*
* Returns:
* On success mq_unlink() returns 0; on error, -1 is returned, with errno
* set to indicate the error.
*/
int mq_unlink (const(char)* name);
/**
* Register for notification when a message is available
*
* Params:
* mqdes = Message queue descriptor.
* notification = See `man 3 mq_notify` for details.
*
* Returns:
* On success mq_notify() returns 0; on error, -1 is returned, with errno
* set to indicate the error.
*/
int mq_notify (mqd_t mqdes, const(sigevent)* notification);
/**
* Receive the oldest message with the highest priority the message queue
*
* Params:
* mqdes = Message queue descriptor.
* msg_ptr = Buffer to write the message to
* msg_len = Size of the buffer provided as `msg_ptr`. Must be greater
* than the mq_msgsize attribute of the queue.
* msg_prio = If 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
*/
ssize_t mq_receive (mqd_t mqdes, char* msg_ptr, size_t msg_len, uint* msg_prio);
/**
* Receive the oldest message with the highest priority the message queue,
* wait up to a certain timeout.
*
* Params:
* mqdes = Message queue descriptor.
* msg_ptr = Buffer to write the message to
* msg_len = Size of the buffer provided as `msg_ptr`. Must be greater
* than the mq_msgsize attribute of the queue.
* msg_prio = If not `null`, set to the priority of this message.
* abs_timeout = Specify 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
*/
pragma(mangle, muslRedirTime64Mangle!("mq_timedreceive", "__mq_timedreceive_time64"))
ssize_t mq_timedreceive (mqd_t mqdes, char* msg_ptr, size_t msg_len,
uint* msg_prio, const(timespec)* abs_timeout);
/**
* Add a message to a message queue.
*
* Params:
* mqdes = Message queue descriptor.
* msg_ptr = Buffer to read the message from
* msg_len = Size of the message provided via `msg_ptr`. Must be lower
* or equal to the mq_msgsize attribute of the queue.
* msg_prio = Priority of this message.
*
* Returns:
* On success, mq_send() return zero; on error, -1 is returned, with errno
* set to indicate the error.
*/
int mq_send (mqd_t mqdes, const(char)* msg_ptr, size_t msg_len, uint msg_prio);
/**
* Add a message to a message queue, block up to a certain time if the queue
* is full.
*
* Params:
* mqdes = Message queue descriptor.
* msg_ptr = Buffer to read the message from
* msg_len = Size of the message provided via `msg_ptr`. Must be lower
* or equal to the mq_msgsize attribute of the queue.
* msg_prio = Priority of this message.
* abs_timeout = Specify 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.
*
*/
pragma(mangle, muslRedirTime64Mangle!("mq_timedsend", "__mq_timedsend_time64"))
int mq_timedsend (mqd_t mqdes, const(char)* msg_ptr, size_t msg_len,
uint msg_prio, const(timespec)* abs_timeout);