On Mon, Apr 01, 2013 at 22:54, James Turner wrote: > I've come across a piece of software that defines __POSIX_C_SOURCE which > causes __BSD_VISIBLE to bet set to 0. > > In sys/socket.h if __BSD_VISIBLE is 0 sys/_types.h is included instead > of sys/types.h. This is fine however in three cases we reference > u_int8_t (2) and u_int64_t (1) which requires sys/types.h. > > If we change these to __uint8_t and __uint64_t they work with either > types.h or _types.h. Does this make sense? Will there be any side > effects? >
I believe the correct type would be uint8_t or uint64_t. Those should be visible (I think). A quick look indicates that maybe they aren't, so that won't work. There won't be any side effects from using __uint64_t, but I think of it more like a building block for another type. Not to be used directly. I would like to believe that posix allows int64_t to be visible after including socket.h since they use it in their sample sockaddr_storage implementation, but the text doesn't seem to allow that. Maybe the __uint64_t type is the way to go.