File: flock.2

package info (click to toggle)
manpages-pt 20040726-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,988 kB
  • sloc: sh: 45; makefile: 16
file content (111 lines) | stat: -rw-r--r-- 3,373 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
.\" -*- 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 <esr@thyrsus.com>
.\" Modified Fri Dec 11 17:57:27 1998 by Jamie Lokier <jamie@imbolc.ucc.ie>
.\"
.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 <sys/file.h>
.sp
.BR "int flock(int " fd ", int " operation )
.SH DESCRIO
Aplica ou remove uma trava consultiva em um arquivo aberto. O arquivo especificado por
.IR fd .
As operees vlidas so fornecidas abaixo:
.RS
.sp
.TP 1.0i
LOCK_SH
Trava compartilhada. Mais que um processo pode influnciar influenciar uma trava compartilhada para um arquivo
fornecido em um dado tempo.
.TP
LOCK_EX
Trava exclusiva. Somente um processo pode influnciar um trava exclusiva para um arquivo fornecido
em um dado tempo.
.TP
LOCK_UN
Destrava.
.TP
LOCK_NB
No bloqueia quando travado. Pode ser expecificado (por
.IR ou 'ing)
junto com uma das outra operaes.
.sp
.RE

Um arquivo no pode simultneamente ter ambos tipos de trava: compartilhada e exclusiva.

Um arquivo  travado (quer dizer, o inode),
.I no
 o descritor de arquivos. Assim,
.BR dup (2)
e
.BR fork (2)
no cria multiplas instncias de uma trava.
.SH "VALORES RETORNADOS"
Em caso de sucesso, zero  retornado. Caso contrrio, \-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)
no trava arquivos via NFS. Use
.BR fcntl (2)
: que pode trabalhar via NFS, fornecendo uma verso suficientemente recente do
Linux e um servidor que suporta travamentos de arquivos.
.PP
.BR flock (2)
e
.BR fcntl (2)
tem semnticas diferentes com respeito para processos ramificados e
.BR dup (2).
.SH "VEJA TAMBM"
.BR open (2),
.BR close (2),
.BR dup (2),
.BR execve (2),
.BR fcntl (2),
.BR fork (2),
.BR lockf (3).
Alm 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 <lonelywolf@blv.com.br> (traduo)\fR
\&\fR\&\f(CWxxxxxxxxxxxxxxxxxxxxxxxxx <xxx@xxxxxx.xxx.xx> (reviso)\fR