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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [reent/] [fcntlr.c] - Blame information for rev 362

Go to most recent revision | Details | Compare with Previous | View Log

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