malloc/free/realloc will be renamed in the kernel

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Tue Sep 5 11:09:10 PDT 2006


Matthew Dillon wrote:
:Matt, I really think this is no good idea.  I don't understand why you ar=
:e trying to link the kernel with libc in the first place anyways.  The re=
:al kernel doesn't need libc, so why should the userland kernel need it?  =
:What I see what's needed are three usermode kernel drivers:  a console dr=
:iver, a usermode network interface driver and a signal handler.  I don't =
:see anywhere that libc is really needed.
:
:Additionally, renaming malloc et all in the whole kernel just seems a big=
:, possibly even error-prone change, where it can be accomplished much mor=
:e easy and elegant with a linker script.
    I thought it might be a bigger job then it actually was.  It turned
    out to be trivial.  Sure there are going to be a few hicups, but nothing
    that I would consider a big deal.
I see, the changes before seemed more complicated.

    Well, if we don't link it against libc then developing pseudo devices
    that interact with the real system would require considerably more
    infrastructure.  I kinda prefer having libc around so I can just write
    that code as I would any application.
    Lets consider the types of devices we want to support in the virtual
    kernel.  These devices must communicate with the real world:
    * Console      	      - Just use stdin and stdout
    * 'External' Serial ports - Just use a couple of the real kernel's PTYs
    * Disk		      - open/lseek/read/write/close
    * Memory		      - mmap( ... MAP_ANON)
    * Network		      - Just use the real kernel's TUN interfaces.
				It would even be possible to using the new
				bridging code to put a virtual kernel directly
				on the real system's LAN.
    
    Writing those devices should be a matter of a day or two on each one
    with libc available.  It will be so easy that I'm not even concerned
    about them.
looking at those tasks, we don't need any "special" libc support:  syscalls don't require libc.  stuff like malloc(3), strlen(3), gethostbyaddr(3), db*(3), all this stuff is not needed by a kernel.

cheers
 simon
--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
Attachment:
signature.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00006.pgp
Type: application/octet-stream
Size: 252 bytes
Desc: "Description: OpenPGP digital signature"
URL: <http://lists.dragonflybsd.org/pipermail/kernel/attachments/20060905/551d1bf8/attachment-0015.obj>


More information about the Kernel mailing list