os/ossrv/genericopenlibs/openenvcore/libc/src/fpathconf.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/fpathconf.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,68 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-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 +* Name        : fpathconf.c
    1.19 +* Part of     : libc library
    1.20 +* gets configurable system variables.
    1.21 +*
    1.22 +*/
    1.23 +
    1.24 +
    1.25 +
    1.26 +#include <errno.h>
    1.27 +#include <limits.h> //_POSIX_XXXX_XXXX
    1.28 +#include <sys/unistd.h> //_PC_XXXX_XXXX
    1.29 +
    1.30 +/*
    1.31 + * fpathconf --
    1.32 + * get configurable system variables.
    1.33 + *
    1.34 +
    1.35 + */
    1.36 +EXPORT_C
    1.37 +long
    1.38 +fpathconf(int fd, int name)
    1.39 +{
    1.40 +	long ret = -1;
    1.41 +	#ifdef __SYMBIAN32__
    1.42 +	fd = fd; /*to fix the warning 'variable/argument not used in function' */
    1.43 +	#endif //__SYMBIAN32__
    1.44 +	switch(name) {
    1.45 +	case _PC_LINK_MAX:
    1.46 +		ret = _POSIX_LINK_MAX;
    1.47 +		break;
    1.48 +	case _PC_NAME_MAX:
    1.49 +		ret = _POSIX_NAME_MAX;
    1.50 +		break;
    1.51 +	case _PC_PATH_MAX:
    1.52 +		ret = _POSIX_PATH_MAX;
    1.53 +		break;
    1.54 +	case _PC_PIPE_BUF:
    1.55 +		ret = _POSIX_PIPE_BUF;
    1.56 +		break;
    1.57 +	case _PC_NO_TRUNC:
    1.58 +		ret = _POSIX_NO_TRUNC;
    1.59 +		break;
    1.60 +	case _PC_VDISABLE: 			//no concept of terminal
    1.61 +	case _PC_MAX_CANON:			//no concept of terminal
    1.62 +	case _PC_MAX_INPUT:			//no concept of terminal
    1.63 +	case _PC_CHOWN_RESTRICTED:	//no concept of ownership
    1.64 +		errno = ENOTSUP;
    1.65 +		break;
    1.66 +	default:
    1.67 +		errno = EINVAL;
    1.68 +		break;
    1.69 +	}
    1.70 +	return ret;
    1.71 +}