code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
/*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)local.h 5.3 (Berkeley) 5/6/93 */ /* * Information local to this implementation of stdio, * in particular, macros and private variables. */ int __sflush __P((FILE *)); FILE *__sfp __P((void)); int __srefill __P((FILE *)); int __sread __P((void *, char *, int)); int __swrite __P((void *, char const *, int)); fpos_t __sseek __P((void *, fpos_t, int)); int __sclose __P((void *)); void __sinit __P((void)); void _cleanup __P((void)); void (*__cleanup) __P((void)); void __smakebuf __P((FILE *)); int __swhatbuf __P((FILE *, size_t *, int *)); int _fwalk __P((int (*)(FILE *))); int __swsetup __P((FILE *)); int __sflags __P((const char *, int *)); extern int __sdidinit; /* * Return true iff the given FILE cannot be written now. */ #define cantwrite(fp) \ ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \ __swsetup(fp)) /* * Test whether the given stdio file has an active ungetc buffer; * release such a buffer, without restoring ordinary unread data. */ #define HASUB(fp) ((fp)->_ub._base != NULL) #define FREEUB(fp) { \ if ((fp)->_ub._base != (fp)->_ubuf) \ free((char *)(fp)->_ub._base); \ (fp)->_ub._base = NULL; \ } /* * test for an fgetline() buffer. */ #define HASLB(fp) ((fp)->_lb._base != NULL) #define FREELB(fp) { \ free((char *)(fp)->_lb._base); \ (fp)->_lb._base = NULL; \ }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/bsdi.1.0/local/local.h
C
apache-2.0
3,243
/*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)makebuf.c 5.3 (Berkeley) 5/6/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include "local.h" /* * Allocate a file buffer, or switch to unbuffered I/O. * Per the ANSI C standard, ALL tty devices default to line buffered. * * As a side effect, we set __SOPT or __SNPT (en/dis-able fseek * optimisation) right after the fstat() that finds the buffer size. */ void __smakebuf(fp) register FILE *fp; { register void *p; register int flags; size_t size; int couldbetty; if (fp->_flags & __SNBF) { fp->_bf._base = fp->_p = fp->_nbuf; fp->_bf._size = 1; return; } flags = __swhatbuf(fp, &size, &couldbetty); if ((p = malloc(size)) == NULL) { fp->_flags |= __SNBF; fp->_bf._base = fp->_p = fp->_nbuf; fp->_bf._size = 1; return; } __cleanup = _cleanup; flags |= __SMBF; fp->_bf._base = fp->_p = p; fp->_bf._size = size; if (couldbetty && isatty(fp->_file)) flags |= __SLBF; fp->_flags |= flags; } /* * Internal routine to determine `proper' buffering for a file. */ int __swhatbuf(fp, bufsize, couldbetty) register FILE *fp; size_t *bufsize; int *couldbetty; { struct stat st; if (fp->_file < 0 || fstat(fp->_file, &st) < 0) { *couldbetty = 0; *bufsize = BUFSIZ; return (__SNPT); } /* could be a tty iff it is a character device */ *couldbetty = (st.st_mode & S_IFMT) == S_IFCHR; if (st.st_blksize <= 0) { *bufsize = BUFSIZ; return (__SNPT); } /* * Optimise fseek() only if it is a regular file. (The test for * __sseek is mainly paranoia.) It is safe to set _blksize * unconditionally; it will only be used if __SOPT is also set. */ *bufsize = st.st_blksize; fp->_blksize = st.st_blksize; return ((st.st_mode & S_IFMT) == S_IFREG && fp->_seek == __sseek ? __SOPT : __SNPT); }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/bsdi.1.0/local/makebuf.c
C
apache-2.0
3,832
/*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) ! static char sccsid[] = "@(#)setvbuf.c 5.5 (Berkeley) 5/6/93"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> #include <stdlib.h> #include "local.h" /* * Set one of the three kinds of buffering, optionally including * a buffer. */ setvbuf(fp, buf, mode, size) register FILE *fp; char *buf; register int mode; register size_t size; { register int ret, flags; size_t iosize; int ttyflag; /* * Verify arguments. The `int' limit on `size' is due to this * particular implementation. Note, buf and size are ignored * when setting _IONBF. */ if (mode != _IONBF) if ((mode != _IOFBF && mode != _IOLBF) || (int)size < 0) return (EOF); /* * Write current buffer, if any. Discard unread input, cancel * line buffering, and free old buffer if malloc()ed. */ ret = 0; (void)__sflush(fp); fp->_r = fp->_lbfsize = 0; flags = fp->_flags; if (flags & __SMBF) free((void *)fp->_bf._base); flags &= ~(__SLBF | __SNBF | __SMBF | __SOPT | __SNPT); /* If setting unbuffered mode, skip all the hard work. */ if (mode == _IONBF) goto nbf; /* * Find optimal I/O size for seek optimization. This also returns * a `tty flag' to suggest that we check isatty(fd), but we do not * care since our caller told us how to buffer. */ flags |= __swhatbuf(fp, &iosize, &ttyflag); if (size == 0) { buf = NULL; /* force local allocation */ size = iosize; } /* Allocate buffer if needed. */ if (buf == NULL) { if ((buf = malloc(size)) == NULL) { /* * Unable to honor user's request. We will return * failure, but try again with file system size. */ ret = EOF; if (size != iosize) { size = iosize; buf = malloc(size); } } if (buf == NULL) { /* No luck; switch to unbuffered I/O. */ nbf: fp->_flags = flags | __SNBF; fp->_w = 0; fp->_bf._base = fp->_p = fp->_nbuf; fp->_bf._size = 1; return (ret); } flags |= __SMBF; } /* * Kill any seek optimization if the buffer is not the * right size. * * SHOULD WE ALLOW MULTIPLES HERE (i.e., ok iff (size % iosize) == 0)? */ if (size != iosize) flags |= __SNPT; /* * Fix up the FILE fields, and set __cleanup for output flush on * exit (since we are buffered in some way). If in r/w mode, go * to the intermediate state, so that everyone has to call * __srefill or __swsetup on the first operation -- it is more * trouble than it is worth to set things up correctly here. */ if (mode == _IOLBF) flags |= __SLBF; if (flags & __SRW) flags &= ~(__SRD | __SWR); fp->_w = 0; fp->_flags = flags; fp->_bf._base = fp->_p = (unsigned char *)buf; fp->_bf._size = size; fp->_lbfsize = 0; __cleanup = _cleanup; return (ret); }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/bsdi.1.0/local/setvbuf.c
C
apache-2.0
4,653
/*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> #include <string.h> /* * sizeof(word) MUST BE A POWER OF TWO * SO THAT wmask BELOW IS ALL ONES */ typedef int word; /* "word" used for optimal copy speed */ #define wsize sizeof(word) #define wmask (wsize - 1) /* * Copy a block of memory, handling overlap. * This is the routine that actually implements * (the portable versions of) bcopy, memcpy, and memmove. */ #ifdef MEMCOPY void * memcpy(dst0, src0, length) #else #ifdef MEMMOVE void * memmove(dst0, src0, length) #else void bcopy(src0, dst0, length) #endif #endif void *dst0; const void *src0; register size_t length; { register char *dst = dst0; register const char *src = src0; register size_t t; if (length == 0 || dst == src) /* nothing to do */ goto done; /* * Macros: loop-t-times; and loop-t-times, t>0 */ #define TLOOP(s) if (t) TLOOP1(s) #define TLOOP1(s) do { s; } while (--t) if ((unsigned long)dst < (unsigned long)src) { /* * Copy forward. */ t = (int)src; /* only need low bits */ if ((t | (int)dst) & wmask) { /* * Try to align operands. This cannot be done * unless the low bits match. */ if ((t ^ (int)dst) & wmask || length < wsize) t = length; else t = wsize - (t & wmask); length -= t; TLOOP1(*dst++ = *src++); } /* * Copy whole words, then mop up any trailing bytes. */ t = length / wsize; TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); t = length & wmask; TLOOP(*dst++ = *src++); } else { /* * Copy backwards. Otherwise essentially the same. * Alignment works as before, except that it takes * (t&wmask) bytes to align, not wsize-(t&wmask). */ src += length; dst += length; t = (int)src; if ((t | (int)dst) & wmask) { if ((t ^ (int)dst) & wmask || length <= wsize) t = length; else t &= wmask; length -= t; TLOOP1(*--dst = *--src); } t = length / wsize; TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); t = length & wmask; TLOOP(*--dst = *--src); } done: #if defined(MEMCOPY) || defined(MEMMOVE) return (dst0); #else return; #endif }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/clib/memmove.c
C
apache-2.0
4,175
/* * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> #include <stdio.h> #include <ctype.h> static int _gettemp(); mkstemp(path) char *path; { int fd; return (_gettemp(path, &fd) ? fd : -1); } char * mktemp(path) char *path; { return(_gettemp(path, (int *)NULL) ? path : (char *)NULL); } static _gettemp(path, doopen) char *path; register int *doopen; { extern int errno; register char *start, *trv; struct stat sbuf; u_int pid; pid = getpid(); for (trv = path; *trv; ++trv); /* extra X's get set to 0's */ while (*--trv == 'X') { *trv = (pid % 10) + '0'; pid /= 10; } /* * check the target directory; if you have six X's and it * doesn't exist this runs for a *very* long time. */ for (start = trv + 1;; --trv) { if (trv <= path) break; if (*trv == '/') { *trv = '\0'; if (stat(path, &sbuf)) return(0); if (!S_ISDIR(sbuf.st_mode)) { errno = ENOTDIR; return(0); } *trv = '/'; break; } } for (;;) { if (doopen) { if ((*doopen = open(path, O_CREAT|O_EXCL|O_RDWR, 0600)) >= 0) return(1); if (errno != EEXIST) return(0); } else if (stat(path, &sbuf)) return(errno == ENOENT ? 1 : 0); /* tricky little algorithm for backward compatibility */ for (trv = start;;) { if (!*trv) return(0); if (*trv == 'z') *trv++ = 'a'; else { if (isdigit(*trv)) *trv = 'a'; else ++*trv; break; } } } /*NOTREACHED*/ }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/clib/mktemp.c
C
apache-2.0
3,451
#include <sys/types.h> #include <sys/cdefs.h> #include <compat.h> #ifdef __STDC__ #include <stdarg.h> #else #include <varargs.h> #endif int #ifdef __STDC__ snprintf(char *str, size_t n, const char *fmt, ...) #else snprintf(str, n, fmt, va_alist) char *str; size_t n; const char *fmt; va_dcl #endif { va_list ap; char *rp; int rval; #ifdef __STDC__ va_start(ap, fmt); #else va_start(ap); #endif #ifdef VSPRINTF_CHARSTAR rp = vsprintf(str, fmt, ap); va_end(ap); return (strlen(rp)); #else rval = vsprintf(str, fmt, ap); va_end(ap); return (rval); #endif } int vsnprintf(str, n, fmt, ap) char *str; size_t n; const char *fmt; va_list ap; { #ifdef VSPRINTF_CHARSTAR return (strlen(vsprintf(str, fmt, ap))); #else return (vsprintf(str, fmt, ap)); #endif }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/clib/snprintf.c
C
apache-2.0
776
/* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <string.h> char * strerror(num) int num; { extern int sys_nerr; extern char *sys_errlist[]; #define UPREFIX "Unknown error: " static char ebuf[40] = UPREFIX; /* 64-bit number + slop */ register unsigned int errnum; register char *p, *t; char tmp[40]; errnum = num; /* convert to unsigned */ if (errnum < sys_nerr) return(sys_errlist[errnum]); /* Do this by hand, so we don't include stdio(3). */ t = tmp; do { *t++ = "0123456789"[errnum % 10]; } while (errnum /= 10); for (p = ebuf + sizeof(UPREFIX) - 1;;) { *p++ = *--t; if (t <= tmp) break; } return(ebuf); }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/clib/strerror.c
C
apache-2.0
2,577
# @(#)Makefile 8.9 (Berkeley) 7/14/94 LIBDB= libdb.a OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \ hsearch.o ndbm.o OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \ bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \ bt_utils.o OBJ3= db.o OBJ4= mpool.o OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \ rec_seq.o rec_utils.o MISC= ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} rm -f $@ ar cq $@ \ `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort` ranlib $@ clean: rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} CC= gcc OORG= -O2 CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude hash.o: ../../hash/hash.c ${CL} -I../../hash ../../hash/hash.c hash_bigkey.o: ../../hash/hash_bigkey.c ${CL} -I../../hash ../../hash/hash_bigkey.c hash_buf.o: ../../hash/hash_buf.c ${CL} -I../../hash ../../hash/hash_buf.c hash_func.o: ../../hash/hash_func.c ${CL} -I../../hash ../../hash/hash_func.c hash_log2.o: ../../hash/hash_log2.c ${CL} -I../../hash ../../hash/hash_log2.c hash_page.o: ../../hash/hash_page.c ${CL} -I../../hash ../../hash/hash_page.c hsearch.o: ../../hash/hsearch.c ${CL} -I../../hash ../../hash/hsearch.c ndbm.o: ../../hash/ndbm.c ${CL} -I../../hash ../../hash/ndbm.c bt_close.o: ../../btree/bt_close.c ${CL} -I../../btree ../../btree/bt_close.c bt_conv.o: ../../btree/bt_conv.c ${CL} -I../../btree ../../btree/bt_conv.c bt_debug.o: ../../btree/bt_debug.c ${CL} -I../../btree ../../btree/bt_debug.c bt_delete.o: ../../btree/bt_delete.c ${CL} -I../../btree ../../btree/bt_delete.c bt_get.o: ../../btree/bt_get.c ${CL} -I../../btree ../../btree/bt_get.c bt_open.o: ../../btree/bt_open.c ${CL} -I../../btree ../../btree/bt_open.c bt_overflow.o: ../../btree/bt_overflow.c ${CL} -I../../btree ../../btree/bt_overflow.c bt_page.o: ../../btree/bt_page.c ${CL} -I../../btree ../../btree/bt_page.c bt_put.o: ../../btree/bt_put.c ${CL} -I../../btree ../../btree/bt_put.c bt_search.o: ../../btree/bt_search.c ${CL} -I../../btree ../../btree/bt_search.c bt_seq.o: ../../btree/bt_seq.c ${CL} -I../../btree ../../btree/bt_seq.c bt_split.o: ../../btree/bt_split.c ${CL} -I../../btree ../../btree/bt_split.c bt_stack.o: ../../btree/bt_stack.c ${CL} -I../../btree ../../btree/bt_stack.c bt_utils.o: ../../btree/bt_utils.c ${CL} -I../../btree ../../btree/bt_utils.c db.o: ../../db/db.c ${CL} ../../db/db.c mpool.o: ../../mpool/mpool.c ${CL} -I../../mpool ../../mpool/mpool.c rec_close.o: ../../recno/rec_close.c ${CL} -I../../recno ../../recno/rec_close.c rec_delete.o: ../../recno/rec_delete.c ${CL} -I../../recno ../../recno/rec_delete.c rec_get.o: ../../recno/rec_get.c ${CL} -I../../recno ../../recno/rec_get.c rec_open.o: ../../recno/rec_open.c ${CL} -I../../recno ../../recno/rec_open.c rec_put.o: ../../recno/rec_put.c ${CL} -I../../recno ../../recno/rec_put.c rec_search.o: ../../recno/rec_search.c ${CL} -I../../recno ../../recno/rec_search.c rec_seq.o: ../../recno/rec_seq.c ${CL} -I../../recno ../../recno/rec_seq.c rec_utils.o: ../../recno/rec_utils.c ${CL} -I../../recno ../../recno/rec_utils.c memmove.o: ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c mktemp.o: ${CC} -c -O -I. -Iinclude clib/mktemp.c snprintf.o: ${CC} -c -O -I. -Iinclude clib/snprintf.c
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/dgux.5.4/Makefile
Makefile
apache-2.0
3,363
../../include/cdefs.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/dgux.5.4/include/cdefs.h
C
apache-2.0
21
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)compat.h 8.13 (Berkeley) 2/21/94 */ #ifndef _COMPAT_H_ #define _COMPAT_H_ #include <sys/types.h> /* * If your system doesn't typedef u_long, u_short, or u_char, change * the 0 to a 1. */ #if 0 typedef unsigned char u_char; /* 4.[34]BSD names. */ typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short u_short; #endif /* If your system doesn't typedef size_t, change the 0 to a 1. */ #if 0 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ #endif /* If your system doesn't typedef ssize_t, change the 0 to a 1. */ #if 0 typedef int ssize_t; /* POSIX names. */ #endif /* * If your system doesn't have the POSIX type for a signal mask, * change the 0 to a 1. */ #if 0 /* POSIX 1003.1 signal mask type. */ typedef unsigned int sigset_t; #endif /* * If your system's vsprintf returns a char *, not an int, * change the 0 to a 1. */ #if 0 #define VSPRINTF_CHARSTAR #endif /* * If you don't have POSIX 1003.1 signals, the signal code surrounding the * temporary file creation is intended to block all of the possible signals * long enough to create the file and unlink it. All of this stuff is * intended to use old-style BSD calls to fake POSIX 1003.1 calls. */ #ifdef NO_POSIX_SIGNALS #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) #define SIG_BLOCK 1 #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 static int __sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ ((__sigtemp = \ (((how) == SIG_BLOCK) ? \ sigblock(0) | *(set) : \ (((how) == SIG_UNBLOCK) ? \ sigblock(0) & ~(*(set)) : \ ((how) == SIG_SETMASK ? \ *(set) : sigblock(0))))), \ ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ sigsetmask(__sigtemp)), 0) #endif /* * If your system doesn't have an include file with the appropriate * byte order set, make sure you specify the correct one. */ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define BYTE_ORDER BIG_ENDIAN /* Set for your system. */ #endif #if defined(SYSV) || defined(SYSTEM5) #define index(a, b) strchr(a, b) #define rindex(a, b) strrchr(a, b) #define bzero(a, b) memset(a, 0, b) #define bcmp(a, b, n) memcmp(a, b, n) #define bcopy(a, b, n) memmove(b, a, n) #endif #if defined(BSD) || defined(BSD4_3) #define strchr(a, b) index(a, b) #define strrchr(a, b) rindex(a, b) #define memcmp(a, b, n) bcmp(a, b, n) #define memmove(a, b, n) bcopy(b, a, n) #endif /* * 32-bit machine. The db routines are theoretically independent of * the size of u_shorts and u_longs, but I don't know that anyone has * ever actually tried it. At a minimum, change the following #define's * if you are trying to compile on a different type of system. */ #ifndef USHRT_MAX #define USHRT_MAX 0xFFFF #define ULONG_MAX 0xFFFFFFFF #endif #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ #define _POSIX2_RE_DUP_MAX 255 #endif /* * If you can't provide lock values in the open(2) call. Note, this * allows races to happen. */ #ifndef O_EXLOCK /* 4.4BSD extension. */ #define O_EXLOCK 0 #endif #ifndef O_SHLOCK /* 4.4BSD extension. */ #define O_SHLOCK 0 #endif #ifndef EFTYPE #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ #endif #ifndef WCOREDUMP /* 4.4BSD extension */ #define WCOREDUMP(a) 0 #endif #ifndef STDERR_FILENO #define STDIN_FILENO 0 /* ANSI C #defines */ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif #ifndef SEEK_END #define SEEK_SET 0 /* POSIX 1003.1 seek values */ #define SEEK_CUR 1 #define SEEK_END 2 #endif #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ #define _POSIX_VDISABLE 0 /* Some systems used 0. */ #endif #ifndef TCSASOFT /* 4.4BSD extension. */ #define TCSASOFT 0 #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ #define _POSIX2_RE_DUP_MAX 255 #endif #ifndef NULL /* ANSI C #defines NULL everywhere. */ #define NULL 0 #endif #ifndef MAX /* Usually found in <sys/param.h>. */ #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) #endif #ifndef MIN /* Usually found in <sys/param.h>. */ #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif /* Default file permissions. */ #ifndef DEFFILEMODE /* 4.4BSD extension. */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ #endif /* The type of a va_list. */ #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ #define _BSD_VA_LIST_ char * #endif #endif /* !_COMPAT_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/dgux.5.4/include/compat.h
C
apache-2.0
7,281
../../include/db.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/dgux.5.4/include/db.h
C
apache-2.0
18
../../include/mpool.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/dgux.5.4/include/mpool.h
C
apache-2.0
21
../../include/ndbm.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/dgux.5.4/include/ndbm.h
C
apache-2.0
20
../../include/queue.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/dgux.5.4/include/queue.h
C
apache-2.0
21
# @(#)Makefile 8.9 (Berkeley) 7/14/94 LIBDB= libdb.a OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \ hsearch.o ndbm.o OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \ bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \ bt_utils.o OBJ3= db.o OBJ4= mpool.o OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \ rec_seq.o rec_utils.o MISC= snprintf.o ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} rm -f $@ ar cq $@ \ `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort` ranlib $@ clean: rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} OORG= -O CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude hash.o: ../../hash/hash.c ${CL} -I../../hash ../../hash/hash.c hash_bigkey.o: ../../hash/hash_bigkey.c ${CL} -I../../hash ../../hash/hash_bigkey.c hash_buf.o: ../../hash/hash_buf.c ${CL} -I../../hash ../../hash/hash_buf.c hash_func.o: ../../hash/hash_func.c ${CL} -I../../hash ../../hash/hash_func.c hash_log2.o: ../../hash/hash_log2.c ${CL} -I../../hash ../../hash/hash_log2.c hash_page.o: ../../hash/hash_page.c ${CL} -I../../hash ../../hash/hash_page.c hsearch.o: ../../hash/hsearch.c ${CL} -I../../hash ../../hash/hsearch.c ndbm.o: ../../hash/ndbm.c ${CL} -I../../hash ../../hash/ndbm.c bt_close.o: ../../btree/bt_close.c ${CL} -I../../btree ../../btree/bt_close.c bt_conv.o: ../../btree/bt_conv.c ${CL} -I../../btree ../../btree/bt_conv.c bt_debug.o: ../../btree/bt_debug.c ${CL} -I../../btree ../../btree/bt_debug.c bt_delete.o: ../../btree/bt_delete.c ${CL} -I../../btree ../../btree/bt_delete.c bt_get.o: ../../btree/bt_get.c ${CL} -I../../btree ../../btree/bt_get.c bt_open.o: ../../btree/bt_open.c ${CL} -I../../btree ../../btree/bt_open.c bt_overflow.o: ../../btree/bt_overflow.c ${CL} -I../../btree ../../btree/bt_overflow.c bt_page.o: ../../btree/bt_page.c ${CL} -I../../btree ../../btree/bt_page.c bt_put.o: ../../btree/bt_put.c ${CL} -I../../btree ../../btree/bt_put.c bt_search.o: ../../btree/bt_search.c ${CL} -I../../btree ../../btree/bt_search.c bt_seq.o: ../../btree/bt_seq.c ${CL} -I../../btree ../../btree/bt_seq.c bt_split.o: ../../btree/bt_split.c ${CL} -I../../btree ../../btree/bt_split.c bt_stack.o: ../../btree/bt_stack.c ${CL} -I../../btree ../../btree/bt_stack.c bt_utils.o: ../../btree/bt_utils.c ${CL} -I../../btree ../../btree/bt_utils.c db.o: ../../db/db.c ${CL} ../../db/db.c mpool.o: ../../mpool/mpool.c ${CL} -I../../mpool ../../mpool/mpool.c rec_close.o: ../../recno/rec_close.c ${CL} -I../../recno ../../recno/rec_close.c rec_delete.o: ../../recno/rec_delete.c ${CL} -I../../recno ../../recno/rec_delete.c rec_get.o: ../../recno/rec_get.c ${CL} -I../../recno ../../recno/rec_get.c rec_open.o: ../../recno/rec_open.c ${CL} -I../../recno ../../recno/rec_open.c rec_put.o: ../../recno/rec_put.c ${CL} -I../../recno ../../recno/rec_put.c rec_search.o: ../../recno/rec_search.c ${CL} -I../../recno ../../recno/rec_search.c rec_seq.o: ../../recno/rec_seq.c ${CL} -I../../recno ../../recno/rec_seq.c rec_utils.o: ../../recno/rec_utils.c ${CL} -I../../recno ../../recno/rec_utils.c memmove.o: ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c mktemp.o: ${CC} -c -O -I. -Iinclude clib/mktemp.c snprintf.o: ${CC} -c -O -I. -Iinclude clib/snprintf.c
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/hpux.9.01/Makefile
Makefile
apache-2.0
3,365
../../include/cdefs.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/hpux.9.01/include/cdefs.h
C
apache-2.0
21
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)compat.h 8.13 (Berkeley) 2/21/94 */ #ifndef _COMPAT_H_ #define _COMPAT_H_ #include <sys/types.h> /* * If your system doesn't typedef u_long, u_short, or u_char, change * the 0 to a 1. */ #if 0 typedef unsigned char u_char; /* 4.[34]BSD names. */ typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short u_short; #endif /* If your system doesn't typedef size_t, change the 0 to a 1. */ #if 0 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ #endif /* If your system doesn't typedef ssize_t, change the 0 to a 1. */ #if 0 typedef int ssize_t; /* POSIX names. */ #endif /* * If your system doesn't have the POSIX type for a signal mask, * change the 0 to a 1. */ #if 0 /* POSIX 1003.1 signal mask type. */ typedef unsigned int sigset_t; #endif /* * If your system's vsprintf returns a char *, not an int, * change the 0 to a 1. */ #if 0 #define VSPRINTF_CHARSTAR #endif /* * If you don't have POSIX 1003.1 signals, the signal code surrounding the * temporary file creation is intended to block all of the possible signals * long enough to create the file and unlink it. All of this stuff is * intended to use old-style BSD calls to fake POSIX 1003.1 calls. */ #ifdef NO_POSIX_SIGNALS #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) #define SIG_BLOCK 1 #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 static int __sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ ((__sigtemp = \ (((how) == SIG_BLOCK) ? \ sigblock(0) | *(set) : \ (((how) == SIG_UNBLOCK) ? \ sigblock(0) & ~(*(set)) : \ ((how) == SIG_SETMASK ? \ *(set) : sigblock(0))))), \ ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ sigsetmask(__sigtemp)), 0) #endif /* * If your system doesn't have an include file with the appropriate * byte order set, make sure you specify the correct one. */ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define BYTE_ORDER BIG_ENDIAN /* Set for your system. */ #endif #if defined(SYSV) || defined(SYSTEM5) #define index(a, b) strchr(a, b) #define rindex(a, b) strrchr(a, b) #define bzero(a, b) memset(a, 0, b) #define bcmp(a, b, n) memcmp(a, b, n) #define bcopy(a, b, n) memmove(b, a, n) #endif #if defined(BSD) || defined(BSD4_3) #define strchr(a, b) index(a, b) #define strrchr(a, b) rindex(a, b) #define memcmp(a, b, n) bcmp(a, b, n) #define memmove(a, b, n) bcopy(b, a, n) #endif /* * 32-bit machine. The db routines are theoretically independent of * the size of u_shorts and u_longs, but I don't know that anyone has * ever actually tried it. At a minimum, change the following #define's * if you are trying to compile on a different type of system. */ #ifndef USHRT_MAX #define USHRT_MAX 0xFFFF #define ULONG_MAX 0xFFFFFFFF #endif #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ #define _POSIX2_RE_DUP_MAX 255 #endif /* * If you can't provide lock values in the open(2) call. Note, this * allows races to happen. */ #ifndef O_EXLOCK /* 4.4BSD extension. */ #define O_EXLOCK 0 #endif #ifndef O_SHLOCK /* 4.4BSD extension. */ #define O_SHLOCK 0 #endif #ifndef EFTYPE #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ #endif #ifndef WCOREDUMP /* 4.4BSD extension */ #define WCOREDUMP(a) 0 #endif #ifndef STDERR_FILENO #define STDIN_FILENO 0 /* ANSI C #defines */ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif #ifndef SEEK_END #define SEEK_SET 0 /* POSIX 1003.1 seek values */ #define SEEK_CUR 1 #define SEEK_END 2 #endif #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ #define _POSIX_VDISABLE 0 /* Some systems used 0. */ #endif #ifndef TCSASOFT /* 4.4BSD extension. */ #define TCSASOFT 0 #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ #define _POSIX2_RE_DUP_MAX 255 #endif #ifndef NULL /* ANSI C #defines NULL everywhere. */ #define NULL 0 #endif #ifndef MAX /* Usually found in <sys/param.h>. */ #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) #endif #ifndef MIN /* Usually found in <sys/param.h>. */ #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif /* Default file permissions. */ #ifndef DEFFILEMODE /* 4.4BSD extension. */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ #endif /* The type of a va_list. */ #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ #define _BSD_VA_LIST_ char * #endif #endif /* !_COMPAT_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/hpux.9.01/include/compat.h
C
apache-2.0
7,281
../../include/db.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/hpux.9.01/include/db.h
C
apache-2.0
18
../../include/mpool.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/hpux.9.01/include/mpool.h
C
apache-2.0
21
../../include/ndbm.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/hpux.9.01/include/ndbm.h
C
apache-2.0
20
../../include/queue.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/hpux.9.01/include/queue.h
C
apache-2.0
21
/* * Derived from: * static char sccsid[] = "@(#)siglist.c 8.1 (Berkeley) 6/4/93"; */ #include <sys/cdefs.h> #include <signal.h> const char *const sys_signame[NSIG] = { "Signal 0", "hup", /* SIGHUP */ "int", /* SIGINT */ "quit", /* SIGQUIT */ "ill", /* SIGILL */ "trap", /* SIGTRAP */ "abrt", /* SIGABRT */ "emt", /* SIGEMT */ "fpe", /* SIGFPE */ "kill", /* SIGKILL */ "bus", /* SIGBUS */ "segv", /* SIGSEGV */ "sys", /* SIGSYS */ "pipe", /* SIGPIPE */ "alrm", /* SIGALRM */ "term", /* SIGTERM */ "usr1", /* SIGUSR1 */ "usr2", /* SIGUSR2 */ "chld", /* SIGCHLD */ "pwr", /* SIGPWR */ "vtalrm", /* SIGVTALRM */ "prof", /* SIGPROF */ "io", /* SIGIO */ "winch", /* SIGWINCH */ "stop", /* SIGSTOP */ "tstp", /* SIGTSTP */ "cont", /* SIGCONT */ "ttin", /* SIGTTIN */ "ttou", /* SIGTTOU */ "urg", /* SIGURG */ "lost", /* SIGLOST */ }; const char *const sys_siglist[NSIG] = { "Signal 0", "Hangup", /* SIGHUP */ "Interrupt", /* SIGINT */ "Quit", /* SIGQUIT */ "Illegal instruction", /* SIGILL */ "Trace/BPT trap", /* SIGTRAP */ "Abort trap", /* SIGABRT */ "EMT trap", /* SIGEMT */ "Floating point exception", /* SIGFPE */ "Killed", /* SIGKILL */ "Bus error", /* SIGBUS */ "Segmentation fault", /* SIGSEGV */ "Bad system call", /* SIGSYS */ "Broken pipe", /* SIGPIPE */ "Alarm clock", /* SIGALRM */ "Terminated", /* SIGTERM */ "User defined signal 1", /* SIGUSR1 */ "User defined signal 2" /* SIGUSR2 */ "Child exited", /* SIGCHLD */ "Power failure", /* SIGPWR */ "Virtual timer expired", /* SIGVTALRM */ "Profiling timer expired", /* SIGPROF */ "I/O possible", /* SIGIO */ "Window size changes", /* SIGWINCH */ "Suspended (signal)", /* SIGSTOP */ "Suspended", /* SIGTSTP */ "Continued", /* SIGCONT */ "Stopped (tty input)", /* SIGTTIN */ "Stopped (tty output)", /* SIGTTOU */ "Urgent I/O condition", /* SIGURG */ "File lock lost", /* SIGLOST */ };
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/hpux.9.01/local/hp_siglist.c
C
apache-2.0
2,036
queue.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/include/bsd-queue.h
C
apache-2.0
7
/* * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Berkeley Software Design, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)cdefs.h 8.7 (Berkeley) 1/21/94 */ #ifndef _CDEFS_H_ #define _CDEFS_H_ #if defined(__cplusplus) #define __BEGIN_DECLS extern "C" { #define __END_DECLS }; #else #define __BEGIN_DECLS #define __END_DECLS #endif /* * The __CONCAT macro is used to concatenate parts of symbol names, e.g. * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. * The __CONCAT macro is a bit tricky -- make sure you don't put spaces * in between its arguments. __CONCAT can also concatenate double-quoted * strings produced by the __STRING macro, but this only works with ANSI C. */ #if defined(__STDC__) || defined(__cplusplus) #define __P(protos) protos /* full-blown ANSI C */ #define __CONCAT(x,y) x ## y #define __STRING(x) #x #define __const const /* define reserved names to standard */ #define __signed signed #define __volatile volatile #if defined(__cplusplus) #define __inline inline /* convert to C++ keyword */ #else #ifndef __GNUC__ #define __inline /* delete GCC keyword */ #endif /* !__GNUC__ */ #endif /* !__cplusplus */ #else /* !(__STDC__ || __cplusplus) */ #define __P(protos) () /* traditional C preprocessor */ #define __CONCAT(x,y) x/**/y #define __STRING(x) "x" #ifndef __GNUC__ #define __const /* delete pseudo-ANSI C keywords */ #define __inline #define __signed #define __volatile /* * In non-ANSI C environments, new programs will want ANSI-only C keywords * deleted from the program and old programs will want them left alone. * When using a compiler other than gcc, programs using the ANSI C keywords * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. * When using "gcc -traditional", we assume that this is the intent; if * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. */ #ifndef NO_ANSI_KEYWORDS #define const /* delete ANSI C keywords */ #define inline #define signed #define volatile #endif #endif /* !__GNUC__ */ #endif /* !(__STDC__ || __cplusplus) */ /* * GCC1 and some versions of GCC2 declare dead (non-returning) and * pure (no side effects) functions using "volatile" and "const"; * unfortunately, these then cause warnings under "-ansi -pedantic". * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of * these work for GNU C++ (modulo a slight glitch in the C++ grammar * in the distribution version of 2.5.5). */ #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5 #define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */ #if defined(__GNUC__) && !defined(__STRICT_ANSI__) #define __dead __volatile #define __pure __const #endif #endif /* Delete pseudo-keywords wherever they are not available or needed. */ #ifndef __dead #define __dead #define __pure #endif #endif /* !_CDEFS_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/include/cdefs.h
C
apache-2.0
4,694
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)compat.h 8.13 (Berkeley) 2/21/94 */ #ifndef _COMPAT_H_ #define _COMPAT_H_ #include <sys/types.h> /* * If your system doesn't typedef u_long, u_short, or u_char, change * the 0 to a 1. */ #if 0 typedef unsigned char u_char; /* 4.[34]BSD names. */ typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short u_short; #endif /* If your system doesn't typedef size_t, change the 0 to a 1. */ #if 0 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ #endif /* If your system doesn't typedef ssize_t, change the 0 to a 1. */ #if 0 typedef int ssize_t; /* POSIX names. */ #endif /* * If your system doesn't have the POSIX type for a signal mask, * change the 0 to a 1. */ #if 0 /* POSIX 1003.1 signal mask type. */ typedef unsigned int sigset_t; #endif /* * If your system's vsprintf returns a char *, not an int, * change the 0 to a 1. */ #if 0 #define VSPRINTF_CHARSTAR #endif /* * If you don't have POSIX 1003.1 signals, the signal code surrounding the * temporary file creation is intended to block all of the possible signals * long enough to create the file and unlink it. All of this stuff is * intended to use old-style BSD calls to fake POSIX 1003.1 calls. */ #ifdef NO_POSIX_SIGNALS #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) #define SIG_BLOCK 1 #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 static int __sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ ((__sigtemp = \ (((how) == SIG_BLOCK) ? \ sigblock(0) | *(set) : \ (((how) == SIG_UNBLOCK) ? \ sigblock(0) & ~(*(set)) : \ ((how) == SIG_SETMASK ? \ *(set) : sigblock(0))))), \ ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ sigsetmask(__sigtemp)), 0) #endif /* * If your system doesn't have an include file with the appropriate * byte order set, make sure you specify the correct one. */ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define BYTE_ORDER BIG_ENDIAN /* Set for your system. */ #endif #if defined(SYSV) || defined(SYSTEM5) #define index(a, b) strchr(a, b) #define rindex(a, b) strrchr(a, b) #define bzero(a, b) memset(a, 0, b) #define bcmp(a, b, n) memcmp(a, b, n) #define bcopy(a, b, n) memmove(b, a, n) #endif #if defined(BSD) || defined(BSD4_3) #define strchr(a, b) index(a, b) #define strrchr(a, b) rindex(a, b) #define memcmp(a, b, n) bcmp(a, b, n) #ifndef memmove #define memmove(a, b, n) bcopy(b, a, n) #endif #endif /* * 32-bit machine. The db routines are theoretically independent of * the size of u_shorts and u_longs, but I don't know that anyone has * ever actually tried it. At a minimum, change the following #define's * if you are trying to compile on a different type of system. */ #ifndef USHRT_MAX #define USHRT_MAX 0xFFFF #define ULONG_MAX 0xFFFFFFFF #endif #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ #define _POSIX2_RE_DUP_MAX 255 #endif /* * If you can't provide lock values in the open(2) call. Note, this * allows races to happen. */ #ifndef O_EXLOCK /* 4.4BSD extension. */ #define O_EXLOCK 0 #endif #ifndef O_SHLOCK /* 4.4BSD extension. */ #define O_SHLOCK 0 #endif #ifndef EFTYPE #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ #endif #ifndef WCOREDUMP /* 4.4BSD extension */ #define WCOREDUMP(a) 0 #endif #ifndef STDERR_FILENO #define STDIN_FILENO 0 /* ANSI C #defines */ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif #ifndef SEEK_END #define SEEK_SET 0 /* POSIX 1003.1 seek values */ #define SEEK_CUR 1 #define SEEK_END 2 #endif #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ #define _POSIX_VDISABLE 0 /* Some systems used 0. */ #endif #ifndef TCSASOFT /* 4.4BSD extension. */ #define TCSASOFT 0 #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ #define _POSIX2_RE_DUP_MAX 255 #endif #ifndef NULL /* ANSI C #defines NULL everywhere. */ #define NULL 0 #endif #ifndef MAX /* Usually found in <sys/param.h>. */ #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) #endif #ifndef MIN /* Usually found in <sys/param.h>. */ #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif /* Default file permissions. */ #ifndef DEFFILEMODE /* 4.4BSD extension. */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ #endif /* The type of a va_list. */ #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ #define _BSD_VA_LIST_ char * #endif #endif /* !_COMPAT_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/include/compat.h
C
apache-2.0
7,304
../../include/db.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/include/db.h
C
apache-2.0
18
../../include/filevtable.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/include/filevtable.h
C
apache-2.0
26
../../include/mpool.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/include/mpool.h
C
apache-2.0
21
/*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Margo Seltzer. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ndbm.h 8.1 (Berkeley) 6/2/93 */ #ifndef _NDBM_H_ #define _NDBM_H_ #include <db.h> /* Map dbm interface onto db(3). */ #define DBM_RDONLY O_RDONLY /* Flags to dbm_store(). */ #define DBM_INSERT 0 #define DBM_REPLACE 1 /* * The db(3) support for ndbm(3) always appends this suffix to the * file name to avoid overwriting the user's original database. */ #define DBM_SUFFIX ".db" typedef struct { char *dptr; int dsize; } datum; typedef DB DBM; #define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE __BEGIN_DECLS void dbm_close __P((DBM *)); int dbm_delete __P((DBM *, datum)); datum dbm_fetch __P((DBM *, datum)); datum dbm_firstkey __P((DBM *)); long dbm_forder __P((DBM *, datum)); datum dbm_nextkey __P((DBM *)); DBM *dbm_open __P((const char *, int, int)); int dbm_store __P((DBM *, datum, datum, int)); int dbm_dirfno __P((DBM *)); __END_DECLS #endif /* !_NDBM_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/include/ndbm.h
C
apache-2.0
2,819
/* * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)queue.h 8.3 (Berkeley) 12/13/93 */ #ifndef _QUEUE_H_ #define _QUEUE_H_ /* * This file defines three types of data structures: lists, tail queues, * and circular queues. * * A list is headed by a single forward pointer (or an array of forward * pointers for a hash table header). The elements are doubly linked * so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list after * an existing element or at the head of the list. A list may only be * traversed in the forward direction. * * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list after * an existing element, at the head of the list, or at the end of the * list. A tail queue may only be traversed in the forward direction. * * A circle queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or after * an existing element, at the head of the list, or at the end of the list. * A circle queue may be traversed in either direction, but has a more * complex end of list detection. * * For details on the use of these macros, see the queue(3) manual page. */ /* * List definitions. */ #define LIST_HEAD(name, type) \ struct name { \ struct type *lh_first; /* first element */ \ } #define LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ } /* * List functions. */ #define LIST_INIT(head) { \ (head)->lh_first = NULL; \ } #define LIST_INSERT_AFTER(listelm, elm, field) { \ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ (listelm)->field.le_next->field.le_prev = \ &(elm)->field.le_next; \ (listelm)->field.le_next = (elm); \ (elm)->field.le_prev = &(listelm)->field.le_next; \ } #define LIST_INSERT_HEAD(head, elm, field) { \ if (((elm)->field.le_next = (head)->lh_first) != NULL) \ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ (head)->lh_first = (elm); \ (elm)->field.le_prev = &(head)->lh_first; \ } #define LIST_REMOVE(elm, field) { \ if ((elm)->field.le_next != NULL) \ (elm)->field.le_next->field.le_prev = \ (elm)->field.le_prev; \ *(elm)->field.le_prev = (elm)->field.le_next; \ } /* * Tail queue definitions. */ #define TAILQ_HEAD(name, type) \ struct name { \ struct type *tqh_first; /* first element */ \ struct type **tqh_last; /* addr of last next element */ \ } #define TAILQ_ENTRY(type) \ struct { \ struct type *tqe_next; /* next element */ \ struct type **tqe_prev; /* address of previous next element */ \ } /* * Tail queue functions. */ #define TAILQ_INIT(head) { \ (head)->tqh_first = NULL; \ (head)->tqh_last = &(head)->tqh_first; \ } #define TAILQ_INSERT_HEAD(head, elm, field) { \ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ (elm)->field.tqe_next->field.tqe_prev = \ &(elm)->field.tqe_next; \ else \ (head)->tqh_last = &(elm)->field.tqe_next; \ (head)->tqh_first = (elm); \ (elm)->field.tqe_prev = &(head)->tqh_first; \ } #define TAILQ_INSERT_TAIL(head, elm, field) { \ (elm)->field.tqe_next = NULL; \ (elm)->field.tqe_prev = (head)->tqh_last; \ *(head)->tqh_last = (elm); \ (head)->tqh_last = &(elm)->field.tqe_next; \ } #define TAILQ_INSERT_AFTER(head, listelm, elm, field) { \ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ (elm)->field.tqe_next->field.tqe_prev = \ &(elm)->field.tqe_next; \ else \ (head)->tqh_last = &(elm)->field.tqe_next; \ (listelm)->field.tqe_next = (elm); \ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ } #define TAILQ_REMOVE(head, elm, field) { \ if (((elm)->field.tqe_next) != NULL) \ (elm)->field.tqe_next->field.tqe_prev = \ (elm)->field.tqe_prev; \ else \ (head)->tqh_last = (elm)->field.tqe_prev; \ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ } /* * Circular queue definitions. */ #define CIRCLEQ_HEAD(name, type) \ struct name { \ struct type *cqh_first; /* first element */ \ struct type *cqh_last; /* last element */ \ } #define CIRCLEQ_ENTRY(type) \ struct { \ struct type *cqe_next; /* next element */ \ struct type *cqe_prev; /* previous element */ \ } /* * Circular queue functions. */ #define CIRCLEQ_INIT(head) { \ (head)->cqh_first = (void *)(head); \ (head)->cqh_last = (void *)(head); \ } #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) { \ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ (elm)->field.cqe_prev = (listelm); \ if ((listelm)->field.cqe_next == (void *)(head)) \ (head)->cqh_last = (elm); \ else \ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ (listelm)->field.cqe_next = (elm); \ } #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) { \ (elm)->field.cqe_next = (listelm); \ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ if ((listelm)->field.cqe_prev == (void *)(head)) \ (head)->cqh_first = (elm); \ else \ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ (listelm)->field.cqe_prev = (elm); \ } #define CIRCLEQ_INSERT_HEAD(head, elm, field) { \ (elm)->field.cqe_next = (head)->cqh_first; \ (elm)->field.cqe_prev = (void *)(head); \ if ((head)->cqh_last == (void *)(head)) \ (head)->cqh_last = (elm); \ else \ (head)->cqh_first->field.cqe_prev = (elm); \ (head)->cqh_first = (elm); \ } #define CIRCLEQ_INSERT_TAIL(head, elm, field) { \ (elm)->field.cqe_next = (void *)(head); \ (elm)->field.cqe_prev = (head)->cqh_last; \ if ((head)->cqh_first == (void *)(head)) \ (head)->cqh_first = (elm); \ else \ (head)->cqh_last->field.cqe_next = (elm); \ (head)->cqh_last = (elm); \ } #define CIRCLEQ_REMOVE(head, elm, field) { \ if ((elm)->field.cqe_next == (void *)(head)) \ (head)->cqh_last = (elm)->field.cqe_prev; \ else \ (elm)->field.cqe_next->field.cqe_prev = \ (elm)->field.cqe_prev; \ if ((elm)->field.cqe_prev == (void *)(head)) \ (head)->cqh_first = (elm)->field.cqe_next; \ else \ (elm)->field.cqe_prev->field.cqe_next = \ (elm)->field.cqe_next; \ } #endif /* !_QUEUE_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/include/queue.h
C
apache-2.0
8,612
# @(#)Makefile 8.9 (Berkeley) 7/14/94 LIBDB= libdb.a OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \ hsearch.o ndbm.o OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \ bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \ bt_utils.o OBJ3= db.o OBJ4= mpool.o OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \ rec_seq.o rec_utils.o MISC= snprintf.o ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} rm -f $@ ar cq $@ \ `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort` ranlib $@ clean: rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} CC= cc -cckr -D_BSD_COMPAT OORG= -O CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude hash.o: ../../hash/hash.c ${CL} -I../../hash ../../hash/hash.c hash_bigkey.o: ../../hash/hash_bigkey.c ${CL} -I../../hash ../../hash/hash_bigkey.c hash_buf.o: ../../hash/hash_buf.c ${CL} -I../../hash ../../hash/hash_buf.c hash_func.o: ../../hash/hash_func.c ${CL} -I../../hash ../../hash/hash_func.c hash_log2.o: ../../hash/hash_log2.c ${CL} -I../../hash ../../hash/hash_log2.c hash_page.o: ../../hash/hash_page.c ${CL} -I../../hash ../../hash/hash_page.c hsearch.o: ../../hash/hsearch.c ${CL} -I../../hash ../../hash/hsearch.c ndbm.o: ../../hash/ndbm.c ${CL} -I../../hash ../../hash/ndbm.c bt_close.o: ../../btree/bt_close.c ${CL} -I../../btree ../../btree/bt_close.c bt_conv.o: ../../btree/bt_conv.c ${CL} -I../../btree ../../btree/bt_conv.c bt_debug.o: ../../btree/bt_debug.c ${CL} -I../../btree ../../btree/bt_debug.c bt_delete.o: ../../btree/bt_delete.c ${CL} -I../../btree ../../btree/bt_delete.c bt_get.o: ../../btree/bt_get.c ${CL} -I../../btree ../../btree/bt_get.c bt_open.o: ../../btree/bt_open.c ${CL} -I../../btree ../../btree/bt_open.c bt_overflow.o: ../../btree/bt_overflow.c ${CL} -I../../btree ../../btree/bt_overflow.c bt_page.o: ../../btree/bt_page.c ${CL} -I../../btree ../../btree/bt_page.c bt_put.o: ../../btree/bt_put.c ${CL} -I../../btree ../../btree/bt_put.c bt_search.o: ../../btree/bt_search.c ${CL} -I../../btree ../../btree/bt_search.c bt_seq.o: ../../btree/bt_seq.c ${CL} -I../../btree ../../btree/bt_seq.c bt_split.o: ../../btree/bt_split.c ${CL} -I../../btree ../../btree/bt_split.c bt_stack.o: ../../btree/bt_stack.c ${CL} -I../../btree ../../btree/bt_stack.c bt_utils.o: ../../btree/bt_utils.c ${CL} -I../../btree ../../btree/bt_utils.c db.o: ../../db/db.c ${CL} ../../db/db.c mpool.o: ../../mpool/mpool.c ${CL} -I../../mpool ../../mpool/mpool.c rec_close.o: ../../recno/rec_close.c ${CL} -I../../recno ../../recno/rec_close.c rec_delete.o: ../../recno/rec_delete.c ${CL} -I../../recno ../../recno/rec_delete.c rec_get.o: ../../recno/rec_get.c ${CL} -I../../recno ../../recno/rec_get.c rec_open.o: ../../recno/rec_open.c ${CL} -I../../recno ../../recno/rec_open.c rec_put.o: ../../recno/rec_put.c ${CL} -I../../recno ../../recno/rec_put.c rec_search.o: ../../recno/rec_search.c ${CL} -I../../recno ../../recno/rec_search.c rec_seq.o: ../../recno/rec_seq.c ${CL} -I../../recno ../../recno/rec_seq.c rec_utils.o: ../../recno/rec_utils.c ${CL} -I../../recno ../../recno/rec_utils.c memmove.o: ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c mktemp.o: ${CC} -c -O -I. -Iinclude clib/mktemp.c snprintf.o: ${CC} -c -O -I. -Iinclude clib/snprintf.c
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/irix.4.05F/Makefile
Makefile
apache-2.0
3,392
../../include/cdefs.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/irix.4.05F/include/cdefs.h
C
apache-2.0
21
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)compat.h 8.13 (Berkeley) 2/21/94 */ #ifndef _COMPAT_H_ #define _COMPAT_H_ #include <sys/types.h> /* * If your system doesn't typedef u_long, u_short, or u_char, change * the 0 to a 1. */ #if 0 typedef unsigned char u_char; /* 4.[34]BSD names. */ typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short u_short; #endif /* If your system doesn't typedef size_t, change the 0 to a 1. */ #if 0 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ #endif /* If your system doesn't typedef ssize_t, change the 0 to a 1. */ #if 0 typedef int ssize_t; /* POSIX names. */ #endif /* * If your system doesn't have the POSIX type for a signal mask, * change the 0 to a 1. */ #if 0 /* POSIX 1003.1 signal mask type. */ typedef unsigned int sigset_t; #endif /* * If your system's vsprintf returns a char *, not an int, * change the 0 to a 1. */ #if 0 #define VSPRINTF_CHARSTAR #endif /* * If you don't have POSIX 1003.1 signals, the signal code surrounding the * temporary file creation is intended to block all of the possible signals * long enough to create the file and unlink it. All of this stuff is * intended to use old-style BSD calls to fake POSIX 1003.1 calls. */ #ifdef NO_POSIX_SIGNALS #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) #define SIG_BLOCK 1 #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 static int __sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ ((__sigtemp = \ (((how) == SIG_BLOCK) ? \ sigblock(0) | *(set) : \ (((how) == SIG_UNBLOCK) ? \ sigblock(0) & ~(*(set)) : \ ((how) == SIG_SETMASK ? \ *(set) : sigblock(0))))), \ ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ sigsetmask(__sigtemp)), 0) #endif /* * If your system doesn't have an include file with the appropriate * byte order set, make sure you specify the correct one. */ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define BYTE_ORDER BIG_ENDIAN /* Set for your system. */ #endif #if defined(SYSV) || defined(SYSTEM5) #define index(a, b) strchr(a, b) #define rindex(a, b) strrchr(a, b) #define bzero(a, b) memset(a, 0, b) #define bcmp(a, b, n) memcmp(a, b, n) #define bcopy(a, b, n) memmove(b, a, n) #endif #if defined(BSD) || defined(BSD4_3) #define strchr(a, b) index(a, b) #define strrchr(a, b) rindex(a, b) #define memcmp(a, b, n) bcmp(a, b, n) #define memmove(a, b, n) bcopy(b, a, n) #endif /* * 32-bit machine. The db routines are theoretically independent of * the size of u_shorts and u_longs, but I don't know that anyone has * ever actually tried it. At a minimum, change the following #define's * if you are trying to compile on a different type of system. */ #ifndef USHRT_MAX #define USHRT_MAX 0xFFFF #define ULONG_MAX 0xFFFFFFFF #endif #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ #define _POSIX2_RE_DUP_MAX 255 #endif /* * If you can't provide lock values in the open(2) call. Note, this * allows races to happen. */ #ifndef O_EXLOCK /* 4.4BSD extension. */ #define O_EXLOCK 0 #endif #ifndef O_SHLOCK /* 4.4BSD extension. */ #define O_SHLOCK 0 #endif #ifndef EFTYPE #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ #endif #ifndef WCOREDUMP /* 4.4BSD extension */ #define WCOREDUMP(a) 0 #endif #ifndef STDERR_FILENO #define STDIN_FILENO 0 /* ANSI C #defines */ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif #ifndef SEEK_END #define SEEK_SET 0 /* POSIX 1003.1 seek values */ #define SEEK_CUR 1 #define SEEK_END 2 #endif #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ #define _POSIX_VDISABLE 0 /* Some systems used 0. */ #endif #ifndef TCSASOFT /* 4.4BSD extension. */ #define TCSASOFT 0 #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ #define _POSIX2_RE_DUP_MAX 255 #endif #ifndef NULL /* ANSI C #defines NULL everywhere. */ #define NULL 0 #endif #ifndef MAX /* Usually found in <sys/param.h>. */ #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) #endif #ifndef MIN /* Usually found in <sys/param.h>. */ #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif /* Default file permissions. */ #ifndef DEFFILEMODE /* 4.4BSD extension. */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ #endif /* The type of a va_list. */ #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ #define _BSD_VA_LIST_ char * #endif #endif /* !_COMPAT_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/irix.4.05F/include/compat.h
C
apache-2.0
7,281
../../include/db.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/irix.4.05F/include/db.h
C
apache-2.0
18
../../include/mpool.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/irix.4.05F/include/mpool.h
C
apache-2.0
21
../../include/ndbm.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/irix.4.05F/include/ndbm.h
C
apache-2.0
20
../../include/queue.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/irix.4.05F/include/queue.h
C
apache-2.0
21
# @(#)Makefile 8.9 (Berkeley) 7/14/94 LIBDB= libdb.a OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \ hsearch.o ndbm.o OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \ bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \ bt_utils.o OBJ3= db.o OBJ4= mpool.o OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \ rec_seq.o rec_utils.o MISC= snprintf.o ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} rm -f $@ ar cq $@ \ `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort` ranlib $@ clean: rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} OORG= -O CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude hash.o: ../../hash/hash.c ${CL} -I../../hash ../../hash/hash.c hash_bigkey.o: ../../hash/hash_bigkey.c ${CL} -I../../hash ../../hash/hash_bigkey.c hash_buf.o: ../../hash/hash_buf.c ${CL} -I../../hash ../../hash/hash_buf.c hash_func.o: ../../hash/hash_func.c ${CL} -I../../hash ../../hash/hash_func.c hash_log2.o: ../../hash/hash_log2.c ${CL} -I../../hash ../../hash/hash_log2.c hash_page.o: ../../hash/hash_page.c ${CL} -I../../hash ../../hash/hash_page.c hsearch.o: ../../hash/hsearch.c ${CL} -I../../hash ../../hash/hsearch.c ndbm.o: ../../hash/ndbm.c ${CL} -I../../hash ../../hash/ndbm.c bt_close.o: ../../btree/bt_close.c ${CL} -I../../btree ../../btree/bt_close.c bt_conv.o: ../../btree/bt_conv.c ${CL} -I../../btree ../../btree/bt_conv.c bt_debug.o: ../../btree/bt_debug.c ${CL} -I../../btree ../../btree/bt_debug.c bt_delete.o: ../../btree/bt_delete.c ${CL} -I../../btree ../../btree/bt_delete.c bt_get.o: ../../btree/bt_get.c ${CL} -I../../btree ../../btree/bt_get.c bt_open.o: ../../btree/bt_open.c ${CL} -I../../btree ../../btree/bt_open.c bt_overflow.o: ../../btree/bt_overflow.c ${CL} -I../../btree ../../btree/bt_overflow.c bt_page.o: ../../btree/bt_page.c ${CL} -I../../btree ../../btree/bt_page.c bt_put.o: ../../btree/bt_put.c ${CL} -I../../btree ../../btree/bt_put.c bt_search.o: ../../btree/bt_search.c ${CL} -I../../btree ../../btree/bt_search.c bt_seq.o: ../../btree/bt_seq.c ${CL} -I../../btree ../../btree/bt_seq.c bt_split.o: ../../btree/bt_split.c ${CL} -I../../btree ../../btree/bt_split.c bt_stack.o: ../../btree/bt_stack.c ${CL} -I../../btree ../../btree/bt_stack.c bt_utils.o: ../../btree/bt_utils.c ${CL} -I../../btree ../../btree/bt_utils.c db.o: ../../db/db.c ${CL} ../../db/db.c mpool.o: ../../mpool/mpool.c ${CL} -I../../mpool ../../mpool/mpool.c rec_close.o: ../../recno/rec_close.c ${CL} -I../../recno ../../recno/rec_close.c rec_delete.o: ../../recno/rec_delete.c ${CL} -I../../recno ../../recno/rec_delete.c rec_get.o: ../../recno/rec_get.c ${CL} -I../../recno ../../recno/rec_get.c rec_open.o: ../../recno/rec_open.c ${CL} -I../../recno ../../recno/rec_open.c rec_put.o: ../../recno/rec_put.c ${CL} -I../../recno ../../recno/rec_put.c rec_search.o: ../../recno/rec_search.c ${CL} -I../../recno ../../recno/rec_search.c rec_seq.o: ../../recno/rec_seq.c ${CL} -I../../recno ../../recno/rec_seq.c rec_utils.o: ../../recno/rec_utils.c ${CL} -I../../recno ../../recno/rec_utils.c memmove.o: ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c mktemp.o: ${CC} -c -O -I. -Iinclude clib/mktemp.c snprintf.o: ${CC} -c -O -I. -Iinclude clib/snprintf.c
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/linux/Makefile
Makefile
apache-2.0
3,365
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)compat.h 8.13 (Berkeley) 2/21/94 */ #ifndef _COMPAT_H_ #define _COMPAT_H_ #include <sys/types.h> /* * If your system doesn't typedef u_long, u_short, or u_char, change * the 0 to a 1. */ #if 0 typedef unsigned char u_char; /* 4.[34]BSD names. */ typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short u_short; #endif /* If your system doesn't typedef size_t, change the 0 to a 1. */ #if 0 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ #endif /* If your system doesn't typedef ssize_t, change the 0 to a 1. */ #if 0 typedef int ssize_t; /* POSIX names. */ #endif /* * If your system doesn't have the POSIX type for a signal mask, * change the 0 to a 1. */ #if 0 /* POSIX 1003.1 signal mask type. */ typedef unsigned int sigset_t; #endif /* * If your system's vsprintf returns a char *, not an int, * change the 0 to a 1. */ #if 0 #define VSPRINTF_CHARSTAR #endif /* * If you don't have POSIX 1003.1 signals, the signal code surrounding the * temporary file creation is intended to block all of the possible signals * long enough to create the file and unlink it. All of this stuff is * intended to use old-style BSD calls to fake POSIX 1003.1 calls. */ #ifdef NO_POSIX_SIGNALS #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) #define SIG_BLOCK 1 #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 static int __sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ ((__sigtemp = \ (((how) == SIG_BLOCK) ? \ sigblock(0) | *(set) : \ (((how) == SIG_UNBLOCK) ? \ sigblock(0) & ~(*(set)) : \ ((how) == SIG_SETMASK ? \ *(set) : sigblock(0))))), \ ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ sigsetmask(__sigtemp)), 0) #endif /* * If your system doesn't have an include file with the appropriate * byte order set, make sure you specify the correct one. */ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define BYTE_ORDER LITTLE_ENDIAN /* Set for your system. */ #endif #if defined(SYSV) || defined(SYSTEM5) #define index(a, b) strchr(a, b) #define rindex(a, b) strrchr(a, b) #define bzero(a, b) memset(a, 0, b) #define bcmp(a, b, n) memcmp(a, b, n) #define bcopy(a, b, n) memmove(b, a, n) #endif #if defined(BSD) || defined(BSD4_3) #define strchr(a, b) index(a, b) #define strrchr(a, b) rindex(a, b) #define memcmp(a, b, n) bcmp(a, b, n) #define memmove(a, b, n) bcopy(b, a, n) #endif /* * 32-bit machine. The db routines are theoretically independent of * the size of u_shorts and u_longs, but I don't know that anyone has * ever actually tried it. At a minimum, change the following #define's * if you are trying to compile on a different type of system. */ #ifndef USHRT_MAX #define USHRT_MAX 0xFFFF #define ULONG_MAX 0xFFFFFFFF #endif #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ #define _POSIX2_RE_DUP_MAX 255 #endif /* * If you can't provide lock values in the open(2) call. Note, this * allows races to happen. */ #ifndef O_EXLOCK /* 4.4BSD extension. */ #define O_EXLOCK 0 #endif #ifndef O_SHLOCK /* 4.4BSD extension. */ #define O_SHLOCK 0 #endif #ifndef EFTYPE #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ #endif #ifndef WCOREDUMP /* 4.4BSD extension */ #define WCOREDUMP(a) 0 #endif #ifndef STDERR_FILENO #define STDIN_FILENO 0 /* ANSI C #defines */ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif #ifndef SEEK_END #define SEEK_SET 0 /* POSIX 1003.1 seek values */ #define SEEK_CUR 1 #define SEEK_END 2 #endif #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ #define _POSIX_VDISABLE 0 /* Some systems used 0. */ #endif #ifndef TCSASOFT /* 4.4BSD extension. */ #define TCSASOFT 0 #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ #define _POSIX2_RE_DUP_MAX 255 #endif #ifndef NULL /* ANSI C #defines NULL everywhere. */ #define NULL 0 #endif #ifndef MAX /* Usually found in <sys/param.h>. */ #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) #endif #ifndef MIN /* Usually found in <sys/param.h>. */ #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif /* Default file permissions. */ #ifndef DEFFILEMODE /* 4.4BSD extension. */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ #endif /* The type of a va_list. */ #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ #define _BSD_VA_LIST_ char * #endif #endif /* !_COMPAT_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/linux/include/compat.h
C
apache-2.0
7,284
../../include/db.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/linux/include/db.h
C
apache-2.0
18
../../include/mpool.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/linux/include/mpool.h
C
apache-2.0
21
../../include/ndbm.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/linux/include/ndbm.h
C
apache-2.0
20
# @(#)Makefile 8.9 (Berkeley) 7/14/94 LIBDB= libdb.a OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \ hsearch.o ndbm.o OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \ bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \ bt_utils.o OBJ3= db.o OBJ4= mpool.o OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \ rec_seq.o rec_utils.o MISC= snprintf.o ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} rm -f $@ ar cq $@ \ `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort` ranlib $@ clean: rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} OORG= -O CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude hash.o: ../../hash/hash.c ${CL} -I../../hash ../../hash/hash.c hash_bigkey.o: ../../hash/hash_bigkey.c ${CL} -I../../hash ../../hash/hash_bigkey.c hash_buf.o: ../../hash/hash_buf.c ${CL} -I../../hash ../../hash/hash_buf.c hash_func.o: ../../hash/hash_func.c ${CL} -I../../hash ../../hash/hash_func.c hash_log2.o: ../../hash/hash_log2.c ${CL} -I../../hash ../../hash/hash_log2.c hash_page.o: ../../hash/hash_page.c ${CL} -I../../hash ../../hash/hash_page.c hsearch.o: ../../hash/hsearch.c ${CL} -I../../hash ../../hash/hsearch.c ndbm.o: ../../hash/ndbm.c ${CL} -I../../hash ../../hash/ndbm.c bt_close.o: ../../btree/bt_close.c ${CL} -I../../btree ../../btree/bt_close.c bt_conv.o: ../../btree/bt_conv.c ${CL} -I../../btree ../../btree/bt_conv.c bt_debug.o: ../../btree/bt_debug.c ${CL} -I../../btree ../../btree/bt_debug.c bt_delete.o: ../../btree/bt_delete.c ${CL} -I../../btree ../../btree/bt_delete.c bt_get.o: ../../btree/bt_get.c ${CL} -I../../btree ../../btree/bt_get.c bt_open.o: ../../btree/bt_open.c ${CL} -I../../btree ../../btree/bt_open.c bt_overflow.o: ../../btree/bt_overflow.c ${CL} -I../../btree ../../btree/bt_overflow.c bt_page.o: ../../btree/bt_page.c ${CL} -I../../btree ../../btree/bt_page.c bt_put.o: ../../btree/bt_put.c ${CL} -I../../btree ../../btree/bt_put.c bt_search.o: ../../btree/bt_search.c ${CL} -I../../btree ../../btree/bt_search.c bt_seq.o: ../../btree/bt_seq.c ${CL} -I../../btree ../../btree/bt_seq.c bt_split.o: ../../btree/bt_split.c ${CL} -I../../btree ../../btree/bt_split.c bt_stack.o: ../../btree/bt_stack.c ${CL} -I../../btree ../../btree/bt_stack.c bt_utils.o: ../../btree/bt_utils.c ${CL} -I../../btree ../../btree/bt_utils.c db.o: ../../db/db.c ${CL} ../../db/db.c mpool.o: ../../mpool/mpool.c ${CL} -I../../mpool ../../mpool/mpool.c rec_close.o: ../../recno/rec_close.c ${CL} -I../../recno ../../recno/rec_close.c rec_delete.o: ../../recno/rec_delete.c ${CL} -I../../recno ../../recno/rec_delete.c rec_get.o: ../../recno/rec_get.c ${CL} -I../../recno ../../recno/rec_get.c rec_open.o: ../../recno/rec_open.c ${CL} -I../../recno ../../recno/rec_open.c rec_put.o: ../../recno/rec_put.c ${CL} -I../../recno ../../recno/rec_put.c rec_search.o: ../../recno/rec_search.c ${CL} -I../../recno ../../recno/rec_search.c rec_seq.o: ../../recno/rec_seq.c ${CL} -I../../recno ../../recno/rec_seq.c rec_utils.o: ../../recno/rec_utils.c ${CL} -I../../recno ../../recno/rec_utils.c memmove.o: ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c mktemp.o: ${CC} -c -O -I. -Iinclude clib/mktemp.c snprintf.o: ${CC} -c -O -I. -Iinclude clib/snprintf.c
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/osf.1.0.2/Makefile
Makefile
apache-2.0
3,365
../../include/cdefs.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/osf.1.0.2/include/cdefs.h
C
apache-2.0
21
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)compat.h 8.13 (Berkeley) 2/21/94 */ #ifndef _COMPAT_H_ #define _COMPAT_H_ #include <sys/types.h> /* * If your system doesn't typedef u_long, u_short, or u_char, change * the 0 to a 1. */ #if 0 typedef unsigned char u_char; /* 4.[34]BSD names. */ typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short u_short; #endif /* If your system doesn't typedef size_t, change the 0 to a 1. */ #if 0 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ #endif /* If your system doesn't typedef ssize_t, change the 0 to a 1. */ #if 0 typedef int ssize_t; /* POSIX names. */ #endif /* * If your system doesn't have the POSIX type for a signal mask, * change the 0 to a 1. */ #if 0 /* POSIX 1003.1 signal mask type. */ typedef unsigned int sigset_t; #endif /* * If your system's vsprintf returns a char *, not an int, * change the 0 to a 1. */ #if 0 #define VSPRINTF_CHARSTAR #endif /* * If you don't have POSIX 1003.1 signals, the signal code surrounding the * temporary file creation is intended to block all of the possible signals * long enough to create the file and unlink it. All of this stuff is * intended to use old-style BSD calls to fake POSIX 1003.1 calls. */ #ifdef NO_POSIX_SIGNALS #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) #define SIG_BLOCK 1 #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 static int __sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ ((__sigtemp = \ (((how) == SIG_BLOCK) ? \ sigblock(0) | *(set) : \ (((how) == SIG_UNBLOCK) ? \ sigblock(0) & ~(*(set)) : \ ((how) == SIG_SETMASK ? \ *(set) : sigblock(0))))), \ ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ sigsetmask(__sigtemp)), 0) #endif /* * If your system doesn't have an include file with the appropriate * byte order set, make sure you specify the correct one. */ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define BYTE_ORDER LITTLE_ENDIAN /* Set for your system. */ #endif #if defined(SYSV) || defined(SYSTEM5) #define index(a, b) strchr(a, b) #define rindex(a, b) strrchr(a, b) #define bzero(a, b) memset(a, 0, b) #define bcmp(a, b, n) memcmp(a, b, n) #define bcopy(a, b, n) memmove(b, a, n) #endif #if defined(BSD) || defined(BSD4_3) #define strchr(a, b) index(a, b) #define strrchr(a, b) rindex(a, b) #define memcmp(a, b, n) bcmp(a, b, n) #define memmove(a, b, n) bcopy(b, a, n) #endif /* * 32-bit machine. The db routines are theoretically independent of * the size of u_shorts and u_longs, but I don't know that anyone has * ever actually tried it. At a minimum, change the following #define's * if you are trying to compile on a different type of system. */ #ifndef USHRT_MAX #define USHRT_MAX 0xFFFF #define ULONG_MAX 0xFFFFFFFF #endif #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ #define _POSIX2_RE_DUP_MAX 255 #endif /* * If you can't provide lock values in the open(2) call. Note, this * allows races to happen. */ #ifndef O_EXLOCK /* 4.4BSD extension. */ #define O_EXLOCK 0 #endif #ifndef O_SHLOCK /* 4.4BSD extension. */ #define O_SHLOCK 0 #endif #ifndef EFTYPE #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ #endif #ifndef WCOREDUMP /* 4.4BSD extension */ #define WCOREDUMP(a) 0 #endif #ifndef STDERR_FILENO #define STDIN_FILENO 0 /* ANSI C #defines */ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif #ifndef SEEK_END #define SEEK_SET 0 /* POSIX 1003.1 seek values */ #define SEEK_CUR 1 #define SEEK_END 2 #endif #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ #define _POSIX_VDISABLE 0 /* Some systems used 0. */ #endif #ifndef TCSASOFT /* 4.4BSD extension. */ #define TCSASOFT 0 #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ #define _POSIX2_RE_DUP_MAX 255 #endif #ifndef NULL /* ANSI C #defines NULL everywhere. */ #define NULL 0 #endif #ifndef MAX /* Usually found in <sys/param.h>. */ #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) #endif #ifndef MIN /* Usually found in <sys/param.h>. */ #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif /* Default file permissions. */ #ifndef DEFFILEMODE /* 4.4BSD extension. */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ #endif /* The type of a va_list. */ #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ #define _BSD_VA_LIST_ char * #endif #endif /* !_COMPAT_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/osf.1.0.2/include/compat.h
C
apache-2.0
7,284
../../include/db.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/osf.1.0.2/include/db.h
C
apache-2.0
18
../../include/mpool.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/osf.1.0.2/include/mpool.h
C
apache-2.0
21
../../include/ndbm.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/osf.1.0.2/include/ndbm.h
C
apache-2.0
20
../../include/queue.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/osf.1.0.2/include/queue.h
C
apache-2.0
21
osf.1.0.2
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/osf.1.3
Roff
apache-2.0
9
# @(#)Makefile 8.9 (Berkeley) 7/14/94 LIBDB= libdb.a OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \ hsearch.o ndbm.o OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \ bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \ bt_utils.o OBJ3= db.o OBJ4= mpool.o OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \ rec_seq.o rec_utils.o MISC= mktemp.o snprintf.o ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} rm -f $@ ar cq $@ \ `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort` ranlib $@ clean: rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} CC= gcc OORG= -O CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude \ -DMMAP_NOT_AVAILABLE -DSTBLKSIZE_NOT_AVAILABLE -DSYS5 hash.o: ../../hash/hash.c ${CL} -I../../hash ../../hash/hash.c hash_bigkey.o: ../../hash/hash_bigkey.c ${CL} -I../../hash ../../hash/hash_bigkey.c hash_buf.o: ../../hash/hash_buf.c ${CL} -I../../hash ../../hash/hash_buf.c hash_func.o: ../../hash/hash_func.c ${CL} -I../../hash ../../hash/hash_func.c hash_log2.o: ../../hash/hash_log2.c ${CL} -I../../hash ../../hash/hash_log2.c hash_page.o: ../../hash/hash_page.c ${CL} -I../../hash ../../hash/hash_page.c hsearch.o: ../../hash/hsearch.c ${CL} -I../../hash ../../hash/hsearch.c ndbm.o: ../../hash/ndbm.c ${CL} -I../../hash ../../hash/ndbm.c bt_close.o: ../../btree/bt_close.c ${CL} -I../../btree ../../btree/bt_close.c bt_conv.o: ../../btree/bt_conv.c ${CL} -I../../btree ../../btree/bt_conv.c bt_debug.o: ../../btree/bt_debug.c ${CL} -I../../btree ../../btree/bt_debug.c bt_delete.o: ../../btree/bt_delete.c ${CL} -I../../btree ../../btree/bt_delete.c bt_get.o: ../../btree/bt_get.c ${CL} -I../../btree ../../btree/bt_get.c bt_open.o: ../../btree/bt_open.c ${CL} -I../../btree ../../btree/bt_open.c bt_overflow.o: ../../btree/bt_overflow.c ${CL} -I../../btree ../../btree/bt_overflow.c bt_page.o: ../../btree/bt_page.c ${CL} -I../../btree ../../btree/bt_page.c bt_put.o: ../../btree/bt_put.c ${CL} -I../../btree ../../btree/bt_put.c bt_search.o: ../../btree/bt_search.c ${CL} -I../../btree ../../btree/bt_search.c bt_seq.o: ../../btree/bt_seq.c ${CL} -I../../btree ../../btree/bt_seq.c bt_split.o: ../../btree/bt_split.c ${CL} -I../../btree ../../btree/bt_split.c bt_stack.o: ../../btree/bt_stack.c ${CL} -I../../btree ../../btree/bt_stack.c bt_utils.o: ../../btree/bt_utils.c ${CL} -I../../btree ../../btree/bt_utils.c db.o: ../../db/db.c ${CL} ../../db/db.c mpool.o: ../../mpool/mpool.c ${CL} -I../../mpool ../../mpool/mpool.c rec_close.o: ../../recno/rec_close.c ${CL} -I../../recno ../../recno/rec_close.c rec_delete.o: ../../recno/rec_delete.c ${CL} -I../../recno ../../recno/rec_delete.c rec_get.o: ../../recno/rec_get.c ${CL} -I../../recno ../../recno/rec_get.c rec_open.o: ../../recno/rec_open.c ${CL} -I../../recno ../../recno/rec_open.c rec_put.o: ../../recno/rec_put.c ${CL} -I../../recno ../../recno/rec_put.c rec_search.o: ../../recno/rec_search.c ${CL} -I../../recno ../../recno/rec_search.c rec_seq.o: ../../recno/rec_seq.c ${CL} -I../../recno ../../recno/rec_seq.c rec_utils.o: ../../recno/rec_utils.c ${CL} -I../../recno ../../recno/rec_utils.c memmove.o: ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c mktemp.o: ${CC} -c -O -I. -Iinclude clib/mktemp.c snprintf.o: ${CC} -c -O -I. -Iinclude clib/snprintf.c
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ptx.2.0/Makefile
Makefile
apache-2.0
3,443
../../include/cdefs.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ptx.2.0/include/cdefs.h
C
apache-2.0
21
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)compat.h 8.13 (Berkeley) 2/21/94 */ #ifndef _COMPAT_H_ #define _COMPAT_H_ #include <sys/types.h> #include <sys/select.h> /* For fd_set. */ /* * If your system doesn't typedef u_long, u_short, or u_char, change * the 0 to a 1. */ #if 1 typedef unsigned char u_char; /* 4.[34]BSD names. */ typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short u_short; #endif /* If your system doesn't typedef size_t, change the 0 to a 1. */ #if 0 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ #endif /* If your system doesn't typedef ssize_t, change the 0 to a 1. */ #if 0 typedef int ssize_t; /* POSIX names. */ #endif /* * If your system doesn't have the POSIX type for a signal mask, * change the 0 to a 1. */ #if 0 /* POSIX 1003.1 signal mask type. */ typedef unsigned int sigset_t; #endif /* * If your system's vsprintf returns a char *, not an int, * change the 0 to a 1. */ #if 0 #define VSPRINTF_CHARSTAR #endif /* * If you don't have POSIX 1003.1 signals, the signal code surrounding the * temporary file creation is intended to block all of the possible signals * long enough to create the file and unlink it. All of this stuff is * intended to use old-style BSD calls to fake POSIX 1003.1 calls. */ #ifdef NO_POSIX_SIGNALS #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) #define SIG_BLOCK 1 #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 static int __sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ ((__sigtemp = \ (((how) == SIG_BLOCK) ? \ sigblock(0) | *(set) : \ (((how) == SIG_UNBLOCK) ? \ sigblock(0) & ~(*(set)) : \ ((how) == SIG_SETMASK ? \ *(set) : sigblock(0))))), \ ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ sigsetmask(__sigtemp)), 0) #endif /* * If your system doesn't have an include file with the appropriate * byte order set, make sure you specify the correct one. */ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define BYTE_ORDER BIG_ENDIAN /* Set for your system. */ #endif #if defined(SYSV) || defined(SYSTEM5) #define index(a, b) strchr(a, b) #define rindex(a, b) strrchr(a, b) #define bzero(a, b) memset(a, 0, b) #define bcmp(a, b, n) memcmp(a, b, n) #define bcopy(a, b, n) memmove(b, a, n) #endif #if defined(BSD) || defined(BSD4_3) #define strchr(a, b) index(a, b) #define strrchr(a, b) rindex(a, b) #define memcmp(a, b, n) bcmp(a, b, n) #define memmove(a, b, n) bcopy(b, a, n) #endif /* * 32-bit machine. The db routines are theoretically independent of * the size of u_shorts and u_longs, but I don't know that anyone has * ever actually tried it. At a minimum, change the following #define's * if you are trying to compile on a different type of system. */ #ifndef USHRT_MAX #define USHRT_MAX 0xFFFF #define ULONG_MAX 0xFFFFFFFF #endif #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ #define _POSIX2_RE_DUP_MAX 255 #endif /* * If you can't provide lock values in the open(2) call. Note, this * allows races to happen. */ #ifndef O_EXLOCK /* 4.4BSD extension. */ #define O_EXLOCK 0 #endif #ifndef O_SHLOCK /* 4.4BSD extension. */ #define O_SHLOCK 0 #endif #ifndef EFTYPE #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ #endif #ifndef WCOREDUMP /* 4.4BSD extension */ #define WCOREDUMP(a) 0 #endif #ifndef STDERR_FILENO #define STDIN_FILENO 0 /* ANSI C #defines */ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif #ifndef SEEK_END #define SEEK_SET 0 /* POSIX 1003.1 seek values */ #define SEEK_CUR 1 #define SEEK_END 2 #endif #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ #define _POSIX_VDISABLE 0 /* Some systems used 0. */ #endif #ifndef TCSASOFT /* 4.4BSD extension. */ #define TCSASOFT 0 #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ #define _POSIX2_RE_DUP_MAX 255 #endif #ifndef NULL /* ANSI C #defines NULL everywhere. */ #define NULL 0 #endif #ifndef MAX /* Usually found in <sys/param.h>. */ #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) #endif #ifndef MIN /* Usually found in <sys/param.h>. */ #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif /* Default file permissions. */ #ifndef DEFFILEMODE /* 4.4BSD extension. */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ #endif /* The type of a va_list. */ #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ #define _BSD_VA_LIST_ char * #endif #endif /* !_COMPAT_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ptx.2.0/include/compat.h
C
apache-2.0
7,325
../../include/db.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ptx.2.0/include/db.h
C
apache-2.0
18
../../include/mpool.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ptx.2.0/include/mpool.h
C
apache-2.0
21
../../include/ndbm.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ptx.2.0/include/ndbm.h
C
apache-2.0
20
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)pathnames.h 8.5 (Berkeley) 12/21/93 */ #define _PATH_BSHELL "/bin/sh" #define _PATH_DEVNULL "/dev/null" #define _PATH_EXRC ".exrc" #define _PATH_NEXRC ".nexrc" #define _PATH_PRESERVE "/usr/tmp/vi.recover" #define _PATH_SENDMAIL "/usr/lib/sendmail" #define _PATH_SYSEXRC "/etc/vi.exrc" #define _PATH_TAGS "tags" #define _PATH_TMP "/tmp" #define _PATH_TTY "/dev/tty"
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ptx.2.0/include/pathnames.h
C
apache-2.0
2,205
../../include/queue.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ptx.2.0/include/queue.h
C
apache-2.0
21
# @(#)Makefile 8.9 (Berkeley) 7/14/94 LIBDB= libdb.a OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \ hsearch.o ndbm.o OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \ bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \ bt_utils.o OBJ3= db.o OBJ4= mpool.o OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \ rec_seq.o rec_utils.o MISC= mktemp.o snprintf.o ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} rm -f $@ ar cq $@ \ `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort` ranlib $@ clean: rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} OORG= -O CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude hash.o: ../../hash/hash.c ${CL} -I../../hash ../../hash/hash.c hash_bigkey.o: ../../hash/hash_bigkey.c ${CL} -I../../hash ../../hash/hash_bigkey.c hash_buf.o: ../../hash/hash_buf.c ${CL} -I../../hash ../../hash/hash_buf.c hash_func.o: ../../hash/hash_func.c ${CL} -I../../hash ../../hash/hash_func.c hash_log2.o: ../../hash/hash_log2.c ${CL} -I../../hash ../../hash/hash_log2.c hash_page.o: ../../hash/hash_page.c ${CL} -I../../hash ../../hash/hash_page.c hsearch.o: ../../hash/hsearch.c ${CL} -I../../hash ../../hash/hsearch.c ndbm.o: ../../hash/ndbm.c ${CL} -I../../hash ../../hash/ndbm.c bt_close.o: ../../btree/bt_close.c ${CL} -I../../btree ../../btree/bt_close.c bt_conv.o: ../../btree/bt_conv.c ${CL} -I../../btree ../../btree/bt_conv.c bt_debug.o: ../../btree/bt_debug.c ${CL} -I../../btree ../../btree/bt_debug.c bt_delete.o: ../../btree/bt_delete.c ${CL} -I../../btree ../../btree/bt_delete.c bt_get.o: ../../btree/bt_get.c ${CL} -I../../btree ../../btree/bt_get.c bt_open.o: ../../btree/bt_open.c ${CL} -I../../btree ../../btree/bt_open.c bt_overflow.o: ../../btree/bt_overflow.c ${CL} -I../../btree ../../btree/bt_overflow.c bt_page.o: ../../btree/bt_page.c ${CL} -I../../btree ../../btree/bt_page.c bt_put.o: ../../btree/bt_put.c ${CL} -I../../btree ../../btree/bt_put.c bt_search.o: ../../btree/bt_search.c ${CL} -I../../btree ../../btree/bt_search.c bt_seq.o: ../../btree/bt_seq.c ${CL} -I../../btree ../../btree/bt_seq.c bt_split.o: ../../btree/bt_split.c ${CL} -I../../btree ../../btree/bt_split.c bt_stack.o: ../../btree/bt_stack.c ${CL} -I../../btree ../../btree/bt_stack.c bt_utils.o: ../../btree/bt_utils.c ${CL} -I../../btree ../../btree/bt_utils.c db.o: ../../db/db.c ${CL} ../../db/db.c mpool.o: ../../mpool/mpool.c ${CL} -I../../mpool ../../mpool/mpool.c rec_close.o: ../../recno/rec_close.c ${CL} -I../../recno ../../recno/rec_close.c rec_delete.o: ../../recno/rec_delete.c ${CL} -I../../recno ../../recno/rec_delete.c rec_get.o: ../../recno/rec_get.c ${CL} -I../../recno ../../recno/rec_get.c rec_open.o: ../../recno/rec_open.c ${CL} -I../../recno ../../recno/rec_open.c rec_put.o: ../../recno/rec_put.c ${CL} -I../../recno ../../recno/rec_put.c rec_search.o: ../../recno/rec_search.c ${CL} -I../../recno ../../recno/rec_search.c rec_seq.o: ../../recno/rec_seq.c ${CL} -I../../recno ../../recno/rec_seq.c rec_utils.o: ../../recno/rec_utils.c ${CL} -I../../recno ../../recno/rec_utils.c memmove.o: ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c mktemp.o: ${CC} -c -O -I. -Iinclude clib/mktemp.c snprintf.o: ${CC} -c -O -I. -Iinclude clib/snprintf.c
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sinix.5.41/Makefile
Makefile
apache-2.0
3,374
../../include/cdefs.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sinix.5.41/include/cdefs.h
C
apache-2.0
21
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)compat.h 8.13 (Berkeley) 2/21/94 */ #ifndef _COMPAT_H_ #define _COMPAT_H_ #include <sys/types.h> /* * If your system doesn't typedef u_long, u_short, or u_char, change * the 0 to a 1. */ #if 0 typedef unsigned char u_char; /* 4.[34]BSD names. */ typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short u_short; #endif /* If your system doesn't typedef size_t, change the 0 to a 1. */ #if 0 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ #endif /* If your system doesn't typedef ssize_t, change the 0 to a 1. */ #if 0 typedef int ssize_t; /* POSIX names. */ #endif /* * If your system doesn't have the POSIX type for a signal mask, * change the 0 to a 1. */ #if 0 /* POSIX 1003.1 signal mask type. */ typedef unsigned int sigset_t; #endif /* * If your system's vsprintf returns a char *, not an int, * change the 0 to a 1. */ #if 0 #define VSPRINTF_CHARSTAR #endif /* * If you don't have POSIX 1003.1 signals, the signal code surrounding the * temporary file creation is intended to block all of the possible signals * long enough to create the file and unlink it. All of this stuff is * intended to use old-style BSD calls to fake POSIX 1003.1 calls. */ #ifdef NO_POSIX_SIGNALS #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) #define SIG_BLOCK 1 #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 static int __sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ ((__sigtemp = \ (((how) == SIG_BLOCK) ? \ sigblock(0) | *(set) : \ (((how) == SIG_UNBLOCK) ? \ sigblock(0) & ~(*(set)) : \ ((how) == SIG_SETMASK ? \ *(set) : sigblock(0))))), \ ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ sigsetmask(__sigtemp)), 0) #endif /* * If your system doesn't have an include file with the appropriate * byte order set, make sure you specify the correct one. */ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define BYTE_ORDER BIG_ENDIAN /* Set for your system. */ #endif #if defined(SYSV) || defined(SYSTEM5) #define index(a, b) strchr(a, b) #define rindex(a, b) strrchr(a, b) #define bzero(a, b) memset(a, 0, b) #define bcmp(a, b, n) memcmp(a, b, n) #define bcopy(a, b, n) memmove(b, a, n) #endif #if defined(BSD) || defined(BSD4_3) #define strchr(a, b) index(a, b) #define strrchr(a, b) rindex(a, b) #define memcmp(a, b, n) bcmp(a, b, n) #define memmove(a, b, n) bcopy(b, a, n) #endif /* * 32-bit machine. The db routines are theoretically independent of * the size of u_shorts and u_longs, but I don't know that anyone has * ever actually tried it. At a minimum, change the following #define's * if you are trying to compile on a different type of system. */ #ifndef USHRT_MAX #define USHRT_MAX 0xFFFF #define ULONG_MAX 0xFFFFFFFF #endif #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ #define _POSIX2_RE_DUP_MAX 255 #endif /* * If you can't provide lock values in the open(2) call. Note, this * allows races to happen. */ #ifndef O_EXLOCK /* 4.4BSD extension. */ #define O_EXLOCK 0 #endif #ifndef O_SHLOCK /* 4.4BSD extension. */ #define O_SHLOCK 0 #endif #ifndef EFTYPE #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ #endif #ifndef WCOREDUMP /* 4.4BSD extension */ #define WCOREDUMP(a) 0 #endif #ifndef STDERR_FILENO #define STDIN_FILENO 0 /* ANSI C #defines */ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif #ifndef SEEK_END #define SEEK_SET 0 /* POSIX 1003.1 seek values */ #define SEEK_CUR 1 #define SEEK_END 2 #endif #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ #define _POSIX_VDISABLE 0 /* Some systems used 0. */ #endif #ifndef TCSASOFT /* 4.4BSD extension. */ #define TCSASOFT 0 #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ #define _POSIX2_RE_DUP_MAX 255 #endif #ifndef NULL /* ANSI C #defines NULL everywhere. */ #define NULL 0 #endif #ifndef MAX /* Usually found in <sys/param.h>. */ #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) #endif #ifndef MIN /* Usually found in <sys/param.h>. */ #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif /* Default file permissions. */ #ifndef DEFFILEMODE /* 4.4BSD extension. */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ #endif /* The type of a va_list. */ #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ #define _BSD_VA_LIST_ char * #endif #endif /* !_COMPAT_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sinix.5.41/include/compat.h
C
apache-2.0
7,281
../../include/db.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sinix.5.41/include/db.h
C
apache-2.0
18
../../include/mpool.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sinix.5.41/include/mpool.h
C
apache-2.0
21
../../include/ndbm.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sinix.5.41/include/ndbm.h
C
apache-2.0
20
../../include/queue.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sinix.5.41/include/queue.h
C
apache-2.0
21
sunos.5.2
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/solaris.2.2
Roff
apache-2.0
9
# @(#)Makefile 8.9 (Berkeley) 7/14/94 LIBDB= libdb.a OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \ hsearch.o ndbm.o OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \ bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \ bt_utils.o OBJ3= db.o OBJ4= mpool.o OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \ rec_seq.o rec_utils.o MISC= memmove.o snprintf.o ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} rm -f $@ ar cq $@ \ `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort` ranlib $@ clean: rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} OORG= -O CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude hash.o: ../../hash/hash.c ${CL} -I../../hash ../../hash/hash.c hash_bigkey.o: ../../hash/hash_bigkey.c ${CL} -I../../hash ../../hash/hash_bigkey.c hash_buf.o: ../../hash/hash_buf.c ${CL} -I../../hash ../../hash/hash_buf.c hash_func.o: ../../hash/hash_func.c ${CL} -I../../hash ../../hash/hash_func.c hash_log2.o: ../../hash/hash_log2.c ${CL} -I../../hash ../../hash/hash_log2.c hash_page.o: ../../hash/hash_page.c ${CL} -I../../hash ../../hash/hash_page.c hsearch.o: ../../hash/hsearch.c ${CL} -I../../hash ../../hash/hsearch.c ndbm.o: ../../hash/ndbm.c ${CL} -I../../hash ../../hash/ndbm.c bt_close.o: ../../btree/bt_close.c ${CL} -I../../btree ../../btree/bt_close.c bt_conv.o: ../../btree/bt_conv.c ${CL} -I../../btree ../../btree/bt_conv.c bt_debug.o: ../../btree/bt_debug.c ${CL} -I../../btree ../../btree/bt_debug.c bt_delete.o: ../../btree/bt_delete.c ${CL} -I../../btree ../../btree/bt_delete.c bt_get.o: ../../btree/bt_get.c ${CL} -I../../btree ../../btree/bt_get.c bt_open.o: ../../btree/bt_open.c ${CL} -I../../btree ../../btree/bt_open.c bt_overflow.o: ../../btree/bt_overflow.c ${CL} -I../../btree ../../btree/bt_overflow.c bt_page.o: ../../btree/bt_page.c ${CL} -I../../btree ../../btree/bt_page.c bt_put.o: ../../btree/bt_put.c ${CL} -I../../btree ../../btree/bt_put.c bt_search.o: ../../btree/bt_search.c ${CL} -I../../btree ../../btree/bt_search.c bt_seq.o: ../../btree/bt_seq.c ${CL} -I../../btree ../../btree/bt_seq.c bt_split.o: ../../btree/bt_split.c ${CL} -I../../btree ../../btree/bt_split.c bt_stack.o: ../../btree/bt_stack.c ${CL} -I../../btree ../../btree/bt_stack.c bt_utils.o: ../../btree/bt_utils.c ${CL} -I../../btree ../../btree/bt_utils.c db.o: ../../db/db.c ${CL} ../../db/db.c mpool.o: ../../mpool/mpool.c ${CL} -I../../mpool ../../mpool/mpool.c rec_close.o: ../../recno/rec_close.c ${CL} -I../../recno ../../recno/rec_close.c rec_delete.o: ../../recno/rec_delete.c ${CL} -I../../recno ../../recno/rec_delete.c rec_get.o: ../../recno/rec_get.c ${CL} -I../../recno ../../recno/rec_get.c rec_open.o: ../../recno/rec_open.c ${CL} -I../../recno ../../recno/rec_open.c rec_put.o: ../../recno/rec_put.c ${CL} -I../../recno ../../recno/rec_put.c rec_search.o: ../../recno/rec_search.c ${CL} -I../../recno ../../recno/rec_search.c rec_seq.o: ../../recno/rec_seq.c ${CL} -I../../recno ../../recno/rec_seq.c rec_utils.o: ../../recno/rec_utils.c ${CL} -I../../recno ../../recno/rec_utils.c memmove.o: ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c mktemp.o: ${CC} -c -O -I. -Iinclude clib/mktemp.c snprintf.o: ${CC} -c -O -I. -Iinclude clib/snprintf.c
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.4.1.1/Makefile
Makefile
apache-2.0
3,375
../../include/cdefs.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.4.1.1/include/cdefs.h
C
apache-2.0
21
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)compat.h 8.13 (Berkeley) 2/21/94 */ #ifndef _COMPAT_H_ #define _COMPAT_H_ #include <sys/types.h> /* * If your system doesn't typedef u_long, u_short, or u_char, change * the 0 to a 1. */ #if 0 typedef unsigned char u_char; /* 4.[34]BSD names. */ typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short u_short; #endif /* If your system doesn't typedef size_t, change the 0 to a 1. */ #if 0 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ #endif /* If your system doesn't typedef ssize_t, change the 0 to a 1. */ #if 1 typedef int ssize_t; /* POSIX names. */ #endif /* * If your system doesn't have the POSIX type for a signal mask, * change the 0 to a 1. */ #if 0 /* POSIX 1003.1 signal mask type. */ typedef unsigned int sigset_t; #endif /* * If your system's vsprintf returns a char *, not an int, * change the 0 to a 1. */ #if 1 #define VSPRINTF_CHARSTAR #endif /* * If you don't have POSIX 1003.1 signals, the signal code surrounding the * temporary file creation is intended to block all of the possible signals * long enough to create the file and unlink it. All of this stuff is * intended to use old-style BSD calls to fake POSIX 1003.1 calls. */ #ifdef NO_POSIX_SIGNALS #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) #define SIG_BLOCK 1 #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 static int __sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ ((__sigtemp = \ (((how) == SIG_BLOCK) ? \ sigblock(0) | *(set) : \ (((how) == SIG_UNBLOCK) ? \ sigblock(0) & ~(*(set)) : \ ((how) == SIG_SETMASK ? \ *(set) : sigblock(0))))), \ ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ sigsetmask(__sigtemp)), 0) #endif /* * If your system doesn't have an include file with the appropriate * byte order set, make sure you specify the correct one. */ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define BYTE_ORDER BIG_ENDIAN /* Set for your system. */ #endif #if defined(SYSV) || defined(SYSTEM5) #define index(a, b) strchr(a, b) #define rindex(a, b) strrchr(a, b) #define bzero(a, b) memset(a, 0, b) #define bcmp(a, b, n) memcmp(a, b, n) #define bcopy(a, b, n) memmove(b, a, n) #endif #if defined(BSD) || defined(BSD4_3) #define strchr(a, b) index(a, b) #define strrchr(a, b) rindex(a, b) #define memcmp(a, b, n) bcmp(a, b, n) #define memmove(a, b, n) bcopy(b, a, n) #endif /* * 32-bit machine. The db routines are theoretically independent of * the size of u_shorts and u_longs, but I don't know that anyone has * ever actually tried it. At a minimum, change the following #define's * if you are trying to compile on a different type of system. */ #ifndef USHRT_MAX #define USHRT_MAX 0xFFFF #define ULONG_MAX 0xFFFFFFFF #endif #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ #define _POSIX2_RE_DUP_MAX 255 #endif /* * If you can't provide lock values in the open(2) call. Note, this * allows races to happen. */ #ifndef O_EXLOCK /* 4.4BSD extension. */ #define O_EXLOCK 0 #endif #ifndef O_SHLOCK /* 4.4BSD extension. */ #define O_SHLOCK 0 #endif #ifndef EFTYPE #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ #endif #ifndef WCOREDUMP /* 4.4BSD extension */ #define WCOREDUMP(a) 0 #endif #ifndef STDERR_FILENO #define STDIN_FILENO 0 /* ANSI C #defines */ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif #ifndef SEEK_END #define SEEK_SET 0 /* POSIX 1003.1 seek values */ #define SEEK_CUR 1 #define SEEK_END 2 #endif #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ #define _POSIX_VDISABLE 0 /* Some systems used 0. */ #endif #ifndef TCSASOFT /* 4.4BSD extension. */ #define TCSASOFT 0 #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ #define _POSIX2_RE_DUP_MAX 255 #endif #ifndef NULL /* ANSI C #defines NULL everywhere. */ #define NULL 0 #endif #ifndef MAX /* Usually found in <sys/param.h>. */ #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) #endif #ifndef MIN /* Usually found in <sys/param.h>. */ #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif /* Default file permissions. */ #ifndef DEFFILEMODE /* 4.4BSD extension. */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ #endif /* The type of a va_list. */ #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ #define _BSD_VA_LIST_ char * #endif #endif /* !_COMPAT_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.4.1.1/include/compat.h
C
apache-2.0
7,281
../../include/db.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.4.1.1/include/db.h
C
apache-2.0
18
../../include/mpool.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.4.1.1/include/mpool.h
C
apache-2.0
21
../../include/ndbm.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.4.1.1/include/ndbm.h
C
apache-2.0
20
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)pathnames.h 8.5 (Berkeley) 12/21/93 */ #define _PATH_BSHELL "/bin/sh" #define _PATH_DEVNULL "/dev/null" #define _PATH_EXRC ".exrc" #define _PATH_NEXRC ".nexrc" #define _PATH_PRESERVE "/var/tmp/vi.recover" #define _PATH_SENDMAIL "/usr/lib/sendmail" #define _PATH_SYSEXRC "/etc/vi.exrc" #define _PATH_TAGS "tags /var/db/libc.tags /sys/kern/tags" #define _PATH_TMP "/tmp" #define _PATH_TTY "/dev/tty"
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.4.1.1/include/pathnames.h
C
apache-2.0
2,238
../../include/queue.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.4.1.1/include/queue.h
C
apache-2.0
21
sunos.4.1.1
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.4.1.2
Roff
apache-2.0
11
sunos.4.1.1
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.4.1.3
Roff
apache-2.0
11
# @(#)Makefile 8.9 (Berkeley) 7/14/94 LIBDB= libdb.a OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \ hsearch.o ndbm.o OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \ bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \ bt_utils.o OBJ3= db.o OBJ4= mpool.o OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \ rec_seq.o rec_utils.o MISC= snprintf.o ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} rm -f $@ ar cq $@ \ `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort` ranlib $@ clean: rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} OORG= -O CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude hash.o: ../../hash/hash.c ${CL} -I../../hash ../../hash/hash.c hash_bigkey.o: ../../hash/hash_bigkey.c ${CL} -I../../hash ../../hash/hash_bigkey.c hash_buf.o: ../../hash/hash_buf.c ${CL} -I../../hash ../../hash/hash_buf.c hash_func.o: ../../hash/hash_func.c ${CL} -I../../hash ../../hash/hash_func.c hash_log2.o: ../../hash/hash_log2.c ${CL} -I../../hash ../../hash/hash_log2.c hash_page.o: ../../hash/hash_page.c ${CL} -I../../hash ../../hash/hash_page.c hsearch.o: ../../hash/hsearch.c ${CL} -I../../hash ../../hash/hsearch.c ndbm.o: ../../hash/ndbm.c ${CL} -I../../hash ../../hash/ndbm.c bt_close.o: ../../btree/bt_close.c ${CL} -I../../btree ../../btree/bt_close.c bt_conv.o: ../../btree/bt_conv.c ${CL} -I../../btree ../../btree/bt_conv.c bt_debug.o: ../../btree/bt_debug.c ${CL} -I../../btree ../../btree/bt_debug.c bt_delete.o: ../../btree/bt_delete.c ${CL} -I../../btree ../../btree/bt_delete.c bt_get.o: ../../btree/bt_get.c ${CL} -I../../btree ../../btree/bt_get.c bt_open.o: ../../btree/bt_open.c ${CL} -I../../btree ../../btree/bt_open.c bt_overflow.o: ../../btree/bt_overflow.c ${CL} -I../../btree ../../btree/bt_overflow.c bt_page.o: ../../btree/bt_page.c ${CL} -I../../btree ../../btree/bt_page.c bt_put.o: ../../btree/bt_put.c ${CL} -I../../btree ../../btree/bt_put.c bt_search.o: ../../btree/bt_search.c ${CL} -I../../btree ../../btree/bt_search.c bt_seq.o: ../../btree/bt_seq.c ${CL} -I../../btree ../../btree/bt_seq.c bt_split.o: ../../btree/bt_split.c ${CL} -I../../btree ../../btree/bt_split.c bt_stack.o: ../../btree/bt_stack.c ${CL} -I../../btree ../../btree/bt_stack.c bt_utils.o: ../../btree/bt_utils.c ${CL} -I../../btree ../../btree/bt_utils.c db.o: ../../db/db.c ${CL} ../../db/db.c mpool.o: ../../mpool/mpool.c ${CL} -I../../mpool ../../mpool/mpool.c rec_close.o: ../../recno/rec_close.c ${CL} -I../../recno ../../recno/rec_close.c rec_delete.o: ../../recno/rec_delete.c ${CL} -I../../recno ../../recno/rec_delete.c rec_get.o: ../../recno/rec_get.c ${CL} -I../../recno ../../recno/rec_get.c rec_open.o: ../../recno/rec_open.c ${CL} -I../../recno ../../recno/rec_open.c rec_put.o: ../../recno/rec_put.c ${CL} -I../../recno ../../recno/rec_put.c rec_search.o: ../../recno/rec_search.c ${CL} -I../../recno ../../recno/rec_search.c rec_seq.o: ../../recno/rec_seq.c ${CL} -I../../recno ../../recno/rec_seq.c rec_utils.o: ../../recno/rec_utils.c ${CL} -I../../recno ../../recno/rec_utils.c memmove.o: ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c mktemp.o: ${CC} -c -O -I. -Iinclude clib/mktemp.c snprintf.o: ${CC} -c -O -I. -Iinclude clib/snprintf.c
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.5.2/Makefile
Makefile
apache-2.0
3,365
../../include/cdefs.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.5.2/include/cdefs.h
C
apache-2.0
21
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)compat.h 8.13 (Berkeley) 2/21/94 */ #ifndef _COMPAT_H_ #define _COMPAT_H_ #include <sys/types.h> #define NO_ERRLIST /* * If your system doesn't typedef u_long, u_short, or u_char, change * the 0 to a 1. */ #if 0 typedef unsigned char u_char; /* 4.[34]BSD names. */ typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short u_short; #endif /* If your system doesn't typedef size_t, change the 0 to a 1. */ #if 0 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ #endif /* If your system doesn't typedef ssize_t, change the 0 to a 1. */ #if 0 typedef int ssize_t; /* POSIX names. */ #endif /* * If your system doesn't have the POSIX type for a signal mask, * change the 0 to a 1. */ #if 0 /* POSIX 1003.1 signal mask type. */ typedef unsigned int sigset_t; #endif #define write _write /* * If your system's vsprintf returns a char *, not an int, * change the 0 to a 1. */ #if 0 #define VSPRINTF_CHARSTAR #endif /* * If you don't have POSIX 1003.1 signals, the signal code surrounding the * temporary file creation is intended to block all of the possible signals * long enough to create the file and unlink it. All of this stuff is * intended to use old-style BSD calls to fake POSIX 1003.1 calls. */ #ifdef NO_POSIX_SIGNALS #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) #define SIG_BLOCK 1 #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 static int __sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ ((__sigtemp = \ (((how) == SIG_BLOCK) ? \ sigblock(0) | *(set) : \ (((how) == SIG_UNBLOCK) ? \ sigblock(0) & ~(*(set)) : \ ((how) == SIG_SETMASK ? \ *(set) : sigblock(0))))), \ ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ sigsetmask(__sigtemp)), 0) #endif /* * If your system doesn't have an include file with the appropriate * byte order set, make sure you specify the correct one. */ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define BYTE_ORDER BIG_ENDIAN /* Set for your system. */ #endif #if defined(SYSV) || defined(SYSTEM5) #define index(a, b) strchr(a, b) #define rindex(a, b) strrchr(a, b) #define bzero(a, b) memset(a, 0, b) #define bcmp(a, b, n) memcmp(a, b, n) #define bcopy(a, b, n) memmove(b, a, n) #endif #if defined(BSD) || defined(BSD4_3) #define strchr(a, b) index(a, b) #define strrchr(a, b) rindex(a, b) #define memcmp(a, b, n) bcmp(a, b, n) #define memmove(a, b, n) bcopy(b, a, n) #endif /* * 32-bit machine. The db routines are theoretically independent of * the size of u_shorts and u_longs, but I don't know that anyone has * ever actually tried it. At a minimum, change the following #define's * if you are trying to compile on a different type of system. */ #ifndef USHRT_MAX #define USHRT_MAX 0xFFFF #define ULONG_MAX 0xFFFFFFFF #endif #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ #define _POSIX2_RE_DUP_MAX 255 #endif /* * If you can't provide lock values in the open(2) call. Note, this * allows races to happen. */ #ifndef O_EXLOCK /* 4.4BSD extension. */ #define O_EXLOCK 0 #endif #ifndef O_SHLOCK /* 4.4BSD extension. */ #define O_SHLOCK 0 #endif #ifndef EFTYPE #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ #endif #ifndef WCOREDUMP /* 4.4BSD extension */ #define WCOREDUMP(a) 0 #endif #ifndef STDERR_FILENO #define STDIN_FILENO 0 /* ANSI C #defines */ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif #ifndef SEEK_END #define SEEK_SET 0 /* POSIX 1003.1 seek values */ #define SEEK_CUR 1 #define SEEK_END 2 #endif #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ #define _POSIX_VDISABLE 0 /* Some systems used 0. */ #endif #ifndef TCSASOFT /* 4.4BSD extension. */ #define TCSASOFT 0 #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ #define _POSIX2_RE_DUP_MAX 255 #endif #ifndef NULL /* ANSI C #defines NULL everywhere. */ #define NULL 0 #endif #ifndef MAX /* Usually found in <sys/param.h>. */ #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) #endif #ifndef MIN /* Usually found in <sys/param.h>. */ #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif /* Default file permissions. */ #ifndef DEFFILEMODE /* 4.4BSD extension. */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ #endif /* The type of a va_list. */ #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ #define _BSD_VA_LIST_ char * #endif #endif /* !_COMPAT_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.5.2/include/compat.h
C
apache-2.0
7,324
../../include/db.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.5.2/include/db.h
C
apache-2.0
18
../../include/mpool.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.5.2/include/mpool.h
C
apache-2.0
21
../../include/ndbm.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.5.2/include/ndbm.h
C
apache-2.0
20
../../include/queue.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/sunos.5.2/include/queue.h
C
apache-2.0
21
# @(#)Makefile 8.9 (Berkeley) 7/14/94 LIBDB= libdb.a OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \ hsearch.o ndbm.o OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \ bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \ bt_utils.o OBJ3= db.o OBJ4= mpool.o OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \ rec_seq.o rec_utils.o MISC= mktemp.o snprintf.o ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} rm -f $@ ar cq $@ \ `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort` ranlib $@ clean: rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} OORG= -O CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude hash.o: ../../hash/hash.c ${CL} -I../../hash ../../hash/hash.c hash_bigkey.o: ../../hash/hash_bigkey.c ${CL} -I../../hash ../../hash/hash_bigkey.c hash_buf.o: ../../hash/hash_buf.c ${CL} -I../../hash ../../hash/hash_buf.c hash_func.o: ../../hash/hash_func.c ${CL} -I../../hash ../../hash/hash_func.c hash_log2.o: ../../hash/hash_log2.c ${CL} -I../../hash ../../hash/hash_log2.c hash_page.o: ../../hash/hash_page.c ${CL} -I../../hash ../../hash/hash_page.c hsearch.o: ../../hash/hsearch.c ${CL} -I../../hash ../../hash/hsearch.c ndbm.o: ../../hash/ndbm.c ${CL} -I../../hash ../../hash/ndbm.c bt_close.o: ../../btree/bt_close.c ${CL} -I../../btree ../../btree/bt_close.c bt_conv.o: ../../btree/bt_conv.c ${CL} -I../../btree ../../btree/bt_conv.c bt_debug.o: ../../btree/bt_debug.c ${CL} -I../../btree ../../btree/bt_debug.c bt_delete.o: ../../btree/bt_delete.c ${CL} -I../../btree ../../btree/bt_delete.c bt_get.o: ../../btree/bt_get.c ${CL} -I../../btree ../../btree/bt_get.c bt_open.o: ../../btree/bt_open.c ${CL} -I../../btree ../../btree/bt_open.c bt_overflow.o: ../../btree/bt_overflow.c ${CL} -I../../btree ../../btree/bt_overflow.c bt_page.o: ../../btree/bt_page.c ${CL} -I../../btree ../../btree/bt_page.c bt_put.o: ../../btree/bt_put.c ${CL} -I../../btree ../../btree/bt_put.c bt_search.o: ../../btree/bt_search.c ${CL} -I../../btree ../../btree/bt_search.c bt_seq.o: ../../btree/bt_seq.c ${CL} -I../../btree ../../btree/bt_seq.c bt_split.o: ../../btree/bt_split.c ${CL} -I../../btree ../../btree/bt_split.c bt_stack.o: ../../btree/bt_stack.c ${CL} -I../../btree ../../btree/bt_stack.c bt_utils.o: ../../btree/bt_utils.c ${CL} -I../../btree ../../btree/bt_utils.c db.o: ../../db/db.c ${CL} ../../db/db.c mpool.o: ../../mpool/mpool.c ${CL} -I../../mpool ../../mpool/mpool.c rec_close.o: ../../recno/rec_close.c ${CL} -I../../recno ../../recno/rec_close.c rec_delete.o: ../../recno/rec_delete.c ${CL} -I../../recno ../../recno/rec_delete.c rec_get.o: ../../recno/rec_get.c ${CL} -I../../recno ../../recno/rec_get.c rec_open.o: ../../recno/rec_open.c ${CL} -I../../recno ../../recno/rec_open.c rec_put.o: ../../recno/rec_put.c ${CL} -I../../recno ../../recno/rec_put.c rec_search.o: ../../recno/rec_search.c ${CL} -I../../recno ../../recno/rec_search.c rec_seq.o: ../../recno/rec_seq.c ${CL} -I../../recno ../../recno/rec_seq.c rec_utils.o: ../../recno/rec_utils.c ${CL} -I../../recno ../../recno/rec_utils.c memmove.o: ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c mktemp.o: ${CC} -c -O -I. -Iinclude clib/mktemp.c snprintf.o: ${CC} -c -O -I. -Iinclude clib/snprintf.c
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ultrix.4.2/Makefile
Makefile
apache-2.0
3,374
../../include/cdefs.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ultrix.4.2/include/cdefs.h
C
apache-2.0
21
/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)compat.h 8.13 (Berkeley) 2/21/94 */ #ifndef _COMPAT_H_ #define _COMPAT_H_ #include <sys/types.h> /* * If your system doesn't typedef u_long, u_short, or u_char, change * the 0 to a 1. */ #if 0 typedef unsigned char u_char; /* 4.[34]BSD names. */ typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short u_short; #endif /* If your system doesn't typedef size_t, change the 0 to a 1. */ #if 0 typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ #endif /* If your system doesn't typedef ssize_t, change the 0 to a 1. */ #if 1 typedef int ssize_t; /* POSIX names. */ #endif /* * If your system doesn't have the POSIX type for a signal mask, * change the 0 to a 1. */ #if 0 /* POSIX 1003.1 signal mask type. */ typedef unsigned int sigset_t; #endif /* * If your system's vsprintf returns a char *, not an int, * change the 0 to a 1. */ #if 0 #define VSPRINTF_CHARSTAR #endif /* * If you don't have POSIX 1003.1 signals, the signal code surrounding the * temporary file creation is intended to block all of the possible signals * long enough to create the file and unlink it. All of this stuff is * intended to use old-style BSD calls to fake POSIX 1003.1 calls. */ #ifdef NO_POSIX_SIGNALS #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) #define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) #define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) #define SIG_BLOCK 1 #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 static int __sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ ((__sigtemp = \ (((how) == SIG_BLOCK) ? \ sigblock(0) | *(set) : \ (((how) == SIG_UNBLOCK) ? \ sigblock(0) & ~(*(set)) : \ ((how) == SIG_SETMASK ? \ *(set) : sigblock(0))))), \ ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ sigsetmask(__sigtemp)), 0) #endif /* * If your system doesn't have an include file with the appropriate * byte order set, make sure you specify the correct one. */ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define BYTE_ORDER LITTLE_ENDIAN /* Set for your system. */ #endif #if defined(SYSV) || defined(SYSTEM5) #define index(a, b) strchr(a, b) #define rindex(a, b) strrchr(a, b) #define bzero(a, b) memset(a, 0, b) #define bcmp(a, b, n) memcmp(a, b, n) #define bcopy(a, b, n) memmove(b, a, n) #endif #if defined(BSD) || defined(BSD4_3) #define strchr(a, b) index(a, b) #define strrchr(a, b) rindex(a, b) #define memcmp(a, b, n) bcmp(a, b, n) #define memmove(a, b, n) bcopy(b, a, n) #endif /* * 32-bit machine. The db routines are theoretically independent of * the size of u_shorts and u_longs, but I don't know that anyone has * ever actually tried it. At a minimum, change the following #define's * if you are trying to compile on a different type of system. */ #ifndef USHRT_MAX #define USHRT_MAX 0xFFFF #define ULONG_MAX 0xFFFFFFFF #endif #ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ #define _POSIX2_RE_DUP_MAX 255 #endif /* * If you can't provide lock values in the open(2) call. Note, this * allows races to happen. */ #ifndef O_EXLOCK /* 4.4BSD extension. */ #define O_EXLOCK 0 #endif #ifndef O_SHLOCK /* 4.4BSD extension. */ #define O_SHLOCK 0 #endif #ifndef EFTYPE #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ #endif #ifndef WCOREDUMP /* 4.4BSD extension */ #define WCOREDUMP(a) 0 #endif #ifndef STDERR_FILENO #define STDIN_FILENO 0 /* ANSI C #defines */ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif #ifndef SEEK_END #define SEEK_SET 0 /* POSIX 1003.1 seek values */ #define SEEK_CUR 1 #define SEEK_END 2 #endif #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ #define _POSIX_VDISABLE 0 /* Some systems used 0. */ #endif #ifndef TCSASOFT /* 4.4BSD extension. */ #define TCSASOFT 0 #endif #ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ #define _POSIX2_RE_DUP_MAX 255 #endif #ifndef NULL /* ANSI C #defines NULL everywhere. */ #define NULL 0 #endif #ifndef MAX /* Usually found in <sys/param.h>. */ #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) #endif #ifndef MIN /* Usually found in <sys/param.h>. */ #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif /* Default file permissions. */ #ifndef DEFFILEMODE /* 4.4BSD extension. */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ #endif /* The type of a va_list. */ #ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ #define _BSD_VA_LIST_ char * #endif #endif /* !_COMPAT_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ultrix.4.2/include/compat.h
C
apache-2.0
7,284
/*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)db.h 8.7 (Berkeley) 6/16/94 */ #ifndef _DB_H_ #define _DB_H_ #include <sys/types.h> #include <sys/cdefs.h> #include <limits.h> #ifdef __DBINTERFACE_PRIVATE #include <compat.h> #endif #define RET_ERROR -1 /* Return values. */ #define RET_SUCCESS 0 #define RET_SPECIAL 1 #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ typedef __signed char int8_t; typedef unsigned char u_int8_t; typedef short int16_t; typedef unsigned short u_int16_t; typedef int int32_t; typedef unsigned int u_int32_t; #ifdef WE_DONT_NEED_QUADS typedef long long int64_t; typedef unsigned long long u_int64_t; #endif #endif #define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ typedef u_int32_t pgno_t; #define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ typedef u_int16_t indx_t; #define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ typedef u_int32_t recno_t; /* Key/data structure -- a Data-Base Thang. */ typedef struct { void *data; /* data */ size_t size; /* data length */ } DBT; /* Routine flags. */ #define R_CURSOR 1 /* del, put, seq */ #define __R_UNUSED 2 /* UNUSED */ #define R_FIRST 3 /* seq */ #define R_IAFTER 4 /* put (RECNO) */ #define R_IBEFORE 5 /* put (RECNO) */ #define R_LAST 6 /* seq (BTREE, RECNO) */ #define R_NEXT 7 /* seq */ #define R_NOOVERWRITE 8 /* put */ #define R_PREV 9 /* seq (BTREE, RECNO) */ #define R_SETCURSOR 10 /* put (RECNO) */ #define R_RECNOSYNC 11 /* sync (RECNO) */ typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; /* * !!! * The following flags are included in the dbopen(3) call as part of the * open(2) flags. In order to avoid conflicts with the open flags, start * at the top of the 16 or 32-bit number space and work our way down. If * the open flags were significantly expanded in the future, it could be * a problem. Wish I'd left another flags word in the dbopen call. * * !!! * None of this stuff is implemented yet. The only reason that it's here * is so that the access methods can skip copying the key/data pair when * the DB_LOCK flag isn't set. */ #define DB_LOCK 0x20000000 /* Do locking. */ #define DB_SHMEM 0x40000000 /* Use shared memory. */ #define DB_TXN 0x80000000 /* Do transactions. */ /* Access method description structure. */ typedef struct __db { DBTYPE type; /* Underlying db type. */ int (*close) __P((struct __db *)); int (*del) __P((const struct __db *, const DBT *, u_int)); int (*get) __P((const struct __db *, const DBT *, DBT *, u_int)); int (*put) __P((const struct __db *, DBT *, const DBT *, u_int)); int (*seq) __P((const struct __db *, DBT *, DBT *, u_int)); int (*sync) __P((const struct __db *, u_int)); void *internal; /* Access method private. */ int (*fd) __P((const struct __db *)); } DB; #define BTREEMAGIC 0x053162 #define BTREEVERSION 3 /* Structure used to pass parameters to the btree routines. */ typedef struct { #define R_DUP 0x01 /* duplicate keys */ u_long flags; u_int cachesize; /* bytes to cache */ int maxkeypage; /* maximum keys per page */ int minkeypage; /* minimum keys per page */ u_int psize; /* page size */ int (*compare) /* comparison function */ __P((const DBT *, const DBT *)); size_t (*prefix) /* prefix function */ __P((const DBT *, const DBT *)); int lorder; /* byte order */ } BTREEINFO; #define HASHMAGIC 0x061561 #define HASHVERSION 2 /* Structure used to pass parameters to the hashing routines. */ typedef struct { u_int bsize; /* bucket size */ u_int ffactor; /* fill factor */ u_int nelem; /* number of elements */ u_int cachesize; /* bytes to cache */ u_int32_t /* hash function */ (*hash) __P((const void *, size_t)); int lorder; /* byte order */ } HASHINFO; /* Structure used to pass parameters to the record routines. */ typedef struct { #define R_FIXEDLEN 0x01 /* fixed-length records */ #define R_NOKEY 0x02 /* key not required */ #define R_SNAPSHOT 0x04 /* snapshot the input */ u_long flags; u_int cachesize; /* bytes to cache */ u_int psize; /* page size */ int lorder; /* byte order */ size_t reclen; /* record length (fixed-length records) */ u_char bval; /* delimiting byte (variable-length records */ char *bfname; /* btree file name */ } RECNOINFO; #ifdef __DBINTERFACE_PRIVATE /* * Little endian <==> big endian 32-bit swap macros. * M_32_SWAP swap a memory location * P_32_SWAP swap a referenced memory location * P_32_COPY swap from one location to another */ #define M_32_SWAP(a) { \ u_int32_t _tmp = a; \ ((char *)&a)[0] = ((char *)&_tmp)[3]; \ ((char *)&a)[1] = ((char *)&_tmp)[2]; \ ((char *)&a)[2] = ((char *)&_tmp)[1]; \ ((char *)&a)[3] = ((char *)&_tmp)[0]; \ } #define P_32_SWAP(a) { \ u_int32_t _tmp = *(u_int32_t *)a; \ ((char *)a)[0] = ((char *)&_tmp)[3]; \ ((char *)a)[1] = ((char *)&_tmp)[2]; \ ((char *)a)[2] = ((char *)&_tmp)[1]; \ ((char *)a)[3] = ((char *)&_tmp)[0]; \ } #define P_32_COPY(a, b) { \ ((char *)&(b))[0] = ((char *)&(a))[3]; \ ((char *)&(b))[1] = ((char *)&(a))[2]; \ ((char *)&(b))[2] = ((char *)&(a))[1]; \ ((char *)&(b))[3] = ((char *)&(a))[0]; \ } /* * Little endian <==> big endian 16-bit swap macros. * M_16_SWAP swap a memory location * P_16_SWAP swap a referenced memory location * P_16_COPY swap from one location to another */ #define M_16_SWAP(a) { \ u_int16_t _tmp = a; \ ((char *)&a)[0] = ((char *)&_tmp)[1]; \ ((char *)&a)[1] = ((char *)&_tmp)[0]; \ } #define P_16_SWAP(a) { \ u_int16_t _tmp = *(u_int16_t *)a; \ ((char *)a)[0] = ((char *)&_tmp)[1]; \ ((char *)a)[1] = ((char *)&_tmp)[0]; \ } #define P_16_COPY(a, b) { \ ((char *)&(b))[0] = ((char *)&(a))[1]; \ ((char *)&(b))[1] = ((char *)&(a))[0]; \ } #endif __BEGIN_DECLS DB *dbopen __P((const char *, int, int, DBTYPE, const void *)); #ifdef __DBINTERFACE_PRIVATE DB *__bt_open __P((const char *, int, int, const BTREEINFO *, int)); DB *__hash_open __P((const char *, int, int, const HASHINFO *, int)); DB *__rec_open __P((const char *, int, int, const RECNOINFO *, int)); void __dbpanic __P((DB *dbp)); #endif __END_DECLS #endif /* !_DB_H_ */
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ultrix.4.2/include/db.h
C
apache-2.0
8,031
../../include/mpool.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ultrix.4.2/include/mpool.h
C
apache-2.0
21
../../include/ndbm.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ultrix.4.2/include/ndbm.h
C
apache-2.0
20
../../include/queue.h
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ultrix.4.2/include/queue.h
C
apache-2.0
21
ultrix.4.2
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/PORT/ultrix.4.3
Roff
apache-2.0
10
# @(#)Makefile.inc 8.2 (Berkeley) 7/14/94 .PATH: ${.CURDIR}/db/btree SRCS+= bt_close.c bt_conv.c bt_debug.c bt_delete.c bt_get.c bt_open.c \ bt_overflow.c bt_page.c bt_put.c bt_search.c bt_seq.c bt_split.c \ bt_utils.c
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/btree/Makefile.inc
Makefile
apache-2.0
223
/*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Olson. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)bt_close.c 8.7 (Berkeley) 8/17/94"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <db.h> #include "btree.h" static int bt_meta __P((BTREE *)); /* * BT_CLOSE -- Close a btree. * * Parameters: * dbp: pointer to access method * * Returns: * RET_ERROR, RET_SUCCESS */ int __bt_close(dbp) DB *dbp; { BTREE *t; t = dbp->internal; /* Toss any page pinned across calls. */ if (t->bt_pinned != NULL) { mpool_put(t->bt_mp, t->bt_pinned, 0); t->bt_pinned = NULL; } /* Sync the tree. */ if (__bt_sync(dbp, 0) == RET_ERROR) return (RET_ERROR); /* Close the memory pool. */ if (mpool_close(t->bt_mp) == RET_ERROR) return (RET_ERROR); /* Free random memory. */ if (t->bt_cursor.key.data != NULL) { free(t->bt_cursor.key.data); t->bt_cursor.key.size = 0; t->bt_cursor.key.data = NULL; } if (t->bt_rkey.data) { free(t->bt_rkey.data); t->bt_rkey.size = 0; t->bt_rkey.data = NULL; } if (t->bt_rdata.data) { free(t->bt_rdata.data); t->bt_rdata.size = 0; t->bt_rdata.data = NULL; } free(t); free(dbp); return RET_SUCCESS; } /* * BT_SYNC -- sync the btree to disk. * * Parameters: * dbp: pointer to access method * * Returns: * RET_SUCCESS, RET_ERROR. */ int __bt_sync(dbp, flags) const DB *dbp; u_int flags; { BTREE *t; int status; t = dbp->internal; /* Toss any page pinned across calls. */ if (t->bt_pinned != NULL) { mpool_put(t->bt_mp, t->bt_pinned, 0); t->bt_pinned = NULL; } /* Sync doesn't currently take any flags. */ if (flags != 0) { errno = EINVAL; return (RET_ERROR); } if (F_ISSET(t, B_INMEM | B_RDONLY) || !F_ISSET(t, B_MODIFIED)) return (RET_SUCCESS); if (F_ISSET(t, B_METADIRTY) && bt_meta(t) == RET_ERROR) return (RET_ERROR); if ((status = mpool_sync(t->bt_mp)) == RET_SUCCESS) F_CLR(t, B_MODIFIED); return (status); } /* * BT_META -- write the tree meta data to disk. * * Parameters: * t: tree * * Returns: * RET_ERROR, RET_SUCCESS */ static int bt_meta(t) BTREE *t; { BTMETA m; void *p; if ((p = mpool_get(t->bt_mp, P_META, 0)) == NULL) return (RET_ERROR); /* Fill in metadata. */ m.magic = BTREEMAGIC; m.version = BTREEVERSION; m.psize = t->bt_psize; m.free = t->bt_free; m.nrecs = t->bt_nrecs; m.flags = F_ISSET(t, SAVEMETA); memmove(p, &m, sizeof(BTMETA)); mpool_put(t->bt_mp, p, MPOOL_DIRTY); return (RET_SUCCESS); }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/btree/bt_close.c
C
apache-2.0
4,448
/*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Olson. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)bt_conv.c 8.5 (Berkeley) 8/17/94"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> #include <stdio.h> #include <db.h> #include "btree.h" static void mswap __P((PAGE *)); /* * __BT_BPGIN, __BT_BPGOUT -- * Convert host-specific number layout to/from the host-independent * format stored on disk. * * Parameters: * t: tree * pg: page number * h: page to convert */ void __bt_pgin(t, pg, pp) void *t; pgno_t pg; void *pp; { PAGE *h; indx_t i, top; u_char flags; char *p; if (!F_ISSET(((BTREE *)t), B_NEEDSWAP)) return; if (pg == P_META) { mswap(pp); return; } h = pp; M_32_SWAP(h->pgno); M_32_SWAP(h->prevpg); M_32_SWAP(h->nextpg); M_32_SWAP(h->flags); M_16_SWAP(h->lower); M_16_SWAP(h->upper); top = NEXTINDEX(h); if ((h->flags & P_TYPE) == P_BINTERNAL) for (i = 0; i < top; i++) { M_16_SWAP(h->linp[i]); p = (char *)GETBINTERNAL(h, i); P_32_SWAP(p); p += sizeof(u_int32_t); P_32_SWAP(p); p += sizeof(pgno_t); if (*(u_char *)p & P_BIGKEY) { p += sizeof(u_char); P_32_SWAP(p); p += sizeof(pgno_t); P_32_SWAP(p); } } else if ((h->flags & P_TYPE) == P_BLEAF) for (i = 0; i < top; i++) { M_16_SWAP(h->linp[i]); p = (char *)GETBLEAF(h, i); P_32_SWAP(p); p += sizeof(u_int32_t); P_32_SWAP(p); p += sizeof(u_int32_t); flags = *(u_char *)p; if (flags & (P_BIGKEY | P_BIGDATA)) { p += sizeof(u_char); if (flags & P_BIGKEY) { P_32_SWAP(p); p += sizeof(pgno_t); P_32_SWAP(p); } if (flags & P_BIGDATA) { p += sizeof(u_int32_t); P_32_SWAP(p); p += sizeof(pgno_t); P_32_SWAP(p); } } } } void __bt_pgout(t, pg, pp) void *t; pgno_t pg; void *pp; { PAGE *h; indx_t i, top; u_char flags; char *p; if (!F_ISSET(((BTREE *)t), B_NEEDSWAP)) return; if (pg == P_META) { mswap(pp); return; } h = pp; top = NEXTINDEX(h); if ((h->flags & P_TYPE) == P_BINTERNAL) for (i = 0; i < top; i++) { p = (char *)GETBINTERNAL(h, i); P_32_SWAP(p); p += sizeof(u_int32_t); P_32_SWAP(p); p += sizeof(pgno_t); if (*(u_char *)p & P_BIGKEY) { p += sizeof(u_char); P_32_SWAP(p); p += sizeof(pgno_t); P_32_SWAP(p); } M_16_SWAP(h->linp[i]); } else if ((h->flags & P_TYPE) == P_BLEAF) for (i = 0; i < top; i++) { p = (char *)GETBLEAF(h, i); P_32_SWAP(p); p += sizeof(u_int32_t); P_32_SWAP(p); p += sizeof(u_int32_t); flags = *(u_char *)p; if (flags & (P_BIGKEY | P_BIGDATA)) { p += sizeof(u_char); if (flags & P_BIGKEY) { P_32_SWAP(p); p += sizeof(pgno_t); P_32_SWAP(p); } if (flags & P_BIGDATA) { p += sizeof(u_int32_t); P_32_SWAP(p); p += sizeof(pgno_t); P_32_SWAP(p); } } M_16_SWAP(h->linp[i]); } M_32_SWAP(h->pgno); M_32_SWAP(h->prevpg); M_32_SWAP(h->nextpg); M_32_SWAP(h->flags); M_16_SWAP(h->lower); M_16_SWAP(h->upper); } /* * MSWAP -- Actually swap the bytes on the meta page. * * Parameters: * p: page to convert */ static void mswap(pg) PAGE *pg; { char *p; p = (char *)pg; P_32_SWAP(p); /* magic */ p += sizeof(u_int32_t); P_32_SWAP(p); /* version */ p += sizeof(u_int32_t); P_32_SWAP(p); /* psize */ p += sizeof(u_int32_t); P_32_SWAP(p); /* free */ p += sizeof(u_int32_t); P_32_SWAP(p); /* nrecs */ p += sizeof(u_int32_t); P_32_SWAP(p); /* flags */ p += sizeof(u_int32_t); }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/btree/bt_conv.c
C
apache-2.0
5,400
/*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Olson. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)bt_debug.c 8.5 (Berkeley) 8/17/94"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <db.h> #include "btree.h" #ifdef DEBUG /* * BT_DUMP -- Dump the tree * * Parameters: * dbp: pointer to the DB */ void __bt_dump(dbp) DB *dbp; { BTREE *t; PAGE *h; pgno_t i; char *sep; t = dbp->internal; (void)fprintf(stderr, "%s: pgsz %d", F_ISSET(t, B_INMEM) ? "memory" : "disk", t->bt_psize); if (F_ISSET(t, R_RECNO)) (void)fprintf(stderr, " keys %lu", t->bt_nrecs); #undef X #define X(flag, name) \ if (F_ISSET(t, flag)) { \ (void)fprintf(stderr, "%s%s", sep, name); \ sep = ", "; \ } if (t->flags != 0) { sep = " flags ("; X(R_FIXLEN, "FIXLEN"); X(B_INMEM, "INMEM"); X(B_NODUPS, "NODUPS"); X(B_RDONLY, "RDONLY"); X(R_RECNO, "RECNO"); X(B_METADIRTY,"METADIRTY"); (void)fprintf(stderr, ")\n"); } #undef X for (i = P_ROOT; (h = mpool_get(t->bt_mp, i, 0)) != NULL; ++i) { __bt_dpage(h); (void)mpool_put(t->bt_mp, h, 0); } } /* * BT_DMPAGE -- Dump the meta page * * Parameters: * h: pointer to the PAGE */ void __bt_dmpage(h) PAGE *h; { BTMETA *m; char *sep; m = (BTMETA *)h; (void)fprintf(stderr, "magic %lx\n", m->magic); (void)fprintf(stderr, "version %lu\n", m->version); (void)fprintf(stderr, "psize %lu\n", m->psize); (void)fprintf(stderr, "free %lu\n", m->free); (void)fprintf(stderr, "nrecs %lu\n", m->nrecs); (void)fprintf(stderr, "flags %lu", m->flags); #undef X #define X(flag, name) \ if (m->flags & flag) { \ (void)fprintf(stderr, "%s%s", sep, name); \ sep = ", "; \ } if (m->flags) { sep = " ("; X(B_NODUPS, "NODUPS"); X(R_RECNO, "RECNO"); (void)fprintf(stderr, ")"); } } /* * BT_DNPAGE -- Dump the page * * Parameters: * n: page number to dump. */ void __bt_dnpage(dbp, pgno) DB *dbp; pgno_t pgno; { BTREE *t; PAGE *h; t = dbp->internal; if ((h = mpool_get(t->bt_mp, pgno, 0)) != NULL) { __bt_dpage(h); (void)mpool_put(t->bt_mp, h, 0); } } /* * BT_DPAGE -- Dump the page * * Parameters: * h: pointer to the PAGE */ void __bt_dpage(h) PAGE *h; { BINTERNAL *bi; BLEAF *bl; RINTERNAL *ri; RLEAF *rl; indx_t cur, top; char *sep; (void)fprintf(stderr, " page %d: (", h->pgno); #undef X #define X(flag, name) \ if (h->flags & flag) { \ (void)fprintf(stderr, "%s%s", sep, name); \ sep = ", "; \ } sep = ""; X(P_BINTERNAL, "BINTERNAL") /* types */ X(P_BLEAF, "BLEAF") X(P_RINTERNAL, "RINTERNAL") /* types */ X(P_RLEAF, "RLEAF") X(P_OVERFLOW, "OVERFLOW") X(P_PRESERVE, "PRESERVE"); (void)fprintf(stderr, ")\n"); #undef X (void)fprintf(stderr, "\tprev %2d next %2d", h->prevpg, h->nextpg); if (h->flags & P_OVERFLOW) return; top = NEXTINDEX(h); (void)fprintf(stderr, " lower %3d upper %3d nextind %d\n", h->lower, h->upper, top); for (cur = 0; cur < top; cur++) { (void)fprintf(stderr, "\t[%03d] %4d ", cur, h->linp[cur]); switch (h->flags & P_TYPE) { case P_BINTERNAL: bi = GETBINTERNAL(h, cur); (void)fprintf(stderr, "size %03d pgno %03d", bi->ksize, bi->pgno); if (bi->flags & P_BIGKEY) (void)fprintf(stderr, " (indirect)"); else if (bi->ksize) (void)fprintf(stderr, " {%.*s}", (int)bi->ksize, bi->bytes); break; case P_RINTERNAL: ri = GETRINTERNAL(h, cur); (void)fprintf(stderr, "entries %03d pgno %03d", ri->nrecs, ri->pgno); break; case P_BLEAF: bl = GETBLEAF(h, cur); if (bl->flags & P_BIGKEY) (void)fprintf(stderr, "big key page %lu size %u/", *(pgno_t *)bl->bytes, *(u_int32_t *)(bl->bytes + sizeof(pgno_t))); else if (bl->ksize) (void)fprintf(stderr, "%s/", bl->bytes); if (bl->flags & P_BIGDATA) (void)fprintf(stderr, "big data page %lu size %u", *(pgno_t *)(bl->bytes + bl->ksize), *(u_int32_t *)(bl->bytes + bl->ksize + sizeof(pgno_t))); else if (bl->dsize) (void)fprintf(stderr, "%.*s", (int)bl->dsize, bl->bytes + bl->ksize); break; case P_RLEAF: rl = GETRLEAF(h, cur); if (rl->flags & P_BIGDATA) (void)fprintf(stderr, "big data page %lu size %u", *(pgno_t *)rl->bytes, *(u_int32_t *)(rl->bytes + sizeof(pgno_t))); else if (rl->dsize) (void)fprintf(stderr, "%.*s", (int)rl->dsize, rl->bytes); break; } (void)fprintf(stderr, "\n"); } } #endif #ifdef STATISTICS /* * BT_STAT -- Gather/print the tree statistics * * Parameters: * dbp: pointer to the DB */ void __bt_stat(dbp) DB *dbp; { extern u_long bt_cache_hit, bt_cache_miss, bt_pfxsaved, bt_rootsplit; extern u_long bt_sortsplit, bt_split; BTREE *t; PAGE *h; pgno_t i, pcont, pinternal, pleaf; u_long ifree, lfree, nkeys; int levels; t = dbp->internal; pcont = pinternal = pleaf = 0; nkeys = ifree = lfree = 0; for (i = P_ROOT; (h = mpool_get(t->bt_mp, i, 0)) != NULL; ++i) { switch (h->flags & P_TYPE) { case P_BINTERNAL: case P_RINTERNAL: ++pinternal; ifree += h->upper - h->lower; break; case P_BLEAF: case P_RLEAF: ++pleaf; lfree += h->upper - h->lower; nkeys += NEXTINDEX(h); break; case P_OVERFLOW: ++pcont; break; } (void)mpool_put(t->bt_mp, h, 0); } /* Count the levels of the tree. */ for (i = P_ROOT, levels = 0 ;; ++levels) { h = mpool_get(t->bt_mp, i, 0); if (h->flags & (P_BLEAF|P_RLEAF)) { if (levels == 0) levels = 1; (void)mpool_put(t->bt_mp, h, 0); break; } i = F_ISSET(t, R_RECNO) ? GETRINTERNAL(h, 0)->pgno : GETBINTERNAL(h, 0)->pgno; (void)mpool_put(t->bt_mp, h, 0); } (void)fprintf(stderr, "%d level%s with %ld keys", levels, levels == 1 ? "" : "s", nkeys); if (F_ISSET(t, R_RECNO)) (void)fprintf(stderr, " (%ld header count)", t->bt_nrecs); (void)fprintf(stderr, "\n%lu pages (leaf %ld, internal %ld, overflow %ld)\n", pinternal + pleaf + pcont, pleaf, pinternal, pcont); (void)fprintf(stderr, "%ld cache hits, %ld cache misses\n", bt_cache_hit, bt_cache_miss); (void)fprintf(stderr, "%ld splits (%ld root splits, %ld sort splits)\n", bt_split, bt_rootsplit, bt_sortsplit); pleaf *= t->bt_psize - BTDATAOFF; if (pleaf) (void)fprintf(stderr, "%.0f%% leaf fill (%ld bytes used, %ld bytes free)\n", ((double)(pleaf - lfree) / pleaf) * 100, pleaf - lfree, lfree); pinternal *= t->bt_psize - BTDATAOFF; if (pinternal) (void)fprintf(stderr, "%.0f%% internal fill (%ld bytes used, %ld bytes free\n", ((double)(pinternal - ifree) / pinternal) * 100, pinternal - ifree, ifree); if (bt_pfxsaved) (void)fprintf(stderr, "prefix checking removed %lu bytes.\n", bt_pfxsaved); } #endif
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/btree/bt_debug.c
C
apache-2.0
8,679
/*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Olson. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)bt_delete.c 8.13 (Berkeley) 7/28/94"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> #include <errno.h> #include <stdio.h> #include <string.h> #include <db.h> #include "btree.h" static int __bt_bdelete __P((BTREE *, const DBT *)); static int __bt_curdel __P((BTREE *, const DBT *, PAGE *, u_int)); static int __bt_pdelete __P((BTREE *, PAGE *)); static int __bt_relink __P((BTREE *, PAGE *)); static int __bt_stkacq __P((BTREE *, PAGE **, CURSOR *)); /* * __bt_delete * Delete the item(s) referenced by a key. * * Return RET_SPECIAL if the key is not found. */ int __bt_delete(dbp, key, flags) const DB *dbp; const DBT *key; u_int flags; { BTREE *t; CURSOR *c; PAGE *h; int status; t = dbp->internal; /* Toss any page pinned across calls. */ if (t->bt_pinned != NULL) { mpool_put(t->bt_mp, t->bt_pinned, 0); t->bt_pinned = NULL; } /* Check for change to a read-only tree. */ if (F_ISSET(t, B_RDONLY)) { errno = EPERM; return (RET_ERROR); } switch (flags) { case 0: status = __bt_bdelete(t, key); break; case R_CURSOR: /* * If flags is R_CURSOR, delete the cursor. Must already * have started a scan and not have already deleted it. */ c = &t->bt_cursor; if (F_ISSET(c, CURS_INIT)) { if (F_ISSET(c, CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE)) return (RET_SPECIAL); if ((h = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL) return (RET_ERROR); /* * If the page is about to be emptied, we'll need to * delete it, which means we have to acquire a stack. */ if (NEXTINDEX(h) == 1) if (__bt_stkacq(t, &h, &t->bt_cursor)) return (RET_ERROR); status = __bt_dleaf(t, NULL, h, c->pg.index); if (NEXTINDEX(h) == 0 && status == RET_SUCCESS) { if (__bt_pdelete(t, h)) return (RET_ERROR); } else mpool_put(t->bt_mp, h, status == RET_SUCCESS ? MPOOL_DIRTY : 0); break; } /* FALLTHROUGH */ default: errno = EINVAL; return (RET_ERROR); } if (status == RET_SUCCESS) F_SET(t, B_MODIFIED); return (status); } /* * __bt_stkacq -- * Acquire a stack so we can delete a cursor entry. * * Parameters: * t: tree * hp: pointer to current, pinned PAGE pointer * c: pointer to the cursor * * Returns: * 0 on success, 1 on failure */ static int __bt_stkacq(t, hp, c) BTREE *t; PAGE **hp; CURSOR *c; { BINTERNAL *bi; EPG *e; EPGNO *parent; PAGE *h; indx_t index = 0; pgno_t pgno; recno_t nextpg, prevpg; int exact, level; /* * Find the first occurrence of the key in the tree. Toss the * currently locked page so we don't hit an already-locked page. */ h = *hp; mpool_put(t->bt_mp, h, 0); if ((e = __bt_search(t, &c->key, &exact)) == NULL) return (1); h = e->page; /* See if we got it in one shot. */ if (h->pgno == c->pg.pgno) goto ret; /* * Move right, looking for the page. At each move we have to move * up the stack until we don't have to move to the next page. If * we have to change pages at an internal level, we have to fix the * stack back up. */ while (h->pgno != c->pg.pgno) { if ((nextpg = h->nextpg) == P_INVALID) break; mpool_put(t->bt_mp, h, 0); /* Move up the stack. */ for (level = 0; (parent = BT_POP(t)) != NULL; ++level) { /* Get the parent page. */ if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) return (1); /* Move to the next index. */ if (parent->index != NEXTINDEX(h) - 1) { index = parent->index + 1; BT_PUSH(t, h->pgno, index); break; } mpool_put(t->bt_mp, h, 0); } /* Restore the stack. */ while (level--) { /* Push the next level down onto the stack. */ bi = GETBINTERNAL(h, index); pgno = bi->pgno; BT_PUSH(t, pgno, 0); /* Lose the currently pinned page. */ mpool_put(t->bt_mp, h, 0); /* Get the next level down. */ if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL) return (1); index = 0; } mpool_put(t->bt_mp, h, 0); if ((h = mpool_get(t->bt_mp, nextpg, 0)) == NULL) return (1); } if (h->pgno == c->pg.pgno) goto ret; /* Reacquire the original stack. */ mpool_put(t->bt_mp, h, 0); if ((e = __bt_search(t, &c->key, &exact)) == NULL) return (1); h = e->page; /* * Move left, looking for the page. At each move we have to move * up the stack until we don't have to change pages to move to the * next page. If we have to change pages at an internal level, we * have to fix the stack back up. */ while (h->pgno != c->pg.pgno) { if ((prevpg = h->prevpg) == P_INVALID) break; mpool_put(t->bt_mp, h, 0); /* Move up the stack. */ for (level = 0; (parent = BT_POP(t)) != NULL; ++level) { /* Get the parent page. */ if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) return (1); /* Move to the next index. */ if (parent->index != 0) { index = parent->index - 1; BT_PUSH(t, h->pgno, index); break; } mpool_put(t->bt_mp, h, 0); } /* Restore the stack. */ while (level--) { /* Push the next level down onto the stack. */ bi = GETBINTERNAL(h, index); pgno = bi->pgno; /* Lose the currently pinned page. */ mpool_put(t->bt_mp, h, 0); /* Get the next level down. */ if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL) return (1); index = NEXTINDEX(h) - 1; BT_PUSH(t, pgno, index); } mpool_put(t->bt_mp, h, 0); if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL) return (1); } ret: mpool_put(t->bt_mp, h, 0); return ((*hp = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL); } /* * __bt_bdelete -- * Delete all key/data pairs matching the specified key. * * Parameters: * t: tree * key: key to delete * * Returns: * RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found. */ static int __bt_bdelete(t, key) BTREE *t; const DBT *key; { EPG *e; PAGE *h; int deleted, exact, redo; deleted = 0; /* Find any matching record; __bt_search pins the page. */ loop: if ((e = __bt_search(t, key, &exact)) == NULL) return (deleted ? RET_SUCCESS : RET_ERROR); if (!exact) { mpool_put(t->bt_mp, e->page, 0); return (deleted ? RET_SUCCESS : RET_SPECIAL); } /* * Delete forward, then delete backward, from the found key. If * there are duplicates and we reach either side of the page, do * the key search again, so that we get them all. */ redo = 0; h = e->page; do { if (__bt_dleaf(t, key, h, e->index)) { mpool_put(t->bt_mp, h, 0); return (RET_ERROR); } if (F_ISSET(t, B_NODUPS)) { if (NEXTINDEX(h) == 0) { if (__bt_pdelete(t, h)) return (RET_ERROR); } else mpool_put(t->bt_mp, h, MPOOL_DIRTY); return (RET_SUCCESS); } deleted = 1; } while (e->index < NEXTINDEX(h) && __bt_cmp(t, key, e) == 0); /* Check for right-hand edge of the page. */ if (e->index == NEXTINDEX(h)) redo = 1; /* Delete from the key to the beginning of the page. */ while (e->index-- > 0) { if (__bt_cmp(t, key, e) != 0) break; if (__bt_dleaf(t, key, h, e->index) == RET_ERROR) { mpool_put(t->bt_mp, h, 0); return (RET_ERROR); } if (e->index == 0) redo = 1; } /* Check for an empty page. */ if (NEXTINDEX(h) == 0) { if (__bt_pdelete(t, h)) return (RET_ERROR); goto loop; } /* Put the page. */ mpool_put(t->bt_mp, h, MPOOL_DIRTY); if (redo) goto loop; return (RET_SUCCESS); } /* * __bt_pdelete -- * Delete a single page from the tree. * * Parameters: * t: tree * h: leaf page * * Returns: * RET_SUCCESS, RET_ERROR. * * Side-effects: * mpool_put's the page */ static int __bt_pdelete(t, h) BTREE *t; PAGE *h; { BINTERNAL *bi; PAGE *pg; EPGNO *parent; indx_t cnt, index, *ip, offset; u_int32_t nksize; char *from; /* * Walk the parent page stack -- a LIFO stack of the pages that were * traversed when we searched for the page where the delete occurred. * Each stack entry is a page number and a page index offset. The * offset is for the page traversed on the search. We've just deleted * a page, so we have to delete the key from the parent page. * * If the delete from the parent page makes it empty, this process may * continue all the way up the tree. We stop if we reach the root page * (which is never deleted, it's just not worth the effort) or if the * delete does not empty the page. */ while ((parent = BT_POP(t)) != NULL) { /* Get the parent page. */ if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) return (RET_ERROR); index = parent->index; bi = GETBINTERNAL(pg, index); /* Free any overflow pages. */ if (bi->flags & P_BIGKEY && __ovfl_delete(t, bi->bytes) == RET_ERROR) { mpool_put(t->bt_mp, pg, 0); return (RET_ERROR); } /* * Free the parent if it has only the one key and it's not the * root page. If it's the rootpage, turn it back into an empty * leaf page. */ if (NEXTINDEX(pg) == 1) if (pg->pgno == P_ROOT) { pg->lower = BTDATAOFF; pg->upper = t->bt_psize; pg->flags = P_BLEAF; } else { if (__bt_relink(t, pg) || __bt_free(t, pg)) return (RET_ERROR); continue; } else { /* Pack remaining key items at the end of the page. */ nksize = NBINTERNAL(bi->ksize); from = (char *)pg + pg->upper; memmove(from + nksize, from, (char *)bi - from); pg->upper += nksize; /* Adjust indices' offsets, shift the indices down. */ offset = pg->linp[index]; for (cnt = index, ip = &pg->linp[0]; cnt--; ++ip) if (ip[0] < offset) ip[0] += nksize; for (cnt = NEXTINDEX(pg) - index; --cnt; ++ip) ip[0] = ip[1] < offset ? ip[1] + nksize : ip[1]; pg->lower -= sizeof(indx_t); } mpool_put(t->bt_mp, pg, MPOOL_DIRTY); break; } /* Free the leaf page, as long as it wasn't the root. */ if (h->pgno == P_ROOT) { mpool_put(t->bt_mp, h, MPOOL_DIRTY); return (RET_SUCCESS); } return (__bt_relink(t, h) || __bt_free(t, h)); } /* * __bt_dleaf -- * Delete a single record from a leaf page. * * Parameters: * t: tree * key: referenced key * h: page * index: index on page to delete * * Returns: * RET_SUCCESS, RET_ERROR. */ int __bt_dleaf(t, key, h, index) BTREE *t; const DBT *key; PAGE *h; u_int index; { BLEAF *bl; indx_t cnt, *ip, offset; u_int32_t nbytes; void *to; char *from; /* If this record is referenced by the cursor, delete the cursor. */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == index && __bt_curdel(t, key, h, index)) return (RET_ERROR); /* If the entry uses overflow pages, make them available for reuse. */ to = bl = GETBLEAF(h, index); if (bl->flags & P_BIGKEY && __ovfl_delete(t, bl->bytes) == RET_ERROR) return (RET_ERROR); if (bl->flags & P_BIGDATA && __ovfl_delete(t, bl->bytes + bl->ksize) == RET_ERROR) return (RET_ERROR); /* Pack the remaining key/data items at the end of the page. */ nbytes = NBLEAF(bl); from = (char *)h + h->upper; memmove(from + nbytes, from, (char *)to - from); h->upper += nbytes; /* Adjust the indices' offsets, shift the indices down. */ offset = h->linp[index]; for (cnt = index, ip = &h->linp[0]; cnt--; ++ip) if (ip[0] < offset) ip[0] += nbytes; for (cnt = NEXTINDEX(h) - index; --cnt; ++ip) ip[0] = ip[1] < offset ? ip[1] + nbytes : ip[1]; h->lower -= sizeof(indx_t); /* If the cursor is on this page, adjust it as necessary. */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > index) --t->bt_cursor.pg.index; return (RET_SUCCESS); } /* * __bt_curdel -- * Delete the cursor. * * Parameters: * t: tree * key: referenced key (or NULL) * h: page * index: index on page to delete * * Returns: * RET_SUCCESS, RET_ERROR. */ static int __bt_curdel(t, key, h, index) BTREE *t; const DBT *key; PAGE *h; u_int index; { CURSOR *c; EPG e; PAGE *pg; int curcopy, status; /* * If there are duplicates, move forward or backward to one. * Otherwise, copy the key into the cursor area. */ c = &t->bt_cursor; F_CLR(c, CURS_AFTER | CURS_BEFORE | CURS_ACQUIRE); curcopy = 0; if (!F_ISSET(t, B_NODUPS)) { /* * We're going to have to do comparisons. If we weren't * provided a copy of the key, i.e. the user is deleting * the current cursor position, get one. */ if (key == NULL) { e.page = h; e.index = index; if ((status = __bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) != RET_SUCCESS) return (status); curcopy = 1; key = &c->key; } /* Check previous key, if not at the beginning of the page. */ if (index > 0) { e.page = h; e.index = index - 1; if (__bt_cmp(t, key, &e) == 0) { F_SET(c, CURS_BEFORE); goto dup2; } } /* Check next key, if not at the end of the page. */ if (index < NEXTINDEX(h) - 1) { e.page = h; e.index = index + 1; if (__bt_cmp(t, key, &e) == 0) { F_SET(c, CURS_AFTER); goto dup2; } } /* Check previous key if at the beginning of the page. */ if (index == 0 && h->prevpg != P_INVALID) { if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL) return (RET_ERROR); e.page = pg; e.index = NEXTINDEX(pg) - 1; if (__bt_cmp(t, key, &e) == 0) { F_SET(c, CURS_BEFORE); goto dup1; } mpool_put(t->bt_mp, pg, 0); } /* Check next key if at the end of the page. */ if (index == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) { if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL) return (RET_ERROR); e.page = pg; e.index = 0; if (__bt_cmp(t, key, &e) == 0) { F_SET(c, CURS_AFTER); dup1: mpool_put(t->bt_mp, pg, 0); dup2: c->pg.pgno = e.page->pgno; c->pg.index = e.index; return (RET_SUCCESS); } mpool_put(t->bt_mp, pg, 0); } } e.page = h; e.index = index; if (curcopy || (status = __bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) == RET_SUCCESS) { F_SET(c, CURS_ACQUIRE); return (RET_SUCCESS); } return (status); } /* * __bt_relink -- * Link around a deleted page. * * Parameters: * t: tree * h: page to be deleted */ static int __bt_relink(t, h) BTREE *t; PAGE *h; { PAGE *pg; if (h->nextpg != P_INVALID) { if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL) return (RET_ERROR); pg->prevpg = h->prevpg; mpool_put(t->bt_mp, pg, MPOOL_DIRTY); } if (h->prevpg != P_INVALID) { if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL) return (RET_ERROR); pg->nextpg = h->nextpg; mpool_put(t->bt_mp, pg, MPOOL_DIRTY); } return (0); }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/btree/bt_delete.c
C
apache-2.0
16,525
/*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Olson. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)bt_get.c 8.6 (Berkeley) 7/20/94"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> #include <errno.h> #include <stddef.h> #include <stdio.h> #include <db.h> #include "btree.h" /* * __BT_GET -- Get a record from the btree. * * Parameters: * dbp: pointer to access method * key: key to find * data: data to return * flag: currently unused * * Returns: * RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found. */ int __bt_get(dbp, key, data, flags) const DB *dbp; const DBT *key; DBT *data; u_int flags; { BTREE *t; EPG *e; int exact, status; t = dbp->internal; /* Toss any page pinned across calls. */ if (t->bt_pinned != NULL) { mpool_put(t->bt_mp, t->bt_pinned, 0); t->bt_pinned = NULL; } /* Get currently doesn't take any flags. */ if (flags) { errno = EINVAL; return (RET_ERROR); } if ((e = __bt_search(t, key, &exact)) == NULL) return (RET_ERROR); if (!exact) { mpool_put(t->bt_mp, e->page, 0); return (RET_SPECIAL); } status = __bt_ret(t, e, NULL, NULL, data, &t->bt_rdata, 0); /* * If the user is doing concurrent access, we copied the * key/data, toss the page. */ if (F_ISSET(t, B_DB_LOCK)) mpool_put(t->bt_mp, e->page, 0); else t->bt_pinned = e->page; return (status); }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/btree/bt_get.c
C
apache-2.0
3,253
/*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Olson. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)bt_open.c 8.10 (Berkeley) 8/17/94"; #endif /* LIBC_SCCS and not lint */ /* * Implementation of btree access method for 4.4BSD. * * The design here was originally based on that of the btree access method * used in the Postgres database system at UC Berkeley. This implementation * is wholly independent of the Postgres code. */ #include <sys/param.h> #include <errno.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <db.h> #include "btree.h" #ifdef DEBUG #undef MINPSIZE #define MINPSIZE 128 #endif static int byteorder __P((void)); static int nroot __P((BTREE *)); #ifdef BTREE_POSIX /* Default vmethods and vtable to work with POSIX fd's. */ static ssize_t bt_read(void *fd, void *buf, size_t size) { //printf("read: %p(%lx)\n", buf, size); return read((int)(uintptr_t)fd, buf, size); } static ssize_t bt_write(void *fd, const void *buf, size_t size) { //printf("write: %p(%lx)\n", buf, size); return write((int)(uintptr_t)fd, buf, size); } static off_t bt_lseek(void *fd, off_t offset, int whence) { //printf("lseek: %lx(%d)\n", offset, whence); return lseek((int)(uintptr_t)fd, offset, whence); } static int bt_fsync(void *fd) { return fsync((int)(uintptr_t)fd); } static FILEVTABLE bt_fd_fvtable = { bt_read, bt_write, bt_lseek, bt_fsync }; #endif /* * __BT_OPEN -- Open a btree. * * Creates and fills a DB struct, and calls the routine that actually * opens the btree. * * Parameters: * fname: filename (NULL for in-memory trees) * b: BTREEINFO pointer * * Returns: * NULL on failure, pointer to DB on success. * */ DB * __bt_open(file, vtable, openinfo, dflags) virt_fd_t file; const FILEVTABLE *vtable; int dflags; const BTREEINFO *openinfo; { BTMETA m; BTREE *t; BTREEINFO b; DB *dbp; pgno_t ncache; ssize_t nr; int machine_lorder; t = NULL; #ifdef BTREE_POSIX if (vtable == NULL) vtable = &bt_fd_fvtable; #endif /* * Intention is to make sure all of the user's selections are okay * here and then use them without checking. Can't be complete, since * we don't know the right page size, lorder or flags until the backing * file is opened. Also, the file's page size can cause the cachesize * to change. */ machine_lorder = byteorder(); if (openinfo) { b = *openinfo; /* Flags: R_DUP. */ if (b.flags & ~(R_DUP)) goto einval; /* * Page size must be indx_t aligned and >= MINPSIZE. Default * page size is set farther on, based on the underlying file * transfer size. */ if (b.psize && (b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 || b.psize & (sizeof(indx_t) - 1))) goto einval; /* Minimum number of keys per page; absolute minimum is 2. */ if (b.minkeypage) { if (b.minkeypage < 2) goto einval; } else b.minkeypage = DEFMINKEYPAGE; /* If no comparison, use default comparison and prefix. */ if (b.compare == NULL) { b.compare = __bt_defcmp; if (b.prefix == NULL) b.prefix = __bt_defpfx; } if (b.lorder == 0) b.lorder = machine_lorder; } else { b.compare = __bt_defcmp; b.cachesize = 0; b.flags = 0; b.lorder = machine_lorder; b.minkeypage = DEFMINKEYPAGE; b.prefix = __bt_defpfx; b.psize = 0; } /* Check for the ubiquitous PDP-11. */ if (b.lorder != BIG_ENDIAN && b.lorder != LITTLE_ENDIAN) goto einval; /* Allocate and initialize DB and BTREE structures. */ if ((t = (BTREE *)malloc(sizeof(BTREE))) == NULL) goto err; memset(t, 0, sizeof(BTREE)); t->bt_fd = file; t->bt_lorder = b.lorder; t->bt_order = NOT; t->bt_cmp = b.compare; t->bt_pfx = b.prefix; t->bt_rfd = -1; if ((t->bt_dbp = dbp = (DB *)malloc(sizeof(DB))) == NULL) goto err; memset(t->bt_dbp, 0, sizeof(DB)); if (t->bt_lorder != machine_lorder) F_SET(t, B_NEEDSWAP); dbp->type = DB_BTREE; dbp->internal = t; dbp->close = __bt_close; dbp->del = __bt_delete; dbp->fd = __bt_fd; dbp->get = __bt_get; dbp->put = __bt_put; dbp->seq = __bt_seq; dbp->sync = __bt_sync; if ((nr = vtable->read(t->bt_fd, &m, sizeof(BTMETA))) < 0) goto err; if (nr != 0) { if (nr != sizeof(BTMETA)) goto eftype; /* * Read in the meta-data. This can change the notion of what * the lorder, page size and flags are, and, when the page size * changes, the cachesize value can change too. If the user * specified the wrong byte order for an existing database, we * don't bother to return an error, we just clear the NEEDSWAP * bit. */ if (m.magic == BTREEMAGIC) F_CLR(t, B_NEEDSWAP); else { F_SET(t, B_NEEDSWAP); M_32_SWAP(m.magic); M_32_SWAP(m.version); M_32_SWAP(m.psize); M_32_SWAP(m.free); M_32_SWAP(m.nrecs); M_32_SWAP(m.flags); } if (m.magic != BTREEMAGIC || m.version != BTREEVERSION) goto eftype; if (m.psize < MINPSIZE || m.psize > MAX_PAGE_OFFSET + 1 || m.psize & (sizeof(indx_t) - 1)) goto eftype; if (m.flags & ~SAVEMETA) goto eftype; b.psize = m.psize; F_SET(t, m.flags); t->bt_free = m.free; t->bt_nrecs = m.nrecs; } else { /* * Set the page size to the best value for I/O to this file. * Don't overflow the page offset type. */ if (b.psize == 0) { b.psize = DEFPSIZE; } /* Set flag if duplicates permitted. */ if (!(b.flags & R_DUP)) F_SET(t, B_NODUPS); t->bt_free = P_INVALID; t->bt_nrecs = 0; F_SET(t, B_METADIRTY); } t->bt_psize = b.psize; /* Set the cache size; must be a multiple of the page size. */ if (b.cachesize && b.cachesize & (b.psize - 1)) b.cachesize += (~b.cachesize & (b.psize - 1)) + 1; if (b.cachesize < b.psize * MINCACHE) b.cachesize = b.psize * MINCACHE; /* Calculate number of pages to cache. */ ncache = (b.cachesize + t->bt_psize - 1) / t->bt_psize; /* * The btree data structure requires that at least two keys can fit on * a page, but other than that there's no fixed requirement. The user * specified a minimum number per page, and we translated that into the * number of bytes a key/data pair can use before being placed on an * overflow page. This calculation includes the page header, the size * of the index referencing the leaf item and the size of the leaf item * structure. Also, don't let the user specify a minkeypage such that * a key/data pair won't fit even if both key and data are on overflow * pages. */ t->bt_ovflsize = (t->bt_psize - BTDATAOFF) / b.minkeypage - (sizeof(indx_t) + NBLEAFDBT(0, 0)); if (t->bt_ovflsize < NBLEAFDBT(NOVFLSIZE, NOVFLSIZE) + sizeof(indx_t)) t->bt_ovflsize = NBLEAFDBT(NOVFLSIZE, NOVFLSIZE) + sizeof(indx_t); /* Initialize the buffer pool. */ if ((t->bt_mp = mpool_open(NULL, t->bt_fd, vtable, t->bt_psize, ncache)) == NULL) goto err; if (!F_ISSET(t, B_INMEM)) mpool_filter(t->bt_mp, __bt_pgin, __bt_pgout, t); /* Create a root page if new tree. */ if (nroot(t) == RET_ERROR) goto err; /* Global flags. */ if (dflags & DB_LOCK) F_SET(t, B_DB_LOCK); if (dflags & DB_SHMEM) F_SET(t, B_DB_SHMEM); if (dflags & DB_TXN) F_SET(t, B_DB_TXN); return (dbp); einval: errno = EINVAL; goto err; eftype: errno = EFTYPE; goto err; err: if (t) { if (t->bt_dbp) free(t->bt_dbp); free(t); } return (NULL); } /* * NROOT -- Create the root of a new tree. * * Parameters: * t: tree * * Returns: * RET_ERROR, RET_SUCCESS */ static int nroot(t) BTREE *t; { PAGE *meta, *root; pgno_t npg; if ((meta = mpool_get(t->bt_mp, 0, 0)) != NULL) { mpool_put(t->bt_mp, meta, 0); return (RET_SUCCESS); } if (errno != EINVAL) /* It's OK to not exist. */ return (RET_ERROR); errno = 0; if ((meta = mpool_new(t->bt_mp, &npg)) == NULL) return (RET_ERROR); if ((root = mpool_new(t->bt_mp, &npg)) == NULL) return (RET_ERROR); if (npg != P_ROOT) return (RET_ERROR); root->pgno = npg; root->prevpg = root->nextpg = P_INVALID; root->lower = BTDATAOFF; root->upper = t->bt_psize; root->flags = P_BLEAF; memset(meta, 0, t->bt_psize); mpool_put(t->bt_mp, meta, MPOOL_DIRTY); mpool_put(t->bt_mp, root, MPOOL_DIRTY); return (RET_SUCCESS); } static int byteorder() { u_int32_t x; u_char *p; x = 0x01020304; p = (u_char *)&x; switch (*p) { case 1: return (BIG_ENDIAN); case 4: return (LITTLE_ENDIAN); default: return (0); } } int __bt_fd(dbp) const DB *dbp; { BTREE *t; t = dbp->internal; /* Toss any page pinned across calls. */ if (t->bt_pinned != NULL) { mpool_put(t->bt_mp, t->bt_pinned, 0); t->bt_pinned = NULL; } return -1; }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/btree/bt_open.c
C
apache-2.0
10,513
/*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Olson. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)bt_overflow.c 8.5 (Berkeley) 7/16/94"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <db.h> #include "btree.h" /* * Big key/data code. * * Big key and data entries are stored on linked lists of pages. The initial * reference is byte string stored with the key or data and is the page number * and size. The actual record is stored in a chain of pages linked by the * nextpg field of the PAGE header. * * The first page of the chain has a special property. If the record is used * by an internal page, it cannot be deleted and the P_PRESERVE bit will be set * in the header. * * XXX * A single DBT is written to each chain, so a lot of space on the last page * is wasted. This is a fairly major bug for some data sets. */ /* * __OVFL_GET -- Get an overflow key/data item. * * Parameters: * t: tree * p: pointer to { pgno_t, u_int32_t } * buf: storage address * bufsz: storage size * * Returns: * RET_ERROR, RET_SUCCESS */ int __ovfl_get(t, p, ssz, buf, bufsz) BTREE *t; void *p; size_t *ssz; void **buf; size_t *bufsz; { PAGE *h; pgno_t pg; size_t nb, plen; u_int32_t sz; memcpy(&pg, p, sizeof(pgno_t)); memcpy(&sz, (char *)p + sizeof(pgno_t), sizeof(u_int32_t)); *ssz = sz; #ifdef DEBUG if (pg == P_INVALID || sz == 0) abort(); #endif /* Make the buffer bigger as necessary. */ if (*bufsz < sz) { *buf = (char *)(*buf == NULL ? malloc(sz) : realloc(*buf, sz)); if (*buf == NULL) return (RET_ERROR); *bufsz = sz; } /* * Step through the linked list of pages, copying the data on each one * into the buffer. Never copy more than the data's length. */ plen = t->bt_psize - BTDATAOFF; for (p = *buf;; p = (char *)p + nb, pg = h->nextpg) { if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) return (RET_ERROR); nb = MIN(sz, plen); memmove(p, (char *)h + BTDATAOFF, nb); mpool_put(t->bt_mp, h, 0); if ((sz -= nb) == 0) break; } return (RET_SUCCESS); } /* * __OVFL_PUT -- Store an overflow key/data item. * * Parameters: * t: tree * data: DBT to store * pgno: storage page number * * Returns: * RET_ERROR, RET_SUCCESS */ int __ovfl_put(t, dbt, pg) BTREE *t; const DBT *dbt; pgno_t *pg; { PAGE *h, *last; void *p; pgno_t npg; size_t nb, plen; u_int32_t sz; /* * Allocate pages and copy the key/data record into them. Store the * number of the first page in the chain. */ plen = t->bt_psize - BTDATAOFF; for (last = NULL, p = dbt->data, sz = dbt->size;; p = (char *)p + plen, last = h) { if ((h = __bt_new(t, &npg)) == NULL) return (RET_ERROR); h->pgno = npg; h->nextpg = h->prevpg = P_INVALID; h->flags = P_OVERFLOW; h->lower = h->upper = 0; nb = MIN(sz, plen); memmove((char *)h + BTDATAOFF, p, nb); if (last) { last->nextpg = h->pgno; mpool_put(t->bt_mp, last, MPOOL_DIRTY); } else *pg = h->pgno; if ((sz -= nb) == 0) { mpool_put(t->bt_mp, h, MPOOL_DIRTY); break; } } return (RET_SUCCESS); } /* * __OVFL_DELETE -- Delete an overflow chain. * * Parameters: * t: tree * p: pointer to { pgno_t, u_int32_t } * * Returns: * RET_ERROR, RET_SUCCESS */ int __ovfl_delete(t, p) BTREE *t; void *p; { PAGE *h; pgno_t pg; size_t plen; u_int32_t sz; memmove(&pg, p, sizeof(pgno_t)); memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(u_int32_t)); #ifdef DEBUG if (pg == P_INVALID || sz == 0) abort(); #endif if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) return (RET_ERROR); /* Don't delete chains used by internal pages. */ if (h->flags & P_PRESERVE) { mpool_put(t->bt_mp, h, 0); return (RET_SUCCESS); } /* Step through the chain, calling the free routine for each page. */ for (plen = t->bt_psize - BTDATAOFF;; sz -= plen) { pg = h->nextpg; __bt_free(t, h); if (sz <= plen) break; if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) return (RET_ERROR); } return (RET_SUCCESS); }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/btree/bt_overflow.c
C
apache-2.0
5,948
/*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)bt_page.c 8.3 (Berkeley) 7/14/94"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> #include <stdio.h> #include <db.h> #include "btree.h" /* * __bt_free -- * Put a page on the freelist. * * Parameters: * t: tree * h: page to free * * Returns: * RET_ERROR, RET_SUCCESS * * Side-effect: * mpool_put's the page. */ int __bt_free(t, h) BTREE *t; PAGE *h; { /* Insert the page at the head of the free list. */ h->prevpg = P_INVALID; h->nextpg = t->bt_free; t->bt_free = h->pgno; F_SET(t, B_METADIRTY); /* Make sure the page gets written back. */ return (mpool_put(t->bt_mp, h, MPOOL_DIRTY)); } /* * __bt_new -- * Get a new page, preferably from the freelist. * * Parameters: * t: tree * npg: storage for page number. * * Returns: * Pointer to a page, NULL on error. */ PAGE * __bt_new(t, npg) BTREE *t; pgno_t *npg; { PAGE *h; if (t->bt_free != P_INVALID && (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) { *npg = t->bt_free; t->bt_free = h->nextpg; F_SET(t, B_METADIRTY); return (h); } return (mpool_new(t->bt_mp, npg)); }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/berkeley-db-1.xx/btree/bt_page.c
C
apache-2.0
2,998