source: rtems/cpukit/libcsupport/src/getdents.c @ 98b785e

4.115
Last change on this file since 98b785e was 50f32b11, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/18/04 at 06:05:35

Remove stray white spaces.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  getdents() - Get Directory Entries
3 *
4 *  SVR4 and SVID extension required by Newlib readdir() family.
5 *
6 *  This routine will dd_len / (sizeof dirent) directory entries relative to
7 *  the current directory position index. These entries will be placed in
8 *  character array pointed to by -dd_buf-
9 *
10 *  COPYRIGHT (c) 1989-1999.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 *
17 *  $Id$
18 */
19
20#if HAVE_CONFIG_H
21#include "config.h"
22#endif
23
24#include <errno.h>
25
26#include <rtems/libio_.h>
27#include <rtems/seterr.h>
28
29int getdents(
30  int   dd_fd,
31  char *dd_buf,
32  int   dd_len
33)
34{
35  rtems_libio_t                    *iop;
36  rtems_filesystem_location_info_t  loc;
37
38  /*
39   *  Get the file control block structure associated with the file descriptor
40   */
41
42  iop = rtems_libio_iop( dd_fd );
43
44  /*
45   *  Make sure we are working on a directory
46   */
47  loc = iop->pathinfo;
48  if ( !loc.ops->node_type_h )
49    rtems_set_errno_and_return_minus_one( ENOTSUP );
50
51  if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
52    rtems_set_errno_and_return_minus_one( ENOTDIR );
53
54  /*
55   *  Return the number of bytes that were actually transfered as a result
56   *  of the read attempt.
57   */
58
59  if ( !iop->handlers->read_h )
60    rtems_set_errno_and_return_minus_one( ENOTSUP );
61
62  return (*iop->handlers->read_h)( iop, dd_buf, dd_len  );
63}
Note: See TracBrowser for help on using the repository browser.