10

I started to learn socket programming for C / C++ and examining the man pages for functions like bind, listen etc.

While I was navigating between man pages, I noticed there are situations that there are multiple man pages for the same system call, e.g. socket()

http://man7.org/linux/man-pages/man2/socket.2.html

http://man7.org/linux/man-pages/man3/socket.3p.html

http://man7.org/linux/man-pages/man7/socket.7.html

Among these manuals, what comes up at my linux box is the first one (socket(2)).

I noticed that one with the 3p suffix is titled "POSIX programmer's manual" and rest two are titled "Linux programmer's manual". Function prototypes and usages are the same (as far as I understood).

My question is: What is the purpose of two different versions of Linux Programmer's Manuals for the same system call, and what does the number between the paranthesis means (socket(2), socket(3p), socket(7))?

SercioSoydanov
  • 980
  • 10
  • 29

1 Answers1

14

Man pages are organized in sections, each section have its own topic. Check out the manpage for man, try run man man, it lists all the sections available:

  1. Executable programs or shell commands
  2. System calls (functions provided by the kernel)
  3. Library calls (functions within program libraries)
  4. Special files (usually found in /dev)
  5. File formats and conventions eg /etc/passwd
  6. Games
  7. Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
  8. System administration commands (usually only for root)
  9. Kernel routines [Non standard]

For the socket example, "socket(2)" is the system call provided by the operating system kernel, "socket(3)" is the POSIX interface provided by the library, "socket(7)" is a general documents on the topic of socket. You can see that all three have different content.

fluter
  • 13,238
  • 8
  • 62
  • 100