Portability research

From K5Wiki
Revision as of 16:42, 7 May 2012 by TomYu (talk | contribs)

Jump to: navigation, search

This page collects some research we have done into the portability of various platform features. See Portability assumptions for the assumptions we make about target platforms based on this and other knowledge.

C99 Compiler Support

Full C99 support is common in modern Unix compilers, but is not present in Microsoft Visual C (see this blog post). Some C99 features are supported in MSVC; here is a partial list of supported and unsupported features based on experimenting with version 7.1 of the SDK:

  • The // comment syntax is supported.
  • Variadic macros are supported.
  • The "long long int" type is supported.
  • inline functions are supported, but the keyword is __inline.
  • MSVC defines __FUNCTION__ instead of C99's __func__.
  • va_copy is not supported, but va_list positions can be copied by assignment.
  • Mixed declarations and code (declarations after statements) is not supported.
  • Named structure initializers are not supported.
  • Variable length arrays are not supported.
  • stdbool.h is not supported.

IPv4 and IPv6 pktinfo support

The basic BSD sockets API does not allow discovery of the interface address on which data was received, or control over the interface address used to send data. This makes it difficult to implement a UDP server which cooperates with NATs. Where available, we use an extension which allows this discovery and control. This extension was originally defined in RFC 2292 for the IPv6 socket API, and was revised in RFC 3542. Some platforms provide analagous support for IPv4.

The following table was collected in a platform survey to determine the prevalence of pktinfo support:

Platform RFC 2292 (IPV6_PKTINFO) RFC 3542 (IPV6_RECVPKTINFO) IPv4 pktinfo
Linux 2.6.32 yes yes yes
Solaris 10 yes yes no
Solaris 11 yes yes yes
FreeBSD 8.1-1 yes yes no
Hurd-0.3 yes no no
OSX (unknown version) yes no no
AIX 6.1 yes yes no
HP-UX B.11.11 yes yes no

Leap second handling