lib: os: Add refcounting to fdtable entries
lib: os: Add refcounting to fdtable entries

Use proper refcounting instead of magic value in obj field
when checking whether the fd is still in use. This will make
sure that if fd is shared between two threads, we do not
release it too soon.

Signed-off-by: Jukka Rissanen <f9f077d1da4c7aa947f9864fa5a28c3588f6a45d@linux.intel.com>

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