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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*-
michael@0 2 * Copyright (c) 1991, 1993
michael@0 3 * The Regents of the University of California. All rights reserved.
michael@0 4 *
michael@0 5 * Redistribution and use in source and binary forms, with or without
michael@0 6 * modification, are permitted provided that the following conditions
michael@0 7 * are met:
michael@0 8 * 1. Redistributions of source code must retain the above copyright
michael@0 9 * notice, this list of conditions and the following disclaimer.
michael@0 10 * 2. Redistributions in binary form must reproduce the above copyright
michael@0 11 * notice, this list of conditions and the following disclaimer in the
michael@0 12 * documentation and/or other materials provided with the distribution.
michael@0 13 * 3. ***REMOVED*** - see
michael@0 14 * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
michael@0 15 * 4. Neither the name of the University nor the names of its contributors
michael@0 16 * may be used to endorse or promote products derived from this software
michael@0 17 * without specific prior written permission.
michael@0 18 *
michael@0 19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
michael@0 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
michael@0 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
michael@0 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
michael@0 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
michael@0 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
michael@0 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
michael@0 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
michael@0 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
michael@0 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@0 29 * SUCH DAMAGE.
michael@0 30 *
michael@0 31 * @(#)compat.h 8.13 (Berkeley) 2/21/94
michael@0 32 */
michael@0 33
michael@0 34 #ifndef _COMPAT_H_
michael@0 35 #define _COMPAT_H_
michael@0 36
michael@0 37 #include <sys/types.h>
michael@0 38
michael@0 39 /*
michael@0 40 * If your system doesn't typedef u_long, u_short, or u_char, change
michael@0 41 * the 0 to a 1.
michael@0 42 */
michael@0 43 #if 0
michael@0 44 typedef unsigned char u_char; /* 4.[34]BSD names. */
michael@0 45 typedef unsigned int u_int;
michael@0 46 typedef unsigned long u_long;
michael@0 47 typedef unsigned short u_short;
michael@0 48 #endif
michael@0 49
michael@0 50 /* If your system doesn't typedef size_t, change the 0 to a 1. */
michael@0 51 #if 0
michael@0 52 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */
michael@0 53 #endif
michael@0 54
michael@0 55 /* If your system doesn't typedef ssize_t, change the 0 to a 1. */
michael@0 56 #if 0
michael@0 57 typedef int ssize_t; /* POSIX names. */
michael@0 58 #endif
michael@0 59
michael@0 60 /*
michael@0 61 * If your system doesn't have the POSIX type for a signal mask,
michael@0 62 * change the 0 to a 1.
michael@0 63 */
michael@0 64 #if 0 /* POSIX 1003.1 signal mask type. */
michael@0 65 typedef unsigned int sigset_t;
michael@0 66 #endif
michael@0 67
michael@0 68 /*
michael@0 69 * If your system's vsprintf returns a char *, not an int,
michael@0 70 * change the 0 to a 1.
michael@0 71 */
michael@0 72 #if defined (__sun) && !defined(__SVR4) /* SUNOS */
michael@0 73 #define VSPRINTF_CHARSTAR
michael@0 74 #endif
michael@0 75 /*
michael@0 76 * If you don't have POSIX 1003.1 signals, the signal code surrounding the
michael@0 77 * temporary file creation is intended to block all of the possible signals
michael@0 78 * long enough to create the file and unlink it. All of this stuff is
michael@0 79 * intended to use old-style BSD calls to fake POSIX 1003.1 calls.
michael@0 80 */
michael@0 81 #ifdef NO_POSIX_SIGNALS
michael@0 82 #define sigemptyset(set) (*(set) = 0)
michael@0 83 #define sigfillset(set) (*(set) = ~(sigset_t)0, 0)
michael@0 84 #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0)
michael@0 85 #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0)
michael@0 86 #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0)
michael@0 87
michael@0 88 #define SIG_BLOCK 1
michael@0 89 #define SIG_UNBLOCK 2
michael@0 90 #define SIG_SETMASK 3
michael@0 91
michael@0 92 static int __sigtemp; /* For the use of sigprocmask */
michael@0 93
michael@0 94 /* Repeated test of oset != NULL is to avoid "*0". */
michael@0 95 #define sigprocmask(how, set, oset) \
michael@0 96 ((__sigtemp = \
michael@0 97 (((how) == SIG_BLOCK) ? \
michael@0 98 sigblock(0) | *(set) : \
michael@0 99 (((how) == SIG_UNBLOCK) ? \
michael@0 100 sigblock(0) & ~(*(set)) : \
michael@0 101 ((how) == SIG_SETMASK ? \
michael@0 102 *(set) : sigblock(0))))), \
michael@0 103 ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \
michael@0 104 sigsetmask(__sigtemp)), 0)
michael@0 105 #endif
michael@0 106
michael@0 107 /*
michael@0 108 * If your system doesn't have an include file with the appropriate
michael@0 109 * byte order set, make sure you specify the correct one.
michael@0 110 */
michael@0 111 #ifndef BYTE_ORDER
michael@0 112 #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
michael@0 113 #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
michael@0 114 #define BYTE_ORDER BIG_ENDIAN /* Set for your system. */
michael@0 115 #endif
michael@0 116
michael@0 117 #if defined(SYSV) || defined(SYSTEM5) || defined(__sun)
michael@0 118 #define index(a, b) strchr(a, b)
michael@0 119 #define rindex(a, b) strrchr(a, b)
michael@0 120 #define bzero(a, b) memset(a, 0, b)
michael@0 121 #define bcmp(a, b, n) memcmp(a, b, n)
michael@0 122 #define bcopy(a, b, n) memmove(b, a, n)
michael@0 123 #endif
michael@0 124
michael@0 125 #if defined(BSD) || defined(BSD4_3)
michael@0 126 #define strchr(a, b) index(a, b)
michael@0 127 #define strrchr(a, b) rindex(a, b)
michael@0 128 #define memcmp(a, b, n) bcmp(a, b, n)
michael@0 129 #define memmove(a, b, n) bcopy(b, a, n)
michael@0 130 #endif
michael@0 131
michael@0 132 /*
michael@0 133 * 32-bit machine. The db routines are theoretically independent of
michael@0 134 * the size of u_shorts and u_longs, but I don't know that anyone has
michael@0 135 * ever actually tried it. At a minimum, change the following #define's
michael@0 136 * if you are trying to compile on a different type of system.
michael@0 137 */
michael@0 138 #ifndef USHRT_MAX
michael@0 139 #define USHRT_MAX 0xFFFF
michael@0 140 #define ULONG_MAX 0xFFFFFFFF
michael@0 141 #endif
michael@0 142
michael@0 143 #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */
michael@0 144 #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
michael@0 145 #endif
michael@0 146
michael@0 147 #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */
michael@0 148 #define _POSIX2_RE_DUP_MAX 255
michael@0 149 #endif
michael@0 150
michael@0 151 /*
michael@0 152 * If you can't provide lock values in the open(2) call. Note, this
michael@0 153 * allows races to happen.
michael@0 154 */
michael@0 155 #ifndef O_EXLOCK /* 4.4BSD extension. */
michael@0 156 #define O_EXLOCK 0
michael@0 157 #endif
michael@0 158
michael@0 159 #ifndef O_SHLOCK /* 4.4BSD extension. */
michael@0 160 #define O_SHLOCK 0
michael@0 161 #endif
michael@0 162
michael@0 163 #ifndef EFTYPE
michael@0 164 #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */
michael@0 165 #endif
michael@0 166
michael@0 167 #ifndef WCOREDUMP /* 4.4BSD extension */
michael@0 168 #define WCOREDUMP(a) 0
michael@0 169 #endif
michael@0 170
michael@0 171 #ifndef STDERR_FILENO
michael@0 172 #define STDIN_FILENO 0 /* ANSI C #defines */
michael@0 173 #define STDOUT_FILENO 1
michael@0 174 #define STDERR_FILENO 2
michael@0 175 #endif
michael@0 176
michael@0 177 #ifndef SEEK_END
michael@0 178 #define SEEK_SET 0 /* POSIX 1003.1 seek values */
michael@0 179 #define SEEK_CUR 1
michael@0 180 #define SEEK_END 2
michael@0 181 #endif
michael@0 182
michael@0 183 #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */
michael@0 184 #define _POSIX_VDISABLE 0 /* Some systems used 0. */
michael@0 185 #endif
michael@0 186
michael@0 187 #ifndef TCSASOFT /* 4.4BSD extension. */
michael@0 188 #define TCSASOFT 0
michael@0 189 #endif
michael@0 190
michael@0 191 #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */
michael@0 192 #define _POSIX2_RE_DUP_MAX 255
michael@0 193 #endif
michael@0 194
michael@0 195 #ifndef NULL /* ANSI C #defines NULL everywhere. */
michael@0 196 #define NULL 0
michael@0 197 #endif
michael@0 198
michael@0 199 #ifndef MAX /* Usually found in <sys/param.h>. */
michael@0 200 #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a))
michael@0 201 #endif
michael@0 202 #ifndef MIN /* Usually found in <sys/param.h>. */
michael@0 203 #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
michael@0 204 #endif
michael@0 205
michael@0 206 /* Default file permissions. */
michael@0 207 #ifndef DEFFILEMODE /* 4.4BSD extension. */
michael@0 208 #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
michael@0 209 #endif
michael@0 210
michael@0 211 #ifndef __sun
michael@0 212 #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */
michael@0 213 #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */
michael@0 214 #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */
michael@0 215 #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */
michael@0 216 #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */
michael@0 217 #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */
michael@0 218 #endif
michael@0 219 #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */
michael@0 220 #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */
michael@0 221 #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */
michael@0 222 #endif
michael@0 223 #endif /* __sun */
michael@0 224
michael@0 225 /* The type of a va_list. */
michael@0 226 #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */
michael@0 227 #define _BSD_VA_LIST_ char *
michael@0 228 #endif
michael@0 229
michael@0 230 #endif /* !_COMPAT_H_ */

mercurial