sched/scheduler.c
/**************************************************************************
 * Name:
 *  sched_find_opened_resource
 *
 * Description:
 *  Search for an opened resource with specified fd number in the current tcb.
 *
 * Assumptions:
 *  Call this function with pre-emption disabled.
 *
 * Return Value:
 *  The opened container resource or NULL in case we are running out of memory.
 *
 *************************************************************************/


Search for an opened resource with specified fd number in the current tcb.

Call this function with pre-emption disabled.

Return Value:
The opened container resource or NULL in case we are running out of memory.
Search for an opened resource with specified fd number in the current tcb . Call this function with pre - emption disabled . Return Value : The opened container resource or NULL in case we are running out of memory .
struct opened_resource_s *sched_find_opened_resource(int fd)
{
  struct tcb_s *curr_tcb = sched_get_current_task();
  assert(curr_tcb->curr_resource_opened >= 0);
  struct opened_resource_s *resource = NULL;
  list_for_each_entry(resource, &curr_tcb->opened_resource, node)
  {
    if (resource && resource->fd == fd) {
      return resource;
    }
  }
  return NULL;
}
struct opened_resource_s * sched_find_opened_resource ( int fd ) { struct tcb_s * curr_tcb = sched_get_current_task ( ) ; assert ( curr_tcb -> curr_resource_opened >= 0 ) ; struct opened_resource_s * resource = NULL ; list_for_each_entry ( resource , & curr_tcb -> opened_resource , node ) { if ( resource && resource -> fd == fd ) { return resource ; } } return NULL ; }
Name:
  sched_find_opened_resource
Name : sched_find_opened_resource