jlaitine commented on code in PR #8026: URL: https://github.com/apache/nuttx/pull/8026#discussion_r1065406297
########## fs/mmap/fs_munmap.c: ########## @@ -158,7 +159,40 @@ static int file_munmap_(FAR void *start, size_t length, bool kernel) nxmutex_unlock(&g_rammaps.lock); return ret; #else - return OK; + + FAR struct tcb_s *tcb = nxsched_self(); + FAR struct task_group_s *group = tcb->group; + FAR struct mm_map_entry_s *entry = NULL; + int ret = OK; + + /* Iterate through all the mappings and call the underlying + * unmap for every mapping where "start" lies + * break loop on any errors. + * + * Get exclusive access to mm_map for this + */ + + ret = mm_map_lock(); + if (ret == OK) Review Comment: No, I want to unlock() only if it is locked, the if guards that ########## fs/mmap/fs_munmap.c: ########## @@ -158,7 +159,40 @@ static int file_munmap_(FAR void *start, size_t length, bool kernel) nxmutex_unlock(&g_rammaps.lock); return ret; #else - return OK; + + FAR struct tcb_s *tcb = nxsched_self(); + FAR struct task_group_s *group = tcb->group; + FAR struct mm_map_entry_s *entry = NULL; + int ret = OK; + + /* Iterate through all the mappings and call the underlying + * unmap for every mapping where "start" lies + * break loop on any errors. + * + * Get exclusive access to mm_map for this + */ + + ret = mm_map_lock(); + if (ret == OK) + { + while (ret == OK && (entry = mm_map_find(start, length))) + { + if (entry->munmap) Review Comment: sure, done -- 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-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org