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/02/09 12:05:31 UTC
[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new issue #2833: Refine the interaction between fs and net
xiaoxiang781216 opened a new issue #2833:
URL: https://github.com/apache/incubator-nuttx/issues/2833
fs layer has many places to check socket handler explicitly:
```
int nx_close(int fd)
{
/* Did we get a valid file descriptor? */
if (fd >= CONFIG_NFILE_DESCRIPTORS)
{
/* Close a socket descriptor */
#ifdef CONFIG_NET
if (fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
{
return net_close(fd);
}
else
#endif
{
return -EBADF;
}
}
/* Close the driver or mountpoint. NOTES: (1) there is no
* exclusion mechanism here, the driver or mountpoint must be
* able to handle concurrent operations internally, (2) The driver
* may have been opened numerous times (for different file
* descriptors) and must also handle being closed numerous times.
* (3) for the case of the mountpoint, we depend on the close
* methods bing identical in signature and position in the operations
* vtable.
*/
return files_close(fd);
}
```
It's better to use the same approach we have done for the named semphare, mqueue or eventfd:
https://github.com/apache/incubator-nuttx/tree/master/fs/mqueue
https://github.com/apache/incubator-nuttx/tree/master/fs/semaphore
https://github.com/apache/incubator-nuttx/blob/master/fs/vfs/fs_eventfd.c
so we can:
1. unify socket access api
2. avoid the code duplication
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on issue #2833: Refine the interaction between fs and net
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on issue #2833:
URL: https://github.com/apache/incubator-nuttx/issues/2833#issuecomment-779818934
The more detail design can found here: https://github.com/apache/incubator-nuttx/issues/2834
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 closed issue #2833: Refine the interaction between fs and net
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 closed issue #2833:
URL: https://github.com/apache/incubator-nuttx/issues/2833
----------------------------------------------------------------
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:
users@infra.apache.org