os/ossrv/genericopenlibs/openenvcore/backend/inc/sysreent.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2006-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
* @file
sl@0
    46
* @internalComponent
sl@0
    47
* 
sl@0
    48
*
sl@0
    49
*/
sl@0
    50
sl@0
    51
sl@0
    52
sl@0
    53
#ifndef _SYSREENT_H_
sl@0
    54
#define _SYSREENT_H_
sl@0
    55
sl@0
    56
#ifdef __cplusplus
sl@0
    57
extern "C" {
sl@0
    58
#endif
sl@0
    59
sl@0
    60
#define __need_size_t
sl@0
    61
#include <stddef.h>
sl@0
    62
#include <sys/_types.h>
sl@0
    63
#include <sys/types.h>
sl@0
    64
#include <dirent.h>
sl@0
    65
#include <sys/select.h>
sl@0
    66
#include <spawn.h>
sl@0
    67
sl@0
    68
/* FIXME: not namespace clean */
sl@0
    69
/*
sl@0
    70
@internalTechnology
sl@0
    71
*/
sl@0
    72
struct stat;
sl@0
    73
/*
sl@0
    74
@internalTechnology
sl@0
    75
*/
sl@0
    76
struct sockaddr;
sl@0
    77
struct TProtocolDesc;
sl@0
    78
sl@0
    79
/*
sl@0
    80
Reentrant versions of system calls.
sl@0
    81
Most of these are thread-safe in EPOC32 anyway
sl@0
    82
*/
sl@0
    83
IMPORT_C int	_chdir_r	(int *, const wchar_t *);
sl@0
    84
IMPORT_C int	_wchdir_r	(int *, const wchar_t *);
sl@0
    85
IMPORT_C int	_chmod_r	(int *, const wchar_t *, mode_t);
sl@0
    86
IMPORT_C int	_fchmod_r	(int *, int, mode_t);
sl@0
    87
IMPORT_C int	_wchmod_r	(int *, const wchar_t *, mode_t);
sl@0
    88
IMPORT_C int	_close_r	(int *, int);
sl@0
    89
IMPORT_C int	_dup_r		(int *, int);
sl@0
    90
IMPORT_C int	_dup2_r	(int *, int, int);
sl@0
    91
IMPORT_C int	_fcntl_r	(int *, int, int, long);
sl@0
    92
IMPORT_C int	_fstat_r	(int *, int, struct stat *);
sl@0
    93
IMPORT_C int	_fsync_r	(int *, int);
sl@0
    94
IMPORT_C wchar_t*	_wgetcwd_r	(int *, wchar_t *, size_t);
sl@0
    95
IMPORT_C int	_ioctl_r	(int *, int, int, void *);
sl@0
    96
IMPORT_C int	_link_r		(int *, const wchar_t *, const wchar_t *);
sl@0
    97
IMPORT_C off_t	_lseek_r	(int *, int, off_t, int);
sl@0
    98
IMPORT_C int	_mkdir_r	(int *, const wchar_t *, mode_t);
sl@0
    99
IMPORT_C int	_wmkdir_r	(int *, const wchar_t *, mode_t);
sl@0
   100
IMPORT_C int	_open_r	(int *, const wchar_t *, int, int);
sl@0
   101
IMPORT_C int	_wopen_r	(int *, const wchar_t *, int, int);
sl@0
   102
IMPORT_C int	_read_r	(int *, int, char *, size_t);
sl@0
   103
IMPORT_C wchar_t*	_wrealpath_r	(int *, const wchar_t *, wchar_t *);
sl@0
   104
IMPORT_C int	_rename_r	(int *, const wchar_t *_old, const wchar_t *_new);
sl@0
   105
IMPORT_C int	_wrename_r	(int *, const wchar_t *_old, const wchar_t *_new);
sl@0
   106
IMPORT_C int	_rmdir_r	(int *, const wchar_t *);
sl@0
   107
IMPORT_C int	_wrmdir_r	(int *, const wchar_t *);
sl@0
   108
IMPORT_C int	_stat_r		(int *, const wchar_t *, struct stat *);
sl@0
   109
IMPORT_C int    _lstat_r    (int *, const wchar_t *, struct stat *);
sl@0
   110
IMPORT_C int	_wstat_r	(int *, const wchar_t *, struct stat *);
sl@0
   111
IMPORT_C int	_unlink_r	(int *, const wchar_t *);
sl@0
   112
IMPORT_C int	_wunlink_r	(int *, const wchar_t *);
sl@0
   113
IMPORT_C int	_wait_r		(int *, int *);
sl@0
   114
IMPORT_C int	_waitpid_r	(int *, int, int *, int);
sl@0
   115
IMPORT_C int	_write_r	(int *, int, const char *, size_t);
sl@0
   116
sl@0
   117
IMPORT_C int	_accept_r	(int *, int, struct sockaddr *, size_t *);
sl@0
   118
IMPORT_C int	_bind_r	(int *, int, const struct sockaddr *, size_t);
sl@0
   119
IMPORT_C int	_connect_r	(int *, int, const struct sockaddr *, size_t);
sl@0
   120
IMPORT_C int	_getpeername_r	(int *, int, struct sockaddr *, size_t *);
sl@0
   121
IMPORT_C int	_getsockname_r	(int *, int, struct sockaddr *, size_t *);
sl@0
   122
IMPORT_C int	_getsockopt_r	(int *, int, int, int, void *, size_t *);
sl@0
   123
IMPORT_C int	_getprotobynumber_r (int*, int, struct TProtocolDesc*);
sl@0
   124
IMPORT_C int	_getprotobyname_r (int*, const char*, struct TProtocolDesc*);
sl@0
   125
IMPORT_C int	_gethostname_r (int*, char*, size_t);
sl@0
   126
IMPORT_C int	_listen_r	(int *, int, int);
sl@0
   127
IMPORT_C int	_recvfrom_r	(int *, int, char *, size_t, int, struct sockaddr *, size_t *);
sl@0
   128
IMPORT_C int	_sendto_r	(int *, int, const char *, size_t, int, struct sockaddr *, size_t);
sl@0
   129
IMPORT_C int	_setsockopt_r	(int *, int, int, int, void *, size_t);
sl@0
   130
IMPORT_C int	_socket_r	(int *, int, int, int);
sl@0
   131
IMPORT_C int	_shutdown_r	(int *, int, int);
sl@0
   132
sl@0
   133
#ifdef SYMBIAN_OE_POSIX_SIGNALS
sl@0
   134
IMPORT_C int _kill_r (int *, pid_t, int);
sl@0
   135
IMPORT_C int _raise_r (int *, int);
sl@0
   136
IMPORT_C int _sigqueue_r (int *, pid_t, int, const union sigval);
sl@0
   137
sl@0
   138
IMPORT_C int _sigfillset_r(int *, sigset_t *);
sl@0
   139
IMPORT_C int _sigaddset_r(int *, sigset_t *, int );
sl@0
   140
IMPORT_C int _sigdelset_r(int *, sigset_t *, int );
sl@0
   141
IMPORT_C int _sigismember_r(int *, const sigset_t *, int );
sl@0
   142
IMPORT_C int _sigandset_r(int *, sigset_t * , const sigset_t * , const sigset_t * );
sl@0
   143
IMPORT_C int _sigorset_r(int *, sigset_t * , const sigset_t * , const sigset_t * );
sl@0
   144
IMPORT_C int _sigisemptyset_r(int *, const sigset_t * );
sl@0
   145
IMPORT_C int _sigemptyset_r(int *, sigset_t* set);
sl@0
   146
sl@0
   147
IMPORT_C int _sigprocmask_r(int*, int , const sigset_t *, sigset_t *);
sl@0
   148
IMPORT_C int _sighold_r(int*, int);
sl@0
   149
IMPORT_C int _sigrelse_r(int*, int);
sl@0
   150
IMPORT_C int _sigpause_r(int*, int);
sl@0
   151
sl@0
   152
IMPORT_C int _sigwait_r(int*, const sigset_t*, int*);
sl@0
   153
IMPORT_C int _sigtimedwait_r(int*, const sigset_t*, siginfo_t*,
sl@0
   154
       const struct timespec*);
sl@0
   155
IMPORT_C int _sigwaitinfo_r(int*, const sigset_t*, siginfo_t*);
sl@0
   156
sl@0
   157
IMPORT_C int _sigaction_r(int *aErrno, int sig, const struct sigaction *act, struct sigaction *oact);
sl@0
   158
IMPORT_C void (*_sigset_r(int *aErrno, int sig, void (*disp)(int)))(int);
sl@0
   159
IMPORT_C void (*_bsd_signal_r(int *aErrno, int sig, void (*disp)(int)))(int);
sl@0
   160
IMPORT_C void (*_signal_r(int *aErrno, int sig, void (*disp)(int)))(int);
sl@0
   161
IMPORT_C int _sigignore_r(int *aErrno, int sig);
sl@0
   162
IMPORT_C unsigned int _alarm_r(unsigned int seconds);
sl@0
   163
IMPORT_C int _sigpending_r(int *aErrno,sigset_t *aSet);
sl@0
   164
IMPORT_C int _sigenable_r(int *aErrno);
sl@0
   165
#endif // SYMBIAN_OE_POSIX_SIGNALS
sl@0
   166
//forward declaration
sl@0
   167
struct utimbuf;
sl@0
   168
IMPORT_C int 	_utime_r (int *, const wchar_t*, const struct utimbuf*);
sl@0
   169
sl@0
   170
IMPORT_C DIR* _opendir_r (int*, const wchar_t* _path) ;
sl@0
   171
IMPORT_C int _wclosedir_r (int*, WDIR *dp) ;
sl@0
   172
IMPORT_C struct dirent* _readdir_r (int*, DIR *dp) ;
sl@0
   173
IMPORT_C void _wrewinddir_r(WDIR *dp);
sl@0
   174
IMPORT_C struct wdirent* _wreaddir_r(WDIR *dp);
sl@0
   175
IMPORT_C int _fchdir_r (int *aErrno, int filedesc);
sl@0
   176
IMPORT_C wchar_t* _getcwd_r (int *aErrno, wchar_t *_buf, size_t _size);
sl@0
   177
IMPORT_C int 	_mkfifo_r (int *aErrno, const wchar_t *pathname, mode_t mode);
sl@0
   178
IMPORT_C int 	_pipe_r (int *aErrno, int fildes[2]);
sl@0
   179
IMPORT_C int 	_wpopen3_r	(int *aErrno, const wchar_t *file, const wchar_t *cmd, wchar_t** envp, int fids[3]);
sl@0
   180
sl@0
   181
IMPORT_C int _posix_spawn_r (int* pid, const wchar_t* wpath,
sl@0
   182
							 const posix_spawn_file_actions_t* file_actions,
sl@0
   183
							 const posix_spawnattr_t* attrp,
sl@0
   184
							 const wchar_t* wargs,
sl@0
   185
							 wchar_t** wenvp);
sl@0
   186
sl@0
   187
IMPORT_C void _exit_r (int code);
sl@0
   188
/*
sl@0
   189
New function introduced for MRT2.0
sl@0
   190
Reentrant version of popen() function
sl@0
   191
*/
sl@0
   192
IMPORT_C int _wpopen_r (int *aErrno, const wchar_t* command, const char* mode);
sl@0
   193
IMPORT_C int _pclose_r (int *aErrno, int aFid);
sl@0
   194
sl@0
   195
IMPORT_C int _shmget_r	(int *aErrno, key_t key, int size, int shmflg);
sl@0
   196
IMPORT_C void* _shmat_r	(int *aErrno, int shmid, const void *shmaddr, int shmflg);
sl@0
   197
IMPORT_C int _shmdt_r	(int *aErrno, const void *shmaddr);
sl@0
   198
sl@0
   199
//forward declarations
sl@0
   200
struct shmid_ds;
sl@0
   201
struct sembuf;
sl@0
   202
sl@0
   203
IMPORT_C int _shmctl_r	(int *aErrno,int shmid, int cmd, struct shmid_ds *buf);
sl@0
   204
sl@0
   205
IMPORT_C int _semget_r	(int *aErrno, key_t key, int nsems, int semflg);
sl@0
   206
IMPORT_C int _semop_r	(int *aErrno, int semid, struct sembuf *sops, unsigned nsops);
sl@0
   207
IMPORT_C int _semctl_r	(int *aErrno, int semid, int semnum, int cmd, ...);
sl@0
   208
sl@0
   209
IMPORT_C int _select_r	(int *aErrno, int maxfd, fd_set *readfds,
sl@0
   210
						 fd_set *writefds, fd_set *exceptfds, struct timeval *tvptr);
sl@0
   211
sl@0
   212
IMPORT_C int _wsystem_r	(int *aErrno, const wchar_t *command);
sl@0
   213
sl@0
   214
typedef void* iconv_t;
sl@0
   215
IMPORT_C iconv_t _iconv_open_r(int* aErrno, const char* tocharset, const char* fromcharset);
sl@0
   216
sl@0
   217
IMPORT_C size_t _iconv_r(int* aErrno, iconv_t conversion_descriptor, const char** inbuf, size_t* inbytesleft, char** outbuf, size_t* outbytesleft);
sl@0
   218
sl@0
   219
IMPORT_C int _iconv_close_r(int* aErrno, iconv_t conversion_descriptor);
sl@0
   220
/*
sl@0
   221
Functions to allocate/deallocate on the backend's private heap
sl@0
   222
*/
sl@0
   223
IMPORT_C void* BackendAlloc(size_t aNBytes);
sl@0
   224
IMPORT_C void* BackendReAlloc(void* aPtr, size_t aNBytes);
sl@0
   225
IMPORT_C void BackendFree(void* aPtr);
sl@0
   226
IMPORT_C void* BackendAllocTLD(size_t aSize);
sl@0
   227
sl@0
   228
#define _remove_r(r,x)	_unlink_r(r,x)
sl@0
   229
#define _wremove_r(r,x)	_wunlink_r(r,x)
sl@0
   230
sl@0
   231
sl@0
   232
//forward declarations
sl@0
   233
struct msqid_ds;
sl@0
   234
sl@0
   235
IMPORT_C int _msgget_r(key_t aKey, int aMsgFlag, int* aErrno);
sl@0
   236
IMPORT_C int _msgsnd_r(int msqid, const void *msgp, size_t msgsz, int msgflg, int* aErrno);
sl@0
   237
IMPORT_C int _msgrcv_r(int msqid, void* msgp, size_t msgsz, long msgtyp, int msgflg, int* aErrno);
sl@0
   238
IMPORT_C int _msgctl_r(int msqid, int cmd, struct msqid_ds* buf, int* aErrno);
sl@0
   239
sl@0
   240
IMPORT_C int _setecho_r(int *aErrno, int aFd, uint8_t aEchoVal);
sl@0
   241
sl@0
   242
//forward declarations
sl@0
   243
struct ifreq;
sl@0
   244
sl@0
   245
IMPORT_C int _setdefaultif_r(int *aErrno, const struct ifreq* aIfReq);
sl@0
   246
IMPORT_C int _unsetdefaultif_r(int *aErrno);
sl@0
   247
sl@0
   248
IMPORT_C void *_memcpy_r(void *dst0, const void *src0, size_t length);
sl@0
   249
IMPORT_C void *_memmove_r(void *dst0, const void *src0, size_t length);
sl@0
   250
sl@0
   251
#ifdef __cplusplus
sl@0
   252
}	// extern "C"
sl@0
   253
#endif
sl@0
   254
#endif /* _SYSREENT_H_ */