You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/10/25 03:19:41 UTC

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #4720: fs: mqueue: Allocate fullpath on the heap memory

patacongo commented on a change in pull request #4720:
URL: https://github.com/apache/incubator-nuttx/pull/4720#discussion_r735231880



##########
File path: fs/mqueue/mq_open.c
##########
@@ -165,7 +165,7 @@ static int file_mq_vopen(FAR struct file *mq, FAR const char *mq_name,
   FAR struct mqueue_inode_s *msgq;
   FAR struct mq_attr *attr = NULL;
   struct inode_search_s desc;
-  char fullpath[MAX_MQUEUE_PATH];

Review comment:
       In #4698
   
       #define MAX_MQUEUE_PATH (sizeof(CONFIG_FS_MQUEUE_MPATH) + NAME_MAX)
   
   First, the use of sizeof on an integer constant seems a little odd and probably not portable.
   
   Under GNU/Linux, I recall that NAME_MAX is 4Kb.  If someone needed GNU/Linux compatibility, then that would be quite large.
   
   > MAX_MQUEUE_PATH is just 64 bytes, is it good to allocate a small temp buffer every time?'
   
   The message queue implementation uses pre-allocated data as much as possible for performance reasons; messaging operations must be very fast.  But this stack allocation is in fs_vopen().  I would not think that an allocation while opening a named message queue would have any performance implication since that is a rare event.
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org