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