net: sockets: move fcntl back to socket_offload.c
We are reverting the changes in commit
55b3f05932
given build errors are seen
when fcntl.h is included, as it declares fcntl() as a non-static
function. The same function cannot be declared as both static and
non-static.
Instead, we avoid redefining fcntl() in lib/os/fdtable.c specifically
for case of the SimpleLink family, til we have support for the new
socket_op_vtable.
Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
This commit is contained in:
parent
1a98d4d1fe
commit
3609e261bb
|
@ -158,20 +158,7 @@ static inline void freeaddrinfo(struct addrinfo *res)
|
|||
return socket_ops->freeaddrinfo(res);
|
||||
}
|
||||
|
||||
static inline int fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
__ASSERT_NO_MSG(socket_ops);
|
||||
__ASSERT_NO_MSG(socket_ops->fcntl);
|
||||
|
||||
va_list args;
|
||||
int res;
|
||||
|
||||
va_start(args, cmd);
|
||||
res = socket_ops->fcntl(fd, cmd, args);
|
||||
va_end(args);
|
||||
|
||||
return res;
|
||||
}
|
||||
int fcntl(int fd, int cmd, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -227,6 +227,12 @@ int ioctl(int fd, unsigned long request, ...)
|
|||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* In the SimpleLink case, we have yet to add support for the fdtable
|
||||
* feature. The socket offload subsys has already defined fcntl, hence we
|
||||
* avoid redefining fcntl here.
|
||||
*/
|
||||
#ifndef CONFIG_SOC_FAMILY_TISIMPLELINK
|
||||
int fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
@ -251,6 +257,7 @@ int fcntl(int fd, int cmd, ...)
|
|||
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* fd operations for stdio/stdout/stderr
|
||||
|
|
|
@ -20,3 +20,19 @@ void socket_offload_register(const struct socket_offload *ops)
|
|||
socket_ops = ops;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SOC_FAMILY_TISIMPLELINK
|
||||
int fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
__ASSERT_NO_MSG(socket_ops);
|
||||
__ASSERT_NO_MSG(socket_ops->fcntl);
|
||||
|
||||
va_list args;
|
||||
int res;
|
||||
|
||||
va_start(args, cmd);
|
||||
res = socket_ops->fcntl(fd, cmd, args);
|
||||
va_end(args);
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue