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