Path: blob/main/tools/build/cross-build/include/linux/limits.h
39565 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright 2018-2020 Alex Richardson <[email protected]>4*5* This software was developed by SRI International and the University of6* Cambridge Computer Laboratory (Department of Computer Science and7* Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the8* DARPA SSITH research programme.9*10* This software was developed by SRI International and the University of11* Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)12* ("CTSRD"), as part of the DARPA CRASH research programme.13*14* Redistribution and use in source and binary forms, with or without15* modification, are permitted provided that the following conditions16* are met:17* 1. Redistributions of source code must retain the above copyright18* notice, this list of conditions and the following disclaimer.19* 2. Redistributions in binary form must reproduce the above copyright20* notice, this list of conditions and the following disclaimer in the21* documentation and/or other materials provided with the distribution.22*23* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND24* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE25* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE26* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE27* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL28* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS29* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)30* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT31* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY32* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF33* SUCH DAMAGE.34*/35#if __has_include_next(<limits.h>)36#include_next <limits.h>37#endif3839#if __has_include(<linux/limits.h>)40#include <linux/limits.h>41#endif4243#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L44#if !defined(_GNU_SOURCE)45#warning "Attempting to use limits.h with -std=c89/without _GNU_SOURCE, many macros will be missing"46#endif47#endif /* C89 */4849#ifndef IOV_MAX50#error IOV_MAX should be defined51#endif5253#ifndef MAXBSIZE54#define MAXBSIZE 65536 /* must be power of 2 */55#endif5657#ifndef OFF_MAX58#define OFF_MAX UINT64_MAX59#endif6061#ifndef QUAD_MAX62#define QUAD_MAX INT64_MAX63#endif6465#ifndef GID_MAX66#define GID_MAX ((gid_t)-1)67#endif6869#ifndef UID_MAX70#define UID_MAX ((uid_t)-1)71#endif7273#ifdef __GLIBC__74#ifndef _LIBC_LIMITS_H_75#error "DIDN't include correct limits?"76#endif7778#ifndef __USE_XOPEN79#warning __USE_XOPEN should be defined (did you forget to set _GNU_SOURCE?)80#endif8182#include <sys/types.h>8384/* Sanity checks for glibc */85#ifndef _GNU_SOURCE86#error _GNU_SOURCE not defined87#endif8889#ifndef __USE_POSIX90#warning __USE_POSIX not defined91#endif9293#if defined __GNUC__ && !defined _GCC_LIMITS_H_94#error "GCC limits not included"95#endif9697#ifndef __OFF_T_MATCHES_OFF64_T98#error "Expected 64-bit off_t"99#endif100101#ifndef _POSIX_PATH_MAX102#define _POSIX_PATH_MAX PATH_MAX103#endif104#endif105106107