|
Last change
on this file was
444,
checked in by satin@…, 8 years ago
|
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
|
File size:
1.1 KB
|
| Rev | Line | |
|---|
| [444] | 1 | /* 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 | SYNOPSIS |
|---|
| 32 | #include <reent.h> |
|---|
| 33 | int _fcntl_r(struct _reent *<[ptr]>, |
|---|
| 34 | int <[fd]>, int <[cmd]>, <[arg]>); |
|---|
| 35 | |
|---|
| 36 | DESCRIPTION |
|---|
| 37 | This is a reentrant version of <<fcntl>>. It |
|---|
| 38 | takes a pointer to the global data block, which holds |
|---|
| 39 | <<errno>>. |
|---|
| 40 | */ |
|---|
| 41 | |
|---|
| 42 | int |
|---|
| 43 | _fcntl_r (struct _reent *ptr, |
|---|
| 44 | int fd, |
|---|
| 45 | int cmd, |
|---|
| 46 | int arg) |
|---|
| 47 | { |
|---|
| 48 | int ret; |
|---|
| 49 | |
|---|
| 50 | errno = 0; |
|---|
| 51 | if ((ret = _fcntl (fd, cmd, arg)) == -1 && errno != 0) |
|---|
| 52 | ptr->_errno = errno; |
|---|
| 53 | return ret; |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.