source: rtems/cpukit/libcsupport/src/getdents.c @ 0d923d9

4.115
Last change on this file since 0d923d9 was 0d923d9, checked in by Joel Sherrill <joel.sherrill@…>, on 07/01/10 at 17:47:48

2010-07-01 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/_rename_r.c, libcsupport/src/getdents.c, libcsupport/src/unlink.c, libcsupport/src/utime.c, libcsupport/src/writev.c: Remove remaining checks for missing handlers.
  • Property mode set to 100644
File size: 1.3 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  iop = rtems_libio_iop( dd_fd );
42
43  /*
44   *  Make sure we are working on a directory
45   */
46  loc = iop->pathinfo;
47  if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
48    rtems_set_errno_and_return_minus_one( ENOTDIR );
49
50  /*
51   *  Return the number of bytes that were actually transfered as a result
52   *  of the read attempt.
53   */
54  return (*iop->handlers->read_h)( iop, dd_buf, dd_len  );
55}
Note: See TracBrowser for help on using the repository browser.