sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* The reentrant system calls here serve two purposes:
|
sl@0
|
16 |
* 1) Provide reentrant versions of the system calls the ANSI C library
|
sl@0
|
17 |
* requires.
|
sl@0
|
18 |
* 2) Provide these system calls in a namespace clean way.
|
sl@0
|
19 |
* It is intended that *all* system calls that the ANSI C library needs
|
sl@0
|
20 |
* be declared here. It documents them all in one place. All library access
|
sl@0
|
21 |
* to the system is via some form of these functions.
|
sl@0
|
22 |
* There are three ways a target may provide the needed syscalls.
|
sl@0
|
23 |
* 1) Define the reentrant versions of the syscalls directly.
|
sl@0
|
24 |
* (eg: _open_r, _close_r, etc.). Please keep the namespace clean.
|
sl@0
|
25 |
* When you do this, set "syscall_dir" to "syscalls" in configure.in,
|
sl@0
|
26 |
* and add -DREENTRANT_SYSCALLS_PROVIDED to target_cflags in configure.in.
|
sl@0
|
27 |
* 2) Define namespace clean versions of the system calls by prefixing
|
sl@0
|
28 |
* them with '_' (eg: _open, _close, etc.). Technically, there won't be
|
sl@0
|
29 |
* true reentrancy at the syscall level, but the library will be namespace
|
sl@0
|
30 |
* clean.
|
sl@0
|
31 |
* When you do this, set "syscall_dir" to "syscalls" in configure.in.
|
sl@0
|
32 |
* 3) Define or otherwise provide the regular versions of the syscalls
|
sl@0
|
33 |
* (eg: open, close, etc.). The library won't be reentrant nor namespace
|
sl@0
|
34 |
* clean, but at least it will work.
|
sl@0
|
35 |
* When you do this, add -DMISSING_SYSCALL_NAMES to target_cflags in
|
sl@0
|
36 |
* configure.in.
|
sl@0
|
37 |
* Stubs of the reentrant versions of the syscalls exist in the libc/reent
|
sl@0
|
38 |
* source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined.
|
sl@0
|
39 |
* They use the native system calls: _open, _close, etc. if they're available
|
sl@0
|
40 |
* (MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc.
|
sl@0
|
41 |
* (MISSING_SYSCALL_NAMES *is* defined).
|
sl@0
|
42 |
* WARNING: All identifiers here must begin with an underscore. This file is
|
sl@0
|
43 |
* included by stdio.h and others and we therefore must only use identifiers
|
sl@0
|
44 |
* in the namespace allotted to us.
|
sl@0
|
45 |
*
|
sl@0
|
46 |
*
|
sl@0
|
47 |
*/
|
sl@0
|
48 |
|
sl@0
|
49 |
|
sl@0
|
50 |
|
sl@0
|
51 |
/**
|
sl@0
|
52 |
@file
|
sl@0
|
53 |
@publishedAll
|
sl@0
|
54 |
@released
|
sl@0
|
55 |
*/
|
sl@0
|
56 |
|
sl@0
|
57 |
#ifndef _REENT_H_
|
sl@0
|
58 |
#define _REENT_H_
|
sl@0
|
59 |
|
sl@0
|
60 |
#ifdef __cplusplus
|
sl@0
|
61 |
extern "C" {
|
sl@0
|
62 |
#endif
|
sl@0
|
63 |
|
sl@0
|
64 |
#define __need_size_t
|
sl@0
|
65 |
#include <stddef.h>
|
sl@0
|
66 |
|
sl@0
|
67 |
#include <sys/reent.h>
|
sl@0
|
68 |
#include <sys/_types.h>
|
sl@0
|
69 |
#include <sys/types.h>
|
sl@0
|
70 |
|
sl@0
|
71 |
/* FIX THIS: not namespace clean */
|
sl@0
|
72 |
|
sl@0
|
73 |
//Forward Declaration, For Internal Use Only
|
sl@0
|
74 |
struct stat;
|
sl@0
|
75 |
|
sl@0
|
76 |
struct sockaddr;
|
sl@0
|
77 |
|
sl@0
|
78 |
/**
|
sl@0
|
79 |
Reentrant versions of system calls.
|
sl@0
|
80 |
Most of these are thread-safe in EPOC32 anyway
|
sl@0
|
81 |
*/
|
sl@0
|
82 |
IMPORT_C int _chdir_r (struct _reent *, const char *);
|
sl@0
|
83 |
IMPORT_C int _wchdir_r (struct _reent *, const wchar_t *);
|
sl@0
|
84 |
IMPORT_C int _chmod_r (struct _reent *, const char *, mode_t);
|
sl@0
|
85 |
IMPORT_C int _wchmod_r (struct _reent *, const wchar_t *, mode_t);
|
sl@0
|
86 |
IMPORT_C int _close_r (struct _reent *, int);
|
sl@0
|
87 |
IMPORT_C int _dup_r (struct _reent *, int);
|
sl@0
|
88 |
IMPORT_C int _dup2_r (struct _reent *, int, int);
|
sl@0
|
89 |
IMPORT_C int _fcntl_r (struct _reent *, int, int, int);
|
sl@0
|
90 |
IMPORT_C int _fork_r (struct _reent *);
|
sl@0
|
91 |
IMPORT_C int _fstat_r (struct _reent *, int, struct stat *);
|
sl@0
|
92 |
IMPORT_C int _fsync_r (struct _reent *, int);
|
sl@0
|
93 |
IMPORT_C char* _getcwd_r (struct _reent *, char *, size_t);
|
sl@0
|
94 |
IMPORT_C wchar_t* _wgetcwd_r (struct _reent *, wchar_t *, size_t);
|
sl@0
|
95 |
IMPORT_C int _ioctl_r (struct _reent *, int, int, void *);
|
sl@0
|
96 |
IMPORT_C int _kill_r (struct _reent *, int, int);
|
sl@0
|
97 |
IMPORT_C int _link_r (struct _reent *, const char *, const char *);
|
sl@0
|
98 |
IMPORT_C off_t _lseek_r (struct _reent *, int, _off_t, int);
|
sl@0
|
99 |
IMPORT_C int _mkdir_r (struct _reent *, const char *, mode_t);
|
sl@0
|
100 |
IMPORT_C int _wmkdir_r (struct _reent *, const wchar_t *, mode_t);
|
sl@0
|
101 |
IMPORT_C int _open_r (struct _reent *, const char *, int, int);
|
sl@0
|
102 |
IMPORT_C int _wopen_r (struct _reent *, const wchar_t *, int, int);
|
sl@0
|
103 |
IMPORT_C int _read_r (struct _reent *, int, char *, size_t);
|
sl@0
|
104 |
IMPORT_C char * _realpath_r (struct _reent *, const char *, char *);
|
sl@0
|
105 |
IMPORT_C wchar_t * _wrealpath_r (struct _reent *, const wchar_t *, wchar_t *);
|
sl@0
|
106 |
IMPORT_C int _rename_r (struct _reent *, const char *_old, const char *_new);
|
sl@0
|
107 |
IMPORT_C int _wrename_r (struct _reent *, const wchar_t *_old, const wchar_t *_new);
|
sl@0
|
108 |
IMPORT_C int _rmdir_r (struct _reent *, const char *);
|
sl@0
|
109 |
IMPORT_C int _wrmdir_r (struct _reent *, const wchar_t *);
|
sl@0
|
110 |
IMPORT_C int _stat_r (struct _reent *, const char *, struct stat *);
|
sl@0
|
111 |
IMPORT_C int _wstat_r (struct _reent *, const wchar_t *, struct stat *);
|
sl@0
|
112 |
IMPORT_C int _unlink_r (struct _reent *, const char *);
|
sl@0
|
113 |
IMPORT_C int _wunlink_r (struct _reent *, const wchar_t *);
|
sl@0
|
114 |
IMPORT_C int _wait_r (struct _reent *, int *);
|
sl@0
|
115 |
IMPORT_C int _waitpid_r (struct _reent *, int, int *, int);
|
sl@0
|
116 |
IMPORT_C int _write_r (struct _reent *, int, const char *, size_t);
|
sl@0
|
117 |
|
sl@0
|
118 |
IMPORT_C int _accept_r (struct _reent*, int, struct sockaddr *, size_t *);
|
sl@0
|
119 |
IMPORT_C int _bind_r (struct _reent*, int, struct sockaddr *, size_t);
|
sl@0
|
120 |
IMPORT_C int _connect_r (struct _reent*, int, struct sockaddr *, size_t);
|
sl@0
|
121 |
IMPORT_C int _getpeername_r (struct _reent*, int, struct sockaddr *, size_t *);
|
sl@0
|
122 |
IMPORT_C int _getsockname_r (struct _reent*, int, struct sockaddr *, size_t *);
|
sl@0
|
123 |
IMPORT_C int _getsockopt_r (struct _reent*, int, int, int, void *, size_t *);
|
sl@0
|
124 |
IMPORT_C int _listen_r (struct _reent*, int, int);
|
sl@0
|
125 |
IMPORT_C int _recv_r (struct _reent*, int, char *, size_t, int);
|
sl@0
|
126 |
IMPORT_C int _recvfrom_r (struct _reent*, int, char *, size_t, int, struct sockaddr *, size_t *);
|
sl@0
|
127 |
IMPORT_C int _send_r (struct _reent*, int, const char *, size_t, int);
|
sl@0
|
128 |
IMPORT_C int _sendto_r (struct _reent*, int, const char *, size_t, int, struct sockaddr *, size_t);
|
sl@0
|
129 |
IMPORT_C int _setsockopt_r (struct _reent*, int, int, int, void *, size_t);
|
sl@0
|
130 |
IMPORT_C int _socket_r (struct _reent*, int, int, int);
|
sl@0
|
131 |
IMPORT_C int _shutdown_r (struct _reent*, int, int);
|
sl@0
|
132 |
|
sl@0
|
133 |
#define _remove_r(r,x) _unlink_r(r,x)
|
sl@0
|
134 |
#define _wremove_r(r,x) _wunlink_r(r,x)
|
sl@0
|
135 |
|
sl@0
|
136 |
#ifdef __cplusplus
|
sl@0
|
137 |
}
|
sl@0
|
138 |
#endif
|
sl@0
|
139 |
#endif /* _REENT_H_ */
|