gustavonihei commented on a change in pull request #3070:
URL: https://github.com/apache/incubator-nuttx/pull/3070#discussion_r595389644



##########
File path: fs/mmap/fs_mmap.c
##########
@@ -142,6 +148,30 @@ FAR void *mmap(FAR void *start, size_t length, int prot, 
int flags,
     }
 #endif
 
+  if (fs_getfilep(fd, &filep) < 0)

Review comment:
       > but caller should expect that the implementation may return the 
additional errno which not specify in the spec.
   
   I agree as long as it is compatible with the "Returned values" in the 
documentation, which was not the case for the EAGAIN returned from the 
`fs_getfilep`.
   
   > it depends on the error category. If it's programming error, we can assert 
it for debugging purpose. But assert is an abuse for the runtime error and make 
the thing more worse.
   
   Good, we also agree on this, and that was my motivation for using 
DEBUGASSERT. Receiving **-EAGAIN** from `fs_getfilep` at `mmap` would be due to 
a programming error.
   
   If the `mmap` caller were to read **EAGAIN** from errno, the natural 
handling would be to perform a new `mmap` attempt at a later moment. But, 
according to the description at `fs_getfilep`, it would never have a different 
outcome, because it is not a runtime error.




----------------------------------------------------------------
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.

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


Reply via email to