From 73f6236bc09b3cadf0aa030e16396154421f3e30 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 1 Mar 1999 22:40:08 +0000 Subject: Patch from Eric Norum to eliminate external IO handlers scheme that was implemented originally just to support sockets. The file system IO switch is more general and works fine. --- c/src/lib/libc/fstat.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) (limited to 'c/src/lib/libc/fstat.c') diff --git a/c/src/lib/libc/fstat.c b/c/src/lib/libc/fstat.c index 0399518532..7fdc2a4b8a 100644 --- a/c/src/lib/libc/fstat.c +++ b/c/src/lib/libc/fstat.c @@ -32,34 +32,6 @@ int fstat( if ( !sbuf ) set_errno_and_return_minus_one( EFAULT ); - /* - * Zero out the stat structure so the various support - * versions of stat don't have to. - */ - - memset( sbuf, 0, sizeof(struct stat) ); - - /* - * If this file descriptor is mapped to an external set of handlers, - * then pass the request on to them. - */ - - if (rtems_file_descriptor_type(fd)) { - switch (rtems_file_descriptor_type (fd)) { - case RTEMS_FILE_DESCRIPTOR_TYPE_FILE: - break; - - case RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET: -#if !defined(__GO32__) - sbuf->st_mode = S_IFSOCK; - break; -#endif - - default: - set_errno_and_return_minus_one( EBADF ); - } - } - /* * Now process the stat() request. */ @@ -68,9 +40,18 @@ int fstat( rtems_libio_check_fd( fd ); rtems_libio_check_is_open(iop); + if ( !iop->handlers ) + set_errno_and_return_minus_one( EBADF ); + if ( !iop->handlers->fstat ) set_errno_and_return_minus_one( ENOTSUP ); + /* + * Zero out the stat structure so the various support + * versions of stat don't have to. + */ + memset( sbuf, 0, sizeof(struct stat) ); + return (*iop->handlers->fstat)( &iop->pathinfo, sbuf ); } -- cgit v1.2.3