diff --git a/include/nuttx/mqueue.h b/include/nuttx/mqueue.h index 7ffe2d8d38..bcd50935df 100644 --- a/include/nuttx/mqueue.h +++ b/include/nuttx/mqueue.h @@ -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]; }; diff --git a/sched/Kconfig b/sched/Kconfig index 5ce00f849d..f0b3fecd81 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -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 diff --git a/sched/mqueue/mq_msgqalloc.c b/sched/mqueue/mq_msgqalloc.c index fffc153d26..69372d1802 100644 --- a/sched/mqueue/mq_msgqalloc.c +++ b/sched/mqueue/mq_msgqalloc.c @@ -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 { diff --git a/sched/mqueue/mq_notify.c b/sched/mqueue/mq_notify.c index 378dbfd81b..ab5aa484fe 100644 --- a/sched/mqueue/mq_notify.c +++ b/sched/mqueue/mq_notify.c @@ -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 } diff --git a/sched/mqueue/mq_sndinternal.c b/sched/mqueue/mq_sndinternal.c index f71c7bd077..6ae163db9f 100644 --- a/sched/mqueue/mq_sndinternal.c +++ b/sched/mqueue/mq_sndinternal.c @@ -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. */