Last change
on this file was
444,
checked in by satin@…, 7 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.2 KB
|
Rev | Line | |
---|
[444] | 1 | /* Reentrant versions of stat system call. This implementation just |
---|
| 2 | calls the stat system call. */ |
---|
| 3 | |
---|
| 4 | #include <reent.h> |
---|
| 5 | #include <unistd.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 |
---|
| 11 | TARGET_CFLAGS. */ |
---|
| 12 | |
---|
| 13 | #ifdef _REENT_ONLY |
---|
| 14 | #ifndef REENTRANT_SYSCALLS_PROVIDED |
---|
| 15 | #define REENTRANT_SYSCALLS_PROVIDED |
---|
| 16 | #endif |
---|
| 17 | #endif |
---|
| 18 | |
---|
| 19 | #ifdef REENTRANT_SYSCALLS_PROVIDED |
---|
| 20 | |
---|
| 21 | int _dummy_stat_syscalls = 1; |
---|
| 22 | |
---|
| 23 | #else |
---|
| 24 | |
---|
| 25 | /* We use the errno variable used by the system dependent layer. */ |
---|
| 26 | #undef errno |
---|
| 27 | extern int errno; |
---|
| 28 | |
---|
| 29 | /* |
---|
| 30 | FUNCTION |
---|
| 31 | <<_stat_r>>---Reentrant version of stat |
---|
| 32 | |
---|
| 33 | INDEX |
---|
| 34 | _stat_r |
---|
| 35 | |
---|
| 36 | SYNOPSIS |
---|
| 37 | #include <reent.h> |
---|
| 38 | int _stat_r(struct _reent *<[ptr]>, |
---|
| 39 | const char *<[file]>, struct stat *<[pstat]>); |
---|
| 40 | |
---|
| 41 | DESCRIPTION |
---|
| 42 | This is a reentrant version of <<stat>>. It |
---|
| 43 | takes a pointer to the global data block, which holds |
---|
| 44 | <<errno>>. |
---|
| 45 | */ |
---|
| 46 | |
---|
| 47 | int |
---|
| 48 | _stat_r (struct _reent *ptr, |
---|
| 49 | const char *file, |
---|
| 50 | struct stat *pstat) |
---|
| 51 | { |
---|
| 52 | int ret; |
---|
| 53 | |
---|
| 54 | errno = 0; |
---|
| 55 | if ((ret = _stat (file, pstat)) == -1 && errno != 0) |
---|
| 56 | ptr->_errno = errno; |
---|
| 57 | return ret; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
---|
Note: See
TracBrowser
for help on using the repository browser.