What is the difference between malloc and malloc (3)?

When reading a hacker article in the jemalloc memory manager, the hacker continues to reference malloc (3), not malloc. I wondered why.

Does he do this because it refers to a particular linux malloc implementation? Or just reference all the malloc variants that implement the interface as described in the section (libary functions) of the unix / linux manual pages? This option is my guess, I want to be sure. Is there any other reason?

So is the hacker just too specific? Or is there a difference between malloc and malloc (3)?

Part (3) is not a reference to other documentation, article or research mentioned below in the hacker's article.

+4
source share
3 answers

malloc(3) is just a hint that malloc is part of section 3 of the manual pages. Section 3 are library functions. This contradicts Section 2 of the man page where system calls are indicated. No malloc(2) .

For instance:

fwrite is a library function that is sometimes written as fwrite(3)

write is syscall, which is sometimes written as write(2)

If you run the command:

 $ man man 

he will tell you

  1 Executable programs or shell commands 2 System calls (functions provided by the kernel) 3 Library calls (functions within program libraries) 4 Special files (usually found in /dev) 5 File formats and conventions eg /etc/passwd 6 Games 7 Miscellaneous (including macro packages and convenรข tions), eg man(7), groff(7) 8 System administration commands (usually only for root) 9 Kernel routines [Non standard] 
+9
source

Foreword: my unix is โ€‹โ€‹weak.

I believe this is just a link to the section 3 library.

(from jargon file)
Links such as malloc (3) and patch (1) relate to Unix tools (some of which, such as patch (1), are actually open source distributed via Usenet).

+3
source

It seems that the author is just very specific.

Linking to section 3 of the manual pages is often useful if, for example, there may be a shell version of the same function. For example, man 1 printf for printf (1) and printf (3).

But in the case of malloc documentation should only exist in section 3.

+1
source

All Articles