nishantv
nishantv

Reputation: 781

System Calls in Unix

I was reading about system calls and encountered system calls in the form open(2) , read(2),write(2) and others. I am trying to find whats 2 in the paranthesis. First I thought its the flag settings but its not the flags i found out. Please help me understand this. Please bear with me if the question is too silly.

Thanks

Upvotes: 0

Views: 264

Answers (3)

rob mayoff
rob mayoff

Reputation: 386018

The “2” refers to the section of the Unix manual. Section 2 is for system calls. Section 3 is for library calls. The distinction has become somewhat arbitrary for certain calls, which used to be system calls (essentially direct calls to the kernel) but are now (at least on some versions of Unix) library functions that do significant work before calling the kernel.

Check out the Wikipedia page about “man pages” for more.

Upvotes: 1

squiguy
squiguy

Reputation: 33380

I think that may just be referring to the section of the man pages it is in. Like man 2 read for example.

Upvotes: 1

Andreas Wong
Andreas Wong

Reputation: 60594

It indicates the section in the man page

http://en.wikipedia.org/wiki/Man_page#Manual_sections

As you can see there, 2 is listed as system calls, what you'd expect since open, read and write are pretty much system calls :)

This is useful, for example if you want to look for perl's open, you can do:

man open -S 3 # -S switch here is to specify which section in man page

Upvotes: 0

Related Questions