<?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: 2 program writing to same file in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584138#M103720</link>
    <description>Check fcntl()</description>
    <pubDate>Mon, 18 Jul 2005 00:50:40 GMT</pubDate>
    <dc:creator>Bejoy C Alias</dc:creator>
    <dc:date>2005-07-18T00:50:40Z</dc:date>
    <item>
      <title>2 program writing to same file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584135#M103717</link>
      <description>Hi Guys,&lt;BR /&gt;&lt;BR /&gt;  I have 2 programs written in C in my process that needs to write to a log file, can I know how I can facilitate these programs so that no contention occurs?&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;Henry</description>
      <pubDate>Sun, 17 Jul 2005 18:20:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584135#M103717</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2005-07-17T18:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: 2 program writing to same file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584136#M103718</link>
      <description>This is one of the basic problems.&lt;BR /&gt;&lt;BR /&gt;Gather some information about Semaphores.</description>
      <pubDate>Sun, 17 Jul 2005 21:36:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584136#M103718</guid>
      <dc:creator>Vibhor Kumar Agarwal</dc:creator>
      <dc:date>2005-07-17T21:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: 2 program writing to same file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584137#M103719</link>
      <description>One option is you create a LOCK file.&lt;BR /&gt;When ever a program writes to the log file it creates a LOCK file and so that the other program waits till it sees the LOCK file is no more there and then writes back and once done it removes the LOCK file.&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Rajeev&lt;BR /&gt;</description>
      <pubDate>Sun, 17 Jul 2005 21:53:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584137#M103719</guid>
      <dc:creator>Rajeev  Shukla</dc:creator>
      <dc:date>2005-07-17T21:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: 2 program writing to same file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584138#M103720</link>
      <description>Check fcntl()</description>
      <pubDate>Mon, 18 Jul 2005 00:50:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584138#M103720</guid>
      <dc:creator>Bejoy C Alias</dc:creator>
      <dc:date>2005-07-18T00:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: 2 program writing to same file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584139#M103721</link>
      <description>Your IPC programs must device some sort of locking to avoid race conditions.&lt;BR /&gt;Advisory locking is quite often done through the fcntl() syscall (see manpage),&lt;BR /&gt;or the flock() function in Perl.&lt;BR /&gt;As the term advisory implies this only works if your processes obey the locks at all.</description>
      <pubDate>Mon, 18 Jul 2005 01:05:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584139#M103721</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2005-07-18T01:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: 2 program writing to same file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584140#M103722</link>
      <description>You have to use file locking with fcntl() call. It will control this problem. When one process is trying then next process will check what is the status of log file (is it writable or not). If get the access starts to access it.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Mon, 18 Jul 2005 02:05:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584140#M103722</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-07-18T02:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: 2 program writing to same file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584141#M103723</link>
      <description>fcntl() is obviously a better option but the simple aproach of using a lock file is better implimented by creating a directory instead of a file as the create and test for existance can be implimented as a single call and more efficient that using something like open() with the appropriate options.&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Jul 2005 16:30:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/2-program-writing-to-same-file/m-p/3584141#M103723</guid>
      <dc:creator>Daavid Turnbull</dc:creator>
      <dc:date>2005-07-19T16:30:26Z</dc:date>
    </item>
  </channel>
</rss>

