All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx.manpages@gmail.com>
To: "Floyd, Paul" <pjfloyd@wanadoo.fr>,
	GNU C Library <libc-alpha@sourceware.org>
Cc: linux-man@vger.kernel.org
Subject: Re: Issues in manpage memalign
Date: Fri, 10 Mar 2023 01:35:25 +0100	[thread overview]
Message-ID: <77cfc3d2-cd41-13a7-bdb9-ced179531f33@gmail.com> (raw)
In-Reply-To: <d79b505c-5b19-331c-5b25-d40adc9cc843@wanadoo.fr>


[-- Attachment #1.1: Type: text/plain, Size: 1975 bytes --]

Hi Paul,

On 3/7/23 23:24, Floyd, Paul wrote:
> 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.

I've CCd glibc, in case someone there can confirm in which direction they
would like the manual page to go.

For now, I'll add a [[deprecated]] attribute in the Synopsis for the
obsolete functions.

Cheers,

Alex

> 
> 
> Regards
> 
> Paul
> 
> 

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-03-10  0:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 22:24 Issues in manpage memalign Floyd, Paul
2023-03-10  0:35 ` Alejandro Colomar [this message]
2023-03-10  3:02   ` DJ Delorie
2023-03-10  7:21     ` Paul Floyd
2023-03-10  4:05   ` Xi Ruoyao
2023-03-10  7:15     ` Paul Floyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77cfc3d2-cd41-13a7-bdb9-ced179531f33@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-man@vger.kernel.org \
    --cc=pjfloyd@wanadoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.