.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1980, 1991 Regents of the University of California. .\" All rights reserved. .\" .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" %%%LICENSE_END .\" .\" @(#)ioctl.2 6.4 (Berkeley) 3/10/91 .\" .\" Modified 1993-07-23 by Rik Faith .\" Modified 1996-10-22 by Eric S. Raymond .\" Modified 1999-06-25 by Rachael Munns .\" Modified 2000-09-21 by Andries Brouwer .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH IOCTL 2 "11 abril 2020" Linux "Manual do Programador do Linux" .SH NOME ioctl \- controle de dispositivo .SH SINOPSE \fB#include \fP .PP .\" POSIX says 'request' is int, but glibc has the above .\" See https://bugzilla.kernel.org/show_bug.cgi?id=42705 \fBint ioctl(int \fP\fIfd\fP\fB, unsigned long \fP\fIrequest\fP\fB, ...);\fP .SH DESCRIÇÃO The \fBioctl\fP() system call manipulates the underlying device parameters of special files. In particular, many operating characteristics of character special files (e.g., terminals) may be controlled with \fBioctl\fP() requests. The argument \fIfd\fP must be an open file descriptor. .PP The second argument is a device\-dependent request code. The third argument is an untyped pointer to memory. It's traditionally \fBchar *\fP\fIargp\fP (from the days before \fBvoid *\fP was valid C), and will be so named for this discussion. .PP An \fBioctl\fP() \fIrequest\fP has encoded in it whether the argument is an \fIin\fP parameter or \fIout\fP parameter, and the size of the argument \fIargp\fP in bytes. Macros and defines used in specifying an \fBioctl\fP() \fIrequest\fP are located in the file \fI\fP. See NOTES. .SH "VALOR DE RETORNO" Usually, on success zero is returned. A few \fBioctl\fP() requests use the return value as an output parameter and return a nonnegative value on success. On error, \-1 is returned, and \fIerrno\fP is set appropriately. .SH ERROS .TP \fBEBADF\fP \fIfd\fP não é um descritor de arquivo válido. .TP \fBEFAULT\fP \fIargp\fP referencia uma área de memória inacessível. .TP \fBEINVAL\fP \fIrequest\fP ou \fIargp\fP não é válido. .TP \fBENOTTY\fP \fIfd\fP não está associada com um dispositivo especial de caracter. .TP \fBENOTTY\fP The specified request does not apply to the kind of object that the file descriptor \fIfd\fP references. .SH "DE ACORDO COM" No single standard. Arguments, returns, and semantics of \fBioctl\fP() vary according to the device driver in question (the call is used as a catch\-all for operations that don't cleanly fit the UNIX stream I/O model). .PP The \fBioctl\fP() system call appeared in Version 7 AT&T UNIX. .SH NOTAS .\" In order to use this call, one needs an open file descriptor. Often the \fBopen\fP(2) call has unwanted side effects, that can be avoided under Linux by giving it the \fBO_NONBLOCK\fP flag. .SS "Estrutura de ioctl" .\" added two sections - aeb Os valores do comando Ioctl são constantes de 32 bits. Em princípio, essas constantes são completamente arbitrárias, mas as pessoas tentaram construir alguma estrutura nelas. .PP A situação antiga do Linux era principalmente de constantes de 16 bits, onde o último byte é um número de série e o(s) byte(s) anterior(es) fornecem um tipo que indica o driver. Às vezes, o número principal era usado: 0x03 para os ioctls \fBHDIO_*\fP, 0x06 para os ioctls \fBLP*\fP. E, às vezes, uma ou mais letras ASCII eram usadas. Por exemplo, \fBTCGETS\fP tem valor 0x00005401, com 0x54 = \(aqT\(aq indicando o driver do terminal, e \fBCYGETTIMEOUT\fP tem valor 0x00435906, com 0x43 0x59 = \(aqC\(aq\(aqY\(aq indicando o driver Cyclades. .PP Posteriormente (0.98p5), mais algumas informações foram incorporadas ao número. Um tem 2 bits de direção (00: nada, 01: escrita, 10: leitura, 11: leitura/escrita) seguidos por 14 bits de tamanho (fornecendo o tamanho do argumento), seguido por um tipo de 8 bits (coletando os ioctls em grupos para uma finalidade comum ou um driver comum) e um número de série de 8 bits. .PP As macros descrevendo esta estrutura residem em \fI\fP e são \fB_IO(type,nr)\fP e \fB{_IOR,_IOW,_IOWR}(type,nr,size)\fP. Elas usam \fIsizeof(size)\fP, de forma que o tamanho é um nome incorreto aqui: este terceiro argumento é um tipo de dados. .PP Observe que os bits de tamanho não são confiáveis: em muitos casos, eles estão errados, seja por causa de macros com erros usando \fIsizeof(sizeof(struct))\fP, ou por causa de valores legados. .PP Assim, parece que a nova estrutura só deu desvantagens: não ajuda na verificação, mas causa valores variáveis para as várias arquiteturas. .SH "VEJA TAMBÉM" .\" .BR mt (4), \fBexecve\fP(2), \fBfcntl\fP(2), \fBioctl_console\fP(2), \fBioctl_fat\fP(2), \fBioctl_ficlonerange\fP(2), \fBioctl_fideduperange\fP(2), \fBioctl_fslabel\fP(2), \fBioctl_getfsmap\fP(2), \fBioctl_iflags\fP(2), \fBioctl_ns\fP(2), \fBioctl_tty\fP(2), \fBioctl_userfaultfd\fP(2), \fBopen\fP(2), \fBsd\fP(4), \fBtty\fP(4) .SH COLOFÃO Esta página faz parte da versão 5.10 do projeto Linux \fIman\-pages\fP. Uma descrição do projeto, informações sobre relatórios de bugs e a versão mais recente desta página podem ser encontradas em \%https://www.kernel.org/doc/man\-pages/. .PP .SH TRADUÇÃO A tradução para português brasileiro desta página man foi criada por André Luiz Fassone e Ricardo C.O.Freitas . .PP Esta tradução é uma documentação livre; leia a .UR https://www.gnu.org/licenses/gpl-3.0.html Licença Pública Geral GNU Versão 3 .UE ou posterior para as condições de direitos autorais. Nenhuma responsabilidade é aceita. .PP Se você encontrar algum erro na tradução desta página de manual, envie um e-mail para .MT debian-l10n-portuguese@lists.debian.org a lista de discussão de tradutores .ME .