source: rtems/c/src/lib/libc/close.c @ 7edb9281

4.104.114.84.95
Last change on this file since 7edb9281 was 73f6236, checked in by Joel Sherrill <joel.sherrill@…>, on 03/01/99 at 22:40:08

Patch from Eric Norum <eric@…> to eliminate external
IO handlers scheme that was implemented originally just to support
sockets. The file system IO switch is more general and works fine.

  • Property mode set to 100644
File size: 928 bytes
Line 
1/*
2 *  close() - POSIX 1003.1b 6.3.1 - Close a File
3 *
4 *  COPYRIGHT (c) 1989-1998.
5 *  On-Line Applications Research Corporation (OAR).
6 *  Copyright assigned to U.S. Government, 1994.
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include "libio_.h"
16
17int close(
18  int  fd
19)
20{
21  rtems_libio_t      *iop;
22  rtems_status_code   rc;
23
24  rtems_libio_check_fd(fd);
25  iop = rtems_libio_iop(fd);
26  rtems_libio_check_is_open(iop);
27
28  rc = RTEMS_SUCCESSFUL;
29  if ( iop->handlers->close )
30    rc = (*iop->handlers->close)( iop );
31
32  rtems_libio_free( iop );
33
34  return rc;
35}
36
37/*
38 *  _close_r
39 *
40 *  This is the Newlib dependent reentrant version of close().
41 */
42
43#if defined(RTEMS_NEWLIB)
44
45#include <reent.h>
46
47int _close_r(
48  struct _reent *ptr,
49  int            fd
50)
51{
52  return close( fd );
53}
54#endif
Note: See TracBrowser for help on using the repository browser.