include: net: Move fcntl implementation into socket_offload.h

This is done to conform with how the rest of the socket APIs are
implemented during socket offload. Otherwise link error would
result due to the symbol being redefined in lib/os/fdtable.c.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
This commit is contained in:
Vincent Wan 2019-02-15 11:34:39 -08:00 committed by Anas Nashif
parent e0b369a63c
commit 55b3f05932
2 changed files with 14 additions and 15 deletions

View file

@ -158,7 +158,20 @@ static inline void freeaddrinfo(struct addrinfo *res)
return socket_ops->freeaddrinfo(res);
}
int fcntl(int fd, int cmd, ...);
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;
}
#ifdef __cplusplus
}

View file

@ -20,17 +20,3 @@ void socket_offload_register(const struct socket_offload *ops)
socket_ops = ops;
}
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;
}