.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992 .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\" Modified by Michael Haardt .\" Modified 1993-07-24 by Rik Faith .\" Modified 1995-07-22 by Michael Chastain .\" Modified 1995-07-23 by aeb .\" Modified 1996-10-22 by Eric S. Raymond .\" Modified 1998-09-08 by aeb .\" Modified 2004-06-17 by Michael Kerrisk .\" Modified 2004-10-10 by aeb .\" 2004-12-14 mtk, Anand Kumria: added new errors .\" 2007-06-22 Ivana Varekova , mtk .\" Update text describing limit on number of swap files. .\" 2021-01-17 Alex Baranowski .\" Update information about available swap files decreased by .\" CONFIG_DEVICE_PRIVATE option. .\" .\" FIXME Linux 3.11 added SWAP_FLAG_DISCARD_ONCE and SWAP_FLAG_DISCARD_PAGES .\" commit dcf6b7ddd7df8965727746f89c59229b23180e5a .\" Author: Rafael Aquini .\" Date: Wed Jul 3 15:02:46 2013 -0700 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH swapon 2 "30 marzo 2023" "Linux man\-pages 6.05.01" .SH NOME swapon, swapoff \- start/stop swapping sul file/dispositivo .SH LIBRARY Standard C library (\fIlibc\fP, \fI\-lc\fP) .SH SINTASSI .nf \fB#include \fP .PP \fBint swapon(const char *\fP\fIpath\fP\fB, int \fP\fIswapflags\fP\fB);\fP \fBint swapoff(const char *\fP\fIpath\fP\fB);\fP .fi .SH DESCRIZIONE \fBswapon\fP() imposta lo swap sul dispositivo a blocchi o sul file specificato in \fIpath\fP. \fBswapoff\fP() ferma lo swap sul dispositivo a blocchi o sul file specificato in \fIpath\fP. .PP Se nell'argomento \fIswapflags\fP di \fBswapon\fP() è specificata l'opzione \fBSWAP_FLAG_PREFER\fP, la nuova area di swap avrà una priorità maggiore di quella predefinita. La priorità è codificata in \fIswapflags\fP come: .PP .in +4n .EX \fI(prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK\fP .EE .in .PP Se nell'argomento \fIswapflags\fP di \fBswapon\fP() è specificata l'opzione \fBSWAP_FLAG_DISCARD\fP, le pagine di swap liberate saranno segnate come scartate prima di essere riutilizzate, se il dispositivo di swap supporta l'operazione discard o trim. (Questo potrebbe migliorare le prestazioni di alcuni Dispositivi a Stato Solido, ma spesso non avviene). Vedere anche la sezione NOTE. .PP Queste funzioni possono essere usate solo da un processo privilegiato (uno che ha le funzionalità \fBCAP_SYS_ADMIN\fP). .SS Priorità Ogni area di swap ha una sua priorità, sia essa alta o bassa. Quella predefinita è bassa. Tra le aree a bassa priorità le aree più nuove hanno sempre una priorità più bassa delle aree più vecchie. .PP Tutte le priorità impostate attraverso \fIswapflags\fP sono ad alta prorità, più alta di quella predefinita. Esse possono avere qualunque valore non negativo scelto dal chiamante. A numero maggiore corrisponde priorità maggiore. .PP Le pagine di swap sono allocate in aree in ordine di priorità, prima quelle con priorità maggiore. Per aree aventi priorità diverse, un'area con priorità più alta viene esaurita prima che venga usata un'area a priorità più bassa. Se vi sono due o più aree con la stessa priorità, ed è la massima priorità disponibile, le pagine sono allocate secondo uno schema a "round\-robin". .PP Fino al kernel 1.3.6, si seguivano queste regole, ma con alcune eccezioni. .SH "VALORE RESTITUITO" In caso di successo restituisce zero. In caso di errore restituisce \-1, e \fIerrno\fP verrà impostato per indicare l'errore. .SH ERRORI .TP \fBEBUSY\fP (per \fBswapon\fP()) Il \fIpercorso\fP specificato è già stato usato come area di swap. .TP \fBEINVAL\fP Il \fIpercorso\fP del file esiste, ma non fa riferimento nè a un file regolare, nè a un dispositivo a blocchi. .TP \fBEINVAL\fP (\fBswapon\fP()) Il percorso indicato non contiene una firma di swap valida o risiede in un filesystem in memoria come \fBtmpfs\fP(5). .TP \fBEINVAL\fP (a partire da Linux 3.4) (\fBswapon\fP()) Un valore di opzione non valido è sato specificato in \fIswapflags\fP. .TP \fBEINVAL\fP (\fBswapoff\fP()) \fIpercorso\fP attualmente non è un'area di swap. .TP \fBENFILE\fP E' stato raggiunto il limite per l'intero sistema sul numero totale di file aperti. .TP \fBENOENT\fP Il \fIpercorso\fP del file non esiste. .TP \fBENOMEM\fP Il sistema ha memoria insufficiente per iniziare lo swapping. .TP \fBEPERM\fP Il chiamante non ha la funzionalità \fBCAP_SYS_ADMIN\fP. In alternativa, il numero massimo di file di swap è già in uso; vedere le NOTE sotto. .SH STANDARDS Linux. .SH STORIA The \fIswapflags\fP argument was introduced in Linux 1.3.2. .SH NOTE La partizione o percorso devono essere preparati con \fBmkswap\fP(8). .PP There is an upper limit on the number of swap files that may be used, defined by the kernel constant \fBMAX_SWAPFILES\fP. Before Linux 2.4.10, \fBMAX_SWAPFILES\fP has the value 8; since Linux 2.4.10, it has the value 32. Since Linux 2.6.18, the limit is decreased by 2 (thus: 30) if the kernel is built with the \fBCONFIG_MIGRATION\fP option (which reserves two swap table entries for the page migration features of \fBmbind\fP(2) and \fBmigrate_pages\fP(2)). Since Linux 2.6.32, the limit is further decreased by 1 if the kernel is built with the \fBCONFIG_MEMORY_FAILURE\fP option. Since Linux 5.14, the limit is further decreased by 4 if the kernel is built with the \fBCONFIG_DEVICE_PRIVATE\fP option. .PP .\" To be precise: 2.6.35.5 Discard of swap pages was introduced in Linux 2.6.29, then made conditional on the \fBSWAP_FLAG_DISCARD\fP flag in Linux 2.6.36, which still discards the entire swap area when \fBswapon\fP() is called, even if that flag bit is not set. .SH "VEDERE ANCHE" \fBmkswap\fP(8), \fBswapoff\fP(8), \fBswapon\fP(8) .PP .SH TRADUZIONE La traduzione italiana di questa pagina di manuale è stata creata da Goffredo Baroncelli , Giulio Daprelà , Elisabetta Galli e Marco Curreli . .PP Questa traduzione è documentazione libera; leggere la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Versione 3 .UE o successiva per le condizioni di copyright. Non ci assumiamo alcuna responsabilità. .PP Per segnalare errori nella traduzione di questa pagina di manuale inviare un messaggio a .MT pluto-ildp@lists.pluto.it .ME .