os/ossrv/genericopenlibs/cstdlib/LINC/REENT.H
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/LINC/REENT.H	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,139 @@
     1.4 +/*
     1.5 +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +* The reentrant system calls here serve two purposes:
    1.19 +* 1) Provide reentrant versions of the system calls the ANSI C library
    1.20 +* requires.
    1.21 +* 2) Provide these system calls in a namespace clean way.
    1.22 +* It is intended that *all* system calls that the ANSI C library needs
    1.23 +* be declared here.  It documents them all in one place.  All library access
    1.24 +* to the system is via some form of these functions.
    1.25 +* There are three ways a target may provide the needed syscalls.
    1.26 +* 1) Define the reentrant versions of the syscalls directly.
    1.27 +* (eg: _open_r, _close_r, etc.).  Please keep the namespace clean.
    1.28 +* When you do this, set "syscall_dir" to "syscalls" in configure.in,
    1.29 +* and add -DREENTRANT_SYSCALLS_PROVIDED to target_cflags in configure.in.
    1.30 +* 2) Define namespace clean versions of the system calls by prefixing
    1.31 +* them with '_' (eg: _open, _close, etc.).  Technically, there won't be
    1.32 +* true reentrancy at the syscall level, but the library will be namespace
    1.33 +* clean.
    1.34 +* When you do this, set "syscall_dir" to "syscalls" in configure.in.
    1.35 +* 3) Define or otherwise provide the regular versions of the syscalls
    1.36 +* (eg: open, close, etc.).  The library won't be reentrant nor namespace
    1.37 +* clean, but at least it will work.
    1.38 +* When you do this, add -DMISSING_SYSCALL_NAMES to target_cflags in
    1.39 +* configure.in.
    1.40 +* Stubs of the reentrant versions of the syscalls exist in the libc/reent
    1.41 +* source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined.
    1.42 +* They use the native system calls: _open, _close, etc. if they're available
    1.43 +* (MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc.
    1.44 +* (MISSING_SYSCALL_NAMES *is* defined).
    1.45 +* WARNING: All identifiers here must begin with an underscore.  This file is
    1.46 +* included by stdio.h and others and we therefore must only use identifiers
    1.47 +* in the namespace allotted to us.  
    1.48 +* 
    1.49 +*
    1.50 +*/
    1.51 +
    1.52 +
    1.53 +
    1.54 +/**
    1.55 + @file
    1.56 + @publishedAll
    1.57 + @released
    1.58 +*/
    1.59 +
    1.60 +#ifndef _REENT_H_
    1.61 +#define _REENT_H_
    1.62 +
    1.63 +#ifdef __cplusplus
    1.64 +extern "C" {
    1.65 +#endif
    1.66 +
    1.67 +#define __need_size_t
    1.68 +#include <stddef.h>
    1.69 +
    1.70 +#include <sys/reent.h>
    1.71 +#include <sys/_types.h>
    1.72 +#include <sys/types.h>
    1.73 +
    1.74 +/* FIX THIS: not namespace clean */
    1.75 +
    1.76 +//Forward Declaration, For Internal Use Only
    1.77 +struct stat;
    1.78 +
    1.79 +struct sockaddr;
    1.80 +
    1.81 +/**
    1.82 +Reentrant versions of system calls.  
    1.83 +Most of these are thread-safe in EPOC32 anyway
    1.84 +*/
    1.85 +IMPORT_C int	_chdir_r	(struct _reent *, const char *);
    1.86 +IMPORT_C int	_wchdir_r	(struct _reent *, const wchar_t *);
    1.87 +IMPORT_C int	_chmod_r	(struct _reent *, const char *, mode_t);
    1.88 +IMPORT_C int	_wchmod_r	(struct _reent *, const wchar_t *, mode_t);
    1.89 +IMPORT_C int	_close_r	(struct _reent *, int);
    1.90 +IMPORT_C int	_dup_r		(struct _reent *, int);
    1.91 +IMPORT_C int	_dup2_r		(struct _reent *, int, int);
    1.92 +IMPORT_C int	_fcntl_r	(struct _reent *, int, int, int);
    1.93 +IMPORT_C int	_fork_r		(struct _reent *);
    1.94 +IMPORT_C int	_fstat_r	(struct _reent *, int, struct stat *);
    1.95 +IMPORT_C int	_fsync_r	(struct _reent *, int);
    1.96 +IMPORT_C char*	_getcwd_r	(struct _reent *, char *, size_t);
    1.97 +IMPORT_C wchar_t*	_wgetcwd_r	(struct _reent *, wchar_t *, size_t);
    1.98 +IMPORT_C int	_ioctl_r	(struct _reent *, int, int, void *);
    1.99 +IMPORT_C int	_kill_r		(struct _reent *, int, int);
   1.100 +IMPORT_C int	_link_r		(struct _reent *, const char *, const char *);
   1.101 +IMPORT_C off_t	_lseek_r	(struct _reent *, int, _off_t, int);
   1.102 +IMPORT_C int	_mkdir_r	(struct _reent *, const char *, mode_t);
   1.103 +IMPORT_C int	_wmkdir_r	(struct _reent *, const wchar_t *, mode_t);
   1.104 +IMPORT_C int	_open_r		(struct _reent *, const char *, int, int);
   1.105 +IMPORT_C int	_wopen_r		(struct _reent *, const wchar_t *, int, int);
   1.106 +IMPORT_C int	_read_r		(struct _reent *, int, char *, size_t);
   1.107 +IMPORT_C char *	_realpath_r	(struct _reent *, const char *, char *);
   1.108 +IMPORT_C wchar_t *	_wrealpath_r	(struct _reent *, const wchar_t *, wchar_t *);
   1.109 +IMPORT_C int	_rename_r	(struct _reent *, const char *_old, const char *_new);
   1.110 +IMPORT_C int	_wrename_r	(struct _reent *, const wchar_t *_old, const wchar_t *_new);
   1.111 +IMPORT_C int	_rmdir_r	(struct _reent *, const char *);
   1.112 +IMPORT_C int	_wrmdir_r	(struct _reent *, const wchar_t *);
   1.113 +IMPORT_C int	_stat_r		(struct _reent *, const char *, struct stat *);
   1.114 +IMPORT_C int	_wstat_r		(struct _reent *, const wchar_t *, struct stat *);
   1.115 +IMPORT_C int	_unlink_r	(struct _reent *, const char *);
   1.116 +IMPORT_C int	_wunlink_r	(struct _reent *, const wchar_t *);
   1.117 +IMPORT_C int	_wait_r		(struct _reent *, int *);
   1.118 +IMPORT_C int	_waitpid_r	(struct _reent *, int, int *, int);
   1.119 +IMPORT_C int	_write_r	(struct _reent *, int, const char *, size_t);
   1.120 +
   1.121 +IMPORT_C int	_accept_r	(struct _reent*, int, struct sockaddr *, size_t *);
   1.122 +IMPORT_C int	_bind_r		(struct _reent*, int, struct sockaddr *, size_t);
   1.123 +IMPORT_C int	_connect_r	(struct _reent*, int, struct sockaddr *, size_t);
   1.124 +IMPORT_C int	_getpeername_r	(struct _reent*, int, struct sockaddr *, size_t *);
   1.125 +IMPORT_C int	_getsockname_r	(struct _reent*, int, struct sockaddr *, size_t *);
   1.126 +IMPORT_C int	_getsockopt_r	(struct _reent*, int, int, int, void *, size_t *);
   1.127 +IMPORT_C int	_listen_r	(struct _reent*, int, int);
   1.128 +IMPORT_C int	_recv_r		(struct _reent*, int, char *, size_t, int);
   1.129 +IMPORT_C int	_recvfrom_r	(struct _reent*, int, char *, size_t, int, struct sockaddr *, size_t *);
   1.130 +IMPORT_C int	_send_r		(struct _reent*, int, const char *, size_t, int);
   1.131 +IMPORT_C int	_sendto_r	(struct _reent*, int, const char *, size_t, int, struct sockaddr *, size_t);
   1.132 +IMPORT_C int	_setsockopt_r	(struct _reent*, int, int, int, void *, size_t);
   1.133 +IMPORT_C int	_socket_r	(struct _reent*, int, int, int);
   1.134 +IMPORT_C int	_shutdown_r	(struct _reent*, int, int);
   1.135 +
   1.136 +#define _remove_r(r,x)	_unlink_r(r,x)
   1.137 +#define _wremove_r(r,x)	_wunlink_r(r,x)
   1.138 +
   1.139 +#ifdef __cplusplus
   1.140 +}
   1.141 +#endif
   1.142 +#endif /* _REENT_H_ */