4

I have an assignment where I need to use some system calls in UNIX, like mktime() and fnmatch(), to complete some operations. We're given only the names of the man pages to look up to find the functions.

Now, this is fine for the purpose of the assignment. But in the future when I do UNIX programming, I may not know the exact name (I never would have known fnmatch exists without knowing its name first).

So the question is: how can I get a comprehensive list of ALL UNIX system functions? I really don't care if it's categorized or sorted (though it would be nice), but I'd like to have the list include the descriptions so it's searchable. That way when I need a function, I can do a few searches to locate potential candidates, then I can man them to find the exact usage.

jstm88
  • 3,335
  • 4
  • 38
  • 55
  • 5
    If you are serious about this, buy `Advanced Programming In a Unix Environment, Second Edition` ... that is when the lights came on for me regarding low level network and IPC programming. I cannot speak highly enough about this book, it is by far, the best technical book I have ever read (on any subject). – gahooa Jan 21 '11 at 16:07
  • Note that mktime and fnmatch are not system calls. They are library functions. Unix terminology makes a difference between these two types of calls. They look similar to the C programmer, but there is a difference in how they are handled by the system, and in which section of the manual you find them. – Thomas Padron-McCarthy Jan 22 '11 at 09:39
  • Thanks Thomas, I kind of meant to imply that (I'm targeting both system calls and library functions). – jstm88 Jan 24 '11 at 02:29

3 Answers3

5

There's also a useful utility called "apropos"

$ whatis apropos
apropos (1)          - search the manual page names and descriptions


$ apropos filename
...
fnmatch (3)          - match filename or pathname
...
vmpstr
  • 5,051
  • 2
  • 25
  • 25
  • Okay, I've decided to use apropos and possibly build a GUI around it since its output is... messy at best. I'm wondering though, are there any options to apropos? I don't see any in the manpage for it and if I use 'apropos -r' I get an 'unknown option'. I'm specifically looking for a way to do and rather than or searches, i.e. 'apropos filename match' gives more results than 'apropos filename' - I'd like to have 'apropos filename match' only give results that have to do with _both_ 'filename' and 'match' – jstm88 Jan 24 '11 at 02:32
  • There should be a man page for apropos as well. On my system, the "-a" flag is what you are looking for. "apropos -a filename match" returns only items that match both. If you are looking for more advanced uses, the you can take a look into regular expressions, since apropos also accepts that. – vmpstr Jan 24 '11 at 04:03
4

System calls are documented in section 2 of the man documentation. Depending on your version of Unix, you should be able to find these pages in the man data directory.

On Linux, this directory is /usr/share/man/man2; your version of Unix may differ. Also man man should tell you what is in the other sections.

Kevin Lacquement
  • 5,057
  • 3
  • 25
  • 30
  • 2
    It is a correct answer, nevertheless be warned than system calls could be different for each different UNIX system... – Doomsday Jan 21 '11 at 16:17
  • Thanks, I'm aware of that. I'm primarily working on Mac OS X and a few variants of Linux. So far I haven't found any issues but I'm certainly on the lookout for them. – jstm88 Jan 21 '11 at 16:43
1

I used to keep a printed copy of part of "The Authorized Guide to Version 3 of the Single UNIX Specification" lying around - the table shows availability of calls in a variety of different standards, which was extremely useful for supporting multiple targets.

Flexo
  • 87,323
  • 22
  • 191
  • 272