RTEMS Event Receive Issue

Till Straumann strauman at SLAC.Stanford.EDU
Mon Feb 10 18:52:58 UTC 2003


I had a look at this when it was first reported and
I agree with Mike. His proposed fix looks good to me.

-- Till

Mike Siers wrote:
> Hi All,
> Attached is a small patch to the network daemon task
> code.  I just added code to check the return value of
> the rtems_bsdnet_event_receive function.  Only when
> this function returns a SUCCESSFUL status, will the
> event flags be checked.  
> 
> This is more of a code cleanup issue than a bug.  The 
> patch will just ensure the ipintr() and arpintr() 
> functions are only called when a event is signaled.
> 
> Please review and let me know if you think this is
> the correct fix.  The rtems_glue.c file is in the
> cpukit/libnetworking/rtems directory.
> 
> Thanks
> Mike Siers
> 
> 
> --- rtems_glue.c	Fri Nov  1 12:43:57 2002
> +++ rtems_glue.new	Mon Feb 10 10:09:51 2003
> @@ -493,6 +493,7 @@
>  static void
>  networkDaemon (void *task_argument)
>  {
> +	rtems_status_code sc;
>  	rtems_event_set events;
>  	rtems_interval now;
>  	int ticksPassed;
> @@ -505,14 +506,18 @@
>  			timeout = c->c_time;
>  		else
>  			timeout = RTEMS_NO_TIMEOUT;
> -		rtems_bsdnet_event_receive (NETISR_EVENTS,
> +
> +		sc = rtems_bsdnet_event_receive (NETISR_EVENTS,
>  						RTEMS_EVENT_ANY | RTEMS_WAIT,
>  						timeout,
>  						&events);
> -		if (events & NETISR_IP_EVENT)
> -			ipintr ();
> -		if (events & NETISR_ARP_EVENT)
> -			arpintr ();
> +		if ( sc == RTEMS_SUCCESSFUL ) {
> +			if (events & NETISR_IP_EVENT)
> +				ipintr ();
> +			if (events & NETISR_ARP_EVENT)
> +				arpintr ();
> +		}
> +
>  		rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now);
>  		ticksPassed = now - ticksWhenCalloutsLastChecked;
>  		if (ticksPassed != 0) {
> 






More information about the users mailing list