> > Could it be, that the amount of memory which I want to copy must be less than
> > PAGE_SIZE???? The structure has a size of about 512 kB!
> > The shared memory is allocated by mbuff, no problems. The local copy which I
> > try to fill with the contents of the shm structure is a static variable, like
> >
> > void *thread_code(void *param)
> > {
> > shm_slut_t slut;
> > memcpy((void *)slut, (void *)shm_slut, sizeof(shm_slut_t));
>
> Oh no, why I did not see it immediately. Also, probably "&" is missing.
In the real code, I give an adress to memcpy. This is my fault due to quick &
dirty copy&paste to reduce the code. This is separeted into two functions, the
thread_code and the shm_get_slut(shm_slut_t *slut_dest):
inline int shm_get_sensorLUT(shm_slut_t *slut_dest)
{
unsigned long flags;
if(!shm_slut->inuse) {
shm_slut->inuse = true;
#warning memcpy enabled
memcpy((void *)slut_dest, (void *)shm_slut, sizeof(shm_slut_t));
shm_slut->inuse = false;
return 0;
} else {
return -EBUSY;
}
}
/* original code yet */
void *thread_code(void *param)
{
shm_slut_t slut;
....
while(1) {
pthread_wait_np();
.....
(void)shm_get_sensorLUT(&slut);
.....
}
> So first of all shm_slut_t slut; here it is not static variable, but
> automatic one and it is created on the stack every time you call the
> function. And the size of the stack for RT thread is one of the parameters
> you give when you create a new thread. For standard Linux kernel it is 8 KB.
> Using automatic variables to store things larger than let's say 1 KB is
> strongly discouraged. Overwriting the stack results in a crash.
Maybee this is the crash "resource". So I will make it module static maybee.
How can I change the stack size with the new RTL2/pthread interface? At RTL1
this was a parameter on creating the task, if I right remember.
> So of course, use vmalloc. Best allocate this memory in init_module, because
> you can not call it from RT thread nor ISR.
shm_slut_t *slut;
...
if((slut = vmalloc(sizeof(shm_slut_t))) == NULL) {
/* error */
}
...
vfree(slut);
Right? (my first memory allocation inside kernel space 8), where can I get
manpages for this - the syntax is from the kernel source).
Thanks a lot Olaf
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/