From 07e42265974da64efdb139647780b3f133590374 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Tue, 1 Dec 2009 09:08:23 -0200 Subject: [PATCH] =?utf8?q?Traduzido=20para=20o=20portugu=C3=AAs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- _ldd.xml | 113 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 57 insertions(+), 56 deletions(-) diff --git a/_ldd.xml b/_ldd.xml index 8056a1f..a1085c6 100644 --- a/_ldd.xml +++ b/_ldd.xml @@ -9,26 +9,26 @@ -Introduction +Introdução -Devices in POSIX Systems are files in /dev directory. As with any files -in POSIX, they may be opened, closed, read from, written to, seeked, -ioctl'd, and others. +Dispositivos em sistemas POSIX são arquivos no diretório /dev. Como quaisquer +outros arquivos no POSIX, eles podem ser abertos, fechados, lidos, escritos, +posicionados, controlados, entre outros. -Examples of device files: +Exemplos de arquivos de dispositivos: -/dev/sda - A SCSI block device +/dev/sda - Um dispositivo de bloco SCSI -/dev/ttyS0 - A Serial terminal device +/dev/ttyS0 - Um dispositivo terminal serial @@ -36,11 +36,11 @@ Examples of device files: -POSIX I/O calls +Chamandas de Entrada e Saída em POSIX -POSIX systems have some standard calls for I/O. Since devices are files, -these same system calls are used to work with devices. We are gonna work -with the following calls: +Sistemas POSIX possuem algumas chamadas padrões para E/S. Já que dispositivos +são arquivos, essas mesmas chamadas são utilizadas para trabalhar com +dispositivos. Vamos trabalhar com as seguintes chamadas: @@ -67,19 +67,19 @@ ioctl open -The open system call opens a file. When working with devices, that's -when some initialization should be done. Some devices may be opened only -once at a time. +A chamada de systema open abre um arquivo. Quando estivermos trabalhando com +dispositivo, é quando alguma inicialização deve ser feita. Alguns dispositivos +só podem ser abertos por um processo de cada vez. int open (char * filename, int flags); -flags may be O\_RDONLY, O\_WRONLY, O\_RDWR and many others, some not -important for devices. +flags podem ser O\_RDONLY, O\_WRONLY, O\_RDWR e muitas outras, algumas menos +importantes para dispositivos. -Example: +Exemplo: fd = open ("/dev/ttyS0", O\_RDWR); @@ -89,13 +89,13 @@ fd = open ("/dev/ttyS0", O\_RDWR); close -The close system call closes an open file. +A chamada de sistema close fecha um arquivo aberto. int close (int fd); -Example: +Exemplo: close (fd); @@ -105,18 +105,18 @@ close (fd); read -The read system call reads data from an open file into a buffer. For -devices, it reads from the device. +A chamada de sistema read lê de um arquivo aberto para um buffer. Para +dispositivos, ela lê de um dispositivo. int read (int fd, char *buffer, int bsz); -Read returns the number of bytes written into the buffer, which may be -less than the number of bytes requested for any number of reasons. +read retorna o número de bytes escritos no buffer, que pode ser menor que o +número de bytes requisitados por diferentes razões. -Example: +Exemplo: c = read (fd, buffer, sizeof (buffer)); @@ -126,18 +126,18 @@ c = read (fd, buffer, sizeof (buffer)); write -The write system call writes data to an open file from a buffer. For -devices, it writes to the device. +A chamada de sistema write escreve dados de um buffer em um arquivo aberto. Para +dispositivos, ela escreve no dispositivo. int write (int fd, char *buffer, int bsz); -Write returns the number of bytes written to the file, which may be -less than the number of bytes requested for any number of reasons. +write retorna o número de bytes escritos no arquivo, que pode ser menor que o +número de bytes requisitados por diferentes razões. -Example: +Exemplo: c = write (fd, buffer, strlen (buffer)); @@ -147,20 +147,20 @@ c = write (fd, buffer, strlen (buffer)); lseek -The lseek system call changes the current position of the file, allowing -to read or write in that position. Seeking on a device may have many -different meanings. +A chamada de sistema lseek muda a posição corrente do arquivo, permitindo a +leitura ou escrita naquela posição. Posicionar em um dispositivo pode ter +diferentes significados. off\_t lseek (int fd, off\_t pos, int whence); -The meaning of the position depends on the value of whence, which can be -SEEK\_SET (the absolute position), SEEK\_CUR (relative to the current -position), SEEK\_END (relative to the end of the file). +O significado da posição depende do valor de whence, que pode ser +SEEK\_SET (a posição absoluta), SEEK\_CUR (relativa a posição corrente), +SEEK\_END (relativa ao fim do arquivo). -Example: +Exemplo: lseek (fd, 0, SEEK\_END); @@ -170,20 +170,20 @@ lseek (fd, 0, SEEK\_END); ioctl -The ioctl system call is a catch-all operation. For those operations -which doesn't fit in the read/write model, the ioctl allows the user to -send a command with an optional argument to the device. This command may -accept input or generate output. +A chamada de sistema ioctl é uma operação "pega-tudo". Para aquelas operações +que não se encaixam no modelo leitura/escrita, ioctl permite ao usuário enviar +um comando com um argumento opcional ao dispositivo. Esse comando pode aceitar +entrada ou gerar saída. int ioctl (int fd, int request, char *arg); -The last argument is optional and depends on the type of request. Every -device or device class may have its different set of ioctl's. +O último argumento é opcional e depende do tipo de requisição. Todo dispositivo +ou classe de dispositivo pode ter seu diferente conjunto de ioctl's. -Example: +Exemplo: struct ifreq req; ioctl (fd, SIOCGIFFLAGS, \&req); @@ -191,32 +191,33 @@ struct ifreq req; ioctl (fd, SIOCGIFFLAGS, \&req); -Linux Modules +Módulos do Linux -Linux is modularized. Drivers, filesystems, network protocols and others -may be loaded at runtime. Every module has an init and an exit -functions. +Linux é modularizado. Drivers, sistemas de arquivos, protocolos de rede e outros +podem ser carregados em tempo de execução. Todo módulos tem uma função init e +uma função exit. -Modules may have parameters. In load time, parameters, which may be -boolean, integers or strings, are given by the user. +Módulos podem ter parâmetros. Em tempo de carga, parâmetros, que podem ser +booleanos, inteiros ou strings, são dados pelo usuário. -Device types and numbers +Tipos e números de dispositivos -Linux devices may be of different types, including character devices, -block devices or network devices. Both character and block devices have -identifying numbers, a major and a minor number. +Dispositivos no Linux podem ter diferentes tipos, incluindo dispositivos de +caractere, dispositivos de bloco e dispositivos de rede. Tanto dispositivos de +caractere quanto de bloco têm números identificadores, um número maior e um +número menor. -Character devices allocation +Alocação de dispositivos de caractere -In Linux, major and minor numbers have to be requested or allocated. The -calls to do that for character devices are: +No Linux, números maior e menor devem ser requisitados ou alocados. As chamadas +para fazê-lo para os dispositivos de caractere são: int register\_chrdev\_region (dev\_t first, unsigned int count, char -- 2.20.1