.\" -*- nroff -*- .\" .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) .\" .\" 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. .\" .\" Modified Fri Jan 31 16:26:07 1997 by Eric S. Raymond .\" Modified Fri Dec 11 17:57:27 1998 by Jamie Lokier .\" .TH FLOCK 2 "11/12/1998" Linux "Manual do Programador Linux" .SH NOME flock \- aplica ou remove uma trava consultiva em um arquivo aberto .SH SINOPSE .B #include .sp .BR "int flock(int " fd ", int " operation ) .SH DESCRIÇÃO Aplica ou remove uma trava consultiva em um arquivo aberto. O arquivo especificado por .IR fd . As opereções válidas são fornecidas abaixo: .RS .sp .TP 1.0i LOCK_SH Trava compartilhada. Mais que um processo pode influênciar influenciar uma trava compartilhada para um arquivo fornecido em um dado tempo. .TP LOCK_EX Trava exclusiva. Somente um processo pode influênciar um trava exclusiva para um arquivo fornecido em um dado tempo. .TP LOCK_UN Destrava. .TP LOCK_NB Não bloqueia quando travado. Pode ser expecificado (por .IR ou 'ing) junto com uma das outra operações. .sp .RE Um arquivo não pode simultâneamente ter ambos tipos de trava: compartilhada e exclusiva. Um arquivo é travado (quer dizer, o inode), .I não é o descritor de arquivos. Assim, .BR dup (2) e .BR fork (2) não cria multiplas instâncias de uma trava. .SH "VALORES RETORNADOS" Em caso de sucesso, zero é retornado. Caso contrário, \-1 é retornado, e .I errno é selecionado adequadamente. .SH ERROS .TP .B EWOULDBLOCK O arquivo esta travado e o sinalizador .B LOCK_NB foi selecionado. .SH "DE ACORDO COM" 4.4BSD (a chamada .BR flock (2) apareceu primeiramente no BSD 4.2). .SH NOTAS .BR flock (2) não trava arquivos via NFS. Use .BR fcntl (2) : que pode trabalhar via NFS, fornecendo uma versão suficientemente recente do Linux e um servidor que suporta travamentos de arquivos. .PP .BR flock (2) e .BR fcntl (2) tem semânticas diferentes com respeito para processos ramificados e .BR dup (2). .SH "VEJA TAMBÉM" .BR open (2), .BR close (2), .BR dup (2), .BR execve (2), .BR fcntl (2), .BR fork (2), .BR lockf (3). Além disso .I locks.txt e .I mandatory.txt em .IR /usr/src/linux/Documentation . .SH TRADUZIDO POR LDP-BR em 21/08/2000. \&\fR\&\f(CWAndré L. Fassone Canova (tradução)\fR \&\fR\&\f(CWxxxxxxxxxxxxxxxxxxxxxxxxx (revisão)\fR