Update copyright dates with scripts/update-copyrights.
[glibc.git] / misc / sys / param.h
blob62b7ed26f41c96cca3637271a1055f4aa0eccf65
1 /* Compatibility header for old-style Unix parameters and limits.
2 Copyright (C) 1995-2015 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _SYS_PARAM_H
20 #define _SYS_PARAM_H 1
22 #define __need_NULL
23 #include <stddef.h>
25 #include <sys/types.h>
26 #include <limits.h>
27 #include <endian.h> /* Define BYTE_ORDER et al. */
28 #include <signal.h> /* Define NSIG. */
30 /* This file defines some things in system-specific ways. */
31 #include <bits/param.h>
34 /* BSD names for some <limits.h> values. */
36 #define NBBY CHAR_BIT
38 #if !defined NGROUPS && defined NGROUPS_MAX
39 # define NGROUPS NGROUPS_MAX
40 #endif
41 #if !defined MAXSYMLINKS && defined SYMLOOP_MAX
42 # define MAXSYMLINKS SYMLOOP_MAX
43 #endif
44 #if !defined CANBSIZ && defined MAX_CANON
45 # define CANBSIZ MAX_CANON
46 #endif
47 #if !defined MAXPATHLEN && defined PATH_MAX
48 # define MAXPATHLEN PATH_MAX
49 #endif
50 #if !defined NOFILE && defined OPEN_MAX
51 # define NOFILE OPEN_MAX
52 #endif
53 #ifndef NCARGS
54 # ifdef ARG_MAX
55 # define NCARGS ARG_MAX
56 # else
57 /* ARG_MAX is unlimited, but we define NCARGS for BSD programs that want to
58 compare against some fixed limit. */
59 # define NCARGS INT_MAX
60 # endif
61 #endif
64 /* Magical constants. */
65 #ifndef NOGROUP
66 # define NOGROUP 65535 /* Marker for empty group set member. */
67 #endif
68 #ifndef NODEV
69 # define NODEV ((dev_t) -1) /* Non-existent device. */
70 #endif
73 /* Unit of `st_blocks'. */
74 #ifndef DEV_BSIZE
75 # define DEV_BSIZE 512
76 #endif
79 /* Bit map related macros. */
80 #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
81 #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
82 #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
83 #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
85 /* Macros for counting and rounding. */
86 #ifndef howmany
87 # define howmany(x, y) (((x) + ((y) - 1)) / (y))
88 #endif
89 #ifdef __GNUC__
90 # define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \
91 ? (((x) + (y) - 1) & ~((y) - 1)) \
92 : ((((x) + ((y) - 1)) / (y)) * (y)))
93 #else
94 # define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
95 #endif
96 #define powerof2(x) ((((x) - 1) & (x)) == 0)
98 /* Macros for min/max. */
99 #define MIN(a,b) (((a)<(b))?(a):(b))
100 #define MAX(a,b) (((a)>(b))?(a):(b))
103 #endif /* sys/param.h */