Skip to content

mqueue: add poll support - #2957

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
GUIDINGLI:mine
Mar 4, 2021
Merged

xiaoxiang781216 merged 1 commit into
apache:masterfrom
GUIDINGLI:mine

Conversation

@GUIDINGLI

Copy link
Copy Markdown
Contributor

Summary

mqueue: add poll support

Impact

mqeue, can support poll

Testing

Comment thread fs/mqueue/Kconfig Resolved
Change-Id: I7e908f6a6c00158c0946587dd79ae3dc5d279d37
Signed-off-by: ligd <[email protected]>

@davids5 davids5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GUIDINGLI - Nice Addition!

@davids5 davids5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xiaoxiang781216
xiaoxiang781216 merged commit 48d49e5 into apache:master Mar 4, 2021
GUIDINGLI pushed a commit that referenced this pull request Nov 27, 2026
In fs/mqueue/Kconfig, CONFIG_FS_MQUEUE_NPOLLWAITERS currently defaults
to 4, which was introduced when poll support was added in PR #2957.

Each POSIX message queue pre-allocates an array of poll descriptors
(FAR struct pollfd_s *fds[CONFIG_FS_MQUEUE_NPOLLWAITERS]) inside
struct mqueue_inode_s. When mq_open() creates a queue, this structure
is dynamically allocated from the heap. In typical embedded and RTOS
applications, a message queue has at most one reader and one writer
waiting concurrently on poll/select/epoll events.

This change sets the default of CONFIG_FS_MQUEUE_NPOLLWAITERS to 2,
aligning it with the rest of the IPC poll waiter configurations:
CONFIG_SERIAL_NPOLLWAITERS=2 (PR #22228), CONFIG_DEV_PIPE_NPOLLWAITERS=2
(PR #22348), CONFIG_EVENT_FD_NPOLLWAITERS=2, CONFIG_TIMER_FD_NPOLLWAITERS=2,
CONFIG_SIGNAL_FD_NPOLLWAITERS=2, and CONFIG_FS_NOTIFY_FD_POLLWAITERS=2.

This saves 8 bytes of heap memory per message queue on 32-bit targets
(16 bytes on 64-bit targets).

Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Swatantra Yadav <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants