sched/mqueue: configurable mqueue notification

Add a configuration to disable the mqueue notification mechanism

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-06-09 15:19:01 +08:00 committed by Xiang Xiao
parent 59da1bc86a
commit 8da798926d
5 changed files with 17 additions and 0 deletions

View File

@ -97,9 +97,11 @@ struct mqueue_inode_s
#else
uint16_t maxmsgsize; /* Max size of message in message queue */
#endif
#ifndef CONFIG_DISABLE_MQUEUE_NOTIFICATION
pid_t ntpid; /* Notification: Receiving Task's PID */
struct sigevent ntevent; /* Notification description */
struct sigwork_s ntwork; /* Notification work */
#endif
FAR struct pollfd *fds[CONFIG_FS_MQUEUE_NPOLLWAITERS];
};

View File

@ -1585,6 +1585,12 @@ config MQ_MAXMSGSIZE
Message structures are allocated with a fixed payload size given by this
setting (does not include other message structure overhead.
config DISABLE_MQUEUE_NOTIFICATION
bool "Disable POSIX message queue notification"
default DEFAULT_SMALL
---help---
Disable POSIX message queue notification
endmenu # POSIX Message Queue Options
config MODULE

View File

@ -98,7 +98,9 @@ int nxmq_alloc_msgq(FAR struct mq_attr *attr,
msgq->maxmsgsize = MQ_MAX_BYTES;
}
#ifndef CONFIG_DISABLE_MQUEUE_NOTIFICATION
msgq->ntpid = INVALID_PROCESS_ID;
#endif
}
else
{

View File

@ -94,6 +94,7 @@
int mq_notify(mqd_t mqdes, FAR const struct sigevent *notification)
{
#ifndef CONFIG_DISABLE_MQUEUE_NOTIFICATION
FAR struct mqueue_inode_s *msgq;
FAR struct inode *inode;
FAR struct file *filep;
@ -189,4 +190,8 @@ errout:
errout_without_lock:
set_errno(errval);
return ERROR;
#else
set_errno(ENOSYS);
return ERROR;
#endif
}

View File

@ -373,6 +373,7 @@ int nxmq_do_send(FAR struct mqueue_inode_s *msgq,
* message queue
*/
#ifndef CONFIG_DISABLE_MQUEUE_NOTIFICATION
if (msgq->ntpid != INVALID_PROCESS_ID)
{
struct sigevent event;
@ -393,6 +394,7 @@ int nxmq_do_send(FAR struct mqueue_inode_s *msgq,
DEBUGVERIFY(nxsig_notification(pid, &event,
SI_MESGQ, &msgq->ntwork));
}
#endif
/* Check if any tasks are waiting for the MQ not empty event. */