+3  A: 

struct sockaddr is a "super-class" of the concrete protocol address structures like struct sockaddr_in, struct sockaddr_in6, and struct sockaddr_un, etc. The getnameinfo(3) dispatches to a specific execution path based of the address family (the sa_family member.)

As far as memory is concerned - the three members of struct sockaddr_in are overlaid with the struct sockaddr's sa_data member. Take a look at Chapter 3 of the UnP book.

Nikolai N Fetissov
And this is why you have to pass in the size of the address structure that you've given it.
Jonathan Leffler
@Jonathan: thanks, I was just thinking about adding that.
Nikolai N Fetissov