Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Aug 2007 12:25:36 -0500
From:      Craig Boston <cb@severious.net>
To:        Biks N <freebsd.dev@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Using userland library in Kernel
Message-ID:  <20070808172535.GA8404@nowhere>
In-Reply-To: <50cd4e5f0708080923p1d441e66ha6b42e277b55f8d@mail.gmail.com>
References:  <50cd4e5f0708080923p1d441e66ha6b42e277b55f8d@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 08, 2007 at 11:23:25AM -0500, Biks N wrote:
> I am new to FreeBSD kernel programming and I am trying to use userland
> library (zlib) in FreeBSD kernel. But I am not sure if zlib library is
> linkable from the kernel.

Normally, no, you can't just link in a library designed for userland
into the kernel.  Some porting is required to deal with the kernel
environment -- things such as not having a full C library available,
different memory management, etc.

In this case however, there is already a zlib implementation in the
kernel.  IIRC, geom_uzip and the crypto framework both use it.

You may want to check out sys/net/zlib.[ch] and see if it can do what
you're after.  You'll need to make sure to include a dependency on the
zlib module and/or add it to your kernel configuration.

Good luck,
Craig



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070808172535.GA8404>