C find out list of C functions supported in FreeBSD

is there a page or way to list out all the C functions (supported in FreeBSD) that are available?

that are classified based on graphics, file i/o, system calls, networking; etc.

for example, if i want to code in networking part, i may not know that some functions are available, but going through a list like this, i shall know the available possibilites, i can use the relevant functions and libraries then.

man pages, gives you the help if you know the function name.

Turbo C used to have such a list.
 
Although this is from an adversary project, I found the documentation of "The GNU C Library“ very useful. The FreeBSD C library and the GNU C library are both based on Standard C, and most stuff should simply work. In addition, the documentation of the GNU C Library gives hints on differences between BSD and the other system.
The GNU C Library is designed to be a backwards compatible, portable, and high performance ISO C library. It aims to follow all relevant standards including ISO C11, POSIX.1-2008, and IEEE 754-2008.

The project was started circa 1988 and is more than 30 years old.
For example, there is a chapter about BSD terminal modes. The whole manual references BSD 676 times. I guess this might be more, than in any C Library book which you can buy.

 
The K&R The C Programming Language also has a good overview of these kinds of functions in Appendix B -Standard Library

PDF | Physical

Most parts are covered though keep in mind that unlike MS-DOS and Turbo C where you had Borland's classic BGI for graphics, you don't quite have the same in UNIX. You can output graphics to a framebuffer using KMS/DRM code directly but it is fairly complex and worse of all, not portable to different machines.

Also for networking you will want to look into POSIX / BSD sockets. This is not in the C standard library.
 
is there a page or way to list out all the C functions (supported in FreeBSD) that are available?

that are classified based on graphics, file i/o, system calls, networking; etc.

for example, if i want to code in networking part, i may not know that some functions are available, but going through a list like this, i shall know the available possibilites, i can use the relevant functions and libraries then.

man pages, gives you the help if you know the function name.

Turbo C used to have such a list.
It may help to realize that 'Turbo C' is an IDE from Borland, not a language. A company named Borland bundled a C compiler for Intel processors with their IDE. On FreeBSD, you program in straight C using a text editor that understands ASCII text. You compile it with lang/gcc or devel/llvm. To write a C program that does something on the network, you do need to understand sockets. To write a C program that uses OpenGL - just install graphics/freeglut first, then include the OpenGL C API like this: include gl/glut.h.
 
OpenGL is a little different to the Borland Turbo C's direct framebuffer. For one you will need a windowing platform like X11/glx, FreeGLUT, etc.

The closest to the OP's graphics experience will probably be to mmap some /dev/fb0 (which FreeBSD doesn't have) and writing to that memory directly. We used to have vgl but it was rarely used. I have revived some parts using the KMS layer but it only works on Intel and AMD GPUs (only those seem to have functioning modesetting).
 
is there a page or way to list out all the C functions (supported in FreeBSD) that are available? that are classified based on graphics, file i/o, system calls, networking; etc. for example, if i want to code in networking part, i may not know that some functions are available, but going through a list like this, i shall know the available possibilites, i can use the relevant functions and libraries then. man pages, gives you the help if you know the function name. Turbo C used to have such a list.

In its most basic form you can look in the directories of /usr/share/man/man2 and man3 respectively.
The problem with categorising man pages into something like networking is that to a unix-like system, all things are files and thus you use the same system call of write(2) for example to write to a file, device, socket.
 
DOS/NT Kingdom
I. Philippe Kahn made Bill Gate crazy. Turbo C (~ 40 USD) vs. MS (~ 400 USD).
II. In Windows we didn't have src/, only Win32 API. That's all.
III. We had to wait till someone like Peter Norton or Mark Russinovich show us more!
IV. There was also system-specific stuff, e.g. dos.h, conio.h, windows.h, etc.
V. And C++ classes wrapper around Win32 APIs made things worse.
VI. But, UNIX has src/

UNIX/BSD Empire
I. Pick a random c(7) file in the src/
II. Follow up its headers at sys/sys/ and include/
III. Many functions, constant and blocks of code in the translation unit have comments. Some are obvious from its context.
IV. Back and forth between .c (s) and .h (s)
V. Learn more at man(3) <-->>man(2) <-->>man(9)
VI. It's not just ANSI C, there's POSIX headers too. The best next step to learn about ANSI C, POSIX, XSI, SUS and their interfaces, headers, etc:
Stevens' Advanced Programming in the Unix Environment book.
 
Borland C or Turbo C is an IDE. correct.

my question is about finding specific libraries for specific problems.

say for example, what is the function that is available to get information like uname -a. I have to go through the web. in this case, luckily though there is a function name with same like uname (man 3 uname). however, next time my requirement could be different. find out md5 of a file, i don't know how to find out. because it's not md5file but MD5file. so if there is a list, i can go through it and find out supported crypto functionalities.

the turboc kind of list, gave an idea about the different libraries that are available in.

the equivalent i got from covacat answer.

I would like to go through list of C functions and learn the available and supported interfaces. The basic operations like, integer, string, memory allocation and others I am aware of.
 
At the level you're looking for, there is no single reference document. That's because the universe of available functions is way too large for a single manual.

You have to think in layers here. At the bottom layer, there is the basic ANSI C definition, which already gives you a big set of functions, like printf, getc and malloc. Documentation for that is in the ANSI C standard, which you can download from something, or you can read a (very old but still mostly correct) version in K&R's book. The next layer up is the basic Unix interfaces, like open, chmod, umask, signal. For those I don't know any concise documentation, but the POSIX standards exist and are really detailed. There used to be a good book by O'Reilly explaining those interfaces - just found it: POSIX Programmer's Guide, by Donald Lewing.

But that's still just the surface. Any modern OS has way more interfaces that ship as part of the standard. For example, you can program in C++ (huge and super useful standard library, there are many books about it). You can do threads, locking, asynchronous IO. My favorite book on that topic is again from O'Reilly: Programming for the real world, by Bill Gallmeister (I know him personally, his kid and my kid were in high school band at the same time). Then there is character-based graphics: Use ncurses, there are books. How about pixel graphics and windowing? The 10- or 11-volume set about XWindows used to be on every bookshelf about 30 years ago, and the interfaces documented in there are still current (but still very hard to use).

For the other stuff that's shipped with the base OS, it gets really hard to have a single source of documentation. As an example, on my FreeBSD system, there are 170 libraries in /usr/lib (ones that are significantly different, not just .so versus .a). About a dozen are the standard C library and POSIX libraries, the rest are all other stuff. For example, libz is for gzip-style compression, libusb and libbluetooth are obvious, and I have no idea what is in libcrypto.

But that's just the beginning. You can install zillions of packages that give you lots of other libraries. On my server at home (which is NOT a development machine), I have another 136 distinct libraries installed in /usr/local/lib.

As to your md5 question: If you don't want to reinvent the wheel, just look in the source code of the md5 command to see how they do it. For one of my personal projects, I needed to calculate SHA512 efficiently, and I ended up locating the source code for the md5 utility (which does this), and cut and pasted the routine into my code after some interface modifications. This is a general pattern: Search the source code.
 
Borland C or Turbo C is an IDE. correct.

my question is about finding specific libraries for specific problems.

say for example, what is the function that is available to get information like uname -a.
If you want something like that, you use something like this:
C:
 #include <stdlib.h>

   int system(const char *command);

Most good books on C would have a section devoted to syscalls. Read the table of contents, there's a reason that syscalls don't come up until fairly late in the book.
 
Borland C or Turbo C is an IDE. correct.

my question is about finding specific libraries for specific problems.

say for example, what is the function that is available to get information like uname -a. I have to go through the web. in this case, luckily though there is a
You would use the function uname(3), however, with caveats.
In FreeBSD a user can override the values with UNAME_xxxx environment variables. Yes, I know, weird hey?
So, to circumvent that you could use sysctl(3) and pass it various MIBs like KERN_OSTYPE etc.

It's nice to have choices. ;)

PS. I remember Borland's C IDE, it was very nice for its time. I also remember the documentation and the book called the "Reference Guide" which listed ALL the C functions available to it. I presume this is what you're looking for (well in similar form but for FreeBSD)?
 
You would use the function uname(3), however, with caveats.
In FreeBSD a user can override the values with UNAME_xxxx environment variables. Yes, I know, weird hey?
So, to circumvent that you could use sysctl(3) and pass it various MIBs like KERN_OSTYPE etc.

It's nice to have choices. ;)

PS. I remember Borland's C IDE, it was very nice for its time. I also remember the documentation and the book called the "Reference Guide" which listed ALL the C functions available to it. I presume this is what you're looking for (well in similar form but for FreeBSD)?
There's a reason that Computer Science is a formal academic subject and universities award degrees based at least in part on competence and grasp of the subject matter. Some smart people did figure out what needs to be learned first, second, what is an absolute pre-requisiste to what, and how much time it's reasonable to dedicate to that. Those classes have grading systems, professors have surprisingly interesting connections, side stories, and you can be the goat for asking someone on % /bin/talk tty4 another_user "Hi, how's it going" and discover you made a mess of a National Science Foundation IRC conference, where your message flashes on a huge screen and is seen by an auditorium full of big cheeses!

Back to the subject: UNIX approach to C programming is VERY different from Windows approach.
But generally, within C code you can include system.h for syscall API, or gl.h for some of OpenGL API. None of that would make sense if you can't think things through. syscalls (via the system.h) are perfectly usable for stuff like calling # /usr/local/bin/nc --args and do nearly anything you want on the network. Netcat is for crafting network packets, and it will be available just via system.h and realizing what's next. However, you don't get to learn about the power of netcat until you take a class on networking.

Or, you can include gl.h, glut.h, and glu.h, and use just that to draw fractals or buttons on the screen. Bottom line, OP should go read a good C book, get a helloworld program (written in C) running in bash, zsh, ksh, csh, or even plain sh, and don't worry about 'specific libs for specific problems' just yet.
 
PS. I remember Borland's C IDE, it was very nice for its time.
Apparently India's educational system still dictate that students learn specifically Borland Turbo C++ as a standard. Even today on a number of C/C++ programming forums you get random questions about Borland's ancient graphics APIs. They literally run it in QEMU or DOSBox. The C++ is fairly non-standard and dated but as for C, I think it is a really good way to learn. Visual Studio breeds "consumer" developers that don't want to get their hands dirty with anything technical.

Offtopic: I don't suppose you remember this: http://www.rhide.com/
It was a clone of Borland's (Turbo and 3.x) IDE to run with DJGPP (GCC for DOS). I was a massive fan of it before I moved to Watcom Vi. Apparently it has Linux / Cygwin ports so perhaps a FreeBSD one isn't impossible :)
Or, you can include gl.h, glut.h, and glu.h
Absolutely newer than the Borland stuff but gl.h, glu.h (and depending on who you ask) glut.h are all deprecated.
These days for the extensions and thus current vendor implementations of OpenGL, you want to be using glew.h and a decent maths library in place of glu.h.

I like glut.h though. It is very portable and can be written in an evening.
 
Apparently India's educational system still dictate that students learn specifically Borland Turbo C++ as a standard.
If for some reasons someone has to use DOS/NT OS in an educational system, then using Code::BLOCK is a better option.
 
ralphbsz, thank you very much for this. I have got many hints from your answer, which is really helpful.

astyle, the system function is the last thing i would go after. since it's not safe to use, if you don't implement it properly. also if i want to take the output of uname and customize it, then system call shall not be that helpful. for that, using uname function is the right option.

i used borland way back in 1994. no internet was there at that time. the only way is to browse the available function in Turbo C and find out. once, i was finding out how to create a program that would browse the harddisk and print the file properties. i didn't even know where to start. going through the help and selecting the function one by one, i found there is a function that i was looking for. findfirst and findnext, were those apis.

mark_j, you are right. in borland c, you press Shift + F1, you are presented with all functions from a..z.

kpedersen. you are right. still the students in India, use TurboC and Borland C, to create programs for their academic courses. I remember switching to rhide, when everyone migrated to Windows 98 from MS DOS. But Turbo C, Turbo Basic were some of the best IDEs available at that time. some people even were fond of Turbo Pascal and Turbo ASM.

at the moment, running the command "nm -D /lib/libc.so.7 |awk '($2 == "T") {print $3}'|grep ^[a-z]|less" on many of the libraries available in my system, is definitely giving me some clue.

i have decided that, for example if i want to explore crypto, explore the lib*crypto* libraries and use the functions. or, if I want to use markup lang, use something like lib*yaml* kind of libraries.

thanks everyone. i really liked all the answers and it's awesome to be in this forum!
 
the system function is the last thing i would go after. since it's not safe to use, if you don't implement it properly. also if i want to take the output of uname and customize it, then system call shall not be that helpful. for that, using uname function is the right option.

i used borland way back in 1994. no internet was there at that time. the only way is to browse the available function in Turbo C and find out. once, i was finding out how to create a program that would browse the harddisk and print the file properties. i didn't even know where to start. going through the help and selecting the function one by one, i found there is a function that i was looking for. findfirst and findnext, were those apis.
You want safety, you go for Java, not C. C was meant to be rather minimal, yet easy enough to use. If you wanted C with classes (and a bigger API set), you go for C++. Back in 1994, I remember seeing a Borland book-with-CD package in a locked glass case, and it went for a few hundred USD easy. Not something a teenager could afford. At least there was email to play with - prefixing SMTP- to the email address allowed you to to send an email outside of the school's LAN, and email your parents or adult friends at work.
 
In its most basic form you can look in the directories of /usr/share/man/man2 and man3 respectively.
The problem with categorising man pages into something like networking is that to a unix-like system, all things are files and thus you use the same system call of write(2) for example to write to a file, device, socket.
thank you mark_j. exploring the directories, certainly gives lot of functions available.
 
Back
Top