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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
2
 *  close() - POSIX 1003.1b 6.3.1 - Close a File
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.OARcorp.com/rtems/license.html.
10
 *
11
 *  close.c,v 1.9 2001/10/19 17:37:24 joel Exp
12
 */
13
 
14
#if HAVE_CONFIG_H
15
#include "config.h"
16
#endif
17
 
18
#include <rtems/libio_.h>
19
 
20
int close(
21
  int  fd
22
)
23
{
24
  rtems_libio_t      *iop;
25
  rtems_status_code   rc;
26
 
27
  rtems_libio_check_fd(fd);
28
  iop = rtems_libio_iop(fd);
29
  rtems_libio_check_is_open(iop);
30
 
31
  rc = RTEMS_SUCCESSFUL;
32
  if ( iop->handlers->close_h )
33
    rc = (*iop->handlers->close_h)( iop );
34
 
35
  rtems_filesystem_freenode( &iop->pathinfo );
36
  rtems_libio_free( iop );
37
 
38
  return rc;
39
}
40
 
41
/*
42
 *  _close_r
43
 *
44
 *  This is the Newlib dependent reentrant version of close().
45
 */
46
 
47
#if defined(RTEMS_NEWLIB)
48
 
49
#include <reent.h>
50
 
51
int _close_r(
52
  struct _reent *ptr,
53
  int            fd
54
)
55
{
56
  return close( fd );
57
}
58
#endif

powered by: WebSVN 2.1.0

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