<?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 How to tell IF a file is opened by a process using C code in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359062#M713089</link>
    <description>Does anyone know how to do this or have an example in C on how to do this? I want to make sure a file is not opened by a process before I do something with it.&lt;BR /&gt;This is on an HPUX 11i OS.&lt;BR /&gt;Thanks</description>
    <pubDate>Tue, 17 Aug 2004 11:54:30 GMT</pubDate>
    <dc:creator>Dan Deck</dc:creator>
    <dc:date>2004-08-17T11:54:30Z</dc:date>
    <item>
      <title>How to tell IF a file is opened by a process using C code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359062#M713089</link>
      <description>Does anyone know how to do this or have an example in C on how to do this? I want to make sure a file is not opened by a process before I do something with it.&lt;BR /&gt;This is on an HPUX 11i OS.&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 17 Aug 2004 11:54:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359062#M713089</guid>
      <dc:creator>Dan Deck</dc:creator>
      <dc:date>2004-08-17T11:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to tell IF a file is opened by a process using C code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359063#M713090</link>
      <description>I believe you could use fcntl() call to find out the status of the file. &lt;BR /&gt;&lt;BR /&gt;# man 2 fcntl&lt;BR /&gt;&lt;BR /&gt;# man 5 fnctl</description>
      <pubDate>Tue, 17 Aug 2004 12:07:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359063#M713090</guid>
      <dc:creator>Sundar_7</dc:creator>
      <dc:date>2004-08-17T12:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to tell IF a file is opened by a process using C code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359064#M713091</link>
      <description>Do you know of any example code that would demonstrate this?</description>
      <pubDate>Tue, 17 Aug 2004 15:06:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359064#M713091</guid>
      <dc:creator>Dan Deck</dc:creator>
      <dc:date>2004-08-17T15:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to tell IF a file is opened by a process using C code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359065#M713092</link>
      <description>From UNIX programming FAQ at &lt;A href="http://www.faqs.org/faqs/unix-faq/programmer/faq/" target="_blank"&gt;http://www.faqs.org/faqs/unix-faq/programmer/faq/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;2.4 How can I find out if someone else has a file open?&lt;BR /&gt;=======================================================&lt;BR /&gt;&lt;BR /&gt;This is another candidate for `Frequently Unanswered Questions' because, in&lt;BR /&gt;general, your program should never be interested in whether someone else&lt;BR /&gt;has the file open.  If you need to deal with concurrent access to the file,&lt;BR /&gt;then you should be looking at advisory locking.&lt;BR /&gt;&lt;BR /&gt;This is, in general, too hard to do anyway. Tools like `fuser' and `lsof'&lt;BR /&gt;that find out about open files do so by grovelling through kernel data&lt;BR /&gt;structures in a most unhealthy fashion. You can't usefully invoke them from&lt;BR /&gt;a program, either, because by the time you've found out that the file&lt;BR /&gt;is/isn't open, the information may already be out of date.</description>
      <pubDate>Wed, 18 Aug 2004 00:01:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359065#M713092</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2004-08-18T00:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to tell IF a file is opened by a process using C code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359066#M713093</link>
      <description>fcntl implements advisory locking mechanism that can be used only if all processes accessing a file use this method.</description>
      <pubDate>Wed, 18 Aug 2004 00:49:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359066#M713093</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2004-08-18T00:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to tell IF a file is opened by a process using C code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359067#M713094</link>
      <description>Here is a program that will report pids that have particular files open.  It uses pstat_getproc and pstat_getfile.</description>
      <pubDate>Wed, 18 Aug 2004 16:40:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-tell-if-a-file-is-opened-by-a-process-using-c-code/m-p/3359067#M713094</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2004-08-18T16:40:32Z</dc:date>
    </item>
  </channel>
</rss>

