<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi all,<div><br></div><div>I was adding another semaphore to my code and decided to test the semaphore create failure case first. I added the create without incrementing the maximum number of semaphores that was configured. The create succeeded rather than failed.<div><br></div><div>I created 4 semaphores with the maximum set to 3. All returned rtems_status_code == 0. I set the maximum to 2, same. I set the maximum to 1, same. I set the maximum to 0, same result.</div><div><br></div><div>This is running on an Axiom CML5282 using RTEMS 4.9.4 and a BSP that is heavily based on the AV5282 and UC5282 BSPs.</div><div><br></div><div>Any ideas?</div><div><br></div><div><br></div><div><br></div><div>I started stripping out code until my program generates this:</div><div><br></div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(80, 143, 115); "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">create sem1 semaphore returned with 0</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">create sem2 semaphore returned with 0</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">create sem3 semaphore returned with 0</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">create sem4 semaphore returned with 0</div><div><br></div><div><br></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">From this (only comments have been removed):</span></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><br></span></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><br></span></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(66, 60, 252); "><span style="color: rgb(145, 28, 103); ">#include</span><span style="color: rgb(0, 0, 0); "> </span><rtems.h></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">rtems_task Init(rtems_task_argument ignored);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(145, 28, 103); ">#include<span style="color: rgb(0, 0, 0); "> </span><span style="color: rgb(66, 60, 252); "><bsp.h></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><font class="Apple-style-span" color="#508F73"><font class="Apple-style-span" color="#000000"><br></font></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: rgb(145, 28, 103); ">#define</span> CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: rgb(145, 28, 103); ">#define</span> CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(80, 143, 115); "><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><span style="color: rgb(145, 28, 103); ">#define</span> CONFIGURE_MAXIMUM_TASKS<span class="Apple-tab-span" style="white-space: pre; "> </span>1</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span style="color: rgb(145, 28, 103); ">#define</span> CONFIGURE_MAXIMUM_MESSAGE_QUEUES<span class="Apple-tab-span" style="white-space: pre; "> </span>0</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(80, 143, 115); "><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><span style="color: rgb(145, 28, 103); ">#define</span> CONFIGURE_MAXIMUM_SEMAPHORES<span class="Apple-tab-span" style="white-space: pre; "> </span>0</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(80, 143, 115); "><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><span style="color: rgb(145, 28, 103); ">#define</span> CONFIGURE_MAXIMUM_TIMERS<span class="Apple-tab-span" style="white-space: pre; "> </span>0</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span style="color: rgb(145, 28, 103); ">#define</span> CONFIGURE_MAXIMUM_PARTITIONS<span class="Apple-tab-span" style="white-space: pre; "> </span>0</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span style="color: rgb(145, 28, 103); ">#define</span> CONFIGURE_MAXIMUM_DRIVERS<span class="Apple-tab-span" style="white-space: pre; "> </span>20</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: rgb(145, 28, 103); ">#define</span> STACK_CHECKER_ON</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: rgb(145, 28, 103); ">#define</span> CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: rgb(145, 28, 103); ">#define</span> CONFIGURE_RTEMS_INIT_TASKS_TABLE</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: rgb(145, 28, 103); ">#define</span> CONFIGURE_INIT</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(66, 60, 252); "><span style="color: rgb(145, 28, 103); ">#include</span><span style="color: rgb(0, 0, 0); "> </span><rtems/confdefs.h></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(80, 143, 115); "><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><span style="color: rgb(145, 28, 103); ">static</span> rtems_id sem1;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: rgb(145, 28, 103); ">static</span> rtems_id sem2;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: rgb(145, 28, 103); ">static</span> rtems_id sem3;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: rgb(145, 28, 103); ">static</span> rtems_id sem4;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(80, 143, 115); "><span class="Apple-style-span" style="color: rgb(0, 0, 0); ">rtems_task Init(rtems_task_argument ignored) {</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(80, 143, 115); "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#508F73"><br></font></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>rtems_status_code status;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(80, 143, 115); "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#508F73"><br></font></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>status = rtems_semaphore_create( rtems_build_name(<span style="color: rgb(66, 60, 252); ">'S'</span>,<span style="color: rgb(66, 60, 252); ">'E'</span>,<span style="color: rgb(66, 60, 252); ">'M'</span>,<span style="color: rgb(66, 60, 252); ">'1'</span>),</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>1,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>0,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>&sem1);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(66, 60, 252); "><span style="color: rgb(0, 0, 0); "><span class="Apple-tab-span" style="white-space: pre; "> </span>printk(</span>"create sem1 semaphore returned with %d\n"<span style="color: rgb(0, 0, 0); ">, status);</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>status = rtems_semaphore_create( rtems_build_name(<span style="color: rgb(66, 60, 252); ">'S'</span>,<span style="color: rgb(66, 60, 252); ">'E'</span>,<span style="color: rgb(66, 60, 252); ">'M'</span>,<span style="color: rgb(66, 60, 252); ">'2'</span>),</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>1,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>0,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>&sem2);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(66, 60, 252); "><span style="color: rgb(0, 0, 0); "><span class="Apple-tab-span" style="white-space: pre; "> </span>printk(</span>"create sem2 semaphore returned with %d\n"<span style="color: rgb(0, 0, 0); ">, status);</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>status = rtems_semaphore_create( rtems_build_name(<span style="color: rgb(66, 60, 252); ">'S'</span>,<span style="color: rgb(66, 60, 252); ">'E'</span>,<span style="color: rgb(66, 60, 252); ">'M'</span>,<span style="color: rgb(66, 60, 252); ">'3'</span>),</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>1,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>0,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>&sem3);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(66, 60, 252); "><span style="color: rgb(0, 0, 0); "><span class="Apple-tab-span" style="white-space: pre; "> </span>printk(</span>"create sem3 semaphore returned with %d\n"<span style="color: rgb(0, 0, 0); ">, status);</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>status = rtems_semaphore_create( rtems_build_name(<span style="color: rgb(66, 60, 252); ">'S'</span>,<span style="color: rgb(66, 60, 252); ">'E'</span>,<span style="color: rgb(66, 60, 252); ">'M'</span>,<span style="color: rgb(66, 60, 252); ">'4'</span>),</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>1,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>0,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>&sem4);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(66, 60, 252); "><span style="color: rgb(0, 0, 0); "><span class="Apple-tab-span" style="white-space: pre; "> </span>printk(</span>"create sem4 semaphore returned with %d\n"<span style="color: rgb(0, 0, 0); ">, status);</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>status = rtems_task_delete( RTEMS_SELF);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; "> </span>exit(0);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><font class="Apple-style-span" color="#508F73"><font class="Apple-style-span" color="#000000"><br></font></font></div></span></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(80, 143, 115); "><span class="Apple-style-span" style="color: rgb(66, 60, 252); "><span style="color: rgb(145, 28, 103); "><br></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(80, 143, 115); "><font class="Apple-style-span" color="#000000" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#911C67" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></span></font></div></div></div></body></html>