.\" -*- coding: UTF-8 -*- .\" Copyright (c) 2001 by John Levon .\" Based in part on GNU libc documentation. .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" 2001-10-11, 2003-08-22, aeb, added some details .\" 2012-03-23, Michael Kerrisk .\" Document pvalloc() and aligned_alloc() .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH POSIX_MEMALIGN 3 "21 décembre 2020" GNU "Manuel du programmeur Linux" .SH NOM posix_memalign, aligned_alloc, memalign, valloc, pvalloc \- Allocation de mémoire alignée .SH SYNOPSIS .nf \fB#include \fP .PP \fBint posix_memalign(void **\fP\fImemptr\fP\fB, size_t \fP\fIalignment\fP\fB, size_t \fP\fIsize\fP\fB);\fP \fBvoid *aligned_alloc(size_t \fP\fIalignment\fP\fB, size_t \fP\fIsize\fP\fB);\fP \fBvoid *valloc(size_t \fP\fIsize\fP\fB);\fP \fB#include \fP .PP \fBvoid *memalign(size_t \fP\fIalignment\fP\fB, size_t \fP\fIsize\fP\fB);\fP \fBvoid *pvalloc(size_t \fP\fIsize\fP\fB);\fP .fi .PP .RS -4 Exigences de macros de test de fonctionnalités pour la glibc (consulter \fBfeature_test_macros\fP(7))\ : .RE .PP .ad l \fBposix_memalign\fP(): _POSIX_C_SOURCE\ >=\ 200112L .PP \fBaligned_alloc\fP(): _ISOC11_SOURCE .PP \fBvalloc\fP()\ : .br .PD 0 .RS 4 .TP 4 Depuis la glibc 2.12 : .nf (_XOPEN_SOURCE\ >=\ 500) && !(_POSIX_C_SOURCE\ >=\ 200112L) || /* Glibc since 2.19: */ _DEFAULT_SOURCE || /* Glibc versions <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE .br .fi .TP Avant la glibc 2.12\ : .\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 .ad b .br Le fichier d'en\-tête (non standard) \fI\fP déclare également \fBvalloc\fP()\ ; aucune macro de test de fonctionnalité n'est nécessaire. .RE .PD .SH DESCRIPTION .\" glibc does this: The function \fBposix_memalign\fP() allocates \fIsize\fP bytes and places the address of the allocated memory in \fI*memptr\fP. The address of the allocated memory will be a multiple of \fIalignment\fP, which must be a power of two and a multiple of \fIsizeof(void\ *)\fP. This address can later be successfully passed to \fBfree\fP(3). If \fIsize\fP is 0, then the value placed in \fI*memptr\fP is either NULL or a unique pointer value. .PP .\" The behavior of memalign() for size==0 is as for posix_memalign() .\" but no standards govern this. La fonction obsolète \fBmemalign\fP() alloue \fIsize\fP octets et renvoie un pointeur vers la mémoire allouée. L'adresse mémoire est alors un multiple de \fIalignment\fP, qui doit être une puissance de deux. .PP La fonction \fBaligned_alloc\fP() est identique à \fBmemalign\fP(), excepté que \fIsize\fP doit être un multiple de \fIalignment\fP. .PP La fonction obsolète \fBvalloc\fP() alloue \fIsize\fP octets et renvoie un pointeur vers la mémoire allouée. L'adresse mémoire est alors un multiple de la taille de page. Cette fonction est équivalente à \fImemalign(sysconf(_SC_PAGESIZE),size)\fP. .PP La fonction obsolète \fBpvalloc\fP() est similaire à \fBvalloc\fP(), mais arrondit la taille de l'allocation au multiple supérieur de la taille de page système. .PP Pour toutes ces fonctions, la mémoire n'est pas initialisée à zéro. .SH "VALEUR RENVOYÉE" \fBaligned_alloc\fP(), \fBmemalign\fP(), \fBvalloc\fP(), and \fBpvalloc\fP() return a pointer to the allocated memory on success. On error, NULL is returned, and \fIerrno\fP is set to indicate the cause of the error. .PP .\" http://austingroupbugs.net/view.php?id=520 \fBposix_memalign\fP() returns zero on success, or one of the error values listed in the next section on failure. The value of \fIerrno\fP is not set. On Linux (and other systems), \fBposix_memalign\fP() does not modify \fImemptr\fP on failure. A requirement standardizing this behavior was added in POSIX.1\-2008 TC2. .SH ERREURS .TP \fBEINVAL\fP Le paramètre \fIalignment\fP n'est pas une puissance de deux, ou n'est pas un multiple de \fIsizeof(void\ *)\fP. .TP \fBENOMEM\fP Mémoire insuffisante pour réaliser la demande d'allocation. .SH VERSIONS The functions \fBmemalign\fP(), \fBvalloc\fP(), and \fBpvalloc\fP() have been available since at least glibc 2.0. .PP La fonction \fBaligned_alloc\fP() est disponible depuis la glibc 2.16. .PP La fonction \fBposix_memalign\fP() est disponible depuis la glibc 2.1.94. .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consulter \fBattributes\fP(7). .TS allbox; lb lb lb l l l. Interface Attribut Valeur T{ \fBaligned_alloc\fP(), .br \fBmemalign\fP(), .br \fBposix_memalign\fP() T} Sécurité des threads MT\-Safe T{ \fBvalloc\fP(), .br \fBpvalloc\fP() T} Sécurité des threads MT\-Unsafe init .TE .sp 1 .SH CONFORMITÉ The function \fBvalloc\fP() appeared in 3.0BSD. It is documented as being obsolete in 4.3BSD, and as legacy in SUSv2. It does not appear in POSIX.1. .PP La fonction \fBpvalloc\fP() est une extension GNU. .PP La fonction \fBmemalign\fP() est apparue dans SunOS 4.1.3 mais pas dans BSD\ 4.4. .PP The function \fBposix_memalign\fP() comes from POSIX.1d and is specified in POSIX.1\-2001 and POSIX.1\-2008. .PP .\" La fonction \fBaligned_alloc\fP() est spécifiée dans le standard C11. .SS En\-têtes Tout le monde est d'accord sur le fait que \fBposix_memalign\fP() est déclarée dans \fI\fP. .PP Sur certains systèmes, \fBmemalign\fP() est déclaré dans \fI\fP au lieu de \fI\fP. .PP .\" Libc4,5 and According to SUSv2, \fBvalloc\fP() is declared in \fI\fP. Glibc declares it in \fI\fP, and also in \fI\fP if suitable feature test macros are defined (see above). .SH NOTES Il y a des restrictions d'alignement sur beaucoup de systèmes, par exemple sur les tampons utilisés pour les entrées\-sorties directes des périphériques blocs. POSIX spécifie que l'appel \fIpathconf(path,_PC_REC_XFER_ALIGN)\fP indique quel alignement est nécessaire. On peut à présent utiliser \fBposix_memalign\fP() pour satisfaire cette condition. .PP \fBposix_memalign\fP() vérifie qu'\fIalignment\fP répond bien aux exigences détaillées ci\-dessus. \fBmemalign\fP() est susceptible de ne pas contrôler que le paramètre \fIalignment\fP est correct. .PP .\" Other systems allow passing the result of .\" .IR valloc () .\" to .\" .IR free (3), .\" but not to .\" .IR realloc (3). La norme POSIX impose que la mémoire obtenue par un appel à \fBposix_memalign\fP() puisse être libérée en utilisant \fBfree\fP(3). Certains systèmes ne fournissent aucun moyen de libérer la mémoire allouée par \fBmemalign\fP() ou \fBvalloc\fP() (parce que l'on peut seulement passer comme paramètre à \fBfree\fP(3) un pointeur obtenu via \fBmalloc\fP(3), alors que, par exemple, \fBmemalign\fP() pourrait appeler \fBmalloc\fP(3) et aligner par la suite la valeur obtenue). L'implémentation de la glibc permet de libérer la mémoire obtenue par n'importe laquelle de ces fonctions par appel à \fBfree\fP(3). .PP L'implémentation de la glibc de \fBmalloc\fP(3) renvoie toujours des adresses mémoire alignées sur 8\ octets, ainsi ces fonctions ne sont nécessaires qu'en cas de besoin de valeurs d'alignement plus grandes. .SH "VOIR AUSSI" \fBbrk\fP(2), \fBgetpagesize\fP(2), \fBfree\fP(3), \fBmalloc\fP(3) .SH COLOPHON Cette page fait partie de la publication\ 5.10 du projet \fIman\-pages\fP Linux. Une description du projet et des instructions pour signaler des anomalies et la dernière version de cette page peuvent être trouvées à l'adresse \%https://www.kernel.org/doc/man\-pages/. .SH TRADUCTION La traduction française de cette page de manuel a été créée par Christophe Blaess , Stéphan Rafin , Thierry Vignaud , François Micaux, Alain Portal , Jean-Philippe Guérard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas François , Florentin Duneau , Simon Paillard , Denis Barbier et David Prévot . Cette traduction est une documentation libre ; veuillez vous reporter à la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 .UE concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE. Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à .MT debian-l10n-french@lists.debian.org .ME .