4 ms·
I've been meaning to ask this for a very long time: What does the (2) mean? I see (n) in lots of descriptions of calls, but I've never found out what it means.
by ramidarigaz 16y ago
I've been meaning to ask this for a very long time: What does the (2) mean? I see (n) in lots of descriptions of calls, but I've never found out what it means.
- eru 16y agoIt refers to sections of the man pages. They are organized like this: 1. General Commands 2. System Calls 3. Subroutines 4. Special Files 5. File Formats 6. Games 7. Macros and Conventions 8. Maintenence Commands
- ramidarigaz 16y agoExactly what I wanted to know. Thanks.
- cycojesus 16y agoand it's used like this: man 2 write
- gxti 16y agoIt's the "man" section. According to "man man", 2 is the section for system calls. Often you'll have manpages for the same name under different sections, for example sync(1) is a command while sync(2) a system call (which, unsurprisingly, the sync command uses).
- jbarham 16y agoThe Unix manual is divided into sections (http://en.wikipedia.org/wiki/Man_page#Manual_sections http://en.wikipedia.org/wiki/Man_page#Manual_sections). Section 2 is for system calls. Specifying the section number allows you to disambiguate which section of the manual you want to look in if a man page exists in multiple sections (e.g., "man 1 write" vs. "man 2 write").
- bretthoerner 16y agoIt's the man page section number. I believe this dates back to when the man(uals) were actually printed out. You'd go to section 2 to find X to disambiguate from a different Y. http://www.december.com/unix/ref/mansec.html http://www.december.com/unix/ref/mansec.html
- eru 16y agoAnd the disambiguation is still useful.
- stonemetal 16y agoIt is where it lives in man. man write returns write(1) an application that sends a message to another user. man 2 write returns write(2) the system call mentioned above(or at least it does on Ubuntu).
- deleted 16y ago[deleted]
- deleted 16y ago[deleted]
- tptacek 16y agoYou got a lot of good answers here, but just so you know: you really only have to remember that open(2) is a syscall and fopen(3) is a library call. That's the important distinction.