2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * The reentrant system calls here serve two purposes:
16 * 1) Provide reentrant versions of the system calls the ANSI C library
18 * 2) Provide these system calls in a namespace clean way.
19 * It is intended that *all* system calls that the ANSI C library needs
20 * be declared here. It documents them all in one place. All library access
21 * to the system is via some form of these functions.
22 * There are three ways a target may provide the needed syscalls.
23 * 1) Define the reentrant versions of the syscalls directly.
24 * (eg: _open_r, _close_r, etc.). Please keep the namespace clean.
25 * When you do this, set "syscall_dir" to "syscalls" in configure.in,
26 * and add -DREENTRANT_SYSCALLS_PROVIDED to target_cflags in configure.in.
27 * 2) Define namespace clean versions of the system calls by prefixing
28 * them with '_' (eg: _open, _close, etc.). Technically, there won't be
29 * true reentrancy at the syscall level, but the library will be namespace
31 * When you do this, set "syscall_dir" to "syscalls" in configure.in.
32 * 3) Define or otherwise provide the regular versions of the syscalls
33 * (eg: open, close, etc.). The library won't be reentrant nor namespace
34 * clean, but at least it will work.
35 * When you do this, add -DMISSING_SYSCALL_NAMES to target_cflags in
37 * Stubs of the reentrant versions of the syscalls exist in the libc/reent
38 * source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined.
39 * They use the native system calls: _open, _close, etc. if they're available
40 * (MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc.
41 * (MISSING_SYSCALL_NAMES *is* defined).
42 * WARNING: All identifiers here must begin with an underscore. This file is
43 * included by stdio.h and others and we therefore must only use identifiers
44 * in the namespace allotted to us.
72 #include <sys/reent.h>
73 #include <sys/_types.h>
74 #include <sys/types.h>
76 /* FIX THIS: not namespace clean */
87 Reentrant versions of system calls.
88 Most of these are thread-safe in EPOC32 anyway
90 IMPORT_C int _chdir_r (struct _reent *, const char *);
91 IMPORT_C int _wchdir_r (struct _reent *, const wchar_t *);
92 IMPORT_C int _chmod_r (struct _reent *, const char *, mode_t);
93 IMPORT_C int _wchmod_r (struct _reent *, const wchar_t *, mode_t);
94 IMPORT_C int _close_r (struct _reent *, int);
95 IMPORT_C int _dup_r (struct _reent *, int);
96 IMPORT_C int _dup2_r (struct _reent *, int, int);
97 IMPORT_C int _fcntl_r (struct _reent *, int, int, int);
98 IMPORT_C int _fork_r (struct _reent *);
99 IMPORT_C int _fstat_r (struct _reent *, int, struct stat *);
100 IMPORT_C int _fsync_r (struct _reent *, int);
101 IMPORT_C char* _getcwd_r (struct _reent *, char *, size_t);
102 IMPORT_C wchar_t* _wgetcwd_r (struct _reent *, wchar_t *, size_t);
103 IMPORT_C int _ioctl_r (struct _reent *, int, int, void *);
104 IMPORT_C int _kill_r (struct _reent *, int, int);
105 IMPORT_C int _link_r (struct _reent *, const char *, const char *);
106 IMPORT_C off_t _lseek_r (struct _reent *, int, _off_t, int);
107 IMPORT_C int _mkdir_r (struct _reent *, const char *, mode_t);
108 IMPORT_C int _wmkdir_r (struct _reent *, const wchar_t *, mode_t);
109 IMPORT_C int _open_r (struct _reent *, const char *, int, int);
110 IMPORT_C int _wopen_r (struct _reent *, const wchar_t *, int, int);
111 IMPORT_C int _read_r (struct _reent *, int, char *, size_t);
112 IMPORT_C char * _realpath_r (struct _reent *, const char *, char *);
113 IMPORT_C wchar_t * _wrealpath_r (struct _reent *, const wchar_t *, wchar_t *);
114 IMPORT_C int _rename_r (struct _reent *, const char *_old, const char *_new);
115 IMPORT_C int _wrename_r (struct _reent *, const wchar_t *_old, const wchar_t *_new);
116 IMPORT_C int _rmdir_r (struct _reent *, const char *);
117 IMPORT_C int _wrmdir_r (struct _reent *, const wchar_t *);
118 IMPORT_C int _stat_r (struct _reent *, const char *, struct stat *);
119 IMPORT_C int _wstat_r (struct _reent *, const wchar_t *, struct stat *);
120 IMPORT_C int _unlink_r (struct _reent *, const char *);
121 IMPORT_C int _wunlink_r (struct _reent *, const wchar_t *);
122 IMPORT_C int _wait_r (struct _reent *, int *);
123 IMPORT_C int _waitpid_r (struct _reent *, int, int *, int);
124 IMPORT_C int _write_r (struct _reent *, int, const char *, size_t);
126 IMPORT_C int _accept_r (struct _reent*, int, struct sockaddr *, size_t *);
127 IMPORT_C int _bind_r (struct _reent*, int, struct sockaddr *, size_t);
128 IMPORT_C int _connect_r (struct _reent*, int, struct sockaddr *, size_t);
129 IMPORT_C int _getpeername_r (struct _reent*, int, struct sockaddr *, size_t *);
130 IMPORT_C int _getsockname_r (struct _reent*, int, struct sockaddr *, size_t *);
131 IMPORT_C int _getsockopt_r (struct _reent*, int, int, int, void *, size_t *);
132 IMPORT_C int _listen_r (struct _reent*, int, int);
133 IMPORT_C int _recv_r (struct _reent*, int, char *, size_t, int);
134 IMPORT_C int _recvfrom_r (struct _reent*, int, char *, size_t, int, struct sockaddr *, size_t *);
135 IMPORT_C int _send_r (struct _reent*, int, const char *, size_t, int);
136 IMPORT_C int _sendto_r (struct _reent*, int, const char *, size_t, int, struct sockaddr *, size_t);
137 IMPORT_C int _setsockopt_r (struct _reent*, int, int, int, void *, size_t);
138 IMPORT_C int _socket_r (struct _reent*, int, int, int);
139 IMPORT_C int _shutdown_r (struct _reent*, int, int);
141 #define _remove_r(r,x) _unlink_r(r,x)
142 #define _wremove_r(r,x) _wunlink_r(r,x)
147 #endif /* _REENT_H_ */