Porting an element from user level to kernel level?

Eddie Kohler kohler at icir.org
Sun Mar 16 22:05:21 EST 2003


> I'm porting my elements to kernel level, but I'm having a lot of compile problems with functions that I cannot use in kernel level. 
> Most of the problems are with functions of stdlib.h, like malloc, calloc and free. Also something about conflicting types: 
> "conflicting types for 'typedef __dev_t dev_t' and '__kernel_dev_t dev_t'", and network functions like inet_ntoa(), inet_ntop(), 
> inet_pton(), etc.  

Juan Luis,

Most functions in stdlib.h are not available in the kernel. Most C library
functions are not available in the kernel. Types like dev_t are not
available in the kernel. Functions like inet_ntoa are not available in the
kernel.

Kernel programming is very different from user-level programming. No file
access. No standard library.

Your best bet is to use Click functions exclusively. For example inet_ntoa
is silly when you have "IPAddress::unparse()". If it is not wrapped by
Click, the functionality is not likely to work in the kernel.

Eddie




More information about the click mailing list