os/ossrv/genericopenlibs/openenvcore/libc/inc/reent.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 * WARNING: All identifiers here must begin with an underscore.  This file is
    16 * included by stdio.h and others and we therefore must only use identifiers
    17 * in the namespace allotted to us.
    18 * 
    19 *
    20 */
    21 
    22 
    23 
    24 #ifndef _REENT_H_
    25 #define _REENT_H_
    26 
    27 
    28 #if (defined(__SYMBIAN32__) && (defined(__WINSCW__) || defined(__WINS__)))
    29 #include <time.h>
    30 #include <limits.h>
    31 #include <locale.h>
    32 #include <stdio.h>
    33 #include <wchar.h>
    34 #include <pthread.h>
    35 #endif
    36 
    37 #ifdef __cplusplus
    38 extern "C" {
    39 #endif
    40 
    41 
    42 #include <_ansi.h>
    43 #include <sys/types.h>
    44 
    45 /*
    46 struct _reent
    47 
    48 This structure contains *all* globals needed by the library.
    49 It's raison d'etre is to facilitate threads by making all library routines
    50 reentrant.  
    51 Currently only error number, which is per thread basis and
    52 pointer to CLocalSystemInterface is stored in _reent structure.
    53 */
    54 
    55 
    56 #define _ASCTIME_SIZE	(26+8)	/* 26 min, plus caution factor! */
    57 struct _reent
    58 	{
    59 	int _errno;			/* local copy of errno */
    60 	void *_netdb;		/* used by gethostbyaddr and similar netdb functions */
    61 	void *_memaddr;		/* To hold mapped memory address during mmap syscall */
    62 	};
    63 
    64 /*
    65 This exported API is used for fetching reent structure for TLS
    66 */
    67 struct _reent*	ImpurePtr	(void);
    68 
    69 /*
    70 Support for explicit release of all STDLIB resources belonging to this thread
    71 */
    72 void CloseSTDLIB();
    73 
    74 #define _REENT (ImpurePtr())
    75 #define __errno_r(ptr) ((ptr)->_errno)
    76 
    77 #ifdef __cplusplus
    78 }
    79 #endif
    80 
    81 #endif /* _REENT_H_ */