Ubuntu – Finding a C struct or header in man pages

ccommand linemanpage

When programming in C, I like to use man sections 2 and 3 to look up the form of system and library calls.

But I also often need to look up the form of a struct that is defined in a standard library. For example, sockaddr/sockaddr_un in 'sys/socket.h'. Is there any way I can look up structs or header files through man pages?

Best Answer

To find these, it's helpful to use, for example, apropos socket to see which man pages may correspond to the information you desire. In this case, it's man 7 unix:

#define UNIX_PATH_MAX    108
struct sockaddr_un {
    sa_family_t sun_family;               /* AF_UNIX */
    char        sun_path[UNIX_PATH_MAX];  /* pathname */
};

Is this what you were looking for?