Hi all,

I traced down the code generating the segfault when installing EMC to a
minimum install of linux (only xorg, xfce4 and slim added to a command line
install of 8.04). The segfault is generated from a call to rtai_malloc in
the file rtapi/rtai_ulapi.c. The function called has the prototype:

int rtapi_shmem_new(int key, int module_id, unsigned long int size);

The specific code generating the error is:

    /* now get shared memory block from OS and save its address */
    shmem_addr_array[shmem_id] = rtai_malloc(key, size);
    // the check for -1 here is because rtai_malloc (in at least
    // rtai 3.6.1, and probably others) has a bug where it
    // sometimes returns -1 on error
    if (shmem_addr_array[shmem_id] == NULL || shmem_addr_array[shmem_id] ==
(void*)-1) {
        rtapi_mutex_give(&(rtapi_data->mutex));
        rtapi_print_msg(RTAPI_MSG_ERR,
            "RTAPI: ERROR: could not create shmem %d\n", n);
        return RTAPI_NOMEM;
    }

The returned value from the call to rtai_malloc is consistently -1. I
checked the values of the parameters to rtapi_shmem_new on both a working
system and this system, and they are identical.

The online documentation I found for rtai_malloc
(https://www.rtai.org/documentation/magma/html/api/group__shm.html#ga68)
defines rtai_malloc as (typos included <g>):

<quote>
#define rtai_malloc (name, size)  _rt_shm_alloc(0, name, size, USE_VMALLOC,
0)

Allocate a chunk of memory to be shared inter-intra kernel modules and Linux
processes. 

rtai_malloc is used to allocate shared memory from user space.

Parameters:     name  is an unsigned long identifier;
            size  is the amount of required shared memory;

rtai_malloc is a legacy helper macro, the real job is carried out by a call
to rt_shm_alloc() with the same name, size and with vmalloc support. This
function should not be used in newly developed applications. See
rt_shm_alloc fro more details.

Returns:
a valid address on succes, 0 on failure.
</quote>

Among other things, this indicates to me a direct kernel call to a kernel
with the rtai extensions. Thus it seems unlikely to have anything to do with
the additional packages in a full ubuntu or xubuntu install.

I don't know exactly what is going on when the emc install script
(emc2-install.sh) is run. Is a rtai patched kernel just copied into /boot or
does something get patched or otherwise modified locally to create the rtai
kernel? Is it possible that something different happens at the install when
only a minimal system is installed? Where is the -1 coming from which is not
a defined result (comment refers to it as a bug)? Any ideas where to look
next?

Thanks,
Eric



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to