<pre><span style="font-family:arial,helvetica,sans-serif;background-color:rgb(255,255,255)"><font color="#333333">Hi,</font></span></pre><pre><font color="#333333" style="background-color:rgb(255,255,255)"><span style="font-family:arial,helvetica,sans-serif;font-size:13px;white-space:normal">Solaris build was failing due to missing </span><span style="font-family:arial,helvetica,sans-serif;font-size:13px;white-space:normal">flock</span><span style="font-family:arial,helvetica,sans-serif;font-size:13px;white-space:normal"> function. In Solaris there is another equivalent function named </span><span style="font-family:arial,helvetica,sans-serif;font-size:13px;white-space:normal"><span class="il">lockf</span></span><span style="font-family:arial,helvetica,sans-serif;font-size:13px;white-space:normal">. </span><span style="font-family:arial,helvetica,sans-serif;font-size:13px;white-space:normal">Looking at the man pages of flock and </span><span class="il" style="font-family:arial,helvetica,sans-serif;font-size:13px;white-space:normal">lockf</span><span style="font-family:arial,helvetica,sans-serif;font-size:13px;white-space:normal">, they are implemented somewhat differently on Linux</span><span style="font-family:arial,helvetica,sans-serif;font-size:13px;white-space:normal">.</span></font></pre>
<font face="arial, helvetica, sans-serif" color="#333333" style="background-color:rgb(255,255,255)"><span class="il" style="font-size:13px">The lockf</span><span style="font-size:13px">() only works if the file descriptor was opened for write access. The call to </span><span class="il" style="font-size:13px">lockf</span><span style="font-size:13px">( ) should work from within pool_add_table_oid_map( ) because in that case, the file is opened with O_RDWR. </span><span style="font-size:13px">But the call from pool_invalidate_query_cache() will fail because that file is opened with O_RDONLY.</span><br style="font-size:13px">
<br style="font-size:13px"></font><pre><span style="font-size:13px;white-space:normal;background-color:rgb(255,255,255)"><font face="arial, helvetica, sans-serif" color="#333333">In my opinion we should use fcntl function instead of lockf and flock. I have attached a patch please review.</font></span></pre>
<pre><font color="#333333" style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif"><br></font></pre><pre><font color="#333333" style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif">--ibrar</font></pre>
<pre><font color="#333333" style="background-color:rgb(255,255,255)"><br></font></pre><pre>><i> I have the same problem on Solaris 10 x86, it seems to be a global problem with pgpool 3.2 on Solaris platforms, because there is no flock functions on Solaris, but only in "BSD Compatibility Library Functions" (/usr/ucblib/libucb.a)</i></pre>
<pre>><i>
</i>><i> According to the manual of flock:
</i>><i> "Use of these interfaces should be restricted to only appli-
</i>><i> cations written on BSD platforms. Use of these interfaces
</i>><i> with any of the system libraries or in multi-thread applica-
</i>><i> tions is unsupported."
</i>><i>
</i>><i> Afaik the right solutions of file locking in Solaris is to use lockf(3C) function <a href="http://www.s-gms.ms.edus.si/cgi-bin/man-cgi?lockf+3C">http://www.s-gms.ms.edus.si/cgi-bin/man-cgi?lockf+3C</a>
</i>
> Anybody volunteers to write a patch using lockf() for Solaris?
<br></pre>