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



##########
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:
       `fs_getfilep` either returns **-EBADF** or **-EAGAIN**.
   According to the `mmap` specification, although EAGAIN is a possible return 
value, it is useful for indicating that a file is currently locked and the API 
user should try `mmap` again later:
   
   ```
          EAGAIN The file has been locked, or too much memory has been
                 locked (see setrlimit(2)).
   ```
   
   But, `fs_getfilep` returns **-EAGAIN** for a unrecoverable error scenario:
   
   
![image](https://user-images.githubusercontent.com/38959758/111299708-07f4ca00-862f-11eb-8765-3fe71e92c48d.png)
   
   So, I think it does not make sense to simply make `mmap` propagate the error 
from `fs_getfilep`. Instead, I chose to handle the error and raise a new one 
that fits to `mmap` API. After all, for the `mmap` API consumer, 




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