source: rtems/cpukit/libcsupport/src/fstat.c @ 92119ed

4.115
Last change on this file since 92119ed was 92119ed, checked in by Jennifer Averett <Jennifer.Averett@…>, on 07/01/10 at 15:12:38

2010-07-01 Jennifer Averett <Jennifer.Averett@…>

  • libcsupport/src/chdir.c, libcsupport/src/chmod.c, libcsupport/src/chown.c, libcsupport/src/close.c, libcsupport/src/eval.c, libcsupport/src/fchdir.c, libcsupport/src/fchmod.c, libcsupport/src/fchown.c, libcsupport/src/fcntl.c, libcsupport/src/fdatasync.c, libcsupport/src/freenode.c, libcsupport/src/fstat.c, libcsupport/src/fsync.c, libcsupport/src/ftruncate.c, libcsupport/src/ioctl.c, libcsupport/src/link.c, libcsupport/src/lseek.c, libcsupport/src/mknod.c, libcsupport/src/mount.c, libcsupport/src/open.c, libcsupport/src/read.c, libcsupport/src/readlink.c, libcsupport/src/readv.c, libcsupport/src/rmdir.c, libcsupport/src/stat.c, libcsupport/src/statvfs.c, libcsupport/src/symlink.c, libcsupport/src/unlink.c, libcsupport/src/unmount.c, libcsupport/src/write.c: Removed filesystem checks for NULL methods checks from the main posix rountines. These are now required to have at a miminum default routines in the tables.
  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  fstat() - POSIX 1003.1b 5.6.2 - Get File Status
3 *
4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <sys/stat.h>
19#include <unistd.h>
20#include <string.h>
21
22#include <rtems/libio_.h>
23#include <rtems/seterr.h>
24
25int fstat(
26  int          fd,
27  struct stat *sbuf
28)
29{
30  rtems_libio_t *iop;
31
32  /*
33   *  Check to see if we were passed a valid pointer.
34   */
35
36  if ( !sbuf )
37    rtems_set_errno_and_return_minus_one( EFAULT );
38
39  /*
40   *  Now process the stat() request.
41   */
42
43  iop = rtems_libio_iop( fd );
44  rtems_libio_check_fd( fd );
45  rtems_libio_check_is_open(iop);
46
47  /*
48   *  Zero out the stat structure so the various support
49   *  versions of stat don't have to.
50   */
51  memset( sbuf, 0, sizeof(struct stat) );
52
53  return (*iop->handlers->fstat_h)( &iop->pathinfo, sbuf );
54}
55
56/*
57 *  _fstat_r
58 *
59 *  This is the Newlib dependent reentrant version of fstat().
60 */
61
62#if defined(RTEMS_NEWLIB) && !defined(HAVE_FSTAT_R)
63
64#include <reent.h>
65
66int _fstat_r(
67  struct _reent *ptr __attribute__((unused)),
68  int            fd,
69  struct stat   *buf
70)
71{
72  return fstat( fd, buf );
73}
74#endif
Note: See TracBrowser for help on using the repository browser.