1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>sys_flock</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Filesystems API"><link rel="up" href="file_locks.html" title="File Locks"><link rel="prev" href="API-fcntl-setlease.html" title="fcntl_setlease"><link rel="next" href="other_functions.html" title="Other Functions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">sys_flock</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-fcntl-setlease.html">Prev</a>&#160;</td><th width="60%" align="center">File Locks</th><td width="20%" align="right">&#160;<a accesskey="n" href="other_functions.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-sys-flock"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sys_flock &#8212; 
2     <code class="function">flock</code> system call.
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">long <b class="fsfunc">sys_flock </b>(</code></td><td>unsigned int <var class="pdparam">fd</var>, </td></tr><tr><td>&#160;</td><td>unsigned int <var class="pdparam">cmd</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1102104556"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>fd</code></em></span></dt><dd><p>
4     the file descriptor to lock.
5    </p></dd><dt><span class="term"><em class="parameter"><code>cmd</code></em></span></dt><dd><p>
6     the type of lock to apply.
7    </p></dd></dl></div></div><div class="refsect1"><a name="idp1102107132"></a><h2>Description</h2><p>
8   Apply a <code class="constant">FL_FLOCK</code> style lock to an open file descriptor.
9   The <em class="parameter"><code>cmd</code></em> can be one of
10   </p><p>
11
12   <code class="constant">LOCK_SH</code> -- a shared lock.
13   </p><p>
14
15   <code class="constant">LOCK_EX</code> -- an exclusive lock.
16   </p><p>
17
18   <code class="constant">LOCK_UN</code> -- remove an existing lock.
19   </p><p>
20
21   <code class="constant">LOCK_MAND</code> -- a `mandatory' flock.  This exists to emulate Windows Share Modes.
22   </p><p>
23
24   <code class="constant">LOCK_MAND</code> can be combined with <code class="constant">LOCK_READ</code> or <code class="constant">LOCK_WRITE</code> to allow other
25   processes read and write access respectively.
26</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-fcntl-setlease.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="file_locks.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="other_functions.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">fcntl_setlease</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Other Functions</td></tr></table></div></body></html>
27