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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [newlib-1.18.0/] [newlib/] [libc/] [reent/] [closer.c] - Blame information for rev 829

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* Reentrant version of close system call.  */
2
 
3
#include <reent.h>
4
#include <unistd.h>
5
#include <_syslist.h>
6
 
7
/* Some targets provides their own versions of this functions.  Those
8
   targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS.  */
9
 
10
#ifdef _REENT_ONLY
11
#ifndef REENTRANT_SYSCALLS_PROVIDED
12
#define REENTRANT_SYSCALLS_PROVIDED
13
#endif
14
#endif
15
 
16
#ifndef REENTRANT_SYSCALLS_PROVIDED
17
 
18
/* We use the errno variable used by the system dependent layer.  */
19
#undef errno
20
extern int errno;
21
 
22
/*
23
FUNCTION
24
        <<_close_r>>---Reentrant version of close
25
 
26
INDEX
27
        _close_r
28
 
29
ANSI_SYNOPSIS
30
        #include <reent.h>
31
        int _close_r(struct _reent *<[ptr]>, int <[fd]>);
32
 
33
TRAD_SYNOPSIS
34
        #include <reent.h>
35
        int _close_r(<[ptr]>, <[fd]>)
36
        struct _reent *<[ptr]>;
37
        int <[fd]>;
38
 
39
DESCRIPTION
40
        This is a reentrant version of <<close>>.  It
41
        takes a pointer to the global data block, which holds
42
        <<errno>>.
43
*/
44
 
45
int
46
_close_r (ptr, fd)
47
     struct _reent *ptr;
48
     int fd;
49
{
50
  int ret;
51
 
52
  errno = 0;
53
  if ((ret = _close (fd)) == -1 && errno != 0)
54
    ptr->_errno = errno;
55
  return ret;
56
}
57
 
58
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */

powered by: WebSVN 2.1.0

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