source: rtems/c/src/lib/libc/close.c @ d7aecdc

4.104.114.84.95
Last change on this file since d7aecdc was 9c49db4, checked in by Joel Sherrill <joel.sherrill@…>, on 01/08/01 at 18:26:44

2001-01-08 Ralf Corsepius <corsepiu@…>

  • configure.in: Add libc/config.h
  • libc/Makefile.am: Add INCLUDES += -I. to pickup config.h
  • libc/.cvsignore: Add config.h and stamp-h
  • libc/*.c: Add config.h support.
  • Property mode set to 100644
File size: 935 bytes
Line 
1/*
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 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/libio_.h>
19
20int 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_libio_free( iop );
36
37  return rc;
38}
39
40/*
41 *  _close_r
42 *
43 *  This is the Newlib dependent reentrant version of close().
44 */
45
46#if defined(RTEMS_NEWLIB)
47
48#include <reent.h>
49
50int _close_r(
51  struct _reent *ptr,
52  int            fd
53)
54{
55  return close( fd );
56}
57#endif
Note: See TracBrowser for help on using the repository browser.