Issues in manpage memalign

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

Quick bit of background. I'm a Valgrind maintainer and recently I've been working on getting Valgrind to work more like the underlying OS / libc implementations of memalign, posix_memalign and aligned_alloc.

There are several issues with the manpage for memalign and aligned alloc.

quote:

       The  obsolete  function  memalign()  allocates size bytes and returns a        pointer to the allocated memory.  The memory address will be a multiple
       of alignment, which must be a power of two.

endquote:

The power if two requirement is false for glibc which silently bumps up the alignment to the next power of two.

quote:

       The  function aligned_alloc() is the same as memalign(), except for the
       added restriction that size should be a multiple of alignment.

endquote:

This is also false for glibc. In the glibc implementation weak aliases are used so memalign and aligned_alloc call the same function.

quote:

ERRORS
       EINVAL The alignment argument was not a power of two, or was not a mul-
              tiple of sizeof(void *).

endquote:

Both of the above only apply to posix_memalign and not to either memalign or aligned_alloc.

There is a missing EINVAL description. If the alignment is so large that the allocation will not be possible to satisfy then the call will fail and set errno to EINVAL.


Regards

Paul





[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux