os/ossrv/genericopenlibs/openenvcore/libc/src/sysconfig.c
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 1998-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 *
    16 */
    17 
    18 
    19 // connectors for re-entrant system calls
    20  
    21 #include <sys/param.h>
    22 #include <sys/time.h>
    23 #include <sys/sysctl.h>
    24 #include <sys/resource.h>
    25 #include <sys/socket.h>
    26 
    27 #include <errno.h>
    28 #include <limits.h>
    29 #include <paths.h>
    30 #include <pthread.h>		/* we just need the limits */
    31 #include <time.h>
    32 #include <unistd.h>
    33 
    34  
    35 EXPORT_C long
    36 sysconf(int name)
    37 	
    38 {
    39 	int retval = 0 ;
    40 
    41 	switch (name) 
    42 	{
    43 		case -1:
    44 			{
    45 			retval = -1 ;
    46 			errno = EINVAL ;
    47 			break ;
    48 			}
    49 	    case _SC_ARG_MAX:
    50 	    	{
    51 	    	retval =   20 ; //KMaxArgC ; 
    52 		    break;
    53 	    	}
    54 	
    55 	    case _SC_CLK_TCK:
    56 	       	{
    57 	       	retval = CLK_TCK ;
    58 		    break ;
    59 	       	}
    60 		
    61 		case _SC_OPEN_MAX:
    62 			{
    63 			retval =  OPEN_MAX ;
    64 		    break ;
    65 			}
    66 		   
    67 		case _SC_JOB_CONTROL :
    68 			{
    69 			retval =  1 ;
    70 		    break ;
    71 			}
    72 
    73 	
    74 	    case _SC_IOV_MAX :
    75 	    	{
    76 	    	 retval = IOV_MAX ;
    77 	    	 break ;
    78 	    	}
    79 	       
    80 		case _SC_SAVED_IDS  :
    81 			{
    82 			retval =  -1 ;
    83 		    break ;
    84 			}
    85 			
    86 	    case _SC_NGROUPS_MAX :           //Suplimentary groups not supported    
    87         case _SC_CHILD_MAX	:            //Needs imp of getrlimit
    88         	{
    89         	errno  = ENOSYS ;
    90             retval =  -1 ;
    91             break ;
    92         	}
    93           
    94 		case _SC_2_C_DEV :   //c99, yac lex utilities are not there
    95 		case _SC_2_C_BIND :
    96 		case _SC_2_FORT_DEV: //  FORTAN development utilities not supported
    97 		case _SC_2_FORT_RUN :// FORTAN Run time utilities not supported
    98 		case _SC_2_UPE :  //User portability not supported
    99 		case _SC_2_CHAR_TERM : //as UPE is not supported
   100 		case _SC_2_SW_DEV:    //utilities such as nm and strip are not supported
   101 		case _SC_2_LOCALEDEF ://No support for supports  Locale Creation Utilities option
   102 			{
   103 			retval = -1 ;
   104 			break ;
   105 			}
   106 		
   107 		case _SC_PAGESIZE :
   108 			{
   109 			 retval = getpagesize() ;
   110 			 break ;
   111 			}
   112 	
   113         default :
   114         	{
   115         	errno = ENOSYS ;
   116             retval =  -1 ;
   117             break ;
   118         	}
   119 	}
   120 	
   121 	return retval ;
   122 }