1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Modified Fri Jan 31 16:26:07 1997 by Eric S. Raymond <esr@thyrsus.com>
26 .\" Modified Fri Dec 11 17:57:27 1998 by Jamie Lokier <jamie@imbolc.ucc.ie>
27 .\" Translated into German by Dennis Stampfer <kontakt@dstampfer.de>
29 .TH FLOCK 2 "28. August 2002" "" "Systemaufrufe"
31 flock \- sperrt und entsperrt Dateien
33 .B #include <sys/file.h>
35 .BR "int flock(int " fd ", int " operation );
37 flock sperrt oder entsperrt eine geöffnete Datei. Der Dateideskriptor wird
40 übergeben. Gültige Operationen sind:
45 Gemeinsames Sperren. Mehrere Prozesse können eine Datei zur selben Zeit sperren.
48 Alleiniges Sperren. Nur ein Prozess kann zu einer Zeit eine Datei sperren.
54 Die Operation blockiert nicht bis die Sperre gesetzt werden kann,
55 sondern übergibt die Kontrolle sofort wieder an das aufrufende Programm.
56 Diese Option kann durch Bitweises
58 mit anderen Operationen verknüpft werden.
62 Eine einzelne Datei kann nicht gleichzeitig gemeinsame und alleinige
65 Es ist nur die Datei (Inode) gesperrt,
67 aber der Dateideskriptor. Dadurch entstehen bei der Benutzung von
71 keine Mehrfachsperrungen.
73 Bei Erfolg gibt die Funktion 0 zurück. Bei Fehlern wird \-1 zurückgegeben und
79 Die Datei ist gesperrt und es ist
85 Aufruf ist erstmals in 4.2BSD zu finden).
88 funktioniert nicht über NFS. Benutzen Sie stattdessen
90 Das funktioniert auch über NFS, wenn eine hinreichend aktuelle Version
91 von Linux installiert ist und der Server Sperren unterstützt.
96 Sperrungen haben unterschiedliche Auswirkungen auf Prozesse, die
115 .IR /usr/src/linux/Documentation .