summaryrefslogtreecommitdiff
path: root/components/net/sal_socket
diff options
context:
space:
mode:
authorchenyong <[email protected]>2019-05-15 14:45:31 +0800
committerchenyong <[email protected]>2019-05-15 14:45:31 +0800
commit9abdebbec99dfb0500e4528f48c3cdd11e9625e9 (patch)
tree9bae0135ee9360811c60e11acc07bc591587e915 /components/net/sal_socket
parent0dae909f66d72323f031c4c14162f32723f3effe (diff)
[net][sal] Fix fcntl() function not support F_GETFL/F_SETFL operations for socketfd.
Signed-off-by: chenyong <[email protected]>
Diffstat (limited to 'components/net/sal_socket')
-rw-r--r--components/net/sal_socket/impl/af_inet_lwip.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/components/net/sal_socket/impl/af_inet_lwip.c b/components/net/sal_socket/impl/af_inet_lwip.c
index cb271a55e0..95e7633635 100644
--- a/components/net/sal_socket/impl/af_inet_lwip.c
+++ b/components/net/sal_socket/impl/af_inet_lwip.c
@@ -217,6 +217,19 @@ static int inet_getsockname(int socket, struct sockaddr *name, socklen_t *namele
return lwip_getsockname(socket, name, namelen);
}
+int inet_ioctlsocket(int socket, long cmd, void *arg)
+{
+ switch (cmd)
+ {
+ case F_GETFL:
+ case F_SETFL:
+ return lwip_fcntl(socket, cmd, (int) arg);
+
+ default:
+ return lwip_ioctl(socket, cmd, arg);
+ }
+}
+
#ifdef SAL_USING_POSIX
static int inet_poll(struct dfs_fd *file, struct rt_pollreq *req)
{
@@ -278,7 +291,7 @@ static const struct sal_socket_ops lwip_socket_ops =
lwip_shutdown,
lwip_getpeername,
inet_getsockname,
- lwip_ioctl,
+ inet_ioctlsocket,
#ifdef SAL_USING_POSIX
inet_poll,
#endif