atigyi / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
0 stars 0 forks source link

RFC: Switch to CONFIG_POSIX_API #11

Open pfalcon opened 4 years ago

pfalcon commented 4 years ago

This actually should be a part of https://github.com/atigyi/zephyr/issues/2, but I submit as a separate ticket to emphasize its importance and consequences.

So, Google IoT SDK is largely a POSIX library, calling into many standard POSIX APIs. With BOARD=native_posix, some share of these functions actually went to the host libc, i.e. Linux.

To support "real" Zephyr targets, we need to enable Zephyr's own POSIX subsystem, config option CONFIG_POSIX_API. Here's the catch however: CONFIG_POSIX_API isn't supported for native_posix. It's actually not hard to imagine why - emulating POSIX API on top of another POSIX API isn't exactly an easy task, it's very easy to get underlying POSIX API to leak into our implementation (that's similar what happens with Device SDK and native_posix). So, all in all, we aren't yet there in Zephyr (if ever).

So, switching to to CONFIG_POSIX_API would mean dropping support for native_posix. However, having 2 proj.conf's, and juggling included headers with #ifdef's based on options, it may be still possible to support native_posix vs real targets. I'm going to do that for as long as practical. Just a notice that if gets too cumbersome, that's it ;-).