named-data-iot / ndn-iot-package-over-posix

NDN IoT Package over POSIX with CMake
7 stars 9 forks source link

POSIX compatibility #5

Open Pesa opened 5 years ago

Pesa commented 5 years ago

This package is targeted at "POSIX compatible OS". However, looking at the code, I noticed several incompatibilities with POSIX. These are a couple of examples I saw so far, but I only took a quick look and there may be others:

https://github.com/named-data-iot/ndn-iot-package-over-posix/blob/4b31168c50f67f66243baec7eaf1fb1833744a0b/adaptation/udp/udp-face.c#L203-L204

MSG_DONTWAIT is not specified by POSIX.

https://github.com/named-data-iot/ndn-iot-package-over-posix/blob/4b31168c50f67f66243baec7eaf1fb1833744a0b/adaptation/udp/udp-face.c#L208

POSIX.1-2001 allows either EAGAIN or EWOULDBLOCK to be returned for this case, and does not guarantee that these constants have the same value, so a portable application should check for both.

https://github.com/named-data-iot/ndn-iot-package-over-posix/blob/4b31168c50f67f66243baec7eaf1fb1833744a0b/adaptation/udp/udp-face.c#L58

FIONBIO is non-standard. You should use fcntl(...O_NONBLOCK...) instead.

zjkmxy commented 5 years ago

Fixed. Thank you for your comments!

Pesa commented 5 years ago

Well... there are several more instances of these or similar problems still present in the codebase... how do you plan to address them? The 3 cases I reported above were just a few examples I noticed from a quick look.

zjkmxy commented 5 years ago

We are planning to review our design recently. I will figure it out then.

Pesa commented 4 years ago

Any updates?

zjkmxy commented 4 years ago

No. Till now we haven't figured out what else is not compatible to POSIX.

yoursunny commented 4 years ago

Is there a linter that automatically find non POSIX complaint function calls?