OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [libcsupport/] [src/] [getdents.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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.OARcorp.com/rtems/license.html.
16
 *
17
 *  getdents.c,v 1.7 2002/01/04 18:29:36 joel Exp
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
 
29
int 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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.