2023-05-03 22:11:05 +08:00
|
|
|
/****************************************************************************
|
2012-07-17 11:58:11 +08:00
|
|
|
* include/mqueue.h
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2024-10-02 21:59:15 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2021-02-03 18:33:49 +08:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2021-02-03 18:33:49 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2021-02-03 18:33:49 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2023-05-03 22:11:05 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2008-11-17 00:36:30 +08:00
|
|
|
#ifndef __INCLUDE_MQUEUE_H
|
|
|
|
#define __INCLUDE_MQUEUE_H
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2023-05-03 22:11:05 +08:00
|
|
|
/****************************************************************************
|
2007-02-18 07:21:28 +08:00
|
|
|
* Included Files
|
2023-05-03 22:11:05 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
2023-05-03 22:11:05 +08:00
|
|
|
/****************************************************************************
|
2014-09-29 00:15:33 +08:00
|
|
|
* Pre-processor Definitions
|
2023-05-03 22:11:05 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2007-03-21 00:51:12 +08:00
|
|
|
#define MQ_NONBLOCK O_NONBLOCK
|
|
|
|
|
2023-05-03 22:11:05 +08:00
|
|
|
/****************************************************************************
|
2015-08-04 01:01:41 +08:00
|
|
|
* Public Type Declarations
|
2023-05-03 22:11:05 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
|
|
|
/* Message queue attributes */
|
|
|
|
|
|
|
|
struct mq_attr
|
|
|
|
{
|
2023-06-08 15:01:50 +08:00
|
|
|
long mq_maxmsg; /* Max number of messages in queue */
|
|
|
|
long mq_msgsize; /* Max message size */
|
|
|
|
long mq_flags; /* Queue flags */
|
|
|
|
long mq_curmsgs; /* Number of messages currently in queue */
|
2007-02-18 07:21:28 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Message queue descriptor */
|
|
|
|
|
2020-12-22 22:02:48 +08:00
|
|
|
typedef int mqd_t;
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2023-05-03 22:11:05 +08:00
|
|
|
/****************************************************************************
|
2014-12-06 09:16:14 +08:00
|
|
|
* Public Data
|
2023-05-03 22:11:05 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
2014-12-06 09:16:14 +08:00
|
|
|
extern "C"
|
|
|
|
{
|
2007-02-18 07:21:28 +08:00
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2023-05-03 22:11:05 +08:00
|
|
|
/****************************************************************************
|
2014-12-06 09:16:14 +08:00
|
|
|
* Public Function Prototypes
|
2023-05-03 22:11:05 +08:00
|
|
|
****************************************************************************/
|
2014-12-06 09:16:14 +08:00
|
|
|
|
|
|
|
mqd_t mq_open(FAR const char *mq_name, int oflags, ...);
|
2020-05-06 17:24:42 +08:00
|
|
|
int mq_close(mqd_t mqdes);
|
2014-12-06 09:16:14 +08:00
|
|
|
int mq_unlink(FAR const char *mq_name);
|
2019-02-16 09:18:55 +08:00
|
|
|
int mq_send(mqd_t mqdes, FAR const char *msg, size_t msglen,
|
|
|
|
unsigned int prio);
|
|
|
|
int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen,
|
|
|
|
unsigned int prio, FAR const struct timespec *abstime);
|
|
|
|
ssize_t mq_receive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
|
|
|
FAR unsigned int *prio);
|
|
|
|
ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
|
|
|
FAR unsigned int *prio,
|
2014-12-06 09:16:14 +08:00
|
|
|
FAR const struct timespec *abstime);
|
2020-05-06 17:24:42 +08:00
|
|
|
int mq_notify(mqd_t mqdes, FAR const struct sigevent *notification);
|
2014-12-06 09:16:14 +08:00
|
|
|
int mq_setattr(mqd_t mqdes, FAR const struct mq_attr *mq_stat,
|
|
|
|
FAR struct mq_attr *oldstat);
|
|
|
|
int mq_getattr(mqd_t mqdes, FAR struct mq_attr *mq_stat);
|
2007-02-18 07:21:28 +08:00
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-11-17 00:36:30 +08:00
|
|
|
#endif /* __INCLUDE_MQUEUE_H */
|