RTEMS Logo

RTEMS 4.10.0 On-Line Library


fstat

PREV UP NEXT Bookshelf RTEMS Filesystem Design Guide

4.13: fstat

File:

fstat.c

Processing:

This routine will return information concerning a file or network connection. If the file descriptor is associated with a network connection, the current implementation of fstat() will return a mode set to S_IFSOCK. In a later version, this routine will map the status of a network connection to an external handler routine.

If the file descriptor is associated with a node under a filesystem, the fstat() routine will map to the fstat() function taken from the node handler table.

Development Comments:

This routine validates that the struct stat pointer is not NULL so that the return location is valid.

The struct stat is then initialized to all zeros.

rtems_file_descriptor_type() is then used to determine if the file descriptor is associated with a network connection. If it is, network status processing is performed. In the current implementation, the file descriptor type processing needs to be improved. It currently just drops into the normal processing for file system nodes.

If the file descriptor is associated with a node under a filesystem, the following steps are performed:

  1. Obtain the file control block that is associated with the file descriptor index.
  2. Range check the file descriptor index.
  3. Test to see if there is a non-NULL function pointer in the handler table for the fstat() function. If there is, invoke the function with the file control block and the pointer to the stat structure.


PREV UP NEXT Bookshelf RTEMS Filesystem Design Guide

Copyright © 1988-2008 OAR Corporation