]> sourceware.org Git - newlib-cygwin.git/blame - newlib/libc/include/reent.h
* include/sys/time.h: Move more cygwin stuff to cygwin-specific header.
[newlib-cygwin.git] / newlib / libc / include / reent.h
CommitLineData
8a0efa53
CF
1/* 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.
af5a221f
JJ
17 When you do this, set "syscall_dir" to "syscalls" and add
18 -DREENTRANT_SYSCALLS_PROVIDED to newlib_cflags in configure.host.
8a0efa53
CF
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.
af5a221f 24 When you do this, set "syscall_dir" to "syscalls" in configure.host.
8a0efa53
CF
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.
af5a221f
JJ
29 When you do this, add -DMISSING_SYSCALL_NAMES to newlib_cflags in
30 configure.host.
8a0efa53
CF
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
44extern "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
ad552766 53#define __need_ptrdiff_t
8a0efa53
CF
54#include <stddef.h>
55
56/* FIXME: not namespace clean */
57struct stat;
58struct tms;
59struct timeval;
60struct timezone;
61
62/* Reentrant versions of system calls. */
63
64extern int _close_r _PARAMS ((struct _reent *, int));
65extern int _execve_r _PARAMS ((struct _reent *, char *, char **, char **));
66extern int _fcntl_r _PARAMS ((struct _reent *, int, int, int));
67extern int _fork_r _PARAMS ((struct _reent *));
68extern int _fstat_r _PARAMS ((struct _reent *, int, struct stat *));
69extern int _getpid_r _PARAMS ((struct _reent *));
70extern int _kill_r _PARAMS ((struct _reent *, int, int));
71extern int _link_r _PARAMS ((struct _reent *, const char *, const char *));
72extern _off_t _lseek_r _PARAMS ((struct _reent *, int, _off_t, int));
73extern int _open_r _PARAMS ((struct _reent *, const char *, int, int));
74extern _ssize_t _read_r _PARAMS ((struct _reent *, int, void *, size_t));
ad552766 75extern void *_sbrk_r _PARAMS ((struct _reent *, ptrdiff_t));
8a0efa53
CF
76extern int _stat_r _PARAMS ((struct _reent *, const char *, struct stat *));
77extern _CLOCK_T_ _times_r _PARAMS ((struct _reent *, struct tms *));
78extern int _unlink_r _PARAMS ((struct _reent *, const char *));
79extern int _wait_r _PARAMS ((struct _reent *, int *));
80extern _ssize_t _write_r _PARAMS ((struct _reent *, int, const void *, size_t));
81
82/* This one is not guaranteed to be available on all targets. */
83extern int _gettimeofday_r _PARAMS ((struct _reent *, struct timeval *tp, struct timezone *tzp));
84
dee51391 85#ifdef __LARGE64_FILES
880fa247
JJ
86
87#if defined(__CYGWIN__) && defined(_COMPILING_NEWLIB)
88#define stat64 __stat64
89#endif
90
dee51391
JJ
91struct stat64;
92
93extern _off64_t _lseek64_r _PARAMS ((struct _reent *, int, _off64_t, int));
94extern int _fstat64_r _PARAMS ((struct _reent *, int, struct stat64 *));
95extern int _open64_r _PARAMS ((struct _reent *, const char *, int, int));
96#endif
97
8a0efa53
CF
98#ifdef __cplusplus
99}
100#endif
101#endif /* _REENT_H_ */
This page took 0.126229 seconds and 5 git commands to generate.