epoc32/include/libc/reent.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 * The reentrant system calls here serve two purposes:
    16 * 1) Provide reentrant versions of the system calls the ANSI C library
    17 * requires.
    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
    30 * clean.
    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
    36 * configure.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.  
    45 * 
    46 *
    47 */
    48 
    49 
    50 
    51 /**
    52  @file
    53  @publishedAll
    54  @released
    55 */
    56 
    57 #ifndef _REENT_H_
    58 #define _REENT_H_
    59 
    60 #ifdef __cplusplus
    61 extern "C" {
    62 #endif
    63 
    64 #define __need_size_t
    65 #include <stddef.h>
    66 
    67 #include <sys/reent.h>
    68 #include <sys/_types.h>
    69 #include <sys/types.h>
    70 
    71 /* FIX THIS: not namespace clean */
    72 
    73 //Forward Declaration, For Internal Use Only
    74 struct stat;
    75 
    76 struct sockaddr;
    77 
    78 /**
    79 Reentrant versions of system calls.  
    80 Most of these are thread-safe in EPOC32 anyway
    81 */
    82 IMPORT_C int	_chdir_r	(struct _reent *, const char *);
    83 IMPORT_C int	_wchdir_r	(struct _reent *, const wchar_t *);
    84 IMPORT_C int	_chmod_r	(struct _reent *, const char *, mode_t);
    85 IMPORT_C int	_wchmod_r	(struct _reent *, const wchar_t *, mode_t);
    86 IMPORT_C int	_close_r	(struct _reent *, int);
    87 IMPORT_C int	_dup_r		(struct _reent *, int);
    88 IMPORT_C int	_dup2_r		(struct _reent *, int, int);
    89 IMPORT_C int	_fcntl_r	(struct _reent *, int, int, int);
    90 IMPORT_C int	_fork_r		(struct _reent *);
    91 IMPORT_C int	_fstat_r	(struct _reent *, int, struct stat *);
    92 IMPORT_C int	_fsync_r	(struct _reent *, int);
    93 IMPORT_C char*	_getcwd_r	(struct _reent *, char *, size_t);
    94 IMPORT_C wchar_t*	_wgetcwd_r	(struct _reent *, wchar_t *, size_t);
    95 IMPORT_C int	_ioctl_r	(struct _reent *, int, int, void *);
    96 IMPORT_C int	_kill_r		(struct _reent *, int, int);
    97 IMPORT_C int	_link_r		(struct _reent *, const char *, const char *);
    98 IMPORT_C off_t	_lseek_r	(struct _reent *, int, _off_t, int);
    99 IMPORT_C int	_mkdir_r	(struct _reent *, const char *, mode_t);
   100 IMPORT_C int	_wmkdir_r	(struct _reent *, const wchar_t *, mode_t);
   101 IMPORT_C int	_open_r		(struct _reent *, const char *, int, int);
   102 IMPORT_C int	_wopen_r		(struct _reent *, const wchar_t *, int, int);
   103 IMPORT_C int	_read_r		(struct _reent *, int, char *, size_t);
   104 IMPORT_C char *	_realpath_r	(struct _reent *, const char *, char *);
   105 IMPORT_C wchar_t *	_wrealpath_r	(struct _reent *, const wchar_t *, wchar_t *);
   106 IMPORT_C int	_rename_r	(struct _reent *, const char *_old, const char *_new);
   107 IMPORT_C int	_wrename_r	(struct _reent *, const wchar_t *_old, const wchar_t *_new);
   108 IMPORT_C int	_rmdir_r	(struct _reent *, const char *);
   109 IMPORT_C int	_wrmdir_r	(struct _reent *, const wchar_t *);
   110 IMPORT_C int	_stat_r		(struct _reent *, const char *, struct stat *);
   111 IMPORT_C int	_wstat_r		(struct _reent *, const wchar_t *, struct stat *);
   112 IMPORT_C int	_unlink_r	(struct _reent *, const char *);
   113 IMPORT_C int	_wunlink_r	(struct _reent *, const wchar_t *);
   114 IMPORT_C int	_wait_r		(struct _reent *, int *);
   115 IMPORT_C int	_waitpid_r	(struct _reent *, int, int *, int);
   116 IMPORT_C int	_write_r	(struct _reent *, int, const char *, size_t);
   117 
   118 IMPORT_C int	_accept_r	(struct _reent*, int, struct sockaddr *, size_t *);
   119 IMPORT_C int	_bind_r		(struct _reent*, int, struct sockaddr *, size_t);
   120 IMPORT_C int	_connect_r	(struct _reent*, int, struct sockaddr *, size_t);
   121 IMPORT_C int	_getpeername_r	(struct _reent*, int, struct sockaddr *, size_t *);
   122 IMPORT_C int	_getsockname_r	(struct _reent*, int, struct sockaddr *, size_t *);
   123 IMPORT_C int	_getsockopt_r	(struct _reent*, int, int, int, void *, size_t *);
   124 IMPORT_C int	_listen_r	(struct _reent*, int, int);
   125 IMPORT_C int	_recv_r		(struct _reent*, int, char *, size_t, int);
   126 IMPORT_C int	_recvfrom_r	(struct _reent*, int, char *, size_t, int, struct sockaddr *, size_t *);
   127 IMPORT_C int	_send_r		(struct _reent*, int, const char *, size_t, int);
   128 IMPORT_C int	_sendto_r	(struct _reent*, int, const char *, size_t, int, struct sockaddr *, size_t);
   129 IMPORT_C int	_setsockopt_r	(struct _reent*, int, int, int, void *, size_t);
   130 IMPORT_C int	_socket_r	(struct _reent*, int, int, int);
   131 IMPORT_C int	_shutdown_r	(struct _reent*, int, int);
   132 
   133 #define _remove_r(r,x)	_unlink_r(r,x)
   134 #define _wremove_r(r,x)	_wunlink_r(r,x)
   135 
   136 #ifdef __cplusplus
   137 }
   138 #endif
   139 #endif /* _REENT_H_ */