Blame misc/sys/param.h

Packit 6c4009
/* Compatibility header for old-style Unix parameters and limits.
Packit 6c4009
   Copyright (C) 1995-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _SYS_PARAM_H
Packit 6c4009
#define _SYS_PARAM_H    1
Packit 6c4009
Packit 6c4009
#define __need_NULL
Packit 6c4009
#include <stddef.h>
Packit 6c4009
Packit 6c4009
#include <sys/types.h>
Packit 6c4009
#include <limits.h>
Packit 6c4009
#include <endian.h>                     /* Define BYTE_ORDER et al.  */
Packit 6c4009
#include <signal.h>                     /* Define NSIG.  */
Packit 6c4009
Packit 6c4009
/* This file defines some things in system-specific ways.  */
Packit 6c4009
#include <bits/param.h>
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* BSD names for some <limits.h> values.  */
Packit 6c4009
Packit 6c4009
#define NBBY		CHAR_BIT
Packit 6c4009
Packit 6c4009
#if !defined NGROUPS && defined NGROUPS_MAX
Packit 6c4009
# define NGROUPS	NGROUPS_MAX
Packit 6c4009
#endif
Packit 6c4009
#if !defined MAXSYMLINKS && defined SYMLOOP_MAX
Packit 6c4009
# define MAXSYMLINKS	SYMLOOP_MAX
Packit 6c4009
#endif
Packit 6c4009
#if !defined CANBSIZ && defined MAX_CANON
Packit 6c4009
# define CANBSIZ	MAX_CANON
Packit 6c4009
#endif
Packit 6c4009
#if !defined MAXPATHLEN && defined PATH_MAX
Packit 6c4009
# define MAXPATHLEN	PATH_MAX
Packit 6c4009
#endif
Packit 6c4009
#if !defined NOFILE && defined OPEN_MAX
Packit 6c4009
# define NOFILE		OPEN_MAX
Packit 6c4009
#endif
Packit 6c4009
#if !defined MAXHOSTNAMELEN && defined HOST_NAME_MAX
Packit 6c4009
# define MAXHOSTNAMELEN	HOST_NAME_MAX
Packit 6c4009
#endif
Packit 6c4009
#ifndef NCARGS
Packit 6c4009
# ifdef ARG_MAX
Packit 6c4009
#  define NCARGS	ARG_MAX
Packit 6c4009
# else
Packit 6c4009
/* ARG_MAX is unlimited, but we define NCARGS for BSD programs that want to
Packit 6c4009
   compare against some fixed limit.  */
Packit 6c4009
# define NCARGS		INT_MAX
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Magical constants.  */
Packit 6c4009
#ifndef NOGROUP
Packit 6c4009
# define NOGROUP	65535     /* Marker for empty group set member.  */
Packit 6c4009
#endif
Packit 6c4009
#ifndef NODEV
Packit 6c4009
# define NODEV		((dev_t) -1)    /* Non-existent device.  */
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Unit of `st_blocks'.  */
Packit 6c4009
#ifndef DEV_BSIZE
Packit 6c4009
# define DEV_BSIZE	512
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Bit map related macros.  */
Packit 6c4009
#define setbit(a,i)     ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
Packit 6c4009
#define clrbit(a,i)     ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
Packit 6c4009
#define isset(a,i)      ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
Packit 6c4009
#define isclr(a,i)      (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
Packit 6c4009
Packit 6c4009
/* Macros for counting and rounding.  */
Packit 6c4009
#ifndef howmany
Packit 6c4009
# define howmany(x, y)  (((x) + ((y) - 1)) / (y))
Packit 6c4009
#endif
Packit 6c4009
#ifdef __GNUC__
Packit 6c4009
# define roundup(x, y)  (__builtin_constant_p (y) && powerof2 (y)             \
Packit 6c4009
                         ? (((x) + (y) - 1) & ~((y) - 1))                     \
Packit 6c4009
                         : ((((x) + ((y) - 1)) / (y)) * (y)))
Packit 6c4009
#else
Packit 6c4009
# define roundup(x, y)  ((((x) + ((y) - 1)) / (y)) * (y))
Packit 6c4009
#endif
Packit 6c4009
#define powerof2(x)     ((((x) - 1) & (x)) == 0)
Packit 6c4009
Packit 6c4009
/* Macros for min/max.  */
Packit 6c4009
#define MIN(a,b) (((a)<(b))?(a):(b))
Packit 6c4009
#define MAX(a,b) (((a)>(b))?(a):(b))
Packit 6c4009
Packit 6c4009
Packit 6c4009
#endif  /* sys/param.h */