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