security/nss/lib/dbm/include/ncompat.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/lib/dbm/include/ncompat.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,230 @@
     1.4 +/*-
     1.5 + * Copyright (c) 1991, 1993
     1.6 + *	The Regents of the University of California.  All rights reserved.
     1.7 + *
     1.8 + * Redistribution and use in source and binary forms, with or without
     1.9 + * modification, are permitted provided that the following conditions
    1.10 + * are met:
    1.11 + * 1. Redistributions of source code must retain the above copyright
    1.12 + *    notice, this list of conditions and the following disclaimer.
    1.13 + * 2. Redistributions in binary form must reproduce the above copyright
    1.14 + *    notice, this list of conditions and the following disclaimer in the
    1.15 + *    documentation and/or other materials provided with the distribution.
    1.16 + * 3. ***REMOVED*** - see 
    1.17 + *    ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
    1.18 + * 4. Neither the name of the University nor the names of its contributors
    1.19 + *    may be used to endorse or promote products derived from this software
    1.20 + *    without specific prior written permission.
    1.21 + *
    1.22 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    1.23 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.24 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.25 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    1.26 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.27 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.28 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.29 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.30 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.31 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.32 + * SUCH DAMAGE.
    1.33 + *
    1.34 + *	@(#)compat.h	8.13 (Berkeley) 2/21/94
    1.35 + */
    1.36 +
    1.37 +#ifndef	_COMPAT_H_
    1.38 +#define	_COMPAT_H_
    1.39 +
    1.40 +#include <sys/types.h>
    1.41 +
    1.42 +/*
    1.43 + * If your system doesn't typedef u_long, u_short, or u_char, change
    1.44 + * the 0 to a 1.
    1.45 + */
    1.46 +#if 0
    1.47 +typedef unsigned char	u_char;		/* 4.[34]BSD names. */
    1.48 +typedef unsigned int	u_int;
    1.49 +typedef unsigned long	u_long;
    1.50 +typedef unsigned short	u_short;
    1.51 +#endif
    1.52 +
    1.53 +/* If your system doesn't typedef size_t, change the 0 to a 1. */
    1.54 +#if 0
    1.55 +typedef unsigned int	size_t;		/* POSIX, 4.[34]BSD names. */
    1.56 +#endif
    1.57 +
    1.58 +/* If your system doesn't typedef ssize_t, change the 0 to a 1. */
    1.59 +#if 0
    1.60 +typedef	int		ssize_t;	/* POSIX names. */
    1.61 +#endif
    1.62 +
    1.63 +/*
    1.64 + * If your system doesn't have the POSIX type for a signal mask,
    1.65 + * change the 0 to a 1.
    1.66 + */
    1.67 +#if 0					/* POSIX 1003.1 signal mask type. */
    1.68 +typedef unsigned int	sigset_t;
    1.69 +#endif
    1.70 +
    1.71 +/*
    1.72 + * If your system's vsprintf returns a char *, not an int,
    1.73 + * change the 0 to a 1.
    1.74 + */
    1.75 +#if defined (__sun) && !defined(__SVR4) /* SUNOS */
    1.76 +#define	VSPRINTF_CHARSTAR
    1.77 +#endif
    1.78 +/*
    1.79 + * If you don't have POSIX 1003.1 signals, the signal code surrounding the 
    1.80 + * temporary file creation is intended to block all of the possible signals
    1.81 + * long enough to create the file and unlink it.  All of this stuff is
    1.82 + * intended to use old-style BSD calls to fake POSIX 1003.1 calls.
    1.83 + */
    1.84 +#ifdef	NO_POSIX_SIGNALS
    1.85 +#define	sigemptyset(set)	(*(set) = 0)
    1.86 +#define	sigfillset(set)		(*(set) = ~(sigset_t)0, 0)
    1.87 +#define	sigaddset(set,signo)	(*(set) |= sigmask(signo), 0)
    1.88 +#define	sigdelset(set,signo)	(*(set) &= ~sigmask(signo), 0)
    1.89 +#define	sigismember(set,signo)	((*(set) & sigmask(signo)) != 0)
    1.90 +
    1.91 +#define	SIG_BLOCK	1
    1.92 +#define	SIG_UNBLOCK	2
    1.93 +#define	SIG_SETMASK	3
    1.94 +
    1.95 +static int __sigtemp;		/* For the use of sigprocmask */
    1.96 +
    1.97 +/* Repeated test of oset != NULL is to avoid "*0". */
    1.98 +#define	sigprocmask(how, set, oset)					\
    1.99 +	((__sigtemp =							\
   1.100 +	(((how) == SIG_BLOCK) ?						\
   1.101 +		sigblock(0) | *(set) :					\
   1.102 +	(((how) == SIG_UNBLOCK) ?					\
   1.103 +		sigblock(0) & ~(*(set)) :				\
   1.104 +	((how) == SIG_SETMASK ?						\
   1.105 +		*(set) : sigblock(0))))),				\
   1.106 +	((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) :	\
   1.107 +		sigsetmask(__sigtemp)), 0)
   1.108 +#endif
   1.109 +
   1.110 +/*
   1.111 + * If your system doesn't have an include file with the appropriate
   1.112 + * byte order set, make sure you specify the correct one.
   1.113 + */
   1.114 +#ifndef BYTE_ORDER
   1.115 +#define	LITTLE_ENDIAN	1234		/* LSB first: i386, vax */
   1.116 +#define	BIG_ENDIAN	4321		/* MSB first: 68000, ibm, net */
   1.117 +#define	BYTE_ORDER	BIG_ENDIAN	/* Set for your system. */
   1.118 +#endif
   1.119 +
   1.120 +#if defined(SYSV) || defined(SYSTEM5) || defined(__sun)
   1.121 +#define	index(a, b)		strchr(a, b)
   1.122 +#define	rindex(a, b)		strrchr(a, b)
   1.123 +#define	bzero(a, b)		memset(a, 0, b)
   1.124 +#define	bcmp(a, b, n)		memcmp(a, b, n)
   1.125 +#define	bcopy(a, b, n)		memmove(b, a, n)
   1.126 +#endif
   1.127 +
   1.128 +#if defined(BSD) || defined(BSD4_3)
   1.129 +#define	strchr(a, b)		index(a, b)
   1.130 +#define	strrchr(a, b)		rindex(a, b)
   1.131 +#define	memcmp(a, b, n)		bcmp(a, b, n)
   1.132 +#define	memmove(a, b, n)	bcopy(b, a, n)
   1.133 +#endif
   1.134 +
   1.135 +/*
   1.136 + * 32-bit machine.  The db routines are theoretically independent of
   1.137 + * the size of u_shorts and u_longs, but I don't know that anyone has
   1.138 + * ever actually tried it.  At a minimum, change the following #define's
   1.139 + * if you are trying to compile on a different type of system.
   1.140 + */
   1.141 +#ifndef USHRT_MAX
   1.142 +#define	USHRT_MAX		0xFFFF
   1.143 +#define	ULONG_MAX		0xFFFFFFFF
   1.144 +#endif
   1.145 +
   1.146 +#ifndef O_ACCMODE			/* POSIX 1003.1 access mode mask. */
   1.147 +#define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
   1.148 +#endif
   1.149 +
   1.150 +#ifndef	_POSIX2_RE_DUP_MAX		/* POSIX 1003.2 RE limit. */
   1.151 +#define	_POSIX2_RE_DUP_MAX	255
   1.152 +#endif
   1.153 +
   1.154 +/*
   1.155 + * If you can't provide lock values in the open(2) call.  Note, this
   1.156 + * allows races to happen.
   1.157 + */
   1.158 +#ifndef O_EXLOCK			/* 4.4BSD extension. */
   1.159 +#define	O_EXLOCK	0
   1.160 +#endif
   1.161 +
   1.162 +#ifndef O_SHLOCK			/* 4.4BSD extension. */
   1.163 +#define	O_SHLOCK	0
   1.164 +#endif
   1.165 +
   1.166 +#ifndef EFTYPE
   1.167 +#define	EFTYPE		EINVAL		/* POSIX 1003.1 format errno. */
   1.168 +#endif
   1.169 +
   1.170 +#ifndef	WCOREDUMP			/* 4.4BSD extension */
   1.171 +#define	WCOREDUMP(a)	0
   1.172 +#endif
   1.173 +
   1.174 +#ifndef	STDERR_FILENO
   1.175 +#define	STDIN_FILENO	0		/* ANSI C #defines */
   1.176 +#define	STDOUT_FILENO	1
   1.177 +#define	STDERR_FILENO	2
   1.178 +#endif
   1.179 +
   1.180 +#ifndef SEEK_END
   1.181 +#define	SEEK_SET	0		/* POSIX 1003.1 seek values */
   1.182 +#define	SEEK_CUR	1
   1.183 +#define	SEEK_END	2
   1.184 +#endif
   1.185 +
   1.186 +#ifndef _POSIX_VDISABLE			/* POSIX 1003.1 disabling char. */
   1.187 +#define	_POSIX_VDISABLE	0		/* Some systems used 0. */
   1.188 +#endif
   1.189 +
   1.190 +#ifndef	TCSASOFT			/* 4.4BSD extension. */
   1.191 +#define	TCSASOFT	0
   1.192 +#endif
   1.193 +
   1.194 +#ifndef _POSIX2_RE_DUP_MAX		/* POSIX 1003.2 values. */
   1.195 +#define	_POSIX2_RE_DUP_MAX	255
   1.196 +#endif
   1.197 +
   1.198 +#ifndef NULL				/* ANSI C #defines NULL everywhere. */
   1.199 +#define	NULL		0
   1.200 +#endif
   1.201 +
   1.202 +#ifndef	MAX				/* Usually found in <sys/param.h>. */
   1.203 +#define	MAX(_a,_b)	((_a)<(_b)?(_b):(_a))
   1.204 +#endif
   1.205 +#ifndef	MIN				/* Usually found in <sys/param.h>. */
   1.206 +#define	MIN(_a,_b)	((_a)<(_b)?(_a):(_b))
   1.207 +#endif
   1.208 +
   1.209 +/* Default file permissions. */
   1.210 +#ifndef DEFFILEMODE			/* 4.4BSD extension. */
   1.211 +#define	DEFFILEMODE	(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
   1.212 +#endif
   1.213 +
   1.214 +#ifndef __sun
   1.215 +#ifndef S_ISDIR				/* POSIX 1003.1 file type tests. */
   1.216 +#define	S_ISDIR(m)	((m & 0170000) == 0040000)	/* directory */
   1.217 +#define	S_ISCHR(m)	((m & 0170000) == 0020000)	/* char special */
   1.218 +#define	S_ISBLK(m)	((m & 0170000) == 0060000)	/* block special */
   1.219 +#define	S_ISREG(m)	((m & 0170000) == 0100000)	/* regular file */
   1.220 +#define	S_ISFIFO(m)	((m & 0170000) == 0010000)	/* fifo */
   1.221 +#endif
   1.222 +#ifndef S_ISLNK				/* BSD POSIX 1003.1 extensions */
   1.223 +#define	S_ISLNK(m)	((m & 0170000) == 0120000)	/* symbolic link */
   1.224 +#define	S_ISSOCK(m)	((m & 0170000) == 0140000)	/* socket */
   1.225 +#endif
   1.226 +#endif /* __sun */
   1.227 +
   1.228 +/* The type of a va_list. */
   1.229 +#ifndef _BSD_VA_LIST_			/* 4.4BSD #define. */
   1.230 +#define	_BSD_VA_LIST_	char *
   1.231 +#endif
   1.232 +
   1.233 +#endif /* !_COMPAT_H_ */

mercurial