net: socket: Workaround issue with recent GCC and fcntl macro
net: socket: Workaround issue with recent GCC and fcntl macro

If we have CONFIG_NET_SOCKETS_POSIX_NAMES enabled (which is now
default), and also have CONFIG_NEWLIB_LIBC enabled, latest versions
of GCC throw a strange error like:

error: conflicting types for 'zsock_fcntl'
  692 | #define fcntl zsock_fcntl

After enough consideration, it seems that when Newlib is used, its
fcntl.h header is used, which declares fcntl() with POSIX prototype:
"int fcntl(int fd, int cmd, ...)". It seems that recent GCC, when
seeing the #define like above, checks that its right-hand side
(zsock_fcntl(int, int, int) above) is compatible with an existing
LHS prototype. That doesn't make sense from the point of view of
the C preprocessor semantics, and yet that's what apparently happens.

Make GCC happy by defining an inline wrapper function with
signature compatible with POSIX fcntl prototype, and use it in
the define, instead of zsock_fcntl directly.

Signed-off-by: Paul Sokolovsky <35cb557f011771c94f127d6fef99f804b62203f5@linaro.org>

zephyrproject-rtos/zephyr,finikorg/zephyr,galak/zephyr,Vudentz/zephyr,Vudentz/zephyr,galak/zephyr,zephyrproject-rtos/zephyr,nashif/zephyr,finikorg/zephyr,nashif/zephyr,galak/zephyr,nashif/zephyr,Vudentz/zephyr,Vudentz/zephyr,galak/zephyr,zephyrproject-rtos/zephyr,finikorg/zephyr,nashif/zephyr,Vudentz/zephyr,finikorg/zephyr,finikorg/zephyr,galak/zephyr,nashif/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr