<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Open &amp;amp; locking files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/open-amp-locking-files/m-p/4623234#M675899</link>
    <description>Hi Walter:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; where do I modify the code to put my filename that has this list of filenames?&lt;BR /&gt;&lt;BR /&gt;You don't have to modify anything,  Compile Laurent's code and redirect the file of your choice to be its input as he showed:&lt;BR /&gt;&lt;BR /&gt;# a.out &amp;lt; filenames&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Fri, 23 Apr 2010 22:16:33 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2010-04-23T22:16:33Z</dc:date>
    <item>
      <title>Open &amp; locking files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/open-amp-locking-files/m-p/4623230#M675895</link>
      <description>Hello, need a C program to open a file, read the list of filenmanes from the file, then loop to open each file and lock it.  We are testing the auto tune ability of the nflocks on the server.   Or is there another/better way to cause the nflocks to increase.  Needs to be C, because we have not other compiler. Any help would be great.</description>
      <pubDate>Fri, 23 Apr 2010 20:19:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/open-amp-locking-files/m-p/4623230#M675895</guid>
      <dc:creator>Walter K. Maul Jr.</dc:creator>
      <dc:date>2010-04-23T20:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Open &amp; locking files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/open-amp-locking-files/m-p/4623231#M675896</link>
      <description>#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;UNISTD.H&gt;&lt;BR /&gt;#include &lt;FCNTL.H&gt;&lt;BR /&gt;main()&lt;BR /&gt;{&lt;BR /&gt;  static char buf [8192];&lt;BR /&gt;  while(  scanf("%s",&amp;amp;buf)&amp;gt;0)&lt;BR /&gt;  {&lt;BR /&gt;      int f;&lt;BR /&gt;      f=open(buf,O_RDWR,0);&lt;BR /&gt;      if (f&amp;lt;0) { perror(buf); continue; }&lt;BR /&gt;      if (lockf(f,F_TLOCK,4096))&lt;BR /&gt;           printf("%s already locked\n",buf);&lt;BR /&gt;      else&lt;BR /&gt;           printf("%s  locked\n",buf);&lt;BR /&gt;  }&lt;BR /&gt;  sleep (100000);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;a.out &lt;/FCNTL.H&gt;&lt;/UNISTD.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Fri, 23 Apr 2010 21:30:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/open-amp-locking-files/m-p/4623231#M675896</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-04-23T21:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: Open &amp; locking files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/open-amp-locking-files/m-p/4623232#M675897</link>
      <description>How much do you know about C programming?&lt;BR /&gt;There is open(2) and fcntl(2) or lockf(2).&lt;BR /&gt;&lt;BR /&gt;You could use a script to read that file and put the files on the command line of your program:&lt;BR /&gt;lock-prog $(&amp;lt; file-list)&lt;BR /&gt;&lt;BR /&gt;Then just loop on argv and open and lock each file.&lt;BR /&gt;You can only open up to maxfiles_lim(5) so you will have to increase that kernel parm, or run multiple instances of your lock-prog.&lt;BR /&gt;&lt;BR /&gt;I suppose you could create a 1 Mb file and lock each byte separately and not need to open each file in your list.</description>
      <pubDate>Fri, 23 Apr 2010 21:30:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/open-amp-locking-files/m-p/4623232#M675897</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-04-23T21:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Open &amp; locking files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/open-amp-locking-files/m-p/4623233#M675898</link>
      <description>LM,&lt;BR /&gt;where do I modify the code to put my filename that has this list of filenames?  I am not a C programmer, I do understand a little of the code.&lt;BR /&gt;&lt;BR /&gt;Thanks again.</description>
      <pubDate>Fri, 23 Apr 2010 21:57:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/open-amp-locking-files/m-p/4623233#M675898</guid>
      <dc:creator>Walter K. Maul Jr.</dc:creator>
      <dc:date>2010-04-23T21:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Open &amp; locking files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/open-amp-locking-files/m-p/4623234#M675899</link>
      <description>Hi Walter:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; where do I modify the code to put my filename that has this list of filenames?&lt;BR /&gt;&lt;BR /&gt;You don't have to modify anything,  Compile Laurent's code and redirect the file of your choice to be its input as he showed:&lt;BR /&gt;&lt;BR /&gt;# a.out &amp;lt; filenames&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 23 Apr 2010 22:16:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/open-amp-locking-files/m-p/4623234#M675899</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-04-23T22:16:33Z</dc:date>
    </item>
  </channel>
</rss>

