nkeynes@185 | 1 | /* This header file provides the reentrancy. */
|
nkeynes@185 | 2 |
|
nkeynes@185 | 3 | /* The reentrant system calls here serve two purposes:
|
nkeynes@185 | 4 |
|
nkeynes@185 | 5 | 1) Provide reentrant versions of the system calls the ANSI C library
|
nkeynes@185 | 6 | requires.
|
nkeynes@185 | 7 | 2) Provide these system calls in a namespace clean way.
|
nkeynes@185 | 8 |
|
nkeynes@185 | 9 | It is intended that *all* system calls that the ANSI C library needs
|
nkeynes@185 | 10 | be declared here. It documents them all in one place. All library access
|
nkeynes@185 | 11 | to the system is via some form of these functions.
|
nkeynes@185 | 12 |
|
nkeynes@185 | 13 | There are three ways a target may provide the needed syscalls.
|
nkeynes@185 | 14 |
|
nkeynes@185 | 15 | 1) Define the reentrant versions of the syscalls directly.
|
nkeynes@185 | 16 | (eg: _open_r, _close_r, etc.). Please keep the namespace clean.
|
nkeynes@185 | 17 | When you do this, set "syscall_dir" to "syscalls" in configure.in,
|
nkeynes@185 | 18 | and add -DREENTRANT_SYSCALLS_PROVIDED to target_cflags in configure.in.
|
nkeynes@185 | 19 |
|
nkeynes@185 | 20 | 2) Define namespace clean versions of the system calls by prefixing
|
nkeynes@185 | 21 | them with '_' (eg: _open, _close, etc.). Technically, there won't be
|
nkeynes@185 | 22 | true reentrancy at the syscall level, but the library will be namespace
|
nkeynes@185 | 23 | clean.
|
nkeynes@185 | 24 | When you do this, set "syscall_dir" to "syscalls" in configure.in.
|
nkeynes@185 | 25 |
|
nkeynes@185 | 26 | 3) Define or otherwise provide the regular versions of the syscalls
|
nkeynes@185 | 27 | (eg: open, close, etc.). The library won't be reentrant nor namespace
|
nkeynes@185 | 28 | clean, but at least it will work.
|
nkeynes@185 | 29 | When you do this, add -DMISSING_SYSCALL_NAMES to target_cflags in
|
nkeynes@185 | 30 | configure.in.
|
nkeynes@185 | 31 |
|
nkeynes@185 | 32 | Stubs of the reentrant versions of the syscalls exist in the libc/reent
|
nkeynes@185 | 33 | source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined.
|
nkeynes@185 | 34 | They use the native system calls: _open, _close, etc. if they're available
|
nkeynes@185 | 35 | (MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc.
|
nkeynes@185 | 36 | (MISSING_SYSCALL_NAMES *is* defined). */
|
nkeynes@185 | 37 |
|
nkeynes@185 | 38 | /* WARNING: All identifiers here must begin with an underscore. This file is
|
nkeynes@185 | 39 | included by stdio.h and others and we therefore must only use identifiers
|
nkeynes@185 | 40 | in the namespace allotted to us. */
|
nkeynes@185 | 41 |
|
nkeynes@185 | 42 | #ifndef _REENT_H_
|
nkeynes@185 | 43 | #ifdef __cplusplus
|
nkeynes@185 | 44 | extern "C" {
|
nkeynes@185 | 45 | #endif
|
nkeynes@185 | 46 | #define _REENT_H_
|
nkeynes@185 | 47 |
|
nkeynes@185 | 48 | #include <sys/reent.h>
|
nkeynes@185 | 49 | #include <sys/_types.h>
|
nkeynes@185 | 50 | #include <machine/types.h>
|
nkeynes@185 | 51 |
|
nkeynes@185 | 52 | #define __need_size_t
|
nkeynes@185 | 53 | #include <stddef.h>
|
nkeynes@185 | 54 |
|
nkeynes@185 | 55 | /* FIXME: not namespace clean */
|
nkeynes@185 | 56 | struct stat;
|
nkeynes@185 | 57 | struct tms;
|
nkeynes@185 | 58 | struct timeval;
|
nkeynes@185 | 59 | struct timezone;
|
nkeynes@185 | 60 |
|
nkeynes@185 | 61 | /* Reentrant versions of system calls. */
|
nkeynes@185 | 62 |
|
nkeynes@185 | 63 | extern int _close_r _PARAMS ((struct _reent *, int));
|
nkeynes@185 | 64 | extern int _execve_r _PARAMS ((struct _reent *, char *, char **, char **));
|
nkeynes@185 | 65 | extern int _fcntl_r _PARAMS ((struct _reent *, int, int, int));
|
nkeynes@185 | 66 | extern int _fork_r _PARAMS ((struct _reent *));
|
nkeynes@185 | 67 | extern int _fstat_r _PARAMS ((struct _reent *, int, struct stat *));
|
nkeynes@185 | 68 | extern int _getpid_r _PARAMS ((struct _reent *));
|
nkeynes@185 | 69 | extern int _kill_r _PARAMS ((struct _reent *, int, int));
|
nkeynes@185 | 70 | extern int _link_r _PARAMS ((struct _reent *, const char *, const char *));
|
nkeynes@185 | 71 | extern _off_t _lseek_r _PARAMS ((struct _reent *, int, _off_t, int));
|
nkeynes@185 | 72 | extern int _open_r _PARAMS ((struct _reent *, const char *, int, int));
|
nkeynes@185 | 73 | extern _ssize_t _read_r _PARAMS ((struct _reent *, int, void *, size_t));
|
nkeynes@185 | 74 | extern void *_sbrk_r _PARAMS ((struct _reent *, size_t));
|
nkeynes@185 | 75 | extern int _stat_r _PARAMS ((struct _reent *, const char *, struct stat *));
|
nkeynes@185 | 76 | extern _CLOCK_T_ _times_r _PARAMS ((struct _reent *, struct tms *));
|
nkeynes@185 | 77 | extern int _unlink_r _PARAMS ((struct _reent *, const char *));
|
nkeynes@185 | 78 | extern int _wait_r _PARAMS ((struct _reent *, int *));
|
nkeynes@185 | 79 | extern _ssize_t _write_r _PARAMS ((struct _reent *, int, const void *, size_t));
|
nkeynes@185 | 80 |
|
nkeynes@185 | 81 | /* This one is not guaranteed to be available on all targets. */
|
nkeynes@185 | 82 | extern int _gettimeofday_r _PARAMS ((struct _reent *, struct timeval *tp, struct timezone *tzp));
|
nkeynes@185 | 83 |
|
nkeynes@185 | 84 | #ifdef __cplusplus
|
nkeynes@185 | 85 | }
|
nkeynes@185 | 86 | #endif
|
nkeynes@185 | 87 | #endif /* _REENT_H_ */
|