Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm a newbie in Linux programming. I found that the way to view the list of system calls in Linux via command-line is:

man syscalls

But now I want to view the list of c library functions, how can I do that? Which command will help me list the c library functions? And another question, where are system calls and c library functions manual pages located? Thank you.

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

There is an offline documentation browser that I have found helpful called ( Zeal ) similar to Dash.

Other options:

whereis glibc

or

dpkg -L *libc*

And open the files in a text editor.

To recursively search inside files for string: grep -R "some string" /path/to/includes

Some paths to consider:

  • /usr/local/include
  • /usr/target/include
  • /usr/include

Other options may include:

share|improve this answer
add comment

There is a nice package to display C function header, named ref. To know more about it see man ref. It has a good database where you can find the list of C library functions.

The functions are listed in the file /usr/share/elvis/stubs/ansistub.c. You can directly look into it to see the functions, or you can filter them as you wish.

You can use the following big line in your terminal to see the full list at once,

cat /usr/share/elvis/stubs/ansistub.c | grep "^int\|^char\|^void\|^double\|^ldiv_t\|^unsigned\|^type\|^struct\|^FILE\|^size_t\|^time_t\|^long\|^clock\|^mbstowcs\|^div_t" | awk 'NR > 12' | less

You will get Output like

void abort(void)
int abs(int num)
double acos(double cosvalue)
char *asctime(const struct tm *currtime)
double asin(double sinvalue)
void assert(int expression)
int atexit(void(*func)(void))
long int atol(const char *string)

....

Or you can copy the list to a file myCfunction.list using,

cat /usr/share/elvis/stubs/ansistub.c | grep "^int\|^char\|^void\|^double\|^ldiv_t\|^unsigned\|^type\|^struct\|^FILE\|^size_t\|^time_t\|^long\|^clock\|^mbstowcs\|^div_t" | awk 'NR > 12' > myCfunction.list

To use it first install ref using the command below,

sudo apt-get install elvis-tools
share|improve this answer
add comment

Which command will help me list the c library functions?

Here is one way to list all functions defined in the standard C library (GNU libc):

nm -D /lib/$(uname -m)-linux-gnu/libc-*.so | grep -vw U | grep -v "_" | cut -d " " -f3

Note that the system calls will also be included as they are actually functions that wrap the real system calls.

Where are system calls and c library functions manual pages located?

System call manual pages are under:

/usr/share/man/man2

Library functions manual pages are under:

/usr/share/man/man3
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.