2003-05-12 19:06:27 +08:00
|
|
|
/* sys/param.h
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
#ifndef _SYS_PARAM_H
|
|
|
|
#define _SYS_PARAM_H
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
/* Linux includes limits.h, but this is not universally done. */
|
|
|
|
#include <limits.h>
|
|
|
|
|
2012-11-01 00:48:50 +08:00
|
|
|
#define __need_NULL
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2003-05-12 19:06:27 +08:00
|
|
|
/* Max number of open files. The Posix version is OPEN_MAX. */
|
|
|
|
/* Number of fds is virtually unlimited in cygwin, but we must provide
|
|
|
|
some reasonable value for Posix conformance */
|
2022-07-07 02:43:16 +08:00
|
|
|
#if !defined NOFILE && defined OPEN_MAX
|
|
|
|
# define NOFILE OPEN_MAX
|
|
|
|
#endif
|
2003-05-12 19:06:27 +08:00
|
|
|
|
|
|
|
/* Max number of groups; must keep in sync with NGROUPS_MAX in limits.h */
|
2011-07-01 20:45:25 +08:00
|
|
|
#define NGROUPS NGROUPS_MAX
|
2003-05-12 19:06:27 +08:00
|
|
|
|
|
|
|
/* Ticks/second for system calls such as times() */
|
|
|
|
#define HZ 1000
|
|
|
|
|
2011-07-01 20:45:25 +08:00
|
|
|
/* Max hostname size that can be dealt with (== Win32 MAX_HOSTNAME_LEN) */
|
|
|
|
#define MAXHOSTNAMELEN 128
|
2003-05-12 19:06:27 +08:00
|
|
|
|
2011-07-01 20:45:25 +08:00
|
|
|
/* Maximum path length including trailing NUL; the Posix version is PATH_MAX.
|
|
|
|
MAXPATHLEN is the BSD variant. */
|
2007-10-18 18:42:43 +08:00
|
|
|
#define MAXPATHLEN PATH_MAX
|
2003-05-12 19:06:27 +08:00
|
|
|
|
2011-07-01 20:45:25 +08:00
|
|
|
/* Maximum number of nested symlinks; the Posix version is SYMLOOP_MAX.
|
|
|
|
MAXSYMLINKS is the BSD variant. */
|
|
|
|
#define MAXSYMLINKS SYMLOOP_MAX
|
|
|
|
|
2003-05-30 16:39:02 +08:00
|
|
|
/* This is the number of bytes per block given in the st_blocks stat member.
|
|
|
|
It should be in sync with S_BLKSIZE in sys/stat.h. S_BLKSIZE is the
|
|
|
|
BSD variant of this constant. */
|
|
|
|
#define DEV_BSIZE 1024
|
|
|
|
|
2003-08-12 18:23:40 +08:00
|
|
|
#ifndef NBBY
|
|
|
|
#define NBBY 8
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Bit map related macros. */
|
|
|
|
#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
|
|
|
|
#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
|
|
|
|
#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
|
|
|
|
#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
|
|
|
|
|
|
|
|
/* Macros for counting and rounding. */
|
|
|
|
#ifndef howmany
|
|
|
|
#define howmany(x, y) (((x)+((y)-1))/(y))
|
|
|
|
#endif
|
|
|
|
#define rounddown(x, y) (((x)/(y))*(y))
|
|
|
|
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */
|
|
|
|
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
|
|
|
|
#define powerof2(x) ((((x)-1)&(x))==0)
|
|
|
|
|
|
|
|
/* Macros for min/max. */
|
|
|
|
#define MIN(a,b) (((a)<(b))?(a):(b))
|
|
|
|
#define MAX(a,b) (((a)>(b))?(a):(b))
|
|
|
|
|
2003-05-12 19:06:27 +08:00
|
|
|
#endif
|