Cleanup Darwin and FreeBSD compatibility code

get_peercred used duplicate code because different names were used for
the platform dependent constants. The constants were also using hard
coded values instead of values from the socket module when possible.

The platform is detected now using sys.platform, which is compile time
setting, and is easier to predict looking at Lib/plat-xxx directories in
the cpython source.

We use now the same names for both constants, and the value defined in
the socket module if the name is defined, or the hardcoded value. The
new private constants are moved near the function using them.