Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the significance of caddr_t and when is it used?

Can somebody please tell me:

  1. What is caddr_t ?
  2. When is it used ?
  3. How it is different from void* ?
  4. When to use void* and when to use caddr_t ?

Thanks in advance.

like image 885
RajSanpui Avatar asked Jun 17 '11 04:06

RajSanpui


2 Answers

caddr_t is a legacy BSD type associated with some low level calls like mmap, and it should never be used in modern code. It was rejected by the POSIX standard. The standardized mmap uses void *.

like image 98
R.. GitHub STOP HELPING ICE Avatar answered Nov 09 '22 06:11

R.. GitHub STOP HELPING ICE


caddr_t was used as a pointer to a core address. I used it in SVR4 when I needed to access kernel structures from user space (having used mmap to access /dev/kmem). Even when "/proc" existed, the ps command still used mmap of the kernel to start walking the process table. As everybody states it was superseded by void *.

like image 1
Keith Smith Avatar answered Nov 09 '22 06:11

Keith Smith