sl@0: /* sl@0: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * The reentrant system calls here serve two purposes: sl@0: * 1) Provide reentrant versions of the system calls the ANSI C library sl@0: * requires. sl@0: * 2) Provide these system calls in a namespace clean way. sl@0: * It is intended that *all* system calls that the ANSI C library needs sl@0: * be declared here. It documents them all in one place. All library access sl@0: * to the system is via some form of these functions. sl@0: * There are three ways a target may provide the needed syscalls. sl@0: * 1) Define the reentrant versions of the syscalls directly. sl@0: * (eg: _open_r, _close_r, etc.). Please keep the namespace clean. sl@0: * When you do this, set "syscall_dir" to "syscalls" in configure.in, sl@0: * and add -DREENTRANT_SYSCALLS_PROVIDED to target_cflags in configure.in. sl@0: * 2) Define namespace clean versions of the system calls by prefixing sl@0: * them with '_' (eg: _open, _close, etc.). Technically, there won't be sl@0: * true reentrancy at the syscall level, but the library will be namespace sl@0: * clean. sl@0: * When you do this, set "syscall_dir" to "syscalls" in configure.in. sl@0: * 3) Define or otherwise provide the regular versions of the syscalls sl@0: * (eg: open, close, etc.). The library won't be reentrant nor namespace sl@0: * clean, but at least it will work. sl@0: * When you do this, add -DMISSING_SYSCALL_NAMES to target_cflags in sl@0: * configure.in. sl@0: * Stubs of the reentrant versions of the syscalls exist in the libc/reent sl@0: * source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined. sl@0: * They use the native system calls: _open, _close, etc. if they're available sl@0: * (MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc. sl@0: * (MISSING_SYSCALL_NAMES *is* defined). sl@0: * WARNING: All identifiers here must begin with an underscore. This file is sl@0: * included by stdio.h and others and we therefore must only use identifiers sl@0: * in the namespace allotted to us. sl@0: * sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: sl@0: #ifndef _REENT_H_ sl@0: #define _REENT_H_ sl@0: sl@0: #ifdef __cplusplus sl@0: extern "C" { sl@0: #endif sl@0: sl@0: #define __need_size_t sl@0: #include sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: /* FIX THIS: not namespace clean */ sl@0: sl@0: //Forward Declaration, For Internal Use Only sl@0: struct stat; sl@0: sl@0: struct sockaddr; sl@0: sl@0: /** sl@0: Reentrant versions of system calls. sl@0: Most of these are thread-safe in EPOC32 anyway sl@0: */ sl@0: IMPORT_C int _chdir_r (struct _reent *, const char *); sl@0: IMPORT_C int _wchdir_r (struct _reent *, const wchar_t *); sl@0: IMPORT_C int _chmod_r (struct _reent *, const char *, mode_t); sl@0: IMPORT_C int _wchmod_r (struct _reent *, const wchar_t *, mode_t); sl@0: IMPORT_C int _close_r (struct _reent *, int); sl@0: IMPORT_C int _dup_r (struct _reent *, int); sl@0: IMPORT_C int _dup2_r (struct _reent *, int, int); sl@0: IMPORT_C int _fcntl_r (struct _reent *, int, int, int); sl@0: IMPORT_C int _fork_r (struct _reent *); sl@0: IMPORT_C int _fstat_r (struct _reent *, int, struct stat *); sl@0: IMPORT_C int _fsync_r (struct _reent *, int); sl@0: IMPORT_C char* _getcwd_r (struct _reent *, char *, size_t); sl@0: IMPORT_C wchar_t* _wgetcwd_r (struct _reent *, wchar_t *, size_t); sl@0: IMPORT_C int _ioctl_r (struct _reent *, int, int, void *); sl@0: IMPORT_C int _kill_r (struct _reent *, int, int); sl@0: IMPORT_C int _link_r (struct _reent *, const char *, const char *); sl@0: IMPORT_C off_t _lseek_r (struct _reent *, int, _off_t, int); sl@0: IMPORT_C int _mkdir_r (struct _reent *, const char *, mode_t); sl@0: IMPORT_C int _wmkdir_r (struct _reent *, const wchar_t *, mode_t); sl@0: IMPORT_C int _open_r (struct _reent *, const char *, int, int); sl@0: IMPORT_C int _wopen_r (struct _reent *, const wchar_t *, int, int); sl@0: IMPORT_C int _read_r (struct _reent *, int, char *, size_t); sl@0: IMPORT_C char * _realpath_r (struct _reent *, const char *, char *); sl@0: IMPORT_C wchar_t * _wrealpath_r (struct _reent *, const wchar_t *, wchar_t *); sl@0: IMPORT_C int _rename_r (struct _reent *, const char *_old, const char *_new); sl@0: IMPORT_C int _wrename_r (struct _reent *, const wchar_t *_old, const wchar_t *_new); sl@0: IMPORT_C int _rmdir_r (struct _reent *, const char *); sl@0: IMPORT_C int _wrmdir_r (struct _reent *, const wchar_t *); sl@0: IMPORT_C int _stat_r (struct _reent *, const char *, struct stat *); sl@0: IMPORT_C int _wstat_r (struct _reent *, const wchar_t *, struct stat *); sl@0: IMPORT_C int _unlink_r (struct _reent *, const char *); sl@0: IMPORT_C int _wunlink_r (struct _reent *, const wchar_t *); sl@0: IMPORT_C int _wait_r (struct _reent *, int *); sl@0: IMPORT_C int _waitpid_r (struct _reent *, int, int *, int); sl@0: IMPORT_C int _write_r (struct _reent *, int, const char *, size_t); sl@0: sl@0: IMPORT_C int _accept_r (struct _reent*, int, struct sockaddr *, size_t *); sl@0: IMPORT_C int _bind_r (struct _reent*, int, struct sockaddr *, size_t); sl@0: IMPORT_C int _connect_r (struct _reent*, int, struct sockaddr *, size_t); sl@0: IMPORT_C int _getpeername_r (struct _reent*, int, struct sockaddr *, size_t *); sl@0: IMPORT_C int _getsockname_r (struct _reent*, int, struct sockaddr *, size_t *); sl@0: IMPORT_C int _getsockopt_r (struct _reent*, int, int, int, void *, size_t *); sl@0: IMPORT_C int _listen_r (struct _reent*, int, int); sl@0: IMPORT_C int _recv_r (struct _reent*, int, char *, size_t, int); sl@0: IMPORT_C int _recvfrom_r (struct _reent*, int, char *, size_t, int, struct sockaddr *, size_t *); sl@0: IMPORT_C int _send_r (struct _reent*, int, const char *, size_t, int); sl@0: IMPORT_C int _sendto_r (struct _reent*, int, const char *, size_t, int, struct sockaddr *, size_t); sl@0: IMPORT_C int _setsockopt_r (struct _reent*, int, int, int, void *, size_t); sl@0: IMPORT_C int _socket_r (struct _reent*, int, int, int); sl@0: IMPORT_C int _shutdown_r (struct _reent*, int, int); sl@0: sl@0: #define _remove_r(r,x) _unlink_r(r,x) sl@0: #define _wremove_r(r,x) _wunlink_r(r,x) sl@0: sl@0: #ifdef __cplusplus sl@0: } sl@0: #endif sl@0: #endif /* _REENT_H_ */