.\" -*- coding: UTF-8 -*- .\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it) .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" Modified 2001-11-28, by Michael Kerrisk, .\" Changed data type of proj_id; minor fixes .\" aeb: further fixes; added notes. .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH FTOK 3 "11 abril 2020" GNU "Manual do Programador do Linux" .SH NOME ftok \- converte um caminho de diretório e um identificador de projeto para uma chave IPC System V .SH SINOPSE .nf \fB#include \fP \fB#include \fP .fi .PP \fBkey_t ftok(const char *\fP\fIpathname\fP\fB, int \fP\fIproj_id\fP\fB);\fP .SH DESCRIÇÃO The \fBftok\fP() function uses the identity of the file named by the given \fIpathname\fP (which must refer to an existing, accessible file) and the least significant 8 bits of \fIproj_id\fP (which must be nonzero) to generate a \fIkey_t\fP type System V IPC key, suitable for use with \fBmsgget\fP(2), \fBsemget\fP(2), or \fBshmget\fP(2). .PP The resulting value is the same for all pathnames that name the same file, when the same value of \fIproj_id\fP is used. The value returned should be different when the (simultaneously existing) files or the project IDs differ. .SH "VALOR DE RETORNO" On success, the generated \fIkey_t\fP value is returned. On failure \-1 is returned, with \fIerrno\fP indicating the error as for the \fBstat\fP(2) system call. .SH ATRIBUTOS Para uma explicação dos termos usados nesta seção, consulte \fBattributes\fP(7). .TS allbox; lb lb lb l l l. Interface Atributo Valor T{ \fBftok\fP() T} Thread safety MT\-Safe .TE .SH "DE ACORDO COM" POSIX.1\-2001, POSIX.1\-2008. .SH NOTAS On some ancient systems, the prototype was: .PP .in +4n .EX \fBkey_t ftok(char *\fP\fIpathname\fP\fB, char \fP\fIproj_id\fP\fB);\fP .EE .in .PP Today, \fIproj_id\fP is an \fIint\fP, but still only 8 bits are used. Typical usage has an ASCII character \fIproj_id\fP, that is why the behavior is said to be undefined when \fIproj_id\fP is zero. .PP Of course, no guarantee can be given that the resulting \fIkey_t\fP is unique. Typically, a best\-effort attempt combines the given \fIproj_id\fP byte, the lower 16 bits of the inode number, and the lower 8 bits of the device number into a 32\-bit result. Collisions may easily happen, for example between files on \fI/dev/hda1\fP and files on \fI/dev/sda1\fP. .SH EXEMPLOS Veja \fBsemget\fP(2). .SH "VEJA TAMBÉM" \fBmsgget\fP(2), \fBsemget\fP(2), \fBshmget\fP(2), \fBstat\fP(2), \fBsysvipc\fP(7) .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 Rubens de Jesus Nogueira e André Luiz Fassone . .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 .