fs/vfs and net/udp: Repartition logic of commit 0c963449d6, moving into net/udp. Add support to handle connected UDP sockets. The correct 'optimal blksize' to return is the MSS. The MTU is always too big.

This commit is contained in:
Gregory Nutt
2018-04-27 08:36:25 -06:00
parent c881ea6d5b
commit f5d0fc7447
5 changed files with 227 additions and 22 deletions
+7 -17
View File
@@ -84,28 +84,18 @@ int fstat(int fd, FAR struct stat *buf)
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS)
{
#if defined(CONFIG_NET_TCP) && CONFIG_NSOCKET_DESCRIPTORS > 0
if (sockfd_socket(fd) == NULL)
#if CONFIG_NSOCKET_DESCRIPTORS > 0
/* Let the networking logic handle the fstat() */
ret = net_fstat(fd, buf);
if (ret < 0)
{
ret = -EBADF;
goto errout;
}
else
{
memset(buf, 0, sizeof(struct stat));
buf->st_mode = S_IFSOCK;
#ifdef CONFIG_NET_ETHERNET
/* REVISIT: Ideally, we would get the MTU from the device that
* serves the connection (assuming the socket is connected).
*/
buf->st_blksize = CONFIG_NET_ETH_MTU;
#endif
return OK;
}
return OK;
#else
/* No networking... it is a bad descriptor in any event */
/* No networking... it is just a bad descriptor */
ret = -EBADF;
goto errout;