<?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: Error handling  for sem_open() API in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-for-sem-open-api/m-p/7186154#M495967</link>
    <description>&lt;P&gt;&amp;gt; [...] my team asking to add more error contions to that, like error&lt;BR /&gt;&amp;gt; handling&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; With my weak psychic powers, I don't know what sort of error handling&lt;BR /&gt;your team might like.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; According to the documentation, sem_open() sets errno when it fails.&lt;BR /&gt;You might do something to display or return that value.&lt;/P&gt;&lt;P&gt;&amp;gt; [...] (void *)-1 [...]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; "(sem_t *)(-1)" might be a little classier.&amp;nbsp; In some environments,&lt;BR /&gt;the macro SEM_FAILED is defined, so you wouldn't need to worry so much&lt;BR /&gt;about the implementation.&lt;/P&gt;&lt;P&gt;&amp;gt; FYI(FYI_FATAL,"sem_open() failed %s\n",__FUNCTION__);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Also, if I see a message like "sem_open() failed", I'd like to know&lt;BR /&gt;_what_, exactly, it was trying to open. In this case, sem_path.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Apr 2023 02:30:41 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2023-04-11T02:30:41Z</dc:date>
    <item>
      <title>Error handling  for sem_open() API</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-for-sem-open-api/m-p/7186107#M495966</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I have written the wrapper function for sem_open() based on my requirent , but my team asking to add more error contions to that, like error handling&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attching the sample code, I had written,Can you please help on this code how to handling error or return values&amp;nbsp;&lt;/P&gt;&lt;P&gt;sem_t *sem;&lt;BR /&gt;sem = sem_open(sem_path, flag, mode, value);&lt;BR /&gt;if (sem == (void *)-1) {&lt;BR /&gt;FYI(FYI_FATAL,"sem_open() failed %s\n",__FUNCTION__);&lt;BR /&gt;}&lt;BR /&gt;return sem;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 03:18:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-for-sem-open-api/m-p/7186107#M495966</guid>
      <dc:creator>meghana9490</dc:creator>
      <dc:date>2023-04-11T03:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling  for sem_open() API</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-for-sem-open-api/m-p/7186154#M495967</link>
      <description>&lt;P&gt;&amp;gt; [...] my team asking to add more error contions to that, like error&lt;BR /&gt;&amp;gt; handling&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; With my weak psychic powers, I don't know what sort of error handling&lt;BR /&gt;your team might like.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; According to the documentation, sem_open() sets errno when it fails.&lt;BR /&gt;You might do something to display or return that value.&lt;/P&gt;&lt;P&gt;&amp;gt; [...] (void *)-1 [...]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; "(sem_t *)(-1)" might be a little classier.&amp;nbsp; In some environments,&lt;BR /&gt;the macro SEM_FAILED is defined, so you wouldn't need to worry so much&lt;BR /&gt;about the implementation.&lt;/P&gt;&lt;P&gt;&amp;gt; FYI(FYI_FATAL,"sem_open() failed %s\n",__FUNCTION__);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Also, if I see a message like "sem_open() failed", I'd like to know&lt;BR /&gt;_what_, exactly, it was trying to open. In this case, sem_path.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 02:30:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-for-sem-open-api/m-p/7186154#M495967</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2023-04-11T02:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling  for sem_open() API</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-for-sem-open-api/m-p/7186166#M495968</link>
      <description>&lt;PRE&gt;   &lt;STRONG&gt;EACCES &lt;/STRONG&gt;The semaphore exists, but the caller does not have
              permission to open it.

       &lt;STRONG&gt;EEXIST &lt;/STRONG&gt;Both &lt;STRONG&gt;O_CREAT &lt;/STRONG&gt;and &lt;STRONG&gt;O_EXCL &lt;/STRONG&gt;were specified in &lt;I&gt;oflag&lt;/I&gt;, but a
              semaphore with this &lt;I&gt;name&lt;/I&gt; already exists.

       &lt;STRONG&gt;EINVAL &lt;/STRONG&gt;&lt;I&gt;value&lt;/I&gt; was greater than &lt;STRONG&gt;SEM_VALUE_MAX&lt;/STRONG&gt;.

       &lt;STRONG&gt;EINVAL &lt;/STRONG&gt;&lt;I&gt;name&lt;/I&gt; consists of just "/", followed by no other
              characters.

       &lt;STRONG&gt;EMFILE &lt;/STRONG&gt;The per-process limit on the number of open file
              descriptors has been reached.

       &lt;STRONG&gt;ENAMETOOLONG&lt;/STRONG&gt;
              &lt;I&gt;name&lt;/I&gt; was too long.

       &lt;STRONG&gt;ENFILE &lt;/STRONG&gt;The system-wide limit on the total number of open files
              has been reached.

       &lt;STRONG&gt;ENOENT &lt;/STRONG&gt;The &lt;STRONG&gt;O_CREAT &lt;/STRONG&gt;flag was not specified in &lt;I&gt;oflag&lt;/I&gt; and no
              semaphore with this &lt;I&gt;name&lt;/I&gt; exists; or, &lt;STRONG&gt;O_CREAT &lt;/STRONG&gt;was
              specified, but &lt;I&gt;name&lt;/I&gt; wasn't well formed.

       &lt;STRONG&gt;ENOMEM &lt;/STRONG&gt;Insufficient memory.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;These are the error condifion , So i need implement those error contions&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Apr 2023 06:11:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-for-sem-open-api/m-p/7186166#M495968</guid>
      <dc:creator>meghana9490</dc:creator>
      <dc:date>2023-04-11T06:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling  for sem_open() API</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-for-sem-open-api/m-p/7186186#M495969</link>
      <description>&lt;P&gt;&amp;gt; These are the error condifion , [...]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Thanks, but I had already seen the sem_open "man" page.&lt;/P&gt;&lt;P&gt;&amp;gt; [...] So i need implement those error contions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I don't know what that means to you,&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; With my weak psychic powers, I don't know what sort of error handling&lt;BR /&gt;&amp;gt; your team might like.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Still true.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 11:34:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-for-sem-open-api/m-p/7186186#M495969</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2023-04-11T11:34:42Z</dc:date>
    </item>
  </channel>
</rss>

