RTEMS Logo

RTEMS 4.9.1 On-Line Library


lseek

PREV UP NEXT Bookshelf RTEMS Filesystem Design Guide

4.16: lseek

File:

lseek.c

Processing:

This routine is layered on both external handlers and filesystem / node type specific handlers. This routine should allow for the support of new filesystems without modification.

Development Comments:

This routine will determine if the file descriptor is associated with a network device. If it is lseek will map to an external network handler. The handler will be called with the file descriptor, offset and whence as its calling parameters. The return code from the external handler will be returned to the calling routine.

If the file descriptor is not associated with a network connection, it is associated with a node in a filesystem. The following steps will be performed for filesystem nodes:

  1. The file descriptor is used to obtain the file control block for the node.
  2. The file descriptor is range checked.
  3. The offset element of the file control block is altered as indicated by the offset and whence calling parameters
  4. The handler table in the file control block is examined to determine if it contains an entry for the lseek() function. If it does not an error is returned to the calling program.
  5. The lseek() function from the designated handler table is called with the file control block, offset and whence as calling arguments
  6. The return code from the lseek() handler function is returned to the calling program


PREV UP NEXT Bookshelf RTEMS Filesystem Design Guide

Copyright © 1988-2008 OAR Corporation