But I get it using vmalloc and testet it also with kmalloc. The behavior was
the same.
>
>> I have to say, that my driver is programmed in C++ and I created a Class =
>> for
>> FileAccess. To be sure that it has nothing to do with C++ I wrote a litle
>
>be very careful not to put too much on the stack, also remember that
>new/delete need their own helpers in kernel space and exceptions dont work
I owerloaded the operators so I can use them.
void * TMemManager::operator new(size_t size)
{
void *ptr;
ptr = kmalloc( size, GFP_KERNEL);
for(size_t i=0; i<size; i++)
{
((UCHAR*)ptr)[i] = 0;
}
return ptr;
};
void TMemManager::operator delete(void *DeadObject, size_t size)
{
UNREFERENCED_PARAMETER(size)
kfree( DeadObject );
};
The C++ compiler shows me a lot of warnings which the C compiler does not,
like unreferenced parameter and assignment of -1 to unsigned
variables. I patched the header to be able to see the warnings created by my
code. If someone is interrested in this patch ...
>
>> An other problem is that the file descriptor cannot be createt ones and u=
>> sed in
>> different functions. I tryed getting the file descr. in init_module with
>
>You can't use file descriptors easily in kernel space. Unless you are doing
>accesses specifically in one process context you will cause grief
-- Vasilios Goutas Software-Development RATIO Entwicklungen GmbH Phone:+49-(0)40-369007-0 Admiralitätstr. 59 Fax:+49-(0)40-369007-25 20459 Hamburg Email: mailto:vgo@ratio.de
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/