os/ossrv/genericopenlibs/openenvcore/libc/src/sysconfig.c
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/libc/src/sysconfig.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,122 @@
     1.4 +/*
     1.5 +* Copyright (c) 1998-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 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +// connectors for re-entrant system calls
    1.23 + 
    1.24 +#include <sys/param.h>
    1.25 +#include <sys/time.h>
    1.26 +#include <sys/sysctl.h>
    1.27 +#include <sys/resource.h>
    1.28 +#include <sys/socket.h>
    1.29 +
    1.30 +#include <errno.h>
    1.31 +#include <limits.h>
    1.32 +#include <paths.h>
    1.33 +#include <pthread.h>		/* we just need the limits */
    1.34 +#include <time.h>
    1.35 +#include <unistd.h>
    1.36 +
    1.37 + 
    1.38 +EXPORT_C long
    1.39 +sysconf(int name)
    1.40 +	
    1.41 +{
    1.42 +	int retval = 0 ;
    1.43 +
    1.44 +	switch (name) 
    1.45 +	{
    1.46 +		case -1:
    1.47 +			{
    1.48 +			retval = -1 ;
    1.49 +			errno = EINVAL ;
    1.50 +			break ;
    1.51 +			}
    1.52 +	    case _SC_ARG_MAX:
    1.53 +	    	{
    1.54 +	    	retval =   20 ; //KMaxArgC ; 
    1.55 +		    break;
    1.56 +	    	}
    1.57 +	
    1.58 +	    case _SC_CLK_TCK:
    1.59 +	       	{
    1.60 +	       	retval = CLK_TCK ;
    1.61 +		    break ;
    1.62 +	       	}
    1.63 +		
    1.64 +		case _SC_OPEN_MAX:
    1.65 +			{
    1.66 +			retval =  OPEN_MAX ;
    1.67 +		    break ;
    1.68 +			}
    1.69 +		   
    1.70 +		case _SC_JOB_CONTROL :
    1.71 +			{
    1.72 +			retval =  1 ;
    1.73 +		    break ;
    1.74 +			}
    1.75 +
    1.76 +	
    1.77 +	    case _SC_IOV_MAX :
    1.78 +	    	{
    1.79 +	    	 retval = IOV_MAX ;
    1.80 +	    	 break ;
    1.81 +	    	}
    1.82 +	       
    1.83 +		case _SC_SAVED_IDS  :
    1.84 +			{
    1.85 +			retval =  -1 ;
    1.86 +		    break ;
    1.87 +			}
    1.88 +			
    1.89 +	    case _SC_NGROUPS_MAX :           //Suplimentary groups not supported    
    1.90 +        case _SC_CHILD_MAX	:            //Needs imp of getrlimit
    1.91 +        	{
    1.92 +        	errno  = ENOSYS ;
    1.93 +            retval =  -1 ;
    1.94 +            break ;
    1.95 +        	}
    1.96 +          
    1.97 +		case _SC_2_C_DEV :   //c99, yac lex utilities are not there
    1.98 +		case _SC_2_C_BIND :
    1.99 +		case _SC_2_FORT_DEV: //  FORTAN development utilities not supported
   1.100 +		case _SC_2_FORT_RUN :// FORTAN Run time utilities not supported
   1.101 +		case _SC_2_UPE :  //User portability not supported
   1.102 +		case _SC_2_CHAR_TERM : //as UPE is not supported
   1.103 +		case _SC_2_SW_DEV:    //utilities such as nm and strip are not supported
   1.104 +		case _SC_2_LOCALEDEF ://No support for supports  Locale Creation Utilities option
   1.105 +			{
   1.106 +			retval = -1 ;
   1.107 +			break ;
   1.108 +			}
   1.109 +		
   1.110 +		case _SC_PAGESIZE :
   1.111 +			{
   1.112 +			 retval = getpagesize() ;
   1.113 +			 break ;
   1.114 +			}
   1.115 +	
   1.116 +        default :
   1.117 +        	{
   1.118 +        	errno = ENOSYS ;
   1.119 +            retval =  -1 ;
   1.120 +            break ;
   1.121 +        	}
   1.122 +	}
   1.123 +	
   1.124 +	return retval ;
   1.125 +}