utils/unistd.c
/**************************************************************************
 * Name:
 *  read
 *
 * Description:
 *  Read up to count bytes in the buffer pointed by buf, from an opened resource
 *  identified by fd.
 *
 * Return Value:
 *  The number of bytes read or a negative value in case of error.
 *
 *************************************************************************/
read

Read up to count bytes in the buffer pointed by buf, from an opened resource
identified by fd.

Return Value:
The number of bytes read or a negative value in case of error.
read Read up to count bytes in the buffer pointed by buf from an opened resource identified by fd . Return Value : The number of bytes read or a negative value in case of error .
ssize_t read(int fd, void *buf, size_t count)
{
  irq_state_t irq_state = cpu_disableint();
  struct opened_resource_s *res = sched_find_opened_resource(fd);
  cpu_enableint(irq_state);
  if (res == NULL) {
    return -EINVAL;
  }
  if (!res->vfs_node->ops || !res->vfs_node->ops->read) {
    return -ENOSYS;
  }
  return res->vfs_node->ops->read(res, buf, count);
}
ssize_t read ( int fd , void * buf , size_t count ) { irq_state_t irq_state = cpu_disableint ( ) ; struct opened_resource_s * res = sched_find_opened_resource ( fd ) ; cpu_enableint ( irq_state ) ; if ( res == NULL ) { return - EINVAL ; } if ( ! res -> vfs_node -> ops || ! res -> vfs_node -> ops -> read ) { return - ENOSYS ; } return res -> vfs_node -> ops -> read ( res , buf , count ) ; }
Name:
  read
Name : read