Move BSD stuff together in <sys/endian.h>.

Change-Id: I8bb511840f3cd98d5008034e405d82e923bd3203
Merge "Move BSD stuff together in <sys/endian.h>."
Fix ptsname(3) and ttyname(3) to use TLS.

Be safe by default.

Change-Id: I6c4a3f1fd4eee3a651b3162ce95b7e873de57521
Merge "Fix ptsname(3) and ttyname(3) to use TLS."