posix_fadvise
Prédéclarer des accès aux données d'un fichier
- Provided by: manpages-fr-dev (Version: 4.31.0-1)
- Source: manpages-l10n
- Report a bug
Prédéclarer des accès aux données d'un fichier
Bibliothèque C standard (libc, -lc)
#include <fcntl.h>
int posix_fadvise(int fd, off_t offset, off_t size, int advice);
posix_fadvise() :
_POSIX_C_SOURCE >= 200112L
Les programmes peuvent utiliser posix_fadvise() pour annoncer leur intention d'accéder aux données d'un fichier suivant un certain ordre, permettant ainsi au noyau de réaliser les optimisations appropriées.
The advice applies to a (not necessarily existent) region starting at offset and extending for size bytes (or until the end of the file if size is 0) within the file referred to by fd. The advice is not binding; it merely constitutes an expectation on behalf of the application.
Les valeurs possibles pour advice incluent :
L'appel renvoie zéro s'il réussit. S'il échoue, il renvoie un code d'erreur.
Under Linux, POSIX_FADV_NORMAL sets the readahead window to the default size for the backing device; POSIX_FADV_SEQUENTIAL doubles this size, and POSIX_FADV_RANDOM disables file readahead entirely. POSIX_FADV_NOREUSE does not modify the readahead window size. These changes affect the entire file, not just the specified region (but other open file handles to the same file are unaffected).
The name of the wrapper function in the C library is posix_fadvise(). The underlying system call is called fadvise64() (or, on some architectures, fadvise64_64()); the difference between the two is that the former system call assumes that the type of the size argument is size_t, while the latter expects loff_t there.
Certaines architectures nécessitent que les paramètres 64 bits soient alignés dans une paire de registres adéquate (consultez syscall(2) pour plus de renseignements). Sur ces architectures, la signature d'appel de posix_fadvise() indiquée dans le SYNOPSIS imposerait le gaspillage d'un registre de remplissage entre les paramètres fd et offset. Pour cette raison, ces architectures définissent un appel système différent qui réordonne correctement les paramètres, mais qui est sinon strictement similaire à posix_fadvise().
Par exemple, depuis Linux 2.6.14, l'architecture ARM utilise l'appel système suivant :
long arm_fadvise64_64(int fd, int advice,
loff_t offset, loff_t size);
Ces détails dépendants de l'architecture sont généralement invisibles des applications grâce à la glibc et sa fonction d'enrobage posix_fadvise() qui utilise l'appel système adapté à l'architecture.
POSIX.1-2024.
POSIX.1-2001.
Le noyau est d'abord apparue dans Linux 2.5.60 ; l'appel système sous-jacent est appelé fadvise64(). La prise en charge dans l'espace utilisateur est disponible depuis la glibc 2.2, à travers la fonction posix_fadvise().
Depuis Linux 3.18, la gestion de l'appel système sous-jacent est facultative, selon le positionnement de l'option de configuration CONFIG_ADVISE_SYSCALLS.
The type of the size argument was changed from size_t to off_t in POSIX.1-2001 TC1.
Le contenu du cache du tampon du noyau peut être vidé à l'aide de l'interface /proc/sys/vm/drop_caches décrite dans proc(5).
On peut obtenir un instantané des pages d'un fichier résidentes dans le cache du tampon en ouvrant un fichier, en le projetant avec mmap(2) et en appliquant mincore(2) à la projection.
Before Linux 2.6.6, if size was specified as 0, then this was interpreted literally as "zero bytes", rather than as meaning "all bytes through to the end of the file".
fincore(1), mincore(2), readahead(2), sync_file_range(2), posix_fallocate(3), posix_madvise(3)
La traduction française de cette page de manuel a été créée par Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org> et Jean-Philippe MENGUAL <jpmengual@debian.org>
Cette traduction est une documentation libre ; veuillez vous reporter à la GNU General Public License version 3 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 à debian-l10n-french@lists.debian.org.