freebsd-ports/lang/ifc/files/sysconf.c
Maho Nakata 6bf0de6ddf Now ifc outputs FreeBSD's native binary.
Bump portrevision.

Wonderful work by: Masakazu Higaki <higamasa@dream.com>
Approved by: maho(maintainer)
Reviewed by: knu(mentor)
2002-11-18 09:27:32 +00:00

145 lines
3.5 KiB
C

/*
* Copyright (c) 2002 The FreeBSD Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: /tmp/pcvs/ports/lang/ifc/files/sysconf.c,v 1.1 2002-11-18 09:27:32 maho Exp $
*/
#include <unistd.h>
#include <errno.h>
#define _SC_UNDEF 0
static int linux_sysconf[] = {
_SC_ARG_MAX,
_SC_CHILD_MAX,
_SC_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_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_UNDEF,
_SC_2_CHAR_TERM,
_SC_UNDEF,
_SC_2_UPE,
};
#define SYSCONF_SIZE (sizeof(linux_sysconf)/sizeof(int))
long __sysconf(int name)
{
if (name >= SYSCONF_SIZE || linux_sysconf[name] == _SC_UNDEF) {
errno = EINVAL;
return -1;
}
return sysconf(linux_sysconf[name]);
}