Skip to contentSkip to conversation

Bug when closing a busy file descriptor.

Xenomai-core Gilles Chanteperdrix 2 participants 2 messages Jun 6, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

there is a bug when closing a busy file descriptor: the close function keeps incrementing the file descriptor reference count making it impossible to really close the file descriptor.

The attached patch fixes this.

Signature · 1 line
                                                 Gilles Chanteperdrix
skins/rtdm/core.c +2 -0
Index: ksrc/skins/rtdm/core.c
===================================================================
@@ -340,6 +340,7 @@
     XENO_ASSERT(RTDM, !rthal_local_irq_test(), rthal_local_irq_enable(););
 
     if (unlikely(ret == -EAGAIN) && !rtdm_in_rt_context()) {
+	rtdm_context_unlock(context);
         msleep(CLOSURE_RETRY_PERIOD);
         goto again;
     } else if (unlikely(ret < 0))
@@ -354,6 +355,7 @@
             ret = -EAGAIN;
             goto unlock_out;
         }
+	rtdm_context_unlock(context);
         msleep(CLOSURE_RETRY_PERIOD);
         goto again;
     }
#1 lore raw
Quoted 8 lines · Gilles Chanteperdrix

Hi,

there is a bug when closing a busy file descriptor: the close function keeps incrementing the file descriptor reference count making it impossible to really close the file descriptor.

The attached patch fixes this.

Yep. Applied, thanks.

Jan