.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1993 Michael Haardt (michael@moria.de), .\" Fri Apr 2 11:32:09 MET DST 1993 .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, see .\" . .\" %%%LICENSE_END .\" .\" Tue Jul 6 12:42:46 MDT 1993 .\" Added "Calling Directly" and supporting paragraphs .\" .\" Modified Sat Jul 24 15:19:12 1993 by Rik Faith .\" .\" Modified 21 Aug 1994 by Michael Chastain : .\" Added explanation of arg stacking when 6 or more args. .\" .\" Modified 10 June 1995 by Andries Brouwer .\" .\" 2007-10-23 mtk: created as a new page, by taking the content .\" specific to the _syscall() macros from intro(2). .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH _SYSCALL 2 "9 giugno 2020" Linux "Manuale del programmatore di Linux" .SH NOME _syscall \- invoca una chiamata di sistema senza supporto di libreria (OBSOLETO) .SH SINTASSI \fB#include \fP .PP Una macro _syscall .PP la chiamata di sistema desiderata .SH DESCRIZIONE La cosa importante da sapere sulle chiamate di sistema è il loro prototipo. Bisogna conoscere il numero di argomenti, il loro tipo, e il tipo di ritorno della funzione. Ci sono sette macro che rendono più facile la reale chiamata nel sistema. Hanno il formato: .PP .in +4n .EX _syscall\fIX\fP(\fItipo\fP,\fInome\fP,\fItipo1\fP,\fIarg1\fP,\fItipo2\fP,\fIarg2\fP,...) .EE .in .PP dove .IP \fIX\fP è tra 0 e 6, che sono il numero di argomenti presi dalla chiamata di sistema .IP \fItipo\fP è il tipo di ritorno della chiamata di sistema .IP \fInome\fP è il nome della chiamata di sistema .IP \fItipoN\fP è il tipo dell'N\-esimo argomento .IP \fIargN\fP è il nome dell'N\-esimo argomento .PP Queste macro creano una funzione chiamata \fInome\fP con gli argomenti specificati. Una volta inclusa la _syscall() nel proprio file sorgente, si può chiamare la chiamata di sistema con \fInome\fP. .SH FILE \fI/usr/include/linux/unistd.h\fP .SH "CONFORME A" L'uso di queste macro è specifico di Linux, ed è deprecato. .SH NOTE A partire dal kernel 2.6.18 le macro di _syscall sono state rimosse dai file di intestazione messi a disposizione nello spazio utente. Si usi \fBsyscall\fP(2) al loro posto. (Alcune architetture, in particolare la ia64, non ha mai messo a disposizione le macro _syscall; su queste architetture è sempre stato richiesto \fBsyscall\fP(2)). .PP Le macro _syscall() \fInon\fP producono un prototipo. Occorrerà quindi crearne uno, specialmente per chi usa C++. .PP Le chiamate di sistema non devono per forza restituire solo codici di errore positivi o negativi. Occorrerà leggere il sorgente per essere sicuri di come ognuna di esse riporta gli errori. Solitamente, il valore di ritorno è il negato di un codice di errore standard, per esempio \-\fIEPERM\fP. Le macro _syscall() restituiranno il risultato \fIr\fP della chiamata di sistema quando \fIr\fP è non\-negativo, ma restituiranno \-1 e imposteranno la variabile \fIerrno\fP a \fIr\fP quando \fIr\fP è negativo. Per i codici di errore si veda \fBerrno\fP(3). .PP .\" The preferred way to invoke system calls that glibc does not know .\" about yet is via .\" .BR syscall (2). .\" However, this mechanism can be used only if using a libc .\" (such as glibc) that supports .\" .BR syscall (2), .\" and if the .\" .I .\" header file contains the required SYS_foo definition. .\" Otherwise, the use of a _syscall macro is required. .\" Quando si definisce una chiamata di sistema, i tipi di argomento \fIdevono\fP essere passati per valore o per puntatore (per gli aggregati come le strutture). .SH ESEMPI .EX #include #include #include #include /* per cose relative alle macro _syscallX */ #include /* per sysinfo struct */ _syscall1(int, sysinfo, struct sysinfo *, info); int main(void) { struct sysinfo s_info; int error; error = sysinfo(&s_info); printf("code error = %d\en", error); printf("Uptime = %lds\enLoad: 1 min %lu / 5 min %lu / 15 min %lu\en" "RAM: total %lu / free %lu / shared %lu\en" "Memory in buffers = %lu\enSwap: total %lu / free %lu\en" "Number of processes = %d\en", s_info.uptime, s_info.loads[0], s_info.loads[1], s_info.loads[2], s_info.totalram, s_info.freeram, s_info.sharedram, s_info.bufferram, s_info.totalswap, s_info.freeswap, s_info.procs); exit(EXIT_SUCCESS); } .EE .SS "Esempio di Output" .EX code error = 0 uptime = 502034s Load: 1 min 13376 / 5 min 5504 / 15 min 1152 RAM: total 15343616 / free 827392 / shared 8237056 Memory in buffers = 5066752 Swap: total 27881472 / free 24698880 Number of processes = 40 .EE .SH "VEDERE ANCHE" \fBintro\fP(2), \fBsyscall\fP(2), \fBerrno\fP(3) .SH COLOPHON Questa pagina fa parte del rilascio 5.10 del progetto Linux \fIman\-pages\fP. Una descrizione del progetto, le istruzioni per la segnalazione degli errori, e l'ultima versione di questa pagina si trovano su \%https://www.kernel.org/doc/man\-pages/. .PP .SH TRADUZIONE La traduzione italiana di questa pagina di manuale è stata creata da 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 .