posix_memalign

Daron Chabot daron.chabot at gmail.com
Tue Apr 30 17:12:59 UTC 2013


On Tue, Apr 30, 2013 at 3:41 AM, Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> On 04/29/2013 10:57 PM, Daron Chabot wrote:
>
>> Hi,
>>
>> I'm working with RTEMS 4.9.3 and the mvme3100 BSP
>>
>> In trying to emulate the vxworks function, memalign( ), and it looks like:
>>
>> 1) there is no equivalent in RTEMS, but it's prototyped in newlib
>> 2) posix_memalign( ) is defined in cpukit/libcsupport/src, but does not
>> appear
>> in any headers and cannot be linked against. It's definitely in
>> librtemscpu.a:
>>
>> ------------------------------**---------
>> dchabot at dev32new--> nm /usr/powerpc-rtems4.9/**mvme3100/lib/librtemscpu.a
>> libcsupport_a-posix_memalign.**o:
>> 00000000 T posix_memalign
>>           U rtems_malloc_statistics
>>           U rtems_memalign
>> ------------------------------**---------
>>
>
> What is the linker problem with this function?


Sorry, my mistake. Once I added a prototype for posix_memalign, all is well
with the linker.

Note, the prototype is missing from the version of newlib's "stdlib.h" that
we're using with RTEMS 4.9.3.
I see Ralf had posted a patch upstream back in 2009 (
http://sourceware.org/ml/newlib/2009/msg00924.html).



> 3) rtems_memalign( ) appears to be the only functional variant
>
>>
>> Is there a more elegant solution here than creating my own memalign( )
>> wrapper
>> around rtems_memalign( ) ? It seems like an error to not have a
>> posix_memalign(
>> ) available...
>>
>
> Since memalign() has a prototype in Newlib's <malloc.h> you can simply add
> an implementation to cpukit/libcsupport and a test case to
> testsuites/libtests/memalign01 if you want.


I'd prefer to use posix_memalign, as it seems the use of memalign is being
deprecated/made obsolete (from the man-page).

Thanks, Sebastian.


-- dc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20130430/a17a5398/attachment-0001.html>


More information about the users mailing list