.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1993 Michael Haardt (michael@moria.de), .\" Fri Apr 2 11:32:09 MET DST 1993 .\" .\" SPDX-License-Identifier: GPL-2.0-or-later .\" .\" 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 "3 maggio 2023" "Linux man\-pages 6.05.01" .SH NOME _syscall \- invoca una chiamata di sistema senza supporto di libreria (OBSOLETO) .SH SINTASSI .nf \fB#include \fP .PP Una macro _syscall .PP la chiamata di sistema desiderata .fi .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 is 0\[en]6, which are the number of arguments taken by the system call .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 STANDARDS Linux. .SH STORIA Starting around Linux 2.6.18, the _syscall macros were removed from header files supplied to user space. Use \fBsyscall\fP(2) instead. (Some architectures, notably ia64, never provided the _syscall macros; on those architectures, \fBsyscall\fP(2) was always required.) .SH NOTE 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 .\" [[deprecated]] SRC BEGIN (_syscall.c) .EX #include #include #include #include /* for _syscallX macros/related stuff */ #include /* for struct sysinfo */ \& _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 .\" SRC END .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) .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 .